From 74d6ad09bc0053f795e1201762a4501e2b609530 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 18 Jul 2018 16:59:13 +0300 Subject: [PATCH 001/674] OSC/UCX: fixed hang on OSC init - there worked progress was missed on startup which caused hang on one of ranks Signed-off-by: Sergey Oblomov (cherry picked from commit a081fba0465e0e03472fc45c9a4a7154f539e3f6) --- ompi/mca/osc/ucx/osc_ucx.h | 1 + ompi/mca/osc/ucx/osc_ucx_component.c | 62 +++++++++++++++++----------- 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx.h b/ompi/mca/osc/ucx/osc_ucx.h index 095de34c272..44dff95a845 100644 --- a/ompi/mca/osc/ucx/osc_ucx.h +++ b/ompi/mca/osc/ucx/osc_ucx.h @@ -38,6 +38,7 @@ typedef struct ompi_osc_ucx_component { opal_free_list_t requests; /* request free list for the r* communication variants */ bool env_initialized; /* UCX environment is initialized or not */ int num_incomplete_req_ops; + int num_modules; unsigned int priority; } ompi_osc_ucx_component_t; diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index dc6c5f2e44c..ad604fb873f 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -26,6 +26,7 @@ static int component_query(struct ompi_win_t *win, void **base, size_t size, int static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model); +static void ompi_osc_ucx_unregister_progress(void); ompi_osc_ucx_component_t mca_osc_ucx_component = { { /* ompi_osc_base_component_t */ @@ -45,7 +46,12 @@ ompi_osc_ucx_component_t mca_osc_ucx_component = { .osc_query = component_query, .osc_select = component_select, .osc_finalize = component_finalize, - } + }, + .ucp_context = NULL, + .ucp_worker = NULL, + .env_initialized = false, + .num_incomplete_req_ops = 0, + .num_modules = 0 }; ompi_osc_ucx_module_t ompi_osc_ucx_module_template = { @@ -105,24 +111,15 @@ static int component_register(void) { } static int progress_callback(void) { - if (mca_osc_ucx_component.ucp_worker != NULL && - mca_osc_ucx_component.num_incomplete_req_ops > 0) { - ucp_worker_progress(mca_osc_ucx_component.ucp_worker); - } + ucp_worker_progress(mca_osc_ucx_component.ucp_worker); return 0; } static int component_init(bool enable_progress_threads, bool enable_mpi_threads) { - int ret = OMPI_SUCCESS; - - mca_osc_ucx_component.ucp_context = NULL; - mca_osc_ucx_component.ucp_worker = NULL; mca_osc_ucx_component.enable_mpi_threads = enable_mpi_threads; - mca_osc_ucx_component.env_initialized = false; - mca_osc_ucx_component.num_incomplete_req_ops = 0; opal_common_ucx_mca_register(); - return ret; + return OMPI_SUCCESS; } static int component_finalize(void) { @@ -141,7 +138,6 @@ static int component_finalize(void) { assert(mca_osc_ucx_component.num_incomplete_req_ops == 0); if (mca_osc_ucx_component.env_initialized == true) { OBJ_DESTRUCT(&mca_osc_ucx_component.requests); - opal_progress_unregister(progress_callback); ucp_cleanup(mca_osc_ucx_component.ucp_context); mca_osc_ucx_component.env_initialized = false; } @@ -241,6 +237,20 @@ static inline int mem_map(void **base, size_t size, ucp_mem_h *memh_ptr, return ret; } +static void ompi_osc_ucx_unregister_progress() +{ + int ret; + + mca_osc_ucx_component.num_modules--; + OSC_UCX_ASSERT(mca_osc_ucx_component.num_modules >= 0); + if (0 == mca_osc_ucx_component.num_modules) { + ret = opal_progress_unregister(progress_callback); + if (OMPI_SUCCESS != ret) { + OSC_UCX_VERBOSE(1, "opal_progress_unregister failed: %d", ret); + } + } +} + static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, struct ompi_communicator_t *comm, struct opal_info_t *info, int flavor, int *model) { @@ -251,7 +261,7 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in ucs_status_t status; int i, comm_size = ompi_comm_size(comm); int is_eps_ready; - bool progress_registered = false, eps_created = false, env_initialized = false; + bool eps_created = false, env_initialized = false; ucp_address_t *my_addr = NULL; size_t my_addr_len; char *recv_buf = NULL; @@ -328,13 +338,6 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error_nomem; } - ret = opal_progress_register(progress_callback); - progress_registered = true; - if (OMPI_SUCCESS != ret) { - OSC_UCX_VERBOSE(1, "opal_progress_register failed: %d", ret); - goto error; - } - /* query UCP worker attributes */ worker_attr.field_mask = UCP_WORKER_ATTR_FIELD_THREAD_MODE; status = ucp_worker_query(mca_osc_ucx_component.ucp_worker, &worker_attr); @@ -362,6 +365,8 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error_nomem; } + mca_osc_ucx_component.num_modules++; + /* fill in the function pointer part */ memcpy(module, &ompi_osc_ucx_module_template, sizeof(ompi_osc_base_module_t)); @@ -616,6 +621,14 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error; } + OSC_UCX_ASSERT(mca_osc_ucx_component.num_modules > 0); + if (1 == mca_osc_ucx_component.num_modules) { + ret = opal_progress_register(progress_callback); + if (OMPI_SUCCESS != ret) { + OSC_UCX_VERBOSE(1, "opal_progress_register failed: %d", ret); + goto error; + } + } return ret; error: @@ -643,8 +656,10 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in ucp_ep_destroy(ep); } } - if (progress_registered) opal_progress_unregister(progress_callback); - if (module) free(module); + if (module) { + free(module); + ompi_osc_ucx_unregister_progress(); + } error_nomem: if (env_initialized == true) { @@ -812,6 +827,7 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) { ompi_comm_free(&module->comm); free(module); + ompi_osc_ucx_unregister_progress(); return ret; } From 508c3f391f5212869b03d48beb275976ac597364 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 19 Jul 2018 11:02:03 -0700 Subject: [PATCH 002/674] Default to internal PMIx if newer than external Per https://github.com/open-mpi/ompi/issues/5031, if the user didn't specify a particular PMIx installation, then default back to the internal version if it is newer than the discovered external one. PMIx doesn't yet provide a full signature so we have to just get as close as possible for now. Signed-off-by: Ralph Castain (cherry picked from commit 1e6aaf7f226f5a4d940e544079e3977229746c11) --- config/opal_check_pmi.m4 | 15 ++++++++++++--- opal/mca/pmix/ext1x/configure.m4 | 4 +--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/config/opal_check_pmi.m4 b/config/opal_check_pmi.m4 index e74574607b1..345115ad328 100644 --- a/config/opal_check_pmi.m4 +++ b/config/opal_check_pmi.m4 @@ -375,7 +375,7 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ #endif ], [])], [AC_MSG_RESULT([found]) - opal_external_pmix_version=1.2.x + opal_external_pmix_version=1x opal_external_pmix_version_found=1 opal_external_have_pmix1=1 opal_external_pmix_happy=yes], @@ -402,6 +402,15 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AC_MSG_WARN([header/library files were not found]) AC_MSG_ERROR([Cannot continue])]) + # Final check - if they didn't point us explicitly at an external version + # but we found one anyway, use the internal version if it is higher + AS_IF([test "$opal_external_pmix_version" != "internal" && (test -z "$with_pmix" || test "$with_pmix" = "yes")], + [AS_IF([test "$opal_external_pmix_version" != "3x"], + [AC_MSG_WARN([discovered external PMIx version is less than internal version 3.x]) + AC_MSG_WARN([using internal PMIx]) + opal_external_pmix_version=internal + opal_external_pmix_happy=no])]) + AC_MSG_CHECKING([PMIx version to be used]) AS_IF([test "$opal_external_pmix_happy" = "yes"], [AC_MSG_RESULT([external($opal_external_pmix_version)]) @@ -415,8 +424,8 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ [Whether the external PMIx library is v1]) AM_CONDITIONAL([OPAL_WANT_PRUN], [test "$opal_prun_happy" = "yes"]) - AS_IF([test "$opal_external_pmix_version" = "1.2.x"], - [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [$opal_external_pmix_version: WARNING - DYNAMIC OPS NOT SUPPORTED])], + AS_IF([test "$opal_external_pmix_version" = "1x"], + [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [1.2.x: WARNING - DYNAMIC OPS NOT SUPPORTED])], [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [$opal_external_pmix_version])]) OPAL_VAR_SCOPE_POP diff --git a/opal/mca/pmix/ext1x/configure.m4 b/opal/mca/pmix/ext1x/configure.m4 index 16bbf2a502a..abbca782eaa 100644 --- a/opal/mca/pmix/ext1x/configure.m4 +++ b/opal/mca/pmix/ext1x/configure.m4 @@ -33,9 +33,7 @@ AC_DEFUN([MCA_opal_pmix_ext1x_CONFIG],[ AS_IF([test "$opal_external_pmix_happy" = "yes"], [ # check for the 1.x version ( >= 1.1.4 ?) AC_MSG_CHECKING([if external component is version 1.x]) - AS_IF([test "$opal_external_pmix_version" = "11" || - test "$opal_external_pmix_version" = "12" || - test "$opal_external_pmix_version" = "1x"], + AS_IF([test "$opal_external_pmix_version" = "1x"], [AC_MSG_RESULT([yes]) AS_IF([test "$opal_event_external_support" != "yes"], [AC_MSG_WARN([EXTERNAL PMIX SUPPORT REQUIRES USE OF EXTERNAL LIBEVENT]) From 50e6e14020769377e9c00c56c32a0d880e705cbf Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 19 Jul 2018 13:50:12 -0700 Subject: [PATCH 003/674] Protect against infinite loops Flag that we provided a notification and ignore it if it attempts to come back up. Signed-off-by: Ralph Castain (cherry picked from commit ea0d70bc9396def61545e2ce492a55c4c3aa7772) --- orte/orted/pmix/pmix_server_gen.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/orte/orted/pmix/pmix_server_gen.c b/orte/orted/pmix/pmix_server_gen.c index 8993a6cdf0f..2c9d7326fb2 100644 --- a/orte/orted/pmix/pmix_server_gen.c +++ b/orte/orted/pmix/pmix_server_gen.c @@ -356,6 +356,17 @@ void pmix_server_notify(int status, orte_process_name_t* sender, } } + /* protect against infinite loops by marking that this notification was + * passed down to the server by me */ + if (NULL == cd->info) { + cd->info = OBJ_NEW(opal_list_t); + } + val = OBJ_NEW(opal_value_t); + val->key = strdup("orte.notify.donotloop"); + val->type = OPAL_BOOL; + val->data.flag = true; + opal_list_append(cd->info, &val->super); + opal_output_verbose(2, orte_pmix_server_globals.output, "%s NOTIFYING PMIX SERVER OF STATUS %d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ret); @@ -382,6 +393,14 @@ int pmix_server_notify_event(int code, opal_process_name_t *source, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(source), code); + /* check to see if this is one we sent down */ + OPAL_LIST_FOREACH(val, info, opal_value_t) { + if (0 == strcmp(val->key, "orte.notify.donotloop")) { + /* yep - do not process */ + goto done; + } + } + /* a local process has generated an event - we need to xcast it * to all the daemons so it can be passed down to their local * procs */ @@ -448,6 +467,7 @@ int pmix_server_notify_event(int code, opal_process_name_t *source, /* maintain accounting */ OBJ_RELEASE(sig); + done: /* execute the callback */ if (NULL != cbfunc) { cbfunc(ORTE_SUCCESS, cbdata); From af0e7b190ec92f8656662e5cff43f7f2b137beec Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 20 Jul 2018 19:27:58 +0300 Subject: [PATCH 004/674] PML/UCX: fixed ucp request free on persistent request completion - in sine cases persistent request was deleted during completion callback, this cause double free of linked UCX request (assert in debug build or hang in release build) - UCX request is freed prior completion callback Signed-off-by: Sergey Oblomov (cherry picked from commit 6fe0a73861b53efac12e740c831802057391525d) --- ompi/mca/pml/ucx/pml_ucx_request.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx_request.c b/ompi/mca/pml/ucx/pml_ucx_request.c index 05533914a4c..70b379f3eb8 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.c +++ b/ompi/mca/pml/ucx/pml_ucx_request.c @@ -85,10 +85,10 @@ mca_pml_ucx_persistent_request_complete(mca_pml_ucx_persistent_request_t *preq, ompi_request_t *tmp_req) { preq->ompi.req_status = tmp_req->req_status; - ompi_request_complete(&preq->ompi, true); - mca_pml_ucx_persistent_request_detach(preq, tmp_req); mca_pml_ucx_request_reset(tmp_req); + mca_pml_ucx_persistent_request_detach(preq, tmp_req); ucp_request_free(tmp_req); + ompi_request_complete(&preq->ompi, true); } static inline void mca_pml_ucx_preq_completion(ompi_request_t *tmp_req) From ac8d2e01f9b208393c285dcac19455c641a8dbe1 Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Wed, 28 Mar 2018 12:10:12 -0400 Subject: [PATCH 005/674] MTL OFI: MTL_OFI_RETRY_UNTIL_DONE support for Resource overflow - Added support in MTL_OFI_RETRY_UNTIL_DONE to handle -FI_EAGAIN from the provider and correctly attempt to progress the OFI Completion queue by calling ompi_mtl_ofi_progress. - If events were pending that blocked OFI operations from being enqueued they will be completed and the OFI operation will be retried once ompi_mtl_ofi_progress has successfully completed. - Updated MTL_OFI_RETRY_UNTIL_DONE to take a RETURN variable instead of requiring the existance of a "ret" variable to pass back the return value from completing the OFI operation. Signed-off-by: Spruit, Neil R (cherry picked from commit d4f408a7f867b2f7bab84b9c966e1eba59f59e0e) --- ompi/mca/mtl/ofi/mtl_ofi.h | 46 +++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 45a66673d11..539533e73b9 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -40,13 +40,6 @@ #include "mtl_ofi_endpoint.h" #include "mtl_ofi_compat.h" -#define MTL_OFI_RETRY_UNTIL_DONE(FUNC) \ - do { \ - do { \ - ret = FUNC; \ - if(OPAL_LIKELY(0 == ret)) {break;} \ - } while(-FI_EAGAIN == ret); \ - } while(0); BEGIN_C_DECLS @@ -134,6 +127,24 @@ ompi_mtl_ofi_progress(void) return count; } +/** + * When attempting to execute an OFI operation we need to handle + * resource overrun cases. When a call to an OFI OP fails with -FI_EAGAIN + * the OFI mtl will attempt to progress any pending Completion Queue + * events that may prevent additional operations to be enqueued. + * If the call to ofi progress is successful, then the function call + * will be retried. + */ +#define MTL_OFI_RETRY_UNTIL_DONE(FUNC, RETURN) \ + do { \ + do { \ + RETURN = FUNC; \ + if (OPAL_LIKELY(0 == RETURN)) {break;} \ + if (OPAL_LIKELY(RETURN == -FI_EAGAIN)) { \ + ompi_mtl_ofi_progress(); \ + } \ + } while (OPAL_LIKELY(-FI_EAGAIN == RETURN)); \ + } while (0); /* MTL interface functions */ int ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl); @@ -281,7 +292,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, src_addr, match_bits | ompi_mtl_ofi.sync_send_ack, 0, /* Exact match, no ignore bits */ - (void *) &ack_req->ctx)); + (void *) &ack_req->ctx), ret); if (OPAL_UNLIKELY(0 > ret)) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: fi_trecv failed: %s(%zd)", @@ -302,15 +313,14 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, length, comm->c_my_rank, endpoint->peer_fiaddr, - match_bits)); + match_bits), ret); } else { MTL_OFI_RETRY_UNTIL_DONE(fi_tinject(ompi_mtl_ofi.ep, start, length, endpoint->peer_fiaddr, - match_bits)); + match_bits), ret); } - if (OPAL_UNLIKELY(0 > ret)) { char *fi_api = ompi_mtl_ofi.fi_cq_data ? "fi_tinjectddata" : "fi_tinject"; opal_output_verbose(1, ompi_mtl_base_framework.framework_output, @@ -334,7 +344,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, comm->c_my_rank, endpoint->peer_fiaddr, match_bits, - (void *) &ofi_req->ctx)); + (void *) &ofi_req->ctx), ret); } else { MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ep, start, @@ -342,7 +352,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, NULL, endpoint->peer_fiaddr, match_bits, - (void *) &ofi_req->ctx)); + (void *) &ofi_req->ctx), ret); } if (OPAL_UNLIKELY(0 > ret)) { char *fi_api = ompi_mtl_ofi.fi_cq_data ? "fi_tsendddata" : "fi_send"; @@ -517,7 +527,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, tagged_msg.data = 0; MTL_OFI_RETRY_UNTIL_DONE(fi_tsendmsg(ompi_mtl_ofi.ep, - &tagged_msg, 0)); + &tagged_msg, 0), ret); if (OPAL_UNLIKELY(0 > ret)) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: fi_tsendmsg failed: %s(%zd)", @@ -621,7 +631,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, remote_addr, match_bits, mask_bits, - (void *)&ofi_req->ctx)); + (void *)&ofi_req->ctx), ret); if (OPAL_UNLIKELY(0 > ret)) { if (NULL != ofi_req->buffer) { free(ofi_req->buffer); @@ -734,7 +744,7 @@ ompi_mtl_ofi_imrecv(struct mca_mtl_base_module_t *mtl, msg.context = (void *)&ofi_req->ctx; msg.data = 0; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags)); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); if (OPAL_UNLIKELY(0 > ret)) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: fi_trecvmsg failed: %s(%zd)", @@ -833,7 +843,7 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, ofi_req.completion_count = 1; ofi_req.match_state = 0; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags)); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); if (-FI_ENOMSG == ret) { /** * The search request completed but no matching message was found. @@ -928,7 +938,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, ofi_req->match_state = 0; ofi_req->mask_bits = mask_bits; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags)); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); if (-FI_ENOMSG == ret) { /** * The search request completed but no matching message was found. From b6bd3d33f1e1fa4308c5c6b1b30e1f0a292ad2fb Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 23 Jul 2018 12:55:03 -0600 Subject: [PATCH 006/674] btl/uct: fix compile warnings/errors Signed-off-by: Nathan Hjelm (cherry picked from commit 47ed8e8830749b6b59c84592c15b7576ea164f0c) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct.h | 1 - opal/mca/btl/uct/btl_uct_am.h | 6 ++++++ opal/mca/btl/uct/btl_uct_component.c | 8 ++++---- opal/mca/btl/uct/btl_uct_endpoint.c | 4 ++-- opal/mca/btl/uct/btl_uct_endpoint.h | 4 ++-- opal/mca/btl/uct/btl_uct_module.c | 7 ++++--- opal/mca/btl/uct/btl_uct_tl.c | 12 +++++++----- opal/mca/btl/uct/configure.m4 | 11 +++++++++++ 8 files changed, 36 insertions(+), 17 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index 0a896dd736e..00e8d4383c8 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -38,7 +38,6 @@ #include "opal/class/opal_hash_table.h" #include "opal/mca/pmix/pmix.h" #include "opal/threads/tsd.h" -#include #include #include "btl_uct_types.h" diff --git a/opal/mca/btl/uct/btl_uct_am.h b/opal/mca/btl/uct/btl_uct_am.h index 07d7223eab5..97cf46bb66a 100644 --- a/opal/mca/btl/uct/btl_uct_am.h +++ b/opal/mca/btl/uct/btl_uct_am.h @@ -14,6 +14,12 @@ #include "btl_uct_frag.h" +struct mca_btl_base_descriptor_t *mca_btl_uct_prepare_src (mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + opal_convertor_t *convertor, + uint8_t order, size_t reserve, + size_t *size, uint32_t flags); + int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, opal_convertor_t *convertor, void *header, size_t header_size, size_t payload_size, uint8_t order, uint32_t flags, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t **descriptor); diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index aa88fe82d0d..58da56dd5a9 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -190,7 +190,7 @@ static int mca_btl_uct_modex_send (void) uint8_t *modex_data; int rc; - for (unsigned i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { + for (int i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { modex_size += mca_btl_uct_module_modex_size (mca_btl_uct_component.modules[i]); } @@ -199,7 +199,7 @@ static int mca_btl_uct_modex_send (void) modex->module_count = mca_btl_uct_component.module_count; - for (unsigned i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { + for (int i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { mca_btl_uct_module_t *module = mca_btl_uct_component.modules[i]; size_t name_len = strlen (module->md_name); @@ -434,7 +434,7 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, return base_modules; } -int mca_btl_uct_tl_progress (mca_btl_uct_tl_t *tl, int starting_index) +static int mca_btl_uct_tl_progress (mca_btl_uct_tl_t *tl, int starting_index) { unsigned int ret = 0; @@ -488,7 +488,7 @@ static int mca_btl_uct_component_progress (void) int starting_index = mca_btl_uct_get_context_index (); unsigned ret = 0; - for (unsigned i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { + for (int i = 0 ; i < mca_btl_uct_component.module_count ; ++i) { mca_btl_uct_module_t *module = mca_btl_uct_component.modules[i]; /* unlike ucp, uct actually tells us something useful! its almost like it was "inspired" diff --git a/opal/mca/btl/uct/btl_uct_endpoint.c b/opal/mca/btl/uct/btl_uct_endpoint.c index e0dd6eee50a..286326d8fe9 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.c +++ b/opal/mca/btl/uct/btl_uct_endpoint.c @@ -312,8 +312,8 @@ int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t *uct_btl, mca_btl_uct_end return OPAL_ERR_UNREACH; } - BTL_VERBOSE(("checking endpoint %p with context id %d. cached uct ep: %p, ready: %d", endpoint, context_id, - tl_endpoint->uct_ep, !!(MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & tl_endpoint->flags))); + BTL_VERBOSE(("checking endpoint %p with context id %d. cached uct ep: %p, ready: %d", (void *) endpoint, context_id, + (void *) tl_endpoint->uct_ep, !!(MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & tl_endpoint->flags))); opal_mutex_lock (&endpoint->ep_lock); if (MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & tl_endpoint->flags) { diff --git a/opal/mca/btl/uct/btl_uct_endpoint.h b/opal/mca/btl/uct/btl_uct_endpoint.h index f8d5e6f522d..9a264bddbb8 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.h +++ b/opal/mca/btl/uct/btl_uct_endpoint.h @@ -31,8 +31,8 @@ BEGIN_C_DECLS mca_btl_base_endpoint_t *mca_btl_uct_endpoint_create (opal_proc_t *proc); int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint, int ep_index, void *ep_addr, int tl_index); -static int mca_btl_uct_endpoint_test_am (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint, - mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle) +static inline int mca_btl_uct_endpoint_test_am (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint, + mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle) { int tl_index = module->am_tl->tl_index; int ep_index = context->context_id; diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index 245c3eddd12..aa69ebb73c8 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -62,7 +62,7 @@ struct mca_btl_base_endpoint_t *mca_btl_uct_get_ep (struct mca_btl_base_module_t break; } - BTL_VERBOSE(("endpoint initialized. new endpoint: %p", ep)); + BTL_VERBOSE(("endpoint initialized. new endpoint: %p", (void *) ep)); /* add this endpoint to the connection lookup table */ (void) opal_hash_table_set_value_uint64 (&uct_module->id_to_endpoint, (intptr_t) proc, ep); @@ -344,6 +344,7 @@ mca_btl_uct_module_t mca_btl_uct_module_template = { .btl_flush = mca_btl_uct_flush, .btl_sendi = mca_btl_uct_sendi, + .btl_prepare_src = mca_btl_uct_prepare_src, .btl_send = mca_btl_uct_send, .btl_alloc = mca_btl_uct_alloc, .btl_free = mca_btl_uct_free, @@ -370,12 +371,12 @@ mca_btl_uct_module_t mca_btl_uct_module_template = { OBJ_CLASS_INSTANCE(mca_btl_uct_reg_t, opal_free_list_item_t, NULL, NULL); -void mca_btl_uct_md_construct (mca_btl_uct_md_t *md) +static void mca_btl_uct_md_construct (mca_btl_uct_md_t *md) { md->uct_md = NULL; } -void mca_btl_uct_md_destruct (mca_btl_uct_md_t *md) +static void mca_btl_uct_md_destruct (mca_btl_uct_md_t *md) { if (md->uct_md) { uct_md_close (md->uct_md); diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index 13e51bceacc..7d12a9c452f 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -111,7 +111,6 @@ static uint64_t mca_btl_uct_cap_to_btl_atomic_flag[][2] = { static void mca_btl_uct_module_set_atomic_flags (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl) { uint64_t cap_flags = tl->uct_iface_attr.cap.flags; - uint32_t flags = 0; module->super.btl_atomic_flags = 0; @@ -173,7 +172,7 @@ static ucs_status_t mca_btl_uct_conn_req_cb (void *arg, void *data, size_t lengt int32_t ep_flags; int rc; - BTL_VERBOSE(("got connection request for endpoint %p. length = %lu", endpoint, length)); + BTL_VERBOSE(("got connection request for endpoint %p. length = %lu", (void *) endpoint, length)); if (NULL == endpoint) { BTL_ERROR(("could not create endpoint for connection request")); @@ -200,7 +199,6 @@ static ucs_status_t mca_btl_uct_conn_req_cb (void *arg, void *data, size_t lengt * an endpoint can be used. */ if ((ep_flags & (MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REM_READY | MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC)) == (MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REM_READY | MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC)) { - mca_btl_uct_device_context_t *tl_context = mca_btl_uct_module_get_tl_context_specific (module, module->comm_tls[req->tl_index], req->context_id); mca_btl_uct_base_frag_t *frag; /* to avoid a race with send adding pending frags grab the lock here */ @@ -280,13 +278,17 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * break; } - BTL_VERBOSE(("enabling progress for tl %p context id %d", tl, context_id)); + BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); +#if HAVE_DECL_UCT_PROGRESS_THREAD_SAFE uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_THREAD_SAFE | UCT_PROGRESS_SEND | UCT_PROGRESS_RECV); +#else + uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_SEND | UCT_PROGRESS_RECV); +#endif if (context_id > 0 && tl == module->am_tl) { - BTL_VERBOSE(("installing AM handler for tl %p context id %d", tl, context_id)); + BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, context, UCT_CB_FLAG_SYNC); } diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index dbeabe2f5f7..23deed6c2e6 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -33,6 +33,17 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ OMPI_CHECK_UCX([btl_uct], [btl_uct_happy="yes"], [btl_uct_happy="no"]) + if test "$btl_uct_happy" = "yes" ; then + OPAL_VAR_SCOPE_PUSH([CPPFLAGS_save]) + + CPPFLAGS_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $btl_uct_CPPFLAGS" + + AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE], [], [], [[#include ]]) + + CPPFLAGS="$CPPFLAGS_save" + OPAL_VAR_SCOPE_POP + fi AS_IF([test "$btl_uct_happy" = "yes"], [$1 From aa7a4d0f6fd8bde3774cd3ba67dccfcc51562f35 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 11 Jul 2018 11:26:37 +0900 Subject: [PATCH 007/674] hwloc: prefer external hwloc component Signed-off-by: Gilles Gouaillardet Signed-off-by: Jeff Squyres (cherry picked from commit open-mpi/ompi@ce2c9fffd421036f46c3d35c1c85439d57538ca6) --- opal/mca/hwloc/external/configure.m4 | 142 +++++++++++++++------------ opal/mca/hwloc/hwloc201/configure.m4 | 4 +- 2 files changed, 79 insertions(+), 67 deletions(-) diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 index d1b4a1380b7..24721f514c9 100644 --- a/opal/mca/hwloc/external/configure.m4 +++ b/opal/mca/hwloc/external/configure.m4 @@ -1,7 +1,7 @@ # -*- shell-script -*- # # Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved -# Copyright (c) 2014-2017 Research Organization for Information Science +# Copyright (c) 2014-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # # Copyright (c) 2018 Intel, Inc. All rights reserved. @@ -84,7 +84,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile]) - OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want opal_hwloc_external_tmp opal_hwloc_external_lstopo]) + OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_tmp opal_hwloc_external_lstopo opal_hwloc_summary_msg]) AC_ARG_WITH([hwloc-libdir], [AC_HELP_STRING([--with-hwloc-libdir=DIR], @@ -98,19 +98,9 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ AC_MSG_WARN([were specified, which does not make sense.]) AC_MSG_ERROR([Cannot continue])]) - # Do we want this external component? (slightly redundant logic, - # but hopefully slightly more clear...) - opal_hwloc_external_want=no - AS_IF([test "$with_hwloc_libdir" != ""], [opal_hwloc_external_want=yes]) - AS_IF([test "$with_hwloc" = "external"], [opal_hwloc_external_want=yes]) - AS_IF([test "$with_hwloc" != "" && \ - test "$with_hwloc" != "no" && \ - test "$with_hwloc" != "internal" && \ - test "$with_hwloc" != "future"], [opal_hwloc_external_want=yes]) - AS_IF([test "$with_hwloc" = "no"], [opal_hwloc_external_want=no]) - - # If we still want external support, try it - AS_IF([test "$opal_hwloc_external_want" = "yes"], + opal_hwloc_summary_msg="internal" + # Try external support if needed + AS_IF([test "$with_hwloc" != "internal"], [OPAL_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir], [libhwloc.*]) @@ -144,64 +134,86 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ LDFLAGS="$LDFLAGS $opal_hwloc_external_LDFLAGS" LIBS="$LIBS $opal_hwloc_external_LIBS" AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [#include ]) - AC_CHECK_FUNCS([hwloc_topology_dup])]) + AC_CHECK_FUNCS([hwloc_topology_dup]) - CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save - CFLAGS=$opal_hwloc_external_CFLAGS_save - LDFLAGS=$opal_hwloc_external_LDFLAGS_save - LIBS=$opal_hwloc_external_LIBS_save - ]) - - # Done! - AS_IF([test "$opal_hwloc_external_support" = "yes"], - [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION], - [external], - [Version of hwloc]) - - # See if the external hwloc supports XML - AC_MSG_CHECKING([if external hwloc supports XML]) - AS_IF([test "$opal_hwloc_dir" != ""], - [opal_hwloc_external_lstopo="$opal_hwloc_dir/bin/lstopo"], - [OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)]) - opal_hwloc_external_tmp=`$opal_hwloc_external_lstopo --help | $GREP "Supported output file formats" | grep xml` - AS_IF([test "$opal_hwloc_external_tmp" = ""], - [opal_hwloc_external_enable_xml=0 - AC_MSG_RESULT([no])], - [opal_hwloc_external_enable_xml=1 - AC_MSG_RESULT([yes])]) - - AC_CHECK_HEADERS([infiniband/verbs.h]) - - AC_MSG_CHECKING([if external hwloc version is 1.5 or greater]) - AS_IF([test "$opal_hwloc_dir" != ""], - [opal_hwloc_external_CFLAGS_save=$CFLAGS - CFLAGS="-I$opal_hwloc_dir/include $opal_hwloc_external_CFLAGS_save"]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[ + AC_MSG_CHECKING([if external hwloc version is 1.5 or greater]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ #if HWLOC_API_VERSION < 0x00010500 #error "hwloc API version is less than 0x00010500" #endif - ]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Cannot continue])]) - - AS_IF([test "$opal_hwloc_dir" != ""], - [CFLAGS=$opal_hwloc_external_CFLAGS_save]) + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + opal_hwloc_external_support=no])]) - # These flags need to get passed to the wrapper compilers - # (this is unnecessary for the internal/embedded hwloc) + # If external hwloc is not explicitly requested, check external version + # is not lower than the internal one + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [AS_IF([test -z "$with_hwloc" || test "$with_hwloc" = "yes"], + [AC_MSG_CHECKING([if external hwloc version is 2.0 or greater]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ +#if HWLOC_API_VERSION < 0x00020000 +#error "hwloc API version is less than 0x00020000" +#endif + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + opal_hwloc_summary_msg="internal (external hlwoc version is less than internal version 2.0)" + AC_MSG_WARN([external hwloc version is less than internal version 2.0]) + AC_MSG_WARN([using internal hwloc]) + opal_hwloc_external_support=no])])]) - # Finally, add some flags to the wrapper compiler if we're - # building with developer headers so that our headers can - # be found. - hwloc_external_WRAPPER_EXTRA_CPPFLAGS=$opal_hwloc_external_CPPFLAGS - hwloc_external_WRAPPER_EXTRA_LDFLAGS=$opal_hwloc_external_LDFLAGS - hwloc_external_WRAPPER_EXTRA_LIBS=$opal_hwloc_external_LIBS + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION], + [external], + [Version of hwloc]) + + # See if the external hwloc supports XML + AC_MSG_CHECKING([if external hwloc supports XML]) + AS_IF([test "$opal_hwloc_dir" != ""], + [opal_hwloc_external_lstopo="$opal_hwloc_dir/bin/lstopo"], + [OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)]) + opal_hwloc_external_tmp=`$opal_hwloc_external_lstopo --help | $GREP "Supported output file formats" | grep xml` + AS_IF([test "$opal_hwloc_external_tmp" = ""], + [opal_hwloc_external_enable_xml=0 + AC_MSG_RESULT([no])], + [opal_hwloc_external_enable_xml=1 + AC_MSG_RESULT([yes])]) + + AC_CHECK_HEADERS([infiniband/verbs.h]) + + # These flags need to get passed to the wrapper compilers + # (this is unnecessary for the internal/embedded hwloc) + + # Finally, add some flags to the wrapper compiler if we're + # building with developer headers so that our headers can + # be found. + hwloc_external_WRAPPER_EXTRA_CPPFLAGS=$opal_hwloc_external_CPPFLAGS + hwloc_external_WRAPPER_EXTRA_LDFLAGS=$opal_hwloc_external_LDFLAGS + hwloc_external_WRAPPER_EXTRA_LIBS=$opal_hwloc_external_LIBS]) + + CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save + CFLAGS=$opal_hwloc_external_CFLAGS_save + LDFLAGS=$opal_hwloc_external_LDFLAGS_save + LIBS=$opal_hwloc_external_LIBS_save + ]) + # Done! + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [opal_hwloc_summary_msg="external" $1], - [$2]) + [# Abort is external hwloc was explicitly requested but cannot be built + AS_IF([test "$with_hwloc" != internal && + test -n "$with_hwloc"], + [AC_MSG_WARN([external hwloc cannot be built]) + AC_MSG_ERROR([Cannot continue.])]) + $2]) + + OPAL_SUMMARY_ADD([[Miscellaneous]],[[HWLOC support]], [], [$opal_hwloc_summary_msg]) AC_SUBST(opal_hwloc_external_LDFLAGS) AC_SUBST(opal_hwloc_external_LIBS) diff --git a/opal/mca/hwloc/hwloc201/configure.m4 b/opal/mca/hwloc/hwloc201/configure.m4 index b6e60bc11e3..33f55b0d442 100644 --- a/opal/mca/hwloc/hwloc201/configure.m4 +++ b/opal/mca/hwloc/hwloc201/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved # Copyright (c) 2014-2017 Intel, Inc. All rights reserved. -# Copyright (c) 2015-2017 Research Organization for Information Science +# Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 Los Alamos National Security, LLC. All rights # reserved. @@ -17,7 +17,7 @@ # # Priority # -AC_DEFUN([MCA_opal_hwloc_hwloc201_PRIORITY], [90]) +AC_DEFUN([MCA_opal_hwloc_hwloc201_PRIORITY], [80]) # # Force this component to compile in static-only mode From 6f5a4534922ec62a8fda2b1027cd4e1a7dd796be Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 17 Jul 2018 18:12:37 -0700 Subject: [PATCH 008/674] event: trivial comment change Switch from #-style to dnl-style. Signed-off-by: Jeff Squyres (cherry picked from commit open-mpi/ompi@83e4a45a9f4c873cbde79478baef9b93f29f8799) --- opal/mca/event/configure.m4 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/opal/mca/event/configure.m4 b/opal/mca/event/configure.m4 index f8040446009..407b7a52a2b 100644 --- a/opal/mca/event/configure.m4 +++ b/opal/mca/event/configure.m4 @@ -1,6 +1,6 @@ dnl -*- shell-script -*- dnl -dnl Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -8,12 +8,12 @@ dnl dnl $HEADER$ dnl -# There will only be one component used in this framework, and it will -# be selected at configure time by priority. Components must set -# their priorities in their configure.m4 files. They must also set -# the shell variable $opal_event_base_include to a header file name -# (relative to opal/mca/event) that will be included in -# opal/mca/event/event.h. +dnl There will only be one component used in this framework, and it will +dnl be selected at configure time by priority. Components must set +dnl their priorities in their configure.m4 files. They must also set +dnl the shell variable $opal_event_base_include to a header file name +dnl (relative to opal/mca/event) that will be included in +dnl opal/mca/event/event.h. dnl We only want one winning component (vs. STOP_AT_FIRST_PRIORITY, dnl which will allow all components of the same priority who succeed to From 1ea021933f38c9cdfafbc4ffee3ae35c63a39b96 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 17 Jul 2018 18:14:33 -0700 Subject: [PATCH 009/674] event/external: prefer external event component Signed-off-by: Jeff Squyres (cherry picked from commit open-mpi/ompi@a70ecf526773a3bc43b582f8d44e91b5def374e1) --- opal/mca/event/configure.m4 | 31 +++++ opal/mca/event/external/configure.m4 | 189 ++++++++++++++------------- 2 files changed, 132 insertions(+), 88 deletions(-) diff --git a/opal/mca/event/configure.m4 b/opal/mca/event/configure.m4 index 407b7a52a2b..5fde182b4cf 100644 --- a/opal/mca/event/configure.m4 +++ b/opal/mca/event/configure.m4 @@ -18,11 +18,42 @@ dnl opal/mca/event/event.h. dnl We only want one winning component (vs. STOP_AT_FIRST_PRIORITY, dnl which will allow all components of the same priority who succeed to dnl win) + m4_define(MCA_opal_event_CONFIGURE_MODE, STOP_AT_FIRST) +dnl +dnl Setup --with-libevent and --with-libevent-libdir +dnl +AC_DEFUN([MCA_opal_event_SETUP],[ + AC_ARG_WITH([libevent], + [AC_HELP_STRING([--with-libevent=DIR], + [Search for libevent headers and libraries in DIR. Should only be used if an external copy of libevent is being used.])]) + + # Bozo check + AS_IF([test "$with_libevent" = "no"], + [AC_MSG_WARN([It is not possible to configure Open MPI --without-libevent]) + AC_MSG_ERROR([Cannot continue])]) + AS_IF([test "$with_libevent" = "yes"], + [with_libevent=]) + + AC_ARG_WITH([libevent-libdir], + [AC_HELP_STRING([--with-libevent-libdir=DIR], + [Search for libevent libraries in DIR. Should only be used if an external copy of libevent is being used.])]) + + # Make sure the user didn't specify --with-libevent=internal and + # --with-libevent-libdir=whatever (because you can only specify + # --with-libevent-libdir when external libevent is being used). + AS_IF([test "$with_libevent" = "internal" && test -n "$with_libevent_libdir"], + [AC_MSG_WARN([Both --with-libevent=internal and --with-libevent-libdir=DIR]) + AC_MSG_WARN([were specified, which does not make sense.]) + AC_MSG_ERROR([Cannot continue])]) +]) + AC_DEFUN([MCA_opal_event_CONFIG],[ opal_event_base_include= + MCA_opal_event_SETUP + # configure all the components MCA_CONFIGURE_FRAMEWORK($1, $2, 1) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 498af38b405..2ba19aa8a14 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -1,8 +1,8 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2015-2017 Research Organization for Information Science +# Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # # Copyright (c) 2017 Intel, Inc. All rights reserved. @@ -56,72 +56,59 @@ AC_DEFUN([MCA_opal_event_external_POST_CONFIG],[ AC_DEFUN([MCA_opal_event_external_CONFIG],[ AC_CONFIG_FILES([opal/mca/event/external/Makefile]) - OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save]) - - AC_ARG_WITH([libevent], - [AC_HELP_STRING([--with-libevent=DIR], - [Search for libevent headers and libraries in DIR. Should only be used if an external copy of libevent is being used.])]) - - # Bozo check - AS_IF([test "$with_libevent" = "no"], - [AC_MSG_WARN([It is not possible to configure Open MPI --without-libevent]) - AC_MSG_ERROR([Cannot continue])]) - - AC_ARG_WITH([libevent-libdir], - [AC_HELP_STRING([--with-libevent-libdir=DIR], - [Search for libevent libraries in DIR. Should only be used if an external copy of libevent is being used.])]) - - # Make sure the user didn't specify --with-libevent=internal and - # --with-libevent-libdir=whatever (because you can only specify - # --with-libevent-libdir when external libevent is being used). - AS_IF([test "$with_libevent" = "internal" && test -n "$with_libevent_libdir"], - [AC_MSG_WARN([Both --with-libevent=internal and --with-libevent-libdir=DIR]) - AC_MSG_WARN([were specified, which does not make sense.]) - AC_MSG_ERROR([Cannot continue])]) - - # Do we want this external component? (slightly redundant logic, - # but hopefully slightly more clear...) - opal_event_external_want=no - AS_IF([test "$with_libevent" = "external"], [opal_event_external_want=yes]) - AS_IF([test -n "$with_libevent_libdir"], [opal_event_external_want=yes]) - AS_IF([test -n "$with_libevent" && test "$with_libevent" != "no" && test "$with_libevent" != "internal"], [opal_event_external_want=yes]) - - # If we want external support, try it - AS_IF([test "$opal_event_external_want" = "yes"], - [ # Error out if the specified dir does not exist - OPAL_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir], - [libevent.*]) - - AC_MSG_CHECKING([for external libevent in]) - AS_IF([test "$with_libevent" != "external" && test "$with_libevent" != "yes"], - [opal_event_dir=$with_libevent - AC_MSG_RESULT([$opal_event_dir]) - OPAL_CHECK_WITHDIR([libevent], [$opal_event_dir], - [include/event.h]) - AS_IF([test -z "$with_libevent_libdir" || test "$with_libevent_libdir" = "yes"], - [AC_MSG_CHECKING([for $with_libevent/lib64]) - AS_IF([test -d "$with_libevent/lib64"], - [opal_event_libdir_found=yes - AC_MSG_RESULT([found])], - [opal_event_libdir_found=no - AC_MSG_RESULT([not found])]) - AS_IF([test "$opal_event_libdir_found" = "yes"], - [opal_event_libdir="$with_libevent/lib64"], - [AC_MSG_CHECKING([for $with_libevent/lib]) - AS_IF([test -d "$with_libevent/lib"], - [AC_MSG_RESULT([found]) - opal_event_libdir="$with_libevent/lib"], - [AC_MSG_RESULT([not found]) - AC_MSG_WARN([Library directories were not found:]) - AC_MSG_WARN([ $with_libevent/lib64]) - AC_MSG_WARN([ $with_libevent/lib]) - AC_MSG_WARN([Please use --with-libevent-libdir to identify it.]) - AC_MSG_ERROR([Cannot continue])])])])], - [AC_MSG_RESULT([(default search paths)])]) - AS_IF([test ! -z "$with_libevent_libdir" && test "$with_libevent_libdir" != "yes"], - [opal_event_libdir="$with_libevent_libdir"]) - - opal_event_external_CPPFLAGS_save=$CPPFLAGS + OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save opal_event_dir opal_event_external_support opal_event_summary_msg]) + + # Make some processing below easier ($with_libevent==yes and + # $with_libevent==no has already been filtered out). + AS_IF([test "$with_libevent" = "external"], + [with_libevent=]) + + opal_event_summary_msg="internal" + + # Once we get to this point, $with_libevent is either: blank, a + # directory location, or "internal". + + # Check the value of $with_libevent_libdir. This macro safely + # handles "yes", "no", blank, and directory name values. + OPAL_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir], + [libevent.*]) + + # Did the user want us to check for libevent in a specific location? + AC_MSG_CHECKING([for external libevent in]) + AS_IF([test -n "$with_libevent" && \ + test "$with_libevent" != "external" && \ + test "$with_libevent" != "internal" && \ + test "$with_libevent" != "yes" && \ + test "$with_libevent" != "no"], + [opal_event_dir=$with_libevent + AC_MSG_RESULT([$opal_event_dir]) + OPAL_CHECK_WITHDIR([libevent], [$opal_event_dir], + [include/event.h]) + AS_IF([test -z "$with_libevent_libdir" || test "$with_libevent_libdir" = "yes"], + [AC_MSG_CHECKING([for $with_libevent/lib64]) + AS_IF([test -d "$with_libevent/lib64"], + [opal_event_libdir_found=yes + AC_MSG_RESULT([found])], + [opal_event_libdir_found=no + AC_MSG_RESULT([not found])]) + AS_IF([test "$opal_event_libdir_found" = "yes"], + [opal_event_libdir="$with_libevent/lib64"], + [AC_MSG_CHECKING([for $with_libevent/lib]) + AS_IF([test -d "$with_libevent/lib"], + [AC_MSG_RESULT([found]) + opal_event_libdir="$with_libevent/lib"], + [AC_MSG_RESULT([not found]) + AC_MSG_WARN([Library directories were not found:]) + AC_MSG_WARN([ $with_libevent/lib64]) + AC_MSG_WARN([ $with_libevent/lib]) + AC_MSG_WARN([Please use --with-libevent-libdir to identify it.]) + AC_MSG_ERROR([Cannot continue])])])])], + [AC_MSG_RESULT([(default search paths)])]) + AS_IF([test ! -z "$with_libevent_libdir" && test "$with_libevent_libdir" != "yes"], + [opal_event_libdir="$with_libevent_libdir"]) + + AS_IF([test "$with_libevent" != "internal"], + [opal_event_external_CPPFLAGS_save=$CPPFLAGS opal_event_external_CFLAGS_save=$CFLAGS opal_event_external_LDFLAGS_save=$LDFLAGS opal_event_external_LIBS_save=$LIBS @@ -136,23 +123,42 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ [opal_event_external_support=yes], [opal_event_external_support=no]) - # Ensure that this libevent has the symbol - # "evthread_set_lock_callbacks", which will only exist if - # libevent was configured with thread support. - LIBS="$opal_event_external_LDFLAGS $LIBS" - AC_CHECK_LIB([event], [evthread_set_lock_callbacks], - [], - [AC_MSG_WARN([External libevent does not have thread support]) - AC_MSG_WARN([Open MPI requires libevent to be compiled with]) - AC_MSG_WARN([thread support enabled]) - AC_MSG_ERROR([Cannot continue])]) - - AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads], - [], - [AC_MSG_WARN([External libevent does not have thread support]) - AC_MSG_WARN([Open MPI requires libevent to be compiled with]) - AC_MSG_WARN([thread support enabled]) - AC_MSG_ERROR([Cannot continue])]) + AS_IF([test "$opal_event_external_support" = "yes"], + [# Ensure that this libevent has the symbol + # "evthread_set_lock_callbacks", which will only exist if + # libevent was configured with thread support. + LIBS="$opal_event_external_LDFLAGS $LIBS" + AC_CHECK_LIB([event], [evthread_set_lock_callbacks], + [], + [AC_MSG_WARN([External libevent does not have thread support]) + AC_MSG_WARN([Open MPI requires libevent to be compiled with]) + AC_MSG_WARN([thread support enabled]) + opal_event_external_support=no])]) + + AS_IF([test "$opal_event_external_support" = "yes"], + [AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads], + [], + [AC_MSG_WARN([External libevent does not have thread support]) + AC_MSG_WARN([Open MPI requires libevent to be compiled with]) + AC_MSG_WARN([thread support enabled]) + opal_event_external_support=no])]) + + AS_IF([test "$opal_event_external_support" = "yes"], + [AS_IF([test -z "$with_libevent" || test "$with_libevent" = "yes"], + [AC_MSG_CHECKING([if external libevent version is 2.0.21 or greater]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ +#if _EVENT_NUMERIC_VERSION < 0x02001500 +#error "libevent API version is less than 0x02001500" +#endif + ]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + opal_event_summary_msg="internal (external libevent version is less that internal version 2.0.21)" + AC_MSG_WARN([external libevent version is less than internal version (2.0.21)]) + AC_MSG_WARN([using internal libevent]) + opal_event_external_support=no])])]) CPPFLAGS=$opal_event_external_CPPFLAGS_save CFLAGS=$opal_event_external_CFLAGS_save @@ -171,20 +177,27 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ # building with developer headers so that our headers can # be found. event_external_WRAPPER_EXTRA_LDFLAGS=$opal_event_external_LDFLAGS - event_external_WRAPPER_EXTRA_LIBS=$opal_event_external_LIBS - ]) + event_external_WRAPPER_EXTRA_LIBS=$opal_event_external_LIBS]) + +################################################################## # Done! AS_IF([test "$opal_event_external_support" = "yes"], - [ # If we configured successfully, set + [# If we configured successfully, set # OPAL_HAVE_WORKING_EVENTOPS to 1 (it's a calculated value # in the embedded Open MPI libevent, so we can only assume # what it is in the installed libevent :-\ ). file=$opal_event_dir/include/libevent/config.h OPAL_HAVE_WORKING_EVENTOPS=1 + opal_event_summary_msg="external" $1], [OPAL_HAVE_WORKING_EVENTOPS=0 + AS_IF([test "$with_libevent" != internal && test -n "$with_libevent"], + [AC_MSG_WARN([external libevent requested but cannot be built]) + AC_MSG_ERROR([Cannot continue.])]) $2]) + OPAL_SUMMARY_ADD([[Miscellaneous]],[[Libevent support]], [], [$opal_event_summary_msg]) + OPAL_VAR_SCOPE_POP ])dnl From 2c2f9b8169995775956e5a66cf6f7924ad8f335f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 23 Jul 2018 09:18:48 -0700 Subject: [PATCH 010/674] Leave opal_event_external_support exposed as global var Signed-off-by: Ralph Castain (cherry picked from commit open-mpi/ompi@5cab823979e785b77520b439fbfbc941b8741dc9) --- opal/mca/event/external/configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 2ba19aa8a14..232f149abbd 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -5,7 +5,7 @@ # Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -56,7 +56,7 @@ AC_DEFUN([MCA_opal_event_external_POST_CONFIG],[ AC_DEFUN([MCA_opal_event_external_CONFIG],[ AC_CONFIG_FILES([opal/mca/event/external/Makefile]) - OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save opal_event_dir opal_event_external_support opal_event_summary_msg]) + OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save opal_event_dir opal_event_summary_msg]) # Make some processing below easier ($with_libevent==yes and # $with_libevent==no has already been filtered out). From 58b7786b7057a52e08ae728a6894219d29830592 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 24 Jul 2018 08:48:21 +0300 Subject: [PATCH 011/674] MCA/ATOMIC: atomic_init renamed to atomic_startup - there is C11 naming conflict - atomic_init is C macro which cause building issue Signed-off-by: Sergey Oblomov (cherry picked from commit 3295b238008a6b2e27941c60d757e64ad796fea2) --- oshmem/mca/atomic/atomic.h | 2 +- oshmem/mca/atomic/base/atomic_base_available.c | 2 +- oshmem/mca/atomic/basic/atomic_basic.h | 2 +- oshmem/mca/atomic/basic/atomic_basic_component.c | 2 +- oshmem/mca/atomic/basic/atomic_basic_module.c | 2 +- oshmem/mca/atomic/mxm/atomic_mxm.h | 2 +- oshmem/mca/atomic/mxm/atomic_mxm_component.c | 2 +- oshmem/mca/atomic/mxm/atomic_mxm_module.c | 2 +- oshmem/mca/atomic/ucx/atomic_ucx.h | 2 +- oshmem/mca/atomic/ucx/atomic_ucx_component.c | 2 +- oshmem/mca/atomic/ucx/atomic_ucx_module.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/oshmem/mca/atomic/atomic.h b/oshmem/mca/atomic/atomic.h index 68e44b58409..912f2a71955 100644 --- a/oshmem/mca/atomic/atomic.h +++ b/oshmem/mca/atomic/atomic.h @@ -135,7 +135,7 @@ struct mca_atomic_base_component_1_0_0_t { mca_base_component_data_t atomic_data; /** Component initialization function */ - mca_atomic_base_component_init_fn_t atomic_init; + mca_atomic_base_component_init_fn_t atomic_startup; mca_atomic_base_component_finalize_fn_t atomic_finalize; mca_atomic_base_component_query_fn_t atomic_query; diff --git a/oshmem/mca/atomic/base/atomic_base_available.c b/oshmem/mca/atomic/base/atomic_base_available.c index a3fe99a2aa2..927e1fe7798 100644 --- a/oshmem/mca/atomic/base/atomic_base_available.c +++ b/oshmem/mca/atomic/base/atomic_base_available.c @@ -104,7 +104,7 @@ static int init_query(const mca_base_component_t * component, mca_atomic_base_component_t *atomic = (mca_atomic_base_component_t *) component; - ret = atomic->atomic_init(enable_progress_threads, enable_threads); + ret = atomic->atomic_startup(enable_progress_threads, enable_threads); } else { /* Unrecognized coll API version */ diff --git a/oshmem/mca/atomic/basic/atomic_basic.h b/oshmem/mca/atomic/basic/atomic_basic.h index ee1bd0df01d..b581f855052 100644 --- a/oshmem/mca/atomic/basic/atomic_basic.h +++ b/oshmem/mca/atomic/basic/atomic_basic.h @@ -31,7 +31,7 @@ OSHMEM_DECLSPEC void atomic_basic_unlock(shmem_ctx_t ctx, int pe); /* API functions */ -int mca_atomic_basic_init(bool enable_progress_threads, bool enable_threads); +int mca_atomic_basic_startup(bool enable_progress_threads, bool enable_threads); int mca_atomic_basic_finalize(void); mca_atomic_base_module_t* mca_atomic_basic_query(int *priority); diff --git a/oshmem/mca/atomic/basic/atomic_basic_component.c b/oshmem/mca/atomic/basic/atomic_basic_component.c index 0d760cc7d3b..fc688164c2d 100644 --- a/oshmem/mca/atomic/basic/atomic_basic_component.c +++ b/oshmem/mca/atomic/basic/atomic_basic_component.c @@ -62,7 +62,7 @@ mca_atomic_base_component_t mca_atomic_basic_component = { /* Initialization / querying functions */ - .atomic_init = mca_atomic_basic_init, + .atomic_startup = mca_atomic_basic_startup, .atomic_finalize = mca_atomic_basic_finalize, .atomic_query = mca_atomic_basic_query, }; diff --git a/oshmem/mca/atomic/basic/atomic_basic_module.c b/oshmem/mca/atomic/basic/atomic_basic_module.c index a6d35d46983..1b8a1b102b9 100644 --- a/oshmem/mca/atomic/basic/atomic_basic_module.c +++ b/oshmem/mca/atomic/basic/atomic_basic_module.c @@ -34,7 +34,7 @@ enum { * Initial query function that is invoked during initialization, allowing * this module to indicate what level of thread support it provides. */ -int mca_atomic_basic_init(bool enable_progress_threads, bool enable_threads) +int mca_atomic_basic_startup(bool enable_progress_threads, bool enable_threads) { int rc = OSHMEM_SUCCESS; void* ptr = NULL; diff --git a/oshmem/mca/atomic/mxm/atomic_mxm.h b/oshmem/mca/atomic/mxm/atomic_mxm.h index 39efdfc4668..ba491d2b29a 100644 --- a/oshmem/mca/atomic/mxm/atomic_mxm.h +++ b/oshmem/mca/atomic/mxm/atomic_mxm.h @@ -37,7 +37,7 @@ OSHMEM_DECLSPEC void atomic_mxm_unlock(int pe); /* API functions */ -int mca_atomic_mxm_init(bool enable_progress_threads, bool enable_threads); +int mca_atomic_mxm_startup(bool enable_progress_threads, bool enable_threads); int mca_atomic_mxm_finalize(void); mca_atomic_base_module_t* mca_atomic_mxm_query(int *priority); diff --git a/oshmem/mca/atomic/mxm/atomic_mxm_component.c b/oshmem/mca/atomic/mxm/atomic_mxm_component.c index 005f2701f24..201087d7673 100644 --- a/oshmem/mca/atomic/mxm/atomic_mxm_component.c +++ b/oshmem/mca/atomic/mxm/atomic_mxm_component.c @@ -66,7 +66,7 @@ mca_atomic_base_component_t mca_atomic_mxm_component = { /* Initialization / querying functions */ - .atomic_init = mca_atomic_mxm_init, + .atomic_startup = mca_atomic_mxm_startup, .atomic_finalize = mca_atomic_mxm_finalize, .atomic_query = mca_atomic_mxm_query, }; diff --git a/oshmem/mca/atomic/mxm/atomic_mxm_module.c b/oshmem/mca/atomic/mxm/atomic_mxm_module.c index c081651707b..b4bee48fa1e 100644 --- a/oshmem/mca/atomic/mxm/atomic_mxm_module.c +++ b/oshmem/mca/atomic/mxm/atomic_mxm_module.c @@ -22,7 +22,7 @@ * Initial query function that is invoked during initialization, allowing * this module to indicate what level of thread support it provides. */ -int mca_atomic_mxm_init(bool enable_progress_threads, bool enable_threads) +int mca_atomic_mxm_startup(bool enable_progress_threads, bool enable_threads) { return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/atomic/ucx/atomic_ucx.h b/oshmem/mca/atomic/ucx/atomic_ucx.h index a6797130194..dd588bdc0b5 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx.h +++ b/oshmem/mca/atomic/ucx/atomic_ucx.h @@ -37,7 +37,7 @@ OSHMEM_DECLSPEC void atomic_ucx_unlock(int pe); /* API functions */ -int mca_atomic_ucx_init(bool enable_progress_threads, bool enable_threads); +int mca_atomic_ucx_startup(bool enable_progress_threads, bool enable_threads); int mca_atomic_ucx_finalize(void); mca_atomic_base_module_t* mca_atomic_ucx_query(int *priority); diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_component.c b/oshmem/mca/atomic/ucx/atomic_ucx_component.c index 437941ef9c9..cf47d3f1c1d 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_component.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_component.c @@ -70,7 +70,7 @@ mca_atomic_base_component_t mca_atomic_ucx_component = { /* Initialization / querying functions */ - mca_atomic_ucx_init, + mca_atomic_ucx_startup, mca_atomic_ucx_finalize, mca_atomic_ucx_query }; diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_module.c b/oshmem/mca/atomic/ucx/atomic_ucx_module.c index 53a00773cb6..4d269065cb4 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_module.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_module.c @@ -22,7 +22,7 @@ * Initial query function that is invoked during initialization, allowing * this module to indicate what level of thread support it provides. */ -int mca_atomic_ucx_init(bool enable_progress_threads, bool enable_threads) +int mca_atomic_ucx_startup(bool enable_progress_threads, bool enable_threads) { return OSHMEM_SUCCESS; } From c540dfb18c574f82546073ae04f6e318ac271b14 Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Wed, 18 Jul 2018 10:27:00 +0700 Subject: [PATCH 012/674] coll-base-allgather: fix MPI_IN_PLACE processing The call of MPI_Allgather with sendbuf and sendtype parameters equal to MPI_IN_PLACE and NULL correspondingly, produces the segmentation fault. The problem is that sendtype is used even when sendbuf value is MPI_IN_PLACE. But according to the standard, sendtype and sendcount parameters should be ignored in this case. Signed-off-by: Mikhail Kurnosov (cherry picked from commit 540c2d1) --- ompi/mca/coll/base/coll_base_allgather.c | 25 +++++------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_allgather.c b/ompi/mca/coll/base/coll_base_allgather.c index c774b3cd41d..f3d3fd1d0a7 100644 --- a/ompi/mca/coll/base/coll_base_allgather.c +++ b/ompi/mca/coll/base/coll_base_allgather.c @@ -90,7 +90,7 @@ int ompi_coll_base_allgather_intra_bruck(const void *sbuf, int scount, mca_coll_base_module_t *module) { int line = -1, rank, size, sendto, recvfrom, distance, blockcount, err = 0; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; size = ompi_comm_size(comm); @@ -99,9 +99,6 @@ int ompi_coll_base_allgather_intra_bruck(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgather_intra_bruck rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -262,7 +259,7 @@ ompi_coll_base_allgather_intra_recursivedoubling(const void *sbuf, int scount, { int line = -1, rank, size, pow2size, err; int remote, distance, sendblocklocation; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; size = ompi_comm_size(comm); @@ -289,9 +286,6 @@ ompi_coll_base_allgather_intra_recursivedoubling(const void *sbuf, int scount, "coll:base:allgather_intra_recursivedoubling rank %d, size %d", rank, size)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -369,7 +363,7 @@ int ompi_coll_base_allgather_intra_ring(const void *sbuf, int scount, mca_coll_base_module_t *module) { int line = -1, rank, size, err, sendto, recvfrom, i, recvdatafrom, senddatafrom; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; size = ompi_comm_size(comm); @@ -378,9 +372,6 @@ int ompi_coll_base_allgather_intra_ring(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgather_intra_ring rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -499,7 +490,7 @@ ompi_coll_base_allgather_intra_neighborexchange(const void *sbuf, int scount, { int line = -1, rank, size, i, even_rank, err; int neighbor[2], offset_at_step[2], recv_data_from[2], send_data_from; - ptrdiff_t slb, rlb, sext, rext; + ptrdiff_t rlb, rext; char *tmpsend = NULL, *tmprecv = NULL; size = ompi_comm_size(comm); @@ -517,9 +508,6 @@ ompi_coll_base_allgather_intra_neighborexchange(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgather_intra_neighborexchange rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -616,7 +604,7 @@ int ompi_coll_base_allgather_intra_two_procs(const void *sbuf, int scount, { int line = -1, err, rank, remote; char *tmpsend = NULL, *tmprecv = NULL; - ptrdiff_t sext, rext, lb; + ptrdiff_t rext, lb; rank = ompi_comm_rank(comm); @@ -627,9 +615,6 @@ int ompi_coll_base_allgather_intra_two_procs(const void *sbuf, int scount, return MPI_ERR_UNSUPPORTED_OPERATION; } - err = ompi_datatype_get_extent (sdtype, &lb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } From 04054d63ebf7050631ae1e10b3290f8dad2cdb81 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 25 Jul 2018 16:11:32 -0700 Subject: [PATCH 013/674] Cleanup pmix selection check Allow for versions > 3 Signed-off-by: Ralph Castain (cherry picked from commit 55cefedf9b8d97c056f7b027d759f32190c9c23e) --- opal/mca/pmix/ext2x/ext2x_component.c | 4 ++-- opal/mca/pmix/pmix3x/pmix3x_component.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opal/mca/pmix/ext2x/ext2x_component.c b/opal/mca/pmix/ext2x/ext2x_component.c index a03125f7804..9f96d8c5d4b 100644 --- a/opal/mca/pmix/ext2x/ext2x_component.c +++ b/opal/mca/pmix/ext2x/ext2x_component.c @@ -118,12 +118,12 @@ static int external_open(void) OBJ_CONSTRUCT(&mca_pmix_ext2x_component.dmdx, opal_list_t); version = PMIx_Get_version(); - if ('2' != version[0]) { + if ('2' >= version[0]) { opal_show_help("help-pmix-base.txt", "incorrect-pmix", true, version, "v2.x"); return OPAL_ERROR; } - if (0 == strncmp(version, "2.1", 3)) { + if (0 != strncmp(version, "2.0", 3)) { mca_pmix_ext2x_component.legacy_get = false; } diff --git a/opal/mca/pmix/pmix3x/pmix3x_component.c b/opal/mca/pmix/pmix3x/pmix3x_component.c index dd685272cc9..9020d44bb1e 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_component.c +++ b/opal/mca/pmix/pmix3x/pmix3x_component.c @@ -118,7 +118,7 @@ static int external_open(void) OBJ_CONSTRUCT(&mca_pmix_pmix3x_component.dmdx, opal_list_t); version = PMIx_Get_version(); - if ('3' != version[0]) { + if ('3' >= version[0]) { opal_show_help("help-pmix-base.txt", "incorrect-pmix", true, version, "v3.x"); return OPAL_ERROR; From 511319c3168e1945b9925b59fb31bc826c223ac3 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 25 Jul 2018 17:42:19 -0700 Subject: [PATCH 014/674] Fix the multiple pe/proc option Things got a little out of whack and we weren't actually processing the map-by modifiers, plus an error crept into the display of the binding report. So clean those up. Thanks to @tonyreina for the error report Signed-off-by: Ralph Castain (cherry picked from commit bcdb1f45aca3f6dfab2646bfdba99775f728ca3b) --- opal/mca/pmix/pmix3x/pmix3x_component.c | 2 +- orte/mca/rmaps/base/rmaps_base_frame.c | 34 ++++++++------ .../data_type_support/orte_dt_print_fns.c | 46 ++++++++++--------- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix3x_component.c b/opal/mca/pmix/pmix3x/pmix3x_component.c index 9020d44bb1e..3477641092b 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_component.c +++ b/opal/mca/pmix/pmix3x/pmix3x_component.c @@ -118,7 +118,7 @@ static int external_open(void) OBJ_CONSTRUCT(&mca_pmix_pmix3x_component.dmdx, opal_list_t); version = PMIx_Get_version(); - if ('3' >= version[0]) { + if ('3' > version[0]) { opal_show_help("help-pmix-base.txt", "incorrect-pmix", true, version, "v3.x"); return OPAL_ERROR; diff --git a/orte/mca/rmaps/base/rmaps_base_frame.c b/orte/mca/rmaps/base/rmaps_base_frame.c index 9c71cdd990a..9300b338ddd 100644 --- a/orte/mca/rmaps/base/rmaps_base_frame.c +++ b/orte/mca/rmaps/base/rmaps_base_frame.c @@ -597,7 +597,7 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, char **device, char *inspec) { char *ck; - char *ptr; + char *ptr, *cptr; orte_mapping_policy_t tmp; int rc; size_t len; @@ -661,20 +661,26 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, return ORTE_ERR_SILENT; } ptr++; // move past the colon - /* check the remaining string for modifiers - may be none, so - * don't emit an error message if the modifier isn't recognized - */ - if (ORTE_ERR_SILENT == (rc = check_modifiers(ptr, &tmp)) && - ORTE_ERR_BAD_PARAM != rc) { - free(spec); - return ORTE_ERR_SILENT; - } - /* if we found something, then we need to adjust the string */ - if (ORTE_SUCCESS == rc) { - ptr--; - *ptr = '\0'; + /* at this point, ck is pointing to the number of procs/object + * and ptr is pointing to the beginning of the string that describes + * the object plus any modifiers. We first check to see if there + * is a comma indicating that there are modifiers to the request */ + if (NULL != (cptr = strchr(ptr, ','))) { + /* there are modifiers, so we terminate the object string + * at the location of the first comma */ + *cptr = '\0'; + /* step over that comma */ + cptr++; + /* now check for modifiers - may be none, so + * don't emit an error message if the modifier + * isn't recognized */ + if (ORTE_ERR_SILENT == (rc = check_modifiers(cptr, &tmp)) && + ORTE_ERR_BAD_PARAM != rc) { + free(spec); + return ORTE_ERR_SILENT; + } } - /* now get the pattern */ + /* now save the pattern */ orte_rmaps_base.ppr = strdup(ck); ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR); ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); diff --git a/orte/runtime/data_type_support/orte_dt_print_fns.c b/orte/runtime/data_type_support/orte_dt_print_fns.c index d017adc1cfa..fbcfa698506 100644 --- a/orte/runtime/data_type_support/orte_dt_print_fns.c +++ b/orte/runtime/data_type_support/orte_dt_print_fns.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -442,9 +442,12 @@ int orte_dt_print_node(char **output, char *prefix, orte_node_t *src, opal_data_ */ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_type_t type) { - char *tmp, *tmp2, *pfx2; - hwloc_obj_t loc=NULL, bd=NULL; - char locale[1024], bind[1024]; + char *tmp, *tmp3, *pfx2; + hwloc_obj_t loc=NULL; + char locale[1024], tmp1[1024], tmp2[1024]; + hwloc_cpuset_t mycpus; + char *str=NULL, *cpu_bitmap=NULL; + /* set default result */ *output = NULL; @@ -470,10 +473,6 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_ } if (!orte_devel_level_output) { - hwloc_cpuset_t mycpus; - char tmp1[1024], tmp2[1024]; - char *str=NULL, *cpu_bitmap=NULL; - if (orte_get_attribute(&src->attributes, ORTE_PROC_CPU_BITMAP, (void**)&cpu_bitmap, OPAL_STRING) && NULL != src->node->topology && NULL != src->node->topology->topo) { mycpus = hwloc_bitmap_alloc(); @@ -509,10 +508,10 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_ asprintf(&tmp, "\n%sData for proc: %s", pfx2, ORTE_NAME_PRINT(&src->name)); - asprintf(&tmp2, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu\tApp rank: %d", tmp, pfx2, + asprintf(&tmp3, "%s\n%s\tPid: %ld\tLocal rank: %lu\tNode rank: %lu\tApp rank: %d", tmp, pfx2, (long)src->pid, (unsigned long)src->local_rank, (unsigned long)src->node_rank, src->app_rank); free(tmp); - tmp = tmp2; + tmp = tmp3; if (orte_get_attribute(&src->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&loc, OPAL_PTR)) { if (NULL != loc) { @@ -525,23 +524,26 @@ int orte_dt_print_proc(char **output, char *prefix, orte_proc_t *src, opal_data_ } else { strcpy(locale, "UNKNOWN"); } - if (orte_get_attribute(&src->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) { - if (NULL != bd) { - if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(bind, sizeof(bind), src->node->topology->topo, bd->cpuset)) { - strcpy(bind, "UNBOUND"); - } - } else { - strcpy(bind, "UNBOUND"); - } + if (orte_get_attribute(&src->attributes, ORTE_PROC_CPU_BITMAP, (void**)&cpu_bitmap, OPAL_STRING) && + NULL != src->node->topology && NULL != src->node->topology->topo) { + mycpus = hwloc_bitmap_alloc(); + hwloc_bitmap_list_sscanf(mycpus, cpu_bitmap); + opal_hwloc_base_cset2mapstr(tmp2, sizeof(tmp2), src->node->topology->topo, mycpus); } else { - strcpy(bind, "UNBOUND"); + snprintf(tmp2, sizeof(tmp2), "UNBOUND"); } - asprintf(&tmp2, "%s\n%s\tState: %s\tApp_context: %ld\n%s\tLocale: %s\n%s\tBinding: %s", tmp, pfx2, - orte_proc_state_to_str(src->state), (long)src->app_idx, pfx2, locale, pfx2, bind); + asprintf(&tmp3, "%s\n%s\tState: %s\tApp_context: %ld\n%s\tLocale: %s\n%s\tBinding: %s", tmp, pfx2, + orte_proc_state_to_str(src->state), (long)src->app_idx, pfx2, locale, pfx2, tmp2); free(tmp); + if (NULL != str) { + free(str); + } + if (NULL != cpu_bitmap) { + free(cpu_bitmap); + } /* set the return */ - *output = tmp2; + *output = tmp3; free(pfx2); return ORTE_SUCCESS; From 0cdf49ed8a7e932c60c18919652242b5706cb440 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 25 Jul 2018 20:05:33 -0700 Subject: [PATCH 015/674] Fix typo Signed-off-by: Ralph Castain (cherry picked from commit f7a537cf040d7192f7a86cfe24de14cff754ca29) --- opal/mca/pmix/ext2x/ext2x_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/pmix/ext2x/ext2x_component.c b/opal/mca/pmix/ext2x/ext2x_component.c index 9f96d8c5d4b..cf60a7ee8f3 100644 --- a/opal/mca/pmix/ext2x/ext2x_component.c +++ b/opal/mca/pmix/ext2x/ext2x_component.c @@ -118,7 +118,7 @@ static int external_open(void) OBJ_CONSTRUCT(&mca_pmix_ext2x_component.dmdx, opal_list_t); version = PMIx_Get_version(); - if ('2' >= version[0]) { + if ('2' > version[0]) { opal_show_help("help-pmix-base.txt", "incorrect-pmix", true, version, "v2.x"); return OPAL_ERROR; From b64502977a581aee65b7dce52aabe4e8e5466b98 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 25 Jul 2018 14:52:45 +0300 Subject: [PATCH 016/674] PML/SPML/UCX: init global objects using C99 style - to avoid value mix used C99 style of object initializations Signed-off-by: Sergey Oblomov (cherry picked from commit 2806504290ff2fdd10f254f878e92cae6e90c854) --- ompi/mca/pml/ucx/pml_ucx.c | 52 +++++++++---------- ompi/mca/pml/ucx/pml_ucx_component.c | 26 +++++----- oshmem/mca/spml/ucx/spml_ucx.c | 66 ++++++++++++------------ oshmem/mca/spml/ucx/spml_ucx_component.c | 31 ++++++----- 4 files changed, 87 insertions(+), 88 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 10c66396db7..9dcae3dd6b5 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -49,33 +49,33 @@ #define MODEX_KEY "pml-ucx" mca_pml_ucx_module_t ompi_pml_ucx = { - { - mca_pml_ucx_add_procs, - mca_pml_ucx_del_procs, - mca_pml_ucx_enable, - NULL, - mca_pml_ucx_add_comm, - mca_pml_ucx_del_comm, - mca_pml_ucx_irecv_init, - mca_pml_ucx_irecv, - mca_pml_ucx_recv, - mca_pml_ucx_isend_init, - mca_pml_ucx_isend, - mca_pml_ucx_send, - mca_pml_ucx_iprobe, - mca_pml_ucx_probe, - mca_pml_ucx_start, - mca_pml_ucx_improbe, - mca_pml_ucx_mprobe, - mca_pml_ucx_imrecv, - mca_pml_ucx_mrecv, - mca_pml_ucx_dump, - NULL, /* FT */ - 1ul << (PML_UCX_CONTEXT_BITS), - 1ul << (PML_UCX_TAG_BITS - 1), + .super = { + .pml_add_procs = mca_pml_ucx_add_procs, + .pml_del_procs = mca_pml_ucx_del_procs, + .pml_enable = mca_pml_ucx_enable, + .pml_progress = NULL, + .pml_add_comm = mca_pml_ucx_add_comm, + .pml_del_comm = mca_pml_ucx_del_comm, + .pml_irecv_init = mca_pml_ucx_irecv_init, + .pml_irecv = mca_pml_ucx_irecv, + .pml_recv = mca_pml_ucx_recv, + .pml_isend_init = mca_pml_ucx_isend_init, + .pml_isend = mca_pml_ucx_isend, + .pml_send = mca_pml_ucx_send, + .pml_iprobe = mca_pml_ucx_iprobe, + .pml_probe = mca_pml_ucx_probe, + .pml_start = mca_pml_ucx_start, + .pml_improbe = mca_pml_ucx_improbe, + .pml_mprobe = mca_pml_ucx_mprobe, + .pml_imrecv = mca_pml_ucx_imrecv, + .pml_mrecv = mca_pml_ucx_mrecv, + .pml_dump = mca_pml_ucx_dump, + .pml_ft_event = NULL, + .pml_max_contextid = 1ul << (PML_UCX_CONTEXT_BITS), + .pml_max_tag = 1ul << (PML_UCX_TAG_BITS - 1) }, - NULL, /* ucp_context */ - NULL /* ucp_worker */ + .ucp_context = NULL, + .ucp_worker = NULL }; #define PML_UCX_REQ_ALLOCA() \ diff --git a/ompi/mca/pml/ucx/pml_ucx_component.c b/ompi/mca/pml/ucx/pml_ucx_component.c index 27e89977314..aa5dd5266e1 100644 --- a/ompi/mca/pml/ucx/pml_ucx_component.c +++ b/ompi/mca/pml/ucx/pml_ucx_component.c @@ -26,25 +26,25 @@ mca_pml_base_component_2_0_0_t mca_pml_ucx_component = { /* First, the mca_base_component_t struct containing meta * information about the component itself */ - { + .pmlm_version = { MCA_PML_BASE_VERSION_2_0_0, - "ucx", /* MCA component name */ - OMPI_MAJOR_VERSION, /* MCA component major version */ - OMPI_MINOR_VERSION, /* MCA component minor version */ - OMPI_RELEASE_VERSION, /* MCA component release version */ - mca_pml_ucx_component_open, /* component open */ - mca_pml_ucx_component_close, /* component close */ - NULL, - mca_pml_ucx_component_register, + .mca_component_name = "ucx", + .mca_component_major_version = OMPI_MAJOR_VERSION, + .mca_component_minor_version = OMPI_MINOR_VERSION, + .mca_component_release_version = OMPI_RELEASE_VERSION, + .mca_open_component = mca_pml_ucx_component_open, + .mca_close_component = mca_pml_ucx_component_close, + .mca_query_component = NULL, + .mca_register_component_params = mca_pml_ucx_component_register, }, - { + .pmlm_data = { /* This component is not checkpoint ready */ - MCA_BASE_METADATA_PARAM_NONE + .param_field = MCA_BASE_METADATA_PARAM_NONE }, - mca_pml_ucx_component_init, /* component init */ - mca_pml_ucx_component_fini /* component finalize */ + .pmlm_init = mca_pml_ucx_component_init, + .pmlm_finalize = mca_pml_ucx_component_fini }; static int mca_pml_ucx_component_register(void) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 277910b3ca7..8cc1153658b 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -48,47 +48,47 @@ static spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva); mca_spml_ucx_t mca_spml_ucx = { - { + .super = { /* Init mca_spml_base_module_t */ - mca_spml_ucx_add_procs, - mca_spml_ucx_del_procs, - mca_spml_ucx_enable, - mca_spml_ucx_register, - mca_spml_ucx_deregister, - mca_spml_base_oob_get_mkeys, - mca_spml_ucx_ctx_create, - mca_spml_ucx_ctx_destroy, - mca_spml_ucx_put, - mca_spml_ucx_put_nb, - mca_spml_ucx_get, - mca_spml_ucx_get_nb, - mca_spml_ucx_recv, - mca_spml_ucx_send, - mca_spml_base_wait, - mca_spml_base_wait_nb, - mca_spml_base_test, - mca_spml_ucx_fence, - mca_spml_ucx_quiet, - mca_spml_ucx_rmkey_unpack, - mca_spml_ucx_rmkey_free, - mca_spml_ucx_rmkey_ptr, - mca_spml_ucx_memuse_hook, - (void*)&mca_spml_ucx + .spml_add_procs = mca_spml_ucx_add_procs, + .spml_del_procs = mca_spml_ucx_del_procs, + .spml_enable = mca_spml_ucx_enable, + .spml_register = mca_spml_ucx_register, + .spml_deregister = mca_spml_ucx_deregister, + .spml_oob_get_mkeys = mca_spml_base_oob_get_mkeys, + .spml_ctx_create = mca_spml_ucx_ctx_create, + .spml_ctx_destroy = mca_spml_ucx_ctx_destroy, + .spml_put = mca_spml_ucx_put, + .spml_put_nb = mca_spml_ucx_put_nb, + .spml_get = mca_spml_ucx_get, + .spml_get_nb = mca_spml_ucx_get_nb, + .spml_recv = mca_spml_ucx_recv, + .spml_send = mca_spml_ucx_send, + .spml_wait = mca_spml_base_wait, + .spml_wait_nb = mca_spml_base_wait_nb, + .spml_test = mca_spml_base_test, + .spml_fence = mca_spml_ucx_fence, + .spml_quiet = mca_spml_ucx_quiet, + .spml_rmkey_unpack = mca_spml_ucx_rmkey_unpack, + .spml_rmkey_free = mca_spml_ucx_rmkey_free, + .spml_rmkey_ptr = mca_spml_ucx_rmkey_ptr, + .spml_memuse_hook = mca_spml_ucx_memuse_hook, + .self = (void*)&mca_spml_ucx }, - NULL, /* ucp_context */ - 1, /* num_disconnect */ - 0, /* heap_reg_nb */ - 0, /* enabled */ - mca_spml_ucx_get_mkey_slow + .ucp_context = NULL, + .num_disconnect = 1, + .heap_reg_nb = 0, + .enabled = 0, + .get_mkey_slow = mca_spml_ucx_get_mkey_slow }; OBJ_CLASS_INSTANCE(mca_spml_ucx_ctx_list_item_t, opal_list_item_t, NULL, NULL); mca_spml_ucx_ctx_t mca_spml_ucx_ctx_default = { - NULL, /* ucp_worker */ - NULL, /* ucp_peers */ - 0 /* options */ + .ucp_worker = NULL, + .ucp_peers = NULL, + .options = 0 }; int mca_spml_ucx_enable(bool enable) diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index a4a4a26385a..d567767946b 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -38,26 +38,25 @@ mca_spml_base_component_2_0_0_t mca_spml_ucx_component = { /* First, the mca_base_component_t struct containing meta information about the component itself */ - { - MCA_SPML_BASE_VERSION_2_0_0, - - "ucx", /* MCA component name */ - OSHMEM_MAJOR_VERSION, /* MCA component major version */ - OSHMEM_MINOR_VERSION, /* MCA component minor version */ - OSHMEM_RELEASE_VERSION, /* MCA component release version */ - mca_spml_ucx_component_open, /* component open */ - mca_spml_ucx_component_close, /* component close */ - NULL, - mca_spml_ucx_component_register + .spmlm_version = { + MCA_SPML_BASE_VERSION_2_0_0, + + .mca_component_name = "ucx", + .mca_component_major_version = OSHMEM_MAJOR_VERSION, + .mca_component_minor_version = OSHMEM_MINOR_VERSION, + .mca_component_release_version = OSHMEM_RELEASE_VERSION, + .mca_open_component = mca_spml_ucx_component_open, + .mca_close_component = mca_spml_ucx_component_close, + .mca_query_component = NULL, + .mca_register_component_params = mca_spml_ucx_component_register }, - { + .spmlm_data = { /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT + .param_field = MCA_BASE_METADATA_PARAM_CHECKPOINT }, - mca_spml_ucx_component_init, /* component init */ - mca_spml_ucx_component_fini /* component finalize */ - + .spmlm_init = mca_spml_ucx_component_init, + .spmlm_finalize = mca_spml_ucx_component_fini }; From 9cc6bc1ea64897723d772bb9960ab58a38eea277 Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Tue, 8 May 2018 13:00:19 -0400 Subject: [PATCH 017/674] MTL OFI: Fix Deadlock in fi_cancel given completion during cancel - If a message for a recv that is being cancelled gets completed after the call to fi_cancel, then the OFI mtl will enter a deadlock state waiting for ofi_req->super.ompi_req->req_status._cancelled which will never happen since the recv was successfully finished. - To resolve this issue, the OFI mtl now checks ofi_req->req_started to see if the request has been started within the loop waiting for the event to be cancelled. If the request is being completed, then the loop is broken and fi_cancel exits setting ofi_req->super.ompi_req->req_status._cancelled = false; Signed-off-by: Spruit, Neil R (cherry picked from commit 767135c580f75d3dde9cb9c88601dd18afda949a) --- ompi/mca/mtl/ofi/mtl_ofi.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 45a66673d11..d4c5f8a7b67 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -1003,8 +1003,11 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, */ while (!ofi_req->super.ompi_req->req_status._cancelled) { opal_progress(); + if (ofi_req->req_started) + goto ofi_cancel_not_possible; } } else { +ofi_cancel_not_possible: /** * Could not cancel the request. */ From e2b6e9ee094f0b8d54d338c0dff470d1dd98ca5c Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Fri, 27 Jul 2018 14:30:15 -0400 Subject: [PATCH 018/674] apply romio314 patch to romio321 When romio314 was first pulled in an extra patch was applied to it, see commit 92f6c7c1e210c559471a05aaac9b19e0bd3d71bb. Most of that patch is already present in vanilla romio321, but the fix for MPIO_DATATYPE_ISCOMMITTED() isn't. If that macro doesn't set err_ then some paths end up with a variable being used uninitialized. In particular you can trace through romio321/romio/mpi-io/read.c to see what happens with error_code. It's an uninitialized stack variable that goes through three MPIO_CHECK_* macros none of which set it. The macros consistently set error_code to a failure if they see something wrong, but they don't consistently set it to success when things are fine. And then in the last macro MPIO_CHECK_DATATYPE it tries to look at the value of error_code that was never set. Signed-off-by: Mark Allen (cherry picked from commit f413ef6b142fc3498bdb575d270f9afd0a840863) --- ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h b/ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h index 7c5f0eb3947..4eb2843bcaf 100644 --- a/ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h +++ b/ompi/mca/io/romio321/romio/mpi-io/mpioimpl.h @@ -2,6 +2,8 @@ /* * * Copyright (C) 1997 University of Chicago. + * Copyright (c) 2018 IBM Corporation. All rights reserved. + * $COPYRIGHT$ * See COPYRIGHT notice in top-level directory. */ @@ -36,7 +38,12 @@ #define ROMIO_THREAD_CS_ENTER() #define ROMIO_THREAD_CS_EXIT() #define ROMIO_THREAD_CS_YIELD() -#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do {} while (0) +/* The MPI_DATATYPE_ISCOMMITTED macro now always sets err_=0. + This is an optimistic approach for Open MPI, but it is likely other + upper layers already checked the datatype was committed. + Not setting err_ is incorrect since it can lead to use of + uninitialized variable.*/ +#define MPIO_DATATYPE_ISCOMMITTED(dtype_, err_) do { err_ = 0; } while (0) #ifdef HAVE_WINDOWS_H #define MPIU_UNREFERENCED_ARG(a) a #else From 1fbbae1907b0e8b25594d7416795bc06caf105b6 Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Tue, 8 May 2018 11:00:14 -0400 Subject: [PATCH 019/674] MTL OFI: send/isend split into blocking/non-blocking paths -Updated blocking send to directly call functionality and set completion events expected to 0 initally. This allows for optimization for providers that support fi_tinject up to larger sizes. This also reduces latency on running the OFI mtl with smaller sizes without requiring calls to progress given fi_tinject is required to complete the messaging before returning and will not create any events in the Completion Queue. -Updated non-blocking send to directly call fi_tsend and avoid calling fi_tinject as the functionality should not wait on completions. This resolves a bug where applications calling MPI_Isend can overrun the TX buffer with small (inject) messages causing a deadlock. In addition this improves performance in message rates by preventing waiting on any size message to complete in non-blocking send messages. -Created common ompi_mtl_ofi_ssend_recv function to post the ssend recv which is common between isend and send code paths. Signed-off-by: Spruit, Neil R (cherry picked from commit 7dc8c8ba3fa630df8c5c7ab36fcf25249a82bfe7) --- ompi/mca/mtl/ofi/mtl_ofi.h | 229 ++++++++++++++++++++++++------------- 1 file changed, 150 insertions(+), 79 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 539533e73b9..d2c5327e718 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -238,34 +238,82 @@ ompi_mtl_ofi_isend_callback(struct fi_cq_tagged_entry *wc, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, - struct ompi_communicator_t *comm, - int dest, - int tag, - struct opal_convertor_t *convertor, - mca_pml_base_send_mode_t mode, - ompi_mtl_ofi_request_t *ofi_req) +ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, + struct ompi_communicator_t *comm, + fi_addr_t *src_addr, + ompi_mtl_ofi_request_t *ofi_req, + mca_mtl_ofi_endpoint_t *endpoint, + uint64_t *match_bits, + int tag) +{ + ssize_t ret = OMPI_SUCCESS; + ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); + + assert(ack_req); + + ack_req->parent = ofi_req; + ack_req->event_callback = ompi_mtl_ofi_send_ack_callback; + ack_req->error_callback = ompi_mtl_ofi_send_ack_error_callback; + + ofi_req->completion_count += 1; + + MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ep, + NULL, + 0, + NULL, + *src_addr, + *match_bits | ompi_mtl_ofi.sync_send_ack, + 0, /* Exact match, no ignore bits */ + (void *) &ack_req->ctx), ret); + if (OPAL_UNLIKELY(0 > ret)) { + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: fi_trecv failed: %s(%zd)", + __FILE__, __LINE__, fi_strerror(-ret), ret); + free(ack_req); + return ompi_mtl_ofi_get_error(ret); + } + + /* The SYNC_SEND tag bit is set for the send operation only.*/ + MTL_OFI_SET_SYNC_SEND(*match_bits); + return OMPI_SUCCESS; +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) { + ssize_t ret = OMPI_SUCCESS; + ompi_mtl_ofi_request_t ofi_req; int ompi_ret; void *start; - size_t length; - ssize_t ret; bool free_after; + size_t length; uint64_t match_bits; ompi_proc_t *ompi_proc = NULL; mca_mtl_ofi_endpoint_t *endpoint = NULL; ompi_mtl_ofi_request_t *ack_req = NULL; /* For synchronous send */ fi_addr_t src_addr = 0; + /** + * Create a send request, start it and wait until it completes. + */ + ofi_req.event_callback = ompi_mtl_ofi_send_callback; + ofi_req.error_callback = ompi_mtl_ofi_send_error_callback; + ompi_proc = ompi_comm_peer_lookup(comm, dest); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); if (OMPI_SUCCESS != ompi_ret) return ompi_ret; - ofi_req->buffer = (free_after) ? start : NULL; - ofi_req->length = length; - ofi_req->status.MPI_ERROR = OMPI_SUCCESS; + ofi_req.buffer = (free_after) ? start : NULL; + ofi_req.length = length; + ofi_req.status.MPI_ERROR = OMPI_SUCCESS; + ofi_req.completion_count = 0; if (ompi_mtl_ofi.fi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); @@ -277,33 +325,11 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, } if (OPAL_UNLIKELY(MCA_PML_BASE_SEND_SYNCHRONOUS == mode)) { - ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); - assert(ack_req); - ack_req->parent = ofi_req; - ack_req->event_callback = ompi_mtl_ofi_send_ack_callback; - ack_req->error_callback = ompi_mtl_ofi_send_ack_error_callback; - - ofi_req->completion_count = 2; - - MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ep, - NULL, - 0, - NULL, - src_addr, - match_bits | ompi_mtl_ofi.sync_send_ack, - 0, /* Exact match, no ignore bits */ - (void *) &ack_req->ctx), ret); - if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecv failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); - free(ack_req); - return ompi_mtl_ofi_get_error(ret); - } - /* The SYNC_SEND tag bit is set for the send operation only.*/ - MTL_OFI_SET_SYNC_SEND(match_bits); - } else { - ofi_req->completion_count = 1; + ofi_req.status.MPI_ERROR = ompi_mtl_ofi_ssend_recv(ack_req, comm, &src_addr, + &ofi_req, endpoint, + &match_bits, tag); + if (OPAL_UNLIKELY(ofi_req.status.MPI_ERROR != OMPI_SUCCESS)) + goto free_request_buffer; } if (ompi_mtl_ofi.max_inject_size >= length) { @@ -331,11 +357,12 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, fi_cancel((fid_t)ompi_mtl_ofi.ep, &ack_req->ctx); free(ack_req); } - return ompi_mtl_ofi_get_error(ret); - } - ofi_req->event_callback(NULL,ofi_req); + ofi_req.status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); + goto free_request_buffer; + } } else { + ofi_req.completion_count += 1; if (ompi_mtl_ofi.fi_cq_data) { MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ep, start, @@ -344,7 +371,7 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, comm->c_my_rank, endpoint->peer_fiaddr, match_bits, - (void *) &ofi_req->ctx), ret); + (void *) &ofi_req.ctx), ret); } else { MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ep, start, @@ -352,44 +379,18 @@ ompi_mtl_ofi_send_start(struct mca_mtl_base_module_t *mtl, NULL, endpoint->peer_fiaddr, match_bits, - (void *) &ofi_req->ctx), ret); + (void *) &ofi_req.ctx), ret); } if (OPAL_UNLIKELY(0 > ret)) { char *fi_api = ompi_mtl_ofi.fi_cq_data ? "fi_tsendddata" : "fi_send"; opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: %s failed: %s(%zd)", __FILE__, __LINE__,fi_api, fi_strerror(-ret), ret); - return ompi_mtl_ofi_get_error(ret); - } - } - - return OMPI_SUCCESS; -} - -__opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, - struct ompi_communicator_t *comm, - int dest, - int tag, - struct opal_convertor_t *convertor, - mca_pml_base_send_mode_t mode) -{ - int ret = OMPI_SUCCESS; - ompi_mtl_ofi_request_t ofi_req; - - /** - * Create a send request, start it and wait until it completes. - */ - ofi_req.event_callback = ompi_mtl_ofi_send_callback; - ofi_req.error_callback = ompi_mtl_ofi_send_error_callback; + free(fi_api); - ret = ompi_mtl_ofi_send_start(mtl, comm, dest, tag, - convertor, mode, &ofi_req); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - if (NULL != ofi_req.buffer) { - free(ofi_req.buffer); + ofi_req.status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); + goto free_request_buffer; } - return ret; } /** @@ -400,6 +401,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, ompi_mtl_ofi_progress(); } +free_request_buffer: if (OPAL_UNLIKELY(NULL != ofi_req.buffer)) { free(ofi_req.buffer); } @@ -417,20 +419,89 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, bool blocking, mca_mtl_request_t *mtl_request) { - int ret = OMPI_SUCCESS; - ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t*) mtl_request; + ssize_t ret = OMPI_SUCCESS; + ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t *) mtl_request; + int ompi_ret; + void *start; + size_t length; + bool free_after; + uint64_t match_bits; + ompi_proc_t *ompi_proc = NULL; + mca_mtl_ofi_endpoint_t *endpoint = NULL; + ompi_mtl_ofi_request_t *ack_req = NULL; /* For synchronous send */ + fi_addr_t src_addr = 0; ofi_req->event_callback = ompi_mtl_ofi_isend_callback; ofi_req->error_callback = ompi_mtl_ofi_send_error_callback; - ret = ompi_mtl_ofi_send_start(mtl, comm, dest, tag, - convertor, mode, ofi_req); + ompi_proc = ompi_comm_peer_lookup(comm, dest); + endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret && NULL != ofi_req->buffer)) { + ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); + if (OMPI_SUCCESS != ompi_ret) return ompi_ret; + + ofi_req->buffer = (free_after) ? start : NULL; + ofi_req->length = length; + ofi_req->status.MPI_ERROR = OMPI_SUCCESS; + ofi_req->completion_count = 1; + + if (ompi_mtl_ofi.fi_cq_data) { + match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); + src_addr = endpoint->peer_fiaddr; + } else { + match_bits = mtl_ofi_create_send_tag(comm->c_contextid, + comm->c_my_rank, tag); + /* src_addr is ignored when FI_DIRECTED_RECV is not supported */ + } + + if (OPAL_UNLIKELY(MCA_PML_BASE_SEND_SYNCHRONOUS == mode)) { + ofi_req->status.MPI_ERROR = ompi_mtl_ofi_ssend_recv(ack_req, comm, &src_addr, + ofi_req, endpoint, + &match_bits, tag); + if (OPAL_UNLIKELY(ofi_req->status.MPI_ERROR != OMPI_SUCCESS)) + goto free_request_buffer; + } + + if (ompi_mtl_ofi.fi_cq_data) { + MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ep, + start, + length, + NULL, + comm->c_my_rank, + endpoint->peer_fiaddr, + match_bits, + (void *) &ofi_req->ctx), ret); + } else { + MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ep, + start, + length, + NULL, + endpoint->peer_fiaddr, + match_bits, + (void *) &ofi_req->ctx), ret); + } + if (OPAL_UNLIKELY(0 > ret)) { + char *fi_api; + if (ompi_mtl_ofi.fi_cq_data) { + asprintf( &fi_api, "fi_tsendddata") ; + } + else { + asprintf( &fi_api, "fi_send") ; + } + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: %s failed: %s(%zd)", + __FILE__, __LINE__,fi_api, fi_strerror(-ret), ret); + free(fi_api); + ofi_req->status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); + } + +free_request_buffer: + if (OPAL_UNLIKELY(OMPI_SUCCESS != ofi_req->status.MPI_ERROR + && NULL != ofi_req->buffer)) { free(ofi_req->buffer); } - return ret; + return ofi_req->status.MPI_ERROR; } /** From 36369f91333a94fdb3b71dcdc8dc669c5e1d97de Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Tue, 31 Jul 2018 10:11:16 -0500 Subject: [PATCH 020/674] coll-portals4: retry PtlMEUnlink() if PTL_IN_USE In the cleanup phase, it is possible for PtlMEUnlink() to return PTL_IN_USE if the NIC is not done with the ME. This should not be considered an error. This commit adds a retry loop around PtlMEUnlink(). In some cases, the return value of PtlMEUnlink() and PtlCTFree() was not checked at all. Check them with the same retry loop as above. Signed-off-by: Todd Kordenbrock (cherry picked from commit f3f2a826b40cc0d4a45a63614835162ec6eef78e) --- .../coll/portals4/coll_portals4_allreduce.c | 29 +++++++++++++++++-- .../mca/coll/portals4/coll_portals4_barrier.c | 4 ++- .../coll/portals4/coll_portals4_component.c | 8 +++-- ompi/mca/coll/portals4/coll_portals4_gather.c | 8 +++-- ompi/mca/coll/portals4/coll_portals4_reduce.c | 20 +++++++++++-- .../mca/coll/portals4/coll_portals4_scatter.c | 20 +++---------- 6 files changed, 62 insertions(+), 27 deletions(-) diff --git a/ompi/mca/coll/portals4/coll_portals4_allreduce.c b/ompi/mca/coll/portals4/coll_portals4_allreduce.c index fe0250defd6..6a5c781b1b3 100644 --- a/ompi/mca/coll/portals4/coll_portals4_allreduce.c +++ b/ompi/mca/coll/portals4/coll_portals4_allreduce.c @@ -343,15 +343,38 @@ allreduce_kary_tree_top(const void *sendbuf, void *recvbuf, int count, static int allreduce_kary_tree_bottom(ompi_coll_portals4_request_t *request) { + int ret; + if (request->u.allreduce.is_optim) { PtlAtomicSync(); if (request->u.allreduce.child_nb) { - PtlCTFree(request->u.allreduce.ack_ct_h); + ret = PtlCTFree(request->u.allreduce.ack_ct_h); + if (PTL_OK != ret) { + opal_output_verbose(1, ompi_coll_base_framework.framework_output, + "%s:%d: PtlCTFree failed: %d\n", + __FILE__, __LINE__, ret); + return OMPI_ERROR; + } } - PtlMEUnlink(request->u.allreduce.data_me_h); - PtlCTFree(request->u.allreduce.trig_ct_h); + do { + ret = PtlMEUnlink(request->u.allreduce.data_me_h); + } while (PTL_IN_USE == ret); + if (PTL_OK != ret) { + opal_output_verbose(1, ompi_coll_base_framework.framework_output, + "%s:%d: PtlMEUnlink failed: %d\n", + __FILE__, __LINE__, ret); + return OMPI_ERROR; + } + + ret = PtlCTFree(request->u.allreduce.trig_ct_h); + if (PTL_OK != ret) { + opal_output_verbose(1, ompi_coll_base_framework.framework_output, + "%s:%d: PtlCTFree failed: %d\n", + __FILE__, __LINE__, ret); + return OMPI_ERROR; + } } return (OMPI_SUCCESS); diff --git a/ompi/mca/coll/portals4/coll_portals4_barrier.c b/ompi/mca/coll/portals4/coll_portals4_barrier.c index b40c1f9256d..8021b60e378 100644 --- a/ompi/mca/coll/portals4/coll_portals4_barrier.c +++ b/ompi/mca/coll/portals4/coll_portals4_barrier.c @@ -206,7 +206,9 @@ barrier_hypercube_bottom(ompi_coll_portals4_request_t *request) int ret; /* cleanup */ - ret = PtlMEUnlink(request->u.barrier.data_me_h); + do { + ret = PtlMEUnlink(request->u.barrier.data_me_h); + } while (PTL_IN_USE == ret); if (PTL_OK != ret) { opal_output_verbose(1, ompi_coll_base_framework.framework_output, "%s:%d: PtlMEUnlink failed: %d\n", diff --git a/ompi/mca/coll/portals4/coll_portals4_component.c b/ompi/mca/coll/portals4/coll_portals4_component.c index 1be495861c0..d632340ee26 100644 --- a/ompi/mca/coll/portals4/coll_portals4_component.c +++ b/ompi/mca/coll/portals4/coll_portals4_component.c @@ -285,7 +285,9 @@ portals4_close(void) mca_coll_portals4_component.data_md_h = PTL_INVALID_HANDLE; if (!PtlHandleIsEqual(mca_coll_portals4_component.finish_me_h, PTL_INVALID_HANDLE)) { - ret = PtlMEUnlink(mca_coll_portals4_component.finish_me_h); + do { + ret = PtlMEUnlink(mca_coll_portals4_component.finish_me_h); + } while (PTL_IN_USE == ret); if (PTL_OK != ret) { opal_output_verbose(1, ompi_coll_base_framework.framework_output, "%s:%d: PtlMEUnlink failed: %d\n", @@ -293,7 +295,9 @@ portals4_close(void) } } if (!PtlHandleIsEqual(mca_coll_portals4_component.unex_me_h, PTL_INVALID_HANDLE)) { - ret = PtlMEUnlink(mca_coll_portals4_component.unex_me_h); + do { + ret = PtlMEUnlink(mca_coll_portals4_component.unex_me_h); + } while (PTL_IN_USE == ret); if (PTL_OK != ret) { opal_output_verbose(1, ompi_coll_base_framework.framework_output, "%s:%d: PtlMEUnlink failed: %d\n", diff --git a/ompi/mca/coll/portals4/coll_portals4_gather.c b/ompi/mca/coll/portals4/coll_portals4_gather.c index 7e38e27c009..274e9d4ee89 100644 --- a/ompi/mca/coll/portals4/coll_portals4_gather.c +++ b/ompi/mca/coll/portals4/coll_portals4_gather.c @@ -460,7 +460,9 @@ cleanup_gather_handles(ompi_coll_portals4_request_t *request) /**********************************/ /* Cleanup Gather Handles */ /**********************************/ - ret = PtlMEUnlink(request->u.gather.gather_meh); + do { + ret = PtlMEUnlink(request->u.gather.gather_meh); + } while (PTL_IN_USE == ret); if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } ret = PtlCTFree(request->u.gather.gather_cth); @@ -484,7 +486,9 @@ cleanup_sync_handles(ompi_coll_portals4_request_t *request) /**********************************/ /* Cleanup Sync Handles */ /**********************************/ - ret = PtlMEUnlink(request->u.gather.sync_meh); + do { + ret = PtlMEUnlink(request->u.gather.sync_meh); + } while (PTL_IN_USE == ret); if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } ret = PtlCTFree(request->u.gather.sync_cth); diff --git a/ompi/mca/coll/portals4/coll_portals4_reduce.c b/ompi/mca/coll/portals4/coll_portals4_reduce.c index 798a1fa17e4..2a60ef57dc8 100644 --- a/ompi/mca/coll/portals4/coll_portals4_reduce.c +++ b/ompi/mca/coll/portals4/coll_portals4_reduce.c @@ -340,24 +340,38 @@ reduce_kary_tree_top(const void *sendbuf, void *recvbuf, int count, static int reduce_kary_tree_bottom(ompi_coll_portals4_request_t *request) { + int ret, line; + if (request->u.reduce.is_optim) { PtlAtomicSync(); if (request->u.reduce.use_ack_ct_h) { - PtlCTFree(request->u.reduce.ack_ct_h); + ret = PtlCTFree(request->u.reduce.ack_ct_h); + if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } } if (request->u.reduce.child_nb) { - PtlMEUnlink(request->u.reduce.data_me_h); + do { + ret = PtlMEUnlink(request->u.reduce.data_me_h); + } while (PTL_IN_USE == ret); + if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } } - PtlCTFree(request->u.reduce.trig_ct_h); + ret = PtlCTFree(request->u.reduce.trig_ct_h); + if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } if (request->u.reduce.free_buffer) { free(request->u.reduce.free_buffer); } } return (OMPI_SUCCESS); + +err_hdlr: + opal_output(ompi_coll_base_framework.framework_output, + "%s:%4d:%4d\tError occurred ret=%d", + __FILE__, __LINE__, line, ret); + + return ret; } diff --git a/ompi/mca/coll/portals4/coll_portals4_scatter.c b/ompi/mca/coll/portals4/coll_portals4_scatter.c index 4f3351ac784..0049a61d001 100644 --- a/ompi/mca/coll/portals4/coll_portals4_scatter.c +++ b/ompi/mca/coll/portals4/coll_portals4_scatter.c @@ -253,14 +253,8 @@ cleanup_scatter_handles(ompi_coll_portals4_request_t *request) /**********************************/ do { ret = PtlMEUnlink(request->u.scatter.scatter_meh); - if (PTL_IN_USE == ret) { - opal_output(ompi_coll_base_framework.framework_output, - "%s:%4d: scatter_meh still in use (ret=%d, rank %2d)", - __FILE__, __LINE__, ret, request->u.scatter.my_rank); - continue; - } - if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } - } while (ret == PTL_IN_USE); + } while (PTL_IN_USE == ret); + if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } ret = PtlCTFree(request->u.scatter.scatter_cth); if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } @@ -292,14 +286,8 @@ cleanup_sync_handles(ompi_coll_portals4_request_t *request) /**********************************/ do { ret = PtlMEUnlink(request->u.scatter.sync_meh); - if (PTL_IN_USE == ret) { - opal_output(ompi_coll_base_framework.framework_output, - "%s:%4d: sync_meh still in use (ret=%d, rank %2d)", - __FILE__, __LINE__, ret, request->u.scatter.my_rank); - continue; - } - if (PTL_OK != ret) { ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } - } while (ret == PTL_IN_USE); + } while (PTL_IN_USE == ret); + if (PTL_OK != ret) { ptl_ret = ret; ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } ret = PtlCTFree(request->u.scatter.sync_cth); if (PTL_OK != ret) { ptl_ret = ret; ret = OMPI_ERROR; line = __LINE__; goto err_hdlr; } From eca16720de2a5cb82cd28d26dcaca390d155663f Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 8 Aug 2018 09:58:49 -0700 Subject: [PATCH 021/674] hwloc201: only configure if hwloc:external fails We know that hwloc:external will be configured first (because of its priority). Take advantage of that here in hwloc201 by having it refuse to configure / politely fail if hwloc:external succeeded. Also print out some additional lines in configure output indicating what is going on (i.e., hwloc:external succeeded, so this component will be skipped, or hwloc:external failed, so this component will be used). Signed-off-by: Jeff Squyres (cherry picked from commit 4e5f432786d1ab99304e40dadec40ac45e93e76f) --- opal/mca/hwloc/hwloc201/configure.m4 | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/opal/mca/hwloc/hwloc201/configure.m4 b/opal/mca/hwloc/hwloc201/configure.m4 index 33f55b0d442..9da91b2c958 100644 --- a/opal/mca/hwloc/hwloc201/configure.m4 +++ b/opal/mca/hwloc/hwloc201/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved # Copyright (c) 2014-2017 Intel, Inc. All rights reserved. # Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -69,6 +69,21 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_POST_CONFIG],[ # MCA_hwloc_hwloc201_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([MCA_opal_hwloc_hwloc201_CONFIG],[ + # We know that the external hwloc component will be configured + # before this one because of its priority. This component is only + # needed if the external component was not successful in selecting + # itself. + AC_MSG_CHECKING([if hwloc external component succeeded]) + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([hwloc:external succeeded, so this component will be skipped]) + $2], + [AC_MSG_RESULT([no]) + AC_MSG_NOTICE([hwloc:external failed, so this component will be used]) + MCA_opal_hwloc_hwloc201_BACKEND_CONFIG($1, $2)]) +]) + +AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[ # Hwloc needs to know if we have Verbs support AC_REQUIRE([OPAL_CHECK_VERBS_DIR]) @@ -80,19 +95,11 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_CONFIG],[ opal_hwloc_hwloc201_basedir=opal/mca/hwloc/hwloc201 opal_hwloc_hwloc201_support=no - AS_IF([test "$with_hwloc" = "internal" || test -z "$with_hwloc" || test "$with_hwloc" = "yes"], - [opal_hwloc_external="no"], - [opal_hwloc_external="yes"]) - opal_hwloc_hwloc201_save_CPPFLAGS=$CPPFLAGS opal_hwloc_hwloc201_save_LDFLAGS=$LDFLAGS opal_hwloc_hwloc201_save_LIBS=$LIBS - # Run the hwloc configuration - if no external hwloc, then set the prefixi - # to minimize the chance that someone will use the internal symbols - AS_IF([test "$opal_hwloc_external" = "no" && - test "$with_hwloc" != "future"], - [HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_])]) + HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_]) # save XML or graphical options opal_hwloc_hwloc201_save_cairo=$enable_cairo From 6cb3d61dd18fc8eb2a33a1657f34204ff3dd0c7a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 8 Aug 2018 10:04:16 -0700 Subject: [PATCH 022/674] libevent2022: only configure if event:external fails We know that event:external will be configured first (because of its priority). Take advantage of that here in libevent2022 by having it refuse to configure / politely fail if event:external succeeded. Also print out some additional lines in configure output indicating what is going on (i.e., event:external succeeded, so this component will be skipped, or event:external failed, so this component will be used). Signed-off-by: Jeff Squyres (cherry picked from commit b063cb6b0f251052dc72d2496e5745ce83d6b869) --- opal/mca/event/libevent2022/configure.m4 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/opal/mca/event/libevent2022/configure.m4 b/opal/mca/event/libevent2022/configure.m4 index 81ffb3ca82b..2d67735ddcb 100644 --- a/opal/mca/event/libevent2022/configure.m4 +++ b/opal/mca/event/libevent2022/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights reserved. # Copyright (c) 2015 Intel, Inc. All rights reserved. # Copyright (c) 2015-2016 Research Organization for Information Science @@ -86,6 +86,21 @@ EOF # [action-if-cant-compile]) # ------------------------------------------------ AC_DEFUN([MCA_opal_event_libevent2022_CONFIG],[ + # We know that the external event component will be configured + # before this one because of its priority. This component is only + # needed if the external component was not successful in selecting + # itself. + AC_MSG_CHECKING([if event external component succeeded]) + AS_IF([test "$opal_event_external_support" = "yes"], + [AC_MSG_RESULT([yes]) + AC_MSG_NOTICE([event:external succeeded, so this component will be skipped]) + $2], + [AC_MSG_RESULT([no]) + AC_MSG_NOTICE([event:external failed, so this component will be used]) + MCA_opal_event_libevent2022_BACKEND_CONFIG($1, $2)]) +]) + +AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[ OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy]) AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile]) From 63d68ded488af23bdb4f856942154903b505eabf Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 10 Aug 2018 10:30:04 -0700 Subject: [PATCH 023/674] libevent2022/configure.m4: minor comment cleanup Change # -> dnl. No code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit 17aa64e43825dd27148fc47d3f8f5694fc091d38) --- opal/mca/event/libevent2022/configure.m4 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/opal/mca/event/libevent2022/configure.m4 b/opal/mca/event/libevent2022/configure.m4 index 2d67735ddcb..fb412629048 100644 --- a/opal/mca/event/libevent2022/configure.m4 +++ b/opal/mca/event/libevent2022/configure.m4 @@ -14,9 +14,9 @@ # AC_DEFUN([MCA_opal_event_libevent2022_PRIORITY], [80]) -# -# Force this component to compile in static-only mode -# +dnl +dnl Force this component to compile in static-only mode +dnl AC_DEFUN([MCA_opal_event_libevent2022_COMPILE_MODE], [ AC_MSG_CHECKING([for MCA component $2:$3 compile mode]) $4="static" @@ -82,9 +82,9 @@ EOF ]) ]) -# MCA_event_libevent2022_CONFIG([action-if-can-compile], -# [action-if-cant-compile]) -# ------------------------------------------------ +dnl MCA_event_libevent2022_CONFIG([action-if-can-compile], +dnl [action-if-cant-compile]) +dnl ------------------------------------------------ AC_DEFUN([MCA_opal_event_libevent2022_CONFIG],[ # We know that the external event component will be configured # before this one because of its priority. This component is only From 5c5246f65544e4c63de7d200d4f97dbeab0e34d9 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 10 Aug 2018 10:30:45 -0700 Subject: [PATCH 024/674] libevent2022/configure.m4: trivial cleanup Put argument to AM_CONDITIONAL inside []. No code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit 80df3f040be2b26162df9cc73a0cfd9e3d11732d) --- opal/mca/event/libevent2022/configure.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opal/mca/event/libevent2022/configure.m4 b/opal/mca/event/libevent2022/configure.m4 index fb412629048..8f1319305bf 100644 --- a/opal/mca/event/libevent2022/configure.m4 +++ b/opal/mca/event/libevent2022/configure.m4 @@ -24,7 +24,8 @@ AC_DEFUN([MCA_opal_event_libevent2022_COMPILE_MODE], [ ]) AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [ - AM_CONDITIONAL(OPAL_EVENT_HAVE_THREAD_SUPPORT, test "$enable_event_thread_support" = "yes") + AM_CONDITIONAL(OPAL_EVENT_HAVE_THREAD_SUPPORT, + [test "$enable_event_thread_support" = "yes"]) AS_IF([test "$1" = "1"], [ # Build libevent/include/event2/event-config.h. If we # don't do it here, then libevent's Makefile.am will build From 714f203985c910015d8e7abc3168beddad8d92d4 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 10 Aug 2018 10:38:12 -0700 Subject: [PATCH 025/674] libevent2022/configure.m4: always invoke sub-configure In order to make "make distclean" (and friends) work, we need to *always* invoke the embedded configure script -- even if we know that we're not going to use this component. But in cases where we know we're not going to use this component, we also need to avoid the side effects of the code path that is used when we *do* want to use this component. So split the two possibilities into two different macros: 1. MCA_opal_event_libevent2022_FAKE_CONFIG: which does almost nothing except invoke the underlying "configure" script. 2. MCA_opal_event_libevent2022_REAL_CONFIG: which does all the real work (including invoking the underlying "configure" script). Signed-off-by: Jeff Squyres (cherry picked from commit 69aa46e1676c00bb41e54b95bbcf1df3b00dc9c1) --- opal/mca/event/libevent2022/configure.m4 | 100 +++++++++++++++-------- 1 file changed, 65 insertions(+), 35 deletions(-) diff --git a/opal/mca/event/libevent2022/configure.m4 b/opal/mca/event/libevent2022/configure.m4 index 8f1319305bf..244fcc8ba4b 100644 --- a/opal/mca/event/libevent2022/configure.m4 +++ b/opal/mca/event/libevent2022/configure.m4 @@ -35,8 +35,8 @@ AC_DEFUN([MCA_opal_event_libevent2022_POST_CONFIG], [ # copied from libevent's Makefile.am. AC_CONFIG_COMMANDS([opal/mca/event/libevent2022/libevent/include/event2/event-config.h], - [libevent_basedir="opal/mca/event/libevent2022" - libevent_file="$libevent_basedir/libevent/include/event2/event-config.h" + [opal_event_libevent2022_basedir="opal/mca/event/libevent2022" + libevent_file="$opal_event_libevent2022_basedir/libevent/include/event2/event-config.h" rm -f "$libevent_file.new" cat > "$libevent_file.new" <> "$libevent_file.new" + -e 's/#ifndef /#ifndef _EVENT_/' < "$opal_event_libevent2022_basedir/libevent/config.h" >> "$libevent_file.new" echo "#endif" >> "$libevent_file.new" # Only make a new .h libevent_file if the @@ -75,7 +75,7 @@ EOF # Add some stuff to CPPFLAGS so that the rest of the source # tree can be built - libevent_file=$libevent_basedir/libevent + libevent_file=$opal_event_libevent2022_basedir/libevent CPPFLAGS="-I$OPAL_TOP_SRCDIR/$libevent_file -I$OPAL_TOP_SRCDIR/$libevent_file/include $CPPFLAGS" AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"], [CPPFLAGS="-I$OPAL_TOP_BUILDDIR/$libevent_file/include $CPPFLAGS"]) @@ -87,6 +87,9 @@ dnl MCA_event_libevent2022_CONFIG([action-if-can-compile], dnl [action-if-cant-compile]) dnl ------------------------------------------------ AC_DEFUN([MCA_opal_event_libevent2022_CONFIG],[ + AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile]) + opal_event_libevent2022_basedir="opal/mca/event/libevent2022" + # We know that the external event component will be configured # before this one because of its priority. This component is only # needed if the external component was not successful in selecting @@ -94,18 +97,37 @@ AC_DEFUN([MCA_opal_event_libevent2022_CONFIG],[ AC_MSG_CHECKING([if event external component succeeded]) AS_IF([test "$opal_event_external_support" = "yes"], [AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([event:external succeeded, so this component will be skipped]) - $2], + AC_MSG_NOTICE([event:external succeeded, so this component will be configured, but then will be skipped]) + MCA_opal_event_libevent2022_FAKE_CONFIG($2)], [AC_MSG_RESULT([no]) AC_MSG_NOTICE([event:external failed, so this component will be used]) - MCA_opal_event_libevent2022_BACKEND_CONFIG($1, $2)]) + MCA_opal_event_libevent2022_REAL_CONFIG($1, $2)]) ]) -AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[ - OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy]) +dnl +dnl This macro is invoked when event:external is going to be used (and +dnl this component is *not* going to be used). +dnl +dnl $1: action if this component can compile +dnl (we still invoke $1 so that "make distclean" and friends will work) +dnl +AC_DEFUN([MCA_opal_event_libevent2022_FAKE_CONFIG],[ + MCA_opal_event_libevent2022_SUB_CONFIGURE([], [], []) + AC_MSG_NOTICE([remember: event:external will be used; this component was configured, but will be skipped]) + $1 +]) - AC_CONFIG_FILES([opal/mca/event/libevent2022/Makefile]) - libevent_basedir="opal/mca/event/libevent2022" +dnl +dnl This macro has a bunch of side effects. It is only meant to be +dnl invoked when this component is going to be used (i.e., when +dnl event:external is *not* going to be used). If this macro is invoked +dnl when event:external is used, Terrible Things will happen. +dnl +dnl $1: action if this component can compile +dnl $2: action if this component cannot compile +dnl +AC_DEFUN([MCA_opal_event_libevent2022_REAL_CONFIG],[ + OPAL_VAR_SCOPE_PUSH([CFLAGS_save CPPFLAGS_save libevent_file event_args libevent_happy]) CFLAGS_save="$CFLAGS" CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS" @@ -175,14 +197,14 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[ AC_MSG_RESULT([$event_args]) + # Invoke the embedded configure script. # We define "random" to be "opal_random" so that Libevent will not # use random(3) internally (and potentially unexpectedly perturb # values returned by rand(3) to the application). - CPPFLAGS="$CPPFLAGS -Drandom=opal_random" - OPAL_CONFIG_SUBDIR([$libevent_basedir/libevent], - [$event_args $opal_subdir_args 'CPPFLAGS=$CPPFLAGS'], - [libevent_happy="yes"], [libevent_happy="no"]) + MCA_opal_event_libevent2022_SUB_CONFIGURE([$event_args], + [libevent_happy="yes"], + [libevent_happy="no"]) if test "$libevent_happy" = "no"; then AC_MSG_WARN([Event library failed to configure]) AC_MSG_ERROR([Cannot continue]) @@ -200,26 +222,34 @@ AC_DEFUN([MCA_opal_event_libevent2022_BACKEND_CONFIG],[ # the value in the generated libevent/config.h (NOT # libevent/include/event2/event-config.h!). Otherwise, set it to # 0. - libevent_file=$libevent_basedir/libevent/config.h - - # If we are not building the internal libevent, then indicate that - # this component should not be built. NOTE: we still did all the - # above configury so that all the proper GNU Autotools - # infrastructure is setup properly (e.g., w.r.t. SUBDIRS=libevent in - # this directory's Makefile.am, we still need the Autotools "make - # distclean" infrastructure to work properly). - - AS_IF([test "$with_libevent" != "internal" && test -n "$with_libevent" && test "$with_libevent" != "yes"], - [AC_MSG_WARN([using an external libevent; disqualifying this component]) - libevent_happy=no], - - [AS_IF([test "$libevent_happy" = "yes" && test -r $libevent_file], - [OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $libevent_file | awk '{print [$]3 }'` - $1], - [$2 - OPAL_HAVE_WORKING_EVENTOPS=0]) - ] - ) + libevent_file=$opal_event_libevent2022_basedir/libevent/config.h + + AS_IF([test "$libevent_happy" = "yes" && test -r $libevent_file], + [OPAL_HAVE_WORKING_EVENTOPS=`grep HAVE_WORKING_EVENTOPS $libevent_file | awk '{print [$]3 }'` + $1], + [$2 + OPAL_HAVE_WORKING_EVENTOPS=0]) OPAL_VAR_SCOPE_POP ]) + +dnl Call configure in the embedded libevent. +dnl +dnl We still do this so that all the proper GNU Autotools +dnl infrastructure is setup properly (e.g., w.r.t. SUBDIRS=libevent in +dnl this directorys Makefile.am, we still need the Autotools "make +dnl distclean" infrastructure to work properly). +dnl +dnl $1: extra configure arguments +dnl $2: action on success +dnl $3: action on failure +dnl +AC_DEFUN([MCA_opal_event_libevent2022_SUB_CONFIGURE],[ + # We define "random" to be "opal_random" so that Libevent will not + # use random(3) internally (and potentially unexpectedly perturb + # values returned by rand(3) to the application). + + OPAL_CONFIG_SUBDIR([$opal_event_libevent2022_basedir/libevent], + [$1 $opal_subdir_args 'CPPFLAGS=$CPPFLAGS'], + [$2], [$3]) +]) From 72e5766a56de9532a79be7002b6583acdf4e1673 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 11 Aug 2018 06:04:06 -0700 Subject: [PATCH 026/674] hwloc201/configure.m4: make it safe when used with hwloc:external The Autoconf AC_CONFIG_* macros can only be instantiated exacly once for any given file, *and* they must be in a code execution path at run time for the target file to be generated at the end of configure. For example, if you want to generate file ABC at the end of configure, you must invoke the AC_CONFIG_FILES(ABC) macro in a code path that will get executed when configure is run. That's pretty straightforward. What's not straightforward is two corner cases: 1. You cannot invoke the AC_CONFIG_FILES(ABC) macro for the same file more than once. If you do, autoreconf will fail (even before you can run configure). 2. If AC_CONFIG_FILES(ABC) is not in a code path that is executed by configure, the file ABC is not registered properly, and ABC will not be generated at the end of configure. This applies to hwloc because hwloc's HWLOC_SETUP_CORE macro calls both AC_CONFIG_FILES and AC_CONFIG_HEADER to setup its Makefiles (etc.) so that targets like "make distclean" and "make distcheck" will work properly. Hence, we *have* to invoke HWLOC_SETUP_CORE. However, the MCA_opal_hwloc_hwloc201_CONFIG macro has a few side effects. It would be nice to do able to do something like this: ``` if hwloc:extern is going to be used: Invoke minimal HWLOC_SETUP_CORE (with no side effects) else Invoke full HWLOC_SETUP_CORE (with side effects) fi ``` But we can't, because autoreconf will detect that AC_CONFIG_FILES has been invoked on the same files more than once (regardless of whether those code paths will be executed at run time or not). Kaboom. Similarly, we can't do this: ``` if hwloc:extern is not going to be used: Invoke full HWLOC_SETUP_CORE (with side effects) fi ``` Because then hwloc's AC_CONFIG_FILES won't be registered properly when hwloc:external *is* used (i.e., when the HWLOC_SETUP_CORE macro is not in a code path that is executed at run time), and targets like "make distclean" will fail because hwloc's Makefiles won't have been setup. Kaboom. But remember that the hwloc framework is a bit special: there will only ever be 2 comoponents: external and internal. External is guaranteed to be configured first because of its priority. So the internal component (i.e., this component) immediately knows if it is going to be used or not based on whether the external component configuration succeeded or failed. Specifically: regardless of whether the internal component (i.e., this component) is going to be used, we have to invoke HWLOC_SETUP_CORE. But we can manage the side effects: allow the side effects when this/internal component is going to be used, and avoid the side effects when this/internal component is not going to be used. This is a little less clean than I would have liked, but because of Autoconf's oddity about its AC_CONFIG_* macros, this is the only solution I could come up with. Signed-off-by: Jeff Squyres (cherry picked from commit 01e4570af759b113b965b63df7bfc72a78d69654) --- opal/mca/hwloc/hwloc201/configure.m4 | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/opal/mca/hwloc/hwloc201/configure.m4 b/opal/mca/hwloc/hwloc201/configure.m4 index 9da91b2c958..78b1b9856fb 100644 --- a/opal/mca/hwloc/hwloc201/configure.m4 +++ b/opal/mca/hwloc/hwloc201/configure.m4 @@ -69,27 +69,23 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_POST_CONFIG],[ # MCA_hwloc_hwloc201_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([MCA_opal_hwloc_hwloc201_CONFIG],[ + # Hwloc needs to know if we have Verbs support + AC_REQUIRE([OPAL_CHECK_VERBS_DIR]) + + AC_CONFIG_FILES([opal/mca/hwloc/hwloc201/Makefile]) + + OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc201_save_CPPFLAGS opal_hwloc_hwloc201_save_LDFLAGS opal_hwloc_hwloc201_save_LIBS opal_hwloc_hwloc201_save_cairo opal_hwloc_hwloc201_save_xml opal_hwloc_hwloc201_save_mode opal_hwloc_hwloc201_basedir opal_hwloc_hwloc201_file opal_hwloc_hwloc201_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external]) + # We know that the external hwloc component will be configured # before this one because of its priority. This component is only # needed if the external component was not successful in selecting - # itself. + # itself. Print out a message explaining this. AC_MSG_CHECKING([if hwloc external component succeeded]) AS_IF([test "$opal_hwloc_external_support" = "yes"], [AC_MSG_RESULT([yes]) - AC_MSG_NOTICE([hwloc:external succeeded, so this component will be skipped]) - $2], + AC_MSG_NOTICE([hwloc:external succeeded, so this component will be configured, but then will be skipped])], [AC_MSG_RESULT([no]) - AC_MSG_NOTICE([hwloc:external failed, so this component will be used]) - MCA_opal_hwloc_hwloc201_BACKEND_CONFIG($1, $2)]) -]) - -AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[ - # Hwloc needs to know if we have Verbs support - AC_REQUIRE([OPAL_CHECK_VERBS_DIR]) - - AC_CONFIG_FILES([opal/mca/hwloc/hwloc201/Makefile]) - - OPAL_VAR_SCOPE_PUSH([HWLOC_VERSION opal_hwloc_hwloc201_save_CPPFLAGS opal_hwloc_hwloc201_save_LDFLAGS opal_hwloc_hwloc201_save_LIBS opal_hwloc_hwloc201_save_cairo opal_hwloc_hwloc201_save_xml opal_hwloc_hwloc201_save_mode opal_hwloc_hwloc201_basedir opal_hwloc_hwloc201_file opal_hwloc_hwloc201_save_cflags CPPFLAGS_save LIBS_save opal_hwloc_external]) + AC_MSG_NOTICE([hwloc:external failed, so this component will be used])]) # default to this component not providing support opal_hwloc_hwloc201_basedir=opal/mca/hwloc/hwloc201 @@ -99,8 +95,6 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[ opal_hwloc_hwloc201_save_LDFLAGS=$LDFLAGS opal_hwloc_hwloc201_save_LIBS=$LIBS - HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_]) - # save XML or graphical options opal_hwloc_hwloc201_save_cairo=$enable_cairo opal_hwloc_hwloc201_save_xml=$enable_xml @@ -143,6 +137,12 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[ AS_IF([test -n "$opal_datatype_cuda_CPPFLAGS"], [CPPFLAGS="$CPPFLAGS $opal_datatype_cuda_CPPFLAGS"]) + # Only set the symbol prefix if this component is being used + # (i.e., if the external component is not being used). + AS_IF([test "$opal_hwloc_external_support" = "no"], + [HWLOC_SET_SYMBOL_PREFIX([opal_hwloc201_])]) + + # Do the bulk of the hwloc core setup HWLOC_SETUP_CORE([opal/mca/hwloc/hwloc201/hwloc], [AC_MSG_CHECKING([whether hwloc configure succeeded]) AC_MSG_RESULT([yes]) @@ -202,8 +202,8 @@ AC_DEFUN([MCA_opal_hwloc_hwloc201_BACKEND_CONFIG],[ # infrastructure is setup properly (e.g., w.r.t. SUBDIRS=hwloc in # this directory's Makefile.am, we still need the Autotools "make # distclean" infrastructure to work properly). - AS_IF([test "$opal_hwloc_external" = "yes"], - [AC_MSG_WARN([using an external hwloc; disqualifying this component]) + AS_IF([test "$opal_hwloc_external_support" = "yes"], + [AC_MSG_NOTICE([using an external hwloc; disqualifying this component]) opal_hwloc_hwloc201_support=no], [AC_DEFINE([HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC], [1]) AC_DEFINE([HAVE_HWLOC_TOPOLOGY_DUP], [1])]) From b4f80e4e36a71db1e672842d6c600dc0664f1f1e Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 13 Aug 2018 10:14:34 -0600 Subject: [PATCH 027/674] btl/vader: move memory barrier to where it belongs The write memory barrier was intended to precede setting a fast-box header but instead follows it. This commit moves the memory barrier to the intended location. Signed-off-by: Nathan Hjelm (cherry picked from commit dca3516765a4b5927b1877ca59d952baec42bc4a) --- opal/mca/btl/vader/btl_vader_fbox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_fbox.h b/opal/mca/btl/vader/btl_vader_fbox.h index abaf12811e4..17239ce8ef0 100644 --- a/opal/mca/btl/vader/btl_vader_fbox.h +++ b/opal/mca/btl/vader/btl_vader_fbox.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights + * Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -51,8 +51,8 @@ static inline void mca_btl_vader_fbox_set_header (mca_btl_vader_fbox_hdr_t *hdr, uint16_t seq, uint32_t size) { mca_btl_vader_fbox_hdr_t tmp = {.data = {.tag = tag, .seq = seq, .size = size}}; - hdr->ival = tmp.ival; opal_atomic_wmb (); + hdr->ival = tmp.ival; } /* attempt to reserve a contiguous segment from the remote ep */ From 7f443a159ae4e92e87289caf0815e42a9d7fdc90 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 16 Aug 2018 10:29:31 -0700 Subject: [PATCH 028/674] fortran/use TKR: remove excess declaration for PMPI_Type_extent This declaration was accidentally left behind in 89da9651bb2fe. Signed-off-by: Jeff Squyres (cherry picked from commit 8a0b5454ae26acc4984129e20ac152ca8e2214e5) --- ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-interfaces.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-interfaces.h b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-interfaces.h index a4c665a3d12..47e022e648c 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-interfaces.h +++ b/ompi/mpi/fortran/use-mpi-tkr/pmpi-f90-interfaces.h @@ -1595,17 +1595,6 @@ end subroutine PMPI_Type_dup end interface -interface PMPI_Type_extent - -subroutine PMPI_Type_extent(datatype, extent, ierror) - integer, intent(in) :: datatype - integer, intent(out) :: extent - integer, intent(out) :: ierror -end subroutine PMPI_Type_extent - -end interface - - interface PMPI_Type_free subroutine PMPI_Type_free(datatype, ierror) From 8873d901e882c9cdfe764767125bfe6ab8558cce Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Mon, 30 Jul 2018 16:55:52 +0600 Subject: [PATCH 029/674] pmix: added check for pmix fence status Signed-off-by: Boris Karasev (cherry picked from commit 57683366ca300fe353e91c52dc9aa0f657120d4d) Conflicts: opal/mca/common/ucx/common_ucx.c opal/mca/common/ucx/common_ucx.h Modified: ompi/mca/pml/ucx/pml_ucx.c oshmem/mca/spml/ucx/spml_ucx.c --- ompi/dpm/dpm.c | 6 +++- ompi/mca/bml/r2/bml_r2_ft.c | 10 +++++-- ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c | 20 +++++++++---- ompi/mca/pml/bfo/pml_bfo.c | 40 ++++++++++++++++++++------ ompi/mca/pml/ob1/pml_ob1.c | 40 ++++++++++++++++++++------ ompi/mca/pml/ucx/pml_ucx.c | 6 +++- ompi/mca/pml/yalla/pml_yalla.c | 5 +++- ompi/runtime/ompi_mpi_finalize.c | 12 ++++++-- ompi/runtime/ompi_mpi_init.c | 43 ++++++++++++++++++++++------ opal/mca/common/ucx/common_ucx.c | 12 ++++++-- opal/mca/common/ucx/common_ucx.h | 2 +- orte/mca/ess/pmi/ess_pmi_module.c | 5 +++- orte/mca/snapc/full/snapc_full_app.c | 12 ++++++-- oshmem/mca/spml/ucx/spml_ucx.c | 6 +++- 14 files changed, 174 insertions(+), 45 deletions(-) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index 14810f6b028..a9a2de586c4 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -589,7 +589,11 @@ int ompi_dpm_disconnect(ompi_communicator_t *comm) /* ensure we tell the host RM to disconnect us - this * is a blocking operation so just use a fence */ - ret = opal_pmix.fence(&coll, false); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(&coll, false))) { + OMPI_ERROR_LOG(ret); + OPAL_LIST_DESTRUCT(&coll); + return ret; + } OPAL_LIST_DESTRUCT(&coll); return ret; diff --git a/ompi/mca/bml/r2/bml_r2_ft.c b/ompi/mca/bml/r2/bml_r2_ft.c index 95fc6ade66b..8dc45d4f1e3 100644 --- a/ompi/mca/bml/r2/bml_r2_ft.c +++ b/ompi/mca/bml/r2/bml_r2_ft.c @@ -155,7 +155,10 @@ int mca_bml_r2_ft_event(int state) * Barrier to make all processes have been successfully restarted before * we try to remove some restart only files. */ - opal_pmix.fence(NULL, 0); + if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "bml:r2: ft_event(Restart): Failed to fence complete\n"); + return ret; + } /* * Re-open the BTL framework to get the full list of components. @@ -224,7 +227,10 @@ int mca_bml_r2_ft_event(int state) * Barrier to make all processes have been successfully restarted before * we try to remove some restart only files. */ - opal_pmix.fence(NULL, 0); + if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "bml:r2: ft_event(Restart): Failed to fence complete\n"); + return ret; + } /* * Re-open the BTL framework to get the full list of components. diff --git a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c index 7d5e480095a..3276df26d0a 100644 --- a/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c +++ b/ompi/mca/crcp/bkmrk/crcp_bkmrk_pml.c @@ -3028,7 +3028,10 @@ ompi_crcp_base_pml_state_t* ompi_crcp_bkmrk_pml_ft_event( if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCPBR0); - opal_pmix.fence(NULL, 0); + if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + exit_status = ret; + goto DONE; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCP0); @@ -3096,7 +3099,10 @@ ompi_crcp_base_pml_state_t* ompi_crcp_bkmrk_pml_ft_event( if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_COREBR1); - opal_pmix.fence(NULL, 0); + if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + exit_status = ret; + goto DONE; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CORE2); } @@ -6207,14 +6213,16 @@ static void clear_timers(void) { static void display_all_timers(int state) { bool report_ready = false; double barrier_start, barrier_stop; - int i; + int i, ret; if( 0 != OMPI_PROC_MY_NAME->vpid ) { if( 2 > timing_enabled ) { return; } else if( 2 == timing_enabled ) { - opal_pmix.fence(NULL, 0); + if( OPAL_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + OPAL_ERROR_LOG(ret); + } return; } } @@ -6235,7 +6243,9 @@ static void display_all_timers(int state) { if( timing_enabled >= 2) { barrier_start = get_time(); - opal_pmix.fence(NULL, 0); + if( OPAL_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + OPAL_ERROR_LOG(ret); + } barrier_stop = get_time(); opal_output(0, "crcp:bkmrk: timing(%20s): %20s = %10.2f s\n", diff --git a/ompi/mca/pml/bfo/pml_bfo.c b/ompi/mca/pml/bfo/pml_bfo.c index e3a1beb447a..ce33b0d57be 100644 --- a/ompi/mca/pml/bfo/pml_bfo.c +++ b/ompi/mca/pml/bfo/pml_bfo.c @@ -666,7 +666,10 @@ int mca_pml_bfo_ft_event( int state ) if(OPAL_CRS_CHECKPOINT == state) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCPBR1); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P0); @@ -677,7 +680,10 @@ int mca_pml_bfo_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_COREBR0); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P2); } @@ -777,7 +783,10 @@ int mca_pml_bfo_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR1); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P3); } @@ -787,7 +796,10 @@ int mca_pml_bfo_ft_event( int state ) * Exchange the modex information once again. * BTLs will have republished their modex information. */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } /* * Startup the PML stack now that the modex is running again @@ -799,7 +811,10 @@ int mca_pml_bfo_ft_event( int state ) } /* Is this barrier necessary ? JJH */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } if( NULL != procs ) { for(p = 0; p < (int)num_procs; ++p) { @@ -812,7 +827,10 @@ int mca_pml_bfo_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR2); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCP1); } @@ -825,7 +843,10 @@ int mca_pml_bfo_ft_event( int state ) * Exchange the modex information once again. * BTLs will have republished their modex information. */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } /* * Startup the PML stack now that the modex is running again @@ -837,7 +858,10 @@ int mca_pml_bfo_ft_event( int state ) } /* Is this barrier necessary ? JJH */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); + return ret; + } if( NULL != procs ) { for(p = 0; p < (int)num_procs; ++p) { diff --git a/ompi/mca/pml/ob1/pml_ob1.c b/ompi/mca/pml/ob1/pml_ob1.c index 5adf19028a8..f4cc24c8ba0 100644 --- a/ompi/mca/pml/ob1/pml_ob1.c +++ b/ompi/mca/pml/ob1/pml_ob1.c @@ -807,7 +807,10 @@ int mca_pml_ob1_ft_event( int state ) if(OPAL_CRS_CHECKPOINT == state) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCPBR1); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P0); @@ -818,7 +821,10 @@ int mca_pml_ob1_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_COREBR0); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P2); } @@ -918,13 +924,19 @@ int mca_pml_ob1_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR1); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P3); } if (opal_cr_continue_like_restart && !first_continue_pass) { - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } /* * Startup the PML stack now that the modex is running again @@ -936,7 +948,10 @@ int mca_pml_ob1_ft_event( int state ) } /* Is this barrier necessary ? JJH */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } if( NULL != procs ) { for(p = 0; p < (int)num_procs; ++p) { @@ -949,7 +964,10 @@ int mca_pml_ob1_ft_event( int state ) if( !first_continue_pass ) { if( opal_cr_timing_barrier_enabled ) { OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR2); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } } OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCP1); } @@ -962,7 +980,10 @@ int mca_pml_ob1_ft_event( int state ) * Exchange the modex information once again. * BTLs will have republished their modex information. */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } /* * Startup the PML stack now that the modex is running again @@ -974,7 +995,10 @@ int mca_pml_ob1_ft_event( int state ) } /* Is this barrier necessary ? JJH */ - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + opal_output(0, "pml:ob1: ft_event(Restart): Failed to fence complete"); + return ret; + } if( NULL != procs ) { for(p = 0; p < (int)num_procs; ++p) { diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 9dcae3dd6b5..697dd078e38 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -389,6 +389,7 @@ int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) void *dreq, **dreqs; ucp_ep_h ep; size_t i; + int ret; max_reqs = ompi_pml_ucx.num_disconnect; if (max_reqs > nprocs) { @@ -433,7 +434,10 @@ int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) mca_pml_ucx_waitall(dreqs, &num_reqs); free(dreqs); - opal_common_ucx_mca_pmix_fence(ompi_pml_ucx.ucp_worker); + if (OMPI_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence( + ompi_pml_ucx.ucp_worker))) { + return ret; + } return OMPI_SUCCESS; } diff --git a/ompi/mca/pml/yalla/pml_yalla.c b/ompi/mca/pml/yalla/pml_yalla.c index 7890293c330..03bb65d420d 100644 --- a/ompi/mca/pml/yalla/pml_yalla.c +++ b/ompi/mca/pml/yalla/pml_yalla.c @@ -265,6 +265,7 @@ int mca_pml_yalla_add_procs(struct ompi_proc_t **procs, size_t nprocs) int mca_pml_yalla_del_procs(struct ompi_proc_t **procs, size_t nprocs) { size_t i; + int ret; if (ompi_mpi_state >= OMPI_MPI_STATE_FINALIZE_STARTED) { PML_YALLA_VERBOSE(3, "%s", "using bulk powerdown"); @@ -276,7 +277,9 @@ int mca_pml_yalla_del_procs(struct ompi_proc_t **procs, size_t nprocs) PML_YALLA_VERBOSE(2, "disconnected from rank %s", OPAL_NAME_PRINT(procs[i]->super.proc_name)); procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PML] = NULL; } - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + return ret; + } return OMPI_SUCCESS; } diff --git a/ompi/runtime/ompi_mpi_finalize.c b/ompi/runtime/ompi_mpi_finalize.c index a235f6ba2d2..b636ddfbaab 100644 --- a/ompi/runtime/ompi_mpi_finalize.c +++ b/ompi/runtime/ompi_mpi_finalize.c @@ -257,7 +257,13 @@ int ompi_mpi_finalize(void) * communications/actions to complete. See * https://github.com/open-mpi/ompi/issues/1576 for the * original bug report. */ - opal_pmix.fence_nb(NULL, 0, fence_cbfunc, (void*)&active); + if (OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, 0, fence_cbfunc, + (void*)&active))) { + OMPI_ERROR_LOG(ret); + /* Reset the active flag to false, to avoid waiting for + * completion when the fence was failed. */ + active = false; + } OMPI_LAZY_WAIT_FOR_COMPLETION(active); } else { /* However, we cannot guarantee that the provided PMIx has @@ -268,7 +274,9 @@ int ompi_mpi_finalize(void) ompi_communicator_t *comm = &ompi_mpi_comm_world.comm; comm->c_coll->coll_barrier(comm, comm->c_coll->coll_barrier_module); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + OMPI_ERROR_LOG(ret); + } } } diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 00e450c923a..b35c491b735 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -662,9 +662,15 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided, #if (OPAL_ENABLE_TIMING) if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex && opal_pmix_collect_all_data) { - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + error = "timing: pmix-barrier-1 failed"; + goto error; + } OMPI_TIMING_NEXT("pmix-barrier-1"); - opal_pmix.fence(NULL, 0); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + error = "timing: pmix-barrier-2 failed"; + goto error; + } OMPI_TIMING_NEXT("pmix-barrier-2"); } #endif @@ -687,19 +693,32 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided, background_fence = true; active = true; OPAL_POST_OBJECT(&active); - opal_pmix.fence_nb(NULL, true, fence_release, (void*)&active); + if( OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, true, + fence_release, + (void*)&active))) { + error = "opal_pmix.fence_nb() failed"; + goto error; + } + } else if (!opal_pmix_base_async_modex) { /* we want to do the modex */ active = true; OPAL_POST_OBJECT(&active); - opal_pmix.fence_nb(NULL, opal_pmix_collect_all_data, - fence_release, (void*)&active); + if( OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, + opal_pmix_collect_all_data, fence_release, (void*)&active))) { + error = "opal_pmix.fence_nb() failed"; + goto error; + } /* cannot just wait on thread as we need to call opal_progress */ OMPI_LAZY_WAIT_FOR_COMPLETION(active); } /* otherwise, we don't want to do the modex, so fall thru */ } else if (!opal_pmix_base_async_modex || opal_pmix_collect_all_data) { - opal_pmix.fence(NULL, opal_pmix_collect_all_data); + if( OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, + opal_pmix_collect_all_data))) { + error = "opal_pmix.fence() failed"; + goto error; + } } OMPI_TIMING_NEXT("modex"); @@ -877,11 +896,17 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided, if (NULL != opal_pmix.fence_nb) { active = true; OPAL_POST_OBJECT(&active); - opal_pmix.fence_nb(NULL, false, - fence_release, (void*)&active); + if (OMPI_SUCCESS != (ret = opal_pmix.fence_nb(NULL, false, + fence_release, (void*)&active))) { + error = "opal_pmix.fence_nb() failed"; + goto error; + } OMPI_LAZY_WAIT_FOR_COMPLETION(active); } else { - opal_pmix.fence(NULL, false); + if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, false))) { + error = "opal_pmix.fence() failed"; + goto error; + } } } diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index cd54490e4dd..62ee70ff47c 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -97,13 +97,19 @@ static void opal_common_ucx_mca_fence_complete_cb(int status, void *fenced) *(int*)fenced = 1; } -OPAL_DECLSPEC void opal_common_ucx_mca_pmix_fence(ucp_worker_h worker) +OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker) { volatile int fenced = 0; + int ret = OPAL_SUCCESS; + + if (OPAL_SUCCESS != (ret = opal_pmix.fence_nb(NULL, 0, + opal_common_ucx_mca_fence_complete_cb, (void*)&fenced))){ + return ret; + } - opal_pmix.fence_nb(NULL, 0, opal_common_ucx_mca_fence_complete_cb, (void*)&fenced); while (!fenced) { ucp_worker_progress(worker); } -} + return ret; +} diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 13a03000e83..0fe345c0695 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -65,7 +65,7 @@ extern opal_common_ucx_module_t opal_common_ucx; OPAL_DECLSPEC void opal_common_ucx_mca_register(void); OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void); OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status); -OPAL_DECLSPEC void opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); +OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); static inline int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, diff --git a/orte/mca/ess/pmi/ess_pmi_module.c b/orte/mca/ess/pmi/ess_pmi_module.c index 563b8115dcf..1515ae98885 100644 --- a/orte/mca/ess/pmi/ess_pmi_module.c +++ b/orte/mca/ess/pmi/ess_pmi_module.c @@ -458,7 +458,10 @@ static int rte_init(void) if (ORTE_PROC_IS_NON_MPI && !orte_do_not_barrier) { /* need to commit the data before we fence */ opal_pmix.commit(); - opal_pmix.fence(NULL, 0); + if (ORTE_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + error = "opal_pmix.fence() failed"; + goto error; + } } OPAL_TIMING_ENV_NEXT(rte_init, "rte_init_done"); diff --git a/orte/mca/snapc/full/snapc_full_app.c b/orte/mca/snapc/full/snapc_full_app.c index 1dd5a8d5edd..3a436bc81d4 100644 --- a/orte/mca/snapc/full/snapc_full_app.c +++ b/orte/mca/snapc/full/snapc_full_app.c @@ -150,7 +150,11 @@ int app_coord_init() "app) Startup Barrier...")); } - opal_pmix.fence(NULL, 0); + if (ORTE_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + ORTE_ERROR_LOG(ret); + exit_status = ret; + goto cleanup; + } if( 0 == ORTE_PROC_MY_NAME->vpid ) { OPAL_OUTPUT_VERBOSE((3, mca_snapc_full_component.super.output_handle, @@ -216,7 +220,11 @@ int app_coord_finalize() "app) Shutdown Barrier...")); } - opal_pmix.fence(NULL, 0); + if (ORTE_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + ORTE_ERROR_LOG(ret); + exit_status = ret; + goto cleanup; + } if( 0 == ORTE_PROC_MY_NAME->vpid ) { OPAL_OUTPUT_VERBOSE((3, mca_snapc_full_component.super.output_handle, diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 8cc1153658b..489f314b10e 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -125,6 +125,7 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) void *dreq, **dreqs; ucp_ep_h ep; size_t i, n; + int ret; oshmem_shmem_barrier(); @@ -175,7 +176,10 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) free(dreqs); free(mca_spml_ucx.remote_addrs_tbl); - opal_common_ucx_mca_pmix_fence(mca_spml_ucx_ctx_default.ucp_worker); + if (OSHMEM_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence( + mca_spml_ucx_ctx_default.ucp_worker))) { + return ret; + } free(mca_spml_ucx_ctx_default.ucp_peers); mca_spml_ucx_ctx_default.ucp_peers = NULL; return OSHMEM_SUCCESS; From 2da601a3503a05e6742eb00751b513448526d6f3 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 20 Aug 2018 09:26:21 -0500 Subject: [PATCH 030/674] common/ompio: fix an ordering problem during file_open the sharedfp component has to be selected and opened before we set the default file view during file_open. Otherwise there is a sperious error message from the sharefp_file_seek operation that is called during the file_set_view. Fixes Issue #5560 Signed-off-by: Edgar Gabriel --- .../mca/common/ompio/common_ompio_file_open.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index cb0d7d1987f..a626c55c222 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2017 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -164,15 +164,6 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, goto fn_fail; } - /* Set default file view */ - mca_common_ompio_set_view(ompio_fh, - 0, - &ompi_mpi_byte.dt, - &ompi_mpi_byte.dt, - "native", - info); - - if ( true == use_sharedfp ) { /* open the file once more for the shared file pointer if required. ** Can be disabled by the user if no shared file pointer operations @@ -191,6 +182,15 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, } } + /* Set default file view */ + mca_common_ompio_set_view(ompio_fh, + 0, + &ompi_mpi_byte.dt, + &ompi_mpi_byte.dt, + "native", + info); + + /* If file has been opened in the append mode, move the internal file pointer of OMPIO to the very end of the file. */ @@ -506,7 +506,7 @@ int mca_common_ompio_file_delete (const char *filename, return ret; } - ret = fh->f_fs->fs_file_delete (filename, NULL); + ret = fh->f_fs->fs_file_delete ( (char *)filename, NULL); free(fh); if (OMPI_SUCCESS != ret) { From 3eef3d1d8f646e569de73995b9784ed83030a419 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 20 Aug 2018 14:00:41 -0700 Subject: [PATCH 031/674] Update to PMIx 3.0.1 Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/NEWS | 26 +- opal/mca/pmix/pmix3x/pmix/VERSION | 8 +- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 1 + .../pmix3x/pmix/include/pmix_version.h.in | 3 + .../pmix3x/pmix/src/common/pmix_control.c | 21 +- .../pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c | 8 +- .../src/mca/psensor/base/psensor_base_stubs.c | 21 +- .../mca/psensor/heartbeat/psensor_heartbeat.c | 18 +- .../mca/psensor/heartbeat/psensor_heartbeat.h | 3 +- .../heartbeat/psensor_heartbeat_component.c | 16 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 16 ++ .../pmix3x/pmix/src/server/pmix_server_ops.c | 28 ++- .../pmix/pmix3x/pmix/test/simple/Makefile.am | 8 +- .../pmix/pmix3x/pmix/test/simple/simpjctrl.c | 231 ++++++++++++++++++ .../pmix/pmix3x/pmix/test/simple/simptest.c | 42 +++- 16 files changed, 410 insertions(+), 42 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index 572b06fb421..8eb5944b5b4 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -21,7 +21,21 @@ example, a bug might be fixed in the master, and then moved to the current release as well as the "stable" bug fix release branch. -3.0.0 -- TBD +3.0.1 -- 23 Aug 2018 +---------------------- +**** DEPRECATION WARNING: The pmix_info_array_t struct was +**** initially marked for deprecation in the v2.x series. +**** We failed to provide clear warning at that time. This +**** therefore serves as warning of intended removal of +**** pmix_info_array_t in the future v4 release series. +- Fixed memory corruption bug in event notification + system due to uninitialized variable +- Add numeric version field to pmix_version.h +- Transfer all cached data to client dstore upon first connect +- Implement missing job control and sensor APIs + + +3.0.0 -- 6 July 2018 ------------------------------------ **** NOTE: This release implements the complete PMIX v3.0 Standard **** and therefore includes a number of new APIs and features. These @@ -63,7 +77,15 @@ current release as well as the "stable" bug fix release branch. - Fix several memory and file descriptor leaks -2.1.2 -- TBD +2.1.3 -- 23 Aug 2018 +---------------------- +- Fixed memory corruption bug in event notification + system due to uninitialized variable +- Add numeric version definition +- Transfer all cached data to client dstore upon first connect + + +2.1.2 -- 6 July 2018 ---------------------- - Added PMIX_VERSION_RELEASE string to pmix_version.h - Added PMIX_SPAWNED and PMIX_PARENT_ID keys to all procs diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index 7453582b973..4332495ed44 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -15,7 +15,7 @@ major=3 minor=0 -release=0 +release=1 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gitffba520 +repo_rev=gitbf30a5f # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Jul 01, 2018" +date="Aug 20, 2018" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,6 +75,6 @@ date="Jul 01, 2018" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:0:2 +libpmix_so_version=4:1:2 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index 5f4613b6c26..529c24772bf 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.0.0 +Version: 3.0.1 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index 93146a45b33..a34354a6d23 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -781,6 +781,7 @@ typedef int pmix_status_t; #define PMIX_LAUNCH_DIRECTIVE (PMIX_ERR_OP_BASE - 24) #define PMIX_LAUNCHER_READY (PMIX_ERR_OP_BASE - 25) #define PMIX_OPERATION_IN_PROGRESS (PMIX_ERR_OP_BASE - 26) +#define PMIX_OPERATION_SUCCEEDED (PMIX_ERR_OP_BASE - 27) /* define a starting point for system error constants so diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in index a88e3a0c0e3..dc8570f38fe 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in @@ -2,6 +2,7 @@ * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -17,4 +18,6 @@ #define PMIX_VERSION_MAJOR @pmixmajor@ #define PMIX_VERSION_MINOR @pmixminor@ #define PMIX_VERSION_RELEASE @pmixrelease@ + +#define PMIX_NUMERIC_VERSION 0x00030001 #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c index 26123cca2a6..615db82630b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c @@ -85,7 +85,7 @@ static void query_cbfunc(struct pmix_peer_t *peer, /* unpack any returned data */ cnt = 1; PMIX_BFROPS_UNPACK(rc, peer, buf, &results->ninfo, &cnt, PMIX_SIZE); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { PMIX_ERROR_LOG(rc); goto complete; } @@ -332,6 +332,12 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm return PMIX_ERR_INIT; } + /* sanity check */ + if (NULL == monitor) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_BAD_PARAM; + } + /* if we are the server, then we just issue the request and * return the response */ if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && @@ -355,6 +361,19 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm } PMIX_RELEASE_THREAD(&pmix_global_lock); + /* if the monitor is PMIX_SEND_HEARTBEAT, then send it */ + if (0 == strncmp(monitor->key, PMIX_SEND_HEARTBEAT, PMIX_MAX_KEYLEN)) { + msg = PMIX_NEW(pmix_buffer_t); + if (NULL == msg) { + return PMIX_ERR_NOMEM; + } + PMIX_PTL_SEND_ONEWAY(rc, pmix_client_globals.myserver, msg, PMIX_PTL_TAG_HEARTBEAT); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(msg); + } + return rc; + } + /* if we are a client, then relay this request to the server */ msg = PMIX_NEW(pmix_buffer_t); /* pack the cmd */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c index 102f64f27c9..52465412253 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 Research Organization for Information Science @@ -3170,7 +3170,7 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, char *msg; pmix_status_t rc; pmix_proc_t proc; - pmix_rank_info_t *rinfo; + pmix_rank_t rank; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:dstore:register_job_info for peer [%s:%d]", @@ -3187,8 +3187,8 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, return rc; } - PMIX_LIST_FOREACH(rinfo, &ns->ranks, pmix_rank_info_t) { - proc.rank = rinfo->pname.rank; + for (rank=0; rank < ns->nprocs; rank++) { + proc.rank = rank; rc = _store_job_info(&proc); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c index c24b57d6986..b959372fe02 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/base/psensor_base_stubs.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -24,6 +24,7 @@ pmix_status_t pmix_psensor_base_start(pmix_peer_t *requestor, pmix_status_t erro { pmix_psensor_active_module_t *mod; pmix_status_t rc; + bool didit = false; pmix_output_verbose(5, pmix_psensor_base_framework.framework_output, "%s:%d sensor:base: starting sensors", @@ -36,9 +37,17 @@ pmix_status_t pmix_psensor_base_start(pmix_peer_t *requestor, pmix_status_t erro if (PMIX_SUCCESS != rc && PMIX_ERR_TAKE_NEXT_OPTION != rc) { return rc; } + didit = true; } } + /* if none of the components could do it, then report + * not supported upwards so the server knows to ask + * the host to try */ + if (!didit) { + return PMIX_ERR_NOT_SUPPORTED; + } + return PMIX_SUCCESS; } @@ -46,7 +55,7 @@ pmix_status_t pmix_psensor_base_stop(pmix_peer_t *requestor, char *id) { pmix_psensor_active_module_t *mod; - pmix_status_t rc; + pmix_status_t rc, ret = PMIX_SUCCESS; pmix_output_verbose(5, pmix_psensor_base_framework.framework_output, "%s:%d sensor:base: stopping sensors", @@ -57,10 +66,14 @@ pmix_status_t pmix_psensor_base_stop(pmix_peer_t *requestor, if (NULL != mod->module->stop) { rc = mod->module->stop(requestor, id); if (PMIX_SUCCESS != rc && PMIX_ERR_TAKE_NEXT_OPTION != rc) { - return rc; + if (PMIX_SUCCESS == ret) { + ret = rc; + } + /* need to continue to ensure that all + * sensors have been stopped */ } } } - return PMIX_SUCCESS; + return ret; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c index 7d363c030b4..0018284dcfb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c @@ -3,7 +3,7 @@ * Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights * reserved. * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,7 +30,7 @@ #include "src/util/output.h" #include "src/util/show_help.h" #include "src/include/pmix_globals.h" -#include "src/mca/ptl/ptl.h" +#include "src/mca/ptl/base/base.h" #include "src/mca/psensor/base/base.h" #include "psensor_heartbeat.h" @@ -168,6 +168,7 @@ static pmix_status_t heartbeat_start(pmix_peer_t *requestor, pmix_status_t error { pmix_heartbeat_trkr_t *ft; size_t n; + pmix_ptl_posted_recv_t *rcv; PMIX_OUTPUT_VERBOSE((1, pmix_psensor_base_framework.framework_output, "[%s:%d] checking heartbeat monitoring for requestor %s:%d", @@ -202,6 +203,17 @@ static pmix_status_t heartbeat_start(pmix_peer_t *requestor, pmix_status_t error return PMIX_ERR_BAD_PARAM; } + /* if the recv hasn't been posted, so so now */ + if (!mca_psensor_heartbeat_component.recv_active) { + /* setup to receive heartbeats */ + rcv = PMIX_NEW(pmix_ptl_posted_recv_t); + rcv->tag = PMIX_PTL_TAG_HEARTBEAT; + rcv->cbfunc = pmix_psensor_heartbeat_recv_beats; + /* add it to the beginning of the list of recvs */ + pmix_list_prepend(&pmix_ptl_globals.posted_recvs, &rcv->super); + mca_psensor_heartbeat_component.recv_active = true; + } + /* need to push into our event base to add this to our trackers */ pmix_event_assign(&ft->cdev, pmix_psensor_base.evbase, -1, EV_WRITE, add_tracker, ft); @@ -241,7 +253,7 @@ static pmix_status_t heartbeat_stop(pmix_peer_t *requestor, char *id) cd->requestor = requestor; cd->id = strdup(id); - /* need to push into our event base to add this to our trackers */ + /* need to push into our event base to remove this from our trackers */ pmix_event_assign(&cd->ev, pmix_psensor_base.evbase, -1, EV_WRITE, del_tracker, cd); PMIX_POST_OBJECT(cd); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h index 2f904b60359..2052b0d9c66 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,6 +28,7 @@ BEGIN_C_DECLS typedef struct { pmix_psensor_base_component_t super; + bool recv_active; pmix_list_t trackers; } pmix_psensor_heartbeat_component_t; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c index 7f6f18f2ff7..1f56177dee2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat_component.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,14 +50,9 @@ pmix_psensor_heartbeat_component_t mca_psensor_heartbeat_component = { */ static int heartbeat_open(void) { - pmix_status_t rc; - PMIX_CONSTRUCT(&mca_psensor_heartbeat_component.trackers, pmix_list_t); - /* setup to receive heartbeats */ - PMIX_PTL_RECV(rc, pmix_globals.mypeer, pmix_psensor_heartbeat_recv_beats, PMIX_PTL_TAG_HEARTBEAT); - - return rc; + return PMIX_SUCCESS; } @@ -74,12 +69,7 @@ static int heartbeat_query(pmix_mca_base_module_t **module, int *priority) static int heartbeat_close(void) { - pmix_status_t rc; - - /* cancel our persistent recv */ - PMIX_PTL_CANCEL(rc, pmix_globals.mypeer, PMIX_PTL_TAG_HEARTBEAT); - PMIX_LIST_DESTRUCT(&mca_psensor_heartbeat_component.trackers); - return rc; + return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index 29046877758..ea80c46e3ac 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -66,6 +66,7 @@ #include "src/mca/bfrops/base/base.h" #include "src/mca/gds/base/base.h" #include "src/mca/preg/preg.h" +#include "src/mca/psensor/base/base.h" #include "src/mca/ptl/base/base.h" #include "src/hwloc/hwloc-internal.h" @@ -397,6 +398,16 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, } } + /* open the psensor framework */ + if (PMIX_SUCCESS != (rc = pmix_mca_base_framework_open(&pmix_psensor_base_framework, 0))) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + if (PMIX_SUCCESS != (rc = pmix_psensor_base_select())) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* setup the wildcard recv for inbound messages from clients */ req = PMIX_NEW(pmix_ptl_posted_recv_t); req->tag = UINT32_MAX; @@ -511,6 +522,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) if (NULL != pmix_server_globals.tmpdir) { free(pmix_server_globals.tmpdir); } + /* close the psensor framework */ + (void)pmix_mca_base_framework_close(&pmix_psensor_base_framework); /* close the pnet framework */ (void)pmix_mca_base_framework_close(&pmix_pnet_base_framework); @@ -3228,6 +3241,9 @@ void pmix_server_message_handler(struct pmix_peer_t *pr, PMIX_ERROR_LOG(PMIX_ERR_NOMEM); return; } + if (PMIX_OPERATION_SUCCEEDED == ret) { + ret = PMIX_SUCCESS; + } PMIX_BFROPS_PACK(rc, pr, reply, &ret, 1, PMIX_STATUS); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 570e1c82a42..31dd62cbc7b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -52,6 +52,7 @@ #include "src/class/pmix_list.h" #include "src/mca/bfrops/bfrops.h" #include "src/mca/plog/plog.h" +#include "src/mca/psensor/psensor.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" @@ -2536,10 +2537,8 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, PMIX_LIST_DESTRUCT(&cachefiles); if (cnt == (int)cd->ninfo) { /* nothing more to do */ - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, NULL, 0, cd, NULL, NULL); - } - return PMIX_SUCCESS; + rc = PMIX_SUCCESS; + goto exit; } } @@ -2575,9 +2574,6 @@ pmix_status_t pmix_server_monitor(pmix_peer_t *peer, pmix_output_verbose(2, pmix_server_globals.base_output, "recvd monitor request from client"); - if (NULL == pmix_host_server.monitor) { - return PMIX_ERR_NOT_SUPPORTED; - } cd = PMIX_NEW(pmix_query_caddy_t); if (NULL == cd) { @@ -2620,6 +2616,24 @@ pmix_status_t pmix_server_monitor(pmix_peer_t *peer, } } + /* see if they are requesting one of the monitoring + * methods we internally support */ + rc = pmix_psensor.start(peer, error, &monitor, cd->info, cd->ninfo); + if (PMIX_SUCCESS == rc) { + rc = PMIX_OPERATION_SUCCEEDED; + goto exit; + } + if (PMIX_ERR_NOT_SUPPORTED != rc) { + goto exit; + } + + /* if we don't internally support it, see if + * our host does */ + if (NULL == pmix_host_server.monitor) { + rc = PMIX_ERR_NOT_SUPPORTED; + goto exit; + } + /* setup the requesting peer name */ (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am index 4beeab62b16..8ee50d6ca8a 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am @@ -25,7 +25,7 @@ headers = simptest.h noinst_PROGRAMS = simptest simpclient simppub simpdyn simpft simpdmodex \ test_pmix simptool simpdie simplegacy simptimeout \ - gwtest gwclient stability quietclient + gwtest gwclient stability quietclient simpjctrl simptest_SOURCES = $(headers) \ simptest.c @@ -116,3 +116,9 @@ quietclient_SOURCES = $(headers) \ quietclient_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) quietclient_LDADD = \ $(top_builddir)/src/libpmix.la + +simpjctrl_SOURCES = \ + simpjctrl.c +simpjctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) +simpjctrl_LDADD = \ + $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c new file mode 100644 index 00000000000..c9ac506520a --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2006-2013 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include + +#include +#include "simptest.h" + +static pmix_proc_t myproc; + +/* this is the event notification function we pass down below + * when registering for general events - i.e.,, the default + * handler. We don't technically need to register one, but it + * is usually good practice to catch any events that occur */ +static void notification_fn(size_t evhdlr_registration_id, + pmix_status_t status, + const pmix_proc_t *source, + pmix_info_t info[], size_t ninfo, + pmix_info_t results[], size_t nresults, + pmix_event_notification_cbfunc_fn_t cbfunc, + void *cbdata) +{ + if (NULL != cbfunc) { + cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); + } +} + +/* event handler registration is done asynchronously because it + * may involve the PMIx server registering with the host RM for + * external events. So we provide a callback function that returns + * the status of the request (success or an error), plus a numerical index + * to the registered event. The index is used later on to deregister + * an event handler - if we don't explicitly deregister it, then the + * PMIx server will do so when it see us exit */ +static void evhandler_reg_callbk(pmix_status_t status, + size_t evhandler_ref, + void *cbdata) +{ + mylock_t *lk = (mylock_t*)cbdata; + + if (PMIX_SUCCESS != status) { + fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", + myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref); + } + lk->status = status; + DEBUG_WAKEUP_THREAD(lk); +} + +static void infocbfunc(pmix_status_t status, + pmix_info_t *info, size_t ninfo, + void *cbdata, + pmix_release_cbfunc_t release_fn, + void *release_cbdata) +{ + mylock_t *lk = (mylock_t*)cbdata; + + fprintf(stderr, "Callback recvd with status %d\n", status); + + /* release the caller */ + if (NULL != release_fn) { + release_fn(release_cbdata); + } + + lk->status = status; + DEBUG_WAKEUP_THREAD(lk); +} + +int main(int argc, char **argv) +{ + int rc; + pmix_value_t value; + pmix_value_t *val = &value; + pmix_proc_t proc; + uint32_t nprocs, n; + pmix_info_t *info, *iptr; + bool flag; + mylock_t mylock; + pmix_data_array_t *dptr; + + /* init us - note that the call to "init" includes the return of + * any job-related info provided by the RM. */ + if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc); + exit(0); + } + fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); + + + /* register our default event handler - again, this isn't strictly + * required, but is generally good practice */ + DEBUG_CONSTRUCT_LOCK(&mylock); + PMIx_Register_event_handler(NULL, 0, NULL, 0, + notification_fn, evhandler_reg_callbk, (void*)&mylock); + DEBUG_WAIT_THREAD(&mylock); + if (0 != mylock.status) { + fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank); + exit(mylock.status); + } + DEBUG_DESTRUCT_LOCK(&mylock); + + /* job-related info is found in our nspace, assigned to the + * wildcard rank as it doesn't relate to a specific rank. Setup + * a name to retrieve such values */ + PMIX_PROC_CONSTRUCT(&proc); + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + + /* get our universe size */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + nprocs = val->data.uint32; + PMIX_VALUE_RELEASE(val); + fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); + + /* inform the RM that we are preemptible, and that our checkpoint methods are + * "signal" on SIGUSR2 and event on PMIX_JCTRL_CHECKPOINT */ + PMIX_INFO_CREATE(info, 2); + flag = true; + PMIX_INFO_LOAD(&info[0], PMIX_JOB_CTRL_PREEMPTIBLE, (void*)&flag, PMIX_BOOL); + /* can't use "load" to load a pmix_data_array_t */ + (void)strncpy(info[1].key, PMIX_JOB_CTRL_CHECKPOINT_METHOD, PMIX_MAX_KEYLEN); + info[1].value.type = PMIX_DATA_ARRAY; + dptr = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); + info[1].value.data.darray = dptr; + dptr->type = PMIX_INFO; + dptr->size = 2; + PMIX_INFO_CREATE(dptr->array, dptr->size); + rc = SIGUSR2; + iptr = (pmix_info_t*)dptr->array; + PMIX_INFO_LOAD(&iptr[0], PMIX_JOB_CTRL_CHECKPOINT_SIGNAL, &rc, PMIX_INT); + rc = PMIX_JCTRL_CHECKPOINT; + PMIX_INFO_LOAD(&iptr[1], PMIX_JOB_CTRL_CHECKPOINT_EVENT, &rc, PMIX_STATUS); + + /* since this is informational and not a requested operation, the target parameter + * doesn't mean anything and can be ignored */ + DEBUG_CONSTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != (rc = PMIx_Job_control_nb(NULL, 0, info, 2, infocbfunc, (void*)&mylock))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + DEBUG_WAIT_THREAD(&mylock); + PMIX_INFO_FREE(info, 2); + if (0 != mylock.status) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, mylock.status); + exit(mylock.status); + } + DEBUG_DESTRUCT_LOCK(&mylock); + + /* now request that this process be monitored using heartbeats */ + PMIX_INFO_CREATE(iptr, 1); + PMIX_INFO_LOAD(&iptr[0], PMIX_MONITOR_HEARTBEAT, NULL, PMIX_POINTER); + + PMIX_INFO_CREATE(info, 3); + PMIX_INFO_LOAD(&info[0], PMIX_MONITOR_ID, "MONITOR1", PMIX_STRING); + n = 5; // require a heartbeat every 5 seconds + PMIX_INFO_LOAD(&info[1], PMIX_MONITOR_HEARTBEAT_TIME, &n, PMIX_UINT32); + n = 2; // two heartbeats can be missed before declaring us "stalled" + PMIX_INFO_LOAD(&info[2], PMIX_MONITOR_HEARTBEAT_DROPS, &n, PMIX_UINT32); + + /* make the request */ + DEBUG_CONSTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != (rc = PMIx_Process_monitor_nb(iptr, PMIX_MONITOR_HEARTBEAT_ALERT, + info, 3, infocbfunc, (void*)&mylock))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + DEBUG_WAIT_THREAD(&mylock); + PMIX_INFO_FREE(iptr, 1); + PMIX_INFO_FREE(info, 3); + if (0 != mylock.status) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, mylock.status); + exit(mylock.status); + } + DEBUG_DESTRUCT_LOCK(&mylock); + + /* send a heartbeat */ + PMIx_Heartbeat(); + + /* call fence to synchronize with our peers - no need to + * collect any info as we didn't "put" anything */ + PMIX_INFO_CREATE(info, 1); + flag = false; + PMIX_INFO_LOAD(info, PMIX_COLLECT_DATA, &flag, PMIX_BOOL); + if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, info, 1))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + PMIX_INFO_FREE(info, 1); + + + done: + /* finalize us */ + fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank); + if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc); + } else { + fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank); + } + fflush(stderr); + return(0); +} diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index 710ecbc135e..cabc54bca0c 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -107,6 +107,18 @@ static void log_fn(const pmix_proc_t *client, const pmix_info_t data[], size_t ndata, const pmix_info_t directives[], size_t ndirs, pmix_op_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t alloc_fn(const pmix_proc_t *client, + pmix_alloc_directive_t directive, + const pmix_info_t data[], size_t ndata, + pmix_info_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t jctrl_fn(const pmix_proc_t *requestor, + const pmix_proc_t targets[], size_t ntargets, + const pmix_info_t directives[], size_t ndirs, + pmix_info_cbfunc_t cbfunc, void *cbdata); +static pmix_status_t mon_fn(const pmix_proc_t *requestor, + const pmix_info_t *monitor, pmix_status_t error, + const pmix_info_t directives[], size_t ndirs, + pmix_info_cbfunc_t cbfunc, void *cbdata); static pmix_server_module_t mymodule = { .client_connected = connected, @@ -125,7 +137,10 @@ static pmix_server_module_t mymodule = { .notify_event = notify_event, .query = query_fn, .tool_connected = tool_connect_fn, - .log = log_fn + .log = log_fn, + .allocate = alloc_fn, + .job_control = jctrl_fn, + .monitor = mon_fn }; typedef struct { @@ -1073,6 +1088,31 @@ static void log_fn(const pmix_proc_t *client, } } +static pmix_status_t alloc_fn(const pmix_proc_t *client, + pmix_alloc_directive_t directive, + const pmix_info_t data[], size_t ndata, + pmix_info_cbfunc_t cbfunc, void *cbdata) +{ + return PMIX_SUCCESS; +} + +static pmix_status_t jctrl_fn(const pmix_proc_t *requestor, + const pmix_proc_t targets[], size_t ntargets, + const pmix_info_t directives[], size_t ndirs, + pmix_info_cbfunc_t cbfunc, void *cbdata) +{ + return PMIX_OPERATION_SUCCEEDED; +} + +static pmix_status_t mon_fn(const pmix_proc_t *requestor, + const pmix_info_t *monitor, pmix_status_t error, + const pmix_info_t directives[], size_t ndirs, + pmix_info_cbfunc_t cbfunc, void *cbdata) +{ + return PMIX_ERR_NOT_SUPPORTED; +} + + static void wait_signal_callback(int fd, short event, void *arg) { pmix_event_t *sig = (pmix_event_t*) arg; From c087cb33076799ac1443af18b9ea51c6cf0b4cfd Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 20 Aug 2018 15:28:38 -0700 Subject: [PATCH 032/674] Update ignores Signed-off-by: Ralph Castain --- .gitignore | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.gitignore b/.gitignore index a07b9c927e7..07ae3be8020 100644 --- a/.gitignore +++ b/.gitignore @@ -228,6 +228,52 @@ ompi/mpi/fortran/use-mpi-tkr/mpi_kinds.ompi_module ompi/mpi/fortran/use-mpi-tkr/mpi-tkr-sizeof.f90 ompi/mpi/fortran/use-mpi-tkr/mpi-tkr-sizeof.h +ompi/mpiext/pcollreq/c/profile/pallgather_init.c +ompi/mpiext/pcollreq/c/profile/pallgatherv_init.c +ompi/mpiext/pcollreq/c/profile/pallreduce_init.c +ompi/mpiext/pcollreq/c/profile/palltoall_init.c +ompi/mpiext/pcollreq/c/profile/palltoallv_init.c +ompi/mpiext/pcollreq/c/profile/palltoallw_init.c +ompi/mpiext/pcollreq/c/profile/pbarrier_init.c +ompi/mpiext/pcollreq/c/profile/pbcast_init.c +ompi/mpiext/pcollreq/c/profile/pexscan_init.c +ompi/mpiext/pcollreq/c/profile/pgather_init.c +ompi/mpiext/pcollreq/c/profile/pgatherv_init.c +ompi/mpiext/pcollreq/c/profile/pmpiext_pcollreq_c.h +ompi/mpiext/pcollreq/c/profile/pneighbor_allgather_init.c +ompi/mpiext/pcollreq/c/profile/pneighbor_allgatherv_init.c +ompi/mpiext/pcollreq/c/profile/pneighbor_alltoall_init.c +ompi/mpiext/pcollreq/c/profile/pneighbor_alltoallv_init.c +ompi/mpiext/pcollreq/c/profile/pneighbor_alltoallw_init.c +ompi/mpiext/pcollreq/c/profile/preduce_init.c +ompi/mpiext/pcollreq/c/profile/preduce_scatter_block_init.c +ompi/mpiext/pcollreq/c/profile/preduce_scatter_init.c +ompi/mpiext/pcollreq/c/profile/pscan_init.c +ompi/mpiext/pcollreq/c/profile/pscatter_init.c +ompi/mpiext/pcollreq/c/profile/pscatterv_init.c +ompi/mpiext/pcollreq/mpif-h/profile/pallgather_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pallgatherv_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pallreduce_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/palltoall_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/palltoallv_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/palltoallw_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pbarrier_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pbcast_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pexscan_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pgather_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pgatherv_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pneighbor_allgather_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pneighbor_allgatherv_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pneighbor_alltoall_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pneighbor_alltoallv_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pneighbor_alltoallw_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/preduce_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/preduce_scatter_block_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/preduce_scatter_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pscan_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pscatter_init_f.c +ompi/mpiext/pcollreq/mpif-h/profile/pscatterv_init_f.c + ompi/mpi/java/java/mpi ompi/mpi/java/java/*.jar ompi/mpi/java/java/*.h From e27e945d9afbfcd43708d5a102168cfb8072dde3 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 20 Aug 2018 16:08:54 -0700 Subject: [PATCH 033/674] Complete job control integration Signed-off-by: Ralph Castain --- opal/include/opal/constants.h | 3 +- opal/mca/pmix/ext1x/pmix1x.c | 1 + opal/mca/pmix/ext2x/ext2x.c | 1 + opal/mca/pmix/pmix3x/pmix3x.c | 44 +++++++--------------------- opal/mca/pmix/pmix3x/pmix3x_client.c | 1 + orte/include/orte/constants.h | 3 +- orte/orted/pmix/pmix_server_gen.c | 2 +- 7 files changed, 19 insertions(+), 36 deletions(-) diff --git a/opal/include/opal/constants.h b/opal/include/opal/constants.h index 246e964da02..9ea9d0362da 100644 --- a/opal/include/opal/constants.h +++ b/opal/include/opal/constants.h @@ -98,7 +98,8 @@ enum { OPAL_ERR_HEARTBEAT_ALERT = (OPAL_ERR_BASE - 67), OPAL_ERR_FILE_ALERT = (OPAL_ERR_BASE - 68), OPAL_ERR_MODEL_DECLARED = (OPAL_ERR_BASE - 69), - OPAL_PMIX_LAUNCH_DIRECTIVE = (OPAL_ERR_BASE - 70) + OPAL_PMIX_LAUNCH_DIRECTIVE = (OPAL_ERR_BASE - 70), + OPAL_OPERATION_SUCCEEDED = (OPAL_ERR_BASE - 71) }; #define OPAL_ERR_MAX (OPAL_ERR_BASE - 100) diff --git a/opal/mca/pmix/ext1x/pmix1x.c b/opal/mca/pmix/ext1x/pmix1x.c index 410c7c79916..d71d35b1bfc 100644 --- a/opal/mca/pmix/ext1x/pmix1x.c +++ b/opal/mca/pmix/ext1x/pmix1x.c @@ -185,6 +185,7 @@ pmix_status_t pmix1_convert_opalrc(int rc) case OPAL_ERROR: return PMIX_ERROR; case OPAL_SUCCESS: + case OPAL_OPERATION_SUCCEEDED: return PMIX_SUCCESS; default: return PMIX_ERROR; diff --git a/opal/mca/pmix/ext2x/ext2x.c b/opal/mca/pmix/ext2x/ext2x.c index 3e3b53980b6..7e0803a9e56 100644 --- a/opal/mca/pmix/ext2x/ext2x.c +++ b/opal/mca/pmix/ext2x/ext2x.c @@ -440,6 +440,7 @@ pmix_status_t ext2x_convert_opalrc(int rc) case OPAL_ERROR: return PMIX_ERROR; case OPAL_SUCCESS: + case OPAL_OPERATION_SUCCEEDED: return PMIX_SUCCESS; default: return rc; diff --git a/opal/mca/pmix/pmix3x/pmix3x.c b/opal/mca/pmix/pmix3x/pmix3x.c index f8650cbe7f1..73288ff842e 100644 --- a/opal/mca/pmix/pmix3x/pmix3x.c +++ b/opal/mca/pmix/pmix3x/pmix3x.c @@ -364,37 +364,13 @@ void pmix3x_event_hdlr(size_t evhdlr_registration_id, return; } -static void cleanup_cbfunc(pmix_status_t status, - pmix_info_t *info, size_t ninfo, - void *cbdata, - pmix_release_cbfunc_t release_fn, - void *release_cbdata) -{ - opal_pmix_lock_t *lk = (opal_pmix_lock_t*)cbdata; - - OPAL_POST_OBJECT(lk); - - /* let the library release the data and cleanup from - * the operation */ - if (NULL != release_fn) { - release_fn(release_cbdata); - } - - /* release the block */ - lk->status = pmix3x_convert_rc(status); - OPAL_PMIX_WAKEUP_THREAD(lk); -} - static int pmix3x_register_cleanup(char *path, bool directory, bool ignore, bool jobscope) { - opal_pmix_lock_t lk; pmix_info_t pinfo[3]; size_t n, ninfo=0; pmix_status_t rc; int ret; - OPAL_PMIX_CONSTRUCT_LOCK(&lk); - if (ignore) { /* they want this path ignored */ PMIX_INFO_LOAD(&pinfo[ninfo], PMIX_CLEANUP_IGNORE, path, PMIX_STRING); @@ -415,18 +391,12 @@ static int pmix3x_register_cleanup(char *path, bool directory, bool ignore, bool /* if they want this applied to the job, then indicate so */ if (jobscope) { - rc = PMIx_Job_control_nb(NULL, 0, pinfo, ninfo, cleanup_cbfunc, (void*)&lk); + rc = PMIx_Job_control_nb(NULL, 0, pinfo, ninfo, NULL, NULL); } else { /* only applies to us */ - rc = PMIx_Job_control_nb(&mca_pmix_pmix3x_component.myproc, 1, pinfo, ninfo, cleanup_cbfunc, (void*)&lk); - } - if (PMIX_SUCCESS != rc) { - ret = pmix3x_convert_rc(rc); - } else { - OPAL_PMIX_WAIT_THREAD(&lk); - ret = lk.status; + rc = PMIx_Job_control_nb(&mca_pmix_pmix3x_component.myproc, 1, pinfo, ninfo, NULL, NULL); } - OPAL_PMIX_DESTRUCT_LOCK(&lk); + ret = pmix3x_convert_rc(rc); for (n=0; n < ninfo; n++) { PMIX_INFO_DESTRUCT(&pinfo[n]); } @@ -536,6 +506,10 @@ pmix_status_t pmix3x_convert_opalrc(int rc) return PMIX_ERROR; case OPAL_SUCCESS: return PMIX_SUCCESS; + + case OPAL_OPERATION_SUCCEEDED: + return PMIX_OPERATION_SUCCEEDED; + default: return rc; } @@ -629,6 +603,10 @@ int pmix3x_convert_rc(pmix_status_t rc) return OPAL_ERROR; case PMIX_SUCCESS: return OPAL_SUCCESS; + + case PMIX_OPERATION_SUCCEEDED: + return OPAL_OPERATION_SUCCEEDED; + default: return rc; } diff --git a/opal/mca/pmix/pmix3x/pmix3x_client.c b/opal/mca/pmix/pmix3x/pmix3x_client.c index 61fc6825782..678f5e98057 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_client.c +++ b/opal/mca/pmix/pmix3x/pmix3x_client.c @@ -1621,6 +1621,7 @@ int pmix3x_job_control(opal_list_t *targets, OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); return OPAL_ERR_NOT_INITIALIZED; } +abort(); /* create the caddy */ op = OBJ_NEW(pmix3x_opcaddy_t); diff --git a/orte/include/orte/constants.h b/orte/include/orte/constants.h index de6c3cbb212..d272c31a6ca 100644 --- a/orte/include/orte/constants.h +++ b/orte/include/orte/constants.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -93,6 +93,7 @@ enum { ORTE_ERR_PROC_ABORTING = OPAL_ERR_PROC_ABORTING, ORTE_ERR_NODE_DOWN = OPAL_ERR_NODE_DOWN, ORTE_ERR_NODE_OFFLINE = OPAL_ERR_NODE_OFFLINE, + ORTE_OPERATION_SUCCEEDED = OPAL_OPERATION_SUCCEEDED, /* error codes specific to ORTE - don't forget to update orte/util/error_strings.c when adding new error codes!! diff --git a/orte/orted/pmix/pmix_server_gen.c b/orte/orted/pmix/pmix_server_gen.c index 2c9d7326fb2..25244c2a340 100644 --- a/orte/orted/pmix/pmix_server_gen.c +++ b/orte/orted/pmix/pmix_server_gen.c @@ -1186,5 +1186,5 @@ int pmix_server_job_ctrl_fn(const opal_process_name_t *requestor, } } - return ORTE_SUCCESS; + return ORTE_OPERATION_SUCCEEDED; } From 00f417706cef978fc72135152c1244d5e1e21583 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 22 Aug 2018 11:15:39 +0300 Subject: [PATCH 034/674] OSHMEM/API/C11: fixed API macro - updated compilation of C11 compiler for API macro Signed-off-by: Sergey Oblomov (cherry picked from commit be0ea1d7647e8c16cb8f30f4dd916454c2bdd746) --- oshmem/include/pshmem.h | 681 ++++++++++++++++++------------------- oshmem/include/shmem.h.in | 689 ++++++++++++++++++-------------------- oshmem/runtime/runtime.h | 10 - 3 files changed, 648 insertions(+), 732 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 08adb40f221..718a7367956 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -106,18 +106,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_float_p(shmem_ctx_t ctx, float* addr, float val OSHMEM_DECLSPEC void pshmem_ctx_double_p(shmem_ctx_t ctx, double* addr, double value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_p(shmem_ctx_t ctx, long long* addr, long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_p(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_p, \ - short*: pshmem_ctx_short_p, \ - int*: pshmem_ctx_int_p, \ - long*: pshmem_ctx_long_p, \ - long long*: pshmem_ctx_longlong_p, \ - float*: pshmem_ctx_float_p, \ - double*: pshmem_ctx_double_p, \ - long double*: pshmem_ctx_longdouble_p)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_char_p(char* addr, char value, int pe); OSHMEM_DECLSPEC void pshmem_short_p(short* addr, short value, int pe); @@ -128,16 +116,26 @@ OSHMEM_DECLSPEC void pshmem_double_p(double* addr, double value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_p(long long* addr, long long value, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_p(long double* addr, long double value, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_p(dst, val, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_p, \ - short*: pshmem_short_p, \ - int*: pshmem_int_p, \ - long*: pshmem_long_p, \ - long long*: pshmem_longlong_p, \ - float*: pshmem_float_p, \ - double*: pshmem_double_p, \ - long double*: pshmem_longdouble_p)(dst, val, pe) +#define pshmem_p(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_p, \ + short*: pshmem_ctx_short_p, \ + int*: pshmem_ctx_int_p, \ + long*: pshmem_ctx_long_p, \ + long long*: pshmem_ctx_longlong_p, \ + float*: pshmem_ctx_float_p, \ + double*: pshmem_ctx_double_p, \ + long double*: pshmem_ctx_longdouble_p, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_p, \ + short*: pshmem_short_p, \ + int*: pshmem_int_p, \ + long*: pshmem_long_p, \ + long long*: pshmem_longlong_p, \ + float*: pshmem_float_p, \ + double*: pshmem_double_p, \ + long double*: pshmem_longdouble_p)(__VA_ARGS__) #endif /* @@ -151,18 +149,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_float_put(shmem_ctx_t ctx, float *target, const OSHMEM_DECLSPEC void pshmem_ctx_double_put(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_put(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_put(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_put, \ - short*: pshmem_ctx_short_put, \ - int*: pshmem_ctx_int_put, \ - long*: pshmem_ctx_long_put, \ - long long*: pshmem_ctx_longlong_put, \ - float*: pshmem_ctx_float_put, \ - double*: pshmem_ctx_double_put, \ - long double*: pshmem_ctx_longdouble_put)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_put(short *target, const short *source, size_t len, int pe); @@ -173,16 +159,26 @@ OSHMEM_DECLSPEC void pshmem_double_put(double *target, const double *source, si OSHMEM_DECLSPEC void pshmem_longlong_put(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_put(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_put, \ - short*: pshmem_short_put, \ - int*: pshmem_int_put, \ - long*: pshmem_long_put, \ - long long*: pshmem_longlong_put, \ - float*: pshmem_float_put, \ - double*: pshmem_double_put, \ - long double*: pshmem_longdouble_put)(dst, src, len, pe) +#define pshmem_put(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_put, \ + short*: pshmem_ctx_short_put, \ + int*: pshmem_ctx_int_put, \ + long*: pshmem_ctx_long_put, \ + long long*: pshmem_ctx_longlong_put, \ + float*: pshmem_ctx_float_put, \ + double*: pshmem_ctx_double_put, \ + long double*: pshmem_ctx_longdouble_put, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_put, \ + short*: pshmem_short_put, \ + int*: pshmem_int_put, \ + long*: pshmem_long_put, \ + long long*: pshmem_longlong_put, \ + float*: pshmem_float_put, \ + double*: pshmem_double_put, \ + long double*: pshmem_longdouble_put)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_put8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -210,18 +206,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_float_iput(shmem_ctx_t ctx, float* target, const OSHMEM_DECLSPEC void pshmem_ctx_double_iput(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_iput(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_iput(ctx, dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_iput, \ - short*: pshmem_ctx_short_iput, \ - int*: pshmem_ctx_int_iput, \ - long*: pshmem_ctx_long_iput, \ - long long*: pshmem_ctx_longlong_iput, \ - float*: pshmem_ctx_float_iput, \ - double*: pshmem_ctx_double_iput, \ - long double*: pshmem_ctx_longdouble_iput)(ctx, dst, src, tst, sst, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_iput(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -232,16 +216,26 @@ OSHMEM_DECLSPEC void pshmem_double_iput(double* target, const double* source, pt OSHMEM_DECLSPEC void pshmem_longlong_iput(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_iput(dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_iput, \ - short*: pshmem_short_iput, \ - int*: pshmem_int_iput, \ - long*: pshmem_long_iput, \ - long long*: pshmem_longlong_iput, \ - float*: pshmem_float_iput, \ - double*: pshmem_double_iput, \ - long double*: pshmem_longdouble_iput)(dst, src, tst, sst, len, pe) +#define pshmem_iput(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_iput, \ + short*: pshmem_ctx_short_iput, \ + int*: pshmem_ctx_int_iput, \ + long*: pshmem_ctx_long_iput, \ + long long*: pshmem_ctx_longlong_iput, \ + float*: pshmem_ctx_float_iput, \ + double*: pshmem_ctx_double_iput, \ + long double*: pshmem_ctx_longdouble_iput, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_iput, \ + short*: pshmem_short_iput, \ + int*: pshmem_int_iput, \ + long*: pshmem_long_iput, \ + long long*: pshmem_longlong_iput, \ + float*: pshmem_float_iput, \ + double*: pshmem_double_iput, \ + long double*: pshmem_longdouble_iput)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_iput8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -267,18 +261,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *ta OSHMEM_DECLSPEC void pshmem_ctx_float_put_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_put_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_put_nbi(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_put_nbi, \ - short*: pshmem_ctx_short_put_nbi, \ - int*: pshmem_ctx_int_put_nbi, \ - long*: pshmem_ctx_long_put_nbi, \ - long long*: pshmem_ctx_longlong_put_nbi, \ - float*: pshmem_ctx_float_put_nbi, \ - double*: pshmem_ctx_double_put_nbi, \ - long double*: pshmem_ctx_longdouble_put_nbi)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_put_nbi(char *target, const char *source, size_t len, int pe); @@ -290,16 +272,26 @@ OSHMEM_DECLSPEC void pshmem_float_put_nbi(float *target, const float *source, s OSHMEM_DECLSPEC void pshmem_double_put_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_put_nbi(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_put_nbi, \ - short*: pshmem_short_put_nbi, \ - int*: pshmem_int_put_nbi, \ - long*: pshmem_long_put_nbi, \ - long long*: pshmem_longlong_put_nbi, \ - float*: pshmem_float_put_nbi, \ - double*: pshmem_double_put_nbi, \ - long double*: pshmem_longdouble_put_nbi)(dst, src, len, pe) +#define pshmem_put_nbi(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_put_nbi, \ + short*: pshmem_ctx_short_put_nbi, \ + int*: pshmem_ctx_int_put_nbi, \ + long*: pshmem_ctx_long_put_nbi, \ + long long*: pshmem_ctx_longlong_put_nbi, \ + float*: pshmem_ctx_float_put_nbi, \ + double*: pshmem_ctx_double_put_nbi, \ + long double*: pshmem_ctx_longdouble_put_nbi, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_put_nbi, \ + short*: pshmem_short_put_nbi, \ + int*: pshmem_int_put_nbi, \ + long*: pshmem_long_put_nbi, \ + long long*: pshmem_longlong_put_nbi, \ + float*: pshmem_float_put_nbi, \ + double*: pshmem_double_put_nbi, \ + long double*: pshmem_longdouble_put_nbi)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_put8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -326,18 +318,6 @@ OSHMEM_DECLSPEC float pshmem_ctx_float_g(shmem_ctx_t ctx, const float* addr, in OSHMEM_DECLSPEC double pshmem_ctx_double_g(shmem_ctx_t ctx, const double* addr, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_g(shmem_ctx_t ctx, const long long* addr, int pe); OSHMEM_DECLSPEC long double pshmem_ctx_longdouble_g(shmem_ctx_t ctx, const long double* addr, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_g(ctx, addr, pe) \ - _Generic(&*(addr), \ - char*: pshmem_ctx_char_g, \ - short*: pshmem_ctx_short_g, \ - int*: pshmem_ctx_int_g, \ - long*: pshmem_ctx_long_g, \ - long long*: pshmem_ctx_longlong_g, \ - float*: pshmem_ctx_float_g, \ - double*: pshmem_ctx_double_g, \ - long double*: pshmem_ctx_longdouble_g)(ctx, addr, pe) -#endif OSHMEM_DECLSPEC char pshmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short pshmem_short_g(const short* addr, int pe); @@ -348,16 +328,26 @@ OSHMEM_DECLSPEC double pshmem_double_g(const double* addr, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_g(const long long* addr, int pe); OSHMEM_DECLSPEC long double pshmem_longdouble_g(const long double* addr, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_g(addr, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_g, \ - short*: pshmem_short_g, \ - int*: pshmem_int_g, \ - long*: pshmem_long_g, \ - long long*: pshmem_longlong_g, \ - float*: pshmem_float_g, \ - double*: pshmem_double_g, \ - long double*: pshmem_longdouble_g)(addr, pe) +#define pshmem_g(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_g, \ + short*: pshmem_ctx_short_g, \ + int*: pshmem_ctx_int_g, \ + long*: pshmem_ctx_long_g, \ + long long*: pshmem_ctx_longlong_g, \ + float*: pshmem_ctx_float_g, \ + double*: pshmem_ctx_double_g, \ + long double*: pshmem_ctx_longdouble_g, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_g, \ + short*: pshmem_short_g, \ + int*: pshmem_int_g, \ + long*: pshmem_long_g, \ + long long*: pshmem_longlong_g, \ + float*: pshmem_float_g, \ + double*: pshmem_double_g, \ + long double*: pshmem_longdouble_g)(__VA_ARGS__) #endif /* @@ -371,18 +361,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_float_get(shmem_ctx_t ctx, float *target, const OSHMEM_DECLSPEC void pshmem_ctx_double_get(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_get(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_get(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_get, \ - short*: pshmem_ctx_short_get, \ - int*: pshmem_ctx_int_get, \ - long*: pshmem_ctx_long_get, \ - long long*: pshmem_ctx_longlong_get, \ - float*: pshmem_ctx_float_get, \ - double*: pshmem_ctx_double_get, \ - long double*: pshmem_ctx_longdouble_get)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_char_get(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_get(short *target, const short *source, size_t len, int pe); @@ -393,16 +371,26 @@ OSHMEM_DECLSPEC void pshmem_double_get(double *target, const double *source, si OSHMEM_DECLSPEC void pshmem_longlong_get(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_get(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_get, \ - short*: pshmem_short_get, \ - int*: pshmem_int_get, \ - long*: pshmem_long_get, \ - long long*: pshmem_longlong_get, \ - float*: pshmem_float_get, \ - double*: pshmem_double_get, \ - long double*: pshmem_longdouble_get)(dst, src, len, pe) +#define pshmem_get(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_get, \ + short*: pshmem_ctx_short_get, \ + int*: pshmem_ctx_int_get, \ + long*: pshmem_ctx_long_get, \ + long long*: pshmem_ctx_longlong_get, \ + float*: pshmem_ctx_float_get, \ + double*: pshmem_ctx_double_get, \ + long double*: pshmem_ctx_longdouble_get, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_get, \ + short*: pshmem_short_get, \ + int*: pshmem_int_get, \ + long*: pshmem_long_get, \ + long long*: pshmem_longlong_get, \ + float*: pshmem_float_get, \ + double*: pshmem_double_get, \ + long double*: pshmem_longdouble_get)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_get8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -430,18 +418,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_double_iget(shmem_ctx_t ctx, double* target, con OSHMEM_DECLSPEC void pshmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_iget(ctx, dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_iget, \ - short*: pshmem_ctx_short_iget, \ - int*: pshmem_ctx_int_iget, \ - long*: pshmem_ctx_long_iget, \ - long long*: pshmem_ctx_longlong_iget, \ - float*: pshmem_ctx_float_iget, \ - double*: pshmem_ctx_double_iget, \ - long double*: pshmem_ctx_longdouble_iget)(ctx, dst, src, tst, sst, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -452,16 +428,26 @@ OSHMEM_DECLSPEC void pshmem_longlong_iget(long long* target, const long long* so OSHMEM_DECLSPEC void pshmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_iget(dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_iget, \ - short*: pshmem_short_iget, \ - int*: pshmem_int_iget, \ - long*: pshmem_long_iget, \ - long long*: pshmem_longlong_iget, \ - float*: pshmem_float_iget, \ - double*: pshmem_double_iget, \ - long double*: pshmem_longdouble_iget)(dst, src, tst, sst, len, pe) +#define pshmem_iget(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_iget, \ + short*: pshmem_ctx_short_iget, \ + int*: pshmem_ctx_int_iget, \ + long*: pshmem_ctx_long_iget, \ + long long*: pshmem_ctx_longlong_iget, \ + float*: pshmem_ctx_float_iget, \ + double*: pshmem_ctx_double_iget, \ + long double*: pshmem_ctx_longdouble_iget, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_iget, \ + short*: pshmem_short_iget, \ + int*: pshmem_int_iget, \ + long*: pshmem_long_iget, \ + long long*: pshmem_longlong_iget, \ + float*: pshmem_float_iget, \ + double*: pshmem_double_iget, \ + long double*: pshmem_longdouble_iget)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_iget8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -487,18 +473,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_longlong_get_nbi(shmem_ctx_t ctx, long long *ta OSHMEM_DECLSPEC void pshmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_get_nbi(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_ctx_char_get_nbi, \ - short*: pshmem_ctx_short_get_nbi, \ - int*: pshmem_ctx_int_get_nbi, \ - long*: pshmem_ctx_long_get_nbi, \ - long long*: pshmem_ctx_longlong_get_nbi, \ - float*: pshmem_ctx_float_get_nbi, \ - double*: pshmem_ctx_double_get_nbi, \ - long double*: pshmem_ctx_longdouble_get_nbi)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void pshmem_getmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_get_nbi(char *target, const char *source, size_t len, int pe); @@ -510,16 +484,26 @@ OSHMEM_DECLSPEC void pshmem_float_get_nbi(float *target, const float *source, s OSHMEM_DECLSPEC void pshmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_get_nbi(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: pshmem_char_get_nbi, \ - short*: pshmem_short_get_nbi, \ - int*: pshmem_int_get_nbi, \ - long*: pshmem_long_get_nbi, \ - long long*: pshmem_longlong_get_nbi, \ - float*: pshmem_float_get_nbi, \ - double*: pshmem_double_get_nbi, \ - long double*: pshmem_longdouble_get_nbi)(dst, src, len, pe) +#define pshmem_get_nbi(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: pshmem_ctx_char_get_nbi, \ + short*: pshmem_ctx_short_get_nbi, \ + int*: pshmem_ctx_int_get_nbi, \ + long*: pshmem_ctx_long_get_nbi, \ + long long*: pshmem_ctx_longlong_get_nbi, \ + float*: pshmem_ctx_float_get_nbi, \ + double*: pshmem_ctx_double_get_nbi, \ + long double*: pshmem_ctx_longdouble_get_nbi, \ + default: __oshmem_datatype_ignore), \ + char*: pshmem_char_get_nbi, \ + short*: pshmem_short_get_nbi, \ + int*: pshmem_int_get_nbi, \ + long*: pshmem_long_get_nbi, \ + long long*: pshmem_longlong_get_nbi, \ + float*: pshmem_float_get_nbi, \ + double*: pshmem_double_get_nbi, \ + long double*: pshmem_longdouble_get_nbi)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_ctx_get8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -544,15 +528,6 @@ OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_swap(shmem_ctx_t ctx, long *target, OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long*target, long long value, int pe); OSHMEM_DECLSPEC float pshmem_ctx_float_atomic_swap(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_ctx_double_atomic_swap(shmem_ctx_t ctx, double *target, double value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_swap(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_swap, \ - long*: pshmem_ctx_long_atomic_swap, \ - long long*: pshmem_ctx_longlong_atomic_swap, \ - float*: pshmem_ctx_float_atomic_swap, \ - double*: pshmem_ctx_double_atomic_swap)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC int pshmem_int_atomic_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_swap(long *target, long value, int pe); @@ -560,13 +535,20 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_swap(long long*target, long lon OSHMEM_DECLSPEC float pshmem_float_atomic_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_swap(double *target, double value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_swap(dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_swap, \ - long*: pshmem_long_atomic_swap, \ - long long*: pshmem_longlong_atomic_swap, \ - float*: pshmem_float_atomic_swap, \ - double*: pshmem_double_atomic_swap)(dst, val, pe) +#define pshmem_atomic_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_swap, \ + long*: pshmem_ctx_long_atomic_swap, \ + long long*: pshmem_ctx_longlong_atomic_swap, \ + float*: pshmem_ctx_float_atomic_swap, \ + double*: pshmem_ctx_double_atomic_swap, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_swap, \ + long*: pshmem_long_atomic_swap, \ + long long*: pshmem_longlong_atomic_swap, \ + float*: pshmem_float_atomic_swap, \ + double*: pshmem_double_atomic_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_swap(int *target, int value, int pe); @@ -575,12 +557,12 @@ OSHMEM_DECLSPEC long long pshmem_longlong_swap(long long*target, long long value OSHMEM_DECLSPEC float pshmem_float_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_double_swap(double *target, double value, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_swap(dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_swap, \ - long*: pshmem_long_swap, \ - long long*: pshmem_longlong_swap, \ - float*: pshmem_float_swap, \ +#define pshmem_swap(dst, val, pe) \ + _Generic(&*(dst), \ + int*: pshmem_int_swap, \ + long*: pshmem_long_swap, \ + long long*: pshmem_longlong_swap, \ + float*: pshmem_float_swap, \ double*: pshmem_double_swap)(dst, val, pe) #endif @@ -590,15 +572,6 @@ OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_set(shmem_ctx_t ctx, long *target, l OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long*target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_atomic_set(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_atomic_set(shmem_ctx_t ctx, double *target, double value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_set(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_set, \ - long*: pshmem_ctx_long_atomic_set, \ - long long*: pshmem_ctx_longlong_atomic_set, \ - float*: pshmem_ctx_float_atomic_set, \ - double*: pshmem_ctx_double_atomic_set)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_int_atomic_set(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_set(long *target, long value, int pe); @@ -606,13 +579,20 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_set(long long*target, long long valu OSHMEM_DECLSPEC void pshmem_float_atomic_set(float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_atomic_set(double *target, double value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_set(dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_set, \ - long*: pshmem_long_atomic_set, \ - long long*: pshmem_longlong_atomic_set, \ - float*: pshmem_float_atomic_set, \ - double*: pshmem_double_atomic_set)(dst, val, pe) +#define pshmem_atomic_set(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_set, \ + long*: pshmem_ctx_long_atomic_set, \ + long long*: pshmem_ctx_longlong_atomic_set, \ + float*: pshmem_ctx_float_atomic_set, \ + double*: pshmem_ctx_double_atomic_set, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_set, \ + long*: pshmem_long_atomic_set, \ + long long*: pshmem_longlong_atomic_set, \ + float*: pshmem_float_atomic_set, \ + double*: pshmem_double_atomic_set)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_set(int *target, int value, int pe); @@ -635,24 +615,21 @@ OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_compare_swap(shmem_ctx_t ctx, int *tar OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_compare_swap(shmem_ctx_t ctx, long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_compare_swap(shmem_ctx_t ctx, long long *target, long long cond, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_compare_swap(ctx, dst, cond, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_compare_swap, \ - long*: pshmem_ctx_long_atomic_compare_swap, \ - long long*: pshmem_ctx_longlong_atomic_compare_swap)(ctx, dst, cond, val, pe) -#endif - OSHMEM_DECLSPEC int pshmem_int_atomic_compare_swap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_compare_swap(long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_compare_swap(long long *target, long long cond, long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_compare_swap(dst, cond, val, pe) \ - _Generic(&*(dst), \ +#define pshmem_atomic_compare_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_compare_swap, \ + long*: pshmem_ctx_long_atomic_compare_swap, \ + long long*: pshmem_ctx_longlong_atomic_compare_swap,\ + default: __oshmem_datatype_ignore), \ int*: pshmem_int_atomic_compare_swap, \ long*: pshmem_long_atomic_compare_swap, \ - long long*: pshmem_longlong_atomic_compare_swap)(dst, cond, val, pe) + long long*: pshmem_longlong_atomic_compare_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_cswap(int *target, int cond, int value, int pe); @@ -670,23 +647,21 @@ OSHMEM_DECLSPEC long long pshmem_longlong_cswap(long long *target, long long con OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_add(shmem_ctx_t ctx, long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_add(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_fetch_add, \ - long*: pshmem_ctx_long_atomic_fetch_add, \ - long long*: pshmem_ctx_longlong_atomic_fetch_add)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_add(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_add(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_add(long long *target, long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_add(dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_fetch_add, \ - long*: pshmem_long_atomic_fetch_add, \ - long long*: pshmem_longlong_atomic_fetch_add)(dst, val, pe) +#define pshmem_atomic_fetch_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_fetch_add, \ + long*: pshmem_ctx_long_atomic_fetch_add, \ + long long*: pshmem_ctx_longlong_atomic_fetch_add, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_add, \ + long*: pshmem_long_atomic_fetch_add, \ + long long*: pshmem_longlong_atomic_fetch_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_fadd(int *target, int value, int pe); @@ -704,69 +679,63 @@ OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long valu OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEMP_HAVE_C11 -#define pshmem_atomic_fetch_and(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_and(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ulong_atomic_fetch_and, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_and)(dst, val, pe) +#define pshmem_atomic_fetch_and(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ulong_atomic_fetch_and, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_and)(__VA_ARGS__) #endif /* Atomic Fetch&Or */ OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_or(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_or(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ulong_atomic_fetch_or, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_or)(dst, val, pe) +#define pshmem_atomic_fetch_or(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ulong_atomic_fetch_or, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_or)(__VA_ARGS__) #endif /* Atomic Fetch&Xor */ OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_xor(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_xor(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ulong_atomic_fetch_xor, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_xor)(dst, val, pe) +#define pshmem_atomic_fetch_xor(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ulong_atomic_fetch_xor, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__) #endif /* Atomic Fetch */ @@ -775,15 +744,6 @@ OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch(shmem_ctx_t ctx, const long *t OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch(shmem_ctx_t ctx, const long long *target, int pe); OSHMEM_DECLSPEC float pshmem_ctx_float_atomic_fetch(shmem_ctx_t ctx, const float *target, int pe); OSHMEM_DECLSPEC double pshmem_ctx_double_atomic_fetch(shmem_ctx_t ctx, const double *target, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_fetch, \ - long*: pshmem_ctx_long_atomic_fetch, \ - long long*: pshmem_ctx_longlong_atomic_fetch,\ - float*: pshmem_ctx_float_atomic_fetch, \ - double*: pshmem_ctx_double_atomic_fetch)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC int pshmem_int_atomic_fetch(const int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch(const long *target, int pe); @@ -791,13 +751,20 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch(const long long *target, OSHMEM_DECLSPEC float pshmem_float_atomic_fetch(const float *target, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_fetch(const double *target, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch(dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_fetch, \ - long*: pshmem_long_atomic_fetch, \ - long long*: pshmem_longlong_atomic_fetch, \ - float*: pshmem_float_atomic_fetch, \ - double*: pshmem_double_atomic_fetch)(dst, pe) +#define pshmem_atomic_fetch(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_fetch, \ + long*: pshmem_ctx_long_atomic_fetch, \ + long long*: pshmem_ctx_longlong_atomic_fetch, \ + float*: pshmem_ctx_float_atomic_fetch, \ + double*: pshmem_ctx_double_atomic_fetch, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch, \ + long*: pshmem_long_atomic_fetch, \ + long long*: pshmem_longlong_atomic_fetch, \ + float*: pshmem_float_atomic_fetch, \ + double*: pshmem_double_atomic_fetch)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_fetch(const int *target, int pe); @@ -819,23 +786,21 @@ OSHMEM_DECLSPEC double pshmem_double_fetch(const double *target, int pe); OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_inc(shmem_ctx_t ctx, long long *target, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_inc(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_fetch_inc, \ - long*: pshmem_ctx_long_atomic_fetch_inc, \ - long long*: pshmem_ctx_longlong_atomic_fetch_inc)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_inc(int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_inc(long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_inc(long long *target, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_inc(dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_fetch_inc, \ - long*: pshmem_long_atomic_fetch_inc, \ - long long*: pshmem_longlong_atomic_fetch_inc)(dst, pe) +#define pshmem_atomic_fetch_inc(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_fetch_inc, \ + long*: pshmem_ctx_long_atomic_fetch_inc, \ + long long*: pshmem_ctx_longlong_atomic_fetch_inc, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_inc, \ + long*: pshmem_long_atomic_fetch_inc, \ + long long*: pshmem_longlong_atomic_fetch_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_finc(int *target, int pe); @@ -853,23 +818,21 @@ OSHMEM_DECLSPEC long long pshmem_longlong_finc(long long *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_add(shmem_ctx_t ctx, long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_add(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_add, \ - long*: pshmem_ctx_long_atomic_add, \ - long long*: pshmem_ctx_longlong_atomic_add)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_int_atomic_add(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_add(long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_atomic_add(long long *target, long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_add(dst, val, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_add, \ - long*: pshmem_long_atomic_add, \ - long long*: pshmem_longlong_atomic_add)(dst, val, pe) +#define pshmem_atomic_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_add, \ + long*: pshmem_ctx_long_atomic_add, \ + long long*: pshmem_ctx_longlong_atomic_add, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_add, \ + long*: pshmem_long_atomic_add, \ + long long*: pshmem_longlong_atomic_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_add(int *target, int value, int pe); @@ -887,92 +850,84 @@ OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_and(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_and, \ - unsigned long*: pshmem_ctx_ulong_atomic_and, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_and)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_and(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_and, \ - unsigned long*: pshmem_ulong_atomic_and, \ - unsigned long long*: pshmem_ulonglong_atomic_and)(dst, val, pe) +#define pshmem_atomic_and(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_and, \ + unsigned long*: pshmem_ctx_ulong_atomic_and, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_and, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_and, \ + unsigned long*: pshmem_ulong_atomic_and, \ + unsigned long long*: pshmem_ulonglong_atomic_and)(__VA_ARGS__) #endif /* Atomic Or */ OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_or(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_or, \ - unsigned long*: pshmem_ctx_ulong_atomic_or, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_or)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_or(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_or, \ - unsigned long*: pshmem_ulong_atomic_or, \ - unsigned long long*: pshmem_ulonglong_atomic_or)(dst, val, pe) +#define pshmem_atomic_or(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_or, \ + unsigned long*: pshmem_ctx_ulong_atomic_or, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_or, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_or, \ + unsigned long*: pshmem_ulong_atomic_or, \ + unsigned long long*: pshmem_ulonglong_atomic_or)(__VA_ARGS__) #endif /* Atomic Xor */ OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_xor(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_ctx_uint_atomic_xor, \ - unsigned long*: pshmem_ctx_ulong_atomic_xor, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_xor)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void pshmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_xor(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: pshmem_uint_atomic_xor, \ - unsigned long*: pshmem_ulong_atomic_xor, \ - unsigned long long*: pshmem_ulonglong_atomic_xor)(dst, val, pe) +#define pshmem_atomic_xor(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: pshmem_ctx_uint_atomic_xor, \ + unsigned long*: pshmem_ctx_ulong_atomic_xor, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_xor, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_uint_atomic_xor, \ + unsigned long*: pshmem_ulong_atomic_xor, \ + unsigned long long*: pshmem_ulonglong_atomic_xor)(__VA_ARGS__) #endif /* Atomic Inc */ OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_inc(shmem_ctx_t ctx, long long *target, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_inc(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_ctx_int_atomic_inc, \ - long*: pshmem_ctx_long_atomic_inc, \ - long long*: pshmem_ctx_longlong_atomic_inc)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC void pshmem_int_atomic_inc(int *target, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_inc(long *target, int pe); OSHMEM_DECLSPEC void pshmem_longlong_atomic_inc(long long *target, int pe); #if OSHMEM_HAVE_C11 -#define pshmem_atomic_inc(dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_atomic_inc, \ - long*: pshmem_long_atomic_inc, \ - long long*: pshmem_longlong_atomic_inc)(dst, pe) +#define pshmem_atomic_inc(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_inc, \ + long*: pshmem_ctx_long_atomic_inc, \ + long long*: pshmem_ctx_longlong_atomic_inc, \ + default: __oshmem_datatype_ignore), \ + int*: pshmem_int_atomic_inc, \ + long*: pshmem_long_atomic_inc, \ + long long*: pshmem_longlong_atomic_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_inc(int *target, int pe); @@ -1012,7 +967,7 @@ OSHMEM_DECLSPEC void pshmem_longlong_wait_until(volatile long long *addr, int c short*: pshmem_short_wait_until, \ int*: pshmem_int_wait_until, \ long*: pshmem_long_wait_until, \ - long long*: pshmem_longlong_wait_until(addr, cmp, value) + long long*: pshmem_longlong_wait_until)(addr, cmp, value) #endif OSHMEM_DECLSPEC int pshmem_short_test(volatile short *addr, int cmp, short value); @@ -1025,7 +980,7 @@ OSHMEM_DECLSPEC int pshmem_longlong_test(volatile long long *addr, int cmp, lon short*: pshmem_short_test, \ int*: pshmem_int_test, \ long*: pshmem_long_test, \ - long long*: pshmem_longlong_test(addr, cmp, value) + long long*: pshmem_longlong_test)(addr, cmp, value) #endif /* diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 43a2a582545..8d3478910f2 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -54,6 +54,22 @@ extern "C" { #endif +#if OSHMEM_HAVE_C11 +#define __OSHMEM_VAR_ARG1_EXPAND(_arg1, ...) _arg1 +#define __OSHMEM_VAR_ARG1(...) __OSHMEM_VAR_ARG1_EXPAND(__VA_ARGS__, _extra) +#define __OSHMEM_VAR_ARG2(_arg1, ...) __OSHMEM_VAR_ARG1_EXPAND(__VA_ARGS__, _extra) +static inline void __oshmem_datatype_ignore(void) {} +#endif + +/* + * SHMEM_Init_thread constants + */ +enum { + SHMEM_THREAD_SINGLE, + SHMEM_THREAD_FUNNELED, + SHMEM_THREAD_SERIALIZED, + SHMEM_THREAD_MULTIPLE +}; /* * OpenSHMEM API (www.openshmem.org) @@ -195,18 +211,6 @@ OSHMEM_DECLSPEC void shmem_ctx_float_p(shmem_ctx_t ctx, float* addr, float valu OSHMEM_DECLSPEC void shmem_ctx_double_p(shmem_ctx_t ctx, double* addr, double value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_p(shmem_ctx_t ctx, long long* addr, long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_p(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_p, \ - short*: shmem_ctx_short_p, \ - int*: shmem_ctx_int_p, \ - long*: shmem_ctx_long_p, \ - long long*: shmem_ctx_longlong_p, \ - float*: shmem_ctx_float_p, \ - double*: shmem_ctx_double_p, \ - long double*: shmem_ctx_longdouble_p)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_char_p(char* addr, char value, int pe); OSHMEM_DECLSPEC void shmem_short_p(short* addr, short value, int pe); @@ -217,16 +221,26 @@ OSHMEM_DECLSPEC void shmem_double_p(double* addr, double value, int pe); OSHMEM_DECLSPEC void shmem_longlong_p(long long* addr, long long value, int pe); OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_p(dst, val, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_p, \ - short*: shmem_short_p, \ - int*: shmem_int_p, \ - long*: shmem_long_p, \ - long long*: shmem_longlong_p, \ - float*: shmem_float_p, \ - double*: shmem_double_p, \ - long double*: shmem_longdouble_p)(dst, val, pe) +#define shmem_p(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_p, \ + short*: shmem_ctx_short_p, \ + int*: shmem_ctx_int_p, \ + long*: shmem_ctx_long_p, \ + long long*: shmem_ctx_longlong_p, \ + float*: shmem_ctx_float_p, \ + double*: shmem_ctx_double_p, \ + long double*: shmem_ctx_longdouble_p, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_p, \ + short*: shmem_short_p, \ + int*: shmem_int_p, \ + long*: shmem_long_p, \ + long long*: shmem_longlong_p, \ + float*: shmem_float_p, \ + double*: shmem_double_p, \ + long double*: shmem_longdouble_p)(__VA_ARGS__) #endif /* @@ -240,18 +254,6 @@ OSHMEM_DECLSPEC void shmem_ctx_float_put(shmem_ctx_t ctx, float *target, const OSHMEM_DECLSPEC void shmem_ctx_double_put(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_put(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_put(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_put, \ - short*: shmem_ctx_short_put, \ - int*: shmem_ctx_int_put, \ - long*: shmem_ctx_long_put, \ - long long*: shmem_ctx_longlong_put, \ - float*: shmem_ctx_float_put, \ - double*: shmem_ctx_double_put, \ - long double*: shmem_ctx_longdouble_put)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void shmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put(short *target, const short *source, size_t len, int pe); @@ -262,16 +264,26 @@ OSHMEM_DECLSPEC void shmem_double_put(double *target, const double *source, siz OSHMEM_DECLSPEC void shmem_longlong_put(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_put(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_put, \ - short*: shmem_short_put, \ - int*: shmem_int_put, \ - long*: shmem_long_put, \ - long long*: shmem_longlong_put, \ - float*: shmem_float_put, \ - double*: shmem_double_put, \ - long double*: shmem_longdouble_put)(dst, src, len, pe) +#define shmem_put(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_put, \ + short*: shmem_ctx_short_put, \ + int*: shmem_ctx_int_put, \ + long*: shmem_ctx_long_put, \ + long long*: shmem_ctx_longlong_put, \ + float*: shmem_ctx_float_put, \ + double*: shmem_ctx_double_put, \ + long double*: shmem_ctx_longdouble_put, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_put, \ + short*: shmem_short_put, \ + int*: shmem_int_put, \ + long*: shmem_long_put, \ + long long*: shmem_longlong_put, \ + float*: shmem_float_put, \ + double*: shmem_double_put, \ + long double*: shmem_longdouble_put)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_put8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -300,18 +312,6 @@ OSHMEM_DECLSPEC void shmem_ctx_float_iput(shmem_ctx_t ctx, float* target, const OSHMEM_DECLSPEC void shmem_ctx_double_iput(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_iput(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_iput(ctx, dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_iput, \ - short*: shmem_ctx_short_iput, \ - int*: shmem_ctx_int_iput, \ - long*: shmem_ctx_long_iput, \ - long long*: shmem_ctx_longlong_iput, \ - float*: shmem_ctx_float_iput, \ - double*: shmem_ctx_double_iput, \ - long double*: shmem_ctx_longdouble_iput)(ctx, dst, src, tst, sst, len, pe) -#endif OSHMEM_DECLSPEC void shmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_iput(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -322,16 +322,26 @@ OSHMEM_DECLSPEC void shmem_double_iput(double* target, const double* source, ptr OSHMEM_DECLSPEC void shmem_longlong_iput(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_iput(dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_iput, \ - short*: shmem_short_iput, \ - int*: shmem_int_iput, \ - long*: shmem_long_iput, \ - long long*: shmem_longlong_iput, \ - float*: shmem_float_iput, \ - double*: shmem_double_iput, \ - long double*: shmem_longdouble_iput)(dst, src, tst, sst, len, pe) +#define shmem_iput(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_iput, \ + short*: shmem_ctx_short_iput, \ + int*: shmem_ctx_int_iput, \ + long*: shmem_ctx_long_iput, \ + long long*: shmem_ctx_longlong_iput, \ + float*: shmem_ctx_float_iput, \ + double*: shmem_ctx_double_iput, \ + long double*: shmem_ctx_longdouble_iput, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_iput, \ + short*: shmem_short_iput, \ + int*: shmem_int_iput, \ + long*: shmem_long_iput, \ + long long*: shmem_longlong_iput, \ + float*: shmem_float_iput, \ + double*: shmem_double_iput, \ + long double*: shmem_longdouble_iput)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_iput8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -357,18 +367,6 @@ OSHMEM_DECLSPEC void shmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *tar OSHMEM_DECLSPEC void shmem_ctx_float_put_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_put_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_put_nbi(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_put_nbi, \ - short*: shmem_ctx_short_put_nbi, \ - int*: shmem_ctx_int_put_nbi, \ - long*: shmem_ctx_long_put_nbi, \ - long long*: shmem_ctx_longlong_put_nbi, \ - float*: shmem_ctx_float_put_nbi, \ - double*: shmem_ctx_double_put_nbi, \ - long double*: shmem_ctx_longdouble_put_nbi)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe); @@ -379,16 +377,26 @@ OSHMEM_DECLSPEC void shmem_float_put_nbi(float *target, const float *source, si OSHMEM_DECLSPEC void shmem_double_put_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_put_nbi(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_put_nbi, \ - short*: shmem_short_put_nbi, \ - int*: shmem_int_put_nbi, \ - long*: shmem_long_put_nbi, \ - long long*: shmem_longlong_put_nbi, \ - float*: shmem_float_put_nbi, \ - double*: shmem_double_put_nbi, \ - long double*: shmem_longdouble_put_nbi)(dst, src, len, pe) +#define shmem_put_nbi(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_put_nbi, \ + short*: shmem_ctx_short_put_nbi, \ + int*: shmem_ctx_int_put_nbi, \ + long*: shmem_ctx_long_put_nbi, \ + long long*: shmem_ctx_longlong_put_nbi, \ + float*: shmem_ctx_float_put_nbi, \ + double*: shmem_ctx_double_put_nbi, \ + long double*: shmem_ctx_longdouble_put_nbi, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_put_nbi, \ + short*: shmem_short_put_nbi, \ + int*: shmem_int_put_nbi, \ + long*: shmem_long_put_nbi, \ + long long*: shmem_longlong_put_nbi, \ + float*: shmem_float_put_nbi, \ + double*: shmem_double_put_nbi, \ + long double*: shmem_longdouble_put_nbi)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_put8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -416,18 +424,6 @@ OSHMEM_DECLSPEC float shmem_ctx_float_g(shmem_ctx_t ctx, const float* addr, int OSHMEM_DECLSPEC double shmem_ctx_double_g(shmem_ctx_t ctx, const double* addr, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_g(shmem_ctx_t ctx, const long long* addr, int pe); OSHMEM_DECLSPEC long double shmem_ctx_longdouble_g(shmem_ctx_t ctx, const long double* addr, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_g(ctx, addr, pe) \ - _Generic(&*(addr), \ - char*: shmem_ctx_char_g, \ - short*: shmem_ctx_short_g, \ - int*: shmem_ctx_int_g, \ - long*: shmem_ctx_long_g, \ - long long*: shmem_ctx_longlong_g, \ - float*: shmem_ctx_float_g, \ - double*: shmem_ctx_double_g, \ - long double*: shmem_ctx_longdouble_g)(ctx, addr, pe) -#endif OSHMEM_DECLSPEC char shmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short shmem_short_g(const short* addr, int pe); @@ -438,16 +434,26 @@ OSHMEM_DECLSPEC double shmem_double_g(const double* addr, int pe); OSHMEM_DECLSPEC long long shmem_longlong_g(const long long* addr, int pe); OSHMEM_DECLSPEC long double shmem_longdouble_g(const long double* addr, int pe); #if OSHMEM_HAVE_C11 -#define shmem_g(addr, pe) \ - _Generic(&*(addr), \ - char*: shmem_char_g, \ - short*: shmem_short_g, \ - int*: shmem_int_g, \ - long*: shmem_long_g, \ - long long*: shmem_longlong_g, \ - float*: shmem_float_g, \ - double*: shmem_double_g, \ - long double*: shmem_longdouble_g)(addr, pe) +#define shmem_g(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_g, \ + short*: shmem_ctx_short_g, \ + int*: shmem_ctx_int_g, \ + long*: shmem_ctx_long_g, \ + long long*: shmem_ctx_longlong_g, \ + float*: shmem_ctx_float_g, \ + double*: shmem_ctx_double_g, \ + long double*: shmem_ctx_longdouble_g, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_g, \ + short*: shmem_short_g, \ + int*: shmem_int_g, \ + long*: shmem_long_g, \ + long long*: shmem_longlong_g, \ + float*: shmem_float_g, \ + double*: shmem_double_g, \ + long double*: shmem_longdouble_g)(__VA_ARGS__) #endif /* @@ -461,18 +467,6 @@ OSHMEM_DECLSPEC void shmem_ctx_float_get(shmem_ctx_t ctx, float *target, const OSHMEM_DECLSPEC void shmem_ctx_double_get(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_get(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_get(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_get, \ - short*: shmem_ctx_short_get, \ - int*: shmem_ctx_int_get, \ - long*: shmem_ctx_long_get, \ - long long*: shmem_ctx_longlong_get, \ - float*: shmem_ctx_float_get, \ - double*: shmem_ctx_double_get, \ - long double*: shmem_ctx_longdouble_get)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void shmem_char_get(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_get(short *target, const short *source, size_t len, int pe); @@ -483,16 +477,26 @@ OSHMEM_DECLSPEC void shmem_double_get(double *target, const double *source, siz OSHMEM_DECLSPEC void shmem_longlong_get(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_get(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_get, \ - short*: shmem_short_get, \ - int*: shmem_int_get, \ - long*: shmem_long_get, \ - long long*: shmem_longlong_get, \ - float*: shmem_float_get, \ - double*: shmem_double_get, \ - long double*: shmem_longdouble_get)(dst, src, len, pe) +#define shmem_get(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_get, \ + short*: shmem_ctx_short_get, \ + int*: shmem_ctx_int_get, \ + long*: shmem_ctx_long_get, \ + long long*: shmem_ctx_longlong_get, \ + float*: shmem_ctx_float_get, \ + double*: shmem_ctx_double_get, \ + long double*: shmem_ctx_longdouble_get, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_get, \ + short*: shmem_short_get, \ + int*: shmem_int_get, \ + long*: shmem_long_get, \ + long long*: shmem_longlong_get, \ + float*: shmem_float_get, \ + double*: shmem_double_get, \ + long double*: shmem_longdouble_get)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_get8(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -520,18 +524,6 @@ OSHMEM_DECLSPEC void shmem_ctx_double_iget(shmem_ctx_t ctx, double* target, cons OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_iget(ctx, dst, src, tst, sst, len, pe)\ - _Generic(&*(dst), \ - char*: shmem_ctx_char_iget, \ - short*: shmem_ctx_short_iget, \ - int*: shmem_ctx_int_iget, \ - long*: shmem_ctx_long_iget, \ - long long*: shmem_ctx_longlong_iget, \ - float*: shmem_ctx_float_iget, \ - double*: shmem_ctx_double_iget, \ - long double*: shmem_ctx_longdouble_iget)(ctx, dst, src, tst, sst, len, pe) -#endif OSHMEM_DECLSPEC void shmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -542,16 +534,26 @@ OSHMEM_DECLSPEC void shmem_longlong_iget(long long* target, const long long* sou OSHMEM_DECLSPEC void shmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_iget(dst, src, tst, sst, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_iget, \ - short*: shmem_short_iget, \ - int*: shmem_int_iget, \ - long*: shmem_long_iget, \ - long long*: shmem_longlong_iget, \ - float*: shmem_float_iget, \ - double*: shmem_double_iget, \ - long double*: shmem_longdouble_iget)(dst, src, tst, sst, len, pe) +#define shmem_iget(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_iget, \ + short*: shmem_ctx_short_iget, \ + int*: shmem_ctx_int_iget, \ + long*: shmem_ctx_long_iget, \ + long long*: shmem_ctx_longlong_iget, \ + float*: shmem_ctx_float_iget, \ + double*: shmem_ctx_double_iget, \ + long double*: shmem_ctx_longdouble_iget, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_iget, \ + short*: shmem_short_iget, \ + int*: shmem_int_iget, \ + long*: shmem_long_iget, \ + long long*: shmem_longlong_iget, \ + float*: shmem_float_iget, \ + double*: shmem_double_iget, \ + long double*: shmem_longdouble_iget)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_iget8(shmem_ctx_t ctx, void* target, const void* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -577,18 +579,6 @@ OSHMEM_DECLSPEC void shmem_ctx_longlong_get_nbi(shmem_ctx_t ctx, long long *tar OSHMEM_DECLSPEC void shmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_get_nbi(ctx, dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_ctx_char_get_nbi, \ - short*: shmem_ctx_short_get_nbi, \ - int*: shmem_ctx_int_get_nbi, \ - long*: shmem_ctx_long_get_nbi, \ - long long*: shmem_ctx_longlong_get_nbi, \ - float*: shmem_ctx_float_get_nbi, \ - double*: shmem_ctx_double_get_nbi, \ - long double*: shmem_ctx_longdouble_get_nbi)(ctx, dst, src, len, pe) -#endif OSHMEM_DECLSPEC void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_get_nbi(char *target, const char *source, size_t len, int pe); @@ -600,16 +590,26 @@ OSHMEM_DECLSPEC void shmem_float_get_nbi(float *target, const float *source, si OSHMEM_DECLSPEC void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_get_nbi(dst, src, len, pe) \ - _Generic(&*(dst), \ - char*: shmem_char_get_nbi, \ - short*: shmem_short_get_nbi, \ - int*: shmem_int_get_nbi, \ - long*: shmem_long_get_nbi, \ - long long*: shmem_longlong_get_nbi, \ - float*: shmem_float_get_nbi, \ - double*: shmem_double_get_nbi, \ - long double*: shmem_longdouble_get_nbi)(dst, src, len, pe) +#define shmem_get_nbi(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_get_nbi, \ + short*: shmem_ctx_short_get_nbi, \ + int*: shmem_ctx_int_get_nbi, \ + long*: shmem_ctx_long_get_nbi, \ + long long*: shmem_ctx_longlong_get_nbi, \ + float*: shmem_ctx_float_get_nbi, \ + double*: shmem_ctx_double_get_nbi, \ + long double*: shmem_ctx_longdouble_get_nbi, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_get_nbi, \ + short*: shmem_short_get_nbi, \ + int*: shmem_int_get_nbi, \ + long*: shmem_long_get_nbi, \ + long long*: shmem_longlong_get_nbi, \ + float*: shmem_float_get_nbi, \ + double*: shmem_double_get_nbi, \ + long double*: shmem_longdouble_get_nbi)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_ctx_get8_nbi(shmem_ctx_t ctx, void *target, const void *source, size_t len, int pe); @@ -634,15 +634,6 @@ OSHMEM_DECLSPEC long shmem_ctx_long_atomic_swap(shmem_ctx_t ctx, long *target, l OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long*target, long long value, int pe); OSHMEM_DECLSPEC float shmem_ctx_float_atomic_swap(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC double shmem_ctx_double_atomic_swap(shmem_ctx_t ctx, double *target, double value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_swap(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_swap, \ - long*: shmem_ctx_long_atomic_swap, \ - long long*: shmem_ctx_longlong_atomic_swap, \ - float*: shmem_ctx_float_atomic_swap, \ - double*: shmem_ctx_double_atomic_swap)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC int shmem_int_atomic_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_swap(long *target, long value, int pe); @@ -650,13 +641,20 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_swap(long long*target, long long OSHMEM_DECLSPEC float shmem_float_atomic_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double shmem_double_atomic_swap(double *target, double value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_swap(dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_swap, \ - long*: shmem_long_atomic_swap, \ - long long*: shmem_longlong_atomic_swap, \ - float*: shmem_float_atomic_swap, \ - double*: shmem_double_atomic_swap)(dst, val, pe) +#define shmem_atomic_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_swap, \ + long*: shmem_ctx_long_atomic_swap, \ + long long*: shmem_ctx_longlong_atomic_swap, \ + float*: shmem_ctx_float_atomic_swap, \ + double*: shmem_ctx_double_atomic_swap, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_swap, \ + long*: shmem_long_atomic_swap, \ + long long*: shmem_longlong_atomic_swap, \ + float*: shmem_float_atomic_swap, \ + double*: shmem_double_atomic_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_swap(int *target, int value, int pe); @@ -680,15 +678,6 @@ OSHMEM_DECLSPEC void shmem_ctx_long_atomic_set(shmem_ctx_t ctx, long *target, lo OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long*target, long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_atomic_set(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_atomic_set(shmem_ctx_t ctx, double *target, double value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_set(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_set, \ - long*: shmem_ctx_long_atomic_set, \ - long long*: shmem_ctx_longlong_atomic_set, \ - float*: shmem_ctx_float_atomic_set, \ - double*: shmem_ctx_double_atomic_set)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_int_atomic_set(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_set(long *target, long value, int pe); @@ -696,13 +685,20 @@ OSHMEM_DECLSPEC void shmem_longlong_atomic_set(long long*target, long long value OSHMEM_DECLSPEC void shmem_float_atomic_set(float *target, float value, int pe); OSHMEM_DECLSPEC void shmem_double_atomic_set(double *target, double value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_set(dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_set, \ - long*: shmem_long_atomic_set, \ - long long*: shmem_longlong_atomic_set, \ - float*: shmem_float_atomic_set, \ - double*: shmem_double_atomic_set)(dst, val, pe) +#define shmem_atomic_set(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_set, \ + long*: shmem_ctx_long_atomic_set, \ + long long*: shmem_ctx_longlong_atomic_set, \ + float*: shmem_ctx_float_atomic_set, \ + double*: shmem_ctx_double_atomic_set, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_set, \ + long*: shmem_long_atomic_set, \ + long long*: shmem_longlong_atomic_set, \ + float*: shmem_float_atomic_set, \ + double*: shmem_double_atomic_set)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_set(int *target, int value, int pe); @@ -725,24 +721,21 @@ OSHMEM_DECLSPEC int shmem_ctx_int_atomic_compare_swap(shmem_ctx_t ctx, int *targ OSHMEM_DECLSPEC long shmem_ctx_long_atomic_compare_swap(shmem_ctx_t ctx, long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_compare_swap(shmem_ctx_t ctx, long long *target, long long cond, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_compare_swap(ctx, dst, cond, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_compare_swap, \ - long*: shmem_ctx_long_atomic_compare_swap, \ - long long*: shmem_ctx_longlong_atomic_compare_swap)(ctx, dst, cond, val, pe) -#endif - OSHMEM_DECLSPEC int shmem_int_atomic_compare_swap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_compare_swap(long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_compare_swap(long long *target, long long cond, long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_compare_swap(dst, cond, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_compare_swap, \ - long*: shmem_long_atomic_compare_swap, \ - long long*: shmem_longlong_atomic_compare_swap)(dst, cond, val, pe) +#define shmem_atomic_compare_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_compare_swap, \ + long*: shmem_ctx_long_atomic_compare_swap, \ + long long*: shmem_ctx_longlong_atomic_compare_swap, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_compare_swap, \ + long*: shmem_long_atomic_compare_swap, \ + long long*: shmem_longlong_atomic_compare_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_cswap(int *target, int cond, int value, int pe); @@ -761,23 +754,21 @@ OSHMEM_DECLSPEC long long shmem_longlong_cswap(long long *target, long long cond OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_add(shmem_ctx_t ctx, long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_add(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_fetch_add, \ - long*: shmem_ctx_long_atomic_fetch_add, \ - long long*: shmem_ctx_longlong_atomic_fetch_add)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC int shmem_int_atomic_fetch_add(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_add(long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_add(long long *target, long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_add(dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_fetch_add, \ - long*: shmem_long_atomic_fetch_add, \ - long long*: shmem_longlong_atomic_fetch_add)(dst, val, pe) +#define shmem_atomic_fetch_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_add, \ + long*: shmem_ctx_long_atomic_fetch_add, \ + long long*: shmem_ctx_longlong_atomic_fetch_add, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_add, \ + long*: shmem_long_atomic_fetch_add, \ + long long*: shmem_longlong_atomic_fetch_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_fadd(int *target, int value, int pe); @@ -795,69 +786,63 @@ OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_and(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_fetch_and, \ - unsigned long*: shmem_ctx_ulong_atomic_fetch_and, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_and)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_and(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_fetch_and, \ - unsigned long*: shmem_ulong_atomic_fetch_and, \ - unsigned long long*: shmem_ulonglong_atomic_fetch_and)(dst, val, pe) +#define shmem_atomic_fetch_and(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_fetch_and, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch_and, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_and, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_fetch_and, \ + unsigned long*: shmem_ulong_atomic_fetch_and, \ + unsigned long long*: shmem_ulonglong_atomic_fetch_and)(__VA_ARGS__) #endif /* Atomic Fetch&Or */ OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_or(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_fetch_or, \ - unsigned long*: shmem_ctx_ulong_atomic_fetch_or, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_or)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_or(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_fetch_or, \ - unsigned long*: shmem_ulong_atomic_fetch_or, \ - unsigned long long*: shmem_ulonglong_atomic_fetch_or)(dst, val, pe) +#define shmem_atomic_fetch_or(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_fetch_or, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch_or, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_or, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_fetch_or, \ + unsigned long*: shmem_ulong_atomic_fetch_or, \ + unsigned long long*: shmem_ulonglong_atomic_fetch_or)(__VA_ARGS__) #endif /* Atomic Fetch&Xor */ OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_xor(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_fetch_xor, \ - unsigned long*: shmem_ctx_ulong_atomic_fetch_xor, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_xor)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_xor(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_fetch_xor, \ - unsigned long*: shmem_ulong_atomic_fetch_xor, \ - unsigned long long*: shmem_ulonglong_atomic_fetch_xor)(dst, val, pe) +#define shmem_atomic_fetch_xor(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_fetch_xor, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch_xor, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_xor, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_fetch_xor, \ + unsigned long*: shmem_ulong_atomic_fetch_xor, \ + unsigned long long*: shmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__) #endif /* Atomic Fetch */ @@ -866,15 +851,6 @@ OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch(shmem_ctx_t ctx, const long *ta OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch(shmem_ctx_t ctx, const long long *target, int pe); OSHMEM_DECLSPEC float shmem_ctx_float_atomic_fetch(shmem_ctx_t ctx, const float *target, int pe); OSHMEM_DECLSPEC double shmem_ctx_double_atomic_fetch(shmem_ctx_t ctx, const double *target, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_fetch, \ - long*: shmem_ctx_long_atomic_fetch, \ - long long*: shmem_ctx_longlong_atomic_fetch,\ - float*: shmem_ctx_float_atomic_fetch, \ - double*: shmem_ctx_double_atomic_fetch)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC int shmem_int_atomic_fetch(const int *target, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch(const long *target, int pe); @@ -882,13 +858,20 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch(const long long *target, i OSHMEM_DECLSPEC float shmem_float_atomic_fetch(const float *target, int pe); OSHMEM_DECLSPEC double shmem_double_atomic_fetch(const double *target, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch(dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_fetch, \ - long*: shmem_long_atomic_fetch, \ - long long*: shmem_longlong_atomic_fetch, \ - float*: shmem_float_atomic_fetch, \ - double*: shmem_double_atomic_fetch)(dst, pe) +#define shmem_atomic_fetch(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch, \ + long*: shmem_ctx_long_atomic_fetch, \ + long long*: shmem_ctx_longlong_atomic_fetch, \ + float*: shmem_ctx_float_atomic_fetch, \ + double*: shmem_ctx_double_atomic_fetch, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch, \ + long*: shmem_long_atomic_fetch, \ + long long*: shmem_longlong_atomic_fetch, \ + float*: shmem_float_atomic_fetch, \ + double*: shmem_double_atomic_fetch)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_fetch(const int *target, int pe); @@ -910,23 +893,21 @@ OSHMEM_DECLSPEC double shmem_double_fetch(const double *target, int pe); OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_inc(shmem_ctx_t ctx, long long *target, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_inc(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_fetch_inc,\ - long*: shmem_ctx_long_atomic_fetch_inc,\ - long long*: shmem_ctx_longlong_atomic_fetch_inc)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC int shmem_int_atomic_fetch_inc(int *target, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_inc(long *target, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_inc(long long *target, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_inc(dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_fetch_inc, \ - long*: shmem_long_atomic_fetch_inc, \ - long long*: shmem_longlong_atomic_fetch_inc)(dst, pe) +#define shmem_atomic_fetch_inc(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_inc, \ + long*: shmem_ctx_long_atomic_fetch_inc, \ + long long*: shmem_ctx_longlong_atomic_fetch_inc, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_inc, \ + long*: shmem_long_atomic_fetch_inc, \ + long long*: shmem_longlong_atomic_fetch_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_finc(int *target, int pe); @@ -944,23 +925,21 @@ OSHMEM_DECLSPEC long long shmem_longlong_finc(long long *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_int_atomic_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_atomic_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_add(shmem_ctx_t ctx, long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_add(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_add, \ - long*: shmem_ctx_long_atomic_add, \ - long long*: shmem_ctx_longlong_atomic_add)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_int_atomic_add(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_add(long *target, long value, int pe); OSHMEM_DECLSPEC void shmem_longlong_atomic_add(long long *target, long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_add(dst, val, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_add, \ - long*: shmem_long_atomic_add, \ - long long*: shmem_longlong_atomic_add)(dst, val, pe) +#define shmem_atomic_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_add, \ + long*: shmem_ctx_long_atomic_add, \ + long long*: shmem_ctx_longlong_atomic_add, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_add, \ + long*: shmem_long_atomic_add, \ + long long*: shmem_longlong_atomic_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_add(int *target, int value, int pe); @@ -978,92 +957,84 @@ OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_and(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_and, \ - unsigned long*: shmem_ctx_ulong_atomic_and, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_and)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_and(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_and, \ - unsigned long*: shmem_ulong_atomic_and, \ - unsigned long long*: shmem_ulonglong_atomic_and)(dst, val, pe) +#define shmem_atomic_and(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_and, \ + unsigned long*: shmem_ctx_ulong_atomic_and, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_and, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_and, \ + unsigned long*: shmem_ulong_atomic_and, \ + unsigned long long*: shmem_ulonglong_atomic_and)(__VA_ARGS__) #endif /* Atomic Or */ OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_or(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_or, \ - unsigned long*: shmem_ctx_ulong_atomic_or, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_or)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_or(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_or, \ - unsigned long*: shmem_ulong_atomic_or, \ - unsigned long long*: shmem_ulonglong_atomic_or)(dst, val, pe) +#define shmem_atomic_or(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_or, \ + unsigned long*: shmem_ctx_ulong_atomic_or, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_or, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_or, \ + unsigned long*: shmem_ulong_atomic_or, \ + unsigned long long*: shmem_ulonglong_atomic_or)(__VA_ARGS__) #endif /* Atomic Xor */ OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_xor(ctx, dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_ctx_uint_atomic_xor, \ - unsigned long*: shmem_ctx_ulong_atomic_xor, \ - unsigned long long*: shmem_ctx_ulonglong_atomic_xor)(ctx, dst, val, pe) -#endif OSHMEM_DECLSPEC void shmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_xor(dst, val, pe) \ - _Generic(&*(dst), \ - unsigned int*: shmem_uint_atomic_xor, \ - unsigned long*: shmem_ulong_atomic_xor, \ - unsigned long long*: shmem_ulonglong_atomic_xor)(dst, val, pe) +#define shmem_atomic_xor(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + unsigned int*: shmem_ctx_uint_atomic_xor, \ + unsigned long*: shmem_ctx_ulong_atomic_xor, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_xor, \ + default: __oshmem_datatype_ignore), \ + unsigned int*: shmem_uint_atomic_xor, \ + unsigned long*: shmem_ulong_atomic_xor, \ + unsigned long long*: shmem_ulonglong_atomic_xor)(__VA_ARGS__) #endif /* Atomic Inc */ OSHMEM_DECLSPEC void shmem_ctx_int_atomic_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_atomic_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_inc(shmem_ctx_t ctx, long long *target, int pe); -#if OSHMEM_HAVE_C11 -#define shmem_atomic_inc(ctx, dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_ctx_int_atomic_inc, \ - long*: shmem_ctx_long_atomic_inc, \ - long long*: shmem_ctx_longlong_atomic_inc)(ctx, dst, pe) -#endif OSHMEM_DECLSPEC void shmem_int_atomic_inc(int *target, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_inc(long *target, int pe); OSHMEM_DECLSPEC void shmem_longlong_atomic_inc(long long *target, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_inc(dst, pe) \ - _Generic(&*(dst), \ - int*: shmem_int_atomic_inc, \ - long*: shmem_long_atomic_inc, \ - long long*: shmem_longlong_atomic_inc)(dst, pe) +#define shmem_atomic_inc(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_inc, \ + long*: shmem_ctx_long_atomic_inc, \ + long long*: shmem_ctx_longlong_atomic_inc, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_inc, \ + long*: shmem_long_atomic_inc, \ + long long*: shmem_longlong_atomic_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_inc(int *target, int pe); @@ -1103,7 +1074,7 @@ OSHMEM_DECLSPEC void shmem_longlong_wait_until(volatile long long *addr, int cm short*: shmem_short_wait_until, \ int*: shmem_int_wait_until, \ long*: shmem_long_wait_until, \ - long long*: shmem_longlong_wait_until(addr, cmp, value) + long long*: shmem_longlong_wait_until)(addr, cmp, value) #endif OSHMEM_DECLSPEC int shmem_short_test(volatile short *addr, int cmp, short value); @@ -1116,7 +1087,7 @@ OSHMEM_DECLSPEC int shmem_longlong_test(volatile long long *addr, int cmp, long short*: shmem_short_test, \ int*: shmem_int_test, \ long*: shmem_long_test, \ - long long*: shmem_longlong_test(addr, cmp, value) + long long*: shmem_longlong_test)(addr, cmp, value) #endif /* diff --git a/oshmem/runtime/runtime.h b/oshmem/runtime/runtime.h index 737def7e255..f0a093438d7 100644 --- a/oshmem/runtime/runtime.h +++ b/oshmem/runtime/runtime.h @@ -74,16 +74,6 @@ OSHMEM_DECLSPEC extern shmem_ctx_t oshmem_ctx_default; } while (0) -/* - * SHMEM_Init_thread constants - */ -enum { - SHMEM_THREAD_SINGLE, - SHMEM_THREAD_FUNNELED, - SHMEM_THREAD_SERIALIZED, - SHMEM_THREAD_MULTIPLE -}; - /** Bitflags to be used for the modex exchange for the various thread * levels. Required to support heterogeneous environments */ #define OSHMEM_THREADLEVEL_SINGLE_BF 0x00000001 From eba44d37098b2e10d5ca481a6f67ca8aa87ca58b Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 22 Aug 2018 10:57:27 -0600 Subject: [PATCH 035/674] btl/vader: clean up debuging and squash warning References #5512 Signed-off-by: Nathan Hjelm (cherry picked from commit c74cf666a983179ffb6e5a13b7da8ba807f4d16d) Signed-off-by: Nathan Hjelm --- opal/mca/btl/vader/btl_vader_sc_emu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_sc_emu.c b/opal/mca/btl/vader/btl_vader_sc_emu.c index 651ce9b4eb3..4f0b289ea63 100644 --- a/opal/mca/btl/vader/btl_vader_sc_emu.c +++ b/opal/mca/btl/vader/btl_vader_sc_emu.c @@ -15,9 +15,7 @@ #if OPAL_HAVE_ATOMIC_MATH_64 static void mca_btl_vader_sc_emu_atomic_64 (int64_t *operand, volatile int64_t *addr, mca_btl_base_atomic_op_t op) { - int64_t result; - - fprintf (stderr, "Performing atomic operation %d on address %p\n", op, (void *) addr); + int64_t result = 0; switch (op) { case MCA_BTL_ATOMIC_ADD: @@ -56,9 +54,7 @@ static void mca_btl_vader_sc_emu_atomic_64 (int64_t *operand, volatile int64_t * #if OPAL_HAVE_ATOMIC_MATH_32 static void mca_btl_vader_sc_emu_atomic_32 (int32_t *operand, volatile int32_t *addr, mca_btl_base_atomic_op_t op) { - int32_t result; - - fprintf (stderr, "Performing atomic operation %d on address %p\n", op, (void *) addr); + int32_t result = 0; switch (op) { case MCA_BTL_ATOMIC_ADD: From b4ae5d005f102db3ae2642a3595397ecce3ecf3b Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 24 Aug 2018 16:41:05 -0700 Subject: [PATCH 036/674] Allow run-as-root if 2 envars are set Per suggestion by @bangerth, allow mpirun to execute as root if two envars are set to specific values Per conversation with @jsquyres, name the envars OMPI_ALLOW_RUN_AS_ROOT and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM Fixes #4451 Signed-off-by: Ralph Castain Signed-off-by: Jeff Squyres (cherry picked from commit 7f1444d5f9e504ff50392a0f73e81787c01b7a0e) --- orte/orted/orted_submit.c | 18 +++++++++++++++--- orte/tools/orterun/orterun.1in | 26 ++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index a1ad7d7b522..f835db4ae2f 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -324,6 +324,14 @@ int orte_submit_init(int argc, char *argv[], * exit with a giant warning flag */ if (0 == geteuid() && !orte_cmd_options.run_as_root) { + /* check for two envars that allow override of this protection */ + char *r1, *r2; + if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) && + NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) { + if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) { + goto moveon; + } + } /* show_help is not yet available, so print an error manually */ fprintf(stderr, "--------------------------------------------------------------------------\n"); if (orte_cmd_options.help) { @@ -338,13 +346,17 @@ int orte_submit_init(int argc, char *argv[], fprintf(stderr, "We strongly suggest that you run %s as a non-root user.\n\n", orte_basename); - fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n"); - fprintf(stderr, "option to your command line. However, we reiterate our strong advice\n"); - fprintf(stderr, "against doing so - please do so at your own risk.\n"); + fprintf(stderr, "You can override this protection by adding the --allow-run-as-root option\n"); + fprintf(stderr, "to the cmd line or by setting two environment variables in the following way:\n"); + fprintf(stderr, "the variable OMPI_ALLOW_RUN_AS_ROOT=1 to indicate the desire to override this\n"); + fprintf(stderr, "protection, and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 to confirm the choice and\n"); + fprintf(stderr, "add one more layer of certainty that you want to do so.\n"); + fprintf(stderr, "We reiterate our advice against doing so - please proceed at your own risk.\n"); fprintf(stderr, "--------------------------------------------------------------------------\n"); exit(1); } + moveon: /* process any mca params */ rc = mca_base_cmd_line_process_args(orte_cmd_line, &environ, &environ); if (ORTE_SUCCESS != rc) { diff --git a/orte/tools/orterun/orterun.1in b/orte/tools/orterun/orterun.1in index aef58239ef8..4d9d5665d42 100644 --- a/orte/tools/orterun/orterun.1in +++ b/orte/tools/orterun/orterun.1in @@ -645,7 +645,10 @@ Allow .I mpirun to run when executed by the root user .RI ( mpirun -defaults to aborting when launched as the root user). +defaults to aborting when launched as the root user). Be sure to see +the +.I Running as root +section, below, for more detail. . . .TP @@ -1628,7 +1631,26 @@ To override this default, you can add the .I --allow-run-as-root option to the .I mpirun -command line. +command line, or you can set the environmental parameters +.I OMPI_ALLOW_RUN_AS_ROOT=1 +and +.IR OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 . +Note that it takes setting +.I two +environment variables to effect the same behavior as +.I --allow-run-as-root +in order to stress the Open MPI team's strong advice against running +as the root user. After extended discussions with communities who use +containers (where running as the root user is the default), there was +a persistent desire to be able to enable root execution of +.I mpirun +via an environmental control (vs. the existing +.I --allow-run-as-root +command line parameter). The compromise of using +.I two +environment variables was reached: it allows root execution via an +environmental control, but it conveys the Open MPI team's strong +recomendation against this behavior. . .SS Exit status . From b2628129fd9d90b367d030162b06baa6a98f5722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= Date: Mon, 6 Aug 2018 19:42:23 +0200 Subject: [PATCH 037/674] fcntl include bugfix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Zoltán Mizsei (cherry picked from commit open-mpi/ompi@ac3f8a16edd10303d571288912a6732ae0698f9b) --- opal/util/stacktrace.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opal/util/stacktrace.c b/opal/util/stacktrace.c index e9d8cdb1ee2..afb791e62c8 100644 --- a/opal/util/stacktrace.c +++ b/opal/util/stacktrace.c @@ -32,8 +32,12 @@ #ifdef HAVE_SYS_STAT_H #include #endif -#ifdef HAVE_SYS_FCNTL_H +#ifdef HAVE_FCNTL_H #include +#else +#ifdef HAVE_SYS_FCNTL_H +#include +#endif #endif #include From 2e4955427d59507e427638808d2133f155e0d9fd Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 24 Aug 2018 17:03:54 +0900 Subject: [PATCH 038/674] test: protect with the HAVE_SYS_MOUNT_H macro Thanks Zoltan Mizsei for bringing this to our attention. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@a02be5e91a8aeb02f1a8b224f794652f10c1f2e6) --- test/util/opal_path_nfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/util/opal_path_nfs.c b/test/util/opal_path_nfs.c index b5fad7ae3dd..fe5768c00ee 100644 --- a/test/util/opal_path_nfs.c +++ b/test/util/opal_path_nfs.c @@ -16,6 +16,8 @@ * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +33,9 @@ #include #include +#ifdef HAVE_SYS_MOUNT_H #include +#endif #ifdef HAVE_SYS_STATFS_H #include #endif From 221fc3ec6616d6765c4eed44fa98891ad4de7868 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Mon, 27 Aug 2018 10:51:14 -0600 Subject: [PATCH 039/674] NEWS: sync 4.0.x NEWS with 3.1.x Signed-off-by: Howard Pritchard --- NEWS | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 113 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 2d823536c55..bb205ad8fc9 100644 --- a/NEWS +++ b/NEWS @@ -12,9 +12,9 @@ Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006 Voltaire, Inc. All rights reserved. Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights +Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights reserved. -Copyright (c) 2010-2017 IBM Corporation. All rights reserved. +Copyright (c) 2010-2018 IBM Corporation. All rights reserved. Copyright (c) 2012 Oak Ridge National Labs. All rights reserved. Copyright (c) 2012 Sandia National Laboratories. All rights reserved. Copyright (c) 2012 University of Houston. All rights reserved. @@ -55,8 +55,8 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. -Master (not on release branches yet) ------------------------------------- +4.0.0 -- September, 2018 +------------------------ ********************************************************************** * PRE-DEPRECATION WARNING: MPIR Support @@ -80,6 +80,53 @@ Master (not on release branches yet) Currently, this means the Open SHMEM layer will only build if a MXM or UCX library is found. +3.1.2 -- August, 2018 +------------------------ + +- A subtle race condition bug was discovered in the "vader" BTL + (shared memory communications) that, in rare instances, can cause + MPI processes to crash or incorrectly classify (or effectively drop) + an MPI message sent via shared memory. If you are using the "ob1" + PML with "vader" for shared memory communication (note that vader is + the default for shared memory communication with ob1), you need to + upgrade to v3.1.2 or later to fix this issue. You may also upgrade + to the following versions to fix this issue: + - Open MPI v2.1.5 (expected end of August, 2018) or later in the + v2.1.x series + - Open MPI v3.0.1 (released March, 2018) or later in the v3.0.x + series +- Assorted Portals 4.0 bug fixes. +- Fix for possible data corruption in MPI_BSEND. +- Move shared memory file for vader btl into /dev/shm on Linux. +- Fix for MPI_ISCATTER/MPI_ISCATTERV Fortran interfaces with MPI_IN_PLACE. +- Upgrade PMIx to v2.1.3. +- Numerous One-sided bug fixes. +- Fix for race condition in uGNI BTL. +- Improve handling of large number of interfaces with TCP BTL. +- Numerous UCX bug fixes. + +3.1.1 -- June, 2018 +------------------- + +- Fix potential hang in UCX PML during MPI_FINALIZE +- Update internal PMIx to v2.1.2rc2 to fix forward version compatibility. +- Add new MCA parameter osc_sm_backing_store to allow users to specify + where in the filesystem the backing file for the shared memory + one-sided component should live. Defaults to /dev/shm on Linux. +- Fix potential hang on non-x86 platforms when using builds with + optimization flags turned off. +- Disable osc/pt2pt when using MPI_THREAD_MULTIPLE due to numerous + race conditions in the component. +- Fix dummy variable names for the mpi and mpi_f08 Fortran bindings to + match the MPI standard. This may break applications which use + name-based parameters in Fortran which used our internal names + rather than those documented in the MPI standard. +- Revamp Java detection to properly handle new Java versions which do + not provide a javah wrapper. +- Fix RMA function signatures for use-mpi-f08 bindings to have the + asynchonous property on all buffers. +- Improved configure logic for finding the UCX library. + 3.1.0 -- May, 2018 ------------------ @@ -246,6 +293,68 @@ Known issues: - MPI_Connect/accept between applications started by different mpirun commands will fail, even if ompi-server is running. +2.1.5 -- August 2018 +-------------------- + +- A subtle race condition bug was discovered in the "vader" BTL + (shared memory communications) that, in rare instances, can cause + MPI processes to crash or incorrectly classify (or effectively drop) + an MPI message sent via shared memory. If you are using the "ob1" + PML with "vader" for shared memory communication (note that vader is + the default for shared memory communication with ob1), you need to + upgrade to v2.1.5 to fix this issue. You may also upgrade to the + following versions to fix this issue: + - Open MPI v3.0.1 (released March, 2018) or later in the v3.0.x + series + - Open MPI v3.1.2 (expected end of August, 2018) or later +- A link issue was fixed when the UCX library was not located in the + linker-default search paths. + +2.1.4 -- August, 2018 +--------------------- + +Bug fixes/minor improvements: +- Disable the POWER 7/BE block in configure. Note that POWER 7/BE is + still not a supported platform, but it is no longer automatically + disabled. See + https://github.com/open-mpi/ompi/issues/4349#issuecomment-374970982 + for more information. +- Fix bug with request-based one-sided MPI operations when using the + "rdma" component. +- Fix issue with large data structure in the TCP BTL causing problems + in some environments. Thanks to @lgarithm for reporting the issue. +- Minor Cygwin build fixes. +- Minor fixes for the openib BTL: + - Support for the QLogic RoCE HCA + - Support for the Boradcom Cumulus RoCE HCA + - Enable support for HDR link speeds +- Fix MPI_FINALIZED hang if invoked from an attribute destructor + during the MPI_COMM_SELF destruction in MPI_FINALIZE. Thanks to + @AndrewGaspar for reporting the issue. +- Java fixes: + - Modernize Java framework detection, especially on OS X/MacOS. + Thanks to Bryce Glover for reporting and submitting the fixes. + - Prefer "javac -h" to "javah" to support newer Java frameworks. +- Fortran fixes: + - Use conformant dummy parameter names for Fortran bindings. Thanks + to Themos Tsikas for reporting and submitting the fixes. + - Build the MPI_SIZEOF() interfaces in the "TKR"-style "mpi" module + whenever possible. Thanks to Themos Tsikas for reporting the + issue. + - Fix array of argv handling for the Fortran bindings of + MPI_COMM_SPAWN_MULTIPLE (and its associated man page). + - Make NAG Fortran compiler support more robust in configure. +- Disable the "pt2pt" one-sided MPI component when MPI_THREAD_MULTIPLE + is used. This component is simply not safe in MPI_THREAD_MULTIPLE + scenarios, and will not be fixed in the v2.1.x series. +- Make the "external" hwloc component fail gracefully if it is tries + to use an hwloc v2.x.y installation. hwloc v2.x.y will not be + supported in the Open MPI v2.1.x series. +- Fix "vader" shared memory support for messages larger than 2GB. + Thanks to Heiko Bauke for the bug report. +- Configure fixes for external PMI directory detection. Thanks to + Davide Vanzo for the report. + 2.1.3 -- March, 2018 -------------------- From a489a6fc9dafd5e288fb1dbc998a4833ec032b05 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 27 Aug 2018 11:45:04 -0500 Subject: [PATCH 040/674] sharedfp/sm and lockedfile: fix naming bug If an application opens a file for reading from multiple processes using MPI_COMM_SELF (or another communicator that has distinct process groups but the same comm-id, as can happen as the result of comm_split), the naming chosen for the lockedfile or the mmapped file used by the sharedfp/sm component would collide. This patch ensures that the filename is different by integrating the process id of rank 0 for each sub-communicator. This fixes one aspect of the problem reported in github issue 5593 Signed-off-by: Edgar Gabriel --- .../sharedfp_lockedfile_file_open.c | 23 +++++++++++++++---- ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c | 22 +++++++++++++++--- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c index 66c17ee22df..b82be1f8932 100644 --- a/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c +++ b/ompi/mca/sharedfp/lockedfile/sharedfp_lockedfile_file_open.c @@ -35,6 +35,7 @@ #include #endif #include +#include int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, const char* filename, @@ -47,7 +48,9 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, int handle; struct mca_sharedfp_lockedfile_data * module_data = NULL; struct mca_sharedfp_base_data_t* sh; - + pid_t my_pid; + int int_pid; + /*Memory is allocated here for the sh structure*/ sh = (struct mca_sharedfp_base_data_t*)malloc(sizeof(struct mca_sharedfp_base_data_t)); if ( NULL == sh){ @@ -87,16 +90,28 @@ int mca_sharedfp_lockedfile_file_open (struct ompi_communicator_t *comm, return err; } - size_t filenamelen = strlen(filename) + 16; + if ( 0 == fh->f_rank ) { + my_pid = getpid(); + int_pid = (int) my_pid; + } + err = comm->c_coll->coll_bcast (&int_pid, 1, MPI_INT, 0, comm, comm->c_coll->coll_bcast_module ); + if ( OMPI_SUCCESS != err ) { + opal_output(0, "[%d]mca_sharedfp_lockedfile_file_open: Error in bcast operation\n", fh->f_rank); + free (sh); + free(module_data); + return err; + } + + size_t filenamelen = strlen(filename) + 24; lockedfilename = (char*)malloc(sizeof(char) * filenamelen); if ( NULL == lockedfilename ) { free (sh); free (module_data); return OMPI_ERR_OUT_OF_RESOURCE; } - snprintf(lockedfilename, filenamelen, "%s-%u%s",filename,masterjobid,".lock"); + snprintf(lockedfilename, filenamelen, "%s-%u-%d%s",filename,masterjobid,int_pid,".lock"); module_data->filename = lockedfilename; - + /*-------------------------------------------------*/ /*Open the lockedfile without shared file pointer */ /*-------------------------------------------------*/ diff --git a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c index dc7a9f7162a..6526ee52480 100644 --- a/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c +++ b/ompi/mca/sharedfp/sm/sharedfp_sm_file_open.c @@ -44,7 +44,7 @@ #include #include #include - +#include int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, const char* filename, @@ -62,6 +62,8 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, struct mca_sharedfp_sm_offset sm_offset; int sm_fd; uint32_t comm_cid; + int int_pid; + pid_t my_pid; /*Memory is allocated here for the sh structure*/ if ( mca_sharedfp_sm_verbose ) { @@ -100,7 +102,7 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, ** For sharedfp we also want to put the file backed shared memory into the tmp directory */ filename_basename = basename((char*)filename); - /* format is "%s/%s_cid-%d.sm", see below */ + /* format is "%s/%s_cid-%d-%d.sm", see below */ sm_filename_length = strlen(ompi_process_info.job_session_dir) + 1 + strlen(filename_basename) + 5 + (3*sizeof(uint32_t)+1) + 4; sm_filename = (char*) malloc( sizeof(char) * sm_filename_length); if (NULL == sm_filename) { @@ -111,7 +113,21 @@ int mca_sharedfp_sm_file_open (struct ompi_communicator_t *comm, } comm_cid = ompi_comm_get_cid(comm); - sprintf(sm_filename, "%s/%s_cid-%d.sm", ompi_process_info.job_session_dir, filename_basename, comm_cid); + if ( 0 == fh->f_rank ) { + my_pid = getpid(); + int_pid = (int) my_pid; + } + err = comm->c_coll->coll_bcast (&int_pid, 1, MPI_INT, 0, comm, comm->c_coll->coll_bcast_module ); + if ( OMPI_SUCCESS != err ) { + opal_output(0,"mca_sharedfp_sm_file_open: Error in bcast operation \n"); + free(sm_filename); + free(sm_data); + free(sh); + return err; + } + + snprintf(sm_filename, sm_filename_length, "%s/%s_cid-%d-%d.sm", ompi_process_info.job_session_dir, + filename_basename, comm_cid, int_pid); /* open shared memory file, initialize to 0, map into memory */ sm_fd = open(sm_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); From 5725e91c1acb376cbd2c30ae4ab24d37fe93bddb Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 25 Aug 2018 07:45:28 -0700 Subject: [PATCH 041/674] Deal with special case during cleanup In some scenarios, we can have a daemon sharing the node with mpirun. In those cases, we need to avoid race conditions in cleanup Signed-off-by: Ralph Castain (cherry picked from commit 8d1be27a1e98940e21e87b75251f6996668490bc) --- orte/util/session_dir.c | 54 +++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/orte/util/session_dir.c b/orte/util/session_dir.c index 90f464fefbb..657cec6586c 100644 --- a/orte/util/session_dir.c +++ b/orte/util/session_dir.c @@ -12,7 +12,7 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -61,6 +61,7 @@ #include "orte/util/show_help.h" #include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/ras/base/base.h" #include "orte/runtime/runtime.h" #include "orte/runtime/orte_globals.h" @@ -370,6 +371,16 @@ int orte_session_dir(bool create, orte_process_name_t *proc) int orte_session_dir_cleanup(orte_jobid_t jobid) { + /* special case - if a daemon is colocated with mpirun, + * then we let mpirun do the rest to avoid a race + * condition. this scenario always results in the rank=1 + * daemon colocated with mpirun */ + if (orte_ras_base.launch_orted_on_hn && + ORTE_PROC_IS_DAEMON && + 1 == ORTE_PROC_MY_NAME->vpid) { + return ORTE_SUCCESS; + } + if (!orte_create_session_dirs || orte_process_info.rm_session_dirs ) { /* we haven't created them or RM will clean them up for us*/ return ORTE_SUCCESS; @@ -386,6 +397,7 @@ orte_session_dir_cleanup(orte_jobid_t jobid) return ORTE_ERR_NOT_INITIALIZED; } + /* recursively blow the whole session away for our job family, * saving only output files */ @@ -461,20 +473,6 @@ orte_session_dir_finalize(orte_process_name_t *proc) opal_os_dirpath_destroy(orte_process_info.proc_session_dir, false, orte_dir_check_file); - opal_os_dirpath_destroy(orte_process_info.job_session_dir, - false, orte_dir_check_file); - /* only remove the jobfam session dir if we are the - * local daemon and we are finalizing our own session dir */ - if ((ORTE_PROC_IS_HNP || ORTE_PROC_IS_DAEMON) && - (ORTE_PROC_MY_NAME == proc)) { - opal_os_dirpath_destroy(orte_process_info.jobfam_session_dir, - false, orte_dir_check_file); - } - - if( NULL != orte_process_info.top_session_dir ){ - opal_os_dirpath_destroy(orte_process_info.top_session_dir, - false, orte_dir_check_file); - } if (opal_os_dirpath_is_empty(orte_process_info.proc_session_dir)) { if (orte_debug_flag) { @@ -492,6 +490,32 @@ orte_session_dir_finalize(orte_process_name_t *proc) } } + /* special case - if a daemon is colocated with mpirun, + * then we let mpirun do the rest to avoid a race + * condition. this scenario always results in the rank=1 + * daemon colocated with mpirun */ + if (orte_ras_base.launch_orted_on_hn && + ORTE_PROC_IS_DAEMON && + 1 == ORTE_PROC_MY_NAME->vpid) { + return ORTE_SUCCESS; + } + + opal_os_dirpath_destroy(orte_process_info.job_session_dir, + false, orte_dir_check_file); + + /* only remove the jobfam session dir if we are the + * local daemon and we are finalizing our own session dir */ + if ((ORTE_PROC_IS_HNP || ORTE_PROC_IS_DAEMON) && + (ORTE_PROC_MY_NAME == proc)) { + opal_os_dirpath_destroy(orte_process_info.jobfam_session_dir, + false, orte_dir_check_file); + } + + if( NULL != orte_process_info.top_session_dir ){ + opal_os_dirpath_destroy(orte_process_info.top_session_dir, + false, orte_dir_check_file); + } + if (opal_os_dirpath_is_empty(orte_process_info.job_session_dir)) { if (orte_debug_flag) { opal_output(0, "sess_dir_finalize: found job session dir empty - deleting"); From d995fb1b3f82aecaf8a4a07bdc1beb3a4c79e56d Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Fri, 24 Aug 2018 19:11:52 +0300 Subject: [PATCH 042/674] Fixed the NUMA obj detection for hwloc ver >= 2.0.0 Since version hwloc 2.0.0 has a new organization of NUMA nodes on the topology tree. This commit adds the detection of local NUMA object for hwloc => 2.0.0, which fixes the procs bindings policy for rmaps mindist component. Signed-off-by: Boris Karasev (cherry picked from commit e5291ccc34a621295a9d3fc3b1d470a4e4c790e2) --- opal/mca/hwloc/base/hwloc_base_util.c | 9 +++++++++ orte/mca/rmaps/mindist/rmaps_mindist_module.c | 3 +++ 2 files changed, 12 insertions(+) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index f0a4f14cc46..b52c7cba6d1 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -1857,9 +1857,18 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t * if (!strcmp(device_obj->name, device_name)) { /* find numa node containing this device */ obj = device_obj->parent; +#if HWLOC_API_VERSION < 0x20000 while ((obj != NULL) && (obj->type != HWLOC_OBJ_NODE)) { obj = obj->parent; } +#else + while (obj && !obj->memory_arity) { + obj = obj->parent; /* no memory child, walk up */ + } + if (obj != NULL) { + obj = obj->memory_first_child; + } +#endif if (obj == NULL) { opal_output_verbose(5, opal_hwloc_base_framework.framework_output, "hwloc:base:get_sorted_numa_list: NUMA node closest to %s wasn't found.", diff --git a/orte/mca/rmaps/mindist/rmaps_mindist_module.c b/orte/mca/rmaps/mindist/rmaps_mindist_module.c index cadbde2a235..ef59845e600 100644 --- a/orte/mca/rmaps/mindist/rmaps_mindist_module.c +++ b/orte/mca/rmaps/mindist/rmaps_mindist_module.c @@ -331,6 +331,9 @@ static int mindist_map(orte_job_t *jdata) } } } + /* first we need to fill summary object for root with information about nodes + * so we call opal_hwloc_base_get_nbobjs_by_type */ + opal_hwloc_base_get_nbobjs_by_type(node->topology->topo, HWLOC_OBJ_NODE, 0, OPAL_HWLOC_AVAILABLE); OBJ_CONSTRUCT(&numa_list, opal_list_t); ret = opal_hwloc_get_sorted_numa_list(node->topology->topo, orte_rmaps_base.device, &numa_list); if (ret > 1) { From 31ca3842da8692f976aa4e56c7ea2986d02d0c0c Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Mon, 27 Aug 2018 09:43:57 +0300 Subject: [PATCH 043/674] Fixed copyrights of prev commit. Signed-off-by: Boris Karasev (cherry picked from commit beb0697f24c5edab4345632944db466ac4daef38) --- opal/mca/hwloc/base/hwloc_base_util.c | 2 ++ orte/mca/rmaps/mindist/rmaps_mindist_module.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index b52c7cba6d1..287c4cb50a7 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -16,6 +16,8 @@ * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (C) 2018 Mellanox Technologies, Ltd. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/orte/mca/rmaps/mindist/rmaps_mindist_module.c b/orte/mca/rmaps/mindist/rmaps_mindist_module.c index ef59845e600..1e78678df30 100644 --- a/orte/mca/rmaps/mindist/rmaps_mindist_module.c +++ b/orte/mca/rmaps/mindist/rmaps_mindist_module.c @@ -15,7 +15,7 @@ * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Mellanox Technologies, Inc. + * Copyright (c) 2017-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * From 2e3cf6fb12628ba021e5d1e59dfe09606c975208 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 27 Aug 2018 15:57:52 -0500 Subject: [PATCH 044/674] io/base: fixes to file_delete selection logic file_delete triggers underneath the hood the full component selection logic, since we do not have a file handle, just a file name. As part of the selection logic, we have to however initiate the framework-open of the fs component in case of ompio, since ompio will call the delete function of the selected fs componentn, which is based on the file system where the file is located. This was not handled correctly so far. The problem however only shows up if the first I/O operatin to be executed is a file_delete, other wise the file_open will lead to the correct opening and initialization of the fs framework. This commit ensures that we do the right thing even if file_delete is the first file I/O operation in the application. Fixes issue #5611 Signed-off-by: Edgar Gabriel --- ompi/mca/io/base/io_base_delete.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/ompi/mca/io/base/io_base_delete.c b/ompi/mca/io/base/io_base_delete.c index 48265b23478..b5926aad5b8 100644 --- a/ompi/mca/io/base/io_base_delete.c +++ b/ompi/mca/io/base/io_base_delete.c @@ -13,6 +13,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,6 +36,8 @@ #include "opal/mca/base/base.h" #include "ompi/mca/io/io.h" #include "ompi/mca/io/base/base.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" /* * Local types @@ -68,6 +71,8 @@ static void unquery(avail_io_t *avail, const char *filename, struct opal_info_t static int delete_file(avail_io_t *avail, const char *filename, struct opal_info_t *info); +extern opal_mutex_t ompi_mpi_ompio_bootstrap_mutex; + /* * Stuff for the OBJ interface @@ -142,8 +147,25 @@ int mca_io_base_delete(const char *filename, struct opal_info_t *info) } OBJ_RELEASE(selectable); - /* Finally -- delete the file with the selected component */ + if (!strcmp (selected.ai_component.v2_0_0.io_version.mca_component_name, + "ompio")) { + int ret; + + opal_mutex_lock(&ompi_mpi_ompio_bootstrap_mutex); + if (OMPI_SUCCESS != (ret = mca_base_framework_open(&ompi_fs_base_framework, 0))) { + opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex); + return err; + } + opal_mutex_unlock(&ompi_mpi_ompio_bootstrap_mutex); + if (OMPI_SUCCESS != + (ret = mca_fs_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) { + return err; + } + } + + + /* Finally -- delete the file with the selected component */ if (OMPI_SUCCESS != (err = delete_file(&selected, filename, info))) { return err; } From 420ffe758830a0b45e0867a30ee32acec2add962 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 23 Aug 2018 08:40:55 -0700 Subject: [PATCH 045/674] opal_config_asm.m4: Fix the detection of 128 bits atomics. Thanks to Stefan Teleman for identifying this issue and providing a proof-of-concept patch. We ended up revamping the detection of 128-bit atomics to reduce duplicated code and be a slightly simpler -- albiet perhaps a bit more verbose -- approach: - Remove the --enable-cross-* options; they were confusing and unnecessary. - Always try to compile / link the compiler-intrinsic 128-bit atomic functions. - Strengthen the C tests we use to be more robust. - Use m4 to avoid duplicating the C tests multiple times in the .m4 source. - If not cross-compiling, try to run a short test and ensure that they actually work (as of Aug 2018, there's at least one platform where they don't: clang 6 on ARM64). If cross-compiling, just assume that they work. - Add more comments about what is going on with all the tests; it's tricky stuff. Our Future Selves will thank us. Signed-off-by: George Bosilca Signed-off-by: Jeff Squyres (cherry picked from commit ff9df9188707f5331cb21aff66371e133e2a810f) --- config/opal_config_asm.m4 | 409 ++++++++++++++++++++++++-------------- 1 file changed, 259 insertions(+), 150 deletions(-) diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 index db120d409e7..729b03425f9 100644 --- a/config/opal_config_asm.m4 +++ b/config/opal_config_asm.m4 @@ -2,14 +2,14 @@ dnl dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana dnl University Research and Technology dnl Corporation. All rights reserved. -dnl Copyright (c) 2004-2015 The University of Tennessee and The University +dnl Copyright (c) 2004-2018 The University of Tennessee and The University dnl of Tennessee Research Foundation. All rights dnl reserved. dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, 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) 2008-2015 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2015-2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. @@ -24,65 +24,211 @@ dnl dnl $HEADER$ dnl +dnl This is a C test to see if 128-bit __atomic_compare_exchange_n() +dnl actually works (e.g., it compiles and links successfully on +dnl ARM64+clang, but returns incorrect answers as of August 2018). +AC_DEFUN([OPAL_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE],[[ +#include +#include +#include -AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ +typedef union { + uint64_t fake@<:@2@:>@; + __int128 real; +} ompi128; + +static void test1(void) +{ + // As of Aug 2018, we could not figure out a way to assign 128-bit + // constants -- the compilers would not accept it. So use a fake + // union to assign 2 uin64_t's to make a single __int128. + ompi128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + ompi128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; + ompi128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real, + desired.real, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + if ( !(r == false && ptr.real == expected.real)) { + exit(1); + } +} + +static void test2(void) +{ + ompi128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + ompi128 expected = ptr; + ompi128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real, + desired.real, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + if (!(r == true && ptr.real == desired.real)) { + exit(2); + } +} - OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save]) +int main(int argc, char** argv) +{ + test1(); + test2(); + return 0; +} +]]) - AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128], - [enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])]) +dnl ------------------------------------------------------------------ - sync_bool_compare_and_swap_128_result=0 +dnl This is a C test to see if 128-bit __sync_bool_compare_and_swap() +dnl actually works (e.g., it compiles and links successfully on +dnl ARM64+clang, but returns incorrect answers as of August 2018). +AC_DEFUN([OPAL_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE],[[ +#include +#include +#include - if test ! "$enable_cross_cmpset128" = "yes" ; then - AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values]) +typedef union { + uint64_t fake@<:@2@:>@; + __int128 real; +} ompi128; - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) +static void test1(void) +{ + // As of Aug 2018, we could not figure out a way to assign 128-bit + // constants -- the compilers would not accept it. So use a fake + // union to assign 2 uin64_t's to make a single __int128. + ompi128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + ompi128 oldval = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; + ompi128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real); + if (!(r == false && ptr.real != newval.real)) { + exit(1); + } +} - if test $sync_bool_compare_and_swap_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" +static void test2(void) +{ + ompi128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + ompi128 oldval = ptr; + ompi128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real); + if (!(r == true && ptr.real == newval.real)) { + exit(2); + } +} - AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) +int main(int argc, char** argv) +{ + test1(); + test2(); + return 0; +} +]]) - CFLAGS=$CFLAGS_save - fi - else - AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values]) +dnl ------------------------------------------------------------------ - # Check if the compiler supports the __sync builtin - AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1], - [AC_MSG_RESULT([no])]) +dnl +dnl Check to see if a specific function is linkable. +dnl +dnl Check with: +dnl 1. No compiler/linker flags. +dnl 2. CFLAGS += -mcx16 +dnl 3. LIBS += -latomic +dnl 4. Finally, if it links ok with any of #1, #2, or #3, actually try +dnl to run the test code (if we're not cross-compiling) and verify +dnl that it actually gives us the correct result. +dnl +dnl Note that we unfortunately can't use AC SEARCH_LIBS because its +dnl check incorrectly fails (because these functions are special compiler +dnl intrinsics -- SEARCH_LIBS tries with "check FUNC()", which the +dnl compiler complains doesn't match the internal prototype). So we have +dnl to use our own LINK_IFELSE tests. Indeed, since these functions are +dnl so special, we actually need a valid source code that calls the +dnl functions with correct arguments, etc. It's not enough, for example, +dnl to do the usual "try to set a function pointer to the symbol" trick to +dnl determine if these functions are available, because the compiler may +dnl not implement these as actual symbols. So just try to link a real +dnl test code. +dnl +dnl $1: function name to print +dnl $2: program to test +dnl $3: action if any of 1, 2, or 3 succeeds +dnl #4: action if all of 1, 2, and 3 fail +dnl +AC_DEFUN([OPAL_ASM_CHECK_ATOMIC_FUNC],[ + OPAL_VAR_SCOPE_PUSH([opal_asm_check_func_happy opal_asm_check_func_CFLAGS_save opal_asm_check_func_LIBS_save]) + + opal_asm_check_func_CFLAGS_save=$CFLAGS + opal_asm_check_func_LIBS_save=$LIBS + + dnl Check with no compiler/linker flags + AC_MSG_CHECKING([for $1]) + AC_LINK_IFELSE([$2], + [opal_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [opal_asm_check_func_happy=0 + AC_MSG_RESULT([no])]) + + dnl If that didn't work, try again with CFLAGS+=mcx16 + AS_IF([test $opal_asm_check_func_happy -eq 0], + [AC_MSG_CHECKING([for $1 with -mcx16]) + CFLAGS="$CFLAGS -mcx16" + AC_LINK_IFELSE([$2], + [opal_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [opal_asm_check_func_happy=0 + CFLAGS=$opal_asm_check_func_CFLAGS_save + AC_MSG_RESULT([no])]) + ]) + + dnl If that didn't work, try again with LIBS+=-latomic + AS_IF([test $opal_asm_check_func_happy -eq 0], + [AC_MSG_CHECKING([for $1 with -latomic]) + LIBS="$LIBS -latomic" + AC_LINK_IFELSE([$2], + [opal_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [opal_asm_check_func_happy=0 + LIBS=$opal_asm_check_func_LIBS_save + AC_MSG_RESULT([no])]) + ]) + + dnl If we have it, try it and make sure it gives a correct result. + dnl As of Aug 2018, we know that it links but does *not* work on clang + dnl 6 on ARM64. + AS_IF([test $opal_asm_check_func_happy -eq 1], + [AC_MSG_CHECKING([if $1() gives correct results]) + AC_RUN_IFELSE([$2], + [AC_MSG_RESULT([yes])], + [opal_asm_check_func_happy=0 + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) - if test $sync_bool_compare_and_swap_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" + dnl If we were unsuccessful, restore CFLAGS/LIBS + AS_IF([test $opal_asm_check_func_happy -eq 0], + [CFLAGS=$opal_asm_check_func_CFLAGS_save + LIBS=$opal_asm_check_func_LIBS_save]) - AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])]) + dnl Run the user actions + AS_IF([test $opal_asm_check_func_happy -eq 1], [$3], [$4]) - CFLAGS=$CFLAGS_save - fi - fi + OPAL_VAR_SCOPE_POP +]) - AC_DEFINE_UNQUOTED([OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result], - [Whether the __sync builtin atomic compare and swap supports 128-bit values]) +dnl ------------------------------------------------------------------ + +AC_DEFUN([OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ + OPAL_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result]) + + # Do we have __sync_bool_compare_and_swap? + # Use a special macro because we need to check with a few different + # CFLAGS/LIBS. + OPAL_ASM_CHECK_ATOMIC_FUNC([__sync_bool_compare_and_swap], + [AC_LANG_SOURCE(OPAL_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE)], + [sync_bool_compare_and_swap_128_result=1], + [sync_bool_compare_and_swap_128_result=0]) + + AC_DEFINE_UNQUOTED([OPAL_HAVE_SYNC_BUILTIN_CSWAP_INT128], + [$sync_bool_compare_and_swap_128_result], + [Whether the __sync builtin atomic compare and swap supports 128-bit values]) OPAL_VAR_SCOPE_POP ]) @@ -119,73 +265,45 @@ __sync_add_and_fetch(&tmp, 1);], AC_DEFUN([OPAL_CHECK_GCC_BUILTIN_CSWAP_INT128], [ - - OPAL_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save]) - - AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128], - [enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])]) - - atomic_compare_exchange_n_128_result=0 - - if test ! "$enable_cross_cmpset128" = "yes" ; then - AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values]) - - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) - - if test $atomic_compare_exchange_n_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" - - AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) - - CFLAGS=$CFLAGS_save - fi - - if test $atomic_compare_exchange_n_128_result = 1 ; then - AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])], + OPAL_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result atomic_compare_exchange_n_128_CFLAGS_save atomic_compare_exchange_n_128_LIBS_save]) + + atomic_compare_exchange_n_128_CFLAGS_save=$CFLAGS + atomic_compare_exchange_n_128_LIBS_save=$LIBS + + # Do we have __sync_bool_compare_and_swap? + # Use a special macro because we need to check with a few different + # CFLAGS/LIBS. + OPAL_ASM_CHECK_ATOMIC_FUNC([__atomic_compare_exchange_n], + [AC_LANG_SOURCE(OPAL_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE)], + [atomic_compare_exchange_n_128_result=1], + [atomic_compare_exchange_n_128_result=0]) + + # If we have it and it works, check to make sure it is always lock + # free. + AS_IF([test $atomic_compare_exchange_n_128_result -eq 1], + [AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128 - atomic_compare_exchange_n_128_result=0], - [AC_MSG_RESULT([no (cross compiling)])]) - fi - else - AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values]) - - # Check if the compiler supports the __atomic builtin - AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1], - [AC_MSG_RESULT([no])]) - - if test $atomic_compare_exchange_n_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" - - AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])]) - - CFLAGS=$CFLAGS_save - fi - fi - - AC_DEFINE_UNQUOTED([OPAL_HAVE_GCC_BUILTIN_CSWAP_INT128], [$atomic_compare_exchange_n_128_result], - [Whether the __atomic builtin atomic compare and swap is lock-free on 128-bit values]) + [atomic_compare_exchange_n_128_result=0 + # If this test fails, need to reset CFLAGS/LIBS (the + # above tests atomically set CFLAGS/LIBS or not; this + # test is running after the fact, so we have to undo + # the side-effects of setting CFLAGS/LIBS if the above + # tests passed). + CFLAGS=$atomic_compare_exchange_n_128_CFLAGS_save + LIBS=$atomic_compare_exchange_n_128_LIBS_save + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) + + AC_DEFINE_UNQUOTED([OPAL_HAVE_GCC_BUILTIN_CSWAP_INT128], + [$atomic_compare_exchange_n_128_result], + [Whether the __atomic builtin atomic compare swap is both supported and lock-free on 128-bit values]) + + dnl If we could not find decent support for 128-bits __atomic let's + dnl try the GCC _sync + AS_IF([test $atomic_compare_exchange_n_128_result -eq 0], + [OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128]) OPAL_VAR_SCOPE_POP ]) @@ -745,35 +863,8 @@ dnl dnl OPAL_CHECK_CMPXCHG16B dnl dnl ################################################################# -AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[ - OPAL_VAR_SCOPE_PUSH([cmpxchg16b_result]) - - AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b], - [enable the use of the cmpxchg16b instruction when cross compiling])]) - - if test ! "$enable_cross_cmpxchg16b" = "yes" ; then - AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[ - __asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])], - [AC_MSG_RESULT([yes]) - cmpxchg16b_result=1], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0], - [AC_MSG_RESULT([no (cross-compiling)]) - cmpxchg16b_result=0]) - else - AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange]) - - OPAL_TRY_ASSEMBLE([$opal_cv_asm_text - cmpxchg16b 0], - [AC_MSG_RESULT([yes]) - cmpxchg16b_result=1], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0]) - fi - if test "$cmpxchg16b_result" = 1; then - AC_MSG_CHECKING([if compiler correctly handles volatile 128bits]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([#include +AC_DEFUN([OPAL_CMPXCHG16B_TEST_SOURCE],[[ +#include #include union opal_counted_pointer_t { @@ -787,8 +878,10 @@ union opal_counted_pointer_t { int128_t value; #endif }; -typedef union opal_counted_pointer_t opal_counted_pointer_t;], - [volatile opal_counted_pointer_t a; +typedef union opal_counted_pointer_t opal_counted_pointer_t; + +int main(int argc, char* argv) { + volatile opal_counted_pointer_t a; opal_counted_pointer_t b; a.data.counter = 0; @@ -813,12 +906,28 @@ typedef union opal_counted_pointer_t opal_counted_pointer_t;], return (a.value != b.value); #else return 0; -#endif])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0], - [AC_MSG_RESULT([untested, assuming ok])]) - fi +#endif +} +]]) + +AC_DEFUN([OPAL_CHECK_CMPXCHG16B],[ + OPAL_VAR_SCOPE_PUSH([cmpxchg16b_result]) + + OPAL_ASM_CHECK_ATOMIC_FUNC([cmpxchg16b], + [AC_LANG_PROGRAM([[unsigned char tmp[16];]], + [[__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])], + [cmpxchg16b_result=1], + [cmpxchg16b_result=0]) + # If we have it, make sure it works. + AS_IF([test $cmpxchg16b_result -eq 1], + [AC_MSG_CHECKING([if cmpxchg16b_result works]) + AC_RUN_IFELSE([AC_LANG_SOURCE(OPAL_CMPXCHG16B_TEST_SOURCE)], + [AC_MSG_RESULT([yes])], + [cmpxchg16b_result=0 + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) + AC_DEFINE_UNQUOTED([OPAL_HAVE_CMPXCHG16B], [$cmpxchg16b_result], [Whether the processor supports the cmpxchg16b instruction]) OPAL_VAR_SCOPE_POP From 55fd437d0fad143045fc1ed87204c5f0f3fa1222 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 17 Aug 2018 17:41:13 -0700 Subject: [PATCH 046/674] opal_config_asm.m4: replace tabs with spaces Whitespace change only; no code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit 63560fe9c4af95894edaa095f59493a3c887fabc) --- config/opal_config_asm.m4 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 index 729b03425f9..65675d16b58 100644 --- a/config/opal_config_asm.m4 +++ b/config/opal_config_asm.m4 @@ -257,7 +257,7 @@ __sync_add_and_fetch(&tmp, 1);], opal_asm_sync_have_64bit=0]) AC_DEFINE_UNQUOTED([OPAL_ASM_SYNC_HAVE_64BIT],[$opal_asm_sync_have_64bit], - [Whether 64-bit is supported by the __sync builtin atomics]) + [Whether 64-bit is supported by the __sync builtin atomics]) # Check for 128-bit support OPAL_CHECK_SYNC_BUILTIN_CSWAP_INT128 @@ -844,7 +844,7 @@ AC_DEFUN([OPAL_CHECK_SPARCV8PLUS],[ AC_MSG_CHECKING([if have Sparc v8+/v9 support]) sparc_result=0 OPAL_TRY_ASSEMBLE([$opal_cv_asm_text - casa [%o0] 0x80, %o1, %o2], + casa [%o0] 0x80, %o1, %o2], [sparc_result=1], [sparc_result=0]) if test "$sparc_result" = "1" ; then @@ -993,7 +993,7 @@ return ret; if test "$asm_result" = "yes" ; then OPAL_C_GCC_INLINE_ASSEMBLY=1 - opal_cv_asm_inline_supported="yes" + opal_cv_asm_inline_supported="yes" else OPAL_C_GCC_INLINE_ASSEMBLY=0 fi @@ -1069,7 +1069,7 @@ AC_DEFUN([OPAL_CONFIG_ASM],[ OPAL_CHECK_SYNC_BUILTINS([opal_cv_asm_builtin="BUILTIN_SYNC"], [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; - aarch64*) + aarch64*) opal_cv_asm_arch="ARM64" OPAL_ASM_SUPPORT_64BIT=1 OPAL_ASM_ARM_VERSION=8 @@ -1177,11 +1177,11 @@ AC_MSG_ERROR([Can not continue.]) ;; esac - if test "x$OPAL_ASM_SUPPORT_64BIT" = "x1" && test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" && - test "$opal_asm_sync_have_64bit" = "0" ; then - # __sync builtins exist but do not implement 64-bit support. Fall back on inline asm. - opal_cv_asm_builtin="BUILTIN_NO" - fi + if test "x$OPAL_ASM_SUPPORT_64BIT" = "x1" && test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" && + test "$opal_asm_sync_have_64bit" = "0" ; then + # __sync builtins exist but do not implement 64-bit support. Fall back on inline asm. + opal_cv_asm_builtin="BUILTIN_NO" + fi if test "$opal_cv_asm_builtin" = "BUILTIN_SYNC" || test "$opal_cv_asm_builtin" = "BUILTIN_GCC" ; then AC_DEFINE([OPAL_C_GCC_INLINE_ASSEMBLY], [1], @@ -1204,7 +1204,7 @@ AC_MSG_ERROR([Can not continue.]) ;; esac - opal_cv_asm_inline_supported="no" + opal_cv_asm_inline_supported="no" # now that we know our architecture, try to inline assemble OPAL_CHECK_INLINE_C_GCC([$OPAL_GCC_INLINE_ASSIGN]) From 8a0f5c57f321046b4ecdff3248ab179627fa3aac Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 23 Aug 2018 08:47:53 -0700 Subject: [PATCH 047/674] opal_functions.m4: minor typo fixes Thanks to George for finding/fixing these. Signed-off-by: Jeff Squyres (cherry picked from commit 9194dbbe7b0924f855b3f3e975225fd28fc196f2) --- config/opal_functions.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/opal_functions.m4 b/config/opal_functions.m4 index 34c965df31f..7a85dbf8766 100644 --- a/config/opal_functions.m4 +++ b/config/opal_functions.m4 @@ -3,7 +3,7 @@ dnl dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana dnl University Research and Technology dnl Corporation. All rights reserved. -dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl Copyright (c) 2004-2018 The University of Tennessee and The University dnl of Tennessee Research Foundation. All rights dnl reserved. dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -506,7 +506,7 @@ dnl ####################################################################### dnl ####################################################################### dnl ####################################################################### -# Declare some variables; use OPAL_VAR_SCOPE_END to ensure that they +# Declare some variables; use OPAL_VAR_SCOPE_POP to ensure that they # are cleaned up / undefined. AC_DEFUN([OPAL_VAR_SCOPE_PUSH],[ @@ -524,7 +524,7 @@ AC_DEFUN([OPAL_VAR_SCOPE_PUSH],[ eval $opal_str if test "x$opal_str" != "x"; then - AC_MSG_WARN([Found configure shell variable clash!]) + AC_MSG_WARN([Found configure shell variable clash at line $LINENO!]) AC_MSG_WARN([[OPAL_VAR_SCOPE_PUSH] called on "$opal_var",]) AC_MSG_WARN([but it is already defined with value "$opal_str"]) AC_MSG_WARN([This usually indicates an error in configure.]) From 37d1a202be85c48697e8ce0346dbc111961eac21 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Tue, 31 Jul 2018 14:41:27 -0700 Subject: [PATCH 048/674] MTL OFI: Fix race condition due to global progress entries array Since progress entries array is globally allocated, it is susceptible to race conditions when using multi-threaded applications. Allocating it on the stack resolves any potential races as it is thread local by default. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit ed2343034d09b33eb44a0a727bef97a108edc8aa) --- ompi/mca/mtl/ofi/mtl_ofi.h | 10 +++++----- ompi/mca/mtl/ofi/mtl_ofi_component.c | 20 -------------------- ompi/mca/mtl/ofi/mtl_ofi_types.h | 3 --- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index f47aa5fb86b..1a04a5bad23 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -59,6 +59,7 @@ ompi_mtl_ofi_progress(void) int count = 0, i, events_read; struct fi_cq_err_entry error = { 0 }; ompi_mtl_ofi_request_t *ofi_req = NULL; + struct fi_cq_tagged_entry wc[ompi_mtl_ofi.ofi_progress_event_count]; /** * Read the work completions from the CQ. @@ -66,16 +67,15 @@ ompi_mtl_ofi_progress(void) * Call the request's callback. */ while (true) { - ret = fi_cq_read(ompi_mtl_ofi.cq, ompi_mtl_ofi.progress_entries, - ompi_mtl_ofi.ofi_progress_event_count); + ret = fi_cq_read(ompi_mtl_ofi.cq, (void *)&wc, ompi_mtl_ofi.ofi_progress_event_count); if (ret > 0) { count+= ret; events_read = ret; for (i = 0; i < events_read; i++) { - if (NULL != ompi_mtl_ofi.progress_entries[i].op_context) { - ofi_req = TO_OFI_REQ(ompi_mtl_ofi.progress_entries[i].op_context); + if (NULL != wc[i].op_context) { + ofi_req = TO_OFI_REQ(wc[i].op_context); assert(ofi_req); - ret = ofi_req->event_callback(&ompi_mtl_ofi.progress_entries[i], ofi_req); + ret = ofi_req->event_callback(&wc[i], ofi_req); if (OMPI_SUCCESS != ret) { opal_output(0, "%s:%d: Error returned by request event callback: %zd.\n" "*** The Open MPI OFI MTL is aborting the MPI job (via exit(3)).\n", diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index a7c076b61fb..a59c96b3915 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -663,21 +663,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } - /** - * Allocate memory for storing the CQ events read in OFI progress. - */ - ompi_mtl_ofi.progress_entries = calloc(ompi_mtl_ofi.ofi_progress_event_count, sizeof(struct fi_cq_tagged_entry)); - if (NULL == ompi_mtl_ofi.progress_entries) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: alloc of CQ event storage failed: %s\n", - __FILE__, __LINE__, strerror(errno)); - goto error; - } - - /** - * The remote fi_addr will be stored in the ofi_endpoint struct. - */ - av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); @@ -799,9 +784,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, if (ompi_mtl_ofi.fabric) { (void) fi_close((fid_t)ompi_mtl_ofi.fabric); } - if (ompi_mtl_ofi.progress_entries) { - free(ompi_mtl_ofi.progress_entries); - } return NULL; } @@ -834,8 +816,6 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl) goto finalize_err; } - free(ompi_mtl_ofi.progress_entries); - return OMPI_SUCCESS; finalize_err: diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index ee414734e0d..5514b67a483 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -52,9 +52,6 @@ typedef struct mca_mtl_ofi_module_t { /** Maximum number of CQ events to read in OFI Progress */ int ofi_progress_event_count; - /** CQ event storage */ - struct fi_cq_tagged_entry *progress_entries; - /** Use FI_REMOTE_CQ_DATA*/ bool fi_cq_data; From 9215eb9a3be7b67ceca5f95c2b9aae03a82df14b Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 21 Aug 2018 13:22:18 +0300 Subject: [PATCH 049/674] PML/UCX: blocked calls optimizations - refactoring of opal/UCX progress calls - added UCX progress priority Signed-off-by: Sergey Oblomov (cherry picked from commit b0f87f22358914ae9f8fc382daa4052b31ed2aeb) --- ompi/mca/pml/ucx/pml_ucx.c | 49 ++++++++++------------- opal/mca/common/ucx/common_ucx.h | 68 ++++++++++++++++++-------------- 2 files changed, 59 insertions(+), 58 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 697dd078e38..2286f5f3df6 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -538,13 +538,12 @@ int mca_pml_ucx_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src mca_pml_ucx_get_datatype(datatype), ucp_tag, ucp_tag_mask, req); - for (;;) { + MCA_COMMON_UCX_PROGRESS_LOOP(ompi_pml_ucx.ucp_worker) { status = ucp_request_test(req, &info); if (status != UCS_INPROGRESS) { mca_pml_ucx_set_recv_status_safe(mpi_status, status, &info); return OMPI_SUCCESS; } - opal_progress(); } } @@ -731,16 +730,12 @@ mca_pml_ucx_send_nb(ucp_ep_h ep, const void *buf, size_t count, req = (ompi_request_t*)mca_pml_ucx_common_send(ep, buf, count, datatype, mca_pml_ucx_get_datatype(datatype), - tag, mode, - mca_pml_ucx_send_completion); - + tag, mode, cb); if (OPAL_LIKELY(req == NULL)) { return OMPI_SUCCESS; } else if (!UCS_PTR_IS_ERR(req)) { PML_UCX_VERBOSE(8, "got request %p", (void*)req); - ucp_worker_progress(ompi_pml_ucx.ucp_worker); - ompi_request_wait(&req, MPI_STATUS_IGNORE); - return OMPI_SUCCESS; + MCA_COMMON_UCX_WAIT_LOOP(req, ompi_pml_ucx.ucp_worker, "ucx send", ompi_request_free(&req)); } else { PML_UCX_ERROR("ucx send failed: %s", ucs_status_string(UCS_PTR_STATUS(req))); return OMPI_ERROR; @@ -753,7 +748,7 @@ mca_pml_ucx_send_nbr(ucp_ep_h ep, const void *buf, size_t count, ucp_datatype_t ucx_datatype, ucp_tag_t tag) { - void *req; + ucs_status_ptr_t req; ucs_status_t status; /* coverity[bad_alloc_arithmetic] */ @@ -763,12 +758,7 @@ mca_pml_ucx_send_nbr(ucp_ep_h ep, const void *buf, size_t count, return OMPI_SUCCESS; } - ucp_worker_progress(ompi_pml_ucx.ucp_worker); - while ((status = ucp_request_check_status(req)) == UCS_INPROGRESS) { - opal_progress(); - } - - return OPAL_LIKELY(UCS_OK == status) ? OMPI_SUCCESS : OMPI_ERROR; + MCA_COMMON_UCX_WAIT_LOOP(req, ompi_pml_ucx.ucp_worker, "ucx send", (void)0); } #endif @@ -804,6 +794,8 @@ int mca_pml_ucx_send(const void *buf, size_t count, ompi_datatype_t *datatype, i int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm, int *matched, ompi_status_public_t* mpi_status) { + static unsigned progress_count = 0; + ucp_tag_t ucp_tag, ucp_tag_mask; ucp_tag_recv_info_t info; ucp_tag_message_h ucp_msg; @@ -816,8 +808,9 @@ int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm, if (ucp_msg != NULL) { *matched = 1; mca_pml_ucx_set_recv_status_safe(mpi_status, UCS_OK, &info); - } else { - opal_progress(); + } else { + (++progress_count % opal_common_ucx.progress_iterations) ? + (void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress(); *matched = 0; } return OMPI_SUCCESS; @@ -833,22 +826,23 @@ int mca_pml_ucx_probe(int src, int tag, struct ompi_communicator_t* comm, PML_UCX_TRACE_PROBE("probe", src, tag, comm); PML_UCX_MAKE_RECV_TAG(ucp_tag, ucp_tag_mask, tag, src, comm); - for (;;) { - ucp_msg = ucp_tag_probe_nb(ompi_pml_ucx.ucp_worker, ucp_tag, ucp_tag_mask, - 0, &info); + + MCA_COMMON_UCX_PROGRESS_LOOP(ompi_pml_ucx.ucp_worker) { + ucp_msg = ucp_tag_probe_nb(ompi_pml_ucx.ucp_worker, ucp_tag, + ucp_tag_mask, 0, &info); if (ucp_msg != NULL) { mca_pml_ucx_set_recv_status_safe(mpi_status, UCS_OK, &info); return OMPI_SUCCESS; } - - opal_progress(); } } int mca_pml_ucx_improbe(int src, int tag, struct ompi_communicator_t* comm, - int *matched, struct ompi_message_t **message, - ompi_status_public_t* mpi_status) + int *matched, struct ompi_message_t **message, + ompi_status_public_t* mpi_status) { + static unsigned progress_count = 0; + ucp_tag_t ucp_tag, ucp_tag_mask; ucp_tag_recv_info_t info; ucp_tag_message_h ucp_msg; @@ -864,7 +858,8 @@ int mca_pml_ucx_improbe(int src, int tag, struct ompi_communicator_t* comm, *matched = 1; mca_pml_ucx_set_recv_status_safe(mpi_status, UCS_OK, &info); } else { - opal_progress(); + (++progress_count % opal_common_ucx.progress_iterations) ? + (void)ucp_worker_progress(ompi_pml_ucx.ucp_worker) : opal_progress(); *matched = 0; } return OMPI_SUCCESS; @@ -881,7 +876,7 @@ int mca_pml_ucx_mprobe(int src, int tag, struct ompi_communicator_t* comm, PML_UCX_TRACE_PROBE("mprobe", src, tag, comm); PML_UCX_MAKE_RECV_TAG(ucp_tag, ucp_tag_mask, tag, src, comm); - for (;;) { + MCA_COMMON_UCX_PROGRESS_LOOP(ompi_pml_ucx.ucp_worker) { ucp_msg = ucp_tag_probe_nb(ompi_pml_ucx.ucp_worker, ucp_tag, ucp_tag_mask, 1, &info); if (ucp_msg != NULL) { @@ -890,8 +885,6 @@ int mca_pml_ucx_mprobe(int src, int tag, struct ompi_communicator_t* comm, mca_pml_ucx_set_recv_status_safe(mpi_status, UCS_OK, &info); return OMPI_SUCCESS; } - - opal_progress(); } } diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 0fe345c0695..a2533966017 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -52,6 +52,33 @@ BEGIN_C_DECLS __VA_ARGS__); \ } +/* progress loop to allow call UCX/opal progress */ +/* used C99 for-statement variable initialization */ +#define MCA_COMMON_UCX_PROGRESS_LOOP(_worker) \ + for (unsigned iter = 0;; (++iter % opal_common_ucx.progress_iterations) ? \ + (void)ucp_worker_progress(_worker) : opal_progress()) + +#define MCA_COMMON_UCX_WAIT_LOOP(_request, _worker, _msg, _completed) \ + do { \ + ucs_status_t status; \ + /* call UCX progress */ \ + MCA_COMMON_UCX_PROGRESS_LOOP(_worker) { \ + status = opal_common_ucx_request_status(_request); \ + if (UCS_INPROGRESS != status) { \ + _completed; \ + if (OPAL_LIKELY(UCS_OK == status)) { \ + return OPAL_SUCCESS; \ + } else { \ + MCA_COMMON_UCX_VERBOSE(1, "%s failed: %d, %s", \ + (_msg) ? (_msg) : __FUNCTION__, \ + UCS_PTR_STATUS(_request), \ + ucs_status_string(UCS_PTR_STATUS(_request))); \ + return OPAL_ERROR; \ + } \ + } \ + } \ + } while (0) + typedef struct opal_common_ucx_module { int output; int verbose; @@ -68,15 +95,21 @@ OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); static inline -int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, - const char *msg) +ucs_status_t opal_common_ucx_request_status(ucs_status_ptr_t request) { - ucs_status_t status; - int i; #if !HAVE_DECL_UCP_REQUEST_CHECK_STATUS ucp_tag_recv_info_t info; + + return ucp_request_test(request, &info); +#else + return ucp_request_check_status(request); #endif +} +static inline +int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, + const char *msg) +{ /* check for request completed or failed */ if (OPAL_LIKELY(UCS_OK == request)) { return OPAL_SUCCESS; @@ -87,32 +120,7 @@ int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, return OPAL_ERROR; } - while (1) { - /* call UCX progress */ - for (i = 0; i < opal_common_ucx.progress_iterations; i++) { - if (UCS_INPROGRESS != (status = -#if HAVE_DECL_UCP_REQUEST_CHECK_STATUS - ucp_request_check_status(request) -#else - ucp_request_test(request, &info) -#endif - )) { - ucp_request_free(request); - if (OPAL_LIKELY(UCS_OK == status)) { - return OPAL_SUCCESS; - } else { - MCA_COMMON_UCX_VERBOSE(1, "%s failed: %d, %s", msg ? msg : __FUNCTION__, - UCS_PTR_STATUS(request), - ucs_status_string(UCS_PTR_STATUS(request))); - return OPAL_ERROR; - } - } - ucp_worker_progress(worker); - } - /* call OPAL progress on every opal_common_ucx_progress_iterations - * calls to UCX progress */ - opal_progress(); - } + MCA_COMMON_UCX_WAIT_LOOP(request, worker, msg, ucp_request_free(request)); } static inline From 028bcb8a73377a952767ffa65763f00e69db381e Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 21 Aug 2018 15:05:12 +0300 Subject: [PATCH 050/674] MCA/COMMON/UCX: added synonim to opal_mem_hook variable - added synonim to common ucx variables to allow to print it in opal_info -a Signed-off-by: Sergey Oblomov (cherry picked from commit e00f7a68ba0b1012f954910e39b26f6075f3d006) --- ompi/mca/osc/ucx/osc_ucx_component.c | 2 + ompi/mca/pml/ucx/pml_ucx_component.c | 1 + opal/mca/common/ucx/common_ucx.c | 61 ++++++++++++++------ opal/mca/common/ucx/common_ucx.h | 1 + oshmem/mca/atomic/ucx/atomic_ucx_component.c | 2 + oshmem/mca/spml/ucx/spml_ucx_component.c | 2 + 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index ad604fb873f..955857d9744 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -107,6 +107,8 @@ static int component_register(void) { MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_ucx_component.priority); free(description_str); + opal_common_ucx_mca_var_register(&mca_osc_ucx_component.super.osc_version); + return OMPI_SUCCESS; } diff --git a/ompi/mca/pml/ucx/pml_ucx_component.c b/ompi/mca/pml/ucx/pml_ucx_component.c index aa5dd5266e1..e427eab32cd 100644 --- a/ompi/mca/pml/ucx/pml_ucx_component.c +++ b/ompi/mca/pml/ucx/pml_ucx_component.c @@ -64,6 +64,7 @@ static int mca_pml_ucx_component_register(void) OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, &ompi_pml_ucx.num_disconnect); + opal_common_ucx_mca_var_register(&mca_pml_ucx_component.pmlm_version); return 0; } diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 62ee70ff47c..cff39971b46 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -34,6 +34,50 @@ static void opal_common_ucx_mem_release_cb(void *buf, size_t length, ucm_vm_munmap(buf, length); } +OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component) +{ + static int registered = 0; + static int hook_index; + static int verbose_index; + static int progress_index; + if (!registered) { + verbose_index = mca_base_var_register("opal", "opal_common", "ucx", "verbose", + "Verbose level of the UCX components", + MCA_BASE_VAR_TYPE_INT, NULL, 0, + MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, + &opal_common_ucx.verbose); + progress_index = mca_base_var_register("opal", "opal_common", "ucx", "progress_iterations", + "Set number of calls of internal UCX progress " + "calls per opal_progress call", + MCA_BASE_VAR_TYPE_INT, NULL, 0, + MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, + &opal_common_ucx.progress_iterations); + hook_index = mca_base_var_register("opal", "opal_common", "ucx", "opal_mem_hooks", + "Use OPAL memory hooks, instead of UCX internal " + "memory hooks", MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, + &opal_common_ucx.opal_mem_hooks); + registered = 1; + } + if (component) { + mca_base_var_register_synonym(verbose_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "verbose", 0); + mca_base_var_register_synonym(progress_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "progress_iterations", 0); + mca_base_var_register_synonym(hook_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "opal_mem_hooks", 0); + } +} + OPAL_DECLSPEC void opal_common_ucx_mca_register(void) { opal_common_ucx.registered++; @@ -42,23 +86,6 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void) return; } - mca_base_var_register("opal", "opal_common", "ucx", "verbose", - "Verbose level of the UCX components", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &opal_common_ucx.verbose); - mca_base_var_register("opal", "opal_common", "ucx", "progress_iterations", - "Set number of calls of internal UCX progress calls per opal_progress call", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &opal_common_ucx.progress_iterations); - mca_base_var_register("opal", "opal_common", "ucx", "opal_mem_hooks", - "Use OPAL memory hooks, instead of UCX internal memory hooks", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_LOCAL, - &opal_common_ucx.opal_mem_hooks); - opal_common_ucx.output = opal_output_open(NULL); opal_output_set_verbosity(opal_common_ucx.output, opal_common_ucx.verbose); diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 0fe345c0695..e6ef7342c5a 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -66,6 +66,7 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void); OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void); OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status); OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); +OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component); static inline int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_component.c b/oshmem/mca/atomic/ucx/atomic_ucx_component.c index cf47d3f1c1d..27088440723 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_component.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_component.c @@ -86,6 +86,8 @@ static int ucx_register(void) MCA_BASE_VAR_SCOPE_ALL_EQ, &mca_atomic_ucx_component.priority); + opal_common_ucx_mca_var_register(&mca_atomic_ucx_component.atomic_version); + return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index d567767946b..9f4d28b5d4c 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -104,6 +104,8 @@ static int mca_spml_ucx_component_register(void) "Use non-blocking memory registration for shared heap", &mca_spml_ucx.heap_reg_nb); + opal_common_ucx_mca_var_register(&mca_spml_ucx_component.spmlm_version); + return OSHMEM_SUCCESS; } From 4eeb41506c456000b1eb6e5be45dd1502eee849f Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 28 Aug 2018 16:24:56 -0600 Subject: [PATCH 051/674] odls/alps: resolve hang when launching with mpirun on Crays This commit removes some code that protected the odls/alps component from closing alps file descriptors. For some unknown reason leaving these file descriptors open causes can cause an orted to hang when launching apps. Signed-off-by: Nathan Hjelm (cherry picked from commit 98172163e6af7ae1bf510b8f31ec97fdb497eaf1) Signed-off-by: Nathan Hjelm --- orte/mca/odls/alps/odls_alps_module.c | 75 ++++++++++----------------- 1 file changed, 26 insertions(+), 49 deletions(-) diff --git a/orte/mca/odls/alps/odls_alps_module.c b/orte/mca/odls/alps/odls_alps_module.c index d99bd177f57..8de9665c16a 100644 --- a/orte/mca/odls/alps/odls_alps_module.c +++ b/orte/mca/odls/alps/odls_alps_module.c @@ -1,3 +1,4 @@ +/* -*- 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 @@ -13,7 +14,7 @@ * Copyright (c) 2007 Evergrid, Inc. All rights reserved. * Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved * Copyright (c) 2010 IBM Corporation. All rights reserved. - * Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights + * Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2017 Rutgers, The State University of New Jersey. @@ -109,6 +110,7 @@ #include #endif +#include #include "opal/mca/hwloc/hwloc-internal.h" #include "opal/mca/hwloc/base/base.h" @@ -289,59 +291,30 @@ static void send_error_show_help(int fd, int exit_status, exit(exit_status); } -static int close_open_file_descriptors(int write_fd, orte_iof_base_io_conf_t opts) -{ - int rc, fd; - DIR *dir = NULL; - struct dirent *files; - int app_alps_filedes[2], alps_app_filedes[2]; - - dir = opendir("/proc/self/fd"); +static int close_open_file_descriptors(int write_fd, + orte_iof_base_io_conf_t opts) { + DIR *dir = opendir("/proc/self/fd"); if (NULL == dir) { return ORTE_ERR_FILE_OPEN_FAILURE; } - - /* close all file descriptors w/ exception of stdin/stdout/stderr, - the pipe used for the IOF INTERNAL messages, and the pipe up to - the parent. Be careful to retain all of the pipe fd's set up - by the apshephered. These are needed for obtaining RDMA credentials, - synchronizing with aprun, etc. */ - - rc = alps_app_lli_pipes(app_alps_filedes,alps_app_filedes); - if (0 != rc) { - closedir(dir); - return ORTE_ERR_FILE_OPEN_FAILURE; - } - - while ((files = readdir(dir)) != NULL) { - if(!strncmp(files->d_name,".",1) || !strncmp(files->d_name,"..",2)) continue; - - fd = strtoul(files->d_name, NULL, 10); - if (EINVAL == errno || ERANGE == errno) { + struct dirent *files; + while (NULL != (files = readdir(dir))) { + if (!isdigit(files->d_name[0])) { + continue; + } + int fd = strtol(files->d_name, NULL, 10); + if (errno == EINVAL || errno == ERANGE) { closedir(dir); return ORTE_ERR_TYPE_MISMATCH; } - - /* - * skip over the pipes we have open to apshepherd or slurmd - */ - - if (fd == XTAPI_FD_IDENTITY) continue; - if (fd == XTAPI_FD_RESILIENCY) continue; - if ((fd == app_alps_filedes[0]) || - (fd == app_alps_filedes[1]) || - (fd == alps_app_filedes[0]) || - (fd == alps_app_filedes[1])) continue; - if (fd >=3 && #if OPAL_PMIX_V1 fd != opts.p_internal[1] && #endif fd != write_fd) { - close(fd); + close(fd); } } - closedir(dir); return ORTE_SUCCESS; } @@ -368,14 +341,18 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd) always outputs a nice, single message indicating what happened */ - if (ORTE_SUCCESS != (i = orte_iof_base_setup_child(&cd->opts, &cd->env))) { - ORTE_ERROR_LOG(i); - send_error_show_help(write_fd, 1, - "help-orte-odls-alps.txt", - "iof setup failed", - orte_process_info.nodename, cd->app->app); - /* Does not return */ - } + + if (ORTE_FLAG_TEST(cd->jdata, ORTE_JOB_FLAG_FORWARD_OUTPUT)) { + if (ORTE_SUCCESS != (i = orte_iof_base_setup_child(&cd->opts, &cd->env))) { + ORTE_ERROR_LOG(i); + send_error_show_help(write_fd, 1, + "help-orte-odls-alps.txt", + "iof setup failed", + orte_process_info.nodename, cd->app->app); + /* Does not return */ + } + } + /* now set any child-level controls such as binding */ orte_rtc.set(cd->jdata, cd->child, &cd->env, write_fd); From 3e842348d185ad6f75bc04eac57fb71b485d45aa Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 30 Aug 2018 13:10:49 -0700 Subject: [PATCH 052/674] common/verbs-usnic: check that it will actually compile If someone specifies --with-verbs-usnic, actually do a configury check to ensure that it will compile (vs. assuming that it will compile if someone asks for it). Signed-off-by: Jeff Squyres (cherry picked from commit 05e5f61fe1c961927eae5bb5c0eb2021ac99afa6) --- opal/mca/common/verbs_usnic/configure.m4 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/opal/mca/common/verbs_usnic/configure.m4 b/opal/mca/common/verbs_usnic/configure.m4 index 68fed9404b8..4e2f2d5654a 100644 --- a/opal/mca/common/verbs_usnic/configure.m4 +++ b/opal/mca/common/verbs_usnic/configure.m4 @@ -69,6 +69,21 @@ AC_DEFUN([MCA_opal_common_verbs_usnic_CONFIG],[ [common_verbs_usnic_happy=0]) ]) + AS_IF([test $common_verbs_usnic_happy -eq 1], + [AC_CHECK_MEMBER([struct ibv_device.ops], + [], + [AC_MSG_WARN([--with-verbs-usnic specified, but the verbs.h does not]) + AC_MSG_WARN([have the required member fields. It is highly likely]) + AC_MSG_WARN([that you do not need --with-verbs-usnic. Try configuring]) + AC_MSG_WARN([and building Open MPI without it; if you get warnings]) + AC_MSG_WARN([about usnic IB devices anyway, please let us know.]) + AC_MSG_WARN([Since you asked for --with-verbs-usnic and we cannot]) + AC_MSG_WARN([deliver it, configure will now abort.]) + AC_MSG_ERROR([Cannot continue]) + ], + [#include ]) + ]) + AC_DEFINE_UNQUOTED([OPAL_COMMON_VERBS_USNIC_HAPPY], [$common_verbs_usnic_happy], [Whether the common/usnic_verbs component is being built or not]) From 1d0e695bd6666ca70877a699db0f94f53dd921ee Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 30 Aug 2018 15:05:04 -0700 Subject: [PATCH 053/674] README: Add note about --with-verbs-usnic This option isn't needed on modern distros; add a note to README about it. Signed-off-by: Jeff Squyres (cherry picked from commit 9a8b0d0e18b3df4a0da8ed2367115f5e45e521c7) --- README | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README b/README index 86e0f13696a..78abfdd336b 100644 --- a/README +++ b/README @@ -1020,15 +1020,33 @@ NETWORKING SUPPORT / OPTIONS configurations. --with-verbs-usnic + Note that this option is no longer necessary in recent Linux distro + versions. If your Linux distro uses the "rdma-core" package (instead + of a standalone "libibverbs" package), not only do you not need this + option, you shouldn't use it, either. More below. + This option will activate support in Open MPI for disabling a dire-sounding warning message from libibverbs that Cisco usNIC devices are not supported (because Cisco usNIC devices are supported through libfabric, not libibverbs). This libibverbs warning can also be suppressed by installing the "no op" libusnic_verbs plugin for libibverbs (see https://github.com/cisco/libusnic_verbs, or - download binaries from cisco.com). This option is disabled by - default because it causes libopen-pal.so to depend on libibverbs.so, - which is undesirable to many downstream packagers. + download binaries from cisco.com). + + This option is disabled by default for two reasons: + + 1. It causes libopen-pal.so to depend on libibverbs.so, which is + undesirable to many downstream packagers. + 2. As mentioned above, recent versions of the libibverbs library + (included in the "rdma-core" package) do not have the bug that + will emit dire-sounding warnings about usnic devices. Indeed, + the --with-verbs-usnic option will enable code in Open MPI that + is actually incompatible with rdma-core (i.e., cause Open MPI to + fail to compile). + + If you enable --with-verbs-usnic and your system uses the rdma-core + package, configure will safely abort with a helpful message telling + you that you should not use --with-verbs-usnic. --with-usnic Abort configure if Cisco usNIC support cannot be built. From 6f9da0c3d5c72ccbeed454a324cd5509e4e851f8 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 23 Aug 2018 18:03:01 +0300 Subject: [PATCH 054/674] OSHMEM: removed incorrect pshmem_wait_until macro redefinition - fixes https://github.com/open-mpi/ompi/issues/5585 Signed-off-by: Sergey Oblomov (cherry picked from commit 7a5ff6a076e40938789b03d41970564e31a11976) --- oshmem/shmem/c/profile/defines.h | 1 - 1 file changed, 1 deletion(-) diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index ce87e2ee2f5..9357c0459bd 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -529,7 +529,6 @@ #define shmem_int_wait_until pshmem_int_wait_until #define shmem_long_wait_until pshmem_long_wait_until #define shmem_longlong_wait_until pshmem_longlong_wait_until -#define shmem_wait_until pshmem_wait_until #define shmemx_int32_wait_until pshmemx_int32_wait_until #define shmemx_int64_wait_until pshmemx_int64_wait_until From 2fb1a5e1b2ad2948c750bed2ea62c1eb1a7c4fa9 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 5 Sep 2018 11:36:11 -0600 Subject: [PATCH 055/674] btl/uct: add missing opal_mem_hooks_unregister_release call This commit fixes a bug when using the UCT btl with the UCX memory hooks disabled. We were misssing a call to opal_mem_hooks_unregister_release to remove the btl memory hook callback. Signed-off-by: Nathan Hjelm (cherry picked from commit 36c206d2d616578c97853d1d69727a1d6e165c1e) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct_module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index aa69ebb73c8..b1b659b23ba 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -288,6 +288,10 @@ int mca_btl_uct_finalize (mca_btl_base_module_t* btl) mca_btl_uct_endpoint_t *endpoint; uint64_t key; + if (mca_btl_uct_component.disable_ucx_memory_hooks) { + opal_mem_hooks_unregister_release (mca_btl_uct_mem_release_cb); + } + /* clean up any leftover endpoints */ OPAL_HASH_TABLE_FOREACH(key, uint64, endpoint, &uct_module->id_to_endpoint) { OBJ_RELEASE(endpoint); From 8fa172e60b8ff2dc948a27de7101ba65d60f6b28 Mon Sep 17 00:00:00 2001 From: matcabral Date: Fri, 2 Feb 2018 08:15:23 -0800 Subject: [PATCH 056/674] MTL PSM2: Remove shadow variables from v4.0.x As agreed on #4574, where removed in past release branches to avoid perfomance impacts in the default values for some paramters. Signed-off-by: Matias Cabral --- ompi/mca/mtl/psm2/mtl_psm2_component.c | 131 ------------------------- ompi/mca/mtl/psm2/mtl_psm2_types.h | 11 --- 2 files changed, 142 deletions(-) diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index 0785193b401..03baa766be9 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -84,129 +84,6 @@ mca_mtl_psm2_component_t mca_mtl_psm2_component = { } }; -struct ompi_mtl_psm2_shadow_variable { - int variable_type; - void *storage; - mca_base_var_storage_t default_value; - const char *env_name; - mca_base_var_info_lvl_t info_level; - const char *mca_name; - const char *description; - mca_base_var_flag_t flags; -}; - -struct ompi_mtl_psm2_shadow_variable ompi_mtl_psm2_shadow_variables[] = { - {MCA_BASE_VAR_TYPE_STRING, &ompi_mtl_psm2.psm2_devices, {.stringval = "self,shm,hfi"}, "PSM2_DEVICES", OPAL_INFO_LVL_3, - "devices", - "Comma-delimited list of PSM2 devices. Valid values: self, shm, hfi (default: self,shm,hfi. Reduced to self,shm in single node jobs)",0}, - {MCA_BASE_VAR_TYPE_STRING, &ompi_mtl_psm2.psm2_memory, {.stringval = "normal"}, "PSM2_MEMORY", OPAL_INFO_LVL_9, - "memory_model", "PSM2 memory usage mode. Valid values: min, normal, large (default: normal)", 0}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_mq_sendreqs_max, {.ulval = 0}, "PSM2_MQ_SENDREQS_MAX", OPAL_INFO_LVL_3, - "mq_sendreqs_max", "PSM2 maximum number of isend requests in flight (default: unset, let libpsm2 use its default)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_mq_recvreqs_max, {.ulval = 0}, "PSM2_MQ_RECVREQS_MAX", OPAL_INFO_LVL_3, - "mq_recvreqs_max", "PSM2 maximum number of irecv requests in flight (default: unset, let libpsm2 use its default)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_mq_rndv_hfi_threshold, {.ulval = 0}, "PSM2_MQ_RNDV_HFI_THRESH", OPAL_INFO_LVL_3, - "hfi_eager_limit", "PSM2 eager to rendezvous threshold (default: unset, let libpsm2 use its defaults)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_mq_rndv_shm_threshold, {.ulval = 0}, "PSM2_MQ_RNDV_SHM_THRESH", OPAL_INFO_LVL_3, - "shm_eager_limit", "PSM2 shared memory eager to rendezvous threshold (default: unset, let libpsm2 use its default)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {MCA_BASE_VAR_TYPE_BOOL, &ompi_mtl_psm2.psm2_recvthread, {.boolval = true}, "PSM2_RCVTHREAD", OPAL_INFO_LVL_3, - "use_receive_thread", "Use PSM2 progress thread (default: true)"}, - {MCA_BASE_VAR_TYPE_BOOL, &ompi_mtl_psm2.psm2_shared_contexts, {.boolval = true}, "PSM2_SHAREDCONTEXTS", OPAL_INFO_LVL_6, - "use_shared_contexts", "Share PSM contexts between MPI processes (default: true)"}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_max_contexts_per_job, {.ulval = 0}, "PSM2_MAX_CONTEXTS_PER_JOB", OPAL_INFO_LVL_9, - "max_contexts_per_job", "Maximum number of contexts available on a node (default: unset, let libpsm2 use its default)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_tracemask, {.ulval = 1}, "PSM2_TRACEMASK", OPAL_INFO_LVL_9, - "trace_mask", "PSM2 tracemask value. See PSM2 documentation for accepted values in 0x (default: 1)"}, - {MCA_BASE_VAR_TYPE_UNSIGNED_LONG, &ompi_mtl_psm2.psm2_opa_sl, {.ulval = 0}, "HFI_SL", OPAL_INFO_LVL_9, - "opa_service_level", "HFI Service Level (default: unset, let libpsm2 use its defaults)", MCA_BASE_VAR_FLAG_DEF_UNSET}, - {-1}, -}; - -static void ompi_mtl_psm2_set_shadow_env (struct ompi_mtl_psm2_shadow_variable *variable) -{ - mca_base_var_storage_t *storage = variable->storage; - char *env_value; - int ret = 0; - int var_index = 0; - const mca_base_var_t *mca_base_var; - - var_index = mca_base_var_find("ompi", "mtl", "psm2", variable->mca_name); - ret = mca_base_var_get (var_index,&mca_base_var); - /* Something is fundamentally broken if registered variables are - * not found */ - if (OPAL_SUCCESS != ret) { - fprintf (stderr, "ERROR setting PSM2 environment variable: %s\n", variable->env_name); - return; - } - - /** Skip setting variables for which the default behavior is "unset" */ - if ((mca_base_var->mbv_flags & MCA_BASE_VAR_FLAG_DEF_UNSET) && - (MCA_BASE_VAR_SOURCE_DEFAULT == mca_base_var->mbv_source)){ - return ; - } - - switch (variable->variable_type) { - case MCA_BASE_VAR_TYPE_BOOL: - ret = asprintf (&env_value, "%s=%d", variable->env_name, storage->boolval ? 1 : 0); - break; - case MCA_BASE_VAR_TYPE_UNSIGNED_LONG: - if (0 == strcmp (variable->env_name, "PSM2_TRACEMASK")) { - /* PSM2 documentation shows the tracemask as a hexidecimal number. to be consitent - * use hexidecimal here. */ - ret = asprintf (&env_value, "%s=0x%lx", variable->env_name, storage->ulval); - } else { - ret = asprintf (&env_value, "%s=%lu", variable->env_name, storage->ulval); - } - break; - case MCA_BASE_VAR_TYPE_STRING: - ret = asprintf (&env_value, "%s=%s", variable->env_name, storage->stringval); - break; - } - - if (0 > ret) { - fprintf (stderr, "ERROR setting PSM2 environment variable: %s\n", variable->env_name); - } else { - putenv (env_value); - } -} - -static void ompi_mtl_psm2_register_shadow_env (struct ompi_mtl_psm2_shadow_variable *variable) -{ - mca_base_var_storage_t *storage = variable->storage; - char *env_value; - - env_value = getenv (variable->env_name); - switch (variable->variable_type) { - case MCA_BASE_VAR_TYPE_BOOL: - if (env_value) { - int tmp; - (void) mca_base_var_enum_bool.value_from_string (&mca_base_var_enum_bool, env_value, &tmp); - storage->boolval = !!tmp; - } else { - storage->boolval = variable->default_value.boolval; - } - break; - case MCA_BASE_VAR_TYPE_UNSIGNED_LONG: - if (env_value) { - storage->ulval = strtol (env_value, NULL, 0); - } else { - storage->ulval = variable->default_value.ulval; - } - break; - case MCA_BASE_VAR_TYPE_STRING: - if (env_value) { - storage->stringval = env_value; - } else { - storage->stringval = variable->default_value.stringval; - } - break; - } - - (void) mca_base_component_var_register (&mca_mtl_psm2_component.super.mtl_version, variable->mca_name, variable->description, - variable->variable_type, NULL, 0, variable->flags, variable->info_level, MCA_BASE_VAR_SCOPE_READONLY, - variable->storage); -} - static int get_num_total_procs(int *out_ntp) { @@ -260,10 +137,6 @@ ompi_mtl_psm2_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, ¶m_priority); - for (int i = 0 ; ompi_mtl_psm2_shadow_variables[i].variable_type >= 0 ; ++i) { - ompi_mtl_psm2_register_shadow_env (ompi_mtl_psm2_shadow_variables + i); - } - ompi_mtl_psm2_register_pvars(); return OMPI_SUCCESS; @@ -395,10 +268,6 @@ ompi_mtl_psm2_component_init(bool enable_progress_threads, return NULL; } - for (int i = 0 ; ompi_mtl_psm2_shadow_variables[i].variable_type >= 0 ; ++i) { - ompi_mtl_psm2_set_shadow_env (ompi_mtl_psm2_shadow_variables + i); - } - #if OPAL_CUDA_SUPPORT /* * If using CUDA enabled Open MPI, the user likely intends to diff --git a/ompi/mca/mtl/psm2/mtl_psm2_types.h b/ompi/mca/mtl/psm2/mtl_psm2_types.h index 20c404129f4..12dd9f9b064 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_types.h +++ b/ompi/mca/mtl/psm2/mtl_psm2_types.h @@ -50,17 +50,6 @@ struct mca_mtl_psm2_module_t { psm2_mq_t mq; psm2_epid_t epid; psm2_epaddr_t epaddr; - char *psm2_devices; - char *psm2_memory; - unsigned long psm2_mq_sendreqs_max; - unsigned long psm2_mq_recvreqs_max; - unsigned long psm2_mq_rndv_hfi_threshold; - unsigned long psm2_mq_rndv_shm_threshold; - unsigned long psm2_max_contexts_per_job; - unsigned long psm2_tracemask; - bool psm2_recvthread; - bool psm2_shared_contexts; - unsigned long psm2_opa_sl; }; typedef struct mca_mtl_psm2_module_t mca_mtl_psm2_module_t; From 2743fadfec9a8268113187b4e5aa10377ee6f839 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 7 Sep 2018 12:39:10 -0600 Subject: [PATCH 057/674] README: update for 4.0 some clean up of old cruft for configure options that we should have cleaned up a while ago. [skip ci] Signed-off-by: Howard Pritchard --- README | 46 ++++++---------------------------------------- 1 file changed, 6 insertions(+), 40 deletions(-) diff --git a/README b/README index 78abfdd336b..f81c5d93f92 100644 --- a/README +++ b/README @@ -507,7 +507,6 @@ MPI Functionality and Features - yalla (1) The cm PML and the following MTLs support MPI_THREAD_MULTIPLE: - - MXM - ofi (Libfabric) - portals4 @@ -522,8 +521,7 @@ MPI Functionality and Features - vader (shared memory) The openib BTL's RDMACM based connection setup mechanism is also not - thread safe. The default UDCM method should be used for - applications requiring MPI_THREAD_MULTIPLE support. + thread safe. Currently, MPI File operations are not thread safe even if MPI is initialized for MPI_THREAD_MULTIPLE support. @@ -560,7 +558,7 @@ MPI Functionality and Features OpenSHMEM Functionality and Features ------------------------------------ -- All OpenSHMEM-1.3 functionality is supported. +- All OpenSHMEM-1.4 functionality is supported. MPI Collectives @@ -601,7 +599,7 @@ Network Support - "ob1" supports a variety of networks that can be used in combination with each other: - - OpenFabrics: InfiniBand, iWARP, and RoCE + - OpenFabrics: iWARP and RoCE - Loopback (send-to-self) - Shared memory - TCP @@ -1122,36 +1120,6 @@ RUN-TIME SYSTEM SUPPORT MISCELLANEOUS SUPPORT LIBRARIES ---with-blcr= - Specify the directory where the Berkeley Labs Checkpoint / Restart - (BLCR) libraries and header files are located. This option is - generally only necessary if the BLCR headers and libraries are not - in default compiler/linker search paths. - - This option is only meaningful if the --with-ft option is also used - to active Open MPI's fault tolerance behavior. - ---with-blcr-libdir= - Look in directory for the BLCR libraries. By default, Open MPI will - look in /lib and /lib64, which - covers most cases. This option is only needed for special - configurations. - ---with-dmtcp= - Specify the directory where the Distributed MultiThreaded - Checkpointing (DMTCP) libraries and header files are located. This - option is generally only necessary if the DMTCP headers and - libraries are not in default compiler/linker search paths. - - This option is only meaningful if the --with-ft option is also used - to active Open MPI's fault tolerance behavior. - ---with-dmtcp-libdir= - Look in directory for the DMTCP libraries. By default, Open MPI - will look in /lib and /lib64, - which covers most cases. This option is only needed for special - configurations. - --with-libevent(=value) This option specifies where to find the libevent support headers and library. The following VALUEs are permitted: @@ -1360,11 +1328,6 @@ MISCELLANEOUS FUNCTIONALITY However, it may be necessary to disable the memory manager in order to build Open MPI statically. ---with-ft=TYPE - Specify the type of fault tolerance to enable. Options: LAM - (LAM/MPI-like), cr (Checkpoint/Restart). Fault tolerance support is - disabled unless this option is specified. - --enable-peruse Enable the PERUSE MPI data analysis interface. @@ -1373,6 +1336,9 @@ MISCELLANEOUS FUNCTIONALITY with different endian representations). Heterogeneous support is disabled by default because it imposes a minor performance penalty. + --enable-spc + Enable software-based performance counters capability. + *** THIS FUNCTIONALITY IS CURRENTLY BROKEN - DO NOT USE *** --with-wrapper-cflags= From 4d5df45bc81cb20438b8176ec6cd1badb195264b Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 7 Sep 2018 08:56:09 -0600 Subject: [PATCH 058/674] NEWS: part II of NEWS update for 4.0.0 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index bb205ad8fc9..3346fc539a2 100644 --- a/NEWS +++ b/NEWS @@ -58,27 +58,33 @@ included in the vX.Y.Z section and be denoted as: 4.0.0 -- September, 2018 ------------------------ -********************************************************************** -* PRE-DEPRECATION WARNING: MPIR Support -* -* As was announced in summer 2017, Open MPI is deprecating support for -* MPIR-based tools beginning with the future release of OMPI v5.0, with -* full removal of that support tentatively planned for OMPI v6.0. -* -* This serves as a pre-deprecation warning to provide tools developers -* with sufficient time to migrate to PMIx. Support for PMIx-based -* tools will be rolled out during the OMPI v4.x series. No runtime -* deprecation warnings will be output during this time. -* -* Runtime deprecation warnings will be output beginning with the OMPI v5.0 -* release whenever MPIR-based tools connect to Open MPI's mpirun/mpiexec -* launcher. -********************************************************************** - -- Fix rank-by algorithms to properly rank by object and span +- OSHMEM updated to the OpenSHMEM 1.4 API. - Do not build Open SHMEM layer when there are no SPMLs available. Currently, this means the Open SHMEM layer will only build if a MXM or UCX library is found. +- A UCX BTL was added for enhanced MPI RMA support using UCX +- With this release, OpenIB BTL now only supports iWarp and RoCE by default. +- Updated internal HWLOC to 2.0.1 +- Updated internal PMIx to 3.0.1 +- Change the priority for selecting external verses internal HWLOC + and PMIx packages to build. Starting with this release, configure + by default selects available external HWLOC and PMIx packages over + the internal ones. +- Updated internal ROMIO to 3.2.1. +- Removed support for the MXM MTL. +- Improved CUDA support when using UCX. +- Improved support for two phase MPI I/O operations when using OMPIO. +- Added support for Software-based Performance Counters, see + https://github.com/davideberius/ompi/wiki/How-to-Use-Software-Based-Performance-Counters-(SPCs)-in-Open-MPI +- Various improvements to MPI RMA performance when using RDMA + capable interconnects. +- Fix problems with use of newer map-by mpirun options. Thanks to + Tony Reina for reporting. +- Fix rank-by algorithms to properly rank by object and span +- Allow for running as root of two environment variables are set. + Requested by Axel Huebl. +- Fix a problem with building the Java bindings when using Java 10. + Thanks to Bryce Glover for reporting. 3.1.2 -- August, 2018 ------------------------ From 38c736489625376060f3e365f170f5c1d8ee5670 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 6 Sep 2018 11:26:58 -0700 Subject: [PATCH 059/674] btl/openib: don't complain about no NICs Since openib is on its long, slow way out the door, don't let it complain about not being able to find any NICs at run time. Signed-off-by: Jeff Squyres (cherry picked from commit 098ec55e37261aee4b9672ec393726c2510247a1) --- opal/mca/btl/openib/btl_openib_component.c | 1 - 1 file changed, 1 deletion(-) diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index c9dec165afb..28fd735ab96 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -2808,7 +2808,6 @@ btl_openib_component_init(int *num_btl_modules, ib_devs = opal_ibv_get_device_list(&num_devs); if(0 == num_devs || NULL == ib_devs) { - mca_btl_base_error_no_nics("OpenFabrics (openib)", "device"); goto no_btls; } From 449020aeaa63ef5a1975de126ce5b1b2f1df4751 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Fri, 7 Sep 2018 17:24:51 -0400 Subject: [PATCH 060/674] Updating VERSION for shared libs for v4.0.0 This was done after discussions with core developers about any potential ABI breakage for any of the libs the user directly links against. Also compaitiblity tests were done using the ibm test suite and building with v3.1.x and running with v4.0.x see: https://github.com/open-mpi/ompi/issues/5447 Signed-off-by: Geoffrey Paulsen --- VERSION | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/VERSION b/VERSION index 6fadf030121..a9706a3db26 100644 --- a/VERSION +++ b/VERSION @@ -3,7 +3,7 @@ # Copyright (c) 2011 NVIDIA Corporation. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2016 IBM Corporation. All rights reserved. +# Copyright (c) 2018 IBM Corporation. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. @@ -52,7 +52,7 @@ date="Unreleased developer copy" # The shared library version of each of Open MPI's public libraries. # These versions are maintained in accordance with the "Library # Interface Versions" chapter from the GNU Libtool documentation. The -# first Open MPI release to programmatically specify these versions was +# first Open MPI release to programatically specify these versions was # v1.3.4 (note that Libtool defaulted all prior releases to 0:0:0). # All changes in these version numbers are dictated by the Open MPI # release managers (not individual developers). Notes: @@ -84,17 +84,17 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=0:0:0 -libmpi_cxx_so_version=0:0:0 -libmpi_mpifh_so_version=0:0:0 -libmpi_usempi_tkr_so_version=0:0:0 -libmpi_usempi_ignore_tkr_so_version=0:0:0 -libmpi_usempif08_so_version=0:0:0 -libopen_rte_so_version=0:0:0 -libopen_pal_so_version=0:0:0 -libmpi_java_so_version=0:0:0 -liboshmem_so_version=0:0:0 -libompitrace_so_version=0:0:0 +libmpi_so_version=60:0:20 +libmpi_cxx_so_version=60:0:20 +libmpi_mpifh_so_version=61:0:21 +libmpi_usempi_tkr_so_version=60:0:20 +libmpi_usempi_ignore_tkr_so_version=60:0:20 +libmpi_usempif08_so_version=60:0:20 +libopen_rte_so_version=60:0:20 +libopen_pal_so_version=60:0:20 +libmpi_java_so_version=60:0:20 +liboshmem_so_version=60:0:20 +libompitrace_so_version=60:0:20 # "Common" components install standalone libraries that are run-time # linked by one or more components. So they need to be versioned as @@ -102,16 +102,16 @@ libompitrace_so_version=0:0:0 # components-don't-affect-the-build-system abstraction. # OMPI layer -libmca_ompi_common_ompio_so_version=0:0:0 -libmca_ompi_common_monitoring_so_version=0:0:0 +libmca_ompi_common_ompio_so_version=60:0:19 +libmca_ompi_common_monitoring_so_version=60:0:10 # ORTE layer -libmca_orte_common_alps_so_version=0:0:0 +libmca_orte_common_alps_so_version=60:0:20 # OPAL layer -libmca_opal_common_cuda_so_version=0:0:0 -libmca_opal_common_ofi_so_version=0:0:0 -libmca_opal_common_sm_so_version=0:0:0 -libmca_opal_common_ucx_so_version=0:0:0 -libmca_opal_common_ugni_so_version=0:0:0 -libmca_opal_common_verbs_so_version=0:0:0 +libmca_opal_common_cuda_so_version=60:0:20 +libmca_opal_common_ofi_so_version=60:0:20 +libmca_opal_common_sm_so_version=60:0:20 +libmca_opal_common_ucx_so_version=60:0:20 +libmca_opal_common_ugni_so_version=60:0:20 +libmca_opal_common_verbs_so_version=60:0:20 From 8015e6f9297cc1cc4f51ae26de32986b7cd84fd8 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:35:21 +0900 Subject: [PATCH 061/674] pmix/base: plug a memory leak in opal_pmix_base_select() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@6e47c5708e7c559108e495f06a29152e4fe02e1b) --- opal/mca/pmix/base/pmix_base_select.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opal/mca/pmix/base/pmix_base_select.c b/opal/mca/pmix/base/pmix_base_select.c index b66466afb69..53891f45c49 100644 --- a/opal/mca/pmix/base/pmix_base_select.c +++ b/opal/mca/pmix/base/pmix_base_select.c @@ -4,6 +4,8 @@ * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,6 +21,7 @@ #include "opal/mca/base/base.h" #include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/base/base.h" +#include "opal/util/opal_environ.h" /* * Globals @@ -33,11 +36,8 @@ int opal_pmix_base_select(void) // value of OPAL's mca_base_component_show_load_errors (i.e., the // bool variable behind Open MPI's mca_component_show_load_errors // MCA param). - char *pmix_show_load_errors_env = NULL; - asprintf(&pmix_show_load_errors_env, - "PMIX_MCA_mca_base_component_show_load_errors=%d", - mca_base_component_show_load_errors ? 1 : 0); - putenv(pmix_show_load_errors_env); + char *pmix_show_load_errors_env = mca_base_component_show_load_errors ? "1" : "0"; + opal_setenv("PMIX_MCA_mca_base_component_show_load_errors", pmix_show_load_errors_env, true, &environ); /* * Select the best component From baf41aceed23bdbf8093be586b90e3a7206d13df Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:36:03 +0900 Subject: [PATCH 062/674] pmix/pmix3x: plug a memory leak in external_register() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@aeddd2f2490fb91185fb3ba5d5e21b1fd6f9e843) --- opal/mca/pmix/pmix3x/pmix3x_component.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opal/mca/pmix/pmix3x/pmix3x_component.c b/opal/mca/pmix/pmix3x/pmix3x_component.c index 3477641092b..7770ff8243f 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_component.c +++ b/opal/mca/pmix/pmix3x/pmix3x_component.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved * $COPYRIGHT$ @@ -86,6 +86,7 @@ mca_pmix_pmix3x_component_t mca_pmix_pmix3x_component = { static int external_register(void) { mca_base_component_t *component = &mca_pmix_pmix3x_component.super.base_version; + char *tmp = NULL; mca_pmix_pmix3x_component.silence_warning = false; (void) mca_base_component_var_register (component, "silence_warning", @@ -97,6 +98,7 @@ static int external_register(void) asprintf(&pmix_library_version, "PMIx library version %s (embedded in Open MPI)", PMIx_Get_version()); + tmp = pmix_library_version; (void) mca_base_component_var_register(component, "library_version", "Version of the underlying PMIx library", MCA_BASE_VAR_TYPE_STRING, @@ -104,6 +106,7 @@ static int external_register(void) OPAL_INFO_LVL_4, MCA_BASE_VAR_SCOPE_CONSTANT, &pmix_library_version); + free(tmp); return OPAL_SUCCESS; } @@ -131,6 +134,7 @@ static int external_close(void) OPAL_LIST_DESTRUCT(&mca_pmix_pmix3x_component.jobids); OPAL_LIST_DESTRUCT(&mca_pmix_pmix3x_component.events); OPAL_LIST_DESTRUCT(&mca_pmix_pmix3x_component.dmdx); + return OPAL_SUCCESS; } From 080e20fa02e81459fbb8060a1d10ae5b88c92c04 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 22 Mar 2018 15:31:59 +0900 Subject: [PATCH 063/674] mtl/psm2: fix a misc memory leak Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@316e4e38f42dabd3973210101005889a8c3079ed) --- ompi/mca/mtl/psm2/mtl_psm2_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index 0785193b401..633c3153041 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -14,7 +14,7 @@ * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved - * Copyright (c) 2017 Research Organization for Information Science + * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -277,7 +277,7 @@ ompi_mtl_psm2_component_open(void) /* Component available only if Omni-Path hardware is present */ res = glob("/dev/hfi1_[0-9]", GLOB_DOOFFS, NULL, &globbuf); - if (globbuf.gl_pathc > 0) { + if (globbuf.gl_pathc > 0 || GLOB_NOMATCH==res) { globfree(&globbuf); } if (0 != res) { From c767c63a3b55a267bb0ff5b5c492e6c49edb1725 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:30:45 +0900 Subject: [PATCH 064/674] ompi/info: plug memory leaks in ompi_mpiinfo_finalize() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@d0d399c9a92d868b024111bca1aa4ecebe428bc8) --- ompi/info/info.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ompi/info/info.c b/ompi/info/info.c index f209ca00574..03904b07b01 100644 --- a/ompi/info/info.c +++ b/ompi/info/info.c @@ -14,7 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -259,6 +259,9 @@ int ompi_mpiinfo_finalize(void) opal_info_entry_t *entry; bool found = false; + OBJ_DESTRUCT(&ompi_mpi_info_null); + OBJ_DESTRUCT(&ompi_mpi_info_env); + /* Go through the f2c table and see if anything is left. Free them all. */ From 9410de0d270dd06df2e562b92a83b04adff3fc97 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:31:44 +0900 Subject: [PATCH 065/674] opal/util: plug a memory leak in the opal_infosubscriber_t destructor Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@7556dd0abbee7d8af6da77be472e25a16e4ee2f5) --- opal/util/info_subscriber.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opal/util/info_subscriber.c b/opal/util/info_subscriber.c index 348194c89bf..5b0544e36d5 100644 --- a/opal/util/info_subscriber.c +++ b/opal/util/info_subscriber.c @@ -14,7 +14,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. @@ -97,6 +97,10 @@ static void infosubscriber_destruct(opal_infosubscriber_t *obj) { } OBJ_DESTRUCT(&obj->s_subscriber_table); + + if (NULL != obj->s_info) { + OBJ_RELEASE(obj->s_info); + } } static void opal_callback_list_item_destruct(opal_callback_list_item_t *obj) { From d2646cd56537fee5c9edf52f65a086739c74eac4 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:32:40 +0900 Subject: [PATCH 066/674] mpool/memkind: plug a memory leak in mca_mpool_memkind_close() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@ad2c207a7e52e059bf0629d80df4af76a1f674b0) --- opal/mca/mpool/memkind/mpool_memkind_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/mpool/memkind/mpool_memkind_component.c b/opal/mca/mpool/memkind/mpool_memkind_component.c index 41145d039c1..96128b2dd3a 100644 --- a/opal/mca/mpool/memkind/mpool_memkind_component.c +++ b/opal/mca/mpool/memkind/mpool_memkind_component.c @@ -15,7 +15,7 @@ * Copyright (c) 2010-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science + * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -237,7 +237,7 @@ static int mca_mpool_memkind_close(void) opal_output_close (mca_mpool_memkind_component.output); mca_mpool_memkind_component.output = -1; - OBJ_DESTRUCT(&mca_mpool_memkind_component.module_list); + OPAL_LIST_DESTRUCT(&mca_mpool_memkind_component.module_list); if (mca_mpool_memkind_policy_enum) { OBJ_RELEASE(mca_mpool_memkind_policy_enum); From 959aeab5d955b16b6389bee552277ffcc0506a8f Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 21 May 2018 13:33:27 +0900 Subject: [PATCH 067/674] ess/hnp: plug a memory leak in rte_finalize() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@d234caef74ee751c7cfd3b88b7e77e50402966bd) --- orte/mca/ess/hnp/ess_hnp_module.c | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/orte/mca/ess/hnp/ess_hnp_module.c b/orte/mca/ess/hnp/ess_hnp_module.c index 56b4f56be64..70f79e67bff 100644 --- a/orte/mca/ess/hnp/ess_hnp_module.c +++ b/orte/mca/ess/hnp/ess_hnp_module.c @@ -859,6 +859,52 @@ static int rte_finalize(void) if (orte_do_not_launch) { exit(0); } + +{ + opal_pointer_array_t * array = orte_node_topologies; + int i; + if( array->number_free != array->size ) { + OPAL_THREAD_LOCK(&array->lock); + array->lowest_free = 0; + array->number_free = array->size; + for(i=0; isize; i++) { + if(NULL != array->addr[i]) { + orte_topology_t * topo = (orte_topology_t *)array->addr[i]; + topo->topo = NULL; + OBJ_RELEASE(topo); + } + array->addr[i] = NULL; + } + OPAL_THREAD_UNLOCK(&array->lock); + } +} + OBJ_RELEASE(orte_node_topologies); + +{ + opal_pointer_array_t * array = orte_node_pool; + int i; + orte_node_t* node = (orte_node_t *)opal_pointer_array_get_item(orte_node_pool, 0); + assert(NULL != node); + OBJ_RELEASE(node->daemon); + node->daemon = NULL; + if( array->number_free != array->size ) { + OPAL_THREAD_LOCK(&array->lock); + array->lowest_free = 0; + array->number_free = array->size; + for(i=0; isize; i++) { + if(NULL != array->addr[i]) { + node= (orte_node_t*)array->addr[i]; + OBJ_RELEASE(node); + } + array->addr[i] = NULL; + } + OPAL_THREAD_UNLOCK(&array->lock); + } +} + OBJ_RELEASE(orte_node_pool); + + free(orte_topo_signature); + return ORTE_SUCCESS; } From 4bd5c538a2e7818f943dd11b738e0f1fc2983b7d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 29 Aug 2018 10:43:46 +0900 Subject: [PATCH 068/674] pml/ob1: plug a memory leak in mca_pml_ob1_component_fini() Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@fed33c15301855fc6addbfe005ffbaf1fa014e69) --- ompi/mca/pml/ob1/pml_ob1_component.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_component.c b/ompi/mca/pml/ob1/pml_ob1_component.c index 60345cab68c..26670f5dfc7 100644 --- a/ompi/mca/pml/ob1/pml_ob1_component.c +++ b/ompi/mca/pml/ob1/pml_ob1_component.c @@ -14,6 +14,8 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved * Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -309,8 +311,14 @@ int mca_pml_ob1_component_fini(void) if(OMPI_SUCCESS != (rc = mca_bml.bml_finalize())) return rc; - if(!mca_pml_ob1.enabled) + if(!mca_pml_ob1.enabled) { + if( NULL != mca_pml_ob1.allocator ) { + (void)mca_pml_ob1.allocator->alc_finalize(mca_pml_ob1.allocator); + mca_pml_ob1.allocator = NULL; + } + return OMPI_SUCCESS; /* never selected.. return success.. */ + } mca_pml_ob1.enabled = false; /* not anymore */ /* return the static receive/send requests to the respective free list and From ff8600f2e4830ceb34acc373a99408fd25080ce0 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 11 May 2017 15:29:31 +0900 Subject: [PATCH 069/674] ompi/hook: plug a misc memory leak Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b79b37465c022840c98ec5850a0662a101af8f26) --- ompi/mca/hook/base/hook_base.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/mca/hook/base/hook_base.c b/ompi/mca/hook/base/hook_base.c index 6a5723a7a42..8017d749415 100644 --- a/ompi/mca/hook/base/hook_base.c +++ b/ompi/mca/hook/base/hook_base.c @@ -1,5 +1,7 @@ /* * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -119,6 +121,7 @@ static int ompi_hook_base_close( void ) if( OMPI_SUCCESS != ret ) { return ret; } + OBJ_RELEASE(additional_callback_components); ompi_hook_is_framework_open = false; return OMPI_SUCCESS; From 685802859633fdf455dd30c12e1a4dc419503d44 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 10 Sep 2018 11:19:07 +0900 Subject: [PATCH 070/674] mpiext/pcollreq: Fix zero-count reduction We need to return a persistent request. `ompi_request_empty` is not a persistent request. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 69901a515697485cf56599e206dcfb74228e7ca2) --- ompi/mpiext/pcollreq/c/allreduce_init.c | 5 +++-- ompi/mpiext/pcollreq/c/reduce_init.c | 5 +++-- ompi/mpiext/pcollreq/c/reduce_scatter_init.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ompi/mpiext/pcollreq/c/allreduce_init.c b/ompi/mpiext/pcollreq/c/allreduce_init.c index e3a96672fa6..dd224f1115d 100644 --- a/ompi/mpiext/pcollreq/c/allreduce_init.c +++ b/ompi/mpiext/pcollreq/c/allreduce_init.c @@ -15,6 +15,7 @@ * Copyright (c) 2015-2018 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$ * * Additional copyrights may follow @@ -106,8 +107,8 @@ int MPIX_Allreduce_init(const void *sendbuf, void *recvbuf, int count, * So handle that case. */ if (0 == count) { - *request = &ompi_request_empty; - return MPI_SUCCESS; + err = ompi_request_persistent_noop_create(request); + OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpiext/pcollreq/c/reduce_init.c b/ompi/mpiext/pcollreq/c/reduce_init.c index 6bef3b5dded..1e72877d504 100644 --- a/ompi/mpiext/pcollreq/c/reduce_init.c +++ b/ompi/mpiext/pcollreq/c/reduce_init.c @@ -16,6 +16,7 @@ * Copyright (c) 2015-2018 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$ * * Additional copyrights may follow @@ -131,8 +132,8 @@ int MPIX_Reduce_init(const void *sendbuf, void *recvbuf, int count, * So handle that case. */ if (0 == count) { - *request = &ompi_request_empty; - return MPI_SUCCESS; + err = ompi_request_persistent_noop_create(request); + OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); diff --git a/ompi/mpiext/pcollreq/c/reduce_scatter_init.c b/ompi/mpiext/pcollreq/c/reduce_scatter_init.c index f1748b771e6..b8c470f064d 100644 --- a/ompi/mpiext/pcollreq/c/reduce_scatter_init.c +++ b/ompi/mpiext/pcollreq/c/reduce_scatter_init.c @@ -16,6 +16,7 @@ * Copyright (c) 2015-2018 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$ * * Additional copyrights may follow @@ -126,8 +127,8 @@ int MPIX_Reduce_scatter_init(const void *sendbuf, void *recvbuf, const int recvc } } if (size == count) { - *request = &ompi_request_empty; - return MPI_SUCCESS; + err = ompi_request_persistent_noop_create(request); + OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } OPAL_CR_ENTER_LIBRARY(); From d207052dbc967ccdd9a9cf6bfe688b0f6e9bfcc5 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Sun, 9 Sep 2018 14:36:02 -0600 Subject: [PATCH 071/674] LICENSE: update license for v4.0.x update missing memkind changes for this release in NEWS Signed-off-by: Howard Pritchard --- LICENSE | 24 ++++++++++++------------ NEWS | 1 + 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/LICENSE b/LICENSE index c835765b580..be9aead45de 100644 --- a/LICENSE +++ b/LICENSE @@ -8,24 +8,24 @@ corresponding files. Copyright (c) 2004-2010 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-2018 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2008 The Regents of the University of California. All rights reserved. -Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights +Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights reserved. -Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved. -Copyright (c) 2006-2017 Sandia National Laboratories. All rights reserved. +Copyright (c) 2006-2018 Sandia National Laboratories. All rights reserved. Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -Copyright (c) 2006-2017 The University of Houston. All rights reserved. +Copyright (c) 2006-2018 The University of Houston. All rights reserved. Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. -Copyright (c) 2007-2017 UT-Battelle, LLC. All rights reserved. -Copyright (c) 2007-2017 IBM Corporation. All rights reserved. +Copyright (c) 2007-2018 UT-Battelle, LLC. All rights reserved. +Copyright (c) 2007-2018 IBM Corporation. All rights reserved. Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing Centre, Federal Republic of Germany Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany @@ -35,7 +35,7 @@ Copyright (c) 2008-2009 Institut National de Recherche en Informatique. All rights reserved. Copyright (c) 2007 Lawrence Livermore National Security, LLC. All rights reserved. -Copyright (c) 2007-2017 Mellanox Technologies. All rights reserved. +Copyright (c) 2007-2018 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. Copyright (c) 2008-2017 Oak Ridge National Labs. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. @@ -45,15 +45,15 @@ Copyright (c) 2016 ARM, Inc. All rights reserved. Copyright (c) 2010-2011 Alex Brick . All rights reserved. Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. -Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +Copyright (c) 2013-2018 Intel, Inc. All rights reserved. Copyright (c) 2011-2017 NVIDIA Corporation. All rights reserved. Copyright (c) 2016 Broadcom Limited. All rights reserved. -Copyright (c) 2011-2017 Fujitsu Limited. All rights reserved. +Copyright (c) 2011-2018 Fujitsu Limited. All rights reserved. Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All rights reserved. -Copyright (c) 2013-2017 Research Organization for Information Science (RIST). +Copyright (c) 2013-2018 Research Organization for Information Science (RIST). All rights reserved. -Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights +Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights reserved. $COPYRIGHT$ diff --git a/NEWS b/NEWS index 3346fc539a2..257f2d2337a 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,7 @@ included in the vX.Y.Z section and be denoted as: https://github.com/davideberius/ompi/wiki/How-to-Use-Software-Based-Performance-Counters-(SPCs)-in-Open-MPI - Various improvements to MPI RMA performance when using RDMA capable interconnects. +- Update memkind component to use the memkind 1.6 public API. - Fix problems with use of newer map-by mpirun options. Thanks to Tony Reina for reporting. - Fix rank-by algorithms to properly rank by object and span From 1cc295e4c4f11f15bbf351d9d2cf94dbd074ba9b Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 30 Aug 2018 15:20:21 -0600 Subject: [PATCH 072/674] patcher/base: improve instruction cache flush for aarch64 This commit updates the patcher component to either use the __clear_cache intrinsic or the correct assembly to flush the instruction cache. Fixes #5631 Signed-off-by: Nathan Hjelm (cherry picked from commit 1cdbceb0951c30a04b730b78f31d07543d8c3d2a) Signed-off-by: Nathan Hjelm --- configure.ac | 2 +- opal/mca/patcher/base/patcher_base_patch.c | 27 +++++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 92d661c305f..9baa43d003e 100644 --- a/configure.ac +++ b/configure.ac @@ -858,7 +858,7 @@ OPAL_SEARCH_LIBS_CORE([ceil], [m]) # -lrt might be needed for clock_gettime OPAL_SEARCH_LIBS_CORE([clock_gettime], [rt]) -AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook]) +AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf openpty isatty getpwuid fork waitpid execve pipe ptsname setsid mmap tcgetpgrp posix_memalign strsignal sysconf syslog vsyslog regcmp regexec regfree _NSGetEnviron socketpair strncpy_s usleep mkfifo dbopen dbm_open statfs statvfs setpgid setenv __malloc_initialize_hook __clear_cache]) # Sanity check: ensure that we got at least one of statfs or statvfs. if test $ac_cv_func_statfs = no && test $ac_cv_func_statvfs = no; then diff --git a/opal/mca/patcher/base/patcher_base_patch.c b/opal/mca/patcher/base/patcher_base_patch.c index 3d97bef6be2..07e2c1ea345 100644 --- a/opal/mca/patcher/base/patcher_base_patch.c +++ b/opal/mca/patcher/base/patcher_base_patch.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -107,7 +107,11 @@ static void flush_and_invalidate_cache (unsigned long a) #elif OPAL_ASSEMBLY_ARCH == OPAL_IA64 __asm__ volatile ("fc %0;; sync.i;; srlz.i;;" : : "r"(a) : "memory"); #elif OPAL_ASSEMBLY_ARCH == OPAL_ARM64 - __asm__ volatile ("dsb sy"); + __asm__ volatile ("dc cvau, %0\n\t" + "dsb ish\n\t" + "ic ivau, %0\n\t" + "dsb ish\n\t" + "isb":: "r" (a)); #endif } @@ -138,10 +142,27 @@ static inline void apply_patch (unsigned char *patch_data, uintptr_t address, si { ModifyMemoryProtection (address, data_size, PROT_EXEC|PROT_READ|PROT_WRITE); memcpy ((void *) address, patch_data, data_size); - for (size_t i = 0 ; i < data_size ; i += 16) { +#if HAVE___CLEAR_CACHE + /* do not allow global declaration of compiler intrinsic */ + void __clear_cache(void* beg, void* end); + + __clear_cache ((void *) address, (void *) (address + data_size)); +#else + size_t offset_jump = 16; + +#if OPAL_ASSEMBLY_ARCH == OPAL_ARM64 + offset_jump = 32; +#endif + + /* align the address */ + address &= ~(offset_jump - 1); + + for (size_t i = 0 ; i < data_size ; i += offset_jump) { flush_and_invalidate_cache (address + i); } +#endif + ModifyMemoryProtection (address, data_size, PROT_EXEC|PROT_READ); } From c23359911c6bb8f1c16ed7770684d0994866400d Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Tue, 11 Sep 2018 13:43:10 -0500 Subject: [PATCH 073/674] Updating VERSION to rc1 and resetting mpifh_so_ver Signed-off-by: Geoffrey Paulsen --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index a9706a3db26..f0c6288bd2c 100644 --- a/VERSION +++ b/VERSION @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=a1 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -86,7 +86,7 @@ date="Unreleased developer copy" libmpi_so_version=60:0:20 libmpi_cxx_so_version=60:0:20 -libmpi_mpifh_so_version=61:0:21 +libmpi_mpifh_so_version=60:0:20 libmpi_usempi_tkr_so_version=60:0:20 libmpi_usempi_ignore_tkr_so_version=60:0:20 libmpi_usempif08_so_version=60:0:20 From 6f8df4e0fddcebf513d457121311bc567c65de89 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 11 Sep 2018 11:43:40 +0300 Subject: [PATCH 074/674] UCX: added missing UCX libs to UCX detection Signed-off-by: Sergey Oblomov (cherry picked from commit c982645a464147ab9a0824979530cb74e8d8d4b4) --- config/ompi_check_ucx.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 8b5332faac6..7608771d132 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -78,7 +78,7 @@ AC_DEFUN([OMPI_CHECK_UCX],[ [ucp/api/ucp.h], [ucp], [ucp_cleanup], - [], + [-luct -lucm -lucs], [$ompi_check_ucx_dir], [$ompi_check_ucx_libdir], [ompi_check_ucx_happy="yes"], From 265ce340a1f532e01541c5de52e60176165c014f Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 11 Sep 2018 19:06:22 +0300 Subject: [PATCH 075/674] UCX: added missing UCX libs to UCX detection - added libs to non-default UCX location branch Signed-off-by: Sergey Oblomov (cherry picked from commit e735593bb1dbdc2b243be32936c5e7d7d1785078) --- config/ompi_check_ucx.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 7608771d132..8a8a6d469c3 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -46,7 +46,7 @@ AC_DEFUN([OMPI_CHECK_UCX],[ [ucp/api/ucp.h], [ucp], [ucp_cleanup], - [], + [-luct -lucm -lucs], [], [], [ompi_check_ucx_happy="yes"], From 229ec82cf0d7ab03b8ebe25ad28ca89895b51f93 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Sep 2018 17:03:55 +0900 Subject: [PATCH 076/674] orte: send error messages to stderr. When a job terminates normally but with a non zero exit code, display the error message to stderr. Thanks Emre Brookes for the bug report. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@893270caeeedd986d7d3bbef8dc7a638b27792d3) --- orte/mca/errmgr/base/help-errmgr-base.txt | 5 +++++ orte/mca/errmgr/default_hnp/errmgr_default_hnp.c | 15 +++++++-------- orte/mca/state/base/Makefile.am | 4 ++++ orte/mca/state/base/help-state-base.txt | 13 +++++++++++++ orte/mca/state/base/state_base_fns.c | 8 ++++---- 5 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 orte/mca/state/base/help-state-base.txt diff --git a/orte/mca/errmgr/base/help-errmgr-base.txt b/orte/mca/errmgr/base/help-errmgr-base.txt index 07a9f71909f..30ff0f882f1 100644 --- a/orte/mca/errmgr/base/help-errmgr-base.txt +++ b/orte/mca/errmgr/base/help-errmgr-base.txt @@ -12,6 +12,8 @@ # All rights reserved. # Copyright (c) 2014-2017 Intel, Inc. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -105,3 +107,6 @@ An internal error has occurred in ORTE: %s This is something that should be reported to the developers. +# +[normal-termination-but] +%s job %s terminated normally, but %d %s. Per user-direction, the job has been aborted. diff --git a/orte/mca/errmgr/default_hnp/errmgr_default_hnp.c b/orte/mca/errmgr/default_hnp/errmgr_default_hnp.c index 9c807dd54b4..05a2a83713e 100644 --- a/orte/mca/errmgr/default_hnp/errmgr_default_hnp.c +++ b/orte/mca/errmgr/default_hnp/errmgr_default_hnp.c @@ -11,6 +11,8 @@ * All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -839,14 +841,11 @@ static void default_hnp_abort(orte_job_t *jdata) i32ptr = &i32; if (orte_get_attribute(&jdata->attributes, ORTE_JOB_NUM_NONZERO_EXIT, (void**)&i32ptr, OPAL_INT32)) { /* warn user */ - opal_output(orte_clean_output, - "-------------------------------------------------------\n" - "%s job %s terminated normally, but %d %s. Per user-direction, the job has been aborted.\n" - "-------------------------------------------------------", - (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "Primary" : "Child", - (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "" : ORTE_LOCAL_JOBID_PRINT(jdata->jobid), - i32, (1 == i32) ? "process returned\na non-zero exit code" : - "processes returned\nnon-zero exit codes"); + orte_show_help("help-errmgr-base.txt", "normal-termination-but", true, + (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "Primary" : "Child", + (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "" : ORTE_LOCAL_JOBID_PRINT(jdata->jobid), + i32, (1 == i32) ? "process returned\na non-zero exit code" : + "processes returned\nnon-zero exit codes"); } OPAL_OUTPUT_VERBOSE((1, orte_errmgr_base_framework.framework_output, diff --git a/orte/mca/state/base/Makefile.am b/orte/mca/state/base/Makefile.am index e8db0481f9d..623a4904399 100644 --- a/orte/mca/state/base/Makefile.am +++ b/orte/mca/state/base/Makefile.am @@ -1,6 +1,8 @@ # # Copyright (c) 2011-2013 Los Alamos National Security, LLC. # All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -8,6 +10,8 @@ # $HEADER$ # +dist_ortedata_DATA += base/help-state-base.txt + headers += \ base/state_private.h \ base/base.h diff --git a/orte/mca/state/base/help-state-base.txt b/orte/mca/state/base/help-state-base.txt new file mode 100644 index 00000000000..06c4c310048 --- /dev/null +++ b/orte/mca/state/base/help-state-base.txt @@ -0,0 +1,13 @@ +# -*- text -*- +# +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# +# +[normal-termination-but] +While %s job %s terminated normally, %d %s. Further examination may be required. diff --git a/orte/mca/state/base/state_base_fns.c b/orte/mca/state/base/state_base_fns.c index 3a2f6e0b834..e3c5682cfd2 100644 --- a/orte/mca/state/base/state_base_fns.c +++ b/orte/mca/state/base/state_base_fns.c @@ -1,6 +1,8 @@ /* * Copyright (c) 2011-2012 Los Alamos National Security, LLC. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,6 +40,7 @@ #include "orte/mca/routed/routed.h" #include "orte/util/session_dir.h" #include "orte/util/threads.h" +#include "orte/util/show_help.h" #include "orte/mca/state/base/base.h" #include "orte/mca/state/base/state_private.h" @@ -847,10 +850,7 @@ void orte_state_base_check_all_complete(int fd, short args, void *cbdata) } /* warn user */ - opal_output(orte_clean_output, - "-------------------------------------------------------\n" - "While %s job %s terminated normally, %d %s. Further examination may be required.\n" - "-------------------------------------------------------", + orte_show_help("help-state-base.txt", "normal-termination-but", true, (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "the primary" : "child", (1 == ORTE_LOCAL_JOBID(jdata->jobid)) ? "" : ORTE_LOCAL_JOBID_PRINT(jdata->jobid), i32, (1 == i32) ? "process returned\na non-zero exit code." : From 83668f4b4723a51ed91f3a70cbd04c95f48ae5e0 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 11 Sep 2018 10:27:31 -0600 Subject: [PATCH 077/674] btl/vader: ensure that the send tag is always written last To ensure fast box entries are complete when processed by the receiving process the tag must be written last. This includes a zero header for the next fast box entry (in some cases). This commit fixes two instances where the tag was written too early. In one case, on 32-bit systems it is possible for the tag part of the header to be written before the size. The second instance is an ordering issue. The zero header was being written after the fastbox header. Fixes #5375, #5638 Signed-off-by: Nathan Hjelm (cherry picked from commit 850fbff441756b2f9cde1007ead3e37ce22599c2) Signed-off-by: Nathan Hjelm --- opal/mca/btl/vader/btl_vader_fbox.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_fbox.h b/opal/mca/btl/vader/btl_vader_fbox.h index 17239ce8ef0..f85a5f6a22a 100644 --- a/opal/mca/btl/vader/btl_vader_fbox.h +++ b/opal/mca/btl/vader/btl_vader_fbox.h @@ -50,9 +50,10 @@ void mca_btl_vader_poll_handle_frag (mca_btl_vader_hdr_t *hdr, mca_btl_base_endp static inline void mca_btl_vader_fbox_set_header (mca_btl_vader_fbox_hdr_t *hdr, uint16_t tag, uint16_t seq, uint32_t size) { - mca_btl_vader_fbox_hdr_t tmp = {.data = {.tag = tag, .seq = seq, .size = size}}; - opal_atomic_wmb (); + mca_btl_vader_fbox_hdr_t tmp = {.data = {.tag = 0, .seq = seq, .size = size}}; hdr->ival = tmp.ival; + opal_atomic_wmb (); + hdr->data.tag = tag; } /* attempt to reserve a contiguous segment from the remote ep */ @@ -138,9 +139,6 @@ static inline bool mca_btl_vader_fbox_sendi (mca_btl_base_endpoint_t *ep, unsign memcpy (data + header_size, payload, payload_size); } - /* write out part of the header now. the tag will be written when the data is available */ - mca_btl_vader_fbox_set_header (MCA_BTL_VADER_FBOX_HDR(dst), tag, ep->fbox_out.seq++, data_size); - end += size; if (OPAL_UNLIKELY(fbox_size == end)) { @@ -152,6 +150,9 @@ static inline bool mca_btl_vader_fbox_sendi (mca_btl_base_endpoint_t *ep, unsign MCA_BTL_VADER_FBOX_HDR(ep->fbox_out.buffer + end)->ival = 0; } + /* write out part of the header now. the tag will be written when the data is available */ + mca_btl_vader_fbox_set_header (MCA_BTL_VADER_FBOX_HDR(dst), tag, ep->fbox_out.seq++, data_size); + /* align the buffer */ ep->fbox_out.end = ((uint32_t) hbs << 31) | end; opal_atomic_wmb (); From 9114a9ac9577cc4aea66f2809f4dbc8e3c59925a Mon Sep 17 00:00:00 2001 From: Selvin Xavier Date: Wed, 12 Sep 2018 00:44:22 -0700 Subject: [PATCH 078/674] v4.0.x: Add support for different Broadcom HCAs Adds device ids of different Broadcom adapters from BCM57XXX and BCM58XXX family of HCAs. Signed-off-by: Selvin Xavier (cherry-picked from a53a6f7650035d1644018fd09647c5e4db6b0694) --- opal/mca/btl/openib/mca-btl-openib-device-params.ini | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/opal/mca/btl/openib/mca-btl-openib-device-params.ini b/opal/mca/btl/openib/mca-btl-openib-device-params.ini index 6e852647f39..4a0a62467d4 100644 --- a/opal/mca/btl/openib/mca-btl-openib-device-params.ini +++ b/opal/mca/btl/openib/mca-btl-openib-device-params.ini @@ -334,9 +334,17 @@ max_inline_data = 72 # Broadcom NetXtreme-E RDMA Ethernet Controller -[Broadcom Cumulus] +[Broadcom BCM57XXX] vendor_id = 0x14e4 -vendor_part_id = 0x16d7 +vendor_part_id = 0x1605,0x1606,0x1614,0x16c0,0x16c1,0x16ce,0x16cf,0x16d6,0x16d7,0x16d8,0x16d9,0x16df,0x16e2,0x16e3,0x16e5,0x16eb,0x16ed,0x16ef,0x16f0,0x16f1 +use_eager_rdma = 1 +mtu = 1024 +receive_queues = P,65536,256,192,128 +max_inline_data = 96 + +[Broadcom BCM58XXX] +vendor_id = 0x14e4 +vendor_part_id = 0xd800,0xd802,0xd804 use_eager_rdma = 1 mtu = 1024 receive_queues = P,65536,256,192,128 From 73f531a8f21142855512532fa9982f4519f448e8 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 18 Sep 2018 09:49:22 +0900 Subject: [PATCH 079/674] mpiext/pcollreq: fix misc typos Thanks Jeff for the report Fixes open-mpi/ompi#5712 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@8dc6985a5af6f42bcdf3a92b9cec6ef1788588e0) --- ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h | 4 ++-- ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h b/ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h index 11f57305ec2..811a94b82e2 100644 --- a/ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h +++ b/ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h @@ -84,10 +84,10 @@ PN2(void, MPIX_Allgather_init, mpix_allgather_init, MPIX_ALLGATHER_INIT, (char * PN2(void, MPIX_Allgatherv_init, mpix_allgatherv_init, MPIX_ALLGATHERV_INIT, (char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *displs, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); END_C_DECLS PN2(void, MPIX_Allreduce_init, mpix_allreduce_init, MPIX_ALLREDUCE_INIT, (char *sendbuf, char *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); -PN2(void, MPIX_alltoall_init, mpix_alltoall_init, MPIX_ALLTOALL_INIT, (char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); +PN2(void, MPIX_Alltoall_init, mpix_alltoall_init, MPIX_ALLTOALL_INIT, (char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPIX_Alltoallv_init, mpix_alltoallv_init, MPIX_ALLTOALLV_INIT, (char *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtype, char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtype, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPIX_Alltoallw_init, mpix_alltoallw_init, MPIX_ALLTOALLW_INIT, (char *sendbuf, MPI_Fint *sendcounts, MPI_Fint *sdispls, MPI_Fint *sendtypes, char *recvbuf, MPI_Fint *recvcounts, MPI_Fint *rdispls, MPI_Fint *recvtypes, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); -PN2(void, MPIX_Barrier_init, mpix_barrier_init, MPIX_BARRIER_init, (MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); +PN2(void, MPIX_Barrier_init, mpix_barrier_init, MPIX_BARRIER_INIT, (MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPIX_Bcast_init, mpix_bcast_init, MPIX_BCAST_INIT, (char *buffer, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPIX_Exscan_init, mpix_exscan_init, MPIX_EXSCAN_INIT, (char *sendbuf, char *recvbuf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *op, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); PN2(void, MPIX_Gather_init, mpix_gather_init, MPIX_GATHER_INIT, (char *sendbuf, MPI_Fint *sendcount, MPI_Fint *sendtype, char *recvbuf, MPI_Fint *recvcount, MPI_Fint *recvtype, MPI_Fint *root, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr)); diff --git a/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c b/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c index afa8d858617..ccb7a04e9ed 100644 --- a/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c +++ b/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c @@ -30,7 +30,7 @@ #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak PMPIX_NEIGHBOR_ALLTOALL = ompix_neighbor_alltoall_init_f +#pragma weak PMPIX_NEIGHBOR_ALLTOALL_INIT = ompix_neighbor_alltoall_init_f #pragma weak pmpix_neighbor_alltoall_init = ompix_neighbor_alltoall_init_f #pragma weak pmpix_neighbor_alltoall_init_ = ompix_neighbor_alltoall_init_f #pragma weak pmpix_neighbor_alltoall_init__ = ompix_neighbor_alltoall_init_f @@ -38,7 +38,7 @@ #pragma weak PMPIX_Neighbor_alltoall_init_f = ompix_neighbor_alltoall_init_f #pragma weak PMPIX_Neighbor_alltoall_init_f08 = ompix_neighbor_alltoall_init_f #else -OMPI_GENERATE_F77_BINDINGS (PMPIX_NEIGHBOR_ALLTOALL, +OMPI_GENERATE_F77_BINDINGS (PMPIX_NEIGHBOR_ALLTOALL_INIT, pmpix_neighbor_alltoall_init, pmpix_neighbor_alltoall_init_, pmpix_neighbor_alltoall_init__, @@ -49,7 +49,7 @@ OMPI_GENERATE_F77_BINDINGS (PMPIX_NEIGHBOR_ALLTOALL, #endif #if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPIX_NEIGHBOR_ALLTOALL = ompix_neighbor_alltoall_init_f +#pragma weak MPIX_NEIGHBOR_ALLTOALL_INIT = ompix_neighbor_alltoall_init_f #pragma weak mpix_neighbor_alltoall_init = ompix_neighbor_alltoall_init_f #pragma weak mpix_neighbor_alltoall_init_ = ompix_neighbor_alltoall_init_f #pragma weak mpix_neighbor_alltoall_init__ = ompix_neighbor_alltoall_init_f From ece18aed4536b8c5ea6174ae682328196efee279 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 18 Sep 2018 13:07:20 +0900 Subject: [PATCH 080/674] coll/libnbc: fix various error paths The parameter passed to NBC_Return_handle() was incorrectly casted and not dereferenced. Thanks Yossi for the bug report. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@8b51862fb2b7223c03033e38cd94d44f743e8fd8) --- ompi/mca/coll/libnbc/nbc_iallgatherv.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_iallreduce.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ialltoall.c | 4 ++-- ompi/mca/coll/libnbc/nbc_ialltoallv.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ialltoallw.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ibarrier.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ibcast.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_iexscan.c | 6 +++--- ompi/mca/coll/libnbc/nbc_igather.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_igatherv.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c | 6 +++--- ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c | 6 +++--- ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c | 6 +++--- ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c | 6 +++--- ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c | 6 +++--- ompi/mca/coll/libnbc/nbc_ireduce.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ireduce_scatter.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_iscan.c | 6 +++--- ompi/mca/coll/libnbc/nbc_iscatter.c | 8 ++++---- ompi/mca/coll/libnbc/nbc_iscatterv.c | 8 ++++---- 21 files changed, 75 insertions(+), 75 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc_iallgatherv.c b/ompi/mca/coll/libnbc/nbc_iallgatherv.c index 500a29dd6cd..b2046ab50e6 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_iallgatherv.c @@ -11,8 +11,8 @@ * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -130,7 +130,7 @@ int ompi_coll_libnbc_iallgatherv(const void* sendbuf, int sendcount, MPI_Datatyp res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -209,7 +209,7 @@ int ompi_coll_libnbc_iallgatherv_inter(const void* sendbuf, int sendcount, MPI_D res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index f61b5fbb93f..57aa0d77e0d 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -7,8 +7,8 @@ * rights reserved. * Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -206,7 +206,7 @@ int ompi_coll_libnbc_iallreduce(const void* sendbuf, void* recvbuf, int count, M res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -289,7 +289,7 @@ int ompi_coll_libnbc_iallreduce_inter(const void* sendbuf, void* recvbuf, int co res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoall.c b/ompi/mca/coll/libnbc/nbc_ialltoall.c index 0b93af0530b..e2731e1a1d3 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoall.c @@ -292,7 +292,7 @@ int ompi_coll_libnbc_ialltoall(const void* sendbuf, int sendcount, MPI_Datatype res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -376,7 +376,7 @@ int ompi_coll_libnbc_ialltoall_inter (const void* sendbuf, int sendcount, MPI_Da res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallv.c b/ompi/mca/coll/libnbc/nbc_ialltoallv.c index 93f54aa20fd..5d13d524ea4 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallv.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -153,7 +153,7 @@ int ompi_coll_libnbc_ialltoallv(const void* sendbuf, const int *sendcounts, cons res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -241,7 +241,7 @@ int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, const int *sendcount res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ialltoallw.c b/ompi/mca/coll/libnbc/nbc_ialltoallw.c index 52d53b121ec..ae293697c7c 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoallw.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -139,7 +139,7 @@ int ompi_coll_libnbc_ialltoallw(const void* sendbuf, const int *sendcounts, cons res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -214,7 +214,7 @@ int ompi_coll_libnbc_ialltoallw_inter(const void* sendbuf, const int *sendcounts res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ibarrier.c b/ompi/mca/coll/libnbc/nbc_ibarrier.c index bed454b859c..05da51de34a 100644 --- a/ompi/mca/coll/libnbc/nbc_ibarrier.c +++ b/ompi/mca/coll/libnbc/nbc_ibarrier.c @@ -7,8 +7,8 @@ * rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. @@ -108,7 +108,7 @@ int ompi_coll_libnbc_ibarrier(struct ompi_communicator_t *comm, ompi_request_t * res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -195,7 +195,7 @@ int ompi_coll_libnbc_ibarrier_inter(struct ompi_communicator_t *comm, ompi_reque res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ibcast.c b/ompi/mca/coll/libnbc/nbc_ibcast.c index 8f2ecd64c12..3cd1ca7b267 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -182,7 +182,7 @@ int ompi_coll_libnbc_ibcast(void *buffer, int count, MPI_Datatype datatype, int } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -405,7 +405,7 @@ int ompi_coll_libnbc_ibcast_inter(void *buffer, int count, MPI_Datatype datatype res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_iexscan.c b/ompi/mca/coll/libnbc/nbc_iexscan.c index 7cc8c7f4e66..90a6b6bf27f 100644 --- a/ompi/mca/coll/libnbc/nbc_iexscan.c +++ b/ompi/mca/coll/libnbc/nbc_iexscan.c @@ -7,8 +7,8 @@ * rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -205,7 +205,7 @@ int ompi_coll_libnbc_iexscan(const void* sendbuf, void* recvbuf, int count, MPI_ res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_igather.c b/ompi/mca/coll/libnbc/nbc_igather.c index 521d583af8b..47203d0a467 100644 --- a/ompi/mca/coll/libnbc/nbc_igather.c +++ b/ompi/mca/coll/libnbc/nbc_igather.c @@ -8,8 +8,8 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -185,7 +185,7 @@ int ompi_coll_libnbc_igather(const void* sendbuf, int sendcount, MPI_Datatype se res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -265,7 +265,7 @@ int ompi_coll_libnbc_igather_inter(const void* sendbuf, int sendcount, MPI_Datat res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_igatherv.c b/ompi/mca/coll/libnbc/nbc_igatherv.c index 0fe0fbfd803..387a668e678 100644 --- a/ompi/mca/coll/libnbc/nbc_igatherv.c +++ b/ompi/mca/coll/libnbc/nbc_igatherv.c @@ -8,8 +8,8 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. @@ -117,7 +117,7 @@ int ompi_coll_libnbc_igatherv(const void* sendbuf, int sendcount, MPI_Datatype s res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -197,7 +197,7 @@ int ompi_coll_libnbc_igatherv_inter(const void* sendbuf, int sendcount, MPI_Data res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c index 9835b0f5a0d..e15ddf33269 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -173,7 +173,7 @@ int ompi_coll_libnbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datat } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c index 649349b751c..9871111326b 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgatherv.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -175,7 +175,7 @@ int ompi_coll_libnbc_ineighbor_allgatherv(const void *sbuf, int scount, MPI_Data } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c index c24a8781bd1..c2aa09b5e02 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoall.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -177,7 +177,7 @@ int ompi_coll_libnbc_ineighbor_alltoall(const void *sbuf, int scount, MPI_Dataty } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c index 58307dbd436..054b047cb8e 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallv.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -182,7 +182,7 @@ int ompi_coll_libnbc_ineighbor_alltoallv(const void *sbuf, const int *scounts, c } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c index adc0ba3ae52..270a0b20b34 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_alltoallw.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -167,7 +167,7 @@ int ompi_coll_libnbc_ineighbor_alltoallw(const void *sbuf, const int *scounts, c } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index d4bcb62e06f..c222fa3a7f0 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -7,8 +7,8 @@ * rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -218,7 +218,7 @@ int ompi_coll_libnbc_ireduce(const void* sendbuf, void* recvbuf, int count, MPI_ } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -284,7 +284,7 @@ int ompi_coll_libnbc_ireduce_inter(const void* sendbuf, void* recvbuf, int count } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c index 3b318ea1d36..230bcaa0101 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c @@ -7,8 +7,8 @@ * rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. @@ -219,7 +219,7 @@ int ompi_coll_libnbc_ireduce_scatter (const void* sendbuf, void* recvbuf, const } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -361,7 +361,7 @@ int ompi_coll_libnbc_ireduce_scatter_inter (const void* sendbuf, void* recvbuf, } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c index 6553b44d63b..6dadd1eafa8 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c @@ -8,8 +8,8 @@ * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -217,7 +217,7 @@ int ompi_coll_libnbc_ireduce_scatter_block(const void* sendbuf, void* recvbuf, i } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -356,7 +356,7 @@ int ompi_coll_libnbc_ireduce_scatter_block_inter(const void* sendbuf, void* recv } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_iscan.c b/ompi/mca/coll/libnbc/nbc_iscan.c index 4d4f3677b7c..33374ede7ae 100644 --- a/ompi/mca/coll/libnbc/nbc_iscan.c +++ b/ompi/mca/coll/libnbc/nbc_iscan.c @@ -5,8 +5,8 @@ * Corporation. All rights reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All * rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -182,7 +182,7 @@ int ompi_coll_libnbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Da } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_iscatter.c b/ompi/mca/coll/libnbc/nbc_iscatter.c index a7bbb42b66c..c1b2f2ac552 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatter.c +++ b/ompi/mca/coll/libnbc/nbc_iscatter.c @@ -10,8 +10,8 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -179,7 +179,7 @@ int ompi_coll_libnbc_iscatter (const void* sendbuf, int sendcount, MPI_Datatype } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -258,7 +258,7 @@ int ompi_coll_libnbc_iscatter_inter (const void* sendbuf, int sendcount, MPI_Dat } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } diff --git a/ompi/mca/coll/libnbc/nbc_iscatterv.c b/ompi/mca/coll/libnbc/nbc_iscatterv.c index e9f8ba7394c..8badee86554 100644 --- a/ompi/mca/coll/libnbc/nbc_iscatterv.c +++ b/ompi/mca/coll/libnbc/nbc_iscatterv.c @@ -10,8 +10,8 @@ * Copyright (c) 2013 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -114,7 +114,7 @@ int ompi_coll_libnbc_iscatterv(const void* sendbuf, const int *sendcounts, const } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } @@ -192,7 +192,7 @@ int ompi_coll_libnbc_iscatterv_inter(const void* sendbuf, const int *sendcounts, } res = NBC_Start(*(ompi_coll_libnbc_request_t **)request); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - NBC_Return_handle ((ompi_coll_libnbc_request_t *)request); + NBC_Return_handle (*(ompi_coll_libnbc_request_t **)request); *request = &ompi_request_null.request; return res; } From e83e118ae704ef95faa57cc4da3a9b90b7819485 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Tue, 18 Sep 2018 14:36:28 +0900 Subject: [PATCH 081/674] mpiext/pcollreq: fix more typos Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 4a0a2598f63b081045fdeb51256493ce2a8ec96a) --- ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c | 3 ++- ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c b/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c index ccb7a04e9ed..561d96a55ea 100644 --- a/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c +++ b/ompi/mpiext/pcollreq/mpif-h/neighbor_alltoall_init_f.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,7 +59,7 @@ OMPI_GENERATE_F77_BINDINGS (PMPIX_NEIGHBOR_ALLTOALL_INIT, #pragma weak MPIX_Neighbor_alltoall_init_f08 = ompix_neighbor_alltoall_init_f #else #if ! OMPI_BUILD_MPI_PROFILING -OMPI_GENERATE_F77_BINDINGS (MPIX_NEIGHBOR_ALLTOALL, +OMPI_GENERATE_F77_BINDINGS (MPIX_NEIGHBOR_ALLTOALL_INIT, mpix_neighbor_alltoall_init, mpix_neighbor_alltoall_init_, mpix_neighbor_alltoall_init__, diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 index 716bfff2909..107a9554dd2 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -25,4 +26,4 @@ subroutine MPIX_Bcast_init_f08(buffer,count,datatype,root,comm,info,request,ierr call ompix_bcast_init_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,info%MPI_VAL,request%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine MPIX_Bcast_init_f08 +end subroutine MPIX_Bcast_init_f08 From cf649bffbcd502697a492773b349644a36d6dd4d Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 18 Sep 2018 09:18:57 -0600 Subject: [PATCH 082/674] NEWS: add a blurb about cuda buffers OMPIO [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 257f2d2337a..11de0cd6dcf 100644 --- a/NEWS +++ b/NEWS @@ -73,6 +73,7 @@ included in the vX.Y.Z section and be denoted as: - Updated internal ROMIO to 3.2.1. - Removed support for the MXM MTL. - Improved CUDA support when using UCX. +- Enable use of CUDA allocated buffers for OMPIO. - Improved support for two phase MPI I/O operations when using OMPIO. - Added support for Software-based Performance Counters, see https://github.com/davideberius/ompi/wiki/How-to-Use-Software-Based-Performance-Counters-(SPCs)-in-Open-MPI From 8d892f9917567b32c773acc95eecd80ae7de8d9d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 9 Mar 2018 09:18:19 +0900 Subject: [PATCH 083/674] Be conservative with the array_of_indices We were assuming that the array_of_indices has the same size as the number of requests (incount), instead of the numberr of actually active requests. While the patch is trivial, the question of the size of the array_of_indices should be clarified in the MPI Forum. Signed-off-by: George Bosilca (cherry picked from commit a5fbfa476a591e747bec285552b57a216c44c027) --- ompi/request/req_wait.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ompi/request/req_wait.c b/ompi/request/req_wait.c index e4d4d5e68a6..d8eb64984c4 100644 --- a/ompi/request/req_wait.c +++ b/ompi/request/req_wait.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2010 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-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -388,13 +388,13 @@ int ompi_request_default_wait_some(size_t count, int * indices, ompi_status_public_t * statuses) { - size_t num_requests_null_inactive=0, num_requests_done=0; + size_t num_requests_null_inactive, num_requests_done, num_active_reqs; int rc = MPI_SUCCESS; ompi_request_t **rptr = NULL; ompi_request_t *request = NULL; ompi_wait_sync_t sync; size_t sync_sets = 0, sync_unsets = 0; - + if (OPAL_UNLIKELY(0 == count)) { *outcount = MPI_UNDEFINED; return OMPI_SUCCESS; @@ -407,6 +407,7 @@ int ompi_request_default_wait_some(size_t count, rptr = requests; num_requests_null_inactive = 0; num_requests_done = 0; + num_active_reqs = 0; for (size_t i = 0; i < count; i++, rptr++) { void *_tmp_ptr = REQUEST_PENDING; @@ -419,14 +420,14 @@ int ompi_request_default_wait_some(size_t count, num_requests_null_inactive++; continue; } - indices[i] = OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR(&request->req_complete, &_tmp_ptr, &sync); - if( !indices[i] ) { + indices[num_active_reqs] = OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR(&request->req_complete, &_tmp_ptr, &sync); + if( !indices[num_active_reqs] ) { /* If the request is completed go ahead and mark it as such */ assert( REQUEST_COMPLETE(request) ); num_requests_done++; } + num_active_reqs++; } - sync_sets = count - num_requests_null_inactive - num_requests_done; if(num_requests_null_inactive == count) { *outcount = MPI_UNDEFINED; @@ -435,6 +436,7 @@ int ompi_request_default_wait_some(size_t count, return rc; } + sync_sets = num_active_reqs - num_requests_done; if( 0 == num_requests_done ) { /* One completed request is enough to satisfy the some condition */ SYNC_WAIT(&sync); @@ -445,6 +447,7 @@ int ompi_request_default_wait_some(size_t count, rptr = requests; num_requests_done = 0; + num_active_reqs = 0; for (size_t i = 0; i < count; i++, rptr++) { void *_tmp_ptr = &sync; @@ -466,13 +469,14 @@ int ompi_request_default_wait_some(size_t count, * either slowly (in case of partial completion) * OR in parallel with `i` (in case of full set completion) */ - if( !indices[i] ){ + if( !indices[num_active_reqs] ) { indices[num_requests_done++] = i; } else if( !OPAL_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR(&request->req_complete, &_tmp_ptr, REQUEST_PENDING) ) { indices[num_requests_done++] = i; } + num_active_reqs++; } - sync_unsets = count - num_requests_null_inactive - num_requests_done; + sync_unsets = num_active_reqs - num_requests_done; if( sync_sets == sync_unsets ){ /* nobody knows about us, From 131ea0132023c0924e9a5f6d3838d7ce24f1fe0c Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 12 Sep 2018 13:00:17 -0700 Subject: [PATCH 084/674] Update to PMIx v3.0.2 Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/NEWS | 24 ++ opal/mca/pmix/pmix3x/pmix/VERSION | 8 +- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 29 +- .../pmix/pmix3x/pmix/src/client/pmix_client.c | 9 +- .../pmix/pmix3x/pmix/src/event/pmix_event.h | 23 +- .../pmix/src/event/pmix_event_notification.c | 384 ++++++++---------- .../pmix/src/mca/psensor/file/psensor_file.c | 6 +- .../mca/psensor/heartbeat/psensor_heartbeat.c | 20 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 4 + .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 2 +- .../pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c | 2 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 1 + .../pmix3x/pmix/src/server/pmix_server_ops.c | 95 +++-- .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 25 +- opal/mca/pmix/pmix3x/pmix/src/util/error.c | 3 +- opal/mca/pmix/pmix3x/pmix/src/util/path.c | 5 +- .../pmix/pmix3x/pmix/test/simple/simptest.c | 36 +- 18 files changed, 370 insertions(+), 308 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index 8eb5944b5b4..4ca89d8505b 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -21,6 +21,18 @@ example, a bug might be fixed in the master, and then moved to the current release as well as the "stable" bug fix release branch. +3.0.2 -- 18 Sept 2018 +---------------------- +- Ensure we cleanup any active sensors when a peer departs. Allow the + heartbeat monitor to "reset" if a process stops beating and subsequently + returns +- Fix a few bugs in the event notification system and provide some + missing implementation (support for specifying target procs to + receive the event). +- Add PMIX_PROC_TERMINATED constant +- Properly deal with EOPNOTSUPP from getsockopt() on ARM + + 3.0.1 -- 23 Aug 2018 ---------------------- **** DEPRECATION WARNING: The pmix_info_array_t struct was @@ -77,6 +89,18 @@ current release as well as the "stable" bug fix release branch. - Fix several memory and file descriptor leaks +2.1.4 -- 18 Sep 2018 +---------------------- +- Updated configury to silence warnings on older compilers +- Implement job control and sensor APIs +- Update sensor support +- Fix a few bugs in the event notification system and provide some + missing implementation (support for specifying target procs to + receive the event). +- Add PMIX_PROC_TERMINATED constant +- Properly deal with EOPNOTSUPP from getsockopt() on ARM + + 2.1.3 -- 23 Aug 2018 ---------------------- - Fixed memory corruption bug in event notification diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index 4332495ed44..c10266b70b6 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -15,7 +15,7 @@ major=3 minor=0 -release=1 +release=2 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gitbf30a5f +repo_rev=gite574b10d # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Aug 20, 2018" +date="Sep 18, 2018" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,6 +75,6 @@ date="Aug 20, 2018" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:1:2 +libpmix_so_version=4:2:2 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index 529c24772bf..b73d36ee39a 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.0.1 +Version: 3.0.2 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index a34354a6d23..9554745ffc2 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -762,6 +762,7 @@ typedef int pmix_status_t; /* monitoring */ #define PMIX_MONITOR_HEARTBEAT_ALERT (PMIX_ERR_V2X_BASE - 9) #define PMIX_MONITOR_FILE_ALERT (PMIX_ERR_V2X_BASE - 10) +#define PMIX_PROC_TERMINATED (PMIX_ERR_V2X_BASE - 11) /* define a starting point for operational error constants so * we avoid renumbering when making additions */ @@ -782,6 +783,7 @@ typedef int pmix_status_t; #define PMIX_LAUNCHER_READY (PMIX_ERR_OP_BASE - 25) #define PMIX_OPERATION_IN_PROGRESS (PMIX_ERR_OP_BASE - 26) #define PMIX_OPERATION_SUCCEEDED (PMIX_ERR_OP_BASE - 27) +/* gap for group codes */ /* define a starting point for system error constants so @@ -951,6 +953,19 @@ typedef uint16_t pmix_iof_channel_t; #define PMIX_FWD_ALL_CHANNELS 0x00ff +/* declare a convenience macro for checking keys */ +#define PMIX_CHECK_KEY(a, b) \ + (0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN)) + +/* define a convenience macro for checking nspaces */ +#define PMIX_CHECK_NSPACE(a, b) \ + (0 == strncmp((a), (b), PMIX_MAX_NSLEN)) + +/* define a convenience macro for checking names */ +#define PMIX_CHECK_PROCID(a, b) \ + (PMIX_CHECK_NSPACE((a)->nspace, (b)->nspace) && ((a)->rank == (b)->rank || (PMIX_RANK_WILDCARD == (a)->rank || PMIX_RANK_WILDCARD == (b)->rank))) + + /**** PMIX BYTE OBJECT ****/ typedef struct pmix_byte_object { char *bytes; @@ -1456,13 +1471,13 @@ struct pmix_info_t { (m)->flags = 0; \ pmix_value_load(&((m)->value), (v), (t)); \ } while (0) -#define PMIX_INFO_XFER(d, s) \ - do { \ - if (NULL != (s)->key) { \ - (void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ - } \ - (d)->flags = (s)->flags; \ - pmix_value_xfer(&(d)->value, &(s)->value); \ +#define PMIX_INFO_XFER(d, s) \ + do { \ + if (NULL != (s)->key) { \ + (void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ + } \ + (d)->flags = (s)->flags; \ + pmix_value_xfer(&(d)->value, (pmix_value_t*)&(s)->value); \ } while(0) #define PMIX_INFO_REQUIRED(m) \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index 8f0d21390fe..3e4c9433fbf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -169,14 +169,9 @@ static void pmix_client_notify_recv(struct pmix_peer_t *peer, PMIX_RELEASE(chain); goto error; } - /* check for non-default flag */ - for (cnt=0; cnt < (int)ninfo; cnt++) { - if (0 == strncmp(chain->info[cnt].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - chain->nondefault = PMIX_INFO_TRUE(&chain->info[cnt]); - break; - } - } } + /* prep the chain for processing */ + pmix_prep_event_chain(chain, chain->info, ninfo, false); pmix_output_verbose(2, pmix_client_globals.base_output, "[%s:%d] pmix:client_notify_recv - processing event %s, calling errhandler", diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h index b4ee30b0c0e..1cd7d3fe719 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h @@ -39,6 +39,13 @@ #define PMIX_EVENT_ORDER_PREPEND 0x10 #define PMIX_EVENT_ORDER_APPEND 0x20 +/* define an internal attribute for marking that the + * server processed an event before passing it up + * to its host in case it comes back down - avoids + * infinite loop */ +#define PMIX_SERVER_INTERNAL_NOTIFY "pmix.srvr.internal.notify" + + /* define a struct for tracking registration ranges */ typedef struct { pmix_data_range_t range; @@ -117,8 +124,15 @@ typedef struct pmix_event_chain_t { bool endchain; pmix_proc_t source; pmix_data_range_t range; + /* When generating events, callers can specify + * the range of targets to receive notifications. + */ + pmix_proc_t *targets; + size_t ntargets; + /* the processes that we affected by the event */ pmix_proc_t *affected; size_t naffected; + /* any info provided by the event generator */ pmix_info_t *info; size_t ninfo; size_t nallocated; @@ -130,6 +144,13 @@ typedef struct pmix_event_chain_t { } pmix_event_chain_t; PMIX_CLASS_DECLARATION(pmix_event_chain_t); +/* prepare a chain for processing by cycling across provided + * info structs and translating those supported by the event + * system into the chain object*/ +pmix_status_t pmix_prep_event_chain(pmix_event_chain_t *chain, + const pmix_info_t *info, size_t ninfo, + bool xfer); + /* invoke the error handler that is registered against the given * status, passing it the provided info on the procs that were * affected, plus any additional info provided by the server */ @@ -146,7 +167,7 @@ bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested, pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); void pmix_event_timeout_cb(int fd, short flags, void *arg); diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index f0ab4c21f0e..d59cfdee170 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -30,7 +30,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); /* if we are a client, we call this function to notify the server of @@ -55,13 +55,16 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); + pmix_output_verbose(2, pmix_server_globals.event_output, + "pmix_server_notify_event source = %s:%d event_status = %d", + (NULL == source) ? "UNKNOWN" : source->nspace, + (NULL == source) ? PMIX_RANK_WILDCARD : source->rank, status); rc = pmix_server_notify_client_of_event(status, source, range, info, ninfo, cbfunc, cbdata); - pmix_output_verbose(2, pmix_server_globals.event_output, - "pmix_server_notify_event source = %s:%d event_status = %d, rc= %d", - (NULL == source) ? "UNKNOWN" : source->nspace, - (NULL == source) ? PMIX_RANK_WILDCARD : source->rank, status, rc); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } return rc; } @@ -71,14 +74,17 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, return PMIX_ERR_UNREACH; } PMIX_RELEASE_THREAD(&pmix_global_lock); + pmix_output_verbose(2, pmix_client_globals.event_output, + "pmix_client_notify_event source = %s:%d event_status =%d", + (NULL == source) ? pmix_globals.myid.nspace : source->nspace, + (NULL == source) ? pmix_globals.myid.rank : source->rank, status); rc = notify_server_of_event(status, source, range, info, ninfo, cbfunc, cbdata); - pmix_output_verbose(2, pmix_client_globals.event_output, - "pmix_client_notify_event source = %s:%d event_status =%d, rc=%d", - (NULL == source) ? pmix_globals.myid.nspace : source->nspace, - (NULL == source) ? pmix_globals.myid.rank : source->rank, status, rc); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } return rc; } @@ -106,7 +112,7 @@ static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, static pmix_status_t notify_server_of_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_status_t rc; @@ -171,14 +177,8 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, /* we always leave space for event hdlr name and a callback object */ chain->nallocated = ninfo + 2; PMIX_INFO_CREATE(chain->info, chain->nallocated); - - if (0 < ninfo) { - chain->ninfo = ninfo; - /* need to copy the info */ - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&chain->info[n], &info[n]); - } - } + /* prep the chain for processing */ + pmix_prep_event_chain(chain, info, ninfo, true); /* we need to cache this event so we can pass it into * ourselves should someone later register for it */ @@ -195,65 +195,25 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, if (0 < chain->ninfo) { cd->ninfo = chain->ninfo; PMIX_INFO_CREATE(cd->info, cd->ninfo); + cd->nondefault = chain->nondefault; /* need to copy the info */ for (n=0; n < cd->ninfo; n++) { PMIX_INFO_XFER(&cd->info[n], &chain->info[n]); - if (0 == strncmp(cd->info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - cd->nondefault = true; - chain->nondefault = true; - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_CUSTOM_RANGE, PMIX_MAX_KEYLEN)) { - /* provides an array of pmix_proc_t identifying the procs - * that are to receive this notification, or a single pmix_proc_t */ - if (PMIX_DATA_ARRAY == cd->info[n].value.type && - NULL != cd->info[n].value.data.darray && - NULL != cd->info[n].value.data.darray->array) { - cd->ntargets = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, cd->info[n].value.data.darray->array, cd->ntargets * sizeof(pmix_proc_t)); - } else if (PMIX_PROC == cd->info[n].value.type) { - cd->ntargets = 1; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - } else { - /* this is an error */ - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { - PMIX_PROC_CREATE(cd->affected, 1); - if (NULL == cd->affected) { - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - cd->naffected = 1; - memcpy(cd->affected, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - /* need to do the same for chain so it can be correctly processed */ - PMIX_PROC_CREATE(chain->affected, 1); - if (NULL == chain->affected) { - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - chain->naffected = 1; - memcpy(chain->affected, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) { - cd->naffected = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(cd->affected, cd->naffected); - if (NULL == cd->affected) { - cd->naffected = 0; - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - memcpy(cd->affected, cd->info[n].value.data.darray->array, cd->naffected * sizeof(pmix_proc_t)); - /* need to do the same for chain so it can be correctly processed */ - chain->naffected = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(chain->affected, chain->naffected); - if (NULL == chain->affected) { - chain->naffected = 0; - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - memcpy(chain->affected, cd->info[n].value.data.darray->array, chain->naffected * sizeof(pmix_proc_t)); + } + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + rc = PMIX_ERR_NOMEM; + goto cleanup; } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); } } @@ -425,7 +385,7 @@ static void progress_local_event_hdlr(pmix_status_t status, } while (pmix_list_get_end(&pmix_globals.events.multi_events) != (item = pmix_list_get_next(item))) { nxt = (pmix_event_hdlr_t*)item; - if (!pmix_notify_check_range(&nxt->rng, &chain->source) && + if (!pmix_notify_check_range(&nxt->rng, &chain->source) || !pmix_notify_check_affected(nxt->affected, nxt->naffected, chain->affected, chain->naffected)) { continue; @@ -623,10 +583,17 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) goto complete; } - /* check for directives */ - for (i=0; i < chain->ninfo; i++) { - if (0 == strncmp(chain->info[i].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - chain->nondefault = true; + /* if we are not a target, then we can simply ignore this event */ + if (NULL != chain->targets) { + found = false; + for (i=0; i < chain->ntargets; i++) { + if (PMIX_CHECK_PROCID(&chain->targets[i], &pmix_globals.myid)) { + found = true; + break; + } + } + if (!found) { + goto complete; } } @@ -815,7 +782,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (0 < cd->ninfo) { /* check for caching instructions */ for (n=0; n < cd->ninfo; n++) { - if (0 == strncmp(cd->info[n].key, PMIX_EVENT_DO_NOT_CACHE, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&cd->info[n], PMIX_EVENT_DO_NOT_CACHE)) { if (PMIX_INFO_TRUE(&cd->info[n])) { holdcd = false; } @@ -837,6 +804,59 @@ static void _notify_client_event(int sd, short args, void *cbdata) } } + /* we may also have registered for events, so setup to check this + * against our registrations */ + chain = PMIX_NEW(pmix_event_chain_t); + chain->status = cd->status; + (void)strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN); + chain->source.rank = cd->source.rank; + /* we always leave space for a callback object and + * the evhandler name. */ + chain->nallocated = cd->ninfo + 2; + PMIX_INFO_CREATE(chain->info, chain->nallocated); + /* prep the chain for processing */ + pmix_prep_event_chain(chain, cd->info, cd->ninfo, true); + + if (0 < cd->ninfo) { + /* copy setup to the cd object */ + cd->nondefault = chain->nondefault; + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + /* notify the caller */ + if (NULL != cd->cbfunc) { + cd->cbfunc(PMIX_ERR_NOMEM, cd->cbdata); + } + PMIX_RELEASE(cd); + PMIX_RELEASE(chain); + return; + } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); + } + } + + /* if they provided a PMIX_EVENT_CUSTOM_RANGE info object but + * specified a range other than PMIX_RANGE_CUSTOM, then this + * is an error */ + if (PMIX_RANGE_CUSTOM != cd->range && NULL != cd->targets) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + /* notify the caller */ + if (NULL != cd->cbfunc) { + cd->cbfunc(PMIX_ERR_BAD_PARAM, cd->cbdata); + } + PMIX_RELEASE(cd); + PMIX_RELEASE(chain); + return; + } + + holdcd = false; if (PMIX_RANGE_PROC_LOCAL != cd->range) { PMIX_CONSTRUCT(&trk, pmix_list_t); @@ -849,8 +869,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) /* if this client was the source of the event, then * don't send it back as they will have processed it * when they generated it */ - if (0 == strncmp(cd->source.nspace, pr->peer->info->pname.nspace, PMIX_MAX_NSLEN) && - cd->source.rank == pr->peer->info->pname.rank) { + if (PMIX_CHECK_PROCID(&cd->source, &pr->peer->info->pname)) { continue; } /* if we have already notified this client, then don't do it again */ @@ -868,11 +887,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (NULL != cd->targets) { matched = false; for (n=0; n < cd->ntargets; n++) { - if (0 != strncmp(pr->peer->info->pname.nspace, cd->targets[n].nspace, PMIX_MAX_NSLEN)) { - continue; - } - if (PMIX_RANK_WILDCARD == cd->targets[n].rank || - pr->peer->info->pname.rank == cd->targets[n].rank) { + if (PMIX_CHECK_PROCID(&pr->peer->info->pname, &cd->targets[n])) { matched = true; break; } @@ -940,9 +955,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) } } PMIX_LIST_DESTRUCT(&trk); - if (PMIX_RANGE_LOCAL != cd->range && - 0 == strncmp(cd->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN) && - cd->source.rank == pmix_globals.myid.rank) { + if (PMIX_RANGE_LOCAL != cd->range && PMIX_CHECK_PROCID(&cd->source, &pmix_globals.myid)) { /* if we are the source, then we need to post this upwards as * well so the host RM can broadcast it as necessary - we rely * on the host RM to _not_ deliver this back to us! */ @@ -953,85 +966,10 @@ static void _notify_client_event(int sd, short args, void *cbdata) pmix_host_server.notify_event(cd->status, &cd->source, cd->range, cd->info, cd->ninfo, local_cbfunc, cd); } - } } - /* we may also have registered for events, so be sure to check this - * against our registrations */ - chain = PMIX_NEW(pmix_event_chain_t); - chain->status = cd->status; - (void)strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN); - chain->source.rank = cd->source.rank; - /* we always leave space for a callback object and - * the evhandler name. */ - chain->nallocated = cd->ninfo + 2; - PMIX_INFO_CREATE(chain->info, chain->nallocated); - if (0 < cd->ninfo) { - chain->ninfo = cd->ninfo; - /* need to copy the info */ - for (n=0; n < cd->ninfo; n++) { - PMIX_INFO_XFER(&chain->info[n], &cd->info[n]); - if (0 == strncmp(cd->info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - cd->nondefault = true; - chain->nondefault = true; - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_CUSTOM_RANGE, PMIX_MAX_KEYLEN)) { - /* provides an array of pmix_proc_t identifying the procs - * that are to receive this notification, or a single pmix_proc_t */ - if (PMIX_DATA_ARRAY == cd->info[n].value.type && - NULL != cd->info[n].value.data.darray && - NULL != cd->info[n].value.data.darray->array) { - cd->ntargets = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, cd->info[n].value.data.darray->array, cd->ntargets * sizeof(pmix_proc_t)); - } else if (PMIX_PROC == cd->info[n].value.type) { - cd->ntargets = 1; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - } else { - /* this is an error */ - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - PMIX_RELEASE(chain); - return; - } - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { - PMIX_PROC_CREATE(cd->affected, 1); - if (NULL == cd->affected) { - PMIX_RELEASE(chain); - return; - } - cd->naffected = 1; - memcpy(cd->affected, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - /* need to do the same for chain so it can be correctly processed */ - PMIX_PROC_CREATE(chain->affected, 1); - if (NULL == chain->affected) { - PMIX_RELEASE(chain); - return; - } - chain->naffected = 1; - memcpy(chain->affected, cd->info[n].value.data.proc, sizeof(pmix_proc_t)); - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) { - cd->naffected = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(cd->affected, cd->naffected); - if (NULL == cd->affected) { - cd->naffected = 0; - PMIX_RELEASE(chain); - return; - } - memcpy(cd->affected, cd->info[n].value.data.darray->array, cd->naffected * sizeof(pmix_proc_t)); - /* need to do the same for chain so it can be correctly processed */ - chain->naffected = cd->info[n].value.data.darray->size; - PMIX_PROC_CREATE(chain->affected, chain->naffected); - if (NULL == chain->affected) { - chain->naffected = 0; - PMIX_RELEASE(chain); - return; - } - memcpy(chain->affected, cd->info[n].value.data.darray->array, chain->naffected * sizeof(pmix_proc_t)); - } - } - } - /* process it */ + /* process it ourselves */ pmix_invoke_local_event_hdlr(chain); if (!holdcd) { @@ -1054,7 +992,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_notify_caddy_t *cd; @@ -1064,6 +1002,11 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, "pmix_server: notify client of event %s", PMIx_Error_string(status)); + /* check for prior processing */ + if (NULL != info && PMIX_CHECK_KEY(&info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY)) { + return PMIX_OPERATION_SUCCEEDED; + } + cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; if (NULL == source) { @@ -1084,51 +1027,6 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, } } - /* check for directives */ - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - cd->nondefault = true; - } else if (0 == strncmp(info[n].key, PMIX_EVENT_CUSTOM_RANGE, PMIX_MAX_KEYLEN)) { - /* provides an array of pmix_proc_t identifying the procs - * that are to receive this notification, or a single pmix_proc_t */ - if (PMIX_DATA_ARRAY == info[n].value.type && - NULL != info[n].value.data.darray && - NULL != info[n].value.data.darray->array) { - cd->ntargets = info[n].value.data.darray->size; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, info[n].value.data.darray->array, cd->ntargets * sizeof(pmix_proc_t)); - } else if (PMIX_PROC == info[n].value.type) { - cd->ntargets = 1; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, info[n].value.data.proc, sizeof(pmix_proc_t)); - } else { - /* this is an error */ - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - return PMIX_ERR_BAD_PARAM; - } - } - } - } - - /* - * If the range is PMIX_RANGE_NAMESPACE, then they should not have set a - * PMIX_EVENT_CUSTOM_RANGE info object or at least we should ignore it - */ - if (PMIX_RANGE_NAMESPACE == cd->range) { - if (cd->targets) { - PMIX_PROC_FREE(cd->targets, cd->ntargets); - } - PMIX_PROC_CREATE(cd->targets, 1); - cd->ntargets = 1; - cd->targets[0].rank = PMIX_RANK_WILDCARD; - if (NULL == source) { - strncpy(cd->targets[0].nspace, "UNDEF", PMIX_MAX_NSLEN); - } else { - strncpy(cd->targets[0].nspace, source->nspace, PMIX_MAX_NSLEN); - } - } - /* track the eventual callback info */ cd->cbfunc = cbfunc; cd->cbdata = cbdata; @@ -1246,6 +1144,65 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg) } } +pmix_status_t pmix_prep_event_chain(pmix_event_chain_t *chain, + const pmix_info_t *info, size_t ninfo, + bool xfer) +{ + size_t n; + + if (NULL != info && 0 < ninfo) { + chain->ninfo = ninfo; + if (NULL == chain->info) { + PMIX_INFO_CREATE(chain->info, chain->ninfo); + } + /* need to copy the info */ + for (n=0; n < ninfo; n++) { + if (xfer) { + /* chain doesn't already have a copy of the info */ + PMIX_INFO_XFER(&chain->info[n], &info[n]); + } + /* look for specific directives */ + if (0 == strncmp(info[n].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { + chain->nondefault = PMIX_INFO_TRUE(&info[n]); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_CUSTOM_RANGE)) { + /* provides an array of pmix_proc_t identifying the procs + * that are to receive this notification, or a single pmix_proc_t */ + if (PMIX_DATA_ARRAY == info[n].value.type && + NULL != info[n].value.data.darray && + NULL != info[n].value.data.darray->array) { + chain->ntargets = info[n].value.data.darray->size; + PMIX_PROC_CREATE(chain->targets, chain->ntargets); + memcpy(chain->targets, info[n].value.data.darray->array, chain->ntargets * sizeof(pmix_proc_t)); + } else if (PMIX_PROC == info[n].value.type) { + chain->ntargets = 1; + PMIX_PROC_CREATE(chain->targets, chain->ntargets); + memcpy(chain->targets, info[n].value.data.proc, sizeof(pmix_proc_t)); + } else { + /* this is an error */ + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_AFFECTED_PROC)) { + PMIX_PROC_CREATE(chain->affected, 1); + if (NULL == chain->affected) { + return PMIX_ERR_NOMEM; + } + chain->naffected = 1; + memcpy(chain->affected, info[n].value.data.proc, sizeof(pmix_proc_t)); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_AFFECTED_PROCS)) { + chain->naffected = info[n].value.data.darray->size; + PMIX_PROC_CREATE(chain->affected, chain->naffected); + if (NULL == chain->affected) { + chain->naffected = 0; + return PMIX_ERR_NOMEM; + } + memcpy(chain->affected, info[n].value.data.darray->array, chain->naffected * sizeof(pmix_proc_t)); + } + } + } + return PMIX_SUCCESS; +} + /**** CLASS INSTANTIATIONS ****/ static void sevcon(pmix_event_hdlr_t *p) @@ -1328,6 +1285,8 @@ static void chcon(pmix_event_chain_t *p) p->source.rank = PMIX_RANK_UNDEF; p->nondefault = false; p->endchain = false; + p->targets = NULL; + p->ntargets = 0; p->range = PMIX_RANGE_UNDEF; p->affected = NULL; p->naffected = 0; @@ -1345,6 +1304,9 @@ static void chdes(pmix_event_chain_t *p) if (p->timer_active) { pmix_event_del(&p->ev); } + if (NULL != p->targets) { + PMIX_PROC_FREE(p->targets, p->ntargets); + } if (NULL != p->affected) { PMIX_PROC_FREE(p->affected, p->naffected); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c index ab4f9ce3f02..914e895a40a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c @@ -6,7 +6,7 @@ * Copyright (c) 2011-2012 Los Alamos National Security, LLC. * All rights reserved. * - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -258,7 +258,9 @@ static pmix_status_t stop(pmix_peer_t *requestor, char *id) cd = PMIX_NEW(file_caddy_t); PMIX_RETAIN(requestor); cd->requestor = requestor; - cd->id = strdup(id); + if (NULL != id) { + cd->id = strdup(id); + } /* need to push into our event base to add this to our trackers */ pmix_event_assign(&cd->ev, pmix_psensor_base.evbase, -1, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c index 0018284dcfb..f88ef0cdb69 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c @@ -63,6 +63,7 @@ typedef struct { pmix_data_range_t range; pmix_info_t *info; size_t ninfo; + bool stopped; } pmix_heartbeat_trkr_t; static void ft_constructor(pmix_heartbeat_trkr_t *ft) @@ -79,6 +80,7 @@ static void ft_constructor(pmix_heartbeat_trkr_t *ft) ft->range = PMIX_RANGE_NAMESPACE; ft->info = NULL; ft->ninfo = 0; + ft->stopped = false; } static void ft_destructor(pmix_heartbeat_trkr_t *ft) { @@ -251,7 +253,9 @@ static pmix_status_t heartbeat_stop(pmix_peer_t *requestor, char *id) cd = PMIX_NEW(heartbeat_caddy_t); PMIX_RETAIN(requestor); cd->requestor = requestor; - cd->id = strdup(id); + if (NULL != id) { + cd->id = strdup(id); + } /* need to push into our event base to remove this from our trackers */ pmix_event_assign(&cd->ev, pmix_psensor_base.evbase, -1, @@ -266,7 +270,7 @@ static void opcbfunc(pmix_status_t status, void *cbdata) { pmix_heartbeat_trkr_t *ft = (pmix_heartbeat_trkr_t*)cbdata; - PMIX_RELEASE(ft); + PMIX_RELEASE(ft); // maintain accounting } /* this function automatically gets periodically called @@ -286,23 +290,25 @@ static void check_heartbeat(int fd, short dummy, void *cbdata) pmix_globals.myid.nspace, pmix_globals.myid.rank, ft->requestor->info->pname.nspace, ft->requestor->info->pname.rank)); - if (0 == ft->nbeats) { + if (0 == ft->nbeats && !ft->stopped) { /* no heartbeat recvd in last window */ PMIX_OUTPUT_VERBOSE((1, pmix_psensor_base_framework.framework_output, "[%s:%d] sensor:check_heartbeat failed for proc %s:%d", pmix_globals.myid.nspace, pmix_globals.myid.rank, ft->requestor->info->pname.nspace, ft->requestor->info->pname.rank)); - /* stop monitoring this client */ - pmix_list_remove_item(&mca_psensor_heartbeat_component.trackers, &ft->super); /* generate an event */ (void)strncpy(source.nspace, ft->requestor->info->pname.nspace, PMIX_MAX_NSLEN); source.rank = ft->requestor->info->pname.rank; + /* ensure the tracker remains throughout the process */ + PMIX_RETAIN(ft); + /* mark that the process appears stopped so we don't + * continue to report it */ + ft->stopped = true; rc = PMIx_Notify_event(PMIX_MONITOR_HEARTBEAT_ALERT, &source, ft->range, ft->info, ft->ninfo, opcbfunc, ft); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } - return; } else { PMIX_OUTPUT_VERBOSE((1, pmix_psensor_base_framework.framework_output, "[%s:%d] sensor:check_heartbeat detected %d beats for proc %s:%d", @@ -328,6 +334,8 @@ static void add_beat(int sd, short args, void *cbdata) if (ft->requestor == b->peer) { /* increment the beat count */ ++ft->nbeats; + /* ensure we know that the proc is alive */ + ft->stopped = false; break; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 5a59300533b..b70da16a365 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -45,6 +45,7 @@ #include "src/server/pmix_server_ops.h" #include "src/util/error.h" #include "src/util/show_help.h" +#include "src/mca/psensor/psensor.h" #include "src/mca/ptl/base/base.h" @@ -148,6 +149,9 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) } } } + /* cleanup any sensors that are monitoring them */ + pmix_psensor.stop(peer, NULL); + if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer)) { /* if this peer already called finalize, then * we are just seeing their connection go away diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index 53765bdf123..43fb426acb9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -1004,7 +1004,7 @@ static pmix_status_t recv_connect_ack(int sd) /* get the current timeout value so we can reset to it */ sz = sizeof(save); if (0 != getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void*)&save, &sz)) { - if (ENOPROTOOPT == errno) { + if (ENOPROTOOPT == errno || EOPNOTSUPP == errno) { sockopt = false; } else { return PMIX_ERR_UNREACH; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c index 4d5afaa94d3..fcb15b01517 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c @@ -393,7 +393,7 @@ static pmix_status_t recv_connect_ack(int sd) /* get the current timeout value so we can reset to it */ sz = sizeof(save); if (0 != getsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, (void*)&save, &sz)) { - if (ENOPROTOOPT == errno) { + if (ENOPROTOOPT == errno || EOPNOTSUPP == errno) { sockopt = false; } else { return PMIX_ERR_UNREACH; diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index ea80c46e3ac..075c877bc1f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -1071,6 +1071,7 @@ static void _deregister_client(int sd, short args, void *cbdata) * for tools, so don't clean them up */ if (!PMIX_PROC_IS_TOOL(peer)) { pmix_pnet.child_finalized(&cd->proc); + pmix_psensor.stop(peer, NULL); } } if (nptr->nlocalprocs == nptr->nfinalized) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 31dd62cbc7b..7293c6e155f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -1933,6 +1933,47 @@ static void local_cbfunc(pmix_status_t status, void *cbdata) PMIX_RELEASE(cd); } +static void intermed_step(pmix_status_t status, void *cbdata) +{ + pmix_notify_caddy_t *cd = (pmix_notify_caddy_t*)cbdata; + pmix_status_t rc; + + if (PMIX_SUCCESS != status) { + rc = status; + goto complete; + } + + /* check the range directive - if it is LOCAL, then we are + * done. Otherwise, it needs to go up to our + * host for dissemination */ + if (PMIX_RANGE_LOCAL == cd->range) { + rc = PMIX_SUCCESS; + goto complete; + } + + if (NULL == pmix_host_server.notify_event) { + rc = PMIX_ERR_NOT_SUPPORTED; + goto complete; + } + + /* pass it to our host RM for distribution */ + rc = pmix_host_server.notify_event(cd->status, &cd->source, cd->range, + cd->info, cd->ninfo, local_cbfunc, cd); + if (PMIX_SUCCESS == rc) { + /* let the callback function respond for us */ + return; + } + if (PMIX_OPERATION_SUCCEEDED == rc) { + rc = PMIX_SUCCESS; // local_cbfunc will not be called + } + + complete: + if (NULL != cd->cbfunc) { + cd->cbfunc(rc, cd->cbdata); + } + PMIX_RELEASE(cd); +} + pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_op_cbfunc_t cbfunc, @@ -1941,13 +1982,11 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, int32_t cnt; pmix_status_t rc; pmix_notify_caddy_t *cd; + size_t ninfo; pmix_output_verbose(2, pmix_server_globals.event_output, - "recvd event notification from client"); - - if (NULL == pmix_host_server.notify_event) { - return PMIX_ERR_NOT_SUPPORTED; - } + "%s:%d recvd event notification from client", + pmix_globals.myid.nspace, pmix_globals.myid.rank); cd = PMIX_NEW(pmix_notify_caddy_t); if (NULL == cd) { @@ -1977,44 +2016,36 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, /* unpack the info keys */ cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, buf, &cd->ninfo, &cnt, PMIX_SIZE); + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto exit; } - if (0 < cd->ninfo) { - PMIX_INFO_CREATE(cd->info, cd->ninfo); - if (NULL == cd->info) { - rc = PMIX_ERR_NOMEM; - goto exit; - } - cnt = cd->ninfo; + cd->ninfo = ninfo + 1; + PMIX_INFO_CREATE(cd->info, cd->ninfo); + if (NULL == cd->info) { + rc = PMIX_ERR_NOMEM; + goto exit; + } + if (0 < ninfo) { + cnt = ninfo; PMIX_BFROPS_UNPACK(rc, peer, buf, cd->info, &cnt, PMIX_INFO); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto exit; } } - - /* check the range directive - if it is LOCAL, then we just - * process it ourselves. Otherwise, it needs to go up to our - * host for dissemination */ - if (PMIX_RANGE_LOCAL == cd->range) { - if (PMIX_SUCCESS != (rc = pmix_server_notify_client_of_event(cd->status, - &cd->source, - cd->range, - cd->info, cd->ninfo, - local_cbfunc, cd))) { - goto exit; - } - return PMIX_SUCCESS; + /* add an info object to mark that we recvd this internally */ + PMIX_INFO_LOAD(&cd->info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY, NULL, PMIX_BOOL); + /* process it */ + if (PMIX_SUCCESS != (rc = pmix_server_notify_client_of_event(cd->status, + &cd->source, + cd->range, + cd->info, cd->ninfo, + intermed_step, cd))) { + goto exit; } - - /* when we receive an event from a client, we just pass it to - * our host RM for distribution - if any targeted recipients - * are local to us, the host RM will let us know */ - pmix_host_server.notify_event(cd->status, &cd->source, cd->range, - cd->info, cd->ninfo, local_cbfunc, cd); + /* tell the switchyard we will handle it from here */ return PMIX_SUCCESS; exit: diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index ae9b331eab1..28d35d301d8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -162,30 +162,9 @@ static void pmix_tool_notify_recv(struct pmix_peer_t *peer, PMIX_RELEASE(chain); goto error; } - /* check for directives */ - for (cnt=0; cnt < (int)ninfo; cnt++) { - if (0 == strncmp(chain->info[cnt].key, PMIX_EVENT_NON_DEFAULT, PMIX_MAX_KEYLEN)) { - chain->nondefault = PMIX_INFO_TRUE(&chain->info[cnt]); - } else if (0 == strncmp(chain->info[cnt].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { - PMIX_PROC_CREATE(chain->affected, 1); - if (NULL == chain->affected) { - PMIX_RELEASE(chain); - goto error; - } - chain->naffected = 1; - memcpy(chain->affected, chain->info[cnt].value.data.proc, sizeof(pmix_proc_t)); - } else if (0 == strncmp(chain->info[cnt].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) { - chain->naffected = chain->info[cnt].value.data.darray->size; - PMIX_PROC_CREATE(chain->affected, chain->naffected); - if (NULL == chain->affected) { - chain->naffected = 0; - PMIX_RELEASE(chain); - goto error; - } - memcpy(chain->affected, chain->info[cnt].value.data.darray->array, chain->naffected * sizeof(pmix_proc_t)); - } - } } + /* prep the chain for processing */ + pmix_prep_event_chain(chain, chain->info, ninfo, false); pmix_output_verbose(2, pmix_client_globals.event_output, "[%s:%d] pmix:tool_notify_recv - processing event %s from source %s:%d, calling errhandler", diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/error.c b/opal/mca/pmix/pmix3x/pmix/src/util/error.c index 452582407b2..fddf8e4b670 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/error.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/error.c @@ -202,7 +202,8 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) return "LAUNCHER-READY"; case PMIX_OPERATION_IN_PROGRESS: return "OPERATION-IN-PROGRESS"; - + case PMIX_PROC_TERMINATED: + return "PROC-TERMINATED"; case PMIX_ERR_NODE_DOWN: return "NODE-DOWN"; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/path.c b/opal/mca/pmix/pmix3x/pmix/src/util/path.c index ad7e911a46d..8705759c3b9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/path.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/path.c @@ -15,6 +15,8 @@ * All rights reserved. * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 University of Houston. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -54,9 +56,6 @@ #ifdef HAVE_SYS_STATVFS_H #include #endif -#ifdef HAVE_SYS_MOUNT_H -#include -#endif #ifdef HAVE_MNTENT_H #include #endif diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index cabc54bca0c..fa7d3fb9337 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -317,6 +317,17 @@ static void model_registration_callback(pmix_status_t status, DEBUG_WAKEUP_THREAD(lock); } +static void set_handler_default(int sig) +{ + struct sigaction act; + + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + sigemptyset(&act.sa_mask); + + sigaction(sig, &act, (struct sigaction *)0); +} + int main(int argc, char **argv) { char **client_env=NULL; @@ -570,14 +581,22 @@ int main(int argc, char **argv) PMIx_server_finalize(); return -1; } - child = PMIX_NEW(wait_tracker_t); - child->pid = pid; - pmix_list_append(&children, &child->super); - if (pid == 0) { + sigset_t sigs; + set_handler_default(SIGTERM); + set_handler_default(SIGINT); + set_handler_default(SIGHUP); + set_handler_default(SIGPIPE); + set_handler_default(SIGCHLD); + sigprocmask(0, 0, &sigs); + sigprocmask(SIG_UNBLOCK, &sigs, 0); execve(executable, client_argv, client_env); /* Does not return */ exit(0); + } else { + child = PMIX_NEW(wait_tracker_t); + child->pid = pid; + pmix_list_append(&children, &child->super); } } free(executable); @@ -596,8 +615,7 @@ int main(int argc, char **argv) n=0; PMIX_LIST_FOREACH(child, &children, wait_tracker_t) { if (0 != child->exit_code) { - fprintf(stderr, "Child %d exited with status %d - test FAILED\n", n, child->exit_code); - goto done; + fprintf(stderr, "Child %d [%d] exited with status %d - test FAILED\n", n, child->pid, child->exit_code); } ++n; } @@ -1024,7 +1042,8 @@ static pmix_status_t notify_event(pmix_status_t code, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { - return PMIX_SUCCESS; + pmix_output(0, "SERVER: NOTIFY EVENT"); + return PMIX_OPERATION_SUCCEEDED; } typedef struct query_data_t { @@ -1147,8 +1166,9 @@ static void wait_signal_callback(int fd, short event, void *arg) exit_code = status; } --wakeup; - break; + return; } } } + fprintf(stderr, "ENDLOOP\n"); } From 547b7da6642afbb867188a190a884ae6ac9409fa Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Tue, 18 Sep 2018 09:36:36 +0300 Subject: [PATCH 085/674] rpmbuild: fix rpmtopdir redefinition Erasing this variable by default makes outside definition useless. Signed-off-by: Andrey Maslennikov (cherry picked from commit c7d51a3a837206cb4dc2ca8aa15d5b8f59598db4) --- contrib/dist/linux/buildrpm.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/dist/linux/buildrpm.sh b/contrib/dist/linux/buildrpm.sh index 84a9045b39c..b4f2f18f744 100755 --- a/contrib/dist/linux/buildrpm.sh +++ b/contrib/dist/linux/buildrpm.sh @@ -267,7 +267,6 @@ fi # Find where the top RPM-building directory is # -rpmtopdir= file=~/.rpmmacros if test -r $file; then rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"} From 3cace87749f2de3ace665e3745d9d7b69b13f5de Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 10 Jul 2018 14:29:43 +0300 Subject: [PATCH 086/674] MCA/COMMON/UCX: del_procs calls are unified to common module Signed-off-by: Sergey Oblomov (cherry picked from commit 920cc2e0d9994dfd49062822c89cb502274eb464) --- ompi/mca/pml/ucx/pml_ucx.c | 68 +++++----------------------- opal/mca/common/ucx/common_ucx.c | 65 ++++++++++++++++++++++++++ opal/mca/common/ucx/common_ucx.h | 7 +++ oshmem/mca/spml/ucx/spml_ucx.c | 78 +++++++------------------------- 4 files changed, 100 insertions(+), 118 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 2286f5f3df6..9cf9ff98c78 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -368,78 +368,32 @@ static inline ucp_ep_h mca_pml_ucx_get_ep(ompi_communicator_t *comm, int rank) return NULL; } -static void mca_pml_ucx_waitall(void **reqs, int *count_p) -{ - int i; - - PML_UCX_VERBOSE(2, "waiting for %d disconnect requests", *count_p); - for (i = 0; i < *count_p; ++i) { - opal_common_ucx_wait_request(reqs[i], ompi_pml_ucx.ucp_worker, "ucp_disconnect_nb"); - reqs[i] = NULL; - } - - *count_p = 0; -} - int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) { ompi_proc_t *proc; - int num_reqs; - size_t max_reqs; - void *dreq, **dreqs; - ucp_ep_h ep; + opal_common_ucx_del_proc_t *del_procs; size_t i; int ret; - max_reqs = ompi_pml_ucx.num_disconnect; - if (max_reqs > nprocs) { - max_reqs = nprocs; - } - - dreqs = malloc(sizeof(*dreqs) * max_reqs); - if (dreqs == NULL) { + del_procs = malloc(sizeof(*del_procs) * nprocs); + if (del_procs == NULL) { return OMPI_ERR_OUT_OF_RESOURCE; } - num_reqs = 0; - for (i = 0; i < nprocs; ++i) { - proc = procs[(i + OMPI_PROC_MY_NAME->vpid) % nprocs]; - ep = proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PML]; - if (ep == NULL) { - continue; - } + proc = procs[i]; + del_procs[i].ep = proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PML]; + del_procs[i].vpid = proc->super.proc_name.vpid; + /* mark peer as disconnected */ proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PML] = NULL; - - PML_UCX_VERBOSE(2, "disconnecting from rank %d", proc->super.proc_name.vpid); - dreq = ucp_disconnect_nb(ep); - if (dreq != NULL) { - if (UCS_PTR_IS_ERR(dreq)) { - PML_UCX_ERROR("ucp_disconnect_nb(%d) failed: %s", - proc->super.proc_name.vpid, - ucs_status_string(UCS_PTR_STATUS(dreq))); - continue; - } else { - dreqs[num_reqs++] = dreq; - if (num_reqs >= ompi_pml_ucx.num_disconnect) { - mca_pml_ucx_waitall(dreqs, &num_reqs); - } - } - } } - /* num_reqs == 0 is processed by mca_pml_ucx_waitall routine, - * so suppress coverity warning */ - /* coverity[uninit_use_in_call] */ - mca_pml_ucx_waitall(dreqs, &num_reqs); - free(dreqs); - if (OMPI_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence( - ompi_pml_ucx.ucp_worker))) { - return ret; - } + ret = opal_common_ucx_del_procs(del_procs, nprocs, OMPI_PROC_MY_NAME->vpid, + ompi_pml_ucx.num_disconnect, ompi_pml_ucx.ucp_worker); + free(del_procs); - return OMPI_SUCCESS; + return ret; } int mca_pml_ucx_enable(bool enable) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index cff39971b46..ad25108ae7c 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -140,3 +140,68 @@ OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker) return ret; } + +static void opal_common_ucx_wait_all_requests(void **reqs, int count, ucp_worker_h worker) +{ + int i; + + MCA_COMMON_UCX_VERBOSE(2, "waiting for %d disconnect requests", count); + for (i = 0; i < count; ++i) { + opal_common_ucx_wait_request(reqs[i], worker, "ucp_disconnect_nb"); + reqs[i] = NULL; + } +} + +OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count, + size_t my_rank, size_t max_disconnect, ucp_worker_h worker) +{ + size_t num_reqs; + size_t max_reqs; + void *dreq, **dreqs; + size_t i; + size_t n; + + MCA_COMMON_UCX_ASSERT(procs || !count); + MCA_COMMON_UCX_ASSERT(max_disconnect > 0); + + max_reqs = (max_disconnect > count) ? count : max_disconnect; + + dreqs = malloc(sizeof(*dreqs) * max_reqs); + if (dreqs == NULL) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + num_reqs = 0; + + for (i = 0; i < count; ++i) { + n = (i + my_rank) % count; + if (procs[n].ep == NULL) { + continue; + } + + MCA_COMMON_UCX_VERBOSE(2, "disconnecting from rank %zu", procs[n].vpid); + dreq = ucp_disconnect_nb(procs[n].ep); + if (dreq != NULL) { + if (UCS_PTR_IS_ERR(dreq)) { + MCA_COMMON_UCX_ERROR("ucp_disconnect_nb(%zu) failed: %s", procs[n].vpid, + ucs_status_string(UCS_PTR_STATUS(dreq))); + continue; + } else { + dreqs[num_reqs++] = dreq; + if (num_reqs >= max_disconnect) { + opal_common_ucx_wait_all_requests(dreqs, num_reqs, worker); + num_reqs = 0; + } + } + } + } + /* num_reqs == 0 is processed by opal_common_ucx_wait_all_requests routine, + * so suppress coverity warning */ + /* coverity[uninit_use_in_call] */ + opal_common_ucx_wait_all_requests(dreqs, num_reqs, worker); + free(dreqs); + + opal_common_ucx_mca_pmix_fence(worker); + + return OPAL_SUCCESS; +} diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 2a2a826b699..6825e4de642 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -87,6 +87,11 @@ typedef struct opal_common_ucx_module { bool opal_mem_hooks; } opal_common_ucx_module_t; +typedef struct opal_common_ucx_del_proc { + ucp_ep_h ep; + size_t vpid; +} opal_common_ucx_del_proc_t; + extern opal_common_ucx_module_t opal_common_ucx; OPAL_DECLSPEC void opal_common_ucx_mca_register(void); @@ -94,6 +99,8 @@ OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void); OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status); OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component); +OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count, + size_t my_rank, size_t max_disconnect, ucp_worker_h worker); static inline ucs_status_t opal_common_ucx_request_status(ucs_status_ptr_t request) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 489f314b10e..67bfc7ceabe 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -103,28 +103,10 @@ int mca_spml_ucx_enable(bool enable) return OSHMEM_SUCCESS; } - -static void mca_spml_ucx_waitall(void **reqs, int *count_p) -{ - int i; - - SPML_UCX_VERBOSE(10, "waiting for %d disconnect requests", *count_p); - for (i = 0; i < *count_p; ++i) { - opal_common_ucx_wait_request(reqs[i], mca_spml_ucx_ctx_default.ucp_worker, "ucp_disconnect_nb"); - reqs[i] = NULL; - } - - *count_p = 0; -} - int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) { - int my_rank = oshmem_my_proc_id(); - int num_reqs; - size_t max_reqs; - void *dreq, **dreqs; - ucp_ep_h ep; - size_t i, n; + opal_common_ucx_del_proc_t *del_procs; + size_t i; int ret; oshmem_shmem_barrier(); @@ -133,56 +115,30 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) return OSHMEM_SUCCESS; } - max_reqs = mca_spml_ucx.num_disconnect; - if (max_reqs > nprocs) { - max_reqs = nprocs; - } - - dreqs = malloc(sizeof(*dreqs) * max_reqs); - if (dreqs == NULL) { + del_procs = malloc(sizeof(*del_procs) * nprocs); + if (del_procs == NULL) { return OMPI_ERR_OUT_OF_RESOURCE; } - num_reqs = 0; - for (i = 0; i < nprocs; ++i) { - n = (i + my_rank) % nprocs; - ep = mca_spml_ucx_ctx_default.ucp_peers[n].ucp_conn; - if (ep == NULL) { - continue; - } + del_procs[i].ep = mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn; + del_procs[i].vpid = i; - mca_spml_ucx_ctx_default.ucp_peers[n].ucp_conn = NULL; - - SPML_UCX_VERBOSE(10, "disconnecting from peer %zu", n); - dreq = ucp_disconnect_nb(ep); - if (dreq != NULL) { - if (UCS_PTR_IS_ERR(dreq)) { - SPML_UCX_ERROR("ucp_disconnect_nb(%zu) failed: %s", n, - ucs_status_string(UCS_PTR_STATUS(dreq))); - continue; - } else { - dreqs[num_reqs++] = dreq; - if (num_reqs >= mca_spml_ucx.num_disconnect) { - mca_spml_ucx_waitall(dreqs, &num_reqs); - } - } - } + /* mark peer as disconnected */ + mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn = NULL; } - /* num_reqs == 0 is processed by mca_pml_ucx_waitall routine, - * so suppress coverity warning */ - /* coverity[uninit_use_in_call] */ - mca_spml_ucx_waitall(dreqs, &num_reqs); - free(dreqs); - free(mca_spml_ucx.remote_addrs_tbl); - if (OSHMEM_SUCCESS != (ret = opal_common_ucx_mca_pmix_fence( - mca_spml_ucx_ctx_default.ucp_worker))) { - return ret; - } + ret = opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), + mca_spml_ucx.num_disconnect, + mca_spml_ucx_ctx_default.ucp_worker); + + free(del_procs); + free(mca_spml_ucx.remote_addrs_tbl); free(mca_spml_ucx_ctx_default.ucp_peers); + mca_spml_ucx_ctx_default.ucp_peers = NULL; - return OSHMEM_SUCCESS; + + return ret; } /* TODO: move func into common place, use it with rkey exchng too */ From 01d4d525883eb757200141cf81b0eaf6122b8229 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 19 Sep 2018 08:35:05 -0600 Subject: [PATCH 087/674] SCIF: remove it KNC is effectively dead. Remove corresponding SCIF support in Open MPI. cherry pick of PR #5737 + news update Signed-off-by: Howard Pritchard (cherry picked from commit b9ac3d8931c38661132544d59be085a50df01420) --- NEWS | 1 + README | 4 - contrib/Makefile.am | 4 - contrib/platform/lanl/darwin/debug-mic.conf | 100 ----- contrib/platform/lanl/darwin/debug.conf | 4 +- .../platform/lanl/darwin/optimized-mic.conf | 100 ----- contrib/platform/lanl/darwin/optimized.conf | 4 +- opal/mca/btl/scif/Makefile.am | 50 --- opal/mca/btl/scif/btl_scif.h | 249 ----------- opal/mca/btl/scif/btl_scif_add_procs.c | 259 ------------ opal/mca/btl/scif/btl_scif_component.c | 386 ------------------ opal/mca/btl/scif/btl_scif_endpoint.c | 301 -------------- opal/mca/btl/scif/btl_scif_endpoint.h | 110 ----- opal/mca/btl/scif/btl_scif_frag.c | 31 -- opal/mca/btl/scif/btl_scif_frag.h | 95 ----- opal/mca/btl/scif/btl_scif_get.c | 75 ---- opal/mca/btl/scif/btl_scif_module.c | 308 -------------- opal/mca/btl/scif/btl_scif_put.c | 72 ---- opal/mca/btl/scif/btl_scif_send.c | 299 -------------- opal/mca/btl/scif/configure.m4 | 47 --- opal/mca/btl/scif/owner.txt | 7 - 21 files changed, 5 insertions(+), 2501 deletions(-) delete mode 100644 contrib/platform/lanl/darwin/debug-mic.conf delete mode 100644 contrib/platform/lanl/darwin/optimized-mic.conf delete mode 100644 opal/mca/btl/scif/Makefile.am delete mode 100644 opal/mca/btl/scif/btl_scif.h delete mode 100644 opal/mca/btl/scif/btl_scif_add_procs.c delete mode 100644 opal/mca/btl/scif/btl_scif_component.c delete mode 100644 opal/mca/btl/scif/btl_scif_endpoint.c delete mode 100644 opal/mca/btl/scif/btl_scif_endpoint.h delete mode 100644 opal/mca/btl/scif/btl_scif_frag.c delete mode 100644 opal/mca/btl/scif/btl_scif_frag.h delete mode 100644 opal/mca/btl/scif/btl_scif_get.c delete mode 100644 opal/mca/btl/scif/btl_scif_module.c delete mode 100644 opal/mca/btl/scif/btl_scif_put.c delete mode 100644 opal/mca/btl/scif/btl_scif_send.c delete mode 100644 opal/mca/btl/scif/configure.m4 delete mode 100644 opal/mca/btl/scif/owner.txt diff --git a/NEWS b/NEWS index 257f2d2337a..081559de83d 100644 --- a/NEWS +++ b/NEWS @@ -72,6 +72,7 @@ included in the vX.Y.Z section and be denoted as: the internal ones. - Updated internal ROMIO to 3.2.1. - Removed support for the MXM MTL. +- Removed support for SCIF. - Improved CUDA support when using UCX. - Improved support for two phase MPI I/O operations when using OMPIO. - Added support for Software-based Performance Counters, see diff --git a/README b/README index f81c5d93f92..829e1c378df 100644 --- a/README +++ b/README @@ -603,7 +603,6 @@ Network Support - Loopback (send-to-self) - Shared memory - TCP - - Intel Phi SCIF - SMCUDA - Cisco usNIC - uGNI (Cray Gemini, Aries) @@ -998,9 +997,6 @@ NETWORKING SUPPORT / OPTIONS covers most cases. This option is only needed for special configurations. ---with-scif= - Look in directory for Intel SCIF support libraries - --with-verbs= Specify the directory where the verbs (also known as OpenFabrics verbs, or Linux verbs, and previously known as OpenIB) libraries and diff --git a/contrib/Makefile.am b/contrib/Makefile.am index bf78f975ad5..029fea39def 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -88,12 +88,8 @@ EXTRA_DIST = \ platform/lanl/darwin/mic-common \ platform/lanl/darwin/debug \ platform/lanl/darwin/debug.conf \ - platform/lanl/darwin/debug-mic \ - platform/lanl/darwin/debug-mic.conf \ platform/lanl/darwin/optimized \ platform/lanl/darwin/optimized.conf \ - platform/lanl/darwin/optimized-mic \ - platform/lanl/darwin/optimized-mic.conf \ platform/snl/portals4-m5 \ platform/snl/portals4-orte \ platform/ibm/debug-ppc32-gcc \ diff --git a/contrib/platform/lanl/darwin/debug-mic.conf b/contrib/platform/lanl/darwin/debug-mic.conf deleted file mode 100644 index 20e183856f9..00000000000 --- a/contrib/platform/lanl/darwin/debug-mic.conf +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. -# All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This is the default system-wide MCA parameters defaults file. -# Specifically, the MCA parameter "mca_param_files" defaults to a -# value of -# "$HOME/.openmpi/mca-params.conf:$sysconf/openmpi-mca-params.conf" -# (this file is the latter of the two). So if the default value of -# mca_param_files is not changed, this file is used to set system-wide -# MCA parameters. This file can therefore be used to set system-wide -# default MCA parameters for all users. Of course, users can override -# these values if they want, but this file is an excellent location -# for setting system-specific MCA parameters for those users who don't -# know / care enough to investigate the proper values for them. - -# Note that this file is only applicable where it is visible (in a -# filesystem sense). Specifically, MPI processes each read this file -# during their startup to determine what default values for MCA -# parameters should be used. mpirun does not bundle up the values in -# this file from the node where it was run and send them to all nodes; -# the default value decisions are effectively distributed. Hence, -# these values are only applicable on nodes that "see" this file. If -# $sysconf is a directory on a local disk, it is likely that changes -# to this file will need to be propagated to other nodes. If $sysconf -# is a directory that is shared via a networked filesystem, changes to -# this file will be visible to all nodes that share this $sysconf. - -# The format is straightforward: one per line, mca_param_name = -# rvalue. Quoting is ignored (so if you use quotes or escape -# characters, they'll be included as part of the value). For example: - -# Disable run-time MPI parameter checking -# mpi_param_check = 0 - -# Note that the value "~/" will be expanded to the current user's home -# directory. For example: - -# Change component loading path -# component_path = /usr/local/lib/openmpi:~/my_openmpi_components - -# See "ompi_info --param all all" for a full listing of Open MPI MCA -# parameters available and their default values. -# - -# Basic behavior to smooth startup -mca_base_component_show_load_errors = 0 -opal_set_max_sys_limits = 1 -orte_report_launch_progress = 1 - -# Define timeout for daemons to report back during launch -orte_startup_timeout = 10000 - -## Protect the shared file systems -orte_no_session_dirs = /panfs,/scratch,/users,/usr/projects -orte_tmpdir_base = /tmp - -## Require an allocation to run - protects the frontend -## from inadvertent job executions -orte_allocation_required = 1 - -## Add the interface for out-of-band communication -## and set it up -oob_tcp_if_include=mic0 -oob_tcp_peer_retries = 1000 -oob_tcp_sndbuf = 32768 -oob_tcp_rcvbuf = 32768 - -## Define the MPI interconnects -btl = sm,scif,openib,self - -## Setup OpenIB - just in case -btl_openib_want_fork_support = 0 -btl_openib_receive_queues = S,4096,1024:S,12288,512:S,65536,512 - -## Enable cpu affinity -hwloc_base_binding_policy = core - -## Setup MPI options -mpi_show_handle_leaks = 1 -mpi_warn_on_fork = 1 -#mpi_abort_print_stack = 1 - diff --git a/contrib/platform/lanl/darwin/debug.conf b/contrib/platform/lanl/darwin/debug.conf index 35b4fc9c579..a28026cc4ba 100644 --- a/contrib/platform/lanl/darwin/debug.conf +++ b/contrib/platform/lanl/darwin/debug.conf @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. +# Copyright (c) 2011-2018 Los Alamos National Security, LLC. # All rights reserved. # $COPYRIGHT$ # @@ -84,7 +84,7 @@ oob_tcp_sndbuf = 32768 oob_tcp_rcvbuf = 32768 ## Define the MPI interconnects -btl = sm,scif,openib,self +btl = sm,openib,self ## Setup OpenIB - just in case btl_openib_want_fork_support = 0 diff --git a/contrib/platform/lanl/darwin/optimized-mic.conf b/contrib/platform/lanl/darwin/optimized-mic.conf deleted file mode 100644 index c59f2c233cf..00000000000 --- a/contrib/platform/lanl/darwin/optimized-mic.conf +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2005 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This is the default system-wide MCA parameters defaults file. -# Specifically, the MCA parameter "mca_param_files" defaults to a -# value of -# "$HOME/.openmpi/mca-params.conf:$sysconf/openmpi-mca-params.conf" -# (this file is the latter of the two). So if the default value of -# mca_param_files is not changed, this file is used to set system-wide -# MCA parameters. This file can therefore be used to set system-wide -# default MCA parameters for all users. Of course, users can override -# these values if they want, but this file is an excellent location -# for setting system-specific MCA parameters for those users who don't -# know / care enough to investigate the proper values for them. - -# Note that this file is only applicable where it is visible (in a -# filesystem sense). Specifically, MPI processes each read this file -# during their startup to determine what default values for MCA -# parameters should be used. mpirun does not bundle up the values in -# this file from the node where it was run and send them to all nodes; -# the default value decisions are effectively distributed. Hence, -# these values are only applicable on nodes that "see" this file. If -# $sysconf is a directory on a local disk, it is likely that changes -# to this file will need to be propagated to other nodes. If $sysconf -# is a directory that is shared via a networked filesystem, changes to -# this file will be visible to all nodes that share this $sysconf. - -# The format is straightforward: one per line, mca_param_name = -# rvalue. Quoting is ignored (so if you use quotes or escape -# characters, they'll be included as part of the value). For example: - -# Disable run-time MPI parameter checking -# mpi_param_check = 0 - -# Note that the value "~/" will be expanded to the current user's home -# directory. For example: - -# Change component loading path -# component_path = /usr/local/lib/openmpi:~/my_openmpi_components - -# See "ompi_info --param all all" for a full listing of Open MPI MCA -# parameters available and their default values. -# - -# Basic behavior to smooth startup -mca_base_component_show_load_errors = 0 -opal_set_max_sys_limits = 1 -orte_report_launch_progress = 1 - -# Define timeout for daemons to report back during launch -orte_startup_timeout = 10000 - -## Protect the shared file systems -orte_no_session_dirs = /panfs,/scratch,/users,/usr/projects -orte_tmpdir_base = /tmp - -## Require an allocation to run - protects the frontend -## from inadvertent job executions -orte_allocation_required = 1 - -## Add the interface for out-of-band communication -## and set it up -oob_tcp_if_include = mic0 -oob_tcp_peer_retries = 1000 -oob_tcp_sndbuf = 32768 -oob_tcp_rcvbuf = 32768 - -## Define the MPI interconnects -btl = sm,scif,openib,self - -## Setup OpenIB - just in case -btl_openib_want_fork_support = 0 -btl_openib_receive_queues = S,4096,1024:S,12288,512:S,65536,512 - -## Enable cpu affinity -hwloc_base_binding_policy = core - -## Setup MPI options -mpi_show_handle_leaks = 0 -mpi_warn_on_fork = 1 -#mpi_abort_print_stack = 0 - diff --git a/contrib/platform/lanl/darwin/optimized.conf b/contrib/platform/lanl/darwin/optimized.conf index 6313a49a8dd..1012072a433 100644 --- a/contrib/platform/lanl/darwin/optimized.conf +++ b/contrib/platform/lanl/darwin/optimized.conf @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights +# Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights # reserved. # $COPYRIGHT$ # @@ -84,7 +84,7 @@ oob_tcp_sndbuf = 32768 oob_tcp_rcvbuf = 32768 ## Define the MPI interconnects -btl = sm,scif,openib,self +btl = sm,openib,self ## Setup OpenIB - just in case btl_openib_want_fork_support = 0 diff --git a/opal/mca/btl/scif/Makefile.am b/opal/mca/btl/scif/Makefile.am deleted file mode 100644 index 828ef2e7dfb..00000000000 --- a/opal/mca/btl/scif/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# -*- indent-tabs-mode:nil -*- -# -# Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights -# reserved. -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -AM_CPPFLAGS = $(btl_scif_CPPFLAGS) - -if MCA_BUILD_opal_btl_scif_DSO -component_noinst = -component_install = mca_btl_scif.la -else -component_noinst = libmca_btl_scif.la -component_install = -endif - -scif_SOURCES = \ - btl_scif_component.c \ - btl_scif_module.c \ - btl_scif_add_procs.c \ - btl_scif_endpoint.h \ - btl_scif_endpoint.c \ - btl_scif_frag.c \ - btl_scif_frag.h \ - btl_scif_send.c \ - btl_scif_put.c \ - btl_scif_get.c \ - btl_scif.h - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_btl_scif_la_SOURCES = $(scif_SOURCES) -nodist_mca_btl_scif_la_SOURCES = $(scif_nodist_SOURCES) -mca_btl_scif_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(btl_scif_LIBS) -mca_btl_scif_la_LDFLAGS = -module -avoid-version $(btl_scif_LDFLAGS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_btl_scif_la_SOURCES = $(scif_SOURCES) -nodist_libmca_btl_scif_la_SOURCES = $(scif_nodist_SOURCES) -libmca_btl_scif_la_LIBADD = $(btl_scif_LIBS) -libmca_btl_scif_la_LDFLAGS = -module -avoid-version $(btl_scif_LDFLAGS) diff --git a/opal/mca/btl/scif/btl_scif.h b/opal/mca/btl/scif/btl_scif.h deleted file mode 100644 index 9b5917224cc..00000000000 --- a/opal/mca/btl/scif/btl_scif.h +++ /dev/null @@ -1,249 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_BTL_SCIF_H -#define MCA_BTL_SCIF_H - -#include "opal_config.h" - -#include "opal/util/output.h" -#include "opal_stdint.h" -#include "opal/util/proc.h" - -#include "opal/mca/btl/btl.h" -#include "opal/mca/btl/base/base.h" -#include "opal/mca/btl/base/btl_base_error.h" -#include "opal/mca/rcache/rcache.h" -#include "opal/mca/rcache/base/base.h" - -#include -#include -#include -#include -#include -#include - -/* Turn on timers for debug builds */ -#if OPAL_ENABLE_DEBUG -/* #define SCIF_TIMING */ -#endif - -#if defined(SCIF_TIMING) -#include -#include - -static inline void timerspecsub (struct timespec *end, struct timespec *start, - struct timespec *diff) { - diff->tv_nsec = end->tv_nsec - start->tv_nsec; - diff->tv_sec = end->tv_sec - start->tv_sec; - if (diff->tv_nsec < 0) { - --diff->tv_sec; - diff->tv_nsec += 1000000000; - } -} - -#define SCIF_UPDATE_TIMER(agg, max, start) \ - do { \ - struct timespec _te, _diff; \ - double _tmpd; \ - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &_te); \ - timerspecsub(&_te, &(start), &_diff); \ - _tmpd = (double) _diff.tv_sec + (double) _diff.tv_nsec / 1000000000.0; \ - (agg) += _tmpd; \ - (max) = fmax ((max), _tmpd); \ - } while (0) -#endif - -typedef struct mca_btl_scif_modex_t { - struct scif_portID port_id; -} mca_btl_scif_modex_t; - -typedef struct mca_btl_scif_module_t { - mca_btl_base_module_t super; - - /* listening endpoint */ - scif_epd_t scif_fd; - - /* listening port */ - struct scif_portID port_id; - - size_t endpoint_count; - struct mca_btl_base_endpoint_t *endpoints; - - opal_list_t failed_frags; - - /* fragments for DMA */ - opal_free_list_t dma_frags; - - /* fragments for eager send */ - opal_free_list_t eager_frags; - - pthread_t listen_thread; - - volatile bool exiting; - bool listening; - - mca_rcache_base_module_t *rcache; -} mca_btl_scif_module_t; - -typedef struct mca_btl_scif_component_t { - /* base BTL component */ - mca_btl_base_component_3_0_0_t super; - - /* DMA free list settings */ - int scif_free_list_num; - int scif_free_list_max; - int scif_free_list_inc; - - unsigned int segment_size; - - bool rma_use_cpu; - bool rma_sync; - -#if defined(SCIF_TIMING) - /* performance timers */ - double aquire_buffer_time; - double aquire_buffer_time_max; - - double send_time; - double send_time_max; - - double sendi_time; - double sendi_time_max; - - double get_time; - double get_time_max; - unsigned long get_count; - - double put_time; - double put_time_max; - unsigned long put_count; -#endif -} mca_btl_scif_component_t; - -int mca_btl_scif_module_init (void); - -/** - * BML->BTL notification of change in the process list. - * - * location: btl_scif_add_procs.c - * - * @param btl (IN) BTL module - * @param nprocs (IN) Number of processes - * @param procs (IN) Array of processes - * @param endpoint (OUT) Array of mca_btl_base_endpoint_t structures by BTL. - * @param reachable (OUT) Bitmask indicating set of peer processes that are reachable by this BTL. - * @return OPAL_SUCCESS or error status on failure. - */ -int -mca_btl_scif_add_procs (struct mca_btl_base_module_t* btl, - size_t nprocs, - struct opal_proc_t **procs, - struct mca_btl_base_endpoint_t **peers, - opal_bitmap_t *reachable); - -/** - * Notification of change to the process list. - * - * location: btl_scif_add_procs.c - * - * @param btl (IN) BTL module - * @param nprocs (IN) Number of processes - * @param proc (IN) Set of processes - * @param peer (IN) Set of peer addressing information. - * @return Status indicating if cleanup was successful - */ -int -mca_btl_scif_del_procs (struct mca_btl_base_module_t *btl, - size_t nprocs, - struct opal_proc_t **procs, - struct mca_btl_base_endpoint_t **peers); - -/** - * Initiate an asynchronous send. - * - * location: btl_scif_send.c - * - * @param btl (IN) BTL module - * @param endpoint (IN) BTL addressing information - * @param descriptor (IN) Description of the data to be transfered - * @param tag (IN) The tag value used to notify the peer. - */ -int -mca_btl_scif_send (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *btl_peer, - struct mca_btl_base_descriptor_t *descriptor, - mca_btl_base_tag_t tag); - -int mca_btl_scif_sendi (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - struct opal_convertor_t *convertor, - void *header, size_t header_size, - size_t payload_size, uint8_t order, - uint32_t flags, mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t **descriptor); - -/** - * Initiate a get operation. - * - * location: btl_scif_get.c - */ -int mca_btl_scif_get (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - -/** - * Initiate a put operation. - * - * location: btl_scif_put.c - */ -int mca_btl_scif_put (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - -mca_btl_base_descriptor_t * -mca_btl_scif_alloc(struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - uint8_t order, size_t size, uint32_t flags); - -int mca_btl_scif_progress_send_wait_list (struct mca_btl_base_endpoint_t *endpoint); - -struct mca_btl_scif_reg_t; - -struct mca_btl_base_registration_handle_t { - /** scif offset */ - off_t scif_offset; - /** base address of this scif region */ - uintptr_t scif_base; -}; - -struct mca_btl_scif_registration_handle_t { - mca_btl_base_registration_handle_t btl_handle; - struct mca_btl_scif_reg_t *reg; -}; -typedef struct mca_btl_scif_registration_handle_t mca_btl_scif_registration_handle_t; - -typedef struct mca_btl_scif_reg_t { - mca_rcache_base_registration_t base; - /** per-endpoint btl handles for this registration */ - mca_btl_scif_registration_handle_t *handles; -} mca_btl_scif_reg_t; - -/* Global structures */ - -OPAL_MODULE_DECLSPEC extern mca_btl_scif_component_t mca_btl_scif_component; -OPAL_MODULE_DECLSPEC extern mca_btl_scif_module_t mca_btl_scif_module; - -#endif diff --git a/opal/mca/btl/scif/btl_scif_add_procs.c b/opal/mca/btl/scif/btl_scif_add_procs.c deleted file mode 100644 index b29d694fc65..00000000000 --- a/opal/mca/btl/scif/btl_scif_add_procs.c +++ /dev/null @@ -1,259 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "opal/util/sys_limits.h" - -#include "btl_scif.h" -#include "btl_scif_frag.h" - -static int mca_btl_scif_setup_rcache (mca_btl_scif_module_t *scif_module); -static void *mca_btl_scif_connect_accept (void *arg); - -int mca_btl_scif_add_procs(struct mca_btl_base_module_t* btl, - size_t nprocs, - struct opal_proc_t **procs, - struct mca_btl_base_endpoint_t **peers, - opal_bitmap_t *reachable) { - mca_btl_scif_module_t *scif_module = (mca_btl_scif_module_t *) btl; - size_t procs_on_board, i, board_proc; - opal_proc_t *my_proc = opal_proc_local_get(); - int rc; - - /* determine how many procs are on this board */ - for (i = 0, procs_on_board = 0 ; i < nprocs ; ++i) { - struct opal_proc_t *opal_proc = procs[i]; - - if (my_proc == opal_proc) { - continue; - } - - if (!OPAL_PROC_ON_LOCAL_HOST(opal_proc->proc_flags) || - my_proc == opal_proc) { - /* scif can only be used with procs on this board */ - continue; - } - - procs_on_board++; - } - - /* allocate space for the detected peers and setup the rcache */ - if (NULL == scif_module->endpoints) { - scif_module->endpoints = calloc (procs_on_board, sizeof (mca_btl_base_endpoint_t)); - if (OPAL_UNLIKELY(NULL == scif_module->endpoints)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - rc = mca_btl_scif_setup_rcache (scif_module); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - BTL_ERROR(("btl/scif error setting up rcache or free lists")); - return rc; - } - } - - for (i = 0, board_proc = 0 ; i < nprocs ; ++i) { - struct opal_proc_t *opal_proc = procs[i]; - - if (my_proc == opal_proc) { - continue; - } - - if (!OPAL_PROC_ON_LOCAL_HOST(opal_proc->proc_flags) || - my_proc == opal_proc) { - peers[i] = NULL; - /* scif can only be used with procs on this board */ - continue; - } - - /* Initialize endpoints */ - rc = mca_btl_scif_ep_init (scif_module->endpoints + board_proc, (mca_btl_scif_module_t *) btl, opal_proc); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - BTL_ERROR(("btl/scif error initializing endpoint")); - return rc; - } - - scif_module->endpoints[board_proc].id = board_proc; - - /* Set the reachable bit */ - rc = opal_bitmap_set_bit (reachable, i); - - /* Store a reference to this peer */ - peers[i] = scif_module->endpoints + board_proc; - - board_proc++; - } - - BTL_VERBOSE(("%lu procs on board\n", (unsigned long) procs_on_board)); - - scif_module->endpoint_count = procs_on_board; - - if (!mca_btl_scif_module.listening) { - /* start listening thread */ - rc = pthread_create (&mca_btl_scif_module.listen_thread, NULL, mca_btl_scif_connect_accept, NULL); - if (0 > rc) { - return OPAL_ERROR; - } - mca_btl_scif_module.listening = true; - } - - return OPAL_SUCCESS; -} - -static void *mca_btl_scif_connect_accept (void *arg) -{ - struct scif_pollepd pollepd = {.epd = mca_btl_scif_module.scif_fd, .events = SCIF_POLLIN, .revents = 0}; - int rc; - - BTL_VERBOSE(("btl/scif: listening for new connections")); - - /* listen for connections */ - while (1) { - pollepd.revents = 0; - - rc = scif_poll (&pollepd, 1, -1); - if (1 == rc) { - if (SCIF_POLLIN != pollepd.revents) { - break; - } - if (mca_btl_scif_module.exiting) { - /* accept the connection so scif_connect() does not timeout */ - struct scif_portID peer; - scif_epd_t newepd; - scif_accept(mca_btl_scif_module.scif_fd, &peer, &newepd, SCIF_ACCEPT_SYNC); - scif_close(newepd); - break; - } - - rc = mca_btl_scif_ep_connect_start_passive (); - if (OPAL_SUCCESS != rc) { - BTL_VERBOSE(("btl/scif: error accepting scif connection")); - continue; - } - } else { - break; - } - } - - BTL_VERBOSE(("btl/scif: stopped listening for new connections")); - - return NULL; -} - -int mca_btl_scif_del_procs (struct mca_btl_base_module_t *btl, - size_t nprocs, struct opal_proc_t **procs, - struct mca_btl_base_endpoint_t **peers) { - /* do nothing for now */ - return OPAL_SUCCESS; -} - -static int scif_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg) -{ - mca_btl_scif_reg_t *scif_reg = (mca_btl_scif_reg_t *)reg; - size_t size = (size_t)((uintptr_t) reg->bound - (uintptr_t) reg->base); - int i; - - /* register the fragment with all connected endpoints */ - for (i = 0 ; i < (int) mca_btl_scif_module.endpoint_count ; ++i) { - if ((off_t)-1 != scif_reg->handles[i].btl_handle.scif_offset && - MCA_BTL_SCIF_EP_STATE_CONNECTED == mca_btl_scif_module.endpoints[i].state) { - (void) scif_unregister(mca_btl_scif_module.endpoints[i].scif_epd, - scif_reg->handles[i].btl_handle.scif_offset, size); - } - } - - free (scif_reg->handles); - - return OPAL_SUCCESS; -} - -static int scif_reg_mem (void *reg_data, void *base, size_t size, - mca_rcache_base_registration_t *reg) -{ - mca_btl_scif_reg_t *scif_reg = (mca_btl_scif_reg_t *)reg; - int rc = OPAL_SUCCESS; - unsigned int i; - - scif_reg->handles = calloc (mca_btl_scif_module.endpoint_count, sizeof (scif_reg->handles[0])); - - /* intialize all scif offsets to -1 and initialize the pointer back to the rcache registration */ - for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) { - scif_reg->handles[i].btl_handle.scif_offset = -1; - scif_reg->handles[i].btl_handle.scif_base = (intptr_t) base; - scif_reg->handles[i].reg = scif_reg; - } - - /* register the pointer with all connected endpoints */ - for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) { - if (MCA_BTL_SCIF_EP_STATE_CONNECTED == mca_btl_scif_module.endpoints[i].state) { - scif_reg->handles[i].btl_handle.scif_offset = scif_register (mca_btl_scif_module.endpoints[i].scif_epd, - base, size, 0, SCIF_PROT_READ | - SCIF_PROT_WRITE, 0); - if (SCIF_REGISTER_FAILED == scif_reg->handles[i].btl_handle.scif_offset) { - /* cleanup */ - scif_dereg_mem (reg_data, reg); - rc = OPAL_ERR_OUT_OF_RESOURCE; - break; - } - } - } - - return rc; -} - -static int mca_btl_scif_setup_rcache (mca_btl_scif_module_t *scif_module) -{ - mca_rcache_base_resources_t rcache_resources; - int rc; - - /* initialize the grdma rcache */ - rcache_resources.cache_name = "scif"; - rcache_resources.reg_data = (void *) scif_module; - rcache_resources.sizeof_reg = sizeof (mca_btl_scif_reg_t); - rcache_resources.register_mem = scif_reg_mem; - rcache_resources.deregister_mem = scif_dereg_mem; - scif_module->rcache = mca_rcache_base_module_create ("grdma", scif_module, &rcache_resources); - if (NULL == scif_module->rcache) { - BTL_ERROR(("error creating grdma rcache")); - return OPAL_ERROR; - } - - /* setup free lists for fragments. dma fragments will be used for - * rma operations and in-place sends. eager frags will be used for - * buffered sends. */ - rc = opal_free_list_init (&scif_module->dma_frags, - sizeof (mca_btl_scif_dma_frag_t), 64, - OBJ_CLASS(mca_btl_scif_dma_frag_t), - 128, opal_getpagesize (), - mca_btl_scif_component.scif_free_list_num, - mca_btl_scif_component.scif_free_list_max, - mca_btl_scif_component.scif_free_list_inc, - NULL, 0, NULL, NULL, NULL); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - return rc; - } - - rc = opal_free_list_init (&scif_module->eager_frags, - sizeof (mca_btl_scif_eager_frag_t), 8, - OBJ_CLASS(mca_btl_scif_eager_frag_t), - 128 + scif_module->super.btl_eager_limit, 64, - mca_btl_scif_component.scif_free_list_num, - mca_btl_scif_component.scif_free_list_max, - mca_btl_scif_component.scif_free_list_inc, - NULL, 0, NULL, NULL, NULL); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - BTL_ERROR(("error creating eager receive fragment free list")); - return rc; - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/scif/btl_scif_component.c b/opal/mca/btl/scif/btl_scif_component.c deleted file mode 100644 index 42ef9b6473f..00000000000 --- a/opal/mca/btl/scif/btl_scif_component.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_scif.h" -#include "btl_scif_frag.h" - -#include "opal/runtime/opal_params.h" -#include "opal/include/opal/align.h" -#include "opal/memoryhooks/memory.h" -#include "opal/mca/pmix/pmix.h" - -#include "opal/mca/base/mca_base_pvar.h" - -#include - -static int btl_scif_component_register(void); -static int btl_scif_component_open(void); -static int btl_scif_component_close(void); -static mca_btl_base_module_t **mca_btl_scif_component_init(int *, bool, bool); -static int mca_btl_scif_component_progress(void); - -mca_btl_scif_component_t mca_btl_scif_component = { - { - /* First, the mca_base_component_t struct containing meta information - about the component itself */ - - .btl_version = { - MCA_BTL_DEFAULT_VERSION("scif"), - .mca_open_component = btl_scif_component_open, - .mca_close_component = btl_scif_component_close, - .mca_register_component_params = btl_scif_component_register, - }, - .btl_data = { - .param_field = MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - .btl_init = mca_btl_scif_component_init, - .btl_progress = mca_btl_scif_component_progress, - } -}; - -static int btl_scif_component_register(void) -{ - (void) mca_base_var_group_component_register(&mca_btl_scif_component.super.btl_version, - "SCIF byte transport layer"); - - mca_btl_scif_component.scif_free_list_num = 8; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "free_list_num", "Initial fragment free list size", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.scif_free_list_num); - mca_btl_scif_component.scif_free_list_max = 16384; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "free_list_max", "Maximum fragment free list size", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.scif_free_list_max); - mca_btl_scif_component.scif_free_list_inc = 64; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "free_list_inc", "Fragment free list size increment", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.scif_free_list_inc); - - mca_btl_scif_component.segment_size = 8 * 1024; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "segment_size", "Size of memory segment to " - "allocate for each remote process (default: " - "8k)", MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, - MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.segment_size); - - mca_btl_scif_component.rma_use_cpu = false; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "rma_use_cpu", "Use CPU instead of DMA " - "for RMA copies (default: false)", MCA_BASE_VAR_TYPE_BOOL, - NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.rma_use_cpu); - - - mca_btl_scif_component.rma_sync = true; - (void) mca_base_component_var_register(&mca_btl_scif_component.super.btl_version, - "rma_sync", "Use synchronous RMA instead of " - "an RMA fence (default: true)", MCA_BASE_VAR_TYPE_BOOL, - NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_scif_component.rma_sync); - -#if defined(SCIF_TIMING) - mca_btl_scif_component.aquire_buffer_time = 0.0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "aquire_buffer_time", "Aggregate time spent " - "aquiring send buffers", OPAL_INFO_LVL_9, - MCA_BASE_PVAR_CLASS_AGGREGATE, MCA_BASE_VAR_TYPE_DOUBLE, - NULL, MCA_BASE_VAR_BIND_NO_OBJECT, MCA_BASE_PVAR_FLAG_READONLY | - MCA_BASE_PVAR_FLAG_CONTINUOUS, NULL, NULL, NULL, - &mca_btl_scif_component.aquire_buffer_time); - - mca_btl_scif_component.send_time = 0.0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "send_time", "Aggregate time spent writing to " - "send buffers", OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_AGGREGATE, - MCA_BASE_VAR_TYPE_DOUBLE, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.send_time); - - mca_btl_scif_component.sendi_time = 0.0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "sendi_time", "Aggregate time spent writing to " - "send buffers in sendi", OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_AGGREGATE, - MCA_BASE_VAR_TYPE_DOUBLE, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.sendi_time); - - mca_btl_scif_component.get_time = 0.0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "get_time", "Aggregate time spent in DMA read (scif_readfrom)", - OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_AGGREGATE, - MCA_BASE_VAR_TYPE_DOUBLE, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.get_time); - - mca_btl_scif_component.get_count = 0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "get_count", "Number of times btl_scif_get was called", - OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_COUNTER, - MCA_BASE_VAR_TYPE_UNSIGNED_LONG, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.get_count); - - mca_btl_scif_component.put_time = 0.0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "put_time", "Aggregate time spent in DMA write (scif_writeto)", - OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_AGGREGATE, - MCA_BASE_VAR_TYPE_DOUBLE, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.put_time); - - mca_btl_scif_component.put_count = 0; - (void) mca_base_component_pvar_register(&mca_btl_scif_component.super.btl_version, - "put_count", "Number of times btl_scif_put was called", - OPAL_INFO_LVL_9, MCA_BASE_PVAR_CLASS_COUNTER, - MCA_BASE_VAR_TYPE_UNSIGNED_LONG, NULL, MCA_BASE_VAR_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - NULL, NULL, NULL, &mca_btl_scif_component.put_count); -#endif - - mca_btl_scif_module.super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH - 1; - mca_btl_scif_module.super.btl_eager_limit = 1 * 1024; - mca_btl_scif_module.super.btl_rndv_eager_limit = 1 * 1024; - mca_btl_scif_module.super.btl_rdma_pipeline_frag_size = 4 * 1024 * 1024; - mca_btl_scif_module.super.btl_max_send_size = 1 * 1024; - mca_btl_scif_module.super.btl_rdma_pipeline_send_length = 1 * 1024; - - /* threshold for put */ - mca_btl_scif_module.super.btl_min_rdma_pipeline_size = 1 * 1024; - - mca_btl_scif_module.super.btl_flags = MCA_BTL_FLAGS_SEND | - MCA_BTL_FLAGS_RDMA | MCA_BTL_FLAGS_SEND_INPLACE; - - mca_btl_scif_module.super.btl_registration_handle_size = sizeof (mca_btl_base_registration_handle_t); - - mca_btl_scif_module.super.btl_bandwidth = 50000; /* Mbs */ - mca_btl_scif_module.super.btl_latency = 2; /* Microsecs */ - - /* Call the BTL based to register its MCA params */ - mca_btl_base_param_register(&mca_btl_scif_component.super.btl_version, - &mca_btl_scif_module.super); - - return OPAL_SUCCESS; -} - -static int btl_scif_component_open(void) -{ - return OPAL_SUCCESS; -} - -static int btl_scif_component_close(void) -{ - return OPAL_SUCCESS; -} - -static void mca_btl_scif_autoset_leave_pinned (void) { - int value = opal_mem_hooks_support_level(); - - if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == - ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & value)) { - /* Set leave pinned to 1 if leave pinned pipeline is not set */ - if (-1 == opal_leave_pinned) { - opal_leave_pinned = !opal_leave_pinned_pipeline; - } - } else { - opal_leave_pinned = 0; - opal_leave_pinned_pipeline = 0; - } -} - -static int mca_btl_scif_modex_send (void) -{ - mca_btl_scif_modex_t modex; - int rc; - - memset(&modex, 0, sizeof(mca_btl_scif_modex_t)); - modex.port_id = mca_btl_scif_module.port_id; - - OPAL_MODEX_SEND(rc, OPAL_PMIX_LOCAL, - &mca_btl_scif_component.super.btl_version, - &modex, sizeof (modex)); - return rc; -} - - -static mca_btl_base_module_t **mca_btl_scif_component_init (int *num_btl_modules, - bool enable_progress_threads, - bool enable_mpi_threads) -{ - struct mca_btl_base_module_t **base_modules; - int rc; - - BTL_VERBOSE(("btl/scif initializing")); - - signal (SIGSEGV, SIG_DFL); - - /* we currently need the memory hooks to determine when - * registrations are no longer valid. */ - mca_btl_scif_autoset_leave_pinned (); - - if (32768 < mca_btl_scif_module.super.btl_eager_limit) { - mca_btl_scif_module.super.btl_eager_limit = 32768; - } - - /* the segment should be large enough to hold at least one eager packet */ - if (4 * mca_btl_scif_module.super.btl_eager_limit > mca_btl_scif_component.segment_size) { - mca_btl_scif_component.segment_size = 4 * mca_btl_scif_module.super.btl_eager_limit; - } - - /* round up to a multiple of 4096 */ - mca_btl_scif_component.segment_size = (mca_btl_scif_component.segment_size + 0xfff) & ~0xfff; - - base_modules = (struct mca_btl_base_module_t **) - calloc (1, sizeof (struct mca_btl_base_module_t *)); - if (OPAL_UNLIKELY(NULL == base_modules)) { - BTL_ERROR(("Malloc failed : %s:%d", __FILE__, __LINE__)); - return NULL; - } - - /* initialize the module */ - rc = mca_btl_scif_module_init (); - if (OPAL_SUCCESS != rc) { - BTL_VERBOSE(("btl/scif error initializing module")); - free (base_modules); - return NULL; - } - - base_modules[0] = &mca_btl_scif_module.super; - mca_btl_scif_module.exiting = false; - mca_btl_scif_module.listening = false; - - rc = mca_btl_scif_modex_send (); - if (OPAL_SUCCESS != rc) { - BTL_VERBOSE(("btl/scif error sending modex")); - free (base_modules); - return NULL; - } - - *num_btl_modules = 1; - - BTL_VERBOSE(("btl/scif done initializing modules")); - - return base_modules; -} - -static int mca_btl_scif_progress_recvs (mca_btl_base_endpoint_t *ep) -{ - const mca_btl_active_message_callback_t *reg; - unsigned int start = ep->recv_buffer.start; - unsigned int end = ep->recv_buffer.endp[0]; - mca_btl_scif_base_frag_t frag; - mca_btl_scif_frag_hdr_t *hdr; - /* changing this value does not appear to have a signifigant impact - * on performance */ - int frags_per_loop = 5; - - if (end == start) { - return 0; - } - - end &= ~ (1 << 31); - start &= ~ (1 << 31); - - /* force all prior reads to complete before continuing */ - opal_atomic_rmb (); - - do { - hdr = (mca_btl_scif_frag_hdr_t *) (ep->recv_buffer.buffer + start); - - /* force all prior reads to complete before continuing */ - MB(); - - BTL_VERBOSE(("got frag with header {.tag = %d, .size = %d} from offset %u", - hdr->tag, hdr->size, start)); -#if defined(SCIF_USE_SEQ) - if (hdr->seq != ep->seq_expected) { - break; - } - - ep->seq_expected++; -#endif - - /* message to skip the rest of the buffer */ - if (0xff != hdr->tag) { - reg = mca_btl_base_active_message_trigger + hdr->tag; - - /* fragment fits entirely in the remaining buffer space. some - * btl users do not handle fragmented data so we can't split - * the fragment without introducing another copy here. this - * limitation has not appeared to cause any performance - * problems. */ - frag.base.des_segment_count = 1; - frag.segments[0].seg_len = hdr->size; - frag.segments[0].seg_addr.pval = (void *) (hdr + 1); - - frag.base.des_segments = frag.segments; - - /* call the registered callback function */ - reg->cbfunc(&mca_btl_scif_module.super, hdr->tag, &frag.base, reg->cbdata); - } - - start = (start + hdr->size + sizeof (*hdr) + 63) & ~63; - - /* skip unusable space at the end of the buffer */ - if (mca_btl_scif_component.segment_size == start) { - start = 64; - ep->recv_buffer.start = ((ep->recv_buffer.start & (1 << 31)) ^ (1 << 31)) | 64; - } else { - ep->recv_buffer.start = (ep->recv_buffer.start & (1 << 31)) | start; - } - } while (start != end && --frags_per_loop); - - /* let the sender know where we stopped */ - ep->recv_buffer.startp[0] = ep->recv_buffer.start; - - /* return the number of fragments processed */ - return 5 - frags_per_loop; -} - -static int mca_btl_scif_progress_sends (mca_btl_base_endpoint_t *ep) -{ - /* try sending any wait listed fragments */ - if (OPAL_UNLIKELY(0 != opal_list_get_size (&ep->frag_wait_list))) { - return mca_btl_scif_progress_send_wait_list (ep); - } - - return 0; -} - -static int mca_btl_scif_component_progress (void) -{ - unsigned int i; - int count = 0; - - /* progress all connected endpoints */ - for (i = 0, count = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) { - if (MCA_BTL_SCIF_EP_STATE_CONNECTED == mca_btl_scif_module.endpoints[i].state) { - /* poll all connected endpoints */ - count += mca_btl_scif_progress_recvs (mca_btl_scif_module.endpoints + i); - /* if any fragments are waiting try to send them now */ - count += mca_btl_scif_progress_sends (mca_btl_scif_module.endpoints + i); - } - } - - return count; -} diff --git a/opal/mca/btl/scif/btl_scif_endpoint.c b/opal/mca/btl/scif/btl_scif_endpoint.c deleted file mode 100644 index 41e34cabcdc..00000000000 --- a/opal/mca/btl/scif/btl_scif_endpoint.c +++ /dev/null @@ -1,301 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_scif.h" - -#include "btl_scif_endpoint.h" -#include "opal/mca/memchecker/base/base.h" -#include "opal/util/sys_limits.h" - -static void mca_btl_scif_ep_construct (mca_btl_base_endpoint_t *ep) { - memset ((char *) ep + sizeof(ep->super), 0, sizeof (*ep) - sizeof (ep->super)); - OBJ_CONSTRUCT(&ep->lock, opal_mutex_t); - OBJ_CONSTRUCT(&ep->frag_wait_list, opal_list_t); -} - -static void mca_btl_scif_ep_destruct (mca_btl_base_endpoint_t *ep) { - if (ep->send_buffer.buffer) { - scif_munmap (ep->send_buffer.buffer, mca_btl_scif_component.segment_size); - } - - if (ep->recv_buffer.buffer) { - scif_unregister (ep->scif_epd, ep->recv_buffer.scif_offset, mca_btl_scif_component.segment_size); - free (ep->recv_buffer.buffer); - } - - if (ep->scif_epd) { - scif_close (ep->scif_epd); - } - - OBJ_DESTRUCT(&ep->lock); - OBJ_DESTRUCT(&ep->frag_wait_list); -} - -OBJ_CLASS_INSTANCE(mca_btl_scif_endpoint_t, opal_list_item_t, - mca_btl_scif_ep_construct, mca_btl_scif_ep_destruct); - -static void mca_btl_scif_ep_free_buffer (mca_btl_base_endpoint_t *ep) { - if (ep->recv_buffer.buffer) { - scif_unregister (ep->scif_epd, ep->recv_buffer.scif_offset, mca_btl_scif_component.segment_size); - free (ep->recv_buffer.buffer); - ep->recv_buffer.buffer = NULL; - ep->recv_buffer.scif_offset = (off_t) -1; - } -} - -static inline int mca_btl_scif_ep_get_buffer (mca_btl_base_endpoint_t *ep) { - int rc; - - rc = posix_memalign ((void **) &ep->recv_buffer.buffer, opal_getpagesize(), mca_btl_scif_component.segment_size); - if (0 > rc) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - memset (ep->recv_buffer.buffer, 0, mca_btl_scif_component.segment_size); - - ep->recv_buffer.scif_offset = scif_register (ep->scif_epd, ep->recv_buffer.buffer, - mca_btl_scif_component.segment_size, 0, - SCIF_PROT_READ | SCIF_PROT_WRITE, 0); - if (SCIF_REGISTER_FAILED == ep->recv_buffer.scif_offset) { - BTL_VERBOSE(("failed to register a scif buffer of size %d. errno = %d", - mca_btl_scif_component.segment_size, errno)); - free (ep->recv_buffer.buffer); - ep->recv_buffer.buffer = NULL; - return OPAL_ERROR; - } - - ep->recv_buffer.startp = (uint32_t *) ep->recv_buffer.buffer; - ep->recv_buffer.endp = ep->recv_buffer.startp + 1; - - ep->recv_buffer.startp[0] = ep->recv_buffer.endp[0] = 64; - - BTL_VERBOSE(("allocated buffer of size %d bytes. with scif registration %lu", - mca_btl_scif_component.segment_size, (unsigned long) ep->recv_buffer.scif_offset)); - - return OPAL_SUCCESS; -} - -/* must be called with the endpoint lock held */ -static int mca_btl_scif_ep_connect_finish (mca_btl_base_endpoint_t *ep, bool passive) { - int rc; - - rc = mca_btl_scif_ep_get_buffer (ep); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - BTL_VERBOSE(("error allocating buffer for scif peer")); - return rc; - } - - if (passive) { - rc = scif_recv (ep->scif_epd, &ep->send_buffer.scif_offset, - sizeof (ep->send_buffer.scif_offset), SCIF_RECV_BLOCK); - if (OPAL_LIKELY(-1 != rc)) { - rc = scif_send (ep->scif_epd, &ep->recv_buffer.scif_offset, - sizeof (ep->recv_buffer.scif_offset), SCIF_SEND_BLOCK); - } - } else { - rc = scif_send (ep->scif_epd, &ep->recv_buffer.scif_offset, - sizeof (ep->recv_buffer.scif_offset), SCIF_SEND_BLOCK); - if (OPAL_LIKELY(-1 != rc)) { - rc = scif_recv (ep->scif_epd, &ep->send_buffer.scif_offset, - sizeof (ep->send_buffer.scif_offset), SCIF_RECV_BLOCK); - } - } - - if (OPAL_UNLIKELY(-1 == rc)) { - BTL_VERBOSE(("error exchanging connection data with peer %d", ep->peer_proc->proc_name.vpid)); - mca_btl_scif_ep_free_buffer (ep); - return OPAL_ERROR; - } - - BTL_VERBOSE(("remote peer %d has scif offset %lu", ep->peer_proc->proc_name.vpid, - (unsigned long) ep->send_buffer.scif_offset)); - - ep->send_buffer.buffer = scif_mmap (0, mca_btl_scif_component.segment_size, - SCIF_PROT_READ | SCIF_PROT_WRITE, - 0, ep->scif_epd, ep->send_buffer.scif_offset); - if (OPAL_UNLIKELY(NULL == ep->send_buffer.buffer)) { - BTL_VERBOSE(("error in scif_mmap")); - mca_btl_scif_ep_free_buffer (ep); - return OPAL_ERROR; - } - - opal_memchecker_base_mem_defined (ep->send_buffer.buffer, mca_btl_scif_component.segment_size); - - BTL_VERBOSE(("remote peer %d buffer mapped to local pointer %p", ep->peer_proc->proc_name.vpid, - ep->send_buffer.buffer)); - - /* setup the circular send buffers */ - ep->send_buffer.start = ep->send_buffer.end = 64; - - ep->send_buffer.startp = (uint32_t *) ep->send_buffer.buffer; - ep->send_buffer.endp = ep->send_buffer.startp + 1; - - ep->recv_buffer.start = 64; - - /* connection complete */ - ep->state = MCA_BTL_SCIF_EP_STATE_CONNECTED; - - BTL_VERBOSE(("btl/scif connection to remote peer %d established", ep->peer_proc->proc_name.vpid)); - - return OPAL_SUCCESS; -} - -int mca_btl_scif_ep_connect_start_passive (void) { - mca_btl_base_endpoint_t *ep = NULL; - opal_process_name_t remote_name; - struct scif_portID port_id; - unsigned int i; - scif_epd_t epd; - int rc; - - /* accept the connection request. if the endpoint is already connecting we - * may close this endpoint and alloc mca_btl_scif_ep_connect_start_active - * to finish the connection. */ - rc = scif_accept (mca_btl_scif_module.scif_fd, &port_id, &epd, SCIF_ACCEPT_SYNC); - if (OPAL_UNLIKELY(0 > rc)) { - BTL_VERBOSE(("error accepting connecton from scif peer. %d", errno)); - return OPAL_ERROR; - } - - /* determine which peer sent the connection request */ - rc = scif_recv (epd, &remote_name, sizeof (remote_name), SCIF_RECV_BLOCK); - if (OPAL_UNLIKELY(-1 == rc)) { - BTL_VERBOSE(("error in scif_recv")); - scif_close (epd); - return OPAL_ERROR; - } - - BTL_VERBOSE(("got connection request from vpid %d on port %u on node %u", - remote_name.vpid, port_id.port, port_id.node)); - - for (i = 0 ; i < mca_btl_scif_module.endpoint_count ; ++i) { - if (mca_btl_scif_module.endpoints[i].peer_proc->proc_name.vpid == - remote_name.vpid) { - ep = mca_btl_scif_module.endpoints + i; - break; - } - } - - /* peer not found */ - if (i == mca_btl_scif_module.endpoint_count) { - BTL_VERBOSE(("remote peer %d unknown", remote_name.vpid)); - scif_close (epd); - return OPAL_ERROR; - } - - /* similtaneous connections (active side) */ - if ((MCA_BTL_SCIF_EP_STATE_CONNECTING == ep->state && - ep->port_id.port < mca_btl_scif_module.port_id.port) || - MCA_BTL_SCIF_EP_STATE_CONNECTED == ep->state) { - BTL_VERBOSE(("active connection in progress. connection request from peer %d rejected", remote_name.vpid)); - scif_close (epd); - return OPAL_SUCCESS; - } - - opal_mutex_lock (&ep->lock); - - if (MCA_BTL_SCIF_EP_STATE_CONNECTED == ep->state) { - opal_mutex_unlock (&ep->lock); - scif_close (epd); - return OPAL_SUCCESS; - } - - BTL_VERBOSE(("accepted connection from port %d", ep->port_id.port)); - - ep->state = MCA_BTL_SCIF_EP_STATE_CONNECTING; - ep->scif_epd = epd; - - rc = mca_btl_scif_ep_connect_finish (ep, true); - if (OPAL_SUCCESS != rc) { - scif_close (ep->scif_epd); - ep->scif_epd = -1; - ep->state = MCA_BTL_SCIF_EP_STATE_INIT; - } - - opal_mutex_unlock (&ep->lock); - - return rc; -} - -static inline int mca_btl_scif_ep_connect_start_active (mca_btl_base_endpoint_t *ep) { - int rc = OPAL_SUCCESS; - - BTL_VERBOSE(("initiaiting connection to remote peer %d with port: %u on local scif node: %u", - ep->peer_proc->proc_name.vpid, ep->port_id.port, ep->port_id.node)); - - opal_mutex_lock (&ep->lock); - do { - if (MCA_BTL_SCIF_EP_STATE_INIT != ep->state) { - /* the accept thread has already finished this connection */ - rc = OPAL_SUCCESS; - break; - } - - ep->state = MCA_BTL_SCIF_EP_STATE_CONNECTING; - - ep->scif_epd = scif_open (); - if (OPAL_UNLIKELY(SCIF_OPEN_FAILED == ep->scif_epd)) { - BTL_VERBOSE(("error creating new scif endpoint")); - rc = OPAL_ERROR; - break; - } - - rc = scif_connect (ep->scif_epd, &ep->port_id); - if (OPAL_UNLIKELY(-1 == rc)) { - /* the connection attempt failed. this could mean the peer is currently - * processing connections. we will to try again later. */ - BTL_VERBOSE(("error connecting to scif peer. %d", errno)); - rc = OPAL_ERR_RESOURCE_BUSY; - break; - } - - rc = scif_send (ep->scif_epd, &OPAL_PROC_MY_NAME, sizeof (OPAL_PROC_MY_NAME), SCIF_SEND_BLOCK); - if (OPAL_UNLIKELY(-1 == rc)) { - BTL_VERBOSE(("error in scif_send")); - rc = OPAL_ERROR; - break; - } - - /* build connection data */ - rc = mca_btl_scif_ep_connect_finish (ep, false); - } while (0); - - if (OPAL_SUCCESS != rc) { - scif_close (ep->scif_epd); - ep->scif_epd = -1; - ep->state = MCA_BTL_SCIF_EP_STATE_INIT; - } - - opal_mutex_unlock (&ep->lock); - - return rc; -} - -int mca_btl_scif_ep_connect (mca_btl_base_endpoint_t *ep) { - int rc; - - if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED == ep->state)) { - return OPAL_SUCCESS; - } else if (MCA_BTL_SCIF_EP_STATE_CONNECTING == ep->state) { - return OPAL_ERR_RESOURCE_BUSY; - } - - if (MCA_BTL_SCIF_EP_STATE_INIT == ep->state) { - rc = mca_btl_scif_ep_connect_start_active (ep); - if (OPAL_SUCCESS != rc) { - return rc; - } - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/scif/btl_scif_endpoint.h b/opal/mca/btl/scif/btl_scif_endpoint.h deleted file mode 100644 index c04ea35405b..00000000000 --- a/opal/mca/btl/scif/btl_scif_endpoint.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_BTL_SCIF_ENDPOINT_H -#define MCA_BTL_SCIF_ENDPOINT_H - -#include "btl_scif.h" -#include "opal/mca/pmix/pmix.h" - -typedef enum mca_btl_scif_endpoint_state_t { - MCA_BTL_SCIF_EP_STATE_INIT, - MCA_BTL_SCIF_EP_STATE_CONNECTING, - MCA_BTL_SCIF_EP_STATE_CONNECTED -} mca_btl_scif_endpoint_state_t; - -typedef struct mca_btl_scif_endpoint_buffer_t { - unsigned char *buffer; - off_t scif_offset; - unsigned int start, end; - uint32_t *startp, *endp; -} mca_btl_scif_endpoint_buffer_t; - -typedef struct mca_btl_base_endpoint_t { - opal_list_item_t super; - mca_btl_scif_module_t *btl; - - /* location in the module endpoints array */ - int id; - - opal_mutex_t lock; - - /* scif endpoint */ - scif_epd_t scif_epd; - - /* connection information */ - struct scif_portID port_id; - - /* buffer information */ - mca_btl_scif_endpoint_buffer_t send_buffer; - mca_btl_scif_endpoint_buffer_t recv_buffer; - - /* current connect state */ - mca_btl_scif_endpoint_state_t state; - - /* frags waiting for resources */ - opal_list_t frag_wait_list; - - /* associated process */ - opal_proc_t *peer_proc; - -#if defined(SCIF_USE_SEQ) - uint32_t seq_next; - uint32_t seq_expected; -#endif -} mca_btl_base_endpoint_t; - -typedef mca_btl_base_endpoint_t mca_btl_scif_endpoint_t; - -OBJ_CLASS_DECLARATION(mca_btl_scif_endpoint_t); - -int mca_btl_scif_ep_connect (mca_btl_scif_endpoint_t *ep); -int mca_btl_scif_ep_connect_start_passive (void); - -static inline int mca_btl_scif_ep_init (mca_btl_scif_endpoint_t *endpoint, - mca_btl_scif_module_t *btl, - opal_proc_t *peer_proc) { - mca_btl_scif_modex_t *modex; - size_t msg_size; - int rc; - - OBJ_CONSTRUCT(endpoint, mca_btl_scif_endpoint_t); - endpoint->state = MCA_BTL_SCIF_EP_STATE_INIT; - - OPAL_MODEX_RECV(rc, &mca_btl_scif_component.super.btl_version, - &peer_proc->proc_name, (void **) &modex, &msg_size); - if (OPAL_SUCCESS != rc) { - return rc; - } - assert (msg_size == sizeof (endpoint->port_id)); - - endpoint->port_id = modex->port_id; - endpoint->peer_proc = peer_proc; - endpoint->btl = btl; - -#if defined(SCIF_USE_SEQ) - endpoint->seq_next = 0x00001010; - endpoint->seq_expected = 0x00001010; -#endif - - free (modex); - - return OPAL_SUCCESS; -} - -static inline int mca_btl_scif_ep_release (mca_btl_scif_endpoint_t *ep) -{ - OBJ_DESTRUCT(ep); - return OPAL_SUCCESS; -} - -#endif /* MCA_BTL_SCIF_ENDPOINT_H */ diff --git a/opal/mca/btl/scif/btl_scif_frag.c b/opal/mca/btl/scif/btl_scif_frag.c deleted file mode 100644 index 6a684defb63..00000000000 --- a/opal/mca/btl/scif/btl_scif_frag.c +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_scif.h" -#include "btl_scif_frag.h" - -static inline void mca_btl_scif_base_frag_constructor (mca_btl_scif_base_frag_t *frag) -{ - memset ((char *) frag + sizeof (frag->base), 0, sizeof (*frag) - sizeof (frag->base)); - frag->segments[0].seg_addr.pval = frag->base.super.ptr; -} - -static inline void mca_btl_scif_eager_frag_constructor (mca_btl_scif_base_frag_t *frag) -{ - memset ((char *) frag + sizeof (frag->base), 0, sizeof (*frag) - sizeof (frag->base)); - frag->segments[0].seg_addr.pval = frag->base.super.ptr; -} - -OBJ_CLASS_INSTANCE(mca_btl_scif_eager_frag_t, mca_btl_base_descriptor_t, - mca_btl_scif_base_frag_constructor, NULL); - -OBJ_CLASS_INSTANCE(mca_btl_scif_dma_frag_t, mca_btl_base_descriptor_t, - mca_btl_scif_base_frag_constructor, NULL); diff --git a/opal/mca/btl/scif/btl_scif_frag.h b/opal/mca/btl/scif/btl_scif_frag.h deleted file mode 100644 index d17ea2a5cec..00000000000 --- a/opal/mca/btl/scif/btl_scif_frag.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#if !defined(MCA_BTL_SCIF_FRAG_H) -#define MCA_BTL_SCIF_FRAG_H - -#include "btl_scif.h" -#include "btl_scif_endpoint.h" - -typedef struct mca_btl_scif_frag_hdr_t { -#if defined(SCIF_USE_SEQ) - uint32_t seq; -#endif - uint8_t tag; - uint8_t flags; - uint16_t size; -} mca_btl_scif_frag_hdr_t; - -struct mca_btl_scif_base_frag_t; - -typedef void (*frag_cb_t) (struct mca_btl_scif_base_frag_t *, int); - -typedef struct mca_btl_scif_base_frag_t { - mca_btl_base_descriptor_t base; - mca_btl_scif_frag_hdr_t hdr; - mca_btl_base_segment_t segments[2]; - mca_btl_base_endpoint_t *endpoint; - mca_btl_scif_reg_t *registration; - opal_free_list_t *my_list; -} mca_btl_scif_base_frag_t; - -typedef mca_btl_scif_base_frag_t mca_btl_scif_dma_frag_t; -typedef mca_btl_scif_base_frag_t mca_btl_scif_eager_frag_t; - -OBJ_CLASS_DECLARATION(mca_btl_scif_dma_frag_t); -OBJ_CLASS_DECLARATION(mca_btl_scif_eager_frag_t); - -static inline int mca_btl_scif_frag_alloc (mca_btl_base_endpoint_t *ep, - opal_free_list_t *list, - mca_btl_scif_base_frag_t **frag) -{ - *frag = (mca_btl_scif_base_frag_t *) opal_free_list_get (list); - if (OPAL_LIKELY(NULL != *frag)) { - (*frag)->my_list = list; - (*frag)->endpoint = ep; - return OPAL_SUCCESS; - } - - return OPAL_ERR_OUT_OF_RESOURCE; -} - -static inline int mca_btl_scif_frag_return (mca_btl_scif_base_frag_t *frag) -{ - if (frag->registration) { - frag->endpoint->btl->rcache->rcache_deregister (frag->endpoint->btl->rcache, - &frag->registration->base); - frag->registration = NULL; - } - - frag->segments[0].seg_addr.pval = frag->base.super.ptr; - frag->segments[0].seg_len = 0; - frag->segments[1].seg_len = 0; - - opal_free_list_return (frag->my_list, (opal_free_list_item_t *) frag); - - return OPAL_SUCCESS; -} - -static inline void mca_btl_scif_frag_complete (mca_btl_scif_base_frag_t *frag, int rc) { - BTL_VERBOSE(("frag complete. flags = %d", frag->base.des_flags)); - - /* call callback if specified */ - if (frag->base.des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - frag->base.des_cbfunc(&frag->endpoint->btl->super, frag->endpoint, &frag->base, rc); - } - - if (frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP) { - mca_btl_scif_frag_return (frag); - } -} - -#define MCA_BTL_SCIF_FRAG_ALLOC_EAGER(ep, frag) \ - mca_btl_scif_frag_alloc((ep), &(ep)->btl->eager_frags, &(frag)) -#define MCA_BTL_SCIF_FRAG_ALLOC_DMA(ep, frag) \ - mca_btl_scif_frag_alloc((ep), &(ep)->btl->dma_frags, &(frag)) - -#endif /* MCA_BTL_SCIF_FRAG_H */ diff --git a/opal/mca/btl/scif/btl_scif_get.c b/opal/mca/btl/scif/btl_scif_get.c deleted file mode 100644 index 3b68dfe8c95..00000000000 --- a/opal/mca/btl/scif/btl_scif_get.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "btl_scif_frag.h" - -#include - -#define lmin(a,b) ((a) < (b) ? (a) : (b)) - -/** - * Initiate a get operation. - */ -int mca_btl_scif_get (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - int rc, mark, scif_flags = 0; - off_t roffset, loffset; -#if defined(SCIF_TIMING) - struct timespec ts; - - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); - - mca_btl_scif_component.get_count++; -#endif - - BTL_VERBOSE(("Using DMA Get from remote address %" PRIx64 " to local address %p", - remote_address, local_address)); - - roffset = remote_handle->scif_offset + (off_t)(remote_address - remote_handle->scif_base); - loffset = local_handle->scif_offset + (off_t)((intptr_t)local_address - local_handle->scif_base); - - if (mca_btl_scif_component.rma_use_cpu) { - scif_flags = SCIF_RMA_USECPU; - } - - if (mca_btl_scif_component.rma_sync) { - scif_flags |= SCIF_RMA_SYNC; - } - - /* start the read */ - rc = scif_readfrom (endpoint->scif_epd, loffset, size, roffset, scif_flags); - if (OPAL_UNLIKELY(-1 == rc)) { - return OPAL_ERROR; - } - - if (!(scif_flags & SCIF_RMA_SYNC)) { - /* according to the scif documentation is is better to use a fence rather - * than using the SCIF_RMA_SYNC flag with scif_readfrom */ - scif_fence_mark (endpoint->scif_epd, SCIF_FENCE_INIT_SELF, &mark); - scif_fence_wait (endpoint->scif_epd, mark); - } - -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.get_time, - mca_btl_scif_component.get_time_max, ts); -#endif - - /* always call the callback function */ - cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/scif/btl_scif_module.c b/opal/mca/btl/scif/btl_scif_module.c deleted file mode 100644 index e5d3f09da8a..00000000000 --- a/opal/mca/btl/scif/btl_scif_module.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include "btl_scif.h" -#include "btl_scif_frag.h" -#include "btl_scif_endpoint.h" - -static int -mca_btl_scif_free (struct mca_btl_base_module_t *btl, - mca_btl_base_descriptor_t *des); - -static int -mca_btl_scif_module_finalize (struct mca_btl_base_module_t* btl); - -static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - void *base, size_t size, uint32_t flags); -static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle); - -static struct mca_btl_base_descriptor_t * -mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - struct opal_convertor_t *convertor, - uint8_t order, size_t reserve, size_t *size, - uint32_t flags); - -mca_btl_scif_module_t mca_btl_scif_module = { - .super = { - .btl_component = &mca_btl_scif_component.super, - .btl_add_procs = mca_btl_scif_add_procs, - .btl_del_procs = mca_btl_scif_del_procs, - .btl_finalize = mca_btl_scif_module_finalize, - .btl_alloc = mca_btl_scif_alloc, - .btl_free = mca_btl_scif_free, - .btl_prepare_src = mca_btl_scif_prepare_src, - .btl_send = mca_btl_scif_send, - .btl_sendi = mca_btl_scif_sendi, - .btl_put = mca_btl_scif_put, - .btl_get = mca_btl_scif_get, - .btl_register_mem = mca_btl_scif_register_mem, - .btl_deregister_mem = mca_btl_scif_deregister_mem, - } -}; - -int mca_btl_scif_module_init (void) -{ - int rc; - - /* create an endpoint to listen for connections */ - mca_btl_scif_module.scif_fd = scif_open (); - if (-1 == mca_btl_scif_module.scif_fd) { - BTL_VERBOSE(("scif_open failed. errno = %d", errno)); - return OPAL_ERROR; - } - - /* bind the endpoint to a port */ - mca_btl_scif_module.port_id.port = scif_bind (mca_btl_scif_module.scif_fd, 0); - if (-1 == mca_btl_scif_module.port_id.port) { - BTL_VERBOSE(("scif_bind failed. errno = %d", errno)); - scif_close (mca_btl_scif_module.scif_fd); - mca_btl_scif_module.scif_fd = -1; - return OPAL_ERROR; - } - - /* determine this processes node id */ - rc = scif_get_nodeIDs (NULL, 0, &mca_btl_scif_module.port_id.node); - if (-1 == rc) { - BTL_VERBOSE(("btl/scif error getting node id of this node")); - return OPAL_ERROR; - } - - /* Listen for connections */ - /* TODO - base the maximum backlog off something */ - rc = scif_listen (mca_btl_scif_module.scif_fd, 64); - if (-1 == rc) { - BTL_VERBOSE(("scif_listen failed. errno = %d", errno)); - scif_close (mca_btl_scif_module.scif_fd); - mca_btl_scif_module.scif_fd = -1; - return OPAL_ERROR; - } - - BTL_VERBOSE(("btl/scif: listening @ port %u on node %u\n", - mca_btl_scif_module.port_id.port, mca_btl_scif_module.port_id.node)); - - OBJ_CONSTRUCT(&mca_btl_scif_module.dma_frags, opal_free_list_t); - OBJ_CONSTRUCT(&mca_btl_scif_module.eager_frags, opal_free_list_t); - - return OPAL_SUCCESS; -} - -static int -mca_btl_scif_module_finalize (struct mca_btl_base_module_t *btl) -{ - mca_btl_scif_module_t *scif_module = (mca_btl_scif_module_t *) btl; - unsigned int i; - - OBJ_DESTRUCT(&mca_btl_scif_module.dma_frags); - OBJ_DESTRUCT(&mca_btl_scif_module.eager_frags); - - mca_btl_scif_module.exiting = true; - - /* close all open connections and release endpoints */ - if (NULL != scif_module->endpoints) { - for (i = 0 ; i < scif_module->endpoint_count ; ++i) { - mca_btl_scif_ep_release (scif_module->endpoints + i); - } - - free (scif_module->endpoints); - - scif_module->endpoint_count = 0; - scif_module->endpoints = NULL; - } - - if (NULL != scif_module->rcache) { - mca_rcache_base_module_destroy (scif_module->rcache); - scif_module->rcache = NULL; - } - - /* close the listening endpoint */ - if (mca_btl_scif_module.listening && -1 != mca_btl_scif_module.scif_fd) { - /* wake up the scif thread */ - scif_epd_t tmpfd; - tmpfd = scif_open(); - scif_connect (tmpfd, &mca_btl_scif_module.port_id); - pthread_join(mca_btl_scif_module.listen_thread, NULL); - scif_close(tmpfd); - scif_close (mca_btl_scif_module.scif_fd); - } - - mca_btl_scif_module.scif_fd = -1; - - return OPAL_SUCCESS; -} - -mca_btl_base_descriptor_t * -mca_btl_scif_alloc(struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - uint8_t order, size_t size, uint32_t flags) -{ - mca_btl_scif_base_frag_t *frag = NULL; - - BTL_VERBOSE(("allocating fragment of size: %u", (unsigned int)size)); - - if (size <= mca_btl_scif_module.super.btl_eager_limit) { - (void) MCA_BTL_SCIF_FRAG_ALLOC_EAGER(endpoint, frag); - } - - if (OPAL_UNLIKELY(NULL == frag)) { - return NULL; - } - - BTL_VERBOSE(("btl/scif_module allocated frag of size: %u, flags: %x. frag = %p", - (unsigned int)size, flags, (void *) frag)); - - frag->base.des_flags = flags; - frag->base.order = order; - frag->base.des_segments = frag->segments; - frag->base.des_segment_count = 1; - - frag->segments[0].seg_len = size; - - return &frag->base; -} - -static int -mca_btl_scif_free (struct mca_btl_base_module_t *btl, - mca_btl_base_descriptor_t *des) -{ - return mca_btl_scif_frag_return ((mca_btl_scif_base_frag_t *) des); -} - -static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - void *base, size_t size, uint32_t flags) -{ - mca_btl_scif_module_t *scif_module = &mca_btl_scif_module; - mca_btl_scif_reg_t *scif_reg; - int access_flags = flags & MCA_BTL_REG_FLAG_ACCESS_ANY; - int rc; - - if (MCA_BTL_ENDPOINT_ANY == endpoint) { - /* it probably isn't possible to support registering memory to use with any endpoint so - * return NULL */ - return NULL; - } - - if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - /* the endpoint needs to be connected before the fragment can be - * registered. */ - rc = mca_btl_scif_ep_connect (endpoint); - if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - /* not yet connected */ - return NULL; - } - } - - rc = scif_module->rcache->rcache_register (scif_module->rcache, base, size, 0, access_flags, - (mca_rcache_base_registration_t **) &scif_reg); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - return NULL; - } - - /* register the memory location with this peer if it isn't already */ - if ((off_t) -1 == scif_reg->handles[endpoint->id].btl_handle.scif_offset) { - size_t seg_size = (size_t)((uintptr_t) scif_reg->base.bound - (uintptr_t) scif_reg->base.base) + 1; - - /* NTH: until we determine a way to pass permissions to the rcache just make all segments - * read/write */ - scif_reg->handles[endpoint->id].btl_handle.scif_offset = - scif_register (endpoint->scif_epd, scif_reg->base.base, seg_size, 0, SCIF_PROT_READ | - SCIF_PROT_WRITE, 0); - BTL_VERBOSE(("registered fragment for scif DMA transaction. offset = %lu", - (unsigned long) scif_reg->handles[endpoint->id].btl_handle.scif_offset)); - } - - return &scif_reg->handles[endpoint->id].btl_handle; -} - -static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle) -{ - mca_btl_scif_registration_handle_t *scif_handle = (mca_btl_scif_registration_handle_t *) handle; - mca_btl_scif_module_t *scif_module = &mca_btl_scif_module; - mca_btl_scif_reg_t *scif_reg = scif_handle->reg; - - scif_module->rcache->rcache_deregister (scif_module->rcache, &scif_reg->base); - - return OPAL_SUCCESS; -} - -static inline struct mca_btl_base_descriptor_t * -mca_btl_scif_prepare_src_send (struct mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - struct opal_convertor_t *convertor, - uint8_t order, size_t reserve, size_t *size, - uint32_t flags) -{ - mca_btl_scif_base_frag_t *frag = NULL; - uint32_t iov_count = 1; - struct iovec iov; - size_t max_size = *size; - int rc; - - if (OPAL_LIKELY((mca_btl_scif_module.super.btl_flags & MCA_BTL_FLAGS_SEND_INPLACE) && - !opal_convertor_need_buffers (convertor) && - reserve <= 128)) { - /* inplace send */ - void *data_ptr; - opal_convertor_get_current_pointer (convertor, &data_ptr); - - (void) MCA_BTL_SCIF_FRAG_ALLOC_DMA(endpoint, frag); - if (OPAL_UNLIKELY(NULL == frag)) { - return NULL; - } - - frag->segments[0].seg_len = reserve; - frag->segments[1].seg_addr.pval = data_ptr; - frag->segments[1].seg_len = *size; - frag->base.des_segment_count = 2; - } else { - /* buffered send */ - (void) MCA_BTL_SCIF_FRAG_ALLOC_EAGER(endpoint, frag); - if (OPAL_UNLIKELY(NULL == frag)) { - return NULL; - } - - if (*size) { - iov.iov_len = *size; - iov.iov_base = (IOVBASE_TYPE *) ((uintptr_t) frag->segments[0].seg_addr.pval + reserve); - - rc = opal_convertor_pack (convertor, &iov, &iov_count, &max_size); - if (OPAL_UNLIKELY(rc < 0)) { - mca_btl_scif_frag_return (frag); - return NULL; - } - *size = max_size; - } - - frag->segments[0].seg_len = reserve + *size; - frag->base.des_segment_count = 1; - } - - frag->base.des_segments = frag->segments; - frag->base.order = order; - frag->base.des_flags = flags; - - return &frag->base; -} - -static mca_btl_base_descriptor_t *mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - struct opal_convertor_t *convertor, - uint8_t order, size_t reserve, size_t *size, - uint32_t flags) -{ - return mca_btl_scif_prepare_src_send (btl, endpoint, convertor, order, reserve, size, flags); -} diff --git a/opal/mca/btl/scif/btl_scif_put.c b/opal/mca/btl/scif/btl_scif_put.c deleted file mode 100644 index 27355a3e5c5..00000000000 --- a/opal/mca/btl/scif/btl_scif_put.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "btl_scif_frag.h" - -#define lmin(a,b) ((a) < (b) ? (a) : (b)) - -/** - * Initiate a put operation. - */ -int mca_btl_scif_put (mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - int rc, mark, scif_flags = 0; - off_t roffset, loffset; -#if defined(SCIF_TIMING) - struct timespec ts; - - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); - - mca_btl_scif_component.get_count++; -#endif - - BTL_VERBOSE(("Using DMA Put from local address %p to remote address %" PRIx64, - local_address, remote_address)); - - roffset = remote_handle->scif_offset + (off_t)(remote_address - remote_handle->scif_base); - loffset = local_handle->scif_offset + (off_t)((intptr_t) local_address - local_handle->scif_base); - - if (mca_btl_scif_component.rma_use_cpu) { - scif_flags = SCIF_RMA_USECPU; - } - - if (mca_btl_scif_component.rma_sync) { - scif_flags |= SCIF_RMA_SYNC; - } - - /* start the write */ - rc = scif_writeto (endpoint->scif_epd, loffset, size, roffset, scif_flags); - rc = scif_readfrom (endpoint->scif_epd, loffset, size, roffset, scif_flags); - if (OPAL_UNLIKELY(-1 == rc)) { - return OPAL_ERROR; - } - - if (!(scif_flags & SCIF_RMA_SYNC)) { - /* according to the scif documentation is is better to use a fence rather - * than using the SCIF_RMA_SYNC flag with scif_readfrom */ - scif_fence_mark (endpoint->scif_epd, SCIF_FENCE_INIT_SELF, &mark); - scif_fence_wait (endpoint->scif_epd, mark); - } - -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.get_time, - mca_btl_scif_component.get_time_max, ts); -#endif - - /* always call the callback function */ - cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/scif/btl_scif_send.c b/opal/mca/btl/scif/btl_scif_send.c deleted file mode 100644 index 008e23b439c..00000000000 --- a/opal/mca/btl/scif/btl_scif_send.c +++ /dev/null @@ -1,299 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_scif.h" -#include "btl_scif_frag.h" - -#define BUFFER_FREE(s,e,hbm) (((s) > (e) || ((s) == (e) && !hbm)) ? (s) - (e) : (mca_btl_scif_component.segment_size - (e))) - -/* attempt to reserve a contiguous segment from the remote endpoint */ -static inline int mca_btl_scif_send_get_buffer (mca_btl_base_endpoint_t *endpoint, size_t size, unsigned char * restrict *dst) -{ - /* the high bit helps determine if the buffer is empty or full */ - bool hbm = (endpoint->send_buffer.start >> 31) == (endpoint->send_buffer.end >> 31); - const unsigned int segment_size = mca_btl_scif_component.segment_size; - unsigned int start = endpoint->send_buffer.start & ~ (1 << 31); - unsigned int end = endpoint->send_buffer.end & ~ (1 << 31); - unsigned int buffer_free = BUFFER_FREE(start, end, hbm); -#if defined(SCIF_TIMING) - struct timespec ts; - - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); -#endif - - /* need space for the fragment + the header */ - size += sizeof (mca_btl_scif_frag_hdr_t); - - /* check if we need to free up space for this fragment */ - if (OPAL_UNLIKELY(buffer_free < size)) { - BTL_VERBOSE(("not enough room for a fragment of size %u. in use buffer segment: {start: %x, end: %x, high bit matches: %d}\n", - (unsigned) size, start, end, (int) hbm)); - - /* read the current start pointer from the remote peer */ - start = endpoint->send_buffer.start = endpoint->send_buffer.startp[0]; - start &= ~ (1 << 31); - hbm = (endpoint->send_buffer.start >> 31) == (endpoint->send_buffer.end >> 31); - buffer_free = BUFFER_FREE(start, end, hbm); - - opal_atomic_rmb (); - - /* if this is the end of the buffer. does the fragment fit? */ - if (OPAL_UNLIKELY(buffer_free > 0 && buffer_free < size && start <= end)) { - mca_btl_scif_frag_hdr_t hdr; - - hdr.size = buffer_free - sizeof (mca_btl_scif_frag_hdr_t); - hdr.tag = 0xff; -#if defined(SCIF_USE_SEQ) - hdr.seq = endpoint->seq_next++; - ((uint64_t *) (endpoint->send_buffer.buffer + end))[0] = *((uint64_t *) &hdr); -#else - ((uint32_t *) (endpoint->send_buffer.buffer + end))[0] = *((uint32_t *) &hdr); -#endif - - /* toggle the high bit */ - end = 64; - endpoint->send_buffer.end = ((endpoint->send_buffer.end & (1 << 31)) ^ (1 << 31)) | end; - hbm = (endpoint->send_buffer.start >> 31) == (endpoint->send_buffer.end >> 31); - buffer_free = BUFFER_FREE(start, end, hbm); - } - - if (OPAL_UNLIKELY(buffer_free < size)) { -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.aquire_buffer_time, mca_btl_scif_component.aquire_buffer_time_max, ts); -#endif - return OPAL_ERR_OUT_OF_RESOURCE; - } - } - - BTL_VERBOSE(("writing fragment of size %u to offset %u {start: %x, end: %x} of peer's buffer. free = %u", - (unsigned int) size, end, start, end, buffer_free)); - - *dst = endpoint->send_buffer.buffer + end; - - /* align the buffer on a 64 byte boundary */ - end = (end + size + 63) & ~63; - - if (OPAL_UNLIKELY(segment_size == end)) { - endpoint->send_buffer.end = ((endpoint->send_buffer.end & (1 << 31)) ^ (1 << 31)) | 64; - } else { - endpoint->send_buffer.end = (endpoint->send_buffer.end & (1 << 31)) | end; - } - -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.aquire_buffer_time, mca_btl_scif_component.aquire_buffer_time_max, ts); -#endif - - return OPAL_SUCCESS; -} - -static void mark_buffer (struct mca_btl_base_endpoint_t *endpoint) -{ - if (endpoint->port_id.node != mca_btl_scif_module.port_id.node) { - /* force the PCIe bus to flush by reading from the remote node */ - volatile uint32_t start = endpoint->send_buffer.startp[0]; (void)start; - - endpoint->send_buffer.endp[0] = endpoint->send_buffer.end; - - endpoint->send_buffer.start = endpoint->send_buffer.startp[0]; - } else { - MB(); - endpoint->send_buffer.endp[0] = endpoint->send_buffer.end; - } -} - -static int mca_btl_scif_send_frag (struct mca_btl_base_endpoint_t *endpoint, - mca_btl_scif_base_frag_t *frag) -{ - size_t size = frag->hdr.size; - unsigned char * restrict dst; - - BTL_VERBOSE(("btl/scif sending descriptor %p from %d -> %d. length = %" PRIu64, (void *) frag, - OPAL_PROC_MY_NAME.vpid, endpoint->peer_proc->proc_name.vpid, frag->segments[0].seg_len)); - - if (OPAL_LIKELY(OPAL_SUCCESS == mca_btl_scif_send_get_buffer (endpoint, size, &dst))) { - unsigned char * restrict data = (unsigned char * restrict) frag->segments[0].seg_addr.pval; -#if defined(SCIF_TIMING) - struct timespec ts; - - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); -#endif - - memcpy (dst + sizeof (frag->hdr), data, frag->segments[0].seg_len); - - if (frag->segments[1].seg_len) { - memcpy (dst + sizeof (frag->hdr) + frag->segments[0].seg_len, - frag->segments[1].seg_addr.pval, - frag->segments[1].seg_len); - } - -#if defined(SCIF_USE_SEQ) - frag->hdr.seq = endpoint->seq_next++; - /* write the tag to signal the fragment is available */ - ((uint64_t *) dst)[0] = *((uint64_t *) &frag->hdr); -#else - ((uint32_t *) dst)[0] = *((uint32_t *) &frag->hdr); -#endif - - opal_atomic_wmb (); - -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.send_time, mca_btl_scif_component.send_time_max, ts); -#endif - - /* fragment is gone */ - mca_btl_scif_frag_complete (frag, OPAL_SUCCESS); - - return 1; - } - - return OPAL_ERR_OUT_OF_RESOURCE; -} - -int mca_btl_scif_send (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - struct mca_btl_base_descriptor_t *descriptor, - mca_btl_base_tag_t tag) -{ - mca_btl_scif_base_frag_t *frag = (mca_btl_scif_base_frag_t *) descriptor; - size_t size = frag->segments[0].seg_len + frag->segments[1].seg_len; - int rc; - - frag->hdr.tag = tag; - frag->hdr.size = size; - - if (OPAL_UNLIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - rc = mca_btl_scif_ep_connect (endpoint); - if (OPAL_UNLIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - /* the receiver was not ready to handle the fragment. queue up the fragment. */ - descriptor->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; - opal_list_append (&endpoint->frag_wait_list, (opal_list_item_t *) descriptor); - return OPAL_SUCCESS; - } - } - - rc = mca_btl_scif_send_frag (endpoint, frag); - if (OPAL_LIKELY(1 == rc)) { - mark_buffer (endpoint); - return 1; - } - - /* the receiver was not ready to handle the fragment. queue up the fragment. */ - descriptor->des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; - opal_list_append (&endpoint->frag_wait_list, (opal_list_item_t *) descriptor); - - return OPAL_SUCCESS; -} - -int mca_btl_scif_sendi (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, - struct opal_convertor_t *convertor, - void *header, size_t header_size, - size_t payload_size, uint8_t order, - uint32_t flags, mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t **descriptor) -{ - size_t length = (header_size + payload_size); - unsigned char * restrict base; - mca_btl_scif_frag_hdr_t hdr; - size_t max_data; - int rc; -#if defined(SCIF_TIMING) - struct timespec ts; -#endif - - assert (length < mca_btl_scif_module.super.btl_eager_limit); - assert (0 == (flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK)); - - if (OPAL_UNLIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - rc = mca_btl_scif_ep_connect (endpoint); - if (OPAL_UNLIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) { - return OPAL_ERR_RESOURCE_BUSY; - } - } - - rc = mca_btl_scif_send_get_buffer (endpoint, length, &base); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - if (NULL != descriptor) { - *descriptor = NULL; - } - return OPAL_ERR_OUT_OF_RESOURCE; - } - -#if defined(SCIF_TIMING) - clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); -#endif - - /* fill in the fragment header (except for the tag) */ - hdr.size = length; - hdr.tag = tag; - -#if defined(SCIF_USE_SEQ) - hdr.seq = endpoint->seq_next++; -#endif - - /* write the match header (with MPI comm/tag/etc. info) */ - memcpy (base + sizeof (hdr), header, header_size); - - if (payload_size) { - uint32_t iov_count = 1; - struct iovec iov[1]; - - iov[0].iov_base = base + sizeof (hdr) + header_size; - iov[0].iov_len = payload_size; - - /* move the data */ - opal_convertor_pack (convertor, iov, &iov_count, &max_data); - - assert (max_data == payload_size); - } - -#if defined(SCIF_USE_SEQ) - /* signal the remote side that this fragment is available */ - ((uint64_t *)base)[0] = *((uint64_t *) &hdr); -#else - ((uint32_t *)base)[0] = *((uint32_t *) &hdr); -#endif - - opal_atomic_wmb (); - - mark_buffer (endpoint); - -#if defined(SCIF_TIMING) - SCIF_UPDATE_TIMER(mca_btl_scif_component.sendi_time, mca_btl_scif_component.sendi_time_max, ts); -#endif - - return OPAL_SUCCESS; -} - -int mca_btl_scif_progress_send_wait_list (mca_btl_base_endpoint_t *endpoint) -{ - mca_btl_scif_base_frag_t *frag; - int rc = OPAL_SUCCESS; - - while (NULL != - (frag = (mca_btl_scif_base_frag_t *) opal_list_remove_first (&endpoint->frag_wait_list))) { - rc = mca_btl_scif_send_frag (endpoint, frag); - if (OPAL_UNLIKELY(OPAL_SUCCESS > rc)) { - if (OPAL_LIKELY(OPAL_ERR_OUT_OF_RESOURCE == rc)) { - opal_list_prepend (&endpoint->frag_wait_list, (opal_list_item_t *) frag); - } else { - mca_btl_scif_frag_complete (frag, rc); - } - - break; - } - } - - mark_buffer (endpoint); - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/scif/configure.m4 b/opal/mca/btl/scif/configure.m4 deleted file mode 100644 index f8b814e2e70..00000000000 --- a/opal/mca/btl/scif/configure.m4 +++ /dev/null @@ -1,47 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights -# reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AC_DEFUN([MCA_opal_btl_scif_CONFIG],[ - OPAL_VAR_SCOPE_PUSH([opal_btl_scif_happy]) - AC_CONFIG_FILES([opal/mca/btl/scif/Makefile]) - - AC_ARG_WITH([scif], [AC_HELP_STRING([--with-scif(=DIR)]), - [Build with SCIF, searching for headers in DIR])]) - OPAL_CHECK_WITHDIR([scif], [$with_scif], [include/scif.h]) - - opal_btl_scif_happy="no" - - if test "$with_scif" != "no" ; then - if test -n "$with_scif" && test "$with_scif" != "yes" ; then - opal_check_scif_dir=$with_scif - fi - - OPAL_CHECK_PACKAGE([btl_scif], [scif.h], [scif], [scif_open], [], - [$opal_check_scif_dir], [], [opal_btl_scif_happy="yes"], []) - - if test "$opal_btl_scif_happy" != "yes" && test -n "$with_scif" ; then - AC_MSG_ERROR([SCIF support requested but not found. Aborting]) - fi - fi - - AS_IF([test "$opal_btl_scif_happy" = "yes"], [$1], [$2]) - - OPAL_SUMMARY_ADD([[Transports]],[[Intel SCIF]],[[btl_scif]],[$opal_btl_scif_happy]) - - # substitute in the things needed to build scif - AC_SUBST([btl_scif_CPPFLAGS]) - AC_SUBST([btl_scif_LDFLAGS]) - AC_SUBST([btl_scif_LIBS]) - OPAL_VAR_SCOPE_POP -])dnl diff --git a/opal/mca/btl/scif/owner.txt b/opal/mca/btl/scif/owner.txt deleted file mode 100644 index 30615e90eb7..00000000000 --- a/opal/mca/btl/scif/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner:LANL -status: maintenance From 98156b7aceb948313a39881a07e438ef58ba35d3 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 19 Sep 2018 11:36:13 +0900 Subject: [PATCH 088/674] use-mpi-f08: fix a typo in [P]MPI_Dist_graph_create_adjacent bindings Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@d2393251f7259a72ad0409d2bff8016646cc6bcb) --- .../fortran/use-mpi-f08/dist_graph_create_adjacent_f08.F90 | 4 +++- .../use-mpi-f08/profile/pdist_graph_create_adjacent_f08.F90 | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/dist_graph_create_adjacent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/dist_graph_create_adjacent_f08.F90 index 884d4df36ef..b5f5b9ad7df 100644 --- a/ompi/mpi/fortran/use-mpi-f08/dist_graph_create_adjacent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/dist_graph_create_adjacent_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourceweights,& @@ -25,6 +27,6 @@ subroutine MPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourcewe call PMPI_Dist_graph_create_adjacent(comm_old%MPI_VAL,indegree,sources,& sourceweights,outdegree,destinations,& destweights,info%MPI_VAL,& - reorder,comm_dist_graph%MPI_VAL,ierror) + reorder,comm_dist_graph%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror end subroutine MPI_Dist_graph_create_adjacent_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_create_adjacent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_create_adjacent_f08.F90 index ecee01e4ef3..6d413a45004 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_create_adjacent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_create_adjacent_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourceweights,& @@ -25,6 +27,6 @@ subroutine PMPI_Dist_graph_create_adjacent_f08(comm_old,indegree,sources,sourcew call PMPI_Dist_graph_create_adjacent(comm_old%MPI_VAL,indegree,sources,& sourceweights,outdegree,destinations,& destweights,info%MPI_VAL,& - reorder,comm_dist_graph%MPI_VAL,ierror) + reorder,comm_dist_graph%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror end subroutine PMPI_Dist_graph_create_adjacent_f08 From 03d994c9cf5bd9924dcccfabf545368e2638befe Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 19 Sep 2018 13:47:49 +0900 Subject: [PATCH 089/674] configury: do not define "dummy" empty targets any more. We previously needed to have empty targets because AM couldn't handle having an AM_CONDITIONAL was targets in the "if" statement but not in the "else". :-( That now appears as an old automake bug that has been fixed, so cleanup some Makefile.am Thanks Jeff for the pointer. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@6e04b2a66a3b22741352c759c246a14e69a8e802) --- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 8 -------- ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am | 10 +--------- ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am | 10 +--------- 3 files changed, 2 insertions(+), 26 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 0d05bc5743b..1de687b1553 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -852,13 +852,5 @@ uninstall-local: echo rm -f $(DESTDIR)$(libdir)/$$file; \ rm -f $(DESTDIR)$(libdir)/$$file; \ done -else - -# Need to have empty targets because AM can't handle having an -# AM_CONDITIONAL was targets in the "if" statement but not in the -# "else". :-( - -install-exec-hook: -uninstall-local: endif diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index e8dc8bfbb5c..45b7753b2be 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-2016 Research Organization for Information Science +# Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # @@ -90,13 +90,5 @@ uninstall-local: echo rm -f $(DESTDIR)$(libdir)/$$file; \ rm -f $(DESTDIR)$(libdir)/$$file; \ done -else - -# Need to have empty targets because AM can't handle having an -# AM_CONDITIONAL was targets in the "if" statement but not in the -# "else". :-( - -install-exec-hook: -uninstall-local: endif diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index d842e6a288d..281e24b17fc 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -1,7 +1,7 @@ # -*- makefile -*- # # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science +# Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # @@ -111,13 +111,5 @@ uninstall-local: echo rm -f $(DESTDIR)$(libdir)/$$file; \ rm -f $(DESTDIR)$(libdir)/$$file; \ done -else - -# Need to have empty targets because AM can't handle having an -# AM_CONDITIONAL was targets in the "if" statement but not in the -# "else". :-( - -install-exec-hook: -uninstall-local: endif From afb66d222ba8fddfc74c6e2c39232ca2b142e8a7 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 18 Jul 2018 16:44:14 +0900 Subject: [PATCH 090/674] fortran/use-mpi-f08: fix [p]ompi_FOO_f symbols handling - do not generate bindings for pompi_FOO_f symbols (they are simply not used anywhere) - move ompi_FOO_f bindings out of mpi_f08.mod into ompi_mpifh_bindings.mod that is only used at build time Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@c6070fd2e0fae48803b9f909aa63614a1705a2dc) --- config/ompi_config_files.m4 | 3 +- ompi/Makefile.am | 4 +- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 11 +- .../fortran/use-mpi-f08/bindings/Makefile.am | 61 + .../{ => bindings}/mpi-f-interfaces-bind.h | 0 .../bindings/ompi-mpifh-bindings.F90 | 35 + ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 | 9 +- .../use-mpi-f08/pmpi-f-interfaces-bind.h | 3251 ----------------- 8 files changed, 106 insertions(+), 3268 deletions(-) create mode 100644 ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am rename ompi/mpi/fortran/use-mpi-f08/{ => bindings}/mpi-f-interfaces-bind.h (100%) create mode 100644 ompi/mpi/fortran/use-mpi-f08/bindings/ompi-mpifh-bindings.F90 delete mode 100644 ompi/mpi/fortran/use-mpi-f08/pmpi-f-interfaces-bind.h diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 160a5d1c528..274b404d75d 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -1,7 +1,7 @@ # -*- shell-script -*- # # Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved -# Copyright (c) 2017 Research Organization for Information Science +# Copyright (c) 2017-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 Los Alamos National Security, LLC. All rights # reserved. @@ -38,6 +38,7 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-removed-interfaces.h ompi/mpi/fortran/use-mpi-f08/Makefile + ompi/mpi/fortran/use-mpi-f08/bindings/Makefile ompi/mpi/fortran/use-mpi-f08/mod/Makefile ompi/mpi/fortran/mpiext-use-mpi/Makefile ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile diff --git a/ompi/Makefile.am b/ompi/Makefile.am index cd5ff0f5281..5d1ce31ea88 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -15,7 +15,7 @@ # Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2015-2017 Intel, Inc. All rights reserved. -# Copyright (c) 2015-2017 Research Organization for Information Science +# Copyright (c) 2015-2018 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. @@ -93,6 +93,7 @@ SUBDIRS = \ $(OMPI_FORTRAN_USEMPI_DIR) \ mpi/fortran/mpiext-use-mpi \ mpi/fortran/use-mpi-f08/mod \ + mpi/fortran/use-mpi-f08/bindings \ $(OMPI_MPIEXT_USEMPIF08_DIRS) \ mpi/fortran/use-mpi-f08 \ mpi/fortran/mpiext-use-mpi-f08 \ @@ -124,6 +125,7 @@ DIST_SUBDIRS = \ mpi/fortran/mpiext-use-mpi \ mpi/fortran/use-mpi-f08 \ mpi/fortran/use-mpi-f08/mod \ + mpi/fortran/use-mpi-f08/bindings \ mpi/fortran/mpiext-use-mpi-f08 \ mpi/java \ $(OMPI_MPIEXT_ALL_SUBDIRS) \ diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index 1de687b1553..dc9de8e379c 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-2017 Research Organization for Information Science +# Copyright (c) 2015-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. @@ -29,6 +29,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG)mod \ + $(OMPI_FC_MODULE_FLAG)bindings \ -I$(top_srcdir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod @@ -42,7 +43,6 @@ module_sentinel_file = \ mpi-f08.lo: $(module_sentinel_file) mpi-f08.lo: mpi-f08.F90 -mpi-f08.lo: mpi-f-interfaces-bind.h pmpi-f-interfaces-bind.h mpi-f08.lo: sizeof_f08.h # @@ -792,8 +792,6 @@ pmpi_api_files = \ lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \ $(mpi_api_files) \ $(pmpi_api_files) \ - mpi-f-interfaces-bind.h \ - pmpi-f-interfaces-bind.h \ mpi-f08.F90 \ buffer_detach.c \ constants.h \ @@ -830,11 +828,10 @@ lib@OMPI_LIBMPI_NAME@_usempif08_la_LDFLAGS = -version-info $(libmpi_usempif08_so mpi_api_lo_files = $(mpi_api_files:.F90=.lo) pmpi_api_lo_files = $(pmpi_api_files:.F90=.lo) -$(mpi_api_lo_files): mpi-f08.lo -$(pmpi_api_lo_files): mpi-f08.lo +$(mpi_api_lo_files): mpi-f08.lo bindings/libforce_usempif08_internal_bindings_to_be_built.la +$(pmpi_api_lo_files): mpi-f08.lo bindings/libforce_usempif08_internal_bindings_to_be_built.la mpi-f08.lo: $(module_sentinel_file) $(SIZEOF_H) -mpi-f08.lo: mpi-f-interfaces-bind.h pmpi-f-interfaces-bind.h ########################################################################### diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am new file mode 100644 index 00000000000..77f861a6baf --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am @@ -0,0 +1,61 @@ +# -*- makefile -*- +# +# Copyright (c) 2006-2015 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-2018 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 + +# This Makefile is only relevant if we're building the "use mpi_f08" +# MPI bindings. +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/$(OMPI_FORTRAN_USEMPI_DIR) \ + $(OMPI_FC_MODULE_FLAG). \ + $(OMPI_FC_MODULE_FLAG)../mod \ + -I$(top_srcdir) $(FCFLAGS_f90) + +MOSTLYCLEANFILES = *.mod + +CLEANFILES += *.i90 + +########################################################################### + +module_sentinel_file = \ + libforce_usempif08_internal_bindings_to_be_built.la + +noinst_LTLIBRARIES = $(module_sentinel_file) + +# f08 support modules + +libforce_usempif08_internal_bindings_to_be_built_la_SOURCES = \ + mpi-f-interfaces-bind.h \ + ompi-mpifh-bindings.F90 + +# +# Automake doesn't do Fortran dependency analysis, so must list them +# manually here. Bummer! +# + +ompi-mpifh-bindings.lo: mpi-f-interfaces-bind.h + +distclean-local: + rm -f *.mod + +endif diff --git a/ompi/mpi/fortran/use-mpi-f08/mpi-f-interfaces-bind.h b/ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h similarity index 100% rename from ompi/mpi/fortran/use-mpi-f08/mpi-f-interfaces-bind.h rename to ompi/mpi/fortran/use-mpi-f08/bindings/mpi-f-interfaces-bind.h diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/ompi-mpifh-bindings.F90 b/ompi/mpi/fortran/use-mpi-f08/bindings/ompi-mpifh-bindings.F90 new file mode 100644 index 00000000000..295c5a9d40f --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/ompi-mpifh-bindings.F90 @@ -0,0 +1,35 @@ +! -*- f90 -*- +! +! Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +! University Research and Technology +! Corporation. All rights reserved. +! Copyright (c) 2004-2005 The University of Tennessee and The University +! of Tennessee Research Foundation. All rights +! reserved. +! Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +! University of Stuttgart. All rights reserved. +! Copyright (c) 2004-2005 The Regents of the University of California. +! All rights reserved. +! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. +! Copyright (c) 2009-2012 Los Alamos National Security, LLC. +! All rights reserved. +! Copyright (c) 2016-2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ +! + +#include "ompi/mpi/fortran/configure-fortran-output.h" + +module ompi_mpifh_bindings + +! +! Declaration of the interfaces to the ompi impl files +! e.g., send_f.c +! +#include "mpi-f-interfaces-bind.h" + +end module ompi_mpifh_bindings diff --git a/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 b/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 index 2cd04596e09..89054d8d30e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mpi-f08.F90 @@ -13,7 +13,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) 2016-2017 Research Organization for Information Science +! Copyright (c) 2016-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -32,13 +32,6 @@ module mpi_f08 use mpi_f08_callbacks ! this module contains the mpi_f08 attribute callback subroutines use mpi_f08_interfaces_callbacks ! this module contains the mpi_f08 callback interfaces -! -! Declaration of the interfaces to the ompi impl files -! e.g., send_f.c -! -#include "mpi-f-interfaces-bind.h" -#include "pmpi-f-interfaces-bind.h" - ! The sizeof interfaces include "sizeof_f08.h" diff --git a/ompi/mpi/fortran/use-mpi-f08/pmpi-f-interfaces-bind.h b/ompi/mpi/fortran/use-mpi-f08/pmpi-f-interfaces-bind.h deleted file mode 100644 index 5a95b883058..00000000000 --- a/ompi/mpi/fortran/use-mpi-f08/pmpi-f-interfaces-bind.h +++ /dev/null @@ -1,3251 +0,0 @@ -! -*- f90 -*- -! -! Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. -! Copyright (c) 2009-2012 Los Alamos National Security, LLC. -! All rights reserved. -! Copyright (c) 2012 The University of Tennessee and The University -! of Tennessee Research Foundation. All rights -! reserved. -! Copyright (c) 2012 Inria. All rights reserved. -! Copyright (c) 2015-2018 Research Organization for Information Science -! and Technology (RIST). All rights reserved. -! $COPYRIGHT$ -! -! This file provides the interface specifications for the MPI Fortran -! API bindings. It effectively maps between public names ("MPI_Init") -! and the back-end implementation subroutine name (e.g., "pompi_init_f"). - -#include "ompi/mpi/fortran/configure-fortran-output.h" - -! -! Note that interfaces for the following subroutines are not included -! in this file because they contain LOGICAL dummy parameters, and -! therefore cannot be BIND(C). Instead, the individual wrapper -! implementation files (e.g., iprobe_f08.F90) use the "mpi" module to -! get a interface for the subroutine and call the PMPI_* name of the -! function, which then invokes the corresponding function in the -! ompi/mpi/fortran/mpif-h directory. -! -! MPI_Cart_create -! MPI_Cart_get -! MPI_Cart_map -! MPI_Cart_sub -! MPI_Comm_get_attr -! MPI_Comm_test_inter -! MPI_Dist_graph_create -! MPI_Dist_graph_create_adjacent -! MPI_Dist_graph_neighbors_count -! MPI_File_get_atomicity -! MPI_File_set_atomicity -! MPI_Finalized -! MPI_Graph_create -! MPI_Improbe -! MPI_Info_get -! MPI_Info_get_valuelen -! MPI_Initialized -! MPI_Intercomm_merge -! MPI_Iprobe -! MPI_Is_thread_main -! MPI_Op_commutative -! MPI_Op_create -! MPI_Request_get_status -! MPI_Status_set_cancelled -! MPI_Test -! MPI_Testall -! MPI_Testany -! MPI_Testsome -! MPI_Test_cancelled -! MPI_Type_get_attr -! MPI_Win_get_attr -! MPI_Win_test -! - -interface - -subroutine pompi_bsend_f(buf,count,datatype,dest,tag,comm,ierror) & - BIND(C, name="pompi_bsend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_bsend_f - -subroutine pompi_bsend_init_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_bsend_init_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_bsend_init_f - -subroutine pompi_buffer_attach_f(buffer,size,ierror) & - BIND(C, name="pompi_buffer_attach_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer - INTEGER, INTENT(IN) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_buffer_attach_f - -! Note that we have an F08-specific C implementation function for -! PMPI_BUFFER_DETACH (i.e., it is different than the mpif.h / mpi -! module C implementation function). -! -! Note, too, the "p" version of the C implementation -! function is a 1-line routine. It calls -! ompi_buffer_detach_f08 C function. -subroutine pompi_buffer_detach_f(buffer_addr,size,ierror) & - BIND(C, name="pompi_buffer_detach_f08") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer_addr - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_buffer_detach_f - -subroutine pompi_cancel_f(request,ierror) & - BIND(C, name="pompi_cancel_f") - implicit none - INTEGER, INTENT(IN) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_cancel_f - -subroutine pompi_get_count_f(status,datatype,count,ierror) & - BIND(C, name="pompi_get_count_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - TYPE(MPI_Status), INTENT(IN) :: status - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: count - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_count_f - -subroutine pompi_ibsend_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_ibsend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ibsend_f - -subroutine pompi_irecv_f(buf,count,datatype,source,tag,comm,request,ierror) & - BIND(C, name="pompi_irecv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf - INTEGER, INTENT(IN) :: count, source, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_irecv_f - -subroutine pompi_irsend_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_irsend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_irsend_f - -subroutine pompi_isend_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_isend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_isend_f - -subroutine pompi_issend_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_issend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_issend_f - -subroutine pompi_probe_f(source,tag,comm,status,ierror) & - BIND(C, name="pompi_probe_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: source, tag - INTEGER, INTENT(IN) :: comm - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_probe_f - -subroutine pompi_recv_f(buf,count,datatype,source,tag,comm,status,ierror) & - BIND(C, name="pompi_recv_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf - INTEGER, INTENT(IN) :: count, source, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_recv_f - -subroutine pompi_recv_init_f(buf,count,datatype,source,tag,comm,request,ierror) & - BIND(C, name="pompi_recv_init_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, source, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_recv_init_f - -subroutine pompi_request_free_f(request,ierror) & - BIND(C, name="pompi_request_free_f") - implicit none - INTEGER, INTENT(INOUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_request_free_f - -subroutine pompi_rsend_f(buf,count,datatype,dest,tag,comm,ierror) & - BIND(C, name="pompi_rsend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_rsend_f - -subroutine pompi_rsend_init_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_rsend_init_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_rsend_init_f - -subroutine pompi_send_f(buf,count,datatype,dest,tag,comm,ierror) & - BIND(C, name="pompi_send_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_send_f - -subroutine pompi_sendrecv_f(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, & - recvcount,recvtype,source,recvtag,comm,status,ierror) & - BIND(C, name="pompi_sendrecv_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_sendrecv_f - -subroutine pompi_sendrecv_replace_f(buf,count,datatype,dest,sendtag,source, & - recvtag,comm,status,ierror) & - BIND(C, name="pompi_sendrecv_replace_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_sendrecv_replace_f - -subroutine pompi_send_init_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_send_init_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_send_init_f - -subroutine pompi_ssend_f(buf,count,datatype,dest,tag,comm,ierror) & - BIND(C, name="pompi_ssend_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ssend_f - -subroutine pompi_ssend_init_f(buf,count,datatype,dest,tag,comm,request,ierror) & - BIND(C, name="pompi_ssend_init_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count, dest, tag - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ssend_init_f - -subroutine pompi_start_f(request,ierror) & - BIND(C, name="pompi_start_f") - implicit none - INTEGER, INTENT(INOUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_start_f - -subroutine pompi_startall_f(count,array_of_requests,ierror) & - BIND(C, name="pompi_startall_f") - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(INOUT) :: array_of_requests(count) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_startall_f - -subroutine pompi_testsome_f(incount,array_of_requests,outcount, & - array_of_indices,array_of_statuses,ierror) & - BIND(C, name="pompi_testsome_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: incount - INTEGER, INTENT(INOUT) :: array_of_requests(incount) - INTEGER, INTENT(OUT) :: outcount - INTEGER, INTENT(OUT) :: array_of_indices(*) - TYPE(MPI_Status), INTENT(OUT) :: array_of_statuses(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_testsome_f - -subroutine pompi_wait_f(request,status,ierror) & - BIND(C, name="pompi_wait_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(INOUT) :: request - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_wait_f - -subroutine pompi_waitall_f(count,array_of_requests,array_of_statuses,ierror) & - BIND(C, name="pompi_waitall_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(INOUT) :: array_of_requests(count) - TYPE(MPI_Status), INTENT(OUT) :: array_of_statuses(count) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_waitall_f - -subroutine pompi_waitany_f(count,array_of_requests,index,status,ierror) & - BIND(C, name="pompi_waitany_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(INOUT) :: array_of_requests(count) - INTEGER, INTENT(OUT) :: index - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_waitany_f - -subroutine pompi_waitsome_f(incount,array_of_requests,outcount, & - array_of_indices,array_of_statuses,ierror) & - BIND(C, name="pompi_waitsome_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: incount - INTEGER, INTENT(INOUT) :: array_of_requests(incount) - INTEGER, INTENT(OUT) :: outcount - INTEGER, INTENT(OUT) :: array_of_indices(*) - TYPE(MPI_Status), INTENT(OUT) :: array_of_statuses(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_waitsome_f - -subroutine pompi_get_address_f(location,address,ierror) & - BIND(C, name="pompi_get_address_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: location - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: address - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_address_f - -subroutine pompi_get_elements_f(status,datatype,count,ierror) & - BIND(C, name="pompi_get_elements_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - TYPE(MPI_Status), INTENT(IN) :: status - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: count - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_elements_f - -subroutine pompi_pack_f(inbuf,incount,datatype,outbuf,outsize, & - position,comm,ierror) & - BIND(C, name="pompi_pack_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf - INTEGER, INTENT(IN) :: incount, outsize - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(INOUT) :: position - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_pack_f - -subroutine pompi_pack_external_f(datarep,inbuf,incount,datatype, & - outbuf,outsize,position,ierror,datarep_len) & - BIND(C, name="pompi_pack_external_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf - INTEGER, INTENT(IN) :: incount - INTEGER, INTENT(IN) :: datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: outsize - INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_pack_external_f - -subroutine pompi_pack_external_size_f(datarep,incount,datatype,size,ierror,datarep_len) & - BIND(C, name="pompi_pack_external_size_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: incount - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: datarep - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_pack_external_size_f - -subroutine pompi_pack_size_f(incount,datatype,comm,size,ierror) & - BIND(C, name="pompi_pack_size_f") - implicit none - INTEGER, INTENT(IN) :: incount - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_pack_size_f - -subroutine pompi_type_commit_f(datatype,ierror) & - BIND(C, name="pompi_type_commit_f") - implicit none - INTEGER, INTENT(INOUT) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_commit_f - -subroutine pompi_type_contiguous_f(count,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_contiguous_f") - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_contiguous_f - -subroutine pompi_type_create_darray_f(size,rank,ndims,& - array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,& - order,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_darray_f") - implicit none - INTEGER, INTENT(IN) :: size, rank, ndims, order - INTEGER, INTENT(IN) :: array_of_gsizes(ndims), array_of_distribs(ndims) - INTEGER, INTENT(IN) :: array_of_dargs(ndims), array_of_psizes(ndims) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_darray_f - -subroutine pompi_type_create_hindexed_f(count,array_of_blocklengths, & - array_of_displacements,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_hindexed_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: array_of_blocklengths(count) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_hindexed_f - -subroutine pompi_type_create_hvector_f(count,blocklength,stride,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_hvector_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: count, blocklength - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: stride - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_hvector_f - -subroutine pompi_type_create_indexed_block_f(count,blocklength, & - array_of_displacements,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_indexed_block_f") - implicit none - INTEGER, INTENT(IN) :: count, blocklength - INTEGER, INTENT(IN) :: array_of_displacements(count) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_indexed_block_f - -subroutine pompi_type_create_hindexed_block_f(count,blocklength, & - array_of_displacements,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_hindexed_block_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: count, blocklength - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_hindexed_block_f - -subroutine pompi_type_create_resized_f(oldtype,lb,extent,newtype,ierror) & - BIND(C, name="pompi_type_create_resized_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: lb, extent - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_resized_f - -subroutine pompi_type_create_struct_f(count,array_of_blocklengths, & - array_of_displacements,array_of_types,newtype,ierror) & - BIND(C, name="pompi_type_create_struct_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: array_of_blocklengths(count) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count) - INTEGER, INTENT(IN) :: array_of_types(count) - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_struct_f - -subroutine pompi_type_create_subarray_f(ndims,array_of_sizes, & - array_of_subsizes,array_of_starts,order,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_create_subarray_f") - implicit none - INTEGER, INTENT(IN) :: ndims, order - INTEGER, INTENT(IN) :: array_of_sizes(*), array_of_subsizes(*), array_of_starts(*) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_subarray_f - -subroutine pompi_type_dup_f(oldtype,newtype,ierror) & - BIND(C, name="pompi_type_dup_f") - implicit none - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_dup_f - -subroutine pompi_type_free_f(datatype,ierror) & - BIND(C, name="pompi_type_free_f") - implicit none - INTEGER, INTENT(INOUT) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_free_f - -subroutine pompi_type_get_contents_f(datatype,max_integers,max_addresses, & - max_datatypes,array_of_integers,array_of_addresses, & - array_of_datatypes,ierror) & - BIND(C, name="pompi_type_get_contents_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: max_integers, max_addresses, max_datatypes - INTEGER, INTENT(OUT) :: array_of_integers(max_integers) - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: array_of_addresses(max_addresses) - INTEGER, INTENT(OUT) :: array_of_datatypes(max_datatypes) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_get_contents_f - -subroutine pompi_type_get_envelope_f(datatype,num_integers, & - num_addresses,num_datatypes,combiner,ierror) & - BIND(C, name="pompi_type_get_envelope_f") - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: num_integers, num_addresses, num_datatypes, combiner - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_get_envelope_f - -subroutine pompi_type_get_extent_f(datatype,lb,extent,ierror) & - BIND(C, name="pompi_type_get_extent_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: lb, extent - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_get_extent_f - -subroutine pompi_type_get_true_extent_f(datatype,true_lb,true_extent,ierror) & - BIND(C, name="pompi_type_get_true_extent_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: true_lb, true_extent - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_get_true_extent_f - -subroutine pompi_type_indexed_f(count,array_of_blocklengths, & - array_of_displacements,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_indexed_f") - implicit none - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: array_of_blocklengths(count), array_of_displacements(count) - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_indexed_f - -subroutine pompi_type_size_f(datatype,size,ierror) & - BIND(C, name="pompi_type_size_f") - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_size_f - -subroutine pompi_type_vector_f(count,blocklength,stride,oldtype,newtype,ierror) & - BIND(C, name="pompi_type_vector_f") - implicit none - INTEGER, INTENT(IN) :: count, blocklength, stride - INTEGER, INTENT(IN) :: oldtype - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_vector_f - -subroutine pompi_unpack_f(inbuf,insize,position,outbuf,outcount, & - datatype,comm,ierror) & - BIND(C, name="pompi_unpack_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf - INTEGER, INTENT(IN) :: insize, outcount - INTEGER, INTENT(INOUT) :: position - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_unpack_f - -subroutine pompi_unpack_external_f(datarep,inbuf,insize,position, & - outbuf,outcount,datatype,ierror,datarep_len) & - BIND(C, name="pompi_unpack_external_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: insize - INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position - INTEGER, INTENT(IN) :: outcount - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_unpack_external_f - -subroutine pompi_allgather_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,comm,ierror) & - BIND(C, name="pompi_allgather_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_allgather_f - -subroutine pompi_iallgather_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,comm,request,ierror) & - BIND(C, name="pompi_iallgather_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iallgather_f - -subroutine pompi_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcounts,displs,recvtype,comm,ierror) & - BIND(C, name="pompi_allgatherv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_allgatherv_f - -subroutine pompi_iallgatherv_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcounts,displs,recvtype,comm,request,ierror) & - BIND(C, name="pompi_iallgatherv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iallgatherv_f - -subroutine pompi_allreduce_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & - BIND(C, name="pompi_allreduce_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_allreduce_f - -subroutine pompi_iallreduce_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & - BIND(C, name="pompi_iallreduce_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iallreduce_f - -subroutine pompi_alltoall_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,comm,ierror) & - BIND(C, name="pompi_alltoall_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_alltoall_f - -subroutine pompi_ialltoall_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,comm,request,ierror) & - BIND(C, name="pompi_ialltoall_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ialltoall_f - -subroutine pompi_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype, & - recvbuf,recvcounts,rdispls,recvtype,comm,ierror) & - BIND(C, name="pompi_alltoallv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_alltoallv_f - -subroutine pompi_ialltoallv_f(sendbuf,sendcounts,sdispls,sendtype, & - recvbuf,recvcounts,rdispls,recvtype,comm,request,ierror) & - BIND(C, name="pompi_ialltoallv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ialltoallv_f - -subroutine pompi_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes, & - recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) & - BIND(C, name="pompi_alltoallw_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtypes - INTEGER, INTENT(IN) :: recvtypes - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_alltoallw_f - -subroutine pompi_ialltoallw_f(sendbuf,sendcounts,sdispls,sendtypes, & - recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) & - BIND(C, name="pompi_ialltoallw_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtypes - INTEGER, INTENT(IN) :: recvtypes - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ialltoallw_f - -subroutine pompi_barrier_f(comm,ierror) & - BIND(C, name="pompi_barrier_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_barrier_f - -subroutine pompi_ibarrier_f(comm,request,ierror) & - BIND(C, name="pompi_ibarrier_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ibarrier_f - -subroutine pompi_bcast_f(buffer,count,datatype,root,comm,ierror) & - BIND(C, name="pompi_bcast_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer - INTEGER, INTENT(IN) :: count, root - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_bcast_f - -subroutine pompi_ibcast_f(buffer,count,datatype,root,comm,request,ierror) & - BIND(C, name="pompi_ibcast_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer - INTEGER, INTENT(IN) :: count, root - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ibcast_f - -subroutine pompi_exscan_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & - BIND(C, name="pompi_exscan_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_exscan_f - -subroutine pompi_iexscan_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & - BIND(C, name="pompi_iexscan_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iexscan_f - -subroutine pompi_gather_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,root,comm,ierror) & - BIND(C, name="pompi_gather_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount, root - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_gather_f - -subroutine pompi_igather_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,root,comm,request,ierror) & - BIND(C, name="pompi_igather_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount, root - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_igather_f - -subroutine pompi_gatherv_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcounts,displs,recvtype,root,comm,ierror) & - BIND(C, name="pompi_gatherv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_gatherv_f - -subroutine pompi_igatherv_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcounts,displs,recvtype,root,comm,request,ierror) & - BIND(C, name="pompi_igatherv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_igatherv_f - -subroutine pompi_op_free_f(op,ierror) & - BIND(C, name="pompi_op_free_f") - implicit none - INTEGER, INTENT(INOUT) :: op - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_op_free_f - -subroutine pompi_reduce_f(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) & - BIND(C, name="pompi_reduce_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count, root - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_reduce_f - -subroutine pompi_ireduce_f(sendbuf,recvbuf,count,datatype,op,root,comm,request,ierror) & - BIND(C, name="pompi_ireduce_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count, root - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ireduce_f - -subroutine pompi_reduce_local_f(inbuf,inoutbuf,count,datatype,op,ierror) & - BIND(C, name="pompi_reduce_local_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_reduce_local_f - -subroutine pompi_reduce_scatter_f(sendbuf,recvbuf,recvcounts, & - datatype,op,comm,ierror) & - BIND(C, name="pompi_reduce_scatter_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_reduce_scatter_f - -subroutine pompi_ireduce_scatter_f(sendbuf,recvbuf,recvcounts, & - datatype,op,comm,request,ierror) & - BIND(C, name="pompi_ireduce_scatter_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ireduce_scatter_f - -subroutine pompi_reduce_scatter_block_f(sendbuf,recvbuf,recvcount, & - datatype,op,comm,ierror) & - BIND(C, name="pompi_reduce_scatter_block_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcount - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_reduce_scatter_block_f - -subroutine pompi_ireduce_scatter_block_f(sendbuf,recvbuf,recvcount, & - datatype,op,comm,request,ierror) & - BIND(C, name="pompi_ireduce_scatter_block_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcount - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ireduce_scatter_block_f - -subroutine pompi_scan_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & - BIND(C, name="pompi_scan_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_scan_f - -subroutine pompi_iscan_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & - BIND(C, name="pompi_iscan_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iscan_f - -subroutine pompi_scatter_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,root,comm,ierror) & - BIND(C, name="pompi_scatter_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount, root - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_scatter_f - -subroutine pompi_iscatter_f(sendbuf,sendcount,sendtype,recvbuf, & - recvcount,recvtype,root,comm,request,ierror) & - BIND(C, name="pompi_iscatter_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount, root - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iscatter_f - -subroutine pompi_scatterv_f(sendbuf,sendcounts,displs,sendtype, & - recvbuf,recvcount,recvtype,root,comm,ierror) & - BIND(C, name="pompi_scatterv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_scatterv_f - -subroutine pompi_iscatterv_f(sendbuf,sendcounts,displs,sendtype, & - recvbuf,recvcount,recvtype,root,comm,request,ierror) & - BIND(C, name="pompi_iscatterv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype - INTEGER, INTENT(IN) :: recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_iscatterv_f - -subroutine pompi_comm_compare_f(comm1,comm2,result,ierror) & - BIND(C, name="pompi_comm_compare_f") - implicit none - INTEGER, INTENT(IN) :: comm1 - INTEGER, INTENT(IN) :: comm2 - INTEGER, INTENT(OUT) :: result - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_compare_f - -subroutine pompi_comm_create_f(comm,group,newcomm,ierror) & - BIND(C, name="pompi_comm_create_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_create_f - -subroutine pompi_comm_create_keyval_f(comm_copy_attr_fn,comm_delete_attr_fn, & - comm_keyval,extra_state,ierror) & - BIND(C, name="pompi_comm_create_keyval_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: comm_copy_attr_fn - type(c_funptr), value :: comm_delete_attr_fn - INTEGER, INTENT(OUT) :: comm_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_create_keyval_f - -subroutine pompi_comm_delete_attr_f(comm,comm_keyval,ierror) & - BIND(C, name="pompi_comm_delete_attr_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: comm_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_delete_attr_f - -subroutine pompi_comm_dup_f(comm,newcomm,ierror) & - BIND(C, name="pompi_comm_dup_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_dup_f - -subroutine pompi_comm_free_f(comm,ierror) & - BIND(C, name="pompi_comm_free_f") - implicit none - INTEGER, INTENT(INOUT) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_free_f - -subroutine pompi_comm_free_keyval_f(comm_keyval,ierror) & - BIND(C, name="pompi_comm_free_keyval_f") - implicit none - INTEGER, INTENT(INOUT) :: comm_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_free_keyval_f - -subroutine pompi_comm_get_name_f(comm,comm_name,resultlen,ierror,comm_name_len) & - BIND(C, name="pompi_comm_get_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: comm - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: comm_name - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: comm_name_len -end subroutine pompi_comm_get_name_f - -subroutine pompi_comm_group_f(comm,group,ierror) & - BIND(C, name="pompi_comm_group_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: group - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_group_f - -subroutine pompi_comm_rank_f(comm,rank,ierror) & - BIND(C, name="pompi_comm_rank_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: rank - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_rank_f - -subroutine pompi_comm_remote_group_f(comm,group,ierror) & - BIND(C, name="pompi_comm_remote_group_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: group - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_remote_group_f - -subroutine pompi_comm_remote_size_f(comm,size,ierror) & - BIND(C, name="pompi_comm_remote_size_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_remote_size_f - -subroutine pompi_comm_set_attr_f(comm,comm_keyval,attribute_val,ierror) & - BIND(C, name="pompi_comm_set_attr_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: comm_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: attribute_val - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_set_attr_f - -subroutine pompi_comm_set_name_f(comm,comm_name,ierror,comm_name_len) & - BIND(C, name="pompi_comm_set_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: comm - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: comm_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: comm_name_len -end subroutine pompi_comm_set_name_f - -subroutine pompi_comm_size_f(comm,size,ierror) & - BIND(C, name="pompi_comm_size_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_size_f - -subroutine pompi_comm_split_f(comm,color,key,newcomm,ierror) & - BIND(C, name="pompi_comm_split_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: color, key - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_split_f - -subroutine pompi_group_compare_f(group1,group2,result,ierror) & - BIND(C, name="pompi_group_compare_f") - implicit none - INTEGER, INTENT(IN) :: group1 - INTEGER, INTENT(IN) :: group2 - INTEGER, INTENT(OUT) :: result - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_compare_f - -subroutine pompi_group_difference_f(group1,group2,newgroup,ierror) & - BIND(C, name="pompi_group_difference_f") - implicit none - INTEGER, INTENT(IN) :: group1 - INTEGER, INTENT(IN) :: group2 - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_difference_f - -subroutine pompi_group_excl_f(group,n,ranks,newgroup,ierror) & - BIND(C, name="pompi_group_excl_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(IN) :: n - INTEGER, INTENT(IN) :: ranks(*) - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_excl_f - -subroutine pompi_group_free_f(group,ierror) & - BIND(C, name="pompi_group_free_f") - implicit none - INTEGER, INTENT(INOUT) :: group - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_free_f - -subroutine pompi_group_incl_f(group,n,ranks,newgroup,ierror) & - BIND(C, name="pompi_group_incl_f") - implicit none - INTEGER, INTENT(IN) :: n - INTEGER, INTENT(IN) :: ranks(*) - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_incl_f - -subroutine pompi_group_intersection_f(group1,group2,newgroup,ierror) & - BIND(C, name="pompi_group_intersection_f") - implicit none - INTEGER, INTENT(IN) :: group1 - INTEGER, INTENT(IN) :: group2 - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_intersection_f - -subroutine pompi_group_range_excl_f(group,n,ranges,newgroup,ierror) & - BIND(C, name="pompi_group_range_excl_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(IN) :: n - INTEGER, INTENT(IN) :: ranges(*) - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_range_excl_f - -subroutine pompi_group_range_incl_f(group,n,ranges,newgroup,ierror) & - BIND(C, name="pompi_group_range_incl_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(IN) :: n - INTEGER, INTENT(IN) :: ranges(*) - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_range_incl_f - -subroutine pompi_group_rank_f(group,rank,ierror) & - BIND(C, name="pompi_group_rank_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(OUT) :: rank - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_rank_f - -subroutine pompi_group_size_f(group,size,ierror) & - BIND(C, name="pompi_group_size_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_size_f - -subroutine pompi_group_translate_ranks_f(group1,n,ranks1,group2,ranks2,ierror) & - BIND(C, name="pompi_group_translate_ranks_f") - implicit none - INTEGER, INTENT(IN) :: group1, group2 - INTEGER, INTENT(IN) :: n - INTEGER, INTENT(IN) :: ranks1(*) - INTEGER, INTENT(OUT) :: ranks2(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_translate_ranks_f - -subroutine pompi_group_union_f(group1,group2,newgroup,ierror) & - BIND(C, name="pompi_group_union_f") - implicit none - INTEGER, INTENT(IN) :: group1, group2 - INTEGER, INTENT(OUT) :: newgroup - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_group_union_f - -subroutine pompi_intercomm_create_f(local_comm,local_leader,peer_comm, & - remote_leader,tag,newintercomm,ierror) & - BIND(C, name="pompi_intercomm_create_f") - implicit none - INTEGER, INTENT(IN) :: local_comm, peer_comm - INTEGER, INTENT(IN) :: local_leader, remote_leader, tag - INTEGER, INTENT(OUT) :: newintercomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_intercomm_create_f - -subroutine pompi_type_create_keyval_f(type_copy_attr_fn,type_delete_attr_fn, & - type_keyval,extra_state,ierror) & - BIND(C, name="pompi_type_create_keyval_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: type_copy_attr_fn - type(c_funptr), value :: type_delete_attr_fn - INTEGER, INTENT(OUT) :: type_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_keyval_f - -subroutine pompi_type_delete_attr_f(datatype,type_keyval,ierror) & - BIND(C, name="pompi_type_delete_attr_f") - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: type_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_delete_attr_f - -subroutine pompi_type_free_keyval_f(type_keyval,ierror) & - BIND(C, name="pompi_type_free_keyval_f") - implicit none - INTEGER, INTENT(INOUT) :: type_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_free_keyval_f - -subroutine pompi_type_get_name_f(datatype,type_name,resultlen,ierror,type_name_len) & - BIND(C, name="pompi_type_get_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: datatype - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: type_name - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: type_name_len -end subroutine pompi_type_get_name_f - -subroutine pompi_type_set_attr_f(datatype,type_keyval,attribute_val,ierror) & - BIND(C, name="pompi_type_set_attr_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: type_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: attribute_val - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_set_attr_f - -subroutine pompi_type_set_name_f(datatype,type_name,ierror,type_name_len) & - BIND(C, name="pompi_type_set_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: datatype - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: type_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: type_name_len -end subroutine pompi_type_set_name_f - -subroutine pompi_win_allocate_f(size, disp_unit, info, comm, & - baseptr, win, ierror) BIND(C, name="pompi_win_allocate_f") - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size - INTEGER, INTENT(IN) :: disp_unit - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: comm - TYPE(C_PTR), INTENT(OUT) :: baseptr - INTEGER, INTENT(OUT) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_allocate_f - -subroutine pompi_win_allocate_shared_f(size, disp_unit, info, comm, & - baseptr, win, ierror) BIND(C, name="pompi_win_allocate_shared_f") - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size - INTEGER, INTENT(IN) :: disp_unit - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: comm - TYPE(C_PTR), INTENT(OUT) :: baseptr - INTEGER, INTENT(OUT) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_allocate_shared_f - -subroutine pompi_win_create_keyval_f(win_copy_attr_fn,win_delete_attr_fn, & - win_keyval,extra_state,ierror) & - BIND(C, name="pompi_win_create_keyval_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: win_copy_attr_fn - type(c_funptr), value :: win_delete_attr_fn - INTEGER, INTENT(OUT) :: win_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_create_keyval_f - -subroutine pompi_win_delete_attr_f(win,win_keyval,ierror) & - BIND(C, name="pompi_win_delete_attr_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(IN) :: win_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_delete_attr_f - -subroutine pompi_win_free_keyval_f(win_keyval,ierror) & - BIND(C, name="pompi_win_free_keyval_f") - implicit none - INTEGER, INTENT(INOUT) :: win_keyval - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_free_keyval_f - -subroutine pompi_win_get_name_f(win,win_name,resultlen,ierror,win_name_len) & - BIND(C, name="pompi_win_get_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: win - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: win_name - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: win_name_len -end subroutine pompi_win_get_name_f - -subroutine pompi_win_set_attr_f(win,win_keyval,attribute_val,ierror) & - BIND(C, name="pompi_win_set_attr_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(IN) :: win_keyval - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: attribute_val - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_set_attr_f - -subroutine pompi_win_set_name_f(win,win_name,ierror,win_name_len) & - BIND(C, name="pompi_win_set_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: win - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: win_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: win_name_len -end subroutine pompi_win_set_name_f - -subroutine pompi_cartdim_get_f(comm,ndims,ierror) & - BIND(C, name="pompi_cartdim_get_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ndims - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_cartdim_get_f - -subroutine pompi_cart_coords_f(comm,rank,maxdims,coords,ierror) & - BIND(C, name="pompi_cart_coords_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: rank, maxdims - INTEGER, INTENT(OUT) :: coords(maxdims) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_cart_coords_f - -subroutine pompi_cart_rank_f(comm,coords,rank,ierror) & - BIND(C, name="pompi_cart_rank_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: coords(*) - INTEGER, INTENT(OUT) :: rank - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_cart_rank_f - -subroutine pompi_cart_shift_f(comm,direction,disp,rank_source,rank_dest,ierror) & - BIND(C, name="pompi_cart_shift_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: direction, disp - INTEGER, INTENT(OUT) :: rank_source, rank_dest - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_cart_shift_f - -subroutine pompi_dims_create_f(nnodes,ndims,dims,ierror) & - BIND(C, name="pompi_dims_create_f") - implicit none - INTEGER, INTENT(IN) :: nnodes, ndims - INTEGER, INTENT(INOUT) :: dims(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_dims_create_f - -subroutine pompi_dist_graph_neighbors_f(comm,maxindegree,sources,sourceweights, & - maxoutdegree,destinations,destweights,ierror) & - BIND(C, name="pompi_dist_graph_neighbors_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: maxindegree, maxoutdegree - INTEGER, INTENT(OUT) :: sources(maxindegree), destinations(maxoutdegree) - INTEGER, INTENT(OUT) :: sourceweights(maxindegree), destweights(maxoutdegree) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_dist_graph_neighbors_f - -subroutine pompi_graphdims_get_f(comm,nnodes,nedges,ierror) & - BIND(C, name="pompi_graphdims_get_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: nnodes, nedges - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_graphdims_get_f - -subroutine pompi_graph_get_f(comm,maxindex,maxedges,index,edges,ierror) & - BIND(C, name="pompi_graph_get_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: maxindex, maxedges - INTEGER, INTENT(OUT) :: index(*), edges(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_graph_get_f - -subroutine pompi_graph_map_f(comm,nnodes,index,edges,newrank,ierror) & - BIND(C, name="pompi_graph_map_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: nnodes - INTEGER, INTENT(IN) :: index(*), edges(*) - INTEGER, INTENT(OUT) :: newrank - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_graph_map_f - -subroutine pompi_graph_neighbors_f(comm,rank,maxneighbors,neighbors,ierror) & - BIND(C, name="pompi_graph_neighbors_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: rank, maxneighbors - INTEGER, INTENT(OUT) :: neighbors(*) - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_graph_neighbors_f - -subroutine pompi_graph_neighbors_count_f(comm,rank,nneighbors,ierror) & - BIND(C, name="pompi_graph_neighbors_count_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: rank - INTEGER, INTENT(OUT) :: nneighbors - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_graph_neighbors_count_f - -subroutine pompi_topo_test_f(comm,status,ierror) & - BIND(C, name="pompi_topo_test_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_topo_test_f - -! -! These functions are declared in mpi-f08-interface.h as BIND(C) -! -!function MPI_Wtick_f() & -! BIND(C, name="pompi_wtick_f") -! implicit none -! DOUBLE PRECISION :: MPI_Wtick_f -!end function MPI_Wtick_f -! -!function MPI_Wtime_f() & -! BIND(C, name="pompi_wtime_f") -! implicit none -! DOUBLE PRECISION :: MPI_Wtime_f -!end function MPI_Wtime_f - -function pompi_aint_add_f(base,diff) & - BIND(C, name="pompi_aint_add_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: base - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: diff - INTEGER(MPI_ADDRESS_KIND) :: pompi_aint_add_f -end function pompi_aint_add_f - -function pompi_aint_diff_f(addr1,addr2) & - BIND(C, name="pompi_aint_diff_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr1 - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr2 - INTEGER(MPI_ADDRESS_KIND) :: pompi_aint_diff_f -end function pompi_aint_diff_f - -subroutine pompi_abort_f(comm,errorcode,ierror) & - BIND(C, name="pompi_abort_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: errorcode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_abort_f - -subroutine pompi_add_error_class_f(errorclass,ierror) & - BIND(C, name="pompi_add_error_class_f") - implicit none - INTEGER, INTENT(OUT) :: errorclass - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_add_error_class_f - -subroutine pompi_add_error_code_f(errorclass,errorcode,ierror) & - BIND(C, name="pompi_add_error_code_f") - implicit none - INTEGER, INTENT(IN) :: errorclass - INTEGER, INTENT(OUT) :: errorcode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_add_error_code_f - -subroutine pompi_add_error_string_f(errorcode,string,ierror,str_len) & - BIND(C, name="pompi_add_error_string_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: errorcode - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: string - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: str_len -end subroutine pompi_add_error_string_f - -subroutine pompi_alloc_mem_f(size,info,baseptr,ierror) & - BIND(C, name="pompi_alloc_mem_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: ISO_C_BINDING, only : C_PTR - implicit none - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size - INTEGER, INTENT(IN) :: info - TYPE(C_PTR), INTENT(OUT) :: baseptr - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_alloc_mem_f - -subroutine pompi_comm_call_errhandler_f(comm,errorcode,ierror) & - BIND(C, name="pompi_comm_call_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: errorcode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_call_errhandler_f - -subroutine pompi_comm_create_errhandler_f(comm_errhandler_fn,errhandler,ierror) & - BIND(C, name="pompi_comm_create_errhandler_f") - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: comm_errhandler_fn - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_create_errhandler_f - -subroutine pompi_comm_get_errhandler_f(comm,errhandler,ierror) & - BIND(C, name="pompi_comm_get_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_get_errhandler_f - -subroutine pompi_comm_set_errhandler_f(comm,errhandler,ierror) & - BIND(C, name="pompi_comm_set_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_set_errhandler_f - -subroutine pompi_errhandler_free_f(errhandler,ierror) & - BIND(C, name="pompi_errhandler_free_f") - implicit none - INTEGER, INTENT(INOUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_errhandler_free_f - -subroutine pompi_error_class_f(errorcode,errorclass,ierror) & - BIND(C, name="pompi_error_class_f") - implicit none - INTEGER, INTENT(IN) :: errorcode - INTEGER, INTENT(OUT) :: errorclass - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_error_class_f - -subroutine pompi_error_string_f(errorcode,string,resultlen,ierror,str_len) & - BIND(C, name="pompi_error_string_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: errorcode - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: string - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: str_len -end subroutine pompi_error_string_f - -subroutine pompi_file_call_errhandler_f(fh,errorcode,ierror) & - BIND(C, name="pompi_file_call_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(IN) :: errorcode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_call_errhandler_f - -subroutine pompi_file_create_errhandler_f(file_errhandler_fn,errhandler,ierror) & - BIND(C, name="pompi_file_create_errhandler_f") - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: file_errhandler_fn - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_create_errhandler_f - -subroutine pompi_file_get_errhandler_f(file,errhandler,ierror) & - BIND(C, name="pompi_file_get_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: file - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_errhandler_f - -subroutine pompi_file_set_errhandler_f(file,errhandler,ierror) & - BIND(C, name="pompi_file_set_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: file - INTEGER, INTENT(IN) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_set_errhandler_f - -subroutine pompi_finalize_f(ierror) & - BIND(C, name="pompi_finalize_f") - implicit none - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_finalize_f - -subroutine pompi_free_mem_f(base,ierror) & - BIND(C, name="pompi_free_mem_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_free_mem_f - -subroutine pompi_get_processor_name_f(name,resultlen,ierror,name_len) & - BIND(C, name="pompi_get_processor_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: name_len -end subroutine pompi_get_processor_name_f - -subroutine pompi_get_version_f(version,subversion,ierror) & - BIND(C, name="pompi_get_version_f") - implicit none - INTEGER, INTENT(OUT) :: version, subversion - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_version_f - -subroutine pompi_init_f(ierror) & - BIND(C, name="pompi_init_f") - implicit none - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_init_f - -subroutine pompi_win_call_errhandler_f(win,errorcode,ierror) & - BIND(C, name="pompi_win_call_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(IN) :: errorcode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_call_errhandler_f - -subroutine pompi_win_create_errhandler_f(win_errhandler_fn,errhandler,ierror) & - BIND(C, name="pompi_win_create_errhandler_f") - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: win_errhandler_fn - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_create_errhandler_f - -subroutine pompi_win_get_errhandler_f(win,errhandler,ierror) & - BIND(C, name="pompi_win_get_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_get_errhandler_f - -subroutine pompi_win_set_errhandler_f(win,errhandler,ierror) & - BIND(C, name="pompi_win_set_errhandler_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(IN) :: errhandler - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_set_errhandler_f - -subroutine pompi_info_create_f(info,ierror) & - BIND(C, name="pompi_info_create_f") - implicit none - INTEGER, INTENT(OUT) :: info - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_info_create_f - -subroutine pompi_info_delete_f(info,key,ierror,key_len) & - BIND(C, name="pompi_info_delete_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: info - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: key - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: key_len -end subroutine pompi_info_delete_f - -subroutine pompi_info_dup_f(info,newinfo,ierror) & - BIND(C, name="pompi_info_dup_f") - implicit none - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: newinfo - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_info_dup_f - -subroutine pompi_info_free_f(info,ierror) & - BIND(C, name="pompi_info_free_f") - implicit none - INTEGER, INTENT(INOUT) :: info - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_info_free_f - -subroutine pompi_info_get_nkeys_f(info,nkeys,ierror) & - BIND(C, name="pompi_info_get_nkeys_f") - implicit none - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: nkeys - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_info_get_nkeys_f - -subroutine pompi_info_get_nthkey_f(info,n,key,ierror,key_len) & - BIND(C, name="pompi_info_get_nthkey_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: n - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: key - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: key_len -end subroutine pompi_info_get_nthkey_f - -subroutine pompi_info_set_f(info,key,value,ierror,key_len,value_len) & - BIND(C, name="pompi_info_set_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: info - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: key, value - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: key_len, value_len -end subroutine pompi_info_set_f - -subroutine pompi_close_port_f(port_name,ierror,port_name_len) & - BIND(C, name="pompi_close_port_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: port_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: port_name_len -end subroutine pompi_close_port_f - -subroutine pompi_comm_accept_f(port_name,info,root,comm,newcomm,ierror,port_name_len) & - BIND(C, name="pompi_comm_accept_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: port_name - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: root - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: port_name_len -end subroutine pompi_comm_accept_f - -subroutine pompi_comm_connect_f(port_name,info,root,comm,newcomm,ierror,port_name_len) & - BIND(C, name="pompi_comm_connect_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: port_name - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: root - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: port_name_len -end subroutine pompi_comm_connect_f - -subroutine pompi_comm_disconnect_f(comm,ierror) & - BIND(C, name="pompi_comm_disconnect_f") - implicit none - INTEGER, INTENT(INOUT) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_disconnect_f - -subroutine pompi_comm_get_parent_f(parent,ierror) & - BIND(C, name="pompi_comm_get_parent_f") - implicit none - INTEGER, INTENT(OUT) :: parent - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_get_parent_f - -subroutine pompi_comm_join_f(fd,intercomm,ierror) & - BIND(C, name="pompi_comm_join_f") - implicit none - INTEGER, INTENT(IN) :: fd - INTEGER, INTENT(OUT) :: intercomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_join_f - -subroutine pompi_comm_spawn_f(command,argv,maxprocs,info,root,comm, & - intercomm, array_of_errcodes,ierror,cmd_len,argv_len) & - BIND(C, name="pompi_comm_spawn_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: command, argv - INTEGER, INTENT(IN) :: maxprocs, root - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: intercomm - INTEGER, INTENT(OUT) :: array_of_errcodes(*) - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: cmd_len, argv_len -end subroutine pompi_comm_spawn_f - - -! TODO - FIXME to use arrays of strings and pass strlen -subroutine pompi_comm_spawn_multiple_f(count,array_of_commands, & - array_of_argv, array_of_maxprocs,array_of_info,root, & - comm,intercomm,array_of_errcodes,ierror, & - cmd_len, argv_len) & - BIND(C, name="pompi_comm_spawn_multiple_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: count, root - INTEGER, INTENT(IN) :: array_of_maxprocs(count) - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: array_of_commands(*), array_of_argv(*) - INTEGER, INTENT(IN) :: array_of_info(count) - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: intercomm - INTEGER, INTENT(OUT) :: array_of_errcodes(*) - INTEGER, INTENT(OUT) :: ierror - INTEGER, INTENT(IN) :: cmd_len, argv_len -end subroutine pompi_comm_spawn_multiple_f - -subroutine pompi_lookup_name_f(service_name,info,port_name,ierror, & - service_name_len,port_name_len) & - BIND(C, name="pompi_lookup_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: service_name - INTEGER, INTENT(IN) :: info - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: port_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: service_name_len, port_name_len -end subroutine pompi_lookup_name_f - -subroutine pompi_open_port_f(info,port_name,ierror,port_name_len) & - BIND(C, name="pompi_open_port_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: info - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: port_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: port_name_len -end subroutine pompi_open_port_f - -subroutine pompi_publish_name_f(service_name,info,port_name,ierror, & - service_name_len,port_name_len) & - BIND(C, name="pompi_publish_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: info - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: service_name, port_name - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: service_name_len, port_name_len -end subroutine pompi_publish_name_f - -subroutine pompi_unpublish_name_f(service_name,info,port_name, & - ierror,service_name_len,port_name_len) & - BIND(C, name="pompi_unpublish_name_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: service_name, port_name - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: service_name_len, port_name_len -end subroutine pompi_unpublish_name_f - -subroutine pompi_accumulate_f(origin_addr,origin_count,origin_datatype, & - target_rank,target_disp, & - target_count,target_datatype,op,win,ierror) & - BIND(C, name="pompi_accumulate_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_accumulate_f - -subroutine pompi_raccumulate_f(origin_addr,origin_count,origin_datatype, & - target_rank,target_disp, & - target_count,target_datatype,op,win, & - request,ierror) & - BIND(C, name="pompi_raccumulate_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_raccumulate_f - -subroutine pompi_get_f(origin_addr,origin_count,origin_datatype,target_rank, & - target_disp,target_count,target_datatype,win,ierror) & - BIND(C, name="pompi_get_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_f - -subroutine pompi_rget_f(origin_addr,origin_count,origin_datatype,target_rank, & - target_disp,target_count,target_datatype,win,request, & - ierror) & - BIND(C, name="pompi_rget_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_rget_f - -subroutine pompi_get_accumulate_f(origin_addr,origin_count,origin_datatype, & - result_addr,result_count,result_datatype, & - target_rank,target_disp, & - target_count,target_datatype,op,win, & - ierror) & - BIND(C, name="pompi_get_accumulate_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr - INTEGER, INTENT(IN) :: result_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_get_accumulate_f - -subroutine pompi_rget_accumulate_f(origin_addr,origin_count,origin_datatype, & - result_addr,result_count,result_datatype, & - target_rank,target_disp, & - target_count,target_datatype,op,win, & - request,ierror) & - BIND(C, name="pompi_rget_accumulate_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr - INTEGER, INTENT(IN) :: result_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_rget_accumulate_f - -subroutine pompi_put_f(origin_addr,origin_count,origin_datatype,target_rank, & - target_disp,target_count,target_datatype,win,ierror) & - BIND(C, name="pompi_put_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_put_f - -subroutine pompi_rput_f(origin_addr,origin_count,origin_datatype,target_rank, & - target_disp,target_count,target_datatype,win,request, & - ierror) & - BIND(C, name="pompi_rput_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - INTEGER, INTENT(IN) :: origin_count, target_rank, target_count - INTEGER, INTENT(IN) :: origin_datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: target_datatype - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_rput_f - -subroutine pompi_win_complete_f(win,ierror) & - BIND(C, name="pompi_win_complete_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_complete_f - -subroutine pompi_compare_and_swap_f(origin_addr,compare_addr,result_addr, & - datatype,target_rank,target_disp, win, & - ierror) & - BIND(C, name="pompi_compare_and_swap_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr, compare_addr - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: target_rank - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_compare_and_swap_f - -subroutine pompi_fetch_and_op_f(origin_addr,result_addr,datatype,target_rank, & - target_disp,op,win,ierror) & - BIND(C, name="pompi_fetch_and_op_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: target_rank - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp - INTEGER, INTENT(IN) :: op - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_fetch_and_op_f - -subroutine pompi_win_create_f(base,size,disp_unit,info,comm,win,ierror) & - BIND(C, name="pompi_win_create_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size - INTEGER, INTENT(IN) :: disp_unit - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_create_f - -subroutine pompi_win_flush_f(rank,win,ierror) & - BIND(C, name="pompi_win_flush_f") - implicit none - INTEGER, INTENT(IN) :: rank - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_flush_f - -subroutine pompi_win_flush_all_f(win,ierror) & - BIND(C, name="pompi_win_flush_all_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_flush_all_f - -subroutine pompi_win_flush_local_f(rank,win,ierror) & - BIND(C, name="pompi_win_flush_local_f") - implicit none - INTEGER, INTENT(IN) :: rank - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_flush_local_f - -subroutine pompi_win_flush_local_all_f(win,ierror) & - BIND(C, name="pompi_win_flush_local_all_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_flush_local_all_f - -subroutine pompi_win_fence_f(assert,win,ierror) & - BIND(C, name="pompi_win_fence_f") - implicit none - INTEGER, INTENT(IN) :: assert - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_fence_f - -subroutine pompi_win_free_f(win,ierror) & - BIND(C, name="pompi_win_free_f") - implicit none - INTEGER, INTENT(INOUT) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_free_f - -subroutine pompi_win_get_group_f(win,group,ierror) & - BIND(C, name="pompi_win_get_group_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: group - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_get_group_f - -subroutine pompi_win_lock_f(lock_type,rank,assert,win,ierror) & - BIND(C, name="pompi_win_lock_f") - implicit none - INTEGER, INTENT(IN) :: lock_type, rank, assert - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_lock_f - -subroutine pompi_win_lock_all_f(assert,win,ierror) & - BIND(C, name="pompi_win_lock_all_f") - implicit none - INTEGER, INTENT(IN) :: assert - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_lock_all_f - -subroutine pompi_win_post_f(group,assert,win,ierror) & - BIND(C, name="pompi_win_post_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(IN) :: assert - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_post_f - -subroutine pompi_win_shared_query_f(win, rank, size, disp_unit, baseptr,& - ierror) BIND(C, name="pompi_win_shared_query_f") - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(IN) :: rank - INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: disp_unit - TYPE(C_PTR), INTENT(OUT) :: baseptr - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_shared_query_f - -subroutine pompi_win_start_f(group,assert,win,ierror) & - BIND(C, name="pompi_win_start_f") - implicit none - INTEGER, INTENT(IN) :: group - INTEGER, INTENT(IN) :: assert - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_start_f - -subroutine pompi_win_sync_f(win,ierror) & - BIND(C, name="pompi_win_sync_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_sync_f - -subroutine pompi_win_unlock_f(rank,win,ierror) & - BIND(C, name="pompi_win_unlock_f") - implicit none - INTEGER, INTENT(IN) :: rank - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_unlock_f - -subroutine pompi_win_unlock_all_f(win,ierror) & - BIND(C, name="pompi_win_unlock_all_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_unlock_all_f - -subroutine pompi_win_wait_f(win,ierror) & - BIND(C, name="pompi_win_wait_f") - implicit none - INTEGER, INTENT(IN) :: win - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_win_wait_f - -subroutine pompi_grequest_complete_f(request,ierror) & - BIND(C, name="pompi_grequest_complete_f") - implicit none - INTEGER, INTENT(IN) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_grequest_complete_f - -subroutine pompi_grequest_start_f(query_fn,free_fn,cancel_fn, & - extra_state,request,ierror) & - BIND(C, name="pompi_grequest_start_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: query_fn - type(c_funptr), value :: free_fn - type(c_funptr), value :: cancel_fn - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_grequest_start_f - -subroutine pompi_init_thread_f(required,provided,ierror) & - BIND(C, name="pompi_init_thread_f") - implicit none - INTEGER, INTENT(IN) :: required - INTEGER, INTENT(OUT) :: provided - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_init_thread_f - -subroutine pompi_query_thread_f(provided,ierror) & - BIND(C, name="pompi_query_thread_f") - implicit none - INTEGER, INTENT(OUT) :: provided - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_query_thread_f - -subroutine pompi_status_set_elements_f(status,datatype,count,ierror) & - BIND(C, name="pompi_status_set_elements_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - TYPE(MPI_Status), INTENT(INOUT) :: status - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_status_set_elements_f - -subroutine pompi_file_close_f(fh,ierror) & - BIND(C, name="pompi_file_close_f") - implicit none - INTEGER, INTENT(INOUT) :: fh - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_close_f - -subroutine pompi_file_delete_f(filename,info,ierror,filename_len) & - BIND(C, name="pompi_file_delete_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: filename - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: filename_len -end subroutine pompi_file_delete_f - -subroutine pompi_file_get_amode_f(fh,amode,ierror) & - BIND(C, name="pompi_file_get_amode_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(OUT) :: amode - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_amode_f - -subroutine pompi_file_get_byte_offset_f(fh,offset,disp,ierror) & - BIND(C, name="pompi_file_get_byte_offset_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: disp - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_byte_offset_f - -subroutine pompi_file_get_group_f(fh,group,ierror) & - BIND(C, name="pompi_file_get_group_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(OUT) :: group - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_group_f - -subroutine pompi_file_get_info_f(fh,info_used,ierror) & - BIND(C, name="pompi_file_get_info_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(OUT) :: info_used - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_info_f - -subroutine pompi_file_get_position_f(fh,offset,ierror) & - BIND(C, name="pompi_file_get_position_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_position_f - -subroutine pompi_file_get_position_shared_f(fh,offset,ierror) & - BIND(C, name="pompi_file_get_position_shared_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_position_shared_f - -subroutine pompi_file_get_size_f(fh,size,ierror) & - BIND(C, name="pompi_file_get_size_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_size_f - -subroutine pompi_file_get_type_extent_f(fh,datatype,extent,ierror) & - BIND(C, name="pompi_file_get_type_extent_f") - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(IN) :: datatype - INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: extent - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_get_type_extent_f - -subroutine pompi_file_get_view_f(fh,disp,etype,filetype,datarep,ierror,datarep_len) & - BIND(C, name="pompi_file_get_view_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: disp - INTEGER, INTENT(OUT) :: etype - INTEGER, INTENT(OUT) :: filetype - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: datarep - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_file_get_view_f - -subroutine pompi_file_iread_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iread_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iread_f - -subroutine pompi_file_iread_at_f(fh,offset,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iread_at_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iread_at_f - -subroutine pompi_file_iread_all_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iread_all_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iread_all_f - -subroutine pompi_file_iread_at_all_f(fh,offset,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iread_at_all_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iread_at_all_f - -subroutine pompi_file_iread_shared_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iread_shared_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iread_shared_f - -subroutine pompi_file_iwrite_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iwrite_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iwrite_f - -subroutine pompi_file_iwrite_at_f(fh,offset,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iwrite_at_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iwrite_at_f - -subroutine pompi_file_iwrite_all_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iwrite_all_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iwrite_all_f - -subroutine pompi_file_iwrite_at_all_f(fh,offset,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iwrite_at_all_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iwrite_at_all_f - -subroutine pompi_file_iwrite_shared_f(fh,buf,count,datatype,request,ierror) & - BIND(C, name="pompi_file_iwrite_shared_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_iwrite_shared_f - -subroutine pompi_file_open_f(comm,filename,amode,info,fh,ierror,filename_len) & - BIND(C, name="pompi_file_open_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - INTEGER, INTENT(IN) :: comm - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: filename - INTEGER, INTENT(IN) :: amode - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: fh - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: filename_len -end subroutine pompi_file_open_f - -subroutine pompi_file_preallocate_f(fh,size,ierror) & - BIND(C, name="pompi_file_preallocate_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_preallocate_f - -subroutine pompi_file_read_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_f - -subroutine pompi_file_read_all_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_all_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_all_f - -subroutine pompi_file_read_all_begin_f(fh,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_read_all_begin_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_all_begin_f - -subroutine pompi_file_read_all_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_read_all_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_all_end_f - -subroutine pompi_file_read_at_f(fh,offset,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_at_f") - use :: mpi_f08_types, only : MPI_Status, MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_at_f - -subroutine pompi_file_read_at_all_f(fh,offset,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_at_all_f") - use :: mpi_f08_types, only : MPI_Status, MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_at_all_f - -subroutine pompi_file_read_at_all_begin_f(fh,offset,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_read_at_all_begin_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_at_all_begin_f - -subroutine pompi_file_read_at_all_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_read_at_all_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_at_all_end_f - -subroutine pompi_file_read_ordered_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_ordered_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_ordered_f - -subroutine pompi_file_read_ordered_begin_f(fh,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_read_ordered_begin_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_ordered_begin_f - -subroutine pompi_file_read_ordered_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_read_ordered_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_ordered_end_f - -subroutine pompi_file_read_shared_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_read_shared_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_read_shared_f - -subroutine pompi_file_seek_f(fh,offset,whence,ierror) & - BIND(C, name="pompi_file_seek_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - INTEGER, INTENT(IN) :: whence - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_seek_f - -subroutine pompi_file_seek_shared_f(fh,offset,whence,ierror) & - BIND(C, name="pompi_file_seek_shared_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - INTEGER, INTENT(IN) :: whence - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_seek_shared_f - -subroutine pompi_file_set_info_f(fh,info,ierror) & - BIND(C, name="pompi_file_set_info_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_set_info_f - -subroutine pompi_file_set_size_f(fh,size,ierror) & - BIND(C, name="pompi_file_set_size_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_set_size_f - -subroutine pompi_file_set_view_f(fh,disp,etype,filetype,datarep,info,ierror,datarep_len) & - BIND(C, name="pompi_file_set_view_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: disp - INTEGER, INTENT(IN) :: etype - INTEGER, INTENT(IN) :: filetype - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: datarep - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_file_set_view_f - -subroutine pompi_file_sync_f(fh,ierror) & - BIND(C, name="pompi_file_sync_f") - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_sync_f - -subroutine pompi_file_write_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_f - -subroutine pompi_file_write_all_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_all_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_all_f - -subroutine pompi_file_write_all_begin_f(fh,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_write_all_begin_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_all_begin_f - -subroutine pompi_file_write_all_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_write_all_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_all_end_f - -subroutine pompi_file_write_at_f(fh,offset,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_at_f") - use :: mpi_f08_types, only : MPI_Status, MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_at_f - -subroutine pompi_file_write_at_all_f(fh,offset,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_at_all_f") - use :: mpi_f08_types, only : MPI_Status, MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_at_all_f - -subroutine pompi_file_write_at_all_begin_f(fh,offset,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_write_at_all_begin_f") - use :: mpi_f08_types, only : MPI_OFFSET_KIND - implicit none - INTEGER, INTENT(IN) :: fh - INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_at_all_begin_f - -subroutine pompi_file_write_at_all_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_write_at_all_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_at_all_end_f - -subroutine pompi_file_write_ordered_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_ordered_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_ordered_f - -subroutine pompi_file_write_ordered_begin_f(fh,buf,count,datatype,ierror) & - BIND(C, name="pompi_file_write_ordered_begin_f") - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_ordered_begin_f - -subroutine pompi_file_write_ordered_end_f(fh,buf,status,ierror) & - BIND(C, name="pompi_file_write_ordered_end_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_ordered_end_f - -subroutine pompi_file_write_shared_f(fh,buf,count,datatype,status,ierror) & - BIND(C, name="pompi_file_write_shared_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: fh - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_file_write_shared_f - -subroutine pompi_register_datarep_f(datarep,read_conversion_fn, & - write_conversion_fn,dtype_file_extent_fn, & - extra_state,ierror,datarep_len) & - BIND(C, name="pompi_register_datarep_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use, intrinsic :: iso_c_binding, only: c_funptr - implicit none - type(c_funptr), value :: read_conversion_fn - type(c_funptr), value :: write_conversion_fn - type(c_funptr), value :: dtype_file_extent_fn - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: datarep - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: extra_state - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: datarep_len -end subroutine pompi_register_datarep_f - -! -! MPI_Sizeof is generic for numeric types. This ignore TKR interface -! is replaced by the specific generics. -! -!subroutine pompi_sizeof(x,size,ierror) & -! BIND(C, name="pompi_sizeof_f") -! implicit none -! OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: x -! INTEGER, INTENT(OUT) :: size -! INTEGER, INTENT(OUT) :: ierror -!end subroutine pompi_sizeof - -subroutine pompi_type_create_f90_complex_f(p,r,newtype,ierror) & - BIND(C, name="pompi_type_create_f90_complex_f") - implicit none - INTEGER, INTENT(IN) :: p, r - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_f90_complex_f - -subroutine pompi_type_create_f90_integer_f(r,newtype,ierror) & - BIND(C, name="pompi_type_create_f90_integer_f") - implicit none - INTEGER, INTENT(IN) :: r - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_f90_integer_f - -subroutine pompi_type_create_f90_real_f(p,r,newtype,ierror) & - BIND(C, name="pompi_type_create_f90_real_f") - implicit none - INTEGER, INTENT(IN) :: p, r - INTEGER, INTENT(OUT) :: newtype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_create_f90_real_f - -subroutine pompi_type_match_size_f(typeclass,size,datatype,ierror) & - BIND(C, name="pompi_type_match_size_f") - implicit none - INTEGER, INTENT(IN) :: typeclass, size - INTEGER, INTENT(OUT) :: datatype - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_type_match_size_f - -subroutine pompi_pcontrol_f(level) & - BIND(C, name="pompi_pcontrol_f") - implicit none - INTEGER, INTENT(IN) :: level -end subroutine pompi_pcontrol_f - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! New routines to MPI-3 -! - -subroutine pompi_comm_split_type_f(comm,split_type,key,info,newcomm,ierror) & - BIND(C, name="pompi_comm_split_type_f") - implicit none - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(IN) :: split_type - INTEGER, INTENT(IN) :: key - INTEGER, INTENT(IN) :: info - INTEGER, INTENT(OUT) :: newcomm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_comm_split_type_f - -subroutine pompi_f_sync_reg_f(buf) & - BIND(C, name="pompi_f_sync_reg_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf -end subroutine pompi_f_sync_reg_f - -subroutine pompi_get_library_version_f(name,resultlen,ierror,name_len) & - BIND(C, name="pompi_get_library_version_f") - use, intrinsic :: ISO_C_BINDING, only : C_CHAR - implicit none - CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: name - INTEGER, INTENT(OUT) :: resultlen - INTEGER, INTENT(OUT) :: ierror - INTEGER, VALUE, INTENT(IN) :: name_len -end subroutine pompi_get_library_version_f - -subroutine pompi_mprobe_f(source,tag,comm,message,status,ierror) & - BIND(C, name="pompi_mprobe_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - INTEGER, INTENT(IN) :: source, tag - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: message - TYPE(MPI_Status), INTENT(OUT) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_mprobe_f - -subroutine pompi_imrecv_f(buf,count,datatype,message,request,ierror) & - BIND(C, name="pompi_imrecv_f") - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(INOUT) :: message - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_imrecv_f - -subroutine pompi_mrecv_f(buf,count,datatype,message,status,ierror) & - BIND(C, name="pompi_mrecv_f") - use :: mpi_f08_types, only : MPI_Status - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf - INTEGER, INTENT(IN) :: count - INTEGER, INTENT(IN) :: datatype - INTEGER, INTENT(INOUT) :: message - TYPE(MPI_Status) :: status - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_mrecv_f - -subroutine pompi_neighbor_allgather_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & - comm,ierror) & - BIND(C, name="pompi_neighbor_allgather_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_neighbor_allgather_f - -subroutine pompi_ineighbor_allgather_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & - comm,request,ierror) & - BIND(C, name="pompi_ineighbor_allgather_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ineighbor_allgather_f - -subroutine pompi_neighbor_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, & - recvtype,comm,ierror) & - BIND(C, name="pompi_neighbor_allgatherv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_neighbor_allgatherv_f - -subroutine pompi_ineighbor_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs, & - recvtype,comm,request,ierror) & - BIND(C, name="pompi_ineighbor_allgatherv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ineighbor_allgatherv_f - -subroutine pompi_neighbor_alltoall_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & - comm,ierror) & - BIND(C, name="pompi_neighbor_alltoall_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_neighbor_alltoall_f - -subroutine pompi_ineighbor_alltoall_f(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype, & - comm,request,ierror) & - BIND(C, name="pompi_ineighbor_alltoall_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ineighbor_alltoall_f - -subroutine pompi_neighbor_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvcounts, & - rdispls,recvtype,comm,ierror) & - BIND(C, name="pompi_neighbor_alltoallv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_neighbor_alltoallv_f - -subroutine pompi_ineighbor_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvcounts, & - rdispls,recvtype,comm,request,ierror) & - BIND(C, name="pompi_ineighbor_alltoallv_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtype, recvtype - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ineighbor_alltoallv_f - -subroutine pompi_neighbor_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvcounts, & - rdispls,recvtypes,comm,ierror) & - BIND(C, name="pompi_neighbor_alltoallw_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtypes, recvtypes - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_neighbor_alltoallw_f - -subroutine pompi_ineighbor_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvcounts, & - rdispls,recvtypes,comm,request,ierror) & - BIND(C, name="pompi_ineighbor_alltoallw_f") - use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND - implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtypes, recvtypes - INTEGER, INTENT(IN) :: comm - INTEGER, INTENT(OUT) :: request - INTEGER, INTENT(OUT) :: ierror -end subroutine pompi_ineighbor_alltoallw_f - -end interface From d0a0fe818fd10aabc9eaa3221469060003172b4f Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 19 Sep 2018 11:27:39 +0900 Subject: [PATCH 091/674] fortran/use-mpi-f08: use bindings from ompi_mpifh_bindings Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@c4ce01d104bb5ccb4bfda82f9492da194d1dc671) --- ompi/mpi/fortran/use-mpi-f08/abort_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/accumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/add_error_class_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/add_error_code_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/add_error_string_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/aint_diff_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/alloc_mem_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/barrier_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/cancel_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/cart_coords_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/cart_rank_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/cart_shift_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/cartdim_get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/close_port_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_accept_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_compare_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_connect_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_create_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_create_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_delete_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_disconnect_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_dup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_dup_with_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_free_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_get_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_get_parent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_idup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_join_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_rank_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_remote_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_remote_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_set_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_set_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_set_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/comm_split_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/comm_split_type_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/dims_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/dist_graph_neighbors_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/errhandler_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/error_class_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/error_string_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_close_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_delete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_amode_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_byte_offset_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_position_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_position_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_type_extent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_get_view_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iread_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iread_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iread_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iread_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_open_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_preallocate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_all_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_at_all_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_at_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_ordered_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_ordered_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_ordered_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_read_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_seek_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_seek_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_set_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_set_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_set_view_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_sync_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_all_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_at_all_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_at_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_ordered_begin_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_ordered_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_ordered_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/file_write_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/finalize_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_accumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_count_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_elements_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_elements_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_library_version_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_processor_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/get_version_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/graph_get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/graph_map_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/graph_neighbors_count_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/graph_neighbors_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/graphdims_get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/grequest_complete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/grequest_start_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_compare_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_difference_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_excl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_incl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_intersection_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_range_excl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_range_incl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_rank_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_translate_ranks_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/group_union_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ibarrier_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_delete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_dup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_get_nkeys_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_get_nthkey_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/info_set_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/init_thread_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/intercomm_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/isend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/issend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/lookup_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/mprobe_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/op_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/open_port_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/pack_external_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/pack_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/pcontrol_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/probe_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pabort_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/padd_error_class_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/padd_error_code_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/padd_error_string_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/paint_diff_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/palloc_mem_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbarrier_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbsend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_detach_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcancel_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcart_coords_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcart_rank_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcart_shift_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcartdim_get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pclose_port_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_accept_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_compare_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_connect_f08.F90 | 4 +++- .../use-mpi-f08/profile/pcomm_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_create_group_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pcomm_delete_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_disconnect_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_dup_with_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pcomm_free_keyval_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_parent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_idup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_join_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_rank_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_remote_group_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pcomm_remote_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_attr_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_type_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pdims_create_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pdist_graph_neighbors_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/perrhandler_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/perror_class_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/perror_string_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pf_sync_reg_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_close_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_delete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_amode_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_get_byte_offset_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_info_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_get_position_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_get_position_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_size_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_get_type_extent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_view_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_all_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_iread_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_iread_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_all_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_iwrite_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_iwrite_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_open_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pfile_preallocate_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_read_all_begin_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_read_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_read_at_all_begin_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_read_at_all_end_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_read_ordered_begin_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_read_ordered_end_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_read_ordered_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pfile_read_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pfile_seek_shared_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_info_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_view_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_sync_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_write_all_begin_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_write_all_end_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_write_at_all_begin_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_write_at_all_end_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_write_at_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_write_ordered_begin_f08.F90 | 4 +++- .../use-mpi-f08/profile/pfile_write_ordered_end_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_write_ordered_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pfile_write_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfinalize_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_address_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_count_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pget_library_version_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pget_version_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgraph_get_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgraph_map_f08.F90 | 4 +++- .../use-mpi-f08/profile/pgraph_neighbors_count_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgraphdims_get_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pgrequest_complete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_start_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_compare_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pgroup_difference_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_excl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_incl_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pgroup_intersection_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pgroup_range_excl_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pgroup_range_incl_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_rank_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_size_f08.F90 | 4 +++- .../use-mpi-f08/profile/pgroup_translate_ranks_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pgroup_union_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pibarrier_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pibsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pimrecv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_delete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_dup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nkeys_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nthkey_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinfo_set_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinit_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pinit_thread_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pintercomm_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 | 4 +++- .../use-mpi-f08/profile/pireduce_scatter_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pirsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pisend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pissend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/plookup_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pmprobe_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pmrecv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pop_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/popen_port_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ppack_external_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ppack_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ppcontrol_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pprobe_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ppublish_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pquery_thread_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/precv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pregister_datarep_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prequest_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/prsend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/psend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/psend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pssend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pssend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pstart_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pstartall_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pstatus_set_elements_f08.F90 | 4 +++- .../use-mpi-f08/profile/pstatus_set_elements_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptopo_test_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_commit_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_contiguous_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_darray_f08.F90 | 4 +++- .../use-mpi-f08/profile/ptype_create_f90_complex_f08.F90 | 4 +++- .../use-mpi-f08/profile/ptype_create_f90_integer_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_f90_real_f08.F90 | 4 +++- .../use-mpi-f08/profile/ptype_create_hindexed_block_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_hindexed_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_hvector_f08.F90 | 4 +++- .../use-mpi-f08/profile/ptype_create_indexed_block_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_keyval_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_resized_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_struct_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_create_subarray_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/ptype_delete_attr_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/profile/ptype_dup_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/ptype_free_keyval_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_get_contents_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_get_envelope_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/ptype_get_extent_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_name_f08.F90 | 2 +- .../fortran/use-mpi-f08/profile/ptype_get_true_extent_f08.F90 | 4 +++- .../use-mpi-f08/profile/ptype_get_true_extent_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_indexed_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_match_size_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_attr_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_name_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_x_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/punpublish_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwait_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwaitall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwaitany_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwaitsome_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_allocate_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 | 4 ++-- .../fortran/use-mpi-f08/profile/pwin_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_complete_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_create_dynamic_f08.F90 | 4 ++-- .../use-mpi-f08/profile/pwin_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_create_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_delete_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/pwin_fence_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_flush_local_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_keyval_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_info_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_post_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_attr_f08.F90 | 4 +++- .../fortran/use-mpi-f08/profile/pwin_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_info_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_name_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/profile/pwin_shared_query_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_start_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/profile/pwin_wait_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/publish_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/put_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/query_thread_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/recv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/register_datarep_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/request_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/rget_accumulate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/rget_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/rput_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/send_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/start_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/startall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/status_set_elements_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/status_set_elements_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_commit_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_contiguous_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_darray_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_f90_complex_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_f90_integer_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_f90_real_f08.F90 | 4 +++- .../fortran/use-mpi-f08/type_create_hindexed_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90 | 4 +++- .../mpi/fortran/use-mpi-f08/type_create_indexed_block_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_resized_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_struct_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_create_subarray_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_delete_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_free_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_contents_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_extent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_match_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_set_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_set_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/type_size_x_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/type_vector_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/unpublish_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/wait_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/waitall_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/waitany_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/waitsome_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_allocate_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_allocate_shared_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/win_call_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_complete_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_create_dynamic_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/win_create_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_create_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_delete_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/win_fence_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_flush_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_flush_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_flush_local_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_flush_local_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_free_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_free_keyval_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_get_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_get_group_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_get_info_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_lock_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_lock_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_post_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_set_attr_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_set_errhandler_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_set_info_f08.F90 | 4 ++-- ompi/mpi/fortran/use-mpi-f08/win_set_name_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_shared_query_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_start_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_unlock_all_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_unlock_f08.F90 | 4 +++- ompi/mpi/fortran/use-mpi-f08/win_wait_f08.F90 | 4 +++- 632 files changed, 1868 insertions(+), 648 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/abort_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/abort_f08.F90 index d88d548943d..7e7240bbb58 100644 --- a/ompi/mpi/fortran/use-mpi-f08/abort_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/abort_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Abort_f08(comm,errorcode,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_abort_f + use :: ompi_mpifh_bindings, only : ompi_abort_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/accumulate_f08.F90 index 67d99414419..3b702236cdd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/accumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_Accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/add_error_class_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/add_error_class_f08.F90 index 073e445cc3b..db1e1aeabb0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/add_error_class_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/add_error_class_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Add_error_class_f08(errorclass,ierror) - use :: mpi_f08, only : ompi_add_error_class_f + use :: ompi_mpifh_bindings, only : ompi_add_error_class_f implicit none INTEGER, INTENT(OUT) :: errorclass INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/add_error_code_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/add_error_code_f08.F90 index 9e6c093c5d5..7945fcbf988 100644 --- a/ompi/mpi/fortran/use-mpi-f08/add_error_code_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/add_error_code_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Add_error_code_f08(errorclass,errorcode,ierror) - use :: mpi_f08, only : ompi_add_error_code_f + use :: ompi_mpifh_bindings, only : ompi_add_error_code_f implicit none INTEGER, INTENT(IN) :: errorclass INTEGER, INTENT(OUT) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/add_error_string_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/add_error_string_f08.F90 index d987bdce0ef..2d6a52e1494 100644 --- a/ompi/mpi/fortran/use-mpi-f08/add_error_string_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/add_error_string_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Add_error_string_f08(errorcode,string,ierror) - use :: mpi_f08, only : ompi_add_error_string_f + use :: ompi_mpifh_bindings, only : ompi_add_error_string_f implicit none integer, intent(in) :: errorcode character(len=*), intent(in) :: string diff --git a/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 index afe3874d036..59dc78231e2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2015 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" function MPI_Aint_add_f08(addr1, addr2) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_aint_add_f + use :: ompi_mpifh_bindings, only : ompi_aint_add_f implicit none INTEGER(MPI_ADDRESS_KIND) :: MPI_Aint_add_f08 INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr1 diff --git a/ompi/mpi/fortran/use-mpi-f08/aint_diff_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/aint_diff_f08.F90 index 97919f1da97..c03bf049752 100644 --- a/ompi/mpi/fortran/use-mpi-f08/aint_diff_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/aint_diff_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2015 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" function MPI_Aint_diff_f08(addr1, addr2) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_aint_diff_f + use :: ompi_mpifh_bindings, only : ompi_aint_diff_f implicit none INTEGER(MPI_ADDRESS_KIND) :: MPI_Aint_diff_f08 INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr1 diff --git a/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 index 4b3d30607f6..86adb405cb3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_allgather_f + use :: ompi_mpifh_bindings, only : ompi_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 index 8d84343c1f9..a8f0f072794 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/alloc_mem_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alloc_mem_f08.F90 index bdd52af0159..4d01edf2365 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alloc_mem_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alloc_mem_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Alloc_mem_f08(size,info,baseptr,ierror) use, intrinsic :: ISO_C_BINDING, only : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_alloc_mem_f + use :: ompi_mpifh_bindings, only : ompi_alloc_mem_f implicit none INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 index a5ca83aeb0d..5a5cb66ef1e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Allreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_allreduce_f + use :: ompi_mpifh_bindings, only : ompi_allreduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 index b013c90748d..a72e31d281b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 index e73326182fb..a9faa8cdd7c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 index 9654057730a..10684b03c9d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/barrier_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/barrier_f08.F90 index e3f507b49f7..b97a647de24 100644 --- a/ompi/mpi/fortran/use-mpi-f08/barrier_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/barrier_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Barrier_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_barrier_f + use :: ompi_mpifh_bindings, only : ompi_barrier_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 index e83decdd1b5..1ecc54dc08f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_bcast_f + use :: ompi_mpifh_bindings, only : ompi_bcast_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90 index d2ae74e7c40..ce7479b9dd9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/bsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Bsend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_bsend_f + use :: ompi_mpifh_bindings, only : ompi_bsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90 index 6826f6dc9e3..7f5ed2c5072 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/bsend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Bsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_bsend_init_f + use :: ompi_mpifh_bindings, only : ompi_bsend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 index 0a3fd8e0663..31e958bc582 100644 --- a/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Buffer_attach_f08(buffer,size,ierror) - use :: mpi_f08, only : ompi_buffer_attach_f + use :: ompi_mpifh_bindings, only : ompi_buffer_attach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 index 7c7815175d2..a0da19933c1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Buffer_detach_f08(buffer_addr,size,ierror) - use :: mpi_f08, only : ompi_buffer_detach_f + use :: ompi_mpifh_bindings, only : ompi_buffer_detach_f USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR implicit none TYPE(C_PTR), INTENT(OUT) :: buffer_addr diff --git a/ompi/mpi/fortran/use-mpi-f08/cancel_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/cancel_f08.F90 index dc4d9d06c01..33dfa7037a9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/cancel_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/cancel_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Cancel_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_cancel_f + use :: ompi_mpifh_bindings, only : ompi_cancel_f implicit none TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/cart_coords_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/cart_coords_f08.F90 index 7ec50650e1c..ec2b11dd5df 100644 --- a/ompi/mpi/fortran/use-mpi-f08/cart_coords_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/cart_coords_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Cart_coords_f08(comm,rank,maxdims,coords,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_coords_f + use :: ompi_mpifh_bindings, only : ompi_cart_coords_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank, maxdims diff --git a/ompi/mpi/fortran/use-mpi-f08/cart_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/cart_rank_f08.F90 index 7cdf8ae299b..26b82822632 100644 --- a/ompi/mpi/fortran/use-mpi-f08/cart_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/cart_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Cart_rank_f08(comm,coords,rank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_rank_f + use :: ompi_mpifh_bindings, only : ompi_cart_rank_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: coords(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/cart_shift_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/cart_shift_f08.F90 index 6c5e1528d24..783fcddc7f0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/cart_shift_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/cart_shift_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Cart_shift_f08(comm,direction,disp,rank_source,rank_dest,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_shift_f + use :: ompi_mpifh_bindings, only : ompi_cart_shift_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: direction, disp diff --git a/ompi/mpi/fortran/use-mpi-f08/cartdim_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/cartdim_get_f08.F90 index bd2b4e8e9bb..bf840dad1c8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/cartdim_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/cartdim_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Cartdim_get_f08(comm,ndims,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cartdim_get_f + use :: ompi_mpifh_bindings, only : ompi_cartdim_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: ndims diff --git a/ompi/mpi/fortran/use-mpi-f08/close_port_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/close_port_f08.F90 index ce3c8d24793..8de5ea548a8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/close_port_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/close_port_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Close_port_f08(port_name,ierror) - use :: mpi_f08, only : ompi_close_port_f + use :: ompi_mpifh_bindings, only : ompi_close_port_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_accept_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_accept_f08.F90 index a5ffda0b867..0c0a533350b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_accept_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_accept_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_accept_f08(port_name,info,root,comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_accept_f + use :: ompi_mpifh_bindings, only : ompi_comm_accept_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_call_errhandler_f08.F90 index 4370f404907..9ba084cf197 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_call_errhandler_f08(comm,errorcode,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_call_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_compare_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_compare_f08.F90 index 353e17b7f09..7244bcff9ed 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_compare_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_compare_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_compare_f08(comm1,comm2,result,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_compare_f + use :: ompi_mpifh_bindings, only : ompi_comm_compare_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm1 TYPE(MPI_Comm), INTENT(IN) :: comm2 diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_connect_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_connect_f08.F90 index d92855256c4..f7e5d244a1f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_connect_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_connect_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_connect_f08(port_name,info,root,comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_connect_f + use :: ompi_mpifh_bindings, only : ompi_comm_connect_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_create_errhandler_f08.F90 index 7f7b7a68a71..0db3920e193 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_Comm_create_errhandler_f08(comm_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_errhandler_function - use :: mpi_f08, only : ompi_comm_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_errhandler_f implicit none PROCEDURE(MPI_Comm_errhandler_function) :: comm_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_create_f08.F90 index 4fc24191857..c4dbaedf8d2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_create_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_create_f08(comm,group,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_create_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(IN) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_create_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_create_group_f08.F90 index 61ce4f185cf..a930829c2fe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_create_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_create_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_create_group_f08(comm,group,tag,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_create_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(IN) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_create_keyval_f08.F90 index 3503c38b8bd..a73475bc9fc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine MPI_Comm_create_keyval_f08(comm_copy_attr_fn,comm_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_delete_attr_function - use :: mpi_f08, only : ompi_comm_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_keyval_f implicit none PROCEDURE(MPI_Comm_copy_attr_function) :: comm_copy_attr_fn PROCEDURE(MPI_Comm_delete_attr_function) :: comm_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_delete_attr_f08.F90 index 1e1b1dceb36..67abf233c21 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_delete_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_delete_attr_f08(comm,comm_keyval,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_comm_delete_attr_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: comm_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_disconnect_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_disconnect_f08.F90 index e8671bce31d..9a7106a87f4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_disconnect_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_disconnect_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_disconnect_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_disconnect_f + use :: ompi_mpifh_bindings, only : ompi_comm_disconnect_f implicit none TYPE(MPI_Comm), INTENT(INOUT) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_dup_f08.F90 index f60bb03b2e2..a495a41ffc2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_dup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_dup_f08(comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_dup_f + use :: ompi_mpifh_bindings, only : ompi_comm_dup_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: newcomm diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_dup_with_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_dup_with_info_f08.F90 index 887323a7f9c..379874a1dcb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_dup_with_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_dup_with_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_dup_with_info_f08(comm,info,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_dup_with_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_dup_with_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_free_f08.F90 index e4385ca4ed9..992548889cc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_free_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_free_f + use :: ompi_mpifh_bindings, only : ompi_comm_free_f implicit none TYPE(MPI_Comm), INTENT(INOUT) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_free_keyval_f08.F90 index 774a2c291e3..af9c3c16089 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_free_keyval_f08(comm_keyval,ierror) - use :: mpi_f08, only : ompi_comm_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_comm_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: comm_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_get_errhandler_f08.F90 index 87d96c47ca1..7960b500ac9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_get_errhandler_f08(comm,errhandler,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Errhandler - use :: mpi_f08, only : ompi_comm_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_get_info_f08.F90 index 734b2493a9a..4d959472430 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_get_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_get_info_f08(comm,info_used,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_get_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(OUT) :: info_used diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 index e39b2ee41bf..8e9af5bff17 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_get_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_get_name_f08(comm,comm_name,resultlen,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_comm_get_name_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_name_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(OUT) :: comm_name diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_get_parent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_get_parent_f08.F90 index afc4972f630..f9294f69702 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_get_parent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_get_parent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_get_parent_f08(parent,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_get_parent_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_parent_f implicit none TYPE(MPI_Comm), INTENT(OUT) :: parent INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_group_f08.F90 index 2dd8bc4d013..375625c8988 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_group_f08(comm,group,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_idup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_idup_f08.F90 index 0c7a5818bb9..d9a6ce00908 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_idup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_idup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_idup_f08(comm,newcomm,request,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_comm_idup_f + use :: ompi_mpifh_bindings, only : ompi_comm_idup_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: newcomm diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_join_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_join_f08.F90 index 589a9c4ccbe..cb4bd79de64 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_join_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_join_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_join_f08(fd,intercomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_join_f + use :: ompi_mpifh_bindings, only : ompi_comm_join_f implicit none INTEGER, INTENT(IN) :: fd TYPE(MPI_Comm), INTENT(OUT) :: intercomm diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_rank_f08.F90 index debdff5bd63..8fc8c4ed9b9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_rank_f08(comm,rank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_rank_f + use :: ompi_mpifh_bindings, only : ompi_comm_rank_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_remote_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_remote_group_f08.F90 index 13ca736471c..7a9e17538da 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_remote_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_remote_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_remote_group_f08(comm,group,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_remote_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_remote_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_remote_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_remote_size_f08.F90 index 40ad0487b19..f21b70051c3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_remote_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_remote_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_remote_size_f08(comm,size,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_remote_size_f + use :: ompi_mpifh_bindings, only : ompi_comm_remote_size_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_set_attr_f08.F90 index 0797d88fb07..cc7833b36a1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_set_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_set_attr_f08(comm,comm_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_comm_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_attr_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: comm_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_set_errhandler_f08.F90 index 0cd58914efd..05d4d81758c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_set_errhandler_f08(comm,errhandler,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Errhandler - use :: mpi_f08, only : ompi_comm_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_set_info_f08.F90 index e70f544aa0b..47c0fddd81d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_set_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_set_info_f08(comm,info,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_set_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_set_name_f08.F90 index 908a2d19493..d1a0c0860ba 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_set_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_set_name_f08(comm,comm_name,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_set_name_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_name_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(IN) :: comm_name diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_size_f08.F90 index 1158c893607..c00911e451a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_size_f08(comm,size,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_size_f + use :: ompi_mpifh_bindings, only : ompi_comm_size_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 index bec26101c3d..a360d66b823 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & array_of_errcodes,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_spawn_f + use :: ompi_mpifh_bindings, only : ompi_comm_spawn_f implicit none CHARACTER(LEN=*), INTENT(IN) :: command, argv INTEGER, INTENT(IN) :: maxprocs, root diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 index b3842eac64c..d6d4ae37c3f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 @@ -3,7 +3,7 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -11,7 +11,7 @@ subroutine MPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & array_of_maxprocs,array_of_info,root, & comm,intercomm,array_of_errcodes,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_spawn_multiple_f + use :: ompi_mpifh_bindings, only : ompi_comm_spawn_multiple_f implicit none INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: array_of_maxprocs(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_split_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_split_f08.F90 index 8c8b28698e0..f2cd99d2905 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_split_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_split_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_split_f08(comm,color,key,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_split_f + use :: ompi_mpifh_bindings, only : ompi_comm_split_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: color, key diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_split_type_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_split_type_f08.F90 index 59bdf0ff530..f2ba532028c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_split_type_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_split_type_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_split_type_f08(comm,split_type,key,info,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_split_type_f + use :: ompi_mpifh_bindings, only : ompi_comm_split_type_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: split_type diff --git a/ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90 index f9acb19e60c..93c1f1a32ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/compare_and_swap_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_Compare_and_swap_f08(origin_addr,compare_addr,result_addr,& datatype,target_rank,target_disp,win,& ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_compare_and_swap_f + use :: ompi_mpifh_bindings, only : ompi_compare_and_swap_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr, compare_addr OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr diff --git a/ompi/mpi/fortran/use-mpi-f08/dims_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/dims_create_f08.F90 index 776bb75e3d9..0f0d138527e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/dims_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/dims_create_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Dims_create_f08(nnodes,ndims,dims,ierror) - use :: mpi_f08, only : ompi_dims_create_f + use :: ompi_mpifh_bindings, only : ompi_dims_create_f implicit none INTEGER, INTENT(IN) :: nnodes, ndims INTEGER, INTENT(INOUT) :: dims(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/dist_graph_neighbors_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/dist_graph_neighbors_f08.F90 index 78a4a7a4a41..f47f21bb2c9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/dist_graph_neighbors_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/dist_graph_neighbors_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Dist_graph_neighbors_f08(comm,maxindegree,sources,sourceweights,& maxoutdegree,destinations,destweights,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_dist_graph_neighbors_f + use :: ompi_mpifh_bindings, only : ompi_dist_graph_neighbors_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: maxindegree, maxoutdegree diff --git a/ompi/mpi/fortran/use-mpi-f08/errhandler_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/errhandler_free_f08.F90 index fb512d9d6ce..a0d6baccba4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/errhandler_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/errhandler_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Errhandler_free_f08(errhandler,ierror) use :: mpi_f08_types, only : MPI_Errhandler - use :: mpi_f08, only : ompi_errhandler_free_f + use :: ompi_mpifh_bindings, only : ompi_errhandler_free_f implicit none TYPE(MPI_Errhandler), INTENT(INOUT) :: errhandler INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/error_class_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/error_class_f08.F90 index d83792f513f..ca901818b37 100644 --- a/ompi/mpi/fortran/use-mpi-f08/error_class_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/error_class_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Error_class_f08(errorcode,errorclass,ierror) - use :: mpi_f08, only : ompi_error_class_f + use :: ompi_mpifh_bindings, only : ompi_error_class_f implicit none INTEGER, INTENT(IN) :: errorcode INTEGER, INTENT(OUT) :: errorclass diff --git a/ompi/mpi/fortran/use-mpi-f08/error_string_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/error_string_f08.F90 index 1af4fe87630..fb0e2d8bffc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/error_string_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/error_string_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Error_string_f08(errorcode,string,resultlen,ierror) - use :: mpi_f08, only : ompi_error_string_f + use :: ompi_mpifh_bindings, only : ompi_error_string_f implicit none integer, intent(in) :: errorcode character(len=*), intent(out) :: string diff --git a/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 index 2e513ef6b04..d628eb31433 100644 --- a/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Exscan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_exscan_f + use :: ompi_mpifh_bindings, only : ompi_exscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90 index 913804155d8..4643cb2b162 100644 --- a/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/f_sync_reg_f08.F90 @@ -4,12 +4,14 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. ! Copyright (c) 2012 University of Oregon. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_F_sync_reg_f08(buf) - use :: mpi_f08, only : ompi_f_sync_reg_f + use :: ompi_mpifh_bindings, only : ompi_f_sync_reg_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90 index 6ef6ed56b22..d1ab5024172 100644 --- a/ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/fetch_and_op_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Fetch_and_op_f08(origin_addr,result_addr,datatype,target_rank, & target_disp,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_fetch_and_op_f + use :: ompi_mpifh_bindings, only : ompi_fetch_and_op_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr diff --git a/ompi/mpi/fortran/use-mpi-f08/file_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_call_errhandler_f08.F90 index 404fe658144..b075e65d66f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_call_errhandler_f08(fh,errorcode,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_call_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/file_close_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_close_f08.F90 index a5a52579cbb..ab3b6e3b7c6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_close_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_close_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_close_f08(fh,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_close_f + use :: ompi_mpifh_bindings, only : ompi_file_close_f implicit none TYPE(MPI_File), INTENT(INOUT) :: fh INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/file_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_create_errhandler_f08.F90 index e779537af8d..199d2f25cdf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_File_create_errhandler_f08(file_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_File_errhandler_function - use :: mpi_f08, only : ompi_file_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_create_errhandler_f implicit none PROCEDURE(MPI_File_errhandler_function) :: file_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/file_delete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_delete_f08.F90 index 120bd91445b..853f2c39578 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_delete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_delete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_delete_f08(filename,info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_file_delete_f + use :: ompi_mpifh_bindings, only : ompi_file_delete_f implicit none CHARACTER(LEN=*), INTENT(IN) :: filename TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_amode_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_amode_f08.F90 index 36e500e440f..bed5bd5bd3e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_amode_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_amode_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_amode_f08(fh,amode,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_get_amode_f + use :: ompi_mpifh_bindings, only : ompi_file_get_amode_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, INTENT(OUT) :: amode diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_byte_offset_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_byte_offset_f08.F90 index d9755df7a52..53ff9633e71 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_byte_offset_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_byte_offset_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_byte_offset_f08(fh,offset,disp,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_byte_offset_f + use :: ompi_mpifh_bindings, only : ompi_file_get_byte_offset_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_errhandler_f08.F90 index 65c2e541124..330db63fb04 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_errhandler_f08(file,errhandler,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Errhandler - use :: mpi_f08, only : ompi_file_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_get_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: file TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_group_f08.F90 index a9833b18370..ead59f69f92 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_group_f08(fh,group,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Group - use :: mpi_f08, only : ompi_file_get_group_f + use :: ompi_mpifh_bindings, only : ompi_file_get_group_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_info_f08.F90 index ba86bd55769..17e02859399 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_info_f08(fh,info_used,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Info - use :: mpi_f08, only : ompi_file_get_info_f + use :: ompi_mpifh_bindings, only : ompi_file_get_info_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Info), INTENT(OUT) :: info_used diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_position_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_position_f08.F90 index c70f9559820..bc4a85e721d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_position_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_position_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_position_f08(fh,offset,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_position_f + use :: ompi_mpifh_bindings, only : ompi_file_get_position_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_position_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_position_shared_f08.F90 index 6d29a8f581d..11bffdc7494 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_position_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_position_shared_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_position_shared_f08(fh,offset,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_position_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_get_position_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_size_f08.F90 index 0f3359bd6de..d134f090f40 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_size_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_size_f + use :: ompi_mpifh_bindings, only : ompi_file_get_size_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_type_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_type_extent_f08.F90 index e98ccba5302..0aa04b6e9fc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_type_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_type_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_type_extent_f08(fh,datatype,extent,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_file_get_type_extent_f + use :: ompi_mpifh_bindings, only : ompi_file_get_type_extent_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/file_get_view_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_get_view_f08.F90 index 4edc99e775b..1d4db13d87b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_get_view_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_get_view_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_get_view_f08(fh,disp,etype,filetype,datarep,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_view_f + use :: ompi_mpifh_bindings, only : ompi_file_get_view_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: disp diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iread_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iread_all_f08.F90 index f280e911c30..2a02a3cdb1e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iread_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iread_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iread_all_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_f08.F90 index 9cc7f317df9..b3265617542 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iread_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iread_at_all_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iread_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iread_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iread_at_f08.F90 index fd6835e6dc8..c382b602c6f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iread_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iread_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iread_at_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iread_at_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iread_f08.F90 index 0d6b42220f6..3bc13693a76 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iread_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iread_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iread_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iread_shared_f08.F90 index 90059cfcae9..b5eabf4843b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iread_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iread_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iread_shared_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_f08.F90 index c36c68abf10..04499250c1a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iwrite_all_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90 index 315b466ffea..792f591731a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iwrite_at_all_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iwrite_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90 index 8c789f2706e..c67f5e17a01 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iwrite_at_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iwrite_at_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90 index c0a9d99fee3..f2f420597be 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iwrite_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90 index fe8b1af8476..3e61aec7f61 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_iwrite_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_iwrite_shared_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_shared_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf TYPE(MPI_File), INTENT(IN) :: fh diff --git a/ompi/mpi/fortran/use-mpi-f08/file_open_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_open_f08.F90 index df606aa77fc..d7855939490 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_open_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_open_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_open_f08(comm,filename,amode,info,fh,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info, MPI_File - use :: mpi_f08, only : ompi_file_open_f + use :: ompi_mpifh_bindings, only : ompi_file_open_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(IN) :: filename diff --git a/ompi/mpi/fortran/use-mpi-f08/file_preallocate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_preallocate_f08.F90 index 9d153c75a60..36cf7e918a4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_preallocate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_preallocate_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_preallocate_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_preallocate_f + use :: ompi_mpifh_bindings, only : ompi_file_preallocate_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_all_begin_f08.F90 index 9003540f28a..ba5f3f8d453 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_all_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_read_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_all_end_f08.F90 index f51fb6951a8..be7da0df912 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_all_f08.F90 index 149bd77d838..6805adb5711 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_all_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_all_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_begin_f08.F90 index cecdd109921..41bb7d6d171 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_at_all_begin_f08(fh,offset,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_end_f08.F90 index 5a00cf214f9..2173c5091a0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_at_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_at_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_f08.F90 index 2786cb2ad11..88efb71740f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_at_all_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_at_f08.F90 index 74f056be664..bd5964c7760 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_at_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_f08.F90 index c089704d976..9e517bcf48f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_f + use :: ompi_mpifh_bindings, only : ompi_file_read_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_begin_f08.F90 index 558caabe833..814ac47b8cc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_ordered_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_read_ordered_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_end_f08.F90 index b87c7fac4e5..dfc6ceea1ed 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_ordered_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_ordered_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_f08.F90 index af250d90509..e929589523e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_ordered_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_ordered_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_ordered_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_read_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_read_shared_f08.F90 index 664b2f0f5c4..b6d3fcb4686 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_read_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_read_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_read_shared_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_read_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_seek_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_seek_f08.F90 index 62321512b07..46b1fa23e9e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_seek_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_seek_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_seek_f08(fh,offset,whence,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_seek_f + use :: ompi_mpifh_bindings, only : ompi_file_seek_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_seek_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_seek_shared_f08.F90 index 4f32feb5865..1b660da3c30 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_seek_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_seek_shared_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_seek_shared_f08(fh,offset,whence,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_seek_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_seek_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_set_errhandler_f08.F90 index c944466de88..18ac24dc918 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_set_errhandler_f08(file,errhandler,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Errhandler - use :: mpi_f08, only : ompi_file_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_set_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: file TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/file_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_set_info_f08.F90 index 2812278a564..6828f22295a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_set_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_set_info_f08(fh,info,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Info - use :: mpi_f08, only : ompi_file_set_info_f + use :: ompi_mpifh_bindings, only : ompi_file_set_info_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/file_set_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_set_size_f08.F90 index 1d73046802c..917d9ac4bd5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_set_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_set_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_set_size_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_set_size_f + use :: ompi_mpifh_bindings, only : ompi_file_set_size_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/file_set_view_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_set_view_f08.F90 index 817ebab4b0a..3f4bb690f50 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_set_view_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_set_view_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_set_view_f08(fh,disp,etype,filetype,datarep,info,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Info, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_set_view_f + use :: ompi_mpifh_bindings, only : ompi_file_set_view_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: disp diff --git a/ompi/mpi/fortran/use-mpi-f08/file_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_sync_f08.F90 index cbd6efea6f1..2963ec0e2af 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_sync_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_File_sync_f08(fh,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_sync_f + use :: ompi_mpifh_bindings, only : ompi_file_sync_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_all_begin_f08.F90 index 01385f86b13..8f94cf04b83 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_all_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_write_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_all_end_f08.F90 index d658876c291..3ebc884662d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_all_f08.F90 index 99d2caf06cb..9521b02ae3c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_all_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_all_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_begin_f08.F90 index 54239edd1fa..1e535cb26ba 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_at_all_begin_f08(fh,offset,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_end_f08.F90 index 09d12cd2ab8..a4bb87bb0d8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_at_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_at_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_f08.F90 index 8935fd95d69..2976bb6318f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_at_all_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_at_f08.F90 index f1da8a9416e..d4beed26dec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_at_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_f08.F90 index a5c9fe246aa..073198ca000 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_f + use :: ompi_mpifh_bindings, only : ompi_file_write_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_begin_f08.F90 index 3565f0e9f94..0a8f798672a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_ordered_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_write_ordered_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_end_f08.F90 index f8b05302e16..19ad37e8271 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_ordered_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_ordered_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_f08.F90 index c57a4f595e5..3e06e606c9b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_ordered_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_ordered_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_ordered_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/file_write_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/file_write_shared_f08.F90 index 3aafd18f2da..239cd0d4993 100644 --- a/ompi/mpi/fortran/use-mpi-f08/file_write_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/file_write_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_File_write_shared_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_write_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/finalize_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/finalize_f08.F90 index 01a733ad4d0..f61b2d56b49 100644 --- a/ompi/mpi/fortran/use-mpi-f08/finalize_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/finalize_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Finalize_f08(ierror) - use :: mpi_f08, only : ompi_finalize_f + use :: ompi_mpifh_bindings, only : ompi_finalize_f implicit none INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90 index cf67c56a563..fc84c6cdefe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/free_mem_f08.F90 @@ -1,14 +1,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Free_mem_f08(base,ierror) - use :: mpi_f08, only : ompi_free_mem_f + use :: ompi_mpifh_bindings, only : ompi_free_mem_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 index fbba2cb2c64..bba9a5cdc38 100644 --- a/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Gather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_gather_f + use :: ompi_mpifh_bindings, only : ompi_gather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 index 6eff37b5ea4..abdcb7ca55b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Gatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_gatherv_f + use :: ompi_mpifh_bindings, only : ompi_gatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/get_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_accumulate_f08.F90 index 0302058a2cf..561e389a737 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_accumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +14,7 @@ subroutine MPI_Get_accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_get_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90 index 0d33b22f559..5aa15420373 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_address_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Get_address_f08(location,address,ierror) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_address_f + use :: ompi_mpifh_bindings, only : ompi_get_address_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: location INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: address diff --git a/ompi/mpi/fortran/use-mpi-f08/get_count_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_count_f08.F90 index f9b2379589e..d2fbc1eeda5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_count_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_count_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_count_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_get_count_f + use :: ompi_mpifh_bindings, only : ompi_get_count_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/get_elements_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_elements_f08.F90 index ba5e50bc7e4..b6914f0e1b8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_elements_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_elements_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_elements_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_get_elements_f + use :: ompi_mpifh_bindings, only : ompi_get_elements_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/get_elements_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_elements_x_f08.F90 index 437bbca8226..c01b6ffc1fb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_elements_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_elements_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_elements_x_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_get_elements_x_f + use :: ompi_mpifh_bindings, only : ompi_get_elements_x_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_f08.F90 index 075a0f71ddb..5baf5555348 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2018 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Get_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_f + use :: ompi_mpifh_bindings, only : ompi_get_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/get_library_version_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_library_version_f08.F90 index 037c38dac2d..d916c5994cb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_library_version_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_library_version_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2010-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_library_version_f08(version,resultlen,ierror) use :: mpi_f08_types, only : MPI_MAX_LIBRARY_VERSION_STRING - use :: mpi_f08, only : ompi_get_library_version_f + use :: ompi_mpifh_bindings, only : ompi_get_library_version_f implicit none character(len=MPI_MAX_LIBRARY_VERSION_STRING), intent(out) :: version integer, intent(out) :: resultlen diff --git a/ompi/mpi/fortran/use-mpi-f08/get_processor_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_processor_name_f08.F90 index 1b47c203547..fe7e3545dfc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_processor_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_processor_name_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_processor_name_f08(name,resultlen,ierror) - use :: mpi_f08, only : ompi_get_processor_name_f + use :: ompi_mpifh_bindings, only : ompi_get_processor_name_f implicit none character(len=*), intent(out) :: name integer, intent(out) :: resultlen diff --git a/ompi/mpi/fortran/use-mpi-f08/get_version_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/get_version_f08.F90 index c6452d300d5..1aaf04c060b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/get_version_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/get_version_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Get_version_f08(version,subversion,ierror) - use :: mpi_f08, only : ompi_get_version_f + use :: ompi_mpifh_bindings, only : ompi_get_version_f implicit none INTEGER, INTENT(OUT) :: version, subversion INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/graph_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/graph_get_f08.F90 index d90d03854bc..0d42f42d4b9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/graph_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/graph_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Graph_get_f08(comm,maxindex,maxedges,index,edges,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_get_f + use :: ompi_mpifh_bindings, only : ompi_graph_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: maxindex, maxedges diff --git a/ompi/mpi/fortran/use-mpi-f08/graph_map_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/graph_map_f08.F90 index e52628687e0..43f788df614 100644 --- a/ompi/mpi/fortran/use-mpi-f08/graph_map_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/graph_map_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Graph_map_f08(comm,nnodes,index,edges,newrank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_map_f + use :: ompi_mpifh_bindings, only : ompi_graph_map_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: nnodes diff --git a/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_count_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_count_f08.F90 index 76f988f6f2b..9ae6905ce8a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_count_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_count_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Graph_neighbors_count_f08(comm,rank,nneighbors,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_neighbors_count_f + use :: ompi_mpifh_bindings, only : ompi_graph_neighbors_count_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_f08.F90 index 8b89a085ecb..3470b6c7aaf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/graph_neighbors_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Graph_neighbors_f08(comm,rank,maxneighbors,neighbors,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_neighbors_f + use :: ompi_mpifh_bindings, only : ompi_graph_neighbors_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank, maxneighbors diff --git a/ompi/mpi/fortran/use-mpi-f08/graphdims_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/graphdims_get_f08.F90 index ed86574216c..e64b250b005 100644 --- a/ompi/mpi/fortran/use-mpi-f08/graphdims_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/graphdims_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Graphdims_get_f08(comm,nnodes,nedges,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graphdims_get_f + use :: ompi_mpifh_bindings, only : ompi_graphdims_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: nnodes, nedges diff --git a/ompi/mpi/fortran/use-mpi-f08/grequest_complete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/grequest_complete_f08.F90 index 3c56e728da2..374ed639c8e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/grequest_complete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/grequest_complete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Grequest_complete_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_grequest_complete_f + use :: ompi_mpifh_bindings, only : ompi_grequest_complete_f implicit none TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/grequest_start_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/grequest_start_f08.F90 index c39d9470dba..505c98ec9cd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/grequest_start_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/grequest_start_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +16,7 @@ subroutine MPI_Grequest_start_f08(query_fn,free_fn,cancel_fn,& use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_query_function use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_free_function use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_cancel_function - use :: mpi_f08, only : ompi_grequest_start_f + use :: ompi_mpifh_bindings, only : ompi_grequest_start_f implicit none PROCEDURE(MPI_Grequest_query_function) :: query_fn PROCEDURE(MPI_Grequest_free_function) :: free_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/group_compare_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_compare_f08.F90 index b5cb7b7dc02..51c805085e9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_compare_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_compare_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_compare_f08(group1,group2,result,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_compare_f + use :: ompi_mpifh_bindings, only : ompi_group_compare_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/group_difference_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_difference_f08.F90 index 115738b762a..cb89f8f6c08 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_difference_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_difference_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_difference_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_difference_f + use :: ompi_mpifh_bindings, only : ompi_group_difference_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/group_excl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_excl_f08.F90 index de74f04a21c..52f1bd29759 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_excl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_excl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_excl_f08(group,n,ranks,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_excl_f + use :: ompi_mpifh_bindings, only : ompi_group_excl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/group_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_free_f08.F90 index 3558bae0297..6e63efefdb9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_free_f08(group,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_free_f + use :: ompi_mpifh_bindings, only : ompi_group_free_f implicit none TYPE(MPI_Group), INTENT(INOUT) :: group INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/group_incl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_incl_f08.F90 index 4e35ef516c6..9447b451575 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_incl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_incl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_incl_f08(group,n,ranks,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_incl_f + use :: ompi_mpifh_bindings, only : ompi_group_incl_f implicit none INTEGER, INTENT(IN) :: n INTEGER, INTENT(IN) :: ranks(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/group_intersection_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_intersection_f08.F90 index 6576a19c15f..b260b61a4f4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_intersection_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_intersection_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_intersection_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_intersection_f + use :: ompi_mpifh_bindings, only : ompi_group_intersection_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/group_range_excl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_range_excl_f08.F90 index 52eb6ad9d1f..c4379592551 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_range_excl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_range_excl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_range_excl_f08(group,n,ranges,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_range_excl_f + use :: ompi_mpifh_bindings, only : ompi_group_range_excl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/group_range_incl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_range_incl_f08.F90 index b267ed99426..c236800d13d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_range_incl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_range_incl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_range_incl_f08(group,n,ranges,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_range_incl_f + use :: ompi_mpifh_bindings, only : ompi_group_range_incl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/group_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_rank_f08.F90 index e269fef7ddb..097e730e39c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_rank_f08(group,rank,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_rank_f + use :: ompi_mpifh_bindings, only : ompi_group_rank_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(OUT) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/group_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_size_f08.F90 index d075743c22e..ff88547125b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_size_f08(group,size,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_size_f + use :: ompi_mpifh_bindings, only : ompi_group_size_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/group_translate_ranks_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_translate_ranks_f08.F90 index b87a1a70700..07a4a2e82e9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_translate_ranks_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_translate_ranks_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_translate_ranks_f08(group1,n,ranks1,group2,ranks2,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_translate_ranks_f + use :: ompi_mpifh_bindings, only : ompi_group_translate_ranks_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1, group2 INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/group_union_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/group_union_f08.F90 index 9a8692dce7a..b752fc5b45c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/group_union_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/group_union_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Group_union_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_union_f + use :: ompi_mpifh_bindings, only : ompi_group_union_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1, group2 TYPE(MPI_Group), INTENT(OUT) :: newgroup diff --git a/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 index 5ed85f2926b..a3de86565c2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallgather_f + use :: ompi_mpifh_bindings, only : ompi_iallgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 index f83974a5695..abc9dfa7b78 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallgatherv_f + use :: ompi_mpifh_bindings, only : ompi_iallgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 index c39150aeaed..eabdccce9ee 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallreduce_f + use :: ompi_mpifh_bindings, only : ompi_iallreduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 index 7cf319c58af..a9b97e37ad3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoall_f + use :: ompi_mpifh_bindings, only : ompi_ialltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 index 661cada65eb..9f72a821536 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoallv_f + use :: ompi_mpifh_bindings, only : ompi_ialltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 index f3ce01e643e..64f35b0699e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoallw_f + use :: ompi_mpifh_bindings, only : ompi_ialltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/ibarrier_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ibarrier_f08.F90 index 8d4be9e372b..a8034a36d40 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ibarrier_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ibarrier_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Ibarrier_f08(comm,request,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibarrier_f + use :: ompi_mpifh_bindings, only : ompi_ibarrier_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 index a715745ce26..ef098a630db 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibcast_f + use :: ompi_mpifh_bindings, only : ompi_ibcast_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90 index fa2f05fb58b..2700e677600 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ibsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ibsend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibsend_f + use :: ompi_mpifh_bindings, only : ompi_ibsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 index a3fc6c7112d..306afedb9ad 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iexscan_f + use :: ompi_mpifh_bindings, only : ompi_iexscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 index 6f989197f15..05659dedcf0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_igather_f + use :: ompi_mpifh_bindings, only : ompi_igather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 index 8af2fbfcd37..81914b8b985 100644 --- a/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_igatherv_f + use :: ompi_mpifh_bindings, only : ompi_igatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90 index 4ce58e4d6d7..17763bcc421 100644 --- a/ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/imrecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Imrecv_f08(buf,count,datatype,message,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Request - use :: mpi_f08, only : ompi_imrecv_f + use :: ompi_mpifh_bindings, only : ompi_imrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 index e1e7091d53c..a7879534d5a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ineighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_allgather_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 index 04d89959907..de8d30a04aa 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ineighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 index d19b153458e..4b1fc585f0f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ineighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 index fc7a2d53b5c..654bec79174 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallw_f08.F90 index c4e7a2050b8..750f0fad30d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Ineighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_ineighbor_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/info_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_create_f08.F90 index c6147a9de3f..0e17545988c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_create_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_create_f08(info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_create_f + use :: ompi_mpifh_bindings, only : ompi_info_create_f implicit none TYPE(MPI_Info), INTENT(OUT) :: info INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/info_delete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_delete_f08.F90 index 1714443c76c..5ed9a68531b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_delete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_delete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_delete_f08(info,key,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_delete_f + use :: ompi_mpifh_bindings, only : ompi_info_delete_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: key diff --git a/ompi/mpi/fortran/use-mpi-f08/info_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_dup_f08.F90 index bbf89bf87cb..b5ce0e0fa4d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_dup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_dup_f08(info,newinfo,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_dup_f + use :: ompi_mpifh_bindings, only : ompi_info_dup_f implicit none TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Info), INTENT(OUT) :: newinfo diff --git a/ompi/mpi/fortran/use-mpi-f08/info_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_free_f08.F90 index c34b59e329b..201dbd3f5de 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_free_f08(info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_free_f + use :: ompi_mpifh_bindings, only : ompi_info_free_f implicit none TYPE(MPI_Info), INTENT(INOUT) :: info INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/info_get_nkeys_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_get_nkeys_f08.F90 index 75a06d69d65..2368bba3279 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_get_nkeys_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_get_nkeys_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_get_nkeys_f08(info,nkeys,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_get_nkeys_f + use :: ompi_mpifh_bindings, only : ompi_info_get_nkeys_f implicit none TYPE(MPI_Info), INTENT(IN) :: info INTEGER, INTENT(OUT) :: nkeys diff --git a/ompi/mpi/fortran/use-mpi-f08/info_get_nthkey_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_get_nthkey_f08.F90 index 7996ae9805b..0941bb7350a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_get_nthkey_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_get_nthkey_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_get_nthkey_f08(info,n,key,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_get_nthkey_f + use :: ompi_mpifh_bindings, only : ompi_info_get_nthkey_f implicit none TYPE(MPI_Info), INTENT(IN) :: info INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/info_set_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/info_set_f08.F90 index b6c93252ca0..dc71caf3bbe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/info_set_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/info_set_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Info_set_f08(info,key,value,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_set_f + use :: ompi_mpifh_bindings, only : ompi_info_set_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: key, value diff --git a/ompi/mpi/fortran/use-mpi-f08/init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/init_f08.F90 index 1b1471d3f3f..5cdc84830ae 100644 --- a/ompi/mpi/fortran/use-mpi-f08/init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/init_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Init_f08(ierror) - use :: mpi_f08, only : ompi_init_f + use :: ompi_mpifh_bindings, only : ompi_init_f implicit none INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/init_thread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/init_thread_f08.F90 index 876d49b1dc6..c8e25c45dd9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/init_thread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/init_thread_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Init_thread_f08(required,provided,ierror) - use :: mpi_f08, only : ompi_init_thread_f + use :: ompi_mpifh_bindings, only : ompi_init_thread_f implicit none INTEGER, INTENT(IN) :: required INTEGER, INTENT(OUT) :: provided diff --git a/ompi/mpi/fortran/use-mpi-f08/intercomm_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/intercomm_create_f08.F90 index 19bf877c5c0..c5ebac96d32 100644 --- a/ompi/mpi/fortran/use-mpi-f08/intercomm_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/intercomm_create_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Intercomm_create_f08(local_comm,local_leader,peer_comm,& remote_leader,tag,newintercomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_intercomm_create_f + use :: ompi_mpifh_bindings, only : ompi_intercomm_create_f implicit none TYPE(MPI_Comm), INTENT(IN) :: local_comm, peer_comm INTEGER, INTENT(IN) :: local_leader, remote_leader, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90 index 9908444457b..db607bcbb72 100644 --- a/ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/irecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_irecv_f + use :: ompi_mpifh_bindings, only : ompi_irecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 index 55e62975657..fc71d76817c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 index 7a3c9b60401..009e3a005e3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_scatter_block_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_block_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 index 923429d3cd3..efd696fbd9c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_scatter_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90 index 464134b0252..e1b5f1ef35a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/irsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Irsend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_irsend_f + use :: ompi_mpifh_bindings, only : ompi_irsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 index f0b5c7b4ba5..2eccaa0596f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscan_f + use :: ompi_mpifh_bindings, only : ompi_iscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 index b53c2b90de3..10259580af5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscatter_f + use :: ompi_mpifh_bindings, only : ompi_iscatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 index a5d2df13b5c..b53b0896ee0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& recvcount,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscatterv_f + use :: ompi_mpifh_bindings, only : ompi_iscatterv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/isend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/isend_f08.F90 index 0d85d151676..cbf92d820a8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/isend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/isend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_isend_f + use :: ompi_mpifh_bindings, only : ompi_isend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/issend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/issend_f08.F90 index 675552fc4f7..3ff0cb895e4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/issend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/issend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Issend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_issend_f + use :: ompi_mpifh_bindings, only : ompi_issend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/lookup_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/lookup_name_f08.F90 index eb2a6e68ce0..21a9b484868 100644 --- a/ompi/mpi/fortran/use-mpi-f08/lookup_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/lookup_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Lookup_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_lookup_name_f + use :: ompi_mpifh_bindings, only : ompi_lookup_name_f implicit none CHARACTER(LEN=*), INTENT(IN) :: service_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/mprobe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/mprobe_f08.F90 index f1f9cb5de4e..c1a39889e40 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mprobe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mprobe_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2010-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Mprobe_f08(source,tag,comm,message,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Message, MPI_Status - use :: mpi_f08, only : ompi_mprobe_f + use :: ompi_mpifh_bindings, only : ompi_mprobe_f implicit none INTEGER, INTENT(IN) :: source, tag TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90 index e3c9fd0a8a1..157a52d36f7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/mrecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Mrecv_f08(buf,count,datatype,message,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Status - use :: mpi_f08, only : ompi_mrecv_f + use :: ompi_mpifh_bindings, only : ompi_mrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 index fbf0e50e00b..77ebbcb0490 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Neighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_allgather_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 index bf9b8130e4b..93facd3c66a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Neighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 index f91fb11deab..77aea7d9b4d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Neighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 index f97a2bbef7a..5836540f320 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Neighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_f08.F90 index 62f3db57cf7..292b846acdc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Neighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_neighbor_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/op_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/op_free_f08.F90 index c056ac69abf..d8e36c75b41 100644 --- a/ompi/mpi/fortran/use-mpi-f08/op_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/op_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Op_free_f08(op,ierror) use :: mpi_f08_types, only : MPI_Op - use :: mpi_f08, only : ompi_op_free_f + use :: ompi_mpifh_bindings, only : ompi_op_free_f implicit none TYPE(MPI_Op), INTENT(INOUT) :: op INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/open_port_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/open_port_f08.F90 index b07d968cebc..558f0842532 100644 --- a/ompi/mpi/fortran/use-mpi-f08/open_port_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/open_port_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Open_port_f08(info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_open_port_f + use :: ompi_mpifh_bindings, only : ompi_open_port_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(OUT) :: port_name diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 index d336f9ccbde..99c09a9a556 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Pack_external_f08(datarep,inbuf,incount,datatype,outbuf,outsize, & position,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_pack_external_f + use :: ompi_mpifh_bindings, only : ompi_pack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_external_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_external_size_f08.F90 index 2aa2475658d..3c7393f13e8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_external_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_external_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Pack_external_size_f08(datarep,incount,datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_pack_external_size_f + use :: ompi_mpifh_bindings, only : ompi_pack_external_size_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep INTEGER, INTENT(IN) :: incount diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 index 2cd89a98a17..02f5de25123 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Pack_f08(inbuf,incount,datatype,outbuf,outsize,position,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_pack_f + use :: ompi_mpifh_bindings, only : ompi_pack_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf INTEGER, INTENT(IN) :: incount, outsize diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_size_f08.F90 index da7691c5e31..502c7dfee86 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Pack_size_f08(incount,datatype,comm,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_pack_size_f + use :: ompi_mpifh_bindings, only : ompi_pack_size_f implicit none INTEGER, INTENT(IN) :: incount TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/pcontrol_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pcontrol_f08.F90 index b90a8a406e5..6f9f7287061 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pcontrol_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pcontrol_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Pcontrol_f08(level) - use :: mpi_f08, only : ompi_pcontrol_f + use :: ompi_mpifh_bindings, only : ompi_pcontrol_f implicit none INTEGER, INTENT(IN) :: level diff --git a/ompi/mpi/fortran/use-mpi-f08/probe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/probe_f08.F90 index 2753ee953e3..d4e8d180d43 100644 --- a/ompi/mpi/fortran/use-mpi-f08/probe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/probe_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Probe_f08(source,tag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_probe_f + use :: ompi_mpifh_bindings, only : ompi_probe_f implicit none INTEGER, INTENT(IN) :: source, tag TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pabort_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pabort_f08.F90 index fa79665ca5d..93725caef49 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pabort_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pabort_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Abort_f08(comm,errorcode,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_abort_f + use :: ompi_mpifh_bindings, only : ompi_abort_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 index 08e2d54a1e9..a8f1b366f27 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_Accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_class_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_class_f08.F90 index 10504aaf521..a5bb25bd57d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_class_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_class_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Add_error_class_f08(errorclass,ierror) - use :: mpi_f08, only : ompi_add_error_class_f + use :: ompi_mpifh_bindings, only : ompi_add_error_class_f implicit none INTEGER, INTENT(OUT) :: errorclass INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_code_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_code_f08.F90 index 15760498fcd..4667a587225 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_code_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_code_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Add_error_code_f08(errorclass,errorcode,ierror) - use :: mpi_f08, only : ompi_add_error_code_f + use :: ompi_mpifh_bindings, only : ompi_add_error_code_f implicit none INTEGER, INTENT(IN) :: errorclass INTEGER, INTENT(OUT) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_string_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_string_f08.F90 index 42b016d7cb8..05a3a0e2504 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_string_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/padd_error_string_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Add_error_string_f08(errorcode,string,ierror) - use :: mpi_f08, only : ompi_add_error_string_f + use :: ompi_mpifh_bindings, only : ompi_add_error_string_f implicit none integer, intent(in) :: errorcode character(len=*), intent(in) :: string diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 index d07e786568e..08d65da8c52 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2015 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" function PMPI_Aint_add_f08(base, diff) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_aint_add_f + use :: ompi_mpifh_bindings, only : ompi_aint_add_f implicit none INTEGER(MPI_ADDRESS_KIND) :: PMPI_Aint_add_f08 INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: base diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/paint_diff_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/paint_diff_f08.F90 index 0d46dee769b..c7673f5341e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/paint_diff_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/paint_diff_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2015 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" function PMPI_Aint_diff_f08(addr1, addr2) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_aint_diff_f + use :: ompi_mpifh_bindings, only : ompi_aint_diff_f implicit none INTEGER(MPI_ADDRESS_KIND) :: PMPI_Aint_diff_f08 INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr1 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 index afcc7c31187..710cfb44bee 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_allgather_f + use :: ompi_mpifh_bindings, only : ompi_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 index 7d9b99e3c47..319e9126143 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palloc_mem_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palloc_mem_f08.F90 index 0c4c14a1947..db79bb3d9b8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palloc_mem_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palloc_mem_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Alloc_mem_f08(size,info,baseptr,ierror) use, intrinsic :: ISO_C_BINDING, only : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_alloc_mem_f + use :: ompi_mpifh_bindings, only : ompi_alloc_mem_f implicit none INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 index 0965cf0abff..1ff22c8a3fe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Allreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_allreduce_f + use :: ompi_mpifh_bindings, only : ompi_allreduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 index 47f7fa7a88c..2b7a396a837 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 index c73982dcf97..ed6abb2d453 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 index ad94bb59252..afdd41808ea 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbarrier_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbarrier_f08.F90 index 42081233057..bb1d9c5b7fc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbarrier_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbarrier_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Barrier_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_barrier_f + use :: ompi_mpifh_bindings, only : ompi_barrier_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 index b7b2cf42154..2adc0721dcf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_bcast_f + use :: ompi_mpifh_bindings, only : ompi_bcast_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_f08.F90 index 84e4a515e4d..a443f9b9019 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Bsend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_bsend_f + use :: ompi_mpifh_bindings, only : ompi_bsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_init_f08.F90 index c2da8b41fff..488bce1bb7f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbsend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Bsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_bsend_init_f + use :: ompi_mpifh_bindings, only : ompi_bsend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 index 0c944547708..e6845486291 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Buffer_attach_f08(buffer,size,ierror) - use :: mpi_f08, only : ompi_buffer_attach_f + use :: ompi_mpifh_bindings, only : ompi_buffer_attach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_detach_f08.F90 index 28125b90341..e1f5cdbc44b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_detach_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Buffer_detach_f08(buffer_addr,size,ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR - use :: mpi_f08, only : ompi_buffer_detach_f + use :: ompi_mpifh_bindings, only : ompi_buffer_detach_f implicit none TYPE(C_PTR), INTENT(OUT) :: buffer_addr INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcancel_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcancel_f08.F90 index 8bfc3d82c19..99bfd9c86e8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcancel_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcancel_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Cancel_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_cancel_f + use :: ompi_mpifh_bindings, only : ompi_cancel_f implicit none TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_coords_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_coords_f08.F90 index 3d3070499fe..1bd33bd1497 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_coords_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_coords_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Cart_coords_f08(comm,rank,maxdims,coords,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_coords_f + use :: ompi_mpifh_bindings, only : ompi_cart_coords_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank, maxdims diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_rank_f08.F90 index 6cec48591a6..b0979cb0616 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Cart_rank_f08(comm,coords,rank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_rank_f + use :: ompi_mpifh_bindings, only : ompi_cart_rank_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: coords(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_shift_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_shift_f08.F90 index 1f2a9c3c6f7..092cc179d01 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcart_shift_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcart_shift_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Cart_shift_f08(comm,direction,disp,rank_source,rank_dest,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cart_shift_f + use :: ompi_mpifh_bindings, only : ompi_cart_shift_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: direction, disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcartdim_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcartdim_get_f08.F90 index 505453dd0a6..367325f48ed 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcartdim_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcartdim_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Cartdim_get_f08(comm,ndims,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_cartdim_get_f + use :: ompi_mpifh_bindings, only : ompi_cartdim_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: ndims diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pclose_port_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pclose_port_f08.F90 index 8ffdeb2a916..a04dfff10c4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pclose_port_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pclose_port_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Close_port_f08(port_name,ierror) - use :: mpi_f08, only : ompi_close_port_f + use :: ompi_mpifh_bindings, only : ompi_close_port_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_accept_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_accept_f08.F90 index 0bc3e68f7c2..8cc7c41f140 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_accept_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_accept_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_accept_f08(port_name,info,root,comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_accept_f + use :: ompi_mpifh_bindings, only : ompi_comm_accept_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_call_errhandler_f08.F90 index 42af5823434..c49d22cf713 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_call_errhandler_f08(comm,errorcode,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_call_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_compare_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_compare_f08.F90 index 4a2d030fe11..652630fe2bc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_compare_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_compare_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_compare_f08(comm1,comm2,result,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_compare_f + use :: ompi_mpifh_bindings, only : ompi_comm_compare_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm1 TYPE(MPI_Comm), INTENT(IN) :: comm2 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_connect_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_connect_f08.F90 index de45199cc92..10108547b43 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_connect_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_connect_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_connect_f08(port_name,info,root,comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_connect_f + use :: ompi_mpifh_bindings, only : ompi_comm_connect_f implicit none CHARACTER(LEN=*), INTENT(IN) :: port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_errhandler_f08.F90 index 86cf28dd486..4fb5620828c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_Comm_create_errhandler_f08(comm_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_errhandler_function - use :: mpi_f08, only : ompi_comm_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_errhandler_f implicit none PROCEDURE(MPI_Comm_errhandler_function) :: comm_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_f08.F90 index 08fd7614bfa..393ee0ffdf9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_create_f08(comm,group,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_create_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(IN) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_group_f08.F90 index 99492efabe0..db55ae35299 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_create_group_f08(comm,group,tag,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_create_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(IN) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 index d0642a214db..bd50696b61d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine PMPI_Comm_create_keyval_f08(comm_copy_attr_fn,comm_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Comm_delete_attr_function - use :: mpi_f08, only : ompi_comm_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_comm_create_keyval_f implicit none PROCEDURE(MPI_Comm_copy_attr_function) :: comm_copy_attr_fn PROCEDURE(MPI_Comm_delete_attr_function) :: comm_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_delete_attr_f08.F90 index 9549cee3b40..dab6e70e228 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_delete_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_delete_attr_f08(comm,comm_keyval,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_comm_delete_attr_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: comm_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_disconnect_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_disconnect_f08.F90 index 2adcb18bc21..05f8240f933 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_disconnect_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_disconnect_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_disconnect_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_disconnect_f + use :: ompi_mpifh_bindings, only : ompi_comm_disconnect_f implicit none TYPE(MPI_Comm), INTENT(INOUT) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_f08.F90 index a29b9c29030..c6bd8d52754 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_dup_f08(comm,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_dup_f + use :: ompi_mpifh_bindings, only : ompi_comm_dup_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: newcomm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_with_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_with_info_f08.F90 index a03d664210a..f511fe01487 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_with_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_dup_with_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_dup_with_info_f08(comm,info,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_dup_with_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_dup_with_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_f08.F90 index 9b5af7cf8b3..b5b79e2d4e2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_free_f08(comm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_free_f + use :: ompi_mpifh_bindings, only : ompi_comm_free_f implicit none TYPE(MPI_Comm), INTENT(INOUT) :: comm INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_keyval_f08.F90 index 580934bce45..510bd8d8f7f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_free_keyval_f08(comm_keyval,ierror) - use :: mpi_f08, only : ompi_comm_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_comm_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: comm_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_errhandler_f08.F90 index cc3dae70610..c76ed79b23e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_get_errhandler_f08(comm,errhandler,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Errhandler - use :: mpi_f08, only : ompi_comm_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_info_f08.F90 index 11e58ed802e..a9fc1733007 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_get_info_f08(comm,info_used,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_get_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(OUT) :: info_used diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_name_f08.F90 index a3b030b1f13..bd6417c2561 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_get_name_f08(comm,comm_name,resultlen,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_comm_get_name_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_name_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(OUT) :: comm_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_parent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_parent_f08.F90 index 78fc45b51ad..f30633b5b4d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_parent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_get_parent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_get_parent_f08(parent,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_get_parent_f + use :: ompi_mpifh_bindings, only : ompi_comm_get_parent_f implicit none TYPE(MPI_Comm), INTENT(OUT) :: parent INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_group_f08.F90 index 450c8638bf4..4905f9c8722 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_group_f08(comm,group,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_idup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_idup_f08.F90 index c5f2287c8b6..7c93d18d903 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_idup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_idup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_idup_f08(comm,newcomm,request,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_comm_idup_f + use :: ompi_mpifh_bindings, only : ompi_comm_idup_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: newcomm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_join_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_join_f08.F90 index 4a04e6b6219..c52bcff4517 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_join_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_join_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_join_f08(fd,intercomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_join_f + use :: ompi_mpifh_bindings, only : ompi_comm_join_f implicit none INTEGER, INTENT(IN) :: fd TYPE(MPI_Comm), INTENT(OUT) :: intercomm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_rank_f08.F90 index 2248eac3427..357a376ea33 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_rank_f08(comm,rank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_rank_f + use :: ompi_mpifh_bindings, only : ompi_comm_rank_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_group_f08.F90 index 807ea7fed49..965b0d8c840 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_remote_group_f08(comm,group,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Group - use :: mpi_f08, only : ompi_comm_remote_group_f + use :: ompi_mpifh_bindings, only : ompi_comm_remote_group_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_size_f08.F90 index f2d85fcf30d..b8046954882 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_remote_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_remote_size_f08(comm,size,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_remote_size_f + use :: ompi_mpifh_bindings, only : ompi_comm_remote_size_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_attr_f08.F90 index 996f512c175..1e46ebae7d1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_set_attr_f08(comm,comm_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_comm_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_attr_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: comm_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_errhandler_f08.F90 index ae4e51b7825..89404e7e68b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_set_errhandler_f08(comm,errhandler,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Errhandler - use :: mpi_f08, only : ompi_comm_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_errhandler_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_info_f08.F90 index 9ddc643ad4c..2ebfbcee4f4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_set_info_f08(comm,info,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_set_info_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_info_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_name_f08.F90 index 9a21745b878..f82d27128a5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_set_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_set_name_f08(comm,comm_name,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_set_name_f + use :: ompi_mpifh_bindings, only : ompi_comm_set_name_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(IN) :: comm_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_size_f08.F90 index 0cc37223347..896044707c8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_size_f08(comm,size,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_size_f + use :: ompi_mpifh_bindings, only : ompi_comm_size_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 index 89968377c1b..f87155ba1e6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & array_of_errcodes,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_spawn_f + use :: ompi_mpifh_bindings, only : ompi_comm_spawn_f implicit none CHARACTER(LEN=*), INTENT(IN) :: command, argv INTEGER, INTENT(IN) :: maxprocs, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 index 6f9e2acd7fc..dea1f169a67 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 @@ -4,7 +4,7 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -12,7 +12,7 @@ subroutine PMPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & array_of_maxprocs,array_of_info,root, & comm,intercomm,array_of_errcodes,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm - use :: mpi_f08, only : ompi_comm_spawn_multiple_f + use :: ompi_mpifh_bindings, only : ompi_comm_spawn_multiple_f implicit none INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: array_of_maxprocs(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_f08.F90 index e1c2a557f31..75419a6bca4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_split_f08(comm,color,key,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_comm_split_f + use :: ompi_mpifh_bindings, only : ompi_comm_split_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: color, key diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_type_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_type_f08.F90 index 6b65c1b5b5c..8d23fb0613c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_type_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_split_type_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_split_type_f08(comm,split_type,key,info,newcomm,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info - use :: mpi_f08, only : ompi_comm_split_type_f + use :: ompi_mpifh_bindings, only : ompi_comm_split_type_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: split_type diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 index c80bbb326b3..0232cecff07 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_Compare_and_swap_f08(origin_addr,compare_addr,result_addr,& datatype,target_rank,target_disp,win,& ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_compare_and_swap_f + use :: ompi_mpifh_bindings, only : ompi_compare_and_swap_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr, compare_addr OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pdims_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pdims_create_f08.F90 index 3ef9786489a..be34c017244 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pdims_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pdims_create_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Dims_create_f08(nnodes,ndims,dims,ierror) - use :: mpi_f08, only : ompi_dims_create_f + use :: ompi_mpifh_bindings, only : ompi_dims_create_f implicit none INTEGER, INTENT(IN) :: nnodes, ndims INTEGER, INTENT(INOUT) :: dims(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_neighbors_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_neighbors_f08.F90 index 808cefb8bae..fb63a8d976e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_neighbors_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pdist_graph_neighbors_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Dist_graph_neighbors_f08(comm,maxindegree,sources,sourceweights,& maxoutdegree,destinations,destweights,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_dist_graph_neighbors_f + use :: ompi_mpifh_bindings, only : ompi_dist_graph_neighbors_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: maxindegree, maxoutdegree diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/perrhandler_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/perrhandler_free_f08.F90 index 31d015f6d0b..09e6dfbc697 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/perrhandler_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/perrhandler_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Errhandler_free_f08(errhandler,ierror) use :: mpi_f08_types, only : MPI_Errhandler - use :: mpi_f08, only : ompi_errhandler_free_f + use :: ompi_mpifh_bindings, only : ompi_errhandler_free_f implicit none TYPE(MPI_Errhandler), INTENT(INOUT) :: errhandler INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/perror_class_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/perror_class_f08.F90 index 9bdcb537efd..203d1199290 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/perror_class_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/perror_class_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Error_class_f08(errorcode,errorclass,ierror) - use :: mpi_f08, only : ompi_error_class_f + use :: ompi_mpifh_bindings, only : ompi_error_class_f implicit none INTEGER, INTENT(IN) :: errorcode INTEGER, INTENT(OUT) :: errorclass diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/perror_string_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/perror_string_f08.F90 index b2a5177c45e..c78a5e557fc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/perror_string_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/perror_string_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Error_string_f08(errorcode,string,resultlen,ierror) - use :: mpi_f08, only : ompi_error_string_f + use :: ompi_mpifh_bindings, only : ompi_error_string_f implicit none integer, intent(in) :: errorcode character(len=*), intent(out) :: string diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 index 60f28860b85..0e863f9fe1e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Exscan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_exscan_f + use :: ompi_mpifh_bindings, only : ompi_exscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pf_sync_reg_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pf_sync_reg_f08.F90 index 902ef031837..f7f03e0fe37 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pf_sync_reg_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pf_sync_reg_f08.F90 @@ -4,12 +4,14 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. ! Copyright (c) 2012 University of Oregon. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_F_sync_reg_f08(buf) - use :: mpi_f08, only : ompi_f_sync_reg_f + use :: ompi_mpifh_bindings, only : ompi_f_sync_reg_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 index 5173d99afef..7e031aedeef 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Fetch_and_op_f08(origin_addr,result_addr,datatype,target_rank, & target_disp,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_fetch_and_op_f + use :: ompi_mpifh_bindings, only : ompi_fetch_and_op_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_call_errhandler_f08.F90 index 0f9d04f2578..ac45688ef23 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_call_errhandler_f08(fh,errorcode,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_call_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_close_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_close_f08.F90 index a5dfb200e62..290f687ee8a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_close_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_close_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_close_f08(fh,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_close_f + use :: ompi_mpifh_bindings, only : ompi_file_close_f implicit none TYPE(MPI_File), INTENT(INOUT) :: fh INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_create_errhandler_f08.F90 index e521185dc07..8daba5d8d39 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_File_create_errhandler_f08(file_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_File_errhandler_function - use :: mpi_f08, only : ompi_file_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_create_errhandler_f implicit none PROCEDURE(MPI_File_errhandler_function) :: file_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_delete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_delete_f08.F90 index b0b1f8e67df..031e545bf02 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_delete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_delete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_delete_f08(filename,info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_file_delete_f + use :: ompi_mpifh_bindings, only : ompi_file_delete_f implicit none CHARACTER(LEN=*), INTENT(IN) :: filename TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_amode_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_amode_f08.F90 index 387066e0739..fa04303627e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_amode_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_amode_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_amode_f08(fh,amode,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_get_amode_f + use :: ompi_mpifh_bindings, only : ompi_file_get_amode_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, INTENT(OUT) :: amode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_byte_offset_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_byte_offset_f08.F90 index bf971545356..fa4d6efd142 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_byte_offset_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_byte_offset_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_byte_offset_f08(fh,offset,disp,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_byte_offset_f + use :: ompi_mpifh_bindings, only : ompi_file_get_byte_offset_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_errhandler_f08.F90 index feaccf12067..6efdb7d12f5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_errhandler_f08(file,errhandler,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Errhandler - use :: mpi_f08, only : ompi_file_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_get_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: file TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_group_f08.F90 index deaf8e54940..a6e885915c8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_group_f08(fh,group,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Group - use :: mpi_f08, only : ompi_file_get_group_f + use :: ompi_mpifh_bindings, only : ompi_file_get_group_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_info_f08.F90 index d22e2eb6d2f..8bd7be4a6f7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_info_f08(fh,info_used,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Info - use :: mpi_f08, only : ompi_file_get_info_f + use :: ompi_mpifh_bindings, only : ompi_file_get_info_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Info), INTENT(OUT) :: info_used diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_f08.F90 index e4f45f56c51..1ec18cedf55 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_position_f08(fh,offset,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_position_f + use :: ompi_mpifh_bindings, only : ompi_file_get_position_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_shared_f08.F90 index a985fc96294..ec59baccbce 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_position_shared_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_position_shared_f08(fh,offset,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_position_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_get_position_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_size_f08.F90 index 8b4eb2b721c..f76664ae737 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_size_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_size_f + use :: ompi_mpifh_bindings, only : ompi_file_get_size_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_type_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_type_extent_f08.F90 index d2eca05a158..055921897a9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_type_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_type_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_type_extent_f08(fh,datatype,extent,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_file_get_type_extent_f + use :: ompi_mpifh_bindings, only : ompi_file_get_type_extent_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_view_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_view_f08.F90 index 8256db56a06..037de339c7f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_view_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_get_view_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_get_view_f08(fh,disp,etype,filetype,datarep,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_get_view_f + use :: ompi_mpifh_bindings, only : ompi_file_get_view_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(OUT) :: disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_all_f08.F90 index 3d935f98ae4..ba12743a939 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_all_f08.F90 @@ -4,13 +4,15 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iread_all_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_all_f08.F90 index 1a627fd7399..276e9175917 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_all_f08.F90 @@ -4,13 +4,15 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iread_at_all_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iread_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_f08.F90 index 8cbbf9f7a98..62c2aedf2c9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iread_at_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iread_at_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_f08.F90 index d216542febf..173361f0839 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iread_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_shared_f08.F90 index 034c381fc0b..a6e17c928d4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iread_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iread_shared_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iread_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_iread_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_all_f08.F90 index f176b17d9e2..59124a90891 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_all_f08.F90 @@ -4,13 +4,15 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iwrite_all_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_all_f08.F90 index ff5116f5d85..ef557c46b89 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_all_f08.F90 @@ -4,13 +4,15 @@ ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. ! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iwrite_at_all_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iwrite_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_f08.F90 index bf7812d6a66..67b67fe1dc6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iwrite_at_f08(fh,offset,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_iwrite_at_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_f08.F90 index 8e96a966794..e128db458dc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iwrite_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_shared_f08.F90 index c07659ead7a..77d03ac5323 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_iwrite_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_iwrite_shared_f08(fh,buf,count,datatype,request,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Request - use :: mpi_f08, only : ompi_file_iwrite_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_iwrite_shared_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf TYPE(MPI_File), INTENT(IN) :: fh diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_open_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_open_f08.F90 index 2977abfe9cc..1325d00e7aa 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_open_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_open_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_open_f08(comm,filename,amode,info,fh,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Info, MPI_File - use :: mpi_f08, only : ompi_file_open_f + use :: ompi_mpifh_bindings, only : ompi_file_open_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm CHARACTER(LEN=*), INTENT(IN) :: filename diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_preallocate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_preallocate_f08.F90 index c44de460d61..a6e6d4bee96 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_preallocate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_preallocate_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_preallocate_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_preallocate_f + use :: ompi_mpifh_bindings, only : ompi_file_preallocate_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_begin_f08.F90 index eceadf26d2b..4b7998597a0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_all_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_read_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_end_f08.F90 index b9cfdd47013..6cebaee1386 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_f08.F90 index caf3e78661f..11c6ec3ff42 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_all_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_all_f + use :: ompi_mpifh_bindings, only : ompi_file_read_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_begin_f08.F90 index 850315dfae7..03548e738a7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_at_all_begin_f08(fh,offset,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_end_f08.F90 index ee6631f8e23..2454a723f2f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_at_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_at_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_f08.F90 index 237dfef0ad8..308c0288a6f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_at_all_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_f08.F90 index 55d265752b6..369749cc885 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_at_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_read_at_f + use :: ompi_mpifh_bindings, only : ompi_file_read_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_f08.F90 index 2b405dbee8f..8f5c1a32fcb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_f + use :: ompi_mpifh_bindings, only : ompi_file_read_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_begin_f08.F90 index 9c714f4d168..f36ecd396d3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_ordered_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_read_ordered_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_end_f08.F90 index b7e156d5f7a..19ee13308ee 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_ordered_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_read_ordered_end_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_f08.F90 index 2073c503a8b..07f144d6210 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_ordered_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_ordered_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_ordered_f + use :: ompi_mpifh_bindings, only : ompi_file_read_ordered_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_shared_f08.F90 index 8b7a3905ca8..d198dfe7cf8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_read_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_read_shared_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_read_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_read_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_f08.F90 index 73016436b86..01f1697381c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_seek_f08(fh,offset,whence,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_seek_f + use :: ompi_mpifh_bindings, only : ompi_file_seek_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_shared_f08.F90 index fd530458923..3d0fee10c1d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_seek_shared_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_seek_shared_f08(fh,offset,whence,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_seek_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_seek_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_errhandler_f08.F90 index 4f168ce620c..5c2b4892b8a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_set_errhandler_f08(file,errhandler,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Errhandler - use :: mpi_f08, only : ompi_file_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_file_set_errhandler_f implicit none TYPE(MPI_File), INTENT(IN) :: file TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_info_f08.F90 index c536bca9d93..17f9222fe2d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_info_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_set_info_f08(fh,info,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Info - use :: mpi_f08, only : ompi_file_set_info_f + use :: ompi_mpifh_bindings, only : ompi_file_set_info_f implicit none TYPE(MPI_File), INTENT(IN) :: fh TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_size_f08.F90 index 93e9f910a6a..bc0ac14527a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_set_size_f08(fh,size,ierror) use :: mpi_f08_types, only : MPI_File, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_set_size_f + use :: ompi_mpifh_bindings, only : ompi_file_set_size_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_view_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_view_f08.F90 index df26ac07eee..3be7bcf327c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_view_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_set_view_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_set_view_f08(fh,disp,etype,filetype,datarep,info,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Info, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_set_view_f + use :: ompi_mpifh_bindings, only : ompi_file_set_view_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_sync_f08.F90 index 916ee1c9438..d098f572e3a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_sync_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_File_sync_f08(fh,ierror) use :: mpi_f08_types, only : MPI_File - use :: mpi_f08, only : ompi_file_sync_f + use :: ompi_mpifh_bindings, only : ompi_file_sync_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_begin_f08.F90 index d144ff1f0ee..07621641398 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_all_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_write_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_end_f08.F90 index 1a2b06187d4..c27b759bf27 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_f08.F90 index 43421d01226..c3b270de144 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_all_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_all_f + use :: ompi_mpifh_bindings, only : ompi_file_write_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_begin_f08.F90 index e8bf0f3dfc7..64438ae6968 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_at_all_begin_f08(fh,offset,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_all_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_end_f08.F90 index f9efd90068a..8db21a6b10e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_at_all_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_at_all_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_f08.F90 index c5d278a67be..0ea870a8c87 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_all_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_at_all_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_all_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_all_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_f08.F90 index f65976b1a67..b89101e3f01 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_at_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_at_f08(fh,offset,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status, MPI_OFFSET_KIND - use :: mpi_f08, only : ompi_file_write_at_f + use :: ompi_mpifh_bindings, only : ompi_file_write_at_f implicit none TYPE(MPI_File), INTENT(IN) :: fh INTEGER(MPI_OFFSET_KIND), INTENT(IN) :: offset diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_f08.F90 index e3a765ee0c7..64d62bd2bb0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_f + use :: ompi_mpifh_bindings, only : ompi_file_write_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_begin_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_begin_f08.F90 index 1d170340095..be44d72e993 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_begin_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_begin_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_ordered_begin_f08(fh,buf,count,datatype,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype - use :: mpi_f08, only : ompi_file_write_ordered_begin_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_begin_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_end_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_end_f08.F90 index a48d3be8863..41f5a7672fb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_end_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_end_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_ordered_end_f08(fh,buf,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Status - use :: mpi_f08, only : ompi_file_write_ordered_end_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_end_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_f08.F90 index 030cb76524a..7fe51236db2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_ordered_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_ordered_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_ordered_f + use :: ompi_mpifh_bindings, only : ompi_file_write_ordered_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_shared_f08.F90 index b3fdc02198c..f3bf683e3e7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfile_write_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_File_write_shared_f08(fh,buf,count,datatype,status,ierror) use :: mpi_f08_types, only : MPI_File, MPI_Datatype, MPI_Status - use :: mpi_f08, only : ompi_file_write_shared_f + use :: ompi_mpifh_bindings, only : ompi_file_write_shared_f implicit none TYPE(MPI_File), INTENT(IN) :: fh OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfinalize_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfinalize_f08.F90 index 8a708591460..782609b5ad8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfinalize_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfinalize_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Finalize_f08(ierror) - use :: mpi_f08, only : ompi_finalize_f + use :: ompi_mpifh_bindings, only : ompi_finalize_f implicit none INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 index 0a542b9321b..c99160b0acc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 @@ -3,14 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Free_mem_f08(base,ierror) - use :: mpi_f08, only : ompi_free_mem_f + use :: ompi_mpifh_bindings, only : ompi_free_mem_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE,INTENT(IN) :: base INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 index 7a4b07ac28f..3f5ff4f0cc2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Gather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_gather_f + use :: ompi_mpifh_bindings, only : ompi_gather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 index ba20681f29a..6c7605a1894 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Gatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_gatherv_f + use :: ompi_mpifh_bindings, only : ompi_gatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 index 929fd437568..66b223c257b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +14,7 @@ subroutine PMPI_Get_accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_get_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_address_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_address_f08.F90 index c01821806f1..eb2283a801e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_address_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_address_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Get_address_f08(location,address,ierror) use :: mpi_f08_types, only : MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_address_f + use :: ompi_mpifh_bindings, only : ompi_get_address_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: location INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: address diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_count_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_count_f08.F90 index 56ca18568ca..0378b64c16f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_count_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_count_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_count_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_get_count_f + use :: ompi_mpifh_bindings, only : ompi_get_count_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_f08.F90 index 747d4c3bb56..ef2c0dbc241 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_elements_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_get_elements_f + use :: ompi_mpifh_bindings, only : ompi_get_elements_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_x_f08.F90 index eb1ba97edfe..aa323c25568 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_elements_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_elements_x_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_get_elements_x_f + use :: ompi_mpifh_bindings, only : ompi_get_elements_x_f implicit none TYPE(MPI_Status), INTENT(IN) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 index d57da0b9e83..9b77132f189 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Get_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_get_f + use :: ompi_mpifh_bindings, only : ompi_get_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_library_version_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_library_version_f08.F90 index 9ed2b1650a1..fb7d8536db4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_library_version_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_library_version_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2010-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_library_version_f08(version,resultlen,ierror) use :: mpi_f08_types, only : MPI_MAX_LIBRARY_VERSION_STRING - use :: mpi_f08, only : ompi_get_library_version_f + use :: ompi_mpifh_bindings, only : ompi_get_library_version_f implicit none character(len=MPI_MAX_LIBRARY_VERSION_STRING), intent(out) :: version integer, intent(out) :: resultlen diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 index 13c951fb3ab..f05919d3f1c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_processor_name_f08(name,resultlen,ierror) - use :: mpi_f08, only : ompi_get_processor_name_f + use :: ompi_mpifh_bindings, only : ompi_get_processor_name_f implicit none character(len=*), intent(out) :: name integer, intent(out) :: resultlen diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_version_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_version_f08.F90 index 28da38994c7..196ffcc0799 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_version_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_version_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_version_f08(version,subversion,ierror) - use :: mpi_f08, only : ompi_get_version_f + use :: ompi_mpifh_bindings, only : ompi_get_version_f implicit none INTEGER, INTENT(OUT) :: version, subversion INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_get_f08.F90 index ce3d61f11f7..d8adffd8649 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Graph_get_f08(comm,maxindex,maxedges,index,edges,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_get_f + use :: ompi_mpifh_bindings, only : ompi_graph_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: maxindex, maxedges diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_map_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_map_f08.F90 index a8faf9b9f46..6b617977b1a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_map_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_map_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Graph_map_f08(comm,nnodes,index,edges,newrank,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_map_f + use :: ompi_mpifh_bindings, only : ompi_graph_map_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: nnodes diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_count_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_count_f08.F90 index 4832c4d79ee..677de5fd10b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_count_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_count_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Graph_neighbors_count_f08(comm,rank,nneighbors,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_neighbors_count_f + use :: ompi_mpifh_bindings, only : ompi_graph_neighbors_count_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_f08.F90 index 49910e0d777..df483ca9dc7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgraph_neighbors_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Graph_neighbors_f08(comm,rank,maxneighbors,neighbors,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graph_neighbors_f + use :: ompi_mpifh_bindings, only : ompi_graph_neighbors_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(IN) :: rank, maxneighbors diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgraphdims_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgraphdims_get_f08.F90 index 76f6d75c796..38e7f20f9e7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgraphdims_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgraphdims_get_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Graphdims_get_f08(comm,nnodes,nedges,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_graphdims_get_f + use :: ompi_mpifh_bindings, only : ompi_graphdims_get_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: nnodes, nedges diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_complete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_complete_f08.F90 index 5bb23de04bb..40ed64842da 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_complete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_complete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Grequest_complete_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_grequest_complete_f + use :: ompi_mpifh_bindings, only : ompi_grequest_complete_f implicit none TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_start_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_start_f08.F90 index bc488374803..7bb64b34f1f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_start_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgrequest_start_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +16,7 @@ subroutine PMPI_Grequest_start_f08(query_fn,free_fn,cancel_fn,& use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_query_function use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_free_function use :: mpi_f08_interfaces_callbacks, only : MPI_Grequest_cancel_function - use :: mpi_f08, only : ompi_grequest_start_f + use :: ompi_mpifh_bindings, only : ompi_grequest_start_f implicit none PROCEDURE(MPI_Grequest_query_function) :: query_fn PROCEDURE(MPI_Grequest_free_function) :: free_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_compare_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_compare_f08.F90 index e4ee8475715..4354e141540 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_compare_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_compare_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_compare_f08(group1,group2,result,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_compare_f + use :: ompi_mpifh_bindings, only : ompi_group_compare_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_difference_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_difference_f08.F90 index 433c4d75be6..7f3ebe8f60a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_difference_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_difference_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_difference_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_difference_f + use :: ompi_mpifh_bindings, only : ompi_group_difference_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_excl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_excl_f08.F90 index 0715063210b..8481e4d9a08 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_excl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_excl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_excl_f08(group,n,ranks,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_excl_f + use :: ompi_mpifh_bindings, only : ompi_group_excl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_free_f08.F90 index 22abe98c512..b7591ea596f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_free_f08(group,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_free_f + use :: ompi_mpifh_bindings, only : ompi_group_free_f implicit none TYPE(MPI_Group), INTENT(INOUT) :: group INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_incl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_incl_f08.F90 index 85b2c911891..21c20b845ef 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_incl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_incl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_incl_f08(group,n,ranks,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_incl_f + use :: ompi_mpifh_bindings, only : ompi_group_incl_f implicit none INTEGER, INTENT(IN) :: n INTEGER, INTENT(IN) :: ranks(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_intersection_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_intersection_f08.F90 index ecb4da0160e..2e5f5962bf5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_intersection_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_intersection_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_intersection_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_intersection_f + use :: ompi_mpifh_bindings, only : ompi_group_intersection_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1 TYPE(MPI_Group), INTENT(IN) :: group2 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_excl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_excl_f08.F90 index 4c6205738f1..ab305400163 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_excl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_excl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_range_excl_f08(group,n,ranges,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_range_excl_f + use :: ompi_mpifh_bindings, only : ompi_group_range_excl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_incl_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_incl_f08.F90 index 8b5276da7fd..b46e0864ba0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_incl_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_range_incl_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_range_incl_f08(group,n,ranges,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_range_incl_f + use :: ompi_mpifh_bindings, only : ompi_group_range_incl_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_rank_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_rank_f08.F90 index 94d6cd357f5..cd7e16157ca 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_rank_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_rank_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_rank_f08(group,rank,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_rank_f + use :: ompi_mpifh_bindings, only : ompi_group_rank_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(OUT) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_size_f08.F90 index 20b428f199b..50bb58c8360 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_size_f08(group,size,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_size_f + use :: ompi_mpifh_bindings, only : ompi_group_size_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_translate_ranks_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_translate_ranks_f08.F90 index c776a3223aa..739bdce56db 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_translate_ranks_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_translate_ranks_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_translate_ranks_f08(group1,n,ranks1,group2,ranks2,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_translate_ranks_f + use :: ompi_mpifh_bindings, only : ompi_group_translate_ranks_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1, group2 INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_union_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_union_f08.F90 index d771ae9ea1a..a11070156b2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_union_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgroup_union_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Group_union_f08(group1,group2,newgroup,ierror) use :: mpi_f08_types, only : MPI_Group - use :: mpi_f08, only : ompi_group_union_f + use :: ompi_mpifh_bindings, only : ompi_group_union_f implicit none TYPE(MPI_Group), INTENT(IN) :: group1, group2 TYPE(MPI_Group), INTENT(OUT) :: newgroup diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 index a77672b5855..62367cb1c38 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallgather_f + use :: ompi_mpifh_bindings, only : ompi_iallgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 index edf2f1ae929..83946b5e35a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallgatherv_f + use :: ompi_mpifh_bindings, only : ompi_iallgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 index cf06d675890..2a350b8de7c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iallreduce_f + use :: ompi_mpifh_bindings, only : ompi_iallreduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 index 85de5aad449..78247b4a176 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoall_f + use :: ompi_mpifh_bindings, only : ompi_ialltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 index ae1004189af..71763ffe066 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoallv_f + use :: ompi_mpifh_bindings, only : ompi_ialltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 index aee9d842b42..f49faf9ce55 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ialltoallw_f + use :: ompi_mpifh_bindings, only : ompi_ialltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pibarrier_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pibarrier_f08.F90 index 3a0d99f94fc..7d2d9d16111 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pibarrier_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pibarrier_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Ibarrier_f08(comm,request,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibarrier_f + use :: ompi_mpifh_bindings, only : ompi_ibarrier_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 index 867a43bda0a..859864b79c7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibcast_f + use :: ompi_mpifh_bindings, only : ompi_ibcast_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pibsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pibsend_f08.F90 index 27641b63295..06bf415e9cc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pibsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pibsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ibsend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ibsend_f + use :: ompi_mpifh_bindings, only : ompi_ibsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 index 99467085877..4fa05899076 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iexscan_f + use :: ompi_mpifh_bindings, only : ompi_iexscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 index 8c447ddc20d..15cf8894025 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_igather_f + use :: ompi_mpifh_bindings, only : ompi_igather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 index cde575f979b..4f5230ed383 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_igatherv_f + use :: ompi_mpifh_bindings, only : ompi_igatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pimrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pimrecv_f08.F90 index 81614775894..12e197c08ce 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pimrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pimrecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Imrecv_f08(buf,count,datatype,message,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Request - use :: mpi_f08, only : ompi_imrecv_f + use :: ompi_mpifh_bindings, only : ompi_imrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 index f14fed6aa81..d77c9e49423 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ineighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_allgather_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 index e0a59aa5d90..1968c2272eb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ineighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 index 2241001d4e6..63519f24bc3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ineighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 index a2be1d64479..5efdd0089d2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ineighbor_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 index 8f33c1a60ff..2b5cd0a5cde 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Ineighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_ineighbor_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_create_f08.F90 index bca54c96fb1..91d826d557c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_create_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_create_f08(info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_create_f + use :: ompi_mpifh_bindings, only : ompi_info_create_f implicit none TYPE(MPI_Info), INTENT(OUT) :: info INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_delete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_delete_f08.F90 index e6d783498d8..ab92a99f366 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_delete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_delete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_delete_f08(info,key,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_delete_f + use :: ompi_mpifh_bindings, only : ompi_info_delete_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: key diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_dup_f08.F90 index 4ec07a1e84d..7d542dc02cf 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_dup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_dup_f08(info,newinfo,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_dup_f + use :: ompi_mpifh_bindings, only : ompi_info_dup_f implicit none TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Info), INTENT(OUT) :: newinfo diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_free_f08.F90 index 411c299700f..cccbf57f26b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_free_f08(info,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_free_f + use :: ompi_mpifh_bindings, only : ompi_info_free_f implicit none TYPE(MPI_Info), INTENT(INOUT) :: info INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nkeys_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nkeys_f08.F90 index 91f819457e3..e5db42815ca 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nkeys_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nkeys_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_get_nkeys_f08(info,nkeys,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_get_nkeys_f + use :: ompi_mpifh_bindings, only : ompi_info_get_nkeys_f implicit none TYPE(MPI_Info), INTENT(IN) :: info INTEGER, INTENT(OUT) :: nkeys diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nthkey_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nthkey_f08.F90 index 22c75d1a271..ec10bf4298d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nthkey_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_nthkey_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_get_nthkey_f08(info,n,key,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_get_nthkey_f + use :: ompi_mpifh_bindings, only : ompi_info_get_nthkey_f implicit none TYPE(MPI_Info), INTENT(IN) :: info INTEGER, INTENT(IN) :: n diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_set_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_set_f08.F90 index f168b4a68ab..c9a67b4b5fe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_set_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_set_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_set_f08(info,key,value,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_info_set_f + use :: ompi_mpifh_bindings, only : ompi_info_set_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: key, value diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinit_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinit_f08.F90 index 875f6462a39..54b2ba7737f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinit_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinit_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Init_f08(ierror) - use :: mpi_f08, only : ompi_init_f + use :: ompi_mpifh_bindings, only : ompi_init_f implicit none INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinit_thread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinit_thread_f08.F90 index 2e2bf5beb8f..628bc8e9713 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinit_thread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinit_thread_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Init_thread_f08(required,provided,ierror) - use :: mpi_f08, only : ompi_init_thread_f + use :: ompi_mpifh_bindings, only : ompi_init_thread_f implicit none INTEGER, INTENT(IN) :: required INTEGER, INTENT(OUT) :: provided diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pintercomm_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pintercomm_create_f08.F90 index 4414bc145ad..c6647c605f1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pintercomm_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pintercomm_create_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Intercomm_create_f08(local_comm,local_leader,peer_comm,& remote_leader,tag,newintercomm,ierror) use :: mpi_f08_types, only : MPI_Comm - use :: mpi_f08, only : ompi_intercomm_create_f + use :: ompi_mpifh_bindings, only : ompi_intercomm_create_f implicit none TYPE(MPI_Comm), INTENT(IN) :: local_comm, peer_comm INTEGER, INTENT(IN) :: local_leader, remote_leader, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90 index 6ab6c9f5a85..1fc53d7853b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pirecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Irecv_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_irecv_f + use :: ompi_mpifh_bindings, only : ompi_irecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 index 90addb4c1de..9db0bbd2289 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 index 5cec9d887fb..6c990007e32 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_scatter_block_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_block_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 index f726d6bbfba..c7fd5b6cf1b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ireduce_scatter_f + use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pirsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pirsend_f08.F90 index 3b60db7a264..fe449809dfb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pirsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pirsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Irsend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_irsend_f + use :: ompi_mpifh_bindings, only : ompi_irsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 index 24f72c2e4d7..f4b422a205d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscan_f + use :: ompi_mpifh_bindings, only : ompi_iscan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 index 5c29b6bc132..5755d0cfeac 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscatter_f + use :: ompi_mpifh_bindings, only : ompi_iscatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 index 513e445e7ca..853c489b1dc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& recvcount,recvtype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_iscatterv_f + use :: ompi_mpifh_bindings, only : ompi_iscatterv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pisend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pisend_f08.F90 index 3f5e864abe0..0d9cd32ea6d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pisend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pisend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Isend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_isend_f + use :: ompi_mpifh_bindings, only : ompi_isend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) OMPI_ASYNCHRONOUS :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pissend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pissend_f08.F90 index dbe252e9bac..77a03003f78 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pissend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pissend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Issend_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_issend_f + use :: ompi_mpifh_bindings, only : ompi_issend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/plookup_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/plookup_name_f08.F90 index 9096820a1e8..c121b0f5d95 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/plookup_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/plookup_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Lookup_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_lookup_name_f + use :: ompi_mpifh_bindings, only : ompi_lookup_name_f implicit none CHARACTER(LEN=*), INTENT(IN) :: service_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pmprobe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pmprobe_f08.F90 index e87680c799e..23f9c74fd95 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pmprobe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pmprobe_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2010-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Mprobe_f08(source,tag,comm,message,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Message, MPI_Status - use :: mpi_f08, only : ompi_mprobe_f + use :: ompi_mpifh_bindings, only : ompi_mprobe_f implicit none INTEGER, INTENT(IN) :: source, tag TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pmrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pmrecv_f08.F90 index a38704af0d3..35d085520b3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pmrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pmrecv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Mrecv_f08(buf,count,datatype,message,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Message, MPI_Status - use :: mpi_f08, only : ompi_mrecv_f + use :: ompi_mpifh_bindings, only : ompi_mrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 index b983dbc1694..10f7d3ab2a4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Neighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_allgather_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_allgather_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 index 601a6e4b381..48d25a43d39 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Neighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& displs,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_allgatherv_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_allgatherv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 index 90e3872b0da..844173d121c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Neighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_alltoall_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoall_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 index ff66ea28e96..58a1a1cff15 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Neighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& recvcounts,rdispls,recvtype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_neighbor_alltoallv_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 index e1a26ad871b..7d5535afda8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Neighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_neighbor_alltoallw_f + use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallw_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pop_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pop_free_f08.F90 index f1446d73a27..f190ae70076 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pop_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pop_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Op_free_f08(op,ierror) use :: mpi_f08_types, only : MPI_Op - use :: mpi_f08, only : ompi_op_free_f + use :: ompi_mpifh_bindings, only : ompi_op_free_f implicit none TYPE(MPI_Op), INTENT(INOUT) :: op INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/popen_port_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/popen_port_f08.F90 index 76d570a2968..399e4991a41 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/popen_port_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/popen_port_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Open_port_f08(info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_open_port_f + use :: ompi_mpifh_bindings, only : ompi_open_port_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(OUT) :: port_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 index 960ab782d77..a5bf98e41f1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Pack_external_f08(datarep,inbuf,incount,datatype,outbuf,outsize, & position,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_pack_external_f + use :: ompi_mpifh_bindings, only : ompi_pack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_size_f08.F90 index 013999e0a1f..a6b4e2e7b6d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Pack_external_size_f08(datarep,incount,datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_pack_external_size_f + use :: ompi_mpifh_bindings, only : ompi_pack_external_size_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep INTEGER, INTENT(IN) :: incount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 index 92f58f25568..7860b1cce98 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Pack_f08(inbuf,incount,datatype,outbuf,outsize,position,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_pack_f + use :: ompi_mpifh_bindings, only : ompi_pack_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf INTEGER, INTENT(IN) :: incount, outsize diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_size_f08.F90 index 5f13e7908e4..eb67787774f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Pack_size_f08(incount,datatype,comm,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_pack_size_f + use :: ompi_mpifh_bindings, only : ompi_pack_size_f implicit none INTEGER, INTENT(IN) :: incount TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppcontrol_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppcontrol_f08.F90 index 23cbabf35b5..3322dae9a61 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppcontrol_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppcontrol_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Pcontrol_f08(level) - use :: mpi_f08, only : ompi_pcontrol_f + use :: ompi_mpifh_bindings, only : ompi_pcontrol_f implicit none INTEGER, INTENT(IN) :: level diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pprobe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pprobe_f08.F90 index 6a3f5b64ce4..ef2697c242d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pprobe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pprobe_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Probe_f08(source,tag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_probe_f + use :: ompi_mpifh_bindings, only : ompi_probe_f implicit none INTEGER, INTENT(IN) :: source, tag TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppublish_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppublish_name_f08.F90 index cb122fff1b0..714b0597976 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppublish_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppublish_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Publish_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_publish_name_f + use :: ompi_mpifh_bindings, only : ompi_publish_name_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: service_name, port_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 index 8cdbf00ab74..ced762447f6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Put_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_put_f + use :: ompi_mpifh_bindings, only : ompi_put_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pquery_thread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pquery_thread_f08.F90 index a614b8e3d04..a74fea3f95e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pquery_thread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pquery_thread_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Query_thread_f08(provided,ierror) - use :: mpi_f08, only : ompi_query_thread_f + use :: ompi_mpifh_bindings, only : ompi_query_thread_f implicit none INTEGER, INTENT(OUT) :: provided INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 index 6c54f8b19a6..cea5d2f2dc1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_Raccumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,request, ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_raccumulate_f + use :: ompi_mpifh_bindings, only : ompi_raccumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/precv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/precv_f08.F90 index 51b9f39f40f..0baccbcf63d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/precv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/precv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_recv_f + use :: ompi_mpifh_bindings, only : ompi_recv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 index c88b56a2bc6..ac3a8da1882 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_recv_init_f + use :: ompi_mpifh_bindings, only : ompi_recv_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 index 512d71e34bc..c97fa6aa96f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Reduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_f + use :: ompi_mpifh_bindings, only : ompi_reduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 index 00cdba88592..2a0cc235076 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Reduce_local_f08(inbuf,inoutbuf,count,datatype,op,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op - use :: mpi_f08, only : ompi_reduce_local_f + use :: ompi_mpifh_bindings, only : ompi_reduce_local_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 index 0204e6e2edc..d4c52a6355a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Reduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_scatter_block_f + use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_block_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 index 63fcf0b8a25..5f3d1fdfc1b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_scatter_f + use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pregister_datarep_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pregister_datarep_f08.F90 index e64f0511dee..8d635342c75 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pregister_datarep_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pregister_datarep_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine PMPI_Register_datarep_f08(datarep,read_conversion_fn,write_conversion use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Datarep_conversion_function use :: mpi_f08_interfaces_callbacks, only : MPI_Datarep_extent_function - use :: mpi_f08, only : ompi_register_datarep_f + use :: ompi_mpifh_bindings, only : ompi_register_datarep_f implicit none PROCEDURE(MPI_Datarep_conversion_function) :: read_conversion_fn PROCEDURE(MPI_Datarep_conversion_function) :: write_conversion_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prequest_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prequest_free_f08.F90 index 1cbb37a011b..24a80ce9ce6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prequest_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prequest_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Request_free_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_request_free_f + use :: ompi_mpifh_bindings, only : ompi_request_free_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 index 1a40ebc470e..90eb3ffd8c6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +14,7 @@ subroutine PMPI_Rget_accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rget_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_rget_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 index 89f76323eca..24982b43885 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Rget_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rget_f + use :: ompi_mpifh_bindings, only : ompi_rget_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 index d95742816cc..bf0eb59270b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Rput_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rput_f + use :: ompi_mpifh_bindings, only : ompi_rput_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prsend_f08.F90 index c7899dd84a8..66cb5d0e5aa 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Rsend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_rsend_f + use :: ompi_mpifh_bindings, only : ompi_rsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prsend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prsend_init_f08.F90 index 1366c8fe2f1..1b65ed987d7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prsend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prsend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Rsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_rsend_init_f + use :: ompi_mpifh_bindings, only : ompi_rsend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 index 96a49f6c612..73e5cf2a743 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Scan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_scan_f + use :: ompi_mpifh_bindings, only : ompi_scan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 index 6751eec5a7d..eaf46d6f75b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Scatter_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_scatter_f + use :: ompi_mpifh_bindings, only : ompi_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 index 35abe9d778f..7fcbd0df398 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Scatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& recvcount,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_scatterv_f + use :: ompi_mpifh_bindings, only : ompi_scatterv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psend_f08.F90 index 12b884fb3f9..6467dbced7e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Send_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_send_f + use :: ompi_mpifh_bindings, only : ompi_send_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psend_init_f08.F90 index 77fb89de0f6..7ca1544ee35 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Send_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_send_init_f + use :: ompi_mpifh_bindings, only : ompi_send_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 index 8e79346539b..b01fe08be78 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Sendrecv_f08(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, & recvcount,recvtype,source,recvtag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_sendrecv_f + use :: ompi_mpifh_bindings, only : ompi_sendrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 index 73d4e6fcdca..1bf25cffe02 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine PMPI_Sendrecv_replace_f08(buf,count,datatype,dest,sendtag,source, & recvtag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_sendrecv_replace_f + use :: ompi_mpifh_bindings, only : ompi_sendrecv_replace_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pssend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pssend_f08.F90 index db40bb27578..970d9f9defe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pssend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pssend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ssend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_ssend_f + use :: ompi_mpifh_bindings, only : ompi_ssend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pssend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pssend_init_f08.F90 index 83c3806a9bd..f1f89d533f1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pssend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pssend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Ssend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ssend_init_f + use :: ompi_mpifh_bindings, only : ompi_ssend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstart_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstart_f08.F90 index ff0470c1197..86acfc5b5d0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pstart_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstart_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Start_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_start_f + use :: ompi_mpifh_bindings, only : ompi_start_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstartall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstartall_f08.F90 index fb5e9e4858d..d4b7bacf446 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pstartall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstartall_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Startall_f08(count,array_of_requests,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_startall_f + use :: ompi_mpifh_bindings, only : ompi_startall_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_f08.F90 index 851da900d37..42d5a85ffe1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Status_set_elements_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_status_set_elements_f + use :: ompi_mpifh_bindings, only : ompi_status_set_elements_f implicit none TYPE(MPI_Status), INTENT(INOUT) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_x_f08.F90 index 26590973abc..82b63714b86 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pstatus_set_elements_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Status_set_elements_x_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_status_set_elements_x_f + use :: ompi_mpifh_bindings, only : ompi_status_set_elements_x_f implicit none TYPE(MPI_Status), INTENT(INOUT) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptopo_test_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptopo_test_f08.F90 index 8bd474d47fc..e4c0228dda6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptopo_test_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptopo_test_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Topo_test_f08(comm,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_topo_test_f + use :: ompi_mpifh_bindings, only : ompi_topo_test_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: status diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_commit_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_commit_f08.F90 index d608e1afd8b..33b880c851f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_commit_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_commit_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_commit_f08(datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_commit_f + use :: ompi_mpifh_bindings, only : ompi_type_commit_f implicit none TYPE(MPI_Datatype), INTENT(INOUT) :: datatype INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_contiguous_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_contiguous_f08.F90 index 829fb56ef54..eabcecae488 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_contiguous_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_contiguous_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_contiguous_f08(count,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_contiguous_f + use :: ompi_mpifh_bindings, only : ompi_type_contiguous_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_darray_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_darray_f08.F90 index e6137066bde..aff07168693 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_darray_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_darray_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_darray_f08(size,rank,ndims,& array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,& order,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_darray_f + use :: ompi_mpifh_bindings, only : ompi_type_create_darray_f implicit none INTEGER, INTENT(IN) :: size, rank, ndims, order INTEGER, INTENT(IN) :: array_of_gsizes(*), array_of_distribs(*), array_of_dargs(*), array_of_psizes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_complex_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_complex_f08.F90 index b523cf61abf..6400d8a63ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_complex_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_complex_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_f90_complex_f08(p,r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_complex_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_complex_f implicit none INTEGER, INTENT(IN) :: p, r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_integer_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_integer_f08.F90 index def575100dd..4a5b5de7a83 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_integer_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_integer_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_f90_integer_f08(r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_integer_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_integer_f implicit none INTEGER, INTENT(IN) :: r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_real_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_real_f08.F90 index 5ef39303ad4..1dc6aa3da0f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_real_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_f90_real_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_f90_real_f08(p,r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_real_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_real_f implicit none INTEGER, INTENT(IN) :: p, r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_block_f08.F90 index 7d9de21c680..af73a97edc6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_block_f08.F90 @@ -5,12 +5,14 @@ ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. ! Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_hindexed_block_f08(count,blocklength, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hindexed_block_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hindexed_block_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_f08.F90 index 3b5b905cf1d..766309222fe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hindexed_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_hindexed_f08(count,array_of_blocklengths, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hindexed_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hindexed_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hvector_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hvector_f08.F90 index 7d3841f5fd5..39c150fd8b4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hvector_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_hvector_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_hvector_f08(count,blocklength,stride,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hvector_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hvector_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: stride diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_indexed_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_indexed_block_f08.F90 index 18c1c900a89..af902e64dd5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_indexed_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_indexed_block_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_indexed_block_f08(count,blocklength, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_indexed_block_f + use :: ompi_mpifh_bindings, only : ompi_type_create_indexed_block_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER, INTENT(IN) :: array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_keyval_f08.F90 index 86afbd92830..3b9205ad69f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine PMPI_Type_create_keyval_f08(type_copy_attr_fn,type_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Type_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Type_delete_attr_function - use :: mpi_f08, only : ompi_type_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_type_create_keyval_f implicit none PROCEDURE(MPI_Type_copy_attr_function) :: type_copy_attr_fn PROCEDURE(MPI_Type_delete_attr_function) :: type_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_resized_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_resized_f08.F90 index 75a38ea0f7f..d6e8af8cd58 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_resized_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_resized_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_resized_f08(oldtype,lb,extent,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_resized_f + use :: ompi_mpifh_bindings, only : ompi_type_create_resized_f implicit none INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: lb, extent TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_struct_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_struct_f08.F90 index 419f91265b7..32aef155769 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_struct_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_struct_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_struct_f08(count,array_of_blocklengths,array_of_displacements, & array_of_types,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_struct_f + use :: ompi_mpifh_bindings, only : ompi_type_create_struct_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_subarray_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_subarray_f08.F90 index 089c0377361..5e77c98232d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_subarray_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_create_subarray_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_create_subarray_f08(ndims,array_of_sizes,array_of_subsizes, & array_of_starts,order,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_subarray_f + use :: ompi_mpifh_bindings, only : ompi_type_create_subarray_f implicit none INTEGER, INTENT(IN) :: ndims, order INTEGER, INTENT(IN) :: array_of_sizes(*), array_of_subsizes(*), array_of_starts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_delete_attr_f08.F90 index 7a862f52650..c0996b74fc4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_delete_attr_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_delete_attr_f08(datatype,type_keyval,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_type_delete_attr_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: type_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_dup_f08.F90 index 1afa8e3d0cb..b2751ba74ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_dup_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_dup_f08(oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_dup_f + use :: ompi_mpifh_bindings, only : ompi_type_dup_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: oldtype TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_f08.F90 index 5a2409563e3..4a649af19e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_free_f08(datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_free_f + use :: ompi_mpifh_bindings, only : ompi_type_free_f implicit none TYPE(MPI_Datatype), INTENT(INOUT) :: datatype INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_keyval_f08.F90 index 4067ef5b2b8..079d902d0f1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_free_keyval_f08(type_keyval,ierror) - use :: mpi_f08, only : ompi_type_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_type_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: type_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_contents_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_contents_f08.F90 index 9758e375373..d6b200560a8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_contents_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_contents_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_contents_f08(datatype,max_integers,max_addresses, & max_datatypes,array_of_integers,array_of_addresses, & array_of_datatypes,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_contents_f + use :: ompi_mpifh_bindings, only : ompi_type_get_contents_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: max_integers, max_addresses, max_datatypes diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_envelope_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_envelope_f08.F90 index 9de0e0c44fd..042a92c012c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_envelope_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_envelope_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_envelope_f08(datatype,num_integers,num_addresses, & num_datatypes,combiner,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_envelope_f + use :: ompi_mpifh_bindings, only : ompi_type_get_envelope_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(OUT) :: num_integers, num_addresses, num_datatypes, combiner diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_f08.F90 index cdc7c73b266..7a034233c0e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_extent_f08(datatype,lb,extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_extent_f + use :: ompi_mpifh_bindings, only : ompi_type_get_extent_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: lb, extent diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_x_f08.F90 index 94b777379d0..5e8e270eba7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_extent_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_extent_x_f08(datatype,lb,extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_get_extent_x_f + use :: ompi_mpifh_bindings, only : ompi_type_get_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: lb, extent diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_name_f08.F90 index 8947f690ab5..18398f7c367 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_name_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_get_name_f08(datatype,type_name,resultlen,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_type_get_name_f + use :: ompi_mpifh_bindings, only : ompi_type_get_name_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype CHARACTER(LEN=*), INTENT(OUT) :: type_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_f08.F90 index d74bdbd5c2a..fcf3fb64fbd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_true_extent_f08(datatype,true_lb,true_extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_true_extent_f + use :: ompi_mpifh_bindings, only : ompi_type_get_true_extent_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: true_lb, true_extent diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_x_f08.F90 index cf8ed24d5bc..a4efb6f3fec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_get_true_extent_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_get_true_extent_x_f08(datatype,true_lb,true_extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_get_true_extent_x_f + use :: ompi_mpifh_bindings, only : ompi_type_get_true_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: true_lb, true_extent diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_indexed_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_indexed_f08.F90 index 2c0afa10b2e..a3a1f21b71a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_indexed_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_indexed_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_indexed_f08(count,array_of_blocklengths, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_indexed_f + use :: ompi_mpifh_bindings, only : ompi_type_indexed_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count), array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_match_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_match_size_f08.F90 index 1b4219760e9..162137ada6e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_match_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_match_size_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_match_size_f08(typeclass,size,datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_match_size_f + use :: ompi_mpifh_bindings, only : ompi_type_match_size_f implicit none INTEGER, INTENT(IN) :: typeclass, size TYPE(MPI_Datatype), INTENT(OUT) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_attr_f08.F90 index 92db37557aa..525f1ea03e5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_attr_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_set_attr_f08(datatype,type_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_type_set_attr_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: type_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_name_f08.F90 index a6ae8a17ce7..0b0b7b9927a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_set_name_f08.F90 @@ -9,7 +9,7 @@ subroutine PMPI_Type_set_name_f08(datatype,type_name,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_set_name_f + use :: ompi_mpifh_bindings, only : ompi_type_set_name_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype CHARACTER(LEN=*), INTENT(IN) :: type_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_f08.F90 index 7c44708b221..fa4725bb9ca 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_size_f08(datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_size_f + use :: ompi_mpifh_bindings, only : ompi_type_size_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_x_f08.F90 index e5344f50c2d..3739b278cec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_size_x_f08.F90 @@ -3,13 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_size_x_f08(datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_size_x_f + use :: ompi_mpifh_bindings, only : ompi_type_size_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 index de3edb5a131..0a6b554f3e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_vector_f08(count,blocklength,stride,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_vector_f + use :: ompi_mpifh_bindings, only : ompi_type_vector_f implicit none INTEGER, INTENT(IN) :: count, blocklength, stride TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 index 5331b7952ed..c089ece2e33 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Unpack_external_f08(datarep,inbuf,insize,position,outbuf,outcount,datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_unpack_external_f + use :: ompi_mpifh_bindings, only : ompi_unpack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 index 0ced2e6f26a..f22b87610d2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Unpack_f08(inbuf,insize,position,outbuf,outcount,datatype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_unpack_f + use :: ompi_mpifh_bindings, only : ompi_unpack_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf INTEGER, INTENT(IN) :: insize, outcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/punpublish_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/punpublish_name_f08.F90 index 6c2ced41f23..d000993ee20 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/punpublish_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/punpublish_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Unpublish_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_unpublish_name_f + use :: ompi_mpifh_bindings, only : ompi_unpublish_name_f implicit none CHARACTER(LEN=*), INTENT(IN) :: service_name, port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwait_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwait_f08.F90 index 7ac141735b4..9e41083603e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwait_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwait_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Wait_f08(request,status,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_wait_f + use :: ompi_mpifh_bindings, only : ompi_wait_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request TYPE(MPI_Status), INTENT(OUT) :: status diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitall_f08.F90 index 2768fb3088e..26173405845 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitall_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Waitall_f08(count,array_of_requests,array_of_statuses,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitall_f + use :: ompi_mpifh_bindings, only : ompi_waitall_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitany_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitany_f08.F90 index 54956d80922..5b4420b66dd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitany_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitany_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Waitany_f08(count,array_of_requests,index,status,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitany_f + use :: ompi_mpifh_bindings, only : ompi_waitany_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitsome_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitsome_f08.F90 index 71e368f534d..d68bf7eea0d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwaitsome_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwaitsome_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Waitsome_f08(incount,array_of_requests,outcount, & array_of_indices,array_of_statuses,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitsome_f + use :: ompi_mpifh_bindings, only : ompi_waitsome_f implicit none INTEGER, INTENT(IN) :: incount TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(incount) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_f08.F90 index e03dfc23fb6..418be004d35 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_f08.F90 @@ -5,13 +5,15 @@ ! All Rights reserved. ! Copyright (c) 2004-2014 High Performance Computing Center Stuttgart, ! University of Stuttgart. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_allocate_f08(size, disp_unit, info, comm, & baseptr, win, ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_allocate_f + use :: ompi_mpifh_bindings, only : ompi_win_allocate_f implicit none INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_shared_f08.F90 index 1372b173544..1d11b7e3c1a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_allocate_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_allocate_shared_f08(size, disp_unit, info, comm, & baseptr, win, ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_allocate_shared_f + use :: ompi_mpifh_bindings, only : ompi_win_allocate_shared_f implicit none INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 index 4114a822d03..9cde0bf4228 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine PMPI_Win_attach_f08(win,base,size,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_attach_f + use :: ompi_mpifh_bindings, only : ompi_win_attach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_call_errhandler_f08.F90 index 8b42520611a..879e5ad774c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_call_errhandler_f08(win,errorcode,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_call_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_complete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_complete_f08.F90 index 3effdf0673e..7481c80240c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_complete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_complete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_complete_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_complete_f + use :: ompi_mpifh_bindings, only : ompi_win_complete_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_dynamic_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_dynamic_f08.F90 index b36900dcbbd..f00b05c6e62 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_dynamic_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_dynamic_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine PMPI_Win_create_dynamic_f08(info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win - use :: mpi_f08, only : ompi_win_create_dynamic_f + use :: ompi_mpifh_bindings, only : ompi_win_create_dynamic_f implicit none TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_errhandler_f08.F90 index af4a7eabeb7..f38c6be6f8a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine PMPI_Win_create_errhandler_f08(win_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_Win_errhandler_function - use :: mpi_f08, only : ompi_win_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_create_errhandler_f implicit none PROCEDURE(MPI_Win_errhandler_function) :: win_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 index 0e2bf175394..6c0d72609d0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPI_Win_create_f08(base,size,disp_unit,info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_create_f + use :: ompi_mpifh_bindings, only : ompi_win_create_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_keyval_f08.F90 index 1eda763ffa3..d911fff5f72 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine PMPI_Win_create_keyval_f08(win_copy_attr_fn,win_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Win_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Win_delete_attr_function - use :: mpi_f08, only : ompi_win_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_win_create_keyval_f implicit none PROCEDURE(MPI_Win_copy_attr_function) :: win_copy_attr_fn PROCEDURE(MPI_Win_delete_attr_function) :: win_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_delete_attr_f08.F90 index a8fd0b0996b..b2786d01abd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_delete_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_delete_attr_f08(win,win_keyval,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_win_delete_attr_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: win_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 index 67beec75966..26202444b4d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine PMPI_Win_detach_f08(win,base,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_detach_f + use :: ompi_mpifh_bindings, only : ompi_win_detach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_fence_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_fence_f08.F90 index da6d572b201..2dd924125e3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_fence_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_fence_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_fence_f08(assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_fence_f + use :: ompi_mpifh_bindings, only : ompi_win_fence_f implicit none INTEGER, INTENT(IN) :: assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_all_f08.F90 index 2a4ea7304e1..4ccd00bf651 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_flush_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_all_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_f08.F90 index e78448821f0..3893ff6ee5c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_flush_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_all_f08.F90 index 5e2819dc660..a43ff460133 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_flush_local_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_local_all_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_local_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_f08.F90 index 4b215a75be8..8e80552a29a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_flush_local_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_flush_local_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_local_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_local_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_f08.F90 index aebb2214a27..6a5fba6e409 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_free_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_free_f + use :: ompi_mpifh_bindings, only : ompi_win_free_f implicit none TYPE(MPI_Win), INTENT(INOUT) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_keyval_f08.F90 index 16fe0d49f9d..9846436f824 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_free_keyval_f08(win_keyval,ierror) - use :: mpi_f08, only : ompi_win_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_win_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: win_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_errhandler_f08.F90 index af5dc0e87e9..c5809ce0f29 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_get_errhandler_f08(win,errhandler,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Errhandler - use :: mpi_f08, only : ompi_win_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_get_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_group_f08.F90 index e455c44098c..0f505d76e53 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_get_group_f08(win,group,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Group - use :: mpi_f08, only : ompi_win_get_group_f + use :: ompi_mpifh_bindings, only : ompi_win_get_group_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_info_f08.F90 index a9f137badfb..cdb5b982d93 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_info_f08.F90 @@ -1,12 +1,12 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_get_info_f08(win,info,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Info - use :: mpi_f08, only : ompi_win_get_info_f + use :: ompi_mpifh_bindings, only : ompi_win_get_info_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Info), INTENT(OUT) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_name_f08.F90 index 5284700462b..14a290db1ef 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_get_name_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_get_name_f08(win,win_name,resultlen,ierror) use, intrinsic :: ISO_C_BINDING, only : C_CHAR use :: mpi_f08_types, only : MPI_Win, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_win_get_name_f + use :: ompi_mpifh_bindings, only : ompi_win_get_name_f implicit none TYPE(MPI_Win), INTENT(IN) :: win CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: win_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_all_f08.F90 index cf5ed33eab5..7c55df952b6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_lock_all_f08(assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_lock_all_f + use :: ompi_mpifh_bindings, only : ompi_win_lock_all_f implicit none INTEGER, INTENT(IN) :: assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_f08.F90 index 7655d60b32a..ec2af3dfd91 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_lock_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_lock_f08(lock_type,rank,assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_lock_f + use :: ompi_mpifh_bindings, only : ompi_win_lock_f implicit none INTEGER, INTENT(IN) :: lock_type, rank, assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_post_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_post_f08.F90 index 9cd97bdb7da..1bf8732a7ff 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_post_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_post_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_post_f08(group,assert,win,ierror) use :: mpi_f08_types, only : MPI_Group, MPI_Win - use :: mpi_f08, only : ompi_win_post_f + use :: ompi_mpifh_bindings, only : ompi_win_post_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: assert diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_attr_f08.F90 index a23ba0d3446..0cff6690b64 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_set_attr_f08(win,win_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_win_set_attr_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: win_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_errhandler_f08.F90 index 6a638edebe6..8d27af33592 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_set_errhandler_f08(win,errhandler,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Errhandler - use :: mpi_f08, only : ompi_win_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_set_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_info_f08.F90 index c8c3fff3718..2d0324d3297 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_info_f08.F90 @@ -1,12 +1,12 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_set_info_f08(win,info,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Info - use :: mpi_f08, only : ompi_win_set_info_f + use :: ompi_mpifh_bindings, only : ompi_win_set_info_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_name_f08.F90 index 31dbc8eb2bc..69ef6f59dd4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_set_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_set_name_f08(win,win_name,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_set_name_f + use :: ompi_mpifh_bindings, only : ompi_win_set_name_f implicit none TYPE(MPI_Win), INTENT(IN) :: win CHARACTER(LEN=*), INTENT(IN) :: win_name diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_shared_query_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_shared_query_f08.F90 index a6a168942d8..c0b92ff6c97 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_shared_query_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_shared_query_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_shared_query_f08(win, rank, size, disp_unit, baseptr,& ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_shared_query_f + use :: ompi_mpifh_bindings, only : ompi_win_shared_query_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_start_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_start_f08.F90 index ffc7be649b9..22d05cf0152 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_start_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_start_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_start_f08(group,assert,win,ierror) use :: mpi_f08_types, only : MPI_Group, MPI_Win - use :: mpi_f08, only : ompi_win_start_f + use :: ompi_mpifh_bindings, only : ompi_win_start_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: assert diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 index 99164715c47..ba8050b0f51 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_sync_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_sync_f + use :: ompi_mpifh_bindings, only : ompi_win_sync_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_all_f08.F90 index 4c028b09bb1..98cbfa090e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_unlock_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_unlock_all_f + use :: ompi_mpifh_bindings, only : ompi_win_unlock_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_f08.F90 index 436a2ca9fd5..974f9c36965 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_unlock_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_unlock_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_unlock_f + use :: ompi_mpifh_bindings, only : ompi_win_unlock_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_wait_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_wait_f08.F90 index 462b3d1383b..2ec3b802812 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_wait_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_wait_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_wait_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_wait_f + use :: ompi_mpifh_bindings, only : ompi_win_wait_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/publish_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/publish_name_f08.F90 index a8a69b0d9b3..d22b5463d23 100644 --- a/ompi/mpi/fortran/use-mpi-f08/publish_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/publish_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Publish_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_publish_name_f + use :: ompi_mpifh_bindings, only : ompi_publish_name_f implicit none TYPE(MPI_Info), INTENT(IN) :: info CHARACTER(LEN=*), INTENT(IN) :: service_name, port_name diff --git a/ompi/mpi/fortran/use-mpi-f08/put_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/put_f08.F90 index aa9a4fb88bf..74660532391 100644 --- a/ompi/mpi/fortran/use-mpi-f08/put_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/put_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Put_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_put_f + use :: ompi_mpifh_bindings, only : ompi_put_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/query_thread_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/query_thread_f08.F90 index cda1ec22363..3d06e211c50 100644 --- a/ompi/mpi/fortran/use-mpi-f08/query_thread_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/query_thread_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Query_thread_f08(provided,ierror) - use :: mpi_f08, only : ompi_query_thread_f + use :: ompi_mpifh_bindings, only : ompi_query_thread_f implicit none INTEGER, INTENT(OUT) :: provided INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 index 3c51b689b3d..8ec0eabe2ce 100644 --- a/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_Raccumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,request, ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_raccumulate_f + use :: ompi_mpifh_bindings, only : ompi_raccumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN),ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/recv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/recv_f08.F90 index cc1f53cfa3b..17a32d644bb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/recv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/recv_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Recv_f08(buf,count,datatype,source,tag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_recv_f + use :: ompi_mpifh_bindings, only : ompi_recv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 index a06e08687ba..877e7da8593 100644 --- a/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_recv_init_f + use :: ompi_mpifh_bindings, only : ompi_recv_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, source, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 index fd36b9439a4..848974253e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Reduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_f + use :: ompi_mpifh_bindings, only : ompi_reduce_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count, root diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 index 9a1749fc636..bdbe32e4b41 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Reduce_local_f08(inbuf,inoutbuf,count,datatype,op,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op - use :: mpi_f08, only : ompi_reduce_local_f + use :: ompi_mpifh_bindings, only : ompi_reduce_local_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 index f145264e5d2..b85cb92d355 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Reduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_scatter_block_f + use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_block_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 index 6b8ecb90639..49f97d01a84 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_reduce_scatter_f + use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcounts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/register_datarep_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/register_datarep_f08.F90 index 316ec2b2366..10b82e395bc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/register_datarep_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/register_datarep_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine MPI_Register_datarep_f08(datarep,read_conversion_fn,write_conversion_ use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Datarep_conversion_function use :: mpi_f08_interfaces_callbacks, only : MPI_Datarep_extent_function - use :: mpi_f08, only : ompi_register_datarep_f + use :: ompi_mpifh_bindings, only : ompi_register_datarep_f implicit none PROCEDURE(MPI_Datarep_conversion_function) :: read_conversion_fn PROCEDURE(MPI_Datarep_conversion_function) :: write_conversion_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/request_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/request_free_f08.F90 index 222c1fbc105..c8e1b818b8f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/request_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/request_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Request_free_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_request_free_f + use :: ompi_mpifh_bindings, only : ompi_request_free_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/rget_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/rget_accumulate_f08.F90 index a8ba2c95536..3eec2c60d97 100644 --- a/ompi/mpi/fortran/use-mpi-f08/rget_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/rget_accumulate_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +14,7 @@ subroutine MPI_Rget_accumulate_f08(origin_addr,origin_count,origin_datatype,& target_rank,target_disp,target_count, & target_datatype,op,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rget_accumulate_f + use :: ompi_mpifh_bindings, only : ompi_rget_accumulate_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/rget_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/rget_f08.F90 index 5d398fe436a..6947329ba3f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/rget_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/rget_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Rget_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rget_f + use :: ompi_mpifh_bindings, only : ompi_rget_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/rput_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/rput_f08.F90 index f0007699afb..e0104c97de3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/rput_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/rput_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Rput_f08(origin_addr,origin_count,origin_datatype,target_rank,& target_disp,target_count,target_datatype,win,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_rput_f + use :: ompi_mpifh_bindings, only : ompi_rput_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count diff --git a/ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90 index 002722a958b..06b08e30fa3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/rsend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Rsend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_rsend_f + use :: ompi_mpifh_bindings, only : ompi_rsend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90 index cc962c9c320..7945d6d7575 100644 --- a/ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/rsend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Rsend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_rsend_init_f + use :: ompi_mpifh_bindings, only : ompi_rsend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 index 21e7b46ff4e..86d57b91331 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Scan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm - use :: mpi_f08, only : ompi_scan_f + use :: ompi_mpifh_bindings, only : ompi_scan_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: count diff --git a/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 index 0cf3f25afff..915629611a3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Scatter_f08(sendbuf,sendcount,sendtype,recvbuf,& recvcount,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_scatter_f + use :: ompi_mpifh_bindings, only : ompi_scatter_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 index 3c42d93d9dd..f734fc11ad9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Scatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& recvcount,recvtype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_scatterv_f + use :: ompi_mpifh_bindings, only : ompi_scatterv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: recvcount, root diff --git a/ompi/mpi/fortran/use-mpi-f08/send_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/send_f08.F90 index 3ab4b9a2c1c..ff2903b2c58 100644 --- a/ompi/mpi/fortran/use-mpi-f08/send_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/send_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Send_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_send_f + use :: ompi_mpifh_bindings, only : ompi_send_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90 index 8fa4b3db652..84ab38e6043 100644 --- a/ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/send_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Send_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_send_init_f + use :: ompi_mpifh_bindings, only : ompi_send_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 index 51984e1f156..8166e663a66 100644 --- a/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Sendrecv_f08(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, & recvcount,recvtype,source,recvtag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_sendrecv_f + use :: ompi_mpifh_bindings, only : ompi_sendrecv_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag diff --git a/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 index 5a262cb68fd..2fbad9427ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +12,7 @@ subroutine MPI_Sendrecv_replace_f08(buf,count,datatype,dest,sendtag,source, & recvtag,comm,status,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_sendrecv_replace_f + use :: ompi_mpifh_bindings, only : ompi_sendrecv_replace_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag diff --git a/ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90 index 88c698dec17..5c235e4aece 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ssend_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ssend_f08(buf,count,datatype,dest,tag,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_ssend_f + use :: ompi_mpifh_bindings, only : ompi_ssend_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90 index 38699f45e6b..b95680ed603 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ssend_init_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Ssend_init_f08(buf,count,datatype,dest,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request - use :: mpi_f08, only : ompi_ssend_init_f + use :: ompi_mpifh_bindings, only : ompi_ssend_init_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf INTEGER, INTENT(IN) :: count, dest, tag diff --git a/ompi/mpi/fortran/use-mpi-f08/start_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/start_f08.F90 index 4b93cb53848..8129b6132d8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/start_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/start_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Start_f08(request,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_start_f + use :: ompi_mpifh_bindings, only : ompi_start_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/startall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/startall_f08.F90 index 956cc1b00b0..256d02ceba9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/startall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/startall_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Startall_f08(count,array_of_requests,ierror) use :: mpi_f08_types, only : MPI_Request - use :: mpi_f08, only : ompi_startall_f + use :: ompi_mpifh_bindings, only : ompi_startall_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/status_set_elements_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_set_elements_f08.F90 index 8fa2bf415d8..cbf35d9cbf1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/status_set_elements_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/status_set_elements_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Status_set_elements_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype - use :: mpi_f08, only : ompi_status_set_elements_f + use :: ompi_mpifh_bindings, only : ompi_status_set_elements_f implicit none TYPE(MPI_Status), INTENT(INOUT) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/status_set_elements_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_set_elements_x_f08.F90 index 385e1500af9..02752bd58b4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/status_set_elements_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/status_set_elements_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Status_set_elements_x_f08(status,datatype,count,ierror) use :: mpi_f08_types, only : MPI_Status, MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_status_set_elements_x_f + use :: ompi_mpifh_bindings, only : ompi_status_set_elements_x_f implicit none TYPE(MPI_Status), INTENT(INOUT) :: status TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 index 748c2a57cd8..fc4d5f22951 100644 --- a/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/topo_test_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Topo_test_f08(comm,status,ierror) use :: mpi_f08_types, only : MPI_Comm, MPI_Status - use :: mpi_f08, only : ompi_topo_test_f + use :: ompi_mpifh_bindings, only : ompi_topo_test_f implicit none TYPE(MPI_Comm), INTENT(IN) :: comm INTEGER, INTENT(OUT) :: status diff --git a/ompi/mpi/fortran/use-mpi-f08/type_commit_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_commit_f08.F90 index 39f577af72c..a1c6d35a859 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_commit_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_commit_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_commit_f08(datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_commit_f + use :: ompi_mpifh_bindings, only : ompi_type_commit_f implicit none TYPE(MPI_Datatype), INTENT(INOUT) :: datatype INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/type_contiguous_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_contiguous_f08.F90 index 0e2873c8615..efc93cc0fed 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_contiguous_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_contiguous_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_contiguous_f08(count,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_contiguous_f + use :: ompi_mpifh_bindings, only : ompi_type_contiguous_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_darray_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_darray_f08.F90 index 232d5a716de..abb21464b78 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_darray_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_darray_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_darray_f08(size,rank,ndims,& array_of_gsizes,array_of_distribs,array_of_dargs,array_of_psizes,& order,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_darray_f + use :: ompi_mpifh_bindings, only : ompi_type_create_darray_f implicit none INTEGER, INTENT(IN) :: size, rank, ndims, order INTEGER, INTENT(IN) :: array_of_gsizes(*), array_of_distribs(*), array_of_dargs(*), array_of_psizes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_complex_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_complex_f08.F90 index cf0f76f6c94..60be9f0bad8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_complex_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_complex_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_f90_complex_f08(p,r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_complex_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_complex_f implicit none INTEGER, INTENT(IN) :: p, r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_integer_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_integer_f08.F90 index 702284b5978..7622b9c610b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_integer_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_integer_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_f90_integer_f08(r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_integer_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_integer_f implicit none INTEGER, INTENT(IN) :: r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_real_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_real_f08.F90 index c512bb820af..2477d518484 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_f90_real_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_f90_real_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_f90_real_f08(p,r,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_f90_real_f + use :: ompi_mpifh_bindings, only : ompi_type_create_f90_real_f implicit none INTEGER, INTENT(IN) :: p, r TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block_f08.F90 index 76234882093..1e668ed2985 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_block_f08.F90 @@ -5,12 +5,14 @@ ! reserved. ! Copyright (c) 2012 Inria. All rights reserved. ! Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_hindexed_block_f08(count,blocklength, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hindexed_block_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hindexed_block_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90 index 275abde1bce..2bf23df1afd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_hindexed_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_hindexed_f08(count,array_of_blocklengths, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hindexed_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hindexed_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90 index 881bd6447bb..92c0d0a3910 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_hvector_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_hvector_f08(count,blocklength,stride,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_hvector_f + use :: ompi_mpifh_bindings, only : ompi_type_create_hvector_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: stride diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_indexed_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_indexed_block_f08.F90 index ebfc8d0a523..70a6e29d7fd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_indexed_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_indexed_block_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_indexed_block_f08(count,blocklength, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_indexed_block_f + use :: ompi_mpifh_bindings, only : ompi_type_create_indexed_block_f implicit none INTEGER, INTENT(IN) :: count, blocklength INTEGER, INTENT(IN) :: array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_keyval_f08.F90 index abc057ee116..ed7090d5c48 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine MPI_Type_create_keyval_f08(type_copy_attr_fn,type_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Type_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Type_delete_attr_function - use :: mpi_f08, only : ompi_type_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_type_create_keyval_f implicit none PROCEDURE(MPI_Type_copy_attr_function) :: type_copy_attr_fn PROCEDURE(MPI_Type_delete_attr_function) :: type_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_resized_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_resized_f08.F90 index 9093320bb24..820e5b86deb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_resized_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_resized_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_resized_f08(oldtype,lb,extent,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_resized_f + use :: ompi_mpifh_bindings, only : ompi_type_create_resized_f implicit none INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: lb, extent TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_struct_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_struct_f08.F90 index 53c9eb16a0a..80fccb9fdd7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_struct_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_struct_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_struct_f08(count,array_of_blocklengths,array_of_displacements, & array_of_types,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_create_struct_f + use :: ompi_mpifh_bindings, only : ompi_type_create_struct_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_create_subarray_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_create_subarray_f08.F90 index 6de352fd782..2356c592c93 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_create_subarray_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_create_subarray_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_create_subarray_f08(ndims,array_of_sizes,array_of_subsizes, & array_of_starts,order,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_create_subarray_f + use :: ompi_mpifh_bindings, only : ompi_type_create_subarray_f implicit none INTEGER, INTENT(IN) :: ndims, order INTEGER, INTENT(IN) :: array_of_sizes(*), array_of_subsizes(*), array_of_starts(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_delete_attr_f08.F90 index 794f0e4b41e..441e0fe1f96 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_delete_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_delete_attr_f08(datatype,type_keyval,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_type_delete_attr_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: type_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 index 589068bc7d7..5a9b13c5d83 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_dup_f08(datatype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_dup_f + use :: ompi_mpifh_bindings, only : ompi_type_dup_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Datatype), INTENT(OUT) :: newtype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_free_f08.F90 index 71cf2f41d1d..5e8af8af4f1 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_free_f08(datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_free_f + use :: ompi_mpifh_bindings, only : ompi_type_free_f implicit none TYPE(MPI_Datatype), INTENT(INOUT) :: datatype INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/type_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_free_keyval_f08.F90 index 818f4ebafef..7d9757b66ce 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_free_keyval_f08(type_keyval,ierror) - use :: mpi_f08, only : ompi_type_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_type_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: type_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_contents_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_contents_f08.F90 index 7ef9ade1006..16e42a38756 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_contents_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_contents_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_contents_f08(datatype,max_integers,max_addresses, & max_datatypes,array_of_integers,array_of_addresses, & array_of_datatypes,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_contents_f + use :: ompi_mpifh_bindings, only : ompi_type_get_contents_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: max_integers, max_addresses, max_datatypes diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 index 433921ce2d2..fcd591e4224 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_envelope_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_envelope_f08(datatype,num_integers,num_addresses, & num_datatypes,combiner,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_envelope_f + use :: ompi_mpifh_bindings, only : ompi_type_get_envelope_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(OUT) :: num_integers, num_addresses, num_datatypes, combiner diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_f08.F90 index 44b7ee70bef..1e7805344ad 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_extent_f08(datatype,lb,extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_extent_f + use :: ompi_mpifh_bindings, only : ompi_type_get_extent_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: lb, extent diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 index 74f9e2152ac..63d61845530 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_extent_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_extent_x_f08(datatype,lb,extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_get_extent_x_f + use :: ompi_mpifh_bindings, only : ompi_type_get_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: lb, extent diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 index abf1af3530e..86a9639ed50 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_name_f08(datatype,type_name,resultlen,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_type_get_name_f + use :: ompi_mpifh_bindings, only : ompi_type_get_name_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype CHARACTER(LEN=*), INTENT(OUT) :: type_name diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_f08.F90 index 7bcabf4bcd1..28d69bfd4fd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_true_extent_f08(datatype,true_lb,true_extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_get_true_extent_f + use :: ompi_mpifh_bindings, only : ompi_type_get_true_extent_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(OUT) :: true_lb, true_extent diff --git a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 index d2364b2d180..7197f2bc4b7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_get_true_extent_x_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_get_true_extent_x_f08(datatype,true_lb,true_extent,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_get_true_extent_x_f + use :: ompi_mpifh_bindings, only : ompi_type_get_true_extent_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: true_lb, true_extent diff --git a/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 index 33dc638109f..fed67730b07 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_indexed_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_indexed_f08(count,array_of_blocklengths, & array_of_displacements,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_indexed_f + use :: ompi_mpifh_bindings, only : ompi_type_indexed_f implicit none INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: array_of_blocklengths(count), array_of_displacements(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_match_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_match_size_f08.F90 index a5839d563c5..cd33116c6f3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_match_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_match_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_match_size_f08(typeclass,size,datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_match_size_f + use :: ompi_mpifh_bindings, only : ompi_type_match_size_f implicit none INTEGER, INTENT(IN) :: typeclass, size TYPE(MPI_Datatype), INTENT(OUT) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/type_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_set_attr_f08.F90 index 3b52871460f..12e1a14b694 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_set_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_set_attr_f08(datatype,type_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_type_set_attr_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: type_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/type_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_set_name_f08.F90 index 1b0167aaa11..c06a08863b9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_set_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_set_name_f08(datatype,type_name,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_set_name_f + use :: ompi_mpifh_bindings, only : ompi_type_set_name_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype CHARACTER(LEN=*), INTENT(IN) :: type_name diff --git a/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 index 9697347c3cd..e9f9a0eb6e3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_size_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_size_f08(datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_type_size_f + use :: ompi_mpifh_bindings, only : ompi_type_size_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/type_size_x_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_size_x_f08.F90 index d70553b918d..d7e38bd553a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_size_x_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_size_x_f08.F90 @@ -3,13 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2013 Los Alamos National Security, LLC. ! All rights reserved. -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_size_x_f08(datatype,size,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_COUNT_KIND - use :: mpi_f08, only : ompi_type_size_x_f + use :: ompi_mpifh_bindings, only : ompi_type_size_x_f implicit none TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_COUNT_KIND), INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/type_vector_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_vector_f08.F90 index 3a5aac8d465..9328d80734e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_vector_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_vector_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Type_vector_f08(count,blocklength,stride,oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype - use :: mpi_f08, only : ompi_type_vector_f + use :: ompi_mpifh_bindings, only : ompi_type_vector_f implicit none INTEGER, INTENT(IN) :: count, blocklength, stride TYPE(MPI_Datatype), INTENT(IN) :: oldtype diff --git a/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 index 9ccbb69b8bf..c77178240b4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Unpack_external_f08(datarep,inbuf,insize,position,outbuf,outcount,datatype,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_unpack_external_f + use :: ompi_mpifh_bindings, only : ompi_unpack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf diff --git a/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 index f024014580c..4e1b6719b75 100644 --- a/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Unpack_f08(inbuf,insize,position,outbuf,outcount,datatype,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm - use :: mpi_f08, only : ompi_unpack_f + use :: ompi_mpifh_bindings, only : ompi_unpack_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf INTEGER, INTENT(IN) :: insize, outcount diff --git a/ompi/mpi/fortran/use-mpi-f08/unpublish_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/unpublish_name_f08.F90 index 382f5416828..59de5151fc4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/unpublish_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/unpublish_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Unpublish_name_f08(service_name,info,port_name,ierror) use :: mpi_f08_types, only : MPI_Info - use :: mpi_f08, only : ompi_unpublish_name_f + use :: ompi_mpifh_bindings, only : ompi_unpublish_name_f implicit none CHARACTER(LEN=*), INTENT(IN) :: service_name, port_name TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/wait_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/wait_f08.F90 index d0f42543194..611080881b3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/wait_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/wait_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Wait_f08(request,status,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_wait_f + use :: ompi_mpifh_bindings, only : ompi_wait_f implicit none TYPE(MPI_Request), INTENT(INOUT) :: request TYPE(MPI_Status), INTENT(OUT) :: status diff --git a/ompi/mpi/fortran/use-mpi-f08/waitall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/waitall_f08.F90 index 2530d31f566..80862785279 100644 --- a/ompi/mpi/fortran/use-mpi-f08/waitall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/waitall_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Waitall_f08(count,array_of_requests,array_of_statuses,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitall_f + use :: ompi_mpifh_bindings, only : ompi_waitall_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/waitany_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/waitany_f08.F90 index ef44f82d184..0545fd1c75a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/waitany_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/waitany_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Waitany_f08(count,array_of_requests,index,status,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitany_f + use :: ompi_mpifh_bindings, only : ompi_waitany_f implicit none INTEGER, INTENT(IN) :: count TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(count) diff --git a/ompi/mpi/fortran/use-mpi-f08/waitsome_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/waitsome_f08.F90 index afef44722ca..208c547aa66 100644 --- a/ompi/mpi/fortran/use-mpi-f08/waitsome_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/waitsome_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Waitsome_f08(incount,array_of_requests,outcount, & array_of_indices,array_of_statuses,ierror) use :: mpi_f08_types, only : MPI_Request, MPI_Status - use :: mpi_f08, only : ompi_waitsome_f + use :: ompi_mpifh_bindings, only : ompi_waitsome_f implicit none INTEGER, INTENT(IN) :: incount TYPE(MPI_Request), INTENT(INOUT) :: array_of_requests(incount) diff --git a/ompi/mpi/fortran/use-mpi-f08/win_allocate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_allocate_f08.F90 index 0e9aa2765ac..e55216e5e0b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_allocate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_allocate_f08.F90 @@ -5,13 +5,15 @@ ! All Rights reserved. ! Copyright (c) 2004-2014 High Performance Computing Center Stuttgart, ! University of Stuttgart. All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_allocate_f08(size, disp_unit, info, comm, & baseptr, win, ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_allocate_f + use :: ompi_mpifh_bindings, only : ompi_win_allocate_f implicit none INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit diff --git a/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared_f08.F90 index 0a104c7d58d..a9d2e7f21c7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_allocate_shared_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_allocate_shared_f08(size, disp_unit, info, comm, & baseptr, win, ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_allocate_shared_f + use :: ompi_mpifh_bindings, only : ompi_win_allocate_shared_f implicit none INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit diff --git a/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 index 2c8160f3aee..bad1e0d1df6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine MPI_Win_attach_f08(win,base,size,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_attach_f + use :: ompi_mpifh_bindings, only : ompi_win_attach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/win_call_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_call_errhandler_f08.F90 index c1d1bd6bf21..746d3a4fe9b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_call_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_call_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_call_errhandler_f08(win,errorcode,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_call_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_call_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: errorcode diff --git a/ompi/mpi/fortran/use-mpi-f08/win_complete_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_complete_f08.F90 index d46e571a8d5..910593058ba 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_complete_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_complete_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_complete_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_complete_f + use :: ompi_mpifh_bindings, only : ompi_win_complete_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_create_dynamic_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_create_dynamic_f08.F90 index 576aa1a0e56..fe534eeebb4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_create_dynamic_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_create_dynamic_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine MPI_Win_create_dynamic_f08(info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win - use :: mpi_f08, only : ompi_win_create_dynamic_f + use :: ompi_mpifh_bindings, only : ompi_win_create_dynamic_f implicit none TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/win_create_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_create_errhandler_f08.F90 index 604fe2cb50d..ad0c19be698 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_create_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_create_errhandler_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -11,7 +13,7 @@ subroutine MPI_Win_create_errhandler_f08(win_errhandler_fn,errhandler,ierror) use, intrinsic :: iso_c_binding, only: c_funptr, c_funloc use :: mpi_f08_types, only : MPI_Errhandler use :: mpi_f08_interfaces_callbacks, only : MPI_Win_errhandler_function - use :: mpi_f08, only : ompi_win_create_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_create_errhandler_f implicit none PROCEDURE(MPI_Win_errhandler_function) :: win_errhandler_fn TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 index cfb657fbb8f..19236d84992 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Win_create_f08(base,size,disp_unit,info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_create_f + use :: ompi_mpifh_bindings, only : ompi_win_create_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/win_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_create_keyval_f08.F90 index b18860d7d31..4e90aae360b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_create_keyval_f08.F90 @@ -3,6 +3,8 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +15,7 @@ subroutine MPI_Win_create_keyval_f08(win_copy_attr_fn,win_delete_attr_fn,& use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: mpi_f08_interfaces_callbacks, only : MPI_Win_copy_attr_function use :: mpi_f08_interfaces_callbacks, only : MPI_Win_delete_attr_function - use :: mpi_f08, only : ompi_win_create_keyval_f + use :: ompi_mpifh_bindings, only : ompi_win_create_keyval_f implicit none PROCEDURE(MPI_Win_copy_attr_function) :: win_copy_attr_fn PROCEDURE(MPI_Win_delete_attr_function) :: win_delete_attr_fn diff --git a/ompi/mpi/fortran/use-mpi-f08/win_delete_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_delete_attr_f08.F90 index 9651254c917..1b4cddaed6f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_delete_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_delete_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_delete_attr_f08(win,win_keyval,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_delete_attr_f + use :: ompi_mpifh_bindings, only : ompi_win_delete_attr_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: win_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 index 88135ea874f..9ed85491619 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 @@ -1,6 +1,6 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ @@ -8,7 +8,7 @@ subroutine MPI_Win_detach_f08(win,base,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_detach_f + use :: ompi_mpifh_bindings, only : ompi_win_detach_f implicit none OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_fence_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_fence_f08.F90 index a310b72be3c..0afe8ad39a5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_fence_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_fence_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_fence_f08(assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_fence_f + use :: ompi_mpifh_bindings, only : ompi_win_fence_f implicit none INTEGER, INTENT(IN) :: assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_flush_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_flush_all_f08.F90 index 6c54f8a4f5f..90b22a1f444 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_flush_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_flush_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_flush_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_all_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_flush_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_flush_f08.F90 index 890783481ed..4642213bf1f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_flush_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_flush_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_flush_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_flush_local_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_flush_local_all_f08.F90 index 0dc10aa44d2..31e3074f022 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_flush_local_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_flush_local_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_flush_local_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_local_all_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_local_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_flush_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_flush_local_f08.F90 index b244c2b60f4..2cadfa601f7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_flush_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_flush_local_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2014 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_flush_local_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_flush_local_f + use :: ompi_mpifh_bindings, only : ompi_win_flush_local_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_free_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_free_f08.F90 index 012988ba905..812011817b7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_free_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_free_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_free_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_free_f + use :: ompi_mpifh_bindings, only : ompi_win_free_f implicit none TYPE(MPI_Win), INTENT(INOUT) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_free_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_free_keyval_f08.F90 index 9491a040d25..f7f8af9fbbb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_free_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_free_keyval_f08.F90 @@ -3,10 +3,12 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_free_keyval_f08(win_keyval,ierror) - use :: mpi_f08, only : ompi_win_free_keyval_f + use :: ompi_mpifh_bindings, only : ompi_win_free_keyval_f implicit none INTEGER, INTENT(INOUT) :: win_keyval INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_get_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_get_errhandler_f08.F90 index 762def2b1db..ff33f9dfec4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_get_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_get_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_get_errhandler_f08(win,errhandler,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Errhandler - use :: mpi_f08, only : ompi_win_get_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_get_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/win_get_group_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_get_group_f08.F90 index f15e52773db..dec2160d07f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_get_group_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_get_group_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_get_group_f08(win,group,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Group - use :: mpi_f08, only : ompi_win_get_group_f + use :: ompi_mpifh_bindings, only : ompi_win_get_group_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Group), INTENT(OUT) :: group diff --git a/ompi/mpi/fortran/use-mpi-f08/win_get_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_get_info_f08.F90 index 07e09cd86ec..e090282ad45 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_get_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_get_info_f08.F90 @@ -1,12 +1,12 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_get_info_f08(win,info,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Info - use :: mpi_f08, only : ompi_win_get_info_f + use :: ompi_mpifh_bindings, only : ompi_win_get_info_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Info), INTENT(OUT) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 index 96d02f758f1..6d177039d54 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_get_name_f08.F90 @@ -3,12 +3,14 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_get_name_f08(win,win_name,resultlen,ierror) use, intrinsic :: ISO_C_BINDING, only : C_CHAR use :: mpi_f08_types, only : MPI_Win, MPI_MAX_OBJECT_NAME - use :: mpi_f08, only : ompi_win_get_name_f + use :: ompi_mpifh_bindings, only : ompi_win_get_name_f implicit none TYPE(MPI_Win), INTENT(IN) :: win CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(OUT) :: win_name diff --git a/ompi/mpi/fortran/use-mpi-f08/win_lock_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_lock_all_f08.F90 index 0ebe9b84af3..e4ec9eb0144 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_lock_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_lock_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_lock_all_f08(assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_lock_all_f + use :: ompi_mpifh_bindings, only : ompi_win_lock_all_f implicit none INTEGER, INTENT(IN) :: assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_lock_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_lock_f08.F90 index e90745fbf57..a0c54d183b2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_lock_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_lock_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_lock_f08(lock_type,rank,assert,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_lock_f + use :: ompi_mpifh_bindings, only : ompi_win_lock_f implicit none INTEGER, INTENT(IN) :: lock_type, rank, assert TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_post_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_post_f08.F90 index 7f874ade28c..35ff323d3f8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_post_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_post_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_post_f08(group,assert,win,ierror) use :: mpi_f08_types, only : MPI_Group, MPI_Win - use :: mpi_f08, only : ompi_win_post_f + use :: ompi_mpifh_bindings, only : ompi_win_post_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: assert diff --git a/ompi/mpi/fortran/use-mpi-f08/win_set_attr_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_set_attr_f08.F90 index 80333e9e0db..26c3fb6bcb7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_set_attr_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_set_attr_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_set_attr_f08(win,win_keyval,attribute_val,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_set_attr_f + use :: ompi_mpifh_bindings, only : ompi_win_set_attr_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: win_keyval diff --git a/ompi/mpi/fortran/use-mpi-f08/win_set_errhandler_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_set_errhandler_f08.F90 index f665433dd73..c9b32763be4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_set_errhandler_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_set_errhandler_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_set_errhandler_f08(win,errhandler,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Errhandler - use :: mpi_f08, only : ompi_win_set_errhandler_f + use :: ompi_mpifh_bindings, only : ompi_win_set_errhandler_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Errhandler), INTENT(IN) :: errhandler diff --git a/ompi/mpi/fortran/use-mpi-f08/win_set_info_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_set_info_f08.F90 index 5151ba60890..99342ab1554 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_set_info_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_set_info_f08.F90 @@ -1,12 +1,12 @@ ! -*- f90 -*- ! -! Copyright (c) 2015 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_set_info_f08(win,info,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_Info - use :: mpi_f08, only : ompi_win_set_info_f + use :: ompi_mpifh_bindings, only : ompi_win_set_info_f implicit none TYPE(MPI_Win), INTENT(IN) :: win TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/win_set_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_set_name_f08.F90 index cec7da1d3c1..2902ecdba9e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_set_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_set_name_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_set_name_f08(win,win_name,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_set_name_f + use :: ompi_mpifh_bindings, only : ompi_win_set_name_f implicit none TYPE(MPI_Win), INTENT(IN) :: win CHARACTER(LEN=*), INTENT(IN) :: win_name diff --git a/ompi/mpi/fortran/use-mpi-f08/win_shared_query_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_shared_query_f08.F90 index e9f8018ce82..c8579f5d0df 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_shared_query_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_shared_query_f08.F90 @@ -3,13 +3,15 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_shared_query_f08(win, rank, size, disp_unit, baseptr,& ierror) USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND - use :: mpi_f08, only : ompi_win_shared_query_f + use :: ompi_mpifh_bindings, only : ompi_win_shared_query_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, INTENT(IN) :: rank diff --git a/ompi/mpi/fortran/use-mpi-f08/win_start_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_start_f08.F90 index 6ce80317715..cef75e40079 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_start_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_start_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_start_f08(group,assert,win,ierror) use :: mpi_f08_types, only : MPI_Group, MPI_Win - use :: mpi_f08, only : ompi_win_start_f + use :: ompi_mpifh_bindings, only : ompi_win_start_f implicit none TYPE(MPI_Group), INTENT(IN) :: group INTEGER, INTENT(IN) :: assert diff --git a/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 index 932ccd11f43..8d9cb324c43 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_sync_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_sync_f + use :: ompi_mpifh_bindings, only : ompi_win_sync_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_unlock_all_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_unlock_all_f08.F90 index 979581fe5de..6cd653b8171 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_unlock_all_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_unlock_all_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_unlock_all_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_unlock_all_f + use :: ompi_mpifh_bindings, only : ompi_win_unlock_all_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_unlock_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_unlock_f08.F90 index e08777fdab3..a7395a0f601 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_unlock_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_unlock_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_unlock_f08(rank,win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_unlock_f + use :: ompi_mpifh_bindings, only : ompi_win_unlock_f implicit none INTEGER, INTENT(IN) :: rank TYPE(MPI_Win), INTENT(IN) :: win diff --git a/ompi/mpi/fortran/use-mpi-f08/win_wait_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_wait_f08.F90 index b9849d0f479..e9590882073 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_wait_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_wait_f08.F90 @@ -3,11 +3,13 @@ ! Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_wait_f08(win,ierror) use :: mpi_f08_types, only : MPI_Win - use :: mpi_f08, only : ompi_win_wait_f + use :: ompi_mpifh_bindings, only : ompi_win_wait_f implicit none TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror From a4fabb7e262075afa52000ad34b783c239ec050c Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Wed, 19 Sep 2018 22:10:28 +0000 Subject: [PATCH 092/674] openib: Disable CUDA async by default Disable async receive for CUDA under OpenIB. While a performance optimization, it also causes incorrect results for transfers larger than the GPUDirect RDMA limit. This change has been validated and approved by Akshay. References #3972 Signed-off-by: Brian Barrett (cherry picked from commit 9344afd485d23c41a18ab57d6df8550826c24b9e) Signed-off-by: Brian Barrett --- opal/mca/btl/openib/btl_openib_mca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/openib/btl_openib_mca.c b/opal/mca/btl/openib/btl_openib_mca.c index e362c958caa..54b47777141 100644 --- a/opal/mca/btl/openib/btl_openib_mca.c +++ b/opal/mca/btl/openib/btl_openib_mca.c @@ -573,7 +573,7 @@ int btl_openib_register_mca_params(void) CHECK(reg_bool("cuda_async_recv", NULL, "Enable or disable CUDA async recv copies " "(true = async; false = sync)", - true, &mca_btl_openib_component.cuda_async_recv)); + false, &mca_btl_openib_component.cuda_async_recv)); /* Also make the max send size larger for better GPU buffer performance */ mca_btl_openib_module.super.btl_max_send_size = 128 * 1024; /* Turn of message coalescing - not sure if it works with GPU buffers */ From 85e410302d6fb5d1e65f2f58a4e9f27206cd45bc Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 20 Sep 2018 17:59:24 -0500 Subject: [PATCH 093/674] Updating VERSION to rc2 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index f0c6288bd2c..8277c7d0461 100644 --- a/VERSION +++ b/VERSION @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc1 +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 192f0f6fff4b4ba0f207054626c935941ff0b5d8 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 20 Sep 2018 18:09:15 -0700 Subject: [PATCH 094/674] Remove the OFI/BTL component Remove this component pending re-architecture of the overall OFI components. We have had similar issues before when multiple components use the same library - typical issues are race conditions, initialize and finalize errors, etc. We are seeing similar problems here as we get broader exposure to different library version and environment combinations. The correct fix in the past has been to centralize the library interactions in a "common" component. We will pursue that here by moving some additional functions (e.g., endpoint creation) into the existing opal/mca/common/ofi component. We can't do that and thoroughly test it in time for the v4.0.0 release, so we'll simply remove this component from the release. Once we have things correctly fixed, we'll submit a PR to restore the component plus the related fixes to some future v4.x release. Signed-off-by: Ralph Castain --- opal/mca/btl/ofi/Makefile.am | 62 --- opal/mca/btl/ofi/README | 88 ---- opal/mca/btl/ofi/btl_ofi.h | 311 ------------ opal/mca/btl/ofi/btl_ofi_atomics.c | 192 -------- opal/mca/btl/ofi/btl_ofi_component.c | 681 --------------------------- opal/mca/btl/ofi/btl_ofi_endpoint.c | 343 -------------- opal/mca/btl/ofi/btl_ofi_endpoint.h | 75 --- opal/mca/btl/ofi/btl_ofi_module.c | 329 ------------- opal/mca/btl/ofi/btl_ofi_rdma.c | 156 ------ opal/mca/btl/ofi/btl_ofi_rdma.h | 42 -- opal/mca/btl/ofi/configure.m4 | 51 -- opal/mca/btl/ofi/owner.txt | 7 - 12 files changed, 2337 deletions(-) delete mode 100644 opal/mca/btl/ofi/Makefile.am delete mode 100644 opal/mca/btl/ofi/README delete mode 100644 opal/mca/btl/ofi/btl_ofi.h delete mode 100644 opal/mca/btl/ofi/btl_ofi_atomics.c delete mode 100644 opal/mca/btl/ofi/btl_ofi_component.c delete mode 100644 opal/mca/btl/ofi/btl_ofi_endpoint.c delete mode 100644 opal/mca/btl/ofi/btl_ofi_endpoint.h delete mode 100644 opal/mca/btl/ofi/btl_ofi_module.c delete mode 100644 opal/mca/btl/ofi/btl_ofi_rdma.c delete mode 100644 opal/mca/btl/ofi/btl_ofi_rdma.h delete mode 100644 opal/mca/btl/ofi/configure.m4 delete mode 100644 opal/mca/btl/ofi/owner.txt diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am deleted file mode 100644 index fdaeec865d7..00000000000 --- a/opal/mca/btl/ofi/Makefile.am +++ /dev/null @@ -1,62 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2013 NVIDIA Corporation. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# Copyright (c) 2018 Intel, inc. All rights reserved -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -#dist_opaldata_DATA = help-mpi-btl-ofi.txt - -AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) -sources = \ - btl_ofi.h \ - btl_ofi_component.c \ - btl_ofi_endpoint.h \ - btl_ofi_endpoint.c \ - btl_ofi_module.c \ - btl_ofi_rdma.h \ - btl_ofi_rdma.c \ - btl_ofi_atomics.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_btl_ofi_DSO -lib = -lib_sources = -component = mca_btl_ofi.la -component_sources = $(sources) -else -lib = libmca_btl_ofi.la -lib_sources = $(sources) -component = -component_sources = -endif - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component) -mca_btl_ofi_la_SOURCES = $(component_sources) -mca_btl_ofi_la_LDFLAGS = -module -avoid-version \ - $(opal_common_ofi_LDFLAGS) -mca_btl_ofi_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la - -noinst_LTLIBRARIES = $(lib) -libmca_btl_ofi_la_SOURCES = $(lib_sources) -libmca_btl_ofi_la_LDFLAGS = -module -avoid-version $(opal_common_ofi_LDFLAGS) diff --git a/opal/mca/btl/ofi/README b/opal/mca/btl/ofi/README deleted file mode 100644 index 97e3759830d..00000000000 --- a/opal/mca/btl/ofi/README +++ /dev/null @@ -1,88 +0,0 @@ -======================================== -Design notes on BTL/OFI -======================================== - -This is the RDMA only btl based on OFI Libfabric. The goal is to enable RDMA -with multiple vendor hardware through one interface. Most of the operations are -managed by upper layer (osc/rdma). This BTL is mostly doing the low level work. - -Tested providers: sockets,psm2,ugni - -======================================== - -Component - -This BTL is requesting libfabric version 1.5 API and will not support older versions. - -The required capabilities of this BTL is FI_ATOMIC and FI_RMA with the endpoint type -of FI_EP_RDM only. This BTL does NOT support libfabric provider that requires local -memory registration (FI_MR_LOCAL). - -BTL/OFI will initialize a module with ONLY the first compatible info returned from OFI. -This means it will rely on OFI provider to do load balancing. The support for multiple -device might be added later. - -The BTL creates only one endpoint and one CQ. - -======================================== - -Memory Registration - -Open MPI has a system in place to exchange remote address and always use the remote -virtual address to refer to a piece of memory. However, some libfabric providers might -not support the use of virtual address and instead will use zero-based offset addressing. - -FI_MR_VIRT_ADDR is the flag that determine this behavior. mca_btl_ofi_reg_mem() handles -this by storing the base address in registration handle in case of the provider does not -support FI_MR_VIRT_ADDR. This base address will be used to calculate the offset later in -RDMA/Atomic operations. - -The BTL will try to use the address of registration handle as the key. However, if the -provider supports FI_MR_PROV_KEY, it will use provider provided key. Simply does not care. - -The BTL does not register local operand or compare. This is why this BTL does not support -FI_MR_LOCAL and will allocate every buffer before registering. This means FI_MR_ALLOCATED -is supported. So to be explicit. - -Supported MR mode bits (will work with or without): - enum: - - FI_MR_BASIC - - FI_MR_SCALABLE - - mode bits: - - FI_MR_VIRT_ADDR - - FI_MR_ALLOCATED - - FI_MR_PROV_KEY - -The BTL does NOT support (will not work with): - - FI_MR_LOCAL - - FI_MR_MMU_NOTIFY - - FI_MR_RMA_EVENT - - FI_MR_ENDPOINT - -Just a reminder, in libfabric API 1.5... -FI_MR_BASIC == (FI_MR_PROV_KEY | FI_MR_ALLOCATED | FI_MR_VIRT_ADDR) - -======================================== - -Completions - -Every operation in this BTL is asynchronous. The completion handling will occur in -mca_btl_ofi_component_progress() where we read the CQ with the completion context and -execute the callback functions. The completions are local. No remote completion event is -generated as local completion already guarantee global completion. - -The BTL keep tracks of number of outstanding operations and provide flush interface. - -======================================== - -Sockets Provider - -Sockets provider is the proof of concept provider for libfabric. It is supposed to support -all the OFI API with emulations. This provider is considered very slow and bound to raise -problems that we might not see from other faster providers. - -Known Problems: - - sockets provider uses progress thread and can cause segfault in finalize as we free - the resources while progress thread is still using it. sleep(1) was put in - mca_btl_ofi_componenet_close() for this reason. diff --git a/opal/mca/btl/ofi/btl_ofi.h b/opal/mca/btl/ofi/btl_ofi.h deleted file mode 100644 index 02e44fd8b30..00000000000 --- a/opal/mca/btl/ofi/btl_ofi.h +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- 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-2018 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) 2015-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ -#ifndef MCA_BTL_OFI_H -#define MCA_BTL_OFI_H - -#include "opal_config.h" -#include -#include - -/* Open MPI includes */ -#include "opal/mca/event/event.h" -#include "opal/mca/btl/btl.h" -#include "opal/mca/btl/base/base.h" -#include "opal/mca/mpool/mpool.h" -#include "opal/mca/btl/base/btl_base_error.h" -#include "opal/mca/rcache/base/base.h" -#include "opal/mca/pmix/pmix.h" - -#include -#include -#include -#include -#include -#include - -BEGIN_C_DECLS -#define MCA_BTL_OFI_MAX_MODULES 16 -#define MCA_BTL_OFI_MAX_CQ_READ_ENTRIES 128 -#define MCA_BTL_OFI_NUM_CQE_READ 64 -#define MCA_BTL_OFI_PROGRESS_THRESHOLD 64 - -#define MCA_BTL_OFI_ABORT(args) mca_btl_ofi_exit(args) - -enum mca_btl_ofi_type { - MCA_BTL_OFI_TYPE_PUT = 1, - MCA_BTL_OFI_TYPE_GET, - MCA_BTL_OFI_TYPE_AOP, - MCA_BTL_OFI_TYPE_AFOP, - MCA_BTL_OFI_TYPE_CSWAP, - MCA_BTL_OFI_TYPE_TOTAL -}; - -struct mca_btl_ofi_context_t { - int32_t context_id; - - /* transmit context */ - struct fid_ep *tx_ctx; - struct fid_ep *rx_ctx; - - /* completion queue */ - struct fid_cq *cq; - - /* completion info freelist */ - /* We have it per context to reduce the thread contention - * on the freelist. Things can get really slow. */ - opal_free_list_t comp_list; - - /* for thread locking */ - volatile int32_t lock; -}; -typedef struct mca_btl_ofi_context_t mca_btl_ofi_context_t; - -/** - * @brief OFI BTL module - */ -struct mca_btl_ofi_module_t { - /** base BTL interface */ - mca_btl_base_module_t super; - - /* libfabric components */ - struct fi_info *fabric_info; - struct fid_fabric *fabric; - struct fid_domain *domain; - struct fid_ep *ofi_endpoint; - struct fid_av *av; - - int num_contexts; - mca_btl_ofi_context_t *contexts; - - char *linux_device_name; - - /** whether the module has been fully initialized or not */ - bool initialized; - bool use_virt_addr; - bool is_scalable_ep; - - int64_t outstanding_rdma; - - /** linked list of BTL endpoints. this list is never searched so - * there is no need for a complicated structure here at this time*/ - opal_list_t endpoints; - - opal_mutex_t module_lock; - - /** registration cache */ - mca_rcache_base_module_t *rcache; -}; -typedef struct mca_btl_ofi_module_t mca_btl_ofi_module_t; - -extern mca_btl_ofi_module_t mca_btl_ofi_module_template; - -/** - * @brief OFI BTL component - */ -struct mca_btl_ofi_component_t { - mca_btl_base_component_3_0_0_t super; /**< base BTL component */ - - /** number of TL modules */ - int module_count; - int num_contexts_per_module; - int num_cqe_read; - int progress_threshold; - - size_t namelen; - - /** All BTL OFI modules (1 per tl) */ - mca_btl_ofi_module_t *modules[MCA_BTL_OFI_MAX_MODULES]; - -}; -typedef struct mca_btl_ofi_component_t mca_btl_ofi_component_t; - -OPAL_MODULE_DECLSPEC extern mca_btl_ofi_component_t mca_btl_ofi_component; - -struct mca_btl_base_registration_handle_t { - uint64_t rkey; - void *desc; - void *base_addr; -}; - -struct mca_btl_ofi_reg_t { - mca_rcache_base_registration_t base; - struct fid_mr *ur_mr; - - /* remote handle */ - mca_btl_base_registration_handle_t handle; -}; -typedef struct mca_btl_ofi_reg_t mca_btl_ofi_reg_t; - -OBJ_CLASS_DECLARATION(mca_btl_ofi_reg_t); - -/* completion structure store information needed - * for RDMA callbacks */ -struct mca_btl_ofi_completion_t { - opal_free_list_item_t comp_list; - opal_free_list_t *my_list; - - struct mca_btl_base_module_t *btl; - struct mca_btl_base_endpoint_t *endpoint; - struct mca_btl_ofi_context_t *my_context; - uint32_t type; - - void *local_address; - mca_btl_base_registration_handle_t *local_handle; - - /* information for atomic op */ - uint64_t operand; - uint64_t compare; - - mca_btl_base_rdma_completion_fn_t cbfunc; - void *cbcontext; - void *cbdata; - -}; -typedef struct mca_btl_ofi_completion_t mca_btl_ofi_completion_t; - -OBJ_CLASS_DECLARATION(mca_btl_ofi_completion_t); - -/** - * Initiate an asynchronous put. - * Completion Semantics: if this function returns a 1 then the operation - * is complete. a return of OPAL_SUCCESS indicates - * the put operation has been queued with the - * network. the local_handle can not be deregistered - * until all outstanding operations on that handle - * have been completed. - * - * @param btl (IN) BTL module - * @param endpoint (IN) BTL addressing information - * @param local_address (IN) Local address to put from (registered) - * @param remote_address (IN) Remote address to put to (registered remotely) - * @param local_handle (IN) Registration handle for region containing - * (local_address, local_address + size) - * @param remote_handle (IN) Remote registration handle for region containing - * (remote_address, remote_address + size) - * @param size (IN) Number of bytes to put - * @param flags (IN) Flags for this put operation - * @param order (IN) Ordering - * @param cbfunc (IN) Function to call on completion (if queued) - * @param cbcontext (IN) Context for the callback - * @param cbdata (IN) Data for callback - * - * @retval OPAL_SUCCESS The descriptor was successfully queued for a put - * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put - * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put - * operation. Try again later - * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or - * alignment restrictions. - */ -int mca_btl_ofi_put (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, - struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - -/** - * Initiate an asynchronous get. - * Completion Semantics: if this function returns a 1 then the operation - * is complete. a return of OPAL_SUCCESS indicates - * the get operation has been queued with the - * network. the local_handle can not be deregistered - * until all outstanding operations on that handle - * have been completed. - * - * @param btl (IN) BTL module - * @param endpoint (IN) BTL addressing information - * @param local_address (IN) Local address to put from (registered) - * @param remote_address (IN) Remote address to put to (registered remotely) - * @param local_handle (IN) Registration handle for region containing - * (local_address, local_address + size) - * @param remote_handle (IN) Remote registration handle for region containing - * (remote_address, remote_address + size) - * @param size (IN) Number of bytes to put - * @param flags (IN) Flags for this put operation - * @param order (IN) Ordering - * @param cbfunc (IN) Function to call on completion (if queued) - * @param cbcontext (IN) Context for the callback - * @param cbdata (IN) Data for callback - * - * @retval OPAL_SUCCESS The descriptor was successfully queued for a put - * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put - * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put - * operation. Try again later - * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or - * alignment restrictions. - */ -int mca_btl_ofi_get (struct mca_btl_base_module_t *btl, - struct mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, - struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - -int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, - mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, - mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - -int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, - uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, - void *cbcontext, void *cbdata); - -int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); - - -int mca_btl_ofi_flush (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint); - -int mca_btl_ofi_finalize (mca_btl_base_module_t *btl); - -void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module); -int mca_btl_ofi_reg_mem (void *reg_data, void *base, size_t size, - mca_rcache_base_registration_t *reg); -int mca_btl_ofi_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg); - -int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context); -void mca_btl_ofi_exit(void); - -/* thread atomics */ -static inline bool mca_btl_ofi_context_trylock (mca_btl_ofi_context_t *context) -{ - return (context->lock || OPAL_ATOMIC_SWAP_32(&context->lock, 1)); -} - -static inline void mca_btl_ofi_context_lock(mca_btl_ofi_context_t *context) -{ - while (mca_btl_ofi_context_trylock(context)); -} - -static inline void mca_btl_ofi_context_unlock(mca_btl_ofi_context_t *context) -{ - opal_atomic_mb(); - context->lock = 0; -} - -END_C_DECLS -#endif diff --git a/opal/mca/btl/ofi/btl_ofi_atomics.c b/opal/mca/btl/ofi/btl_ofi_atomics.c deleted file mode 100644 index e5364ed6489..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_atomics.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include -#include "btl_ofi_rdma.h" - -static inline int to_fi_op(mca_btl_base_atomic_op_t op) -{ - switch (op) { - case MCA_BTL_ATOMIC_ADD: - return FI_SUM; - case MCA_BTL_ATOMIC_SWAP: - return FI_ATOMIC_WRITE; - default: - BTL_ERROR(("Unknown or unsupported atomic op.")); - MCA_BTL_OFI_ABORT(); - - /* just to squash the warning */ - return OPAL_ERROR; - } -} - -int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, - uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, - void *cbcontext, void *cbdata) -{ - int rc; - int fi_datatype = FI_UINT64; - int fi_op; - - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; - mca_btl_ofi_context_t *ofi_context; - - ofi_context = get_ofi_context(ofi_btl); - - if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { - fi_datatype = FI_UINT32; - } - - fi_op = to_fi_op(op); - - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_AFOP); - - /* copy the operand because it might get freed from upper layer */ - comp->operand = (uint64_t) operand; - - remote_address = (remote_address - (uint64_t) remote_handle->base_addr); - - rc = fi_fetch_atomic(ofi_context->tx_ctx, - (void*) &comp->operand, 1, NULL, /* operand */ - local_address, local_handle->desc, /* results */ - btl_endpoint->peer_addr, /* remote addr */ - remote_address, remote_handle->rkey, /* remote buffer */ - fi_datatype, fi_op, comp); - - if (rc == -FI_EAGAIN) { - return OPAL_ERR_OUT_OF_RESOURCE; - } else if (rc < 0) { - BTL_ERROR(("fi_fetch_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); - MCA_BTL_OFI_ABORT(); - } - - MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); - - return OPAL_SUCCESS; -} - -int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, - uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, - mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, - mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - int rc; - int fi_datatype = FI_UINT64; - int fi_op; - - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; - mca_btl_ofi_context_t *ofi_context; - - ofi_context = get_ofi_context(ofi_btl); - - if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { - fi_datatype = FI_UINT32; - } - - fi_op = to_fi_op(op); - - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - NULL, - NULL, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_AOP); - - /* copy the operand because it might get freed from upper layer */ - comp->operand = (uint64_t) operand; - - remote_address = (remote_address - (uint64_t) remote_handle->base_addr); - - rc = fi_atomic(ofi_context->tx_ctx, - (void*) &comp->operand, 1, NULL, /* operand */ - btl_endpoint->peer_addr, /* remote addr */ - remote_address, remote_handle->rkey, /* remote buffer */ - fi_datatype, fi_op, comp); - - if (rc == -FI_EAGAIN) { - return OPAL_ERR_OUT_OF_RESOURCE; - } else if (rc < 0) { - BTL_ERROR(("fi_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); - MCA_BTL_OFI_ABORT(); - } - - MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); - - return OPAL_SUCCESS; -} - -int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - int rc; - int fi_datatype = FI_UINT64; - - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; - mca_btl_ofi_context_t *ofi_context; - - ofi_context = get_ofi_context(ofi_btl); - - if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { - fi_datatype = FI_UINT32; - } - - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_CSWAP); - - /* copy the operand because it might get freed from upper layer */ - comp->operand = (uint64_t) value; - comp->compare = (uint64_t) compare; - - remote_address = (remote_address - (uint64_t) remote_handle->base_addr); - - /* perform atomic */ - rc = fi_compare_atomic(ofi_context->tx_ctx, - (void*) &comp->operand, 1, NULL, - (void*) &comp->compare, NULL, - local_address, local_handle->desc, - btl_endpoint->peer_addr, - remote_address, remote_handle->rkey, - fi_datatype, - FI_CSWAP, - comp); - - if (rc == -FI_EAGAIN) { - return OPAL_ERR_OUT_OF_RESOURCE; - } else if (rc < 0) { - BTL_ERROR(("fi_compare_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); - MCA_BTL_OFI_ABORT(); - } - - MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c deleted file mode 100644 index 1ee541afb36..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ /dev/null @@ -1,681 +0,0 @@ -/* -*- 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) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "opal_config.h" - -#include "opal/mca/btl/btl.h" -#include "opal/mca/btl/base/base.h" -#include "opal/mca/hwloc/base/base.h" - -#include - -#include "btl_ofi.h" -#include "btl_ofi_endpoint.h" -#include "btl_ofi_rdma.h" - -#define MCA_BTL_OFI_REQUIRED_CAPS (FI_RMA | FI_ATOMIC) -#define MCA_BTL_OFI_REQUESTED_MR_MODE (FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_VIRT_ADDR) - -static char *prov_include; -static char *prov_exclude; -static char *ofi_progress_mode; -static bool disable_sep; -static int mca_btl_ofi_init_device(struct fi_info *info); - -/* validate information returned from fi_getinfo(). - * return OPAL_ERROR if we dont have what we need. */ -static int validate_info(struct fi_info *info) -{ - int mr_mode; - - BTL_VERBOSE(("validating device: %s", info->domain_attr->name)); - - /* we need exactly all the required bits */ - if ((info->caps & MCA_BTL_OFI_REQUIRED_CAPS) != MCA_BTL_OFI_REQUIRED_CAPS) { - BTL_VERBOSE(("unsupported caps")); - return OPAL_ERROR; - } - - /* we need FI_EP_RDM */ - if (info->ep_attr->type != FI_EP_RDM) { - BTL_VERBOSE(("unsupported EP type")); - return OPAL_ERROR; - } - - mr_mode = info->domain_attr->mr_mode; - - if (!(mr_mode == FI_MR_BASIC || mr_mode == FI_MR_SCALABLE || - (mr_mode & ~(FI_MR_VIRT_ADDR | FI_MR_ALLOCATED | FI_MR_PROV_KEY)) == 0)) { - BTL_VERBOSE(("unsupported MR mode")); - return OPAL_ERROR; - } - - if (!(info->tx_attr->op_flags | FI_DELIVERY_COMPLETE)) { - BTL_VERBOSE(("the endpoint tx_ctx does not support FI_DELIVERY_COMPLETE")); - return OPAL_ERROR; - } - - BTL_VERBOSE(("device: %s is good to go.", info->domain_attr->name)); - return OPAL_SUCCESS; -} - -/* Register the MCA parameters */ -static int mca_btl_ofi_component_register(void) -{ - mca_btl_ofi_module_t *module = &mca_btl_ofi_module_template; - - /* fi_getinfo with prov_name == NULL means ALL provider. - * Since now we are using the first valid info returned, I'm not sure - * if we need to provide the support for comma limited provider list. */ - prov_include = NULL; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "provider_include", - "OFI provider that ofi btl will query for. This parameter only " - "accept ONE provider name. " - "(e.g., \"psm2\"; an empty value means that all providers will " - "be considered.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_4, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_include); - - /* TODO: this param has not been implemented. Not sure if we need it. " */ - prov_exclude = NULL; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "provider_exclude", - "Comma-delimited list of OFI providers that are not considered for use " - "(default: \"sockets,mxm\"; empty value means that all providers will " - " be considered). " - "Mutually exclusive with btl_ofi_provider_include.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_4, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_exclude); - - mca_btl_ofi_component.num_cqe_read = MCA_BTL_OFI_NUM_CQE_READ; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "num_cq_read", - "Number of completion entries to read from a single cq_read. ", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_btl_ofi_component.num_cqe_read); - - ofi_progress_mode = "unspec"; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "progress_mode", - "requested provider progress mode. [unspec, auto, manual]" - "(default: unspec)", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &ofi_progress_mode); - - mca_btl_ofi_component.num_contexts_per_module = 1; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "num_contexts_per_module", - "number of communication context per module to create. " - "This should increase multithreaded performance but it is " - "advised that this number should be lower than total cores.", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_btl_ofi_component.num_contexts_per_module); - - disable_sep = false; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "disable_sep", - "force btl/ofi to never use scalable endpoint. ", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &disable_sep); - - mca_btl_ofi_component.progress_threshold = MCA_BTL_OFI_PROGRESS_THRESHOLD; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "progress_threshold", - "number of outstanding operation before btl will progress " - "automatically. Tuning this might improve performance on " - "certain type of application.", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_5, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_btl_ofi_component.progress_threshold); - - /* for now we want this component to lose to btl/ugni and btl/vader */ - module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH - 50; - - return mca_btl_base_param_register (&mca_btl_ofi_component.super.btl_version, - &module->super); -} - -static int mca_btl_ofi_component_open(void) -{ - mca_btl_ofi_component.module_count = 0; - return OPAL_SUCCESS; -} - -/* - * component cleanup - sanity checking of queue lengths - */ -static int mca_btl_ofi_component_close(void) -{ - /* If we don't sleep, sockets provider freaks out. */ - sleep(1); - return OPAL_SUCCESS; -} - -void mca_btl_ofi_exit(void) -{ - BTL_ERROR(("BTL OFI will now abort.")); - exit(1); -} - -/* - * OFI component initialization: - * read interface list from kernel and compare against component parameters - * then create a BTL instance for selected interfaces - */ - -static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, bool enable_progress_threads, - bool enable_mpi_threads) -{ - /* for this BTL to be useful the interface needs to support RDMA and certain atomic operations */ - int rc; - uint64_t progress_mode; - unsigned resource_count = 0; - struct mca_btl_base_module_t **base_modules; - - BTL_VERBOSE(("initializing ofi btl")); - - /* Set up libfabric hints. */ - uint32_t libfabric_api; - libfabric_api = fi_version(); - - /* bail if OFI version is less than 1.5. */ - if (libfabric_api < FI_VERSION(1, 5)) { - BTL_VERBOSE(("ofi btl disqualified because OFI version < 1.5.")); - return NULL; - } - - struct fi_info *info, *info_list; - struct fi_info hints = {0}; - struct fi_ep_attr ep_attr = {0}; - struct fi_rx_attr rx_attr = {0}; - struct fi_tx_attr tx_attr = {0}; - struct fi_fabric_attr fabric_attr = {0}; - struct fi_domain_attr domain_attr = {0}; - - /* Select the provider */ - fabric_attr.prov_name = prov_include; - - domain_attr.mr_mode = MCA_BTL_OFI_REQUESTED_MR_MODE; - - /* message progression mode. */ - if (!strcmp(ofi_progress_mode, "auto")) { - progress_mode = FI_PROGRESS_AUTO; - } else if (!strcmp(ofi_progress_mode, "manual")) { - progress_mode = FI_PROGRESS_MANUAL; - } else { - progress_mode = FI_PROGRESS_UNSPEC; - } - - domain_attr.control_progress = progress_mode; - domain_attr.data_progress = progress_mode; - - /* select endpoint type */ - ep_attr.type = FI_EP_RDM; - - /* ask for capabilities */ - hints.caps = MCA_BTL_OFI_REQUIRED_CAPS; - - /* Ask for completion context */ - hints.mode = FI_CONTEXT; - - hints.fabric_attr = &fabric_attr; - hints.domain_attr = &domain_attr; - hints.ep_attr = &ep_attr; - hints.tx_attr = &tx_attr; - hints.rx_attr = &rx_attr; - - /* for now */ - tx_attr.iov_limit = 1; - rx_attr.iov_limit = 1; - - tx_attr.op_flags = FI_DELIVERY_COMPLETE; - - mca_btl_ofi_component.module_count = 0; - - /* do the query. */ - rc = fi_getinfo(FI_VERSION(1, 5), NULL, NULL, 0, &hints, &info_list); - if (0 != rc) { - BTL_VERBOSE(("fi_getinfo failed with code %d: %s",rc, fi_strerror(-rc))); - return NULL; - } - - /* count the number of resources/ */ - info = info_list; - while(info) { - resource_count++; - info = info->next; - } - BTL_VERBOSE(("ofi btl found %d possible resources.", resource_count)); - - info = info_list; - - while(info) { - rc = validate_info(info); - if (OPAL_SUCCESS == rc) { - /* Device passed sanity check, let's make a module. - * We only pick the first device we found valid */ - rc = mca_btl_ofi_init_device(info); - if (OPAL_SUCCESS == rc) - break; - } - info = info->next; - } - - /* We are done with the returned info. */ - fi_freeinfo(info_list); - - /* pass module array back to caller */ - base_modules = calloc (mca_btl_ofi_component.module_count, sizeof (*base_modules)); - if (NULL == base_modules) { - return NULL; - } - - memcpy(base_modules, mca_btl_ofi_component.modules, - mca_btl_ofi_component.module_count *sizeof (mca_btl_ofi_component.modules[0])); - - BTL_VERBOSE(("ofi btl initialization complete. found %d suitable transports", - mca_btl_ofi_component.module_count)); - - *num_btl_modules = mca_btl_ofi_component.module_count; - - return base_modules; -} - -static int mca_btl_ofi_init_device(struct fi_info *info) -{ - int rc; - int *module_count = &mca_btl_ofi_component.module_count; - size_t namelen; - size_t num_contexts_to_create; - - char *linux_device_name; - char ep_name[FI_NAME_MAX]; - - struct fi_info *ofi_info; - struct fi_ep_attr *ep_attr; - struct fi_domain_attr *domain_attr; - struct fi_av_attr av_attr = {0}; - struct fid_fabric *fabric = NULL; - struct fid_domain *domain = NULL; - struct fid_ep *ep = NULL; - struct fid_av *av = NULL; - - mca_btl_ofi_module_t *module; - - /* allocate module */ - module = (mca_btl_ofi_module_t*) calloc(1, sizeof(mca_btl_ofi_module_t)); - if (NULL == module) { - BTL_ERROR(("failed to allocate memory for OFI module")); - goto fail; - } - *module = mca_btl_ofi_module_template; - - /* make a copy of the given info to store on the module */ - ofi_info = fi_dupinfo(info); - ep_attr = ofi_info->ep_attr; - domain_attr = ofi_info->domain_attr; - - linux_device_name = info->domain_attr->name; - BTL_VERBOSE(("initializing dev:%s provider:%s", - linux_device_name, - info->fabric_attr->prov_name)); - - /* fabric */ - rc = fi_fabric(ofi_info->fabric_attr, &fabric, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_fabric with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - /* domain */ - rc = fi_domain(fabric, ofi_info, &domain, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_domain with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - /* AV */ - av_attr.type = FI_AV_MAP; - rc = fi_av_open(domain, &av_attr, &av, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_av_open with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - num_contexts_to_create = mca_btl_ofi_component.num_contexts_per_module; - - /* If the domain support scalable endpoint. */ - if (domain_attr->max_ep_tx_ctx > 1 && !disable_sep) { - - BTL_VERBOSE(("btl/ofi using scalable endpoint.")); - - if (num_contexts_to_create > domain_attr->max_ep_tx_ctx) { - BTL_VERBOSE(("cannot create requested %u contexts. (node max=%zu)", - module->num_contexts, - domain_attr->max_ep_tx_ctx)); - goto fail; - } - - /* modify the info to let the provider know we are creating x contexts */ - ep_attr->tx_ctx_cnt = num_contexts_to_create; - ep_attr->rx_ctx_cnt = num_contexts_to_create; - - /* create scalable endpoint */ - rc = fi_scalable_ep(domain, ofi_info, &ep, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_scalable_ep with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - module->num_contexts = num_contexts_to_create; - module->is_scalable_ep = true; - - /* create contexts */ - module->contexts = mca_btl_ofi_context_alloc_scalable(ofi_info, - domain, ep, av, - num_contexts_to_create); - - } else { - /* warn the user if they want more than 1 context */ - if (num_contexts_to_create > 1) { - BTL_ERROR(("cannot create %zu contexts as the provider does not support " - "scalable endpoint. Falling back to single context endpoint.", - num_contexts_to_create)); - } - - BTL_VERBOSE(("btl/ofi using normal endpoint.")); - - rc = fi_endpoint(domain, ofi_info, &ep, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_endpoint with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - module->num_contexts = 1; - module->is_scalable_ep = false; - - /* create contexts */ - module->contexts = mca_btl_ofi_context_alloc_normal(ofi_info, - domain, ep, av); - } - - if (NULL == module->contexts) { - /* error message is already printed */ - goto fail; - } - - /* enable the endpoint for using */ - rc = fi_enable(ep); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_enable with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - /* Everything succeeded, lets create a module for this device. */ - /* store the information. */ - module->fabric_info = ofi_info; - module->fabric = fabric; - module->domain = domain; - module->av = av; - module->ofi_endpoint = ep; - module->linux_device_name = linux_device_name; - module->outstanding_rdma = 0; - module->use_virt_addr = false; - - if (ofi_info->domain_attr->mr_mode == FI_MR_BASIC || - ofi_info->domain_attr->mr_mode & FI_MR_VIRT_ADDR) { - module->use_virt_addr = true; - } - - /* initialize the rcache */ - mca_btl_ofi_rcache_init(module); - - /* create endpoint list */ - OBJ_CONSTRUCT(&module->endpoints, opal_list_t); - OBJ_CONSTRUCT(&module->module_lock, opal_mutex_t); - - /* create and send the modex for this device */ - namelen = sizeof(ep_name); - rc = fi_getname((fid_t)ep, &ep_name[0], &namelen); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_getname with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto fail; - } - - /* post our endpoint name so peer can use it to connect to us */ - OPAL_MODEX_SEND(rc, - OPAL_PMIX_GLOBAL, - &mca_btl_ofi_component.super.btl_version, - &ep_name, - namelen); - mca_btl_ofi_component.namelen = namelen; - - /* add this module to the list */ - mca_btl_ofi_component.modules[(*module_count)++] = module; - - return OPAL_SUCCESS; - -fail: - /* clean up */ - - /* if the contexts have not been initiated, num_contexts should - * be zero and we skip this. */ - for (int i=0; i < module->num_contexts; i++) { - mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep); - } - free(module->contexts); - - if (NULL != av) { - fi_close(&av->fid); - } - - if (NULL != ep) { - fi_close(&ep->fid); - } - - if (NULL != domain) { - fi_close(&domain->fid); - } - - if (NULL != fabric) { - fi_close(&fabric->fid); - } - free(module); - - /* not really a failure. just skip this device. */ - return OPAL_ERR_OUT_OF_RESOURCE; -} - -/** - * @brief OFI BTL progress function - * - * This function explictly progresses all workers. - */ -static int mca_btl_ofi_component_progress (void) -{ - int events = 0; - mca_btl_ofi_context_t *context; - - for (int i = 0 ; i < mca_btl_ofi_component.module_count ; ++i) { - mca_btl_ofi_module_t *module = mca_btl_ofi_component.modules[i]; - - /* progress context we own first. */ - context = get_ofi_context(module); - - if (mca_btl_ofi_context_trylock(context)) { - events += mca_btl_ofi_context_progress(context); - mca_btl_ofi_context_unlock(context); - } - - /* if there is nothing to do, try progress other's. */ - if (events == 0) { - for (int j = 0 ; j < module->num_contexts ; j++ ) { - - context = get_ofi_context_rr(module); - - if (mca_btl_ofi_context_trylock(context)) { - events += mca_btl_ofi_context_progress(context); - mca_btl_ofi_context_unlock(context); - } - - /* If we did something, good enough. return now. - * This is crucial for performance/latency. */ - if (events > 0) { - break; - } - } - } - } - - return events; -} - -int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context) { - - int ret = 0; - int events_read; - int events = 0; - struct fi_cq_entry cq_entry[MCA_BTL_OFI_MAX_CQ_READ_ENTRIES]; - struct fi_cq_err_entry cqerr = {0}; - - mca_btl_ofi_completion_t *comp; - - ret = fi_cq_read(context->cq, &cq_entry, mca_btl_ofi_component.num_cqe_read); - - if (0 < ret) { - events_read = ret; - for (int i = 0; i < events_read; i++) { - if (NULL != cq_entry[i].op_context) { - ++events; - comp = (mca_btl_ofi_completion_t*) cq_entry[i].op_context; - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*)comp->btl; - - switch (comp->type) { - case MCA_BTL_OFI_TYPE_GET: - case MCA_BTL_OFI_TYPE_PUT: - case MCA_BTL_OFI_TYPE_AOP: - case MCA_BTL_OFI_TYPE_AFOP: - case MCA_BTL_OFI_TYPE_CSWAP: - - /* call the callback */ - if (comp->cbfunc) { - comp->cbfunc (comp->btl, comp->endpoint, - comp->local_address, comp->local_handle, - comp->cbcontext, comp->cbdata, OPAL_SUCCESS); - } - - /* return the completion handler */ - opal_free_list_return(comp->my_list, (opal_free_list_item_t*) comp); - - MCA_BTL_OFI_NUM_RDMA_DEC(ofi_btl); - break; - - default: - /* catasthrophic */ - BTL_ERROR(("unknown completion type")); - MCA_BTL_OFI_ABORT(); - } - } - } - } else if (OPAL_UNLIKELY(ret == -FI_EAVAIL)) { - ret = fi_cq_readerr(context->cq, &cqerr, 0); - - /* cq readerr failed!? */ - if (0 > ret) { - BTL_ERROR(("%s:%d: Error returned from fi_cq_readerr: %s(%d)", - __FILE__, __LINE__, fi_strerror(-ret), ret)); - } else { - BTL_ERROR(("fi_cq_readerr: (provider err_code = %d)\n", - cqerr.prov_errno)); - } - MCA_BTL_OFI_ABORT(); - } -#ifdef FI_EINTR - /* sometimes, sockets provider complain about interupt. We do nothing. */ - else if (OPAL_UNLIKELY(ret == -FI_EINTR)) { - - } -#endif - /* If the error is not FI_EAGAIN, report the error and abort. */ - else if (OPAL_UNLIKELY(ret != -FI_EAGAIN)) { - BTL_ERROR(("fi_cq_read returned error %d:%s", ret, fi_strerror(-ret))); - MCA_BTL_OFI_ABORT(); - } - - return events; -} - -/** OFI btl component */ -mca_btl_ofi_component_t mca_btl_ofi_component = { - .super = { - .btl_version = { - MCA_BTL_DEFAULT_VERSION("ofi"), - .mca_open_component = mca_btl_ofi_component_open, - .mca_close_component = mca_btl_ofi_component_close, - .mca_register_component_params = mca_btl_ofi_component_register, - }, - .btl_data = { - /* The component is not checkpoint ready */ - .param_field = MCA_BASE_METADATA_PARAM_NONE - }, - - .btl_init = mca_btl_ofi_component_init, - .btl_progress = mca_btl_ofi_component_progress, - }, -}; diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.c b/opal/mca/btl/ofi/btl_ofi_endpoint.c deleted file mode 100644 index 0ef91a9b6ff..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_endpoint.c +++ /dev/null @@ -1,343 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_ofi.h" -#include "btl_ofi_endpoint.h" -#include "opal/util/proc.h" - -#if OPAL_HAVE_THREAD_LOCAL -opal_thread_local mca_btl_ofi_context_t *my_context = NULL; -#endif /* OPAL_HAVE_THREAD_LOCAL */ - -static void mca_btl_ofi_endpoint_construct (mca_btl_ofi_endpoint_t *endpoint) -{ - endpoint->peer_addr = 0; - OBJ_CONSTRUCT(&endpoint->ep_lock, opal_mutex_t); -} - -static void mca_btl_ofi_endpoint_destruct (mca_btl_ofi_endpoint_t *endpoint) -{ - endpoint->peer_addr = 0; - - /* set to null, we will free ofi endpoint in module */ - endpoint->ofi_endpoint = NULL; - - OBJ_DESTRUCT(&endpoint->ep_lock); -} - -OBJ_CLASS_INSTANCE(mca_btl_ofi_endpoint_t, opal_list_item_t, - mca_btl_ofi_endpoint_construct, - mca_btl_ofi_endpoint_destruct); - -mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep) -{ - mca_btl_ofi_endpoint_t *endpoint = OBJ_NEW(mca_btl_ofi_endpoint_t); - - if (OPAL_UNLIKELY(NULL == endpoint)) { - return NULL; - } - - endpoint->ep_proc = proc; - endpoint->ofi_endpoint = ep; - - return (mca_btl_base_endpoint_t *) endpoint; -} - -int ofi_comp_list_init(opal_free_list_t *comp_list) -{ - int rc; - OBJ_CONSTRUCT(comp_list, opal_free_list_t); - rc = opal_free_list_init(comp_list, - sizeof(mca_btl_ofi_completion_t), - opal_cache_line_size, - OBJ_CLASS(mca_btl_ofi_completion_t), - 0, - 0, - 128, - -1, - 128, - NULL, - 0, - NULL, - NULL, - NULL); - if (rc != OPAL_SUCCESS) { - BTL_VERBOSE(("cannot allocate completion freelist")); - } - return rc; -} - -/* mca_btl_ofi_context_alloc_normal() - * - * This function will allocate an ofi_context, map the endpoint to tx/rx context, - * bind CQ,AV to the endpoint and initialize all the structure. - * USE WITH NORMAL ENDPOINT ONLY */ -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *ep, - struct fid_av *av) -{ - int rc; - uint32_t cq_flags = FI_TRANSMIT; - char *linux_device_name = info->domain_attr->name; - - struct fi_cq_attr cq_attr = {0}; - - mca_btl_ofi_context_t *context; - - context = (mca_btl_ofi_context_t*) calloc(1, sizeof(*context)); - if (NULL == context) { - BTL_VERBOSE(("cannot allocate context")); - return NULL; - } - - /* Don't really need to check, just avoiding compiler warning because - * BTL_VERBOSE is a no op in performance build and the compiler will - * complain about unused variable. */ - if (NULL == linux_device_name) { - BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); - goto single_fail; - } - - cq_attr.format = FI_CQ_FORMAT_CONTEXT; - cq_attr.wait_obj = FI_WAIT_NONE; - rc = fi_cq_open(domain, &cq_attr, &context->cq, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_cq_open with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = fi_ep_bind(ep, (fid_t)av, 0); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = fi_ep_bind(ep, (fid_t)context->cq, cq_flags); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = ofi_comp_list_init(&context->comp_list); - if (rc != OPAL_SUCCESS) { - goto single_fail; - } - - context->tx_ctx = ep; - context->rx_ctx = ep; - context->context_id = 0; - - return context; - -single_fail: - mca_btl_ofi_context_finalize(context, false); - return NULL; -} - -/* mca_btl_ofi_context_alloc_scalable() - * - * This function allocate communication contexts and return the pointer - * to the first btl context. It also take care of all the bindings needed. - * USE WITH SCALABLE ENDPOINT ONLY */ -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *sep, - struct fid_av *av, - size_t num_contexts) -{ - BTL_VERBOSE(("creating %zu contexts", num_contexts)); - - int rc; - size_t i; - char *linux_device_name = info->domain_attr->name; - - struct fi_cq_attr cq_attr = {0}; - struct fi_tx_attr tx_attr = {0}; - struct fi_rx_attr rx_attr = {0}; - - mca_btl_ofi_context_t *contexts; - tx_attr.op_flags = FI_DELIVERY_COMPLETE; - - contexts = (mca_btl_ofi_context_t*) calloc(num_contexts, sizeof(*contexts)); - if (NULL == contexts) { - BTL_VERBOSE(("cannot allocate communication contexts.")); - return NULL; - } - - /* Don't really need to check, just avoiding compiler warning because - * BTL_VERBOSE is a no op in performance build and the compiler will - * complain about unused variable. */ - if (NULL == linux_device_name) { - BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); - goto scalable_fail; - } - - /* bind AV to endpoint */ - rc = fi_scalable_ep_bind(sep, (fid_t)av, 0); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - for (i=0; i < num_contexts; i++) { - rc = fi_tx_context(sep, i, &tx_attr, &contexts[i].tx_ctx, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_tx_context with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* We don't actually need a receiving context as we only do one-sided. - * However, sockets provider will hang if we dont have one. It is - * also nice to have equal number of tx/rx context. */ - rc = fi_rx_context(sep, i, &rx_attr, &contexts[i].rx_ctx, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_rx_context with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* create CQ */ - cq_attr.format = FI_CQ_FORMAT_CONTEXT; - cq_attr.wait_obj = FI_WAIT_NONE; - rc = fi_cq_open(domain, &cq_attr, &contexts[i].cq, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_cq_open with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* bind cq to transmit context */ - uint32_t cq_flags = (FI_TRANSMIT); - rc = fi_ep_bind(contexts[i].tx_ctx, (fid_t)contexts[i].cq, cq_flags); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* enable the context. */ - rc = fi_enable(contexts[i].tx_ctx); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_enable with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - rc = fi_enable(contexts[i].rx_ctx); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_enable with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* initialize completion freelist. */ - rc = ofi_comp_list_init(&contexts[i].comp_list); - if (rc != OPAL_SUCCESS) { - goto scalable_fail; - } - - /* assign the id */ - contexts[i].context_id = i; - } - - return contexts; - -scalable_fail: - /* close and free */ - for(i=0; i < num_contexts; i++) { - mca_btl_ofi_context_finalize(&contexts[i], true); - } - free(contexts); - - return NULL; -} - -void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep) { - - /* if it is a scalable ep, we have to close all contexts. */ - if (scalable_ep) { - if (NULL != context->tx_ctx) { - fi_close(&context->tx_ctx->fid); - } - - if (NULL != context->rx_ctx) { - fi_close(&context->rx_ctx->fid); - } - } - - if( NULL != context->cq) { - fi_close(&context->cq->fid); - } - - /* Can we destruct the object that hasn't been constructed? */ - OBJ_DESTRUCT(&context->comp_list); -} - -/* Get a context to use for communication. - * If TLS is supported, it will use the cached endpoint. - * If not, it will invoke the normal round-robin assignment. */ -mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl) -{ -#if OPAL_HAVE_THREAD_LOCAL - /* With TLS, we cache the context we use. */ - static volatile int64_t cur_num = 0; - - if (OPAL_UNLIKELY(my_context == NULL)) { - OPAL_THREAD_LOCK(&btl->module_lock); - - my_context = &btl->contexts[cur_num]; - cur_num = (cur_num + 1) %btl->num_contexts; - - OPAL_THREAD_UNLOCK(&btl->module_lock); - } - - assert (my_context); - return my_context; -#else - return get_ofi_context_rr(btl); -#endif -} - -/* return the context in a round-robin. */ -/* There is no need for atomics here as it might hurt the performance. */ -mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl) -{ - static volatile uint64_t rr_num = 0; - return &btl->contexts[rr_num++%btl->num_contexts]; -} diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.h b/opal/mca/btl/ofi/btl_ofi_endpoint.h deleted file mode 100644 index aad758d8c85..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_endpoint.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 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) 2017-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_BTL_OFI_ENDPOINT_H -#define MCA_BTL_OFI_ENDPOINT_H - -#include "opal/class/opal_list.h" -#include "opal/mca/event/event.h" - -#include "btl_ofi.h" - -BEGIN_C_DECLS - -#if OPAL_HAVE_THREAD_LOCAL -extern opal_thread_local mca_btl_ofi_context_t *my_context; -#endif /* OPAL_HAVE_THREAD_LOCAL */ - -struct mca_btl_base_endpoint_t { - opal_list_item_t super; - - struct fid_ep *ofi_endpoint; - fi_addr_t peer_addr; - - /** endpoint proc */ - opal_proc_t *ep_proc; - - /** mutex to protect this structure */ - opal_mutex_t ep_lock; -}; - -typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t; -typedef mca_btl_base_endpoint_t mca_btl_ofi_endpoint_t; -OBJ_CLASS_DECLARATION(mca_btl_ofi_endpoint_t); - -int ofi_comp_list_init(opal_free_list_t *comp_list); - -mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep); - -/* contexts */ -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *sep, - struct fid_av *av, - size_t num_contexts); - -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *ep, - struct fid_av *av); -void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep); - -mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl); -mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl); - -END_C_DECLS -#endif diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c deleted file mode 100644 index df6ae1e2e1a..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ /dev/null @@ -1,329 +0,0 @@ -/* -*- 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-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include -#include "opal/class/opal_bitmap.h" -#include "opal/mca/btl/btl.h" -#include "opal/datatype/opal_convertor.h" -#include "opal/mca/mpool/base/base.h" -#include "opal/mca/mpool/mpool.h" - -#include "btl_ofi.h" -#include "btl_ofi_endpoint.h" - -static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl, - size_t nprocs, opal_proc_t **opal_procs, - mca_btl_base_endpoint_t **peers, - opal_bitmap_t *reachable) -{ - int rc; - int count; - char *ep_name = NULL; - size_t namelen = mca_btl_ofi_component.namelen; - - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - - for (size_t i = 0 ; i < nprocs ; ++i) { - peers[i] = mca_btl_ofi_endpoint_create (opal_procs[i], ofi_btl->ofi_endpoint); - if (OPAL_UNLIKELY(NULL == peers[i])) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - OPAL_MODEX_RECV(rc, &mca_btl_ofi_component.super.btl_version, - &peers[i]->ep_proc->proc_name, (void **)&ep_name, &namelen); - if (OPAL_SUCCESS != rc) { - BTL_ERROR(("error receiving modex")); - MCA_BTL_OFI_ABORT(); - } - - /* get peer fi_addr */ - count = fi_av_insert(ofi_btl->av, /* Address vector to insert */ - ep_name, /* peer name */ - 1, /* amount to insert */ - &peers[i]->peer_addr, /* return peer address here */ - 0, /* flags */ - NULL); /* context */ - - /* if succeed, add this proc and mark reachable */ - if (count == 1) { /* we inserted 1 address. */ - opal_list_append (&ofi_btl->endpoints, &peers[i]->super); - opal_bitmap_set_bit(reachable, i); - } else { - BTL_VERBOSE(("fi_av_insert failed with rc = %d", count)); - MCA_BTL_OFI_ABORT(); - } - } - - return OPAL_SUCCESS; -} - -static int mca_btl_ofi_del_procs (mca_btl_base_module_t *btl, size_t nprocs, - opal_proc_t **procs, mca_btl_base_endpoint_t **peers) -{ - int ret; - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - - for (size_t i = 0 ; i < nprocs ; ++i) { - if (peers[i]) { - - /* remove the address from AV. */ - ret = fi_av_remove(ofi_btl->av, &peers[i]->peer_addr, 1, 0); - if (ret < 0) { - /* remove failed. this should not happen. */ - /* Lets not crash because we failed to remove an address. */ - BTL_ERROR(("fi_av_remove failed with error %d:%s", - ret, fi_strerror(-ret))); - } - - /* remove and free MPI endpoint from the list. */ - opal_list_remove_item (&ofi_btl->endpoints, &peers[i]->super); - OBJ_RELEASE(peers[i]); - } - } - - return OPAL_SUCCESS; -} - -void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module) -{ - if (!module->initialized) { - mca_rcache_base_resources_t rcache_resources; - char *tmp; - - (void) asprintf (&tmp, "ofi.%s", module->linux_device_name); - - rcache_resources.cache_name = tmp; - rcache_resources.reg_data = (void *) module; - rcache_resources.sizeof_reg = sizeof (mca_btl_ofi_reg_t); - rcache_resources.register_mem = mca_btl_ofi_reg_mem; - rcache_resources.deregister_mem = mca_btl_ofi_dereg_mem; - - module->rcache = mca_rcache_base_module_create ("grdma", module, &rcache_resources); - free (tmp); - - if (NULL == module->rcache) { - /* something when horribly wrong */ - BTL_ERROR(("cannot create rcache")); - MCA_BTL_OFI_ABORT(); - } - - module->initialized = true; - } -} - - -/** - * @brief Register a memory region for put/get/atomic operations. - * - * @param btl (IN) BTL 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 - * - * @returns a memory registration handle valid for both local and remote operations - * @returns NULL if the region could not be registered - * - * This function registers the specified region with the hardware for use with - * the btl_put, btl_get, btl_atomic_cas, btl_atomic_op, and btl_atomic_fop - * functions. Care should be taken to not hold an excessive number of registrations - * as they may use limited system/NIC resources. - */ -static struct mca_btl_base_registration_handle_t * -mca_btl_ofi_register_mem (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *base, - size_t size, uint32_t flags) -{ - mca_btl_ofi_module_t *ofi_module = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_reg_t *reg; - int access_flags = flags & MCA_BTL_REG_FLAG_ACCESS_ANY; - int rc; - - rc = ofi_module->rcache->rcache_register (ofi_module->rcache, base, size, 0, access_flags, - (mca_rcache_base_registration_t **) ®); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - return NULL; - } - - return ®->handle; -} - -/** - * @brief Deregister a memory region - * - * @param btl (IN) BTL module region was registered with - * @param handle (IN) BTL registration handle to deregister - * - * This function deregisters the memory region associated with the specified handle. Care - * should be taken to not perform any RDMA or atomic operation on this memory region - * after it is deregistered. It is erroneous to specify a memory handle associated with - * a remote node. - */ -static int mca_btl_ofi_deregister_mem (mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle) -{ - mca_btl_ofi_module_t *ofi_module = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_reg_t *reg = - (mca_btl_ofi_reg_t *)((intptr_t) handle - offsetof (mca_btl_ofi_reg_t, handle)); - - (void) ofi_module->rcache->rcache_deregister (ofi_module->rcache, ®->base); - - return OPAL_SUCCESS; -} - -int mca_btl_ofi_reg_mem (void *reg_data, void *base, size_t size, mca_rcache_base_registration_t *reg) -{ - int rc; - static uint64_t access_flags = FI_REMOTE_WRITE | FI_REMOTE_READ | FI_READ | FI_WRITE; - - mca_btl_ofi_module_t *btl = (mca_btl_ofi_module_t*) reg_data; - mca_btl_ofi_reg_t *ur = (mca_btl_ofi_reg_t*) reg; - - rc = fi_mr_reg(btl->domain, base, size, access_flags, 0, - (uint64_t) reg, 0, &ur->ur_mr, NULL); - if (0 != rc) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - ur->handle.rkey = fi_mr_key(ur->ur_mr); - ur->handle.desc = fi_mr_desc(ur->ur_mr); - - /* In case the provider doesn't support FI_MR_VIRT_ADDR, - * we need to reference the remote address by the distance from base registered - * address. We keep this information to use in rdma/atomic operations. */ - if (btl->use_virt_addr) { - ur->handle.base_addr = 0; - } else { - ur->handle.base_addr = base; - } - - return OPAL_SUCCESS; -} - -int mca_btl_ofi_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg) -{ - mca_btl_ofi_reg_t *ur = (mca_btl_ofi_reg_t*)reg; - - if (ur->ur_mr != NULL) { - if (0 != fi_close(&ur->ur_mr->fid)) { - BTL_ERROR(("%s: error unpinning memory mr=%p: %s", - __func__, (void*) ur->ur_mr, strerror(errno))); - return OPAL_ERROR; - } - } - - return OPAL_SUCCESS; -} - -/* - * Cleanup/release module resources. - */ - -int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) -{ - int i; - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *endpoint, *next; - - assert(btl); - - /* loop over all the contexts */ - for (i=0; i < ofi_btl->num_contexts; i++) { - mca_btl_ofi_context_finalize(&ofi_btl->contexts[i], ofi_btl->is_scalable_ep); - } - free(ofi_btl->contexts); - - if (NULL != ofi_btl->av) { - fi_close(&ofi_btl->av->fid); - } - - if (NULL != ofi_btl->ofi_endpoint) { - fi_close(&ofi_btl->ofi_endpoint->fid); - } - - if (NULL != ofi_btl->domain) { - fi_close(&ofi_btl->domain->fid); - } - - if (NULL != ofi_btl->fabric) { - fi_close(&ofi_btl->fabric->fid); - } - - if (NULL != ofi_btl->fabric_info) { - fi_freeinfo(ofi_btl->fabric_info); - } - - /* clean up any leftover endpoints */ - OPAL_LIST_FOREACH_SAFE(endpoint, next, &ofi_btl->endpoints, mca_btl_ofi_endpoint_t) { - opal_list_remove_item (&ofi_btl->endpoints, &endpoint->super); - OBJ_RELEASE(endpoint); - } - - OBJ_DESTRUCT(&ofi_btl->endpoints); - - if (ofi_btl->rcache) { - mca_rcache_base_module_destroy (ofi_btl->rcache); - } - - free (btl); - - return OPAL_SUCCESS; -} - -mca_btl_ofi_module_t mca_btl_ofi_module_template = { - .super = { - /* initialize functions. this btl only support RDMA and atomics - * for now so it does not provide prepare_src, alloc, free, or send */ - .btl_component = &mca_btl_ofi_component.super, - .btl_add_procs = mca_btl_ofi_add_procs, - .btl_del_procs = mca_btl_ofi_del_procs, - .btl_finalize = mca_btl_ofi_finalize, - .btl_put = mca_btl_ofi_put, - .btl_get = mca_btl_ofi_get, - .btl_register_mem = mca_btl_ofi_register_mem, - .btl_deregister_mem = mca_btl_ofi_deregister_mem, - .btl_atomic_op = mca_btl_ofi_aop, - .btl_atomic_fop = mca_btl_ofi_afop, - .btl_atomic_cswap = mca_btl_ofi_acswap, - .btl_flush = mca_btl_ofi_flush, - - /* set the default flags for this btl. ofi provides us with rdma and both - * fetching and non-fetching atomics (though limited to add and cswap) */ - .btl_flags = MCA_BTL_FLAGS_RDMA | - MCA_BTL_FLAGS_ATOMIC_FOPS | - MCA_BTL_FLAGS_ATOMIC_OPS, - - .btl_atomic_flags = MCA_BTL_ATOMIC_SUPPORTS_ADD | - MCA_BTL_ATOMIC_SUPPORTS_SWAP | - MCA_BTL_ATOMIC_SUPPORTS_CSWAP | - MCA_BTL_ATOMIC_SUPPORTS_32BIT, - - /* set the default limits on put and get */ - .btl_registration_handle_size = sizeof(mca_btl_base_registration_handle_t), - .btl_put_limit = 1 << 23, - .btl_put_alignment = 0, - .btl_get_limit = 1 << 23, - .btl_get_alignment = 0, - } -}; diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.c b/opal/mca/btl/ofi/btl_ofi_rdma.c deleted file mode 100644 index 9a545038a4d..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_rdma.c +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "btl_ofi_rdma.h" - -OBJ_CLASS_INSTANCE(mca_btl_ofi_completion_t, - opal_free_list_item_t, - NULL, - NULL); - -mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( - mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - mca_btl_ofi_context_t *ofi_context, - void *local_address, - mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_rdma_completion_fn_t cbfunc, - void *cbcontext, void *cbdata, - int type) -{ - assert(btl); - assert(endpoint); - assert(ofi_context); - - mca_btl_ofi_completion_t *comp; - - comp = (mca_btl_ofi_completion_t*) opal_free_list_get(&ofi_context->comp_list); - assert(comp); - - comp->btl = btl; - comp->endpoint = endpoint; - comp->my_context = ofi_context; - comp->local_address = local_address; - comp->local_handle = local_handle; - comp->cbfunc = cbfunc; - comp->cbcontext = cbcontext; - comp->cbdata = cbdata; - comp->my_list = &ofi_context->comp_list; - comp->type = type; - - return comp; -} - -int mca_btl_ofi_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - - int rc; - - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp; - mca_btl_ofi_context_t *ofi_context; - - ofi_context = get_ofi_context(ofi_btl); - - /* create completion context */ - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_GET); - - remote_address = (remote_address - (uint64_t) remote_handle->base_addr); - - /* Remote write data across the wire */ - rc = fi_read(ofi_context->tx_ctx, - local_address, size, /* payload */ - local_handle->desc, - btl_endpoint->peer_addr, - remote_address, remote_handle->rkey, - comp); /* completion context */ - - if (-FI_EAGAIN == rc) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - if (0 != rc) { - BTL_ERROR(("fi_read failed with %d:%s", rc, fi_strerror(-rc))); - MCA_BTL_OFI_ABORT(); - } - - MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); - - return OPAL_SUCCESS; -} - -int mca_btl_ofi_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, - uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, - int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) -{ - int rc; - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_context_t *ofi_context; - - ofi_context = get_ofi_context(ofi_btl); - - /* create completion context */ - mca_btl_ofi_completion_t *comp; - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_PUT); - - remote_address = (remote_address - (uint64_t) remote_handle->base_addr); - - /* Remote write data across the wire */ - rc = fi_write(ofi_context->tx_ctx, - local_address, size, /* payload */ - local_handle->desc, - btl_endpoint->peer_addr, - remote_address, remote_handle->rkey, - comp); /* completion context */ - - if (-FI_EAGAIN == rc) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - if (0 != rc) { - BTL_ERROR(("fi_write failed with %d:%s", rc, fi_strerror(-rc))); - MCA_BTL_OFI_ABORT(); - } - - MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); - - return OPAL_SUCCESS; - -} - -int mca_btl_ofi_flush (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint) -{ - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; - - while(ofi_btl->outstanding_rdma > 0) { - (void) mca_btl_ofi_component.super.btl_progress(); - } - - return OPAL_SUCCESS; -} diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.h b/opal/mca/btl/ofi/btl_ofi_rdma.h deleted file mode 100644 index 3de42454395..00000000000 --- a/opal/mca/btl/ofi/btl_ofi_rdma.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2018 Intel, Inc, All rights reserved - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef BTL_OFI_RDMA_H -#define BTL_OFI_RDMA_H - -#include "opal/threads/thread_usage.h" - -#include "btl_ofi.h" -#include "btl_ofi_endpoint.h" - -mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( - mca_btl_base_module_t *btl, - mca_btl_base_endpoint_t *endpoint, - mca_btl_ofi_context_t *ofi_context, - void *local_address, - mca_btl_base_registration_handle_t *local_handle, - mca_btl_base_rdma_completion_fn_t cbfunc, - void *cbcontext, void *cbdata, - int type); - -#define MCA_BTL_OFI_NUM_RDMA_INC(module) \ - OPAL_THREAD_ADD_FETCH64(&(module)->outstanding_rdma, 1); \ - if (module->outstanding_rdma > mca_btl_ofi_component.progress_threshold){ \ - mca_btl_ofi_component.super.btl_progress(); \ - } - -#define MCA_BTL_OFI_NUM_RDMA_DEC(module) \ - OPAL_THREAD_ADD_FETCH64(&(module)->outstanding_rdma, -1); - -#endif /* !defined(BTL_OFI_RDMA_H) */ - diff --git a/opal/mca/btl/ofi/configure.m4 b/opal/mca/btl/ofi/configure.m4 deleted file mode 100644 index 222a7b29e03..00000000000 --- a/opal/mca/btl/ofi/configure.m4 +++ /dev/null @@ -1,51 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 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-2006 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2006 QLogic Corp. All rights reserved. -# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011-2018 Los Alamos National Security, LLC. -# All rights reserved. -# Copyright (c) 2018 Intel, inc. All rights reserved -# -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# OPAL_CHECK_OFI(prefix, [action-if-found], [action-if-not-found]) -# -------------------------------------------------------- -# check if OFI support can be found. sets prefix_{CPPFLAGS, -# LDFLAGS, LIBS} as needed and runs action-if-found if there is -# support, otherwise executes action-if-not-found - -AC_DEFUN([MCA_opal_btl_ofi_CONFIG],[ - OPAL_VAR_SCOPE_PUSH([opal_btl_ofi_happy CPPFLAGS_save]) - - AC_CONFIG_FILES([opal/mca/btl/ofi/Makefile]) - - AC_REQUIRE([MCA_opal_common_ofi_CONFIG]) - - opal_btl_ofi_happy=0 - AS_IF([test "$opal_common_ofi_happy" = "yes"], - [CPPFLAGS_save=$CPPFLAGS - CPPFLAGS="$opal_common_ofi_CPPFLAGS $CPPFLAGS" - AC_CHECK_DECL([FI_MR_VIRT_ADDR], [opal_btl_ofi_happy=1], [], - [#include ]) - CPPFLAGS=$CPPFLAGS_save]) - AS_IF([test $opal_btl_ofi_happy -eq 1], - [$1], - [$2]) - - OPAL_VAR_SCOPE_POP -])dnl diff --git a/opal/mca/btl/ofi/owner.txt b/opal/mca/btl/ofi/owner.txt deleted file mode 100644 index f58f1cbab7e..00000000000 --- a/opal/mca/btl/ofi/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner:Intel -status:active From 9e1d18090cb54fe304b45a1095553f5f1f110141 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 21 Sep 2018 08:45:35 -0600 Subject: [PATCH 095/674] NEWS: update for user reported issue [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 32db37eb235..3437cdfc67a 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,9 @@ included in the vX.Y.Z section and be denoted as: Requested by Axel Huebl. - Fix a problem with building the Java bindings when using Java 10. Thanks to Bryce Glover for reporting. +- Fix a problem with ORTE not reporting error messages if an application + terminated normally but exited with non-zero error code. Thanks to + Emre Brookes for reporting. 3.1.2 -- August, 2018 ------------------------ From 2e37f97a389a21b19c003f36041854c98930c903 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 24 Aug 2018 07:39:14 -0700 Subject: [PATCH 096/674] Miscellaneous compiler warning stomps. Signed-off-by: Jeff Squyres (cherry picked from commit fe0852bcb4d14a6aaf5a3e1021f60b5be32dd42d) --- ompi/mca/pml/ucx/pml_ucx.c | 13 +++++++------ ompi/mca/pml/ucx/pml_ucx_request.c | 2 +- ompi/mca/pml/ucx/pml_ucx_request.h | 2 +- opal/mca/btl/tcp/btl_tcp_proc.c | 2 +- opal/mca/btl/uct/btl_uct_am.c | 2 +- opal/mca/common/ucx/common_ucx.h | 2 +- orte/tools/orte-top/orte-top.c | 2 +- oshmem/runtime/oshmem_shmem_init.c | 2 +- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 9cf9ff98c78..1f37212c58f 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -441,7 +441,7 @@ int mca_pml_ucx_irecv_init(void *buf, size_t count, ompi_datatype_t *datatype, req->flags = 0; req->buffer = buf; req->count = count; - req->datatype = mca_pml_ucx_get_datatype(datatype); + req->datatype.datatype = mca_pml_ucx_get_datatype(datatype); PML_UCX_MAKE_RECV_TAG(req->tag, req->recv.tag_mask, tag, src, comm); @@ -550,10 +550,10 @@ int mca_pml_ucx_isend_init(const void *buf, size_t count, ompi_datatype_t *datat req->send.mode = mode; req->send.ep = ep; if (MCA_PML_BASE_SEND_BUFFERED == mode) { - req->ompi_datatype = datatype; + req->datatype.ompi_datatype = datatype; OBJ_RETAIN(datatype); } else { - req->datatype = mca_pml_ucx_get_datatype(datatype); + req->datatype.datatype = mca_pml_ucx_get_datatype(datatype); } *request = &req->ompi; @@ -910,8 +910,8 @@ int mca_pml_ucx_start(size_t count, ompi_request_t** requests) tmp_req = (ompi_request_t*)mca_pml_ucx_common_send(preq->send.ep, preq->buffer, preq->count, - preq->ompi_datatype, - preq->datatype, + preq->datatype.ompi_datatype, + preq->datatype.datatype, preq->tag, preq->send.mode, mca_pml_ucx_psend_completion); @@ -919,7 +919,8 @@ int mca_pml_ucx_start(size_t count, ompi_request_t** requests) PML_UCX_VERBOSE(8, "start recv request %p", (void*)preq); tmp_req = (ompi_request_t*)ucp_tag_recv_nb(ompi_pml_ucx.ucp_worker, preq->buffer, preq->count, - preq->datatype, preq->tag, + preq->datatype.datatype, + preq->tag, preq->recv.tag_mask, mca_pml_ucx_precv_completion); } diff --git a/ompi/mca/pml/ucx/pml_ucx_request.c b/ompi/mca/pml/ucx/pml_ucx_request.c index 70b379f3eb8..8602386e0cd 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.c +++ b/ompi/mca/pml/ucx/pml_ucx_request.c @@ -176,7 +176,7 @@ static int mca_pml_ucx_persistent_request_free(ompi_request_t **rptr) } if ((preq->flags & MCA_PML_UCX_REQUEST_FLAG_SEND) && (MCA_PML_BASE_SEND_BUFFERED == preq->send.mode)) { - OBJ_RELEASE(preq->ompi_datatype); + OBJ_RELEASE(preq->datatype.ompi_datatype); } PML_UCX_FREELIST_RETURN(&ompi_pml_ucx.persistent_reqs, &preq->ompi.super); *rptr = MPI_REQUEST_NULL; diff --git a/ompi/mca/pml/ucx/pml_ucx_request.h b/ompi/mca/pml/ucx/pml_ucx_request.h index 9166f042ae9..cb53d30bcee 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.h +++ b/ompi/mca/pml/ucx/pml_ucx_request.h @@ -102,7 +102,7 @@ struct pml_ucx_persistent_request { union { ucp_datatype_t datatype; ompi_datatype_t *ompi_datatype; - }; + } datatype; ucp_tag_t tag; struct { mca_pml_base_send_mode_t mode; diff --git a/opal/mca/btl/tcp/btl_tcp_proc.c b/opal/mca/btl/tcp/btl_tcp_proc.c index b7bf95c14b1..28cf9a17789 100644 --- a/opal/mca/btl/tcp/btl_tcp_proc.c +++ b/opal/mca/btl/tcp/btl_tcp_proc.c @@ -413,7 +413,7 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc, { struct sockaddr_storage endpoint_addr_ss; const char *proc_hostname; - unsigned int perm_size; + unsigned int perm_size = 0; int rc, *a = NULL; size_t i, j; mca_btl_tcp_interface_t** peer_interfaces = NULL; diff --git a/opal/mca/btl/uct/btl_uct_am.c b/opal/mca/btl/uct/btl_uct_am.c index 6927f31c8cd..1c367691378 100644 --- a/opal/mca/btl/uct/btl_uct_am.c +++ b/opal/mca/btl/uct/btl_uct_am.c @@ -269,7 +269,7 @@ int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endp /* message with header */ const size_t msg_size = total_size + 8; mca_btl_uct_am_header_t am_header; - ucs_status_t ucs_status; + ucs_status_t ucs_status = UCS_OK; uct_ep_h ep_handle; int rc; diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 6825e4de642..4fa4b3b670b 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -122,7 +122,7 @@ int opal_common_ucx_wait_request(ucs_status_ptr_t request, ucp_worker_h worker, if (OPAL_LIKELY(UCS_OK == request)) { return OPAL_SUCCESS; } else if (OPAL_UNLIKELY(UCS_PTR_IS_ERR(request))) { - MCA_COMMON_UCX_VERBOSE(1, "%s failed: %d, %s", msg ? msg : __FUNCTION__, + MCA_COMMON_UCX_VERBOSE(1, "%s failed: %d, %s", msg ? msg : __func__, UCS_PTR_STATUS(request), ucs_status_string(UCS_PTR_STATUS(request))); return OPAL_ERROR; diff --git a/orte/tools/orte-top/orte-top.c b/orte/tools/orte-top/orte-top.c index 2111146b1ef..42e2f1f76fe 100644 --- a/orte/tools/orte-top/orte-top.c +++ b/orte/tools/orte-top/orte-top.c @@ -765,7 +765,7 @@ static void print_ranks(opal_list_t *statlist) opal_list_item_t *item; opal_pstats_t *stats, *pstats; int32_t minrank; - char pretty_time[10]; + char pretty_time[32]; int i; /* sort the results by rank */ diff --git a/oshmem/runtime/oshmem_shmem_init.c b/oshmem/runtime/oshmem_shmem_init.c index d1a187bf4d3..f1115810045 100644 --- a/oshmem/runtime/oshmem_shmem_init.c +++ b/oshmem/runtime/oshmem_shmem_init.c @@ -107,7 +107,7 @@ MPI_Comm oshmem_comm_world = {0}; opal_thread_t *oshmem_mpi_main_thread = NULL; -shmem_internal_mutex_t shmem_internal_mutex_alloc = {0}; +shmem_internal_mutex_t shmem_internal_mutex_alloc = {{0}}; shmem_ctx_t oshmem_ctx_default = NULL; From cd88e307fd5da0bac56c1c00461171e0620a58c1 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 7 Aug 2018 16:13:43 -0600 Subject: [PATCH 097/674] opal/progress: protect against multiple threads in event base libevent does not support multiple threads calling the event loop on the same event base. This causes external libevent's to print out re-entrant warning messages. This commit fixes the issue by protecting the call to the event loop with an atomic swap check. Signed-off-by: Nathan Hjelm --- opal/runtime/opal_progress.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opal/runtime/opal_progress.c b/opal/runtime/opal_progress.c index 24607ec71f8..8c88a32c67d 100644 --- a/opal/runtime/opal_progress.c +++ b/opal/runtime/opal_progress.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -171,9 +171,10 @@ opal_progress_finalize(void) static int opal_progress_events(void) { + static volatile int32_t lock = 0; int events = 0; - if( opal_progress_event_flag != 0 ) { + if( opal_progress_event_flag != 0 && !OPAL_THREAD_SWAP_32(&lock, 1) ) { #if OPAL_HAVE_WORKING_EVENTOPS #if OPAL_PROGRESS_USE_TIMERS #if OPAL_PROGRESS_ONLY_USEC_NATIVE @@ -201,6 +202,7 @@ static int opal_progress_events(void) #endif /* OPAL_PROGRESS_USE_TIMERS */ #endif /* OPAL_HAVE_WORKING_EVENTOPS */ + lock = 0; } return events; From 56e31f8206516d8ebbc07dbf45edc75a633d6cf4 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 23 Aug 2018 15:40:21 -0600 Subject: [PATCH 098/674] osc/rdma: clean out stale aggregation code The aggregation code in osc/rdma is currently broken and will likely not be reused. This commit cleans it out. Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma.h | 26 ----- ompi/mca/osc/rdma/osc_rdma_comm.c | 145 ------------------------- ompi/mca/osc/rdma/osc_rdma_component.c | 79 -------------- ompi/mca/osc/rdma/osc_rdma_peer.h | 12 +- ompi/mca/osc/rdma/osc_rdma_sync.c | 2 - ompi/mca/osc/rdma/osc_rdma_sync.h | 3 - ompi/mca/osc/rdma/osc_rdma_types.h | 36 +----- 7 files changed, 2 insertions(+), 301 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma.h b/ompi/mca/osc/rdma/osc_rdma.h index 277be1a1e90..b3743f261ec 100644 --- a/ompi/mca/osc/rdma/osc_rdma.h +++ b/ompi/mca/osc/rdma/osc_rdma.h @@ -77,9 +77,6 @@ struct ompi_osc_rdma_component_t { /** RDMA component buffer size */ unsigned int buffer_size; - /** aggregation limit */ - unsigned int aggregation_limit; - /** List of requests that need to be freed */ opal_list_t request_gc; @@ -104,9 +101,6 @@ struct ompi_osc_rdma_component_t { /** Priority of the osc/rdma component */ unsigned int priority; - /** aggregation free list */ - opal_free_list_t aggregate; - /** directory where to place backing files */ char *backing_directory; }; @@ -569,16 +563,6 @@ static inline void ompi_osc_rdma_sync_rdma_dec (ompi_osc_rdma_sync_t *rdma_sync) */ static inline void ompi_osc_rdma_sync_rdma_complete (ompi_osc_rdma_sync_t *sync) { - if (opal_list_get_size (&sync->aggregations)) { - ompi_osc_rdma_aggregation_t *aggregation, *next; - - OPAL_THREAD_SCOPED_LOCK(&sync->lock, - OPAL_LIST_FOREACH_SAFE(aggregation, next, &sync->aggregations, ompi_osc_rdma_aggregation_t) { - fprintf (stderr, "Flushing aggregation %p, peer %p\n", (void*)aggregation, (void*)aggregation->peer); - ompi_osc_rdma_peer_aggregate_flush (aggregation->peer); - }); - } - #if !defined(BTL_VERSION) || (BTL_VERSION < 310) do { opal_progress (); @@ -611,16 +595,6 @@ static inline bool ompi_osc_rdma_access_epoch_active (ompi_osc_rdma_module_t *mo return (module->all_sync.epoch_active || ompi_osc_rdma_in_passive_epoch (module)); } -static inline void ompi_osc_rdma_aggregation_return (ompi_osc_rdma_aggregation_t *aggregation) -{ - if (aggregation->sync) { - opal_list_remove_item (&aggregation->sync->aggregations, (opal_list_item_t *) aggregation); - } - - opal_free_list_return(&mca_osc_rdma_component.aggregate, (opal_free_list_item_t *) aggregation); -} - - __opal_attribute_always_inline__ static inline bool ompi_osc_rdma_oor (int rc) { diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.c b/ompi/mca/osc/rdma/osc_rdma_comm.c index 4e3736d9515..1c166767783 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.c +++ b/ompi/mca/osc/rdma/osc_rdma_comm.c @@ -434,28 +434,6 @@ static void ompi_osc_rdma_put_complete_flush (struct mca_btl_base_module_t *btl, } } -static void ompi_osc_rdma_aggregate_put_complete (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, - void *local_address, mca_btl_base_registration_handle_t *local_handle, - void *context, void *data, int status) -{ - ompi_osc_rdma_aggregation_t *aggregation = (ompi_osc_rdma_aggregation_t *) context; - ompi_osc_rdma_sync_t *sync = aggregation->sync; - ompi_osc_rdma_frag_t *frag = aggregation->frag; - - assert (OPAL_SUCCESS == status); - - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "aggregate put complete %p on sync %p. local address %p. status %d", - (void *) aggregation, (void *) sync, local_address, status); - - ompi_osc_rdma_frag_complete (frag); - ompi_osc_rdma_aggregation_return (aggregation); - - /* make sure the aggregation is returned before marking the operation as complete */ - opal_atomic_wmb (); - - ompi_osc_rdma_sync_rdma_dec (sync); -} - static int ompi_osc_rdma_put_real (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_peer_t *peer, uint64_t target_address, mca_btl_base_registration_handle_t *target_handle, void *ptr, mca_btl_base_registration_handle_t *local_handle, size_t size, @@ -492,75 +470,11 @@ static int ompi_osc_rdma_put_real (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_pee return ret; } -#if 0 -static void ompi_osc_rdma_aggregate_append (ompi_osc_rdma_aggregation_t *aggregation, ompi_osc_rdma_request_t *request, - void *source_buffer, size_t size) -{ - size_t offset = aggregation->buffer_used; - - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "appending %lu bytes of data from %p to aggregate fragment %p with start " - "address 0x%lx", (unsigned long) size, source_buffer, (void *) aggregation, - (unsigned long) aggregation->target_address); - - memcpy (aggregation->buffer + offset, source_buffer, size); - - aggregation->buffer_used += size; - - if (request) { - /* the local buffer is now available */ - ompi_osc_rdma_request_complete (request, 0); - } -} - -static int ompi_osc_rdma_aggregate_alloc (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_peer_t *peer, uint64_t target_address, - mca_btl_base_registration_handle_t *target_handle, void *source_buffer, size_t size, - ompi_osc_rdma_request_t *request, int type) -{ - ompi_osc_rdma_module_t *module = sync->module; - ompi_osc_rdma_aggregation_t *aggregation; - int ret; - - aggregation = (ompi_osc_rdma_aggregation_t *) opal_free_list_get (&mca_osc_rdma_component.aggregate); - if (OPAL_UNLIKELY(NULL == aggregation)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - ret = ompi_osc_rdma_frag_alloc (module, mca_osc_rdma_component.aggregation_limit, &aggregation->frag, - &aggregation->buffer); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - opal_free_list_return(&mca_osc_rdma_component.aggregate, (opal_free_list_item_t *) aggregation); - return ret; - } - - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "allocated new aggregate fragment %p for target %d", (void *) aggregation, - peer->rank); - - peer->aggregate = aggregation; - - aggregation->target_address = target_address; - aggregation->target_handle = target_handle; - aggregation->buffer_size = mca_osc_rdma_component.aggregation_limit; - aggregation->sync = sync; - aggregation->peer = peer; - aggregation->type = type; - aggregation->buffer_used = 0; - - ompi_osc_rdma_aggregate_append (aggregation, request, source_buffer, size); - - opal_list_append (&sync->aggregations, (opal_list_item_t *) aggregation); - - return OMPI_SUCCESS; -} -#endif - int ompi_osc_rdma_put_contig (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_peer_t *peer, uint64_t target_address, mca_btl_base_registration_handle_t *target_handle, void *source_buffer, size_t size, ompi_osc_rdma_request_t *request) { ompi_osc_rdma_module_t *module = sync->module; -#if 0 - ompi_osc_rdma_aggregation_t *aggregation = peer->aggregate; -#endif mca_btl_base_registration_handle_t *local_handle = NULL; mca_btl_base_rdma_completion_fn_t cbfunc = NULL; ompi_osc_rdma_frag_t *frag = NULL; @@ -568,34 +482,6 @@ int ompi_osc_rdma_put_contig (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_peer_t * void *cbcontext; int ret; -#if 0 - if (aggregation) { - if (size <= (aggregation->buffer_size - aggregation->buffer_used) && (target_handle == aggregation->target_handle) && - (target_address == aggregation->target_address + aggregation->buffer_used)) { - assert (OMPI_OSC_RDMA_TYPE_PUT == aggregation->type); - ompi_osc_rdma_aggregate_append (aggregation, request, source_buffer, size); - return OMPI_SUCCESS; - } - - /* can't aggregate this operation. flush the previous segment */ - ret = ompi_osc_rdma_peer_aggregate_flush (peer); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - return ret; - } - } - - if (size <= (mca_osc_rdma_component.aggregation_limit >> 2)) { - ret = ompi_osc_rdma_aggregate_alloc (sync, peer, target_address, target_handle, source_buffer, size, request, - OMPI_OSC_RDMA_TYPE_PUT); - if (OPAL_LIKELY(OMPI_SUCCESS == ret)) { - if (request) { - - } - return ret; - } - } -#endif - if (module->selected_btl->btl_register_mem && size > module->selected_btl->btl_put_local_registration_threshold) { ret = ompi_osc_rdma_frag_alloc (module, size, &frag, &ptr); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { @@ -680,37 +566,6 @@ static void ompi_osc_rdma_get_complete (struct mca_btl_base_module_t *btl, struc ompi_osc_rdma_request_complete (request, status); } -int ompi_osc_rdma_peer_aggregate_flush (ompi_osc_rdma_peer_t *peer) -{ - ompi_osc_rdma_aggregation_t *aggregation = peer->aggregate; - int ret; - - if (NULL == aggregation) { - return OMPI_SUCCESS; - } - - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "flusing aggregate fragment %p", (void *) aggregation); - - assert (OMPI_OSC_RDMA_TYPE_PUT == aggregation->type); - - ret = ompi_osc_rdma_put_real (aggregation->sync, peer, aggregation->target_address, aggregation->target_handle, - aggregation->buffer, aggregation->frag->handle, aggregation->buffer_used, - ompi_osc_rdma_aggregate_put_complete, (void *) aggregation, NULL); - - peer->aggregate = NULL; - - if (OPAL_UNLIKELY(OMPI_SUCCESS == ret)) { - return OMPI_SUCCESS; - } - - ompi_osc_rdma_cleanup_rdma (aggregation->sync, false, aggregation->frag, NULL, NULL); - - ompi_osc_rdma_aggregation_return (aggregation); - - return ret; - -} - static int ompi_osc_rdma_get_partial (ompi_osc_rdma_sync_t *sync, ompi_osc_rdma_peer_t *peer, uint64_t source_address, mca_btl_base_registration_handle_t *source_handle, void *target_buffer, size_t size, ompi_osc_rdma_request_t *request) { diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index bf6c1a84bb3..ef0fad453c7 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -223,16 +223,6 @@ static int ompi_osc_rdma_component_register (void) MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_rdma_component.max_attach); free(description_str); - mca_osc_rdma_component.aggregation_limit = 1024; - asprintf(&description_str, "Maximum size of an aggregated put/get. Messages are aggregated for consecutive" - "put and get operations. In some cases this may lead to higher latency but " - "should also lead to higher bandwidth utilization. Set to 0 to disable (default: %d)", - mca_osc_rdma_component.aggregation_limit); - (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "aggregation_limit", - description_str, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_rdma_component.aggregation_limit); - free(description_str); - mca_osc_rdma_component.priority = 101; asprintf(&description_str, "Priority of the osc/rdma component (default: %d)", mca_osc_rdma_component.priority); @@ -336,24 +326,6 @@ static int ompi_osc_rdma_component_init (bool enable_progress_threads, __FILE__, __LINE__, ret); } - OBJ_CONSTRUCT(&mca_osc_rdma_component.aggregate, opal_free_list_t); - - if (!enable_mpi_threads && mca_osc_rdma_component.aggregation_limit) { - ret = opal_free_list_init (&mca_osc_rdma_component.aggregate, - sizeof(ompi_osc_rdma_aggregation_t), 8, - OBJ_CLASS(ompi_osc_rdma_aggregation_t), 0, 0, - 32, 128, 32, NULL, 0, NULL, NULL, NULL); - - if (OPAL_SUCCESS != ret) { - opal_output_verbose(1, ompi_osc_base_framework.framework_output, - "%s:%d: opal_free_list_init failed: %d\n", - __FILE__, __LINE__, ret); - } - } else { - /* only enable put aggregation when not using threads */ - mca_osc_rdma_component.aggregation_limit = 0; - } - return ret; } @@ -373,7 +345,6 @@ int ompi_osc_rdma_component_finalize (void) OBJ_DESTRUCT(&mca_osc_rdma_component.requests); OBJ_DESTRUCT(&mca_osc_rdma_component.request_gc); OBJ_DESTRUCT(&mca_osc_rdma_component.buffer_gc); - OBJ_DESTRUCT(&mca_osc_rdma_component.aggregate); return OMPI_SUCCESS; } @@ -1355,53 +1326,3 @@ static char* ompi_osc_rdma_set_no_lock_info(opal_infosubscriber_t *obj, char *ke */ return module->no_locks ? "true" : "false"; } - -#if 0 // stale code? -static int ompi_osc_rdma_set_info (struct ompi_win_t *win, struct opal_info_t *info) -{ - ompi_osc_rdma_module_t *module = GET_MODULE(win); - bool temp; - - temp = check_config_value_bool ("no_locks", info); - if (temp && !module->no_locks) { - /* clean up the lock hash. it is up to the user to ensure no lock is - * outstanding from this process when setting the info key */ - OBJ_DESTRUCT(&module->outstanding_locks); - OBJ_CONSTRUCT(&module->outstanding_locks, opal_hash_table_t); - - module->no_locks = true; - win->w_flags |= OMPI_WIN_NO_LOCKS; - } else if (!temp && module->no_locks) { - int world_size = ompi_comm_size (module->comm); - int init_limit = world_size > 256 ? 256 : world_size; - int ret; - - ret = opal_hash_table_init (&module->outstanding_locks, init_limit); - if (OPAL_SUCCESS != ret) { - return ret; - } - - module->no_locks = false; - win->w_flags &= ~OMPI_WIN_NO_LOCKS; - } - - /* enforce collectiveness... */ - return module->comm->c_coll->coll_barrier(module->comm, - module->comm->c_coll->coll_barrier_module); -} - - -static int ompi_osc_rdma_get_info (struct ompi_win_t *win, struct opal_info_t **info_used) -{ - opal_info_t *info = OBJ_NEW(opal_info_t); - - if (NULL == info) { - return OMPI_ERR_TEMP_OUT_OF_RESOURCE; - } - - *info_used = info; - - return OMPI_SUCCESS; -} -#endif -OBJ_CLASS_INSTANCE(ompi_osc_rdma_aggregation_t, opal_list_item_t, NULL, NULL); diff --git a/ompi/mca/osc/rdma/osc_rdma_peer.h b/ompi/mca/osc/rdma/osc_rdma_peer.h index 0e46ec6dfc4..a0db4c4a7f8 100644 --- a/ompi/mca/osc/rdma/osc_rdma_peer.h +++ b/ompi/mca/osc/rdma/osc_rdma_peer.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -44,9 +44,6 @@ struct ompi_osc_rdma_peer_t { /** peer flags */ volatile int32_t flags; - - /** aggregation support */ - ompi_osc_rdma_aggregation_t *aggregate; }; typedef struct ompi_osc_rdma_peer_t ompi_osc_rdma_peer_t; @@ -164,13 +161,6 @@ int ompi_osc_rdma_new_peer (struct ompi_osc_rdma_module_t *module, int peer_id, */ struct ompi_osc_rdma_peer_t *ompi_osc_rdma_peer_lookup (struct ompi_osc_rdma_module_t *module, int peer_id); -/** - * @brief flush queued aggregated operation - * - * @param[in] peer osc rdma peer - */ -int ompi_osc_rdma_peer_aggregate_flush (ompi_osc_rdma_peer_t *peer); - /** * @brief lookup the btl endpoint for a peer * diff --git a/ompi/mca/osc/rdma/osc_rdma_sync.c b/ompi/mca/osc/rdma/osc_rdma_sync.c index f07ea4f7839..49aae970add 100644 --- a/ompi/mca/osc/rdma/osc_rdma_sync.c +++ b/ompi/mca/osc/rdma/osc_rdma_sync.c @@ -17,14 +17,12 @@ static void ompi_osc_rdma_sync_constructor (ompi_osc_rdma_sync_t *rdma_sync) rdma_sync->type = OMPI_OSC_RDMA_SYNC_TYPE_NONE; rdma_sync->epoch_active = false; rdma_sync->outstanding_rdma.counter = 0; - OBJ_CONSTRUCT(&rdma_sync->aggregations, opal_list_t); OBJ_CONSTRUCT(&rdma_sync->lock, opal_mutex_t); OBJ_CONSTRUCT(&rdma_sync->demand_locked_peers, opal_list_t); } static void ompi_osc_rdma_sync_destructor (ompi_osc_rdma_sync_t *rdma_sync) { - OBJ_DESTRUCT(&rdma_sync->aggregations); OBJ_DESTRUCT(&rdma_sync->lock); OBJ_DESTRUCT(&rdma_sync->demand_locked_peers); } diff --git a/ompi/mca/osc/rdma/osc_rdma_sync.h b/ompi/mca/osc/rdma/osc_rdma_sync.h index e33b32d4371..202bf792656 100644 --- a/ompi/mca/osc/rdma/osc_rdma_sync.h +++ b/ompi/mca/osc/rdma/osc_rdma_sync.h @@ -97,9 +97,6 @@ struct ompi_osc_rdma_sync_t { /** outstanding rdma operations on epoch */ ompi_osc_rdma_sync_aligned_counter_t outstanding_rdma __opal_attribute_aligned__(64); - /** aggregated operations in this epoch */ - opal_list_t aggregations; - /** lock to protect sync structure members */ opal_mutex_t lock; }; diff --git a/ompi/mca/osc/rdma/osc_rdma_types.h b/ompi/mca/osc/rdma/osc_rdma_types.h index 790b8802cb2..4acb40154de 100644 --- a/ompi/mca/osc/rdma/osc_rdma_types.h +++ b/ompi/mca/osc/rdma/osc_rdma_types.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -171,40 +171,6 @@ struct ompi_osc_rdma_state_t { }; typedef struct ompi_osc_rdma_state_t ompi_osc_rdma_state_t; -struct ompi_osc_rdma_aggregation_t { - opal_list_item_t super; - - /** associated peer */ - struct ompi_osc_rdma_peer_t *peer; - - /** aggregation buffer frag */ - struct ompi_osc_rdma_frag_t *frag; - - /** synchronization object */ - struct ompi_osc_rdma_sync_t *sync; - - /** aggregation buffer */ - char *buffer; - - /** target for the operation */ - osc_rdma_base_t target_address; - - /** handle for target memory address */ - mca_btl_base_registration_handle_t *target_handle; - - /** buffer size */ - size_t buffer_size; - - /** buffer used */ - size_t buffer_used; - - /** type */ - int type; -}; -typedef struct ompi_osc_rdma_aggregation_t ompi_osc_rdma_aggregation_t; - -OBJ_CLASS_DECLARATION(ompi_osc_rdma_aggregation_t); - typedef void (*ompi_osc_rdma_pending_op_cb_fn_t) (void *, void *, int); struct ompi_osc_rdma_pending_op_t { From 72fc8acb5016118f12750983504fca800d18203e Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 21 Aug 2018 15:54:53 -0600 Subject: [PATCH 099/674] osc/rdma: quiet warning gcc complains about ret possibly being used uninitialized. That will never happen but we should still quiet the warning. This commit sets ret to a valid value. Fixes #5513 Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma_lock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_lock.h b/ompi/mca/osc/rdma/osc_rdma_lock.h index 70f09908798..7af4d703f6f 100644 --- a/ompi/mca/osc/rdma/osc_rdma_lock.h +++ b/ompi/mca/osc/rdma/osc_rdma_lock.h @@ -40,7 +40,7 @@ static inline int ompi_osc_rdma_btl_fop (ompi_osc_rdma_module_t *module, struct ompi_osc_rdma_pending_op_cb_fn_t cbfunc, void *cbdata, void *cbcontext) { ompi_osc_rdma_pending_op_t *pending_op; - int ret; + int ret = OPAL_ERROR; pending_op = OBJ_NEW(ompi_osc_rdma_pending_op_t); assert (NULL != pending_op); From 5ac3fac6c2cba2d64f294ce248bfeccad206169f Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Thu, 16 Aug 2018 15:17:23 -0400 Subject: [PATCH 100/674] snprintf() length fix for info The important part of this fix is a couple places 5 was hard-coded that needed to be strlen(OPAL_INFO_SAVE_PREFIX). But also this contains a fix for a gcc 7.3.0 compiler warning about snprintf(). There was an "if" statement making sure all the arguments had appropriate strlen(), but gcc still complained about the following snprintf() because the size of the struct element is iterator->ie_key[OPAL_MAX_INFO_KEY + 1]. Signed-off-by: Mark Allen --- opal/util/info.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/opal/util/info.c b/opal/util/info.c index e63c0416b89..a88efe41c83 100644 --- a/opal/util/info.c +++ b/opal/util/info.c @@ -176,7 +176,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo, { int err, flag; opal_info_entry_t *iterator; - char savedkey[OPAL_MAX_INFO_KEY]; + char savedkey[OPAL_MAX_INFO_KEY + 1]; // iterator->ie_key has this as its size char savedval[OPAL_MAX_INFO_VAL]; char *valptr, *pkey; int is_IN_key; @@ -194,7 +194,7 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo, if (0 == strncmp(iterator->ie_key, OPAL_INFO_SAVE_PREFIX, strlen(OPAL_INFO_SAVE_PREFIX))) { - pkey += 5; + pkey += strlen(OPAL_INFO_SAVE_PREFIX); is_IN_key = 1; exists_IN_key = 1; @@ -207,9 +207,9 @@ int opal_info_dup_mode (opal_info_t *info, opal_info_t **newinfo, exists_reg_key = 1; // see if there is an __IN_ for the current - if (strlen(iterator->ie_key) + 5 < OPAL_MAX_INFO_KEY) { - snprintf(savedkey, OPAL_MAX_INFO_KEY, - OPAL_INFO_SAVE_PREFIX "%s", iterator->ie_key); + if (strlen(OPAL_INFO_SAVE_PREFIX) + strlen(pkey) < OPAL_MAX_INFO_KEY) { + snprintf(savedkey, OPAL_MAX_INFO_KEY+1, + OPAL_INFO_SAVE_PREFIX "%s", pkey); // (the prefix macro is a string, so the unreadable part above is a string concatenation) opal_info_get_nolock (info, savedkey, OPAL_MAX_INFO_VAL, savedval, &flag); From c83b30755acfe66410b53c8792ca37c8a120efe2 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 8 Aug 2018 08:50:55 -0700 Subject: [PATCH 101/674] Fix script abstraction break: mv make_manpage.pl to config Having the "make_manpage.pl" script in the ompi/ tree broke "./autogen.pl --no-ompi" (specifically: "make distcheck" of --no-ompi builds would break). (cherry picked from commit 89773c41) Signed-off-by: Jeff Squyres --- Makefile.ompi-rules | 8 ++++---- config/Makefile.am | 5 +++-- {ompi/mpi/man => config}/make_manpage.pl | 0 ompi/mpi/Makefile.am | 5 ++--- 4 files changed, 9 insertions(+), 9 deletions(-) rename {ompi/mpi/man => config}/make_manpage.pl (100%) diff --git a/Makefile.ompi-rules b/Makefile.ompi-rules index 2a9cb2b7b5b..d7e1041ca9f 100644 --- a/Makefile.ompi-rules +++ b/Makefile.ompi-rules @@ -1,5 +1,5 @@ # -*- makefile -*- -# Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # $COPYRIGHT$ # @@ -20,7 +20,7 @@ if ! MAN_PAGE_BUILD_USEMPIF08_BINDINGS endif .1in.1: - $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \ + $(OMPI_V_GEN) $(top_srcdir)/config/make_manpage.pl \ --package-name='@PACKAGE_NAME@' \ --package-version='@PACKAGE_VERSION@' \ --ompi-date='@OMPI_RELEASE_DATE@' \ @@ -30,7 +30,7 @@ endif --output=$@ .3in.3: - $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \ + $(OMPI_V_GEN) $(top_srcdir)/config/make_manpage.pl \ --package-name='@PACKAGE_NAME@' \ --package-version='@PACKAGE_VERSION@' \ --ompi-date='@OMPI_RELEASE_DATE@' \ @@ -41,7 +41,7 @@ endif --output=$@ .7in.7: - $(OMPI_V_GEN) $(top_srcdir)/ompi/mpi/man/make_manpage.pl \ + $(OMPI_V_GEN) $(top_srcdir)/config/make_manpage.pl \ --package-name='@PACKAGE_NAME@' \ --package-version='@PACKAGE_VERSION@' \ --ompi-date='@OMPI_RELEASE_DATE@' \ diff --git a/config/Makefile.am b/config/Makefile.am index 85a222a7c91..4379498100a 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2010 Oracle and/or its affiliates. All rights # reserved. # Copyright (c) 2014-2015 Intel, Inc. All rights reserved. @@ -28,7 +28,8 @@ EXTRA_DIST = \ ltmain_nag_pthread.diff \ ltmain_pgi_tp.diff \ opal_mca_priority_sort.pl \ - find_common_syms + find_common_syms \ + make_manpage.pl maintainer-clean-local: rm -f opal_get_version.sh diff --git a/ompi/mpi/man/make_manpage.pl b/config/make_manpage.pl similarity index 100% rename from ompi/mpi/man/make_manpage.pl rename to config/make_manpage.pl diff --git a/ompi/mpi/Makefile.am b/ompi/mpi/Makefile.am index f4d2970b6c5..388076307c9 100644 --- a/ompi/mpi/Makefile.am +++ b/ompi/mpi/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -20,7 +20,6 @@ # EXTRA_DIST = \ - mpi/fortran/configure-fortran-output-bottom.h \ - mpi/man/make_manpage.pl + mpi/fortran/configure-fortran-output-bottom.h dist_ompidata_DATA += mpi/help-mpi-api.txt From b22b54bf9264a18d4352e9a87de109c965f89a99 Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Tue, 18 Sep 2018 09:47:51 +0300 Subject: [PATCH 102/674] platform/mellanox: cleanup autodetect config Signed-off-by: Andrey Maslennikov (cherry picked from commit ced50a98ff3f9e5b7812503ee895a2b2db581983) --- contrib/platform/mellanox/optimized | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/contrib/platform/mellanox/optimized b/contrib/platform/mellanox/optimized index ae89528ce5f..93dbb78e1bf 100644 --- a/contrib/platform/mellanox/optimized +++ b/contrib/platform/mellanox/optimized @@ -23,26 +23,11 @@ if [ "$mellanox_autodetect" == "yes" ]; then with_ucx=$ucx_dir fi - mxm_dir=${mxm_dir:="$(pkg-config --variable=prefix mxm)"} - if [ -d $mxm_dir ]; then - with_mxm=$mxm_dir - fi - - fca_dir=${fca_dir:="$(pkg-config --variable=prefix fca)"} - if [ -d $fca_dir ]; then - with_fca=$fca_dir - fi - hcoll_dir=${hcoll_dir:="$(pkg-config --variable=prefix hcoll)"} if [ -d $hcoll_dir ]; then with_hcoll=$hcoll_dir fi - knem_dir=${knem_dir:="$(pkg-config --variable=prefix knem)"} - if [ -d $knem_dir ]; then - with_knem=$knem_dir - fi - slurm_dir=${slurm_dir:="/usr"} if [ -f $slurm_dir/include/slurm/slurm.h ]; then with_slurm=$slurm_dir From 6fb0185f49aae377834aa9ad7042c3eecb12a5ec Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Tue, 18 Sep 2018 09:51:47 +0300 Subject: [PATCH 103/674] platform/mellanox: update default configuration Signed-off-by: Andrey Maslennikov (cherry picked from commit da18a2d24c8f6192f2ad4fd4781ce67a3fcc5901) --- contrib/platform/mellanox/optimized.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/platform/mellanox/optimized.conf b/contrib/platform/mellanox/optimized.conf index d4fe40d513c..c58428cf6ad 100644 --- a/contrib/platform/mellanox/optimized.conf +++ b/contrib/platform/mellanox/optimized.conf @@ -56,12 +56,10 @@ # See "ompi_info --param all all" for a full listing of Open MPI MCA # parameters available and their default values. -coll_fca_enable = 0 -scoll_fca_enable = 0 #rmaps_base_mapping_policy = dist:auto coll = ^ml hwloc_base_binding_policy = core -btl = vader,openib,self +btl = self # Basic behavior to smooth startup mca_base_component_show_load_errors = 0 orte_abort_timeout = 10 @@ -77,3 +75,6 @@ oob_tcp_sndbuf = 32768 oob_tcp_rcvbuf = 32768 opal_event_include=epoll + +bml_r2_show_unreach_errors = 0 + From 8bdf4553d9a941c58eb30340c9cf686f7f09c015 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 22 Sep 2018 07:18:45 -0700 Subject: [PATCH 104/674] mca_base_var: fix output bug about settable vars Fix the test that determined whether we output "writeable" or "read-only" for MCA vars (it was checking the wrong flag). Signed-off-by: Jeff Squyres (cherry picked from commit 176da51aec0955a51f21157b33b21f60b6f28092) --- opal/mca/base/mca_base_var.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opal/mca/base/mca_base_var.c b/opal/mca/base/mca_base_var.c index 7d55e703d68..d409296d3cd 100644 --- a/opal/mca/base/mca_base_var.c +++ b/opal/mca/base/mca_base_var.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. @@ -2146,7 +2146,8 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ asprintf(out[0] + line++, "%ssource:%s", tmp, source_string); /* Output whether it's read only or writable */ - asprintf(out[0] + line++, "%sstatus:%s", tmp, VAR_IS_DEFAULT_ONLY(var[0]) ? "read-only" : "writeable"); + asprintf(out[0] + line++, "%sstatus:%s", tmp, + VAR_IS_SETTABLE(var[0]) ? "writeable" : "read-only"); /* Output the info level of this parametere */ asprintf(out[0] + line++, "%slevel:%d", tmp, var->mbv_info_lvl + 1); From 02c5838cdf5354f102cdea978a50daa2019bdc8e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 24 Sep 2018 17:37:28 -0400 Subject: [PATCH 105/674] README: Add note about --with-foo and RPATH Specifically mention our intended behavior about /usr and /usr/lib (and why we don't add /usr/lib[64] and /usr/local/lib[64] to RPATH). Signed-off-by: Jeff Squyres (cherry picked from commit 9367440e3210cf2bfae33d3c72411ab8b9fa6622) --- README | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README b/README index 829e1c378df..ab8406c3f51 100644 --- a/README +++ b/README @@ -8,7 +8,7 @@ Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2007 The Regents of the University of California. All rights reserved. -Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007 Myricom, Inc. All rights reserved. @@ -765,6 +765,22 @@ Open MPI is unable to find relevant support for , configure will assume that it was unable to provide a feature that was specifically requested and will abort so that a human can resolve out the issue. +Additionally, if a search directory is specified in the form +--with-=, Open MPI will: + +1. Search for 's header files in /include. +2. Search for 's library files in /lib, and if they are not + found there, search again in /lib64. +3. If both the relevant header files and libraries are found: + 3a. Open MPI will build support for . + 3b. If is neither "/usr" nor "/usr/local", Open MPI will + compile itself with RPATH flags pointing to the directory where + 's libraries are located. Open MPI does not RPATH + /usr/lib[64] and /usr/local/lib[64] because many systems + already search these directories for run-time libraries by + default; adding RPATH for them could have unintended + consequences for the search path ordering. + INSTALLATION OPTIONS --prefix= From 6b91855eccd451592e1029e2ab96c04ee1f2c580 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 25 Sep 2018 11:02:11 -0400 Subject: [PATCH 106/674] README: additional clarification about --with--libdir. Signed-off-by: Jeff Squyres (cherry picked from commit 36c9f92117053ccd343c30c4540971240717a233) --- README | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README b/README index ab8406c3f51..bdfbd26eef4 100644 --- a/README +++ b/README @@ -769,17 +769,21 @@ Additionally, if a search directory is specified in the form --with-=, Open MPI will: 1. Search for 's header files in /include. -2. Search for 's library files in /lib, and if they are not - found there, search again in /lib64. +2. Search for 's library files: + 2a. If --with--libdir= was specified, search in + . + 2b. Otherwise, search in /lib, and if they are not found + there, search again in /lib64. 3. If both the relevant header files and libraries are found: 3a. Open MPI will build support for . - 3b. If is neither "/usr" nor "/usr/local", Open MPI will - compile itself with RPATH flags pointing to the directory where - 's libraries are located. Open MPI does not RPATH - /usr/lib[64] and /usr/local/lib[64] because many systems - already search these directories for run-time libraries by - default; adding RPATH for them could have unintended - consequences for the search path ordering. + 3b. If the root path where the libraries are found is neither + "/usr" nor "/usr/local", Open MPI will compile itself with + RPATH flags pointing to the directory where 's libraries + are located. Open MPI does not RPATH /usr/lib[64] and + /usr/local/lib[64] because many systems already search these + directories for run-time libraries by default; adding RPATH for + them could have unintended consequences for the search path + ordering. INSTALLATION OPTIONS From e98eae3da68e39080d050883807e864c5cf3d923 Mon Sep 17 00:00:00 2001 From: Philipp Otte Date: Wed, 18 Jul 2018 11:06:39 +0200 Subject: [PATCH 107/674] fortran/use-mpi-f08: Corrections to Fortran08 signatures of collectives Corrected the signatures of the collectives used by the Fortran 2008 interface to state correct intent for inout arguments and use the ASYNCHRONOUS attribute in non-blocking collective calls. Also corrected the C-bindings in Fortran accordingly Signed-off-by: Philipp Otte (cherry picked from commit e98d794e8b49ca0f6cfac6b36be2528d7ef7ab67) --- .../mpi/fortran/use-mpi-f08/allgather_f08.F90 | 3 +- .../fortran/use-mpi-f08/allgatherv_f08.F90 | 3 +- .../mpi/fortran/use-mpi-f08/allreduce_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 | 3 +- .../mpi/fortran/use-mpi-f08/alltoallv_f08.F90 | 3 +- .../mpi/fortran/use-mpi-f08/alltoallw_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 | 2 +- .../bindings/mpi-f-interfaces-bind.h | 113 +++++++++++------- ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 | 3 +- .../fortran/use-mpi-f08/iallgather_f08.F90 | 3 +- .../fortran/use-mpi-f08/iallgatherv_f08.F90 | 5 +- .../fortran/use-mpi-f08/iallreduce_f08.F90 | 3 +- .../mpi/fortran/use-mpi-f08/ialltoall_f08.F90 | 3 +- .../fortran/use-mpi-f08/ialltoallv_f08.F90 | 5 +- .../fortran/use-mpi-f08/ialltoallw_f08.F90 | 9 +- ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 | 2 +- ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 | 5 +- ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 | 3 +- .../use-mpi-f08/ireduce_scatter_block_f08.F90 | 3 +- .../use-mpi-f08/ireduce_scatter_f08.F90 | 5 +- ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 | 3 +- .../mpi/fortran/use-mpi-f08/iscatterv_f08.F90 | 5 +- .../use-mpi-f08/mod/mpi-f08-interfaces.F90 | 76 ++++++------ ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 | 3 +- .../fortran/use-mpi-f08/reduce_local_f08.F90 | 3 +- .../use-mpi-f08/reduce_scatter_block_f08.F90 | 3 +- .../use-mpi-f08/reduce_scatter_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 | 3 +- 35 files changed, 182 insertions(+), 120 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 index 86adb405cb3..2811cc5a73b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allgather_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvty use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 index a8f0f072794..eef5e1d25d8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allgatherv_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 index 5a5cb66ef1e..2298cd5b94e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/allreduce_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Allreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allreduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 index a72e31d281b..20bea7b302a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoall_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 index a9faa8cdd7c..b11ce4cb605 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoallv_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 index 10684b03c9d..6aae6277e95 100644 --- a/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/alltoallw_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 index 1ecc54dc08f..ca7acbe9bb7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 @@ -13,7 +13,7 @@ subroutine MPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_bcast_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm 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 478ecbf9e29..87892a2f831 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 @@ -798,7 +798,8 @@ subroutine ompi_allgather_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,comm,ierror) & BIND(C, name="ompi_allgather_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -810,7 +811,8 @@ subroutine ompi_iallgather_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,comm,request,ierror) & BIND(C, name="ompi_iallgather_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -823,7 +825,8 @@ subroutine ompi_allgatherv_f(sendbuf,sendcount,sendtype,recvbuf, & recvcounts,displs,recvtype,comm,ierror) & BIND(C, name="ompi_allgatherv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype @@ -836,9 +839,10 @@ subroutine ompi_iallgatherv_f(sendbuf,sendcount,sendtype,recvbuf, & recvcounts,displs,recvtype,comm,request,ierror) & BIND(C, name="ompi_iallgatherv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype INTEGER, INTENT(IN) :: comm @@ -849,7 +853,8 @@ end subroutine ompi_iallgatherv_f subroutine ompi_allreduce_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & BIND(C, name="ompi_allreduce_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -860,7 +865,8 @@ end subroutine ompi_allreduce_f subroutine ompi_iallreduce_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & BIND(C, name="ompi_iallreduce_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -873,7 +879,8 @@ subroutine ompi_alltoall_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,comm,ierror) & BIND(C, name="ompi_alltoall_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -885,7 +892,8 @@ subroutine ompi_ialltoall_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,comm,request,ierror) & BIND(C, name="ompi_ialltoall_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -898,7 +906,8 @@ subroutine ompi_alltoallv_f(sendbuf,sendcounts,sdispls,sendtype, & recvbuf,recvcounts,rdispls,recvtype,comm,ierror) & BIND(C, name="ompi_alltoallv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -910,8 +919,9 @@ subroutine ompi_ialltoallv_f(sendbuf,sendcounts,sdispls,sendtype, & recvbuf,recvcounts,rdispls,recvtype,comm,request,ierror) & BIND(C, name="ompi_ialltoallv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype INTEGER, INTENT(IN) :: comm @@ -923,7 +933,8 @@ subroutine ompi_alltoallw_f(sendbuf,sendcounts,sdispls,sendtypes, & recvbuf,recvcounts,rdispls,recvtypes,comm,ierror) & BIND(C, name="ompi_alltoallw_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) INTEGER, INTENT(IN) :: sendtypes INTEGER, INTENT(IN) :: recvtypes @@ -935,10 +946,11 @@ subroutine ompi_ialltoallw_f(sendbuf,sendcounts,sdispls,sendtypes, & recvbuf,recvcounts,rdispls,recvtypes,comm,request,ierror) & BIND(C, name="ompi_ialltoallw_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - INTEGER, INTENT(IN) :: sendtypes - INTEGER, INTENT(IN) :: recvtypes + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendtypes + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvtypes INTEGER, INTENT(IN) :: comm INTEGER, INTENT(OUT) :: request INTEGER, INTENT(OUT) :: ierror @@ -962,7 +974,7 @@ end subroutine ompi_ibarrier_f subroutine ompi_bcast_f(buffer,count,datatype,root,comm,ierror) & BIND(C, name="ompi_bcast_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: comm @@ -972,7 +984,7 @@ end subroutine ompi_bcast_f subroutine ompi_ibcast_f(buffer,count,datatype,root,comm,request,ierror) & BIND(C, name="ompi_ibcast_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: comm @@ -983,7 +995,8 @@ end subroutine ompi_ibcast_f subroutine ompi_exscan_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & BIND(C, name="ompi_exscan_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -994,7 +1007,8 @@ end subroutine ompi_exscan_f subroutine ompi_iexscan_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & BIND(C, name="ompi_iexscan_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1007,7 +1021,8 @@ subroutine ompi_gather_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,root,comm,ierror) & BIND(C, name="ompi_gather_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -1019,7 +1034,8 @@ subroutine ompi_igather_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,root,comm,request,ierror) & BIND(C, name="ompi_igather_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -1032,7 +1048,8 @@ subroutine ompi_gatherv_f(sendbuf,sendcount,sendtype,recvbuf, & recvcounts,displs,recvtype,root,comm,ierror) & BIND(C, name="ompi_gatherv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, root INTEGER, INTENT(IN) :: recvcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype @@ -1045,9 +1062,10 @@ subroutine ompi_igatherv_f(sendbuf,sendcount,sendtype,recvbuf, & recvcounts,displs,recvtype,root,comm,request,ierror) & BIND(C, name="ompi_igatherv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype INTEGER, INTENT(IN) :: comm @@ -1065,7 +1083,8 @@ end subroutine ompi_op_free_f subroutine ompi_reduce_f(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) & BIND(C, name="ompi_reduce_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1076,7 +1095,8 @@ end subroutine ompi_reduce_f subroutine ompi_ireduce_f(sendbuf,recvbuf,count,datatype,op,root,comm,request,ierror) & BIND(C, name="ompi_ireduce_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1088,7 +1108,8 @@ end subroutine ompi_ireduce_f subroutine ompi_reduce_local_f(inbuf,inoutbuf,count,datatype,op,ierror) & BIND(C, name="ompi_reduce_local_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: inoutbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1099,7 +1120,8 @@ subroutine ompi_reduce_scatter_f(sendbuf,recvbuf,recvcounts, & datatype,op,comm,ierror) & BIND(C, name="ompi_reduce_scatter_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcounts(*) INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1111,8 +1133,9 @@ subroutine ompi_ireduce_scatter_f(sendbuf,recvbuf,recvcounts, & datatype,op,comm,request,ierror) & BIND(C, name="ompi_ireduce_scatter_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op INTEGER, INTENT(IN) :: comm @@ -1124,7 +1147,8 @@ subroutine ompi_reduce_scatter_block_f(sendbuf,recvbuf,recvcount, & datatype,op,comm,ierror) & BIND(C, name="ompi_reduce_scatter_block_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1136,7 +1160,8 @@ subroutine ompi_ireduce_scatter_block_f(sendbuf,recvbuf,recvcount, & datatype,op,comm,request,ierror) & BIND(C, name="ompi_ireduce_scatter_block_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1148,7 +1173,8 @@ end subroutine ompi_ireduce_scatter_block_f subroutine ompi_scan_f(sendbuf,recvbuf,count,datatype,op,comm,ierror) & BIND(C, name="ompi_scan_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1159,7 +1185,8 @@ end subroutine ompi_scan_f subroutine ompi_iscan_f(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) & BIND(C, name="ompi_iscan_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count INTEGER, INTENT(IN) :: datatype INTEGER, INTENT(IN) :: op @@ -1172,7 +1199,8 @@ subroutine ompi_scatter_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,root,comm,ierror) & BIND(C, name="ompi_scatter_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -1184,7 +1212,8 @@ subroutine ompi_iscatter_f(sendbuf,sendcount,sendtype,recvbuf, & recvcount,recvtype,root,comm,request,ierror) & BIND(C, name="ompi_iscatter_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype @@ -1197,7 +1226,8 @@ subroutine ompi_scatterv_f(sendbuf,sendcounts,displs,sendtype, & recvbuf,recvcount,recvtype,root,comm,ierror) & BIND(C, name="ompi_scatterv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount, root INTEGER, INTENT(IN) :: sendcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype @@ -1210,9 +1240,10 @@ subroutine ompi_iscatterv_f(sendbuf,sendcounts,displs,sendtype, & recvbuf,recvcount,recvtype,root,comm,request,ierror) & BIND(C, name="ompi_iscatterv_f") implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) INTEGER, INTENT(IN) :: sendtype INTEGER, INTENT(IN) :: recvtype INTEGER, INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 index d628eb31433..3631076e50e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/exscan_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Exscan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_exscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 index bba9a5cdc38..628424281d6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/gather_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Gather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_gather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 index abdcb7ca55b..2eb58211e1d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/gatherv_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Gatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_gatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, root INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 index a3de86565c2..d6fa7c6624d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallgather_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvt use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 index abc9dfa7b78..7fdb6a684dc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallgatherv_f08.F90 @@ -14,9 +14,10 @@ subroutine MPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 index eabdccce9ee..d96015ff406 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iallreduce_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ier use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallreduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 index a9b97e37ad3..65661c3da31 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoall_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 index 9f72a821536..96777dbbebe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoallv_f08.F90 @@ -14,8 +14,9 @@ subroutine MPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 index 64f35b0699e..07bd1a89b73 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 @@ -14,10 +14,11 @@ subroutine MPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 index ef098a630db..1ea1b56c512 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 @@ -13,7 +13,7 @@ subroutine MPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ibcast_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 index 306afedb9ad..ffdb919f611 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iexscan_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iexscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 index 05659dedcf0..32b1bd43fc3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/igather_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_igather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 index 81914b8b985..69521081177 100644 --- a/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/igatherv_f08.F90 @@ -14,9 +14,10 @@ subroutine MPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_igatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 index fc71d76817c..aa9bb7f8830 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request,i use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 index 009e3a005e3..ceebdce4d02 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_block_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,c use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_block_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 index efd696fbd9c..2367e74d37a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ireduce_scatter_f08.F90 @@ -13,8 +13,9 @@ subroutine MPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,r use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 index 2eccaa0596f..55ce8b9a9e9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscan_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 index 10259580af5..86e31d1d5aa 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscatter_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 index b53b0896ee0..19f0ad8d3de 100644 --- a/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/iscatterv_f08.F90 @@ -14,9 +14,10 @@ subroutine MPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscatterv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm 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 03d07cd542c..2d3a6eb15e4 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 @@ -965,8 +965,8 @@ subroutine MPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvt !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1005,10 +1005,10 @@ subroutine MPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,dis !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1044,8 +1044,8 @@ subroutine MPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ier !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1084,8 +1084,8 @@ subroutine MPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvty !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1123,9 +1123,9 @@ subroutine MPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvco !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(IN) :: request @@ -1162,10 +1162,10 @@ subroutine MPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvc !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*), recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror @@ -1217,7 +1217,7 @@ subroutine MPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) !$PRAGMA IGNORE_TKR buffer !DIR$ IGNORE_TKR buffer !IBM* IGNORE_TKR buffer - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1254,8 +1254,8 @@ subroutine MPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1294,8 +1294,8 @@ subroutine MPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtype !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1334,10 +1334,10 @@ subroutine MPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displs !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1404,8 +1404,8 @@ subroutine MPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request,i !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1463,9 +1463,9 @@ subroutine MPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1504,8 +1504,8 @@ subroutine MPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,c !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1543,8 +1543,8 @@ subroutine MPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1583,8 +1583,8 @@ subroutine MPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtyp !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1623,10 +1623,10 @@ subroutine MPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,recvcoun !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 index 848974253e0..8172184ea99 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Reduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 index bdbe32e4b41..f1679394509 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_local_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Reduce_local_f08(inbuf,inoutbuf,count,datatype,op,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op use :: ompi_mpifh_bindings, only : ompi_reduce_local_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: inoutbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 index b85cb92d355..04a55345ee3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_block_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Reduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,co use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_block_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 index 49f97d01a84..1a6ebee885d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/reduce_scatter_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,ie use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 index 86d57b91331..97f48071c01 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scan_f08.F90 @@ -13,7 +13,8 @@ subroutine MPI_Scan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 index 915629611a3..09e43c86e95 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scatter_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Scatter_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 index f734fc11ad9..44f07c54788 100644 --- a/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/scatterv_f08.F90 @@ -14,7 +14,8 @@ subroutine MPI_Scatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scatterv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount, root INTEGER, INTENT(IN) :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype From ce5959ba6caca2a052b89aef48c10f5727bb86ec Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 25 Sep 2018 10:09:34 +0900 Subject: [PATCH 108/674] fortran/use-mpi-f08: Corrections to PMPI signatures of collectives Corrected the signatures of the collectives used by the Fortran 2008 interface to state correct intent for inout arguments and use the ASYNCHRONOUS attribute in non-blocking collective calls. Signed-off-by: Gilles Gouaillardet (cherry picked from commit f750c6932c845b65d059f05aae3a3b6205853aa4) --- .../use-mpi-f08/mod/pmpi-f08-interfaces.F90 | 71 ++++++++++--------- .../use-mpi-f08/profile/pallgather_f08.F90 | 3 +- .../use-mpi-f08/profile/pallgatherv_f08.F90 | 3 +- .../use-mpi-f08/profile/pallreduce_f08.F90 | 3 +- .../use-mpi-f08/profile/palltoall_f08.F90 | 3 +- .../use-mpi-f08/profile/palltoallv_f08.F90 | 3 +- .../use-mpi-f08/profile/palltoallw_f08.F90 | 3 +- .../use-mpi-f08/profile/pbcast_f08.F90 | 2 +- .../use-mpi-f08/profile/pexscan_f08.F90 | 3 +- .../use-mpi-f08/profile/pgather_f08.F90 | 3 +- .../use-mpi-f08/profile/pgatherv_f08.F90 | 3 +- .../use-mpi-f08/profile/piallgather_f08.F90 | 3 +- .../use-mpi-f08/profile/piallgatherv_f08.F90 | 5 +- .../use-mpi-f08/profile/piallreduce_f08.F90 | 3 +- .../use-mpi-f08/profile/pialltoall_f08.F90 | 3 +- .../use-mpi-f08/profile/pialltoallv_f08.F90 | 5 +- .../use-mpi-f08/profile/pialltoallw_f08.F90 | 8 +-- .../use-mpi-f08/profile/pibcast_f08.F90 | 2 +- .../use-mpi-f08/profile/piexscan_f08.F90 | 3 +- .../use-mpi-f08/profile/pigather_f08.F90 | 3 +- .../use-mpi-f08/profile/pigatherv_f08.F90 | 5 +- .../use-mpi-f08/profile/pireduce_f08.F90 | 3 +- .../profile/pireduce_scatter_block_f08.F90 | 3 +- .../profile/pireduce_scatter_f08.F90 | 5 +- .../use-mpi-f08/profile/piscan_f08.F90 | 3 +- .../use-mpi-f08/profile/piscatter_f08.F90 | 3 +- .../use-mpi-f08/profile/piscatterv_f08.F90 | 5 +- .../use-mpi-f08/profile/preduce_f08.F90 | 3 +- .../use-mpi-f08/profile/preduce_local_f08.F90 | 3 +- .../profile/preduce_scatter_block_f08.F90 | 3 +- .../profile/preduce_scatter_f08.F90 | 3 +- .../fortran/use-mpi-f08/profile/pscan_f08.F90 | 3 +- .../use-mpi-f08/profile/pscatter_f08.F90 | 3 +- .../use-mpi-f08/profile/pscatterv_f08.F90 | 3 +- 34 files changed, 107 insertions(+), 76 deletions(-) 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 bf8f83e8371..5aa561190fb 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 @@ -965,8 +965,8 @@ subroutine PMPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recv !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1005,10 +1005,10 @@ subroutine PMPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,di !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1044,8 +1044,8 @@ subroutine PMPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ie !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1086,7 +1086,8 @@ subroutine PMPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvt !IBM* IGNORE_TKR sendbuf, recvbuf OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcount + INTEGER, ASYNCHRONOUS :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1123,9 +1124,9 @@ subroutine PMPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvc !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(IN) :: request @@ -1162,10 +1163,10 @@ subroutine PMPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recv !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*), recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(IN) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror @@ -1217,7 +1218,7 @@ subroutine PMPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) !$PRAGMA IGNORE_TKR buffer !DIR$ IGNORE_TKR buffer !IBM* IGNORE_TKR buffer - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1254,8 +1255,8 @@ subroutine PMPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierro !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1294,8 +1295,8 @@ subroutine PMPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvtyp !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1334,10 +1335,10 @@ subroutine PMPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,displ !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1404,8 +1405,8 @@ subroutine PMPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1443,9 +1444,9 @@ subroutine PMPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1504,8 +1505,8 @@ subroutine PMPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -1583,8 +1584,8 @@ subroutine PMPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvty !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1623,10 +1624,10 @@ subroutine PMPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,recvcou !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 index 710cfb44bee..cbf96e381c7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallgather_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvt use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 index 319e9126143..00752d9dd5b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallgatherv_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 index 1ff22c8a3fe..93658337205 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pallreduce_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Allreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_allreduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 index 2b7a396a837..467bbaf1fe6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoall_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 index ed6abb2d453..87646472532 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallv_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 index afdd41808ea..e237579e23c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/palltoallw_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_alltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 index 2adc0721dcf..737542bbf15 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 @@ -13,7 +13,7 @@ subroutine PMPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_bcast_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 index 0e863f9fe1e..62d6a632358 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pexscan_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Exscan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_exscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 index 3f5ff4f0cc2..e5a948c3995 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgather_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Gather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_gather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 index 6c7605a1894..60108f91570 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pgatherv_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Gatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_gatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, root INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 index 62367cb1c38..79d7d21fcd4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallgather_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Iallgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recv use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 index 83946b5e35a..ca6736c3cc0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallgatherv_f08.F90 @@ -14,9 +14,10 @@ subroutine PMPI_Iallgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 index 2a350b8de7c..b515ecd60a2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piallreduce_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Iallreduce_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ie use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iallreduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 index 78247b4a176..1febbe64042 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoall_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 index 71763ffe066..2d2923af0d0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallv_f08.F90 @@ -14,8 +14,9 @@ subroutine PMPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 index f49faf9ce55..a19eb1cc010 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pialltoallw_f08.F90 @@ -14,10 +14,10 @@ subroutine PMPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ialltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(1) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(1) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 index 859864b79c7..be68659cf3e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 @@ -13,7 +13,7 @@ subroutine PMPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ibcast_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 index 4fa05899076..c7e270e6d36 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piexscan_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Iexscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierro use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iexscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 index 15cf8894025..5e0d0bc2c3f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pigather_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Igather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_igather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 index 4f5230ed383..ebe2a14a07b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pigatherv_f08.F90 @@ -14,9 +14,10 @@ subroutine PMPI_Igatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_igatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 index 9db0bbd2289..e5c8ea3f1d7 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Ireduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,request, use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 index 6c990007e32..ff3680d5f6a 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_block_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Ireduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op, use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_block_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 index c7fd5b6cf1b..a81f24e0dab 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pireduce_scatter_f08.F90 @@ -13,8 +13,9 @@ subroutine PMPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm, use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ireduce_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 index f4b422a205d..84cbb23f048 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscan_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 index 5755d0cfeac..54cf67a7809 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscatter_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Iscatter_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 index 853c489b1dc..944736e3ce2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piscatterv_f08.F90 @@ -14,9 +14,10 @@ subroutine PMPI_Iscatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_iscatterv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 index c97fa6aa96f..af0043bbce9 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Reduce_f08(sendbuf,recvbuf,count,datatype,op,root,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 index 2a0cc235076..a6bab4c675c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_local_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Reduce_local_f08(inbuf,inoutbuf,count,datatype,op,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op use :: ompi_mpifh_bindings, only : ompi_reduce_local_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, inoutbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: inoutbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 index d4c52a6355a..688b817b9e0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_block_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Reduce_scatter_block_f08(sendbuf,recvbuf,recvcount,datatype,op,c use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_block_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 index 5f3d1fdfc1b..56fd71ab980 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/preduce_scatter_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm,i use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_reduce_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 index 73e5cf2a743..9538f82e35d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscan_f08.F90 @@ -13,7 +13,8 @@ subroutine PMPI_Scan_f08(sendbuf,recvbuf,count,datatype,op,comm,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scan_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 index eaf46d6f75b..446d83f13e3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscatter_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Scatter_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scatter_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 index 7fcbd0df398..2bdb115107c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pscatterv_f08.F90 @@ -14,7 +14,8 @@ subroutine PMPI_Scatterv_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_scatterv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: recvcount, root INTEGER, INTENT(IN) :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype From 37a9cf5c8268550d262f7014e08f430179fc4638 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 26 Sep 2018 10:03:23 -0700 Subject: [PATCH 109/674] Squash a bunch of harmless compiler warnings. Signed-off-by: Jeff Squyres (cherry picked from commit 6bb356ab87f20ef50e23956790b85550e04b2f60) --- orte/mca/rmaps/base/rmaps_base_map_job.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_map_job.c b/orte/mca/rmaps/base/rmaps_base_map_job.c index 028e387629b..a06c3187fb8 100644 --- a/orte/mca/rmaps/base/rmaps_base_map_job.c +++ b/orte/mca/rmaps/base/rmaps_base_map_job.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2011-2012 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. @@ -556,17 +556,17 @@ void orte_rmaps_base_display_map(orte_job_t *jdata) if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) { continue; } - memset(tmp1, 0, 1024); + memset(tmp1, 0, sizeof(tmp1)); if (orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_BOUND, (void**)&bd, OPAL_PTR)) { if (NULL == bd) { - (void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND")); + (void)strncpy(tmp1, "UNBOUND", sizeof(tmp1)); } else { if (OPAL_ERR_NOT_BOUND == opal_hwloc_base_cset2mapstr(tmp1, sizeof(tmp1), node->topology->topo, bd->cpuset)) { - (void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND")); + (void)strncpy(tmp1, "UNBOUND", sizeof(tmp1)); } } } else { - (void)strncpy(tmp1, "UNBOUND", strlen("UNBOUND")); + (void)strncpy(tmp1, "UNBOUND", sizeof(tmp1)); } opal_output(orte_clean_output, "\t\t", ORTE_VPID_PRINT(proc->name.vpid), (long)proc->app_idx, From 27f3262403ce31371c691bbed1450e9c04b9b5e8 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Wed, 26 Sep 2018 18:38:29 -0500 Subject: [PATCH 110/674] Updating VERSION to v4.0.0rc3 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 8277c7d0461..7b8dcc5fcbc 100644 --- a/VERSION +++ b/VERSION @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc2 +greek=rc3 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From cda310733f5ed4c8f53c346f157456a044378ca0 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Sun, 26 Aug 2018 17:31:02 +0300 Subject: [PATCH 111/674] shmem/lock: progress communications while waiting for shmem_lock (cherry picked from commit 4101150) Signed-off-by: Yossi Itigin --- oshmem/shmem/c/shmem_lock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/oshmem/shmem/c/shmem_lock.c b/oshmem/shmem/c/shmem_lock.c index 4bd524f1885..626fed5843a 100644 --- a/oshmem/shmem/c/shmem_lock.c +++ b/oshmem/shmem/c/shmem_lock.c @@ -708,6 +708,7 @@ static int shmem_lock_wait_for_ticket(void *lock, do { shmem_int_get(&remote_turn, lock_turn, 1, server_pe); + opal_progress(); } while (remote_turn != ticket); shmem_get_wrapper(&temp, lock, lock_size, 1, server_pe); From 68d3baffd52f8a158123cb1ae67c7bf1a9682f40 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 10 Sep 2018 09:58:30 +0300 Subject: [PATCH 112/674] OPAL/COMMON/UCX: used __func__ macro instead of __FUNCTION__ - used __func__ macro instead of __FUNCTION__ to unify macro usage with other components Signed-off-by: Sergey Oblomov (cherry picked from commit 9a51e257d162e724845024e3505880256194ebe2) --- opal/mca/common/ucx/common_ucx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 4fa4b3b670b..0cf46e5c28a 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -70,7 +70,7 @@ BEGIN_C_DECLS return OPAL_SUCCESS; \ } else { \ MCA_COMMON_UCX_VERBOSE(1, "%s failed: %d, %s", \ - (_msg) ? (_msg) : __FUNCTION__, \ + (_msg) ? (_msg) : __func__, \ UCS_PTR_STATUS(_request), \ ucs_status_string(UCS_PTR_STATUS(_request))); \ return OPAL_ERROR; \ From 10d0a430c404643a1e0e7859e43de615395d13ec Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Tue, 25 Sep 2018 19:42:34 +0000 Subject: [PATCH 113/674] mtl ofi: Change from opt-in to opt-out provider selection Change default provider selection logic for the OFI MTL. The old logic was whitelist-only, so any new HPC NIC provider would have to ask users to do extra work or wait for an OMPI release to be whitelisted. The reason for the logic was to avoid selecting a "generic" provider like sockets or shm that would frequently have worse performance than the optimized BTL options Open MPI supports. With the change, we blacklist the (small, relatively static) list of providers that duplicate internal capabilities. Users can use one of thse blacklisted providers in two ways: first, they can explicitly request the provider in the include list (which will override the default exclude list) and second, the can set a new empty exclude list. Since most HPC networks require special libraries and therefore an explicit build of libfabric, it is highly unlikely that this change will cause users to use libfabric when they didn't want to do so. It does, however, solve the whitelisting problem. Signed-off-by: Brian Barrett (cherry picked from commit c5eaa38491c7197f7dbc74c299ade18e09bf5f64) --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index a59c96b3915..bc1a694789c 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -124,7 +124,7 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, ¶m_priority); - prov_include = "psm,psm2,gni"; + prov_include = NULL; mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, "provider_include", "Comma-delimited list of OFI providers that are considered for use (e.g., \"psm,psm2\"; an empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_exclude.", @@ -133,7 +133,7 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &prov_include); - prov_exclude = NULL; + prov_exclude = "shm,sockets,tcp,udp,rstream"; mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, "provider_exclude", "Comma-delimited list of OFI providers that are not considered for use (default: \"sockets,mxm\"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include.", From 46dd266e4502ec23db574cba4f9819b4c1e6aecd Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 28 Sep 2018 07:39:55 -0700 Subject: [PATCH 114/674] mpi.h: remove MPI_UB/MPI_LB when not enabling MPI-1 compat When --enable-mpi1-compatibility was specified, the ompi_mpi_ub/lb symbols were #if'ed out of mpi.h. But the #defines for MPI_UB/LB still remained. This commit also #if's out the MPI_UB/LB macros when --enable-mpi1-compatibility is specified. Signed-off-by: Jeff Squyres (cherry picked from commit 7223334d4dc1225d49cd2c63714870c3a04ad953) --- ompi/include/mpi.h.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index df101a1c858..7c4c1cf49f8 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -1088,8 +1088,13 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub __mpi_interfa #define MPI_LONG_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_long_int) #define MPI_SHORT_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_short_int) #define MPI_2INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_2int) +#if !OMPI_OMIT_MPI1_COMPAT_DECLS +/* + * Removed datatypes + */ #define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) #define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) +#endif #define MPI_WCHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_wchar) #if OPAL_HAVE_LONG_LONG #define MPI_LONG_LONG_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_long_long_int) From 8138b5b04a1ee4da7a5d16015b02981b74b68c71 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Fri, 28 Sep 2018 16:39:57 -0500 Subject: [PATCH 115/674] NEWS: updated versions of included hwloc and PMIx Updated versions of included hwloc and PMIx to match corresponding VERSION files. Updated the spelling of "Open SHMEM" to "OpenSHMEM". Signed-off-by: Geoffrey Paulsen --- NEWS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 3437cdfc67a..787a9900596 100644 --- a/NEWS +++ b/NEWS @@ -59,13 +59,13 @@ included in the vX.Y.Z section and be denoted as: ------------------------ - OSHMEM updated to the OpenSHMEM 1.4 API. -- Do not build Open SHMEM layer when there are no SPMLs available. - Currently, this means the Open SHMEM layer will only build if +- Do not build OpenSHMEM layer when there are no SPMLs available. + Currently, this means the OpenSHMEM layer will only build if a MXM or UCX library is found. - A UCX BTL was added for enhanced MPI RMA support using UCX - With this release, OpenIB BTL now only supports iWarp and RoCE by default. -- Updated internal HWLOC to 2.0.1 -- Updated internal PMIx to 3.0.1 +- Updated internal HWLOC to 2.0.2 +- Updated internal PMIx to 3.0.2 - Change the priority for selecting external verses internal HWLOC and PMIx packages to build. Starting with this release, configure by default selects available external HWLOC and PMIx packages over From 0f984be3810a545bc5947212619f9c088fc4b5ce Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Fri, 28 Sep 2018 16:43:09 -0500 Subject: [PATCH 116/674] NEWS: PR5794 - change MTL OFI selection Signed-off-by: Geoffrey Paulsen --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 3437cdfc67a..4d9712e677d 100644 --- a/NEWS +++ b/NEWS @@ -78,6 +78,8 @@ included in the vX.Y.Z section and be denoted as: - Improved support for two phase MPI I/O operations when using OMPIO. - Added support for Software-based Performance Counters, see https://github.com/davideberius/ompi/wiki/How-to-Use-Software-Based-Performance-Counters-(SPCs)-in-Open-MPI +- Change MTL OFI from opting-IN on "psm,psm2,gni" to opting-OUT on + "shm,sockets,tcp,udp,rstream" - Various improvements to MPI RMA performance when using RDMA capable interconnects. - Update memkind component to use the memkind 1.6 public API. From 81f2f19398062695525ff964c9eb72553e1e0656 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 1 Oct 2018 15:30:28 -0700 Subject: [PATCH 117/674] btl/tcp: output the IP address correctly Per https://github.com/open-mpi/ompi/issues/3035#issuecomment-426085673, it looks like the IP address for a given interface is being stashed in two places: on the endpoint and on the module. 1. On the endpoint, it is storing the moral equivalent of a (struct sockaddr_in.sin_addr). 2. On the module, it is storing a full (struct sockaddr_storage). The call to opal_net_get_hostname() expects a full (struct sockaddr*) -- not just the stripped-down (struct sockaddr_in.sin_addr). Hence, when the original code was passing in the endpoint's (struct sockaddr_in.sin_addr) and opal_net_get_hostname() was treating it like a (struct sockaddr), hilarity ensued (i.e., we got the wrong output). This commit eliminates the call to opal_net_get_hostname() and just calls inet_ntop() directly to convert the (struct sockaddr_in.sin_addr) to a string. NOTE: Per the github comment cited above, there can be a disparity between the IP address cached on the endpoint vs. the IP address cached on the module. This only happens with interfaces that have more than one IP address. This commit does not fix that issue. Signed-off-by: Jeff Squyres (cherry picked from commit 5dae086f7e4aee28fbb5a7282a2661286a5f68fe) --- opal/mca/btl/tcp/btl_tcp_proc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/tcp/btl_tcp_proc.c b/opal/mca/btl/tcp/btl_tcp_proc.c index 28cf9a17789..5bc4e92828a 100644 --- a/opal/mca/btl/tcp/btl_tcp_proc.c +++ b/opal/mca/btl/tcp/btl_tcp_proc.c @@ -901,17 +901,22 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr /* No further use of this socket. Close it */ CLOSE_THE_SOCKET(sd); { - char *addr_str = NULL, *tmp, *pnet; + char *addr_str = NULL, *tmp; + char ip[128]; + ip[sizeof(ip) - 1] = '\0'; + for (size_t i = 0; i < btl_proc->proc_endpoint_count; i++) { mca_btl_base_endpoint_t* btl_endpoint = btl_proc->proc_endpoints[i]; if (btl_endpoint->endpoint_addr->addr_family != addr->sa_family) { continue; } - pnet = opal_net_get_hostname((struct sockaddr*)&btl_endpoint->endpoint_addr->addr_inet); + inet_ntop(btl_endpoint->endpoint_addr->addr_family, + (void*) &(btl_endpoint->endpoint_addr->addr_inet), + ip, sizeof(ip) - 1); if (NULL == addr_str) { - (void)asprintf(&tmp, "\n\t%s", pnet); + (void)asprintf(&tmp, "\n\t%s", ip); } else { - (void)asprintf(&tmp, "%s\n\t%s", addr_str, pnet); + (void)asprintf(&tmp, "%s\n\t%s", addr_str, ip); free(addr_str); } addr_str = tmp; From d450e460d6667df45276fc96c88cd7c9199cdd72 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 2 Oct 2018 11:37:18 -0400 Subject: [PATCH 118/674] Provide the correct socklen to bind. Get Brian's patch from #5825 and his log message: Fix a failure in binding the initiating side of a connection on MacOS. MacOS doesn't like passing the size of the storage structure (sockaddr_storage) instead of the expected size of the structure (sockaddr_in or sockaddr_in6), which was causing bind() failures. This patch simply changes the structure size to the expected size. Add a more clear error message in debug mode. Signed-off-by: George Bosilca (cherry picked from commit 9164e26e2f323c43c9a671cb510bb4df03e45628) --- opal/mca/btl/tcp/btl_tcp_endpoint.c | 31 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/opal/mca/btl/tcp/btl_tcp_endpoint.c b/opal/mca/btl/tcp/btl_tcp_endpoint.c index f8df420ff8e..e69cd863be9 100644 --- a/opal/mca/btl/tcp/btl_tcp_endpoint.c +++ b/opal/mca/btl/tcp/btl_tcp_endpoint.c @@ -717,34 +717,39 @@ static int mca_btl_tcp_endpoint_start_connect(mca_btl_base_endpoint_t* btl_endpo /* start the connect - will likely fail with EINPROGRESS */ mca_btl_tcp_proc_tosocks(btl_endpoint->endpoint_addr, &endpoint_addr); - + /* Bind the socket to one of the addresses associated with * this btl module. This sets the source IP to one of the * addresses shared in modex, so that the destination rank * can properly pair btl modules, even in cases where Linux * might do something unexpected with routing */ - opal_socklen_t sockaddr_addrlen = sizeof(struct sockaddr_storage); if (endpoint_addr.ss_family == AF_INET) { assert(NULL != &btl_endpoint->endpoint_btl->tcp_ifaddr); if (bind(btl_endpoint->endpoint_sd, (struct sockaddr*) &btl_endpoint->endpoint_btl->tcp_ifaddr, - sockaddr_addrlen) < 0) { - BTL_ERROR(("bind() failed: %s (%d)", strerror(opal_socket_errno), opal_socket_errno)); + sizeof(struct sockaddr_in)) < 0) { + BTL_ERROR(("bind on local address (%s:%d) failed: %s (%d)", + opal_net_get_hostname((struct sockaddr*) &btl_endpoint->endpoint_btl->tcp_ifaddr), + htons(((struct sockaddr_in*)&btl_endpoint->endpoint_btl->tcp_ifaddr)->sin_port), + strerror(opal_socket_errno), opal_socket_errno)); - CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd); - return OPAL_ERROR; - } + CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd); + return OPAL_ERROR; + } } #if OPAL_ENABLE_IPV6 if (endpoint_addr.ss_family == AF_INET6) { assert(NULL != &btl_endpoint->endpoint_btl->tcp_ifaddr_6); if (bind(btl_endpoint->endpoint_sd, (struct sockaddr*) &btl_endpoint->endpoint_btl->tcp_ifaddr_6, - sockaddr_addrlen) < 0) { - BTL_ERROR(("bind() failed: %s (%d)", strerror(opal_socket_errno), opal_socket_errno)); + sizeof(struct sockaddr_in6)) < 0) { + BTL_ERROR(("bind on local address (%s:%d) failed: %s (%d)", + opal_net_get_hostname((struct sockaddr*) &btl_endpoint->endpoint_btl->tcp_ifaddr), + htons(((struct sockaddr_in*)&btl_endpoint->endpoint_btl->tcp_ifaddr)->sin_port), + strerror(opal_socket_errno), opal_socket_errno)); - CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd); - return OPAL_ERROR; - } - } + CLOSE_THE_SOCKET(btl_endpoint->endpoint_sd); + return OPAL_ERROR; + } + } #endif opal_output_verbose(10, opal_btl_base_framework.framework_output, "btl: tcp: attempting to connect() to %s address %s on port %d", From b63bee5da445eb93c7ef2d599a2be3b601c4a452 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 1 Oct 2018 20:21:34 -0400 Subject: [PATCH 119/674] Small pedantic fixes. Signed-off-by: George Bosilca (cherry picked from commit a3a492b42cd7b114b435fafa7cd46222dc565dd1) --- opal/mca/btl/tcp/btl_tcp_component.c | 4 ++-- opal/mca/btl/tcp/btl_tcp_proc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/opal/mca/btl/tcp/btl_tcp_component.c b/opal/mca/btl/tcp/btl_tcp_component.c index e8b05880155..2d1004bcf74 100644 --- a/opal/mca/btl/tcp/btl_tcp_component.c +++ b/opal/mca/btl/tcp/btl_tcp_component.c @@ -361,9 +361,9 @@ static int mca_btl_tcp_component_open(void) #if OPAL_ENABLE_IPV6 mca_btl_tcp_component.tcp6_listen_sd = -1; #endif - mca_btl_tcp_component.tcp_num_btls=0; + mca_btl_tcp_component.tcp_num_btls = 0; mca_btl_tcp_component.tcp_addr_count = 0; - mca_btl_tcp_component.tcp_btls=NULL; + mca_btl_tcp_component.tcp_btls = NULL; /* initialize objects */ OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_lock, opal_mutex_t); diff --git a/opal/mca/btl/tcp/btl_tcp_proc.c b/opal/mca/btl/tcp/btl_tcp_proc.c index 28cf9a17789..a2dc9e75c79 100644 --- a/opal/mca/btl/tcp/btl_tcp_proc.c +++ b/opal/mca/btl/tcp/btl_tcp_proc.c @@ -732,12 +732,12 @@ int mca_btl_tcp_proc_insert( mca_btl_tcp_proc_t* btl_proc, } free(proc_data->local_interfaces[i]); } - free(proc_data->local_interfaces); + free(proc_data->local_interfaces); proc_data->local_interfaces = NULL; proc_data->max_local_interfaces = 0; - free(proc_data->weights); - free(proc_data->best_addr); - free(proc_data->best_assignment); + free(proc_data->weights); proc_data->weights = NULL; + free(proc_data->best_addr); proc_data->best_addr = NULL; + free(proc_data->best_assignment); proc_data->best_assignment = NULL; OBJ_DESTRUCT(&_proc_data.local_kindex_to_index); OBJ_DESTRUCT(&_proc_data.peer_kindex_to_index); From df6dd69db8ab828c020eb97e534545afccea72dc Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 2 Oct 2018 15:52:45 -0600 Subject: [PATCH 120/674] btl/vader: ensure the fast box tag is always read first On some platfoms reading a 64-bit value is non-atomic and it is possible that the two 32-bit values are read in the wrong order. To ensure the tag is always read first this commit reads the tag before reading the full 64-bit value. Signed-off-by: Nathan Hjelm (cherry picked from commit 66a7dc4c72cb25df67e7f872bee7a20b5fa9c763) --- opal/mca/btl/vader/btl_vader_fbox.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/vader/btl_vader_fbox.h b/opal/mca/btl/vader/btl_vader_fbox.h index f85a5f6a22a..5af802781e1 100644 --- a/opal/mca/btl/vader/btl_vader_fbox.h +++ b/opal/mca/btl/vader/btl_vader_fbox.h @@ -56,6 +56,16 @@ static inline void mca_btl_vader_fbox_set_header (mca_btl_vader_fbox_hdr_t *hdr, hdr->data.tag = tag; } +static inline mca_btl_vader_fbox_hdr_t mca_btl_vader_fbox_read_header (mca_btl_vader_fbox_hdr_t *hdr) +{ + mca_btl_vader_fbox_hdr_t tmp; + uint16_t tag = hdr->data.tag; + opal_atomic_rmb (); + tmp.ival = hdr->ival; + tmp.data.tag = tag; + return tmp; +} + /* attempt to reserve a contiguous segment from the remote ep */ static inline bool mca_btl_vader_fbox_sendi (mca_btl_base_endpoint_t *ep, unsigned char tag, void * restrict header, const size_t header_size, @@ -175,7 +185,7 @@ static inline bool mca_btl_vader_check_fboxes (void) int poll_count; for (poll_count = 0 ; poll_count <= MCA_BTL_VADER_POLL_COUNT ; ++poll_count) { - const mca_btl_vader_fbox_hdr_t hdr = {.ival = MCA_BTL_VADER_FBOX_HDR(ep->fbox_in.buffer + start)->ival}; + const mca_btl_vader_fbox_hdr_t hdr = mca_btl_vader_fbox_read_header (MCA_BTL_VADER_FBOX_HDR(ep->fbox_in.buffer + start)); /* check for a valid tag a sequence number */ if (0 == hdr.data.tag || hdr.data.seq != ep->fbox_in.seq) { From fa768d748fbb6e1ad31249d2ee74dfbd1c537548 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 2 Oct 2018 14:55:31 -0600 Subject: [PATCH 121/674] btl/vader: work around Oracle compiler bug This commit works around an Oracle C compiler bug in 5.15 (not sure when it was introduced). The bug is triggered when we chain assignments of atomic variables. Ex: _Atomic intptr x, y; intptr_t z = 0; x = y = z; Will produce a compiler error of the form: operand cannot have void type: op "=" assignment type mismatch: long "=" void To work around the issue we are removing the chain assignment and setting the head and tail on different lines. Fixes #5814 Signed-off-by: Nathan Hjelm (cherry picked from commit dfa8d3a81ac64e32d2bfb13a9afb20b83d747e03) --- opal/mca/btl/vader/btl_vader_fifo.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_fifo.h b/opal/mca/btl/vader/btl_vader_fifo.h index 0dc70bc8a13..178a416704f 100644 --- a/opal/mca/btl/vader/btl_vader_fifo.h +++ b/opal/mca/btl/vader/btl_vader_fifo.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2006-2007 Voltaire. All rights reserved. * Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010-2017 Los Alamos National Security, LLC. + * Copyright (c) 2010-2018 Los Alamos National Security, LLC. * All rights reserved. * $COPYRIGHT$ * @@ -155,7 +155,11 @@ static inline mca_btl_vader_hdr_t *vader_fifo_read (vader_fifo_t *fifo, struct m static inline void vader_fifo_init (vader_fifo_t *fifo) { - fifo->fifo_head = fifo->fifo_tail = VADER_FIFO_FREE; + /* due to a compiler bug in Oracle C 5.15 the following line was broken into two. Not + * ideal but oh well. See #5814 */ + /* fifo->fifo_head = fifo->fifo_tail = VADER_FIFO_FREE; */ + fifo->fifo_head = VADER_FIFO_FREE; + fifo->fifo_tail = VADER_FIFO_FREE; fifo->fbox_available = mca_btl_vader_component.fbox_max; mca_btl_vader_component.my_fifo = fifo; } From ed2bd82075c60ebbd4f20e3c6e3e4ff627dcc366 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Wed, 3 Oct 2018 11:45:06 -0500 Subject: [PATCH 122/674] Updating VERSION to v4.0.0rc4 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7b8dcc5fcbc..77fbbd4191e 100644 --- a/VERSION +++ b/VERSION @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc3 +greek=rc4 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From b9316d3136732bdc5a9268fefbba819eef0d4170 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Fri, 28 Sep 2018 17:17:52 +0900 Subject: [PATCH 123/674] fortran/use-mpi-f08: Correct f08 routine signatures Following the commit f750c6932c, I compared `ompi/mpi/fortran/use-mpi-f08/*.F90` and `ompi/mpi/fortran/use-mpi-f08/profile/p*.F90`, and `ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-interfaces.F90` and `ompi/mpi/fortran/use-mpi-f08/mod/pmpi-f08-interfaces.F90`. There are many differences. Some are bugs of `MPI_*`, some are bugs of `PMPI_*`. I'm not sure how these bugs affect applications. To make it easy to compare these files future, I also removed editorial differences. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit cf6d28cb66981cf315f84e5efb8f8256b6c6a3a4) --- ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 | 9 ++--- ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 | 3 +- .../fortran/use-mpi-f08/buffer_attach_f08.F90 | 3 +- .../fortran/use-mpi-f08/buffer_detach_f08.F90 | 3 +- .../fortran/use-mpi-f08/comm_spawn_f08.F90 | 3 +- .../use-mpi-f08/comm_spawn_multiple_f08.F90 | 3 +- .../fortran/use-mpi-f08/ialltoallw_f08.F90 | 4 +-- ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 | 5 +-- ompi/mpi/fortran/use-mpi-f08/improbe_f08.F90 | 2 ++ .../use-mpi-f08/ineighbor_allgather_f08.F90 | 4 ++- .../use-mpi-f08/ineighbor_allgatherv_f08.F90 | 4 ++- .../use-mpi-f08/ineighbor_alltoall_f08.F90 | 4 ++- .../use-mpi-f08/ineighbor_alltoallv_f08.F90 | 4 ++- .../use-mpi-f08/mod/mpi-f08-interfaces.F90 | 12 +++---- .../use-mpi-f08/mod/pmpi-f08-interfaces.F90 | 33 +++++++++---------- .../use-mpi-f08/neighbor_allgather_f08.F90 | 4 ++- .../use-mpi-f08/neighbor_allgatherv_f08.F90 | 4 ++- .../use-mpi-f08/neighbor_alltoall_f08.F90 | 4 ++- .../use-mpi-f08/neighbor_alltoallv_f08.F90 | 4 ++- .../fortran/use-mpi-f08/pack_external_f08.F90 | 4 ++- ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 | 4 ++- .../use-mpi-f08/profile/paccumulate_f08.F90 | 3 +- .../use-mpi-f08/profile/paint_add_f08.F90 | 7 ++-- .../use-mpi-f08/profile/pbcast_f08.F90 | 3 +- .../profile/pbuffer_attach_f08.F90 | 3 +- .../profile/pcomm_create_keyval_f08.F90 | 2 +- .../use-mpi-f08/profile/pcomm_spawn_f08.F90 | 3 +- .../profile/pcomm_spawn_multiple_f08.F90 | 3 +- .../profile/pcompare_and_swap_f08.F90 | 5 +-- .../use-mpi-f08/profile/pfetch_and_op_f08.F90 | 5 +-- .../use-mpi-f08/profile/pfree_mem_f08.F90 | 2 +- .../profile/pget_accumulate_f08.F90 | 5 +-- .../fortran/use-mpi-f08/profile/pget_f08.F90 | 3 +- .../profile/pget_processor_name_f08.F90 | 2 +- .../use-mpi-f08/profile/pibcast_f08.F90 | 3 +- .../use-mpi-f08/profile/pimprobe_f08.F90 | 4 +-- .../profile/pineighbor_allgather_f08.F90 | 4 ++- .../profile/pineighbor_allgatherv_f08.F90 | 4 ++- .../profile/pineighbor_alltoall_f08.F90 | 4 ++- .../profile/pineighbor_alltoallv_f08.F90 | 4 ++- .../profile/pineighbor_alltoallw_f08.F90 | 4 ++- .../use-mpi-f08/profile/pinfo_get_f08.F90 | 3 +- .../use-mpi-f08/profile/piprobe_f08.F90 | 2 ++ .../profile/pneighbor_allgather_f08.F90 | 4 ++- .../profile/pneighbor_allgatherv_f08.F90 | 4 ++- .../profile/pneighbor_alltoall_f08.F90 | 4 ++- .../profile/pneighbor_alltoallv_f08.F90 | 4 ++- .../profile/pneighbor_alltoallw_f08.F90 | 4 ++- .../profile/ppack_external_f08.F90 | 4 ++- .../fortran/use-mpi-f08/profile/ppack_f08.F90 | 4 ++- .../fortran/use-mpi-f08/profile/pput_f08.F90 | 3 +- .../use-mpi-f08/profile/praccumulate_f08.F90 | 3 +- .../use-mpi-f08/profile/precv_init_f08.F90 | 3 +- .../profile/prget_accumulate_f08.F90 | 5 +-- .../fortran/use-mpi-f08/profile/prget_f08.F90 | 3 +- .../fortran/use-mpi-f08/profile/prput_f08.F90 | 3 +- .../use-mpi-f08/profile/psendrecv_f08.F90 | 4 ++- .../profile/psendrecv_replace_f08.F90 | 3 +- .../use-mpi-f08/profile/ptype_vector_f08.F90 | 3 +- .../profile/punpack_external_f08.F90 | 4 ++- .../use-mpi-f08/profile/punpack_f08.F90 | 4 ++- .../use-mpi-f08/profile/pwin_attach_f08.F90 | 3 +- .../use-mpi-f08/profile/pwin_create_f08.F90 | 3 +- .../use-mpi-f08/profile/pwin_detach_f08.F90 | 3 +- .../use-mpi-f08/profile/pwin_sync_f08.F90 | 3 +- .../fortran/use-mpi-f08/raccumulate_f08.F90 | 2 +- .../mpi/fortran/use-mpi-f08/recv_init_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 | 4 ++- .../use-mpi-f08/sendrecv_replace_f08.F90 | 3 +- .../use-mpi-f08/status_set_cancelled_f08.F90 | 7 ++-- ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 | 7 ++-- .../use-mpi-f08/unpack_external_f08.F90 | 4 ++- ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 | 4 ++- .../fortran/use-mpi-f08/win_attach_f08.F90 | 3 +- .../fortran/use-mpi-f08/win_create_f08.F90 | 3 +- .../fortran/use-mpi-f08/win_detach_f08.F90 | 3 +- ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 | 3 +- 77 files changed, 211 insertions(+), 111 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 index 59dc78231e2..979ee41bf42 100644 --- a/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/aint_add_f08.F90 @@ -5,16 +5,17 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" -function MPI_Aint_add_f08(addr1, addr2) +function MPI_Aint_add_f08(base, disp) use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_aint_add_f implicit none INTEGER(MPI_ADDRESS_KIND) :: MPI_Aint_add_f08 - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr1 - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: addr2 - MPI_Aint_add_f08 = ompi_aint_add_f(addr1, addr2) + INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: base + INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: disp + MPI_Aint_add_f08 = ompi_aint_add_f(base, disp) end function MPI_Aint_add_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 index ca7acbe9bb7..a153bd02adb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/bcast_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -23,4 +24,4 @@ subroutine MPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) call ompi_bcast_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine MPI_Bcast_f08 +end subroutine MPI_Bcast_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 index 31e958bc582..2ab9073a602 100644 --- a/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/buffer_attach_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +13,7 @@ subroutine MPI_Buffer_attach_f08(buffer,size,ierror) use :: ompi_mpifh_bindings, only : ompi_buffer_attach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer INTEGER, INTENT(IN) :: size INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 index a0da19933c1..ee33b06d98f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/buffer_detach_f08.F90 @@ -5,13 +5,14 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPI_Buffer_detach_f08(buffer_addr,size,ierror) - use :: ompi_mpifh_bindings, only : ompi_buffer_detach_f USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR + use :: ompi_mpifh_bindings, only : ompi_buffer_detach_f implicit none TYPE(C_PTR), INTENT(OUT) :: buffer_addr INTEGER, INTENT(OUT) :: size diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 index a360d66b823..c25f43d31e2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & @@ -12,7 +13,7 @@ subroutine MPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & use :: mpi_f08_types, only : MPI_Info, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_comm_spawn_f implicit none - CHARACTER(LEN=*), INTENT(IN) :: command, argv + CHARACTER(LEN=*), INTENT(IN) :: command, argv(*) INTEGER, INTENT(IN) :: maxprocs, root TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 index d6d4ae37c3f..1dd2d776b65 100644 --- a/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/comm_spawn_multiple_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine MPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & @@ -15,7 +16,7 @@ subroutine MPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & implicit none INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: array_of_maxprocs(count) - CHARACTER(LEN=*), INTENT(IN) :: array_of_commands(count), array_of_argv(count) + CHARACTER(LEN=*), INTENT(IN) :: array_of_commands(count), array_of_argv(count, *) TYPE(MPI_Info), INTENT(IN) :: array_of_info(count) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: intercomm diff --git a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 index 07bd1a89b73..8e24f97e720 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ialltoallw_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -17,8 +18,7 @@ subroutine MPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: recvtypes(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 index 1ea1b56c512..4f01661b9ac 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ibcast_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine MPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ibcast_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -24,4 +25,4 @@ subroutine MPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) call ompi_ibcast_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,request%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine MPI_Ibcast_f08 +end subroutine MPI_Ibcast_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/improbe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/improbe_f08.F90 index 9d9cf23387d..946c9730ebc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/improbe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/improbe_f08.F90 @@ -3,6 +3,7 @@ ! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2010-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine MPI_Improbe_f08(source,tag,comm,flag,message,status,ierror) @@ -33,4 +34,5 @@ end subroutine PMPI_Improbe call PMPI_Improbe(source,tag,comm%MPI_VAL,flag,message%MPI_VAL,status,c_ierror) if (present(ierror)) ierror = c_ierror + end subroutine MPI_Improbe_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 index a7879534d5a..d2d4eb0eacb 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgather_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPI_Ineighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvco use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 index de8d30a04aa..f5c29907f52 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_allgatherv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Ineighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvc use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 index 4b1fc585f0f..fd556250103 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoall_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Ineighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 index 654bec79174..8408d86e1bd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/ineighbor_alltoallv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvb use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype 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 2d3a6eb15e4..55ae341d800 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 @@ -9,7 +9,7 @@ ! Copyright (c) 2012 Inria. All rights reserved. ! Copyright (c) 2015-2017 Research Organization for Information Science ! and Technology (RIST). All rights reserved. -! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! ! This file provides the interface specifications for the MPI Fortran @@ -1086,7 +1086,7 @@ subroutine MPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvty !IBM* IGNORE_TKR sendbuf, recvbuf OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf - INTEGER, INTENT(IN) :: sendcount, recvcount + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1128,7 +1128,7 @@ subroutine MPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvco INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine MPI_Ialltoallv_f08 end interface MPI_Ialltoallv @@ -1167,7 +1167,7 @@ subroutine MPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recvc INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine MPI_Ialltoallw_f08 end interface MPI_Ialltoallw @@ -4690,7 +4690,7 @@ subroutine MPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvb INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine MPI_Ineighbor_alltoallv_f08 end interface MPI_Ineighbor_alltoallv @@ -4731,7 +4731,7 @@ subroutine MPI_Ineighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,recv INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine MPI_Ineighbor_alltoallw_f08 end interface MPI_Ineighbor_alltoallw 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 5aa561190fb..6e02e8aac2c 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 @@ -9,7 +9,7 @@ ! Copyright (c) 2012 Inria. All rights reserved. ! Copyright (c) 2015-2017 Research Organization for Information Science ! and Technology (RIST). All rights reserved. -! Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +! Copyright (c) 2017-2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! ! This file provides the interface specifications for the MPI Fortran @@ -1084,10 +1084,9 @@ subroutine PMPI_Ialltoall_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,recvt !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcount - INTEGER, ASYNCHRONOUS :: recvcount + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Request), INTENT(OUT) :: request @@ -1129,7 +1128,7 @@ subroutine PMPI_Ialltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,recvc INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine PMPI_Ialltoallv_f08 end interface PMPI_Ialltoallv @@ -1168,7 +1167,7 @@ subroutine PMPI_Ialltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,recvbuf,recv INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine PMPI_Ialltoallw_f08 end interface PMPI_Ialltoallw @@ -1444,9 +1443,9 @@ subroutine PMPI_Reduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf - INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + INTEGER, INTENT(IN) :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1464,9 +1463,9 @@ subroutine PMPI_Ireduce_scatter_f08(sendbuf,recvbuf,recvcounts,datatype,op,comm, !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm @@ -1544,8 +1543,8 @@ subroutine PMPI_Iscan_f08(sendbuf,recvbuf,count,datatype,op,comm,request,ierror) !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op @@ -4691,7 +4690,7 @@ subroutine PMPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recv INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype, recvtype TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine PMPI_Ineighbor_alltoallv_f08 end interface PMPI_Ineighbor_alltoallv @@ -4732,7 +4731,7 @@ subroutine PMPI_Ineighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,rec INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm - TYPE(MPI_Request), INTENT(IN) :: request + TYPE(MPI_Request), INTENT(OUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror end subroutine PMPI_Ineighbor_alltoallw_f08 end interface PMPI_Ineighbor_alltoallw diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 index 77ebbcb0490..251a141182f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgather_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPI_Neighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvcou use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 index 93facd3c66a..b837ba44ff2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_allgatherv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Neighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvco use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 index 77aea7d9b4d..1567bef7d5e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoall_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Neighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 index 5836540f320..4e3a2e91c56 100644 --- a/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/neighbor_alltoallv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Neighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvbu use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 index 99c09a9a556..af84cdac291 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_external_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -15,7 +16,8 @@ subroutine MPI_Pack_external_f08(datarep,inbuf,incount,datatype,outbuf,outsize, use :: ompi_mpifh_bindings, only : ompi_pack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: incount TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: outsize diff --git a/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 index 02f5de25123..bee3d73a0e5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/pack_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPI_Pack_f08(inbuf,incount,datatype,outbuf,outsize,position,comm,ierr use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_pack_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: incount, outsize TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(INOUT) :: position diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 index a8f1b366f27..d4a21acb5da 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/paccumulate_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -15,7 +16,7 @@ subroutine PMPI_Accumulate_f08(origin_addr,origin_count,origin_datatype,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_accumulate_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 index 08d65da8c52..324de48ae75 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/paint_add_f08.F90 @@ -5,16 +5,17 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" -function PMPI_Aint_add_f08(base, diff) +function PMPI_Aint_add_f08(base, disp) use :: mpi_f08_types, only : MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_aint_add_f implicit none INTEGER(MPI_ADDRESS_KIND) :: PMPI_Aint_add_f08 INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: base - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: diff - PMPI_Aint_add_f08 = ompi_aint_add_f(base, diff) + INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: disp + PMPI_Aint_add_f08 = ompi_aint_add_f(base, disp) end function PMPI_Aint_add_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 index 737542bbf15..94c7efd7ac2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbcast_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -23,4 +24,4 @@ subroutine PMPI_Bcast_f08(buffer,count,datatype,root,comm,ierror) call ompi_bcast_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine PMPI_Bcast_f08 +end subroutine PMPI_Bcast_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 index e6845486291..2be69db7fde 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pbuffer_attach_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -12,7 +13,7 @@ subroutine PMPI_Buffer_attach_f08(buffer,size,ierror) use :: ompi_mpifh_bindings, only : ompi_buffer_attach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer INTEGER, INTENT(IN) :: size INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 index bd50696b61d..1a758ff4c3f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_create_keyval_f08.F90 @@ -27,7 +27,7 @@ subroutine PMPI_Comm_create_keyval_f08(comm_copy_attr_fn,comm_delete_attr_fn,& fcopy_fn = c_funloc(comm_copy_attr_fn) fdelete_fn = c_funloc(comm_delete_attr_fn) - call ompi_comm_create_keyval_f(fcopy_fn, fdelete_fn,& + call ompi_comm_create_keyval_f(fcopy_fn,fdelete_fn,& comm_keyval,extra_state,c_ierror) if (present(ierror)) ierror = c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 index f87155ba1e6..ae81928cfca 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & @@ -12,7 +13,7 @@ subroutine PMPI_Comm_spawn_f08(command,argv,maxprocs,info,root,comm,intercomm, & use :: mpi_f08_types, only : MPI_Info, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_comm_spawn_f implicit none - CHARACTER(LEN=*), INTENT(IN) :: command, argv + CHARACTER(LEN=*), INTENT(IN) :: command, argv(*) INTEGER, INTENT(IN) :: maxprocs, root TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 index dea1f169a67..6f1c00c1504 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcomm_spawn_multiple_f08.F90 @@ -6,6 +6,7 @@ ! All Rights reserved. ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & @@ -16,7 +17,7 @@ subroutine PMPI_Comm_spawn_multiple_f08(count,array_of_commands,array_of_argv, & implicit none INTEGER, INTENT(IN) :: count, root INTEGER, INTENT(IN) :: array_of_maxprocs(count) - CHARACTER(LEN=*), INTENT(IN) :: array_of_commands(count), array_of_argv(count) + CHARACTER(LEN=*), INTENT(IN) :: array_of_commands(count), array_of_argv(count, *) TYPE(MPI_Info), INTENT(IN) :: array_of_info(count) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Comm), INTENT(OUT) :: intercomm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 index 0232cecff07..9f6f284bb8c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pcompare_and_swap_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -15,8 +16,8 @@ subroutine PMPI_Compare_and_swap_f08(origin_addr,compare_addr,result_addr,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_compare_and_swap_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr, compare_addr - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr, compare_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: target_rank INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 index 7e031aedeef..bbdc91a4a87 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfetch_and_op_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,8 +15,8 @@ subroutine PMPI_Fetch_and_op_f08(origin_addr,result_addr,datatype,target_rank, & use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_fetch_and_op_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(IN) :: target_rank INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 index c99160b0acc..1ec5228faf3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pfree_mem_f08.F90 @@ -12,7 +12,7 @@ subroutine PMPI_Free_mem_f08(base,ierror) use :: ompi_mpifh_bindings, only : ompi_free_mem_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE,INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 index 66b223c257b..52d16d81bf6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_accumulate_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -16,10 +17,10 @@ subroutine PMPI_Get_accumulate_f08(origin_addr,origin_count,origin_datatype,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_get_accumulate_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr TYPE(MPI_Datatype), INTENT(IN) :: result_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp TYPE(MPI_Datatype), INTENT(IN) :: target_datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 index 9b77132f189..1f4fcbac8a4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine PMPI_Get_f08(origin_addr,origin_count,origin_datatype,target_rank,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_get_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 index f05919d3f1c..ec8e0ecb905 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pget_processor_name_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Get_processor_name_f08(name,resultlen,ierror) @@ -18,5 +19,4 @@ subroutine PMPI_Get_processor_name_f08(name,resultlen,ierror) call ompi_get_processor_name_f(name,resultlen,c_ierror,len(name)) if (present(ierror)) ierror = c_ierror - end subroutine PMPI_Get_processor_name_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 index be68659cf3e..06bb1a82b32 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pibcast_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -24,4 +25,4 @@ subroutine PMPI_Ibcast_f08(buffer,count,datatype,root,comm,request,ierror) call ompi_ibcast_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,request%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine PMPI_Ibcast_f08 +end subroutine PMPI_Ibcast_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pimprobe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pimprobe_f08.F90 index e219494f034..e7a11a76ea2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pimprobe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pimprobe_f08.F90 @@ -16,6 +16,8 @@ subroutine PMPI_Improbe_f08(source,tag,comm,flag,message,status,ierror) INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror + ! See note in mpi-f-interfaces-bind.h for why we include an + ! interface here and call a PMPI_* subroutine below. interface subroutine PMPI_Improbe(source, tag, comm, flag, message, status, ierror) use :: mpi_f08_types, only : MPI_Status @@ -29,8 +31,6 @@ subroutine PMPI_Improbe(source, tag, comm, flag, message, status, ierror) end subroutine PMPI_Improbe end interface - ! See note in ompi/mpi/fortran/use-mpi-f08/iprobe_f09.F90 about why - ! we call an PMPI_* subroutine here call PMPI_Improbe(source,tag,comm%MPI_VAL,flag,message%MPI_VAL,status,c_ierror) if (present(ierror)) ierror = c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 index d77c9e49423..750e4358d47 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgather_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPI_Ineighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvc use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 index 1968c2272eb..d0fb5864493 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_allgatherv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Ineighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recv use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 index 63519f24bc3..e54522aec63 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoall_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Ineighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 index 5efdd0089d2..ced4f992c69 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Ineighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recv use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 index 2b5cd0a5cde..5e17b850ce6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pineighbor_alltoallw_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Ineighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_ineighbor_alltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_f08.F90 index 3170e95688c..837dd143523 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pinfo_get_f08.F90 @@ -3,6 +3,7 @@ ! Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Info_get_f08(info,key,valuelen,value,flag,ierror) @@ -19,6 +20,6 @@ subroutine PMPI_Info_get_f08(info,key,valuelen,value,flag,ierror) INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror - call PMPI_Info_get(info%MPI_VAL,key,valuelen,value,flag,c_ierror); + call PMPI_Info_get(info%MPI_VAL,key,valuelen,value,flag,c_ierror) if (present(ierror)) ierror = c_ierror end subroutine PMPI_Info_get_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/piprobe_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/piprobe_f08.F90 index 385b99baf8c..5c4eadda03b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/piprobe_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/piprobe_f08.F90 @@ -3,6 +3,7 @@ ! Copyright (c) 2009-2013 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Iprobe_f08(source,tag,comm,flag,status,ierror) @@ -31,4 +32,5 @@ end subroutine PMPI_Iprobe call PMPI_Iprobe(source,tag,comm%MPI_VAL,flag,status,c_ierror) if (present(ierror)) ierror = c_ierror + end subroutine PMPI_Iprobe_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 index 10f7d3ab2a4..aa0a778ab8d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgather_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPI_Neighbor_allgather_f08(sendbuf,sendcount,sendtype,recvbuf,recvco use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_allgather_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 index 48d25a43d39..512571e948e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_allgatherv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Neighbor_allgatherv_f08(sendbuf,sendcount,sendtype,recvbuf,recvc use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_allgatherv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount INTEGER, INTENT(IN) :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 index 844173d121c..5af98ad064b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoall_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Neighbor_alltoall_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoall_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 index 58a1a1cff15..1ef59e429ec 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Neighbor_alltoallv_f08(sendbuf,sendcounts,sdispls,sendtype,recvb use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 index 7d5535afda8..f1fe0d5a733 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pneighbor_alltoallw_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Neighbor_alltoallw_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_neighbor_alltoallw_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 index a5bf98e41f1..ab6c6d1df7b 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_external_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -15,7 +16,8 @@ subroutine PMPI_Pack_external_f08(datarep,inbuf,incount,datatype,outbuf,outsize, use :: ompi_mpifh_bindings, only : ompi_pack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: incount TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: outsize diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 index 7860b1cce98..866668a17fd 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ppack_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPI_Pack_f08(inbuf,incount,datatype,outbuf,outsize,position,comm,ier use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_pack_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: incount, outsize TYPE(MPI_Datatype), INTENT(IN) :: datatype INTEGER, INTENT(INOUT) :: position diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 index ced762447f6..5fe3dd82369 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pput_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine PMPI_Put_f08(origin_addr,origin_count,origin_datatype,target_rank,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_put_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 index cea5d2f2dc1..fbf91d6dbfe 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/praccumulate_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -15,7 +16,7 @@ subroutine PMPI_Raccumulate_f08(origin_addr,origin_count,origin_datatype,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_raccumulate_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 index ac3a8da1882..3425aca80bc 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/precv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine PMPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_recv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, source, tag TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 index 90eb3ffd8c6..06ccfec1d13 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prget_accumulate_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -16,10 +17,10 @@ subroutine PMPI_Rget_accumulate_f08(origin_addr,origin_count,origin_datatype,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_rget_accumulate_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, result_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype - OMPI_FORTRAN_IGNORE_TKR_TYPE :: result_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: result_addr TYPE(MPI_Datatype), INTENT(IN) :: result_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp TYPE(MPI_Datatype), INTENT(IN) :: target_datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 index 24982b43885..fd7cba0447c 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prget_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine PMPI_Rget_f08(origin_addr,origin_count,origin_datatype,target_rank,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_rget_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 index bf0eb59270b..5a3a4dc6d9f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/prput_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine PMPI_Rput_f08(origin_addr,origin_count,origin_datatype,target_rank,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Win, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_rput_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 index b01fe08be78..1fe911e9632 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Sendrecv_f08(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, & use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status use :: ompi_mpifh_bindings, only : ompi_sendrecv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 index 1bf25cffe02..7f6bede48f3 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/psendrecv_replace_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine PMPI_Sendrecv_replace_f08(buf,count,datatype,dest,sendtag,source, & use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status use :: ompi_mpifh_bindings, only : ompi_sendrecv_replace_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 index 0a6b554f3e0..4c035c607b4 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/ptype_vector_f08.F90 @@ -5,10 +5,11 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Type_vector_f08(count,blocklength,stride,oldtype,newtype,ierror) - use :: mpi_f08_types, only : MPI_Datatype, MPI_ADDRESS_KIND + use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_vector_f implicit none INTEGER, INTENT(IN) :: count, blocklength, stride diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 index c089ece2e33..783eb2e4362 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_external_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPI_Unpack_external_f08(datarep,inbuf,insize,position,outbuf,outcoun use :: ompi_mpifh_bindings, only : ompi_unpack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: insize INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position INTEGER, INTENT(IN) :: outcount diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 index f22b87610d2..5ff77842262 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/punpack_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPI_Unpack_f08(inbuf,insize,position,outbuf,outcount,datatype,comm,i use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_unpack_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: insize, outcount INTEGER, INTENT(INOUT) :: position TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 index 9cde0bf4228..c483e7620d6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_attach_f08.F90 @@ -2,6 +2,7 @@ ! ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +11,7 @@ subroutine PMPI_Win_attach_f08(win,base,size,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_attach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 index 6c0d72609d0..636f0d5b1d8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_create_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine PMPI_Win_create_f08(base,size,disp_unit,info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_create_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 index 26202444b4d..962a6c270ae 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_detach_f08.F90 @@ -2,6 +2,7 @@ ! ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +11,7 @@ subroutine PMPI_Win_detach_f08(win,base,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_detach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 index ba8050b0f51..0961908dfb8 100644 --- a/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/profile/pwin_sync_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine PMPI_Win_sync_f08(win,ierror) @@ -18,4 +19,4 @@ subroutine PMPI_Win_sync_f08(win,ierror) call ompi_win_sync_f(win%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine PMPI_Win_sync_f08 +end subroutine PMPI_Win_sync_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 index 8ec0eabe2ce..2e07d077660 100644 --- a/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/raccumulate_f08.F90 @@ -15,7 +15,7 @@ subroutine MPI_Raccumulate_f08(origin_addr,origin_count,origin_datatype,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Win, MPI_Request, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_raccumulate_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN),ASYNCHRONOUS :: origin_addr + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: origin_addr INTEGER, INTENT(IN) :: origin_count, target_rank, target_count TYPE(MPI_Datatype), INTENT(IN) :: origin_datatype INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: target_disp diff --git a/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 index 877e7da8593..70491ffd169 100644 --- a/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/recv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine MPI_Recv_init_f08(buf,count,datatype,source,tag,comm,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Request use :: ompi_mpifh_bindings, only : ompi_recv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, source, tag TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 index 8166e663a66..44bb08570f6 100644 --- a/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/sendrecv_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Sendrecv_f08(sendbuf,sendcount,sendtype,dest,sendtag,recvbuf, & use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status use :: ompi_mpifh_bindings, only : ompi_sendrecv_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf INTEGER, INTENT(IN) :: sendcount, dest, sendtag, recvcount, source, recvtag TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 index 2fbad9427ec..a1d56ef662f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/sendrecv_replace_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,7 @@ subroutine MPI_Sendrecv_replace_f08(buf,count,datatype,dest,sendtag,source, & use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Status use :: ompi_mpifh_bindings, only : ompi_sendrecv_replace_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: buf INTEGER, INTENT(IN) :: count, dest, sendtag, source, recvtag TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpi/fortran/use-mpi-f08/status_set_cancelled_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/status_set_cancelled_f08.F90 index 648e1b48c43..d8f0e0cf372 100644 --- a/ompi/mpi/fortran/use-mpi-f08/status_set_cancelled_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/status_set_cancelled_f08.F90 @@ -3,6 +3,7 @@ ! Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All Rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine MPI_Status_set_cancelled_f08(status,flag,ierror) @@ -13,13 +14,15 @@ subroutine MPI_Status_set_cancelled_f08(status,flag,ierror) INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror + ! See note in mpi-f-interfaces-bind.h for why we include an + ! interface here and call a PMPI_* subroutine below. interface - subroutine MPI_Status_set_cancelled(status, flag, ierror) + subroutine PMPI_Status_set_cancelled(status, flag, ierror) use :: mpi_f08_types, only : MPI_Status type(MPI_Status), intent(inout) :: status logical, intent(in) :: flag integer, intent(out) :: ierror - end subroutine MPI_Status_set_cancelled + end subroutine PMPI_Status_set_cancelled end interface call PMPI_Status_set_cancelled(status,flag,c_ierror) diff --git a/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 index 5a9b13c5d83..b9b1e0a0de0 100644 --- a/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/type_dup_f08.F90 @@ -5,18 +5,19 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ -subroutine MPI_Type_dup_f08(datatype,newtype,ierror) +subroutine MPI_Type_dup_f08(oldtype,newtype,ierror) use :: mpi_f08_types, only : MPI_Datatype use :: ompi_mpifh_bindings, only : ompi_type_dup_f implicit none - TYPE(MPI_Datatype), INTENT(IN) :: datatype + TYPE(MPI_Datatype), INTENT(IN) :: oldtype TYPE(MPI_Datatype), INTENT(OUT) :: newtype INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror - call ompi_type_dup_f(datatype%MPI_VAL,newtype%MPI_VAL,c_ierror) + call ompi_type_dup_f(oldtype%MPI_VAL,newtype%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror end subroutine MPI_Type_dup_f08 diff --git a/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 index c77178240b4..5cbd47c5e2f 100644 --- a/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/unpack_external_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPI_Unpack_external_f08(datarep,inbuf,insize,position,outbuf,outcount use :: ompi_mpifh_bindings, only : ompi_unpack_external_f implicit none CHARACTER(LEN=*), INTENT(IN) :: datarep - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: insize INTEGER(MPI_ADDRESS_KIND), INTENT(INOUT) :: position INTEGER, INTENT(IN) :: outcount diff --git a/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 index 4e1b6719b75..929a58ebda5 100644 --- a/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/unpack_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPI_Unpack_f08(inbuf,insize,position,outbuf,outcount,datatype,comm,ie use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm use :: ompi_mpifh_bindings, only : ompi_unpack_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf, outbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: inbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE :: outbuf INTEGER, INTENT(IN) :: insize, outcount INTEGER, INTENT(INOUT) :: position TYPE(MPI_Datatype), INTENT(IN) :: datatype diff --git a/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 index bad1e0d1df6..f932ed50b68 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_attach_f08.F90 @@ -2,6 +2,7 @@ ! ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +11,7 @@ subroutine MPI_Win_attach_f08(win,base,size,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_attach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 index 19236d84992..4e24943fb83 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_create_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine MPI_Win_create_f08(base,size,disp_unit,info,comm,win,ierror) use :: mpi_f08_types, only : MPI_Info, MPI_Comm, MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_create_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: size INTEGER, INTENT(IN) :: disp_unit TYPE(MPI_Info), INTENT(IN) :: info diff --git a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 index 9ed85491619..976333a118e 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_detach_f08.F90 @@ -2,6 +2,7 @@ ! ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -10,7 +11,7 @@ subroutine MPI_Win_detach_f08(win,base,ierror) use :: mpi_f08_types, only : MPI_Win, MPI_ADDRESS_KIND use :: ompi_mpifh_bindings, only : ompi_win_detach_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: base + OMPI_FORTRAN_IGNORE_TKR_TYPE :: base TYPE(MPI_Win), INTENT(IN) :: win INTEGER, OPTIONAL, INTENT(OUT) :: ierror integer :: c_ierror diff --git a/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 b/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 index 8d9cb324c43..fa3f21cbf54 100644 --- a/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 +++ b/ompi/mpi/fortran/use-mpi-f08/win_sync_f08.F90 @@ -5,6 +5,7 @@ ! All Rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ subroutine MPI_Win_sync_f08(win,ierror) @@ -18,4 +19,4 @@ subroutine MPI_Win_sync_f08(win,ierror) call ompi_win_sync_f(win%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine MPI_Win_sync_f08 +end subroutine MPI_Win_sync_f08 From fcc698f27fddef0fd701ff4e26910c44859763e3 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Thu, 4 Oct 2018 19:50:20 +0900 Subject: [PATCH 124/674] mpiext/pcollreq: Correct f08 routine signatures Changes of nonblocking collectives in e98d794e8b and f750c6932c are applied to persistent collectives. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 357531847e819bf8c33224e0cc9004ed47b42445) --- .../pcollreq/use-mpi-f08/allgather_init_f08.F90 | 4 +++- .../pcollreq/use-mpi-f08/allgatherv_init_f08.F90 | 6 ++++-- .../pcollreq/use-mpi-f08/allreduce_init_f08.F90 | 4 +++- .../pcollreq/use-mpi-f08/alltoall_init_f08.F90 | 4 +++- .../pcollreq/use-mpi-f08/alltoallv_init_f08.F90 | 6 ++++-- .../pcollreq/use-mpi-f08/alltoallw_init_f08.F90 | 9 +++++---- .../mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 | 2 +- .../pcollreq/use-mpi-f08/exscan_init_f08.F90 | 4 +++- .../pcollreq/use-mpi-f08/gather_init_f08.F90 | 6 ++++-- .../pcollreq/use-mpi-f08/gatherv_init_f08.F90 | 8 +++++--- .../use-mpi-f08/neighbor_allgather_init_f08.F90 | 4 +++- .../use-mpi-f08/neighbor_allgatherv_init_f08.F90 | 8 +++++--- .../use-mpi-f08/neighbor_alltoall_init_f08.F90 | 6 ++++-- .../use-mpi-f08/neighbor_alltoallv_init_f08.F90 | 8 +++++--- .../use-mpi-f08/neighbor_alltoallw_init_f08.F90 | 14 +++++++------- .../use-mpi-f08/profile/pallgather_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/pallgatherv_init_f08.F90 | 6 ++++-- .../use-mpi-f08/profile/pallreduce_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/palltoall_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/palltoallv_init_f08.F90 | 6 ++++-- .../use-mpi-f08/profile/palltoallw_init_f08.F90 | 9 +++++---- .../use-mpi-f08/profile/pbcast_init_f08.F90 | 5 +++-- .../use-mpi-f08/profile/pexscan_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/pgather_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/pgatherv_init_f08.F90 | 6 ++++-- .../profile/pneighbor_allgather_init_f08.F90 | 4 +++- .../profile/pneighbor_allgatherv_init_f08.F90 | 8 +++++--- .../profile/pneighbor_alltoall_init_f08.F90 | 6 ++++-- .../profile/pneighbor_alltoallv_init_f08.F90 | 8 +++++--- .../profile/pneighbor_alltoallw_init_f08.F90 | 14 +++++++------- .../use-mpi-f08/profile/preduce_init_f08.F90 | 4 +++- .../profile/preduce_scatter_block_init_f08.F90 | 4 +++- .../profile/preduce_scatter_init_f08.F90 | 6 ++++-- .../use-mpi-f08/profile/pscan_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/pscatter_init_f08.F90 | 4 +++- .../use-mpi-f08/profile/pscatterv_init_f08.F90 | 6 ++++-- .../pcollreq/use-mpi-f08/reduce_init_f08.F90 | 4 +++- .../use-mpi-f08/reduce_scatter_block_init_f08.F90 | 4 +++- .../use-mpi-f08/reduce_scatter_init_f08.F90 | 6 ++++-- ompi/mpiext/pcollreq/use-mpi-f08/scan_init_f08.F90 | 4 +++- .../pcollreq/use-mpi-f08/scatter_init_f08.F90 | 6 ++++-- .../pcollreq/use-mpi-f08/scatterv_init_f08.F90 | 8 +++++--- 42 files changed, 160 insertions(+), 85 deletions(-) diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/allgather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/allgather_init_f08.F90 index 123b17a3f49..f31cd539644 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/allgather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/allgather_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount, use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allgather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/allgatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/allgatherv_init_f08.F90 index e3890d3df4e..db2f5eeafaf 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/allgatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/allgatherv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,9 +15,10 @@ subroutine MPIX_Allgatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allgatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/allreduce_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/allreduce_init_f08.F90 index 3576aedf645..d31e21f88d0 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/allreduce_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/allreduce_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Allreduce_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info,r use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allreduce_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/alltoall_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/alltoall_init_f08.F90 index 5a6815ff884..59728df95c7 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/alltoall_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/alltoall_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine MPIX_Alltoall_init_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoall_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/alltoallv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/alltoallv_init_f08.F90 index 81dea6e5be7..133536c59ca 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/alltoallv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/alltoallv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,8 +15,9 @@ subroutine MPIX_Alltoallv_init_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoallv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/alltoallw_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/alltoallw_init_f08.F90 index d32bff3fe4c..d1b91a5788c 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/alltoallw_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/alltoallw_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,10 +15,10 @@ subroutine MPIX_Alltoallw_init_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoallw_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 index 107a9554dd2..0a2b2bd9360 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/bcast_init_f08.F90 @@ -14,7 +14,7 @@ subroutine MPIX_Bcast_init_f08(buffer,count,datatype,root,comm,info,request,ierr use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_bcast_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/exscan_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/exscan_init_f08.F90 index 1a47ee02e56..ceefd482f52 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/exscan_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/exscan_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Exscan_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info,requ use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_exscan_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/gather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/gather_init_f08.F90 index d43854645e7..a5e93e9f1cc 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/gather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/gather_init_f08.F90 @@ -5,16 +5,18 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Gather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& - recvtype,root,comm,info,request,ierror) + recvtype,root,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_gather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/gatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/gatherv_init_f08.F90 index 79b437a7f38..411b557a231 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/gatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/gatherv_init_f08.F90 @@ -5,18 +5,20 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Gatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& - displs,recvtype,root,comm,info,request,ierror) + displs,recvtype,root,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_gatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgather_init_f08.F90 index bf793dec81f..3beedf850b8 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgather_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Neighbor_allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,r use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_allgather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgatherv_init_f08.F90 index 80c3a853d41..524f51cf484 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_allgatherv_init_f08.F90 @@ -5,18 +5,20 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Neighbor_allgatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& - displs,recvtype,comm,info,request,ierror) + displs,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_allgatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoall_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoall_init_f08.F90 index 5a873169ef4..8f79b893451 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoall_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoall_init_f08.F90 @@ -5,16 +5,18 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Neighbor_alltoall_init_f08(sendbuf,sendcount,sendtype,recvbuf,& - recvcount,recvtype,comm,info,request,ierror) + recvcount,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoall_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallv_init_f08.F90 index 9ea9a68f144..c973d652f06 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallv_init_f08.F90 @@ -5,17 +5,19 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Neighbor_alltoallv_init_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& - recvcounts,rdispls,recvtype,comm,info,request,ierror) + recvcounts,rdispls,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoallv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallw_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallw_init_f08.F90 index de6ad3ff855..4ad00d1f2fb 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallw_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/neighbor_alltoallw_init_f08.F90 @@ -10,16 +10,16 @@ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Neighbor_alltoallw_init_f08(sendbuf,sendcounts,sdispls,sendtypes,& - recvbuf,recvcounts,rdispls,recvtypes,comm,info,request,ierror) + recvbuf,recvcounts,rdispls,recvtypes,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request, MPI_ADDRESS_KIND use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoallw_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), recvcounts(*) + INTEGER(MPI_ADDRESS_KIND), INTENT(IN), ASYNCHRONOUS :: sdispls(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgather_init_f08.F90 index f45c0db4744..d9e1e1ffb79 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgather_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allgather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgatherv_init_f08.F90 index 6fe7d67ffd7..d719fcfeb37 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallgatherv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,9 +15,10 @@ subroutine PMPIX_Allgatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcoun use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allgatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallreduce_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallreduce_init_f08.F90 index c65c3b7f5c6..e89a652c241 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallreduce_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pallreduce_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Allreduce_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info, use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_allreduce_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoall_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoall_init_f08.F90 index 6a99a669a2b..6bf635c3bd4 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoall_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoall_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPIX_Alltoall_init_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoall_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallv_init_f08.F90 index f7f629fcf53..7b16e20d404 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,8 +15,9 @@ subroutine PMPIX_Alltoallv_init_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf, use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoallv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallw_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallw_init_f08.F90 index caa54255b55..f2d108e5e0c 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallw_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/palltoallw_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,10 +15,10 @@ subroutine PMPIX_Alltoallw_init_f08(sendbuf,sendcounts,sdispls,sendtypes,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_alltoallw_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*), recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pbcast_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pbcast_init_f08.F90 index ca17006ea3d..8b0e83cb214 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pbcast_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pbcast_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,7 @@ subroutine PMPIX_Bcast_init_f08(buffer,count,datatype,root,comm,info,request,ier use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_bcast_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: buffer INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Comm), INTENT(IN) :: comm @@ -25,4 +26,4 @@ subroutine PMPIX_Bcast_init_f08(buffer,count,datatype,root,comm,info,request,ier call ompix_bcast_init_f(buffer,count,datatype%MPI_VAL,root,comm%MPI_VAL,info%MPI_VAL,request%MPI_VAL,c_ierror) if (present(ierror)) ierror = c_ierror - end subroutine PMPIX_Bcast_init_f08 +end subroutine PMPIX_Bcast_init_f08 diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pexscan_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pexscan_init_f08.F90 index e93d88036b9..0feb7fb45aa 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pexscan_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pexscan_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Exscan_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info,req use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_exscan_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgather_init_f08.F90 index 3d85ee38068..45b8ac796e2 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgather_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPIX_Gather_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcount,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_gather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgatherv_init_f08.F90 index 2bd002a1131..42c7ad89722 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pgatherv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,9 +15,10 @@ subroutine PMPIX_Gatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts, use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_gatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, root - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgather_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgather_init_f08.F90 index c87a71b44bc..c8a9caa8de7 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgather_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgather_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Neighbor_allgather_init_f08(sendbuf,sendcount,sendtype,recvbuf, use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_allgather_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgatherv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgatherv_init_f08.F90 index faa259ef648..66ce3aefc15 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgatherv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_allgatherv_init_f08.F90 @@ -5,18 +5,20 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPIX_Neighbor_allgatherv_init_f08(sendbuf,sendcount,sendtype,recvbuf,recvcounts,& - displs,recvtype,comm,info,request,ierror) + displs,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_allgatherv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount - INTEGER, INTENT(IN) :: recvcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoall_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoall_init_f08.F90 index 50c2c6deff7..76c7d045b30 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoall_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoall_init_f08.F90 @@ -5,16 +5,18 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPIX_Neighbor_alltoall_init_f08(sendbuf,sendcount,sendtype,recvbuf,& - recvcount,recvtype,comm,info,request,ierror) + recvcount,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoall_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallv_init_f08.F90 index b2c61bc8974..47ca428d016 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallv_init_f08.F90 @@ -5,17 +5,19 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPIX_Neighbor_alltoallv_init_f08(sendbuf,sendcounts,sdispls,sendtype,recvbuf,& - recvcounts,rdispls,recvtype,comm,info,request,ierror) + recvcounts,rdispls,recvtype,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoallv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallw_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallw_init_f08.F90 index 7edead72d8f..bd323b00055 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallw_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pneighbor_alltoallw_init_f08.F90 @@ -10,16 +10,16 @@ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine PMPIX_Neighbor_alltoallw_init_f08(sendbuf,sendcounts,sdispls,sendtypes,& - recvbuf,recvcounts,rdispls,recvtypes,comm,info,request,ierror) + recvbuf,recvcounts,rdispls,recvtypes,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request, MPI_ADDRESS_KIND use :: mpiext_pcollreq_f08, only : ompix_neighbor_alltoallw_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - INTEGER, INTENT(IN) :: sendcounts(*), recvcounts(*) - INTEGER(MPI_ADDRESS_KIND), INTENT(IN) :: sdispls(*), rdispls(*) - TYPE(MPI_Datatype), INTENT(IN) :: sendtypes(*) - TYPE(MPI_Datatype), INTENT(IN) :: recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), recvcounts(*) + INTEGER(MPI_ADDRESS_KIND), INTENT(IN), ASYNCHRONOUS :: sdispls(*), rdispls(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: sendtypes(*) + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: recvtypes(*) TYPE(MPI_Comm), INTENT(IN) :: comm TYPE(MPI_Info), INTENT(IN) :: info TYPE(MPI_Request), INTENT(OUT) :: request diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_init_f08.F90 index 3f43482082f..ab70eed49e0 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Reduce_init_f08(sendbuf,recvbuf,count,datatype,op,root,comm,inf use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_block_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_block_init_f08.F90 index 28a721dd11c..eeb7ccac9ca 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_block_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_block_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Reduce_scatter_block_init_f08(sendbuf,recvbuf,recvcount,datatyp use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_scatter_block_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_init_f08.F90 index 4f21de2d11c..791ffd4ac42 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/preduce_scatter_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,8 +14,9 @@ subroutine PMPIX_Reduce_scatter_init_f08(sendbuf,recvbuf,recvcounts,datatype,op, use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_scatter_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscan_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscan_init_f08.F90 index 1176641367f..668f0425397 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscan_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscan_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine PMPIX_Scan_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info,reque use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scan_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatter_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatter_init_f08.F90 index 16096dda7a8..a02b807dd05 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatter_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatter_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,7 +15,8 @@ subroutine PMPIX_Scatter_init_f08(sendbuf,sendcount,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scatter_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatterv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatterv_init_f08.F90 index b7d8b4df761..6d138816945 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatterv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/profile/pscatterv_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -14,9 +15,10 @@ subroutine PMPIX_Scatterv_init_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scatterv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_init_f08.F90 index a9c7c983c80..24493a1b512 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Reduce_init_f08(sendbuf,recvbuf,count,datatype,op,root,comm,info use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count, root TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_block_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_block_init_f08.F90 index 7e923c06edb..b9b27823ecd 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_block_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_block_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Reduce_scatter_block_init_f08(sendbuf,recvbuf,recvcount,datatype use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_scatter_block_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_init_f08.F90 index 84fb4c17acd..66c0717cdd7 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/reduce_scatter_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,8 +14,9 @@ subroutine MPIX_Reduce_scatter_init_f08(sendbuf,recvbuf,recvcounts,datatype,op,c use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_reduce_scatter_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf - INTEGER, INTENT(IN) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf + INTEGER, INTENT(IN), ASYNCHRONOUS :: recvcounts(*) TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op TYPE(MPI_Comm), INTENT(IN) :: comm diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/scan_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/scan_init_f08.F90 index cfd6fdec7c6..6819722929c 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/scan_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/scan_init_f08.F90 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" @@ -13,7 +14,8 @@ subroutine MPIX_Scan_init_f08(sendbuf,recvbuf,count,datatype,op,comm,info,reques use :: mpi_f08_types, only : MPI_Datatype, MPI_Op, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scan_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: count TYPE(MPI_Datatype), INTENT(IN) :: datatype TYPE(MPI_Op), INTENT(IN) :: op diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/scatter_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/scatter_init_f08.F90 index 230519a2c3f..372207fbaaf 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/scatter_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/scatter_init_f08.F90 @@ -5,16 +5,18 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Scatter_init_f08(sendbuf,sendcount,sendtype,recvbuf,& - recvcount,recvtype,root,comm,info,request,ierror) + recvcount,recvtype,root,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scatter_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: sendcount, recvcount, root TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/scatterv_init_f08.F90 b/ompi/mpiext/pcollreq/use-mpi-f08/scatterv_init_f08.F90 index f9c33f49c14..fe4a4a9d1b9 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/scatterv_init_f08.F90 +++ b/ompi/mpiext/pcollreq/use-mpi-f08/scatterv_init_f08.F90 @@ -5,18 +5,20 @@ ! All rights reserved. ! Copyright (c) 2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ #include "ompi/mpi/fortran/configure-fortran-output.h" subroutine MPIX_Scatterv_init_f08(sendbuf,sendcounts,displs,sendtype,recvbuf,& - recvcount,recvtype,root,comm,info,request,ierror) + recvcount,recvtype,root,comm,info,request,ierror) use :: mpi_f08_types, only : MPI_Datatype, MPI_Comm, MPI_Info, MPI_Request use :: mpiext_pcollreq_f08, only : ompix_scatterv_init_f implicit none - OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN) :: sendbuf, recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, INTENT(IN), ASYNCHRONOUS :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, ASYNCHRONOUS :: recvbuf INTEGER, INTENT(IN) :: recvcount, root - INTEGER, INTENT(IN) :: sendcounts(*), displs(*) + INTEGER, INTENT(IN), ASYNCHRONOUS :: sendcounts(*), displs(*) TYPE(MPI_Datatype), INTENT(IN) :: sendtype TYPE(MPI_Datatype), INTENT(IN) :: recvtype TYPE(MPI_Comm), INTENT(IN) :: comm From 080c52f9061bdb46140fe380f7305517b2f3f569 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Thu, 4 Oct 2018 20:36:30 +0900 Subject: [PATCH 125/674] mpiext/pcollreq: Add missing f08 `asynchronous` Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit be91a26fd8b5c0fb38a0a5bbaeb32e7d4bafeafc) --- .../use-mpi-f08/mpiext_pcollreq_usempif08.h | 208 +++++++++--------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h b/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h index 98196e6c182..9377c441262 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h +++ b/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h @@ -32,8 +32,8 @@ interface mpix_allgather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -54,10 +54,10 @@ interface mpix_allgatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount - integer, intent(in) :: recvcounts(*), displs(*) + integer, intent(in), asynchronous :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -77,8 +77,8 @@ interface mpix_allreduce_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -100,8 +100,8 @@ interface mpix_alltoall_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -122,9 +122,9 @@ interface mpix_alltoallv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -144,10 +144,10 @@ interface mpix_alltoallw_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - type(mpi_datatype), intent(in) :: sendtypes(*), recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + type(mpi_datatype), intent(in), asynchronous :: sendtypes(*), recvtypes(*) type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request @@ -176,7 +176,7 @@ interface mpix_bcast_init !$PRAGMA IGNORE_TKR buffer !DIR$ IGNORE_TKR buffer !IBM* IGNORE_TKR buffer - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: buffer integer, intent(in) :: count, root type(mpi_datatype), intent(in) :: datatype type(mpi_comm), intent(in) :: comm @@ -197,8 +197,8 @@ interface mpix_exscan_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -220,8 +220,8 @@ interface mpix_gather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount, root type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -242,10 +242,10 @@ interface mpix_gatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, root - integer, intent(in) :: recvcounts(*), displs(*) + integer, intent(in), asynchronous :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -265,8 +265,8 @@ interface mpix_reduce_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count, root type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -288,9 +288,9 @@ interface mpix_reduce_scatter_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: recvcounts(*) type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op type(mpi_comm), intent(in) :: comm @@ -311,8 +311,8 @@ interface mpix_reduce_scatter_block_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: recvcount type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -334,8 +334,8 @@ interface mpix_scan_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -357,8 +357,8 @@ interface mpix_scatter_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount, root type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -379,10 +379,10 @@ interface mpix_scatterv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: recvcount, root - integer, intent(in) :: sendcounts(*), displs(*) + integer, intent(in), asynchronous :: sendcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -402,8 +402,8 @@ interface mpix_neighbor_allgather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -424,10 +424,10 @@ interface mpix_neighbor_allgatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount - integer, intent(in) :: recvcounts(*), displs(*) + integer, intent(in), asynchronous :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -447,8 +447,8 @@ interface mpix_neighbor_alltoall_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -469,9 +469,9 @@ interface mpix_neighbor_alltoallv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -491,11 +491,11 @@ interface mpix_neighbor_alltoallw_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), recvcounts(*) - integer(mpi_address_kind), intent(in) :: sdispls(*), rdispls(*) - type(mpi_datatype), intent(in) :: sendtypes(*), recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), recvcounts(*) + integer(mpi_address_kind), intent(in), asynchronous :: sdispls(*), rdispls(*) + type(mpi_datatype), intent(in), asynchronous :: sendtypes(*), recvtypes(*) type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request @@ -514,8 +514,8 @@ interface pmpix_allgather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -536,10 +536,10 @@ interface pmpix_allgatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount - integer, intent(in) :: recvcounts(*), displs(*) + integer, intent(in), asynchronous :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -559,8 +559,8 @@ interface pmpix_allreduce_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -582,8 +582,8 @@ interface pmpix_alltoall_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -604,9 +604,9 @@ interface pmpix_alltoallv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -626,10 +626,10 @@ interface pmpix_alltoallw_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) - type(mpi_datatype), intent(in) :: sendtypes(*), recvtypes(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + type(mpi_datatype), intent(in), asynchronous :: sendtypes(*), recvtypes(*) type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request @@ -658,7 +658,7 @@ interface pmpix_bcast_init !$PRAGMA IGNORE_TKR buffer !DIR$ IGNORE_TKR buffer !IBM* IGNORE_TKR buffer - OMPI_FORTRAN_IGNORE_TKR_TYPE :: buffer + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: buffer integer, intent(in) :: count, root type(mpi_datatype), intent(in) :: datatype type(mpi_comm), intent(in) :: comm @@ -679,8 +679,8 @@ interface pmpix_exscan_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -702,8 +702,8 @@ interface pmpix_gather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount, root type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -724,8 +724,8 @@ interface pmpix_gatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, root integer, intent(in) :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype @@ -747,8 +747,8 @@ interface pmpix_reduce_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count, root type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -770,9 +770,9 @@ interface pmpix_reduce_scatter_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: recvcounts(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: recvcounts(*) type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op type(mpi_comm), intent(in) :: comm @@ -793,8 +793,8 @@ interface pmpix_reduce_scatter_block_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: recvcount type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -816,8 +816,8 @@ interface pmpix_scan_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: count type(mpi_datatype), intent(in) :: datatype type(mpi_op), intent(in) :: op @@ -839,8 +839,8 @@ interface pmpix_scatter_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount, root type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -861,10 +861,10 @@ interface pmpix_scatterv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: recvcount, root - integer, intent(in) :: sendcounts(*), displs(*) + integer, intent(in), asynchronous :: sendcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -884,8 +884,8 @@ interface pmpix_neighbor_allgather_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -906,10 +906,10 @@ interface pmpix_neighbor_allgatherv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount - integer, intent(in) :: recvcounts(*), displs(*) + integer, intent(in), asynchronous :: recvcounts(*), displs(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -929,8 +929,8 @@ interface pmpix_neighbor_alltoall_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf integer, intent(in) :: sendcount, recvcount type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm @@ -951,9 +951,9 @@ interface pmpix_neighbor_alltoallv_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), sdispls(*), recvcounts(*), rdispls(*) type(mpi_datatype), intent(in) :: sendtype, recvtype type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info @@ -973,10 +973,10 @@ interface pmpix_neighbor_alltoallw_init !$PRAGMA IGNORE_TKR sendbuf, recvbuf !DIR$ IGNORE_TKR sendbuf, recvbuf !IBM* IGNORE_TKR sendbuf, recvbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in) :: sendbuf - OMPI_FORTRAN_IGNORE_TKR_TYPE :: recvbuf - integer, intent(in) :: sendcounts(*), recvcounts(*) - integer(mpi_address_kind), intent(in) :: sdispls(*), rdispls(*) + OMPI_FORTRAN_IGNORE_TKR_TYPE, intent(in), asynchronous :: sendbuf + OMPI_FORTRAN_IGNORE_TKR_TYPE, asynchronous :: recvbuf + integer, intent(in), asynchronous :: sendcounts(*), recvcounts(*) + integer(mpi_address_kind), intent(in), asynchronous :: sdispls(*), rdispls(*) type(mpi_datatype), intent(in) :: sendtypes(*), recvtypes(*) type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info From 092cf1937d979ee2e3075d2960bcc00a6cdad50e Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Thu, 4 Oct 2018 21:02:35 +0900 Subject: [PATCH 126/674] man: Correct markup of `MPI_Neighbor_allgather` Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 994b34525399e2524adeef6933e0bc3f673caf5f) --- ompi/mpi/man/man3/MPI_Neighbor_allgather.3in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ompi/mpi/man/man3/MPI_Neighbor_allgather.3in b/ompi/mpi/man/man3/MPI_Neighbor_allgather.3in index 74aee8799e7..e152d747ce8 100644 --- a/ompi/mpi/man/man3/MPI_Neighbor_allgather.3in +++ b/ompi/mpi/man/man3/MPI_Neighbor_allgather.3in @@ -33,13 +33,14 @@ MPI_NEIGHBOR_ALLGATHER(\fISENDBUF\fP,\fI SENDCOUNT\fP,\fI SENDTYPE\fP,\fI RECVBU INTEGER \fIIERROR\fP MPI_INEIGHBOR_ALLGATHER(\fISENDBUF\fP,\fI SENDCOUNT\fP,\fI SENDTYPE\fP,\fI RECVBUF\fP,\fI RECVCOUNT\fP,\fI - RECVTYPE\fP,\fI COMM\fP, \fPREQUEST\fI,\fI IERROR\fP) + RECVTYPE\fP,\fI COMM\fP, \fIREQUEST\fP,\fI IERROR\fP) \fISENDBUF\fP (*), \fIRECVBUF\fP (*) INTEGER \fISENDCOUNT\fP,\fI SENDTYPE\fP,\fI RECVCOUNT\fP,\fI RECVTYPE\fP,\fI COMM\fP, INTEGER \fIREQUEST, IERROR\fP .fi .SH Fortran 2008 Syntax +.nf USE mpi_f08 MPI_Neighbor_allgather(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcount\fP, \fIrecvtype\fP, \fIcomm\fP, \fIierror\fP) From 4dd21111f09ebcfa588408f401f821d974ce6edf Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Thu, 4 Oct 2018 21:04:27 +0900 Subject: [PATCH 127/674] mpiext/pcollreq: Add Fortran bindings in man Fortran bindings were added to persistent collectives in 9e0115c980 but man was not updated. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 43d85dbc815bc5fd02c12810fb7c9f2ddd294f12) --- ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in | 414 ++++++++++++++++++- 1 file changed, 411 insertions(+), 3 deletions(-) diff --git a/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in b/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in index 5977e6e0041..d63d0ca253a 100644 --- a/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in +++ b/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in @@ -115,13 +115,421 @@ int MPIX_Neighbor_alltoallw_init(const void *\fIsendbuf\fP, const MPI_Datatype \fIrecvtypes\fP[], MPI_Comm \fIcomm\fP, MPI_Info \fIinfo\fP, MPI_Request *\fIrequest\fP) +.fi +.SH Fortran Syntax +.nf +USE MPI +USE MPI_EXT +! or the older form: INCLUDE 'mpif.h'; INCLUDE 'mpif-ext.h' +MPIX_ALLGATHER_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, + RECVTYPE, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF\fP(*)\fI, RECVBUF\fP(*) + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE, COMM, INFO\fP + INTEGER \fIREQUEST, IERROR\fP + +MPIX_ALLGATHERV_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, + RECVCOUNT, DISPLS, RECVTYPE, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF\fP(*)\fI, RECVBUF\fP(*) + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT\fP(*) + INTEGER \fIDISPLS\fP(*)\fI, RECVTYPE, COMM, INFO, REQUEST, IERROR\fP + +MPIX_ALLREDUCE_INIT(\fISENDBUF, RECVBUF, COUNT, DATATYPE, OP, COMM, INFO, + REQUEST, IERROR\fP) + \fISENDBUF\fP(*)\fI, RECVBUF\fP(*) + INTEGER \fICOUNT, DATATYPE, OP, COMM, INFO, REQUEST, IERROR\fP + +MPIX_ALLTOALL_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, + RECVTYPE, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_ALLTOALLV_INIT(\fISENDBUF, SENDCOUNTS, SDISPLS, SENDTYPE, + RECVBUF, RECVCOUNTS, RDISPLS, RECVTYPE, COMM, INFO, REQUEST, + IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNTS(*), SDISPLS(*), SENDTYPE\fP + INTEGER \fIRECVCOUNTS(*), RDISPLS(*), RECVTYPE\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_ALLTOALLW_INIT(\fISENDBUF, SENDCOUNTS, SDISPLS, SENDTYPES, + RECVBUF, RECVCOUNTS, RDISPLS, RECVTYPES, COMM, INFO, REQUEST, + IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNTS(*), SDISPLS(*), SENDTYPES(*)\fP + INTEGER \fIRECVCOUNTS(*), RDISPLS(*), RECVTYPES(*)\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_BARRIER_INIT(\fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP) + INTEGER \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP + +MPIX_BCAST_INIT(\fIBUFFER\fP, \fICOUNT\fP, \fIDATATYPE\fP, \fIROOT\fP, \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, + \fIIERROR\fP) + \fIBUFFER\fP(*) + INTEGER \fICOUNT\fP, \fIDATATYPE\fP, \fIROOT\fP, \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP + +MPIX_EXSCAN_INIT(\fISENDBUF, RECVBUF, COUNT, DATATYPE, OP, COMM, INFO, + REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fICOUNT, DATATYPE, OP, COMM, INFO, REQUEST, IERROR\fP + +MPIX_GATHER_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, + RECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE, ROOT\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_GATHERV_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNTS, + DISPLS, RECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNTS(*), DISPLS(*)\fP + INTEGER \fIRECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP + +MPIX_REDUCE_INIT(\fISENDBUF, RECVBUF, COUNT, DATATYPE, OP, ROOT, COMM, + INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fICOUNT, DATATYPE, OP, ROOT, COMM, INFO, REQUEST, IERROR\fP + +MPIX_REDUCE_SCATTER_INIT(\fISENDBUF, RECVBUF, RECVCOUNTS, DATATYPE, OP, + COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fIRECVCOUNTS(*), DATATYPE, OP, COMM, INFO, REQUEST, IERROR \fP + +MPIX_REDUCE_SCATTER_BLOCK_INIT(\fISENDBUF, RECVBUF, RECVCOUNT, DATATYPE, + OP, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fIRECVCOUNT, DATATYPE, OP, COMM, INFO, REQUEST, IERROR \fP + +MPIX_SCAN_INIT(\fISENDBUF, RECVBUF, COUNT, DATATYPE, OP, COMM, INFO, + REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fICOUNT, DATATYPE, OP, COMM, INFO, REQUEST, IERROR\fP + +MPIX_SCATTER_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, RECVCOUNT, + RECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE, ROOT\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_SCATTERV_INIT(\fISENDBUF, SENDCOUNTS, DISPLS, SENDTYPE, RECVBUF, + RECVCOUNT, RECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNTS(*), DISPLS(*), SENDTYPE\fP + INTEGER \fIRECVCOUNT, RECVTYPE, ROOT, COMM, INFO, REQUEST, IERROR\fP + +MPIX_NEIGHBOR_ALLGATHER_INIT(\fISENDBUF\fP, \fISENDCOUNT\fP, \fISENDTYPE\fP, \fIRECVBUF\fP, + \fIRECVCOUNT\fP, \fIRECVTYPE\fP, \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP) + \fISENDBUF\fP(*), \fIRECVBUF\fP(*) + INTEGER \fISENDCOUNT\fP, \fISENDTYPE\fP, \fIRECVCOUNT\fP, \fIRECVTYPE\fP, \fICOMM\fP, + INTEGER \fIINFO, REQUEST, IERROR\fP + +MPIX_NEIGHBOR_ALLGATHERV_INIT(\fISENDBUF\fP, \fISENDCOUNT\fP, \fISENDTYPE\fP, \fIRECVBUF\fP, + \fIRECVCOUNT\fP, \fIDISPLS\fP, \fIRECVTYPE\fP, \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP) + \fISENDBUF\fP(*), \fIRECVBUF\fP(*) + INTEGER \fISENDCOUNT\fP, \fISENDTYPE\fP, \fIRECVCOUNT\fP(*), + INTEGER \fIDISPLS\fP(*), \fIRECVTYPE\fP, \fICOMM\fP, \fIINFO\fP, \fIREQUEST\fP, \fIIERROR\fP + +MPIX_NEIGHBOR_ALLTOALL_INIT(\fISENDBUF, SENDCOUNT, SENDTYPE, RECVBUF, + RECVCOUNT, RECVTYPE, COMM, INFO, REQUEST, IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNT, SENDTYPE, RECVCOUNT, RECVTYPE\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_NEIGHBOR_ALLTOALLV_INIT(\fISENDBUF, SENDCOUNTS, SDISPLS, SENDTYPE, + RECVBUF, RECVCOUNTS, RDISPLS, RECVTYPE, COMM, INFO, REQUEST, + IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNTS(*), SDISPLS(*), SENDTYPE\fP + INTEGER \fIRECVCOUNTS(*), RDISPLS(*), RECVTYPE\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +MPIX_NEIGHBOR_ALLTOALLW_INIT(\fISENDBUF, SENDCOUNTS, SDISPLS, SENDTYPES, + RECVBUF, RECVCOUNTS, RDISPLS, RECVTYPES, COMM, INFO, REQUEST, + IERROR\fP) + \fISENDBUF(*), RECVBUF(*)\fP + INTEGER \fISENDCOUNTS(*), SENDTYPES(*)\fP + INTEGER \fIRECVCOUNTS(*), RECVTYPES(*)\fP + INTEGER(KIND=MPI_ADDRESS_KIND) \fISDISPLS(*), RDISPLS(*)\fP + INTEGER \fICOMM, INFO, REQUEST, IERROR\fP + +.fi +.SH Fortran 2008 Syntax +.nf +USE mpi_f08 +USE mpi_f08_ext +MPIX_Allgather_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcount\fP, + \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Allgatherv_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcounts\fP, + \fIdispls\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIrecvcounts(*)\fP, \fIdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Allreduce_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIop\fP, \fIcomm\fP, \fIinfo\fP, + \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Alltoall_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcount\fP, + \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Alltoallv_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIsdispls\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcounts\fP, \fIrdispls\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIsendcounts(*)\fP, \fIsdispls(*)\fP, + \fIrecvcounts(*)\fP, \fIrdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Alltoallw_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIsdispls\fP, \fIsendtypes\fP, \fIrecvbuf\fP, + \fIrecvcounts\fP, \fIrdispls\fP, \fIrecvtypes\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIsendcounts(*)\fP, \fIsdispls(*)\fP, + \fIrecvcounts(*)\fP, \fIrdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: \fIsendtypes(*)\fP, + \fIrecvtypes(*)\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Barrier_init(\fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Bcast_init(\fIbuffer\fP, \fIcount\fP, \fIdatatype\fP, \fIroot\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, + \fIierror\fP) + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIbuffer\fP + INTEGER, INTENT(IN) :: \fIcount\fP, \fIroot\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Exscan_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIop\fP, \fIcomm\fP, \fIinfo\fP, + \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Gather_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcount\fP, \fIrecvtype\fP, \fIroot\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP, \fIroot\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Gatherv_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcounts\fP, + \fIdispls\fP, \fIrecvtype\fP, \fIroot\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIroot\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIrecvcounts(*)\fP, \fIdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Reduce_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIop\fP, \fIroot\fP, \fIcomm\fP, + \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIcount\fP, \fIroot\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Reduce_scatter_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIrecvcounts\fP, \fIdatatype\fP, \fIop\fP, + \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIrecvcounts(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Reduce_scatter_block_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIrecvcount\fP, \fIdatatype\fP, + \fIop\fP, \fIcomm\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Reduce_scatter_block_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIrecvcount\fP, \fIdatatype\fP, \fIop\fP, + \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Scan_init(\fIsendbuf\fP, \fIrecvbuf\fP, \fIcount\fP, \fIdatatype\fP, \fIop\fP, \fIcomm\fP, \fIinfo\fP, + \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIdatatype\fP + TYPE(MPI_Op), INTENT(IN) :: \fIop\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Scatter_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, \fIrecvcount\fP, + \fIrecvtype\fP, \fIroot\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP, \fIroot\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Scatterv_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIdispls\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcount\fP, \fIrecvtype\fP, \fIroot\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIsendcounts(*)\fP, \fIdispls(*)\fP + INTEGER, INTENT(IN) :: \fIrecvcount\fP, \fIroot\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Neighbor_allgather_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcount\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Neighbor_allgatherv_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcounts\fP, \fIdispls\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIrecvcounts(*)\fP, \fIdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Neighbor_alltoall_init(\fIsendbuf\fP, \fIsendcount\fP, \fIsendtype\fP, \fIrecvbuf\fP, + \fIrecvcount\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN) :: \fIsendcount\fP, \fIrecvcount\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Neighbor_alltoallv_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIsdispls\fP, \fIsendtype\fP, + \fIrecvbuf\fP, \fIrecvcounts\fP, \fIrdispls\fP, \fIrecvtype\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, + \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIsendcounts(*)\fP, \fIsdispls(*)\fP, + \fIrecvcounts(*)\fP, \fIrdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN) :: \fIsendtype\fP, \fIrecvtype\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + +MPIX_Neighbor_alltoallw_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIsdispls\fP, \fIsendtypes\fP, + \fIrecvbuf\fP, \fIrecvcounts\fP, \fIrdispls\fP, \fIrecvtypes\fP, \fIcomm\fP, \fIinfo\fP, \fIrequest\fP, + \fIierror\fP) + TYPE(*), DIMENSION(..), INTENT(IN), ASYNCHRONOUS :: \fIsendbuf\fP + TYPE(*), DIMENSION(..), ASYNCHRONOUS :: \fIrecvbuf\fP + INTEGER, INTENT(IN), ASYNCHRONOUS :: \fIsendcounts(*)\fP, \fIrecvcounts(*)\fP + INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN), ASYNCHRONOUS :: + \fIsdispls(*)\fP, \fIrdispls(*)\fP + TYPE(MPI_Datatype), INTENT(IN), ASYNCHRONOUS :: \fIsendtypes(*)\fP, + \fIrecvtypes(*)\fP + TYPE(MPI_Comm), INTENT(IN) :: \fIcomm\fP + TYPE(MPI_Info), INTENT(IN) :: \fIinfo\fP + TYPE(MPI_Request), INTENT(OUT) :: \fIrequest\fP + INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP + .fi .SH DESCRIPTION .ft R Creates a persistent communication request for a collective operation or neighborhood collective operation. -As of June 2018, the feature of persistent collective communication operations and persistent collective neighborhood communication operations is proposed in the MPI Forum. +As of Sept. 2018, the feature of persistent collective communication operations and persistent collective neighborhood communication operations is planned to be included in the next MPI Standerd after MPI-3.1. .nf https://github.com/mpi-forum/mpi-issues/issues/25 @@ -133,9 +541,9 @@ Open MPI implements its draft version shown in the following URL. https://github.com/mpi-forum/mpi-issues/files/2078076/mpi32-report-ticket25-austin-vote-june2018.pdf .fi -Because it is still in a draft stage, the interface may change in the standard. Therefore the prefix \fIMPIX_\fP is used instead of \fIMPI_\fP for these request creation functions. To start, complete, and free the created request, usual MPI functions (\fIMPI_Start\fP etc.) can be used. Only C bindings are available currently. +The interface may still change in the standard. Therefore the prefix \fIMPIX_\fP is used instead of \fIMPI_\fP for these request creation routines. To start, complete, and free the created request, usual MPI routines (\fIMPI_Start\fP etc.) can be used. -Future versions of Open MPI will switch to the \fIMPI_\fP prefix and will not require the header file \fImpi-ext.h\fP once the MPI Standard which includes this feature is published. +Future versions of Open MPI will switch to the \fIMPI_\fP prefix and will not require the C header file \fImpi-ext.h\fP, the Fortran modules \fImpi_ext\fP and \fImpi_f08_ext\fP, and the Fortran header file \fImpif-ext.h\fP once the MPI Standard which includes this feature is published. .SH EXAMPLE .nf From 7a930039fbe00b45c1f83db92d5d651a403cb49f Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Mon, 8 Oct 2018 12:13:44 +0300 Subject: [PATCH 128/674] platform/mellanox: disable openib/verbs Signed-off-by: Andrey Maslennikov (cherry picked from commit 7180ab144a52136f8c0ec0c63a61b1a31dfed023) --- contrib/platform/mellanox/optimized | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/platform/mellanox/optimized b/contrib/platform/mellanox/optimized index 93dbb78e1bf..339518e483e 100644 --- a/contrib/platform/mellanox/optimized +++ b/contrib/platform/mellanox/optimized @@ -1,7 +1,7 @@ enable_mca_no_build=coll-ml enable_debug_symbols=yes enable_orterun_prefix_by_default=yes -with_verbs=yes +with_verbs=no with_devel_headers=yes enable_oshmem=yes enable_oshmem_fortran=yes From fba5eda4361abbb2946ebbe815cba81f92d0a354 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Fri, 5 Oct 2018 16:30:06 -0600 Subject: [PATCH 129/674] btl/vader: fix race condition in writing header Signed-off-by: Nathan Hjelm (cherry picked from commit 8291f6722d890efd15333bf7b26f0d07952fa41e) Signed-off-by: Nathan Hjelm --- opal/mca/btl/vader/btl_vader_fbox.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_fbox.h b/opal/mca/btl/vader/btl_vader_fbox.h index 5af802781e1..25f99c2c985 100644 --- a/opal/mca/btl/vader/btl_vader_fbox.h +++ b/opal/mca/btl/vader/btl_vader_fbox.h @@ -29,6 +29,10 @@ typedef union mca_btl_vader_fbox_hdr_t { /** sequence number */ uint16_t seq; } data; + struct { + uint32_t value0; + uint32_t value1; + } data_i32; uint64_t ival; } mca_btl_vader_fbox_hdr_t; @@ -50,19 +54,20 @@ void mca_btl_vader_poll_handle_frag (mca_btl_vader_hdr_t *hdr, mca_btl_base_endp static inline void mca_btl_vader_fbox_set_header (mca_btl_vader_fbox_hdr_t *hdr, uint16_t tag, uint16_t seq, uint32_t size) { - mca_btl_vader_fbox_hdr_t tmp = {.data = {.tag = 0, .seq = seq, .size = size}}; - hdr->ival = tmp.ival; + mca_btl_vader_fbox_hdr_t tmp = {.data = {.tag = tag, .seq = seq, .size = size}}; + /* clear out existing tag/seq */ + hdr->data_i32.value1 = 0; + opal_atomic_wmb (); + hdr->data_i32.value0 = size; opal_atomic_wmb (); - hdr->data.tag = tag; + hdr->data_i32.value1 = tmp.data_i32.value1; } static inline mca_btl_vader_fbox_hdr_t mca_btl_vader_fbox_read_header (mca_btl_vader_fbox_hdr_t *hdr) { - mca_btl_vader_fbox_hdr_t tmp; - uint16_t tag = hdr->data.tag; + mca_btl_vader_fbox_hdr_t tmp = {.data_i32 = {.value1 = hdr->data_i32.value1}};; opal_atomic_rmb (); - tmp.ival = hdr->ival; - tmp.data.tag = tag; + tmp.data_i32.value0 = hdr->data_i32.value0; return tmp; } From 2e2366d1931c64030e6c2d62c5208c014c47ea7e Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 9 Oct 2018 11:09:17 +0900 Subject: [PATCH 130/674] util/hostfile: fix a double free error As reported at https://stackoverflow.com/questions/52707242/mpirun-segmentation-fault-whenever-i-use-a-hostfile mpirun crashes when the hostfile contains a "user@host" line. The root cause is username was not strdup'ed and free'd twice by opal_argv_free() and free() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@5803385d447957ef5999fb93052c0712a0b47a81) --- orte/util/hostfile/hostfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orte/util/hostfile/hostfile.c b/orte/util/hostfile/hostfile.c index f502d3bfa06..2a236a030f5 100644 --- a/orte/util/hostfile/hostfile.c +++ b/orte/util/hostfile/hostfile.c @@ -13,7 +13,7 @@ * reserved. * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science + * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -159,7 +159,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates, if (1 == cnt) { node_name = strdup(argv[0]); } else if (2 == cnt) { - username = argv[0]; + username = strdup(argv[0]); node_name = strdup(argv[1]); } else { opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */ @@ -274,7 +274,7 @@ static int hostfile_parse_line(int token, opal_list_t* updates, if (1 == cnt) { node_name = strdup(argv[0]); } else if (2 == cnt) { - username = argv[0]; + username = strdup(argv[0]); node_name = strdup(argv[1]); } else { opal_output(0, "WARNING: Unhandled user@host-combination\n"); /* XXX */ From 4aa11ec763e42d11d27459e99aaf171ed0035d71 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 3 Oct 2018 11:10:56 -0700 Subject: [PATCH 131/674] Strip --with-foo=internal from opal_subdir_args Our components that have a --with-foo configure option won't know what to do with a value of "internal". This scenario only occurs with hwloc and libevent, both of which are statically contained in libopen-pal Thanks to @jsquyres for the diff Signed-off-by: Ralph Castain (cherry picked from commit e836dbd506502c797f5bff2f9761510fad4858cd) --- config/opal_config_subdir_args.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/opal_config_subdir_args.m4 b/config/opal_config_subdir_args.m4 index 3b7a35580f9..cfd75ff405e 100644 --- a/config/opal_config_subdir_args.m4 +++ b/config/opal_config_subdir_args.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 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) 2014-2015 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2018 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. dnl $COPYRIGHT$ dnl @@ -60,6 +60,8 @@ do ;; -with-platform=* | --with-platform=*) ;; + -with*=internal) + ;; *) case $subdir_arg in *\'*) subdir_arg=`echo "$subdir_arg" | sed "s/'/'\\\\\\\\''/g"` ;; From 3e2cc6f46a4251e99382b054722f40007f031eb6 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 5 Oct 2018 06:29:36 -0700 Subject: [PATCH 132/674] Fail configure if pmix won't build If we are using the internal PMIx component and the embedded library fails to configure, then fail - don't silently fail to build and then fail in execution Signed-off-by: Ralph Castain (cherry picked from commit f379ba9c8e5ce17641937c351ab46e4b4a82446c) --- opal/mca/pmix/pmix3x/configure.m4 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opal/mca/pmix/pmix3x/configure.m4 b/opal/mca/pmix/pmix3x/configure.m4 index 646e1debf83..6188960eb3b 100644 --- a/opal/mca/pmix/pmix3x/configure.m4 +++ b/opal/mca/pmix/pmix3x/configure.m4 @@ -87,6 +87,9 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[ [AC_MSG_RESULT([no - disqualifying this component]) opal_pmix_pmix3x_happy=0], [AC_MSG_RESULT([yes - using the internal v3.x library]) + AS_IF([test "$opal_pmix_pmix3x_happy" = "0"], + [AC_MSG_WARN([INTERNAL PMIX FAILED TO CONFIGURE]) + AC_MSG_ERROR([CANNOT CONTINUE])]) # Build flags for our Makefile.am opal_pmix_pmix3x_LDFLAGS= opal_pmix_pmix3x_LIBS="$OPAL_TOP_BUILDDIR/$opal_pmix_pmix3x_basedir/pmix/src/libpmix.la" From 12790e8ec69d85ebcad3f19672fbca2804bccc72 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 5 Oct 2018 07:07:05 -0700 Subject: [PATCH 133/674] Protect PMIx from bad configure entry Ignore with-hwloc=internal or external as those are meaningless to pmix (will upstream) Signed-off-by: Ralph Castain (cherry picked from commit c498a7e77a377ddc3a7bcc26ea072627a33cb470) --- opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 index 4ee046d9abd..86a9b9d4473 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 @@ -24,6 +24,8 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ [Search for hwloc libraries in DIR ])]) pmix_hwloc_support=0 + AS_IF([test "$with_hwloc" = "internal" || test "$with_hwloc" = "external"], + [with_hwloc=]) if test "$with_hwloc" != "no"; then AC_MSG_CHECKING([for hwloc in]) From 71b828eb9ec5e8bc79dbe70b82898b386ae99988 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 5 Oct 2018 07:28:25 -0700 Subject: [PATCH 134/674] opal_config_subdir_args.m4: fix typo A typo inadvertantly crept in to e836dbd506. Add the extra '-' to make it correctly search for --with-*=internal. Signed-off-by: Jeff Squyres (cherry picked from commit 7675956b8fd739b150d3bdd14c265fd728786201) --- config/opal_config_subdir_args.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/opal_config_subdir_args.m4 b/config/opal_config_subdir_args.m4 index cfd75ff405e..aab1d42fd7e 100644 --- a/config/opal_config_subdir_args.m4 +++ b/config/opal_config_subdir_args.m4 @@ -60,7 +60,7 @@ do ;; -with-platform=* | --with-platform=*) ;; - -with*=internal) + --with*=internal) ;; *) case $subdir_arg in From 226aee42fd9da6292d54610637465051447990d4 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 6 Oct 2018 06:48:13 -0700 Subject: [PATCH 135/674] Ignore --with-foo=external arguments in subdirs Signed-off-by: Ralph Castain (cherry picked from commit 08109acf8cf1e3d5a268da0b73210910fd738cfe) --- config/opal_config_subdir_args.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/opal_config_subdir_args.m4 b/config/opal_config_subdir_args.m4 index aab1d42fd7e..0d5f8febabc 100644 --- a/config/opal_config_subdir_args.m4 +++ b/config/opal_config_subdir_args.m4 @@ -62,6 +62,8 @@ do ;; --with*=internal) ;; + --with*=external) + ;; *) case $subdir_arg in *\'*) subdir_arg=`echo "$subdir_arg" | sed "s/'/'\\\\\\\\''/g"` ;; From dd1b3eac1e15700e86e8bbf89a1307a5573edb0d Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Tue, 9 Oct 2018 17:24:40 +0900 Subject: [PATCH 136/674] java: Fix javadoc build failure with OpenJDK 11 OpenJDK 11 changed the default javadoc output HTML version to HTML 5 from HTML 4.01. It causes an error on building Open MPI configured with `--enable-mpi-java` (default: disable). This fix is compatible with older OpenJDK. I don't know whether this problem exists with other vender's JDKs. But this fix should be compatible with other JDKs because the new syntax is used in other places in the same file. Thanks to Siegmar Gross for the bug report. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit b491b454dc304a72c03970326880fbd01641a3d3) --- ompi/mpi/java/java/Comm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mpi/java/java/Comm.java b/ompi/mpi/java/java/Comm.java index ea08bb09245..b72b9879ead 100644 --- a/ompi/mpi/java/java/Comm.java +++ b/ompi/mpi/java/java/Comm.java @@ -653,7 +653,7 @@ private native long iSend( /** * Start a buffered mode, nonblocking send. - *

Java binding of the MPI operation MPI_IBSEND. + *

Java binding of the MPI operation {@code MPI_IBSEND}. * @param buf send buffer * @param count number of items to send * @param type datatype of each item in send buffer From 40270bd24b82ab69d80ff9aec90d653293d9f1b3 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 9 Oct 2018 06:42:08 -0700 Subject: [PATCH 137/674] Minor cleanups to the pmix/ext2x component Signed-off-by: Ralph Castain --- config/opal_check_pmi.m4 | 8 +++++--- opal/mca/pmix/ext2x/Makefile.am | 6 +++--- opal/mca/pmix/ext2x/ext2x.h | 6 ------ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/config/opal_check_pmi.m4 b/config/opal_check_pmi.m4 index 345115ad328..dfbdfdeed4f 100644 --- a/config/opal_check_pmi.m4 +++ b/config/opal_check_pmi.m4 @@ -424,9 +424,11 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ [Whether the external PMIx library is v1]) AM_CONDITIONAL([OPAL_WANT_PRUN], [test "$opal_prun_happy" = "yes"]) - AS_IF([test "$opal_external_pmix_version" = "1x"], - [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [1.2.x: WARNING - DYNAMIC OPS NOT SUPPORTED])], - [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [$opal_external_pmix_version])]) + AS_IF([test "$opal_external_pmix_happy" = "yes"], + [AS_IF([test "$opal_external_pmix_version" = "1x"], + [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [External (1.2.5) WARNING - DYNAMIC OPS NOT SUPPORTED])], + [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [External ($opal_external_pmix_version)])])], + [OPAL_SUMMARY_ADD([[Miscellaneous]], [[PMIx support]], [opal_pmix], [Internal])]) OPAL_VAR_SCOPE_POP ]) diff --git a/opal/mca/pmix/ext2x/Makefile.am b/opal/mca/pmix/ext2x/Makefile.am index e5273558436..7c0fe8b58cf 100644 --- a/opal/mca/pmix/ext2x/Makefile.am +++ b/opal/mca/pmix/ext2x/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -40,13 +40,13 @@ mcacomponentdir = $(opallibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_pmix_ext2x_la_SOURCES = $(sources) mca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS) -mca_pmix_ext2x_la_CPPFLAGS =$(opal_pmix_ext2x_CPPFLAGS) +mca_pmix_ext2x_la_CPPFLAGS = $(opal_pmix_ext2x_CPPFLAGS) mca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS) mca_pmix_ext2x_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ $(opal_pmix_ext2x_LIBS) noinst_LTLIBRARIES = $(component_noinst) -libmca_pmix_ext2x_la_SOURCES =$(sources) +libmca_pmix_ext2x_la_SOURCES = $(sources) libmca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS) libmca_pmix_ext2x_la_CPPFLAGS = $(opal_pmix_ext2x_CPPFLAGS) libmca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS) diff --git a/opal/mca/pmix/ext2x/ext2x.h b/opal/mca/pmix/ext2x/ext2x.h index 8e2012906c7..0f28c8f667e 100644 --- a/opal/mca/pmix/ext2x/ext2x.h +++ b/opal/mca/pmix/ext2x/ext2x.h @@ -37,12 +37,6 @@ BEGIN_C_DECLS -#ifdef OPAL_C_HAVE_VISIBILITY -#define PMIX_HAVE_VISIBILITY 1 -#else -#undef PMIX_HAVE_VISIBILITY -#endif - typedef struct { opal_pmix_base_component_t super; bool legacy_get; From 376e2e4d984f3cd6740d87ec3ab27b5036c3a878 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 9 Oct 2018 06:46:09 -0700 Subject: [PATCH 138/674] Add missing file to tarball Signed-off-by: Ralph Castain --- opal/mca/pmix/ext2x/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/pmix/ext2x/Makefile.am b/opal/mca/pmix/ext2x/Makefile.am index 7c0fe8b58cf..194443d93a9 100644 --- a/opal/mca/pmix/ext2x/Makefile.am +++ b/opal/mca/pmix/ext2x/Makefile.am @@ -38,7 +38,7 @@ endif mcacomponentdir = $(opallibdir) mcacomponent_LTLIBRARIES = $(component_install) -mca_pmix_ext2x_la_SOURCES = $(sources) +mca_pmix_ext2x_la_SOURCES = $(sources) $(headers) mca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS) mca_pmix_ext2x_la_CPPFLAGS = $(opal_pmix_ext2x_CPPFLAGS) mca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS) @@ -46,7 +46,7 @@ mca_pmix_ext2x_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la $(opal_pmix_ext2x_LIBS) noinst_LTLIBRARIES = $(component_noinst) -libmca_pmix_ext2x_la_SOURCES = $(sources) +libmca_pmix_ext2x_la_SOURCES = $(sources) $(headers) libmca_pmix_ext2x_la_CFLAGS = $(opal_pmix_ext2x_CFLAGS) libmca_pmix_ext2x_la_CPPFLAGS = $(opal_pmix_ext2x_CPPFLAGS) libmca_pmix_ext2x_la_LDFLAGS = -module -avoid-version $(opal_pmix_ext2x_LDFLAGS) From 1153082a0f998ed0e116b0cd6e42b29296430737 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 3 Oct 2018 09:26:26 -0600 Subject: [PATCH 139/674] btl/uct: bug fixes and general improvements This commit updates the uct btl to change the transports parameter into a priority list. The dc_mlx5, rc_mlx5, and ud transports to the priority list. This will give better out of the box performance for multi-threaded codes beacuse the *_mlx5 transports can avoid the mlx5 lock inside libmlx5_rdmav2. This commit also fixes a number of leaks and a possible deadlock when using RDMA. Signed-off-by: Nathan Hjelm (cherry picked from commit 39be6ec15c202d31423476f09e70199453d25adc) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct.h | 3 - opal/mca/btl/uct/btl_uct_amo.c | 4 + opal/mca/btl/uct/btl_uct_component.c | 34 ++++-- opal/mca/btl/uct/btl_uct_device_context.h | 4 +- opal/mca/btl/uct/btl_uct_module.c | 26 ---- opal/mca/btl/uct/btl_uct_rdma.c | 23 +++- opal/mca/btl/uct/btl_uct_tl.c | 141 ++++++++++++++-------- opal/mca/btl/uct/btl_uct_types.h | 6 + 8 files changed, 149 insertions(+), 92 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index 00e8d4383c8..d31ad1402ff 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -106,9 +106,6 @@ struct mca_btl_uct_module_t { /** large registered frags for packing non-contiguous data */ opal_free_list_t max_frags; - /** RDMA completions */ - opal_free_list_t rdma_completions; - /** frags that were waiting on connections that are now ready to send */ opal_list_t pending_frags; }; diff --git a/opal/mca/btl/uct/btl_uct_amo.c b/opal/mca/btl/uct/btl_uct_amo.c index d443777089f..f7d02326884 100644 --- a/opal/mca/btl/uct/btl_uct_amo.c +++ b/opal/mca/btl/uct/btl_uct_amo.c @@ -104,8 +104,10 @@ int mca_btl_uct_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_end rc = OPAL_SUCCESS; } else if (UCS_OK == ucs_status) { rc = 1; + mca_btl_uct_uct_completion_release (comp); } else { rc = OPAL_ERR_OUT_OF_RESOURCE; + mca_btl_uct_uct_completion_release (comp); } uct_rkey_release (&rkey); @@ -176,8 +178,10 @@ int mca_btl_uct_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_e rc = OPAL_SUCCESS; } else if (UCS_OK == ucs_status) { rc = 1; + mca_btl_uct_uct_completion_release (comp); } else { rc = OPAL_ERR_OUT_OF_RESOURCE; + mca_btl_uct_uct_completion_release (comp); } uct_rkey_release (&rkey); diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index 58da56dd5a9..a9ad52dea59 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -28,6 +28,9 @@ #include "opal/mca/btl/base/base.h" #include "opal/mca/hwloc/base/base.h" #include "opal/util/argv.h" +#include "opal/memoryhooks/memory.h" +#include "opal/mca/memory/base/base.h" +#include #include @@ -47,13 +50,13 @@ static int mca_btl_uct_component_register(void) MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, &mca_btl_uct_component.memory_domains); - mca_btl_uct_component.allowed_transports = "any"; + mca_btl_uct_component.allowed_transports = "dc_mlx5,rc_mlx5,ud,any"; (void) mca_base_component_var_register(&mca_btl_uct_component.super.btl_version, - "transports", "Comma-delimited list of transports of the form to use." - " The list of transports available can be queried using ucx_info. Special" - "values: any (any available) (default: any)", MCA_BASE_VAR_TYPE_STRING, - NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_btl_uct_component.allowed_transports); + "transports", "Comma-delimited list of transports to use sorted by increasing " + "priority. The list of transports available can be queried using ucx_info. Special" + "values: any (any available) (default: dc_mlx5,rc_mlx5,ud,any)", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &mca_btl_uct_component.allowed_transports); mca_btl_uct_component.num_contexts_per_module = 0; (void) mca_base_component_var_register(&mca_btl_uct_component.super.btl_version, @@ -93,6 +96,11 @@ static int mca_btl_uct_component_register(void) &module->super); } +static void mca_btl_uct_mem_release_cb(void *buf, size_t length, void *cbdata, bool from_alloc) +{ + ucm_vm_munmap(buf, length); +} + static int mca_btl_uct_component_open(void) { if (0 == mca_btl_uct_component.num_contexts_per_module) { @@ -112,6 +120,15 @@ static int mca_btl_uct_component_open(void) } } + if (mca_btl_uct_component.num_contexts_per_module > MCA_BTL_UCT_MAX_WORKERS) { + mca_btl_uct_component.num_contexts_per_module = MCA_BTL_UCT_MAX_WORKERS; + } + + if (mca_btl_uct_component.disable_ucx_memory_hooks) { + ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); + opal_mem_hooks_register_release(mca_btl_uct_mem_release_cb, NULL); + } + return OPAL_SUCCESS; } @@ -121,6 +138,10 @@ static int mca_btl_uct_component_open(void) */ static int mca_btl_uct_component_close(void) { + if (mca_btl_uct_component.disable_ucx_memory_hooks) { + opal_mem_hooks_unregister_release (mca_btl_uct_mem_release_cb); + } + return OPAL_SUCCESS; } @@ -247,7 +268,6 @@ static mca_btl_uct_module_t *mca_btl_uct_alloc_module (const char *md_name, mca_ OBJ_CONSTRUCT(&module->short_frags, opal_free_list_t); OBJ_CONSTRUCT(&module->eager_frags, opal_free_list_t); OBJ_CONSTRUCT(&module->max_frags, opal_free_list_t); - OBJ_CONSTRUCT(&module->rdma_completions, opal_free_list_t); OBJ_CONSTRUCT(&module->pending_frags, opal_list_t); OBJ_CONSTRUCT(&module->lock, opal_mutex_t); diff --git a/opal/mca/btl/uct/btl_uct_device_context.h b/opal/mca/btl/uct/btl_uct_device_context.h index ccb4f3be71f..f8155917e81 100644 --- a/opal/mca/btl/uct/btl_uct_device_context.h +++ b/opal/mca/btl/uct/btl_uct_device_context.h @@ -23,7 +23,7 @@ * @param[in] tl btl uct tl pointer * @param[in] context_id identifier for this context (0..MCA_BTL_UCT_MAX_WORKERS-1) */ -mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl, int context_id); +mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl, int context_id, bool enable_progress); /** * @brief Destroy a device context and release all resources @@ -91,7 +91,7 @@ mca_btl_uct_module_get_tl_context_specific (mca_btl_uct_module_t *module, mca_bt if (OPAL_UNLIKELY(NULL == context)) { mca_btl_uct_device_context_t *new_context; - new_context = mca_btl_uct_context_create (module, tl, context_id); + new_context = mca_btl_uct_context_create (module, tl, context_id, true); if (!opal_atomic_compare_exchange_strong_ptr (&tl->uct_dev_contexts[context_id], &context, new_context)) { mca_btl_uct_context_destroy (new_context); } else { diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index b1b659b23ba..8357be215a2 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -31,15 +31,6 @@ #include "btl_uct_endpoint.h" #include "btl_uct_am.h" -#include "opal/memoryhooks/memory.h" -#include "opal/mca/memory/base/base.h" -#include - -static void mca_btl_uct_mem_release_cb(void *buf, size_t length, void *cbdata, bool from_alloc) -{ - ucm_vm_munmap(buf, length); -} - struct mca_btl_base_endpoint_t *mca_btl_uct_get_ep (struct mca_btl_base_module_t *module, opal_proc_t *proc) { mca_btl_uct_module_t *uct_module = (mca_btl_uct_module_t *) module; @@ -111,18 +102,6 @@ static int mca_btl_uct_add_procs (mca_btl_base_module_t *btl, NULL, 0, uct_module->rcache, NULL, NULL); } - if (rdma_tl) { - rc = opal_free_list_init (&uct_module->rdma_completions, sizeof (mca_btl_uct_uct_completion_t), - opal_cache_line_size, OBJ_CLASS(mca_btl_uct_uct_completion_t), - 0, opal_cache_line_size, 0, 4096, 128, NULL, 0, NULL, NULL, - NULL); - } - - if (mca_btl_uct_component.disable_ucx_memory_hooks) { - ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); - opal_mem_hooks_register_release(mca_btl_uct_mem_release_cb, NULL); - } - uct_module->initialized = true; } @@ -288,10 +267,6 @@ int mca_btl_uct_finalize (mca_btl_base_module_t* btl) mca_btl_uct_endpoint_t *endpoint; uint64_t key; - if (mca_btl_uct_component.disable_ucx_memory_hooks) { - opal_mem_hooks_unregister_release (mca_btl_uct_mem_release_cb); - } - /* clean up any leftover endpoints */ OPAL_HASH_TABLE_FOREACH(key, uint64, endpoint, &uct_module->id_to_endpoint) { OBJ_RELEASE(endpoint); @@ -300,7 +275,6 @@ int mca_btl_uct_finalize (mca_btl_base_module_t* btl) OBJ_DESTRUCT(&uct_module->short_frags); OBJ_DESTRUCT(&uct_module->eager_frags); OBJ_DESTRUCT(&uct_module->max_frags); - OBJ_DESTRUCT(&uct_module->rdma_completions); OBJ_DESTRUCT(&uct_module->pending_frags); OBJ_DESTRUCT(&uct_module->lock); diff --git a/opal/mca/btl/uct/btl_uct_rdma.c b/opal/mca/btl/uct/btl_uct_rdma.c index 58f7c504792..51cc5676cec 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.c +++ b/opal/mca/btl/uct/btl_uct_rdma.c @@ -30,13 +30,14 @@ static void mca_btl_uct_uct_completion_construct (mca_btl_uct_uct_completion_t * OBJ_CLASS_INSTANCE(mca_btl_uct_uct_completion_t, opal_free_list_item_t, mca_btl_uct_uct_completion_construct, NULL); + mca_btl_uct_uct_completion_t * mca_btl_uct_uct_completion_alloc (mca_btl_uct_module_t *uct_btl, mca_btl_base_endpoint_t *endpoint, void *local_address, mca_btl_base_registration_handle_t *local_handle, mca_btl_uct_device_context_t *dev_context, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_uct_uct_completion_t *comp = (mca_btl_uct_uct_completion_t *) opal_free_list_get (&uct_btl->rdma_completions); + mca_btl_uct_uct_completion_t *comp = (mca_btl_uct_uct_completion_t *) opal_free_list_get (&dev_context->rdma_completions); if (OPAL_LIKELY(NULL != comp)) { comp->uct_comp.count = 1; comp->btl = &uct_btl->super; @@ -55,8 +56,7 @@ mca_btl_uct_uct_completion_alloc (mca_btl_uct_module_t *uct_btl, mca_btl_base_en void mca_btl_uct_uct_completion_release (mca_btl_uct_uct_completion_t *comp) { if (comp) { - mca_btl_uct_module_t *uct_btl = (mca_btl_uct_module_t *) comp->btl; - opal_free_list_return (&uct_btl->rdma_completions, &comp->super); + opal_free_list_return (&comp->dev_context->rdma_completions, &comp->super); } } @@ -122,6 +122,8 @@ int mca_btl_uct_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi mca_btl_uct_uct_completion_release (comp); } else if (UCS_INPROGRESS == ucs_status) { ucs_status = UCS_OK; + } else { + mca_btl_uct_uct_completion_release (comp); } BTL_VERBOSE(("get issued. status = %d", ucs_status)); @@ -157,6 +159,8 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi ucs_status_t ucs_status; uct_rkey_bundle_t rkey; uct_ep_h ep_handle; + bool use_short = false; + bool use_bcopy = false; int rc; BTL_VERBOSE(("performing put operation. local address: %p, length: %lu", local_address, (unsigned long) size)); @@ -177,12 +181,19 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi mca_btl_uct_context_lock (context); + /* determine what UCT prototol should be used */ + if (size <= uct_btl->super.btl_put_local_registration_threshold) { + use_short = size <= uct_btl->rdma_tl->uct_iface_attr.cap.put.max_short; + use_bcopy = !use_short; + } + do { - if (size <= uct_btl->rdma_tl->uct_iface_attr.cap.put.max_short) { + if (use_short) { ucs_status = uct_ep_put_short (ep_handle, local_address, size, remote_address, rkey.rkey); - } else if (size <= uct_btl->super.btl_put_local_registration_threshold) { + } else if (use_bcopy) { ssize_t tmp = uct_ep_put_bcopy (ep_handle, mca_btl_uct_put_pack, - &(mca_btl_uct_put_pack_args_t) {.local_address = local_address, .size = size}, + &(mca_btl_uct_put_pack_args_t) {.local_address = local_address, + .size = size}, remote_address, rkey.rkey); ucs_status = (tmp == (ssize_t) size) ? UCS_OK : UCS_ERR_NO_RESOURCE; } else { diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index 7d12a9c452f..a9f4069b8cb 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -237,7 +237,20 @@ static int mca_btl_uct_setup_connection_tl (mca_btl_uct_module_t *module) return UCS_OK == ucs_status ? OPAL_SUCCESS : OPAL_ERROR; } -mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl, int context_id) +static void mca_btl_uct_context_enable_progress (mca_btl_uct_device_context_t *context) +{ + if (!context->progress_enabled) { +#if HAVE_DECL_UCT_PROGRESS_THREAD_SAFE + uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_THREAD_SAFE | UCT_PROGRESS_SEND | + UCT_PROGRESS_RECV); +#else + uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_SEND | UCT_PROGRESS_RECV); +#endif + context->progress_enabled = true; + } +} + +mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl, int context_id, bool enable_progress) { uct_iface_params_t iface_params = {.rndv_cb = NULL, .eager_cb = NULL, .stats_root = NULL, .rx_headroom = 0, .open_mode = UCT_IFACE_OPEN_MODE_DEVICE, @@ -245,6 +258,7 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * .dev_name = tl->uct_dev_name}}}; mca_btl_uct_device_context_t *context; ucs_status_t ucs_status; + int rc; context = calloc (1, sizeof (*context)); if (OPAL_UNLIKELY(NULL == context)) { @@ -255,44 +269,47 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * context->uct_btl = module; OBJ_CONSTRUCT(&context->completion_fifo, opal_fifo_t); OBJ_CONSTRUCT(&context->mutex, opal_recursive_mutex_t); + OBJ_CONSTRUCT(&context->rdma_completions, opal_free_list_t); + + rc = opal_free_list_init (&context->rdma_completions, sizeof (mca_btl_uct_uct_completion_t), + opal_cache_line_size, OBJ_CLASS(mca_btl_uct_uct_completion_t), + 0, opal_cache_line_size, 0, 4096, 128, NULL, 0, NULL, NULL, + NULL); + if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { + mca_btl_uct_context_destroy (context); + return NULL; + } - do { - /* apparently (in contradiction to the spec) UCT is *not* thread safe. because we have to - * use our own locks just go ahead and use UCS_THREAD_MODE_SINGLE. if they ever fix their - * api then change this back to UCS_THREAD_MODE_MULTI and remove the locks around the - * various UCT calls. */ - ucs_status = uct_worker_create (module->ucs_async, UCS_THREAD_MODE_SINGLE, &context->uct_worker); - if (UCS_OK != ucs_status) { - BTL_VERBOSE(("could not create a UCT worker")); - mca_btl_uct_context_destroy (context); - context = NULL; - break; - } + /* apparently (in contradiction to the spec) UCT is *not* thread safe. because we have to + * use our own locks just go ahead and use UCS_THREAD_MODE_SINGLE. if they ever fix their + * api then change this back to UCS_THREAD_MODE_MULTI and remove the locks around the + * various UCT calls. */ + ucs_status = uct_worker_create (module->ucs_async, UCS_THREAD_MODE_SERIALIZED, &context->uct_worker); + if (OPAL_UNLIKELY(UCS_OK != ucs_status)) { + BTL_VERBOSE(("could not create a UCT worker")); + mca_btl_uct_context_destroy (context); + return NULL; + } - ucs_status = uct_iface_open (tl->uct_md->uct_md, context->uct_worker, &iface_params, - tl->uct_tl_config, &context->uct_iface); - if (UCS_OK != ucs_status) { - BTL_VERBOSE(("could not open UCT interface. error code: %d", ucs_status)); - mca_btl_uct_context_destroy (context); - context = NULL; - break; - } + ucs_status = uct_iface_open (tl->uct_md->uct_md, context->uct_worker, &iface_params, + tl->uct_tl_config, &context->uct_iface); + if (OPAL_UNLIKELY(UCS_OK != ucs_status)) { + BTL_VERBOSE(("could not open UCT interface. error code: %d", ucs_status)); + mca_btl_uct_context_destroy (context); + return NULL; + } - BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); + BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); -#if HAVE_DECL_UCT_PROGRESS_THREAD_SAFE - uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_THREAD_SAFE | UCT_PROGRESS_SEND | - UCT_PROGRESS_RECV); -#else - uct_iface_progress_enable (context->uct_iface, UCT_PROGRESS_SEND | UCT_PROGRESS_RECV); -#endif + if (enable_progress) { + mca_btl_uct_context_enable_progress (context); + } - if (context_id > 0 && tl == module->am_tl) { - BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); - uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, - context, UCT_CB_FLAG_SYNC); - } - } while (0); + if (context_id > 0 && tl == module->am_tl) { + BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); + uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, + context, UCT_CB_FLAG_SYNC); + } return context; } @@ -310,6 +327,7 @@ void mca_btl_uct_context_destroy (mca_btl_uct_device_context_t *context) } OBJ_DESTRUCT(&context->completion_fifo); + OBJ_DESTRUCT(&context->rdma_completions); free (context); } @@ -347,7 +365,7 @@ static mca_btl_uct_tl_t *mca_btl_uct_create_tl (mca_btl_uct_module_t *module, mc (void) uct_md_iface_config_read (md->uct_md, tl_desc->tl_name, NULL, NULL, &tl->uct_tl_config); /* always create a 0 context (needed to query) */ - tl->uct_dev_contexts[0] = mca_btl_uct_context_create (module, tl, 0); + tl->uct_dev_contexts[0] = mca_btl_uct_context_create (module, tl, 0, false); if (NULL == tl->uct_dev_contexts[0]) { BTL_VERBOSE(("could not create a uct device context")); OBJ_RELEASE(tl); @@ -385,12 +403,8 @@ static void mca_btl_uct_set_tl_rdma (mca_btl_uct_module_t *module, mca_btl_uct_t module->super.btl_put_limit = tl->uct_iface_attr.cap.put.max_zcopy; module->super.btl_put_alignment = 0; - /* no registration needed when using short put */ - if (tl->uct_iface_attr.cap.put.max_bcopy > tl->uct_iface_attr.cap.put.max_short) { - module->super.btl_put_local_registration_threshold = tl->uct_iface_attr.cap.put.max_bcopy; - } else { - module->super.btl_put_local_registration_threshold = tl->uct_iface_attr.cap.put.max_short; - } + /* no registration needed when using short/bcopy put */ + module->super.btl_put_local_registration_threshold = tl->uct_iface_attr.cap.put.max_bcopy; module->rdma_tl = tl; OBJ_RETAIN(tl); @@ -478,6 +492,11 @@ static int mca_btl_uct_evaluate_tl (mca_btl_uct_module_t *module, mca_btl_uct_tl module->super.btl_latency = 1; } + if (tl == module->rdma_tl || tl == module->am_tl || tl == module->conn_tl) { + /* make sure progress is enabled on the default context now that we know this TL will be used */ + mca_btl_uct_context_enable_progress (tl->uct_dev_contexts[0]); + } + return OPAL_SUCCESS; } @@ -487,6 +506,7 @@ int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, u mca_btl_uct_tl_t *tl; opal_list_t tl_list; char **tl_filter; + int any_priority = 0; OBJ_CONSTRUCT(&tl_list, opal_list_t); @@ -499,23 +519,46 @@ int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, u free (tl_filter[0]); tl_filter[0] = tmp; include = false; - } else if (0 == strcmp (tl_filter[0], "any")) { - any = true; + } + + /* check for the any keyword */ + for (unsigned j = 0 ; tl_filter[j] ; ++j) { + if (0 == strcmp (tl_filter[j], "any")) { + any_priority = j; + any = true; + break; + } + } + + if (any && !include) { + opal_argv_free (tl_filter); + return OPAL_ERR_NOT_AVAILABLE; } for (unsigned i = 0 ; i < tl_count ; ++i) { bool try_tl = any; - int priority = 0; - - for (unsigned j = 0 ; tl_filter[j] && !try_tl ; ++j) { - try_tl = (0 == strcmp (tl_filter[j], tl_descs[i].tl_name)) == include; - priority = j; + int priority = any_priority; + + for (unsigned j = 0 ; tl_filter[j] ; ++j) { + if (0 == strcmp (tl_filter[j], tl_descs[i].tl_name)) { + try_tl = include; + priority = j; + break; + } } + BTL_VERBOSE(("tl filter: tl_name = %s, use = %d, priority = %d", tl_descs[i].tl_name, try_tl, priority)); + if (!try_tl) { continue; } + if (0 == strcmp (tl_descs[i].tl_name, "ud")) { + /* ud looks like any normal transport but we do not want to use it for anything other + * than connection management so ensure it gets evaluated last */ + priority = INT_MAX; + } + tl = mca_btl_uct_create_tl (module, md, tl_descs + i, priority); if (tl) { @@ -523,6 +566,8 @@ int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, u } } + opal_argv_free (tl_filter); + if (0 == opal_list_get_size (&tl_list)) { BTL_VERBOSE(("no suitable tls match filter: %s", mca_btl_uct_component.allowed_transports)); OBJ_DESTRUCT(&tl_list); diff --git a/opal/mca/btl/uct/btl_uct_types.h b/opal/mca/btl/uct/btl_uct_types.h index f7731d9e441..2033dcf4b31 100644 --- a/opal/mca/btl/uct/btl_uct_types.h +++ b/opal/mca/btl/uct/btl_uct_types.h @@ -141,9 +141,15 @@ struct mca_btl_uct_device_context_t { /** UCT interface handle */ uct_iface_h uct_iface; + /** RDMA completions */ + opal_free_list_t rdma_completions; + /** complete fragments and rdma operations. this fifo is used to avoid making * callbacks while holding the device lock. */ opal_fifo_t completion_fifo; + + /** progress is enabled on this context */ + bool progress_enabled; }; typedef struct mca_btl_uct_device_context_t mca_btl_uct_device_context_t; From 274cbc3c035da2dc7fdd87cca0877b72b5b0348f Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 9 Oct 2018 18:56:52 +0300 Subject: [PATCH 140/674] OSC/UCX: fixed zero-size window processing - added processing of zero-size MPI window Signed-off-by: Sergey Oblomov (cherry picked from commit ae6f81983fe354de812ebe2532120fb20ae24d3b) --- ompi/mca/osc/ucx/osc_ucx_comm.c | 23 +++++++++++++++ ompi/mca/osc/ucx/osc_ucx_component.c | 44 ++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index 9211f20e798..ec760d4fda3 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -17,6 +17,13 @@ #include "osc_ucx.h" #include "osc_ucx_request.h" + +#define CHECK_VALID_RKEY(_module, _target, _count) \ + if (!((_module)->win_info_array[_target]).rkey_init && ((_count) > 0)) { \ + OSC_UCX_VERBOSE(1, "window with non-zero length does not have an rkey"); \ + return OMPI_ERROR; \ + } + typedef struct ucx_iovec { void *addr; size_t len; @@ -380,6 +387,12 @@ int ompi_osc_ucx_put(const void *origin_addr, int origin_count, struct ompi_data } } + CHECK_VALID_RKEY(module, target, target_count); + + if (!target_count) { + return OMPI_SUCCESS; + } + rkey = (module->win_info_array[target]).rkey; ompi_datatype_get_true_extent(origin_dt, &origin_lb, &origin_extent); @@ -434,6 +447,12 @@ int ompi_osc_ucx_get(void *origin_addr, int origin_count, } } + CHECK_VALID_RKEY(module, target, target_count); + + if (!target_count) { + return OMPI_SUCCESS; + } + rkey = (module->win_info_array[target]).rkey; ompi_datatype_get_true_extent(origin_dt, &origin_lb, &origin_extent); @@ -860,6 +879,8 @@ int ompi_osc_ucx_rput(const void *origin_addr, int origin_count, } } + CHECK_VALID_RKEY(module, target, target_count); + rkey = (module->win_info_array[target]).rkey; OMPI_OSC_UCX_REQUEST_ALLOC(win, ucx_req); @@ -919,6 +940,8 @@ int ompi_osc_ucx_rget(void *origin_addr, int origin_count, } } + CHECK_VALID_RKEY(module, target, target_count); + rkey = (module->win_info_array[target]).rkey; OMPI_OSC_UCX_REQUEST_ALLOC(win, ucx_req); diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 955857d9744..149106830c1 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -17,6 +17,10 @@ #include "osc_ucx.h" #include "osc_ucx_request.h" +#define memcpy_off(_dst, _src, _len, _off) \ + memcpy(((char*)(_dst)) + (_off), _src, _len); \ + (_off) += (_len); + static int component_open(void); static int component_register(void); static int component_init(bool enable_progress_threads, bool enable_mpi_threads); @@ -275,6 +279,8 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in int disps[comm_size]; int rkey_sizes[comm_size]; uint64_t zero = 0; + size_t info_offset; + uint64_t size_u64; /* the osc/sm component is the exclusive provider for support for * shared memory windows */ @@ -518,22 +524,27 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error; } - my_info_len = 2 * sizeof(uint64_t) + rkey_buffer_size + state_rkey_buffer_size; + size_u64 = (uint64_t)size; + my_info_len = 3 * sizeof(uint64_t) + rkey_buffer_size + state_rkey_buffer_size; my_info = malloc(my_info_len); if (my_info == NULL) { ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE; goto error; } + info_offset = 0; + if (flavor == MPI_WIN_FLAVOR_ALLOCATE || flavor == MPI_WIN_FLAVOR_CREATE) { - memcpy(my_info, base, sizeof(uint64_t)); + memcpy_off(my_info, base, sizeof(uint64_t), info_offset); } else { - memcpy(my_info, &zero, sizeof(uint64_t)); + memcpy_off(my_info, &zero, sizeof(uint64_t), info_offset); } - memcpy((void *)((char *)my_info + sizeof(uint64_t)), &state_base, sizeof(uint64_t)); - memcpy((void *)((char *)my_info + 2 * sizeof(uint64_t)), rkey_buffer, rkey_buffer_size); - memcpy((void *)((char *)my_info + 2 * sizeof(uint64_t) + rkey_buffer_size), - state_rkey_buffer, state_rkey_buffer_size); + memcpy_off(my_info, &state_base, sizeof(uint64_t), info_offset); + memcpy_off(my_info, &size_u64, sizeof(uint64_t), info_offset); + memcpy_off(my_info, rkey_buffer, rkey_buffer_size, info_offset); + memcpy_off(my_info, state_rkey_buffer, state_rkey_buffer_size, info_offset); + + assert(my_info_len == info_offset); ret = allgather_len_and_info(my_info, (int)my_info_len, &recv_buf, disps, module->comm); if (ret != OMPI_SUCCESS) { @@ -549,25 +560,32 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in for (i = 0; i < comm_size; i++) { ucp_ep_h ep = OSC_UCX_GET_EP(module->comm, i); + uint64_t dest_size; assert(ep != NULL); - memcpy(&(module->win_info_array[i]).addr, &recv_buf[disps[i]], sizeof(uint64_t)); - memcpy(&(module->state_info_array[i]).addr, &recv_buf[disps[i] + sizeof(uint64_t)], - sizeof(uint64_t)); + info_offset = disps[i]; + + memcpy(&(module->win_info_array[i]).addr, &recv_buf[info_offset], sizeof(uint64_t)); + info_offset += sizeof(uint64_t); + memcpy(&(module->state_info_array[i]).addr, &recv_buf[info_offset], sizeof(uint64_t)); + info_offset += sizeof(uint64_t); + memcpy(&dest_size, &recv_buf[info_offset], sizeof(uint64_t)); + info_offset += sizeof(uint64_t); (module->win_info_array[i]).rkey_init = false; - if (size > 0 && (flavor == MPI_WIN_FLAVOR_ALLOCATE || flavor == MPI_WIN_FLAVOR_CREATE)) { - status = ucp_ep_rkey_unpack(ep, &(recv_buf[disps[i] + 2 * sizeof(uint64_t)]), + if (dest_size > 0 && (flavor == MPI_WIN_FLAVOR_ALLOCATE || flavor == MPI_WIN_FLAVOR_CREATE)) { + status = ucp_ep_rkey_unpack(ep, &recv_buf[info_offset], &((module->win_info_array[i]).rkey)); if (status != UCS_OK) { OSC_UCX_VERBOSE(1, "ucp_ep_rkey_unpack failed: %d", status); ret = OMPI_ERROR; goto error; } + info_offset += rkey_sizes[i]; (module->win_info_array[i]).rkey_init = true; } - status = ucp_ep_rkey_unpack(ep, &(recv_buf[disps[i] + 2 * sizeof(uint64_t) + rkey_sizes[i]]), + status = ucp_ep_rkey_unpack(ep, &recv_buf[info_offset], &((module->state_info_array[i]).rkey)); if (status != UCS_OK) { OSC_UCX_VERBOSE(1, "ucp_ep_rkey_unpack failed: %d", status); From 1bffd196efcbbe241eae6ff7c0b2d97455814922 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Tue, 9 Oct 2018 16:38:49 +0300 Subject: [PATCH 141/674] pml_ucx: add ompi datatype attribute to release ucp_datatype (picked from master 4763822) Signed-off-by: Yossi Itigin --- ompi/mca/pml/ucx/pml_ucx.c | 62 ++++++++++++++++++++++++----- ompi/mca/pml/ucx/pml_ucx.h | 5 +++ ompi/mca/pml/ucx/pml_ucx_datatype.c | 37 +++++++++++++++-- ompi/mca/pml/ucx/pml_ucx_datatype.h | 7 +++- 4 files changed, 96 insertions(+), 15 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 1f37212c58f..d92ad5a58cb 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -16,6 +16,7 @@ #include "opal/runtime/opal.h" #include "opal/mca/pmix/pmix.h" +#include "ompi/attribute/attribute.h" #include "ompi/message/message.h" #include "ompi/mca/pml/base/pml_base_bsend.h" #include "opal/mca/common/ucx/common_ucx.h" @@ -190,9 +191,9 @@ int mca_pml_ucx_close(void) int mca_pml_ucx_init(void) { ucp_worker_params_t params; - ucs_status_t status; ucp_worker_attr_t attr; - int rc; + ucs_status_t status; + int i, rc; PML_UCX_VERBOSE(1, "mca_pml_ucx_init"); @@ -209,30 +210,34 @@ int mca_pml_ucx_init(void) &ompi_pml_ucx.ucp_worker); if (UCS_OK != status) { PML_UCX_ERROR("Failed to create UCP worker"); - return OMPI_ERROR; + rc = OMPI_ERROR; + goto err; } attr.field_mask = UCP_WORKER_ATTR_FIELD_THREAD_MODE; status = ucp_worker_query(ompi_pml_ucx.ucp_worker, &attr); if (UCS_OK != status) { - ucp_worker_destroy(ompi_pml_ucx.ucp_worker); - ompi_pml_ucx.ucp_worker = NULL; PML_UCX_ERROR("Failed to query UCP worker thread level"); - return OMPI_ERROR; + rc = OMPI_ERROR; + goto err_destroy_worker; } - if (ompi_mpi_thread_multiple && attr.thread_mode != UCS_THREAD_MODE_MULTI) { + if (ompi_mpi_thread_multiple && (attr.thread_mode != UCS_THREAD_MODE_MULTI)) { /* UCX does not support multithreading, disqualify current PML for now */ /* TODO: we should let OMPI to fallback to THREAD_SINGLE mode */ - ucp_worker_destroy(ompi_pml_ucx.ucp_worker); - ompi_pml_ucx.ucp_worker = NULL; PML_UCX_ERROR("UCP worker does not support MPI_THREAD_MULTIPLE"); - return OMPI_ERROR; + rc = OMPI_ERR_NOT_SUPPORTED; + goto err_destroy_worker; } rc = mca_pml_ucx_send_worker_address(); if (rc < 0) { - return rc; + goto err_destroy_worker; + } + + ompi_pml_ucx.datatype_attr_keyval = MPI_KEYVAL_INVALID; + for (i = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; ++i) { + ompi_pml_ucx.predefined_types[i] = PML_UCX_DATATYPE_INVALID; } /* Initialize the free lists */ @@ -249,14 +254,33 @@ int mca_pml_ucx_init(void) (void *)ompi_pml_ucx.ucp_context, (void *)ompi_pml_ucx.ucp_worker); return OMPI_SUCCESS; + +err_destroy_worker: + ucp_worker_destroy(ompi_pml_ucx.ucp_worker); + ompi_pml_ucx.ucp_worker = NULL; +err: + return OMPI_ERROR; } int mca_pml_ucx_cleanup(void) { + int i; + PML_UCX_VERBOSE(1, "mca_pml_ucx_cleanup"); opal_progress_unregister(mca_pml_ucx_progress); + if (ompi_pml_ucx.datatype_attr_keyval != MPI_KEYVAL_INVALID) { + ompi_attr_free_keyval(TYPE_ATTR, &ompi_pml_ucx.datatype_attr_keyval, false); + } + + for (i = 0; i < OMPI_DATATYPE_MAX_PREDEFINED; ++i) { + if (ompi_pml_ucx.predefined_types[i] != PML_UCX_DATATYPE_INVALID) { + ucp_dt_destroy(ompi_pml_ucx.predefined_types[i]); + ompi_pml_ucx.predefined_types[i] = PML_UCX_DATATYPE_INVALID; + } + } + ompi_pml_ucx.completed_send_req.req_state = OMPI_REQUEST_INVALID; OMPI_REQUEST_FINI(&ompi_pml_ucx.completed_send_req); OBJ_DESTRUCT(&ompi_pml_ucx.completed_send_req); @@ -398,6 +422,22 @@ int mca_pml_ucx_del_procs(struct ompi_proc_t **procs, size_t nprocs) int mca_pml_ucx_enable(bool enable) { + ompi_attribute_fn_ptr_union_t copy_fn; + ompi_attribute_fn_ptr_union_t del_fn; + int ret; + + /* Create a key for adding custom attributes to datatypes */ + copy_fn.attr_datatype_copy_fn = + (MPI_Type_internal_copy_attr_function*)MPI_TYPE_NULL_COPY_FN; + del_fn.attr_datatype_delete_fn = mca_pml_ucx_datatype_attr_del_fn; + ret = ompi_attr_create_keyval(TYPE_ATTR, copy_fn, del_fn, + &ompi_pml_ucx.datatype_attr_keyval, NULL, 0, + NULL); + if (ret != OMPI_SUCCESS) { + PML_UCX_ERROR("Failed to create keyval for UCX datatypes: %d", ret); + return ret; + } + PML_UCX_FREELIST_INIT(&ompi_pml_ucx.persistent_reqs, mca_pml_ucx_persistent_request_t, 128, -1, 128); diff --git a/ompi/mca/pml/ucx/pml_ucx.h b/ompi/mca/pml/ucx/pml_ucx.h index da1b3ef0c57..484ad5ebe1c 100644 --- a/ompi/mca/pml/ucx/pml_ucx.h +++ b/ompi/mca/pml/ucx/pml_ucx.h @@ -15,6 +15,7 @@ #include "ompi/mca/pml/pml.h" #include "ompi/mca/pml/base/base.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/communicator/communicator.h" #include "ompi/request/request.h" #include "opal/mca/common/ucx/common_ucx.h" @@ -42,6 +43,10 @@ struct mca_pml_ucx_module { ucp_context_h ucp_context; ucp_worker_h ucp_worker; + /* Datatypes */ + int datatype_attr_keyval; + ucp_datatype_t predefined_types[OMPI_DATATYPE_MPI_MAX_PREDEFINED]; + /* Requests */ mca_pml_ucx_freelist_t persistent_reqs; ompi_request_t completed_send_req; diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.c b/ompi/mca/pml/ucx/pml_ucx_datatype.c index 98b7b190df7..74b5fbe19c3 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.c +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.c @@ -10,6 +10,7 @@ #include "pml_ucx_datatype.h" #include "ompi/runtime/mpiruntime.h" +#include "ompi/attribute/attribute.h" #include @@ -127,12 +128,25 @@ static ucp_generic_dt_ops_t pml_ucx_generic_datatype_ops = { .finish = pml_ucx_generic_datatype_finish }; +int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, + void *attr_val, void *extra) +{ + ucp_datatype_t ucp_datatype = (ucp_datatype_t)attr_val; + + PML_UCX_ASSERT((void*)ucp_datatype == datatype->pml_data); + + ucp_dt_destroy(ucp_datatype); + datatype->pml_data = PML_UCX_DATATYPE_INVALID; + return OMPI_SUCCESS; +} + ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype) { ucp_datatype_t ucp_datatype; ucs_status_t status; ptrdiff_t lb; size_t size; + int ret; ompi_datatype_type_lb(datatype, &lb); @@ -147,16 +161,33 @@ ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype) } status = ucp_dt_create_generic(&pml_ucx_generic_datatype_ops, - datatype, &ucp_datatype); + datatype, &ucp_datatype); if (status != UCS_OK) { PML_UCX_ERROR("Failed to create UCX datatype for %s", datatype->name); ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); } + datatype->pml_data = ucp_datatype; + + /* Add custom attribute, to clean up UCX resources when OMPI datatype is + * released. + */ + if (ompi_datatype_is_predefined(datatype)) { + PML_UCX_ASSERT(datatype->id < OMPI_DATATYPE_MAX_PREDEFINED); + ompi_pml_ucx.predefined_types[datatype->id] = ucp_datatype; + } else { + ret = ompi_attr_set_c(TYPE_ATTR, datatype, &datatype->d_keyhash, + ompi_pml_ucx.datatype_attr_keyval, + (void*)ucp_datatype, false); + if (ret != OMPI_SUCCESS) { + PML_UCX_ERROR("Failed to add UCX datatype attribute for %s: %d", + datatype->name, ret); + ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); + } + } + PML_UCX_VERBOSE(7, "created generic UCX datatype 0x%"PRIx64, ucp_datatype) - // TODO put this on a list to be destroyed later - datatype->pml_data = ucp_datatype; return ucp_datatype; } diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.h b/ompi/mca/pml/ucx/pml_ucx_datatype.h index 26b1835a153..f5207cecc75 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.h +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.h @@ -13,6 +13,8 @@ #include "pml_ucx.h" +#define PML_UCX_DATATYPE_INVALID 0 + struct pml_ucx_convertor { opal_free_list_item_t super; ompi_datatype_t *datatype; @@ -23,6 +25,9 @@ struct pml_ucx_convertor { ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype); +int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, + void *attr_val, void *extra); + OBJ_CLASS_DECLARATION(mca_pml_ucx_convertor_t); @@ -30,7 +35,7 @@ static inline ucp_datatype_t mca_pml_ucx_get_datatype(ompi_datatype_t *datatype) { ucp_datatype_t ucp_type = datatype->pml_data; - if (OPAL_LIKELY(ucp_type != 0)) { + if (OPAL_LIKELY(ucp_type != PML_UCX_DATATYPE_INVALID)) { return ucp_type; } From 4a97d6b9fa124984a96082a58e37f902bbfcd06a Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Wed, 10 Oct 2018 12:10:28 +0300 Subject: [PATCH 142/674] pml_ucx: fix return code from mca_pml_ucx_init() (picked from master 40ac9e4) Signed-off-by: Yossi Itigin --- ompi/mca/pml/ucx/pml_ucx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index d92ad5a58cb..2e10a3b768c 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -253,7 +253,7 @@ int mca_pml_ucx_init(void) PML_UCX_VERBOSE(2, "created ucp context %p, worker %p", (void *)ompi_pml_ucx.ucp_context, (void *)ompi_pml_ucx.ucp_worker); - return OMPI_SUCCESS; + return rc; err_destroy_worker: ucp_worker_destroy(ompi_pml_ucx.ucp_worker); From eabc94cab0ead727ea6cc2c00103f8626db9273c Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Wed, 10 Oct 2018 20:40:35 +0300 Subject: [PATCH 143/674] osc_ucx: add worker flush before osc module free Make sure all pending communications are done on all ranks before closing the window. This way it will be safe to close the endpoints when closing the component. (picked from master b8e1af6) Signed-off-by: Yossi Itigin --- ompi/mca/osc/ucx/osc_ucx_component.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 955857d9744..3aa64240171 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -804,6 +804,8 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) { ucp_worker_progress(mca_osc_ucx_component.ucp_worker); } + opal_common_ucx_worker_flush(mca_osc_ucx_component.ucp_worker); + ret = module->comm->c_coll->coll_barrier(module->comm, module->comm->c_coll->coll_barrier_module); From 600967d2edb4639567417e6c3a43c134202e4b2f Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 11 Oct 2018 10:56:39 -0400 Subject: [PATCH 144/674] mpi.h.in: remove C99-style comments While we require C99 to build Open MPI, we do not require C99 to build user MPI applications. As such, we shouldn't have C99-style comments (i.e., "//"-style) in mpi.h.in. Thanks to @AdamSimpson for reporting the issue. This commit simply converts a //-style comment to a /**/-style comment. No code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit f4b3ccabf726eaec6d39cbcff809882da55ae1e5) --- ompi/include/mpi.h.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 7c4c1cf49f8..2db11d336f6 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -417,10 +417,12 @@ typedef ompi_file_errhandler_fn MPI_File_errhandler_fn typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn __mpi_interface_removed__("MPI_Win_errhandler_fn was removed in MPI-3.0; use MPI_Win_errhandler_function instead"); -// NOTE: We intentionally do *not* mark the following as -// deprecated/removed because they are used below in function -// prototypes (and would therefore emit warnings, just for #including -// ). +/* + * NOTE: We intentionally do *not* mark the following as + * deprecated/removed because they are used below in function + * prototypes (and would therefore emit warnings, just for #including + * ). + */ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...); typedef int (MPI_Copy_function)(MPI_Comm, int, void *, void *, void *, int *); From 0c4ba45af2bca82541dc1e9600e141014a6dd454 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 11 Oct 2018 10:40:08 -0600 Subject: [PATCH 145/674] btl/uct: use the correct tl interface attributes It is apparently possible for different instances of the same UCT transport to have different limits (max short put for example). To account for this we need to store the attributes per TL context not per TL. This commit fixes the issue. Signed-off-by: Nathan Hjelm (cherry picked from commit 6ed68da870c391d88575dc027a3de4826a77f57e) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct.h | 8 ++--- opal/mca/btl/uct/btl_uct_am.c | 15 ++++----- opal/mca/btl/uct/btl_uct_component.c | 12 ++++---- opal/mca/btl/uct/btl_uct_endpoint.c | 9 +++--- opal/mca/btl/uct/btl_uct_module.c | 2 +- opal/mca/btl/uct/btl_uct_rdma.c | 5 ++- opal/mca/btl/uct/btl_uct_tl.c | 46 ++++++++++++++-------------- opal/mca/btl/uct/btl_uct_types.h | 8 +++-- 8 files changed, 53 insertions(+), 52 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index d31ad1402ff..989fe641325 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -286,7 +286,7 @@ int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, u */ static inline bool mca_btl_uct_tl_supports_rdma (mca_btl_uct_tl_t *tl) { - return (tl->uct_iface_attr.cap.flags & (UCT_IFACE_FLAG_PUT_ZCOPY | UCT_IFACE_FLAG_GET_ZCOPY)) == + return (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & (UCT_IFACE_FLAG_PUT_ZCOPY | UCT_IFACE_FLAG_GET_ZCOPY)) == (UCT_IFACE_FLAG_PUT_ZCOPY | UCT_IFACE_FLAG_GET_ZCOPY); } @@ -295,7 +295,7 @@ static inline bool mca_btl_uct_tl_supports_rdma (mca_btl_uct_tl_t *tl) */ static inline bool mca_btl_uct_tl_support_am (mca_btl_uct_tl_t *tl) { - return (tl->uct_iface_attr.cap.flags & (UCT_IFACE_FLAG_AM_SHORT | UCT_IFACE_FLAG_AM_BCOPY | UCT_IFACE_FLAG_AM_ZCOPY)); + return (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & (UCT_IFACE_FLAG_AM_SHORT | UCT_IFACE_FLAG_AM_BCOPY | UCT_IFACE_FLAG_AM_ZCOPY)); } /** @@ -305,7 +305,7 @@ static inline bool mca_btl_uct_tl_support_am (mca_btl_uct_tl_t *tl) */ static inline bool mca_btl_uct_tl_supports_conn (mca_btl_uct_tl_t *tl) { - return (tl->uct_iface_attr.cap.flags & (UCT_IFACE_FLAG_AM_SHORT | UCT_IFACE_FLAG_CONNECT_TO_IFACE)) == + return (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & (UCT_IFACE_FLAG_AM_SHORT | UCT_IFACE_FLAG_CONNECT_TO_IFACE)) == (UCT_IFACE_FLAG_AM_SHORT | UCT_IFACE_FLAG_CONNECT_TO_IFACE); } @@ -316,7 +316,7 @@ static inline bool mca_btl_uct_tl_supports_conn (mca_btl_uct_tl_t *tl) */ static inline bool mca_btl_uct_tl_requires_connection_tl (mca_btl_uct_tl_t *tl) { - return !(tl->uct_iface_attr.cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE); + return !(MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE); } END_C_DECLS diff --git a/opal/mca/btl/uct/btl_uct_am.c b/opal/mca/btl/uct/btl_uct_am.c index 1c367691378..5d3f0ef042a 100644 --- a/opal/mca/btl/uct/btl_uct_am.c +++ b/opal/mca/btl/uct/btl_uct_am.c @@ -25,7 +25,7 @@ mca_btl_base_descriptor_t *mca_btl_uct_alloc (mca_btl_base_module_t *btl, mca_bt mca_btl_uct_module_t *uct_btl = (mca_btl_uct_module_t *) btl; mca_btl_uct_base_frag_t *frag = NULL; - if ((size + 8) <= (size_t) uct_btl->am_tl->uct_iface_attr.cap.am.max_short) { + if ((size + 8) <= (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { frag = mca_btl_uct_frag_alloc_short (uct_btl, endpoint); } else if (size <= uct_btl->super.btl_eager_limit) { frag = mca_btl_uct_frag_alloc_eager (uct_btl, endpoint); @@ -97,7 +97,7 @@ struct mca_btl_base_descriptor_t *mca_btl_uct_prepare_src (mca_btl_base_module_t frag->base.order = order; frag->base.des_flags = flags; - if (total_size > (size_t) uct_btl->am_tl->uct_iface_attr.cap.am.max_short) { + if (total_size > (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { frag->segments[1].seg_len = *size; frag->segments[1].seg_addr.pval = data_ptr; frag->base.des_segment_count = 2; @@ -253,10 +253,11 @@ static size_t mca_btl_uct_sendi_pack (void *data, void *arg) return args->header_size + args->payload_size + 8; } -static inline size_t mca_btl_uct_max_sendi (mca_btl_uct_module_t *uct_btl) +static inline size_t mca_btl_uct_max_sendi (mca_btl_uct_module_t *uct_btl, int context_id) { - return (uct_btl->am_tl->uct_iface_attr.cap.am.max_short > uct_btl->am_tl->uct_iface_attr.cap.am.max_bcopy) ? - uct_btl->am_tl->uct_iface_attr.cap.am.max_short : uct_btl->am_tl->uct_iface_attr.cap.am.max_bcopy; + const mca_btl_uct_tl_t *tl = uct_btl->am_tl; + return (MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_short > MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_bcopy) ? + MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_short : MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_bcopy; } int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, opal_convertor_t *convertor, @@ -274,7 +275,7 @@ int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endp int rc; rc = mca_btl_uct_endpoint_check_am (uct_btl, endpoint, context, &ep_handle); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc || msg_size > mca_btl_uct_max_sendi (uct_btl))) { + if (OPAL_UNLIKELY(OPAL_SUCCESS != rc || msg_size > mca_btl_uct_max_sendi (uct_btl, context->context_id))) { if (descriptor) { *descriptor = mca_btl_uct_alloc (btl, endpoint, order, total_size, flags); } @@ -287,7 +288,7 @@ int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endp mca_btl_uct_context_lock (context); if (0 == payload_size) { ucs_status = uct_ep_am_short (ep_handle, MCA_BTL_UCT_FRAG, am_header.value, header, header_size); - } else if (msg_size < (size_t) uct_btl->am_tl->uct_iface_attr.cap.am.max_short) { + } else if (msg_size < (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, context->context_id).cap.am.max_short) { int8_t *data = alloca (total_size); _mca_btl_uct_send_pack (data, header, header_size, convertor, payload_size); ucs_status = uct_ep_am_short (ep_handle, MCA_BTL_UCT_FRAG, am_header.value, data, total_size); diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index a9ad52dea59..fe5bd1eb0ba 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -149,12 +149,12 @@ static size_t mca_btl_uct_tl_modex_size (mca_btl_uct_tl_t *tl) { const size_t size = strlen (tl->uct_tl_name) + 1; - if (tl->uct_iface_attr.cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE) { + if (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE) { /* pad out to a multiple of 4 bytes */ - return (4 + 3 + size + tl->uct_iface_attr.device_addr_len + tl->uct_iface_attr.iface_addr_len) & ~3; + return (4 + 3 + size + MCA_BTL_UCT_TL_ATTR(tl, 0).device_addr_len + MCA_BTL_UCT_TL_ATTR(tl, 0).iface_addr_len) & ~3; } - return (4 + 3 + size + tl->uct_iface_attr.device_addr_len) & ~3; + return (4 + 3 + size + MCA_BTL_UCT_TL_ATTR(tl, 0).device_addr_len) & ~3; } static size_t mca_btl_uct_module_modex_size (mca_btl_uct_module_t *module) @@ -193,13 +193,13 @@ static size_t mca_btl_uct_tl_modex_pack (mca_btl_uct_tl_t *tl, uint8_t *modex_da * the same endpoint since we are only doing RDMA. if any of these assumptions are * wrong then we can't delay creating the other contexts and must include their * information in the modex. */ - if (tl->uct_iface_attr.cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE) { + if (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & UCT_IFACE_FLAG_CONNECT_TO_IFACE) { uct_iface_get_address (dev_context->uct_iface, (uct_iface_addr_t *) modex_data); - modex_data += tl->uct_iface_attr.iface_addr_len; + modex_data += MCA_BTL_UCT_TL_ATTR(tl, 0).iface_addr_len; } uct_iface_get_device_address (dev_context->uct_iface, (uct_device_addr_t *) modex_data); - modex_data += tl->uct_iface_attr.device_addr_len; + modex_data += MCA_BTL_UCT_TL_ATTR(tl, 0).device_addr_len; return modex_size; } diff --git a/opal/mca/btl/uct/btl_uct_endpoint.c b/opal/mca/btl/uct/btl_uct_endpoint.c index 286326d8fe9..e0d39dee55c 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.c +++ b/opal/mca/btl/uct/btl_uct_endpoint.c @@ -109,15 +109,14 @@ static int mca_btl_uct_endpoint_connect_iface (mca_btl_uct_module_t *uct_btl, mc /* easy case. just connect to the interface */ iface_addr = (uct_iface_addr_t *) tl_data; - device_addr = (uct_device_addr_t *) ((uintptr_t) iface_addr + tl->uct_iface_attr.iface_addr_len); + device_addr = (uct_device_addr_t *) ((uintptr_t) iface_addr + MCA_BTL_UCT_TL_ATTR(tl, tl_context->context_id).iface_addr_len); BTL_VERBOSE(("connecting endpoint to interface")); mca_btl_uct_context_lock (tl_context); ucs_status = uct_ep_create_connected (tl_context->uct_iface, device_addr, iface_addr, &tl_endpoint->uct_ep); - mca_btl_uct_context_unlock (tl_context); - tl_endpoint->flags = MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY; + mca_btl_uct_context_unlock (tl_context); return (UCS_OK == ucs_status) ? OPAL_SUCCESS : OPAL_ERROR; } @@ -189,7 +188,7 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, mca_btl_uct_tl_endpoint_t *tl_endpoint, uint8_t *tl_data, uint8_t *conn_tl_data, void *ep_addr) { - size_t request_length = sizeof (mca_btl_uct_conn_req_t) + tl->uct_iface_attr.ep_addr_len; + size_t request_length = sizeof (mca_btl_uct_conn_req_t) + MCA_BTL_UCT_TL_ATTR(tl, tl_context->context_id).ep_addr_len; mca_btl_uct_connection_ep_t *conn_ep = endpoint->conn_ep; mca_btl_uct_tl_t *conn_tl = uct_btl->conn_tl; mca_btl_uct_device_context_t *conn_tl_context = conn_tl->uct_dev_contexts[0]; @@ -208,7 +207,7 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, opal_process_name_print (endpoint->ep_proc->proc_name))); iface_addr = (uct_iface_addr_t *) conn_tl_data; - device_addr = (uct_device_addr_t *) ((uintptr_t) conn_tl_data + conn_tl->uct_iface_attr.iface_addr_len); + device_addr = (uct_device_addr_t *) ((uintptr_t) conn_tl_data + MCA_BTL_UCT_TL_ATTR(conn_tl, 0).iface_addr_len); endpoint->conn_ep = conn_ep = OBJ_NEW(mca_btl_uct_connection_ep_t); if (OPAL_UNLIKELY(NULL == conn_ep)) { diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index 8357be215a2..ebd7ab6d684 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -88,7 +88,7 @@ static int mca_btl_uct_add_procs (mca_btl_base_module_t *btl, if (am_tl) { rc = opal_free_list_init (&uct_module->short_frags, sizeof (mca_btl_uct_base_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_uct_base_frag_t), - am_tl->uct_iface_attr.cap.am.max_short, opal_cache_line_size, + MCA_BTL_UCT_TL_ATTR(am_tl, 0).cap.am.max_short, opal_cache_line_size, 0, 1024, 64, NULL, 0, NULL, NULL, NULL); rc = opal_free_list_init (&uct_module->eager_frags, sizeof (mca_btl_uct_base_frag_t), diff --git a/opal/mca/btl/uct/btl_uct_rdma.c b/opal/mca/btl/uct/btl_uct_rdma.c index 51cc5676cec..708dea148db 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.c +++ b/opal/mca/btl/uct/btl_uct_rdma.c @@ -98,13 +98,12 @@ int mca_btl_uct_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi mca_btl_uct_context_lock (context); - if (size <= uct_btl->rdma_tl->uct_iface_attr.cap.get.max_bcopy) { + if (size <= MCA_BTL_UCT_TL_ATTR(uct_btl->rdma_tl, context->context_id).cap.get.max_bcopy) { ucs_status = uct_ep_get_bcopy (ep_handle, mca_btl_uct_get_unpack, local_address, size, remote_address, rkey.rkey, &comp->uct_comp); } else { uct_iov_t iov = {.buffer = local_address, .length = size, .stride = 0, .count = 1, .memh = MCA_BTL_UCT_REG_REMOTE_TO_LOCAL(local_handle)->uct_memh}; - ucs_status = uct_ep_get_zcopy (ep_handle, &iov, 1, remote_address, rkey.rkey, &comp->uct_comp); } @@ -183,7 +182,7 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi /* determine what UCT prototol should be used */ if (size <= uct_btl->super.btl_put_local_registration_threshold) { - use_short = size <= uct_btl->rdma_tl->uct_iface_attr.cap.put.max_short; + use_short = size <= MCA_BTL_UCT_TL_ATTR(uct_btl->rdma_tl, context->context_id).cap.put.max_short; use_bcopy = !use_short; } diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index a9f4069b8cb..bca62c4813b 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -61,11 +61,11 @@ static uint64_t mca_btl_uct_cap_to_btl_atomic_flag[][2] = { static void mca_btl_uct_module_set_atomic_flags (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl) { - uint64_t cap_flags = tl->uct_iface_attr.cap.flags; + uint64_t cap_flags = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags; /* NTH: only use the fetching atomics for now */ - uint64_t atomic_flags32 = tl->uct_iface_attr.cap.atomic32.fop_flags; - uint64_t atomic_flags64 = tl->uct_iface_attr.cap.atomic64.fop_flags; + uint64_t atomic_flags32 = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.atomic32.fop_flags; + uint64_t atomic_flags64 = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.atomic64.fop_flags; /* NTH: don't really have a way to seperate 32-bit and 64-bit right now */ uint64_t all_flags = atomic_flags32 & atomic_flags64; @@ -110,7 +110,7 @@ static uint64_t mca_btl_uct_cap_to_btl_atomic_flag[][2] = { */ static void mca_btl_uct_module_set_atomic_flags (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl) { - uint64_t cap_flags = tl->uct_iface_attr.cap.flags; + uint64_t cap_flags = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags; module->super.btl_atomic_flags = 0; @@ -299,9 +299,16 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * return NULL; } - BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); + /* only need to query one of the interfaces to get the attributes */ + ucs_status = uct_iface_query (context->uct_iface, &context->uct_iface_attr); + if (UCS_OK != ucs_status) { + BTL_VERBOSE(("Error querying UCT interface")); + mca_btl_uct_context_destroy (context); + return NULL; + } if (enable_progress) { + BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); mca_btl_uct_context_enable_progress (context); } @@ -372,15 +379,8 @@ static mca_btl_uct_tl_t *mca_btl_uct_create_tl (mca_btl_uct_module_t *module, mc return NULL; } - /* only need to query one of the interfaces to get the attributes */ - ucs_status = uct_iface_query (tl->uct_dev_contexts[0]->uct_iface, &tl->uct_iface_attr); - if (UCS_OK != ucs_status) { - BTL_VERBOSE(("Error querying UCT interface")); - OBJ_RELEASE(tl); - return NULL; - } - - BTL_VERBOSE(("Interface CAPS for tl %s::%s: 0x%lx", module->md_name, tl_desc->tl_name, (unsigned long) tl->uct_iface_attr.cap.flags)); + BTL_VERBOSE(("Interface CAPS for tl %s::%s: 0x%lx", module->md_name, tl_desc->tl_name, + (unsigned long) MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags)); return tl; } @@ -391,20 +391,20 @@ static void mca_btl_uct_set_tl_rdma (mca_btl_uct_module_t *module, mca_btl_uct_t mca_btl_uct_module_set_atomic_flags (module, tl); - module->super.btl_get_limit = tl->uct_iface_attr.cap.get.max_zcopy; - if (tl->uct_iface_attr.cap.get.max_bcopy) { + module->super.btl_get_limit = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.get.max_zcopy; + if (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.get.max_bcopy) { module->super.btl_get_alignment = 0; - module->super.btl_get_local_registration_threshold = tl->uct_iface_attr.cap.get.max_bcopy; + module->super.btl_get_local_registration_threshold = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.get.max_bcopy; } else { /* this is overkill in terms of alignment but we have no way to enforce a minimum get size */ - module->super.btl_get_alignment = opal_next_poweroftwo_inclusive (tl->uct_iface_attr.cap.get.min_zcopy); + module->super.btl_get_alignment = opal_next_poweroftwo_inclusive (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.get.min_zcopy); } - module->super.btl_put_limit = tl->uct_iface_attr.cap.put.max_zcopy; + module->super.btl_put_limit = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.put.max_zcopy; module->super.btl_put_alignment = 0; /* no registration needed when using short/bcopy put */ - module->super.btl_put_local_registration_threshold = tl->uct_iface_attr.cap.put.max_bcopy; + module->super.btl_put_local_registration_threshold = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.put.max_bcopy; module->rdma_tl = tl; OBJ_RETAIN(tl); @@ -480,14 +480,14 @@ static int mca_btl_uct_evaluate_tl (mca_btl_uct_module_t *module, mca_btl_uct_tl } if (tl == module->rdma_tl || tl == module->am_tl) { - BTL_VERBOSE(("tl has flags 0x%" PRIx64, tl->uct_iface_attr.cap.flags)); - module->super.btl_flags |= mca_btl_uct_module_flags (tl->uct_iface_attr.cap.flags); + BTL_VERBOSE(("tl has flags 0x%" PRIx64, MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags)); + module->super.btl_flags |= mca_btl_uct_module_flags (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags); /* the bandwidth and latency numbers relate to both rdma and active messages. need to * come up with a better estimate. */ /* UCT bandwidth is in bytes/sec, BTL is in MB/sec */ - module->super.btl_bandwidth = (uint32_t) (tl->uct_iface_attr.bandwidth / 1048576.0); + module->super.btl_bandwidth = (uint32_t) (MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth / 1048576.0); /* TODO -- figure out how to translate UCT latency to us */ module->super.btl_latency = 1; } diff --git a/opal/mca/btl/uct/btl_uct_types.h b/opal/mca/btl/uct/btl_uct_types.h index 2033dcf4b31..22491b362f9 100644 --- a/opal/mca/btl/uct/btl_uct_types.h +++ b/opal/mca/btl/uct/btl_uct_types.h @@ -141,6 +141,9 @@ struct mca_btl_uct_device_context_t { /** UCT interface handle */ uct_iface_h uct_iface; + /** interface attributes */ + uct_iface_attr_t uct_iface_attr; + /** RDMA completions */ opal_free_list_t rdma_completions; @@ -307,9 +310,6 @@ struct mca_btl_uct_tl_t { /** device name for this tl (used for creating device contexts) */ char *uct_dev_name; - /** interface attributes */ - uct_iface_attr_t uct_iface_attr; - /** maxiumum number of device contexts that can be created */ int max_device_contexts; @@ -324,4 +324,6 @@ struct mca_btl_uct_tl_t { typedef struct mca_btl_uct_tl_t mca_btl_uct_tl_t; OBJ_CLASS_DECLARATION(mca_btl_uct_tl_t); +#define MCA_BTL_UCT_TL_ATTR(tl, context_id) (tl)->uct_dev_contexts[(context_id)]->uct_iface_attr + #endif /* !defined(BTL_UCT_TYPES_H) */ From d936752c170325a8220b2a42b3fa7b25787fb957 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 11 Oct 2018 16:35:08 -0500 Subject: [PATCH 146/674] Reving to v4.0.0rc5 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 77fbbd4191e..76e724ec509 100644 --- a/VERSION +++ b/VERSION @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc4 +greek=rc5 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 2b5a7ca816ec1378b58a9d923566fdb5dd810dbf Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 1 Oct 2018 13:23:54 +0900 Subject: [PATCH 147/674] fortran: add CHARACTER and LOGICAL support to MPI_Sizeof() Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@e4001040b4bb236891865df38bafebacfb29f08b) --- ompi/mpi/fortran/base/gen-mpi-sizeof.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl index 5ea3dca3a47..baa9cf1da59 100755 --- a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl +++ b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl @@ -1,8 +1,8 @@ #!/usr/bin/env perl # # Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Script to generate the overloaded MPI_SIZEOF interfaces and @@ -156,6 +156,8 @@ sub generate { queue_sub("complex(real${size})", "complex${size}", "real${size}"); } } +queue_sub("character", "character"); +queue_sub("logical", "logical"); ####################################################### From 05e05455811e32af63dc3813f53d6d58558c2978 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 15 Oct 2018 20:58:39 -0700 Subject: [PATCH 148/674] Ensure SIGCHLD is unblocked Thanks to @hjelmn for debugging it and providing the patch Signed-off-by: Ralph Castain (cherry picked from commit efa8bcc17078c89f1c9d6aabed35c90973a469bf) (cherry picked from commit 647a760b7e24194b37571a8245d8d39ed202e75b) Signed-off-by: Nathan Hjelm --- orte/mca/odls/base/odls_base_frame.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/orte/mca/odls/base/odls_base_frame.c b/orte/mca/odls/base/odls_base_frame.c index f4beb709b18..48c7702e60f 100644 --- a/orte/mca/odls/base/odls_base_frame.c +++ b/orte/mca/odls/base/odls_base_frame.c @@ -28,6 +28,7 @@ #include "orte/constants.h" #include +#include #include "opal/class/opal_ring_buffer.h" #include "orte/mca/mca.h" @@ -225,6 +226,7 @@ static int orte_odls_base_open(mca_base_open_flag_t flags) int rc, i, rank; orte_namelist_t *nm; bool xterm_hold; + sigset_t unblock; ORTE_CONSTRUCT_LOCK(&orte_odls_globals.lock); orte_odls_globals.lock.active = false; // start with nobody having the thread @@ -243,6 +245,17 @@ static int orte_odls_base_open(mca_base_open_flag_t flags) OBJ_CONSTRUCT(&orte_odls_globals.xterm_ranks, opal_list_t); orte_odls_globals.xtermcmd = NULL; + /* ensure that SIGCHLD is unblocked as we need to capture it */ + if (0 != sigemptyset(&unblock)) { + return ORTE_ERROR; + } + if (0 != sigaddset(&unblock, SIGCHLD)) { + return ORTE_ERROR; + } + if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) { + return ORTE_ERR_NOT_SUPPORTED; + } + /* check if the user requested that we display output in xterms */ if (NULL != orte_xterm) { /* construct a list of ranks to be displayed */ From eaa98af52cc65c3c101d389d307db45ea081ef5d Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 16 Oct 2018 12:33:03 -0600 Subject: [PATCH 149/674] opal/free_list: fix race condition There was a race condition in opal_free_list_get. Code throughout the Open MPI codebase was assuming that a NULL return from this function was due to an out-of-memory condition. In some cases this can lead to a fatal condition (MPI_Irecv and MPI_Isend in pml/ob1 for example). Before this commit opal_free_list_get_mt looked like this: ```c static inline opal_free_list_item_t *opal_free_list_get_mt (opal_free_list_t *flist) { opal_free_list_item_t *item = (opal_free_list_item_t*) opal_lifo_pop_atomic (&flist->super); if (OPAL_UNLIKELY(NULL == item)) { opal_mutex_lock (&flist->fl_lock); opal_free_list_grow_st (flist, flist->fl_num_per_alloc); opal_mutex_unlock (&flist->fl_lock); item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&flist->super); } return item; } ``` The problem is in a multithreaded environment is *is* possible for the free list to be grown successfully but the thread calling opal_free_list_get_mt to be left without an item. The happens if between the calls to opal_lifo_push_atomic in opal_free_list_grow_st and the call to opal_lifo_pop_atomic other threads pop all the items added to the free list. This commit fixes the issue by ensuring the thread that successfully grew the free list **always** gets a free list item. Fixes #2921 Signed-off-by: Nathan Hjelm (cherry picked from commit 5c770a7becc496f63b9f9a59151206236416f4f4) Signed-off-by: Nathan Hjelm --- opal/class/opal_free_list.c | 18 ++++++++++++------ opal/class/opal_free_list.h | 30 +++++++++++++++++++----------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/opal/class/opal_free_list.c b/opal/class/opal_free_list.c index b7c38b22f44..517d8ee0d3d 100644 --- a/opal/class/opal_free_list.c +++ b/opal/class/opal_free_list.c @@ -13,7 +13,7 @@ * Copyright (c) 2006-2007 Mellanox Technologies. All rights reserved. * Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -155,13 +155,13 @@ int opal_free_list_init (opal_free_list_t *flist, size_t frag_size, size_t frag_ flist->ctx = ctx; if (num_elements_to_alloc) { - return opal_free_list_grow_st (flist, num_elements_to_alloc); + return opal_free_list_grow_st (flist, num_elements_to_alloc, NULL); } return OPAL_SUCCESS; } -int opal_free_list_grow_st (opal_free_list_t* flist, size_t num_elements) +int opal_free_list_grow_st (opal_free_list_t* flist, size_t num_elements, opal_free_list_item_t **item_out) { unsigned char *ptr, *payload_ptr = NULL; opal_free_list_memory_t *alloc_ptr; @@ -263,10 +263,16 @@ int opal_free_list_grow_st (opal_free_list_t* flist, size_t num_elements) /* NTH: in case the free list may be accessed from multiple threads * use the atomic lifo push. The overhead is small compared to the * overall overhead of opal_free_list_grow(). */ - opal_lifo_push_atomic (&flist->super, &item->super); + if (item_out && 0 == i) { + /* ensure the thread that is growing the free list always gets an item + * if one is available */ + *item_out = item; + } else { + opal_lifo_push_atomic (&flist->super, &item->super); + } + ptr += head_size; payload_ptr += elem_size; - } if (OPAL_SUCCESS != rc && 0 == num_elements) { @@ -298,7 +304,7 @@ int opal_free_list_resize_mt(opal_free_list_t *flist, size_t size) opal_mutex_lock (&flist->fl_lock); do { - ret = opal_free_list_grow_st (flist, flist->fl_num_per_alloc); + ret = opal_free_list_grow_st (flist, flist->fl_num_per_alloc, NULL); if (OPAL_SUCCESS != ret) { break; } diff --git a/opal/class/opal_free_list.h b/opal/class/opal_free_list.h index 1e1de3e8e83..b7fd1920219 100644 --- a/opal/class/opal_free_list.h +++ b/opal/class/opal_free_list.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -146,6 +146,7 @@ OPAL_DECLSPEC int opal_free_list_init (opal_free_list_t *free_list, * * @param flist (IN) Free list to grow * @param num_elements (IN) Number of elements to add + * @param item_out (OUT) Location to store new free list item (can be NULL) * * @returns OPAL_SUCCESS if any elements were added * @returns OPAL_ERR_OUT_OF_RESOURCE if no elements could be added @@ -155,8 +156,14 @@ OPAL_DECLSPEC int opal_free_list_init (opal_free_list_t *free_list, * that may be accessed by multiple threads simultaneously. Note: this is an * internal function that will be used when needed by opal_free_list_get* and * opal_free_list_wait*. + * + * The item_out parameter can be used to ensure that the thread calling this + * function always gets a free list item if the list is successfully grown. + * This eliminates a race condition with code that simply calls free_list_get + * and assumes NULL is an out of memory condition (which it wasn't necessarily + * before this parameter was added). */ -OPAL_DECLSPEC int opal_free_list_grow_st (opal_free_list_t *flist, size_t num_elements); +OPAL_DECLSPEC int opal_free_list_grow_st (opal_free_list_t *flist, size_t num_elements, opal_free_list_item_t **item_out); /** * Grow the free list to be at least size elements. @@ -195,9 +202,8 @@ static inline opal_free_list_item_t *opal_free_list_get_mt (opal_free_list_t *fl if (OPAL_UNLIKELY(NULL == item)) { opal_mutex_lock (&flist->fl_lock); - opal_free_list_grow_st (flist, flist->fl_num_per_alloc); + opal_free_list_grow_st (flist, flist->fl_num_per_alloc, &item); opal_mutex_unlock (&flist->fl_lock); - item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&flist->super); } return item; @@ -209,8 +215,7 @@ static inline opal_free_list_item_t *opal_free_list_get_st (opal_free_list_t *fl (opal_free_list_item_t*) opal_lifo_pop_st (&flist->super); if (OPAL_UNLIKELY(NULL == item)) { - opal_free_list_grow_st (flist, flist->fl_num_per_alloc); - item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&flist->super); + opal_free_list_grow_st (flist, flist->fl_num_per_alloc, &item); } return item; @@ -253,7 +258,7 @@ static inline opal_free_list_item_t *opal_free_list_wait_mt (opal_free_list_t *f while (NULL == item) { if (!opal_mutex_trylock (&fl->fl_lock)) { if (fl->fl_max_to_alloc <= fl->fl_num_allocated || - OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc)) { + OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc, &item)) { fl->fl_num_waiting++; opal_condition_wait (&fl->fl_condition, &fl->fl_lock); fl->fl_num_waiting--; @@ -274,7 +279,9 @@ static inline opal_free_list_item_t *opal_free_list_wait_mt (opal_free_list_t *f opal_mutex_lock (&fl->fl_lock); } opal_mutex_unlock (&fl->fl_lock); - item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&fl->super); + if (NULL == item) { + item = (opal_free_list_item_t *) opal_lifo_pop_atomic (&fl->super); + } } return item; @@ -287,12 +294,13 @@ static inline opal_free_list_item_t *opal_free_list_wait_st (opal_free_list_t *f while (NULL == item) { if (fl->fl_max_to_alloc <= fl->fl_num_allocated || - OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc)) { + OPAL_SUCCESS != opal_free_list_grow_st (fl, fl->fl_num_per_alloc, &item)) { /* try to make progress */ opal_progress (); } - - item = (opal_free_list_item_t *) opal_lifo_pop (&fl->super); + if (NULL == item) { + item = (opal_free_list_item_t *) opal_lifo_pop (&fl->super); + } } return item; From e6f84e79de372a65387f9b1533079d7c136d1882 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Fri, 12 Oct 2018 12:15:03 -0600 Subject: [PATCH 150/674] btl/uct: fix deadlock in connection code This commit fixes a deadlock that can occur when using a TL that supports the connect to endpoint model. The deadlock was occurring while processing an incoming connection requests. This was done from an active-message callback. For some unknown reason (at this time) this callback was sometimes hanging. To avoid the issue the connection active-message is saved for later processing. At the same time I cleaned up the connection code to eliminate duplicate messages when possible. This commit also fixes some bugs in the active-message send path: - Correctly set all fragment fields in prepare_src. - Fix bug when using buffered-send. We were not reading the return code correctly (which is in bytes). This resulted in a message getting sent multiple times. - Don't try to progress sends from the btl_send function when in an active-message callback. It could lead to deep recursion and an eventual crash if we get a trace like send->progress->am_complete->ob1_callback->send->am_complete... Closes #5820 Closes #5821 Signed-off-by: Nathan Hjelm (cherry picked from commit 707d35deeb62a93ea8a3806d07e07e3a96c51d19) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct.h | 6 +- opal/mca/btl/uct/btl_uct_am.c | 121 +++++++++++++--------- opal/mca/btl/uct/btl_uct_am.h | 3 +- opal/mca/btl/uct/btl_uct_component.c | 20 +++- opal/mca/btl/uct/btl_uct_device_context.h | 12 +-- opal/mca/btl/uct/btl_uct_endpoint.c | 77 ++++++-------- opal/mca/btl/uct/btl_uct_endpoint.h | 3 +- opal/mca/btl/uct/btl_uct_module.c | 2 +- opal/mca/btl/uct/btl_uct_rdma.c | 29 ++++-- opal/mca/btl/uct/btl_uct_tl.c | 68 +++++++----- opal/mca/btl/uct/btl_uct_types.h | 18 +++- 11 files changed, 211 insertions(+), 148 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index 989fe641325..38756794430 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -68,7 +68,7 @@ struct mca_btl_uct_module_t { opal_hash_table_t id_to_endpoint; /** mutex to protect the module */ - opal_mutex_t lock; + opal_recursive_mutex_t lock; /** async context */ ucs_async_context_t *ucs_async; @@ -108,6 +108,9 @@ struct mca_btl_uct_module_t { /** frags that were waiting on connections that are now ready to send */ opal_list_t pending_frags; + + /** pending connection requests */ + opal_fifo_t pending_connection_reqs; }; typedef struct mca_btl_uct_module_t mca_btl_uct_module_t; @@ -278,6 +281,7 @@ ucs_status_t mca_btl_uct_am_handler (void *arg, void *data, size_t length, unsig struct mca_btl_base_endpoint_t *mca_btl_uct_get_ep (struct mca_btl_base_module_t *module, opal_proc_t *proc); int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, uct_tl_resource_desc_t *tl_descs, unsigned tl_count); +int mca_btl_uct_process_connection_request (mca_btl_uct_module_t *module, mca_btl_uct_conn_req_t *req); /** * @brief Checks if a tl is suitable for using for RDMA diff --git a/opal/mca/btl/uct/btl_uct_am.c b/opal/mca/btl/uct/btl_uct_am.c index 5d3f0ef042a..90ea28eed5c 100644 --- a/opal/mca/btl/uct/btl_uct_am.c +++ b/opal/mca/btl/uct/btl_uct_am.c @@ -25,7 +25,7 @@ mca_btl_base_descriptor_t *mca_btl_uct_alloc (mca_btl_base_module_t *btl, mca_bt mca_btl_uct_module_t *uct_btl = (mca_btl_uct_module_t *) btl; mca_btl_uct_base_frag_t *frag = NULL; - if ((size + 8) <= (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { + if (size <= (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { frag = mca_btl_uct_frag_alloc_short (uct_btl, endpoint); } else if (size <= uct_btl->super.btl_eager_limit) { frag = mca_btl_uct_frag_alloc_eager (uct_btl, endpoint); @@ -40,6 +40,10 @@ mca_btl_base_descriptor_t *mca_btl_uct_alloc (mca_btl_base_module_t *btl, mca_bt frag->base.des_flags = flags; frag->base.order = order; frag->uct_iov.length = size; + if (NULL != frag->base.super.registration) { + /* zero-copy fragments will need callbacks */ + frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; + } } return (mca_btl_base_descriptor_t *) frag; @@ -95,14 +99,18 @@ struct mca_btl_base_descriptor_t *mca_btl_uct_prepare_src (mca_btl_base_module_t return NULL; } + frag->uct_iov.length = total_size; frag->base.order = order; frag->base.des_flags = flags; if (total_size > (size_t) MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { + frag->segments[0].seg_len = reserve; frag->segments[1].seg_len = *size; frag->segments[1].seg_addr.pval = data_ptr; frag->base.des_segment_count = 2; } else { + frag->segments[0].seg_len = total_size; memcpy ((void *)((intptr_t) frag->segments[1].seg_addr.pval + reserve), data_ptr, *size); + frag->base.des_segment_count = 1; } } @@ -130,7 +138,7 @@ static size_t mca_btl_uct_send_frag_pack (void *data, void *arg) data = (void *)((intptr_t) data + 8); /* this function should only ever get called with fragments with two segments */ - for (size_t i = 0 ; i < 2 ; ++i) { + for (size_t i = 0 ; i < frag->base.des_segment_count ; ++i) { const size_t seg_len = frag->segments[i].seg_len; memcpy (data, frag->segments[i].seg_addr.pval, seg_len); data = (void *)((intptr_t) data + seg_len); @@ -140,57 +148,84 @@ static size_t mca_btl_uct_send_frag_pack (void *data, void *arg) return length; } -int mca_btl_uct_send_frag (mca_btl_uct_module_t *uct_btl, mca_btl_base_endpoint_t *endpoint, mca_btl_uct_base_frag_t *frag, - int32_t flags, mca_btl_uct_device_context_t *context, uct_ep_h ep_handle) +static void mca_btl_uct_append_pending_frag (mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_t *frag, + mca_btl_uct_device_context_t *context, bool ready) { + frag->ready = ready; + frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; + opal_atomic_wmb (); + + opal_list_append (&uct_btl->pending_frags, (opal_list_item_t *) frag); +} + +int mca_btl_uct_send_frag (mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_t *frag, bool append) +{ + mca_btl_uct_device_context_t *context = frag->context; + const ssize_t msg_size = frag->uct_iov.length + 8; + ssize_t size; ucs_status_t ucs_status; + uct_ep_h ep_handle = NULL; - mca_btl_uct_context_lock (context); + /* if we get here then we must have an endpoint handle for this context/endpoint pair */ + (void) mca_btl_uct_endpoint_test_am (uct_btl, frag->endpoint, frag->context, &ep_handle); + assert (NULL != ep_handle); - do { + /* if another thread set this we really don't care too much as this flag is only meant + * to protect against deep recursion */ + if (!context->in_am_callback) { + mca_btl_uct_context_lock (context); + /* attempt to post the fragment */ if (NULL != frag->base.super.registration) { frag->comp.dev_context = context; - ucs_status = uct_ep_am_zcopy (ep_handle, MCA_BTL_UCT_FRAG, &frag->header, sizeof (frag->header), &frag->uct_iov, 1, 0, &frag->comp.uct_comp); + + if (OPAL_LIKELY(UCS_INPROGRESS == ucs_status)) { + uct_worker_progress (context->uct_worker); + mca_btl_uct_context_unlock (context); + return OPAL_SUCCESS; + } } else { /* short message */ - /* restore original flags */ - frag->base.des_flags = flags; - - if (1 == frag->base.des_segment_count) { + if (1 == frag->base.des_segment_count && (frag->uct_iov.length + 8) < MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, 0).cap.am.max_short) { ucs_status = uct_ep_am_short (ep_handle, MCA_BTL_UCT_FRAG, frag->header.value, frag->uct_iov.buffer, frag->uct_iov.length); - } else { - ucs_status = uct_ep_am_bcopy (ep_handle, MCA_BTL_UCT_FRAG, mca_btl_uct_send_frag_pack, frag, 0); + + if (OPAL_LIKELY(UCS_OK == ucs_status)) { + uct_worker_progress (context->uct_worker); + mca_btl_uct_context_unlock (context); + /* send is complete */ + mca_btl_uct_frag_complete (frag, OPAL_SUCCESS); + return 1; + } } - } - if (UCS_ERR_NO_RESOURCE != ucs_status) { - /* go ahead and progress the worker while we have the lock */ - (void) uct_worker_progress (context->uct_worker); - break; + size = uct_ep_am_bcopy (ep_handle, MCA_BTL_UCT_FRAG, mca_btl_uct_send_frag_pack, frag, 0); + if (OPAL_LIKELY(size == msg_size)) { + uct_worker_progress (context->uct_worker); + mca_btl_uct_context_unlock (context); + /* send is complete */ + mca_btl_uct_frag_complete (frag, OPAL_SUCCESS); + return 1; + } } - /* wait for something to complete before trying again */ - while (!uct_worker_progress (context->uct_worker)); - } while (1); - - mca_btl_uct_context_unlock (context); + /* wait for something to happen */ + uct_worker_progress (context->uct_worker); + mca_btl_uct_context_unlock (context); - if (UCS_OK == ucs_status) { - /* restore original flags */ - frag->base.des_flags = flags; - /* send is complete */ - mca_btl_uct_frag_complete (frag, OPAL_SUCCESS); - return 1; + mca_btl_uct_device_handle_completions (context); } - if (OPAL_UNLIKELY(UCS_INPROGRESS != ucs_status)) { + if (!append) { return OPAL_ERR_OUT_OF_RESOURCE; } - return 0; + OPAL_THREAD_LOCK(&uct_btl->lock); + mca_btl_uct_append_pending_frag (uct_btl, frag, context, true); + OPAL_THREAD_UNLOCK(&uct_btl->lock); + + return OPAL_SUCCESS; } int mca_btl_uct_send (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, mca_btl_base_descriptor_t *descriptor, @@ -199,7 +234,6 @@ int mca_btl_uct_send (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpo mca_btl_uct_module_t *uct_btl = (mca_btl_uct_module_t *) btl; mca_btl_uct_device_context_t *context = mca_btl_uct_module_get_am_context (uct_btl); mca_btl_uct_base_frag_t *frag = (mca_btl_uct_base_frag_t *) descriptor; - int flags = frag->base.des_flags; uct_ep_h ep_handle; int rc; @@ -208,28 +242,21 @@ int mca_btl_uct_send (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpo frag->header.data.tag = tag; - - /* add the callback flag before posting to avoid potential races with other threads */ - frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; + frag->context = context; rc = mca_btl_uct_endpoint_check_am (uct_btl, endpoint, context, &ep_handle); if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - OPAL_THREAD_LOCK(&endpoint->ep_lock); + OPAL_THREAD_LOCK(&uct_btl->lock); /* check one more time in case another thread is completing the connection now */ if (OPAL_SUCCESS != mca_btl_uct_endpoint_test_am (uct_btl, endpoint, context, &ep_handle)) { - frag->context_id = context->context_id; - frag->ready = false; - OPAL_THREAD_LOCK(&uct_btl->lock); - opal_list_append (&uct_btl->pending_frags, (opal_list_item_t *) frag); - OPAL_THREAD_UNLOCK(&endpoint->ep_lock); + mca_btl_uct_append_pending_frag (uct_btl, frag, context, false); OPAL_THREAD_UNLOCK(&uct_btl->lock); - return OPAL_SUCCESS; } - OPAL_THREAD_UNLOCK(&endpoint->ep_lock); + OPAL_THREAD_UNLOCK(&uct_btl->lock); } - return mca_btl_uct_send_frag (uct_btl, endpoint, frag, flags, context, ep_handle); + return mca_btl_uct_send_frag (uct_btl, frag, true); } struct mca_btl_uct_sendi_pack_args_t { @@ -255,9 +282,7 @@ static size_t mca_btl_uct_sendi_pack (void *data, void *arg) static inline size_t mca_btl_uct_max_sendi (mca_btl_uct_module_t *uct_btl, int context_id) { - const mca_btl_uct_tl_t *tl = uct_btl->am_tl; - return (MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_short > MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_bcopy) ? - MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_short : MCA_BTL_UCT_TL_ATTR(tl, context_id).cap.am.max_bcopy; + return MCA_BTL_UCT_TL_ATTR(uct_btl->am_tl, context_id).cap.am.max_bcopy; } int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, opal_convertor_t *convertor, @@ -270,7 +295,7 @@ int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endp /* message with header */ const size_t msg_size = total_size + 8; mca_btl_uct_am_header_t am_header; - ucs_status_t ucs_status = UCS_OK; + ucs_status_t ucs_status = UCS_ERR_NO_RESOURCE; uct_ep_h ep_handle; int rc; diff --git a/opal/mca/btl/uct/btl_uct_am.h b/opal/mca/btl/uct/btl_uct_am.h index 97cf46bb66a..9035540e710 100644 --- a/opal/mca/btl/uct/btl_uct_am.h +++ b/opal/mca/btl/uct/btl_uct_am.h @@ -27,8 +27,7 @@ int mca_btl_uct_sendi (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endp int mca_btl_uct_send (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, mca_btl_base_descriptor_t *descriptor, mca_btl_base_tag_t tag); -int mca_btl_uct_send_frag (mca_btl_uct_module_t *uct_btl, mca_btl_base_endpoint_t *endpoint, mca_btl_uct_base_frag_t *frag, - int32_t flags, mca_btl_uct_device_context_t *context, uct_ep_h ep_handle); +int mca_btl_uct_send_frag (mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_t *frag, bool append); mca_btl_base_descriptor_t *mca_btl_uct_alloc (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, uint8_t order, size_t size, uint32_t flags); diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index fe5bd1eb0ba..74f85480c33 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -269,7 +269,8 @@ static mca_btl_uct_module_t *mca_btl_uct_alloc_module (const char *md_name, mca_ OBJ_CONSTRUCT(&module->eager_frags, opal_free_list_t); OBJ_CONSTRUCT(&module->max_frags, opal_free_list_t); OBJ_CONSTRUCT(&module->pending_frags, opal_list_t); - OBJ_CONSTRUCT(&module->lock, opal_mutex_t); + OBJ_CONSTRUCT(&module->lock, opal_recursive_mutex_t); + OBJ_CONSTRUCT(&module->pending_connection_reqs, opal_fifo_t); module->md = md; module->md_name = strdup (md_name); @@ -295,10 +296,13 @@ ucs_status_t mca_btl_uct_am_handler (void *arg, void *data, size_t length, unsig .seg_len = length - sizeof (*header)}; mca_btl_uct_base_frag_t frag = {.base = {.des_segments = &seg, .des_segment_count = 1}}; + /* prevent recursion */ + tl_context->in_am_callback = true; + reg = mca_btl_base_active_message_trigger + header->data.tag; - mca_btl_uct_context_unlock (tl_context); reg->cbfunc (&uct_btl->super, header->data.tag, &frag.base, reg->cbdata); - mca_btl_uct_context_lock (tl_context); + + tl_context->in_am_callback = false; return UCS_OK; } @@ -488,8 +492,7 @@ static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl opal_list_remove_item (&uct_btl->pending_frags, (opal_list_item_t *) frag); - if (OPAL_SUCCESS > mca_btl_uct_send (&uct_btl->super, frag->endpoint, &frag->base, - frag->header.data.tag)) { + if (OPAL_SUCCESS > mca_btl_uct_send_frag (uct_btl, frag, false)) { opal_list_prepend (&uct_btl->pending_frags, (opal_list_item_t *) frag); } } @@ -520,9 +523,16 @@ static int mca_btl_uct_component_progress (void) } if (module->conn_tl) { + mca_btl_uct_pending_connection_request_t *request; + if (module->conn_tl != module->am_tl && module->conn_tl != module->rdma_tl) { ret += mca_btl_uct_tl_progress (module->conn_tl, 0); } + + while (NULL != (request = (mca_btl_uct_pending_connection_request_t *) opal_fifo_pop_atomic (&module->pending_connection_reqs))) { + mca_btl_uct_process_connection_request (module, (mca_btl_uct_conn_req_t *) request->request_data); + OBJ_RELEASE(request); + } } if (0 != opal_list_get_size (&module->pending_frags)) { diff --git a/opal/mca/btl/uct/btl_uct_device_context.h b/opal/mca/btl/uct/btl_uct_device_context.h index f8155917e81..12ef1e1f42c 100644 --- a/opal/mca/btl/uct/btl_uct_device_context.h +++ b/opal/mca/btl/uct/btl_uct_device_context.h @@ -89,14 +89,12 @@ mca_btl_uct_module_get_tl_context_specific (mca_btl_uct_module_t *module, mca_bt mca_btl_uct_device_context_t *context = tl->uct_dev_contexts[context_id]; if (OPAL_UNLIKELY(NULL == context)) { - mca_btl_uct_device_context_t *new_context; - - new_context = mca_btl_uct_context_create (module, tl, context_id, true); - if (!opal_atomic_compare_exchange_strong_ptr (&tl->uct_dev_contexts[context_id], &context, new_context)) { - mca_btl_uct_context_destroy (new_context); - } else { - context = new_context; + OPAL_THREAD_LOCK(&module->lock); + context = tl->uct_dev_contexts[context_id]; + if (OPAL_UNLIKELY(NULL == context)) { + context = tl->uct_dev_contexts[context_id] = mca_btl_uct_context_create (module, tl, context_id, true); } + OPAL_THREAD_UNLOCK(&module->lock); } return context; diff --git a/opal/mca/btl/uct/btl_uct_endpoint.c b/opal/mca/btl/uct/btl_uct_endpoint.c index e0d39dee55c..804820bbba7 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.c +++ b/opal/mca/btl/uct/btl_uct_endpoint.c @@ -56,7 +56,7 @@ mca_btl_base_endpoint_t *mca_btl_uct_endpoint_create (opal_proc_t *proc) static unsigned char *mca_btl_uct_process_modex_tl (unsigned char *modex_data) { - BTL_VERBOSE(("processing modex for tl %s. size: %u", modex_data, *((uint32_t *) modex_data))); + BTL_VERBOSE(("processing modex for tl %s. size: %u", modex_data + 4, *((uint32_t *) modex_data))); /* skip size and name */ return modex_data + 4 + strlen ((char *) modex_data + 4) + 1; @@ -139,13 +139,13 @@ OBJ_CLASS_INSTANCE(mca_btl_uct_connection_ep_t, opal_object_t, mca_btl_uct_conne static int mca_btl_uct_endpoint_send_conn_req (mca_btl_uct_module_t *uct_btl, mca_btl_base_endpoint_t *endpoint, mca_btl_uct_device_context_t *conn_tl_context, - int64_t type, void *request, size_t request_length) + mca_btl_uct_conn_req_t *request, size_t request_length) { mca_btl_uct_connection_ep_t *conn_ep = endpoint->conn_ep; ucs_status_t ucs_status; - BTL_VERBOSE(("sending connection request to peer. type: %" PRId64 ", length: %" PRIsize_t, - type, request_length)); + BTL_VERBOSE(("sending connection request to peer. context id: %d, type: %d, length: %" PRIsize_t, + request->context_id, request->type, request_length)); OBJ_RETAIN(endpoint->conn_ep); @@ -154,7 +154,8 @@ static int mca_btl_uct_endpoint_send_conn_req (mca_btl_uct_module_t *uct_btl, mc do { MCA_BTL_UCT_CONTEXT_SERIALIZE(conn_tl_context, { - ucs_status = uct_ep_am_short (conn_ep->uct_ep, MCA_BTL_UCT_CONNECT_RDMA, type, request, request_length); + ucs_status = uct_ep_am_short (conn_ep->uct_ep, MCA_BTL_UCT_CONNECT_RDMA, request->type, request, + request_length); }); if (OPAL_LIKELY(UCS_OK == ucs_status)) { break; @@ -169,12 +170,10 @@ static int mca_btl_uct_endpoint_send_conn_req (mca_btl_uct_module_t *uct_btl, mc } while (1); /* for now we just wait for the connection request to complete before continuing */ - MCA_BTL_UCT_CONTEXT_SERIALIZE(conn_tl_context, { - do { - uct_worker_progress (conn_tl_context->uct_worker); - ucs_status = uct_ep_flush (conn_ep->uct_ep, 0, NULL); - } while (UCS_INPROGRESS == ucs_status); - }); + do { + ucs_status = uct_ep_flush (conn_ep->uct_ep, 0, NULL); + mca_btl_uct_context_progress (conn_tl_context); + } while (UCS_INPROGRESS == ucs_status); opal_mutex_lock (&endpoint->ep_lock); @@ -232,6 +231,7 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, request->proc_name = OPAL_PROC_MY_NAME; request->context_id = tl_context->context_id; request->tl_index = tl->tl_index; + request->type = !!(ep_addr); if (NULL == tl_endpoint->uct_ep) { BTL_VERBOSE(("allocating endpoint for peer %s and sending connection data", @@ -244,48 +244,37 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, OBJ_RELEASE(endpoint->conn_ep); return OPAL_ERROR; } - - /* fill in connection request */ - ucs_status = uct_ep_get_address (tl_endpoint->uct_ep, (uct_ep_addr_t *) request->ep_addr); - if (UCS_OK != ucs_status) { - /* this is a fatal a fatal error */ - OBJ_RELEASE(endpoint->conn_ep); - uct_ep_destroy (tl_endpoint->uct_ep); - tl_endpoint->uct_ep = NULL; - return OPAL_ERROR; - } - - rc = mca_btl_uct_endpoint_send_conn_req (uct_btl, endpoint, conn_tl_context, 0, request, - request_length); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - OBJ_RELEASE(endpoint->conn_ep); - uct_ep_destroy (tl_endpoint->uct_ep); - tl_endpoint->uct_ep = NULL; - return OPAL_ERROR; - } } if (ep_addr) { - BTL_VERBOSE(("using remote endpoint address to connect endpoint. ep_addr = %p", ep_addr)); - - device_addr = (uct_device_addr_t *) tl_data; + BTL_VERBOSE(("using remote endpoint address to connect endpoint for tl %s, index %d. ep_addr = %p", + tl->uct_tl_name, tl_context->context_id, ep_addr)); /* NTH: there is no need to lock the device context in this case */ - ucs_status = uct_ep_connect_to_ep (tl_endpoint->uct_ep, device_addr, ep_addr); + ucs_status = uct_ep_connect_to_ep (tl_endpoint->uct_ep, (uct_device_addr_t *) tl_data, ep_addr); if (UCS_OK != ucs_status) { return OPAL_ERROR; } + } - /* let the remote side know that the connection has been established and - * wait for the message to be sent */ - rc = mca_btl_uct_endpoint_send_conn_req (uct_btl, endpoint, conn_tl_context, 1, request, - sizeof (mca_btl_uct_conn_req_t)); - if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { - OBJ_RELEASE(endpoint->conn_ep); - uct_ep_destroy (tl_endpoint->uct_ep); - tl_endpoint->uct_ep = NULL; - return OPAL_ERROR; - } + /* fill in connection request */ + ucs_status = uct_ep_get_address (tl_endpoint->uct_ep, (uct_ep_addr_t *) request->ep_addr); + if (UCS_OK != ucs_status) { + /* this is a fatal a fatal error */ + OBJ_RELEASE(endpoint->conn_ep); + uct_ep_destroy (tl_endpoint->uct_ep); + tl_endpoint->uct_ep = NULL; + return OPAL_ERROR; + } + + /* let the remote side know that the connection has been established and + * wait for the message to be sent */ + rc = mca_btl_uct_endpoint_send_conn_req (uct_btl, endpoint, conn_tl_context, request, request_length); + if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { + OBJ_RELEASE(endpoint->conn_ep); + uct_ep_destroy (tl_endpoint->uct_ep); + tl_endpoint->uct_ep = NULL; + return OPAL_ERROR; } return (tl_endpoint->flags & MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY) ? OPAL_SUCCESS : OPAL_ERR_OUT_OF_RESOURCE; diff --git a/opal/mca/btl/uct/btl_uct_endpoint.h b/opal/mca/btl/uct/btl_uct_endpoint.h index 9a264bddbb8..6add6f27193 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.h +++ b/opal/mca/btl/uct/btl_uct_endpoint.h @@ -72,7 +72,8 @@ static inline int mca_btl_uct_endpoint_check (mca_btl_uct_module_t *module, mca_ rc = mca_btl_uct_endpoint_connect (module, endpoint, ep_index, NULL, tl_index); *ep_handle = endpoint->uct_eps[ep_index][tl_index].uct_ep; - BTL_VERBOSE(("mca_btl_uct_endpoint_connect returned %d", rc)); + BTL_VERBOSE(("mca_btl_uct_endpoint_connect returned %d. context id = %d, flags = 0x%x", rc, ep_index, + MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & endpoint->uct_eps[ep_index][tl_index].flags)); return rc; } diff --git a/opal/mca/btl/uct/btl_uct_module.c b/opal/mca/btl/uct/btl_uct_module.c index ebd7ab6d684..f0802867546 100644 --- a/opal/mca/btl/uct/btl_uct_module.c +++ b/opal/mca/btl/uct/btl_uct_module.c @@ -74,7 +74,6 @@ static int mca_btl_uct_add_procs (mca_btl_base_module_t *btl, if (false == uct_module->initialized) { mca_btl_uct_tl_t *am_tl = uct_module->am_tl; - mca_btl_uct_tl_t *rdma_tl = uct_module->rdma_tl; /* NTH: might want to vary this size based off the universe size (if * one exists). the table is only used for connection lookup and @@ -277,6 +276,7 @@ int mca_btl_uct_finalize (mca_btl_base_module_t* btl) OBJ_DESTRUCT(&uct_module->max_frags); OBJ_DESTRUCT(&uct_module->pending_frags); OBJ_DESTRUCT(&uct_module->lock); + OBJ_DESTRUCT(&uct_module->pending_connection_reqs); if (uct_module->rcache) { mca_rcache_base_module_destroy (uct_module->rcache); diff --git a/opal/mca/btl/uct/btl_uct_rdma.c b/opal/mca/btl/uct/btl_uct_rdma.c index 708dea148db..2d2d1c3f04b 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.c +++ b/opal/mca/btl/uct/btl_uct_rdma.c @@ -107,19 +107,24 @@ int mca_btl_uct_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi ucs_status = uct_ep_get_zcopy (ep_handle, &iov, 1, remote_address, rkey.rkey, &comp->uct_comp); } - /* go ahead and progress the worker while we have the lock */ - (void) uct_worker_progress (context->uct_worker); + /* go ahead and progress the worker while we have the lock (if we are not in an AM callback) */ + if (!context->in_am_callback) { + (void) uct_worker_progress (context->uct_worker); + } mca_btl_uct_context_unlock (context); - mca_btl_uct_device_handle_completions (context); + if (!context->in_am_callback) { + mca_btl_uct_device_handle_completions (context); + } if (UCS_OK == ucs_status && cbfunc) { /* if UCS_OK is returned the callback will never fire so we have to make the callback * ourselves */ cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS); - mca_btl_uct_uct_completion_release (comp); - } else if (UCS_INPROGRESS == ucs_status) { + } + + if (UCS_INPROGRESS == ucs_status) { ucs_status = UCS_OK; } else { mca_btl_uct_uct_completion_release (comp); @@ -203,8 +208,11 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi } /* go ahead and progress the worker while we have the lock */ - if (UCS_ERR_NO_RESOURCE != ucs_status) { - (void) uct_worker_progress (context->uct_worker); + if (UCS_ERR_NO_RESOURCE != ucs_status || context->in_am_callback) { + if (!context->in_am_callback) { + (void) uct_worker_progress (context->uct_worker); + } + break; } @@ -221,9 +229,12 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi * ourselves. this callback is possibly being made before the data is visible to the * remote process. */ cbfunc (btl, endpoint, local_address, local_handle, cbcontext, cbdata, OPAL_SUCCESS); - mca_btl_uct_uct_completion_release (comp); - } else if (UCS_INPROGRESS == ucs_status) { + } + + if (UCS_INPROGRESS == ucs_status) { ucs_status = UCS_OK; + } else { + mca_btl_uct_uct_completion_release (comp); } uct_rkey_release (&rkey); diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index bca62c4813b..721015fb2a5 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -164,60 +164,70 @@ OBJ_CLASS_INSTANCE(mca_btl_uct_tl_t, opal_list_item_t, mca_btl_uct_tl_constructo static ucs_status_t mca_btl_uct_conn_req_cb (void *arg, void *data, size_t length, unsigned flags) { mca_btl_uct_module_t *module = (mca_btl_uct_module_t *) arg; - mca_btl_uct_conn_req_t *req = (mca_btl_uct_conn_req_t *) ((uintptr_t) data + 8); + mca_btl_uct_pending_connection_request_t *request = calloc (1, length + sizeof (request->super)); + + /* it is not safe to process the connection request from the callback so just save it for + * later processing */ + OBJ_CONSTRUCT(request, mca_btl_uct_pending_connection_request_t); + memcpy (&request->request_data, (void *) ((intptr_t) data + 8), length); + opal_fifo_push_atomic (&module->pending_connection_reqs, &request->super); + + return UCS_OK; +} + +OBJ_CLASS_INSTANCE(mca_btl_uct_pending_connection_request_t, opal_list_item_t, NULL, NULL); + +int mca_btl_uct_process_connection_request (mca_btl_uct_module_t *module, mca_btl_uct_conn_req_t *req) +{ struct opal_proc_t *remote_proc = opal_proc_for_name (req->proc_name); mca_btl_base_endpoint_t *endpoint = mca_btl_uct_get_ep (&module->super, remote_proc); mca_btl_uct_tl_endpoint_t *tl_endpoint = endpoint->uct_eps[req->context_id] + req->tl_index; - int64_t type = *((int64_t *) data); int32_t ep_flags; int rc; - BTL_VERBOSE(("got connection request for endpoint %p. length = %lu", (void *) endpoint, length)); + BTL_VERBOSE(("got connection request for endpoint %p. type = %d. context id = %d", + (void *) endpoint, req->type, req->context_id)); if (NULL == endpoint) { BTL_ERROR(("could not create endpoint for connection request")); return UCS_ERR_UNREACHABLE; } - assert (type < 2); + assert (req->type < 2); - if (0 == type) { + ep_flags = opal_atomic_fetch_or_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC); + + if (!(ep_flags & MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC)) { /* create any necessary resources */ rc = mca_btl_uct_endpoint_connect (module, endpoint, req->context_id, req->ep_addr, req->tl_index); if (OPAL_SUCCESS != rc && OPAL_ERR_OUT_OF_RESOURCE != rc) { - BTL_ERROR(("could not setup rdma endpoint")); - return UCS_ERR_UNREACHABLE; + BTL_ERROR(("could not setup rdma endpoint. rc = %d", rc)); + return rc; } - - ep_flags = opal_atomic_or_fetch_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC); - } else { - ep_flags = opal_atomic_or_fetch_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REM_READY); } /* the connection is ready once we have received the connection data and also a connection ready * message. this might be overkill but there is little documentation at the UCT level on when * an endpoint can be used. */ - if ((ep_flags & (MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REM_READY | MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC)) == - (MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REM_READY | MCA_BTL_UCT_ENDPOINT_FLAG_CONN_REC)) { + if (req->type == 1) { + /* remote side is ready */ mca_btl_uct_base_frag_t *frag; /* to avoid a race with send adding pending frags grab the lock here */ - OPAL_THREAD_LOCK(&endpoint->ep_lock); - (void) opal_atomic_or_fetch_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY); - OPAL_THREAD_UNLOCK(&endpoint->ep_lock); - - opal_atomic_wmb (); + OPAL_THREAD_SCOPED_LOCK(&endpoint->ep_lock,{ + BTL_VERBOSE(("connection ready. sending %d frags", opal_list_get_size (&module->pending_frags))); + (void) opal_atomic_or_fetch_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY); + opal_atomic_wmb (); - OPAL_THREAD_SCOPED_LOCK(&module->lock, { OPAL_LIST_FOREACH(frag, &module->pending_frags, mca_btl_uct_base_frag_t) { - if (frag->context_id == req->context_id && endpoint == frag->endpoint) { + if (frag->context->context_id == req->context_id && endpoint == frag->endpoint) { frag->ready = true; } } }); } - return UCS_OK; + return OPAL_SUCCESS; } static int mca_btl_uct_setup_connection_tl (mca_btl_uct_module_t *module) @@ -284,7 +294,7 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * * use our own locks just go ahead and use UCS_THREAD_MODE_SINGLE. if they ever fix their * api then change this back to UCS_THREAD_MODE_MULTI and remove the locks around the * various UCT calls. */ - ucs_status = uct_worker_create (module->ucs_async, UCS_THREAD_MODE_SERIALIZED, &context->uct_worker); + ucs_status = uct_worker_create (module->ucs_async, UCS_THREAD_MODE_SINGLE, &context->uct_worker); if (OPAL_UNLIKELY(UCS_OK != ucs_status)) { BTL_VERBOSE(("could not create a UCT worker")); mca_btl_uct_context_destroy (context); @@ -307,17 +317,17 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * return NULL; } - if (enable_progress) { - BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); - mca_btl_uct_context_enable_progress (context); - } - if (context_id > 0 && tl == module->am_tl) { BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, context, UCT_CB_FLAG_SYNC); } + if (enable_progress) { + BTL_VERBOSE(("enabling progress for tl %p context id %d", (void *) tl, context_id)); + mca_btl_uct_context_enable_progress (context); + } + return context; } @@ -349,7 +359,6 @@ static int tl_compare (opal_list_item_t **a, opal_list_item_t **b) static mca_btl_uct_tl_t *mca_btl_uct_create_tl (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, uct_tl_resource_desc_t *tl_desc, int priority) { mca_btl_uct_tl_t *tl = OBJ_NEW(mca_btl_uct_tl_t); - ucs_status_t ucs_status; if (OPAL_UNLIKELY(NULL == tl)) { return NULL; @@ -434,6 +443,9 @@ static void mca_btl_uct_set_tl_am (mca_btl_uct_module_t *module, mca_btl_uct_tl_ if (tl->max_device_contexts <= 1) { tl->max_device_contexts = mca_btl_uct_component.num_contexts_per_module; } + + module->super.btl_max_send_size = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_zcopy - sizeof (mca_btl_uct_am_header_t); + module->super.btl_eager_limit = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_bcopy - sizeof (mca_btl_uct_am_header_t); } static int mca_btl_uct_set_tl_conn (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl) diff --git a/opal/mca/btl/uct/btl_uct_types.h b/opal/mca/btl/uct/btl_uct_types.h index 22491b362f9..7b7a4eaa69b 100644 --- a/opal/mca/btl/uct/btl_uct_types.h +++ b/opal/mca/btl/uct/btl_uct_types.h @@ -77,6 +77,9 @@ struct mca_btl_uct_conn_req_t { /** name of the requesting process */ opal_process_name_t proc_name; + /** request type: 0 == endpoint data, 1 == endpoint data + remote ready */ + int type; + /** context id that should be connected */ int context_id; @@ -153,6 +156,9 @@ struct mca_btl_uct_device_context_t { /** progress is enabled on this context */ bool progress_enabled; + + /** context is in AM callback */ + volatile bool in_am_callback; }; typedef struct mca_btl_uct_device_context_t mca_btl_uct_device_context_t; @@ -238,8 +244,8 @@ struct mca_btl_uct_base_frag_t { /** module this fragment is associated with */ struct mca_btl_uct_module_t *btl; - /** context this fragment is waiting on */ - int context_id; + /* tl context */ + mca_btl_uct_device_context_t *context; /** is this frag ready to send (only used when pending) */ bool ready; @@ -326,4 +332,12 @@ OBJ_CLASS_DECLARATION(mca_btl_uct_tl_t); #define MCA_BTL_UCT_TL_ATTR(tl, context_id) (tl)->uct_dev_contexts[(context_id)]->uct_iface_attr +struct mca_btl_uct_pending_connection_request_t { + opal_list_item_t super; + uint8_t request_data[]; +}; + +typedef struct mca_btl_uct_pending_connection_request_t mca_btl_uct_pending_connection_request_t; +OBJ_CLASS_DECLARATION(mca_btl_uct_pending_connection_request_t); + #endif /* !defined(BTL_UCT_TYPES_H) */ From c65dda6f5f00d8702ef8ed845f3ce8bccba30ef8 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 11 Oct 2018 14:07:45 -0500 Subject: [PATCH 151/674] io/ompio: fix seek position calculation for SEEK_CUR This commit fixes the calculation of the position where to seek to, in case SEEK_CUR is used. Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_file_open.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index 37f7b308b72..cf9b545fa53 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -400,8 +400,9 @@ int mca_io_ompio_file_seek (ompi_file_t *fh, } break; case MPI_SEEK_CUR: - offset += data->ompio_fh.f_position_in_file_view; - offset += data->ompio_fh.f_disp; + ret = mca_common_ompio_file_get_position (&data->ompio_fh, + &temp_offset); + offset += temp_offset; if (offset < 0) { OPAL_THREAD_UNLOCK(&fh->f_lock); return OMPI_ERROR; From 425a71799e0f36dd04cb3e4056e55d87e9373747 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 11 Oct 2018 14:41:58 -0500 Subject: [PATCH 152/674] common/ompio: return correct error code for improper access return MPI_ERR_ACCESS if the user tries to read from a file that was opened using MPI_MODE_WRONLY return MPI_ERR_READ_ONLY if the user tries to write a file that was opened using MPI_MODE_RDONLY Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio_file_read.c | 17 ++++++++++++----- ompi/mca/common/ompio/common_ompio_file_write.c | 13 +++++++++++++ 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c index 6d6d112eb30..3203e2a697f 100644 --- a/ompi/mca/common/ompio/common_ompio_file_read.c +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -77,6 +77,12 @@ int mca_common_ompio_file_read (ompio_file_t *fh, int i = 0; /* index into the decoded iovec of the buffer */ int j = 0; /* index into the file vie iovec */ + if (fh->f_amode & MPI_MODE_WRONLY){ +// opal_output(10, "Improper use of FILE Mode, Using WRONLY for Read!\n"); + ret = MPI_ERR_ACCESS; + return ret; + } + if ( 0 == count ) { if ( MPI_STATUS_IGNORE != status ) { status->_ucount = 0; @@ -84,11 +90,6 @@ int mca_common_ompio_file_read (ompio_file_t *fh, return ret; } - if (fh->f_amode & MPI_MODE_WRONLY){ - printf("Improper use of FILE Mode, Using WRONLY for Read!\n"); - ret = OMPI_ERROR; - return ret; - } #if OPAL_CUDA_SUPPORT int is_gpu, is_managed; @@ -226,6 +227,12 @@ int mca_common_ompio_file_iread (ompio_file_t *fh, mca_ompio_request_t *ompio_req=NULL; size_t spc=0; + if (fh->f_amode & MPI_MODE_WRONLY){ +// opal_output(10, "Improper use of FILE Mode, Using WRONLY for Read!\n"); + ret = MPI_ERR_ACCESS; + return ret; + } + mca_common_ompio_request_alloc ( &ompio_req, MCA_OMPIO_REQUEST_READ); if ( 0 == count ) { diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index fb62edf2d91..e53a1d080b0 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -58,6 +58,13 @@ int mca_common_ompio_file_write (ompio_file_t *fh, int i = 0; /* index into the decoded iovec of the buffer */ int j = 0; /* index into the file view iovec */ + if (fh->f_amode & MPI_MODE_RDONLY){ +// opal_output(10, "Improper use of FILE Mode, Using RDONLY for write!\n"); + ret = MPI_ERR_READ_ONLY; + return ret; + } + + if ( 0 == count ) { if ( MPI_STATUS_IGNORE != status ) { status->_ucount = 0; @@ -194,6 +201,12 @@ int mca_common_ompio_file_iwrite (ompio_file_t *fh, mca_ompio_request_t *ompio_req=NULL; size_t spc=0; + if (fh->f_amode & MPI_MODE_RDONLY){ +// opal_output(10, "Improper use of FILE Mode, Using RDONLY for write!\n"); + ret = MPI_ERR_READ_ONLY; + return ret; + } + mca_common_ompio_request_alloc ( &ompio_req, MCA_OMPIO_REQUEST_WRITE); if ( 0 == count ) { From 96c1a5b9dcdc4bcf206fa694434116afe508ac18 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 11 Oct 2018 14:43:32 -0500 Subject: [PATCH 153/674] common/ompio: check datatypes when setting file view return MPI_ERR_ARG if the size of the fileview is not a multiple of the size of the etype provided. Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio_file_view.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index 71ba14ba02a..bf8a25345b8 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -141,6 +141,10 @@ int mca_common_ompio_set_view (ompio_file_t *fh, // in orig_file type, No need to set args on this one. ompi_datatype_duplicate (newfiletype, &fh->f_filetype); + if ( (fh->f_view_size % fh->f_etype_size) ) { + // File view is not a multiple of the etype. + return MPI_ERR_ARG; + } if( SIMPLE_PLUS == OMPIO_MCA_GET(fh, grouping_option) ) { fh->f_cc_size = get_contiguous_chunk_size (fh, 1); From a07c9e96b130a224d33f831c7a2647b4c11ab4e3 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 11 Oct 2018 17:39:05 -0500 Subject: [PATCH 154/674] io/ompio: execute barrier before sync this ensures that all processes are done modifying a file before syncing. Fixes an error in the testmpio testsuite. Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_file_open.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index cf9b545fa53..37bc8fea572 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -372,6 +372,13 @@ int mca_io_ompio_file_sync (ompi_file_t *fh) OPAL_THREAD_UNLOCK(&fh->f_lock); return MPI_ERR_ACCESS; } + // Make sure all processes reach this point before syncing the file. + ret = data->ompio_fh.f_comm->c_coll->coll_barrier (data->ompio_fh.f_comm, + data->ompio_fh.f_comm->c_coll->coll_barrier_module); + if ( MPI_SUCCESS != ret ) { + OPAL_THREAD_UNLOCK(&fh->f_lock); + return ret; + } ret = data->ompio_fh.f_fs->fs_file_sync (&data->ompio_fh); OPAL_THREAD_UNLOCK(&fh->f_lock); From 278ecf2205476e224eeb4d336657005105dbeefd Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 16 Oct 2018 12:45:33 -0500 Subject: [PATCH 155/674] io/ompio: add verification for data representations. check for providing a data representation that is actually supported by ompio. Add also one check for a non-NULL pointer in mpi/c/file_set_view for the data representation. Also fixes parts of issue #5643 Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_file_set_view.c | 8 ++++++-- ompi/mpi/c/file_set_view.c | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_set_view.c b/ompi/mca/io/ompio/io_ompio_file_set_view.c index ba18db8fe14..72671c3410a 100644 --- a/ompi/mca/io/ompio/io_ompio_file_set_view.c +++ b/ompi/mca/io/ompio/io_ompio_file_set_view.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2008-2018 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -66,13 +66,17 @@ int mca_io_ompio_file_set_view (ompi_file_t *fp, mca_common_ompio_data_t *data; ompio_file_t *fh; + if ( (strcmp(datarep, "native") && strcmp(datarep, "NATIVE"))) { + return MPI_ERR_UNSUPPORTED_DATAREP; + } + data = (mca_common_ompio_data_t *) fp->f_io_selected_data; /* we need to call the internal file set view twice: once for the individual file pointer, once for the shared file pointer (if it is existent) */ fh = &data->ompio_fh; - + OPAL_THREAD_LOCK(&fp->f_lock); ret = mca_common_ompio_set_view(fh, disp, etype, filetype, datarep, info); OPAL_THREAD_UNLOCK(&fp->f_lock); diff --git a/ompi/mpi/c/file_set_view.c b/ompi/mpi/c/file_set_view.c index a49a80f29aa..c62df489aa6 100644 --- a/ompi/mpi/c/file_set_view.c +++ b/ompi/mpi/c/file_set_view.c @@ -64,6 +64,10 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype, OMPI_CHECK_DATATYPE_FOR_VIEW(rc, filetype, 0); } } + if ( NULL == datarep) { + rc = MPI_ERR_UNSUPPORTED_DATAREP; + fh = MPI_FILE_NULL; + } OMPI_ERRHANDLER_CHECK(rc, fh, rc, FUNC_NAME); } From a806d09450f5aa81f2ba4f8626e4fe9de7c9198b Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 17 Oct 2018 06:50:11 -0600 Subject: [PATCH 156/674] remove the bfo pml Signed-off-by: Howard Pritchard (cherry picked from commit 7d6774acf89558c05f415c96c00502429e26e502) --- ompi/mca/pml/bfo/.opal_ignore | 0 ompi/mca/pml/bfo/Makefile.am | 78 - ompi/mca/pml/bfo/README | 340 ---- ompi/mca/pml/bfo/configure.m4 | 27 - ompi/mca/pml/bfo/help-mpi-pml-bfo.txt | 20 - ompi/mca/pml/bfo/owner.txt | 7 - ompi/mca/pml/bfo/pml_bfo.c | 897 ---------- ompi/mca/pml/bfo/pml_bfo.h | 362 ---- ompi/mca/pml/bfo/pml_bfo_comm.c | 100 -- ompi/mca/pml/bfo/pml_bfo_comm.h | 81 - ompi/mca/pml/bfo/pml_bfo_component.c | 274 ---- ompi/mca/pml/bfo/pml_bfo_component.h | 33 - ompi/mca/pml/bfo/pml_bfo_cuda.c | 157 -- ompi/mca/pml/bfo/pml_bfo_failover.c | 2187 ------------------------- ompi/mca/pml/bfo/pml_bfo_failover.h | 398 ----- ompi/mca/pml/bfo/pml_bfo_hdr.h | 539 ------ ompi/mca/pml/bfo/pml_bfo_iprobe.c | 171 -- ompi/mca/pml/bfo/pml_bfo_irecv.c | 308 ---- ompi/mca/pml/bfo/pml_bfo_isend.c | 129 -- ompi/mca/pml/bfo/pml_bfo_progress.c | 78 - ompi/mca/pml/bfo/pml_bfo_rdma.c | 118 -- ompi/mca/pml/bfo/pml_bfo_rdma.h | 42 - ompi/mca/pml/bfo/pml_bfo_rdmafrag.c | 30 - ompi/mca/pml/bfo/pml_bfo_rdmafrag.h | 75 - ompi/mca/pml/bfo/pml_bfo_recvfrag.c | 743 --------- ompi/mca/pml/bfo/pml_bfo_recvfrag.h | 172 -- ompi/mca/pml/bfo/pml_bfo_recvreq.c | 1165 ------------- ompi/mca/pml/bfo/pml_bfo_recvreq.h | 449 ----- ompi/mca/pml/bfo/pml_bfo_sendreq.c | 1401 ---------------- ompi/mca/pml/bfo/pml_bfo_sendreq.h | 499 ------ ompi/mca/pml/bfo/pml_bfo_start.c | 148 -- ompi/mca/pml/bfo/post_configure.sh | 1 - 32 files changed, 11029 deletions(-) delete mode 100644 ompi/mca/pml/bfo/.opal_ignore delete mode 100644 ompi/mca/pml/bfo/Makefile.am delete mode 100644 ompi/mca/pml/bfo/README delete mode 100644 ompi/mca/pml/bfo/configure.m4 delete mode 100644 ompi/mca/pml/bfo/help-mpi-pml-bfo.txt delete mode 100644 ompi/mca/pml/bfo/owner.txt delete mode 100644 ompi/mca/pml/bfo/pml_bfo.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_comm.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_comm.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_component.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_component.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_cuda.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_failover.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_failover.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_hdr.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_iprobe.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_irecv.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_isend.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_progress.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_rdma.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_rdma.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_rdmafrag.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_rdmafrag.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_recvfrag.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_recvfrag.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_recvreq.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_recvreq.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_sendreq.c delete mode 100644 ompi/mca/pml/bfo/pml_bfo_sendreq.h delete mode 100644 ompi/mca/pml/bfo/pml_bfo_start.c delete mode 100644 ompi/mca/pml/bfo/post_configure.sh diff --git a/ompi/mca/pml/bfo/.opal_ignore b/ompi/mca/pml/bfo/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/ompi/mca/pml/bfo/Makefile.am b/ompi/mca/pml/bfo/Makefile.am deleted file mode 100644 index 7565d84c13e..00000000000 --- a/ompi/mca/pml/bfo/Makefile.am +++ /dev/null @@ -1,78 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = -DPML_BFO=1 - -dist_ompidata_DATA = \ - help-mpi-pml-bfo.txt - -EXTRA_DIST = post_configure.sh - -bfo_sources = \ - pml_bfo.c \ - pml_bfo.h \ - pml_bfo_comm.c \ - pml_bfo_comm.h \ - pml_bfo_component.c \ - pml_bfo_component.h \ - pml_bfo_failover.c \ - pml_bfo_failover.h \ - pml_bfo_hdr.h \ - pml_bfo_iprobe.c \ - pml_bfo_irecv.c \ - pml_bfo_isend.c \ - pml_bfo_progress.c \ - pml_bfo_rdma.c \ - pml_bfo_rdma.h \ - pml_bfo_rdmafrag.c \ - pml_bfo_rdmafrag.h \ - pml_bfo_recvfrag.c \ - pml_bfo_recvfrag.h \ - pml_bfo_recvreq.c \ - pml_bfo_recvreq.h \ - pml_bfo_sendreq.c \ - pml_bfo_sendreq.h \ - pml_bfo_start.c - -# If we have CUDA support requested, build the CUDA file also -if OPAL_cuda_support -bfo_sources += \ - pml_bfo_cuda.c -endif - -if MCA_BUILD_ompi_pml_bfo_DSO -component_noinst = -component_install = mca_pml_bfo.la -else -component_noinst = libmca_pml_bfo.la -component_install = -endif - -mcacomponentdir = $(ompilibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_pml_bfo_la_SOURCES = $(bfo_sources) -mca_pml_bfo_la_LDFLAGS = -module -avoid-version -mca_pml_bfo_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_pml_bfo_la_SOURCES = $(bfo_sources) -libmca_pml_bfo_la_LDFLAGS = -module -avoid-version diff --git a/ompi/mca/pml/bfo/README b/ompi/mca/pml/bfo/README deleted file mode 100644 index 88c3b1a70f1..00000000000 --- a/ompi/mca/pml/bfo/README +++ /dev/null @@ -1,340 +0,0 @@ -Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - -BFO DESIGN DOCUMENT -This document describes the use and design of the bfo. In addition, -there is a section at the end explaining why this functionality was -not merged into the ob1 PML. - -1. GENERAL USAGE -First, one has to configure the failover code into the openib BTL so -that bfo will work correctly. To do this: -configure --enable-btl-openib-failover. - -Then, when running one needs to select the bfo PML explicitly. -mpirun --mca pml bfo - -Note that one needs to both configure with --enable-btl-openib-failover -and run with --mca pml bfo to get the failover support. If one of -these two steps is skipped, then the MPI job will just abort in the -case of an error like it normally does with the ob1 PML. - -2. GENERAL FUNCTION -The bfo failover feature requires two or more openib BTLs in use. In -normal operation, it will stripe the communication over the multiple -BTLs. When an error is detected, it will stop using the BTL that -incurred the error and continue the communication over the remaining -BTL. Once a BTL has been mapped out, it cannot be used by the job -again, even if the underlying fabric becomes functional again. Only -new jobs started after the fabric comes back up will use both BTLs. - -The bfo works in conjunction with changes that were made in the openib -BTL. As noted above, those changes need to be configured into the -BTL for everything to work properly. - -The bfo only fails over between openib BTLs. It cannot failover from -an openib BTL to TCP, for example. - -3. GENERAL DESIGN -The bfo (Btl FailOver) PML was designed to work in clusters that have -multiple openib BTLs. It was designed to be lightweight so as to -avoid any adverse effects on latency. To that end, there is no -tracking of fragments or messages in the bfo PML. Rather, it depends -on the underlying BTL to notify it of each fragment that has an error. -The bfo then decides what needs to be done based on the type of -fragment that gets an error. - -No additional sequence numbers were introduced in the bfo. Instead, -it makes use of the sequence numbers that exist in the MATCH, RNDV and -RGET fragment header. In that way, duplicate fragments that have -MATCH information in them can be detected. Other fragments, like PUT -and ACK, are never retransmitted so it does not matter that they do -not have sequence numbers. The FIN header was a special case in that -it was changed to include the MATCH header so that the tag, source, -and context fields could be used to check for duplicate FINs. - -Note that the assumption is that the underlying BTL will always issue -a callback with an error flag when it thinks a fragment has an error. -This means that even after an error is detected on a BTL, the BTL -continues to be checked for any other messages that may also complete -with an error. This is potentially a unique characteristic of the -openib BTL when running over RC connections that allows the BFO to -work properly. - -One scenario that is particularly difficult to handle is the case -where a fragment has an error but the message actually makes it to the -other side. It is because of this that all fragments need to be -checked to make sure they are not a duplicate. This scenario also -complicates some of the rendezvous protocols as the two sides may not -agree where the problem occurred. For example, one can imagine a -sender getting an error on a final FIN message, but the FIN message -actually arrives at the other side. The receiver thinks the -communication is done and moves on. The sender thinks there was a -problem, and that the communication needs to restart. - -It is also important to note that a message cannot signal a successful -completion and *not* make it to the receiver. This would probably cause -the bfo to hang. - -4. ERRORS -Errors are detected in the openib BTL layer and propagated to the PML -layer. Typically, the errors occur while polling the completion -queue, but can happen in other areas as well. When an error occurs, -an additional callback is called so the PML can map out the connection -for future sending. Then the callback associated with the fragment is -called, but with the error field set to OMPI_ERROR. This way, the PML -knows that this fragment may not have made it to the remote side. - -The first callback into the PML is via the mca_pml_bfo_error_handler() -callback and the PML uses this to remove a connection for future -sending. If the error_proc_t field is NULL, then the entire BTL is -removed for any future communication. If the error_proc_t is not -NULL, then the BTL is only removed for the connection associated with -the error_proc_t. - -The second callback is the standard one for a completion event, and -this can trigger various activities in the PML. The regular callback -function is called but the status is set to OMPI_ERROR. The PML layer -detects this and calls some failover specific routines depending on -the type of fragment that got the error. - - -5. RECOVERY OF MATCH FRAGMENTS -Note: For a general description of how the various fragments interact, -see Appendix 1 at the end of this document. - -In the case of a MATCH fragment, the fragment is simply resent. Care -has to be taken with a MATCH fragment that is sent via the standard -interface and one that is sent via the sendi interface. In the -standard send, the send request is still available and is therefore -reset reused to send the MATCH fragment. In the case of the sendi -fragment, the send request is gone, so the fragment is regenerated -from the information contained within the fragment. - -6. RECOVERY OF RNDV or LARGE MESSAGE RDMA -In the case of a large message RDMA transfer or a RNDV transfer where -the message consists of several fragments, the restart is a little -more complicated. This includes fragments like RNDV, PUT, RGET, FRAG, -FIN, and RDMA write and RDMA read completions. In most cases, the -requests associated with these fragments are reset and restarted. - -First, it should be pointed out that a new variable was added to the -send and receive requests. This variable tracks outstanding send -events that have not yet received their completion events. This new -variable is used so that a request is not restarted until all the -outstanding events have completed. If one does not wait for the -outstanding events to complete, then one may restart a request and -then a completion event will happen on the wrong request. - -There is a second variable added to each request and that is one that -shows whether the request is already in an error state. When a request -reaches the state that it has an error flagged on it and the outstanding -completion events are down to zero, it can start the restart dance -as described below. - -7. SPECIAL CASE FOR FIN FRAGMENT -Like the MATCH fragment, the FIN message is also simply resent. Like -the sendi MATCH fragment, there may be no request associated with the -FIN message when it gets an error, so the fragment is recreated from -the information in the fragment. The FIN fragment was modified to -have additional information like what is in a MATCH fragment including -the context, source, and tag. In this way, we can figure out if the -FIN message is a duplicate on the receiving side. - -8. RESTART DANCE -When the bfo determines that there are no outstanding completion events, -a restart dance is initiated. There are four new PML message types that -have been created to participate in the dance. - 1. RNDVRESTARTNOTIFY - 2. RECVERRNOTIFY - 3. RNDVRESTARTACK - 4. RNDVRESTARTNACK - -When the send request is in an error state and the outstanding -completion events is zero, RNDVRESTARTNOTIFY is sent from the sender -to the receiver to let it know that the communication needs to be -restarted. Upon receipt of the RNDVRESTARTNOTIFY, the receiver first -checks to make sure that it is still pointing to a valid receiver -request. If so, it marks the receive request in error. It then -checks to see if there are any outstanding completion events on the -receiver. If there are no outstanding completion events, the receiver -sends the RNDVRESTARTACK. If there are outstanding completion events, -then the RNDVRESTARTACK gets sent later when a completion event occurs -that brings the outstanding event count to zero. - -In the case that the receiver determines that it is no longer looking -at a valid receive request, which means the request is complete, the -receiver responds with a RNDVRESTARTNACK. While rare, this case can -happen for example, when a final FRAG message triggers an error on the -sender, but actually makes it to the receiver. - -The RECVERRNOTIFY fragment is used so the receiver can let the sender -sender know that it had an error. The sender then waits for all of -its completion events, and then sends a RNDVRESTARTNOTIFY. - -All the handling of these new messages is contained in the -pml_bfo_failover files. - -9. BTL SUPPORT -The openib BTL also supplies a lot of support for the bfo PML. First, -fragments can be stored in the BTL during normal operation if -resources become scarce. This means that when an error is detected in -the BTL, it needs to scour its internal queues for fragments that are -destined for the BTL and error them out. The function -error_out_all_pending_frags() takes care of this functionality. And -some of the fragments stored can be coalesced, so care has to be taken -to tease out each message from a coalesced fragment. - -There is also some special code in the BTL to handle some strange -occurrences that were observed in the BTL. First, there are times -where only one half of the connection gets an error. This can result -in a mismatch between what the PML thinks is available to it and can -cause hangs. Therefore, when a BTL detects an error, it sends a -special message down the working BTL connection to tell the remote -side that it needs to be brought down as well. - -Secondly, it has been observed that a message can get stuck in the -eager RDMA connection between two BTLs. In this case, an error is -detected on one side, but the other side never sees the message. -Therefore, a special message is sent to the other side telling it to -move along in the eager RDMA connection. This is all somewhat -confusing. See the code in the btl_openib_failover.c file for the -details. - -10. MERGING -Every effort was made to try and merge the bfo PML into the ob1 PML. -The idea was that any upgrades to the ob1 PML would automatically make -it into the bfo PML and this would enhance maintainability of all the -code. However, it was deemed that this merging would cause more -problems than it would solve. What was attempted and why the -conclusion was made are documented here. - -One can look at the bfo and easily see the differences between it and -ob1. All the bfo specific code is surrounded by #if PML_BFO. In -addition, there are two additional files in the bfo, -pml_bfo_failover.c and pml_bfo_failover.h. - -To merge them, the following was attempted. First, add all the code -in #if regions into the ob1 PML. As of this writing, there are 73 -#ifs that would have to be added into ob1. - -Secondly, remove almost all the pml_bfo files and replace them with -links to the ob1 files. - -Third, create a new header file that did name shifting of all the -functions so that ob1 and bfo could live together. This also included -having to create macros for the names of header files as well. To -help illustrate the name shifting issue, here is what the file might -look like in the bfo directory. - -/* Need macros for the header files as they are different in the - * different PMLs */ -#define PML "bfo" -#define PML_OB1_H "pml_bfo.h" -#define PML_OB1_COMM_H "pml_bfo_comm.h" -#define PML_OB1_COMPONENT_H "pml_bfo_component.h" -#define PML_OB1_HDR_H "pml_bfo_hdr.h" -#define PML_OB1_RDMA_H "pml_bfo_rdma.h" -#define PML_OB1_RDMAFRAG_H "pml_bfo_rdmafrag.h" -#define PML_OB1_RECVFRAG_H "pml_bfo_recvfrag.h" -#define PML_OB1_RECVREQ_H "pml_bfo_recvreq.h" -#define PML_OB1_SENDREQ_H "pml_bfo_sendreq.h" - -/* Name shifting of functions from ob1 to bfo (incomplete list) */ -#define mca_pml_ob1 mca_pml_bfo -#define mca_pml_ob1_t mca_pml_bfo_t -#define mca_pml_ob1_component mca_pml_bfo_component -#define mca_pml_ob1_add_procs mca_pml_bfo_add_procs -#define mca_pml_ob1_del_procs mca_pml_bfo_del_procs -#define mca_pml_ob1_enable mca_pml_bfo_enable -#define mca_pml_ob1_progress mca_pml_bfo_progress -#define mca_pml_ob1_add_comm mca_pml_bfo_add_comm -#define mca_pml_ob1_del_comm mca_pml_bfo_del_comm -#define mca_pml_ob1_irecv_init mca_pml_bfo_irecv_init -#define mca_pml_ob1_irecv mca_pml_bfo_irecv -#define mca_pml_ob1_recv mca_pml_bfo_recv -#define mca_pml_ob1_isend_init mca_pml_bfo_isend_init -#define mca_pml_ob1_isend mca_pml_bfo_isend -#define mca_pml_ob1_send mca_pml_bfo_send -#define mca_pml_ob1_iprobe mca_pml_bfo_iprobe -[...and much more ...] - -The pml_bfo_hdr.h file was not a link because the changes in it were -so extensive. Also the Makefile was kept separate so it could include -the additional failover files as well as add a compile directive that -would force the files to be compiled as bfo instead of ob1. - -After these changes were made, several independent developers reviewed -the results and concluded that making these changes would have too -much of a negative impact on ob1 maintenance. First, the code became -much harder to read with all the additional #ifdefs. Secondly, the -possibility of adding other features, like csum, to ob1 would only -make this issue even worse. Therefore, it was decided to keep the bfo -PML separate from ob1. - -11. UTILITIES -In an ideal world, any bug fixes that are made in the ob1 PML would -also be made in the csum and the bfo PMLs. However, that does not -always happen. Therefore, there are two new utilities added to the -contrib directory. - -check-ob1-revision.pl -check-ob1-pml-diffs.pl - -The first one can be run to see if ob1 has changed from its last known -state. Here is an example. - - machine =>check-ob1-revision.pl -Running svn diff -r24138 ../ompi/mca/pml/ob1 -No new changes detected in ob1. Everything is fine. - -If there are differences, then one needs to review them and potentially -add them to the bfo (and csum also if one feels like it). -After that, bump up the value in the script to the latest value. - -The second script allows one to see the differences between the ob1 -and bfo PML. Here is an example. - - machine =>check-ob1-pml-diffs.pl - -Starting script to check differences between bfo and ob1... -Files Compared: pml_ob1.c and pml_bfo.c -No differences encountered -Files Compared: pml_ob1.h and pml_bfo.h -[...snip...] -Files Compared: pml_ob1_start.c and pml_bfo_start.c -No differences encountered - -There is a lot more in the script that tells how it is used. - - -Appendix 1: SIMPLE OVERVIEW OF COMMUNICATION PROTOCOLS -The drawings below attempt to describe some of the general flow of -fragments in the various protocols that are supported in the PMLs. -The "read" and "write" are actual RDMA actions and do not pertain to -fragments that are sent. As can be inferred, they use FIN messages to -indicate their completion. - - -MATCH PROTOCOL -sender >->->-> MATCH >->->-> receiver - -SEND WITH MULTIPLE FRAGMENTS -sender >->->-> RNDV >->->-> receiver - <-<-<-< ACK <-<-<-< - >->->-> FRAG >->->-> - >->->-> FRAG >->->-> - >->->-> FRAG >->->-> - -RDMA PUT -sender >->->-> RNDV >->->-> receiver - <-<-<-< PUT <-<-<-< - <-<-<-< PUT <-<-<-< - >->->-> write >->->-> - >->->-> FIN >->->-> - >->->-> write >->->-> - >->->-> FIN >->->-> - -RMA GET -sender >->->-> RGET >->->-> receiver - <-<-<-< read <-<-<-< - <-<-<-< FIN <-<-<-< diff --git a/ompi/mca/pml/bfo/configure.m4 b/ompi/mca/pml/bfo/configure.m4 deleted file mode 100644 index 4001c94d650..00000000000 --- a/ompi/mca/pml/bfo/configure.m4 +++ /dev/null @@ -1,27 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2013 Sandia National Laboratories. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_ompi_pml_bfo_POST_CONFIG(will_build) -# ---------------------------------------- -# The BFO PML requires a BML endpoint tag to compile, so require it. -# Require in POST_CONFIG instead of CONFIG so that we only require it -# if we're not disabled. -AC_DEFUN([MCA_ompi_pml_bfo_POST_CONFIG], [ - AS_IF([test "$1" = "1"], [OMPI_REQUIRE_ENDPOINT_TAG([BML])]) -])dnl - -# MCA_ompi_pml_bfo_CONFIG(action-if-can-compile, -# [action-if-cant-compile]) -# ------------------------------------------------ -# We can always build, unless we were explicitly disabled. -AC_DEFUN([MCA_ompi_pml_bfo_CONFIG],[ - AC_CONFIG_FILES([ompi/mca/pml/bfo/Makefile]) - [$1] -])dnl diff --git a/ompi/mca/pml/bfo/help-mpi-pml-bfo.txt b/ompi/mca/pml/bfo/help-mpi-pml-bfo.txt deleted file mode 100644 index 4bbff8ff6d7..00000000000 --- a/ompi/mca/pml/bfo/help-mpi-pml-bfo.txt +++ /dev/null @@ -1,20 +0,0 @@ -# -*- text -*- -# -# Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -[eager_limit_too_small] -The "eager limit" MCA parameter in the %s BTL was set to a value which -is too low for Open MPI to function properly. Please re-run your job -with a higher eager limit value for this BTL; the exact MCA parameter -name and its corresponding minimum value is shown below. - - Local host: %s - BTL name: %s - BTL eager limit value: %d (set via btl_%s_eager_limit) - BTL eager limit minimum: %d - MCA parameter name: btl_%s_eager_limit diff --git a/ompi/mca/pml/bfo/owner.txt b/ompi/mca/pml/bfo/owner.txt deleted file mode 100644 index f1dfe8edb40..00000000000 --- a/ompi/mca/pml/bfo/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: NVIDIA -status: unmaintained diff --git a/ompi/mca/pml/bfo/pml_bfo.c b/ompi/mca/pml/bfo/pml_bfo.c deleted file mode 100644 index ce33b0d57be..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo.c +++ /dev/null @@ -1,897 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; -*- */ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2009 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2006-2008 University of Houston. All rights reserved. - * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include -#include - -#include "opal/class/opal_bitmap.h" -#include "opal/util/output.h" -#include "opal/util/show_help.h" -#include "opal/mca/btl/btl.h" -#include "opal/mca/btl/base/base.h" -#include "opal/mca/pmix/pmix.h" - -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/pml/base/base.h" -#include "ompi/mca/pml/base/base.h" -#include "ompi/mca/bml/base/base.h" -#include "ompi/runtime/ompi_cr.h" - -#include "pml_bfo.h" -#include "pml_bfo_component.h" -#include "pml_bfo_comm.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_recvfrag.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_rdmafrag.h" -#if PML_BFO -#include "pml_bfo_failover.h" -#endif /* PML_BFO */ - -mca_pml_bfo_t mca_pml_bfo = { - { - mca_pml_bfo_add_procs, - mca_pml_bfo_del_procs, - mca_pml_bfo_enable, - mca_pml_bfo_progress, - mca_pml_bfo_add_comm, - mca_pml_bfo_del_comm, - mca_pml_bfo_irecv_init, - mca_pml_bfo_irecv, - mca_pml_bfo_recv, - mca_pml_bfo_isend_init, - mca_pml_bfo_isend, - mca_pml_bfo_send, - mca_pml_bfo_iprobe, - mca_pml_bfo_probe, - mca_pml_bfo_start, - mca_pml_bfo_improbe, - mca_pml_bfo_mprobe, - mca_pml_bfo_imrecv, - mca_pml_bfo_mrecv, - mca_pml_bfo_dump, - mca_pml_bfo_ft_event, - 65535, - INT_MAX - } -}; - - -void mca_pml_bfo_error_handler( struct mca_btl_base_module_t* btl, - int32_t flags, ompi_proc_t* errproc, - char* btlinfo ); - -int mca_pml_bfo_enable(bool enable) -{ - if( false == enable ) { - return OMPI_SUCCESS; - } - - OBJ_CONSTRUCT(&mca_pml_bfo.lock, opal_mutex_t); - - /* fragments */ - OBJ_CONSTRUCT(&mca_pml_bfo.rdma_frags, opal_free_list_t); - opal_free_list_init( &mca_pml_bfo.rdma_frags, - sizeof(mca_pml_bfo_rdma_frag_t), - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_rdma_frag_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - OBJ_CONSTRUCT(&mca_pml_bfo.recv_frags, opal_free_list_t); - opal_free_list_init( &mca_pml_bfo.recv_frags, - sizeof(mca_pml_bfo_recv_frag_t) + mca_pml_bfo.unexpected_limit, - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_recv_frag_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - OBJ_CONSTRUCT(&mca_pml_bfo.pending_pckts, opal_free_list_t); - opal_free_list_init( &mca_pml_bfo.pending_pckts, - sizeof(mca_pml_bfo_pckt_pending_t), - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_pckt_pending_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - OBJ_CONSTRUCT(&mca_pml_bfo.buffers, opal_free_list_t); - OBJ_CONSTRUCT(&mca_pml_bfo.send_ranges, opal_free_list_t); - opal_free_list_init( &mca_pml_bfo.send_ranges, - sizeof(mca_pml_bfo_send_range_t) + - (mca_pml_bfo.max_send_per_range - 1) * sizeof(mca_pml_bfo_com_btl_t), - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_send_range_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - /* pending operations */ - OBJ_CONSTRUCT(&mca_pml_bfo.send_pending, opal_list_t); - OBJ_CONSTRUCT(&mca_pml_bfo.recv_pending, opal_list_t); - OBJ_CONSTRUCT(&mca_pml_bfo.pckt_pending, opal_list_t); - OBJ_CONSTRUCT(&mca_pml_bfo.rdma_pending, opal_list_t); - /* missing communicator pending list */ - OBJ_CONSTRUCT(&mca_pml_bfo.non_existing_communicator_pending, opal_list_t); - - /** - * If we get here this is the PML who get selected for the run. We - * should get ownership for the send and receive requests list, and - * initialize them with the size of our own requests. - */ - opal_free_list_init( &mca_pml_base_send_requests, - sizeof(mca_pml_bfo_send_request_t) + - (mca_pml_bfo.max_rdma_per_request - 1) * - sizeof(mca_pml_bfo_com_btl_t), - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_send_request_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - opal_free_list_init( &mca_pml_base_recv_requests, - sizeof(mca_pml_bfo_recv_request_t) + - (mca_pml_bfo.max_rdma_per_request - 1) * - sizeof(mca_pml_bfo_com_btl_t), - opal_cache_line_size, - OBJ_CLASS(mca_pml_bfo_recv_request_t), - 0,opal_cache_line_size, - mca_pml_bfo.free_list_num, - mca_pml_bfo.free_list_max, - mca_pml_bfo.free_list_inc, - NULL, 0, NULL, NULL, NULL ); - - mca_pml_bfo.enabled = true; - return OMPI_SUCCESS; -} - -int mca_pml_bfo_add_comm(ompi_communicator_t* comm) -{ - /* allocate pml specific comm data */ - mca_pml_bfo_comm_t* pml_comm = OBJ_NEW(mca_pml_bfo_comm_t); - opal_list_item_t *item, *next_item; - mca_pml_bfo_recv_frag_t* frag; - mca_pml_bfo_comm_proc_t* pml_proc; - mca_pml_bfo_match_hdr_t* hdr; - int i; - - if (NULL == pml_comm) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - /* should never happen, but it was, so check */ - if (comm->c_contextid > mca_pml_bfo.super.pml_max_contextid) { - OBJ_RELEASE(pml_comm); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - mca_pml_bfo_comm_init_size(pml_comm, comm->c_remote_group->grp_proc_count); - comm->c_pml_comm = pml_comm; - - for( i = 0; i < comm->c_remote_group->grp_proc_count; i++ ) { - pml_comm->procs[i].ompi_proc = ompi_group_peer_lookup(comm->c_remote_group,i); - OBJ_RETAIN(pml_comm->procs[i].ompi_proc); - } - /* Grab all related messages from the non_existing_communicator pending queue */ - for( item = opal_list_get_first(&mca_pml_bfo.non_existing_communicator_pending); - item != opal_list_get_end(&mca_pml_bfo.non_existing_communicator_pending); - item = next_item ) { - frag = (mca_pml_bfo_recv_frag_t*)item; - next_item = opal_list_get_next(item); - hdr = &frag->hdr.hdr_match; - - /* Is this fragment for the current communicator ? */ - if( frag->hdr.hdr_match.hdr_ctx != comm->c_contextid ) - continue; - - /* As we now know we work on a fragment for this communicator - * we should remove it from the - * non_existing_communicator_pending list. */ - opal_list_remove_item( &mca_pml_bfo.non_existing_communicator_pending, - item ); - - add_fragment_to_unexpected: - - /* We generate the MSG_ARRIVED event as soon as the PML is aware - * of a matching fragment arrival. Independing if it is received - * on the correct order or not. This will allow the tools to - * figure out if the messages are not received in the correct - * order (if multiple network interfaces). - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - /* There is no matching to be done, and no lock to be held on the communicator as - * we know at this point that the communicator has not yet been returned to the user. - * The only required protection is around the non_existing_communicator_pending queue. - * We just have to push the fragment into the unexpected list of the corresponding - * proc, or into the out-of-order (cant_match) list. - */ - pml_proc = &(pml_comm->procs[hdr->hdr_src]); - - if( ((uint16_t)hdr->hdr_seq) == ((uint16_t)pml_proc->expected_sequence) ) { - /* We're now expecting the next sequence number. */ - pml_proc->expected_sequence++; - opal_list_append( &pml_proc->unexpected_frags, (opal_list_item_t*)frag ); - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_INSERT_IN_UNEX_Q, comm, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - /* And now the ugly part. As some fragments can be inserted in the cant_match list, - * every time we succesfully add a fragment in the unexpected list we have to make - * sure the next one is not in the cant_match. Otherwise, we will endup in a deadlock - * situation as the cant_match is only checked when a new fragment is received from - * the network. - */ - for(frag = (mca_pml_bfo_recv_frag_t *)opal_list_get_first(&pml_proc->frags_cant_match); - frag != (mca_pml_bfo_recv_frag_t *)opal_list_get_end(&pml_proc->frags_cant_match); - frag = (mca_pml_bfo_recv_frag_t *)opal_list_get_next(frag)) { - hdr = &frag->hdr.hdr_match; - /* If the message has the next expected seq from that proc... */ - if(hdr->hdr_seq != pml_proc->expected_sequence) - continue; - - opal_list_remove_item(&pml_proc->frags_cant_match, (opal_list_item_t*)frag); - goto add_fragment_to_unexpected; - } - } else { - opal_list_append( &pml_proc->frags_cant_match, (opal_list_item_t*)frag ); - } - } - return OMPI_SUCCESS; -} - -int mca_pml_bfo_del_comm(ompi_communicator_t* comm) -{ - mca_pml_bfo_comm_t* pml_comm = comm->c_pml_comm; - int i; - - for( i = 0; i < comm->c_remote_group->grp_proc_count; i++ ) { - OBJ_RELEASE(pml_comm->procs[i].ompi_proc); - } - OBJ_RELEASE(comm->c_pml_comm); - comm->c_pml_comm = NULL; - return OMPI_SUCCESS; -} - - -/* - * For each proc setup a datastructure that indicates the BTLs - * that can be used to reach the destination. - * - */ - -int mca_pml_bfo_add_procs(ompi_proc_t** procs, size_t nprocs) -{ - opal_bitmap_t reachable; - int rc; - opal_list_item_t *item; - - if(nprocs == 0) - return OMPI_SUCCESS; - - OBJ_CONSTRUCT(&reachable, opal_bitmap_t); - rc = opal_bitmap_init(&reachable, (int)nprocs); - if(OMPI_SUCCESS != rc) - return rc; - - /* - * JJH: Disable this in FT enabled builds since - * we use a wrapper PML. It will cause this check to - * return failure as all processes will return the wrapper PML - * component in use instead of the wrapped PML component underneath. - */ -#if OPAL_ENABLE_FT_CR == 0 - /* make sure remote procs are using the same PML as us */ - if (OMPI_SUCCESS != (rc = mca_pml_base_pml_check_selected("bfo", - procs, - nprocs))) { - return rc; - } -#endif - - rc = mca_bml.bml_add_procs( nprocs, - procs, - &reachable ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - /* Check that values supplied by all initialized btls will work - for us. Note that this is the list of all initialized BTLs, - not the ones used for the just added procs. This is a little - overkill and inaccurate, as we may end up not using the BTL in - question and all add_procs calls after the first one are - duplicating an already completed check. But the final - initialization of the PML occurs before the final - initialization of the BTLs, and iterating through the in-use - BTLs requires iterating over the procs, as the BML does not - expose all currently in use btls. */ - - for (item = opal_list_get_first(&mca_btl_base_modules_initialized) ; - item != opal_list_get_end(&mca_btl_base_modules_initialized) ; - item = opal_list_get_next(item)) { - mca_btl_base_selected_module_t *sm = - (mca_btl_base_selected_module_t*) item; - if (sm->btl_module->btl_eager_limit < sizeof(mca_pml_bfo_hdr_t)) { - opal_show_help("help-mpi-pml-bfo.txt", "eager_limit_too_small", - true, - sm->btl_component->btl_version.mca_component_name, - ompi_process_info.nodename, - sm->btl_component->btl_version.mca_component_name, - sm->btl_module->btl_eager_limit, - sm->btl_component->btl_version.mca_component_name, - sizeof(mca_pml_bfo_hdr_t), - sm->btl_component->btl_version.mca_component_name); - rc = OMPI_ERR_BAD_PARAM; - goto cleanup_and_return; - } - } - - - /* TODO: Move these callback registration to another place */ - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_MATCH, - mca_pml_bfo_recv_frag_callback_match, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RNDV, - mca_pml_bfo_recv_frag_callback_rndv, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RGET, - mca_pml_bfo_recv_frag_callback_rget, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_ACK, - mca_pml_bfo_recv_frag_callback_ack, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_FRAG, - mca_pml_bfo_recv_frag_callback_frag, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_PUT, - mca_pml_bfo_recv_frag_callback_put, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_FIN, - mca_pml_bfo_recv_frag_callback_fin, - NULL ); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - -#if PML_BFO - rc = mca_pml_bfo_register_callbacks(); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; -#endif /* PML_BFO */ - /* register error handlers */ - rc = mca_bml.bml_register_error((mca_btl_base_module_error_cb_fn_t)mca_pml_bfo_error_handler); - if(OMPI_SUCCESS != rc) - goto cleanup_and_return; - - cleanup_and_return: - OBJ_DESTRUCT(&reachable); - - return rc; -} - -/* - * iterate through each proc and notify any PTLs associated - * with the proc that it is/has gone away - */ - -int mca_pml_bfo_del_procs(ompi_proc_t** procs, size_t nprocs) -{ - return mca_bml.bml_del_procs(nprocs, procs); -} - -/* - * diagnostics - */ - -int mca_pml_bfo_dump(struct ompi_communicator_t* comm, int verbose) -{ - struct mca_pml_comm_t* pml_comm = comm->c_pml_comm; - int i; - - /* iterate through all procs on communicator */ - for( i = 0; i < (int)pml_comm->num_procs; i++ ) { - mca_pml_bfo_comm_proc_t* proc = &pml_comm->procs[i]; - mca_bml_base_endpoint_t* ep = (mca_bml_base_endpoint_t*)proc->ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - size_t n; - - opal_output(0, "[Rank %d]\n", i); - /* dump all receive queues */ - - /* dump all btls */ - for(n=0; nbtl_eager.arr_size; n++) { - mca_bml_base_btl_t* bml_btl = &ep->btl_eager.bml_btls[n]; - bml_btl->btl->btl_dump(bml_btl->btl, bml_btl->btl_endpoint, verbose); - } - } - return OMPI_SUCCESS; -} - -static void mca_pml_bfo_fin_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - -#if PML_BFO - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { - mca_pml_bfo_repost_fin(des); - return; - } - MCA_PML_BFO_CHECK_EAGER_BML_BTL_ON_FIN_COMPLETION(bml_btl, btl, des); -#endif /* PML_BFO */ - /* check for pending requests */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/** - * Send an FIN to the peer. If we fail to send this ack (no more available - * fragments or the send failed) this function automatically add the FIN - * to the list of pending FIN, Which guarantee that the FIN will be sent - * later. - */ -int mca_pml_bfo_send_fin( ompi_proc_t* proc, - mca_bml_base_btl_t* bml_btl, - opal_ptr_t hdr_des, - uint8_t order, -#if PML_BFO - uint32_t status, - uint16_t seq, - uint8_t restartseq, - uint16_t ctx, uint32_t src) -#else /* PML_BFO */ - uint32_t status ) -#endif /* PML_BFO */ -{ - mca_btl_base_descriptor_t* fin; - mca_pml_bfo_fin_hdr_t* hdr; - int rc; - - mca_bml_base_alloc(bml_btl, &fin, order, sizeof(mca_pml_bfo_fin_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - - if(NULL == fin) { - MCA_PML_BFO_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status); - return OMPI_ERR_OUT_OF_RESOURCE; - } - fin->des_cbfunc = mca_pml_bfo_fin_completion; - fin->des_cbdata = NULL; - - /* fill in header */ - hdr = (mca_pml_bfo_fin_hdr_t*)fin->des_local->seg_addr.pval; - hdr->hdr_common.hdr_flags = 0; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_FIN; - hdr->hdr_des = hdr_des; - hdr->hdr_fail = status; -#if PML_BFO - fin->des_cbdata = proc; - hdr->hdr_match.hdr_seq = seq; - hdr->hdr_match.hdr_ctx = ctx; - hdr->hdr_match.hdr_src = src; - hdr->hdr_match.hdr_common.hdr_flags = restartseq; /* use unused hdr_flags field */ -#endif /* PML_BFO */ - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_FIN, proc); - - /* queue request */ - rc = mca_bml_base_send( bml_btl, - fin, - MCA_PML_BFO_HDR_TYPE_FIN ); - if( OPAL_LIKELY( rc >= 0 ) ) { - if( OPAL_LIKELY( 1 == rc ) ) { - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); - } - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, fin); - MCA_PML_BFO_ADD_FIN_TO_PENDING(proc, hdr_des, bml_btl, order, status); - return OMPI_ERR_OUT_OF_RESOURCE; -} - -void mca_pml_bfo_process_pending_packets(mca_bml_base_btl_t* bml_btl) -{ - mca_pml_bfo_pckt_pending_t *pckt; - int32_t i, rc, s = (int32_t)opal_list_get_size(&mca_pml_bfo.pckt_pending); - - for(i = 0; i < s; i++) { - mca_bml_base_btl_t *send_dst = NULL; - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - pckt = (mca_pml_bfo_pckt_pending_t*) - opal_list_remove_first(&mca_pml_bfo.pckt_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - if(NULL == pckt) - break; - if(pckt->bml_btl != NULL && - pckt->bml_btl->btl == bml_btl->btl) { - send_dst = pckt->bml_btl; - } else { - mca_bml_base_endpoint_t* endpoint = - (mca_bml_base_endpoint_t*) pckt->proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - send_dst = mca_bml_base_btl_array_find( - &endpoint->btl_eager, bml_btl->btl); - } - if(NULL == send_dst) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.pckt_pending, - (opal_list_item_t*)pckt); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - switch(pckt->hdr.hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_ACK: - rc = mca_pml_bfo_recv_request_ack_send_btl(pckt->proc, - send_dst, - pckt->hdr.hdr_ack.hdr_src_req.lval, - pckt->hdr.hdr_ack.hdr_dst_req.pval, - pckt->hdr.hdr_ack.hdr_send_offset, - pckt->hdr.hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_NORDMA); - if( OPAL_UNLIKELY(OMPI_ERR_OUT_OF_RESOURCE == rc) ) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.pckt_pending, - (opal_list_item_t*)pckt); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - return; - } - break; - case MCA_PML_BFO_HDR_TYPE_FIN: - rc = mca_pml_bfo_send_fin(pckt->proc, send_dst, - pckt->hdr.hdr_fin.hdr_des, - pckt->order, -#if PML_BFO - pckt->hdr.hdr_fin.hdr_fail, - pckt->hdr.hdr_fin.hdr_match.hdr_seq, - pckt->hdr.hdr_fin.hdr_match.hdr_common.hdr_flags, - pckt->hdr.hdr_fin.hdr_match.hdr_ctx, - pckt->hdr.hdr_fin.hdr_match.hdr_src); -#else /* PML_BFO */ - pckt->hdr.hdr_fin.hdr_fail); -#endif /* PML_BFO */ - if( OPAL_UNLIKELY(OMPI_ERR_OUT_OF_RESOURCE == rc) ) { - return; - } - break; - default: - opal_output(0, "[%s:%d] wrong header type\n", - __FILE__, __LINE__); - break; - } - /* We're done with this packet, return it back to the free list */ - MCA_PML_BFO_PCKT_PENDING_RETURN(pckt); - } -} - -void mca_pml_bfo_process_pending_rdma(void) -{ - mca_pml_bfo_rdma_frag_t* frag; - int32_t i, rc, s = (int32_t)opal_list_get_size(&mca_pml_bfo.rdma_pending); - - for(i = 0; i < s; i++) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - frag = (mca_pml_bfo_rdma_frag_t*) - opal_list_remove_first(&mca_pml_bfo.rdma_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - if(NULL == frag) - break; - if(frag->rdma_state == MCA_PML_BFO_RDMA_PUT) { - frag->retries++; - rc = mca_pml_bfo_send_request_put_frag(frag); - } else { - rc = mca_pml_bfo_recv_request_get_frag(frag); - } - if(OMPI_ERR_OUT_OF_RESOURCE == rc) - break; - } -} - - -void mca_pml_bfo_error_handler( - struct mca_btl_base_module_t* btl, int32_t flags, - ompi_proc_t* errproc, char* btlinfo ) { -#if PML_BFO - if (flags & MCA_BTL_ERROR_FLAGS_NONFATAL) { - mca_pml_bfo_failover_error_handler(btl, flags, errproc, btlinfo); - return; - } -#endif /* PML_BFO */ - ompi_rte_abort(-1, NULL); -} - -#if OPAL_ENABLE_FT_CR == 0 -int mca_pml_bfo_ft_event( int state ) { - return OMPI_SUCCESS; -} -#else -int mca_pml_bfo_ft_event( int state ) -{ - static bool first_continue_pass = false; - ompi_proc_t** procs = NULL; - size_t num_procs; - int ret, p; - - if(OPAL_CRS_CHECKPOINT == state) { - if( opal_cr_timing_barrier_enabled ) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCPBR1); - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - } - - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P0); - } - else if(OPAL_CRS_CONTINUE == state) { - first_continue_pass = !first_continue_pass; - - if( !first_continue_pass ) { - if( opal_cr_timing_barrier_enabled ) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_COREBR0); - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - } - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P2); - } - - if (opal_cr_continue_like_restart && !first_continue_pass) { - /* - * Get a list of processes - */ - procs = ompi_proc_all(&num_procs); - if(NULL == procs) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - /* - * Refresh the proc structure, and publish our proc info in the modex. - * NOTE: Do *not* call ompi_proc_finalize as there are many places in - * the code that point to indv. procs in this strucutre. For our - * needs here we only need to fix up the modex, bml and pml - * references. - */ - if (OMPI_SUCCESS != (ret = ompi_proc_refresh())) { - opal_output(0, - "pml:bfo: ft_event(Restart): proc_refresh Failed %d", - ret); - for(p = 0; p < (int)num_procs; ++p) { - OBJ_RELEASE(procs[p]); - } - free (procs); - return ret; - } - } - } - else if(OPAL_CRS_RESTART_PRE == state ) { - /* Nothing here */ - } - else if(OPAL_CRS_RESTART == state ) { - /* - * Get a list of processes - */ - procs = ompi_proc_all(&num_procs); - if(NULL == procs) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - /* - * Clean out the modex information since it is invalid now. - * ompi_rte_purge_proc_attrs(); - * This happens at the ORTE level, so doing it again here will cause - * some issues with socket caching. - */ - - - /* - * Refresh the proc structure, and publish our proc info in the modex. - * NOTE: Do *not* call ompi_proc_finalize as there are many places in - * the code that point to indv. procs in this strucutre. For our - * needs here we only need to fix up the modex, bml and pml - * references. - */ - if (OMPI_SUCCESS != (ret = ompi_proc_refresh())) { - opal_output(0, - "pml:bfo: ft_event(Restart): proc_refresh Failed %d", - ret); - for(p = 0; p < (int)num_procs; ++p) { - OBJ_RELEASE(procs[p]); - } - free (procs); - return ret; - } - } - else if(OPAL_CRS_TERM == state ) { - ; - } - else { - ; - } - - /* Call the BML - * BML is expected to call ft_event in - * - BTL(s) - * - MPool(s) - */ - if( OMPI_SUCCESS != (ret = mca_bml.bml_ft_event(state))) { - opal_output(0, "pml:base: ft_event: BML ft_event function failed: %d\n", - ret); - } - - if(OPAL_CRS_CHECKPOINT == state) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P1); - - if( opal_cr_timing_barrier_enabled ) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR0); - /* JJH Cannot barrier here due to progress engine -- ompi_rte_barrier();*/ - } - } - else if(OPAL_CRS_CONTINUE == state) { - if( !first_continue_pass ) { - if( opal_cr_timing_barrier_enabled ) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR1); - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - } - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2P3); - } - - if (opal_cr_continue_like_restart && !first_continue_pass) { - /* - * Exchange the modex information once again. - * BTLs will have republished their modex information. - */ - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - - /* - * Startup the PML stack now that the modex is running again - * Add the new procs (BTLs redo modex recv's) - */ - if( OMPI_SUCCESS != (ret = mca_pml_bfo_add_procs(procs, num_procs) ) ) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed in add_procs (%d)", ret); - return ret; - } - - /* Is this barrier necessary ? JJH */ - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - - if( NULL != procs ) { - for(p = 0; p < (int)num_procs; ++p) { - OBJ_RELEASE(procs[p]); - } - free(procs); - procs = NULL; - } - } - if( !first_continue_pass ) { - if( opal_cr_timing_barrier_enabled ) { - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_P2PBR2); - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - } - OPAL_CR_SET_TIMER(OPAL_CR_TIMER_CRCP1); - } - } - else if(OPAL_CRS_RESTART_PRE == state ) { - /* Nothing here */ - } - else if(OPAL_CRS_RESTART == state ) { - /* - * Exchange the modex information once again. - * BTLs will have republished their modex information. - */ - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - - /* - * Startup the PML stack now that the modex is running again - * Add the new procs (BTLs redo modex recv's) - */ - if( OMPI_SUCCESS != (ret = mca_pml_bfo_add_procs(procs, num_procs) ) ) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed in add_procs (%d)", ret); - return ret; - } - - /* Is this barrier necessary ? JJH */ - if (OMPI_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { - opal_output(0, "pml:bfo: ft_event(Restart): Failed to fence complete"); - return ret; - } - - if( NULL != procs ) { - for(p = 0; p < (int)num_procs; ++p) { - OBJ_RELEASE(procs[p]); - } - free(procs); - procs = NULL; - } - } - else if(OPAL_CRS_TERM == state ) { - ; - } - else { - ; - } - - return OMPI_SUCCESS; -} -#endif /* OPAL_ENABLE_FT_CR */ - -int mca_pml_bfo_com_btl_comp(const void *v1, const void *v2) -{ - const mca_pml_bfo_com_btl_t *b1 = (const mca_pml_bfo_com_btl_t *) v1; - const mca_pml_bfo_com_btl_t *b2 = (const mca_pml_bfo_com_btl_t *) v2; - - if(b1->bml_btl->btl_weight < b2->bml_btl->btl_weight) - return 1; - if(b1->bml_btl->btl_weight > b2->bml_btl->btl_weight) - return -1; - - return 0; -} - diff --git a/ompi/mca/pml/bfo/pml_bfo.h b/ompi/mca/pml/bfo/pml_bfo.h deleted file mode 100644 index ef606f2669a..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo.h +++ /dev/null @@ -1,362 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ - -#ifndef MCA_PML_BFO_H -#define MCA_PML_BFO_H - -#include "ompi_config.h" -#include "opal/class/opal_free_list.h" -#include "ompi/request/request.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/pml/base/pml_base_request.h" -#include "ompi/mca/pml/base/pml_base_bsend.h" -#include "ompi/mca/pml/base/pml_base_sendreq.h" -#include "ompi/datatype/ompi_datatype.h" -#include "pml_bfo_hdr.h" -#include "ompi/mca/bml/base/base.h" -#include "ompi/proc/proc.h" -#include "opal/mca/allocator/base/base.h" - -BEGIN_C_DECLS - -/** - * BFO PML module - */ - -struct mca_pml_bfo_t { - mca_pml_base_module_t super; - - int priority; - int free_list_num; /* initial size of free list */ - int free_list_max; /* maximum size of free list */ - int free_list_inc; /* number of elements to grow free list */ - unsigned int send_pipeline_depth; - unsigned int recv_pipeline_depth; - unsigned int rdma_put_retries_limit; - int max_rdma_per_request; - int max_send_per_range; - bool leave_pinned; - int leave_pinned_pipeline; - - /* lock queue access */ - opal_mutex_t lock; - - /* free lists */ - opal_free_list_t rdma_frags; - opal_free_list_t recv_frags; - opal_free_list_t pending_pckts; - opal_free_list_t buffers; - opal_free_list_t send_ranges; - - /* list of pending operations */ - opal_list_t pckt_pending; - opal_list_t send_pending; - opal_list_t recv_pending; - opal_list_t rdma_pending; - /* List of pending fragments without a matching communicator */ - opal_list_t non_existing_communicator_pending; - bool enabled; - char* allocator_name; - mca_allocator_base_module_t* allocator; - unsigned int unexpected_limit; -}; -typedef struct mca_pml_bfo_t mca_pml_bfo_t; - -extern mca_pml_bfo_t mca_pml_bfo; -extern int mca_pml_bfo_output; - -/* - * PML interface functions. - */ - -extern int mca_pml_bfo_add_comm( - struct ompi_communicator_t* comm -); - -extern int mca_pml_bfo_del_comm( - struct ompi_communicator_t* comm -); - -extern int mca_pml_bfo_add_procs( - struct ompi_proc_t **procs, - size_t nprocs -); - -extern int mca_pml_bfo_del_procs( - struct ompi_proc_t **procs, - size_t nprocs -); - -extern int mca_pml_bfo_enable( bool enable ); - -extern int mca_pml_bfo_progress(void); - -extern int mca_pml_bfo_iprobe( int dst, - int tag, - struct ompi_communicator_t* comm, - int *matched, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_probe( int dst, - int tag, - struct ompi_communicator_t* comm, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_improbe( int dst, - int tag, - struct ompi_communicator_t* comm, - int *matched, - struct ompi_message_t **message, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_mprobe( int dst, - int tag, - struct ompi_communicator_t* comm, - struct ompi_message_t **message, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_isend_init( void *buf, - size_t count, - ompi_datatype_t *datatype, - int dst, - int tag, - mca_pml_base_send_mode_t mode, - struct ompi_communicator_t* comm, - struct ompi_request_t **request ); - -extern int mca_pml_bfo_isend( void *buf, - size_t count, - ompi_datatype_t *datatype, - int dst, - int tag, - mca_pml_base_send_mode_t mode, - struct ompi_communicator_t* comm, - struct ompi_request_t **request ); - -extern int mca_pml_bfo_send( void *buf, - size_t count, - ompi_datatype_t *datatype, - int dst, - int tag, - mca_pml_base_send_mode_t mode, - struct ompi_communicator_t* comm ); - -extern int mca_pml_bfo_irecv_init( void *buf, - size_t count, - ompi_datatype_t *datatype, - int src, - int tag, - struct ompi_communicator_t* comm, - struct ompi_request_t **request ); - -extern int mca_pml_bfo_irecv( void *buf, - size_t count, - ompi_datatype_t *datatype, - int src, - int tag, - struct ompi_communicator_t* comm, - struct ompi_request_t **request ); - -extern int mca_pml_bfo_recv( void *buf, - size_t count, - ompi_datatype_t *datatype, - int src, - int tag, - struct ompi_communicator_t* comm, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_imrecv( void *buf, - size_t count, - ompi_datatype_t *datatype, - struct ompi_message_t **message, - struct ompi_request_t **request ); - -extern int mca_pml_bfo_mrecv( void *buf, - size_t count, - ompi_datatype_t *datatype, - struct ompi_message_t **message, - ompi_status_public_t* status ); - -extern int mca_pml_bfo_dump( struct ompi_communicator_t* comm, - int verbose ); - -extern int mca_pml_bfo_start( size_t count, - ompi_request_t** requests ); - -extern int mca_pml_bfo_ft_event( int state ); - -END_C_DECLS - -struct mca_pml_bfo_pckt_pending_t { - opal_free_list_item_t super; - ompi_proc_t* proc; - mca_pml_bfo_hdr_t hdr; - struct mca_bml_base_btl_t *bml_btl; - uint8_t order; -}; -typedef struct mca_pml_bfo_pckt_pending_t mca_pml_bfo_pckt_pending_t; -OBJ_CLASS_DECLARATION(mca_pml_bfo_pckt_pending_t); - -#define MCA_PML_BFO_PCKT_PENDING_ALLOC(pckt) \ -do { \ - opal_free_list_item_t* item; \ - OPAL_FREE_LIST_WAIT(&mca_pml_bfo.pending_pckts, item); \ - pckt = (mca_pml_bfo_pckt_pending_t*)item; \ -} while (0) - -#define MCA_PML_BFO_PCKT_PENDING_RETURN(pckt) \ -do { \ - /* return packet */ \ - OPAL_FREE_LIST_RETURN(&mca_pml_bfo.pending_pckts, \ - (opal_free_list_item_t*)pckt); \ -} while(0) - -#define MCA_PML_BFO_ADD_FIN_TO_PENDING(P, D, B, O, S) \ - do { \ - mca_pml_bfo_pckt_pending_t *_pckt; \ - \ - MCA_PML_BFO_PCKT_PENDING_ALLOC(_pckt); \ - _pckt->hdr.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_FIN; \ - _pckt->hdr.hdr_fin.hdr_des = (D); \ - _pckt->hdr.hdr_fin.hdr_fail = (S); \ - _pckt->proc = (P); \ - _pckt->bml_btl = (B); \ - _pckt->order = (O); \ - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); \ - opal_list_append(&mca_pml_bfo.pckt_pending, \ - (opal_list_item_t*)_pckt); \ - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); \ - } while(0) - - -int mca_pml_bfo_send_fin(ompi_proc_t* proc, mca_bml_base_btl_t* bml_btl, -#if PML_BFO - opal_ptr_t hdr_des, uint8_t order, uint32_t status, - uint16_t seq, uint8_t reqseq, uint16_t ctx, uint32_t src); -#else /* PML_BFO */ - opal_ptr_t hdr_des, uint8_t order, uint32_t status); -#endif /* PML_BFO */ - -/* This function tries to resend FIN/ACK packets from pckt_pending queue. - * Packets are added to the queue when sending of FIN or ACK is failed due to - * resource unavailability. bml_btl passed to the function doesn't represents - * packet's destination, it represents BTL on which resource was freed, so only - * this BTL should be considered for resending packets */ -void mca_pml_bfo_process_pending_packets(mca_bml_base_btl_t* bml_btl); - -/* This function retries failed PUT/GET operations on frag. When RDMA operation - * cannot be accomplished for some reason, frag is put on the rdma_pending list. - * Later the operation is retried. The destination of RDMA operation is stored - * inside the frag structure */ -void mca_pml_bfo_process_pending_rdma(void); - -#define MCA_PML_BFO_PROGRESS_PENDING(bml_btl) \ - do { \ - if(opal_list_get_size(&mca_pml_bfo.pckt_pending)) \ - mca_pml_bfo_process_pending_packets(bml_btl); \ - if(opal_list_get_size(&mca_pml_bfo.recv_pending)) \ - mca_pml_bfo_recv_request_process_pending(); \ - if(opal_list_get_size(&mca_pml_bfo.send_pending)) \ - mca_pml_bfo_send_request_process_pending(bml_btl); \ - if(opal_list_get_size(&mca_pml_bfo.rdma_pending)) \ - mca_pml_bfo_process_pending_rdma(); \ - } while (0) - -/* - * Compute the total number of bytes on supplied descriptor - */ -static inline int mca_pml_bfo_compute_segment_length (size_t seg_size, void *segments, size_t count, - size_t hdrlen) { - size_t i, length; - - for (i = 0, length = -hdrlen ; i < count ; ++i) { - mca_btl_base_segment_t *segment = - (mca_btl_base_segment_t *)((char *) segments + i * seg_size); - - length += segment->seg_len; - } - - return length; -} - -static inline int mca_pml_bfo_compute_segment_length_base (mca_btl_base_segment_t *segments, - size_t count, size_t hdrlen) { - size_t i, length; - - for (i = 0, length = -hdrlen ; i < count ; ++i) { - length += segments[i].seg_len; - } - - return length; -} - -/* represent BTL chosen for sending request */ -struct mca_pml_bfo_com_btl_t { - mca_bml_base_btl_t *bml_btl; - struct mca_mpool_base_registration_t* btl_reg; - size_t length; -}; -typedef struct mca_pml_bfo_com_btl_t mca_pml_bfo_com_btl_t; - -int mca_pml_bfo_com_btl_comp(const void *v1, const void *v2); - -/* Calculate what percentage of a message to send through each BTL according to - * relative weight */ -static inline void -mca_pml_bfo_calc_weighted_length( mca_pml_bfo_com_btl_t *btls, int num_btls, size_t size, - double weight_total ) -{ - int i; - size_t length_left; - - /* shortcut for common case for only one BTL */ - if( OPAL_LIKELY(1 == num_btls) ) { - btls[0].length = size; - return; - } - - /* sort BTLs according of their weights so BTLs with smaller weight will - * not hijack all of the traffic */ - qsort( btls, num_btls, sizeof(mca_pml_bfo_com_btl_t), - mca_pml_bfo_com_btl_comp ); - - for(length_left = size, i = 0; i < num_btls; i++) { - mca_bml_base_btl_t* bml_btl = btls[i].bml_btl; - size_t length = 0; - if( OPAL_UNLIKELY(0 != length_left) ) { - length = (length_left > bml_btl->btl->btl_eager_limit)? - ((size_t)(size * (bml_btl->btl_weight / weight_total))) : - length_left; - - if(length > length_left) - length = length_left; - length_left -= length; - } - btls[i].length = length; - } - - /* account for rounding errors */ - btls[0].length += length_left; -} - -#endif diff --git a/ompi/mca/pml/bfo/pml_bfo_comm.c b/ompi/mca/pml/bfo/pml_bfo_comm.c deleted file mode 100644 index 997f1911492..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_comm.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include - -#include "pml_bfo.h" -#include "pml_bfo_comm.h" - - - -static void mca_pml_bfo_comm_proc_construct(mca_pml_bfo_comm_proc_t* proc) -{ - proc->expected_sequence = 1; - proc->ompi_proc = NULL; - proc->send_sequence = 0; - OBJ_CONSTRUCT(&proc->frags_cant_match, opal_list_t); - OBJ_CONSTRUCT(&proc->specific_receives, opal_list_t); - OBJ_CONSTRUCT(&proc->unexpected_frags, opal_list_t); -} - - -static void mca_pml_bfo_comm_proc_destruct(mca_pml_bfo_comm_proc_t* proc) -{ - OBJ_DESTRUCT(&proc->frags_cant_match); - OBJ_DESTRUCT(&proc->specific_receives); - OBJ_DESTRUCT(&proc->unexpected_frags); -} - - -static OBJ_CLASS_INSTANCE( - mca_pml_bfo_comm_proc_t, - opal_object_t, - mca_pml_bfo_comm_proc_construct, - mca_pml_bfo_comm_proc_destruct); - - -static void mca_pml_bfo_comm_construct(mca_pml_bfo_comm_t* comm) -{ - OBJ_CONSTRUCT(&comm->wild_receives, opal_list_t); - OBJ_CONSTRUCT(&comm->matching_lock, opal_mutex_t); - comm->recv_sequence = 0; - comm->procs = NULL; - comm->last_probed = 0; - comm->num_procs = 0; -} - - -static void mca_pml_bfo_comm_destruct(mca_pml_bfo_comm_t* comm) -{ - size_t i; - for(i=0; inum_procs; i++) - OBJ_DESTRUCT((&comm->procs[i])); - if(NULL != comm->procs) - free(comm->procs); - OBJ_DESTRUCT(&comm->wild_receives); - OBJ_DESTRUCT(&comm->matching_lock); -} - - -OBJ_CLASS_INSTANCE( - mca_pml_bfo_comm_t, - opal_object_t, - mca_pml_bfo_comm_construct, - mca_pml_bfo_comm_destruct); - - -int mca_pml_bfo_comm_init_size(mca_pml_bfo_comm_t* comm, size_t size) -{ - size_t i; - - /* send message sequence-number support - sender side */ - comm->procs = (mca_pml_bfo_comm_proc_t*)malloc(sizeof(mca_pml_bfo_comm_proc_t)*size); - if(NULL == comm->procs) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - for(i=0; iprocs+i, mca_pml_bfo_comm_proc_t); - } - comm->num_procs = size; - return OMPI_SUCCESS; -} - - diff --git a/ompi/mca/pml/bfo/pml_bfo_comm.h b/ompi/mca/pml/bfo/pml_bfo_comm.h deleted file mode 100644 index c70b4514d34..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_comm.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ -#ifndef MCA_PML_BFO_COMM_H -#define MCA_PML_BFO_COMM_H - -#include "opal/threads/mutex.h" -#include "opal/class/opal_list.h" -#include "ompi/proc/proc.h" -BEGIN_C_DECLS - - -struct mca_pml_bfo_comm_proc_t { - opal_object_t super; - uint16_t expected_sequence; /**< send message sequence number - receiver side */ - struct ompi_proc_t* ompi_proc; -#if OPAL_ENABLE_MULTI_THREADS - volatile int32_t send_sequence; /**< send side sequence number */ -#else - int32_t send_sequence; /**< send side sequence number */ -#endif - opal_list_t frags_cant_match; /**< out-of-order fragment queues */ - opal_list_t specific_receives; /**< queues of unmatched specific receives */ - opal_list_t unexpected_frags; /**< unexpected fragment queues */ -}; -typedef struct mca_pml_bfo_comm_proc_t mca_pml_bfo_comm_proc_t; - - -/** - * Cached on ompi_communicator_t to hold queues/state - * used by the PML<->PTL interface for matching logic. - */ -struct mca_pml_comm_t { - opal_object_t super; -#if OPAL_ENABLE_MULTI_THREADS - volatile uint32_t recv_sequence; /**< recv request sequence number - receiver side */ -#else - uint32_t recv_sequence; /**< recv request sequence number - receiver side */ -#endif - opal_mutex_t matching_lock; /**< matching lock */ - opal_list_t wild_receives; /**< queue of unmatched wild (source process not specified) receives */ - mca_pml_bfo_comm_proc_t* procs; - size_t num_procs; - size_t last_probed; -}; -typedef struct mca_pml_comm_t mca_pml_bfo_comm_t; - -OBJ_CLASS_DECLARATION(mca_pml_bfo_comm_t); - - -/** - * Initialize an instance of mca_pml_bfo_comm_t based on the communicator size. - * - * @param comm Instance of mca_pml_bfo_comm_t - * @param size Size of communicator - * @return OMPI_SUCCESS or error status on failure. - */ - -extern int mca_pml_bfo_comm_init_size(mca_pml_bfo_comm_t* comm, size_t size); - -END_C_DECLS -#endif - diff --git a/ompi/mca/pml/bfo/pml_bfo_component.c b/ompi/mca/pml/bfo/pml_bfo_component.c deleted file mode 100644 index 67e59272613..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_component.c +++ /dev/null @@ -1,274 +0,0 @@ -/* -*- 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-2009 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) 2007-2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "opal/mca/event/event.h" -#include "mpi.h" -#include "ompi/runtime/params.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/pml/base/pml_base_bsend.h" -#include "pml_bfo.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_rdmafrag.h" -#include "pml_bfo_recvfrag.h" -#include "ompi/mca/bml/base/base.h" -#include "pml_bfo_component.h" -#include "opal/mca/allocator/base/base.h" -#include "opal/runtime/opal_params.h" - -OBJ_CLASS_INSTANCE( mca_pml_bfo_pckt_pending_t, - ompi_free_list_item_t, - NULL, - NULL ); - -static int mca_pml_bfo_component_register(void); -static int mca_pml_bfo_component_open(void); -static int mca_pml_bfo_component_close(void); -static mca_pml_base_module_t* -mca_pml_bfo_component_init( int* priority, bool enable_progress_threads, - bool enable_mpi_threads ); -static int mca_pml_bfo_component_fini(void); -int mca_pml_bfo_output = 0; -static int mca_pml_bfo_verbose = 0; - -mca_pml_base_component_2_0_0_t mca_pml_bfo_component = { - - /* First, the mca_base_component_t struct containing meta - information about the component itself */ - - .pmlm_version = { - MCA_PML_BASE_VERSION_2_0_0, - - .mca_component_name = "bfo", - MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, - OMPI_RELEASE_VERSION), - .mca_open_component = mca_pml_bfo_component_open, - .mca_close_component = mca_pml_bfo_component_close, - .mca_register_component_params = mca_pml_bfo_component_register, - }, - .pmlm_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - - .pmlm_init = mca_pml_bfo_component_init, - .pmlm_finalize = mca_pml_bfo_component_fini, -}; - -void *mca_pml_bfo_seg_alloc( struct mca_mpool_base_module_t* mpool, - size_t* size, - mca_mpool_base_registration_t** registration); - -void mca_pml_bfo_seg_free( struct mca_mpool_base_module_t* mpool, - void* segment ); - -static inline int mca_pml_bfo_param_register_int( - const char* param_name, - int default_value, - int *storage) -{ - *storage = default_value; - (void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version, param_name, - NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, storage); - - return *storage; -} - -static inline unsigned int mca_pml_bfo_param_register_uint( - const char* param_name, - unsigned int default_value, - unsigned int *storage) -{ - *storage = default_value; - (void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version, param_name, - NULL, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, storage); - - return *storage; -} - -static int mca_pml_bfo_component_register(void) -{ - int default_priority; - -#if PML_BFO - default_priority = 5; -#else /* PML_BFO */ - default_priority = 20; - mca_pml_bfo_param_register_int("priority", 20); -#endif /* PML_BFO */ - - (void) mca_pml_bfo_param_register_int("verbose", 0, &mca_pml_bfo_verbose); - (void) mca_pml_bfo_param_register_int("free_list_num", 4, &mca_pml_bfo.free_list_num); - (void) mca_pml_bfo_param_register_int("free_list_max", -1, &mca_pml_bfo.free_list_max); - (void) mca_pml_bfo_param_register_int("free_list_inc", 64, &mca_pml_bfo.free_list_inc); - (void) mca_pml_bfo_param_register_int("priority", default_priority, &mca_pml_bfo.priority); - (void) mca_pml_bfo_param_register_uint("send_pipeline_depth", 3, &mca_pml_bfo.send_pipeline_depth); - (void) mca_pml_bfo_param_register_uint("recv_pipeline_depth", 4, &mca_pml_bfo.recv_pipeline_depth); - (void) mca_pml_bfo_param_register_uint("rdma_put_retries_limit", 5, &mca_pml_bfo.rdma_put_retries_limit); - (void) mca_pml_bfo_param_register_int("max_rdma_per_request", 4, &mca_pml_bfo.max_rdma_per_request); - (void) mca_pml_bfo_param_register_int("max_send_per_range", 4, &mca_pml_bfo.max_send_per_range); - (void) mca_pml_bfo_param_register_uint("unexpected_limit", 128, &mca_pml_bfo.unexpected_limit); - - mca_pml_bfo.allocator_name = "bucket"; - (void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version, - "allocator", - "Name of allocator component for unexpected messages", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_pml_bfo.allocator_name); - - return OMPI_SUCCESS; -} - -static int mca_pml_bfo_component_open(void) -{ - mca_pml_bfo_output = opal_output_open(NULL); - opal_output_set_verbosity(mca_pml_bfo_output, mca_pml_bfo_verbose); - - mca_pml_bfo.enabled = false; - return mca_base_framework_open(&ompi_bml_base_framework, 0); -} - - -static int mca_pml_bfo_component_close(void) -{ - int rc; - - if (OMPI_SUCCESS != (rc = mca_base_framework_close(&ompi_bml_base_framework))) { - return rc; - } - opal_output_close(mca_pml_bfo_output); - - return OMPI_SUCCESS; -} - - -static mca_pml_base_module_t* -mca_pml_bfo_component_init( int* priority, - bool enable_progress_threads, - bool enable_mpi_threads ) -{ - mca_allocator_base_component_t* allocator_component; - - opal_output_verbose( 10, mca_pml_bfo_output, - "in bfo, my priority is %d\n", mca_pml_bfo.priority); - - if((*priority) > mca_pml_bfo.priority) { - *priority = mca_pml_bfo.priority; - return NULL; - } - *priority = mca_pml_bfo.priority; - - allocator_component = mca_allocator_component_lookup( mca_pml_bfo.allocator_name ); - if(NULL == allocator_component) { - opal_output(0, "mca_pml_bfo_component_init: can't find allocator: %s\n", mca_pml_bfo.allocator_name); - return NULL; - } - - mca_pml_bfo.allocator = allocator_component->allocator_init(true, - mca_pml_bfo_seg_alloc, - mca_pml_bfo_seg_free, NULL); - if(NULL == mca_pml_bfo.allocator) { - opal_output(0, "mca_pml_bfo_component_init: unable to initialize allocator\n"); - return NULL; - } - - - if(OMPI_SUCCESS != mca_bml_base_init( enable_progress_threads, - enable_mpi_threads)) { - return NULL; - } - - /* Set this here (vs in component_open()) because - opal_leave_pinned* may have been set after MCA params were - read (e.g., by the openib btl) */ - mca_pml_bfo.leave_pinned = (1 == opal_leave_pinned); - mca_pml_bfo.leave_pinned_pipeline = (int) opal_leave_pinned_pipeline; - - return &mca_pml_bfo.super; -} - -int mca_pml_bfo_component_fini(void) -{ - int rc; - - /* Shutdown BML */ - if(OMPI_SUCCESS != (rc = mca_bml.bml_finalize())) - return rc; - - if(!mca_pml_bfo.enabled) - return OMPI_SUCCESS; /* never selected.. return success.. */ - mca_pml_bfo.enabled = false; /* not anymore */ - - OBJ_DESTRUCT(&mca_pml_bfo.rdma_pending); - OBJ_DESTRUCT(&mca_pml_bfo.pckt_pending); - OBJ_DESTRUCT(&mca_pml_bfo.recv_pending); - OBJ_DESTRUCT(&mca_pml_bfo.send_pending); - OBJ_DESTRUCT(&mca_pml_bfo.non_existing_communicator_pending); - OBJ_DESTRUCT(&mca_pml_bfo.buffers); - OBJ_DESTRUCT(&mca_pml_bfo.pending_pckts); - OBJ_DESTRUCT(&mca_pml_bfo.recv_frags); - OBJ_DESTRUCT(&mca_pml_bfo.rdma_frags); - OBJ_DESTRUCT(&mca_pml_bfo.lock); - - if(OMPI_SUCCESS != (rc = mca_pml_bfo.allocator->alc_finalize(mca_pml_bfo.allocator))) { - return rc; - } - -#if 0 - if (mca_pml_base_send_requests.fl_num_allocated != - mca_pml_base_send_requests.super.opal_list_length) { - opal_output(0, "bfo send requests: %d allocated %d returned\n", - mca_pml_base_send_requests.fl_num_allocated, - mca_pml_base_send_requests.super.opal_list_length); - } - if (mca_pml_base_recv_requests.fl_num_allocated != - mca_pml_base_recv_requests.super.opal_list_length) { - opal_output(0, "bfo recv requests: %d allocated %d returned\n", - mca_pml_base_recv_requests.fl_num_allocated, - mca_pml_base_recv_requests.super.opal_list_length); - } -#endif - - return OMPI_SUCCESS; -} - -void *mca_pml_bfo_seg_alloc( struct mca_mpool_base_module_t* mpool, - size_t* size, - mca_mpool_base_registration_t** registration) { - return malloc(*size); -} - -void mca_pml_bfo_seg_free( struct mca_mpool_base_module_t* mpool, - void* segment ) { - free(segment); -} diff --git a/ompi/mca/pml/bfo/pml_bfo_component.h b/ompi/mca/pml/bfo/pml_bfo_component.h deleted file mode 100644 index 60a9828a54c..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_component.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 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) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ - -#ifndef MCA_PML_BFO_COMPONENT_H -#define MCA_PML_BFO_COMPONENT_H - -BEGIN_C_DECLS - -/* - * PML module functions. - */ -OMPI_MODULE_DECLSPEC extern mca_pml_base_component_2_0_0_t mca_pml_bfo_component; - -END_C_DECLS - -#endif diff --git a/ompi/mca/pml/bfo/pml_bfo_cuda.c b/ompi/mca/pml/bfo/pml_bfo_cuda.c deleted file mode 100644 index eb35b226e0e..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_cuda.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012-2015 NVIDIA Corporation. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "opal/prefetch.h" -#include "opal/mca/btl/btl.h" -#include "opal/mca/mpool/mpool.h" -#include "ompi/constants.h" -#include "ompi/mca/pml/pml.h" -#include "pml_bfo.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_rdmafrag.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_sendreq.h" -#include "ompi/mca/bml/base/base.h" -#include "ompi/memchecker.h" - -size_t mca_pml_bfo_rdma_cuda_btls( - mca_bml_base_endpoint_t* bml_endpoint, - unsigned char* base, - size_t size, - mca_pml_bfo_com_btl_t* rdma_btls); - -int mca_pml_bfo_cuda_need_buffers(void * rreq, - mca_btl_base_module_t* btl); - -/** - * Handle the CUDA buffer. - */ -int mca_pml_bfo_send_request_start_cuda(mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size) { - int rc; - sendreq->req_send.req_base.req_convertor.flags &= ~CONVERTOR_CUDA; - if (opal_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { - unsigned char *base; - opal_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); - /* Set flag back */ - sendreq->req_send.req_base.req_convertor.flags |= CONVERTOR_CUDA; - if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_bfo_rdma_cuda_btls( - sendreq->req_endpoint, - base, - sendreq->req_send.req_bytes_packed, - sendreq->req_rdma))) { - rc = mca_pml_bfo_send_request_start_rdma(sendreq, bml_btl, - sendreq->req_send.req_bytes_packed); - if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { - mca_pml_bfo_free_rdma_resources(sendreq); - } - } else { - if (bml_btl->btl_flags & MCA_BTL_FLAGS_CUDA_PUT) { - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, size, - MCA_PML_BFO_HDR_FLAGS_CONTIG); - } else { - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, size, 0); - } - } - } else { - /* Do not send anything with first rendezvous message as copying GPU - * memory into RNDV message is expensive. */ - sendreq->req_send.req_base.req_convertor.flags |= CONVERTOR_CUDA; - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, 0, 0); - } - return rc; -} - - - -size_t mca_pml_bfo_rdma_cuda_btls( - mca_bml_base_endpoint_t* bml_endpoint, - unsigned char* base, - size_t size, - mca_pml_bfo_com_btl_t* rdma_btls) -{ - int num_btls = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send); - double weight_total = 0; - int num_btls_used = 0, n; - - /* shortcut when there are no rdma capable btls */ - if(num_btls == 0) { - return 0; - } - - /* check to see if memory is registered */ - for(n = 0; n < num_btls && num_btls_used < mca_pml_bfo.max_rdma_per_request; - n++) { - mca_bml_base_btl_t* bml_btl = - mca_bml_base_btl_array_get_index(&bml_endpoint->btl_send, n); - - if (bml_btl->btl_flags & MCA_BTL_FLAGS_CUDA_GET) { - mca_mpool_base_registration_t* reg = NULL; - mca_mpool_base_module_t *btl_mpool = bml_btl->btl->btl_mpool; - - if( NULL != btl_mpool ) { - /* register the memory */ - btl_mpool->mpool_register(btl_mpool, base, size, 0, ®); - } - - if(NULL == reg) - continue; - - rdma_btls[num_btls_used].bml_btl = bml_btl; - rdma_btls[num_btls_used].btl_reg = reg; - weight_total += bml_btl->btl_weight; - num_btls_used++; - } - } - - /* if we don't use leave_pinned and all BTLs that already have this memory - * registered amount to less then half of available bandwidth - fall back to - * pipeline protocol */ - if(0 == num_btls_used || (!mca_pml_bfo.leave_pinned && weight_total < 0.5)) - return 0; - - mca_pml_bfo_calc_weighted_length(rdma_btls, num_btls_used, size, - weight_total); - - return num_btls_used; -} - -int mca_pml_bfo_cuda_need_buffers(void * rreq, - mca_btl_base_module_t* btl) -{ - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)rreq; - if ((recvreq->req_recv.req_base.req_convertor.flags & CONVERTOR_CUDA) && - (btl->btl_flags & MCA_BTL_FLAGS_CUDA_GET)) { - recvreq->req_recv.req_base.req_convertor.flags &= ~CONVERTOR_CUDA; - if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { - recvreq->req_recv.req_base.req_convertor.flags |= CONVERTOR_CUDA; - return true; - } else { - recvreq->req_recv.req_base.req_convertor.flags |= CONVERTOR_CUDA; - return false; - } - } - return true; -} - diff --git a/ompi/mca/pml/bfo/pml_bfo_failover.c b/ompi/mca/pml/bfo/pml_bfo_failover.c deleted file mode 100644 index bd8e3a54527..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_failover.c +++ /dev/null @@ -1,2187 +0,0 @@ -/* - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2013 Intel, Inc. All rights reserved - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * Functions that implement failover capabilities. To utilize the - * failover feature, one needs to configure the library with - * --enable-openib-failover. Then the system that is being used - * must have two or more openib BTLs in use. When an error occurs, - * the BTL will call into this PML to map out the offending BTL and - * continue using the one that is still working. - * Most of the differences between the ob1 PML and the bfo PML are - * contained in this file. - */ - -#include "ompi_config.h" - -#include -#include - -#include "opal/class/opal_bitmap.h" -#include "opal/mca/btl/btl.h" -#include "opal/mca/btl/base/base.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/pml/base/base.h" -#include "ompi/mca/pml/base/base.h" -#include "pml_bfo.h" -#include "pml_bfo_component.h" -#include "pml_bfo_comm.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_recvfrag.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_rdmafrag.h" -#include "pml_bfo_failover.h" -#include "ompi/mca/bml/base/base.h" - -#include "ompi/runtime/ompi_cr.h" - -static void mca_pml_bfo_error_pending_packets(mca_btl_base_module_t* btl, - mca_bml_base_endpoint_t* ep); - -/** - * When running with failover enabled, check the PML sequence numbers - * to see if we have received a duplicate message. This check is done - * for for all MATCH fragments. It is also done for RNDV and RGET - * fragments that do not have the MCA_PML_BFO_HDR_FLAGS_RESTART flag - * set. - * We set the window size to half the total range of sequence numbers. - * We only enter this code when the seq_num is not the expected one. - * A few more notes on the algorithm used here. In normal operation, - * the expected value will either be equal to or less than the - * sequence number of the header. This is because we are using this - * sequence number to detect packets arriving prior to them being - * expected. If we determine that expected is less than header, then - * make sure this is not a rollover case. We do that by adding the - * maxnum to the expected. - * @param proc Pointer to proc from where message came - * @param hdr Pointer to header of message - */ -bool mca_pml_bfo_is_duplicate_msg(mca_pml_bfo_comm_proc_t* proc, - mca_pml_bfo_match_hdr_t *hdr) -{ - const int window = 32768; - const int maxnum = 65536; - mca_pml_bfo_recv_frag_t *frag; - -#if 0 - opal_output(0, "checking dup, exp=%d, act=%d, type=%d, cant_match=%d\n", - (uint16_t)proc->expected_sequence, - hdr->hdr_seq, hdr->hdr_common.hdr_type, - opal_list_get_size(&proc->frags_cant_match)); -#endif - - /* Few cases near end of values where expected may equal 65535 and - * an out of order shows up that may equal something like 1. */ - if (OPAL_UNLIKELY((uint16_t)proc->expected_sequence > hdr->hdr_seq)) { - if (((uint16_t)proc->expected_sequence - hdr->hdr_seq) < window) { - opal_output_verbose(20, mca_pml_bfo_output, - "%s:%d: frag duplicated, exp=%d, act=%d, type=%d\n", - __FILE__, __LINE__, (uint16_t)proc->expected_sequence, - hdr->hdr_seq, hdr->hdr_common.hdr_type); - return true; - } - } else { - /* This is the normal flow through this code. We also need to - * use the maxnum to ensure that we handle cases where the - * expected number has rolled over but then a duplicate message - * shows up that is greater than it. */ - if ((((uint16_t)proc->expected_sequence + maxnum) - hdr->hdr_seq) < window) { - opal_output_verbose(20, mca_pml_bfo_output, - "%s:%d: frag duplicated, exp=%d, act=%d, type=%d\n", - __FILE__, __LINE__, (uint16_t)proc->expected_sequence, - hdr->hdr_seq, hdr->hdr_common.hdr_type); - return true; - } - } - - /* Need to explicitly check against any out of order fragments. Unfortunately, we - * always have to do this since we can get a duplicate out of order fragment. */ - if(OPAL_UNLIKELY(opal_list_get_size(&proc->frags_cant_match) > 0)) { - for(frag = (mca_pml_bfo_recv_frag_t*)opal_list_get_first(&proc->frags_cant_match); - frag != (mca_pml_bfo_recv_frag_t*)opal_list_get_end(&proc->frags_cant_match); - frag = (mca_pml_bfo_recv_frag_t*)opal_list_get_next(frag)) - { - mca_pml_bfo_match_hdr_t* mhdr = &frag->hdr.hdr_match; - - if(mhdr->hdr_seq == hdr->hdr_seq) { - opal_output_verbose(20, mca_pml_bfo_output, - "%s:%d: frag duplicated on frags_cant_match list, seq=%d, type=%d\n", - __FILE__, __LINE__, hdr->hdr_seq, hdr->hdr_common.hdr_type); - return true; - } - } - } - - return false; -} - -/** - * This function checks to see if we have received a duplicate FIN - * message. This is done by first pulling the pointer of the request - * that the FIN message is pointing to from the message. We then - * check the various fields in the request to the fields in the header - * and make sure they match. If they do not, then the request must - * have been recycled already and this is a duplicate FIN message. We - * have to do this check on every FIN message that we receive. - */ -bool mca_pml_bfo_is_duplicate_fin(mca_pml_bfo_hdr_t* hdr, mca_btl_base_descriptor_t* rdma, - mca_btl_base_module_t* btl) -{ - mca_pml_base_request_t* basereq; - /* When running with failover enabled, need to ensure that this - * is not a duplicate FIN message. */ - if (btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) { - /* The first check is to make sure the descriptor is pointing - * to a valid request. The descriptor may be pointing to NULL - * if it was freed and not reused yet. */ - if (NULL == rdma->des_cbdata) { - opal_output_verbose(20, mca_pml_bfo_output, - "FIN: received: dropping because not pointing to valid descriptor " - "PML=%d CTX=%d SRC=%d RQS=%d", - hdr->hdr_fin.hdr_match.hdr_seq, - hdr->hdr_fin.hdr_match.hdr_ctx, - hdr->hdr_fin.hdr_match.hdr_src, - hdr->hdr_fin.hdr_match.hdr_common.hdr_flags); - return true; - } - - basereq = (mca_pml_base_request_t*)rdma->des_cbdata; - /* Now we know the descriptor is pointing to a non-null request. - * Does it match what we expect? To make sure the receiver request - * matches the FIN message, check the context number, source of the - * message, and MPI sequence number. Then make sure that it also - * matches the internal sequencing number of the requests. We need - * to look at the type of request we are pointing at to figure out - * what fields to access. */ - if (basereq->req_type == MCA_PML_REQUEST_RECV) { - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)basereq; - if ((hdr->hdr_fin.hdr_match.hdr_ctx != - recvreq->req_recv.req_base.req_comm->c_contextid) || - (hdr->hdr_fin.hdr_match.hdr_src != - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE) || - (hdr->hdr_fin.hdr_match.hdr_seq != (uint16_t)recvreq->req_msgseq)) { - opal_output_verbose(5, mca_pml_bfo_output, - "FIN: received on receiver: dropping because no match " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d " - "RQS:exp=%d,act=%d, dst_req=%p", - (uint16_t)recvreq->req_msgseq, hdr->hdr_fin.hdr_match.hdr_seq, - recvreq->req_recv.req_base.req_comm->c_contextid, - hdr->hdr_fin.hdr_match.hdr_ctx, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - hdr->hdr_fin.hdr_match.hdr_src, - recvreq->req_restartseq, - hdr->hdr_fin.hdr_match.hdr_common.hdr_flags, - (void *)recvreq); - return true; - } - if (hdr->hdr_fin.hdr_match.hdr_common.hdr_flags != recvreq->req_restartseq) { - opal_output_verbose(5, mca_pml_bfo_output, - "FIN: received on receiver: dropping because old " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d " - "RQS:exp=%d,act=%d, dst_req=%p", - (uint16_t)recvreq->req_msgseq, hdr->hdr_fin.hdr_match.hdr_seq, - recvreq->req_recv.req_base.req_comm->c_contextid, - hdr->hdr_fin.hdr_match.hdr_ctx, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - hdr->hdr_fin.hdr_match.hdr_src, - recvreq->req_restartseq, - hdr->hdr_fin.hdr_match.hdr_common.hdr_flags, - (void *)recvreq); - return true; - } - } else if (basereq->req_type == MCA_PML_REQUEST_SEND) { - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)basereq; - if ((hdr->hdr_fin.hdr_match.hdr_ctx != - sendreq->req_send.req_base.req_comm->c_contextid) || - (hdr->hdr_fin.hdr_match.hdr_src != - sendreq->req_send.req_base.req_peer) || - (hdr->hdr_fin.hdr_match.hdr_seq != - (uint16_t)sendreq->req_send.req_base.req_sequence)) { - uint16_t seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - opal_output_verbose(5, mca_pml_bfo_output, - "FIN: received on sender: dropping because no match " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d " - "RQS:exp=%d,act=%d, dst_req=%p", - seq, hdr->hdr_fin.hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, - hdr->hdr_fin.hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_peer, - hdr->hdr_fin.hdr_match.hdr_src, - sendreq->req_restartseq, - hdr->hdr_fin.hdr_match.hdr_common.hdr_flags, - (void *)sendreq); - return true; - } - if (hdr->hdr_fin.hdr_match.hdr_common.hdr_flags != sendreq->req_restartseq) { - uint16_t seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - opal_output_verbose(5, mca_pml_bfo_output, - "FIN: received on sender: dropping because old " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d " - "RQS:exp=%d,act=%d, dst_req=%p", - seq, hdr->hdr_fin.hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, - hdr->hdr_fin.hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_peer, - hdr->hdr_fin.hdr_match.hdr_src, - sendreq->req_restartseq, - hdr->hdr_fin.hdr_match.hdr_common.hdr_flags, - (void *)sendreq); - return true; - } - } else { - /* We can get here if the descriptor has been reused, but - * not as an RDMA descriptor. In that case, the callback - * function has been set to something else. Clearly the - * descriptor we are interested is gone, so just drop the - * FIN message. */ - opal_output_verbose(5, mca_pml_bfo_output, - "FIN: received: dropping because descriptor has been reused " - "PML=%d CTX=%d SRC=%d RQS=%d rdma->des_flags=%d", - hdr->hdr_fin.hdr_match.hdr_seq, hdr->hdr_fin.hdr_match.hdr_ctx, - hdr->hdr_fin.hdr_match.hdr_src, hdr->hdr_fin.hdr_match.hdr_common.hdr_flags, - rdma->des_flags); - return true; - } - } - return false; -} - -/** - * Repost a FIN message if we get an error on the completion event. - */ -void mca_pml_bfo_repost_fin(struct mca_btl_base_descriptor_t* des) { - /* In the error case, we will repost the FIN message. I had - * considered restarting the request. The problem is that the - * request may be already complete when we detect that a FIN - * message got an error on its completion event. For example, with - * the PUT protocol, if the RDMA writes succeed and all the data - * has been sent, then the request is marked as complete and can be - * freed. Therefore, an error on the FIN message has no request to - * refer back to. So, we will just repost it. However, we are also - * faced with the case where the FIN message has an error but it - * actually makes it to the other side. In that case we are now - * sending a FIN message to a non-existent request on the receiver - * side. To handle that, we have added the match information to - * the FIN message. That way, we can check on the receiving side - * to ensure that it is pointing to a valid request. */ - mca_pml_bfo_fin_hdr_t* hdr; - mca_bml_base_endpoint_t* bml_endpoint; - ompi_proc_t *proc; - mca_bml_base_btl_t* bml_btl; - - proc = (ompi_proc_t*) des->des_cbdata; - bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - hdr = (mca_pml_bfo_fin_hdr_t*)des->des_local->seg_addr.pval; - - opal_output_verbose(20, mca_pml_bfo_output, - "REPOST: BFO_HDR_TYPE_FIN: seq=%d,myrank=%d,peer=%d,hdr->hdr_fail=%d,src=%d", - hdr->hdr_match.hdr_seq, OMPI_PROC_MY_NAME->vpid, OMPI_CAST_RTE_NAME(&proc->super.proc_name)->vpid, - hdr->hdr_fail, hdr->hdr_match.hdr_src); - - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - - /* Reconstruct the fin for sending on the other BTL */ - mca_pml_bfo_send_fin(proc, bml_btl, - hdr->hdr_des, MCA_BTL_NO_ORDER, - hdr->hdr_fail, hdr->hdr_match.hdr_seq, - hdr->hdr_match.hdr_common.hdr_flags, - hdr->hdr_match.hdr_ctx, hdr->hdr_match.hdr_src); - return; -} - -/** - * This function is called when a RNDV or RGET is received with the - * FLAGS_RESTART flag set. This means this message already has a - * receive request already associated with it. - */ -mca_pml_bfo_recv_request_t* mca_pml_bfo_get_request(mca_pml_bfo_match_hdr_t *hdr) { - mca_pml_bfo_recv_request_t *match = NULL; - mca_pml_bfo_rendezvous_hdr_t * rhdr = (mca_pml_bfo_rendezvous_hdr_t *) hdr; - match = (mca_pml_bfo_recv_request_t *) rhdr->hdr_dst_req.pval; - - /* Check to see if we have received a duplicate RNDV (or RGET). This can - * occur because we got an error when we reposted the RNDV. Therefore, - * we make sure that the request has not completed from underneath us - * and been recycled. Secondly, make sure we are not getting it a - * second time for the same request. */ - if ((rhdr->hdr_match.hdr_ctx != match->req_recv.req_base.req_comm->c_contextid) || - (rhdr->hdr_match.hdr_src != match->req_recv.req_base.req_ompi.req_status.MPI_SOURCE) || - (rhdr->hdr_match.hdr_seq != (uint16_t)match->req_msgseq) || - (rhdr->hdr_restartseq == match->req_restartseq)) { - if (hdr->hdr_common.hdr_type == MCA_PML_BFO_HDR_TYPE_RNDV) { - opal_output_verbose(20, mca_pml_bfo_output, - "RNDV: received with RESTART flag: duplicate, dropping " - "PML:exp=%d,act=%d RQS=%d, src_req=%p, dst_req=%p, peer=%d", - match->req_msgseq, rhdr->hdr_match.hdr_seq, match->req_restartseq, - match->remote_req_send.pval, (void *)match, - match->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } else { - opal_output_verbose(20, mca_pml_bfo_output, - "RGET: received with RESTART flag: duplicate, dropping " - "PML:exp=%d,act=%d RQS=%d, src_req=%p, dst_req=%p, peer=%d", - match->req_msgseq, rhdr->hdr_match.hdr_seq, match->req_restartseq, - match->remote_req_send.pval, (void *)match, - match->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } - return NULL; - } - - mca_pml_bfo_recv_request_reset(match); - if (hdr->hdr_common.hdr_type == MCA_PML_BFO_HDR_TYPE_RNDV) { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDV: received with RESTART flag: restarting recv, " - "PML:exp=%d,act=%d RQS(new)=%d, src_req=%p, dst_req=%p, peer=%d", - match->req_msgseq, rhdr->hdr_match.hdr_seq, match->req_restartseq, - match->remote_req_send.pval, (void *)match, - match->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "RGET: received with RESTART flag: restarting recv, " - "PML:exp=%d,act=%d RQS(new)=%d, src_req=%p, dst_req=%p, peer=%d", - match->req_msgseq, rhdr->hdr_match.hdr_seq, match->req_restartseq, - match->remote_req_send.pval, (void *)match, - match->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } - return match; -} - -/** - * Callback for when a RNDVRESTARTNOTIFY message is received. A - * RNDVRESTARTNOTIFY message is sent from the sender to the receiver - * telling the receiver that the message is going to be started over. - * The receiver first makes sure that the request being pointed to is - * still valid. If it is not, that means the receiver must have - * completed the request and therefore we need to send a NACK back to - * the sender. The receiver then makes sure this is not a duplicate - * message. If it is a duplicate, it will just drop it. Otherwise, - * it will then send a RNDVRESTARTACK message if there are no - * outstanding events on the receiver. Otherwise, it will just change - * the state of the request and wait for another event to send the - * RNDVRESTARTACK to the sender. - */ -void mca_pml_bfo_recv_frag_callback_rndvrestartnotify(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_recv_request_t* recvreq; - ompi_proc_t* ompi_proc; - ompi_process_name_t orte_proc; - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY); - recvreq = (mca_pml_bfo_recv_request_t*)hdr->hdr_restart.hdr_dst_req.pval; - - /* Check to see if the receive request is still valid. If the - * request is recycled, that means the original request must have - * completed and we therefore need to send a NACK back to the sender. - * Note that when the request is gone, we need to pull some information - * off the header so that we can figure out where to send the NACK - * message back to. */ - if ((hdr->hdr_match.hdr_ctx != recvreq->req_recv.req_base.req_comm->c_contextid) || - (hdr->hdr_match.hdr_src != recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE) || - (hdr->hdr_match.hdr_seq != (uint16_t)recvreq->req_msgseq)) { - orte_proc.jobid = hdr->hdr_restart.hdr_jobid; - orte_proc.vpid = hdr->hdr_restart.hdr_vpid; - - ompi_proc = ompi_proc_find(&orte_proc); - opal_output_verbose(20, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: received: does not match request, sending NACK back " - "PML:req=%d,hdr=%d CTX:req=%d,hdr=%d SRC:req=%d,hdr=%d " - "RQS:req=%d,hdr=%d src_req=%p, dst_req=%p, peer=%d, hdr->hdr_jobid=%d, " - "hdr->hdr_vpid=%d, proc_hostname=%s", - (uint16_t)recvreq->req_msgseq, hdr->hdr_match.hdr_seq, - recvreq->req_recv.req_base.req_comm->c_contextid, hdr->hdr_match.hdr_ctx, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - hdr->hdr_match.hdr_src, recvreq->req_restartseq, - hdr->hdr_restart.hdr_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - hdr->hdr_restart.hdr_jobid, hdr->hdr_restart.hdr_vpid, - (NULL == ompi_proc->super.proc_hostname) ? "unknown" : ompi_proc->super.proc_hostname); - mca_pml_bfo_recv_request_rndvrestartnack(des, ompi_proc, false); - return; - } - - /* We know that we have the correct receive request. Make sure this is not - * a duplicate RNDVRESTARTNOTIFY on this request. */ - if (hdr->hdr_restart.hdr_restartseq == recvreq->req_restartseq) { - opal_output_verbose(20, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: received duplicate: dropping RNDVRESTARTNOTIFY " - "message PML:req=%d,hdr=%d CTX:req=%d,hdr=%d SRC:req=%d,hdr=%d " - "RQS:req=%d,hdr=%d src_req=%p, dst_req=%p, peer=%d", - (uint16_t)recvreq->req_msgseq, hdr->hdr_match.hdr_seq, - recvreq->req_recv.req_base.req_comm->c_contextid, hdr->hdr_match.hdr_ctx, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - hdr->hdr_match.hdr_src, recvreq->req_restartseq, - hdr->hdr_restart.hdr_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - return; - } - - /* Increment restart number. */ - recvreq->req_restartseq++; - recvreq->req_errstate |= RECVREQ_RNDVRESTART_RECVED; - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: received: outstanding receive events=%d, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_events, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - if (0 == recvreq->req_events) { - mca_pml_bfo_recv_request_rndvrestartack(recvreq, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY, - OMPI_SUCCESS, btl); - } - - return; -} - -/** - * Callback for when a RNDVRESTARTACK message is received. This - * message is sent from the receiver to the sender to acknowledge - * the receipt of the RNDVRESTARTNOTIFY message. At this point, - * the sender can reset the send request and restart the message. - */ -void mca_pml_bfo_recv_frag_callback_rndvrestartack(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_send_request_t* sendreq; - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK); - sendreq = (mca_pml_bfo_send_request_t*)hdr->hdr_restart.hdr_src_req.pval; - - /* Check to see if we have received a duplicate message. The - * first three comparisons make sure that we are not looking at a - * recycled request. The last check makes sure we are not getting - * a duplicate message for this specific request. All of this is - * needed because the receiver might get an error and repost the - * RNDVRESTARTACK message, but the RNDVRESTARTACK was actually received. */ - if ((hdr->hdr_match.hdr_ctx != sendreq->req_send.req_base.req_comm->c_contextid) || - (hdr->hdr_match.hdr_src != sendreq->req_send.req_base.req_peer) || - (hdr->hdr_match.hdr_seq != (uint16_t)sendreq->req_send.req_base.req_sequence) || - (hdr->hdr_restart.hdr_restartseq != sendreq->req_restartseq)) { - opal_output_verbose(20, mca_pml_bfo_output, - "RNDVRESTARTACK: received: does not match request, dropping " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d EXP:exp=%d,act=%d " - "src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, hdr->hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, hdr->hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_peer, hdr->hdr_match.hdr_src, - sendreq->req_restartseq, hdr->hdr_restart.hdr_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - return; - } - - sendreq->req_restart++; - if (2 == sendreq->req_restart) { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTACK: received: restarting send " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - hdr->hdr_match.hdr_seq, hdr->hdr_restart.hdr_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - mca_pml_bfo_send_request_restart(sendreq, false, 0); - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTACK received: waiting for RNDVRESTARTNOTIFY completion " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - hdr->hdr_match.hdr_seq, hdr->hdr_restart.hdr_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - } - return; -} - - -/** - * Callback for when a RECVERRNOTIFY message is received. This message - * is sent from the receiver to the sender and tells the sender that - * the receiver has seen an error. This will trigger the sender - * to start the request restart sequence. - */ -void mca_pml_bfo_recv_frag_callback_recverrnotify(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_send_request_t* sendreq; - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY); - sendreq = (mca_pml_bfo_send_request_t*)hdr->hdr_restart.hdr_src_req.pval; - - /* First make sure that this message is pointing to a valid request. - * This can be determined if the communicator context, the source of - * the message, and the MPI sequence number all match. */ - if ((hdr->hdr_match.hdr_ctx != sendreq->req_send.req_base.req_comm->c_contextid) || - (hdr->hdr_match.hdr_src != sendreq->req_send.req_base.req_peer) || - (hdr->hdr_match.hdr_seq != (uint16_t)sendreq->req_send.req_base.req_sequence)) { - opal_output_verbose(20, mca_pml_bfo_output, - "RECVERRNOTIFY: received: does not match request, dropping " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d RQS:exp=%d,act=%d " - "src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, hdr->hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, hdr->hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_peer, hdr->hdr_match.hdr_src, - sendreq->req_restartseq, hdr->hdr_restart.hdr_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - return; - } - - /* If a good ACK was never received, then the first ACK received - * might be a RECVERRNOTIFY message. In that case, the sendreq does not - * have a valid req_recv pointer in it. Therefore, check for that - * case and update the field in the sendreq if necessary. */ - if (NULL == sendreq->req_recv.pval) { - sendreq->req_recv = hdr->hdr_restart.hdr_dst_req; - } - - /* Now check to see a restart needs to be issued. The request - * sequence number in the header is compared against the current - * request sequence number in the send request. If the header - * sequence number is greater than or equal to the send request - * number, then a rndvrestartnotify is issued. There are some cases - * where a few extra rndvrestartnotifys are issued. That is OK as - * it will all work itself out. The idea is to prevent many - * restarts unnecessarily. This still allows multiple restarts to - * happen. It could be that sometime later another error occurs - * which initiates a restart. That is OK as it will have the new - * sequence number and all is well. */ - if (hdr->hdr_restart.hdr_restartseq >= sendreq->req_restartseq) { - assert(sendreq->req_send.req_base.req_ompi.req_state == OMPI_REQUEST_ACTIVE); - sendreq->req_error++; - opal_output_verbose(30, mca_pml_bfo_output, - "RECVERRNOTIFY: received: sendreq has error, outstanding events=%d, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - sendreq->req_events, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - - if (0 == sendreq->req_events) { - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, false, - MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY, - OMPI_SUCCESS, btl); - } - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "RECVERRNOTIFY: received: error has already been noted, ignoring " - "PML:exp=%d,act=%d RQS:exp=%d,act=%d src_req=%p, dst_req=%p, peer=%d", - sendreq->req_restartseq, hdr->hdr_restart.hdr_restartseq, - (uint16_t)sendreq->req_send.req_base.req_sequence, hdr->hdr_match.hdr_seq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - } - return; -} - -/** - * Callback for when a RNDVRESTARTNACK message is received. This message - * is sent from the receiver to the sender and tells the sender that - * the receiver has already completed the message and there is nothing - * else to be done. The sender should then just make the send request - * complete. - */ -void mca_pml_bfo_recv_frag_callback_rndvrestartnack(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_send_request_t* sendreq; - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK); - sendreq = (mca_pml_bfo_send_request_t*)hdr->hdr_restart.hdr_src_req.pval; - - /* Not convinced a RNDVRESTARTNACK that does not match a request can - * happen, but have the check in here anyways for now */ - if ((hdr->hdr_match.hdr_ctx != sendreq->req_send.req_base.req_comm->c_contextid) || - (hdr->hdr_match.hdr_src != sendreq->req_send.req_base.req_peer) || - (hdr->hdr_match.hdr_seq != (uint16_t)sendreq->req_send.req_base.req_sequence) || - (hdr->hdr_restart.hdr_restartseq != sendreq->req_restartseq)) { - opal_output_verbose(20, mca_pml_bfo_output, - "RNDVRESTARTNACK: received: does not match request, dropping " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d EXP:exp=%d,act=%d " - "src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, hdr->hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, hdr->hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_peer, hdr->hdr_match.hdr_src, - sendreq->req_restartseq, hdr->hdr_restart.hdr_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - return; - } - - opal_output_verbose(20, mca_pml_bfo_output, - "RNDVRESTARTNACK: received: marking send request as complete " - "PML=%d CTX=%d SRC=%d EXP=%d " - "src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_peer, sendreq->req_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - /* Mark the sender complete. This data exchange is over. */ - send_request_pml_complete(sendreq); - return; -} - - -/** - * This function gets called when failover is enabled and an error - * occurs during the rendezvous protocol. A message is sent to the - * receiving side notifying the request that the communication is - * going to be starting over. However, none of the information in the - * send request is reset yet, so that any in flight fragments can - * still find a home. Information in the send request gets reset when - * the completion event for this send occurs AND an ACK has been - * received back from the receiver. - */ -void mca_pml_bfo_send_request_rndvrestartnotify(mca_pml_bfo_send_request_t* sendreq, - bool repost, mca_btl_base_tag_t tag, - int status, mca_btl_base_module_t* btl) -{ - mca_btl_base_descriptor_t* des; - mca_pml_bfo_restart_hdr_t* restart; - int rc; - mca_bml_base_btl_t* bml_btl; - ompi_proc_t* proc = (ompi_proc_t*)sendreq->req_send.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - /* If this message is not a repost, then update the sequence number. */ - if (!repost) { - /* Bump up the rendezvous request sequence number. */ - sendreq->req_restartseq++; - } - - assert(0 == sendreq->req_events); - assert(0 != bml_endpoint->btl_eager.arr_size); - - /* In the case that this is started because the receiver has - * sent us a message, then attempt to use a different BTL than the - * error message was received on. This may potentially tickle the - * error sooner if this side has not seen it yet. */ - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - if (bml_btl->btl == btl) { - /* If there is more than one BTL left, then we will get a - * different one. If there is only one, we will just get - * the same one back again. That is OK. */ - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - } - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_restart_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - if( OPAL_UNLIKELY(NULL == des) ) { - opal_output(0, "%s:%d Our of resources, cannot proceed", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - - /* fill out header */ - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - restart->hdr_match.hdr_common.hdr_flags = 0; - restart->hdr_match.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY; - restart->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - restart->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - restart->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - restart->hdr_restartseq = sendreq->req_restartseq; - restart->hdr_src_req.pval = sendreq; - restart->hdr_dst_req = sendreq->req_recv; - restart->hdr_dst_rank = sendreq->req_send.req_base.req_peer; /* Needed for NACKs */ - restart->hdr_jobid = OMPI_PROC_MY_NAME->jobid; - restart->hdr_vpid = OMPI_PROC_MY_NAME->vpid; - - bfo_hdr_hton(restart, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY, proc); - - /* initialize descriptor */ - des->des_cbfunc = mca_pml_bfo_rndvrestartnotify_completion; - - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: sent: PML=%d, RQS(new)=%d, CTX=%d, SRC=%d, " - "src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, sendreq->req_restartseq, - restart->hdr_match.hdr_ctx, restart->hdr_match.hdr_src, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY); - if( OPAL_UNLIKELY( rc < 0 ) ) { - opal_output(0, "[%s:%d] Cannot send rndvrestartnotify message", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - -} - -/** - * This function restarts a RNDV send request. When this is called, - * all the fields in the send request are reset and the send is - * started over. The sendreq->req_restartseq will be non-zero which will - * trigger a special flag in the RNDV header which indicates the match - * has already happened on the receiving side. - */ -void mca_pml_bfo_send_request_restart(mca_pml_bfo_send_request_t* sendreq, - bool repost, mca_btl_base_tag_t tag) -{ - size_t offset = 0; - opal_list_item_t *first_item; - opal_list_item_t *last_item; - mca_bml_base_endpoint_t* endpoint; - size_t i; - - /* If the tag is something valid, it was a repost. We could also - * check the repost field as well. Maybe I can drop the - * repost and have the tag double as it. */ - switch (tag) { - case MCA_PML_BFO_HDR_TYPE_RNDV: - opal_output_verbose(30, mca_pml_bfo_output, - "RNDV: completion failed, reset and repost: PML=%d, RQS=%d, " - "CTX=%d, SRC=%d, src_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, sendreq->req_restartseq, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_comm->c_my_rank, (void *)sendreq, - sendreq->req_send.req_base.req_peer); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - opal_output_verbose(30, mca_pml_bfo_output, - "RGET: completion failed, reset and repost: PML=%d, RQS=%d, " - "CTX=%d, SRC=%d, src_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, sendreq->req_restartseq, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_comm->c_my_rank, (void *)sendreq, - sendreq->req_send.req_base.req_peer); - break; - default: - break; - } - - /* Return mpool resources, they get reacquired when request starts over. */ - mca_pml_bfo_free_rdma_resources(sendreq); - - /* Release any memory in use if this is a buffered send */ - if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED && - sendreq->req_send.req_addr != sendreq->req_send.req_base.req_addr) { - mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq); - } - - /* Clear out any unsent send ranges. Recreate the functionality - * from the get_send_range() and get_next_send_range() functions. */ - OPAL_THREAD_LOCK(&sendreq->req_send_range_lock); - first_item = opal_list_get_begin(&sendreq->req_send_ranges); - last_item = opal_list_get_last(&sendreq->req_send_ranges); - while (first_item != last_item) { - opal_list_remove_item(&sendreq->req_send_ranges, last_item); - OMPI_FREE_LIST_RETURN_MT(&mca_pml_bfo.send_ranges, (ompi_free_list_item_t *)last_item); - last_item = opal_list_get_last(&sendreq->req_send_ranges); - } - OPAL_THREAD_UNLOCK(&sendreq->req_send_range_lock); - - /* Reset the converter to the beginning. */ - opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, - &offset); - - /* Bump up internal sequence number to handle possible duplicate - * RNDV messages. In the case of reposting a RNDV message, do not - * increment the value. That way, a duplicate message can be - * detected. */ - if (!repost) { - sendreq->req_restartseq++; - } - - /* This code here is essentially the same is mca_pml_bfo_send_request_start() - * but with a few modifications since we are restarting the request, not - * starting entirely from scratch. */ - endpoint = (mca_bml_base_endpoint_t*)sendreq->req_send.req_base.req_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - sendreq->req_endpoint = endpoint; - sendreq->req_state = 0; - sendreq->req_lock = 0; - sendreq->req_pipeline_depth = 0; - sendreq->req_bytes_delivered = 0; - sendreq->req_pending = MCA_PML_BFO_SEND_PENDING_NONE; - - /* Note that we do not reset the following three items. - * They stay with their original values. - * sendreq->req_send.req_base.req_sequence - * sendreq->req_restartseq - * sendreq->req_recv.pval - */ - sendreq->req_restart = 0; /* reset in case we restart again */ - sendreq->req_error = 0; /* clear error state */ - sendreq->req_events = 0; /* clear events, probably 0 anyways */ - - MCA_PML_BASE_SEND_START( &sendreq->req_send.req_base ); - - for(i = 0; i < mca_bml_base_btl_array_get_size(&endpoint->btl_eager); i++) { - mca_bml_base_btl_t* bml_btl; - int rc; - - /* select a btl */ - bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); - rc = mca_pml_bfo_send_request_start_btl(sendreq, bml_btl); - if(OPAL_LIKELY(OMPI_ERR_OUT_OF_RESOURCE != rc)) - return; - } - add_request_to_send_pending(sendreq, MCA_PML_BFO_SEND_PENDING_START, true); -} - -/** - * This function will repost a match fragment. This function has to - * handle the case where there may not be a request associated with - * the fragment and just use the information in the fragment to - * repost the send. - */ -void mca_pml_bfo_repost_match_fragment(struct mca_btl_base_descriptor_t* des) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - struct mca_bml_base_endpoint_t* endpoint; - int rc; - size_t offset = 0; - - /* At this point a determination has to be made whether the - * BFO_HDR_TYPE_MATCH fragment was sent via the sendi interface or - * via the regular send interface. This is important because if it - * was sent via the sendi interface, then the request associated - * with it has already been completed and released. This can be - * determined by looking at the des->des_flags field of the - * descriptor. If the ALWAYS_CALLBACK flag is set then it is known - * that there is a valid send request associated with the fragment - * and it can be used to extricate information. If ALWAYS_CALLBACK - * is not set, then the endpoint information is in the callback - * data field and where to resend the fragment can be determined - * from the fragment. */ - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - endpoint = sendreq->req_endpoint; - opal_output_verbose(30, mca_pml_bfo_output, - "MATCH: repost: src_req=%p", - (void *)sendreq); - } else { - endpoint = des->des_cbdata; - opal_output_verbose(30, mca_pml_bfo_output, - "MATCH: repost: des=%p (sendi fragment)", - (void *)des); - } - - assert(0 != endpoint->btl_eager.arr_size); - bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); - - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - /* Reset the converter to the beginning if the message is - * not a zero-length message. In the case of zero-length - * message, the convertor is not being used. */ - if (0 != sendreq->req_send.req_bytes_packed) { - opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, - &offset); - } - rc = mca_pml_bfo_send_request_start_btl(sendreq, bml_btl); - if (OMPI_SUCCESS == rc) { - return; - } else if (OMPI_ERR_OUT_OF_RESOURCE == rc) { - opal_output_verbose(30, mca_pml_bfo_output, - "Warning: delaying reposting of BFO_HDR_TYPE_MATCH, btls=%d", - (int)sendreq->req_endpoint->btl_eager.arr_size); - add_request_to_send_pending(sendreq, MCA_PML_BFO_SEND_PENDING_START, true); - return; - } else { - opal_output(0, "%s:%d FATAL ERROR, cannot repost BFO_HDR_TYPE_MATCH", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - } else { - /* No send request available so alloc and repost explicitly */ - mca_btl_base_descriptor_t* newdes = NULL; - mca_btl_base_segment_t* oldseg; - mca_btl_base_segment_t* newseg; - - oldseg = des->des_local; - /* The alloc routine must be called with the MCA_BTL_NO_ORDER - * flag so that the allocation routine works. The allocation - * will fill in the order flag in the descriptor. */ - mca_bml_base_alloc( bml_btl, &newdes, - MCA_BTL_NO_ORDER, - oldseg->seg_len, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - if (OPAL_UNLIKELY(NULL == newdes)) { - opal_output(0, "%s:%d FATAL ERROR, cannot repost BFO_HDR_TYPE_MATCH", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - newseg = newdes->des_local; - /* Copy over all the data that is actually sent over the wire */ - memcpy(newseg->seg_addr.pval, oldseg->seg_addr.pval, oldseg->seg_len); - newseg->seg_len = oldseg->seg_len; - - /* This call will either return OMPI_SUCCESS or OMPI_ERROR. The - * OMPI_SUCCESS only says that the send request can be freed. - * It may be that the message was queued up in the BTL. */ - rc = mca_bml_base_send(bml_btl, newdes, MCA_PML_BFO_HDR_TYPE_MATCH); - - /* Some BTLs will set the CALLBACK flag but we do not want that - * as there is no longer a request associated with this descriptor. - * Therefore, always make sure it is cleared. */ - newdes->des_flags &= ~MCA_BTL_DES_SEND_ALWAYS_CALLBACK; - - if( OPAL_LIKELY( rc >= 0 )) { - /* Just let the normal flow of data free whatever needs - * to be freed */ - return; - } else { - opal_output(0, "%s:%d FATAL ERROR, cannot repost BFO_HDR_TYPE_MATCH", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - } - /* No need to free any descriptors. The BTLs take care of it since - * we originally allocated with MCA_BTL_DES_FLAGS_BTL_OWNERSHIP. */ -} - -/** - * Completion callback for rndvrestartnotify completion event. If the - * RNDVRESTARTACK has already been received, then reset and restart. - * Otherwise, just update the state and let the RNDVRESTARTACK trigger - * the reset and restart. - */ -void -mca_pml_bfo_rndvrestartnotify_completion(mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status) -{ - mca_pml_bfo_restart_hdr_t* restart; - mca_pml_bfo_send_request_t* sendreq; - - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - sendreq = (mca_pml_bfo_send_request_t*) restart->hdr_src_req.pval; - - /* Need to resend this message in the case that it fails */ - if( OPAL_UNLIKELY((OMPI_SUCCESS != status))) { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: completion failed: repost " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, - (void *)sendreq, sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - /* Repost the message and indicate it is a repost, not a new one. No need - * to check the req_events as this is the only possible outstanding send - * event when we have posted this message. We also know the sendreq is still - * available because nothing can proceed until this completion event happens - * successfully as we track the req_restart value. */ - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, true, - MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY, - status, btl); - return; - } - - /* The req_restart value is incremented to indicate completion of - * the RNDVRESTARTNOTIFY message. Then (typically) the arrival of the - * ACK message will cause the request to reset and restart. Need to - * make sure that RNDVRESTARTNOTIFY callback has been called as well as - * the ACK back from the receiver prior to resetting and restarting - * the request. This is needed in case we get an error on the - * RNDVRESTARTNOTIFY message, but it actually makes it over. We want - * to make sure the send request has not restarted yet. So, keep a - * counter that counts to 2. */ - sendreq->req_restart++; - if (2 == sendreq->req_restart) { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: completion: restarting request " - "PML=%d, RQS=%d, CTX=%d, src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_recv.pval, (void *)sendreq, - sendreq->req_send.req_base.req_peer); - mca_pml_bfo_send_request_restart(sendreq, false, 0); - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNOTIFY: completion: waiting for ack " - "PML=%d, RQS=%d, CTX=%d, src_req=%p, dst_req=%p, peer=%d", - (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_recv.pval, (void *)sendreq, - sendreq->req_send.req_base.req_peer); - } -} - -/** - * This function is called when an error is detected on a completion - * event on the receiving side. This can come from a ACK, PUT, RDMA - * read (GET) or RECVERRNOTIFY completion event. When this happens, check - * the state of the request and decide if the sender needs be notified - * that a problem was seen. If no RECVERRNOTIFY message has been sent and - * no RNDVRESTARTNOTIFY has been received from the sender, then send a - * message telling the sender an error was seen. - */ -void mca_pml_bfo_recv_request_recverrnotify(mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_tag_t tag, int status) -{ - mca_btl_base_descriptor_t* des; - mca_pml_bfo_restart_hdr_t* restart; - ompi_proc_t* proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - mca_bml_base_btl_t* bml_btl; - int rc; - - assert(0 != bml_endpoint->btl_eager.arr_size); - - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_restart_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - if( OPAL_UNLIKELY(NULL == des) ) { - opal_output(0, "%s:%d Out of resources, cannot proceed", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - - /* fill out header */ - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - restart->hdr_match.hdr_common.hdr_flags = 0; - restart->hdr_match.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY; - restart->hdr_match.hdr_ctx = recvreq->req_recv.req_base.req_comm->c_contextid; - restart->hdr_match.hdr_src = recvreq->req_recv.req_base.req_comm->c_my_rank; - restart->hdr_match.hdr_seq = (uint16_t)recvreq->req_msgseq; - restart->hdr_restartseq = recvreq->req_restartseq; - restart->hdr_src_req = recvreq->remote_req_send; - restart->hdr_dst_req.pval = recvreq; - - bfo_hdr_hton(restart, MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY, proc); - - /* initialize descriptor */ - des->des_cbfunc = mca_pml_bfo_recv_restart_completion; - - opal_output_verbose(30, mca_pml_bfo_output, - "RECVERRNOTIFY: sending to sender, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d, btl=%p", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, - (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - (void *)bml_btl->btl); - - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY); - if( OPAL_UNLIKELY( rc < 0 ) ) { - opal_output(0, "[%s:%d] Cannot send recverrnotify message", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - /* Prevent future error messages on this request */ - recvreq->req_errstate |= RECVREQ_RECVERRSENT; -} - -/** - * This function is called when it may be time to send a RNDVRESTARTACK - * message back to the sending side. This can happen because we - * received a RNDVRESTARTNOTIFY message from the sender. This can - * also happen if we have noticed that the request has received the - * RNDVRESTARTNOTIFY message, but has not yet sent out the RNDVRESTARTACK - * because there were still some pending receive events on the request. - * That means we can enter this routine from a completion event on a ACK, - * PUT, or RDMA read as well as from the receipt of a RNDVRESTARTNOTIFY - * message. If all is good, we sent the RNDVRESTARTACK message back to - * the sender. Then sometime later a message will arrive telling us - * to reset and restart the receive request. - */ -void mca_pml_bfo_recv_request_rndvrestartack(mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_tag_t tag, int status, - mca_btl_base_module_t* btl) -{ - mca_btl_base_descriptor_t* des; - mca_pml_bfo_restart_hdr_t* restart; - ompi_proc_t* proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - mca_bml_base_btl_t* bml_btl; - int rc; - - assert((recvreq->req_errstate & RECVREQ_RNDVRESTART_RECVED) == RECVREQ_RNDVRESTART_RECVED); - assert((recvreq->req_errstate & RECVREQ_RNDVRESTART_ACKED) == 0); - assert(0 != bml_endpoint->btl_eager.arr_size); - - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - - /* Attempt to use a different BTL than the error message was - * received on. This may potentially tickle the error sooner if - * this side has not seen it yet. */ - if (bml_btl->btl == btl) { - /* If there is more than one BTL left, then we will get a - * different one. If there is only one, we will just get - * the same one back again. That is OK. */ - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - } - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_restart_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - if( OPAL_UNLIKELY(NULL == des) ) { - opal_output(0, "%s:%d Out of resources, cannot proceed", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - - /* fill out header */ - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - restart->hdr_match.hdr_common.hdr_flags = 0; - restart->hdr_match.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK; - restart->hdr_match.hdr_ctx = recvreq->req_recv.req_base.req_comm->c_contextid; - restart->hdr_match.hdr_src = recvreq->req_recv.req_base.req_comm->c_my_rank; - restart->hdr_match.hdr_seq = (uint16_t)recvreq->req_msgseq; - restart->hdr_restartseq = recvreq->req_restartseq; - restart->hdr_src_req = recvreq->remote_req_send; - restart->hdr_dst_req.pval = recvreq; - - bfo_hdr_hton(restart, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK, proc); - - /* initialize descriptor */ - des->des_cbfunc = mca_pml_bfo_recv_restart_completion; - des->des_cbdata = (void *)proc; - - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTACK: due to PML tag=%d completion, sending to " - "sender, PML=%d, RQS=%d, src_req=%p, dst_req=%p, status=%d, " - "peer=%d, btl=%p", - tag, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, status, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, - (void *)bml_btl->btl); - - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK); - if( OPAL_UNLIKELY( rc < 0 ) ) { - opal_output(0, "[%s:%d] Cannot send rndvrestartack message", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - /* Move to the next state so we do not send anymore ACKs */ - recvreq->req_errstate &= ~RECVREQ_RNDVRESTART_RECVED; - recvreq->req_errstate |= RECVREQ_RNDVRESTART_ACKED; -} - -/** - * Called after the receipt of a RNDVRESTARTNOTIFY message to a request - * that no longer matches. This can happen if the sender detected an - * error, but the receiver actually received all the data. Therefore - * send a NACK back instead of the ACK so that the sender can complete - * its request. This happens very rarely. Note that we need to make - * use of the hdr_dst_rank that we received from the notify message. - * This is so the sending side make sure the message matches a valid - * request on the sending side. - */ -void mca_pml_bfo_recv_request_rndvrestartnack(mca_btl_base_descriptor_t* olddes, - ompi_proc_t* ompi_proc, bool repost) -{ - mca_btl_base_segment_t* segments; - mca_pml_bfo_restart_hdr_t* hdr; /* hdr of NOTIFY message */ - mca_pml_bfo_restart_hdr_t* nack; /* hdr of NACK message */ - mca_btl_base_descriptor_t* des; - mca_bml_base_endpoint_t* bml_endpoint; - mca_bml_base_btl_t* bml_btl; - int rc; - - if (repost) { - /* In the case where we are reposting the NACK, the information - * is in the src area, since we are reposting a send. In addition, - * we get the ompi_proc from the old descriptor. */ - ompi_proc = olddes->des_cbdata; - } - - segments = olddes->des_local; - hdr = (mca_pml_bfo_restart_hdr_t*)segments->seg_addr.pval; - - bml_endpoint = ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - assert(0 != bml_endpoint->btl_eager.arr_size); - bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_restart_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - if( OPAL_UNLIKELY(NULL == des) ) { - opal_output(0, "%s:%d Out of resources, cannot proceed", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - - /* fill out header */ - nack = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - nack->hdr_match.hdr_common.hdr_flags = 0; - nack->hdr_match.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK; - nack->hdr_match.hdr_ctx = hdr->hdr_match.hdr_ctx; - nack->hdr_match.hdr_src = hdr->hdr_dst_rank; /* Receiver rank */ - nack->hdr_match.hdr_seq = hdr->hdr_match.hdr_seq; - nack->hdr_restartseq = hdr->hdr_restartseq; - nack->hdr_src_req = hdr->hdr_src_req; - nack->hdr_dst_req.pval = 0; - - bfo_hdr_hton(nack, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK, ompi_proc); - - /* Initialize descriptor. Save away ompi_proc in case we need - * to respost this fragmnet. */ - des->des_cbfunc = mca_pml_bfo_recv_restart_completion; - des->des_cbdata = ompi_proc; - - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNACK: sending to sender, " - "PML=%d, RQS=%d, CTX=%d, SRC=%d, peer=%d", - nack->hdr_match.hdr_seq, nack->hdr_restartseq, - nack->hdr_match.hdr_ctx, nack->hdr_match.hdr_src, - OMPI_CAST_RTE_NAME(&ompi_proc->super.proc_name)->vpid); - - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK); - if( OPAL_UNLIKELY( rc < 0 ) ) { - opal_output(0, "[%s:%d] Cannot send rndvrestartnack message", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } -} - - -/** - * Reset all the receive request fields to match what a request - * looks like when it is first started. This gets called when - * the rendezvous/rget message is being restarted. - */ -void mca_pml_bfo_recv_request_reset(mca_pml_bfo_recv_request_t* match) { - int i; - - assert(true != match->req_recv.req_base.req_pml_complete); - - /* Free up any resources that were reserved for this receive. This - * was copied from the receive completion code. */ - for(i = 0; i < (int)match->req_rdma_cnt; i++) { - mca_mpool_base_registration_t* btl_reg = match->req_rdma[i].btl_reg; - if( NULL != btl_reg && btl_reg->mpool != NULL) { - btl_reg->mpool->mpool_deregister( btl_reg->mpool, btl_reg ); - } - } - match->req_rdma_cnt = 0; - - /* This code is mostly copied from mca_pml_bfo_recv_req_start. - * Note 1: Leave req_bytes_expected as the original value. No - * need to adjust this as it is set when convertor is created. - * Note 2: Leave req_bytes_delivered as the original value. - * This is created when the convertor is created and represents - * the expected bytes from the user. */ - assert(0 == match->req_events); - match->req_errstate = 0; - match->req_lock = 0; - match->req_pipeline_depth = 0; - match->req_bytes_received = 0; - match->req_rdma_idx = 0; - match->req_rdma_offset = 0; - match->req_send_offset = 0; - match->req_pending = false; - match->req_ack_sent = false; - match->req_restartseq++; - - /* These really should not need to be set, but this matches some - * of the initialization within MCA_PML_BASE_RECV_START. */ - match->req_recv.req_base.req_pml_complete = false; - match->req_recv.req_base.req_ompi.req_complete = false; - match->req_recv.req_base.req_ompi.req_state = OMPI_REQUEST_ACTIVE; - - /* Reset the convertor */ - opal_convertor_set_position(&match->req_recv.req_base.req_convertor, - &match->req_rdma_offset); - return; -} - -/* - * Completion callback for RNDVRESTARTACK, RNDVRESTARTNACK and RECVERRNOTIFY. - */ -void mca_pml_bfo_recv_restart_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - if(OPAL_UNLIKELY(OMPI_SUCCESS != status)) { - mca_pml_bfo_common_hdr_t* common = des->des_local->seg_addr.pval; - mca_pml_bfo_restart_hdr_t* restart; /* RESTART header */ - mca_pml_bfo_recv_request_t* recvreq; - - switch (common->hdr_type) { - case MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK: - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - recvreq = (mca_pml_bfo_recv_request_t*) restart->hdr_dst_req.pval; - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTACK: completion failed: try again " - "PML:req=%d,hdr=%d RQS:req=%d,hdr=%d CTX:req=%d,hdr=%d " - "src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, restart->hdr_match.hdr_seq, - recvreq->req_restartseq, restart->hdr_restartseq, - recvreq->req_recv.req_base.req_comm->c_contextid, - restart->hdr_match.hdr_ctx, - recvreq->remote_req_send.pval, - (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - /* Adjust the states back to avoid assert errors */ - recvreq->req_errstate &= ~RECVREQ_RNDVRESTART_ACKED; - recvreq->req_errstate |= RECVREQ_RNDVRESTART_RECVED; - mca_pml_bfo_recv_request_rndvrestartack(recvreq, MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK, - status, btl); - break; - case MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK: - opal_output_verbose(30, mca_pml_bfo_output, - "RNDVRESTARTNACK: completion failed: try again " - "des=%p ", (void *)des); - /* Just blast it again. No request associated with it. */ - mca_pml_bfo_recv_request_rndvrestartnack(des, NULL, true); - break; - case MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY: - restart = (mca_pml_bfo_restart_hdr_t*)des->des_local->seg_addr.pval; - recvreq = (mca_pml_bfo_recv_request_t*) restart->hdr_dst_req.pval; - /* With just two BTLs, this should never happen as we are - * typically sending the RECVERRNOTIFY message on the - * working BTL. But, just in case, if we get an error, - * send it again. */ - opal_output_verbose(30, mca_pml_bfo_output, - "RECVERRNOTIFY: completion failed: try again, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, - (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY, - status); - break; - default: - opal_output(0, "[%s:%d] Unknown callback error", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - } -} - -/* - * Remove a btl for future communication on an endpoint. - */ -void mca_pml_bfo_map_out_btl(struct mca_btl_base_module_t* btl, - ompi_proc_t *errproc, char *btlname) -{ - mca_bml_base_endpoint_t* ep; - bool remove = false; - int i; - - ep = (mca_bml_base_endpoint_t*)errproc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - /* The bml_del_proc_btl function does not indicate if it - * actually removed a btl, so let me check up front. This is - * done so that we can only print out messages when a btl is - * actually going to be removed. These arrays are small so it - * is OK to walk through all of them even though it may be - * redundant. */ - for( i = 0; i < (int)ep->btl_eager.arr_size; i++ ) { - if( ep->btl_eager.bml_btls[i].btl == btl ) { - remove = true; - } - } - for( i = 0; i < (int)ep->btl_send.arr_size; i++ ) { - if( ep->btl_send.bml_btls[i].btl == btl ) { - remove = true; - } - } - for( i = 0; i < (int)ep->btl_rdma.arr_size; i++ ) { - if( ep->btl_rdma.bml_btls[i].btl == btl ) { - remove = true; - } - } - - if (true == remove) { - mca_bml.bml_del_proc_btl(errproc, btl); - - opal_output_verbose(10, mca_pml_bfo_output, - "BTL %s error: rank=%d mapping out %s " - "to rank=%d on node=%s \n", - btl->btl_component->btl_version.mca_component_name, - OMPI_PROC_MY_NAME->vpid, - btlname, OMPI_CAST_RTE_NAME(&errproc->super.proc_name)->vpid, - (NULL == errproc->super.proc_hostname) ? "unknown" : errproc->super.proc_hostname); - - /* Need to search for any pending packets associated - * with this endpoint and remove them. We may also - * have to restarts depending on the state of the - * requests. */ - mca_pml_bfo_error_pending_packets(btl, ep); - - if ((ep->btl_eager.arr_size == 0) && - (ep->btl_send.arr_size == 0) && - (ep->btl_rdma.arr_size == 0)) { - opal_output(0, "%s:%d: No more interfaces, aborting", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - } -} - -void mca_pml_bfo_failover_error_handler(struct mca_btl_base_module_t* btl, - int32_t flags, ompi_proc_t *errproc, char *btlname) -{ - ompi_proc_t** procs; - size_t p, num_procs; - - /* If we are in here, we know that the we were called - * with the flags == MCA_BTL_ERROR_FLAGS_NONFATAL so no - * need to check it in here. */ - assert(flags & MCA_BTL_ERROR_FLAGS_NONFATAL); - - procs = ompi_proc_all(&num_procs); - - if(NULL == procs) { - opal_output(0, "%s:%d: Out of memory, giving up.", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - - if (NULL == btlname) { - btlname = "unknown"; - } - - /* If the process to map out is not specified then map out the - * entire BTL. Otherwise, only map out the BTL for the specific - * remote process. */ - if (NULL == errproc) { - for( p = 0; p < num_procs; p++ ) { - mca_pml_bfo_map_out_btl(btl, procs[p], btlname); - } - } else { - mca_pml_bfo_map_out_btl(btl, errproc, btlname); - } - free(procs); -} - -/** - * This function is called since when we are mapping out a BML. This - * will walk through the four PML lists and dispatch with the - * fragments/requests. There are four different lists and each one is - * handled slighty differently. In all cases, we first see if the - * message is associated with the endpoint that is being mapped out. - * If not, then just leave it alone and put it back on the list. If - * it is associated with the endpoint, then a each list handles it - * slighlty differently. Also, in some cases, we actually adjust the - * pointers to the BMLs in the messages as they may have changed when - * the BML is mapped out. That is because this is called after we - * have mapped out the offending BML and adjusted the array of - * available BMLs. - */ -static void mca_pml_bfo_error_pending_packets(mca_btl_base_module_t* btl, - mca_bml_base_endpoint_t* ep) { - int32_t i, s; - - /* The pckt_pending list contains both ACK and FIN messages. - * ACKs can be sent over any BTL associated with the endpoint. - * Therefore, the bml_btl entry for ACKS is NULL and they do - * not need to be adjusted. It is also worth noting that - * the ACK will be the only outstanding message associated - * with a request so we can just let nature takes it course. - * - * FIN messages do have a BML associated with them, but they - * can also be sent over any BTL. Therefore, adjust the bml - * pointer in the pckt to ensure it points at a valid BML. - */ - - s = (int32_t)opal_list_get_size(&mca_pml_bfo.pckt_pending); - for(i = 0; i < s; i++) { - mca_pml_bfo_pckt_pending_t *pckt; - opal_output_verbose(0, mca_pml_bfo_output, - "INFO: pckt_pending list has %d entries", s); -#if 1 - /* TODO: Error out until code is tested */ - opal_output_verbose(0, mca_pml_bfo_output, - "%s:%d: Support not implemented, aborting", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - pckt = (mca_pml_bfo_pckt_pending_t*) - opal_list_remove_first(&mca_pml_bfo.pckt_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - /* My guess is that this can happen in the threaded - * case where the other thread removed some packets - * after we determined the size of the list. */ - if(NULL == pckt) - break; - - /* If there is no bml stored on the packet, then just - * put it back on the list as there is nothing to adjust. - * This appears to be true with ACK packets. */ - if (NULL == pckt->bml_btl) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.pckt_pending, - (opal_list_item_t*)pckt); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - /* Now see if this endpoint matches the one we are mapping - * out. If so, adjust the bml entry so to ensure it is - * not pointing at a stale bml. We do not really care - * which BML it is pointing at as long as it is valid. - * In either case, then put entry back on the list. */ - if (pckt->proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML] == ep) { - opal_output_verbose(15, mca_pml_bfo_output, - "INFO: Found matching pckt on pckt_pending list, adjusting bml"); - pckt->bml_btl = mca_bml_base_btl_array_get_next(&ep->btl_eager); - } - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.pckt_pending, - (opal_list_item_t*)pckt); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - } - - /* This next list holds rdma fragments. We need to walk through - * the list and see if any are associated with the endpoint - * we are mapping out. If not, then just put back on the - * list. If they are, then we need to error them out. One issue - * is that we need to deal with the case where there may be more - * then one pending rdma fragment for a request. */ - s = (int32_t)opal_list_get_size(&mca_pml_bfo.rdma_pending); - for(i = 0; i < s; i++) { - mca_pml_bfo_rdma_frag_t* frag; - mca_pml_bfo_send_request_t* sendreq; - mca_pml_bfo_recv_request_t* recvreq; - opal_output_verbose(0, mca_pml_bfo_output, - "INFO: rdma_pending list has %d entries", s); -#if 1 - /* TODO: Error out until code is tested */ - opal_output_verbose(0, mca_pml_bfo_output, - "%s:%d: Support not implemented, aborting", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - frag = (mca_pml_bfo_rdma_frag_t*) - opal_list_remove_first(&mca_pml_bfo.rdma_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - /* My guess is that this can happen in the threaded - * case where the other thread removed some packets - * after we determined the size of the list. */ - if(NULL == frag) - break; - - /* Check to see if it matches our endpoint. If it does, - * then check if it matches the BTL that is being mapped - * out. If it does not, then just readjust the BML pointer. - * If it does, then we need to do something with it. */ - if (frag->rdma_ep != ep) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, - (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - /* If we are here, then we know we are working on the same - * endpoint. Now check the BTL. */ - if (frag->rdma_btl != btl) { - opal_output_verbose(15, mca_pml_bfo_output, - "INFO: Found matching frag on rdma_pending list, adjusting bml"); - /* The BTL this RDMA is associated with is not the - * one that is getting mapped out, so just adjust the - * BML pointer and put back on the list. */ - frag->rdma_bml = mca_bml_base_btl_array_find(&ep->btl_rdma, frag->rdma_btl); - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, - (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - /* Now we call the restart routine. This is just like if we got - * a completion event after calling an RDMA write. This will - * take care of figuring out if we need to restart the request - * or wait for any outstanding events to complete. */ - if(frag->rdma_state == MCA_PML_BFO_RDMA_PUT) { - opal_output_verbose(15, mca_pml_bfo_output, - "INFO: Found matching PUT frag on rdma_pending list, restarting"); - sendreq = frag->rdma_req; - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, false, - MCA_PML_BFO_HDR_TYPE_PUT, 2, btl); - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); - } else { - opal_output_verbose(15, mca_pml_bfo_output, - "INFO: Found matching RGET frag on rdma_pending list, sending reqerror"); - /* This is just like what we do on an rget completion event */ - recvreq = (mca_pml_bfo_recv_request_t*)frag->rdma_req; - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_RGET, 2); - - /* See if the request has received a RNDVRESTARTNOTIFY */ - if( OPAL_UNLIKELY(recvreq->req_errstate)) { - if (recvreq->req_errstate & RECVREQ_RNDVRESTART_RECVED) { - mca_pml_bfo_recv_request_rndvrestartack(recvreq, - MCA_PML_BFO_HDR_TYPE_RGET, - 2, btl); - } - } - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); - } - } - - s = opal_list_get_size(&mca_pml_bfo.send_pending); - /* Look for pending events on our endpoint */ - for(i = 0; i < s; i++) { - mca_pml_bfo_send_request_t* sendreq; - ompi_proc_t* proc; - mca_bml_base_endpoint_t* bml_endpoint; - opal_output_verbose(0, mca_pml_bfo_output, - "INFO: send_pending list has %d entries", s); -#if 1 - /* TODO: Error out until code is tested */ - opal_output_verbose(0, mca_pml_bfo_output, - "%s:%d: Support not implemented, aborting", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - sendreq = (mca_pml_bfo_send_request_t*) - opal_list_remove_first(&mca_pml_bfo.send_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - /* My guess is that this can happen in the threaded - * case where the other thread removed some packets - * after we determined the size of the list. */ - if(NULL == sendreq) - break; - - proc = (ompi_proc_t*)sendreq->req_send.req_base.req_proc; - bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - /* Check to see if it matches our endpoint. If it does not, - * then just put it back on the list as there is nothing - * we need to do with it. */ - if (bml_endpoint != ep) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.send_pending, - (opal_list_item_t*)sendreq); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - switch(sendreq->req_pending) { - case MCA_PML_BFO_SEND_PENDING_SCHEDULE: - /* If this send request is using the endpoint that received - * the error, then let us error it out. In the case - * where there is only one fragment left to be scheduled - * and it would have gone over the good BTL, this is - * not necessary. But, we will use simplicity here - * and assume that some of the fragments are still - * scheduled to go over the broken BTL. */ - sendreq->req_error++; - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, false, - MCA_PML_BFO_HDR_TYPE_FRAG, 2, btl); - break; - case MCA_PML_BFO_SEND_PENDING_START: - /* If the request has not even started, then just put it back - * on the list. Nothing else to do with it. */ - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.send_pending, - (opal_list_item_t*)sendreq); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - break; - default: - opal_output(0, "[%s:%d] wrong send request type\n", - __FILE__, __LINE__); - break; - } - } - - s = (int)opal_list_get_size(&mca_pml_bfo.recv_pending); - for(i = 0; i < s; i++) { - mca_pml_bfo_recv_request_t* recvreq; - ompi_proc_t* proc; - mca_bml_base_endpoint_t* bml_endpoint; - opal_output_verbose(0, mca_pml_bfo_output, - "INFO: recv_pending list has %d entries", s); -#if 1 - /* TODO: Error out until code is tested */ - opal_output_verbose(0, mca_pml_bfo_output, - "%s:%d: Support not implemented, aborting", - __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - recvreq = (mca_pml_bfo_recv_request_t*) - opal_list_remove_first(&mca_pml_bfo.recv_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - /* My guess is that this can happen in the threaded - * case where the other thread removed some packets - * after we determined the size of the list. */ - if(NULL == recvreq) - break; - - proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - if (bml_endpoint != ep) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.recv_pending, - (opal_list_item_t*)recvreq); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - continue; - } - - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_PUT, 2); - } -} - -/** - * Call each time we get a completion event on ACK or PUT message. - * These types of messages are receive control type messages. This - * function is only called if the underlying BTL supports failover. - * Otherwise, there is no need for this check. - */ -void mca_pml_bfo_check_recv_ctl_completion_status(mca_btl_base_module_t* btl, - struct mca_btl_base_descriptor_t* des, - int status) -{ - mca_pml_bfo_common_hdr_t * common = des->des_local->seg_addr.pval; - mca_pml_bfo_rdma_hdr_t* hdr; /* PUT header */ - struct mca_btl_base_descriptor_t* rdma_des; - mca_pml_bfo_recv_request_t* recvreq; - - if(OPAL_UNLIKELY(OMPI_SUCCESS != status)) { - switch (common->hdr_type) { - case MCA_PML_BFO_HDR_TYPE_ACK: - recvreq = des->des_cbdata; - - /* Record the error. Send RECVERRNOTIFY if necessary. */ - if (recvreq->req_errstate) { - opal_output_verbose(30, mca_pml_bfo_output, - "ACK: completion failed, error already seen, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "ACK: completion failed, sending RECVERRNOTIFY to sender, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_ACK, status); - } - break; - - case MCA_PML_BFO_HDR_TYPE_PUT: - hdr = (mca_pml_bfo_rdma_hdr_t*)des->des_local->seg_addr.pval; - rdma_des = hdr->hdr_des.pval; - recvreq = des->des_cbdata; - if ((NULL != rdma_des->des_cbdata) && (recvreq == rdma_des->des_cbdata)) { - /* We now record the error, send the RECVERRNOTIFY if - * necessary, and free the descriptor. Prior to this, - * we want to ensure that we have not reached the case - * where the PUT message actually made it over and we - * have already received a FIN back. We first check to - * see if the RDMA descriptor cbdata is pointing to - * NULL. If it is, this means that the PUT message must - * have made it over and a corresponding FIN already - * made it back and freed the RDMA descriptor. Second, - * if it is non-null, we make sure that it is pointing - * to the same request as the PUT descriptor is. If - * it is not, again we assume that the FIN came back - * and freed it. And we can count on the fact that the - * recvreq has not been freed or reused as it is held - * until this very completion event occurs. */ - if (recvreq->req_errstate) { - opal_output_verbose(30, mca_pml_bfo_output, - "PUT: completion failed, error already seen, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - } else { - opal_output_verbose(30, mca_pml_bfo_output, - "PUT: completion failed, sending RECVERRNOTIFY to sender, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_PUT, status); - } -#if 0 - /* TODO: Add descriptor to receive request so it can - * be freed only when receive request is freed and - * only if needed. */ - btl->btl_free(btl, rdma_des); -#endif - } - break; - default: - ompi_rte_abort(-1, NULL); - } - } - - switch (common->hdr_type) { - case MCA_PML_BFO_HDR_TYPE_ACK: - recvreq = des->des_cbdata; - recvreq->req_events--; - assert(recvreq->req_events >= 0); - if(OPAL_UNLIKELY (recvreq->req_errstate & RECVREQ_RNDVRESTART_RECVED)) { - opal_output_verbose(30, mca_pml_bfo_output, - "ACK: completion: recvreq in error, outstanding events=%d " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, status=%d, peer=%d", - recvreq->req_events, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, status, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - if (0 == recvreq->req_events) { - mca_pml_bfo_recv_request_rndvrestartack(recvreq, MCA_PML_BFO_HDR_TYPE_ACK, - status, btl); - } - return; - } - recv_request_pml_complete_check(recvreq); - break; - case MCA_PML_BFO_HDR_TYPE_PUT: - recvreq = des->des_cbdata; - recvreq->req_events--; - assert(recvreq->req_events >= 0); - if(OPAL_UNLIKELY(recvreq->req_errstate & RECVREQ_RNDVRESTART_RECVED)) { - opal_output_verbose(30, mca_pml_bfo_output, - "PUT: completion: recvreq in error, outstanding events=%d " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, status=%d, peer=%d", - recvreq->req_events, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, status, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - if (0 == recvreq->req_events) { - mca_pml_bfo_recv_request_rndvrestartack(recvreq, MCA_PML_BFO_HDR_TYPE_PUT, - status, btl); - } - return; - } - recv_request_pml_complete_check(recvreq); - break; - } -} - -/** - * Register four functions to handle extra PML message types that - * are utilized when a failover occurs. - */ -int mca_pml_bfo_register_callbacks(void) { - int rc; - /* The following four functions are utilized when failover - * support for openib is enabled. */ - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY, - mca_pml_bfo_recv_frag_callback_rndvrestartnotify, - NULL ); - if(OMPI_SUCCESS != rc) - return rc; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK, - mca_pml_bfo_recv_frag_callback_rndvrestartack, - NULL ); - if(OMPI_SUCCESS != rc) - return rc; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK, - mca_pml_bfo_recv_frag_callback_rndvrestartnack, - NULL ); - if(OMPI_SUCCESS != rc) - return rc; - - rc = mca_bml.bml_register( MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY, - mca_pml_bfo_recv_frag_callback_recverrnotify, - NULL ); - if(OMPI_SUCCESS != rc) - return rc; - - return rc; -} - -/** - * Update a few fields when we are restarting either a RNDV or - * RGET type message. - */ -void mca_pml_bfo_update_rndv_fields(mca_pml_bfo_hdr_t* hdr, - mca_pml_bfo_send_request_t* sendreq, char *type) -{ - hdr->hdr_common.hdr_flags |= MCA_PML_BFO_HDR_FLAGS_RESTART; - hdr->hdr_rndv.hdr_dst_req = sendreq->req_recv; - hdr->hdr_rndv.hdr_restartseq = sendreq->req_restartseq; - opal_output_verbose(30, mca_pml_bfo_output, - "%s: restarting: PML=%d, RQS=%d, CTX=%d, SRC=%d, " - "src_req=%p, dst_req=%p, peer=%d", - type, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, - sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_comm->c_my_rank, (void *)sendreq, - sendreq->req_recv.pval, sendreq->req_send.req_base.req_peer); -} - -/** - * The following set of functions are all called when it is determined - * that the cached bml_btl->btl does not match the btl handed back - * by the callback function. This means that the bml_btl array has - * been shuffled and the bml_btl matching the btl has to be found - * back. If it cannot be found, then just find a different one to - * use. - */ -void mca_pml_bfo_update_eager_bml_btl_recv_ctl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - struct mca_btl_base_descriptor_t* des) -{ - if ((*bml_btl)->btl != btl) { - mca_pml_bfo_common_hdr_t * common = des->des_local->seg_addr.pval; - mca_pml_bfo_ack_hdr_t* ack; /* ACK header */ - mca_pml_bfo_recv_request_t* recvreq = NULL; - char *type = NULL; - - switch (common->hdr_type) { - case MCA_PML_BFO_HDR_TYPE_ACK: - ack = (mca_pml_bfo_ack_hdr_t*)des->des_local->seg_addr.pval; - recvreq = (mca_pml_bfo_recv_request_t*) ack->hdr_dst_req.pval; - type = "ACK"; - break; - case MCA_PML_BFO_HDR_TYPE_PUT: - recvreq = des->des_cbdata; - type = "PUT"; - break; - default: - /* In theory, this can never happen. */ - opal_output(0, "%s:%d FATAL ERROR, unknown header (hdr=%d)", - __FILE__, __LINE__, common->hdr_type); - ompi_rte_abort(-1, NULL); - } - - mca_pml_bfo_find_recvreq_eager_bml_btl(bml_btl, btl, recvreq, type); - } -} - -void mca_pml_bfo_find_sendreq_eager_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_send_request_t* sendreq, - char* type) -{ - if ((*bml_btl)->btl != btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML does not match BTL, find it back, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - *bml_btl = mca_bml_base_btl_array_find(&sendreq->req_endpoint->btl_eager, btl); - if (NULL == *bml_btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML is gone, find another one, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - *bml_btl = mca_bml_base_btl_array_get_next(&sendreq->req_endpoint->btl_eager); - } - } -} - -void mca_pml_bfo_find_sendreq_rdma_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_send_request_t* sendreq, - char* type) -{ - if ((*bml_btl)->btl != btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML does not match BTL, find it back, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - *bml_btl = mca_bml_base_btl_array_find(&sendreq->req_endpoint->btl_rdma, btl); - if (NULL == *bml_btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML is gone, find another one, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - sendreq->req_send.req_base.req_peer); - *bml_btl = mca_bml_base_btl_array_get_next(&sendreq->req_endpoint->btl_rdma); - } - } -} - -void mca_pml_bfo_find_recvreq_eager_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_recv_request_t* recvreq, - char* type) -{ - if ((*bml_btl)->btl != btl) { - ompi_proc_t *proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML does not match BTL, find it back, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - *bml_btl = mca_bml_base_btl_array_find(&bml_endpoint->btl_eager, btl); - if (NULL == *bml_btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML is gone, find another one, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - *bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_eager); - } - } -} - -void mca_pml_bfo_find_recvreq_rdma_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_recv_request_t* recvreq, - char* type) -{ - if ((*bml_btl)->btl != btl) { - ompi_proc_t *proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML does not match BTL, find it back, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - *bml_btl = mca_bml_base_btl_array_find(&bml_endpoint->btl_rdma, btl); - if (NULL == *bml_btl) { - opal_output_verbose(25, mca_pml_bfo_output, - "%s completion: BML is gone, find another one, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", - type, recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->remote_req_send.pval, (void *)recvreq, - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); - - *bml_btl = mca_bml_base_btl_array_get_next(&bml_endpoint->btl_rdma); - } - } -} - -/** - * The completion event for the RNDV message has returned with an - * error. We know that the send request we are looking at is valid - * because it cannot be completed until the sendreq->req_state value - * reaches 0. And for the sendreq->req_state to reach 0, the - * completion event on the RNDV message must occur. So, we do not - * bother checking whether the send request is valid, because we know - * it is, but we put a few asserts in for good measure. We then check - * a few fields in the request to decide what to do. If the - * sendreq->req_error is set, that means that something has happend - * already to the request and we do not want to restart it. - * Presumably, we may have received a RECVERRNOTIFY message from the - * receiver. We also check the sendreq->req_acked field to see if it - * has been acked. If it has, then again we do not restart everything - * because obviously the RNDV message has made it to the other side. - */ -bool mca_pml_bfo_rndv_completion_status_error(struct mca_btl_base_descriptor_t* des, - mca_pml_bfo_send_request_t* sendreq) -{ - assert(((mca_pml_bfo_hdr_t*)((des)->des_local->seg_addr.pval))->hdr_match.hdr_ctx == - (sendreq)->req_send.req_base.req_comm->c_contextid); - assert(((mca_pml_bfo_hdr_t*)((des)->des_local->seg_addr.pval))->hdr_match.hdr_src == - (sendreq)->req_send.req_base.req_comm->c_my_rank); - assert(((mca_pml_bfo_hdr_t*)((des)->des_local->seg_addr.pval))->hdr_match.hdr_seq == - (uint16_t)(sendreq)->req_send.req_base.req_sequence); - if ((!(sendreq)->req_error) && (NULL == (sendreq)->req_recv.pval)) { - (sendreq)->req_events--; - /* Assume RNDV did not make it, so restart from the beginning. */ - mca_pml_bfo_send_request_restart(sendreq, true, MCA_PML_BFO_HDR_TYPE_RNDV); - return true; - } - return false; -} - -/** - * Check to see if an error has occurred on this send request. If it has - * and there are no outstanding events, then we can start the restart dance. - */ -void mca_pml_bfo_completion_sendreq_has_error(mca_pml_bfo_send_request_t* sendreq, - int status, - mca_btl_base_module_t* btl, - int type, - char *description) -{ - opal_output_verbose(30, mca_pml_bfo_output, - "%s: completion: sendreq has error, outstanding events=%d, " - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, status=%d, peer=%d", - description, - sendreq->req_events, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, (void *)sendreq, - sendreq->req_recv.pval, - status, sendreq->req_send.req_base.req_peer); - if (0 == sendreq->req_events) { - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, false, - type, status, btl); - } -} - -/* If we get an error on the RGET message, then first make sure that - * header matches the send request that we are pointing to. This is - * necessary, because even though the sending side got an error, the - * RGET may have made it to the receiving side and the message transfer - * may have completed. This would then mean the send request has been - * completed and perhaps in use by another communication. So there is - * no need to restart this request. Therefore, ensure that we are - * looking at the same request that the header thinks we are looking - * at. If not, then there is nothing else to be done. */ -void mca_pml_bfo_send_ctl_completion_status_error(struct mca_btl_base_descriptor_t* des) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_pml_bfo_hdr_t* hdr = des->des_local->seg_addr.pval; - switch (hdr->hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_RGET: - if ((hdr->hdr_match.hdr_ctx != sendreq->req_send.req_base.req_comm->c_contextid) || - (hdr->hdr_match.hdr_src != sendreq->req_send.req_base.req_comm->c_my_rank) || - (hdr->hdr_match.hdr_seq != (uint16_t)sendreq->req_send.req_base.req_sequence)) { - opal_output_verbose(30, mca_pml_bfo_output, - "RGET: completion event: dropping because no valid request " - "PML:exp=%d,act=%d CTX:exp=%d,act=%d SRC:exp=%d,act=%d " - "RQS:exp=%d,act=%d, dst_req=%p", - (uint16_t)sendreq->req_send.req_base.req_sequence, - hdr->hdr_match.hdr_seq, - sendreq->req_send.req_base.req_comm->c_contextid, - hdr->hdr_match.hdr_ctx, - sendreq->req_send.req_base.req_comm->c_my_rank, - hdr->hdr_match.hdr_src, - sendreq->req_restartseq, hdr->hdr_rndv.hdr_restartseq, - (void *)sendreq); - return; - } - mca_pml_bfo_send_request_restart(sendreq, true, MCA_PML_BFO_HDR_TYPE_RGET); - return; - default: - opal_output(0, "%s:%d FATAL ERROR, unknown header (hdr=%d)", - __FILE__, __LINE__, hdr->hdr_common.hdr_type); - ompi_rte_abort(-1, NULL); - } -} diff --git a/ompi/mca/pml/bfo/pml_bfo_failover.h b/ompi/mca/pml/bfo/pml_bfo_failover.h deleted file mode 100644 index ea4f70fdc48..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_failover.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * Functions that implement failover capabilities. - */ - -#ifndef MCA_PML_BFO_FAILOVER_H -#define MCA_PML_BFO_FAILOVER_H - -#include "opal/mca/btl/btl.h" -#include "pml_bfo_hdr.h" - -BEGIN_C_DECLS - -bool mca_pml_bfo_is_duplicate_msg(mca_pml_bfo_comm_proc_t* proc, - mca_pml_bfo_match_hdr_t *hdr); -bool mca_pml_bfo_is_duplicate_fin(mca_pml_bfo_hdr_t* hdr, mca_btl_base_descriptor_t* rdma, - mca_btl_base_module_t* btl); - -mca_pml_bfo_recv_request_t* mca_pml_bfo_get_request(mca_pml_bfo_match_hdr_t *hdr); - -void mca_pml_bfo_send_request_restart(mca_pml_bfo_send_request_t* sendreq, - bool repost, mca_btl_base_tag_t tag); -void mca_pml_bfo_send_request_rndvrestartnotify(mca_pml_bfo_send_request_t* sendreq, - bool repost, mca_btl_base_tag_t tag, int status, - mca_btl_base_module_t* btl); - -void -mca_pml_bfo_rndvrestartnotify_completion(mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status); -void -mca_pml_bfo_check_recv_ctl_completion_status(mca_btl_base_module_t* btl, - struct mca_btl_base_descriptor_t* des, - int status); - -/* Reset a receive request to the beginning */ -void mca_pml_bfo_recv_request_reset(mca_pml_bfo_recv_request_t* recvreq); -/* Notify sender that receiver detected an error */ -void mca_pml_bfo_recv_request_recverrnotify(mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_tag_t tag, int status); -/* Ack the RNDVRESTARTNOTIFY message */ -void mca_pml_bfo_recv_request_rndvrestartack(mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_tag_t tag, int status, - mca_btl_base_module_t* btl); -/* Nack the RNDVRESTARTNOTIFY message */ -void mca_pml_bfo_recv_request_rndvrestartnack(mca_btl_base_descriptor_t* olddes, - ompi_proc_t* ompi_proc, bool repost); - -void mca_pml_bfo_recv_restart_completion(mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status); -void mca_pml_bfo_failover_error_handler(struct mca_btl_base_module_t* btl, - int32_t flags, ompi_proc_t *errproc, char *btlname); -void mca_pml_bfo_repost_match_fragment(struct mca_btl_base_descriptor_t* des); -void mca_pml_bfo_repost_fin(struct mca_btl_base_descriptor_t* des); - -void mca_pml_bfo_map_out_btl(struct mca_btl_base_module_t* btl, - ompi_proc_t *errproc, char *btlname); - -extern void mca_pml_bfo_map_out( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -int mca_pml_bfo_register_callbacks(void); - -void mca_pml_bfo_update_rndv_fields(mca_pml_bfo_hdr_t* hdr, - mca_pml_bfo_send_request_t*, char *type); - -void mca_pml_bfo_update_bml_btl(mca_bml_base_btl_t** bml_btl, mca_btl_base_module_t* btl, - struct mca_btl_base_descriptor_t* des); - -void mca_pml_bfo_find_recvreq_eager_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_recv_request_t* recvreq, - char* type); - -void mca_pml_bfo_find_sendreq_eager_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_send_request_t* sendreq, - char* type); - -void mca_pml_bfo_find_sendreq_rdma_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_send_request_t* sendreq, - char* type); - -void mca_pml_bfo_update_eager_bml_btl_recv_ctl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - struct mca_btl_base_descriptor_t* des); -void mca_pml_bfo_find_recvreq_rdma_bml_btl(mca_bml_base_btl_t** bml_btl, - mca_btl_base_module_t* btl, - mca_pml_bfo_recv_request_t* recvreq, - char* type); - -bool mca_pml_bfo_rndv_completion_status_error(struct mca_btl_base_descriptor_t* des, - mca_pml_bfo_send_request_t* sendreq); -void mca_pml_bfo_send_ctl_completion_status_error(struct mca_btl_base_descriptor_t* des); - - -void mca_pml_bfo_completion_sendreq_has_error(mca_pml_bfo_send_request_t* sendreq, - int status, - mca_btl_base_module_t* btl, - int type, - char *description); -/** - * Four new callbacks for the four new message types. - */ -extern void mca_pml_bfo_recv_frag_callback_rndvrestartnotify( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -extern void mca_pml_bfo_recv_frag_callback_rndvrestartack( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -extern void mca_pml_bfo_recv_frag_callback_rndvrestartnack( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -extern void mca_pml_bfo_recv_frag_callback_recverrnotify( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -/** - * A bunch of macros to help isolate failover code from regular ob1 code. - */ - -/* Drop any ACK fragments if request is in error state. Do not want - * to initiate any more activity. */ -#define MCA_PML_BFO_ERROR_CHECK_ON_ACK_CALLBACK(sendreq) \ - if( OPAL_UNLIKELY((sendreq)->req_error)) { \ - opal_output_verbose(20, mca_pml_bfo_output, \ - "ACK: received: dropping because request in error, " \ - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", \ - (uint16_t)(sendreq)->req_send.req_base.req_sequence, \ - (sendreq)->req_restartseq, \ - (void *)(sendreq), (sendreq)->req_recv.pval, \ - (sendreq)->req_send.req_base.req_peer); \ - return; \ - } - -/* Drop any FRAG fragments if request is in error state. Do not want - * to initiate any more activity. */ -#define MCA_PML_BFO_ERROR_CHECK_ON_FRAG_CALLBACK(recvreq) \ - if( OPAL_UNLIKELY((recvreq)->req_errstate)) { \ - opal_output_verbose(20, mca_pml_bfo_output, \ - "FRAG: received: dropping because request in error, " \ - "PML=%d, src_req=%p, dst_req=%p, peer=%d, offset=%d", \ - (uint16_t)(recvreq)->req_msgseq, \ - (recvreq)->remote_req_send.pval, \ - (void *)(recvreq), \ - (recvreq)->req_recv.req_base.req_ompi.req_status.MPI_SOURCE, \ - (int)hdr->hdr_frag.hdr_frag_offset); \ - return; \ - } - -/* Drop any PUT fragments if request is in error state. Do not want - * to initiate any more activity. */ -#define MCA_PML_BFO_ERROR_CHECK_ON_PUT_CALLBACK(sendreq) \ - if( OPAL_UNLIKELY((sendreq)->req_error)) { \ - opal_output_verbose(20, mca_pml_bfo_output, \ - "PUT: received: dropping because request in error, " \ - "PML=%d, src_req=%p, dst_req=%p, peer=%d", \ - (uint16_t)(sendreq)->req_send.req_base.req_sequence, \ - (void *)(sendreq), (sendreq)->req_recv.pval, \ - (sendreq)->req_send.req_base.req_peer); \ - return; \ - } - -/** - * Macros for pml_bfo_recvreq.c file. - */ - -/* This can happen if a FIN message arrives after the request was - * marked in error. So, just drop the message. Note that the status - * field is not being checked. That is because the status field is the - * value returned in the FIN hdr.hdr_fail field and may be used for - * other things. Note that we allow the various fields to be updated - * in case this actually completes the request and the sending side - * thinks it is done. */ -#define MCA_PML_BFO_ERROR_CHECK_ON_FIN_FOR_PUT(recvreq) \ - if( OPAL_UNLIKELY((recvreq)->req_errstate)) { \ - opal_output_verbose(20, mca_pml_bfo_output, \ - "FIN: received on broken request, skipping, " \ - "PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", \ - (recvreq)->req_msgseq, (recvreq)->req_restartseq, \ - (recvreq)->remote_req_send.pval, (void *)(recvreq), \ - (recvreq)->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); \ - /* Even though in error, it still might complete. */ \ - recv_request_pml_complete_check(recvreq); \ - return; \ - } - -#define MCA_PML_BFO_ERROR_CHECK_ON_RDMA_READ_COMPLETION(recvreq) \ - if ((recvreq)->req_errstate) { \ - opal_output_verbose(30, mca_pml_bfo_output, \ - "RDMA read: completion failed, error already seen, " \ - "PML=%d, RQS=%d, src_req=%lx, dst_req=%lx, peer=%d", \ - (recvreq)->req_msgseq, (recvreq)->req_restartseq, \ - (unsigned long)(recvreq)->remote_req_send.pval, \ - (unsigned long)(recvreq), \ - (recvreq)->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); \ - return; \ - } else { \ - opal_output_verbose(30, mca_pml_bfo_output, \ - "RDMA read: completion failed, sending RECVERRNOTIFY to " \ - "sender, PML=%d, RQS=%d, src_req=%lx, dst_req=%lx, peer=%d", \ - (recvreq)->req_msgseq, (recvreq)->req_restartseq, \ - (unsigned long)(recvreq)->remote_req_send.pval, \ - (unsigned long)(recvreq), \ - (recvreq)->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); \ - mca_pml_bfo_recv_request_recverrnotify(recvreq, MCA_PML_BFO_HDR_TYPE_RGET, status); \ - } - -#define MCA_PML_BFO_SECOND_ERROR_CHECK_ON_RDMA_READ_COMPLETION(recvreq, status, btl) \ - /* See if the request has received a RNDVRESTARTNOTIFY */ \ - if( OPAL_UNLIKELY(recvreq->req_errstate)) { \ - if (recvreq->req_errstate & RECVREQ_RNDVRESTART_RECVED) { \ - opal_output_verbose(30, mca_pml_bfo_output, \ - "RDMA read: completion: recvreq has error, outstanding events=%d " \ - "PML=%d, RQS=%d, src_req=%lx, dst_req=%lx, status=%d, peer=%d", \ - recvreq->req_events, recvreq->req_msgseq, recvreq->req_restartseq, \ - (unsigned long)recvreq->remote_req_send.pval, \ - (unsigned long)recvreq, status, \ - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE); \ - if (0 == recvreq->req_events) { \ - mca_pml_bfo_recv_request_rndvrestartack(recvreq, MCA_PML_BFO_HDR_TYPE_RGET, \ - status, btl); \ - } \ - } \ - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); \ - return; \ - } - -/** - * Macros for pml_bfo_sendreq.c file. - */ - -/* This macro is called on the sending side after receiving - * a PUT message. There is a chance that this PUT message - * has shown up and is attempting to modify the state of - * the req_state, but the req_state is no longer being tracked - * because the RNDV message has turned into a RGET message - * because it got an error on the RNDV completion. - */ -#define MCA_PML_BFO_VERIFY_SENDREQ_REQ_STATE_VALUE(sendreq) \ - if (sendreq->req_state == -1) { \ - OPAL_THREAD_ADD_FETCH32(&sendreq->req_state, 1); \ - } - -/* Now check the error state. This request can be in error if the - * RNDV message made it over, but the receiver got an error trying to - * send the ACK back and therefore sent a RECVERRNOTIFY message. In - * that case, we want to start the restart dance as the receiver has - * matched this message already. Only restart if there are no - * outstanding events on send request. */ -#define MCA_PML_BFO_RNDV_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl, type, description) \ - if( OPAL_UNLIKELY ((sendreq)->req_error)) { \ - mca_pml_bfo_completion_sendreq_has_error(sendreq, status, \ - btl, type, description); \ - return; \ - } - -/** - * This macro is called within the frag completion function in two - * places. It is called to see if any errors occur prior to the - * completion event on the frag. It is then called a second time - * after the scheduling routine is called as the scheduling routine - * may have detected that a BTL that was cached on the request had - * been removed and therefore marked the request in error. In that - * case, the scheduling of fragments can no longer proceed properly, - * and if there are no outstanding events, iniated the restart dance. - */ -#define MCA_PML_BFO_FRAG_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl, type, description) \ - if( OPAL_UNLIKELY((sendreq)->req_error)) { \ - mca_pml_bfo_completion_sendreq_has_error(sendreq, status, \ - btl, type, description); \ - return; \ - } - -/* This can happen if a FIN message arrives after the request was - * marked in error. So, just drop the message. Note that the status - * field is not checked here. That is because that is the value - * returned in the FIN hdr.hdr_fail field and may be used for other - * things. */ -#define MCA_PML_BFO_RGET_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, btl, des) \ - if( OPAL_UNLIKELY(sendreq->req_error)) { \ - opal_output_verbose(30, mca_pml_bfo_output, \ - "FIN: received on broken request, skipping, " \ - "PML=%d, src_req=%lx, dst_req=%lx, peer=%d", \ - (uint16_t)sendreq->req_send.req_base.req_sequence, \ - (unsigned long)sendreq, (unsigned long)sendreq->req_recv.pval, \ - sendreq->req_send.req_base.req_peer); \ - btl->btl_free(btl, des); \ - return; \ - } - - -/* Check if there has been an error on the send request when we get - * a completion event on the RDMA write. */ -#define MCA_PML_BFO_PUT_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl) \ - if ( OPAL_UNLIKELY(sendreq->req_error)) { \ - mca_pml_bfo_completion_sendreq_has_error(sendreq, status, btl, \ - MCA_PML_BFO_HDR_TYPE_PUT, "RDMA write"); \ - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); \ - return; \ - } - -#define MCA_PML_BFO_CHECK_FOR_RNDV_RESTART(hdr, sendreq, type) \ - if (0 < sendreq->req_restartseq) { \ - mca_pml_bfo_update_rndv_fields(hdr, sendreq, type); \ - } - -/* If a bml_btl gets mapped out, then we need to adjust it based - * on the btl from the callback function. These macros are called on - * every callback to make sure things are copacetic. - */ -#define MCA_PML_BFO_CHECK_EAGER_BML_BTL_ON_FIN_COMPLETION(bml_btl, btl, des) \ - if (bml_btl->btl != btl) { \ - ompi_proc_t *proc = (ompi_proc_t*) des->des_cbdata; \ - mca_bml_base_endpoint_t* bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; \ - bml_btl = mca_bml_base_btl_array_find(&bml_endpoint->btl_eager, btl); \ - } -#define MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, sendreq, type) \ - if (bml_btl->btl != btl) { \ - mca_pml_bfo_find_sendreq_eager_bml_btl(&bml_btl, btl, sendreq, type); \ - } -#define MCA_PML_BFO_CHECK_SENDREQ_RDMA_BML_BTL(bml_btl, btl, sendreq, type) \ - if (bml_btl->btl != btl) { \ - mca_pml_bfo_find_sendreq_rdma_bml_btl(&bml_btl, btl, sendreq, type); \ - } - -#define MCA_PML_BFO_CHECK_RECVREQ_EAGER_BML_BTL(bml_btl, btl, recvreq, type) \ - if (bml_btl->btl != btl) { \ - mca_pml_bfo_find_recvreq_eager_bml_btl(&bml_btl, btl, recvreq, type); \ - } - -#define MCA_PML_BFO_CHECK_RECVREQ_RDMA_BML_BTL(bml_btl, btl, recvreq, type) \ - if (bml_btl->btl != btl) { \ - mca_pml_bfo_find_recvreq_rdma_bml_btl(&bml_btl, btl, recvreq, type); \ - } - -#define MCA_PML_BFO_CHECK_RECVREQ_EAGER_BML_BTL_RECV_CTL(bml_btl, btl, des) \ - if (bml_btl->btl != btl) { \ - mca_pml_bfo_update_eager_bml_btl_recv_ctl(&bml_btl, btl, des); \ - } - -#define MCA_PML_BFO_CHECK_FOR_REMOVED_BML(sendreq, frag, btl) \ - if( OPAL_UNLIKELY(NULL == frag->rdma_bml) ) { \ - opal_output_verbose(30, mca_pml_bfo_output, \ - "PUT received: no matching BTL to RDMA write to, oustanding " \ - "events=%d, PML=%d, RQS=%d, src_req=%p, dst_req=%p, peer=%d", \ - sendreq->req_events, \ - (uint16_t)sendreq->req_send.req_base.req_sequence, \ - sendreq->req_restartseq, (void *)sendreq, \ - sendreq->req_recv.pval, sendreq->req_send.req_base.req_peer); \ - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); \ - sendreq->req_error++; \ - if (0 == sendreq->req_events) { \ - mca_pml_bfo_send_request_rndvrestartnotify(sendreq, false, \ - MCA_PML_BFO_HDR_TYPE_PUT, \ - OMPI_ERROR, btl); \ - } \ - return; \ - } - -/* This macro checks to see if the cached number of BTLs in the - * send request still matches the value from the endpoint. - * If it does not, this means that a BTL was removed from the - * available list. In this case, start the request over. - */ -#define MCA_PML_BFO_CHECK_FOR_REMOVED_BTL(sendreq, range) \ - if ((int)mca_bml_base_btl_array_get_size(&sendreq->req_endpoint->btl_send) \ - != range->range_btl_cnt) { \ - sendreq->req_error++; \ - return OMPI_ERROR; \ - } - - -END_C_DECLS - -#endif diff --git a/ompi/mca/pml/bfo/pml_bfo_hdr.h b/ompi/mca/pml/bfo/pml_bfo_hdr.h deleted file mode 100644 index 90a6f2326d7..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_hdr.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 IBM Corporation. All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ -#ifndef MCA_PML_BFO_HEADER_H -#define MCA_PML_BFO_HEADER_H - -#include "ompi_config.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#include "opal/types.h" -#include "opal/util/arch.h" -#include "opal/mca/btl/btl.h" -#include "ompi/proc/proc.h" - -#define MCA_PML_BFO_HDR_TYPE_MATCH (MCA_BTL_TAG_PML + 1) -#define MCA_PML_BFO_HDR_TYPE_RNDV (MCA_BTL_TAG_PML + 2) -#define MCA_PML_BFO_HDR_TYPE_RGET (MCA_BTL_TAG_PML + 3) -#define MCA_PML_BFO_HDR_TYPE_ACK (MCA_BTL_TAG_PML + 4) -#define MCA_PML_BFO_HDR_TYPE_NACK (MCA_BTL_TAG_PML + 5) -#define MCA_PML_BFO_HDR_TYPE_FRAG (MCA_BTL_TAG_PML + 6) -#define MCA_PML_BFO_HDR_TYPE_GET (MCA_BTL_TAG_PML + 7) -#define MCA_PML_BFO_HDR_TYPE_PUT (MCA_BTL_TAG_PML + 8) -#define MCA_PML_BFO_HDR_TYPE_FIN (MCA_BTL_TAG_PML + 9) -#if PML_BFO -#define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY (MCA_BTL_TAG_PML + 10) -#define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK (MCA_BTL_TAG_PML + 11) -#define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK (MCA_BTL_TAG_PML + 12) -#define MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY (MCA_BTL_TAG_PML + 13) -#endif /* PML_BFO */ - -#define MCA_PML_BFO_HDR_FLAGS_ACK 1 /* is an ack required */ -#define MCA_PML_BFO_HDR_FLAGS_NBO 2 /* is the hdr in network byte order */ -#define MCA_PML_BFO_HDR_FLAGS_PIN 4 /* is user buffer pinned */ -#define MCA_PML_BFO_HDR_FLAGS_CONTIG 8 /* is user buffer contiguous */ -#define MCA_PML_BFO_HDR_FLAGS_NORDMA 16 /* rest will be send by copy-in-out */ -#if PML_BFO -#define MCA_PML_BFO_HDR_FLAGS_RESTART 32 /* restart RNDV because of error */ -#endif /* PML_BFO */ - -/** - * Common hdr attributes - must be first element in each hdr type - */ -struct mca_pml_bfo_common_hdr_t { - uint8_t hdr_type; /**< type of envelope */ - uint8_t hdr_flags; /**< flags indicating how fragment should be processed */ -}; -typedef struct mca_pml_bfo_common_hdr_t mca_pml_bfo_common_hdr_t; - -#define MCA_PML_BFO_COMMON_HDR_NTOH(h) -#define MCA_PML_BFO_COMMON_HDR_HTON(h) - -/** - * Header definition for the first fragment, contains the - * attributes required to match the corresponding posted receive. - */ -struct mca_pml_bfo_match_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; /**< common attributes */ - uint16_t hdr_ctx; /**< communicator index */ - int32_t hdr_src; /**< source rank */ - int32_t hdr_tag; /**< user tag */ - uint16_t hdr_seq; /**< message sequence number */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[2]; /**< explicitly pad to 16 bytes. Compilers seem to already prefer to do this, but make it explicit just in case */ -#endif -}; -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT -#define OMPI_PML_BFO_MATCH_HDR_LEN 16 -#else -#define OMPI_PML_BFO_MATCH_HDR_LEN 14 -#endif - -typedef struct mca_pml_bfo_match_hdr_t mca_pml_bfo_match_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_MATCH_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ -} while(0) -#else -#define MCA_PML_BFO_MATCH_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_MATCH_HDR_NTOH(h) \ -do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - (h).hdr_ctx = ntohs((h).hdr_ctx); \ - (h).hdr_src = ntohl((h).hdr_src); \ - (h).hdr_tag = ntohl((h).hdr_tag); \ - (h).hdr_seq = ntohs((h).hdr_seq); \ -} while (0) - -#define MCA_PML_BFO_MATCH_HDR_HTON(h) \ -do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_MATCH_HDR_FILL(h); \ - (h).hdr_ctx = htons((h).hdr_ctx); \ - (h).hdr_src = htonl((h).hdr_src); \ - (h).hdr_tag = htonl((h).hdr_tag); \ - (h).hdr_seq = htons((h).hdr_seq); \ -} while (0) - -/** - * Header definition for the first fragment when an acknowledgment - * is required. This could be the first fragment of a large message - * or a short message that requires an ack (synchronous). - */ -struct mca_pml_bfo_rendezvous_hdr_t { - mca_pml_bfo_match_hdr_t hdr_match; - uint64_t hdr_msg_length; /**< message length */ - opal_ptr_t hdr_src_req; /**< pointer to source request - returned in ack */ -#if PML_BFO - opal_ptr_t hdr_dst_req; /**< pointer to dst req */ - uint8_t hdr_restartseq; /**< restart sequence */ -#endif /* PML_BFO */ -}; -typedef struct mca_pml_bfo_rendezvous_hdr_t mca_pml_bfo_rendezvous_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_RNDV_HDR_FILL(h) \ - MCA_PML_BFO_MATCH_HDR_FILL((h).hdr_match) -#else -#define MCA_PML_BFO_RNDV_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -/* Note that hdr_src_req is not put in network byte order because it - is never processed by the receiver, other than being copied into - the ack header */ -#define MCA_PML_BFO_RNDV_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \ - (h).hdr_msg_length = ntoh64((h).hdr_msg_length); \ - } while (0) - -#define MCA_PML_BFO_RNDV_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \ - MCA_PML_BFO_RNDV_HDR_FILL(h); \ - (h).hdr_msg_length = hton64((h).hdr_msg_length); \ - } while (0) - -/** - * Header definition for a combined rdma rendezvous/get - */ -struct mca_pml_bfo_rget_hdr_t { - mca_pml_bfo_rendezvous_hdr_t hdr_rndv; - uint32_t hdr_seg_cnt; /**< number of segments for rdma */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[4]; -#endif - opal_ptr_t hdr_des; /**< source descriptor */ -}; -typedef struct mca_pml_bfo_rget_hdr_t mca_pml_bfo_rget_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_RGET_HDR_FILL(h) \ -do { \ - MCA_PML_BFO_RNDV_HDR_FILL((h).hdr_rndv); \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ - (h).hdr_padding[2] = 0; \ - (h).hdr_padding[3] = 0; \ -} while(0) -#else -#define MCA_PML_BFO_RGET_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_RGET_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_RNDV_HDR_NTOH((h).hdr_rndv); \ - (h).hdr_seg_cnt = ntohl((h).hdr_seg_cnt); \ - } while (0) - -#define MCA_PML_BFO_RGET_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_RNDV_HDR_HTON((h).hdr_rndv); \ - MCA_PML_BFO_RGET_HDR_FILL(h); \ - (h).hdr_seg_cnt = htonl((h).hdr_seg_cnt); \ - } while (0) - -/** - * Header for subsequent fragments. - */ -struct mca_pml_bfo_frag_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; /**< common attributes */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[6]; -#endif - uint64_t hdr_frag_offset; /**< offset into message */ - opal_ptr_t hdr_src_req; /**< pointer to source request */ - opal_ptr_t hdr_dst_req; /**< pointer to matched receive */ -}; -typedef struct mca_pml_bfo_frag_hdr_t mca_pml_bfo_frag_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_FRAG_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ - (h).hdr_padding[2] = 0; \ - (h).hdr_padding[3] = 0; \ - (h).hdr_padding[4] = 0; \ - (h).hdr_padding[5] = 0; \ -} while(0) -#else -#define MCA_PML_BFO_FRAG_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_FRAG_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - (h).hdr_frag_offset = ntoh64((h).hdr_frag_offset); \ - } while (0) - -#define MCA_PML_BFO_FRAG_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_FRAG_HDR_FILL(h); \ - (h).hdr_frag_offset = hton64((h).hdr_frag_offset); \ - } while (0) - -/** - * Header used to acknowledgment outstanding fragment(s). - */ - -struct mca_pml_bfo_ack_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; /**< common attributes */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[6]; -#endif - opal_ptr_t hdr_src_req; /**< source request */ - opal_ptr_t hdr_dst_req; /**< matched receive request */ - uint64_t hdr_send_offset; /**< starting point of copy in/out */ -}; -typedef struct mca_pml_bfo_ack_hdr_t mca_pml_bfo_ack_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_ACK_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ - (h).hdr_padding[2] = 0; \ - (h).hdr_padding[3] = 0; \ - (h).hdr_padding[4] = 0; \ - (h).hdr_padding[5] = 0; \ -} while (0) -#else -#define MCA_PML_BFO_ACK_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -/* Note that the request headers are not put in NBO because the - src_req is already in receiver's byte order and the dst_req is not - used by the receiver for anything other than backpointers in return - headers */ -#define MCA_PML_BFO_ACK_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - (h).hdr_send_offset = ntoh64((h).hdr_send_offset); \ - } while (0) - -#define MCA_PML_BFO_ACK_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_ACK_HDR_FILL(h); \ - (h).hdr_send_offset = hton64((h).hdr_send_offset); \ - } while (0) - -/** - * Header used to initiate an RDMA operation. - */ - -struct mca_pml_bfo_rdma_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; /**< common attributes */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[2]; /** two to pad out the hdr to a 4 byte alignment. hdr_req will then be 8 byte aligned after 4 for hdr_seg_cnt */ -#endif - uint32_t hdr_seg_cnt; /**< number of segments for rdma */ - opal_ptr_t hdr_req; /**< destination request */ -#if PML_BFO - opal_ptr_t hdr_dst_req; /**< pointer to destination request */ -#endif /* PML_BFO */ - opal_ptr_t hdr_des; /**< source descriptor */ - uint64_t hdr_rdma_offset; /**< current offset into user buffer */ - mca_btl_base_segment_t hdr_segs[1]; /**< list of segments for rdma */ -}; -typedef struct mca_pml_bfo_rdma_hdr_t mca_pml_bfo_rdma_hdr_t; - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_RDMA_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ -} while(0) -#else -#define MCA_PML_BFO_RDMA_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_RDMA_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - (h).hdr_seg_cnt = ntohl((h).hdr_seg_cnt); \ - (h).hdr_rdma_offset = ntoh64((h).hdr_rdma_offset); \ - } while (0) - -#define MCA_PML_BFO_RDMA_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_RDMA_HDR_FILL(h); \ - (h).hdr_seg_cnt = htonl((h).hdr_seg_cnt); \ - (h).hdr_rdma_offset = hton64((h).hdr_rdma_offset); \ - } while (0) - -/** - * Header used to complete an RDMA operation. - */ - -struct mca_pml_bfo_fin_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; /**< common attributes */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[2]; -#endif -#if PML_BFO - /* Match info is needed to check for duplicate FIN messages. */ - mca_pml_bfo_match_hdr_t hdr_match; -#endif /* PML_BFO */ - uint32_t hdr_fail; /**< RDMA operation failed */ - opal_ptr_t hdr_des; /**< completed descriptor */ -}; -typedef struct mca_pml_bfo_fin_hdr_t mca_pml_bfo_fin_hdr_t; - -#if PML_BFO -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_FIN_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ - MCA_PML_BFO_MATCH_HDR_FILL((h).hdr_match); \ -} while (0) -#else -#define MCA_PML_BFO_FIN_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_FIN_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \ - } while (0) - -#define MCA_PML_BFO_FIN_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \ - MCA_PML_BFO_FIN_HDR_FILL(h); \ - } while (0) -#else /* PML_BFO */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG -#define MCA_PML_BFO_FIN_HDR_FILL(h) \ -do { \ - (h).hdr_padding[0] = 0; \ - (h).hdr_padding[1] = 0; \ -} while (0) -#else -#define MCA_PML_BFO_FIN_HDR_FILL(h) -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG */ - -#define MCA_PML_BFO_FIN_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \ - } while (0) - -#define MCA_PML_BFO_FIN_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \ - MCA_PML_BFO_FIN_HDR_FILL(h); \ - } while (0) -#endif /* PML_BFO */ - -#if PML_BFO -/** - * Header used to restart a rendezvous request. - */ -struct mca_pml_bfo_restart_hdr_t { - mca_pml_bfo_match_hdr_t hdr_match; /**< needed to avoid duplicate messages */ - uint8_t hdr_restartseq; /**< restart sequence */ -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - uint8_t hdr_padding[3]; -#endif - opal_ptr_t hdr_src_req; /**< source request */ - opal_ptr_t hdr_dst_req; /**< matched receive request */ - int32_t hdr_dst_rank; /**< needed to send NACK */ - uint32_t hdr_jobid; /**< needed to send NACK */ - uint32_t hdr_vpid; /**< needed to send NACK */ -}; -typedef struct mca_pml_bfo_restart_hdr_t mca_pml_bfo_restart_hdr_t; - -/* Only need to put parts of the restart header in NBO. No need - to do hdr_src_req and hdr_dst_req as they are only used on the - by the process that originated them. */ -#define MCA_PML_BFO_RESTART_HDR_NTOH(h) \ - do { \ - MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \ - (h).hdr_dst_rank = ntohl((h).hdr_dst_rank); \ - (h).hdr_jobid = ntohl((h).hdr_jobid); \ - (h).hdr_vpid = ntohl((h).hdr_vpid); \ - } while (0) - -#define MCA_PML_BFO_RESTART_HDR_HTON(h) \ - do { \ - MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \ - (h).hdr_dst_rank = htonl((h).hdr_dst_rank); \ - (h).hdr_jobid = htonl((h).hdr_jobid); \ - (h).hdr_vpid = htonl((h).hdr_vpid); \ - } while (0) - -#endif /* PML_BFO */ -/** - * Union of defined hdr types. - */ -union mca_pml_bfo_hdr_t { - mca_pml_bfo_common_hdr_t hdr_common; - mca_pml_bfo_match_hdr_t hdr_match; - mca_pml_bfo_rendezvous_hdr_t hdr_rndv; - mca_pml_bfo_rget_hdr_t hdr_rget; - mca_pml_bfo_frag_hdr_t hdr_frag; - mca_pml_bfo_ack_hdr_t hdr_ack; - mca_pml_bfo_rdma_hdr_t hdr_rdma; - mca_pml_bfo_fin_hdr_t hdr_fin; -#if PML_BFO - mca_pml_bfo_restart_hdr_t hdr_restart; -#endif /* PML_BFO */ -}; -typedef union mca_pml_bfo_hdr_t mca_pml_bfo_hdr_t; - -#if !defined(WORDS_BIGENDIAN) && OPAL_ENABLE_HETEROGENEOUS_SUPPORT -static inline __opal_attribute_always_inline__ void -bfo_hdr_ntoh(mca_pml_bfo_hdr_t *hdr, const uint8_t hdr_type) -{ - if(!(hdr->hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_NBO)) - return; - - switch(hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - MCA_PML_BFO_MATCH_HDR_NTOH(hdr->hdr_match); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - MCA_PML_BFO_RNDV_HDR_NTOH(hdr->hdr_rndv); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - MCA_PML_BFO_RGET_HDR_NTOH(hdr->hdr_rget); - break; - case MCA_PML_BFO_HDR_TYPE_ACK: - MCA_PML_BFO_ACK_HDR_NTOH(hdr->hdr_ack); - break; - case MCA_PML_BFO_HDR_TYPE_FRAG: - MCA_PML_BFO_FRAG_HDR_NTOH(hdr->hdr_frag); - break; - case MCA_PML_BFO_HDR_TYPE_PUT: - MCA_PML_BFO_RDMA_HDR_NTOH(hdr->hdr_rdma); - break; - case MCA_PML_BFO_HDR_TYPE_FIN: - MCA_PML_BFO_FIN_HDR_NTOH(hdr->hdr_fin); - break; - default: - assert(0); - break; - } -} -#else -#define bfo_hdr_ntoh(h, t) do{}while(0) -#endif - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT -#define bfo_hdr_hton(h, t, p) \ - bfo_hdr_hton_intr((mca_pml_bfo_hdr_t*)h, t, p) -static inline __opal_attribute_always_inline__ void -bfo_hdr_hton_intr(mca_pml_bfo_hdr_t *hdr, const uint8_t hdr_type, - const ompi_proc_t *proc) -{ -#ifdef WORDS_BIGENDIAN - hdr->hdr_common.hdr_flags |= MCA_PML_BFO_HDR_FLAGS_NBO; -#else - - if(!(proc->super.proc_arch & OPAL_ARCH_ISBIGENDIAN)) - return; - - hdr->hdr_common.hdr_flags |= MCA_PML_BFO_HDR_FLAGS_NBO; - switch(hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - MCA_PML_BFO_MATCH_HDR_HTON(hdr->hdr_match); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - MCA_PML_BFO_RNDV_HDR_HTON(hdr->hdr_rndv); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - MCA_PML_BFO_RGET_HDR_HTON(hdr->hdr_rget); - break; - case MCA_PML_BFO_HDR_TYPE_ACK: - MCA_PML_BFO_ACK_HDR_HTON(hdr->hdr_ack); - break; - case MCA_PML_BFO_HDR_TYPE_FRAG: - MCA_PML_BFO_FRAG_HDR_HTON(hdr->hdr_frag); - break; - case MCA_PML_BFO_HDR_TYPE_PUT: - MCA_PML_BFO_RDMA_HDR_HTON(hdr->hdr_rdma); - break; - case MCA_PML_BFO_HDR_TYPE_FIN: - MCA_PML_BFO_FIN_HDR_HTON(hdr->hdr_fin); - break; - default: - assert(0); - break; - } -#endif -} -#else -#define bfo_hdr_hton(h, t, p) do{}while(0) -#endif -#endif diff --git a/ompi/mca/pml/bfo/pml_bfo_iprobe.c b/ompi/mca/pml/bfo/pml_bfo_iprobe.c deleted file mode 100644 index c3d432367af..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_iprobe.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/request/request.h" -#include "ompi/message/message.h" -#include "pml_bfo_recvreq.h" - - -int mca_pml_bfo_iprobe(int src, - int tag, - struct ompi_communicator_t *comm, - int *matched, ompi_status_public_t * status) -{ - int rc = OMPI_SUCCESS; - mca_pml_bfo_recv_request_t recvreq; - - OBJ_CONSTRUCT( &recvreq, mca_pml_bfo_recv_request_t ); - recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML; - recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_IPROBE; - - MCA_PML_BFO_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char.dt, src, tag, comm, false); - MCA_PML_BFO_RECV_REQUEST_START(&recvreq); - - if( recvreq.req_recv.req_base.req_ompi.req_complete == true ) { - if( NULL != status ) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; - } - rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR; - *matched = 1; - } else { - *matched = 0; - opal_progress(); - } - MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); - return rc; -} - - -int mca_pml_bfo_probe(int src, - int tag, - struct ompi_communicator_t *comm, - ompi_status_public_t * status) -{ - int rc = OMPI_SUCCESS; - mca_pml_bfo_recv_request_t recvreq; - - OBJ_CONSTRUCT( &recvreq, mca_pml_bfo_recv_request_t ); - recvreq.req_recv.req_base.req_ompi.req_type = OMPI_REQUEST_PML; - recvreq.req_recv.req_base.req_type = MCA_PML_REQUEST_PROBE; - - MCA_PML_BFO_RECV_REQUEST_INIT(&recvreq, NULL, 0, &ompi_mpi_char.dt, src, tag, comm, false); - MCA_PML_BFO_RECV_REQUEST_START(&recvreq); - - ompi_request_wait_completion(&recvreq.req_recv.req_base.req_ompi); - rc = recvreq.req_recv.req_base.req_ompi.req_status.MPI_ERROR; - if (NULL != status) { - *status = recvreq.req_recv.req_base.req_ompi.req_status; - } - - MCA_PML_BASE_RECV_REQUEST_FINI( &recvreq.req_recv ); - return rc; -} - - -int -mca_pml_bfo_improbe(int src, - int tag, - struct ompi_communicator_t *comm, - int *matched, - struct ompi_message_t **message, - ompi_status_public_t * status) -{ - int rc = OMPI_SUCCESS; - mca_pml_bfo_recv_request_t *recvreq; - - *message = ompi_message_alloc(); - if (NULL == *message) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; - - MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq); - if (NULL == recvreq) - return OMPI_ERR_OUT_OF_RESOURCE; - recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_IMPROBE; - - /* initialize the request enough to probe and get the status */ - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt, - src, tag, comm, false); - MCA_PML_BFO_RECV_REQUEST_START(recvreq); - - if( recvreq->req_recv.req_base.req_ompi.req_complete == true ) { - if( NULL != status ) { - *status = recvreq->req_recv.req_base.req_ompi.req_status; - } - *matched = 1; - - (*message)->comm = comm; - (*message)->req_ptr = recvreq; - (*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE; - (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount; - - rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; - } else { - *matched = 0; - - /* we only free if we didn't match, because we're going to - translate the request into a receive request later on if it - was matched */ - MCA_PML_BFO_RECV_REQUEST_RETURN( recvreq ); - ompi_message_return(*message); - *message = MPI_MESSAGE_NULL; - - opal_progress(); - } - - return rc; -} - - -int -mca_pml_bfo_mprobe(int src, - int tag, - struct ompi_communicator_t *comm, - struct ompi_message_t **message, - ompi_status_public_t * status) -{ - int rc = OMPI_SUCCESS; - mca_pml_bfo_recv_request_t *recvreq; - - *message = ompi_message_alloc(); - if (NULL == *message) return OMPI_ERR_TEMP_OUT_OF_RESOURCE; - - MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq); - if (NULL == recvreq) - return OMPI_ERR_TEMP_OUT_OF_RESOURCE; - recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_MPROBE; - - /* initialize the request enough to probe and get the status */ - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, NULL, 0, &ompi_mpi_char.dt, - src, tag, comm, false); - MCA_PML_BFO_RECV_REQUEST_START(recvreq); - - ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); - rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; - - if( NULL != status ) { - *status = recvreq->req_recv.req_base.req_ompi.req_status; - } - - (*message)->comm = comm; - (*message)->req_ptr = recvreq; - (*message)->peer = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE; - (*message)->count = recvreq->req_recv.req_base.req_ompi.req_status._ucount; - - return rc; -} diff --git a/ompi/mca/pml/bfo/pml_bfo_irecv.c b/ompi/mca/pml/bfo/pml_bfo_irecv.c deleted file mode 100644 index b4b2cb352b2..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_irecv.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" -#include "ompi/request/request.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_recvfrag.h" -#include "ompi/peruse/peruse-internal.h" -#include "ompi/message/message.h" - -int mca_pml_bfo_irecv_init(void *addr, - size_t count, - ompi_datatype_t * datatype, - int src, - int tag, - struct ompi_communicator_t *comm, - struct ompi_request_t **request) -{ - mca_pml_bfo_recv_request_t *recvreq; - MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq); - if (NULL == recvreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, - addr, - count, datatype, src, tag, comm, true); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &((recvreq)->req_recv.req_base), - PERUSE_RECV); - - *request = (ompi_request_t *) recvreq; - return OMPI_SUCCESS; -} - -int mca_pml_bfo_irecv(void *addr, - size_t count, - ompi_datatype_t * datatype, - int src, - int tag, - struct ompi_communicator_t *comm, - struct ompi_request_t **request) -{ - mca_pml_bfo_recv_request_t *recvreq; - MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq); - if (NULL == recvreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, - addr, - count, datatype, src, tag, comm, false); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &((recvreq)->req_recv.req_base), - PERUSE_RECV); - - MCA_PML_BFO_RECV_REQUEST_START(recvreq); - *request = (ompi_request_t *) recvreq; - return OMPI_SUCCESS; -} - - -int mca_pml_bfo_recv(void *addr, - size_t count, - ompi_datatype_t * datatype, - int src, - int tag, - struct ompi_communicator_t *comm, - ompi_status_public_t * status) -{ - int rc; - mca_pml_bfo_recv_request_t *recvreq; - MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq); - if (NULL == recvreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, - addr, - count, datatype, src, tag, comm, false); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &((recvreq)->req_recv.req_base), - PERUSE_RECV); - - MCA_PML_BFO_RECV_REQUEST_START(recvreq); - ompi_request_wait_completion(&recvreq->req_recv.req_base.req_ompi); - - if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; - } - rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; - ompi_request_free( (ompi_request_t**)&recvreq ); - return rc; -} - - -int -mca_pml_bfo_imrecv( void *buf, - size_t count, - ompi_datatype_t *datatype, - struct ompi_message_t **message, - struct ompi_request_t **request ) -{ - mca_pml_bfo_recv_frag_t* frag; - mca_pml_bfo_recv_request_t *recvreq; - mca_pml_bfo_hdr_t *hdr; - int src, tag; - ompi_communicator_t *comm; - mca_pml_bfo_comm_proc_t* proc; - mca_pml_bfo_comm_t* bfo_comm; - uint64_t seq; - - /* get the request from the message and the frag from the request - before we overwrite everything */ - recvreq = (mca_pml_bfo_recv_request_t*) (*message)->req_ptr; - frag = (mca_pml_bfo_recv_frag_t*) recvreq->req_recv.req_base.req_addr; - src = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE; - tag = recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG; - comm = (*message)->comm; - bfo_comm = recvreq->req_recv.req_base.req_comm->c_pml_comm; - seq = recvreq->req_recv.req_base.req_sequence; - - /* make the request a recv request again */ - /* The old request kept pointers to comm and the char datatype. - We're about to release those, but need to make sure comm - doesn't go out of scope (we don't care about the char datatype - anymore). So retain comm, then release the frag, then reinit - the frag (which will retain comm), then release comm (but the - frag still has it's ref, so it'll stay in scope). Make - sense? */ - OBJ_RETAIN(comm); - MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq->req_recv); - recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_RECV; - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, - buf, - count, datatype, - src, tag, comm, false); - OBJ_RELEASE(comm); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &((recvreq)->req_recv.req_base), - PERUSE_RECV); - - /* init/re-init the request */ - recvreq->req_lock = 0; - recvreq->req_pipeline_depth = 0; - recvreq->req_bytes_received = 0; - /* What about req_rdma_cnt ? */ - recvreq->req_rdma_idx = 0; - recvreq->req_pending = false; - recvreq->req_ack_sent = false; - - MCA_PML_BASE_RECV_START(&recvreq->req_recv.req_base); - - /* Note - sequence number already assigned */ - recvreq->req_recv.req_base.req_sequence = seq; - - proc = &bfo_comm->procs[recvreq->req_recv.req_base.req_peer]; - recvreq->req_recv.req_base.req_proc = proc->ompi_proc; - prepare_recv_req_converter(recvreq); - - /* we can't go through the match, since we already have the match. - Cheat and do what REQUEST_START does, but without the frag - search */ - hdr = (mca_pml_bfo_hdr_t*)frag->segments->seg_addr.pval; - switch(hdr->hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - mca_pml_bfo_recv_request_progress_match(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - mca_pml_bfo_recv_request_progress_rndv(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - mca_pml_bfo_recv_request_progress_rget(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - default: - assert(0); - } - MCA_PML_BFO_RECV_FRAG_RETURN(frag); - - ompi_message_return(*message); - *message = MPI_MESSAGE_NULL; - *request = (ompi_request_t *) recvreq; - - return OMPI_SUCCESS; -} - - -int -mca_pml_bfo_mrecv( void *buf, - size_t count, - ompi_datatype_t *datatype, - struct ompi_message_t **message, - ompi_status_public_t* status ) -{ - mca_pml_bfo_recv_frag_t* frag; - mca_pml_bfo_recv_request_t *recvreq; - mca_pml_bfo_hdr_t *hdr; - int src, tag, rc; - ompi_communicator_t *comm; - mca_pml_bfo_comm_proc_t* proc; - mca_pml_bfo_comm_t* bfo_comm; - uint64_t seq; - - /* get the request from the message and the frag from the request - before we overwrite everything */ - comm = (*message)->comm; - recvreq = (mca_pml_bfo_recv_request_t*) (*message)->req_ptr; - frag = (mca_pml_bfo_recv_frag_t*) recvreq->req_recv.req_base.req_addr; - src = recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE; - tag = recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG; - seq = recvreq->req_recv.req_base.req_sequence; - bfo_comm = recvreq->req_recv.req_base.req_comm->c_pml_comm; - - /* make the request a recv request again */ - /* The old request kept pointers to comm and the char datatype. - We're about to release those, but need to make sure comm - doesn't go out of scope (we don't care about the char datatype - anymore). So retain comm, then release the frag, then reinit - the frag (which will retain comm), then release comm (but the - frag still has it's ref, so it'll stay in scope). Make - sense? */ - OBJ_RETAIN(comm); - MCA_PML_BASE_RECV_REQUEST_FINI(&recvreq->req_recv); - recvreq->req_recv.req_base.req_type = MCA_PML_REQUEST_RECV; - MCA_PML_BFO_RECV_REQUEST_INIT(recvreq, - buf, - count, datatype, - src, tag, comm, false); - OBJ_RELEASE(comm); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &((recvreq)->req_recv.req_base), - PERUSE_RECV); - - /* init/re-init the request */ - recvreq->req_lock = 0; - recvreq->req_pipeline_depth = 0; - recvreq->req_bytes_received = 0; - recvreq->req_rdma_cnt = 0; - recvreq->req_rdma_idx = 0; - recvreq->req_pending = false; - - MCA_PML_BASE_RECV_START(&recvreq->req_recv.req_base); - - /* Note - sequence number already assigned */ - recvreq->req_recv.req_base.req_sequence = seq; - - proc = &bfo_comm->procs[recvreq->req_recv.req_base.req_peer]; - recvreq->req_recv.req_base.req_proc = proc->ompi_proc; - prepare_recv_req_converter(recvreq); - - /* we can't go through the match, since we already have the match. - Cheat and do what REQUEST_START does, but without the frag - search */ - hdr = (mca_pml_bfo_hdr_t*)frag->segments->seg_addr.pval; - switch(hdr->hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - mca_pml_bfo_recv_request_progress_match(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - mca_pml_bfo_recv_request_progress_rndv(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - mca_pml_bfo_recv_request_progress_rget(recvreq, frag->btl, frag->segments, - frag->num_segments); - break; - default: - assert(0); - } - - ompi_message_return(*message); - *message = MPI_MESSAGE_NULL; - ompi_request_wait_completion(&(recvreq->req_recv.req_base.req_ompi)); - - MCA_PML_BFO_RECV_FRAG_RETURN(frag); - - if (NULL != status) { /* return status */ - *status = recvreq->req_recv.req_base.req_ompi.req_status; - } - rc = recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR; - ompi_request_free( (ompi_request_t**)&recvreq ); - return rc; -} - diff --git a/ompi/mca/pml/bfo/pml_bfo_isend.c b/ompi/mca/pml/bfo/pml_bfo_isend.c deleted file mode 100644 index 599d1afc0a4..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_isend.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2007 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "pml_bfo.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_recvreq.h" -#include "ompi/peruse/peruse-internal.h" - -int mca_pml_bfo_isend_init(void *buf, - size_t count, - ompi_datatype_t * datatype, - int dst, - int tag, - mca_pml_base_send_mode_t sendmode, - ompi_communicator_t * comm, - ompi_request_t ** request) -{ - mca_pml_bfo_send_request_t *sendreq = NULL; - MCA_PML_BFO_SEND_REQUEST_ALLOC(comm, dst, sendreq); - if (NULL == sendreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_SEND_REQUEST_INIT(sendreq, - buf, - count, - datatype, - dst, tag, - comm, sendmode, true); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &(sendreq)->req_send.req_base, - PERUSE_SEND); - - *request = (ompi_request_t *) sendreq; - return OMPI_SUCCESS; -} - - -int mca_pml_bfo_isend(void *buf, - size_t count, - ompi_datatype_t * datatype, - int dst, - int tag, - mca_pml_base_send_mode_t sendmode, - ompi_communicator_t * comm, - ompi_request_t ** request) -{ - int rc; - mca_pml_bfo_send_request_t *sendreq = NULL; - - MCA_PML_BFO_SEND_REQUEST_ALLOC(comm, dst, sendreq); - if (NULL == sendreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_SEND_REQUEST_INIT(sendreq, - buf, - count, - datatype, - dst, tag, - comm, sendmode, false); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &(sendreq)->req_send.req_base, - PERUSE_SEND); - - MCA_PML_BFO_SEND_REQUEST_START(sendreq, rc); - *request = (ompi_request_t *) sendreq; - return rc; -} - - -int mca_pml_bfo_send(void *buf, - size_t count, - ompi_datatype_t * datatype, - int dst, - int tag, - mca_pml_base_send_mode_t sendmode, - ompi_communicator_t * comm) -{ - int rc; - mca_pml_bfo_send_request_t *sendreq; - - MCA_PML_BFO_SEND_REQUEST_ALLOC(comm, dst, sendreq); - if (NULL == sendreq) - return OMPI_ERR_OUT_OF_RESOURCE; - - MCA_PML_BFO_SEND_REQUEST_INIT(sendreq, - buf, - count, - datatype, - dst, tag, - comm, sendmode, false); - - PERUSE_TRACE_COMM_EVENT (PERUSE_COMM_REQ_ACTIVATE, - &(sendreq)->req_send.req_base, - PERUSE_SEND); - - MCA_PML_BFO_SEND_REQUEST_START(sendreq, rc); - if (rc != OMPI_SUCCESS) { - MCA_PML_BFO_SEND_REQUEST_RETURN( sendreq ); - return rc; - } - - ompi_request_wait_completion(&sendreq->req_send.req_base.req_ompi); - - rc = sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR; - ompi_request_free( (ompi_request_t**)&sendreq ); - return rc; -} diff --git a/ompi/mca/pml/bfo/pml_bfo_progress.c b/ompi/mca/pml/bfo/pml_bfo_progress.c deleted file mode 100644 index 1ab217357b6..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_progress.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "pml_bfo.h" -#include "pml_bfo_sendreq.h" -#include "ompi/mca/bml/base/base.h" - -int mca_pml_bfo_progress(void) -{ - int i, queue_length = opal_list_get_size(&mca_pml_bfo.send_pending); - int j, completed_requests = 0; - bool send_succedded; - - if( OPAL_LIKELY(0 == queue_length) ) - return 0; - - for( i = 0; i < queue_length; i++ ) { - mca_pml_bfo_send_pending_t pending_type = MCA_PML_BFO_SEND_PENDING_NONE; - mca_pml_bfo_send_request_t* sendreq; - mca_bml_base_endpoint_t* endpoint; - - sendreq = get_request_from_send_pending(&pending_type); - if(OPAL_UNLIKELY(NULL == sendreq)) - break; - - switch(pending_type) { - case MCA_PML_BFO_SEND_PENDING_NONE: - assert(0); - return 0; - case MCA_PML_BFO_SEND_PENDING_SCHEDULE: - if( mca_pml_bfo_send_request_schedule_exclusive(sendreq) == - OMPI_ERR_OUT_OF_RESOURCE ) { - return 0; - } - completed_requests++; - break; - case MCA_PML_BFO_SEND_PENDING_START: - endpoint = sendreq->req_endpoint; - send_succedded = false; - for(j = 0; j < (int)mca_bml_base_btl_array_get_size(&endpoint->btl_eager); j++) { - mca_bml_base_btl_t* bml_btl; - int rc; - - /* select a btl */ - bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); - rc = mca_pml_bfo_send_request_start_btl(sendreq, bml_btl); - if( OPAL_LIKELY(OMPI_SUCCESS == rc) ) { - send_succedded = true; - completed_requests++; - break; - } - } - if( false == send_succedded ) { - add_request_to_send_pending(sendreq, MCA_PML_BFO_SEND_PENDING_START, true); - } - } - } - return completed_requests; -} - diff --git a/ompi/mca/pml/bfo/pml_bfo_rdma.c b/ompi/mca/pml/bfo/pml_bfo_rdma.c deleted file mode 100644 index 0bd99849073..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_rdma.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - -#include "ompi_config.h" -#include "ompi/constants.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/bml/bml.h" -#include "opal/mca/mpool/mpool.h" -#include "pml_bfo.h" -#include "pml_bfo_rdma.h" - -/* Use this registration if no registration needed for a BTL instead of NULL. - * This will help other code to distinguish case when memory is not registered - * from case when registration is not needed */ -static mca_mpool_base_registration_t pml_bfo_dummy_reg; - -/* - * Check to see if memory is registered or can be registered. Build a - * set of registrations on the request. - */ - -size_t mca_pml_bfo_rdma_btls( - mca_bml_base_endpoint_t* bml_endpoint, - unsigned char* base, - size_t size, - mca_pml_bfo_com_btl_t* rdma_btls) -{ - int num_btls = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_rdma); - double weight_total = 0; - int num_btls_used = 0, n; - - /* shortcut when there are no rdma capable btls */ - if(num_btls == 0) { - return 0; - } - - /* check to see if memory is registered */ - for(n = 0; n < num_btls && num_btls_used < mca_pml_bfo.max_rdma_per_request; - n++) { - mca_bml_base_btl_t* bml_btl = - mca_bml_base_btl_array_get_index(&bml_endpoint->btl_rdma, - (bml_endpoint->btl_rdma_index + n) % num_btls); - mca_mpool_base_registration_t* reg = &pml_bfo_dummy_reg; - mca_mpool_base_module_t *btl_mpool = bml_btl->btl->btl_mpool; - - if( NULL != btl_mpool ) { - if(!mca_pml_bfo.leave_pinned) { - /* look through existing registrations */ - btl_mpool->mpool_find(btl_mpool, base, size, ®); - } else { - /* register the memory */ - btl_mpool->mpool_register(btl_mpool, base, size, 0, ®); - } - - if(NULL == reg) - continue; - } - - rdma_btls[num_btls_used].bml_btl = bml_btl; - rdma_btls[num_btls_used].btl_reg = reg; - weight_total += bml_btl->btl_weight; - num_btls_used++; - } - - /* if we don't use leave_pinned and all BTLs that already have this memory - * registered amount to less then half of available bandwidth - fall back to - * pipeline protocol */ - if(0 == num_btls_used || (!mca_pml_bfo.leave_pinned && weight_total < 0.5)) - return 0; - - mca_pml_bfo_calc_weighted_length(rdma_btls, num_btls_used, size, - weight_total); - - bml_endpoint->btl_rdma_index = (bml_endpoint->btl_rdma_index + 1) % num_btls; - return num_btls_used; -} - -size_t mca_pml_bfo_rdma_pipeline_btls( mca_bml_base_endpoint_t* bml_endpoint, - size_t size, - mca_pml_bfo_com_btl_t* rdma_btls ) -{ - int i, num_btls = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_rdma); - double weight_total = 0; - - for(i = 0; i < num_btls && i < mca_pml_bfo.max_rdma_per_request; i++) { - rdma_btls[i].bml_btl = - mca_bml_base_btl_array_get_next(&bml_endpoint->btl_rdma); - if(NULL != rdma_btls[i].bml_btl->btl->btl_mpool) - rdma_btls[i].btl_reg = NULL; - else - rdma_btls[i].btl_reg = &pml_bfo_dummy_reg; - - weight_total += rdma_btls[i].bml_btl->btl_weight; - } - - mca_pml_bfo_calc_weighted_length(rdma_btls, i, size, weight_total); - - return i; -} diff --git a/ompi/mca/pml/bfo/pml_bfo_rdma.h b/ompi/mca/pml/bfo/pml_bfo_rdma.h deleted file mode 100644 index abeb65a0f8b..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_rdma.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004-2005 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ - -#ifndef MCA_PML_BFO_RDMA_H -#define MCA_PML_BFO_RDMA_H - -struct mca_bml_base_endpoint_t; - -/* - * Of the set of available btls that support RDMA, - * find those that already have registrations - or - * register if required (for leave_pinned option) - */ -size_t mca_pml_bfo_rdma_btls(struct mca_bml_base_endpoint_t* endpoint, - unsigned char* base, size_t size, struct mca_pml_bfo_com_btl_t* btls); - -/* Choose RDMA BTLs to use for sending of a request by pipeline protocol. - * Calculate number of bytes to send through each BTL according to available - * bandwidth */ -size_t mca_pml_bfo_rdma_pipeline_btls(struct mca_bml_base_endpoint_t* endpoint, - size_t size, mca_pml_bfo_com_btl_t* rdma_btls); -#endif - diff --git a/ompi/mca/pml/bfo/pml_bfo_rdmafrag.c b/ompi/mca/pml/bfo/pml_bfo_rdmafrag.c deleted file mode 100644 index b99e30a8de5..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_rdmafrag.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2004-2005 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 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "pml_bfo.h" -#include "pml_bfo_rdmafrag.h" - - -OBJ_CLASS_INSTANCE( - mca_pml_bfo_rdma_frag_t, - ompi_free_list_item_t, - NULL, - NULL); diff --git a/ompi/mca/pml/bfo/pml_bfo_rdmafrag.h b/ompi/mca/pml/bfo/pml_bfo_rdmafrag.h deleted file mode 100644 index 883c16baa1f..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_rdmafrag.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ - -#ifndef MCA_PML_BFO_RDMAFRAG_H -#define MCA_PML_BFO_RDMAFRAG_H - -#include "pml_bfo_hdr.h" -#include "opal/mca/mpool/base/base.h" - -BEGIN_C_DECLS - -typedef enum { - MCA_PML_BFO_RDMA_PUT, - MCA_PML_BFO_RDMA_GET -} mca_pml_bfo_rdma_state_t; - -struct mca_pml_bfo_rdma_frag_t { - opal_free_list_item_t super; - mca_bml_base_btl_t* rdma_bml; -#if PML_BFO - mca_btl_base_module_t* rdma_btl; -#endif /* PML_BFO */ - mca_pml_bfo_hdr_t rdma_hdr; - mca_pml_bfo_rdma_state_t rdma_state; - size_t rdma_length; - uint8_t rdma_segs[MCA_BTL_SEG_MAX_SIZE * MCA_BTL_DES_MAX_SEGMENTS]; - void *rdma_req; - struct mca_bml_base_endpoint_t* rdma_ep; - opal_convertor_t convertor; - struct mca_mpool_base_registration_t* reg; - uint32_t retries; -}; -typedef struct mca_pml_bfo_rdma_frag_t mca_pml_bfo_rdma_frag_t; - -OBJ_CLASS_DECLARATION(mca_pml_bfo_rdma_frag_t); - - -#define MCA_PML_BFO_RDMA_FRAG_ALLOC(frag) \ -do { \ - opal_free_list_item_t* item; \ - OPAL_FREE_LIST_WAIT_MT(&mca_pml_bfo.rdma_frags, item); \ - frag = (mca_pml_bfo_rdma_frag_t*)item; \ -} while(0) - -#define MCA_PML_BFO_RDMA_FRAG_RETURN(frag) \ -do { \ - /* return fragment */ \ - OPAL_FREE_LIST_RETURN_MT(&mca_pml_bfo.rdma_frags, \ - (opal_free_list_item_t*)frag); \ -} while(0) - - -END_C_DECLS - -#endif - diff --git a/ompi/mca/pml/bfo/pml_bfo_recvfrag.c b/ompi/mca/pml/bfo/pml_bfo_recvfrag.c deleted file mode 100644 index c7216c0d538..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_recvfrag.c +++ /dev/null @@ -1,743 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2007 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2006-2008 University of Houston. All rights reserved. - * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - */ - -#include "ompi_config.h" - -#include "opal/class/opal_list.h" -#include "opal/threads/mutex.h" -#include "opal/prefetch.h" - -#include "ompi/constants.h" -#include "ompi/communicator/communicator.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/peruse/peruse-internal.h" -#include "ompi/memchecker.h" - -#include "pml_bfo.h" -#include "pml_bfo_comm.h" -#include "pml_bfo_recvfrag.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_hdr.h" -#if PML_BFO -#include "pml_bfo_failover.h" -#endif /* PML_BFO */ - -OBJ_CLASS_INSTANCE( mca_pml_bfo_buffer_t, - ompi_free_list_item_t, - NULL, - NULL ); - -OBJ_CLASS_INSTANCE( mca_pml_bfo_recv_frag_t, - opal_list_item_t, - NULL, - NULL ); - -/** - * Static functions. - */ - -/** - * Append a unexpected descriptor to a queue. This function will allocate and - * initialize the fragment (if necessary) and then will add it to the specified - * queue. The allocated fragment is not returned to the caller. - */ -static void -append_frag_to_list(opal_list_t *queue, mca_btl_base_module_t *btl, - mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t* segments, - size_t num_segments, mca_pml_bfo_recv_frag_t* frag) -{ - if(NULL == frag) { - MCA_PML_BFO_RECV_FRAG_ALLOC(frag); - MCA_PML_BFO_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl); - } - opal_list_append(queue, (opal_list_item_t*)frag); -} - -/** - * Match incoming recv_frags against posted receives. - * Supports out of order delivery. - * - * @param frag_header (IN) Header of received recv_frag. - * @param frag_desc (IN) Received recv_frag descriptor. - * @param match_made (OUT) Flag indicating wether a match was made. - * @param additional_matches (OUT) List of additional matches - * @return OMPI_SUCCESS or error status on failure. - */ -static int mca_pml_bfo_recv_frag_match( mca_btl_base_module_t *btl, - mca_pml_bfo_match_hdr_t *hdr, - mca_btl_base_segment_t* segments, - size_t num_segments, - int type); - -static mca_pml_bfo_recv_request_t* -match_one(mca_btl_base_module_t *btl, - mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t* segments, - size_t num_segments, ompi_communicator_t *comm_ptr, - mca_pml_bfo_comm_proc_t *proc, - mca_pml_bfo_recv_frag_t* frag); - -void mca_pml_bfo_recv_frag_callback_match(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) -{ - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_match_hdr_t* hdr = (mca_pml_bfo_match_hdr_t*)segments->seg_addr.pval; - ompi_communicator_t *comm_ptr; - mca_pml_bfo_recv_request_t *match = NULL; - mca_pml_bfo_comm_t *comm; - mca_pml_bfo_comm_proc_t *proc; - size_t num_segments = des->des_local_count; - size_t bytes_received = 0; - - assert(num_segments <= MCA_BTL_DES_MAX_SEGMENTS); - - if( OPAL_UNLIKELY(segments->seg_len < OMPI_PML_BFO_MATCH_HDR_LEN) ) { - return; - } - bfo_hdr_ntoh(((mca_pml_bfo_hdr_t*) hdr), MCA_PML_BFO_HDR_TYPE_MATCH); - - /* communicator pointer */ - comm_ptr = ompi_comm_lookup(hdr->hdr_ctx); - if(OPAL_UNLIKELY(NULL == comm_ptr)) { - /* This is a special case. A message for a not yet existing - * communicator can happens. Instead of doing a matching we - * will temporarily add it the a pending queue in the PML. - * Later on, when the communicator is completely instantiated, - * this pending queue will be searched and all matching fragments - * moved to the right communicator. - */ - append_frag_to_list( &mca_pml_bfo.non_existing_communicator_pending, - btl, hdr, segments, num_segments, NULL ); - return; - } - comm = (mca_pml_bfo_comm_t *)comm_ptr->c_pml_comm; - - /* source sequence number */ - proc = &comm->procs[hdr->hdr_src]; - - /* We generate the MSG_ARRIVED event as soon as the PML is aware - * of a matching fragment arrival. Independing if it is received - * on the correct order or not. This will allow the tools to - * figure out if the messages are not received in the correct - * order (if multiple network interfaces). - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - /* get next expected message sequence number - if threaded - * run, lock to make sure that if another thread is processing - * a frag from the same message a match is made only once. - * Also, this prevents other posted receives (for a pair of - * end points) from being processed, and potentially "loosing" - * the fragment. - */ - OPAL_THREAD_LOCK(&comm->matching_lock); - - /* get sequence number of next message that can be processed */ - if(OPAL_UNLIKELY((((uint16_t) hdr->hdr_seq) != ((uint16_t) proc->expected_sequence)) || - (opal_list_get_size(&proc->frags_cant_match) > 0 ))) { - goto slow_path; - } - - /* This is the sequence number we were expecting, so we can try - * matching it to already posted receives. - */ - - /* We're now expecting the next sequence number. */ - proc->expected_sequence++; - - /* We generate the SEARCH_POSTED_QUEUE only when the message is - * received in the correct sequence. Otherwise, we delay the event - * generation until we reach the correct sequence number. - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_BEGIN, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - match = match_one(btl, hdr, segments, num_segments, comm_ptr, proc, NULL); - - /* The match is over. We generate the SEARCH_POSTED_Q_END here, - * before going into the mca_pml_bfo_check_cantmatch_for_match so - * we can make a difference for the searching time for all - * messages. - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_END, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - /* release matching lock before processing fragment */ - OPAL_THREAD_UNLOCK(&comm->matching_lock); - - if(OPAL_LIKELY(match)) { - bytes_received = segments->seg_len - OMPI_PML_BFO_MATCH_HDR_LEN; - match->req_recv.req_bytes_packed = bytes_received; - - MCA_PML_BFO_RECV_REQUEST_MATCHED(match, hdr); - if(match->req_bytes_expected > 0) { - struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; - uint32_t iov_count = 1; - - /* - * Make user buffer accessable(defined) before unpacking. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - match->req_recv.req_base.req_addr, - match->req_recv.req_base.req_count, - match->req_recv.req_base.req_datatype); - ); - - iov[0].iov_len = bytes_received; - iov[0].iov_base = (IOVBASE_TYPE*)((unsigned char*)segments->seg_addr.pval + - OMPI_PML_BFO_MATCH_HDR_LEN); - while (iov_count < num_segments) { - bytes_received += segments[iov_count].seg_len; - iov[iov_count].iov_len = segments[iov_count].seg_len; - iov[iov_count].iov_base = (IOVBASE_TYPE*)((unsigned char*)segments[iov_count].seg_addr.pval); - iov_count++; - } - opal_convertor_unpack( &match->req_recv.req_base.req_convertor, - iov, - &iov_count, - &bytes_received ); - match->req_bytes_received = bytes_received; - /* - * Unpacking finished, make the user buffer unaccessable again. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - match->req_recv.req_base.req_addr, - match->req_recv.req_base.req_count, - match->req_recv.req_base.req_datatype); - ); - } - - /* no need to check if complete we know we are.. */ - /* don't need a rmb as that is for checking */ - recv_request_pml_complete(match); - } - return; - - slow_path: - OPAL_THREAD_UNLOCK(&comm->matching_lock); -#if PML_BFO - if (true == mca_pml_bfo_is_duplicate_msg(proc, hdr)) { - return; - } -#endif /* PML_BFO */ - mca_pml_bfo_recv_frag_match(btl, hdr, segments, - num_segments, MCA_PML_BFO_HDR_TYPE_MATCH); -} - - -void mca_pml_bfo_recv_frag_callback_rndv(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) -{ - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RNDV); - mca_pml_bfo_recv_frag_match(btl, &hdr->hdr_match, segments, - des->des_local_count, MCA_PML_BFO_HDR_TYPE_RNDV); - return; -} - -void mca_pml_bfo_recv_frag_callback_rget(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) -{ - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_RGET); - mca_pml_bfo_recv_frag_match(btl, &hdr->hdr_match, segments, - des->des_local_count, MCA_PML_BFO_HDR_TYPE_RGET); - return; -} - - - -void mca_pml_bfo_recv_frag_callback_ack(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) -{ - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_send_request_t* sendreq; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_ACK); - sendreq = (mca_pml_bfo_send_request_t*)hdr->hdr_ack.hdr_src_req.pval; - sendreq->req_recv = hdr->hdr_ack.hdr_dst_req; -#if PML_BFO - MCA_PML_BFO_ERROR_CHECK_ON_ACK_CALLBACK(sendreq); -#endif /* PML_BFO */ - - /* if the request should be delivered entirely by copy in/out - * then throttle sends */ - if(hdr->hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_NORDMA) - sendreq->req_throttle_sends = true; - - mca_pml_bfo_send_request_copy_in_out(sendreq, - hdr->hdr_ack.hdr_send_offset, - sendreq->req_send.req_bytes_packed - - hdr->hdr_ack.hdr_send_offset); - - if (sendreq->req_state != 0) { - /* Typical receipt of an ACK message causes req_state to be - * decremented. However, a send request that started as an - * RGET request can become a RNDV. For example, when the - * receiver determines that its receive buffer is not - * contiguous and therefore cannot support the RGET - * protocol. A send request that started with the RGET - * protocol has req_state == 0 and as such should not be - * decremented. - */ - OPAL_THREAD_ADD_FETCH32(&sendreq->req_state, -1); - } - - if(send_request_pml_complete_check(sendreq) == false) - mca_pml_bfo_send_request_schedule(sendreq); - - return; -} - -void mca_pml_bfo_recv_frag_callback_frag(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_recv_request_t* recvreq; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_FRAG); - recvreq = (mca_pml_bfo_recv_request_t*)hdr->hdr_frag.hdr_dst_req.pval; -#if PML_BFO - MCA_PML_BFO_ERROR_CHECK_ON_FRAG_CALLBACK(recvreq); -#endif /* PML_BFO */ - mca_pml_bfo_recv_request_progress_frag(recvreq,btl,segments,des->des_local_count); - - return; -} - - -void mca_pml_bfo_recv_frag_callback_put(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_pml_bfo_send_request_t* sendreq; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_PUT); - sendreq = (mca_pml_bfo_send_request_t*)hdr->hdr_rdma.hdr_req.pval; -#if PML_BFO - MCA_PML_BFO_ERROR_CHECK_ON_PUT_CALLBACK(sendreq); -#endif /* PML_BFO */ - mca_pml_bfo_send_request_put(sendreq,btl,&hdr->hdr_rdma); - - return; -} - - -void mca_pml_bfo_recv_frag_callback_fin(mca_btl_base_module_t* btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* des, - void* cbdata ) { - mca_btl_base_segment_t* segments = des->des_local; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - mca_btl_base_descriptor_t* rdma; - - if( OPAL_UNLIKELY(segments->seg_len < sizeof(mca_pml_bfo_common_hdr_t)) ) { - return; - } - - bfo_hdr_ntoh(hdr, MCA_PML_BFO_HDR_TYPE_FIN); - rdma = (mca_btl_base_descriptor_t*)hdr->hdr_fin.hdr_des.pval; -#if PML_BFO - if (true == mca_pml_bfo_is_duplicate_fin(hdr, rdma, btl)) { - return; - } -#endif /* PML_BFO */ - rdma->des_cbfunc(btl, NULL, rdma, - hdr->hdr_fin.hdr_fail ? OMPI_ERROR : OMPI_SUCCESS); - - return; -} - - - -#define PML_MAX_SEQ ~((mca_pml_sequence_t)0); - -static inline mca_pml_bfo_recv_request_t* get_posted_recv(opal_list_t *queue) -{ - if(opal_list_get_size(queue) == 0) - return NULL; - - return (mca_pml_bfo_recv_request_t*)opal_list_get_first(queue); -} - -static inline mca_pml_bfo_recv_request_t* get_next_posted_recv( - opal_list_t *queue, - mca_pml_bfo_recv_request_t* req) -{ - opal_list_item_t *i = opal_list_get_next((opal_list_item_t*)req); - - if(opal_list_get_end(queue) == i) - return NULL; - - return (mca_pml_bfo_recv_request_t*)i; -} - -static mca_pml_bfo_recv_request_t *match_incomming( - mca_pml_bfo_match_hdr_t *hdr, mca_pml_bfo_comm_t *comm, - mca_pml_bfo_comm_proc_t *proc) -{ - mca_pml_bfo_recv_request_t *specific_recv, *wild_recv; - mca_pml_sequence_t wild_recv_seq, specific_recv_seq; - int tag = hdr->hdr_tag; - - specific_recv = get_posted_recv(&proc->specific_receives); - wild_recv = get_posted_recv(&comm->wild_receives); - - wild_recv_seq = wild_recv ? - wild_recv->req_recv.req_base.req_sequence : PML_MAX_SEQ; - specific_recv_seq = specific_recv ? - specific_recv->req_recv.req_base.req_sequence : PML_MAX_SEQ; - - /* they are equal only if both are PML_MAX_SEQ */ - while(wild_recv_seq != specific_recv_seq) { - mca_pml_bfo_recv_request_t **match; - opal_list_t *queue; - int req_tag; - mca_pml_sequence_t *seq; - - if (OPAL_UNLIKELY(wild_recv_seq < specific_recv_seq)) { - match = &wild_recv; - queue = &comm->wild_receives; - seq = &wild_recv_seq; - } else { - match = &specific_recv; - queue = &proc->specific_receives; - seq = &specific_recv_seq; - } - - req_tag = (*match)->req_recv.req_base.req_tag; - if(req_tag == tag || (req_tag == OMPI_ANY_TAG && tag >= 0)) { - opal_list_remove_item(queue, (opal_list_item_t*)(*match)); - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_REMOVE_FROM_POSTED_Q, - &((*match)->req_recv.req_base), PERUSE_RECV); - return *match; - } - - *match = get_next_posted_recv(queue, *match); - *seq = (*match) ? (*match)->req_recv.req_base.req_sequence : PML_MAX_SEQ; - } - - return NULL; -} - -static mca_pml_bfo_recv_request_t* -match_one(mca_btl_base_module_t *btl, - mca_pml_bfo_match_hdr_t *hdr, mca_btl_base_segment_t* segments, - size_t num_segments, ompi_communicator_t *comm_ptr, - mca_pml_bfo_comm_proc_t *proc, - mca_pml_bfo_recv_frag_t* frag) -{ - mca_pml_bfo_recv_request_t *match; - mca_pml_bfo_comm_t *comm = (mca_pml_bfo_comm_t *)comm_ptr->c_pml_comm; - - do { - match = match_incomming(hdr, comm, proc); - - /* if match found, process data */ - if(OPAL_LIKELY(NULL != match)) { - match->req_recv.req_base.req_proc = proc->ompi_proc; - - if(OPAL_UNLIKELY(MCA_PML_REQUEST_PROBE == match->req_recv.req_base.req_type)) { - /* complete the probe */ - mca_pml_bfo_recv_request_matched_probe(match, btl, segments, - num_segments); - /* attempt to match actual request */ - continue; - } else if (MCA_PML_REQUEST_MPROBE == match->req_recv.req_base.req_type) { - /* create a receive frag and associate it with the - request, which is then completed so that it can be - restarted later during mrecv */ - mca_pml_bfo_recv_frag_t *tmp; - if(NULL == frag) { - MCA_PML_BFO_RECV_FRAG_ALLOC(tmp); - MCA_PML_BFO_RECV_FRAG_INIT(tmp, hdr, segments, num_segments, btl); - } else { - tmp = frag; - } - - match->req_recv.req_base.req_addr = tmp; - mca_pml_bfo_recv_request_matched_probe(match, btl, segments, - num_segments); - /* this frag is already processed, so we want to break out - of the loop and not end up back on the unexpected queue. */ - return NULL; - } - - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_MSG_MATCH_POSTED_REQ, - &(match->req_recv.req_base), PERUSE_RECV); - return match; - } - - /* if no match found, place on unexpected queue */ - append_frag_to_list(&proc->unexpected_frags, btl, hdr, segments, - num_segments, frag); - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_INSERT_IN_UNEX_Q, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - return NULL; - } while(true); -} - -static mca_pml_bfo_recv_frag_t* check_cantmatch_for_match(mca_pml_bfo_comm_proc_t *proc) -{ - mca_pml_bfo_recv_frag_t *frag; - - /* search the list for a fragment from the send with sequence - * number next_msg_seq_expected - */ - for(frag = (mca_pml_bfo_recv_frag_t*)opal_list_get_first(&proc->frags_cant_match); - frag != (mca_pml_bfo_recv_frag_t*)opal_list_get_end(&proc->frags_cant_match); - frag = (mca_pml_bfo_recv_frag_t*)opal_list_get_next(frag)) - { - mca_pml_bfo_match_hdr_t* hdr = &frag->hdr.hdr_match; - /* - * If the message has the next expected seq from that proc... - */ - if(hdr->hdr_seq != proc->expected_sequence) - continue; - - opal_list_remove_item(&proc->frags_cant_match, (opal_list_item_t*)frag); - return frag; - } - - return NULL; -} - -/** - * RCS/CTS receive side matching - * - * @param hdr list of parameters needed for matching - * This list is also embeded in frag, - * but this allows to save a memory copy when - * a match is made in this routine. (IN) - * @param frag pointer to receive fragment which we want - * to match (IN/OUT). If a match is not made, - * hdr is copied to frag. - * @param match_made parameter indicating if we matched frag/ - * hdr (OUT) - * @param additional_matches if a match is made with frag, we - * may be able to match fragments that previously - * have arrived out-of-order. If this is the - * case, the associated fragment descriptors are - * put on this list for further processing. (OUT) - * - * @return OMPI error code - * - * This routine is used to try and match a newly arrived message fragment - * to pre-posted receives. The following assumptions are made - * - fragments are received out of order - * - for long messages, e.g. more than one fragment, a RTS/CTS algorithm - * is used. - * - 2nd and greater fragments include a receive descriptor pointer - * - fragments may be dropped - * - fragments may be corrupt - * - this routine may be called simultaneously by more than one thread - */ -static int mca_pml_bfo_recv_frag_match( mca_btl_base_module_t *btl, - mca_pml_bfo_match_hdr_t *hdr, - mca_btl_base_segment_t* segments, - size_t num_segments, - int type) -{ - /* local variables */ - uint16_t next_msg_seq_expected, frag_msg_seq; - ompi_communicator_t *comm_ptr; - mca_pml_bfo_recv_request_t *match = NULL; - mca_pml_bfo_comm_t *comm; - mca_pml_bfo_comm_proc_t *proc; - mca_pml_bfo_recv_frag_t* frag = NULL; - - /* communicator pointer */ - comm_ptr = ompi_comm_lookup(hdr->hdr_ctx); - if(OPAL_UNLIKELY(NULL == comm_ptr)) { - /* This is a special case. A message for a not yet existing - * communicator can happens. Instead of doing a matching we - * will temporarily add it the a pending queue in the PML. - * Later on, when the communicator is completely instantiated, - * this pending queue will be searched and all matching fragments - * moved to the right communicator. - */ - append_frag_to_list( &mca_pml_bfo.non_existing_communicator_pending, - btl, hdr, segments, num_segments, NULL ); - return OMPI_SUCCESS; - } - comm = (mca_pml_bfo_comm_t *)comm_ptr->c_pml_comm; - - /* source sequence number */ - frag_msg_seq = hdr->hdr_seq; - proc = &comm->procs[hdr->hdr_src]; - - /** - * We generate the MSG_ARRIVED event as soon as the PML is aware of a matching - * fragment arrival. Independing if it is received on the correct order or not. - * This will allow the tools to figure out if the messages are not received in the - * correct order (if multiple network interfaces). - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_ARRIVED, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - /* get next expected message sequence number - if threaded - * run, lock to make sure that if another thread is processing - * a frag from the same message a match is made only once. - * Also, this prevents other posted receives (for a pair of - * end points) from being processed, and potentially "loosing" - * the fragment. - */ - OPAL_THREAD_LOCK(&comm->matching_lock); - -#if PML_BFO - if(OPAL_UNLIKELY(hdr->hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_RESTART)) { - if (NULL == (match = mca_pml_bfo_get_request(hdr))) { - return OMPI_SUCCESS; - } - } else { -#endif /* PML_BFO */ - /* get sequence number of next message that can be processed */ - next_msg_seq_expected = (uint16_t)proc->expected_sequence; - if(OPAL_UNLIKELY(frag_msg_seq != next_msg_seq_expected)) - goto wrong_seq; - - /* - * This is the sequence number we were expecting, - * so we can try matching it to already posted - * receives. - */ - -out_of_order_match: - /* We're now expecting the next sequence number. */ - proc->expected_sequence++; - - /** - * We generate the SEARCH_POSTED_QUEUE only when the message is received - * in the correct sequence. Otherwise, we delay the event generation until - * we reach the correct sequence number. - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_BEGIN, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - match = match_one(btl, hdr, segments, num_segments, comm_ptr, proc, frag); - - /** - * The match is over. We generate the SEARCH_POSTED_Q_END here, before going - * into the mca_pml_bfo_check_cantmatch_for_match so we can make a difference - * for the searching time for all messages. - */ - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_SEARCH_POSTED_Q_END, comm_ptr, - hdr->hdr_src, hdr->hdr_tag, PERUSE_RECV); - - /* release matching lock before processing fragment */ - OPAL_THREAD_UNLOCK(&comm->matching_lock); - -#if PML_BFO - } -#endif /* PML_BFO */ - if(OPAL_LIKELY(match)) { - switch(type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - mca_pml_bfo_recv_request_progress_match(match, btl, segments, num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - mca_pml_bfo_recv_request_progress_rndv(match, btl, segments, num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - mca_pml_bfo_recv_request_progress_rget(match, btl, segments, num_segments); - break; - } - - if(OPAL_UNLIKELY(frag)) - MCA_PML_BFO_RECV_FRAG_RETURN(frag); - } - - /* - * Now that new message has arrived, check to see if - * any fragments on the c_c_frags_cant_match list - * may now be used to form new matchs - */ - if(OPAL_UNLIKELY(opal_list_get_size(&proc->frags_cant_match) > 0)) { - OPAL_THREAD_LOCK(&comm->matching_lock); - if((frag = check_cantmatch_for_match(proc))) { - hdr = &frag->hdr.hdr_match; - segments = frag->segments; - num_segments = frag->num_segments; - btl = frag->btl; - type = hdr->hdr_common.hdr_type; - goto out_of_order_match; - } - OPAL_THREAD_UNLOCK(&comm->matching_lock); - } - - return OMPI_SUCCESS; -wrong_seq: - /* - * This message comes after the next expected, so it - * is ahead of sequence. Save it for later. - */ -#if PML_BFO - if (true == mca_pml_bfo_is_duplicate_msg(proc, hdr)) { - return OMPI_SUCCESS; - } -#endif /* PML_BFO */ - append_frag_to_list(&proc->frags_cant_match, btl, hdr, segments, - num_segments, NULL); - OPAL_THREAD_UNLOCK(&comm->matching_lock); - return OMPI_SUCCESS; -} - diff --git a/ompi/mca/pml/bfo/pml_bfo_recvfrag.h b/ompi/mca/pml/bfo/pml_bfo_recvfrag.h deleted file mode 100644 index 72c557daac1..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_recvfrag.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ - -#ifndef MCA_PML_BFO_RECVFRAG_H -#define MCA_PML_BFO_RECVFRAG_H - -#include "pml_bfo_hdr.h" - -BEGIN_C_DECLS - -struct mca_pml_bfo_buffer_t { - size_t len; - void * addr; -}; -typedef struct mca_pml_bfo_buffer_t mca_pml_bfo_buffer_t; - - -struct mca_pml_bfo_recv_frag_t { - opal_free_list_item_t super; - mca_pml_bfo_hdr_t hdr; - size_t num_segments; - mca_btl_base_module_t* btl; - mca_btl_base_segment_t segments[MCA_BTL_DES_MAX_SEGMENTS]; - mca_pml_bfo_buffer_t buffers[MCA_BTL_DES_MAX_SEGMENTS]; - unsigned char addr[1]; -}; -typedef struct mca_pml_bfo_recv_frag_t mca_pml_bfo_recv_frag_t; - -OBJ_CLASS_DECLARATION(mca_pml_bfo_recv_frag_t); - - -#define MCA_PML_BFO_RECV_FRAG_ALLOC(frag) \ -do { \ - opal_free_list_item_t* item; \ - OPAL_FREE_LIST_WAIT_MT(&mca_pml_bfo.recv_frags, item); \ - frag = (mca_pml_bfo_recv_frag_t*)item; \ -} while(0) - - -#define MCA_PML_BFO_RECV_FRAG_INIT(frag, hdr, segs, cnt, btl ) \ -do { \ - size_t i, _size; \ - mca_btl_base_segment_t* macro_segments = frag->segments; \ - mca_pml_bfo_buffer_t* buffers = frag->buffers; \ - unsigned char* _ptr = (unsigned char*)frag->addr; \ - /* init recv_frag */ \ - frag->btl = btl; \ - frag->hdr = *(mca_pml_bfo_hdr_t*)hdr; \ - frag->num_segments = 1; \ - _size = segs[0].seg_len; \ - for( i = 1; i < cnt; i++ ) { \ - _size += segs[i].seg_len; \ - } \ - /* copy over data */ \ - if(_size <= mca_pml_bfo.unexpected_limit ) { \ - macro_segments[0].seg_addr.pval = frag->addr; \ - } else { \ - buffers[0].len = _size; \ - buffers[0].addr = (char*) \ - mca_pml_bfo.allocator->alc_alloc( mca_pml_bfo.allocator, \ - buffers[0].len, \ - 0, NULL); \ - _ptr = (unsigned char*)(buffers[0].addr); \ - macro_segments[0].seg_addr.pval = buffers[0].addr; \ - } \ - macro_segments[0].seg_len = _size; \ - for( i = 0; i < cnt; i++ ) { \ - memcpy( _ptr, segs[i].seg_addr.pval, segs[i].seg_len); \ - _ptr += segs[i].seg_len; \ - } \ - } while(0) - - -#define MCA_PML_BFO_RECV_FRAG_RETURN(frag) \ -do { \ - if( frag->segments[0].seg_len > mca_pml_bfo.unexpected_limit ) { \ - /* return buffers */ \ - mca_pml_bfo.allocator->alc_free( mca_pml_bfo.allocator, \ - frag->buffers[0].addr ); \ - } \ - frag->num_segments = 0; \ - \ - /* return recv_frag */ \ - OPAL_FREE_LIST_RETURN(&mca_pml_bfo.recv_frags, \ - (opal_free_list_item_t*)frag); \ - } while(0) - - -/** - * Callback from BTL on receipt of a recv_frag (match). - */ - -extern void mca_pml_bfo_recv_frag_callback_match( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -/** - * Callback from BTL on receipt of a recv_frag (rndv). - */ - -extern void mca_pml_bfo_recv_frag_callback_rndv( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); -/** - * Callback from BTL on receipt of a recv_frag (rget). - */ - -extern void mca_pml_bfo_recv_frag_callback_rget( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - -/** - * Callback from BTL on receipt of a recv_frag (ack). - */ - -extern void mca_pml_bfo_recv_frag_callback_ack( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); -/** - * Callback from BTL on receipt of a recv_frag (frag). - */ - -extern void mca_pml_bfo_recv_frag_callback_frag( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); -/** - * Callback from BTL on receipt of a recv_frag (put). - */ - -extern void mca_pml_bfo_recv_frag_callback_put( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); -/** - * Callback from BTL on receipt of a recv_frag (fin). - */ - -extern void mca_pml_bfo_recv_frag_callback_fin( mca_btl_base_module_t *btl, - mca_btl_base_tag_t tag, - mca_btl_base_descriptor_t* descriptor, - void* cbdata ); - - -END_C_DECLS - -#endif - diff --git a/ompi/mca/pml/bfo/pml_bfo_recvreq.c b/ompi/mca/pml/bfo/pml_bfo_recvreq.c deleted file mode 100644 index c0658f10ef3..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_recvreq.c +++ /dev/null @@ -1,1165 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * 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 - * 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "opal/mca/mpool/mpool.h" -#include "opal/util/arch.h" -#include "ompi/mca/pml/pml.h" -#include "ompi/mca/bml/bml.h" -#include "pml_bfo_comm.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_recvfrag.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_rdmafrag.h" -#include "ompi/mca/bml/base/base.h" -#include "ompi/memchecker.h" -#if OPAL_CUDA_SUPPORT -#include "opal/datatype/opal_datatype_cuda.h" -#include "opal/mca/common/cuda/common_cuda.h" -#endif /* OPAL_CUDA_SUPPORT */ - -#if OPAL_CUDA_SUPPORT -int mca_pml_bfo_cuda_need_buffers(mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl); -#endif /* OPAL_CUDA_SUPPORT */ -#if PML_BFO -#include "pml_bfo_failover.h" -#endif /* PML_BFO */ - -void mca_pml_bfo_recv_request_process_pending(void) -{ - mca_pml_bfo_recv_request_t* recvreq; - int rc, i, s = (int)opal_list_get_size(&mca_pml_bfo.recv_pending); - - for(i = 0; i < s; i++) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - recvreq = (mca_pml_bfo_recv_request_t*) - opal_list_remove_first(&mca_pml_bfo.recv_pending); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - if( OPAL_UNLIKELY(NULL == recvreq) ) - break; - recvreq->req_pending = false; - rc = mca_pml_bfo_recv_request_schedule_exclusive(recvreq, NULL); - if(OMPI_ERR_OUT_OF_RESOURCE == rc) - break; - } -} - -static int mca_pml_bfo_recv_request_free(struct ompi_request_t** request) -{ - mca_pml_bfo_recv_request_t* recvreq = *(mca_pml_bfo_recv_request_t**)request; - - if(false == recvreq->req_recv.req_base.req_free_called) { - - recvreq->req_recv.req_base.req_free_called = true; - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_NOTIFY, - &(recvreq->req_recv.req_base), PERUSE_RECV ); - - if( true == recvreq->req_recv.req_base.req_pml_complete ) { - /* make buffer defined when the request is compeleted, - and before releasing the objects. */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - - MCA_PML_BFO_RECV_REQUEST_RETURN( recvreq ); - } - - } - *request = MPI_REQUEST_NULL; - return OMPI_SUCCESS; -} - -static int mca_pml_bfo_recv_request_cancel(struct ompi_request_t* ompi_request, int complete) -{ - mca_pml_bfo_recv_request_t* request = (mca_pml_bfo_recv_request_t*)ompi_request; - mca_pml_bfo_comm_t* comm = request->req_recv.req_base.req_comm->c_pml_comm; - - if( true == ompi_request->req_complete ) { /* way to late to cancel this one */ - /* - * Receive request completed, make user buffer accessable. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - request->req_recv.req_base.req_addr, - request->req_recv.req_base.req_count, - request->req_recv.req_base.req_datatype); - ); - return OMPI_SUCCESS; - } - - /* The rest should be protected behind the match logic lock */ - OPAL_THREAD_LOCK(&comm->matching_lock); - if( OMPI_ANY_TAG == ompi_request->req_status.MPI_TAG ) { /* the match has not been already done */ - if( request->req_recv.req_base.req_peer == OMPI_ANY_SOURCE ) { - opal_list_remove_item( &comm->wild_receives, (opal_list_item_t*)request ); - } else { - mca_pml_bfo_comm_proc_t* proc = comm->procs + request->req_recv.req_base.req_peer; - opal_list_remove_item(&proc->specific_receives, (opal_list_item_t*)request); - } - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_REMOVE_FROM_POSTED_Q, - &(request->req_recv.req_base), PERUSE_RECV ); - /** - * As now the PML is done with this request we have to force the pml_complete - * to true. Otherwise, the request will never be freed. - */ - request->req_recv.req_base.req_pml_complete = true; - } - OPAL_THREAD_UNLOCK(&comm->matching_lock); - - ompi_request->req_status._cancelled = true; - /* This macro will set the req_complete to true so the MPI Test/Wait* functions - * on this request will be able to complete. As the status is marked as - * cancelled the cancel state will be detected. - */ - MCA_PML_BFO_RECV_REQUEST_MPI_COMPLETE(request); - /* - * Receive request cancelled, make user buffer accessable. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - request->req_recv.req_base.req_addr, - request->req_recv.req_base.req_count, - request->req_recv.req_base.req_datatype); - ); - return OMPI_SUCCESS; -} - -static void mca_pml_bfo_recv_request_construct(mca_pml_bfo_recv_request_t* request) -{ - request->req_recv.req_base.req_type = MCA_PML_REQUEST_RECV; - request->req_recv.req_base.req_ompi.req_start = mca_pml_bfo_start; - request->req_recv.req_base.req_ompi.req_free = mca_pml_bfo_recv_request_free; - request->req_recv.req_base.req_ompi.req_cancel = mca_pml_bfo_recv_request_cancel; - request->req_rdma_cnt = 0; - OBJ_CONSTRUCT(&request->lock, opal_mutex_t); -} - -OBJ_CLASS_INSTANCE( - mca_pml_bfo_recv_request_t, - mca_pml_base_recv_request_t, - mca_pml_bfo_recv_request_construct, - NULL); - - -/* - * Release resources. - */ - -static void mca_pml_bfo_recv_ctl_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context; - -#if PML_BFO - if (btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) { - mca_pml_bfo_check_recv_ctl_completion_status(btl, des, status); - } - MCA_PML_BFO_CHECK_RECVREQ_EAGER_BML_BTL_RECV_CTL(bml_btl, btl, des); -#endif /* PML_BFO */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/* - * Put operation has completed remotely - update request status - */ - -static void mca_pml_bfo_put_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context; - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)des->des_cbdata; - size_t bytes_received = 0; - - if( OPAL_LIKELY(status == OMPI_SUCCESS) ) { - bytes_received = mca_pml_bfo_compute_segment_length (btl->btl_seg_size, - (void *) des->des_remote, - des->des_remote_count, 0); - } - OPAL_THREAD_SUB_FETCH_SIZE_T(&recvreq->req_pipeline_depth, 1); - -#if PML_BFO - btl->btl_free(btl, des); - MCA_PML_BFO_ERROR_CHECK_ON_FIN_FOR_PUT(recvreq); - MCA_PML_BFO_CHECK_RECVREQ_EAGER_BML_BTL(bml_btl, btl, recvreq, "PUT"); -#else /* PML_BFO */ - mca_bml_base_free(bml_btl, des); -#endif /* PML_BFO */ - - /* check completion status */ - OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); - if(recv_request_pml_complete_check(recvreq) == false && - recvreq->req_rdma_offset < recvreq->req_send_offset) { - /* schedule additional rdma operations */ - mca_pml_bfo_recv_request_schedule(recvreq, bml_btl); - } - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/* - * - */ - -int mca_pml_bfo_recv_request_ack_send_btl( - ompi_proc_t* proc, mca_bml_base_btl_t* bml_btl, - uint64_t hdr_src_req, void *hdr_dst_req, uint64_t hdr_send_offset, - bool nordma) -{ - mca_btl_base_descriptor_t* des; - mca_pml_bfo_ack_hdr_t* ack; - int rc; - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_ack_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - if( OPAL_UNLIKELY(NULL == des) ) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - /* fill out header */ - ack = (mca_pml_bfo_ack_hdr_t*)des->des_local->seg_addr.pval; - ack->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_ACK; - ack->hdr_common.hdr_flags = nordma ? MCA_PML_BFO_HDR_FLAGS_NORDMA : 0; - ack->hdr_src_req.lval = hdr_src_req; - ack->hdr_dst_req.pval = hdr_dst_req; - ack->hdr_send_offset = hdr_send_offset; - - bfo_hdr_hton(ack, MCA_PML_BFO_HDR_TYPE_ACK, proc); - - /* initialize descriptor */ - des->des_cbfunc = mca_pml_bfo_recv_ctl_completion; -#if PML_BFO - des->des_cbdata = hdr_dst_req; -#endif /* PML_BFO */ - - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_ACK); - if( OPAL_LIKELY( rc >= 0 ) ) { -#if PML_BFO - if ((bml_btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) && - (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK)) { - ((mca_pml_bfo_recv_request_t *)hdr_dst_req)->req_events++; - } -#endif /* PML_BFO */ - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, des); - return OMPI_ERR_OUT_OF_RESOURCE; -} - -static int mca_pml_bfo_recv_request_ack( - mca_pml_bfo_recv_request_t* recvreq, - mca_pml_bfo_rendezvous_hdr_t* hdr, - size_t bytes_received) -{ - ompi_proc_t* proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; - mca_bml_base_endpoint_t* bml_endpoint = NULL; - - bml_endpoint = (mca_bml_base_endpoint_t*) proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - /* by default copy everything */ - recvreq->req_send_offset = bytes_received; - if(hdr->hdr_msg_length > bytes_received) { - size_t rdma_num = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_rdma); - /* - * lookup request buffer to determine if memory is already - * registered. - */ - - if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == 0 && - hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_CONTIG && - rdma_num != 0) { - unsigned char *base; - opal_convertor_get_current_pointer( &recvreq->req_recv.req_base.req_convertor, (void**)&(base) ); - - if(hdr->hdr_match.hdr_common.hdr_flags & MCA_PML_BFO_HDR_FLAGS_PIN) - recvreq->req_rdma_cnt = mca_pml_bfo_rdma_btls(bml_endpoint, - base, recvreq->req_recv.req_bytes_packed, - recvreq->req_rdma ); - else - recvreq->req_rdma_cnt = 0; - - /* memory is already registered on both sides */ - if (recvreq->req_rdma_cnt != 0) { - recvreq->req_send_offset = hdr->hdr_msg_length; - /* are rdma devices available for long rdma protocol */ - } else if(bml_endpoint->btl_send_limit < hdr->hdr_msg_length) { - /* use convertor to figure out the rdma offset for this request */ - recvreq->req_send_offset = hdr->hdr_msg_length - - bml_endpoint->btl_pipeline_send_length; - - if(recvreq->req_send_offset < bytes_received) - recvreq->req_send_offset = bytes_received; - - /* use converter to figure out the rdma offset for this - * request */ - opal_convertor_set_position(&recvreq->req_recv.req_base.req_convertor, - &recvreq->req_send_offset); - - recvreq->req_rdma_cnt = - mca_pml_bfo_rdma_pipeline_btls(bml_endpoint, - recvreq->req_send_offset - bytes_received, - recvreq->req_rdma); - } - } - /* nothing to send by copy in/out - no need to ack */ - if(recvreq->req_send_offset == hdr->hdr_msg_length) - return OMPI_SUCCESS; - } - /* let know to shedule function there is no need to put ACK flag */ - recvreq->req_ack_sent = true; - return mca_pml_bfo_recv_request_ack_send(proc, hdr->hdr_src_req.lval, - recvreq, recvreq->req_send_offset, - recvreq->req_send_offset == bytes_received); -} - -/** - * Return resources used by the RDMA - */ - -static void mca_pml_bfo_rget_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context; - mca_pml_bfo_rdma_frag_t* frag = (mca_pml_bfo_rdma_frag_t*)des->des_cbdata; - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)frag->rdma_req; - -#if PML_BFO - if (btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) { - recvreq->req_events--; - } -#endif /* PML_BFO */ - /* check completion status */ - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { -#if PML_BFO - MCA_PML_BFO_ERROR_CHECK_ON_RDMA_READ_COMPLETION(recvreq); -#else /* PML_BFO */ - /* TSW - FIX */ - OMPI_ERROR_LOG(status); - ompi_rte_abort(-1, NULL); -#endif /* PML_BFO */ - } -#if PML_BFO - MCA_PML_BFO_SECOND_ERROR_CHECK_ON_RDMA_READ_COMPLETION(recvreq, status, btl); - MCA_PML_BFO_CHECK_RECVREQ_RDMA_BML_BTL(bml_btl, btl, recvreq, "RDMA write"); -#endif /* PML_BFO */ - - mca_pml_bfo_send_fin(recvreq->req_recv.req_base.req_proc, - bml_btl, - frag->rdma_hdr.hdr_rget.hdr_des, -#if PML_BFO - des->order, 0, (uint16_t)recvreq->req_msgseq, recvreq->req_restartseq, - recvreq->req_recv.req_base.req_comm->c_contextid, - recvreq->req_recv.req_base.req_comm->c_my_rank); -#else /* PML_BFO */ - des->order, 0); -#endif /* PML_BFO */ - - /* is receive request complete */ - OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, frag->rdma_length); - recv_request_pml_complete_check(recvreq); - - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); - - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - - -/* - * - */ -int mca_pml_bfo_recv_request_get_frag( mca_pml_bfo_rdma_frag_t* frag ) -{ - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)frag->rdma_req; - mca_bml_base_btl_t* bml_btl = frag->rdma_bml; - mca_btl_base_descriptor_t* descriptor; - size_t save_size = frag->rdma_length; - int rc; - - /* prepare descriptor */ - mca_bml_base_prepare_dst( bml_btl, - NULL, - &recvreq->req_recv.req_base.req_convertor, - MCA_BTL_NO_ORDER, - 0, - &frag->rdma_length, - MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK | - MCA_BTL_DES_FLAGS_GET, - &descriptor ); - if( OPAL_UNLIKELY(NULL == descriptor) ) { - frag->rdma_length = save_size; - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - descriptor->des_remote = (mca_btl_base_segment_t *) frag->rdma_segs; - descriptor->des_remote_count = frag->rdma_hdr.hdr_rdma.hdr_seg_cnt; - descriptor->des_cbfunc = mca_pml_bfo_rget_completion; - descriptor->des_cbdata = frag; - - PERUSE_TRACE_COMM_OMPI_EVENT(PERUSE_COMM_REQ_XFER_CONTINUE, - &(recvreq->req_recv.req_base), - frag->rdma_length, PERUSE_RECV); - - /* queue up get request */ - rc = mca_bml_base_get(bml_btl,descriptor); - if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { - if(OMPI_ERR_OUT_OF_RESOURCE == rc) { - mca_bml_base_free(bml_btl, descriptor); - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, - (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - return OMPI_ERR_OUT_OF_RESOURCE; - } else { - OMPI_ERROR_LOG(rc); - ompi_rte_abort(-1, NULL); - } - } -#if PML_BFO - if ((bml_btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) && - (descriptor->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK)) { - recvreq->req_events++; - } -#endif /* PML_BFO */ - - return OMPI_SUCCESS; -} - - - - -/* - * Update the recv request status to reflect the number of bytes - * received and actually delivered to the application. - */ - -void mca_pml_bfo_recv_request_progress_frag( mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments ) -{ - size_t bytes_received, data_offset = 0; - size_t bytes_delivered __opal_attribute_unused__; /* is being set to zero in MCA_PML_BFO_RECV_REQUEST_UNPACK */ - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - bytes_received = mca_pml_bfo_compute_segment_length_base (segments, num_segments, - sizeof(mca_pml_bfo_frag_hdr_t)); - data_offset = hdr->hdr_frag.hdr_frag_offset; - /* - * Make user buffer accessable(defined) before unpacking. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - MCA_PML_BFO_RECV_REQUEST_UNPACK( recvreq, - segments, - num_segments, - sizeof(mca_pml_bfo_frag_hdr_t), - data_offset, - bytes_received, - bytes_delivered ); - /* - * Unpacking finished, make the user buffer unaccessable again. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - - OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); - /* check completion status */ - if(recv_request_pml_complete_check(recvreq) == false && - recvreq->req_rdma_offset < recvreq->req_send_offset) { - /* schedule additional rdma operations */ - mca_pml_bfo_recv_request_schedule(recvreq, NULL); - } -} - -/* - * Update the recv request status to reflect the number of bytes - * received and actually delivered to the application. - */ - -void mca_pml_bfo_recv_request_progress_rget( mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments ) -{ - mca_pml_bfo_rget_hdr_t* hdr = (mca_pml_bfo_rget_hdr_t*)segments->seg_addr.pval; - mca_bml_base_endpoint_t* bml_endpoint = NULL; - mca_pml_bfo_rdma_frag_t* frag; - size_t i, size = 0; - - recvreq->req_recv.req_bytes_packed = hdr->hdr_rndv.hdr_msg_length; - -#if PML_BFO - recvreq->remote_req_send = hdr->hdr_rndv.hdr_src_req; -#endif /* PML_BFO */ - MCA_PML_BFO_RECV_REQUEST_MATCHED(recvreq, &hdr->hdr_rndv.hdr_match); - - /* if receive buffer is not contiguous we can't just RDMA read into it, so - * fall back to copy in/out protocol. It is a pity because buffer on the - * sender side is already registered. We need to be smarter here, perhaps - * do couple of RDMA reads */ - if(opal_convertor_need_buffers(&recvreq->req_recv.req_base.req_convertor) == true) { -#if OPAL_CUDA_SUPPORT - if (mca_pml_bfo_cuda_need_buffers(recvreq, btl)) { - mca_pml_bfo_recv_request_ack(recvreq, &hdr->hdr_rndv, 0); - return; - } -#else /* OPAL_CUDA_SUPPORT */ - mca_pml_bfo_recv_request_ack(recvreq, &hdr->hdr_rndv, 0); - return; -#endif /* OPAL_CUDA_SUPPORT */ - } - - MCA_PML_BFO_RDMA_FRAG_ALLOC(frag); - if( OPAL_UNLIKELY(NULL == frag) ) { - /* GLB - FIX */ - OMPI_ERROR_LOG(OMPI_ERR_OUT_OF_RESOURCE); - ompi_rte_abort(-1, NULL); - } - - /* lookup bml datastructures */ - bml_endpoint = (mca_bml_base_endpoint_t*)recvreq->req_recv.req_base.req_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - assert (btl->btl_seg_size * hdr->hdr_seg_cnt <= sizeof (frag->rdma_segs)); - - /* allocate/initialize a fragment */ - memmove (frag->rdma_segs, hdr + 1, btl->btl_seg_size * hdr->hdr_seg_cnt); - - for(i = 0; i < hdr->hdr_seg_cnt; i++) { - mca_btl_base_segment_t *seg = (mca_btl_base_segment_t *)(frag->rdma_segs + i * btl->btl_seg_size); - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - if ((recvreq->req_recv.req_base.req_proc->super.proc_arch & OPAL_ARCH_ISBIGENDIAN) != - (ompi_proc_local()->super.proc_arch & OPAL_ARCH_ISBIGENDIAN)) { - size += opal_swap_bytes4(seg->seg_len); - } else -#endif - { - size += seg->seg_len; - } - } -#if PML_BFO - frag->rdma_btl = btl; -#endif /* PML_BFO */ - frag->rdma_bml = mca_bml_base_btl_array_find(&bml_endpoint->btl_rdma, btl); -#if OPAL_CUDA_SUPPORT - if( OPAL_UNLIKELY(NULL == frag->rdma_bml) ) { - if (recvreq->req_recv.req_base.req_convertor.flags & CONVERTOR_CUDA) { - /* Check to see if this is a CUDA get */ - if (btl->btl_flags & MCA_BTL_FLAGS_CUDA_GET) { - frag->rdma_bml = mca_bml_base_btl_array_find(&bml_endpoint->btl_send, btl); - } - if( OPAL_UNLIKELY(NULL == frag->rdma_bml) ) { - opal_output(0, "[%s:%d] invalid bml for rdma get", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } - } else { - /* Just default back to send and receive. Must be mix of GPU and HOST memory. */ - mca_pml_bfo_recv_request_ack(recvreq, &hdr->hdr_rndv, 0); - return; - } - } -#else /* OPAL_CUDA_SUPPORT */ - if( OPAL_UNLIKELY(NULL == frag->rdma_bml) ) { - opal_output(0, "[%s:%d] invalid bml for rdma get", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); - } -#endif /* OPAL_CUDA_SUPPORT */ - frag->rdma_hdr.hdr_rget = *hdr; - frag->rdma_req = recvreq; - frag->rdma_ep = bml_endpoint; - frag->rdma_length = size; - frag->rdma_state = MCA_PML_BFO_RDMA_GET; - frag->reg = NULL; - - mca_pml_bfo_recv_request_get_frag(frag); - return; -} - -/* - * Update the recv request status to reflect the number of bytes - * received and actually delivered to the application. - */ - -void mca_pml_bfo_recv_request_progress_rndv( mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments ) -{ - size_t bytes_received; - size_t bytes_delivered __opal_attribute_unused__; /* is being set to zero in MCA_PML_BFO_RECV_REQUEST_UNPACK */ - size_t data_offset = 0; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - bytes_received = mca_pml_bfo_compute_segment_length_base (segments, num_segments, - sizeof(mca_pml_bfo_rendezvous_hdr_t)); - - recvreq->req_recv.req_bytes_packed = hdr->hdr_rndv.hdr_msg_length; - recvreq->remote_req_send = hdr->hdr_rndv.hdr_src_req; - recvreq->req_rdma_offset = bytes_received; - MCA_PML_BFO_RECV_REQUEST_MATCHED(recvreq, &hdr->hdr_match); - mca_pml_bfo_recv_request_ack(recvreq, &hdr->hdr_rndv, bytes_received); - /** - * The PUT protocol do not attach any data to the original request. - * Therefore, we might want to avoid unpacking if there is nothing to - * unpack. - */ - if( 0 < bytes_received ) { - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - MCA_PML_BFO_RECV_REQUEST_UNPACK( recvreq, - segments, - num_segments, - sizeof(mca_pml_bfo_rendezvous_hdr_t), - data_offset, - bytes_received, - bytes_delivered ); - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - } - OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_bytes_received, bytes_received); - /* check completion status */ - if(recv_request_pml_complete_check(recvreq) == false && - recvreq->req_rdma_offset < recvreq->req_send_offset) { - /* schedule additional rdma operations */ - mca_pml_bfo_recv_request_schedule(recvreq, NULL); - } -} - -/* - * Update the recv request status to reflect the number of bytes - * received and actually delivered to the application. - */ -void mca_pml_bfo_recv_request_progress_match( mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments ) -{ - size_t bytes_received, data_offset = 0; - size_t bytes_delivered __opal_attribute_unused__; /* is being set to zero in MCA_PML_BFO_RECV_REQUEST_UNPACK */ - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - bytes_received = mca_pml_bfo_compute_segment_length_base (segments, num_segments, - OMPI_PML_BFO_MATCH_HDR_LEN); - - recvreq->req_recv.req_bytes_packed = bytes_received; - - MCA_PML_BFO_RECV_REQUEST_MATCHED(recvreq, &hdr->hdr_match); - /* - * Make user buffer accessable(defined) before unpacking. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - MCA_PML_BFO_RECV_REQUEST_UNPACK( recvreq, - segments, - num_segments, - OMPI_PML_BFO_MATCH_HDR_LEN, - data_offset, - bytes_received, - bytes_delivered); - /* - * Unpacking finished, make the user buffer unaccessable again. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - recvreq->req_recv.req_base.req_addr, - recvreq->req_recv.req_base.req_count, - recvreq->req_recv.req_base.req_datatype); - ); - - /* - * No need for atomic here, as we know there is only one fragment - * for this request. - */ - recvreq->req_bytes_received += bytes_received; - recv_request_pml_complete(recvreq); -} - - -/** - * Handle completion of a probe request - */ - -void mca_pml_bfo_recv_request_matched_probe( mca_pml_bfo_recv_request_t* recvreq, - mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments ) -{ - size_t bytes_packed = 0; - mca_pml_bfo_hdr_t* hdr = (mca_pml_bfo_hdr_t*)segments->seg_addr.pval; - - switch(hdr->hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - bytes_packed = mca_pml_bfo_compute_segment_length_base (segments, num_segments, - OMPI_PML_BFO_MATCH_HDR_LEN); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - case MCA_PML_BFO_HDR_TYPE_RGET: - bytes_packed = hdr->hdr_rndv.hdr_msg_length; - break; - } - - /* set completion status */ - recvreq->req_recv.req_base.req_ompi.req_status.MPI_TAG = hdr->hdr_match.hdr_tag; - recvreq->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = hdr->hdr_match.hdr_src; - recvreq->req_bytes_received = bytes_packed; - recvreq->req_bytes_expected = bytes_packed; - - recv_request_pml_complete(recvreq); -} - - -/* - * Schedule RDMA protocol. - * -*/ - -int mca_pml_bfo_recv_request_schedule_once( mca_pml_bfo_recv_request_t* recvreq, - mca_bml_base_btl_t *start_bml_btl ) -{ - mca_bml_base_btl_t* bml_btl; - int num_tries = recvreq->req_rdma_cnt, num_fail = 0; - size_t i, prev_bytes_remaining = 0; - size_t bytes_remaining = recvreq->req_send_offset - - recvreq->req_rdma_offset; - - /* if starting bml_btl is provided schedule next fragment on it first */ - if(start_bml_btl != NULL) { - for(i = 0; i < recvreq->req_rdma_cnt; i++) { - if(recvreq->req_rdma[i].bml_btl != start_bml_btl) - continue; - /* something left to be send? */ - if( OPAL_LIKELY(recvreq->req_rdma[i].length) ) - recvreq->req_rdma_idx = i; - break; - } - } - - while(bytes_remaining > 0 && - recvreq->req_pipeline_depth < mca_pml_bfo.recv_pipeline_depth) { - size_t size, seg_size; - mca_pml_bfo_rdma_hdr_t* hdr; - mca_btl_base_descriptor_t* dst; - mca_btl_base_descriptor_t* ctl; - mca_mpool_base_registration_t * reg = NULL; - mca_btl_base_module_t* btl; - int rc, rdma_idx; - - if(prev_bytes_remaining == bytes_remaining) { - if(++num_fail == num_tries) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - if(false == recvreq->req_pending) { - opal_list_append(&mca_pml_bfo.recv_pending, - (opal_list_item_t*)recvreq); - recvreq->req_pending = true; - } - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - return OMPI_ERR_OUT_OF_RESOURCE; - } - } else { - num_fail = 0; - prev_bytes_remaining = bytes_remaining; - } - - do { - rdma_idx = recvreq->req_rdma_idx; - bml_btl = recvreq->req_rdma[rdma_idx].bml_btl; - reg = recvreq->req_rdma[rdma_idx].btl_reg; - size = recvreq->req_rdma[rdma_idx].length; - if(++recvreq->req_rdma_idx >= recvreq->req_rdma_cnt) - recvreq->req_rdma_idx = 0; - } while(!size); - btl = bml_btl->btl; - - /* makes sure that we don't exceed BTL max rdma size - * if memory is not pinned already */ - if( (NULL == reg) && (btl->btl_rdma_pipeline_frag_size != 0) && - (size > btl->btl_rdma_pipeline_frag_size)) { - size = btl->btl_rdma_pipeline_frag_size; - } - - /* take lock to protect converter against concurrent access - * from unpack */ - OPAL_THREAD_LOCK(&recvreq->lock); - opal_convertor_set_position( &recvreq->req_recv.req_base.req_convertor, - &recvreq->req_rdma_offset ); - - /* prepare a descriptor for RDMA */ - mca_bml_base_prepare_dst(bml_btl, reg, - &recvreq->req_recv.req_base.req_convertor, - MCA_BTL_NO_ORDER, 0, &size, MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_FLAGS_PUT, &dst); - OPAL_THREAD_UNLOCK(&recvreq->lock); - - if(OPAL_UNLIKELY(dst == NULL)) { - continue; - } - - dst->des_cbfunc = mca_pml_bfo_put_completion; - dst->des_cbdata = recvreq; - - seg_size = btl->btl_seg_size * dst->des_local_count; - - /* prepare a descriptor for rdma control message */ - mca_bml_base_alloc(bml_btl, &ctl, MCA_BTL_NO_ORDER, sizeof(mca_pml_bfo_rdma_hdr_t) + seg_size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK); - - if( OPAL_UNLIKELY(NULL == ctl) ) { - mca_bml_base_free(bml_btl,dst); - continue; - } - ctl->des_cbfunc = mca_pml_bfo_recv_ctl_completion; -#if PML_BFO - ctl->des_cbdata = recvreq; -#endif /* PML_BFO */ - - /* fill in rdma header */ - hdr = (mca_pml_bfo_rdma_hdr_t*)ctl->des_local->seg_addr.pval; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_PUT; - hdr->hdr_common.hdr_flags = - (!recvreq->req_ack_sent) ? MCA_PML_BFO_HDR_TYPE_ACK : 0; - hdr->hdr_req = recvreq->remote_req_send; -#if PML_BFO - hdr->hdr_dst_req.pval = recvreq; /* only needed in the first put message */ -#endif /* PML_BFO */ - hdr->hdr_des.pval = dst; - hdr->hdr_rdma_offset = recvreq->req_rdma_offset; - hdr->hdr_seg_cnt = dst->des_local_count; - - /* copy segments */ - memmove (hdr + 1, dst->des_local, seg_size); - - if(!recvreq->req_ack_sent) - recvreq->req_ack_sent = true; - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_PUT, recvreq->req_recv.req_base.req_proc); - - PERUSE_TRACE_COMM_OMPI_EVENT( PERUSE_COMM_REQ_XFER_CONTINUE, - &(recvreq->req_recv.req_base), size, - PERUSE_RECV); - - /* send rdma request to peer */ - rc = mca_bml_base_send(bml_btl, ctl, MCA_PML_BFO_HDR_TYPE_PUT); - if( OPAL_LIKELY( rc >= 0 ) ) { -#if PML_BFO - if ((btl->btl_flags & MCA_BTL_FLAGS_FAILOVER_SUPPORT) && - (ctl->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK)) { - recvreq->req_events++; - } -#endif /* PML_BFO */ - /* update request state */ - recvreq->req_rdma_offset += size; - OPAL_THREAD_ADD_FETCH_SIZE_T(&recvreq->req_pipeline_depth, 1); - recvreq->req_rdma[rdma_idx].length -= size; - bytes_remaining -= size; - } else { - mca_bml_base_free(bml_btl,ctl); - mca_bml_base_free(bml_btl,dst); - } - } - - return OMPI_SUCCESS; -} - -#define IS_PROB_REQ(R) \ - ((MCA_PML_REQUEST_IPROBE == (R)->req_recv.req_base.req_type) || \ - (MCA_PML_REQUEST_PROBE == (R)->req_recv.req_base.req_type) || \ - (MCA_PML_REQUEST_IMPROBE == (R)->req_recv.req_base.req_type) || \ - (MCA_PML_REQUEST_MPROBE == (R)->req_recv.req_base.req_type)) -#define IS_MPROB_REQ(R) \ - ((MCA_PML_REQUEST_IMPROBE == (R)->req_recv.req_base.req_type) || \ - (MCA_PML_REQUEST_MPROBE == (R)->req_recv.req_base.req_type)) - -static inline void append_recv_req_to_queue(opal_list_t *queue, - mca_pml_bfo_recv_request_t *req) -{ - if(OPAL_UNLIKELY(req->req_recv.req_base.req_type == MCA_PML_REQUEST_IPROBE || - req->req_recv.req_base.req_type == MCA_PML_REQUEST_IMPROBE)) - return; - - opal_list_append(queue, (opal_list_item_t*)req); - - /** - * We don't want to generate this kind of event for MPI_Probe. Hopefully, - * the compiler will optimize out the empty if loop in the case where PERUSE - * support is not required by the user. - */ - if(req->req_recv.req_base.req_type != MCA_PML_REQUEST_PROBE || - req->req_recv.req_base.req_type != MCA_PML_REQUEST_MPROBE) { - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_INSERT_IN_POSTED_Q, - &(req->req_recv.req_base), PERUSE_RECV); - } -} - -/* - * this routine tries to match a posted receive. If a match is found, - * it places the request in the appropriate matched receive list. This - * function has to be called with the communicator matching lock held. -*/ -static mca_pml_bfo_recv_frag_t* -recv_req_match_specific_proc( const mca_pml_bfo_recv_request_t *req, - mca_pml_bfo_comm_proc_t *proc ) -{ - opal_list_t* unexpected_frags = &proc->unexpected_frags; - opal_list_item_t *i; - mca_pml_bfo_recv_frag_t* frag; - int tag = req->req_recv.req_base.req_tag; - - if(opal_list_get_size(unexpected_frags) == 0) - return NULL; - - if( OMPI_ANY_TAG == tag ) { - for (i = opal_list_get_first(unexpected_frags); - i != opal_list_get_end(unexpected_frags); - i = opal_list_get_next(i)) { - frag = (mca_pml_bfo_recv_frag_t*)i; - - if( frag->hdr.hdr_match.hdr_tag >= 0 ) - return frag; - } - } else { - for (i = opal_list_get_first(unexpected_frags); - i != opal_list_get_end(unexpected_frags); - i = opal_list_get_next(i)) { - frag = (mca_pml_bfo_recv_frag_t*)i; - - if( frag->hdr.hdr_match.hdr_tag == tag ) - return frag; - } - } - return NULL; -} - -/* - * this routine is used to try and match a wild posted receive - where - * wild is determined by the value assigned to the source process -*/ -static mca_pml_bfo_recv_frag_t* -recv_req_match_wild( mca_pml_bfo_recv_request_t* req, - mca_pml_bfo_comm_proc_t **p) -{ - mca_pml_bfo_comm_t* comm = req->req_recv.req_base.req_comm->c_pml_comm; - mca_pml_bfo_comm_proc_t* proc = comm->procs; - size_t i; - - /* - * Loop over all the outstanding messages to find one that matches. - * There is an outer loop over lists of messages from each - * process, then an inner loop over the messages from the - * process. - * - * In order to avoid starvation do this in a round-robin fashion. - */ - for (i = comm->last_probed + 1; i < comm->num_procs; i++) { - mca_pml_bfo_recv_frag_t* frag; - - /* loop over messages from the current proc */ - if((frag = recv_req_match_specific_proc(req, &proc[i]))) { - *p = &proc[i]; - comm->last_probed = i; - req->req_recv.req_base.req_proc = proc[i].ompi_proc; - prepare_recv_req_converter(req); - return frag; /* match found */ - } - } - for (i = 0; i <= comm->last_probed; i++) { - mca_pml_bfo_recv_frag_t* frag; - - /* loop over messages from the current proc */ - if((frag = recv_req_match_specific_proc(req, &proc[i]))) { - *p = &proc[i]; - comm->last_probed = i; - req->req_recv.req_base.req_proc = proc[i].ompi_proc; - prepare_recv_req_converter(req); - return frag; /* match found */ - } - } - - *p = NULL; - return NULL; -} - - -void mca_pml_bfo_recv_req_start(mca_pml_bfo_recv_request_t *req) -{ - mca_pml_bfo_comm_t* comm = req->req_recv.req_base.req_comm->c_pml_comm; - mca_pml_bfo_comm_proc_t* proc; - mca_pml_bfo_recv_frag_t* frag; - opal_list_t *queue; - mca_pml_bfo_hdr_t* hdr; - - /* init/re-init the request */ - req->req_lock = 0; - req->req_pipeline_depth = 0; - req->req_bytes_received = 0; - req->req_bytes_expected = 0; - /* What about req_rdma_cnt ? */ -#if PML_BFO - req->req_rdma_cnt = 0; - req->req_events = 0; - req->req_restartseq = 0; - req->req_errstate = 0; -#endif /* PML_BFO */ - req->req_rdma_idx = 0; - req->req_pending = false; - req->req_ack_sent = false; - - MCA_PML_BASE_RECV_START(&req->req_recv.req_base); - - OPAL_THREAD_LOCK(&comm->matching_lock); - /** - * The laps of time between the ACTIVATE event and the SEARCH_UNEX one include - * the cost of the request lock. - */ - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_SEARCH_UNEX_Q_BEGIN, - &(req->req_recv.req_base), PERUSE_RECV); - - /* assign sequence number */ - req->req_recv.req_base.req_sequence = comm->recv_sequence++; - - /* attempt to match posted recv */ - if(req->req_recv.req_base.req_peer == OMPI_ANY_SOURCE) { - frag = recv_req_match_wild(req, &proc); - queue = &comm->wild_receives; -#if !OPAL_ENABLE_HETEROGENEOUS_SUPPORT - /* As we are in a homogeneous environment we know that all remote - * architectures are exactly the same as the local one. Therefore, - * we can safely construct the convertor based on the proc - * information of rank 0. - */ - if( NULL == frag ) { - req->req_recv.req_base.req_proc = ompi_proc_local_proc; - prepare_recv_req_converter(req); - } -#endif /* !OPAL_ENABLE_HETEROGENEOUS_SUPPORT */ - } else { - proc = &comm->procs[req->req_recv.req_base.req_peer]; - req->req_recv.req_base.req_proc = proc->ompi_proc; - frag = recv_req_match_specific_proc(req, proc); - queue = &proc->specific_receives; - /* wild cardrecv will be prepared on match */ - prepare_recv_req_converter(req); - } - - if(OPAL_UNLIKELY(NULL == frag)) { - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_SEARCH_UNEX_Q_END, - &(req->req_recv.req_base), PERUSE_RECV); - /* We didn't find any matches. Record this irecv so we can match - it when the message comes in. */ - append_recv_req_to_queue(queue, req); - req->req_match_received = false; - OPAL_THREAD_UNLOCK(&comm->matching_lock); - } else { - if(OPAL_LIKELY(!IS_PROB_REQ(req))) { - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_MATCH_UNEX, - &(req->req_recv.req_base), PERUSE_RECV); - - hdr = (mca_pml_bfo_hdr_t*)frag->segments->seg_addr.pval; - PERUSE_TRACE_MSG_EVENT(PERUSE_COMM_MSG_REMOVE_FROM_UNEX_Q, - req->req_recv.req_base.req_comm, - hdr->hdr_match.hdr_src, - hdr->hdr_match.hdr_tag, - PERUSE_RECV); - - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_SEARCH_UNEX_Q_END, - &(req->req_recv.req_base), PERUSE_RECV); - - opal_list_remove_item(&proc->unexpected_frags, - (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&comm->matching_lock); - - switch(hdr->hdr_common.hdr_type) { - case MCA_PML_BFO_HDR_TYPE_MATCH: - mca_pml_bfo_recv_request_progress_match(req, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RNDV: - mca_pml_bfo_recv_request_progress_rndv(req, frag->btl, frag->segments, - frag->num_segments); - break; - case MCA_PML_BFO_HDR_TYPE_RGET: - mca_pml_bfo_recv_request_progress_rget(req, frag->btl, frag->segments, - frag->num_segments); - break; - default: - assert(0); - } - - MCA_PML_BFO_RECV_FRAG_RETURN(frag); - - } else if (OPAL_UNLIKELY(IS_MPROB_REQ(req))) { - /* Remove the fragment from the match list, as it's now - matched. Stash it somewhere in the request (which, - yes, is a complete hack), where it will be plucked out - during the end of mprobe. The request will then be - "recreated" as a receive request, and the frag will be - restarted with this request during mrecv */ - opal_list_remove_item(&proc->unexpected_frags, - (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&comm->matching_lock); - - req->req_recv.req_base.req_addr = frag; - mca_pml_bfo_recv_request_matched_probe(req, frag->btl, - frag->segments, frag->num_segments); - - } else { - OPAL_THREAD_UNLOCK(&comm->matching_lock); - mca_pml_bfo_recv_request_matched_probe(req, frag->btl, - frag->segments, frag->num_segments); - } - } -} diff --git a/ompi/mca/pml/bfo/pml_bfo_recvreq.h b/ompi/mca/pml/bfo/pml_bfo_recvreq.h deleted file mode 100644 index 7b3a6db6271..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_recvreq.h +++ /dev/null @@ -1,449 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * 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 - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2007 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** - * @file - */ -#ifndef OMPI_PML_BFO_RECV_REQUEST_H -#define OMPI_PML_BFO_RECV_REQUEST_H - -#include "pml_bfo.h" -#include "pml_bfo_rdma.h" -#include "pml_bfo_rdmafrag.h" -#include "ompi/proc/proc.h" -#include "ompi/mca/pml/bfo/pml_bfo_comm.h" -#include "opal/mca/mpool/base/base.h" -#include "ompi/mca/pml/base/pml_base_recvreq.h" -#if PML_BFO -#define RECVREQ_RECVERRSENT 0x01 -#define RECVREQ_RNDVRESTART_RECVED 0x02 -#define RECVREQ_RNDVRESTART_ACKED 0x04 -#endif /* PML_BFO */ - -BEGIN_C_DECLS - -struct mca_pml_bfo_recv_request_t { - mca_pml_base_recv_request_t req_recv; - opal_ptr_t remote_req_send; -#if PML_BFO - int32_t req_msgseq; /* PML sequence number */ - int32_t req_events; /* number of outstanding events on request */ - int32_t req_restartseq; /* sequence number of restarted request */ - int32_t req_errstate; /* state of request if in error */ -#endif /* PML_BFO */ - int32_t req_lock; - size_t req_pipeline_depth; - size_t req_bytes_received; /**< amount of data transferred into the user buffer */ - size_t req_bytes_expected; /**< local size of the data as suggested by the user */ - size_t req_rdma_offset; - size_t req_send_offset; - uint32_t req_rdma_cnt; - uint32_t req_rdma_idx; - bool req_pending; - bool req_ack_sent; /**< whether ack was sent to the sender */ - bool req_match_received; /**< Prevent request to be completed prematurely */ - opal_mutex_t lock; - mca_pml_bfo_com_btl_t req_rdma[1]; -}; -typedef struct mca_pml_bfo_recv_request_t mca_pml_bfo_recv_request_t; - -OBJ_CLASS_DECLARATION(mca_pml_bfo_recv_request_t); - -static inline bool lock_recv_request(mca_pml_bfo_recv_request_t *recvreq) -{ - return OPAL_THREAD_ADD_FETCH32(&recvreq->req_lock, 1) == 1; -} - -static inline bool unlock_recv_request(mca_pml_bfo_recv_request_t *recvreq) -{ - return OPAL_THREAD_ADD_FETCH32(&recvreq->req_lock, -1) == 0; -} - -/** - * Allocate a recv request from the modules free list. - * - * @param rc (OUT) OMPI_SUCCESS or error status on failure. - * @return Receive request. - */ -#define MCA_PML_BFO_RECV_REQUEST_ALLOC(recvreq) \ -do { \ - ompi_free_list_item_t* item; \ - OMPI_FREE_LIST_GET_MT(&mca_pml_base_recv_requests, item); \ - recvreq = (mca_pml_bfo_recv_request_t*)item; \ -} while(0) - - -/** - * Initialize a receive request with call parameters. - * - * @param request (IN) Receive request. - * @param addr (IN) User buffer. - * @param count (IN) Number of elements of indicated datatype. - * @param datatype (IN) User defined datatype. - * @param src (IN) Source rank w/in the communicator. - * @param tag (IN) User defined tag. - * @param comm (IN) Communicator. - * @param persistent (IN) Is this a ersistent request. - */ -#define MCA_PML_BFO_RECV_REQUEST_INIT( request, \ - addr, \ - count, \ - datatype, \ - src, \ - tag, \ - comm, \ - persistent) \ -do { \ - MCA_PML_BASE_RECV_REQUEST_INIT( &(request)->req_recv, \ - addr, \ - count, \ - datatype, \ - src, \ - tag, \ - comm, \ - persistent); \ -} while(0) - -/** - * Mark the request as completed at MPI level for internal purposes. - * - * @param recvreq (IN) Receive request. - */ -#define MCA_PML_BFO_RECV_REQUEST_MPI_COMPLETE( recvreq ) \ - do { \ - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \ - &(recvreq->req_recv.req_base), PERUSE_RECV ); \ - ompi_request_complete( &(recvreq->req_recv.req_base.req_ompi), true ); \ - } while (0) - -/* - * Free the PML receive request - */ -#define MCA_PML_BFO_RECV_REQUEST_RETURN(recvreq) \ - { \ - MCA_PML_BASE_RECV_REQUEST_FINI(&(recvreq)->req_recv); \ - OPAL_FREE_LIST_RETURN( &mca_pml_base_recv_requests, \ - (opal_free_list_item_t*)(recvreq)); \ - } - -/** - * Complete receive request. Request structure cannot be accessed after calling - * this function any more. - * - * @param recvreq (IN) Receive request. - */ -static inline void -recv_request_pml_complete(mca_pml_bfo_recv_request_t *recvreq) -{ - size_t i; - - if(false == recvreq->req_recv.req_base.req_pml_complete) { - - if(recvreq->req_recv.req_bytes_packed > 0) { - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END, - &recvreq->req_recv.req_base, PERUSE_RECV ); - } - - for(i = 0; i < recvreq->req_rdma_cnt; i++) { - mca_mpool_base_registration_t* btl_reg = recvreq->req_rdma[i].btl_reg; - if( NULL != btl_reg && btl_reg->mpool != NULL) { - btl_reg->mpool->mpool_deregister( btl_reg->mpool, btl_reg ); - } - } - recvreq->req_rdma_cnt = 0; -#if PML_BFO - recvreq->req_msgseq -= 100; -#endif /* PML_BFO */ - - if(true == recvreq->req_recv.req_base.req_free_called) { - if( MPI_SUCCESS != recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR ) { - ompi_mpi_abort(&ompi_mpi_comm_world.comm, MPI_ERR_REQUEST); - } - MCA_PML_BFO_RECV_REQUEST_RETURN(recvreq); - } else { - /* initialize request status */ - recvreq->req_recv.req_base.req_pml_complete = true; - recvreq->req_recv.req_base.req_ompi.req_status._ucount = - recvreq->req_bytes_received; - if (recvreq->req_recv.req_bytes_packed > recvreq->req_bytes_expected) { - recvreq->req_recv.req_base.req_ompi.req_status._ucount = - recvreq->req_recv.req_bytes_packed; - recvreq->req_recv.req_base.req_ompi.req_status.MPI_ERROR = - MPI_ERR_TRUNCATE; - } - MCA_PML_BFO_RECV_REQUEST_MPI_COMPLETE(recvreq); - } - } -} - -static inline bool -recv_request_pml_complete_check(mca_pml_bfo_recv_request_t *recvreq) -{ -#if OPAL_ENABLE_MULTI_THREADS - opal_atomic_rmb(); -#endif - if(recvreq->req_match_received && - recvreq->req_bytes_received >= recvreq->req_recv.req_bytes_packed && -#if PML_BFO - (0 == recvreq->req_events) && lock_recv_request(recvreq)) { -#else /* PML_BFO */ - lock_recv_request(recvreq)) { -#endif /* PML_BFO */ - recv_request_pml_complete(recvreq); - return true; - } - - return false; -} - -extern void mca_pml_bfo_recv_req_start(mca_pml_bfo_recv_request_t *req); -#define MCA_PML_BFO_RECV_REQUEST_START(r) mca_pml_bfo_recv_req_start(r) - -static inline void prepare_recv_req_converter(mca_pml_bfo_recv_request_t *req) -{ - if( req->req_recv.req_base.req_datatype->super.size | req->req_recv.req_base.req_count ) { - opal_convertor_copy_and_prepare_for_recv( - req->req_recv.req_base.req_proc->super.proc_convertor, - &(req->req_recv.req_base.req_datatype->super), - req->req_recv.req_base.req_count, - req->req_recv.req_base.req_addr, - 0, - &req->req_recv.req_base.req_convertor); - opal_convertor_get_unpacked_size(&req->req_recv.req_base.req_convertor, - &req->req_bytes_expected); - } -} - -#define MCA_PML_BFO_RECV_REQUEST_MATCHED(request, hdr) \ - recv_req_matched(request, hdr) - -static inline void recv_req_matched(mca_pml_bfo_recv_request_t *req, - mca_pml_bfo_match_hdr_t *hdr) -{ - req->req_recv.req_base.req_ompi.req_status.MPI_SOURCE = hdr->hdr_src; - req->req_recv.req_base.req_ompi.req_status.MPI_TAG = hdr->hdr_tag; - req->req_match_received = true; -#if PML_BFO - req->req_msgseq = hdr->hdr_seq; -#endif /* PML_BFO */ -#if OPAL_ENABLE_MULTI_THREADS - opal_atomic_wmb(); -#endif - if(req->req_recv.req_bytes_packed > 0) { -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - if(MPI_ANY_SOURCE == req->req_recv.req_base.req_peer) { - /* non wildcard prepared during post recv */ - prepare_recv_req_converter(req); - } -#endif /* OPAL_ENABLE_HETEROGENEOUS_SUPPORT */ - PERUSE_TRACE_COMM_EVENT(PERUSE_COMM_REQ_XFER_BEGIN, - &req->req_recv.req_base, PERUSE_RECV); - } -} - - -/** - * - */ - -#define MCA_PML_BFO_RECV_REQUEST_UNPACK( request, \ - segments, \ - num_segments, \ - seg_offset, \ - data_offset, \ - bytes_received, \ - bytes_delivered) \ -do { \ - bytes_delivered = 0; \ - if(request->req_recv.req_bytes_packed > 0) { \ - struct iovec iov[MCA_BTL_DES_MAX_SEGMENTS]; \ - uint32_t iov_count = 0; \ - size_t max_data = bytes_received; \ - size_t n, offset = seg_offset; \ - mca_btl_base_segment_t* segment = segments; \ - \ - OPAL_THREAD_LOCK(&request->lock); \ - for( n = 0; n < num_segments; n++, segment++ ) { \ - if(offset >= segment->seg_len) { \ - offset -= segment->seg_len; \ - } else { \ - iov[iov_count].iov_len = segment->seg_len - offset; \ - iov[iov_count].iov_base = (IOVBASE_TYPE*) \ - ((unsigned char*)segment->seg_addr.pval + offset); \ - iov_count++; \ - offset = 0; \ - } \ - } \ - PERUSE_TRACE_COMM_OMPI_EVENT (PERUSE_COMM_REQ_XFER_CONTINUE, \ - &(recvreq->req_recv.req_base), max_data, \ - PERUSE_RECV); \ - opal_convertor_set_position( &(request->req_recv.req_base.req_convertor), \ - &data_offset ); \ - opal_convertor_unpack( &(request)->req_recv.req_base.req_convertor, \ - iov, \ - &iov_count, \ - &max_data ); \ - bytes_delivered = max_data; \ - OPAL_THREAD_UNLOCK(&request->lock); \ - } \ -} while (0) - - -/** - * - */ - -void mca_pml_bfo_recv_request_progress_match( - mca_pml_bfo_recv_request_t* req, - struct mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments); - -/** - * - */ - -void mca_pml_bfo_recv_request_progress_frag( - mca_pml_bfo_recv_request_t* req, - struct mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments); - -/** - * - */ - -void mca_pml_bfo_recv_request_progress_rndv( - mca_pml_bfo_recv_request_t* req, - struct mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments); - -/** - * - */ - -void mca_pml_bfo_recv_request_progress_rget( - mca_pml_bfo_recv_request_t* req, - struct mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments); - -/** - * - */ - -void mca_pml_bfo_recv_request_matched_probe( - mca_pml_bfo_recv_request_t* req, - struct mca_btl_base_module_t* btl, - mca_btl_base_segment_t* segments, - size_t num_segments); - -/** - * - */ - -int mca_pml_bfo_recv_request_schedule_once( - mca_pml_bfo_recv_request_t* req, mca_bml_base_btl_t* start_bml_btl); - -static inline int mca_pml_bfo_recv_request_schedule_exclusive( - mca_pml_bfo_recv_request_t* req, - mca_bml_base_btl_t* start_bml_btl) -{ - int rc; - - do { - rc = mca_pml_bfo_recv_request_schedule_once(req, start_bml_btl); - if(rc == OMPI_ERR_OUT_OF_RESOURCE) - break; - } while(!unlock_recv_request(req)); - - if(OMPI_SUCCESS == rc) - recv_request_pml_complete_check(req); - - return rc; -} - -static inline void mca_pml_bfo_recv_request_schedule( - mca_pml_bfo_recv_request_t* req, - mca_bml_base_btl_t* start_bml_btl) -{ - if(!lock_recv_request(req)) - return; - - (void)mca_pml_bfo_recv_request_schedule_exclusive(req, start_bml_btl); -} - -#define MCA_PML_BFO_ADD_ACK_TO_PENDING(P, S, D, O) \ - do { \ - mca_pml_bfo_pckt_pending_t *_pckt; \ - \ - MCA_PML_BFO_PCKT_PENDING_ALLOC(_pckt); \ - _pckt->hdr.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_ACK; \ - _pckt->hdr.hdr_ack.hdr_src_req.lval = (S); \ - _pckt->hdr.hdr_ack.hdr_dst_req.pval = (D); \ - _pckt->hdr.hdr_ack.hdr_send_offset = (O); \ - _pckt->proc = (P); \ - _pckt->bml_btl = NULL; \ - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); \ - opal_list_append(&mca_pml_bfo.pckt_pending, \ - (opal_list_item_t*)_pckt); \ - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); \ - } while(0) - -int mca_pml_bfo_recv_request_ack_send_btl(ompi_proc_t* proc, - mca_bml_base_btl_t* bml_btl, uint64_t hdr_src_req, void *hdr_dst_req, - uint64_t hdr_rdma_offset, bool nordma); - -static inline int mca_pml_bfo_recv_request_ack_send(ompi_proc_t* proc, - uint64_t hdr_src_req, void *hdr_dst_req, uint64_t hdr_send_offset, - bool nordma) -{ - size_t i; - mca_bml_base_btl_t* bml_btl; - mca_bml_base_endpoint_t* endpoint = - (mca_bml_base_endpoint_t*)proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - - for(i = 0; i < mca_bml_base_btl_array_get_size(&endpoint->btl_eager); i++) { - bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); - if(mca_pml_bfo_recv_request_ack_send_btl(proc, bml_btl, hdr_src_req, - hdr_dst_req, hdr_send_offset, nordma) == OMPI_SUCCESS) - return OMPI_SUCCESS; - } - - MCA_PML_BFO_ADD_ACK_TO_PENDING(proc, hdr_src_req, hdr_dst_req, - hdr_send_offset); - - return OMPI_ERR_OUT_OF_RESOURCE; -} - -int mca_pml_bfo_recv_request_get_frag(mca_pml_bfo_rdma_frag_t* frag); - -/* This function tries to continue recvreq that stuck due to resource - * unavailability. Recvreq is added to recv_pending list if scheduling of put - * operation cannot be accomplished for some reason. */ -void mca_pml_bfo_recv_request_process_pending(void); - -END_C_DECLS - -#endif - diff --git a/ompi/mca/pml/bfo/pml_bfo_sendreq.c b/ompi/mca/pml/bfo/pml_bfo_sendreq.c deleted file mode 100644 index 176eadf4f6e..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_sendreq.c +++ /dev/null @@ -1,1401 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * 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 - * 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) 2008 UT-Battelle, LLC. All rights reserved. - * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "ompi_config.h" -#include "opal/prefetch.h" -#include "opal/mca/mpool/mpool.h" -#include "ompi/constants.h" -#include "ompi/mca/pml/pml.h" -#include "pml_bfo.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_sendreq.h" -#include "pml_bfo_rdmafrag.h" -#include "pml_bfo_recvreq.h" -#if PML_BFO -#include "pml_bfo_failover.h" -#endif /* PML_BFO */ -#include "ompi/mca/bml/base/base.h" -#include "ompi/memchecker.h" - -OBJ_CLASS_INSTANCE(mca_pml_bfo_send_range_t, ompi_free_list_item_t, - NULL, NULL); - -void mca_pml_bfo_send_request_process_pending(mca_bml_base_btl_t *bml_btl) -{ - int rc, i, s = opal_list_get_size(&mca_pml_bfo.send_pending); - - /* advance pending requests */ - for(i = 0; i < s; i++) { - mca_pml_bfo_send_pending_t pending_type = MCA_PML_BFO_SEND_PENDING_NONE; - mca_pml_bfo_send_request_t* sendreq; - mca_bml_base_btl_t *send_dst; - - sendreq = get_request_from_send_pending(&pending_type); - if(OPAL_UNLIKELY(NULL == sendreq)) - break; - - switch(pending_type) { - case MCA_PML_BFO_SEND_PENDING_SCHEDULE: - rc = mca_pml_bfo_send_request_schedule_exclusive(sendreq); - if(OMPI_ERR_OUT_OF_RESOURCE == rc) { - return; - } - break; - case MCA_PML_BFO_SEND_PENDING_START: - send_dst = mca_bml_base_btl_array_find( - &sendreq->req_endpoint->btl_eager, bml_btl->btl); - if (NULL == send_dst) { - /* Put request back onto pending list and try next one. */ - add_request_to_send_pending(sendreq, - MCA_PML_BFO_SEND_PENDING_START, true); - } else { - rc = mca_pml_bfo_send_request_start_btl(sendreq, send_dst); - if (OMPI_ERR_OUT_OF_RESOURCE == rc) { - /* No more resources on this btl so prepend to the pending - * list to minimize reordering and give up for now. */ - add_request_to_send_pending(sendreq, - MCA_PML_BFO_SEND_PENDING_START, false); - return; - } - } - break; - default: - opal_output(0, "[%s:%d] wrong send request type\n", - __FILE__, __LINE__); - break; - } - } -} - -/* - * The free call mark the final stage in a request life-cycle. Starting from this - * point the request is completed at both PML and user level, and can be used - * for others p2p communications. Therefore, in the case of the BFO PML it should - * be added to the free request list. - */ -static int mca_pml_bfo_send_request_free(struct ompi_request_t** request) -{ - mca_pml_bfo_send_request_t* sendreq = *(mca_pml_bfo_send_request_t**)request; - if( false == sendreq->req_send.req_base.req_free_called ) { - - sendreq->req_send.req_base.req_free_called = true; - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_NOTIFY, - &(sendreq->req_send.req_base), PERUSE_SEND ); - - if( true == sendreq->req_send.req_base.req_pml_complete ) { - /* make buffer defined when the request is compeleted, - and before releasing the objects. */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - - MCA_PML_BFO_SEND_REQUEST_RETURN( sendreq ); - } - *request = MPI_REQUEST_NULL; - } - return OMPI_SUCCESS; -} - -static int mca_pml_bfo_send_request_cancel(struct ompi_request_t* request, int complete) -{ - /* we dont cancel send requests by now */ - return OMPI_SUCCESS; -} - -static void mca_pml_bfo_send_request_construct(mca_pml_bfo_send_request_t* req) -{ - req->req_send.req_base.req_type = MCA_PML_REQUEST_SEND; - req->req_send.req_base.req_ompi.req_start = mca_pml_bfo_start; - req->req_send.req_base.req_ompi.req_free = mca_pml_bfo_send_request_free; - req->req_send.req_base.req_ompi.req_cancel = mca_pml_bfo_send_request_cancel; - req->req_rdma_cnt = 0; - req->req_throttle_sends = false; - OBJ_CONSTRUCT(&req->req_send_ranges, opal_list_t); - OBJ_CONSTRUCT(&req->req_send_range_lock, opal_mutex_t); -} - -static void mca_pml_bfo_send_request_destruct(mca_pml_bfo_send_request_t* req) -{ - OBJ_DESTRUCT(&req->req_send_ranges); - OBJ_DESTRUCT(&req->req_send_range_lock); -} - -OBJ_CLASS_INSTANCE( mca_pml_bfo_send_request_t, - mca_pml_base_send_request_t, - mca_pml_bfo_send_request_construct, - mca_pml_bfo_send_request_destruct ); - -/** - * Completion of a short message - nothing left to schedule. - */ - -static inline void -mca_pml_bfo_match_completion_free_request( mca_bml_base_btl_t* bml_btl, - mca_pml_bfo_send_request_t* sendreq ) -{ - if( sendreq->req_send.req_bytes_packed > 0 ) { - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_BEGIN, - &(sendreq->req_send.req_base), PERUSE_SEND ); - } - - /* signal request completion */ - send_request_pml_complete(sendreq); - - /* check for pending requests */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -static void -mca_pml_bfo_match_completion_free( struct mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - - /* check completion status */ - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { -#if PML_BFO - mca_pml_bfo_repost_match_fragment(des); - return; -#else /* PML_BFO */ - /* TSW - FIX */ - opal_output(0, "%s:%d FATAL", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif /* PML_BFO */ - } -#if PML_BFO - MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, sendreq, "MATCH"); -#endif /* PML_BFO */ - mca_pml_bfo_match_completion_free_request( bml_btl, sendreq ); -} - -static inline void -mca_pml_bfo_rndv_completion_request( mca_bml_base_btl_t* bml_btl, - mca_pml_bfo_send_request_t* sendreq, - size_t req_bytes_delivered ) -{ - if( sendreq->req_send.req_bytes_packed > 0 ) { - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_BEGIN, - &(sendreq->req_send.req_base), PERUSE_SEND ); - } - - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered); - - /* advance the request */ - OPAL_THREAD_ADD_FETCH32(&sendreq->req_state, -1); - - send_request_pml_complete_check(sendreq); - - /* check for pending requests */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/* - * Completion of the first fragment of a long message that - * requires an acknowledgement - */ -static void -mca_pml_bfo_rndv_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context; - size_t req_bytes_delivered; - - /* check completion status */ - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { -#if PML_BFO - if (true == mca_pml_bfo_rndv_completion_status_error(des, sendreq)) - return; -#else /* PML_BFO */ - /* TSW - FIX */ - opal_output(0, "%s:%d FATAL", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif /* PML_BFO */ - } -#if PML_BFO - sendreq->req_events--; - MCA_PML_BFO_RNDV_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl, - MCA_PML_BFO_HDR_TYPE_RNDV, "RNDV"); -#endif /* PML_BFO */ - - /* count bytes of user data actually delivered. As the rndv completion only - * happens in one thread, the increase of the req_bytes_delivered does not - * have to be atomic. - */ - req_bytes_delivered = mca_pml_bfo_compute_segment_length (btl->btl_seg_size, - (void *) des->des_local, - des->des_local_count, - sizeof(mca_pml_bfo_rendezvous_hdr_t)); - -#if PML_BFO - MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, sendreq, "RNDV"); -#endif /* PML_BFO */ - mca_pml_bfo_rndv_completion_request( bml_btl, sendreq, req_bytes_delivered ); -} - - -/** - * Completion of a get request. - */ - -static void -mca_pml_bfo_rget_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*)des->des_context; - size_t req_bytes_delivered; -#if PML_BFO - MCA_PML_BFO_RGET_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, btl, des); -#endif /* PML_BFO */ - - /* count bytes of user data actually delivered and check for request completion */ - req_bytes_delivered = mca_pml_bfo_compute_segment_length (btl->btl_seg_size, - (void *) des->des_local, - des->des_local_count, 0); - if (OPAL_LIKELY(0 < req_bytes_delivered)) { - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered); - } - - send_request_pml_complete_check(sendreq); - /* free the descriptor */ -#if PML_BFO - btl->btl_free(btl, des); - MCA_PML_BFO_CHECK_SENDREQ_RDMA_BML_BTL(bml_btl, btl, sendreq, "RGET"); -#else /* PML_BFO */ - mca_bml_base_free(bml_btl, des); -#endif /* PML_BFO */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - - -/** - * Completion of a control message - return resources. - */ - -static void -mca_pml_bfo_send_ctl_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - -#if PML_BFO - if(OPAL_UNLIKELY(OMPI_SUCCESS != status)) { - mca_pml_bfo_send_ctl_completion_status_error(des); - return; - } - MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, des->des_cbdata, "RGET"); -#endif /* PML_BFO */ - /* check for pending requests */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/** - * Completion of additional fragments of a large message - may need - * to schedule additional fragments. - */ - -static void -mca_pml_bfo_frag_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)des->des_cbdata; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - size_t req_bytes_delivered; -#if PML_BFO - sendreq->req_events--; -#endif /* PML_BFO */ - - /* check completion status */ - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { -#if PML_BFO - sendreq->req_error++; -#else /* PML_BFO */ - /* TSW - FIX */ - opal_output(0, "%s:%d FATAL", __FILE__, __LINE__); - ompi_rte_abort(-1, NULL); -#endif /* PML_BFO */ - } - - /* count bytes of user data actually delivered */ - req_bytes_delivered = mca_pml_bfo_compute_segment_length (btl->btl_seg_size, - (void *) des->des_local, - des->des_local_count, - sizeof(mca_pml_bfo_frag_hdr_t)); - - OPAL_THREAD_SUB_FETCH_SIZE_T(&sendreq->req_pipeline_depth, 1); - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, req_bytes_delivered); - -#if PML_BFO - MCA_PML_BFO_FRAG_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl, - MCA_PML_BFO_HDR_TYPE_FRAG, "FRAG"); -#endif /* PML_BFO */ - if(send_request_pml_complete_check(sendreq) == false) { - mca_pml_bfo_send_request_schedule(sendreq); -#if PML_BFO - MCA_PML_BFO_FRAG_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl, - MCA_PML_BFO_HDR_TYPE_FRAG, - "FRAG (BTL removal)"); -#endif /* PML_BFO */ - } - - /* check for pending requests */ -#if PML_BFO - MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, sendreq, "FRAG"); -#endif /* PML_BFO */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -/** - * Buffer the entire message and mark as complete. - */ - -int mca_pml_bfo_send_request_start_buffered( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size) -{ - mca_btl_base_descriptor_t* des; - mca_btl_base_segment_t* segment; - mca_pml_bfo_hdr_t* hdr; - struct iovec iov; - unsigned int iov_count; - size_t max_data, req_bytes_delivered; - int rc; - - /* allocate descriptor */ - mca_bml_base_alloc(bml_btl, &des, - MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_rendezvous_hdr_t) + size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - if( OPAL_UNLIKELY(NULL == des) ) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - segment = des->des_local; - - /* pack the data into the BTL supplied buffer */ - iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + - sizeof(mca_pml_bfo_rendezvous_hdr_t)); - iov.iov_len = size; - iov_count = 1; - max_data = size; - if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, - &iov, - &iov_count, - &max_data)) < 0) { - mca_bml_base_free(bml_btl, des); - return rc; - } - req_bytes_delivered = max_data; - - /* build rendezvous header */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = 0; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDV; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed; - hdr->hdr_rndv.hdr_src_req.pval = sendreq; -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_RNDV_RESTART(hdr, sendreq, "RNDV(buffered)"); -#endif /* PML_BFO */ - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_RNDV, - sendreq->req_send.req_base.req_proc); - - /* update lengths */ - segment->seg_len = sizeof(mca_pml_bfo_rendezvous_hdr_t) + max_data; - - des->des_cbfunc = mca_pml_bfo_rndv_completion; - des->des_cbdata = sendreq; - - /* buffer the remainder of the message */ - rc = mca_pml_base_bsend_request_alloc((ompi_request_t*)sendreq); - if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { - mca_bml_base_free(bml_btl, des); - return rc; - } - - iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)sendreq->req_send.req_addr) + max_data); - iov.iov_len = max_data = sendreq->req_send.req_bytes_packed - max_data; - - if((rc = opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, - &iov, - &iov_count, - &max_data)) < 0) { - mca_bml_base_free(bml_btl, des); - return rc; - } - - /* re-init convertor for packed data */ - opal_convertor_prepare_for_send( &sendreq->req_send.req_base.req_convertor, - &(ompi_mpi_byte.dt.super), - sendreq->req_send.req_bytes_packed, - sendreq->req_send.req_addr ); - - /* wait for ack and completion */ - sendreq->req_state = 2; - - /* request is complete at mpi level */ - MCA_PML_BFO_SEND_REQUEST_MPI_COMPLETE(sendreq, true); - - /* send */ - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RNDV); - if( OPAL_LIKELY( rc >= 0 ) ) { - if( OPAL_LIKELY( 1 == rc ) ) { - mca_pml_bfo_rndv_completion_request( bml_btl, sendreq, req_bytes_delivered); - } -#if PML_BFO - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - sendreq->req_events++; - } -#endif /* PML_BFO */ - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, des ); - return rc; -} - - -/** - * We work on a buffered request with a size smaller than the eager size - * or the BTL is not able to send the data IN_PLACE. Request a segment - * that is used for initial hdr and any eager data. This is used only - * from the _START macro. - */ -int mca_pml_bfo_send_request_start_copy( mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size ) -{ - mca_btl_base_descriptor_t* des = NULL; - mca_btl_base_segment_t* segment; - mca_pml_bfo_hdr_t* hdr; - struct iovec iov; - unsigned int iov_count; - size_t max_data = size; - int rc; - - if(NULL != bml_btl->btl->btl_sendi) { - mca_pml_bfo_match_hdr_t match; - match.hdr_common.hdr_flags = 0; - match.hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_MATCH; - match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - match.hdr_tag = sendreq->req_send.req_base.req_tag; - match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - - bfo_hdr_hton(&match, MCA_PML_BFO_HDR_TYPE_MATCH, - sendreq->req_send.req_base.req_proc); - - /* try to send immediately */ - rc = mca_bml_base_sendi( bml_btl, &sendreq->req_send.req_base.req_convertor, - &match, OMPI_PML_BFO_MATCH_HDR_LEN, - size, MCA_BTL_NO_ORDER, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP, - MCA_PML_BFO_HDR_TYPE_MATCH, - &des); - if( OPAL_LIKELY(OMPI_SUCCESS == rc) ) { -#if PML_BFO - /* Needed in case of failover */ - if (NULL != des) { - des->des_cbfunc = mca_pml_bfo_match_completion_free; - des->des_cbdata = sendreq->req_endpoint; - } -#endif /* PML_BFO */ - /* signal request completion */ - send_request_pml_complete(sendreq); - - /* check for pending requests */ - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); - return OMPI_SUCCESS; - } - } else { - /* allocate descriptor */ - mca_bml_base_alloc( bml_btl, &des, - MCA_BTL_NO_ORDER, - OMPI_PML_BFO_MATCH_HDR_LEN + size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - } - if( OPAL_UNLIKELY(NULL == des) ) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - - segment = des->des_local; - - if(size > 0) { - /* pack the data into the supplied buffer */ - iov.iov_base = (IOVBASE_TYPE*)((unsigned char*)segment->seg_addr.pval + - OMPI_PML_BFO_MATCH_HDR_LEN); - iov.iov_len = size; - iov_count = 1; - /* - * Before copy the user buffer, make the target part - * accessible. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - (void)opal_convertor_pack( &sendreq->req_send.req_base.req_convertor, - &iov, &iov_count, &max_data ); - /* - * Packing finished, make the user buffer unaccessable. - */ - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - } - - - /* build match header */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = 0; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_MATCH; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_MATCH, - sendreq->req_send.req_base.req_proc); - - /* update lengths */ - segment->seg_len = OMPI_PML_BFO_MATCH_HDR_LEN + max_data; - - /* short message */ - des->des_cbdata = sendreq; - des->des_cbfunc = mca_pml_bfo_match_completion_free; - - /* send */ - rc = mca_bml_base_send_status(bml_btl, des, MCA_PML_BFO_HDR_TYPE_MATCH); - if( OPAL_LIKELY( rc >= OMPI_SUCCESS ) ) { - if( OPAL_LIKELY( 1 == rc ) ) { - mca_pml_bfo_match_completion_free_request( bml_btl, sendreq ); - } - return OMPI_SUCCESS; - } - if (OMPI_ERR_RESOURCE_BUSY == rc) { - /* No more resources. Allow the upper level to queue the send */ - rc = OMPI_ERR_OUT_OF_RESOURCE; - } - - mca_bml_base_free (bml_btl, des); - - return rc; -} - -/** - * BTL can send directly from user buffer so allow the BTL - * to prepare the segment list. Start sending a small message. - */ - -int mca_pml_bfo_send_request_start_prepare( mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size ) -{ - mca_btl_base_descriptor_t* des; - mca_btl_base_segment_t* segment; - mca_pml_bfo_hdr_t* hdr; - int rc; - - /* prepare descriptor */ - mca_bml_base_prepare_src( bml_btl, - NULL, - &sendreq->req_send.req_base.req_convertor, - MCA_BTL_NO_ORDER, - OMPI_PML_BFO_MATCH_HDR_LEN, - &size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP, - &des ); - if( OPAL_UNLIKELY(NULL == des) ) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - segment = des->des_local; - - /* build match header */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = 0; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_MATCH; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_MATCH, - sendreq->req_send.req_base.req_proc); - - /* short message */ - des->des_cbfunc = mca_pml_bfo_match_completion_free; - des->des_cbdata = sendreq; - - /* send */ - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_MATCH); - if( OPAL_LIKELY( rc >= 0 ) ) { - if( OPAL_LIKELY( 1 == rc ) ) { - mca_pml_bfo_match_completion_free_request( bml_btl, sendreq ); - } - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, des ); - return rc; -} - - -/** - * We have contigous data that is registered - schedule across - * available nics. - */ - -int mca_pml_bfo_send_request_start_rdma( mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size ) -{ - /* - * When req_rdma array is constructed the first element of the array always - * assigned different btl in round robin fashion (if there are more than - * one RDMA capable BTLs). This way round robin distribution of RDMA - * operation is achieved. - */ - - mca_btl_base_descriptor_t* des, *src = NULL; - mca_btl_base_segment_t* segment; - mca_pml_bfo_hdr_t* hdr; - bool need_local_cb = false; - int rc; - - bml_btl = sendreq->req_rdma[0].bml_btl; - if((sendreq->req_rdma_cnt == 1) && (bml_btl->btl_flags & (MCA_BTL_FLAGS_GET | MCA_BTL_FLAGS_CUDA_GET))) { - mca_mpool_base_registration_t* reg = sendreq->req_rdma[0].btl_reg; - size_t seg_size; - size_t old_position = sendreq->req_send.req_base.req_convertor.bConverted; - - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - /* prepare source descriptor/segment(s) */ - /* PML owns this descriptor and will free it in */ - /* get_completion */ - mca_bml_base_prepare_src( bml_btl, - reg, - &sendreq->req_send.req_base.req_convertor, - MCA_BTL_NO_ORDER, - 0, - &size, - MCA_BTL_DES_FLAGS_GET, - &src ); - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - if( OPAL_UNLIKELY(NULL == src) ) { - opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, - &old_position); - return OMPI_ERR_OUT_OF_RESOURCE; - } - src->des_cbfunc = mca_pml_bfo_rget_completion; - src->des_cbdata = sendreq; - - seg_size = bml_btl->btl->btl_seg_size * src->des_local_count; - - /* allocate space for get hdr + segment list */ - mca_bml_base_alloc(bml_btl, &des, MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_rget_hdr_t) + seg_size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - if( OPAL_UNLIKELY(NULL == des) ) { - opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, - &old_position ); - mca_bml_base_free(bml_btl, src); - return OMPI_ERR_OUT_OF_RESOURCE; - } - segment = des->des_local; - - /* build match header */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = MCA_PML_BFO_HDR_FLAGS_CONTIG|MCA_PML_BFO_HDR_FLAGS_PIN; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RGET; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed; - hdr->hdr_rndv.hdr_src_req.pval = sendreq; -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_RNDV_RESTART(hdr, sendreq, "RGET"); -#endif /* PML_BFO */ - hdr->hdr_rget.hdr_des.pval = src; - hdr->hdr_rget.hdr_seg_cnt = src->des_local_count; - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_RGET, - sendreq->req_send.req_base.req_proc); - - /* copy segment data */ - memmove (&hdr->hdr_rget + 1, src->des_local, seg_size); - - des->des_cbfunc = mca_pml_bfo_send_ctl_completion; - - /** - * Well, it's a get so we will not know when the peer get the data anyway. - * If we generate the PERUSE event here, at least we will know when do we - * sent the GET message ... - */ - if( sendreq->req_send.req_bytes_packed > 0 ) { - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_BEGIN, - &(sendreq->req_send.req_base), PERUSE_SEND ); - } - - } else { - - /* allocate a rendezvous header - dont eager send any data - * receiver will schedule rdma put(s) of the entire message - */ - - mca_bml_base_alloc(bml_btl, &des, - MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_rendezvous_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); - if( OPAL_UNLIKELY(NULL == des)) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - segment = des->des_local; - - /* build hdr */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = MCA_PML_BFO_HDR_FLAGS_CONTIG|MCA_PML_BFO_HDR_FLAGS_PIN; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDV; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed; - hdr->hdr_rndv.hdr_src_req.pval = sendreq; -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_RNDV_RESTART(hdr, sendreq, "RNDV"); -#endif /* PML_BFO */ - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_RNDV, - sendreq->req_send.req_base.req_proc); - - /* update lengths with number of bytes actually packed */ - segment->seg_len = sizeof(mca_pml_bfo_rendezvous_hdr_t); - - /* first fragment of a long message */ - des->des_cbfunc = mca_pml_bfo_rndv_completion; - need_local_cb = true; - - /* wait for ack and completion */ - sendreq->req_state = 2; - } - - des->des_cbdata = sendreq; - - /* send */ - rc = mca_bml_base_send(bml_btl, des, hdr->hdr_common.hdr_type); - if( OPAL_LIKELY( rc >= 0 ) ) { - if( OPAL_LIKELY( 1 == rc ) && (true == need_local_cb)) { - mca_pml_bfo_rndv_completion_request( bml_btl, sendreq, 0 ); - } -#if PML_BFO - if (MCA_PML_BFO_HDR_TYPE_RNDV == hdr->hdr_common.hdr_type) { - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - sendreq->req_events++; - } - } -#endif /* PML_BFO */ - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, des); - if (NULL != src) { - mca_bml_base_free (bml_btl, src); - } - - return rc; -} - - -/** - * Rendezvous is required. Not doing rdma so eager send up to - * the btls eager limit. - */ - -int mca_pml_bfo_send_request_start_rndv( mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size, - int flags ) -{ - mca_btl_base_descriptor_t* des; - mca_btl_base_segment_t* segment; - mca_pml_bfo_hdr_t* hdr; - int rc; - - /* prepare descriptor */ - if(size == 0) { - mca_bml_base_alloc( bml_btl, - &des, - MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_rendezvous_hdr_t), - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP ); - } else { - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - mca_bml_base_prepare_src( bml_btl, - NULL, - &sendreq->req_send.req_base.req_convertor, - MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_rendezvous_hdr_t), - &size, - MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP, - &des ); - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - } - - if( OPAL_UNLIKELY(NULL == des) ) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - segment = des->des_local; - - /* build hdr */ - hdr = (mca_pml_bfo_hdr_t*)segment->seg_addr.pval; - hdr->hdr_common.hdr_flags = flags; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_RNDV; - hdr->hdr_match.hdr_ctx = sendreq->req_send.req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_send.req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_tag = sendreq->req_send.req_base.req_tag; - hdr->hdr_match.hdr_seq = (uint16_t)sendreq->req_send.req_base.req_sequence; - hdr->hdr_rndv.hdr_msg_length = sendreq->req_send.req_bytes_packed; - hdr->hdr_rndv.hdr_src_req.pval = sendreq; -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_RNDV_RESTART(hdr, sendreq, "RNDV"); -#endif /* PML_BFO */ - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_RNDV, - sendreq->req_send.req_base.req_proc); - - /* first fragment of a long message */ - des->des_cbdata = sendreq; - des->des_cbfunc = mca_pml_bfo_rndv_completion; - - /* wait for ack and completion */ - sendreq->req_state = 2; - - /* send */ - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_RNDV); - if( OPAL_LIKELY( rc >= 0 ) ) { - if( OPAL_LIKELY( 1 == rc ) ) { - mca_pml_bfo_rndv_completion_request( bml_btl, sendreq, size ); - } -#if PML_BFO - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - sendreq->req_events++; - } -#endif /* PML_BFO */ - return OMPI_SUCCESS; - } - mca_bml_base_free(bml_btl, des ); - return rc; -} - -void mca_pml_bfo_send_request_copy_in_out( mca_pml_bfo_send_request_t *sendreq, - uint64_t send_offset, - uint64_t send_length ) -{ - mca_pml_bfo_send_range_t *sr; - ompi_free_list_item_t *i; - mca_bml_base_endpoint_t* bml_endpoint = sendreq->req_endpoint; - int num_btls = mca_bml_base_btl_array_get_size(&bml_endpoint->btl_send); - int n; - double weight_total = 0; - - if( OPAL_UNLIKELY(0 == send_length) ) - return; - - OMPI_FREE_LIST_WAIT_MT(&mca_pml_bfo.send_ranges, i); - - sr = (mca_pml_bfo_send_range_t*)i; - - sr->range_send_offset = send_offset; - sr->range_send_length = send_length; - sr->range_btl_idx = 0; - - for(n = 0; n < num_btls && n < mca_pml_bfo.max_send_per_range; n++) { - sr->range_btls[n].bml_btl = - mca_bml_base_btl_array_get_next(&bml_endpoint->btl_send); - weight_total += sr->range_btls[n].bml_btl->btl_weight; - } - - sr->range_btl_cnt = n; - mca_pml_bfo_calc_weighted_length(sr->range_btls, n, send_length, - weight_total); - - OPAL_THREAD_LOCK(&sendreq->req_send_range_lock); - opal_list_append(&sendreq->req_send_ranges, (opal_list_item_t*)sr); - OPAL_THREAD_UNLOCK(&sendreq->req_send_range_lock); -} - -static inline mca_pml_bfo_send_range_t * -get_send_range_nolock(mca_pml_bfo_send_request_t* sendreq) -{ - opal_list_item_t *item; - - item = opal_list_get_first(&sendreq->req_send_ranges); - - if(opal_list_get_end(&sendreq->req_send_ranges) == item) - return NULL; - - return (mca_pml_bfo_send_range_t*)item; -} - -static inline mca_pml_bfo_send_range_t * -get_send_range(mca_pml_bfo_send_request_t* sendreq) -{ - mca_pml_bfo_send_range_t *range; - - OPAL_THREAD_LOCK(&sendreq->req_send_range_lock); - range = get_send_range_nolock(sendreq); - OPAL_THREAD_UNLOCK(&sendreq->req_send_range_lock); - - return range; -} - -static inline mca_pml_bfo_send_range_t * -get_next_send_range(mca_pml_bfo_send_request_t* sendreq, - mca_pml_bfo_send_range_t *range) -{ - OPAL_THREAD_LOCK(&sendreq->req_send_range_lock); - opal_list_remove_item(&sendreq->req_send_ranges, (opal_list_item_t *)range); - OMPI_FREE_LIST_RETURN_MT(&mca_pml_bfo.send_ranges, &range->base); - range = get_send_range_nolock(sendreq); - OPAL_THREAD_UNLOCK(&sendreq->req_send_range_lock); - - return range; -} - -/** - * Schedule pipeline of send descriptors for the given request. - * Up to the rdma threshold. If this is a send based protocol, - * the rdma threshold is the end of the message. Otherwise, schedule - * fragments up to the threshold to overlap initial registration/setup - * costs of the rdma. Only one thread can be inside this function. - */ - -int -mca_pml_bfo_send_request_schedule_once(mca_pml_bfo_send_request_t* sendreq) -{ - size_t prev_bytes_remaining = 0; - mca_pml_bfo_send_range_t *range; - int num_fail = 0; - - /* check pipeline_depth here before attempting to get any locks */ - if(true == sendreq->req_throttle_sends && - sendreq->req_pipeline_depth >= mca_pml_bfo.send_pipeline_depth) - return OMPI_SUCCESS; - - range = get_send_range(sendreq); - - while(range && (false == sendreq->req_throttle_sends || - sendreq->req_pipeline_depth < mca_pml_bfo.send_pipeline_depth)) { - mca_pml_bfo_frag_hdr_t* hdr; - mca_btl_base_descriptor_t* des; - int rc, btl_idx; - size_t size, offset, data_remaining = 0; - mca_bml_base_btl_t* bml_btl; - - assert(range->range_send_length != 0); -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_REMOVED_BTL(sendreq, range); -#endif /* PML_BFO */ - - if(prev_bytes_remaining == range->range_send_length) - num_fail++; - else - num_fail = 0; - - prev_bytes_remaining = range->range_send_length; - - if( OPAL_UNLIKELY(num_fail == range->range_btl_cnt) ) { - assert(sendreq->req_pending == MCA_PML_BFO_SEND_PENDING_NONE); - add_request_to_send_pending(sendreq, - MCA_PML_BFO_SEND_PENDING_SCHEDULE, true); - /* Note that request remains locked. send_request_process_pending() - * function will call shedule_exclusive() directly without taking - * the lock */ - return OMPI_ERR_OUT_OF_RESOURCE; - } - -cannot_pack: - do { - btl_idx = range->range_btl_idx; - if(++range->range_btl_idx == range->range_btl_cnt) - range->range_btl_idx = 0; - } while(!range->range_btls[btl_idx].length); - - bml_btl = range->range_btls[btl_idx].bml_btl; - /* If there is a remaining data from another BTL that was too small - * for converter to pack then send it through another BTL */ - range->range_btls[btl_idx].length += data_remaining; - size = range->range_btls[btl_idx].length; - - /* makes sure that we don't exceed BTL max send size */ - if(bml_btl->btl->btl_max_send_size != 0) { - size_t max_send_size = bml_btl->btl->btl_max_send_size - - sizeof(mca_pml_bfo_frag_hdr_t); - - if (size > max_send_size) { - size = max_send_size; - } - } - - /* pack into a descriptor */ - offset = (size_t)range->range_send_offset; - opal_convertor_set_position(&sendreq->req_send.req_base.req_convertor, - &offset); - range->range_send_offset = (uint64_t)offset; - - data_remaining = size; - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_defined, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - mca_bml_base_prepare_src(bml_btl, NULL, - &sendreq->req_send.req_base.req_convertor, - MCA_BTL_NO_ORDER, - sizeof(mca_pml_bfo_frag_hdr_t), - &size, MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | MCA_BTL_DES_SEND_ALWAYS_CALLBACK, &des); - MEMCHECKER( - memchecker_call(&opal_memchecker_base_mem_noaccess, - sendreq->req_send.req_base.req_addr, - sendreq->req_send.req_base.req_count, - sendreq->req_send.req_base.req_datatype); - ); - - if( OPAL_UNLIKELY(des == NULL || size == 0) ) { - if(des) { - /* Converter can't pack this chunk. Append to another chunk - * from other BTL */ - mca_bml_base_free(bml_btl, des); - range->range_btls[btl_idx].length -= data_remaining; - goto cannot_pack; - } - continue; - } - - des->des_cbfunc = mca_pml_bfo_frag_completion; - des->des_cbdata = sendreq; - - /* setup header */ - hdr = (mca_pml_bfo_frag_hdr_t*)des->des_local->seg_addr.pval; - hdr->hdr_common.hdr_flags = 0; - hdr->hdr_common.hdr_type = MCA_PML_BFO_HDR_TYPE_FRAG; - hdr->hdr_frag_offset = range->range_send_offset; - hdr->hdr_src_req.pval = sendreq; - hdr->hdr_dst_req = sendreq->req_recv; - - bfo_hdr_hton(hdr, MCA_PML_BFO_HDR_TYPE_FRAG, - sendreq->req_send.req_base.req_proc); - -#if OMPI_WANT_PERUSE - PERUSE_TRACE_COMM_OMPI_EVENT(PERUSE_COMM_REQ_XFER_CONTINUE, - &(sendreq->req_send.req_base), size, PERUSE_SEND); -#endif /* OMPI_WANT_PERUSE */ - - /* initiate send - note that this may complete before the call returns */ - rc = mca_bml_base_send(bml_btl, des, MCA_PML_BFO_HDR_TYPE_FRAG); - if( OPAL_LIKELY(rc >= 0) ) { - /* update state */ - range->range_btls[btl_idx].length -= size; - range->range_send_length -= size; - range->range_send_offset += size; - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_pipeline_depth, 1); - if(range->range_send_length == 0) { - range = get_next_send_range(sendreq, range); - prev_bytes_remaining = 0; - } -#if PML_BFO - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - sendreq->req_events++; - } -#endif /* PML_BFO */ - } else { - mca_bml_base_free(bml_btl,des); - } - } - - return OMPI_SUCCESS; -} - - -/** - * An RDMA put operation has completed: - * (1) Update request status and if required set completed - * (2) Send FIN control message to the destination - */ - -static void mca_pml_bfo_put_completion( mca_btl_base_module_t* btl, - struct mca_btl_base_endpoint_t* ep, - struct mca_btl_base_descriptor_t* des, - int status ) -{ - mca_pml_bfo_rdma_frag_t* frag = (mca_pml_bfo_rdma_frag_t*)des->des_cbdata; - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)frag->rdma_req; - mca_bml_base_btl_t* bml_btl = (mca_bml_base_btl_t*) des->des_context; - - /* check completion status */ - if( OPAL_UNLIKELY(OMPI_SUCCESS != status) ) { -#if PML_BFO - sendreq->req_error++; -#else /* PML_BFO */ - /* TSW - FIX */ - OMPI_ERROR_LOG(status); - ompi_rte_abort(-1, NULL); -#endif /* PML_BFO */ - } -#if PML_BFO - sendreq->req_events--; - MCA_PML_BFO_PUT_COMPLETION_SENDREQ_ERROR_CHECK(sendreq, status, btl); - MCA_PML_BFO_CHECK_SENDREQ_EAGER_BML_BTL(bml_btl, btl, sendreq, "RDMA write"); -#endif /* PML_BFO */ - - mca_pml_bfo_send_fin(sendreq->req_send.req_base.req_proc, - bml_btl, - frag->rdma_hdr.hdr_rdma.hdr_des, -#if PML_BFO - des->order, 0, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_comm->c_my_rank); -#else /* PML_BFO */ - des->order, 0); -#endif /* PML_BFO */ - - /* check for request completion */ - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, frag->rdma_length); - - send_request_pml_complete_check(sendreq); - - MCA_PML_BFO_RDMA_FRAG_RETURN(frag); - - MCA_PML_BFO_PROGRESS_PENDING(bml_btl); -} - -int mca_pml_bfo_send_request_put_frag( mca_pml_bfo_rdma_frag_t* frag ) -{ - mca_mpool_base_registration_t* reg = NULL; - mca_bml_base_btl_t* bml_btl = frag->rdma_bml; - mca_btl_base_descriptor_t* des; - size_t save_size = frag->rdma_length; - int rc; - - /* setup descriptor */ - mca_bml_base_prepare_src( bml_btl, - reg, - &frag->convertor, - MCA_BTL_NO_ORDER, - 0, - &frag->rdma_length, - MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | - MCA_BTL_DES_FLAGS_PUT, - &des ); - - if( OPAL_UNLIKELY(NULL == des) ) { - if(frag->retries < mca_pml_bfo.rdma_put_retries_limit) { - size_t offset = (size_t)frag->rdma_hdr.hdr_rdma.hdr_rdma_offset; - frag->rdma_length = save_size; - opal_convertor_set_position(&frag->convertor, &offset); - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - } else { - mca_pml_bfo_send_request_t *sendreq = - (mca_pml_bfo_send_request_t*)frag->rdma_req; - - /* tell receiver to unregister memory */ - mca_pml_bfo_send_fin(sendreq->req_send.req_base.req_proc, - bml_btl, frag->rdma_hdr.hdr_rdma.hdr_des, -#if PML_BFO - MCA_BTL_NO_ORDER, 1, (uint16_t)sendreq->req_send.req_base.req_sequence, - sendreq->req_restartseq, sendreq->req_send.req_base.req_comm->c_contextid, - sendreq->req_send.req_base.req_comm->c_my_rank); -#else /* PML_BFO */ - MCA_BTL_NO_ORDER, 1); -#endif /* PML_BFO */ - - /* send fragment by copy in/out */ - mca_pml_bfo_send_request_copy_in_out(sendreq, - frag->rdma_hdr.hdr_rdma.hdr_rdma_offset, frag->rdma_length); - /* if a pointer to a receive request is not set it means that - * ACK was not yet received. Don't schedule sends before ACK */ - if(NULL != sendreq->req_recv.pval) - mca_pml_bfo_send_request_schedule(sendreq); - } - return OMPI_ERR_OUT_OF_RESOURCE; - } - - des->des_remote = (mca_btl_base_segment_t *) frag->rdma_segs; - des->des_remote_count = frag->rdma_hdr.hdr_rdma.hdr_seg_cnt; - des->des_cbfunc = mca_pml_bfo_put_completion; - des->des_cbdata = frag; - - PERUSE_TRACE_COMM_OMPI_EVENT( PERUSE_COMM_REQ_XFER_CONTINUE, - &(((mca_pml_bfo_send_request_t*)frag->rdma_req)->req_send.req_base), save_size, PERUSE_SEND ); - - rc = mca_bml_base_put(bml_btl, des); - if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { - mca_bml_base_free(bml_btl, des); - frag->rdma_length = save_size; - if(OMPI_ERR_OUT_OF_RESOURCE == rc) { - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - opal_list_append(&mca_pml_bfo.rdma_pending, (opal_list_item_t*)frag); - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - return OMPI_ERR_OUT_OF_RESOURCE; - } else { - /* TSW - FIX */ - OMPI_ERROR_LOG(rc); - ompi_rte_abort(-1, NULL); - } - } -#if PML_BFO - if (des->des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { - ((mca_pml_bfo_send_request_t*)frag->rdma_req)->req_events++; - } -#endif /* PML_BFO */ - return OMPI_SUCCESS; -} - -/** - * Receiver has scheduled an RDMA operation: - * (1) Allocate an RDMA fragment to maintain the state of the operation - * (2) Call BTL prepare_src to pin/prepare source buffers - * (3) Queue the RDMA put - */ - -void mca_pml_bfo_send_request_put( mca_pml_bfo_send_request_t* sendreq, - mca_btl_base_module_t* btl, - mca_pml_bfo_rdma_hdr_t* hdr ) -{ - mca_bml_base_endpoint_t *bml_endpoint = sendreq->req_endpoint; - mca_pml_bfo_rdma_frag_t* frag; - size_t i, size = 0; - - if(hdr->hdr_common.hdr_flags & MCA_PML_BFO_HDR_TYPE_ACK) { - OPAL_THREAD_ADD_FETCH32(&sendreq->req_state, -1); - } -#if PML_BFO - MCA_PML_BFO_VERIFY_SENDREQ_REQ_STATE_VALUE(sendreq); - sendreq->req_recv = hdr->hdr_dst_req; /* only needed once, but it is OK */ -#endif /* PML_BFO */ - - MCA_PML_BFO_RDMA_FRAG_ALLOC(frag); - if( OPAL_UNLIKELY(NULL == frag) ) { - /* TSW - FIX */ - OMPI_ERROR_LOG(OMPI_ERR_OUT_OF_RESOURCE); - ompi_rte_abort(-1, NULL); - } - - assert (btl->btl_seg_size * hdr->hdr_seg_cnt <= sizeof (frag->rdma_segs)); - - /* setup fragment */ - memmove (frag->rdma_segs, hdr + 1, btl->btl_seg_size * hdr->hdr_seg_cnt); - - for( i = 0; i < hdr->hdr_seg_cnt; i++ ) { - mca_btl_base_segment_t *seg = (mca_btl_base_segment_t *) ((uintptr_t)(frag->rdma_segs) + i * btl->btl_seg_size); - -#if OPAL_ENABLE_HETEROGENEOUS_SUPPORT - if ((sendreq->req_send.req_base.req_proc->super.proc_arch & OPAL_ARCH_ISBIGENDIAN) != - (ompi_proc_local()->super.proc_arch & OPAL_ARCH_ISBIGENDIAN)) { - size += opal_swap_bytes4(seg->seg_len); - } else -#endif - { - size += seg->seg_len; - } - } - - frag->rdma_bml = mca_bml_base_btl_array_find(&bml_endpoint->btl_rdma, btl); -#if PML_BFO - MCA_PML_BFO_CHECK_FOR_REMOVED_BML(sendreq, frag, btl); - frag->rdma_btl = btl; /* in case frag ends up on pending */ -#endif /* PML_BFO */ - frag->rdma_hdr.hdr_rdma = *hdr; - frag->rdma_req = sendreq; - frag->rdma_ep = bml_endpoint; - frag->rdma_length = size; - frag->rdma_state = MCA_PML_BFO_RDMA_PUT; - frag->reg = NULL; - frag->retries = 0; - - /* lookup the corresponding registration */ - for(i=0; ireq_rdma_cnt; i++) { - if(sendreq->req_rdma[i].bml_btl == frag->rdma_bml) { - frag->reg = sendreq->req_rdma[i].btl_reg; - break; - } - } - - /* RDMA writes may proceed in parallel to send and to each other, so - * create clone of the convertor for each RDMA fragment - */ - size = hdr->hdr_rdma_offset; - opal_convertor_clone_with_position(&sendreq->req_send.req_base.req_convertor, - &frag->convertor, 0, &size); - - mca_pml_bfo_send_request_put_frag(frag); -} - diff --git a/ompi/mca/pml/bfo/pml_bfo_sendreq.h b/ompi/mca/pml/bfo/pml_bfo_sendreq.h deleted file mode 100644 index 170512ffe3e..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_sendreq.h +++ /dev/null @@ -1,499 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * 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 - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009-2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2011-2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef OMPI_PML_BFO_SEND_REQUEST_H -#define OMPI_PML_BFO_SEND_REQUEST_H - -#include "opal/mca/btl/btl.h" -#include "opal/mca/mpool/base/base.h" -#include "ompi/mca/pml/base/pml_base_sendreq.h" -#include "pml_bfo_comm.h" -#include "pml_bfo_hdr.h" -#include "pml_bfo_rdma.h" -#include "pml_bfo_rdmafrag.h" -#include "ompi/mca/bml/bml.h" - -BEGIN_C_DECLS - -typedef enum { - MCA_PML_BFO_SEND_PENDING_NONE, - MCA_PML_BFO_SEND_PENDING_SCHEDULE, - MCA_PML_BFO_SEND_PENDING_START -} mca_pml_bfo_send_pending_t; - -struct mca_pml_bfo_send_request_t { - mca_pml_base_send_request_t req_send; - mca_bml_base_endpoint_t* req_endpoint; - opal_ptr_t req_recv; -#if PML_BFO - int32_t req_events; /* number of outstanding events on request */ - int32_t req_restartseq; /* sequence number of restarted request */ - int32_t req_restart; /* state of restarted request */ - int32_t req_error; /* non-zero when error has occurred on request */ -#endif /* PML_BFO */ - int32_t req_state; - int32_t req_lock; - bool req_throttle_sends; - size_t req_pipeline_depth; - size_t req_bytes_delivered; - uint32_t req_rdma_cnt; - mca_pml_bfo_send_pending_t req_pending; - opal_mutex_t req_send_range_lock; - opal_list_t req_send_ranges; - mca_pml_bfo_com_btl_t req_rdma[1]; -}; -typedef struct mca_pml_bfo_send_request_t mca_pml_bfo_send_request_t; - -OBJ_CLASS_DECLARATION(mca_pml_bfo_send_request_t); - -struct mca_pml_bfo_send_range_t { - opal_free_list_item_t base; - uint64_t range_send_offset; - uint64_t range_send_length; - int range_btl_idx; - int range_btl_cnt; - mca_pml_bfo_com_btl_t range_btls[1]; -}; -typedef struct mca_pml_bfo_send_range_t mca_pml_bfo_send_range_t; -OBJ_CLASS_DECLARATION(mca_pml_bfo_send_range_t); - -static inline bool lock_send_request(mca_pml_bfo_send_request_t *sendreq) -{ - return OPAL_THREAD_ADD_FETCH32(&sendreq->req_lock, 1) == 1; -} - -static inline bool unlock_send_request(mca_pml_bfo_send_request_t *sendreq) -{ - return OPAL_THREAD_ADD_FETCH32(&sendreq->req_lock, -1) == 0; -} - -static inline void -add_request_to_send_pending(mca_pml_bfo_send_request_t* sendreq, - const mca_pml_bfo_send_pending_t type, - const bool append) -{ - opal_list_item_t *item = (opal_list_item_t*)sendreq; - - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - sendreq->req_pending = type; - if(append) - opal_list_append(&mca_pml_bfo.send_pending, item); - else - opal_list_prepend(&mca_pml_bfo.send_pending, item); - - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); -} - -static inline mca_pml_bfo_send_request_t* -get_request_from_send_pending(mca_pml_bfo_send_pending_t *type) -{ - mca_pml_bfo_send_request_t *sendreq; - - OPAL_THREAD_LOCK(&mca_pml_bfo.lock); - sendreq = (mca_pml_bfo_send_request_t*) - opal_list_remove_first(&mca_pml_bfo.send_pending); - if(sendreq) { - *type = sendreq->req_pending; - sendreq->req_pending = MCA_PML_BFO_SEND_PENDING_NONE; - } - OPAL_THREAD_UNLOCK(&mca_pml_bfo.lock); - - return sendreq; -} - -#define MCA_PML_BFO_SEND_REQUEST_ALLOC( comm, \ - dst, \ - sendreq) \ - { \ - ompi_proc_t *proc = ompi_comm_peer_lookup( comm, dst ); \ - opal_free_list_item_t* item; \ - \ - sendreq = NULL; \ - if( OPAL_LIKELY(NULL != proc) ) { \ - OPAL_FREE_LIST_WAIT_MT(&mca_pml_base_send_requests, item); \ - sendreq = (mca_pml_bfo_send_request_t*)item; \ - sendreq->req_send.req_base.req_proc = proc; \ - } \ - } - - -#define MCA_PML_BFO_SEND_REQUEST_INIT( sendreq, \ - buf, \ - count, \ - datatype, \ - dst, \ - tag, \ - comm, \ - sendmode, \ - persistent) \ - { \ - MCA_PML_BASE_SEND_REQUEST_INIT(&sendreq->req_send, \ - buf, \ - count, \ - datatype, \ - dst, \ - tag, \ - comm, \ - sendmode, \ - persistent, \ - 0); /* convertor_flags */ \ - (sendreq)->req_recv.pval = NULL; \ - } - - -static inline void mca_pml_bfo_free_rdma_resources(mca_pml_bfo_send_request_t* sendreq) -{ - size_t r; - - /* return mpool resources */ - for(r = 0; r < sendreq->req_rdma_cnt; r++) { - struct mca_btl_base_registration_handle_t* handle = sendreq->req_rdma[r].btl_reg; - mca_bml_base_btl_t *bml_btl = sendreq->req_rdma[r].bml_btl; - - if( NULL != handle ) { - mca_bml_base_deregister_mem (bml_btl, handle); - sendreq->req_rdma[r].btl_reg = NULL; - } - } - sendreq->req_rdma_cnt = 0; -} - - -/** - * Start a send request. - */ - -#define MCA_PML_BFO_SEND_REQUEST_START(sendreq, rc) \ - do { \ - rc = mca_pml_bfo_send_request_start(sendreq); \ - } while (0) - - -/* - * Mark a send request as completed at the MPI level. - */ - -#define MCA_PML_BFO_SEND_REQUEST_MPI_COMPLETE(sendreq, with_signal) \ -do { \ - (sendreq)->req_send.req_base.req_ompi.req_status.MPI_SOURCE = \ - (sendreq)->req_send.req_base.req_comm->c_my_rank; \ - (sendreq)->req_send.req_base.req_ompi.req_status.MPI_TAG = \ - (sendreq)->req_send.req_base.req_tag; \ - (sendreq)->req_send.req_base.req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; \ - (sendreq)->req_send.req_base.req_ompi.req_status._ucount = \ - (sendreq)->req_send.req_bytes_packed; \ - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_COMPLETE, \ - &(sendreq->req_send.req_base), PERUSE_SEND); \ - \ - ompi_request_complete( &((sendreq)->req_send.req_base.req_ompi), (with_signal) ); \ -} while(0) - -/* - * Release resources associated with a request - */ - -#define MCA_PML_BFO_SEND_REQUEST_RETURN(sendreq) \ - do { \ - MCA_PML_BASE_SEND_REQUEST_FINI((&(sendreq)->req_send)); \ - OPAL_FREE_LIST_RETURN( &mca_pml_base_send_requests, \ - (opal_free_list_item_t*)sendreq); \ - } while(0) - - -/* - * The PML has completed a send request. Note that this request - * may have been orphaned by the user or have already completed - * at the MPI level. - * This function will never be called directly from the upper level, as it - * should only be an internal call to the PML. - * - */ -static inline void -send_request_pml_complete(mca_pml_bfo_send_request_t *sendreq) -{ - if(false == sendreq->req_send.req_base.req_pml_complete) { - if(sendreq->req_send.req_bytes_packed > 0) { - PERUSE_TRACE_COMM_EVENT( PERUSE_COMM_REQ_XFER_END, - &(sendreq->req_send.req_base), PERUSE_SEND); - } - - /* return mpool resources */ - mca_pml_bfo_free_rdma_resources(sendreq); - - if (sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED && - sendreq->req_send.req_addr != sendreq->req_send.req_base.req_addr) { - mca_pml_base_bsend_request_fini((ompi_request_t*)sendreq); - } - - sendreq->req_send.req_base.req_pml_complete = true; - - if( !REQUEST_COMPLETE( &((sendreq->req_send).req_base.req_ompi)) ) { - /* Should only be called for long messages (maybe synchronous) */ - MCA_PML_BFO_SEND_REQUEST_MPI_COMPLETE(sendreq, true); - } else { - if( MPI_SUCCESS != sendreq->req_send.req_base.req_ompi.req_status.MPI_ERROR ) { - ompi_mpi_abort(&ompi_mpi_comm_world.comm, MPI_ERR_REQUEST); - } - } -#if PML_BFO - sendreq->req_send.req_base.req_sequence -= 100; -#endif /* PML_BFO */ - - if(true == sendreq->req_send.req_base.req_free_called) { - MCA_PML_BFO_SEND_REQUEST_RETURN(sendreq); - } - } -} - -/* returns true if request was completed on PML level */ -static inline bool -send_request_pml_complete_check(mca_pml_bfo_send_request_t *sendreq) -{ -#if OPAL_ENABLE_MULTI_THREADS - opal_atomic_rmb(); -#endif - /* if no more events are expected for the request and the whole message is - * already sent and send fragment scheduling isn't running in another - * thread then complete the request on PML level. From now on, if user - * called free on this request, the request structure can be reused for - * another request or if the request is persistent it can be restarted */ - if(sendreq->req_state == 0 && - sendreq->req_bytes_delivered >= sendreq->req_send.req_bytes_packed - && lock_send_request(sendreq)) { - send_request_pml_complete(sendreq); - return true; - } - - return false; -} - -/** - * Schedule additional fragments - */ -int -mca_pml_bfo_send_request_schedule_once(mca_pml_bfo_send_request_t*); - -static inline int -mca_pml_bfo_send_request_schedule_exclusive(mca_pml_bfo_send_request_t* sendreq) -{ - int rc; - do { - rc = mca_pml_bfo_send_request_schedule_once(sendreq); - if(rc == OMPI_ERR_OUT_OF_RESOURCE) - break; - } while(!unlock_send_request(sendreq)); - - if(OMPI_SUCCESS == rc) - send_request_pml_complete_check(sendreq); - - return rc; -} - -static inline void -mca_pml_bfo_send_request_schedule(mca_pml_bfo_send_request_t* sendreq) -{ - /* - * Only allow one thread in this routine for a given request. - * However, we cannot block callers on a mutex, so simply keep track - * of the number of times the routine has been called and run through - * the scheduling logic once for every call. - */ - - if(!lock_send_request(sendreq)) - return; - - mca_pml_bfo_send_request_schedule_exclusive(sendreq); -} - -#if OPAL_CUDA_SUPPORT -int mca_pml_bfo_send_request_start_cuda( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size); -#endif /* OPAL_CUDA_SUPPORT */ - -/** - * Start the specified request - */ - -int mca_pml_bfo_send_request_start_buffered( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size); - -int mca_pml_bfo_send_request_start_copy( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size); - -int mca_pml_bfo_send_request_start_prepare( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size); - -int mca_pml_bfo_send_request_start_rdma( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size); - -int mca_pml_bfo_send_request_start_rndv( - mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl, - size_t size, - int flags); - -static inline int -mca_pml_bfo_send_request_start_btl( mca_pml_bfo_send_request_t* sendreq, - mca_bml_base_btl_t* bml_btl ) -{ - size_t size = sendreq->req_send.req_bytes_packed; - mca_btl_base_module_t* btl = bml_btl->btl; - size_t eager_limit = btl->btl_eager_limit - sizeof(mca_pml_bfo_hdr_t); - int rc; - - if( OPAL_LIKELY(size <= eager_limit) ) { - switch(sendreq->req_send.req_send_mode) { - case MCA_PML_BASE_SEND_SYNCHRONOUS: - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, size, 0); - break; - case MCA_PML_BASE_SEND_BUFFERED: - rc = mca_pml_bfo_send_request_start_copy(sendreq, bml_btl, size); - break; - case MCA_PML_BASE_SEND_COMPLETE: - rc = mca_pml_bfo_send_request_start_prepare(sendreq, bml_btl, size); - break; - default: - if (size != 0 && bml_btl->btl_flags & MCA_BTL_FLAGS_SEND_INPLACE) { - rc = mca_pml_bfo_send_request_start_prepare(sendreq, bml_btl, size); - } else { - rc = mca_pml_bfo_send_request_start_copy(sendreq, bml_btl, size); - } - break; - } - } else { - size = eager_limit; - if(OPAL_UNLIKELY(btl->btl_rndv_eager_limit < eager_limit)) - size = btl->btl_rndv_eager_limit; - if(sendreq->req_send.req_send_mode == MCA_PML_BASE_SEND_BUFFERED) { - rc = mca_pml_bfo_send_request_start_buffered(sendreq, bml_btl, size); - } else if - (opal_convertor_need_buffers(&sendreq->req_send.req_base.req_convertor) == false) { - unsigned char *base; - opal_convertor_get_current_pointer( &sendreq->req_send.req_base.req_convertor, (void**)&base ); - - if( 0 != (sendreq->req_rdma_cnt = (uint32_t)mca_pml_bfo_rdma_btls( - sendreq->req_endpoint, - base, - sendreq->req_send.req_bytes_packed, - sendreq->req_rdma))) { - rc = mca_pml_bfo_send_request_start_rdma(sendreq, bml_btl, - sendreq->req_send.req_bytes_packed); - if( OPAL_UNLIKELY(OMPI_SUCCESS != rc) ) { - mca_pml_bfo_free_rdma_resources(sendreq); - } - } else { - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, size, - MCA_PML_BFO_HDR_FLAGS_CONTIG); - } - } else { -#if OPAL_CUDA_SUPPORT - if (sendreq->req_send.req_base.req_convertor.flags & CONVERTOR_CUDA) { - return mca_pml_bfo_send_request_start_cuda(sendreq, bml_btl, size); - } -#endif /* OPAL_CUDA_SUPPORT */ - rc = mca_pml_bfo_send_request_start_rndv(sendreq, bml_btl, size, 0); - } - } - - return rc; -} - -static inline int -mca_pml_bfo_send_request_start( mca_pml_bfo_send_request_t* sendreq ) -{ - mca_pml_bfo_comm_t* comm = sendreq->req_send.req_base.req_comm->c_pml_comm; - mca_bml_base_endpoint_t* endpoint = (mca_bml_base_endpoint_t*) - sendreq->req_send.req_base.req_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_BML]; - size_t i; - - if( OPAL_UNLIKELY(endpoint == NULL) ) { - return OMPI_ERR_UNREACH; - } - - sendreq->req_endpoint = endpoint; - sendreq->req_state = 0; - sendreq->req_lock = 0; - sendreq->req_pipeline_depth = 0; - sendreq->req_bytes_delivered = 0; - sendreq->req_pending = MCA_PML_BFO_SEND_PENDING_NONE; - sendreq->req_send.req_base.req_sequence = OPAL_THREAD_ADD_FETCH32( - &comm->procs[sendreq->req_send.req_base.req_peer].send_sequence,1); -#if PML_BFO - sendreq->req_restartseq = 0; /* counts up restarts */ - sendreq->req_restart = 0; /* reset in case we restart again */ - sendreq->req_error = 0; /* clear error state */ - sendreq->req_events = 0; /* clear events, probably 0 anyways */ -#endif /* PML_BFO */ - - MCA_PML_BASE_SEND_START( &sendreq->req_send.req_base ); - - for(i = 0; i < mca_bml_base_btl_array_get_size(&endpoint->btl_eager); i++) { - mca_bml_base_btl_t* bml_btl; - int rc; - - /* select a btl */ - bml_btl = mca_bml_base_btl_array_get_next(&endpoint->btl_eager); - rc = mca_pml_bfo_send_request_start_btl(sendreq, bml_btl); - if( OPAL_LIKELY(OMPI_ERR_OUT_OF_RESOURCE != rc) ) - return rc; - } - add_request_to_send_pending(sendreq, MCA_PML_BFO_SEND_PENDING_START, true); - - return OMPI_SUCCESS; -} - -/** - * Initiate a put scheduled by the receiver. - */ - -void mca_pml_bfo_send_request_put( mca_pml_bfo_send_request_t* sendreq, - mca_btl_base_module_t* btl, - mca_pml_bfo_rdma_hdr_t* hdr ); - -int mca_pml_bfo_send_request_put_frag(mca_pml_bfo_rdma_frag_t* frag); - -/* This function tries to continue sendreq that was stuck because of resource - * unavailability. A sendreq may be added to send_pending list if there is no - * resource to send initial packet or there is not resource to schedule data - * for sending. The reason the sendreq was added to the list is stored inside - * sendreq struct and appropriate operation is retried when resource became - * available. bml_btl passed to the function doesn't represents sendreq - * destination, it represents BTL on which resource was freed, so only this BTL - * should be considered for sending packets */ -void mca_pml_bfo_send_request_process_pending(mca_bml_base_btl_t *bml_btl); - -void mca_pml_bfo_send_request_copy_in_out(mca_pml_bfo_send_request_t *sendreq, - uint64_t send_offset, uint64_t send_length); - -END_C_DECLS - -#endif /* OMPI_PML_BFO_SEND_REQUEST_H */ diff --git a/ompi/mca/pml/bfo/pml_bfo_start.c b/ompi/mca/pml/bfo/pml_bfo_start.c deleted file mode 100644 index 93e6216c92d..00000000000 --- a/ompi/mca/pml/bfo/pml_bfo_start.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * 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 - * 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) 2006 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "ompi_config.h" - -#include "pml_bfo.h" -#include "pml_bfo_recvreq.h" -#include "pml_bfo_sendreq.h" -#include "ompi/memchecker.h" - - -int mca_pml_bfo_start(size_t count, ompi_request_t** requests) -{ - int rc; - size_t i; - bool reuse_old_request = true; - - for(i=0; ireq_type) { - continue; - } - - /* If the persistent request is currently active - obtain the - * request lock and verify the status is incomplete. if the - * pml layer has not completed the request - mark the request - * as free called - so that it will be freed when the request - * completes - and create a new request. - */ - -#if OPAL_ENABLE_MULTI_THREADS - opal_atomic_rmb(); -#endif - reuse_old_request = true; - switch(pml_request->req_ompi.req_state) { - case OMPI_REQUEST_INACTIVE: - if(pml_request->req_pml_complete == true) - break; - /* otherwise fall through */ - case OMPI_REQUEST_ACTIVE: { - - ompi_request_t *request; - if (pml_request->req_pml_complete == false) { - /* free request after it completes */ - pml_request->req_free_called = true; - } else { - /* can reuse the existing request */ - break; - } - - reuse_old_request = false; - /* allocate a new request */ - switch(pml_request->req_type) { - case MCA_PML_REQUEST_SEND: { - mca_pml_base_send_mode_t sendmode = - ((mca_pml_base_send_request_t*)pml_request)->req_send_mode; - rc = mca_pml_bfo_isend_init( - pml_request->req_addr, - pml_request->req_count, - pml_request->req_datatype, - pml_request->req_peer, - pml_request->req_tag, - sendmode, - pml_request->req_comm, - &request); - break; - } - case MCA_PML_REQUEST_RECV: - rc = mca_pml_bfo_irecv_init( - pml_request->req_addr, - pml_request->req_count, - pml_request->req_datatype, - pml_request->req_peer, - pml_request->req_tag, - pml_request->req_comm, - &request); - break; - default: - rc = OMPI_ERR_REQUEST; - break; - } - if(OMPI_SUCCESS != rc) - return rc; - pml_request = (mca_pml_base_request_t*)request; - requests[i] = request; - break; - } - default: - return OMPI_ERR_REQUEST; - } - - /* start the request */ - switch(pml_request->req_type) { - case MCA_PML_REQUEST_SEND: - { - mca_pml_bfo_send_request_t* sendreq = (mca_pml_bfo_send_request_t*)pml_request; - MEMCHECKER( - memchecker_call(&opal_memchecker_base_isdefined, - pml_request->req_addr, pml_request->req_count, - pml_request->req_datatype); - ); - if( reuse_old_request && (sendreq->req_send.req_bytes_packed != 0) ) { - size_t offset = 0; - /** - * Reset the convertor in case we're dealing with the original - * request, which when completed do not reset the convertor. - */ - opal_convertor_set_position( &sendreq->req_send.req_base.req_convertor, - &offset ); - } - MCA_PML_BFO_SEND_REQUEST_START(sendreq, rc); - if(rc != OMPI_SUCCESS) - return rc; - break; - } - case MCA_PML_REQUEST_RECV: - { - mca_pml_bfo_recv_request_t* recvreq = (mca_pml_bfo_recv_request_t*)pml_request; - MCA_PML_BFO_RECV_REQUEST_START(recvreq); - break; - } - default: - return OMPI_ERR_REQUEST; - } - } - return OMPI_SUCCESS; -} - diff --git a/ompi/mca/pml/bfo/post_configure.sh b/ompi/mca/pml/bfo/post_configure.sh deleted file mode 100644 index 77a7d52608a..00000000000 --- a/ompi/mca/pml/bfo/post_configure.sh +++ /dev/null @@ -1 +0,0 @@ -DIRECT_CALL_HEADER="ompi/mca/pml/bfo/pml_bfo.h" From 48e12cf76678d87489b3800bf4adb8a95a0c60c4 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 17 Oct 2018 14:34:50 -0600 Subject: [PATCH 157/674] NEWS: updates for v4.0.0rc5 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 5f524f4c65f..4fd2fbb7968 100644 --- a/NEWS +++ b/NEWS @@ -83,6 +83,13 @@ included in the vX.Y.Z section and be denoted as: - Various improvements to MPI RMA performance when using RDMA capable interconnects. - Update memkind component to use the memkind 1.6 public API. +- Fix a problem with javadoc builds using OpenJDK 11. Thanks to + Siegmar Gross for reporting. +- Fix a memory leak using UCX. Thanks to Charles Taylor for reporting. +- Fix hangs in MPI_FINALIZE when using UCX. +- Fix a problem with building Open MPI using an external PMIx 2.1.2 + library. Thanks to Marcin Krotkiewski for reporting. +- Fix race conditions in Vader (shared memory) transport. - Fix problems with use of newer map-by mpirun options. Thanks to Tony Reina for reporting. - Fix rank-by algorithms to properly rank by object and span From 210b4c60aa973b252d10ee99465a9573ab84b8a3 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 17 Oct 2018 10:29:00 -0600 Subject: [PATCH 158/674] remove some dead crs components Signed-off-by: Howard Pritchard (cherry picked from commit 6564d3d217c3ebff24d0e1fd72929756dc498dfe) --- opal/mca/crs/blcr/.opal_ignore | 0 opal/mca/crs/blcr/Makefile.am | 51 -- opal/mca/crs/blcr/configure.m4 | 204 ------ opal/mca/crs/blcr/crs_blcr.h | 84 --- opal/mca/crs/blcr/crs_blcr_component.c | 145 ---- opal/mca/crs/blcr/crs_blcr_module.c | 866 ----------------------- opal/mca/crs/blcr/help-opal-crs-blcr.txt | 28 - opal/mca/crs/criu/.opal_ignore | 0 opal/mca/crs/criu/Makefile.am | 51 -- opal/mca/crs/criu/configure.m4 | 93 --- opal/mca/crs/criu/crs_criu.h | 88 --- opal/mca/crs/criu/crs_criu_component.c | 213 ------ opal/mca/crs/criu/crs_criu_module.c | 261 ------- opal/mca/crs/criu/owner.txt | 7 - opal/mca/crs/dmtcp/.opal_ignore | 0 opal/mca/crs/dmtcp/Makefile.am | 43 -- opal/mca/crs/dmtcp/configure.m4 | 140 ---- opal/mca/crs/dmtcp/crs_dmtcp.h | 87 --- opal/mca/crs/dmtcp/crs_dmtcp_component.c | 133 ---- opal/mca/crs/dmtcp/crs_dmtcp_module.c | 709 ------------------- opal/mca/crs/dmtcp/owner.txt | 7 - 21 files changed, 3210 deletions(-) delete mode 100644 opal/mca/crs/blcr/.opal_ignore delete mode 100644 opal/mca/crs/blcr/Makefile.am delete mode 100644 opal/mca/crs/blcr/configure.m4 delete mode 100644 opal/mca/crs/blcr/crs_blcr.h delete mode 100644 opal/mca/crs/blcr/crs_blcr_component.c delete mode 100644 opal/mca/crs/blcr/crs_blcr_module.c delete mode 100644 opal/mca/crs/blcr/help-opal-crs-blcr.txt delete mode 100644 opal/mca/crs/criu/.opal_ignore delete mode 100644 opal/mca/crs/criu/Makefile.am delete mode 100644 opal/mca/crs/criu/configure.m4 delete mode 100644 opal/mca/crs/criu/crs_criu.h delete mode 100644 opal/mca/crs/criu/crs_criu_component.c delete mode 100644 opal/mca/crs/criu/crs_criu_module.c delete mode 100644 opal/mca/crs/criu/owner.txt delete mode 100644 opal/mca/crs/dmtcp/.opal_ignore delete mode 100644 opal/mca/crs/dmtcp/Makefile.am delete mode 100644 opal/mca/crs/dmtcp/configure.m4 delete mode 100644 opal/mca/crs/dmtcp/crs_dmtcp.h delete mode 100644 opal/mca/crs/dmtcp/crs_dmtcp_component.c delete mode 100644 opal/mca/crs/dmtcp/crs_dmtcp_module.c delete mode 100644 opal/mca/crs/dmtcp/owner.txt diff --git a/opal/mca/crs/blcr/.opal_ignore b/opal/mca/crs/blcr/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opal/mca/crs/blcr/Makefile.am b/opal/mca/crs/blcr/Makefile.am deleted file mode 100644 index 7e0e22bc4d1..00000000000 --- a/opal/mca/crs/blcr/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004-2007 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# 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 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -CFLAGS = $(crs_blcr_CFLAGS) -AM_CPPFLAGS = $(crs_blcr_CPPFLAGS) - -dist_opaldata_DATA = help-opal-crs-blcr.txt - -sources = \ - crs_blcr.h \ - crs_blcr_component.c \ - crs_blcr_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_crs_blcr_DSO -component_noinst = -component_install = mca_crs_blcr.la -else -component_noinst = libmca_crs_blcr.la -component_install = -endif - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_crs_blcr_la_SOURCES = $(sources) -mca_crs_blcr_la_LDFLAGS = -module -avoid-version $(crs_blcr_LDFLAGS) -mca_crs_blcr_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(crs_blcr_LIBS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_crs_blcr_la_SOURCES = $(sources) -libmca_crs_blcr_la_LDFLAGS = -module -avoid-version $(crs_blcr_LDFLAGS) -libmca_crs_blcr_la_LIBADD = $(crs_blcr_LIBS) diff --git a/opal/mca/crs/blcr/configure.m4 b/opal/mca/crs/blcr/configure.m4 deleted file mode 100644 index 3aea23106bc..00000000000 --- a/opal/mca/crs/blcr/configure.m4 +++ /dev/null @@ -1,204 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2010 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# All rights reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2006 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_crs_blcr_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_opal_crs_blcr_CONFIG],[ - AC_CONFIG_FILES([opal/mca/crs/blcr/Makefile]) - - AC_ARG_WITH([blcr], - [AC_HELP_STRING([--with-blcr(=DIR)], - [Path to BLCR Installation])]) - OPAL_CHECK_WITHDIR([blcr], [$with_blcr], [include/libcr.h]) - AC_ARG_WITH([blcr-libdir], - [AC_HELP_STRING([--with-blcr-libdir=DIR], - [Search for BLCR libraries in DIR])]) - OPAL_CHECK_WITHDIR([blcr-libdir], [$with_blcr_libdir], [libcr.*]) - - check_crs_blcr_good="no" - - # If we do not want FT, don't compile this component - # - # If we wanted BLCR, but did not specify the FT option, - # error out with a warning for the user - AS_IF([test "$opal_want_ft_cr" = "0"], - [$2 - check_crs_blcr_good="no" - AS_IF([test ! -z "$with_blcr" && test "$with_blcr" != "no"], - [AC_MSG_WARN([BLCR support requested, but FT support not requested. You need to specify the --with-ft=cr configure option.]) - AC_MSG_ERROR([Aborting.])]) - ], - [check_crs_blcr_good="yes"]) - - # If we do not want BLCR, then do not compile it - AS_IF([test "$with_blcr" = "no" || test "$check_crs_blcr_good" = "no"], - [$2 - check_crs_blcr_good="no"], - [check_crs_blcr_good="yes"]) - - # Defaults - check_crs_blcr_dir_msg="compiler default" - check_crs_blcr_libdir_msg="linker default" - check_crs_blcr_dir="" - check_crs_blcr_libdir="" - - # Determine the search paths for the headers and libraries - AS_IF([test "$check_crs_blcr_good" != "yes"], [$2], - [AS_IF([test ! -z "$with_blcr" && test "$with_blcr" != "yes"], - [check_crs_blcr_dir="$with_blcr" - check_crs_blcr_dir_msg="$with_blcr (from --with-blcr)"]) - AS_IF([test ! -z "$with_blcr_libdir" && test "$with_blcr_libdir" != "yes"], - [check_crs_blcr_libdir="$with_blcr_libdir" - check_crs_blcr_libdir_msg="$with_blcr_libdir (from --with-blcr-libdir)"]) - ]) - - AS_IF([test "$check_crs_blcr_good" != "yes"], [$2], - [AC_MSG_CHECKING([for BLCR dir]) - AC_MSG_RESULT([$check_crs_blcr_dir_msg]) - AC_MSG_CHECKING([for BLCR library dir]) - AC_MSG_RESULT([$check_crs_blcr_libdir_msg]) - OPAL_CHECK_PACKAGE([crs_blcr_check], - [libcr.h], - [cr], - [cr_init], - [], - [$check_crs_blcr_dir], - [$check_crs_blcr_libdir], - [check_crs_blcr_good="yes"], - [check_crs_blcr_good="no"]) - ]) - - crs_blcr_save_CFLAGS="$CFLAGS" - crs_blcr_save_CPPFLAGS="$CPPFLAGS" - crs_blcr_save_LDFLAGS="$LDFLAGS" - crs_blcr_save_LIBS="$LIBS" - - crs_blcr_CFLAGS="$CFLAGS $crs_blcr_check_CFLAGS" - crs_blcr_CPPFLAGS="$CPPFLAGS $crs_blcr_check_CPPFLAGS" - crs_blcr_LDFLAGS="$LDFLAGS $crs_blcr_check_LDFLAGS" - crs_blcr_LIBS="$LIBS $crs_blcr_check_LIBS" - - # Check to see if we found the BLCR libcr.h library - AS_IF([test "$check_crs_blcr_good" != "yes"], [$2], - [ - # - # Since BLCR libraries are not fully ISO99 C compliant - # -pedantic and -Wundef raise a bunch of warnings, so - # we just strip them off for this component - AC_MSG_WARN([Removed -pedantic and -Wundef from CFLAGS for blcr component because libcr.h is not really ANSI C]) - # Strip off problematic arguments - crs_blcr_CFLAGS="`echo $crs_blcr_CFLAGS | sed 's/-pedantic//g'`" - crs_blcr_CFLAGS="`echo $crs_blcr_CFLAGS | sed 's/-Wundef//g'`" - crs_blcr_CPPFLAGS="`echo $crs_blcr_CPPFLAGS | sed 's/-pedantic//g'`" - crs_blcr_CPPFLAGS="`echo $crs_blcr_CPPFLAGS | sed 's/-Wundef//g'`" - crs_blcr_LDFLAGS="$crs_blcr_LDFLAGS" - crs_blcr_LIBS="$crs_blcr_LIBS" - $1]) - - # - # Check for version difference which may have: - # - working cr_request_file - # - working cr_request_checkpoint (which should be used instead of cr_request_file) - # - 'requester' parameter to checkpoint_info - # - AS_IF([test "$check_crs_blcr_good" != "yes"], [$2], [ - CFLAGS="$crs_blcr_CFLAGS" - CPPFLAGS="$crs_blcr_CPPFLAGS" - LDFLAGS="$crs_blcr_LDFLAGS" - LIBS="$crs_blcr_LIBS" - # - # First look for the cr_request_file function - # - crs_blcr_have_working_cr_request=0 - AC_MSG_CHECKING(for BLCR working cr_request) - OPAL_SEARCH_LIBS_COMPONENT([crs_blcr], [cr_request_file],[cr], - [AC_TRY_COMPILE([#include ], - [#if CR_RELEASE_MAJOR <= 0 && CR_RELEASE_MINOR < 6 - #error Version earlier than 0.6.0 - #endif - ], - [crs_blcr_have_working_cr_request=1 - ], - [crs_blcr_have_working_cr_request=0 - AC_MSG_WARN([This BLCR version does not contain a known working version of cr_request_file]) - ])], - [crs_blcr_have_working_cr_request=0 - AC_MSG_WARN([This BLCR version does not contain the cr_request_file function]) - ]) - AC_DEFINE_UNQUOTED([CRS_BLCR_HAVE_CR_REQUEST], [$crs_blcr_have_working_cr_request], - [BLCR cr_request_file check]) - - # - # Look for the cr_request_checkpoint function - # - crs_blcr_have_cr_request_checkpoint=0 - AC_MSG_CHECKING(for BLCR cr_request_checkpoint) - OPAL_SEARCH_LIBS_COMPONENT([crs_blcr], - [cr_request_checkpoint],[cr], - [crs_blcr_have_cr_request_checkpoint=1 - ], - [crs_blcr_have_cr_request_checkpoint=0 - AC_MSG_WARN([This BLCR version does not contain the cr_request_checkpoint function]) - ]) - AC_DEFINE_UNQUOTED([CRS_BLCR_HAVE_CR_REQUEST_CHECKPOINT], [$crs_blcr_have_cr_request_checkpoint], - [BLCR cr_request_checkpoint check]) - - # - # Look for the cr_checkpoint_info.requester member - # - crs_blcr_have_info_requester=0 - AC_CHECK_MEMBER([struct cr_checkpoint_info.requester], - [crs_blcr_have_info_requester=1], - [AC_MSG_WARN([This BLCR version does not contain a 'requester' member of the 'cr_checkpoint_info' struct])], - [#include ]) - AC_DEFINE_UNQUOTED([CRS_BLCR_HAVE_INFO_REQUESTER], [$crs_blcr_have_info_requester], - [BLCRs cr_checkpoint_info.requester member availability]) - $1]) - - # - # Require either a working cr_request_file() or cr_request_checkpoint() function - # - AS_IF([test "$crs_blcr_have_working_cr_request" = "0" && test "$crs_blcr_have_cr_request_checkpoint" = "0"], - [$2 - check_crs_blcr_good="no" - AC_MSG_WARN([The BLCR CRS component requires either the cr_request_checkpoint() or cr_request_file() functions])]) - - # - # Reset the flags - # - CFLAGS="$crs_blcr_save_CFLAGS" - CPPFLAGS="$crs_blcr_save_CPPFLAGS" - LDFLAGS="$crs_blcr_save_LDFLAGS" - LIBS="$crs_blcr_save_LIBS" - - # - AS_IF([test "$check_crs_blcr_good" = "yes"], - [ AC_SUBST([crs_blcr_CFLAGS]) - AC_SUBST([crs_blcr_CPPFLAGS]) - AC_SUBST([crs_blcr_LDFLAGS]) - AC_SUBST([crs_blcr_LIBS]) - $1], - [AS_IF([test ! -z "$with_blcr" && test "$with_blcr" != "no"], - [AC_MSG_WARN([BLCR support requested but not found. Perhaps you need to specify the location of the BLCR libraries.]) - AC_MSG_ERROR([Aborting.])]) - $3]) - -])dnl diff --git a/opal/mca/crs/blcr/crs_blcr.h b/opal/mca/crs/blcr/crs_blcr.h deleted file mode 100644 index f4678d76217..00000000000 --- a/opal/mca/crs/blcr/crs_blcr.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004-2009 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * BLCR CRS component - * - */ - -#ifndef MCA_CRS_BLCR_EXPORT_H -#define MCA_CRS_BLCR_EXPORT_H - -#include "opal_config.h" - - -#include "opal/mca/mca.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/base/base.h" - -#include - -BEGIN_C_DECLS - - /* - * Local Component structures - */ - struct opal_crs_blcr_component_t { - /** Base CRS component */ - opal_crs_base_component_t super; - }; - typedef struct opal_crs_blcr_component_t opal_crs_blcr_component_t; - OPAL_MODULE_DECLSPEC extern opal_crs_blcr_component_t mca_crs_blcr_component; - - int opal_crs_blcr_component_query(mca_base_module_t **module, int *priority); - - extern bool opal_crs_blcr_dev_null; - - /* - * Module functions - */ - int opal_crs_blcr_module_init(void); - int opal_crs_blcr_module_finalize(void); - - /* - * Actual funcationality - */ - int opal_crs_blcr_checkpoint( pid_t pid, - opal_crs_base_snapshot_t *snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state); - - int opal_crs_blcr_restart( opal_crs_base_snapshot_t *snapshot, - bool spawn_child, - pid_t *child_pid); - - int opal_crs_blcr_disable_checkpoint(void); - int opal_crs_blcr_enable_checkpoint(void); - - int opal_crs_blcr_prelaunch(int32_t rank, - char *base_snapshot_dir, - char **app, - char **cwd, - char ***argv, - char ***env); - - int opal_crs_blcr_reg_thread(void); - -END_C_DECLS - -#endif /* MCA_CRS_BLCR_EXPORT_H */ diff --git a/opal/mca/crs/blcr/crs_blcr_component.c b/opal/mca/crs/blcr/crs_blcr_component.c deleted file mode 100644 index 57cb8e43abd..00000000000 --- a/opal/mca/crs/blcr/crs_blcr_component.c +++ /dev/null @@ -1,145 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2009 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include "opal/util/output.h" - -#include "opal/constants.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" -#include "crs_blcr.h" - -/* - * Local functionality - */ -static int crs_blcr_register (void); -static int crs_blcr_open(void); -static int crs_blcr_close(void); - -bool opal_crs_blcr_dev_null = false; - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -opal_crs_blcr_component_t mca_crs_blcr_component = { - /* First do the base component stuff */ - { - /* Handle the general mca_component_t struct containing - * meta information about the component itself - */ - .base_version = { - OPAL_CRS_BASE_VERSION_2_0_0, - - /* Component name and version */ - .mca_component_name = "blcr", - MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = crs_blcr_open, - .mca_close_component = crs_blcr_close, - .mca_query_component = opal_crs_blcr_component_query, - .mca_register_component_params = crs_blcr_register - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - - .verbose = 0, - .output_handle = -1, - } -}; - -static int crs_blcr_register (void) -{ - int ret; - - mca_crs_blcr_component.super.priority = 10; - ret = mca_base_component_var_register (&mca_crs_blcr_component.super.base_version, - "priority", "Priority of the CRS blcr component " - "(default: 10)". MCA_BASE_VAR_TYPE_INT, NULL, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ, - &mca_crs_blcr_component.super.priority); - if (0 > ret) { - return ret; - } - - mca_crs_blcr_component.super.verbose = 0; - ret = mca_base_component_var_register (&mca_crs_blcr_component.super.base_version, - "verbose", - "Verbose level for the CRS blcr component", - MCA_BASE_VAR_TYPE_INT, NULL, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_blcr_component.super.verbose); - if (0 > ret) { - return ret; - } - - opal_crs_blcr_dev_null = false; - ret = mca_base_component_var_register (&mca_crs_blcr_component.super.base_version, - "dev_null", - "Not for general use! For debugging only! Save checkpoint to /dev/null. [Default = disabled]", - MCA_BASE_VAR_TYPE_BOOL, NULL, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ, - &opal_crs_blcr_dev_null); - return (0 > ret) ? ret : OPAL_SUCCESS -} - -static int crs_blcr_open(void) -{ - /* If there is a custom verbose level for this component than use it - * otherwise take our parents level and output channel - */ - if ( 0 != mca_crs_blcr_component.super.verbose) { - mca_crs_blcr_component.super.output_handle = opal_output_open(NULL); - opal_output_set_verbosity(mca_crs_blcr_component.super.output_handle, - mca_crs_blcr_component.super.verbose); - } else { - mca_crs_blcr_component.super.output_handle = opal_crs_base_framework.framework_output; - } - - /* - * Debug output - */ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: open()"); - opal_output_verbose(20, mca_crs_blcr_component.super.output_handle, - "crs:blcr: open: priority = %d", - mca_crs_blcr_component.super.priority); - opal_output_verbose(20, mca_crs_blcr_component.super.output_handle, - "crs:blcr: open: verbosity = %d", - mca_crs_blcr_component.super.verbose); - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: open: dev_null = %s", - (opal_crs_blcr_dev_null == true ? "True" : "False")); - - return OPAL_SUCCESS; -} - -static int crs_blcr_close(void) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: close()"); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/crs/blcr/crs_blcr_module.c b/opal/mca/crs/blcr/crs_blcr_module.c deleted file mode 100644 index c84e79bfbe2..00000000000 --- a/opal/mca/crs/blcr/crs_blcr_module.c +++ /dev/null @@ -1,866 +0,0 @@ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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) 2007 Evergrid, Inc. All rights reserved. - * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * - * Copyright (c) 2017 IBM Corporation. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "opal/util/show_help.h" -#include "opal/util/output.h" -#include "opal/util/argv.h" -#include "opal/constants.h" - -#include "opal/mca/base/mca_base_var.h" - -#include "opal/threads/threads.h" -#include "opal/threads/mutex.h" -#include "opal/threads/condition.h" - -#include "opal/mca/event/event.h" - -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" - -#include "crs_blcr.h" - -/* - * Blcr module - */ -static opal_crs_base_module_t blcr_module = { - /** Initialization Function */ - opal_crs_blcr_module_init, - /** Finalization Function */ - opal_crs_blcr_module_finalize, - - /** Checkpoint interface */ - opal_crs_blcr_checkpoint, - - /** Restart Command Access */ - opal_crs_blcr_restart, - - /** Disable checkpoints */ - opal_crs_blcr_disable_checkpoint, - /** Enable checkpoints */ - opal_crs_blcr_enable_checkpoint, - - /** Prelaunch */ - opal_crs_blcr_prelaunch, - - /** Register Thread */ - opal_crs_blcr_reg_thread -}; - -/*************************** - * Snapshot Class Functions - ***************************/ -OBJ_CLASS_DECLARATION(opal_crs_blcr_snapshot_t); - -struct opal_crs_blcr_snapshot_t { - /** Base CRS snapshot type */ - opal_crs_base_snapshot_t super; - char * context_filename; -}; -typedef struct opal_crs_blcr_snapshot_t opal_crs_blcr_snapshot_t; - -void opal_crs_blcr_construct(opal_crs_blcr_snapshot_t *obj); -void opal_crs_blcr_destruct( opal_crs_blcr_snapshot_t *obj); - -OBJ_CLASS_INSTANCE(opal_crs_blcr_snapshot_t, - opal_crs_base_snapshot_t, - opal_crs_blcr_construct, - opal_crs_blcr_destruct); - -/****************** - * Local Functions - ******************/ -static int blcr_get_checkpoint_filename(char **fname, pid_t pid); -static int opal_crs_blcr_thread_callback(void *arg); -static int opal_crs_blcr_signal_callback(void *arg); - -static int opal_crs_blcr_restart_cmd(char *fname, char **cmd); - -static int blcr_cold_start(opal_crs_blcr_snapshot_t *snapshot); - -#if OPAL_ENABLE_CRDEBUG == 1 -static void MPIR_checkpoint_debugger_crs_hook(cr_hook_event_t event); -#endif - -/************************* - * Local Global Variables - *************************/ -#if OPAL_ENABLE_CRDEBUG == 1 -static opal_thread_t *checkpoint_thread_id = NULL; -static bool blcr_crdebug_refreshed_env = false; -#endif - -static cr_client_id_t client_id; -static cr_callback_id_t cr_thread_callback_id; -static cr_callback_id_t cr_signal_callback_id; -static int blcr_current_state = OPAL_CRS_NONE; - -static char *blcr_restart_cmd = NULL; -static char *blcr_checkpoint_cmd = NULL; - -static opal_condition_t blcr_cond; -static opal_mutex_t blcr_lock; - -static pid_t my_pid = -1; - -void opal_crs_blcr_construct(opal_crs_blcr_snapshot_t *snapshot) { - snapshot->context_filename = NULL; - snapshot->super.component_name = strdup(mca_crs_blcr_component.super.base_version.mca_component_name); -} - -void opal_crs_blcr_destruct( opal_crs_blcr_snapshot_t *snapshot) { - if(NULL != snapshot->context_filename) { - free(snapshot->context_filename); - snapshot->context_filename = NULL; - } -} - -/***************** - * MCA Functions - *****************/ -int opal_crs_blcr_component_query(mca_base_module_t **module, int *priority) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: component_query()"); - - *priority = mca_crs_blcr_component.super.priority; - *module = (mca_base_module_t *)&blcr_module; - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_module_init(void) -{ - void *crs_blcr_thread_callback_arg = NULL; - void *crs_blcr_signal_callback_arg = NULL; - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: module_init()"); - - blcr_restart_cmd = strdup("cr_restart"); - blcr_checkpoint_cmd = strdup("cr_checkpoint"); - - my_pid = getpid(); - - if( !opal_cr_is_tool ) { - /* We need to make the lock and condition variable before - * starting the thread, since the thread uses these vars. - */ - OBJ_CONSTRUCT(&blcr_lock, opal_mutex_t); - OBJ_CONSTRUCT(&blcr_cond, opal_condition_t); - - /* - * Initialize BLCR - */ - client_id = cr_init(); - if (0 > client_id) { - opal_output(mca_crs_blcr_component.super.output_handle, - "Error: crs:blcr: module_init: cr_init failed (%d)\n", client_id); - return OPAL_ERROR; - } - } - -#if OPAL_ENABLE_CRDEBUG == 1 - blcr_crdebug_refreshed_env = false; -#endif - - blcr_restart_cmd = strdup("cr_restart"); - blcr_checkpoint_cmd = strdup("cr_checkpoint"); - - if( !opal_cr_is_tool ) { - /* - * Register the thread handler - */ - cr_thread_callback_id = cr_register_callback(opal_crs_blcr_thread_callback, - crs_blcr_thread_callback_arg, - CR_THREAD_CONTEXT); - /* - * Register the signal handler - * - even though we do not use it - */ - cr_signal_callback_id = cr_register_callback(opal_crs_blcr_signal_callback, - crs_blcr_signal_callback_arg, - CR_SIGNAL_CONTEXT); - -#if OPAL_ENABLE_CRDEBUG == 1 - /* - * Checkpoint/restart enabled debugging hooks - * "NO_CALLBACKS" -> non-MPI threads - * "SIGNAL_CONTEXT" -> MPI threads - * "THREAD_CONTEXT" -> BLCR threads - */ - cr_register_hook(CR_HOOK_CONT_NO_CALLBACKS, MPIR_checkpoint_debugger_crs_hook); - cr_register_hook(CR_HOOK_CONT_SIGNAL_CONTEXT, MPIR_checkpoint_debugger_crs_hook); - - cr_register_hook(CR_HOOK_RSTRT_NO_CALLBACKS, MPIR_checkpoint_debugger_crs_hook); - cr_register_hook(CR_HOOK_RSTRT_SIGNAL_CONTEXT, MPIR_checkpoint_debugger_crs_hook); -#endif - } - - /* - * Now that we are done with init, set the state to running - */ - blcr_current_state = OPAL_CRS_RUNNING; - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: module_init() --> Finished [%d]", - opal_cr_is_tool); - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_prelaunch(int32_t rank, - char *base_snapshot_dir, - char **app, - char **cwd, - char ***argv, - char ***env) -{ - char * tmp_env_var = NULL; - - (void) mca_base_var_env_name("opal_cr_is_tool", &tmp_env_var); - opal_setenv(tmp_env_var, - "0", true, env); - free(tmp_env_var); - tmp_env_var = NULL; - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_reg_thread(void) -{ - cr_client_id_t loc_client_id; - - /* - * Initialize BLCR - */ - loc_client_id = cr_init(); - if (0 > loc_client_id) { - opal_output(mca_crs_blcr_component.super.output_handle, - "Error: crs:blcr: reg_thread: cr_init failed (%d)\n", loc_client_id); - return OPAL_ERROR; - } - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_module_finalize(void) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: module_finalize()"); - - /* Cleanup some memory */ - if( NULL != blcr_restart_cmd ) { - free(blcr_restart_cmd); - blcr_restart_cmd = NULL; - } - if( NULL != blcr_checkpoint_cmd ) { - free(blcr_checkpoint_cmd); - blcr_checkpoint_cmd = NULL; - } - - if( !opal_cr_is_tool ) { - OBJ_DESTRUCT(&blcr_lock); - OBJ_DESTRUCT(&blcr_cond); - - if( OPAL_CRS_RUNNING == blcr_current_state ) { - /* Unload the thread callback */ - cr_replace_callback(cr_thread_callback_id, NULL, NULL, CR_THREAD_CONTEXT); - /* Unload the signal callback */ - cr_replace_callback(cr_signal_callback_id, NULL, NULL, CR_SIGNAL_CONTEXT); - } - -#if OPAL_ENABLE_CRDEBUG == 1 - /* - * Checkpoint/restart enabled debugging hooks - */ - cr_register_hook(CR_HOOK_CONT_NO_CALLBACKS, NULL); - cr_register_hook(CR_HOOK_CONT_SIGNAL_CONTEXT, NULL); - - cr_register_hook(CR_HOOK_RSTRT_NO_CALLBACKS, NULL); - cr_register_hook(CR_HOOK_RSTRT_SIGNAL_CONTEXT, NULL); -#endif - } - - /* BLCR does not have a finalization routine */ - blcr_current_state = OPAL_CRS_NONE; - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_checkpoint(pid_t pid, - opal_crs_base_snapshot_t *base_snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state) -{ - int ret, exit_status = OPAL_SUCCESS; - opal_crs_blcr_snapshot_t *snapshot = NULL; -#if CRS_BLCR_HAVE_CR_REQUEST_CHECKPOINT == 1 - cr_checkpoint_args_t cr_args; - static cr_checkpoint_handle_t cr_handle = (cr_checkpoint_handle_t)(-1); -#endif - int fd = 0; - char *loc_fname = NULL; - - if( pid != my_pid ) { - opal_output(0, "crs:blcr: checkpoint(%d, ---): Checkpointing of peers not allowed!", pid); - exit_status = OPAL_ERROR; - goto cleanup; - } - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(%d, ---)", pid); - - snapshot = (opal_crs_blcr_snapshot_t *)base_snapshot; - - /* - * Update the snapshot metadata - */ - snapshot->super.component_name = strdup(mca_crs_blcr_component.super.base_version.mca_component_name); - blcr_get_checkpoint_filename(&(snapshot->context_filename), pid); - - if( NULL == snapshot->super.metadata ) { - if (NULL == (snapshot->super.metadata = fopen(snapshot->super.metadata_filename, "a")) ) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Error: Unable to open the file (%s)", - snapshot->super.metadata_filename); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - fprintf(snapshot->super.metadata, "%s%s\n", CRS_METADATA_COMP, snapshot->super.component_name); - fprintf(snapshot->super.metadata, "%s%s\n", CRS_METADATA_CONTEXT, snapshot->context_filename); - - fclose(snapshot->super.metadata ); - snapshot->super.metadata = NULL; - - /* - * If we can checkpointing ourselves do so: - * use cr_request_checkpoint() if available, and cr_request_file() if not - */ - if( opal_crs_blcr_dev_null ) { - loc_fname = strdup("/dev/null"); - } else { - asprintf(&loc_fname, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename); - } - -#if OPAL_ENABLE_CRDEBUG == 1 - /* Make sure to identify the checkpointing thread, so that it is not - * prevented from requesting the checkpoint after the debugger detaches - */ - opal_cr_debug_set_current_ckpt_thread_self(); - checkpoint_thread_id = opal_thread_get_self(); - blcr_crdebug_refreshed_env = false; - - /* If checkpoint/restart enabled debugging then mark detachment place */ - if( MPIR_debug_with_checkpoint ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Detaching debugger..."); - MPIR_checkpoint_debugger_detach(); - } -#endif - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint SELF <%s>", - loc_fname); - -#if CRS_BLCR_HAVE_CR_REQUEST_CHECKPOINT == 1 || CRS_BLCR_HAVE_CR_REQUEST == 1 -#if CRS_BLCR_HAVE_CR_REQUEST_CHECKPOINT == 1 - fd = open(loc_fname, - O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE, - S_IRUSR | S_IWUSR); - if( fd < 0 ) { - *state = OPAL_CRS_ERROR; - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Error: Unable to open checkpoint file (%s) for pid (%d)", - loc_fname, pid); - exit_status = OPAL_ERROR; - goto cleanup; - } - - cr_initialize_checkpoint_args_t(&cr_args); - cr_args.cr_scope = CR_SCOPE_PROC; - cr_args.cr_fd = fd; - if( options->stop ) { - cr_args.cr_signal = SIGSTOP; - } - - ret = cr_request_checkpoint(&cr_args, &cr_handle); - if( ret < 0 ) { - close(cr_args.cr_fd); - *state = OPAL_CRS_ERROR; - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Error: Unable to checkpoint pid (%d) to file (%s)", - pid, loc_fname); - exit_status = ret; - goto cleanup; - } - - /* Wait for checkpoint to finish */ - do { - ret = cr_poll_checkpoint(&cr_handle, NULL); - if( ret < 0 ) { - /* Check if restarting. This is not an error. */ - if( (ret == CR_POLL_CHKPT_ERR_POST) && (errno == CR_ERESTARTED) ) { - ret = 0; - break; - } - /* If Call was interrupted by a signal, retry the call */ - else if (errno == EINTR) { - ; - } - /* Otherwise this is a real error that we need to deal with */ - else { - *state = OPAL_CRS_ERROR; - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Error: Unable to checkpoint pid (%d) to file (%s) - poll failed with (%d)", - pid, loc_fname, ret); - exit_status = ret; - goto cleanup; - } - } - } while( ret < 0 ); - - /* Close the file */ - close(cr_args.cr_fd); -#else - /* Request a checkpoint be taken of the current process. - * Since we are not guaranteed to finish the checkpoint before this - * returns, we also need to wait for it. - */ - cr_request_file(loc_fname); - - /* Wait for checkpoint to finish */ - do { - usleep(1000); /* JJH Do we really want to sleep? */ - } while(CR_STATE_IDLE != cr_status()); -#endif -#endif - - *state = blcr_current_state; - free(loc_fname); - - cleanup: - if( NULL != snapshot->super.metadata ) { - fclose(snapshot->super.metadata ); - snapshot->super.metadata = NULL; - } - - return exit_status; -} - -int opal_crs_blcr_restart(opal_crs_base_snapshot_t *base_snapshot, bool spawn_child, pid_t *child_pid) -{ - opal_crs_blcr_snapshot_t *snapshot = OBJ_NEW(opal_crs_blcr_snapshot_t); - char **cr_argv = NULL; - char *cr_cmd = NULL; - char *cr_full_cmd = NULL; - int ret; - int exit_status = OPAL_SUCCESS; - int status; - - snapshot->super = *base_snapshot; - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: restart(--, %d)", spawn_child); - - /* - * If we need to reconstruct the snapshot, - */ - if(snapshot->super.cold_start) { - if( OPAL_SUCCESS != (ret = blcr_cold_start(snapshot)) ) { - exit_status = OPAL_ERROR; - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: Unable to reconstruct the snapshot."); - goto cleanup; - } - } - - - /* - * Get the restart command - */ - if ( OPAL_SUCCESS != (ret = opal_crs_blcr_restart_cmd(snapshot->context_filename, &cr_cmd)) ) { - exit_status = ret; - goto cleanup; - } - if ( NULL == (cr_argv = opal_argv_split(cr_cmd, ' ')) ) { - exit_status = OPAL_ERROR; - goto cleanup; - } - - /* Need to shutdown the event engine before this. - * for some reason the BLCR checkpointer and our event engine don't get - * along very well. - */ - opal_progress_finalize(); - (void) mca_base_framework_close(&opal_event_base_framework); - - if (!spawn_child) { - cr_full_cmd = opal_argv_join(cr_argv, ' '); - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: SELF: exec :(%s, %s):", - blcr_restart_cmd, cr_full_cmd); - - status = execvp(blcr_restart_cmd, cr_argv); - - if(status < 0) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: SELF: Child failed to execute :(%d):", status); - } - opal_show_help("help-opal-crs-blcr.txt", "blcr:restart_failed_exec", true, - status, - blcr_restart_cmd, - cr_full_cmd); - - exit_status = status; - goto cleanup; - } - /* - * Restart by starting a new process - */ - else { - *child_pid = fork(); - - if( 0 == *child_pid) { - /* Child Process */ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: CHILD: exec :(%s, %s):", - blcr_restart_cmd, - opal_argv_join(cr_argv, ' ')); - - status = execvp(blcr_restart_cmd, cr_argv); - - if(status < 0) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: CHILD: Child failed to execute :(%d):", status); - } - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: CHILD: execvp returned %d", status); - - exit_status = status; - goto cleanup; - } - else if(*child_pid > 0) { - /* Parent is done once it is started. */ - ; - } - else { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_restart: CHILD: fork failed :(%d):", *child_pid); - } - } - - cleanup: - if(NULL != cr_cmd) - free(cr_cmd); - if(NULL != cr_argv) - opal_argv_free(cr_argv); - - return exit_status; -} - -int opal_crs_blcr_disable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: disable_checkpoint()"); - /* - * Enter the BLCR Critical Section - */ - cr_enter_cs(client_id); - - return OPAL_SUCCESS; -} - -int opal_crs_blcr_enable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: enable_checkpoint()"); - /* - * Leave the BLCR Critical Section - */ - cr_leave_cs(client_id); - - return OPAL_SUCCESS; -} - -/***************************** - * Local Function Definitions - *****************************/ -static int opal_crs_blcr_thread_callback(void *arg) { - const struct cr_checkpoint_info *ckpt_info = cr_get_checkpoint_info(); - int ret; - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: thread_callback()"); - - OPAL_THREAD_LOCK(&blcr_lock); - blcr_current_state = OPAL_CRS_CHECKPOINT; - - /* - * Allow the checkpoint to be taken, if we requested it - */ -#if CRS_BLCR_HAVE_INFO_REQUESTER == 1 - if( ckpt_info->requester != my_pid ) { - ret = cr_checkpoint(CR_CHECKPOINT_OMIT); - blcr_current_state = OPAL_CRS_RUNNING; - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: thread_callback(); WARNING: An external agent attempted to checkpoint this process " - "when it did not expect to be checkpointed. Skipping this checkpoint request." - " [%d != %d].", ckpt_info->requester, my_pid); - return 0; - } - else -#endif - { - if(OPAL_SUCCESS != (ret = ompi_trigger_user_inc_callback(OPAL_CR_INC_CRS_PRE_CKPT, - OPAL_CR_INC_STATE_PREPARE)) ) { - ; - } - - ret = cr_checkpoint(0); - } - - /* - * Restarting - */ - if ( 0 < ret ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: thread_callback: Restarting."); - blcr_current_state = OPAL_CRS_RESTART; - } - /* - * Continuing - */ - else { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: thread_callback: Continue."); - blcr_current_state = OPAL_CRS_CONTINUE; - } - - if( OPAL_SUCCESS != (ret = ompi_trigger_user_inc_callback(OPAL_CR_INC_CRS_POST_CKPT, - (blcr_current_state == OPAL_CRS_CONTINUE ? - OPAL_CR_INC_STATE_CONTINUE : - OPAL_CR_INC_STATE_RESTART))) ) { - ; - } - - OPAL_THREAD_UNLOCK(&blcr_lock); - opal_condition_signal(&blcr_cond); - - return 0; -} - -static int opal_crs_blcr_signal_callback(void *arg) { - const struct cr_checkpoint_info *ckpt_info = cr_get_checkpoint_info(); - int ret; - - /* - * Allow the checkpoint to be taken, if we requested it - */ -#if CRS_BLCR_HAVE_INFO_REQUESTER == 1 - if( ckpt_info->requester != my_pid ) { - ret = cr_checkpoint(CR_CHECKPOINT_OMIT); - return 0; - } - else -#endif - { - ret = cr_checkpoint(0); - } - - return 0; -} - -static int opal_crs_blcr_restart_cmd(char *fname, char **cmd) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: restart_cmd(%s, ---)", fname); - - if (NULL == fname) { - opal_output_verbose(10, opal_crs_base_framework.framework_output, - "crs:blcr: restart_cmd: Error: filename is NULL!"); - return OPAL_CRS_ERROR; - } - - asprintf(cmd, "%s %s", blcr_restart_cmd, fname); - - return OPAL_SUCCESS; -} - -static int blcr_get_checkpoint_filename(char **fname, pid_t pid) -{ - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: get_checkpoint_filename(--, %d)", pid); - - asprintf(fname, "ompi_blcr_context.%d", pid); - - return OPAL_SUCCESS; -} - -static int blcr_cold_start(opal_crs_blcr_snapshot_t *snapshot) { - int ret, exit_status = OPAL_SUCCESS; - char **tmp_argv = NULL; - char * component_name = NULL; - int prev_pid; - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: cold_start()"); - - /* - * Find the snapshot directory, read the metadata file - */ - if( NULL == snapshot->super.metadata ) { - if (NULL == (snapshot->super.metadata = fopen(snapshot->super.metadata_filename, "r")) ) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: checkpoint(): Error: Unable to open the file (%s)", - snapshot->super.metadata_filename); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - if( OPAL_SUCCESS != (ret = opal_crs_base_extract_expected_component(snapshot->super.metadata, - &component_name, &prev_pid) ) ) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_cold_start: Error: Failed to extract the metadata from the local snapshot (%s). Returned %d.", - snapshot->super.metadata_filename, ret); - exit_status = ret; - goto cleanup; - } - - snapshot->super.component_name = strdup(component_name); - - /* Compare the component strings to make sure this is our snapshot before going further */ - if ( 0 != strncmp(mca_crs_blcr_component.super.base_version.mca_component_name, - component_name, strlen(component_name)) ) { - exit_status = OPAL_ERROR; - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_cold_start: Error: This snapshot (%s) is not intended for us (%s)\n", - component_name, mca_crs_blcr_component.super.base_version.mca_component_name); - goto cleanup; - } - - /* - * Context Filename - */ - opal_crs_base_metadata_read_token(snapshot->super.metadata, CRS_METADATA_CONTEXT, &tmp_argv); - if( NULL == tmp_argv ) { - opal_output(mca_crs_blcr_component.super.output_handle, - "crs:blcr: blcr_cold_start: Error: Failed to read the %s token from the local checkpoint in %s", - CRS_METADATA_CONTEXT, snapshot->super.snapshot_directory); - exit_status = OPAL_ERROR; - goto cleanup; - } - asprintf(&snapshot->context_filename, "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]); - - /* - * Reset the cold_start flag - */ - snapshot->super.cold_start = false; - - cleanup: - if(NULL != tmp_argv) { - opal_argv_free(tmp_argv); - tmp_argv = NULL; - } - - if( NULL != snapshot->super.metadata ) { - fclose(snapshot->super.metadata); - snapshot->super.metadata = NULL; - } - - return exit_status; -} - -#if OPAL_ENABLE_CRDEBUG == 1 -static void MPIR_checkpoint_debugger_crs_hook(cr_hook_event_t event) { - opal_thread_t *my_thread_id = NULL; - my_thread_id = opal_thread_get_self(); - - /* Non-MPI threads */ - if(event == CR_HOOK_RSTRT_NO_CALLBACKS ) { - /* wait for the MPI thread to refresh the environment for us */ - while(!blcr_crdebug_refreshed_env) { - sched_yield(); - } - } - /* MPI threads */ - else if(event == CR_HOOK_RSTRT_SIGNAL_CONTEXT ) { - if( opal_thread_self_compare(checkpoint_thread_id) ) { - opal_cr_refresh_environ(my_pid); - blcr_crdebug_refreshed_env = true; - } else { - while(!blcr_crdebug_refreshed_env) { - sched_yield(); - } - } - } - - /* - * Some debugging output - */ - /* Non-MPI threads */ - if( event == CR_HOOK_CONT_NO_CALLBACKS ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: MPIR_checkpoint_debugger_crs_hook: Waiting in Continue (Non-MPI). (%d)", - (int)my_thread_id->t_handle); - } - else if(event == CR_HOOK_RSTRT_NO_CALLBACKS ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: MPIR_checkpoint_debugger_crs_hook: Waiting in Restart (Non-MPI). (%d)", - (int)my_thread_id->t_handle); - } - /* MPI Threads */ - else if( event == CR_HOOK_CONT_SIGNAL_CONTEXT ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: MPIR_checkpoint_debugger_crs_hook: Waiting in Continue (MPI)."); - } - else if(event == CR_HOOK_RSTRT_SIGNAL_CONTEXT ) { - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: MPIR_checkpoint_debugger_crs_hook: Waiting in Restart (MPI)."); - } - - /* - * Enter the breakpoint function. - * If no debugger intends on attaching, then this function is expected to - * return immediately. - * - * If this is an MPI thread then odds are that this is the checkpointing - * thread, in which case this function will return immediately allowing - * it to prepare the MPI library before signaling to the debugger that - * it is safe to attach, if necessary. - */ - MPIR_checkpoint_debugger_waitpoint(); - - opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, - "crs:blcr: MPIR_checkpoint_debugger_crs_hook: Finished..."); - } -#endif diff --git a/opal/mca/crs/blcr/help-opal-crs-blcr.txt b/opal/mca/crs/blcr/help-opal-crs-blcr.txt deleted file mode 100644 index efb015d716b..00000000000 --- a/opal/mca/crs/blcr/help-opal-crs-blcr.txt +++ /dev/null @@ -1,28 +0,0 @@ - -*- text -*- -# -# 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) 2011 Oak Ridge National Labs. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -# This is the US/English general help file for Open PAL CRS framework. -# -[blcr:restart_failed_exec] -Error: BLCR was not able to restart the process because exec failed. - Check the installation of BLCR on all of the machines in your - system. The following information may be of help: - Return Code : %d - BLCR Restart Command : %s - Restart Command Line : %s diff --git a/opal/mca/crs/criu/.opal_ignore b/opal/mca/crs/criu/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opal/mca/crs/criu/Makefile.am b/opal/mca/crs/criu/Makefile.am deleted file mode 100644 index 1088e7be763..00000000000 --- a/opal/mca/crs/criu/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -# -# Copyright (c) 2004-2007 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# 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 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Hochschule Esslingen. All rights reserved. -# -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -CFLAGS = $(crs_criu_CFLAGS) -AM_CPPFLAGS = $(crs_criu_CPPFLAGS) - -sources = \ - crs_criu.h \ - crs_criu_component.c \ - crs_criu_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_crs_criu_DSO -component_noinst = -component_install = mca_crs_criu.la -else -component_noinst = libmca_crs_criu.la -component_install = -endif - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_crs_criu_la_SOURCES = $(sources) -mca_crs_criu_la_LDFLAGS = -module -avoid-version $(crs_criu_LDFLAGS) -mca_crs_criu_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(crs_criu_LIBS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_crs_criu_la_SOURCES = $(sources) -libmca_crs_criu_la_LDFLAGS = -module -avoid-version $(crs_criu_LDFLAGS) -libmca_crs_criu_la_LIBADD = $(crs_criu_LIBS) diff --git a/opal/mca/crs/criu/configure.m4 b/opal/mca/crs/criu/configure.m4 deleted file mode 100644 index 94ea29d2248..00000000000 --- a/opal/mca/crs/criu/configure.m4 +++ /dev/null @@ -1,93 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2010 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2004-2005 The Trustees of the University of Tennessee. -# All rights reserved. -# Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2006 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2014 Hochschule Esslingen. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_crs_criu_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_opal_crs_criu_CONFIG],[ - OPAL_VAR_SCOPE_PUSH([check_crs_criu_good check_crs_criu_dir_msg check_crs_criu_libdir_msg check_crs_criu_dir check_crs_criu_libdir]) - AC_CONFIG_FILES([opal/mca/crs/criu/Makefile]) - - AC_ARG_WITH([criu], - [AC_HELP_STRING([--with-criu(=DIR)], - [Path to CRIU Installation])]) - OPAL_CHECK_WITHDIR([criu], [$with_criu], [include/criu/criu.h]) - AC_ARG_WITH([criu-libdir], - [AC_HELP_STRING([--with-criu-libdir=DIR], - [Search for CRIU libraries in DIR])]) - OPAL_CHECK_WITHDIR([criu-libdir], [$with_criu_libdir], [libcriu.*]) - - # If we do not want FT or CRIU, don't compile this component - AS_IF([test "$opal_want_ft_cr" = "1" && test "$with_criu" = "yes"], - [check_crs_criu_good=yes], - [check_crs_criu_good=no]) - - # Defaults - check_crs_criu_dir_msg="compiler default" - check_crs_criu_libdir_msg="linker default" - check_crs_criu_dir="" - check_crs_criu_libdir="" - - # Determine the search paths for the headers and libraries - AS_IF([test $check_crs_criu_good = yes], - [AS_IF([test ! -z "$with_criu" && test "$with_criu" != "yes"], - [check_crs_criu_dir="$with_criu" - check_crs_criu_dir_msg="$with_criu (from --with-criu)"]) - AS_IF([test ! -z "$with_criu_libdir" && test "$with_criu_libdir" != "yes"], - [check_crs_criu_libdir="$with_criu_libdir" - check_crs_criu_libdir_msg="$with_criu_libdir (from --with-criu-libdir)"]) - ]) - - AS_IF([test $check_crs_criu_good = yes], - [AC_MSG_CHECKING([for CRIU dir]) - AC_MSG_RESULT([$check_crs_criu_dir_msg]) - AC_MSG_CHECKING([for CRIU library dir]) - AC_MSG_RESULT([$check_crs_criu_libdir_msg]) - OPAL_CHECK_PACKAGE([crs_criu_check], - [criu/criu.h], - [criu], - [criu_init_opts], - [], - [$check_crs_criu_dir], - [$check_crs_criu_libdir], - [check_crs_criu_good="yes"], - [check_crs_criu_good="no"]) - ]) - - crs_criu_CFLAGS="$CFLAGS $crs_criu_check_CFLAGS" - crs_criu_CPPFLAGS="$CPPFLAGS $crs_criu_check_CPPFLAGS" - crs_criu_LDFLAGS="$LDFLAGS $crs_criu_check_LDFLAGS" - crs_criu_LIBS="$LIBS $crs_criu_check_LIBS" - - AS_IF([test $check_crs_criu_good = yes], - [ AC_SUBST([crs_criu_CFLAGS]) - AC_SUBST([crs_criu_CPPFLAGS]) - AC_SUBST([crs_criu_LDFLAGS]) - AC_SUBST([crs_criu_LIBS]) - $1], - [AS_IF([test ! -z "$with_criu" && test "$with_criu" != "no"], - [AC_MSG_WARN([CRIU support requested but not found. Perhaps you need to enable FT support, or specify the location of the CRIU libraries...?]) - AC_MSG_ERROR([Aborting.])]) - $2]) - - OPAL_VAR_SCOPE_POP -])dnl diff --git a/opal/mca/crs/criu/crs_criu.h b/opal/mca/crs/criu/crs_criu.h deleted file mode 100644 index 96dbbd4598e..00000000000 --- a/opal/mca/crs/criu/crs_criu.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004-2009 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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) 2014 Hochschule Esslingen. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * CRIU CRS component - support checkpoint/restart using CRIU - */ - -#ifndef MCA_CRS_CRIU_EXPORT_H -#define MCA_CRS_CRIU_EXPORT_H - -#include "opal_config.h" - - -#include "opal/mca/mca.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/base/base.h" - -#include - -BEGIN_C_DECLS - -#define LOG_FILE ("criu.log") - -/* Local Component structures */ -struct opal_crs_criu_component_t { - /* Base CRS component */ - opal_crs_base_component_t super; - - /* criu log file */ - char *log_file; - /* criu log level */ - int log_level; - /* criu tcp established */ - bool tcp_established; - /* criu shell job */ - bool shell_job; - /* criu external unix sockets */ - bool ext_unix_sk; - /* criu leave tasks in running state after checkpoint */ - bool leave_running; -}; -typedef struct opal_crs_criu_component_t opal_crs_criu_component_t; - -OPAL_MODULE_DECLSPEC extern opal_crs_criu_component_t mca_crs_criu_component; - -int opal_crs_criu_component_query(mca_base_module_t **module, int *priority); - -/* - * Module functions - */ -int opal_crs_criu_module_init(void); -int opal_crs_criu_module_finalize(void); -int opal_crs_criu_checkpoint(pid_t pid, opal_crs_base_snapshot_t *snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state); - -int opal_crs_criu_restart(opal_crs_base_snapshot_t *snapshot, - bool spawn_child, pid_t *child_pid); - -int opal_crs_criu_disable_checkpoint(void); -int opal_crs_criu_enable_checkpoint(void); - -int opal_crs_criu_prelaunch(int32_t rank, char *base_snapshot_dir, char **app, - char **cwd, char ***argv, char ***env); - -int opal_crs_criu_reg_thread(void); - - -END_C_DECLS - -#endif /* MCA_CRS_CRIU_EXPORT_H */ diff --git a/opal/mca/crs/criu/crs_criu_component.c b/opal/mca/crs/criu/crs_criu_component.c deleted file mode 100644 index e56be920c70..00000000000 --- a/opal/mca/crs/criu/crs_criu_component.c +++ /dev/null @@ -1,213 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2009 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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) 2014 Hochschule Esslingen. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include "opal/util/output.h" - -#include "opal/constants.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" -#include "crs_criu.h" - -/* Local functionality */ -static int crs_criu_register(void); -static int crs_criu_open(void); -static int crs_criu_close(void); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -opal_crs_criu_component_t mca_crs_criu_component = { - /* First do the base component stuff */ - { - /* Handle the general mca_component_t struct containing - * meta information about the component itself - */ - .base_version = { - OPAL_CRS_BASE_VERSION_2_0_0, - - /* Component name and version */ - .mca_component_name = "criu", - MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = crs_criu_open, - .mca_close_component = crs_criu_close, - .mca_query_component = opal_crs_criu_component_query, - .mca_register_component_params = crs_criu_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - - .verbose = 0, - .output_handle = -1, - }, - /* criu log file */ - LOG_FILE, - /* criu log level */ - 0, - /* criu tcp established */ - true, - /* criu shell job */ - true, - /* criu external unix sockets */ - true, - /* criu leave tasks in running state after checkpoint */ - true -}; - -static int crs_criu_register(void) -{ - int ret; - - mca_base_component_t *component = &mca_crs_criu_component.super.base_version; - - mca_crs_criu_component.super.priority = 10; - ret = mca_base_component_var_register(component, "priority", - "Priority of the CRS criu component (default: 10)", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_ALL_EQ, - &mca_crs_criu_component.super.priority); - if (0 > ret) { - return ret; - } - - mca_crs_criu_component.super.verbose = 0; - ret = mca_base_component_var_register(component, "verbose", - "Verbose level for the CRS criu component", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.super.verbose); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "log", "Name of CRIU logfile (default: criu.log)", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.log_file); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "log_level", - "Verbose level for the CRS criu component (default: 0)", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.log_level); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "tcp_established", - "Checkpoint/restore established TCP connections (default: true)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.tcp_established); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "shell_job", - "Allow to dump and restore shell jobs (default: true)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.shell_job); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "ext_unix_sk", - "Allow external unix connections (default: true)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.ext_unix_sk); - - if (0 > ret) { - return ret; - } - - ret = mca_base_component_var_register(component, "leave_running", - "Leave tasks in running state after checkpoint (default: true)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_criu_component.leave_running); - - return (0 > ret) ? ret : OPAL_SUCCESS; -} - -static int crs_criu_open(void) -{ - int oh; - - /* If there is a custom verbose level for this component than use it - * otherwise take our parents level and output channel - */ - if (0 != mca_crs_criu_component.super.verbose) { - mca_crs_criu_component.super.output_handle = opal_output_open(NULL); - opal_output_set_verbosity(mca_crs_criu_component.super.output_handle, - mca_crs_criu_component.super.verbose); - } else { - mca_crs_criu_component.super.output_handle = opal_crs_base_framework.framework_output; - } - - oh = mca_crs_criu_component.super.output_handle; - /* - * Debug output - */ - opal_output_verbose(10, oh, "crs:criu: open()"); - opal_output_verbose(20, oh, "crs:criu: open: priority = %d", - mca_crs_criu_component.super.priority); - opal_output_verbose(20, oh, "crs:criu: open: verbosity = %d", - mca_crs_criu_component.super.verbose); - opal_output_verbose(20, oh, "crs:criu: open: log_file = %s", - mca_crs_criu_component.log_file); - opal_output_verbose(20, oh, "crs:criu: open: log_level = %d", - mca_crs_criu_component.log_level); - opal_output_verbose(20, oh, "crs:criu: open: tcp_established = %d", - mca_crs_criu_component.tcp_established); - opal_output_verbose(20, oh, "crs:criu: open: shell_job = %d", - mca_crs_criu_component.shell_job); - opal_output_verbose(20, oh, "crs:criu: open: ext_unix_sk = %d", - mca_crs_criu_component.ext_unix_sk); - opal_output_verbose(20, oh, "crs:criu: open: leave_running = %d", - mca_crs_criu_component.leave_running); - - return OPAL_SUCCESS; -} - -static int crs_criu_close(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: close()"); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/crs/criu/crs_criu_module.c b/opal/mca/crs/criu/crs_criu_module.c deleted file mode 100644 index e4b12c4717c..00000000000 --- a/opal/mca/crs/criu/crs_criu_module.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2004-2005 The Trustees of the University of Tennessee. - * 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) 2007 Evergrid, Inc. All rights reserved. - * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2014 Hochschule Esslingen. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include -#include -#include -#include - -#include "opal/util/show_help.h" -#include "opal/util/output.h" -#include "opal/util/argv.h" -#include "opal/constants.h" - -#include "opal/mca/base/mca_base_var.h" - -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" - -#include "crs_criu.h" - -/* CRIU module */ -static opal_crs_base_module_t criu_module = { - /* Initialization Function */ - opal_crs_criu_module_init, - /* Finalization Function */ - opal_crs_criu_module_finalize, - - /* Checkpoint interface */ - opal_crs_criu_checkpoint, - - /* Restart Command Access */ - opal_crs_criu_restart, - - /* Disable checkpoints */ - opal_crs_criu_disable_checkpoint, - /* Enable checkpoints */ - opal_crs_criu_enable_checkpoint, - - /* Prelaunch */ - opal_crs_criu_prelaunch, - - /* Register Thread */ - opal_crs_criu_reg_thread -}; - -/* Snapshot Class Functions */ -OBJ_CLASS_DECLARATION(opal_crs_criu_snapshot_t); - -struct opal_crs_criu_snapshot_t { - /* Base CRS snapshot type */ - opal_crs_base_snapshot_t super; -}; -typedef struct opal_crs_criu_snapshot_t opal_crs_criu_snapshot_t; - -void opal_crs_criu_construct(opal_crs_criu_snapshot_t *obj); -void opal_crs_criu_destruct(opal_crs_criu_snapshot_t *obj); - -OBJ_CLASS_INSTANCE(opal_crs_criu_snapshot_t, - opal_crs_base_snapshot_t, - opal_crs_criu_construct, - opal_crs_criu_destruct); - -void opal_crs_criu_construct(opal_crs_criu_snapshot_t *snapshot) -{ - snapshot->super.component_name = strdup(mca_crs_criu_component.super.base_version.mca_component_name); -} - -void opal_crs_criu_destruct(opal_crs_criu_snapshot_t *snapshot) -{ -} - -int opal_crs_criu_component_query(mca_base_module_t **module, int *priority) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: component_query()"); - - *priority = mca_crs_criu_component.super.priority; - *module = (mca_base_module_t *)&criu_module; - - return OPAL_SUCCESS; -} - -int opal_crs_criu_module_init(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: module_init()"); - - return OPAL_SUCCESS; -} - -int opal_crs_criu_module_finalize(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: module_finalize()"); - - return OPAL_SUCCESS; -} - -static void criu_error(int ret, pid_t pid) -{ - switch (ret) { - case -EBADE: - opal_output(0, "crs:criu:(PID:%d):RPC has returned fail", pid); - break; - case -ECONNREFUSED: - opal_output(0, "crs:criu:(PID:%d):Unable to connect to CRIU", pid); - break; - case -ECOMM: - opal_output(0, "crs:criu:(PID:%d):Unable to send/recv msg to/from CRIU", pid); - break; - case -EINVAL: - opal_output(0, "crs:criu:(PID:%d):CRIU doesn't support this type of request." - "You should probably update CRIU", pid); - break; - case -EBADMSG: - opal_output(0, "crs:criu:(PID:%d):Unexpected response from CRIU." - "You should probably update CRIU", pid); - break; - default: - opal_output(0, "crs:criu:(PID:%d):Unknown error type code." - "You should probably update CRIU", pid); - } -} - -int opal_crs_criu_checkpoint(pid_t pid, opal_crs_base_snapshot_t *base_snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state) -{ - int ret; - int fd = 0; - int oh = mca_crs_criu_component.super.output_handle; - opal_crs_criu_snapshot_t *snapshot = NULL; - char *dest = NULL; - - opal_output_verbose(10, oh, "crs:criu: checkpoint(%d, ---)", pid); - - snapshot = (opal_crs_criu_snapshot_t *)base_snapshot; - snapshot->super.component_name = strdup(mca_crs_criu_component.super.base_version.mca_component_name); - - if (NULL == snapshot->super.metadata) { - if (NULL == (snapshot->super.metadata = fopen(snapshot->super.metadata_filename, "a"))) { - opal_output(oh, "crs:criu: checkpoint(): Error: Unable to open the file (%s)", - snapshot->super.metadata_filename); - *state = OPAL_CRS_ERROR; - goto cleanup; - } - } - fprintf(snapshot->super.metadata, "%s%s\n", CRS_METADATA_COMP, snapshot->super.component_name); - - fclose(snapshot->super.metadata); - snapshot->super.metadata = NULL; - - ret = criu_init_opts(); - - if (ret < 0) { - criu_error(ret, pid); - *state = OPAL_CRS_ERROR; - goto cleanup; - } - - opal_output_verbose(10, oh, "crs:criu: criu_init_opts() returned %d", ret); - - dest = snapshot->super.snapshot_directory; - opal_output_verbose(10, oh, "crs:criu: opening snapshot directory %s", dest); - fd = open(dest, O_DIRECTORY); - - if (fd < 0) { - *state = OPAL_CRS_ERROR; - opal_output(oh, "crs:criu: checkpoint(): Error: Unable to open checkpoint " - "directory (%s) for pid (%d)", dest, pid); - goto cleanup; - } - - /* http://criu.org/C_API */ - criu_set_images_dir_fd(fd); - criu_set_pid(pid); - - criu_set_log_file(mca_crs_criu_component.log_file); - criu_set_log_level(mca_crs_criu_component.log_level); - criu_set_tcp_established(mca_crs_criu_component.tcp_established); - criu_set_shell_job(mca_crs_criu_component.shell_job); - criu_set_ext_unix_sk(mca_crs_criu_component.ext_unix_sk); - criu_set_leave_running(mca_crs_criu_component.leave_running); - ret = criu_dump(); - - if (ret < 0) { - criu_error(ret, pid); - *state = OPAL_CRS_ERROR; - goto cleanup; - } - - *state = OPAL_CRS_CONTINUE; - - cleanup: - - if (fd > 0) { - close(fd); - } - - if (OPAL_CRS_ERROR == *state) { - return OPAL_ERROR; - } - return OPAL_SUCCESS; -} - -int opal_crs_criu_restart(opal_crs_base_snapshot_t *snapshot, - bool spawn_child, pid_t *child_pid) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: %s", __func__); - return OPAL_SUCCESS; -} - -int opal_crs_criu_disable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: %s", __func__); - return OPAL_SUCCESS; -} - -int opal_crs_criu_enable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: %s", __func__); - return OPAL_SUCCESS; -} - -int opal_crs_criu_prelaunch(int32_t rank, char *base_snapshot_dir, - char **app, char **cwd, char ***argv, - char ***env) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: %s", __func__); - return OPAL_SUCCESS; -} - -int opal_crs_criu_reg_thread(void) -{ - opal_output_verbose(10, mca_crs_criu_component.super.output_handle, - "crs:criu: %s", __func__); - return OPAL_SUCCESS; -} diff --git a/opal/mca/crs/criu/owner.txt b/opal/mca/crs/criu/owner.txt deleted file mode 100644 index 0cc0384f0eb..00000000000 --- a/opal/mca/crs/criu/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: CISCO -status: maintenance diff --git a/opal/mca/crs/dmtcp/.opal_ignore b/opal/mca/crs/dmtcp/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/opal/mca/crs/dmtcp/Makefile.am b/opal/mca/crs/dmtcp/Makefile.am deleted file mode 100644 index 91bbbe91a1b..00000000000 --- a/opal/mca/crs/dmtcp/Makefile.am +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (c) 2010 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -CFLAGS = $(crs_dmtcp_CFLAGS) -AM_CPPFLAGS = $(crs_dmtcp_CPPFLAGS) - -sources = \ - crs_dmtcp.h \ - crs_dmtcp_component.c \ - crs_dmtcp_module.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_opal_crs_dmtcp_DSO -component_noinst = -component_install = mca_crs_dmtcp.la -else -component_noinst = libmca_crs_dmtcp.la -component_install = -endif - -mcacomponentdir = $(opallibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_crs_dmtcp_la_SOURCES = $(sources) -mca_crs_dmtcp_la_LDFLAGS = -module -avoid-version $(crs_dmtcp_LDFLAGS) -mca_crs_dmtcp_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(crs_dmtcp_LIBS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_crs_dmtcp_la_SOURCES = $(sources) -libmca_crs_dmtcp_la_LDFLAGS = -module -avoid-version $(crs_dmtcp_LDFLAGS) -libmca_crs_dmtcp_la_LIBADD = $(crs_dmtcp_LIBS) diff --git a/opal/mca/crs/dmtcp/configure.m4 b/opal/mca/crs/dmtcp/configure.m4 deleted file mode 100644 index af61f228a00..00000000000 --- a/opal/mca/crs/dmtcp/configure.m4 +++ /dev/null @@ -1,140 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2010 The Trustees of Indiana University. -# All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_opal_crs_dmtcp_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_opal_crs_dmtcp_CONFIG],[ - AC_CONFIG_FILES([opal/mca/crs/dmtcp/Makefile]) - - OPAL_VAR_SCOPE_PUSH([opal_check_crs_dmtcp_good opal_opal_check_crs_dmtcp_save_CPPFLAGS opal_opal_check_crs_dmtcp_save_LDFLAGS opal_opal_check_crs_dmtcp_save_LIBS opal_check_crs_dmtcp_dir_msg opal_check_crs_dmtcp_libdir_msg opal_check_crs_dmtcp_dir opal_check_crs_dmtcp_libdir]) - - - opal_check_crs_dmtcp_good="no" - - # Configure option to specify where to look for DMTCP headers - # --with-dmtcp(=DIR) - AC_ARG_WITH([dmtcp], - [AC_HELP_STRING([--with-dmtcp(=DIR)], - [Path to DMTCP Installation])]) - OPAL_CHECK_WITHDIR([dmtcp], [$with_dmtcp], [include/mtcp.h]) - - # Configure option to specify where to look for DMTCP libraries - # (Default: $with_dmtcp/lib) - # --with-dmtcp-libdir=DIR - AC_ARG_WITH([dmtcp-libdir], - [AC_HELP_STRING([--with-dmtcp-libdir=DIR], - [Search for DMTCP libraries in DIR])]) - OPAL_CHECK_WITHDIR([dmtcp-libdir], [$with_dmtcp_libdir], [libmtcp.so]) - - # - # Check if Open MPI was compiled with Checkpoint/Restart support - # If not, then we do not compile this component - # - AS_IF([test "$opal_want_ft" = "0"], - [opal_check_crs_dmtcp_good="no"], - [opal_check_crs_dmtcp_good="yes"]) - - # - # Check if the user explicitly requested -not- to build the DMTCP component - # If so, the we do not compile this component - # - AS_IF([test "$with_dmtcp" = "no" || test "$opal_check_crs_dmtcp_good" = "no"], - [opal_check_crs_dmtcp_good="no"], - [opal_check_crs_dmtcp_good="yes"]) - - # Save some flags - opal_opal_check_crs_dmtcp_save_CPPFLAGS=$CPPFLAGS - opal_opal_check_crs_dmtcp_save_LDFLAGS=$LDFLAGS - opal_opal_check_crs_dmtcp_save_LIBS=$LIBS - - # - # Now to check if the library is usable - # - opal_check_crs_dmtcp_dir_msg="compiler default" - opal_check_crs_dmtcp_libdir_msg="linker default" - opal_check_crs_dmtcp_dir="" - opal_check_crs_dmtcp_libdir="" - - # Determine the search paths for the headers and libraries - AS_IF([test "$opal_check_crs_dmtcp_good" = "yes"], - [AS_IF([test ! -z "$with_dmtcp" && test "$with_dmtcp" != "yes"], - [opal_check_crs_dmtcp_dir="$with_dmtcp" - opal_check_crs_dmtcp_dir_msg="$with_dmtcp (from --with-dmtcp)"]) - AS_IF([test ! -z "$with_dmtcp_libdir" && test "$with_dmtcp_libdir" != "yes"], - [opal_check_crs_dmtcp_libdir="$with_dmtcp_libdir" - opal_check_crs_dmtcp_libdir_msg="$with_dmtcp_libdir (from --with-dmtcp-libdir)"]) - ]) - - # Look for DMTCP. - AS_IF([test "$opal_check_crs_dmtcp_good" = "yes"], - [AC_MSG_CHECKING([for DMTCP dir]) - AC_MSG_RESULT([$opal_check_crs_dmtcp_dir_msg]) - AC_MSG_CHECKING([for DMTCP library dir]) - AC_MSG_RESULT([$opal_check_crs_dmtcp_libdir_msg]) - OPAL_CHECK_PACKAGE([crs_dmtcp_check], - [mtcp.h], - [mtcp], - [mtcp_init], - [], - [$opal_check_crs_dmtcp_dir], - [$opal_check_crs_dmtcp_libdir], - [opal_check_crs_dmtcp_good="yes"], - [opal_check_crs_dmtcp_good="no"]) - ]) - - # When we restart a thread, we use execlp() to exec the "mtcp_restart" - # command. We don't care what its path is, but it does need to exist in - # the PATH. - AC_CHECK_PROG([mtcp_restart_command_exists], ["mtcp_restart"], ["yes"], ["no"]) - AS_IF([test "$mtcp_restart_command_exists" = "no"], - [opal_check_crs_dmtcp_good="no" - AS_IF([test ! -z "$with_dmtcp" && test "$with_dmtcp" != "no"], - [AC_MSG_WARN([mtcp_restart not found in PATH.]) - AC_MSG_ERROR([Aborting.])])]) - - # - # If '-lmtcp' or - # '-I' or '-L' was needed to link to MTCP, then OPAL_CHECK_PACKAGE - # sets the crs_mtcp_check_* variables, which we use below. - # - - crs_dmtcp_CFLAGS="$CFLAGS $crs_dmtcp_check_CFLAGS" - crs_dmtcp_CPPFLAGS="$CPPFLAGS $crs_dmtcp_check_CPPFLAGS" - crs_dmtcp_LDFLAGS="$LDFLAGS $crs_dmtcp_check_LDFLAGS" - crs_dmtcp_LIBS="$crs_dmtcp_check_LIBS $LIBS" - - AS_IF([test "$opal_check_crs_dmtcp_good" = "yes"], - [$1]) - - CPPFLAGS=$opal_opal_check_crs_dmtcp_save_CPPFLAGS - LDFLAGS="$crs_dmtcp_check_LDFLAGS $opal_opal_check_crs_dmtcp_save_LDFLAGS" - LIBS="$crs_dmtcp_LIBS $opal_opal_check_crs_dmtcp_save_LIBS" - - AC_SUBST([crs_dmtcp_CFLAGS]) - AC_SUBST([crs_dmtcp_CPPFLAGS]) - AC_SUBST([crs_dmtcp_LDFLAGS]) - AC_SUBST([crs_dmtcp_LIBS]) - - # If all is good at this point then post any compiler options to - # the build environment. If all is not good at this point and - # DMTCP was explicitly requested, then error out. - - AS_IF([test "$opal_check_crs_dmtcp_good" = "yes"], - [$1], - [AS_IF([test ! -z "$with_dmtcp" && test "$with_dmtcp" != "no"], - [AC_MSG_WARN([DMTCP support requested but not found. Perhaps you need to specify the location of the DMTCP libraries.]) - AC_MSG_ERROR([Aborting.])]) - $2]) - OPAL_VAR_SCOPE_POP -])dnl diff --git a/opal/mca/crs/dmtcp/crs_dmtcp.h b/opal/mca/crs/dmtcp/crs_dmtcp.h deleted file mode 100644 index 6e5b4db9562..00000000000 --- a/opal/mca/crs/dmtcp/crs_dmtcp.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2010 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2010-2011 Alex Brick . - * All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - * DMTCP CRS component - * - */ - -#ifndef MCA_CRS_DMTCP_EXPORT_H -#define MCA_CRS_DMTCP_EXPORT_H - -#include "opal_config.h" - - -#include "opal/mca/mca.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/base/base.h" - -/* JJH NOTE: Include your library header here */ -/* #include */ -#include - -BEGIN_C_DECLS - - /* - * Local Component Structure - */ - struct opal_crs_dmtcp_component_t { - /** Base CRS component */ - opal_crs_base_component_t super; - - /** JJH: Add additional items here as needed internally */ - }; - typedef struct opal_crs_dmtcp_component_t opal_crs_dmtcp_component_t; - OPAL_MODULE_DECLSPEC extern opal_crs_dmtcp_component_t mca_crs_dmtcp_component; - - /* - * Component query command - * - Called during opal_init() to determine if this component should be selected. - */ - int opal_crs_dmtcp_component_query(mca_base_module_t **module, int *priority); - - /* - * Module functions - */ - int opal_crs_dmtcp_module_init(void); - int opal_crs_dmtcp_module_finalize(void); - - /* - * Actual CRS funcationality - */ - int opal_crs_dmtcp_checkpoint( pid_t pid, - opal_crs_base_snapshot_t *snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state); - - int opal_crs_dmtcp_restart( opal_crs_base_snapshot_t *snapshot, - bool spawn_child, - pid_t *child_pid); - - int opal_crs_dmtcp_disable_checkpoint(void); - int opal_crs_dmtcp_enable_checkpoint(void); - - int opal_crs_dmtcp_prelaunch(int32_t rank, - char *base_snapshot_dir, - char **app, - char **cwd, - char ***argv, - char ***env); - - int opal_crs_dmtcp_reg_thread(void); - -END_C_DECLS - -#endif /* MCA_CRS_DMTCP_EXPORT_H */ diff --git a/opal/mca/crs/dmtcp/crs_dmtcp_component.c b/opal/mca/crs/dmtcp/crs_dmtcp_component.c deleted file mode 100644 index 20e85fa406c..00000000000 --- a/opal/mca/crs/dmtcp/crs_dmtcp_component.c +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2010 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2010-2011 Alex Brick . - * All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include "opal/util/output.h" - -#include "opal/constants.h" -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" -#include "crs_dmtcp.h" - -/* - * Local functionality - */ -static int crs_dmtcp_register (void); -static int crs_dmtcp_open(void); -static int crs_dmtcp_close(void); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -opal_crs_dmtcp_component_t mca_crs_dmtcp_component = { - /* First do the base component stuff */ - { - /* Handle the general mca_component_t struct containing - * meta information about the component itself - */ - .base_version = { - OPAL_CRS_BASE_VERSION_2_0_0, - - /* Component name and version */ - .mca_component_name = "dmtcp", - MCA_BASE_MAKE_VERSION(component, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = crs_dmtcp_open, - .mca_close_component = crs_dmtcp_close, - .mca_query_component = opal_crs_dmtcp_component_query, - .mca_register_component_params = crs_dmtcp_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - - .verbose = 0, - .output_handle = -1 - } -}; - -static int crs_dmtcp_register (void) -{ - int ret; - /* - * User can adjust the relative priority of this component with respect - * to other CRS components available for selection. - */ - mca_crs_dmtcp_component.super.priority = 20 - ret = mca_base_component_var_register (&mca_crs_dmtcp_component.super.base_version, - "priority", "Priority of the CRS dmtcp component " - "(default: 20)", MCA_BASE_VAR_TYPE_INT, NULL, - MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_ALL_EQ, - &mca_crs_dmtcp_component.super.priority); - if (0 > ret) { - return ret; - } - - /* - * Adjust the verbosity level for this component. Default off or 0. - */ - mca_crs_dmtcp_component.super.verbose = 0; - ret = mca_base_component_var_register (&mca_crs_dmtcp_component.super.base_version, - "verbose", - "Verbose level for the CRS dmtcp component", - MCA_BASE_VAR_TYPE_INT, NULL,MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &mca_crs_dmtcp_component.super.verbose); - return (0 > ret) ? ret : OPAL_SUCCESS; -} - -static int crs_dmtcp_open(void) -{ - /* If there is a custom verbose level for this component than use it - * otherwise take our parents level and output channel - */ - if ( 0 != mca_crs_dmtcp_component.super.verbose) { - mca_crs_dmtcp_component.super.output_handle = opal_output_open(NULL); - opal_output_set_verbosity(mca_crs_dmtcp_component.super.output_handle, - mca_crs_dmtcp_component.super.verbose); - } else { - mca_crs_dmtcp_component.super.output_handle = opal_crs_base_framework.framework_output; - } - - /* - * Debug output - */ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: open()"); - opal_output_verbose(20, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: open: priority = %d", - mca_crs_dmtcp_component.super.priority); - opal_output_verbose(20, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: open: verbosity = %d", - mca_crs_dmtcp_component.super.verbose); - - return OPAL_SUCCESS; -} - -static int crs_dmtcp_close(void) -{ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: close()"); - - return OPAL_SUCCESS; -} diff --git a/opal/mca/crs/dmtcp/crs_dmtcp_module.c b/opal/mca/crs/dmtcp/crs_dmtcp_module.c deleted file mode 100644 index e18626ff577..00000000000 --- a/opal/mca/crs/dmtcp/crs_dmtcp_module.c +++ /dev/null @@ -1,709 +0,0 @@ -/* - * Copyright (c) 2010 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2010-2011 Alex Brick . - * All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "opal/util/output.h" -#include "opal/util/argv.h" -#include "opal/constants.h" - -#include "opal/mca/base/mca_base_var.h" - -#include "opal/threads/mutex.h" -#include "opal/threads/condition.h" - -#include "opal/mca/event/event.h" - -#include "opal/mca/crs/crs.h" -#include "opal/mca/crs/base/base.h" - -#include "crs_dmtcp.h" - -#define MTCP_RESTART_COMMAND "mtcp_restart" - -/* - * DMTCP module - */ -static opal_crs_base_module_t dmtcp_module = { - /** Initialization Function */ - opal_crs_dmtcp_module_init, - /** Finalization Function */ - opal_crs_dmtcp_module_finalize, - - /** Checkpoint interface */ - opal_crs_dmtcp_checkpoint, - - /** Restart Command Access */ - opal_crs_dmtcp_restart, - - /** Disable checkpoints */ - opal_crs_dmtcp_disable_checkpoint, - /** Enable checkpoints */ - opal_crs_dmtcp_enable_checkpoint, - - /** Prelaunch */ - opal_crs_dmtcp_prelaunch, - - /** Register Thread */ - opal_crs_dmtcp_reg_thread -}; - -/*************************** - * Snapshot Class Functions - ***************************/ -OBJ_CLASS_DECLARATION(opal_crs_dmtcp_snapshot_t); - -struct opal_crs_dmtcp_snapshot_t { - /** Base CRS snapshot type */ - opal_crs_base_snapshot_t super; - char * context_filename; -}; -typedef struct opal_crs_dmtcp_snapshot_t opal_crs_dmtcp_snapshot_t; - -void opal_crs_dmtcp_construct(opal_crs_dmtcp_snapshot_t *obj); -void opal_crs_dmtcp_destruct(opal_crs_dmtcp_snapshot_t *obj); - -OBJ_CLASS_INSTANCE(opal_crs_dmtcp_snapshot_t, - opal_crs_base_snapshot_t, - opal_crs_dmtcp_construct, - opal_crs_dmtcp_destruct); - -/****************** - * Local Functions - ******************/ -static int dmtcp_cold_start(opal_crs_dmtcp_snapshot_t *snapshot); -static int dmtcp_generate_full_ckpt_path(opal_crs_dmtcp_snapshot_t *snapshot); -static void dmtcp_sleep_between_ckpt_callback(int interval); -static void dmtcp_pre_ckpt_callback(char **ckpt_filename); -static void dmtcp_post_ckpt_callback(int is_restarting, - char *mtcp_restore_argv_start_addr); -static int dmtcp_should_ckpt_fd_callback(int fd); - -/************************* - * Local Global Variables - *************************/ -static char *full_ckpt_path = NULL; -static pthread_cond_t checkpoint_cond = PTHREAD_COND_INITIALIZER; -static pthread_cond_t checkpoint_done_cond = PTHREAD_COND_INITIALIZER; -static pthread_mutex_t checkpoint_mutex = PTHREAD_MUTEX_INITIALIZER; -static int post_ckpt_state; - -void opal_crs_dmtcp_construct(opal_crs_dmtcp_snapshot_t *snapshot) { - snapshot->context_filename = NULL; - snapshot->super.component_name = - strdup(mca_crs_dmtcp_component.super.base_version.mca_component_name); -} - -void opal_crs_dmtcp_destruct( opal_crs_dmtcp_snapshot_t *snapshot) { - if(NULL != snapshot->context_filename) { - free(snapshot->context_filename); - snapshot->context_filename = NULL; - } -} - -/***************** - * MCA Functions - *****************/ -int opal_crs_dmtcp_component_query(mca_base_module_t **module, int *priority) -{ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: component_query()"); - - *priority = mca_crs_dmtcp_component.super.priority; - *module = (mca_base_module_t *)&dmtcp_module; - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_module_init(void) -{ - char *temp_checkpoint_name; - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: module_init()"); - - /* - * JJH NOTE: Call any initialization routines you require - */ - mtcp_set_callbacks(dmtcp_sleep_between_ckpt_callback, /* sleep_between_ckpt */ - dmtcp_pre_ckpt_callback, /* pre_ckpt */ - dmtcp_post_ckpt_callback, /* post_ckpt */ - dmtcp_should_ckpt_fd_callback, /* ckpt_fd */ - NULL); /* write_ckpt_header */ - - /* This serves to simply initialize MTCP. The checkpoint file will - * actually be set by our pre_ckpt callback (which takes it from the - * snapshot given to the CRS checkpoint function), and the interval will be - * ignored, substituted for a synchronization signal that is handled by our - * sleep_between_ckpt callback. - */ - - asprintf(&temp_checkpoint_name, "checkpoint.dmtcp.%ld", syscall(SYS_getpid)); - mtcp_init(temp_checkpoint_name, 0, 1); - mtcp_ok(); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: leaving module_init()"); - - free(temp_checkpoint_name); - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_module_finalize(void) -{ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: module_finalize()"); - - /* - * JJH NOTE: Call any finalization routines you require - */ - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_prelaunch(int32_t rank, - char *base_snapshot_dir, - char **app, - char **cwd, - char ***argv, - char ***env) -{ - char * tmp_env_var = NULL; - - /* - * The below should be left untouched for now - */ - (void) mca_base_var_env_name("opal_cr_is_tool", &tmp_env_var); - opal_setenv(tmp_env_var, - "0", true, env); - free(tmp_env_var); - tmp_env_var = NULL; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: leaving module_prelaunch()"); - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_reg_thread(void) -{ - /* - * JJH NOTE: If you require that all threads that may call into MTCP - * explicitly register with MTCP, then place the necessary - * initialization here. - */ - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: leaving module_reg_thread()"); - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_checkpoint(pid_t pid, - opal_crs_base_snapshot_t *base_snapshot, - opal_crs_base_ckpt_options_t *options, - opal_crs_state_type_t *state) -{ - int unlock_retval, exit_status = OPAL_SUCCESS; - char buf[BUFSIZ]; - opal_crs_dmtcp_snapshot_t *snapshot; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: about to lock mutex for checkpoint()"); - - pthread_mutex_lock(&checkpoint_mutex); - snapshot = (opal_crs_dmtcp_snapshot_t *) base_snapshot; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: checkpoint(%d, ---)", pid); - - /* Are we checkpointing ourselves or a peer. - * JJH NOTE: This will only ever be called when pid == getpid() - * This is an old interface argument, that is no longer used. - */ - - /* bricka (2010-05-14): According to crs.h, 0 also indicates checkpointing - * self. - */ - if((pid != 0) && (pid != syscall(SYS_getpid)) ) { - /* MTCP can only checkpoint a single process: we can only checkpoint - * ourself. */ - *state = OPAL_CRS_ERROR; - exit_status = OPAL_ERROR; - goto cleanup; - } - - /* the metadata file should always be NULL at this point */ - if ( NULL != snapshot->super.metadata) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: checkpoint(): Error: Metadata file already open"); - exit_status = OPAL_ERROR; - goto cleanup; - } - - /* - * Update the snapshot metadata with the component name so opal-restart can - * pick the correct CRS to restart with. - */ - snapshot->super.component_name = strdup(mca_crs_dmtcp_component.super.base_version.mca_component_name); - - if( NULL == snapshot->super.metadata ) { - if (NULL == (snapshot->super.metadata = fopen(snapshot->super.metadata_filename, "a")) ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: checkpoint(): Error: Unable to open the file (%s)", - snapshot->super.metadata_filename); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - - /* The filename of the checkpoint will be changed by our pre_ckpt hook - * based on the options given to this function. */ - if(dmtcp_generate_full_ckpt_path(snapshot) == -1) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: unable to generate context filename."); - - exit_status = OPAL_ERROR; - goto cleanup; - } - - /* - * JJH NOTE: You can write however much or little data you want to the - * metadata file. The metadata file is stored with the local - * checkpoint, and provided at restart time to help the - * CRS component deteremine how to restart from any files - * that is left in this directory during checkpoint. - * Use the command below to write key/value strings to the - * metadata file. - * (Just as we did above with the component name). - */ - if ( 0 > fprintf(snapshot->super.metadata, "%s%s\n", CRS_METADATA_COMP, snapshot->super.component_name)) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: unable to print component name to metadata"); - } - - if ( 0 > fprintf(snapshot->super.metadata, "%s%s\n", CRS_METADATA_CONTEXT, snapshot->context_filename)) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: unable to print context name to metadata"); - } - - fclose(snapshot->super.metadata ); - snapshot->super.metadata = NULL; - - /* - * JJH NOTE: Setup and request a checkpoint of this process. - */ - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: will checkpoint to file: %s", - full_ckpt_path); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: about to signal checkpoint"); - - /* Now that we have set the requested filename, we simply need to start - * the checkpoint. */ - pthread_cond_signal(&checkpoint_cond); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: signalled checkpoint"); - - /* We want to wait for the checkpoint to finish before we continue (in - * particular, we need the post_ckpt hook to happen so that we know the - * status of the checkpoint) - */ - pthread_cond_wait(&checkpoint_done_cond, &checkpoint_mutex); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: received checkpoint_done signal"); - - /* We have now been checkpointed. Note that the state of the checkpoint - * (OPAL_CRS_CONTINUE, etc.) has been recorded by the post_ckpt hook. - */ - *state = post_ckpt_state; - exit_status = OPAL_SUCCESS; - - free(full_ckpt_path); - - cleanup: - unlock_retval = pthread_mutex_unlock(&checkpoint_mutex); - - if( 0 != unlock_retval ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_checkpoint: unable to unlock mutex at end of checkpoint: %s", - strerror_r(unlock_retval, buf, BUFSIZ)); - - exit_status = OPAL_ERROR; - } - - if( NULL != snapshot->super.metadata ) { - fclose(snapshot->super.metadata ); - snapshot->super.metadata = NULL; - } - - return exit_status; -} - -int opal_crs_dmtcp_restart(opal_crs_base_snapshot_t *base_snapshot, bool spawn_child, pid_t *child_pid) -{ - int ret, exit_status = OPAL_SUCCESS; - int exec_status; - - opal_crs_dmtcp_snapshot_t *snapshot = OBJ_NEW(opal_crs_dmtcp_snapshot_t); - snapshot->super = *base_snapshot; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: restart(--, %d)", spawn_child); - - /* - * JJH NOTE: 'cold_start' indicates that this process is being restarted from - * opal-restart instead of from within an already running process. - * In the current code base, this is always set to true since it - * does not allow a process to request a restart of itself. - */ - if(snapshot->super.cold_start) { - /* - * Read the metadata left by the checkpoint() of this process - */ - if( OPAL_SUCCESS != (ret = dmtcp_cold_start(snapshot)) ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_restart: Unable to reconstruct the snapshot."); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - - /* JJH NOTE: Nearly all of the time the 'spawn_child' argument is set to - * 'false' indicating that the restart function is expected to - * call exec() directly. It is only set to 'true' if the user - * explicitly tells opal-restart to spawn off the child, which - * rarely/never happens. So I would not worry about that option. - */ - if( spawn_child ) { - pid_t child_pid = fork(); - - if(child_pid > 0) - goto cleanup; - else if(child_pid < 0) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_restart: Unable to spawn child."); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - - /* - * JJH NOTE: Restart the process by replacing this process - */ - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_restart: About to invoke command: %s with argv: %s %s", - MTCP_RESTART_COMMAND, - MTCP_RESTART_COMMAND, - snapshot->context_filename); - - exec_status = execlp(MTCP_RESTART_COMMAND, MTCP_RESTART_COMMAND, snapshot->context_filename, NULL); - - /* If we get down here, something has broken. */ - - if(exec_status < 0) - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_restart: error in replacing process: %s", - strerror(errno)); - else - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_restart: exec() returned!"); - - exit_status = OPAL_ERROR; - goto cleanup; - - cleanup: - return exit_status; -} - -int opal_crs_dmtcp_disable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: disable_checkpoint()"); - - /* - * JJH NOTE: Enter a critical section. This is not really used in the code - * at the moment. - */ - mtcp_no(); - - return OPAL_SUCCESS; -} - -int opal_crs_dmtcp_enable_checkpoint(void) -{ - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: enable_checkpoint()"); - /* - * JJH NOTE: Leave a critical section. This is not really used in the code - * at the moment. - */ - mtcp_ok(); - - return OPAL_SUCCESS; -} - -/***************************** - * Local Function Definitions - *****************************/ -static int dmtcp_cold_start(opal_crs_dmtcp_snapshot_t *snapshot) { - int ret, exit_status = OPAL_SUCCESS; - char **tmp_argv = NULL; - char * component_name = NULL; - int prev_pid; - - /* - * Find the snapshot directory, read the metadata file for - * component name and previous pid - */ - if( NULL == snapshot->super.metadata ) { - if (NULL == (snapshot->super.metadata = fopen(snapshot->super.metadata_filename, "r")) ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_cold_start(): Error: Unable to open the file (%s)", - snapshot->super.metadata_filename); - exit_status = OPAL_ERROR; - goto cleanup; - } - } - if( OPAL_SUCCESS != (ret = opal_crs_base_extract_expected_component(snapshot->super.metadata, - &component_name, &prev_pid) ) ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_cold_start: Error: Failed to extract the metadata from the local snapshot (%s). Returned %d.", - snapshot->super.metadata_filename, ret); - exit_status = ret; - goto cleanup; - } - - snapshot->super.component_name = strdup(component_name); - - /* - * Compare the component strings to make sure this is our snapshot before going further. - * JJH NOTE: This will nearly always be true since opal-restart also checks this metadata. - */ - if ( 0 != strncmp(mca_crs_dmtcp_component.super.base_version.mca_component_name, - component_name, strlen(component_name)) ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_cold_start: Error: This snapshot (%s) is not intended for us (%s)\n", - component_name, mca_crs_dmtcp_component.super.base_version.mca_component_name); - exit_status = OPAL_ERROR; - goto cleanup; - } - - /* - * Read context information from the metadata file - */ - opal_crs_base_metadata_read_token(snapshot->super.metadata, CRS_METADATA_CONTEXT, &tmp_argv); - if( NULL == tmp_argv ) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: dmtcp_cold_start: Error: Failed to read the %s token from the local checkpoint in %s", - CRS_METADATA_CONTEXT, snapshot->super.snapshot_directory); - exit_status = OPAL_ERROR; - goto cleanup; - } - - asprintf(&(snapshot->context_filename), "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: cold_start(%s)", snapshot->context_filename); - - /* - * Reset the cold_start flag - */ - snapshot->super.cold_start = false; - - cleanup: - if(NULL != tmp_argv) { - opal_argv_free(tmp_argv); - tmp_argv = NULL; - } - - if( NULL != snapshot->super.metadata ) { - fclose(snapshot->super.metadata); - snapshot->super.metadata = NULL; - } - - return exit_status; -} - -/** - * Given a snapshot, generate the context filename and its full path. - * - * @param snapshot the snapshot with request information - */ -static int dmtcp_generate_full_ckpt_path(opal_crs_dmtcp_snapshot_t *snapshot) -{ - int retval; - retval = asprintf(&(snapshot->context_filename), "ompi_dmtcp_context.%ld", syscall(SYS_getpid)); - if(retval == -1) - return -1; - - return asprintf(&full_ckpt_path, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename); -} - -/** - * This is a callback function to call the actual checkpointing routine. - * Instead of waiting for a specific interval as MTCP does, we will wait on a - * synchronization signal that will allow us to checkpoint on demand. The - * argument to this function will be ignored. - */ -static void dmtcp_sleep_between_ckpt_callback(int interval) -{ - int signal_retval; - char buf[BUFSIZ]; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: called sleep_between_ckpt callback"); - - pthread_mutex_lock(&checkpoint_mutex); - - /* If the MPI checkpoint thread is waiting on the checkpoint_done_cond and - * this thread is here, it means that a checkpoint has just completed. - * Let's signal the MPI checkpoint thread to resume. */ - signal_retval = pthread_cond_signal(&checkpoint_done_cond); - - if( 0 != signal_retval) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: post_ckpt_callback(): Unable to signal checkpoint done: %s", - strerror_r(signal_retval, buf, BUFSIZ)); - } - - /* now we simply wait for the signal to checkpoint */ - pthread_cond_wait(&checkpoint_cond, &checkpoint_mutex); - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: received sync signal to checkpoint."); - - /* We have now been instructed to checkpoint, so we return. Note that the - * mutex is still locked: the post_ckpt callback will unlock it. */ -} - -/** - * This is a callback function that is invoked before the checkpoint actually - * occurs. It enables us to do any logging that is necessary, as well as change - * the filename that the checkpoint will be written to. We expect that this - * filename will be pulled from the checkpoint options. - * - * @param ckpt_filename a pointer in which to store the desired checkpoint - * filename - */ -static void dmtcp_pre_ckpt_callback(char **ckpt_filename) -{ - *ckpt_filename = full_ckpt_path; -} - -/** - * This is a callback function that is invoked after the checkpoint has - * finished. It enables us to do any logging that is necessary, as well as - * report whether this is called from a restart or a checkpoint. We will report - * this status, signal the CRS code to continue running, and then release the - * mutex that we are holding. - * - * @param is_restarting whether or not this is being called as part of a restart - * @param mtcp_restore_argv_start_addr unused - */ -static void dmtcp_post_ckpt_callback(int is_restarting, char *mtcp_restore_argv_start_addr) -{ - int unlock_retval; - char buf[BUFSIZ]; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: in post_ckpt_callback, restarting: %d", is_restarting); - if(is_restarting) - post_ckpt_state = OPAL_CRS_RESTART; - else - post_ckpt_state = OPAL_CRS_CONTINUE; - - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: unlocking at end of post_ckpt_callback"); - - unlock_retval = pthread_mutex_unlock(&checkpoint_mutex); - - if( 0 != unlock_retval) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: post_ckpt_callback(): Unable to unlock mutex: %s", - strerror_r(unlock_retval, buf, BUFSIZ)); - } -} - -/** - * This is a callback function that is invoked by DMTCP to see if it should - * checkpoint the given file descriptor. - * - * If the file descriptor is a socket, named-pipe or pseudo-terminal, DMTCP - * should skip checkpointing them. - * - * If we can't determine the type of fd (stat and/or readlink failed), we ask - * DMTCP to try to checkpoint them anyways with the assumption that DMTCP would - * warn users of any such case. - * - * @param fd file descriptor to checkpoint - * @return: 1 if DMTCP should ckpt the file descriptor, 0 otherwise. - */ -static int dmtcp_should_ckpt_fd_callback(int fd) -{ - struct stat stat_buf; - char device_name[PATH_MAX]; - char proc_filename[64]; - char buf[BUFSIZ]; - - if (fstat(fd, &stat_buf) != 0) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: should_ckpt_fd_callback(): error stat()'ing %d: %s", - fd, strerror_r(errno, buf, BUFSIZ)); - return 1; - /* Don't checkpoint sockets and FIFOs */ - } else if (S_ISSOCK(stat_buf.st_mode) || S_ISFIFO(stat_buf.st_mode)) { - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: skipping checkpointing socket/fifo: %d", - fd); - return 0; - } - - memset(device_name, 0, sizeof device_name); - sprintf(proc_filename, "/proc/self/fd/%d", fd); - if (readlink(proc_filename, device_name, sizeof(device_name) - 1) <= 0) { - opal_output(mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: should_ckpt_fd_callback(): readlink(%d) failed: %s", - fd, strerror_r(errno, buf, BUFSIZ)); - return 1; - } - - /* Don't checkpoint ptys */ - if (strstr(device_name, "/dev/pts/") == 0 || - strstr(device_name, "/dev/pty") == 0 || - strstr(device_name, "/dev/tty") == 0) { - opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, - "crs:dmtcp: skipping checkpointing %s", - device_name); - return 0; - } - - /* Checkpoint fd by default */ - return 1; -} diff --git a/opal/mca/crs/dmtcp/owner.txt b/opal/mca/crs/dmtcp/owner.txt deleted file mode 100644 index ed1d89a44ab..00000000000 --- a/opal/mca/crs/dmtcp/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: U Brit.Columbia -status: unmaintained From 79abcc2e939afcf9775fa0cae7d8df8e8cf6d65f Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Mon, 22 Oct 2018 12:23:40 +0300 Subject: [PATCH 159/674] platform/mellanox: disable btl-uct by default (cherry picked from commit 074e9cc92c79e6b9f8c492b2613eac3f27e1c522) Signed-off-by: Andrey Maslennikov --- contrib/platform/mellanox/optimized | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/platform/mellanox/optimized b/contrib/platform/mellanox/optimized index 339518e483e..f49a0576c64 100644 --- a/contrib/platform/mellanox/optimized +++ b/contrib/platform/mellanox/optimized @@ -1,4 +1,4 @@ -enable_mca_no_build=coll-ml +enable_mca_no_build=coll-ml,btl-uct enable_debug_symbols=yes enable_orterun_prefix_by_default=yes with_verbs=no From 270ae73611bab480f322a581e417f75104a3539b Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Sun, 21 Oct 2018 18:52:52 -0600 Subject: [PATCH 160/674] btl/uct: update for UCT_CB_FLAG_SYNC removal Signed-off-by: Nathan Hjelm (cherry picked from commit 1b37328ba8e8cbd30a5dcdae8332dc879aea48d7) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct_tl.c | 12 +++++++++--- opal/mca/btl/uct/configure.m4 | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index 721015fb2a5..0c8f27d9234 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -16,6 +16,12 @@ #include "opal/util/bit_ops.h" #include "opal/util/argv.h" +#if HAVE_DECL_UCT_CB_FLAG_SYNC +#define MCA_BTL_UCT_CB_FLAG_SYNC UCT_CB_FLAG_SYNC +#else +#define MCA_BTL_UCT_CB_FLAG_SYNC 0 +#endif + /** * @brief Convert UCT capabilities to BTL flags */ @@ -318,9 +324,9 @@ mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t * } if (context_id > 0 && tl == module->am_tl) { - BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); - uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, - context, UCT_CB_FLAG_SYNC); + BTL_VERBOSE(("installing AM handler for tl %p context id %d", (void *) tl, context_id)); + uct_iface_set_am_handler (context->uct_iface, MCA_BTL_UCT_FRAG, mca_btl_uct_am_handler, + context, MCA_BTL_UCT_CB_FLAG_SYNC); } if (enable_progress) { diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index 23deed6c2e6..eae8c6abfc8 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -39,7 +39,7 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $btl_uct_CPPFLAGS" - AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE], [], [], [[#include ]]) + AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE UCT_CB_FLAG_SYNC], [], [], [[#include ]]) CPPFLAGS="$CPPFLAGS_save" OPAL_VAR_SCOPE_POP From 8aae7943ab1da979a15b9f87d3af29a2a61c90c0 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 17 Oct 2018 20:04:17 -0700 Subject: [PATCH 161/674] Provide deprecation warning of MPIR debugger If we detect that we are being debugged by an MPIR-based debugger, then print a warning that OMPI's MPIR support has been deprecated and will be removed in a subsequent release. Signed-off-by: Ralph Castain Signed-off-by: Jeff Squyres (cherry picked from commit 2cb271716beae08b5e5e20f30a5a2fe3e5c50c5e) --- orte/orted/help-orted.txt | 20 ++++++++++++++++- orte/orted/orted_submit.c | 46 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/orte/orted/help-orted.txt b/orte/orted/help-orted.txt index fa7e25b487b..2f390d067a2 100644 --- a/orte/orted/help-orted.txt +++ b/orte/orted/help-orted.txt @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -89,3 +89,21 @@ to it - please check the connection info and ensure the server is alive: Connection: %s +# +[mpir-debugger-detected] +Open MPI has detected that you have attached a debugger to this MPI +job, and that debugger is using the legacy "MPIR" method of +attachment. + +Please note that Open MPI has deprecated the "MPIR" debugger +attachment method in favor of the new "PMIx" debugger attchment +mechanisms. + +*** This means that future versions of Open MPI may not support the +*** "MPIR" debugger attachment method at all. Specifically: the +*** debugger you just attached may not work with future versions of +*** Open MPI. + +You may wish to contact your debugger vendor to inquire about support +for PMIx-based debugger attachment mechanisms. Meantime, you can +disable this warning by setting the OMPI_MPIR_DO_NOT_WARN envar to 1. diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index f835db4ae2f..92ba83988be 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -2257,6 +2257,8 @@ struct MPIR_PROCDESC { * spawn we need to check if we are being run under a TotalView-like * debugger; if so then inform applications via an MCA parameter. */ +static bool mpir_warning_printed = false; + static void orte_debugger_init_before_spawn(orte_job_t *jdata) { char *env_name; @@ -2305,6 +2307,15 @@ static void orte_debugger_init_before_spawn(orte_job_t *jdata) launchit: opal_output_verbose(1, orte_debug_output, "Info: Spawned by a debugger"); + /* if we haven't previously warned about it */ + if (!mpir_warning_printed) { + mpir_warning_printed = true; + /* check for silencing envar */ + if (NULL == getenv("OMPI_MPIR_DO_NOT_WARN")) { + orte_show_help("help-orted.txt", "mpir-debugger-detected", true); + } + } + /* tell the procs they are being debugged */ (void) mca_base_var_env_name ("orte_in_parallel_debugger", &env_name); @@ -2518,6 +2529,14 @@ void orte_debugger_init_after_spawn(int fd, short event, void *cbdata) if (MPIR_being_debugged || NULL != orte_debugger_test_daemon || NULL != getenv("ORTE_TEST_DEBUGGER_ATTACH")) { OBJ_RELEASE(caddy); + /* if we haven't previously warned about it */ + if (!mpir_warning_printed) { + mpir_warning_printed = true; + /* check for silencing envar */ + if (NULL == getenv("OMPI_MPIR_DO_NOT_WARN")) { + orte_show_help("help-orted.txt", "mpir-debugger-detected", true); + } + } if (!mpir_breakpoint_fired) { /* record that we have triggered the debugger */ mpir_breakpoint_fired = true; @@ -2613,6 +2632,15 @@ void orte_debugger_init_after_spawn(int fd, short event, void *cbdata) */ if (MPIR_being_debugged || NULL != orte_debugger_test_daemon || NULL != getenv("ORTE_TEST_DEBUGGER_ATTACH")) { + /* if we haven't previously warned about it */ + if (!mpir_warning_printed) { + mpir_warning_printed = true; + /* check for silencing envar */ + if (NULL == getenv("OMPI_MPIR_DO_NOT_WARN")) { + orte_show_help("help-orted.txt", "mpir-debugger-detected", true); + } + } + /* if we are not launching debugger daemons, then trigger * the debugger - otherwise, we need to wait for the debugger * daemons to be started @@ -2921,6 +2949,15 @@ static void attach_debugger(int fd, short event, void *arg) "%s Attaching debugger %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (NULL == orte_debugger_test_daemon) ? MPIR_executable_path : orte_debugger_test_daemon); + /* if we haven't previously warned about it */ + if (!mpir_warning_printed) { + mpir_warning_printed = true; + /* check for silencing envar */ + if (NULL == getenv("OMPI_MPIR_DO_NOT_WARN")) { + orte_show_help("help-orted.txt", "mpir-debugger-detected", true); + } + } + /* a debugger has attached! All the MPIR_Proctable * data is already available, so we only need to * check to see if we should spawn any daemons @@ -3036,6 +3073,15 @@ static void run_debugger(char *basename, opal_cmd_line_t *cmd_line, free(env_name); } + /* if we haven't previously warned about it */ + if (!mpir_warning_printed) { + mpir_warning_printed = true; + /* check for silencing envar */ + if (NULL == getenv("OMPI_MPIR_DO_NOT_WARN")) { + orte_show_help("help-orted.txt", "mpir-debugger-detected", true); + } + } + /* Launch the debugger */ execvp(new_argv[0], new_argv); value = opal_argv_join(new_argv, ' '); From 40a1f0c214f7aba5e9ade2141ebd9d4a5fe4a9f3 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 26 Oct 2018 15:26:21 +0900 Subject: [PATCH 162/674] event/external: misc configury fixes - Always use the external component when configure'd with --with-libevent=external - Fix the external libevent library version detection by testing _EVENT_NUMERIC_VERSION and EVENT__NUMERIC_VERSION macros - Use the event2/event.h header (event.h is deprecated since libevent 2.0 Signed-off-by: Gilles Gouaillardet (cherry picked from commit 35e77a286c369c1be66ee7ef9ad5ec2faef47edb) --- opal/mca/event/external/configure.m4 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 232f149abbd..150ffac97f7 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -58,16 +58,8 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ OPAL_VAR_SCOPE_PUSH([opal_event_external_CPPFLAGS_save opal_event_external_CFLAGS_save opal_event_external_LDFLAGS_save opal_event_external_LIBS_save opal_event_dir opal_event_summary_msg]) - # Make some processing below easier ($with_libevent==yes and - # $with_libevent==no has already been filtered out). - AS_IF([test "$with_libevent" = "external"], - [with_libevent=]) - opal_event_summary_msg="internal" - # Once we get to this point, $with_libevent is either: blank, a - # directory location, or "internal". - # Check the value of $with_libevent_libdir. This macro safely # handles "yes", "no", blank, and directory name values. OPAL_CHECK_WITHDIR([libevent-libdir], [$with_libevent_libdir], @@ -83,7 +75,7 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ [opal_event_dir=$with_libevent AC_MSG_RESULT([$opal_event_dir]) OPAL_CHECK_WITHDIR([libevent], [$opal_event_dir], - [include/event.h]) + [include/event2/event.h]) AS_IF([test -z "$with_libevent_libdir" || test "$with_libevent_libdir" = "yes"], [AC_MSG_CHECKING([for $with_libevent/lib64]) AS_IF([test -d "$with_libevent/lib64"], @@ -114,7 +106,7 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ opal_event_external_LIBS_save=$LIBS OPAL_CHECK_PACKAGE([opal_event_external], - [event.h], + [event2/event.h], [event], [event_config_new], [-levent_pthreads], From 7f36dce3482ca96ebb360818ca20c4aed605c6f3 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 29 Oct 2018 10:07:56 +0900 Subject: [PATCH 163/674] event/external: fix version requirement Only default to the external component if its version is greater or equal than the internal libevent (2.0.22) Signed-off-by: Gilles Gouaillardet (cherry picked from commit b2050392051ed3d9d842f105326f7ea2223aafc4) --- opal/mca/event/external/configure.m4 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 150ffac97f7..15313db50a3 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -137,18 +137,20 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ AS_IF([test "$opal_event_external_support" = "yes"], [AS_IF([test -z "$with_libevent" || test "$with_libevent" = "yes"], - [AC_MSG_CHECKING([if external libevent version is 2.0.21 or greater]) + [AC_MSG_CHECKING([if external libevent version is 2.0.22 or greater]) AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], + [AC_LANG_PROGRAM([[#include ]], [[ -#if _EVENT_NUMERIC_VERSION < 0x02001500 -#error "libevent API version is less than 0x02001500" +#if defined(_EVENT_NUMERIC_VERSION) && _EVENT_NUMERIC_VERSION < 0x02001600 +#error "libevent API version is less than 0x02001600" +#elif defined(EVENT__NUMERIC_VERSION) && EVENT__NUMERIC_VERSION < 0x02001600 +#error "libevent API version is less than 0x02001600" #endif ]])], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) - opal_event_summary_msg="internal (external libevent version is less that internal version 2.0.21)" - AC_MSG_WARN([external libevent version is less than internal version (2.0.21)]) + opal_event_summary_msg="internal (external libevent version is less that internal version 2.0.22)" + AC_MSG_WARN([external libevent version is less than internal version (2.0.22)]) AC_MSG_WARN([using internal libevent]) opal_event_external_support=no])])]) From 712ddd326f93af95e72721bcb45d6e12e4f99d67 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 17 Oct 2018 15:11:38 -0700 Subject: [PATCH 164/674] Remove the stale orte-dvm code Users should migrate to https://github.com/pmix/prrte Signed-off-by: Ralph Castain (cherry picked from commit 1bd772e8ebf66f705537b9a6e1af2b6093ef8471) --- config/opal_check_pmi.m4 | 4 - config/orte_config_files.m4 | 2 - ompi/mca/rte/orte/Makefile.am | 19 +- orte/mca/errmgr/dvm/Makefile.am | 37 - orte/mca/errmgr/dvm/errmgr_dvm.c | 632 -------- orte/mca/errmgr/dvm/errmgr_dvm.h | 39 - orte/mca/errmgr/dvm/errmgr_dvm_component.c | 102 -- orte/mca/errmgr/dvm/owner.txt | 7 - orte/mca/state/dvm/Makefile.am | 36 - orte/mca/state/dvm/owner.txt | 7 - orte/mca/state/dvm/state_dvm.c | 688 --------- orte/mca/state/dvm/state_dvm.h | 35 - orte/mca/state/dvm/state_dvm_component.c | 83 - orte/tools/Makefile.am | 10 +- orte/tools/ompi-prun/Makefile.am | 59 - orte/tools/ompi-prun/main.c | 33 - orte/tools/ompi-prun/ompi-prun.1in | 1597 -------------------- orte/tools/ompi-prun/prun | 228 --- orte/tools/ompi-prun/prun.1 | 1597 -------------------- orte/tools/ompi-prun/prun.c | 1373 ----------------- orte/tools/ompi-prun/prun.h | 37 - orte/tools/orte-dvm/Makefile.am | 57 - orte/tools/orte-dvm/orte-dvm.1in | 193 --- orte/tools/orte-dvm/orte-dvm.c | 482 ------ 24 files changed, 2 insertions(+), 7355 deletions(-) delete mode 100644 orte/mca/errmgr/dvm/Makefile.am delete mode 100644 orte/mca/errmgr/dvm/errmgr_dvm.c delete mode 100644 orte/mca/errmgr/dvm/errmgr_dvm.h delete mode 100644 orte/mca/errmgr/dvm/errmgr_dvm_component.c delete mode 100644 orte/mca/errmgr/dvm/owner.txt delete mode 100644 orte/mca/state/dvm/Makefile.am delete mode 100644 orte/mca/state/dvm/owner.txt delete mode 100644 orte/mca/state/dvm/state_dvm.c delete mode 100644 orte/mca/state/dvm/state_dvm.h delete mode 100644 orte/mca/state/dvm/state_dvm_component.c delete mode 100644 orte/tools/ompi-prun/Makefile.am delete mode 100644 orte/tools/ompi-prun/main.c delete mode 100644 orte/tools/ompi-prun/ompi-prun.1in delete mode 100755 orte/tools/ompi-prun/prun delete mode 100644 orte/tools/ompi-prun/prun.1 delete mode 100644 orte/tools/ompi-prun/prun.c delete mode 100644 orte/tools/ompi-prun/prun.h delete mode 100644 orte/tools/orte-dvm/Makefile.am delete mode 100644 orte/tools/orte-dvm/orte-dvm.1in delete mode 100644 orte/tools/orte-dvm/orte-dvm.c diff --git a/config/opal_check_pmi.m4 b/config/opal_check_pmi.m4 index dfbdfdeed4f..042bdcc6969 100644 --- a/config/opal_check_pmi.m4 +++ b/config/opal_check_pmi.m4 @@ -248,14 +248,12 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AC_MSG_ERROR([Cannot continue])]) AC_MSG_CHECKING([if user requested internal PMIx support($with_pmix)]) - opal_prun_happy=no opal_external_pmix_happy=no opal_external_have_pmix1=0 AS_IF([test "$with_pmix" = "internal"], [AC_MSG_RESULT([yes]) opal_external_pmix_happy=no - opal_prun_happy=yes opal_external_pmix_version=internal], [AC_MSG_RESULT([no]) @@ -362,7 +360,6 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ [AC_MSG_RESULT([found]) opal_external_pmix_version=2x opal_external_pmix_version_found=1 - opal_prun_happy=yes opal_external_pmix_happy=yes], [AC_MSG_RESULT([not found])])]) @@ -422,7 +419,6 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AC_DEFINE_UNQUOTED([OPAL_PMIX_V1],[$opal_external_have_pmix1], [Whether the external PMIx library is v1]) - AM_CONDITIONAL([OPAL_WANT_PRUN], [test "$opal_prun_happy" = "yes"]) AS_IF([test "$opal_external_pmix_happy" = "yes"], [AS_IF([test "$opal_external_pmix_version" = "1x"], diff --git a/config/orte_config_files.m4 b/config/orte_config_files.m4 index 82a7f7f8246..b0f79dbb66f 100644 --- a/config/orte_config_files.m4 +++ b/config/orte_config_files.m4 @@ -30,7 +30,5 @@ AC_DEFUN([ORTE_CONFIG_FILES],[ orte/tools/orte-top/Makefile orte/tools/orte-info/Makefile orte/tools/orte-server/Makefile - orte/tools/orte-dvm/Makefile - orte/tools/ompi-prun/Makefile ]) ]) diff --git a/ompi/mca/rte/orte/Makefile.am b/ompi/mca/rte/orte/Makefile.am index 451436373b3..30dd21b14da 100644 --- a/ompi/mca/rte/orte/Makefile.am +++ b/ompi/mca/rte/orte/Makefile.am @@ -2,7 +2,7 @@ # Copyright (c) 2012 Los Alamos National Security, LLC. # All rights reserved. # Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2016-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -30,12 +30,6 @@ libmca_rte_orte_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la man_pages = mpirun.1 mpiexec.1 ompi-ps.1 ompi-clean.1 ompi-top.1 ompi-server.1 -if OPAL_WANT_PRUN -if WANT_INSTALL_HEADERS -man_pages += ompi-dvm.1 -endif -endif - if OPAL_INSTALL_BINARIES nodist_man_MANS = $(man_pages) @@ -46,9 +40,6 @@ install-exec-hook: (cd $(DESTDIR)$(bindir); rm -f ompi-clean$(EXEEXT); $(LN_S) orte-clean$(EXEEXT) ompi-clean$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f ompi-top$(EXEEXT); $(LN_S) orte-top$(EXEEXT) ompi-top$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f ompi-server$(EXEEXT); $(LN_S) orte-server$(EXEEXT) ompi-server$(EXEEXT)) -if OPAL_WANT_PRUN - (cd $(DESTDIR)$(bindir); rm -f ompi-dvm$(EXEEXT); $(LN_S) orte-dvm$(EXEEXT) ompi-dvm$(EXEEXT)) -endif uninstall-local: rm -f $(DESTDIR)$(bindir)/mpirun$(EXEEXT) \ @@ -57,9 +48,6 @@ uninstall-local: $(DESTDIR)$(bindir)/ompi-clean$(EXEEXT) \ $(DESTDIR)$(bindir)/ompi-top$(EXEEXT) \ $(DESTDIR)$(bindir)/ompi-server$(EXEEXT) -if OPAL_WANT_PRUN - rm -f $(DESTDIR)$(bindir)/ompi-dvm$(EXEEXT) -endif endif # OPAL_INSTALL_BINARIES @@ -96,10 +84,5 @@ $(top_builddir)/orte/tools/orte-server/orte-server.1: ompi-server.1: $(top_builddir)/orte/tools/orte-server/orte-server.1 cp -f $(top_builddir)/orte/tools/orte-server/orte-server.1 ompi-server.1 -if OPAL_WANT_PRUN -ompi-dvm.1: $(top_builddir)/orte/tools/orte-dvm/orte-dvm.1 - cp -f $(top_builddir)/orte/tools/orte-dvm/orte-dvm.1 ompi-dvm.1 -endif - clean-local: rm -f $(man_pages) diff --git a/orte/mca/errmgr/dvm/Makefile.am b/orte/mca/errmgr/dvm/Makefile.am deleted file mode 100644 index 43fbe76550d..00000000000 --- a/orte/mca/errmgr/dvm/Makefile.am +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - errmgr_dvm.h \ - errmgr_dvm_component.c \ - errmgr_dvm.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_errmgr_dvm_DSO -component_noinst = -component_install = mca_errmgr_dvm.la -else -component_noinst = libmca_errmgr_dvm.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_errmgr_dvm_la_SOURCES = $(sources) -mca_errmgr_dvm_la_LDFLAGS = -module -avoid-version -mca_errmgr_dvm_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_errmgr_dvm_la_SOURCES =$(sources) -libmca_errmgr_dvm_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/errmgr/dvm/errmgr_dvm.c b/orte/mca/errmgr/dvm/errmgr_dvm.c deleted file mode 100644 index f259da2321c..00000000000 --- a/orte/mca/errmgr/dvm/errmgr_dvm.c +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright (c) 2009-2011 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2010-2017 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2011 Oracle and/or all its affiliates. All rights reserved. - * Copyright (c) 2011-2013 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2017 IBM Corporation. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#ifdef HAVE_SYS_WAIT_H -#include -#endif - -#include "opal/util/output.h" -#include "opal/dss/dss.h" - -#include "orte/mca/iof/base/base.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/odls/odls.h" -#include "orte/mca/odls/base/base.h" -#include "orte/mca/odls/base/odls_private.h" -#include "orte/mca/plm/base/plm_private.h" -#include "orte/mca/plm/plm.h" -#include "orte/mca/rmaps/rmaps_types.h" -#include "orte/mca/routed/routed.h" -#include "orte/mca/grpcomm/grpcomm.h" -#include "orte/mca/ess/ess.h" -#include "orte/mca/state/state.h" - -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" -#include "orte/util/proc_info.h" -#include "orte/util/show_help.h" -#include "orte/util/threads.h" - -#include "orte/runtime/orte_globals.h" -#include "orte/runtime/orte_locks.h" -#include "orte/runtime/orte_quit.h" -#include "orte/runtime/data_type_support/orte_dt_support.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/errmgr/base/base.h" -#include "orte/mca/errmgr/base/errmgr_private.h" - -#include "errmgr_dvm.h" - -static int init(void); -static int finalize(void); - -/****************** - * dvm module - ******************/ -orte_errmgr_base_module_t orte_errmgr_dvm_module = { - .init = init, - .finalize = finalize, - .logfn = orte_errmgr_base_log, - .abort = orte_errmgr_base_abort, - .abort_peers = orte_errmgr_base_abort_peers -}; - - -/* - * Local functions - */ -static void job_errors(int fd, short args, void *cbdata); -static void proc_errors(int fd, short args, void *cbdata); - -static int init(void) -{ - /* setup state machine to trap job errors */ - orte_state.add_job_state(ORTE_JOB_STATE_ERROR, job_errors, ORTE_ERROR_PRI); - - /* set the lost connection state to run at MSG priority so - * we can process any last messages from the proc - */ - orte_state.add_proc_state(ORTE_PROC_STATE_COMM_FAILED, proc_errors, ORTE_MSG_PRI); - - /* setup state machine to trap proc errors */ - orte_state.add_proc_state(ORTE_PROC_STATE_ERROR, proc_errors, ORTE_ERROR_PRI); - - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - return ORTE_SUCCESS; -} - -static void _terminate_job(orte_jobid_t jobid) -{ - opal_pointer_array_t procs; - orte_proc_t pobj; - - OBJ_CONSTRUCT(&procs, opal_pointer_array_t); - opal_pointer_array_init(&procs, 1, 1, 1); - OBJ_CONSTRUCT(&pobj, orte_proc_t); - pobj.name.jobid = jobid; - pobj.name.vpid = ORTE_VPID_WILDCARD; - opal_pointer_array_add(&procs, &pobj); - orte_plm.terminate_procs(&procs); - OBJ_DESTRUCT(&procs); - OBJ_DESTRUCT(&pobj); -} - -static void job_errors(int fd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - orte_job_t *jdata; - orte_job_state_t jobstate; - opal_buffer_t *answer; - int32_t rc, ret; - int room, *rmptr; - - ORTE_ACQUIRE_OBJECT(caddy); - - /* - * if orte is trying to shutdown, just let it - */ - if (orte_finalizing) { - return; - } - - /* if the jdata is NULL, then we ignore it as this - * is reporting an unrecoverable error - */ - if (NULL == caddy->jdata) { - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - OBJ_RELEASE(caddy); - return; - } - - /* update the state */ - jdata = caddy->jdata; - jobstate = caddy->job_state; - jdata->state = jobstate; - - OPAL_OUTPUT_VERBOSE((1, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: job %s reported state %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_JOBID_PRINT(jdata->jobid), - orte_job_state_to_str(jobstate))); - - if (jdata->jobid == ORTE_PROC_MY_NAME->jobid) { - /* if the daemon job aborted and we haven't heard from everyone yet, - * then this could well have been caused by a daemon not finding - * a way back to us. In this case, output a message indicating a daemon - * died without reporting. Otherwise, say nothing as we - * likely already output an error message */ - if (ORTE_JOB_STATE_ABORTED == jobstate && - jdata->num_procs != jdata->num_reported) { - orte_routing_is_enabled = false; - orte_show_help("help-errmgr-base.txt", "failed-daemon", true); - } - /* there really isn't much else we can do since the problem - * is in the DVM itself, so best just to terminate */ - jdata->num_terminated = jdata->num_procs; - /* activate the terminated state so we can exit */ - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_TERMINATED); - OBJ_RELEASE(caddy); - return; - } - - /* all other cases involve jobs submitted to the DVM - therefore, - * we only inform the submitter of the problem, but do NOT terminate - * the DVM itself */ - - rc = jobstate; - answer = OBJ_NEW(opal_buffer_t); - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &rc, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(caddy); - return; - } - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &jdata->jobid, 1, ORTE_JOBID))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(caddy); - return; - } - /* pack the room number */ - rmptr = &room; - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_ROOM_NUM, (void**)&rmptr, OPAL_INT)) { - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &room, 1, OPAL_INT))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(caddy); - return; - } - } - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm sending notification of job %s failure to %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_JOBID_PRINT(jdata->jobid), - ORTE_NAME_PRINT(&jdata->originator))); - if (0 > (ret = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &jdata->originator, answer, - ORTE_RML_TAG_LAUNCH_RESP, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(answer); - } - /* ensure we terminate any processes left running in the DVM */ - _terminate_job(jdata->jobid); - - /* cleanup */ - OBJ_RELEASE(caddy); -} - -static void proc_errors(int fd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - orte_job_t *jdata; - orte_proc_t *pptr, *proct; - orte_process_name_t *proc = &caddy->name; - orte_proc_state_t state = caddy->proc_state; - int i; - int32_t i32, *i32ptr; - char *rtmod; - - ORTE_ACQUIRE_OBJECT(caddy); - - OPAL_OUTPUT_VERBOSE((1, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: for proc %s state %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc), - orte_proc_state_to_str(state))); - - /* - * if orte is trying to shutdown, just let it - */ - if (orte_finalizing) { - goto cleanup; - } - - /* get the job object */ - if (NULL == (jdata = orte_get_job_data_object(proc->jobid))) { - /* could be a race condition */ - goto cleanup; - } - pptr = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, proc->vpid); - - /* get the management conduit's routed module */ - rtmod = orte_rml.get_routed(orte_mgmt_conduit); - - /* we MUST handle a communication failure before doing anything else - * as it requires some special care to avoid normal termination issues - * for local application procs - */ - if (ORTE_PROC_STATE_COMM_FAILED == state) { - /* is this to a daemon? */ - if (ORTE_PROC_MY_NAME->jobid != proc->jobid) { - /* nope - ignore it */ - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure to non-daemon proc - ignoring it", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - goto cleanup; - } - /* if this is my own connection, ignore it */ - if (ORTE_PROC_MY_NAME->vpid == proc->vpid) { - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure on my own connection - ignoring it", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - goto cleanup; - } - /* mark the daemon as gone */ - ORTE_FLAG_UNSET(pptr, ORTE_PROC_FLAG_ALIVE); - /* update the state */ - pptr->state = state; - /* adjust our num_procs */ - --orte_process_info.num_procs; - /* if we have ordered orteds to terminate or abort - * is in progress, record it */ - if (orte_orteds_term_ordered || orte_abnormal_term_ordered) { - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure: daemons terminating - recording daemon %s as gone", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(proc))); - /* remove from dependent routes, if it is one */ - orte_routed.route_lost(rtmod, proc); - /* if all my routes and local children are gone, then terminate ourselves */ - if (0 == orte_routed.num_routes(rtmod)) { - for (i=0; i < orte_local_children->size; i++) { - if (NULL != (proct = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, i)) && - ORTE_FLAG_TEST(pptr, ORTE_PROC_FLAG_ALIVE) && proct->state < ORTE_PROC_STATE_UNTERMINATED) { - /* at least one is still alive */ - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure: at least one proc (%s) still alive", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&proct->name))); - goto cleanup; - } - } - /* call our appropriate exit procedure */ - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr_dvm: all routes and children gone - ordering exit", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - ORTE_ACTIVATE_JOB_STATE(NULL, ORTE_JOB_STATE_DAEMONS_TERMINATED); - } else { - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure: %d routes remain alive", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (int)orte_routed.num_routes(rtmod))); - } - goto cleanup; - } - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s Comm failure: daemon %s - aborting", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(proc))); - /* record the first one to fail */ - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - /* output an error message so the user knows what happened */ - orte_show_help("help-errmgr-base.txt", "node-died", true, - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_process_info.nodename, - ORTE_NAME_PRINT(proc), - pptr->node->name); - /* mark the daemon job as failed */ - jdata->state = ORTE_JOB_STATE_COMM_FAILED; - /* point to the lowest rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - /* update our exit code */ - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* just in case the exit code hadn't been set, do it here - this - * won't override any reported exit code */ - ORTE_UPDATE_EXIT_STATUS(ORTE_ERR_COMM_FAILURE); - } - goto cleanup; - } - - /* update the proc state - can get multiple reports on a proc - * depending on circumstances, so ensure we only do this once - */ - if (pptr->state < ORTE_PROC_STATE_TERMINATED) { - pptr->state = state; - } - - /* if we were ordered to terminate, mark this proc as dead and see if - * any of our routes or local children remain alive - if not, then - * terminate ourselves. */ - if (orte_orteds_term_ordered) { - for (i=0; i < orte_local_children->size; i++) { - if (NULL != (proct = (orte_proc_t*)opal_pointer_array_get_item(orte_local_children, i))) { - if (ORTE_FLAG_TEST(proct, ORTE_PROC_FLAG_ALIVE)) { - goto keep_going; - } - } - } - /* if all my routes and children are gone, then terminate - ourselves nicely (i.e., this is a normal termination) */ - if (0 == orte_routed.num_routes(rtmod)) { - OPAL_OUTPUT_VERBOSE((2, orte_errmgr_base_framework.framework_output, - "%s errmgr:default:dvm all routes gone - exiting", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - ORTE_ACTIVATE_JOB_STATE(NULL, ORTE_JOB_STATE_DAEMONS_TERMINATED); - } - } - - keep_going: - /* ensure we record the failed proc properly so we can report - * the error once we terminate - */ - switch (state) { - case ORTE_PROC_STATE_KILLED_BY_CMD: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s killed by cmd", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - /* we ordered this proc to die, so it isn't an abnormal termination - * and we don't flag it as such - */ - if (jdata->num_terminated >= jdata->num_procs) { - /* this job has terminated */ - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_TERMINATED); - } - /* don't abort the job as this isn't an abnormal termination */ - break; - - case ORTE_PROC_STATE_ABORTED: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s aborted", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_ABORTED; - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* kill the job */ - _terminate_job(jdata->jobid); - } - break; - - case ORTE_PROC_STATE_ABORTED_BY_SIG: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s aborted by signal", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_ABORTED_BY_SIG; - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* kill the job */ - _terminate_job(jdata->jobid); - } - break; - - case ORTE_PROC_STATE_TERM_WO_SYNC: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s terminated without sync", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_ABORTED_WO_SYNC; - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* now treat a special case - if the proc exit'd without a required - * sync, it may have done so with a zero exit code. We want to ensure - * that the user realizes there was an error, so in this -one- case, - * we overwrite the process' exit code with the default error code - */ - ORTE_UPDATE_EXIT_STATUS(ORTE_ERROR_DEFAULT_EXIT_CODE); - /* kill the job */ - _terminate_job(jdata->jobid); - } - break; - - case ORTE_PROC_STATE_FAILED_TO_START: - case ORTE_PROC_STATE_FAILED_TO_LAUNCH: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc), - orte_proc_state_to_str(state))); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - opal_buffer_t *answer; - int id, *idptr, ret; - - if (ORTE_PROC_STATE_FAILED_TO_START) { - jdata->state = ORTE_JOB_STATE_FAILED_TO_START; - } else { - jdata->state = ORTE_JOB_STATE_FAILED_TO_LAUNCH; - } - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - /* send a notification to the requestor - indicate that this is a spawn response */ - answer = OBJ_NEW(opal_buffer_t); - /* pack the return status */ - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &pptr->exit_code, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(answer); - goto CLEANUP; - } - /* pack the jobid to be returned */ - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, &jdata->jobid, 1, ORTE_JOBID))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(answer); - goto CLEANUP; - } - idptr = &id; - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_ROOM_NUM, (void**)&idptr, OPAL_INT)) { - /* pack the sender's index to the tracking object */ - if (ORTE_SUCCESS != (ret = opal_dss.pack(answer, idptr, 1, OPAL_INT))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(answer); - goto CLEANUP; - } - } - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_FIXED_DVM, NULL, OPAL_BOOL)) { - /* we need to send the requestor more info about what happened */ - opal_dss.pack(answer, &jdata->state, 1, ORTE_JOB_STATE_T); - opal_dss.pack(answer, &pptr, 1, ORTE_PROC); - opal_dss.pack(answer, &pptr->node, 1, ORTE_NODE); - } - /* return response */ - if (0 > (ret = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &jdata->originator, answer, - ORTE_RML_TAG_LAUNCH_RESP, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(answer); - } - /* record that we notified about this job */ - jdata->state = ORTE_JOB_STATE_NOTIFIED; - CLEANUP: - /* kill the job */ - _terminate_job(jdata->jobid); - } - /* if this was a daemon, report it */ - if (jdata->jobid == ORTE_PROC_MY_NAME->jobid) { - /* output a message indicating we failed to launch a daemon */ - orte_show_help("help-errmgr-base.txt", "failed-daemon-launch", true); - } - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_TERMINATED); - break; - - case ORTE_PROC_STATE_CALLED_ABORT: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s called abort with exit code %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc), pptr->exit_code)); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_CALLED_ABORT; - /* point to the first proc to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* kill the job */ - _terminate_job(jdata->jobid); - } - break; - - case ORTE_PROC_STATE_TERM_NON_ZERO: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s exited with non-zero status %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc), - pptr->exit_code)); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* track the number of non-zero exits */ - i32 = 0; - i32ptr = &i32; - orte_get_attribute(&jdata->attributes, ORTE_JOB_NUM_NONZERO_EXIT, (void**)&i32ptr, OPAL_INT32); - ++i32; - orte_set_attribute(&jdata->attributes, ORTE_JOB_NUM_NONZERO_EXIT, ORTE_ATTR_LOCAL, i32ptr, OPAL_INT32); - if (orte_abort_non_zero_exit) { - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_NON_ZERO_TERM; - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - /* kill the job */ - _terminate_job(jdata->jobid); - } - } else { - /* user requested we consider this normal termination */ - if (jdata->num_terminated >= jdata->num_procs) { - /* this job has terminated */ - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_TERMINATED); - } - } - break; - - case ORTE_PROC_STATE_HEARTBEAT_FAILED: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s heartbeat failed", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_ABORTED)) { - jdata->state = ORTE_JOB_STATE_HEARTBEAT_FAILED; - /* point to the first rank to cause the problem */ - orte_set_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, ORTE_ATTR_LOCAL, pptr, OPAL_PTR); - /* retain the object so it doesn't get free'd */ - OBJ_RETAIN(pptr); - ORTE_FLAG_SET(jdata, ORTE_JOB_FLAG_ABORTED); - ORTE_UPDATE_EXIT_STATUS(pptr->exit_code); - /* kill the job */ - _terminate_job(jdata->jobid); - } - /* remove from dependent routes, if it is one */ - orte_routed.route_lost(rtmod, proc); - break; - - case ORTE_PROC_STATE_UNABLE_TO_SEND_MSG: - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: unable to send message to proc %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - /* if this proc is one of my daemons, then we are truly - * hosed - so just exit out - */ - if (ORTE_PROC_MY_NAME->jobid == proc->jobid) { - ORTE_ACTIVATE_JOB_STATE(NULL, ORTE_JOB_STATE_DAEMONS_TERMINATED); - break; - } - break; - - default: - /* shouldn't get this, but terminate job if required */ - OPAL_OUTPUT_VERBOSE((5, orte_errmgr_base_framework.framework_output, - "%s errmgr:dvm: proc %s default error %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc), - orte_proc_state_to_str(state))); - if (jdata->num_terminated == jdata->num_procs) { - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_TERMINATED); - } - break; - } - /* if the waitpid fired, be sure to let the state machine know */ - if (ORTE_FLAG_TEST(pptr, ORTE_PROC_FLAG_WAITPID)) { - ORTE_ACTIVATE_PROC_STATE(&pptr->name, ORTE_PROC_STATE_WAITPID_FIRED); - } - - cleanup: - OBJ_RELEASE(caddy); -} diff --git a/orte/mca/errmgr/dvm/errmgr_dvm.h b/orte/mca/errmgr/dvm/errmgr_dvm.h deleted file mode 100644 index 291394d9a56..00000000000 --- a/orte/mca/errmgr/dvm/errmgr_dvm.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - */ - -#ifndef MCA_ERRMGR_dvm_EXPORT_H -#define MCA_ERRMGR_dvm_EXPORT_H - -#include "orte_config.h" - -#include "orte/mca/errmgr/errmgr.h" - -BEGIN_C_DECLS - -/* - * Local Component structures - */ - -ORTE_MODULE_DECLSPEC extern orte_errmgr_base_component_t mca_errmgr_dvm_component; - -ORTE_DECLSPEC extern orte_errmgr_base_module_t orte_errmgr_dvm_module; - -END_C_DECLS - -#endif /* MCA_ERRMGR_dvm_EXPORT_H */ diff --git a/orte/mca/errmgr/dvm/errmgr_dvm_component.c b/orte/mca/errmgr/dvm/errmgr_dvm_component.c deleted file mode 100644 index 879062893bf..00000000000 --- a/orte/mca/errmgr/dvm/errmgr_dvm_component.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "opal/util/output.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/errmgr/base/base.h" -#include "orte/mca/errmgr/base/errmgr_private.h" -#include "errmgr_dvm.h" - -/* - * Public string for version number - */ -const char *orte_errmgr_dvm_component_version_string = - "ORTE ERRMGR dvm MCA component version " ORTE_VERSION; - -/* - * Local functionality - */ -static int dvm_register(void); -static int dvm_open(void); -static int dvm_close(void); -static int dvm_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -orte_errmgr_base_component_t mca_errmgr_dvm_component = { - /* Handle the general mca_component_t struct containing - * meta information about the component dvm - */ - .base_version = { - ORTE_ERRMGR_BASE_VERSION_3_0_0, - /* Component name and version */ - .mca_component_name = "dvm", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = dvm_open, - .mca_close_component = dvm_close, - .mca_query_component = dvm_component_query, - .mca_register_component_params = dvm_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int my_priority; - -static int dvm_register(void) -{ - mca_base_component_t *c = &mca_errmgr_dvm_component.base_version; - - my_priority = 1000; - (void) mca_base_component_var_register(c, "priority", - "Priority of the dvm errmgr component", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, &my_priority); - - return ORTE_SUCCESS; -} - -static int dvm_open(void) -{ - return ORTE_SUCCESS; -} - -static int dvm_close(void) -{ - return ORTE_SUCCESS; -} - -static int dvm_component_query(mca_base_module_t **module, int *priority) -{ - /* used by DVM masters */ - if (ORTE_PROC_IS_MASTER) { - *priority = my_priority; - *module = (mca_base_module_t *)&orte_errmgr_dvm_module; - return ORTE_SUCCESS; - } - - *module = NULL; - *priority = -1; - return ORTE_ERROR; -} diff --git a/orte/mca/errmgr/dvm/owner.txt b/orte/mca/errmgr/dvm/owner.txt deleted file mode 100644 index 85b4416d206..00000000000 --- a/orte/mca/errmgr/dvm/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: INTEL -status: active diff --git a/orte/mca/state/dvm/Makefile.am b/orte/mca/state/dvm/Makefile.am deleted file mode 100644 index 6122ab0e7fa..00000000000 --- a/orte/mca/state/dvm/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - state_dvm.h \ - state_dvm_component.c \ - state_dvm.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_state_dvm_DSO -component_noinst = -component_install = mca_state_dvm.la -else -component_noinst = libmca_state_dvm.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_state_dvm_la_SOURCES = $(sources) -mca_state_dvm_la_LDFLAGS = -module -avoid-version -mca_state_dvm_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_state_dvm_la_SOURCES =$(sources) -libmca_state_dvm_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/state/dvm/owner.txt b/orte/mca/state/dvm/owner.txt deleted file mode 100644 index 85b4416d206..00000000000 --- a/orte/mca/state/dvm/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: INTEL -status: active diff --git a/orte/mca/state/dvm/state_dvm.c b/orte/mca/state/dvm/state_dvm.c deleted file mode 100644 index 4d11b21d899..00000000000 --- a/orte/mca/state/dvm/state_dvm.c +++ /dev/null @@ -1,688 +0,0 @@ -/* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include - -#include "opal/util/output.h" -#include "opal/mca/pmix/pmix.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/filem/filem.h" -#include "orte/mca/grpcomm/grpcomm.h" -#include "orte/mca/iof/base/base.h" -#include "orte/mca/odls/odls_types.h" -#include "orte/mca/plm/base/base.h" -#include "orte/mca/ras/base/base.h" -#include "orte/mca/regx/regx.h" -#include "orte/mca/rmaps/base/base.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/rml/base/rml_contact.h" -#include "orte/mca/routed/routed.h" -#include "orte/util/session_dir.h" -#include "orte/util/threads.h" -#include "orte/runtime/orte_quit.h" -#include "orte/runtime/orte_wait.h" - -#include "orte/mca/state/state.h" -#include "orte/mca/state/base/base.h" -#include "orte/mca/state/base/state_private.h" -#include "state_dvm.h" - -/* - * Module functions: Global - */ -static int init(void); -static int finalize(void); - -/* local functions */ -static void init_complete(int fd, short args, void *cbdata); -static void vm_ready(int fd, short args, void *cbata); -static void check_complete(int fd, short args, void *cbdata); -static void cleanup_job(int fd, short args, void *cbdata); - -/****************** - * DVM module - used when mpirun is persistent - ******************/ -orte_state_base_module_t orte_state_dvm_module = { - init, - finalize, - orte_state_base_activate_job_state, - orte_state_base_add_job_state, - orte_state_base_set_job_state_callback, - orte_state_base_set_job_state_priority, - orte_state_base_remove_job_state, - orte_state_base_activate_proc_state, - orte_state_base_add_proc_state, - orte_state_base_set_proc_state_callback, - orte_state_base_set_proc_state_priority, - orte_state_base_remove_proc_state -}; - -static void dvm_notify(int sd, short args, void *cbdata); - -/* defined default state machine sequence - individual - * plm's must add a state for launching daemons - */ -static orte_job_state_t launch_states[] = { - ORTE_JOB_STATE_INIT, - ORTE_JOB_STATE_INIT_COMPLETE, - ORTE_JOB_STATE_ALLOCATE, - ORTE_JOB_STATE_ALLOCATION_COMPLETE, - ORTE_JOB_STATE_DAEMONS_LAUNCHED, - ORTE_JOB_STATE_DAEMONS_REPORTED, - ORTE_JOB_STATE_VM_READY, - ORTE_JOB_STATE_MAP, - ORTE_JOB_STATE_MAP_COMPLETE, - ORTE_JOB_STATE_SYSTEM_PREP, - ORTE_JOB_STATE_LAUNCH_APPS, - ORTE_JOB_STATE_SEND_LAUNCH_MSG, - ORTE_JOB_STATE_LOCAL_LAUNCH_COMPLETE, - ORTE_JOB_STATE_RUNNING, - ORTE_JOB_STATE_REGISTERED, - /* termination states */ - ORTE_JOB_STATE_TERMINATED, - ORTE_JOB_STATE_NOTIFY_COMPLETED, - ORTE_JOB_STATE_NOTIFIED, - ORTE_JOB_STATE_ALL_JOBS_COMPLETE -}; -static orte_state_cbfunc_t launch_callbacks[] = { - orte_plm_base_setup_job, - init_complete, - orte_ras_base_allocate, - orte_plm_base_allocation_complete, - orte_plm_base_daemons_launched, - orte_plm_base_daemons_reported, - vm_ready, - orte_rmaps_base_map_job, - orte_plm_base_mapping_complete, - orte_plm_base_complete_setup, - orte_plm_base_launch_apps, - orte_plm_base_send_launch_msg, - orte_state_base_local_launch_complete, - orte_plm_base_post_launch, - orte_plm_base_registered, - check_complete, - dvm_notify, - cleanup_job, - orte_quit -}; - -static orte_proc_state_t proc_states[] = { - ORTE_PROC_STATE_RUNNING, - ORTE_PROC_STATE_REGISTERED, - ORTE_PROC_STATE_IOF_COMPLETE, - ORTE_PROC_STATE_WAITPID_FIRED, - ORTE_PROC_STATE_TERMINATED -}; -static orte_state_cbfunc_t proc_callbacks[] = { - orte_state_base_track_procs, - orte_state_base_track_procs, - orte_state_base_track_procs, - orte_state_base_track_procs, - orte_state_base_track_procs -}; - -static void force_quit(int fd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - - /* give us a chance to stop the orteds */ - orte_plm.terminate_orteds(); - OBJ_RELEASE(caddy); -} - -/************************ - * API Definitions - ************************/ -static int init(void) -{ - int i, rc; - int num_states; - - /* setup the state machines */ - OBJ_CONSTRUCT(&orte_job_states, opal_list_t); - OBJ_CONSTRUCT(&orte_proc_states, opal_list_t); - - /* setup the job state machine */ - num_states = sizeof(launch_states) / sizeof(orte_job_state_t); - for (i=0; i < num_states; i++) { - if (ORTE_SUCCESS != (rc = orte_state.add_job_state(launch_states[i], - launch_callbacks[i], - ORTE_SYS_PRI))) { - ORTE_ERROR_LOG(rc); - } - } - /* add the termination response */ - if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_DAEMONS_TERMINATED, - orte_quit, ORTE_SYS_PRI))) { - ORTE_ERROR_LOG(rc); - } - /* add a default error response */ - if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_FORCED_EXIT, - force_quit, ORTE_ERROR_PRI))) { - ORTE_ERROR_LOG(rc); - } - /* add callback to report progress, if requested */ - if (ORTE_SUCCESS != (rc = orte_state.add_job_state(ORTE_JOB_STATE_REPORT_PROGRESS, - orte_state_base_report_progress, ORTE_ERROR_PRI))) { - ORTE_ERROR_LOG(rc); - } - if (5 < opal_output_get_verbosity(orte_state_base_framework.framework_output)) { - orte_state_base_print_job_state_machine(); - } - - /* populate the proc state machine to allow us to - * track proc lifecycle changes - */ - num_states = sizeof(proc_states) / sizeof(orte_proc_state_t); - for (i=0; i < num_states; i++) { - if (ORTE_SUCCESS != (rc = orte_state.add_proc_state(proc_states[i], - proc_callbacks[i], - ORTE_SYS_PRI))) { - ORTE_ERROR_LOG(rc); - } - } - if (5 < opal_output_get_verbosity(orte_state_base_framework.framework_output)) { - orte_state_base_print_proc_state_machine(); - } - - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - opal_list_item_t *item; - - /* cleanup the proc state machine */ - while (NULL != (item = opal_list_remove_first(&orte_proc_states))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&orte_proc_states); - - return ORTE_SUCCESS; -} - -static void files_ready(int status, void *cbdata) -{ - orte_job_t *jdata = (orte_job_t*)cbdata; - - if (ORTE_SUCCESS != status) { - ORTE_FORCED_TERMINATE(status); - return; - } else { - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_MAP); - } -} - -static void init_complete(int sd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - - ORTE_ACQUIRE_OBJECT(caddy); - - /* nothing to do here but move along - if it is the - * daemon job, then next step is allocate */ - ORTE_ACTIVATE_JOB_STATE(caddy->jdata, ORTE_JOB_STATE_ALLOCATE); - OBJ_RELEASE(caddy); -} - -static void vm_ready(int fd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - int rc; - opal_buffer_t *buf; - orte_daemon_cmd_flag_t command = ORTE_DAEMON_DVM_NIDMAP_CMD; - orte_grpcomm_signature_t *sig; - opal_buffer_t *wireup; - orte_job_t *jptr; - orte_proc_t *dmn; - opal_byte_object_t bo, *boptr; - int8_t flag; - int32_t numbytes, v; - char *nidmap; - opal_list_t *modex; - opal_value_t *val, *kv; - - ORTE_ACQUIRE_OBJECT(caddy); - - /* if this is my job, then we are done */ - if (ORTE_PROC_MY_NAME->jobid == caddy->jdata->jobid) { - /* if there is only one daemon in the job, then there - * is just a little bit to do */ - if (1 == orte_process_info.num_procs) { - if (!orte_nidmap_communicated) { - if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(orte_node_pool, &orte_node_regex))) { - ORTE_ERROR_LOG(rc); - return; - } - orte_nidmap_communicated = true; - } - } else { - /* send the daemon map to every daemon in this DVM - we - * do this here so we don't have to do it for every - * job we are going to launch */ - buf = OBJ_NEW(opal_buffer_t); - opal_dss.pack(buf, &command, 1, ORTE_DAEMON_CMD); - /* if we couldn't provide the allocation regex on the orted - * cmd line, then we need to provide all the info here */ - if (!orte_nidmap_communicated) { - if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(orte_node_pool, &nidmap))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - return; - } - orte_nidmap_communicated = true; - } else { - nidmap = NULL; - } - opal_dss.pack(buf, &nidmap, 1, OPAL_STRING); - if (NULL != nidmap) { - free(nidmap); - } - /* provide the info on the capabilities of each node */ - if (!orte_node_info_communicated) { - flag = 1; - opal_dss.pack(buf, &flag, 1, OPAL_INT8); - if (ORTE_SUCCESS != (rc = orte_regx.encode_nodemap(buf))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - return; - } - orte_node_info_communicated = true; - /* get wireup info for daemons */ - jptr = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid); - wireup = OBJ_NEW(opal_buffer_t); - for (v=0; v < jptr->procs->size; v++) { - if (NULL == (dmn = (orte_proc_t*)opal_pointer_array_get_item(jptr->procs, v))) { - continue; - } - val = NULL; - if (opal_pmix.legacy_get()) { - if (OPAL_SUCCESS != (rc = opal_pmix.get(&dmn->name, OPAL_PMIX_PROC_URI, NULL, &val)) || NULL == val) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } else { - /* pack the name of the daemon */ - if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &dmn->name, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - /* pack the URI */ - if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &val->data.string, 1, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - OBJ_RELEASE(val); - } - } else { - if (OPAL_SUCCESS != (rc = opal_pmix.get(&dmn->name, NULL, NULL, &val)) || NULL == val) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } else { - /* pack the name of the daemon */ - if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &dmn->name, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - /* the data is returned as a list of key-value pairs in the opal_value_t */ - if (OPAL_PTR != val->type) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - modex = (opal_list_t*)val->data.ptr; - numbytes = (int32_t)opal_list_get_size(modex); - if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &numbytes, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - OPAL_LIST_FOREACH(kv, modex, opal_value_t) { - if (ORTE_SUCCESS != (rc = opal_dss.pack(wireup, &kv, 1, OPAL_VALUE))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(wireup); - return; - } - } - OPAL_LIST_RELEASE(modex); - OBJ_RELEASE(val); - } - } - } - /* put it in a byte object for xmission */ - opal_dss.unload(wireup, (void**)&bo.bytes, &numbytes); - /* pack the byte object - zero-byte objects are fine */ - bo.size = numbytes; - boptr = &bo; - if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, &boptr, 1, OPAL_BYTE_OBJECT))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(wireup); - OBJ_RELEASE(buf); - return; - } - /* release the data since it has now been copied into our buffer */ - if (NULL != bo.bytes) { - free(bo.bytes); - } - OBJ_RELEASE(wireup); - } else { - flag = 0; - opal_dss.pack(buf, &flag, 1, OPAL_INT8); - } - - /* goes to all daemons */ - sig = OBJ_NEW(orte_grpcomm_signature_t); - sig->signature = (orte_process_name_t*)malloc(sizeof(orte_process_name_t)); - sig->signature[0].jobid = ORTE_PROC_MY_NAME->jobid; - sig->signature[0].vpid = ORTE_VPID_WILDCARD; - if (ORTE_SUCCESS != (rc = orte_grpcomm.xcast(sig, ORTE_RML_TAG_DAEMON, buf))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buf); - OBJ_RELEASE(sig); - ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); - return; - } - OBJ_RELEASE(buf); - } - /* notify that the vm is ready */ - fprintf(stdout, "DVM ready\n"); fflush(stdout); - OBJ_RELEASE(caddy); - return; - } - - /* progress the job */ - caddy->jdata->state = ORTE_JOB_STATE_VM_READY; - - /* position any required files */ - if (ORTE_SUCCESS != orte_filem.preposition_files(caddy->jdata, files_ready, caddy->jdata)) { - ORTE_FORCED_TERMINATE(ORTE_ERROR_DEFAULT_EXIT_CODE); - } - - /* cleanup */ - OBJ_RELEASE(caddy); -} - -static void check_complete(int fd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - orte_job_t *jdata; - orte_proc_t *proc; - int i; - orte_node_t *node; - orte_job_map_t *map; - orte_std_cntr_t index; - char *rtmod; - - ORTE_ACQUIRE_OBJECT(caddy); - jdata = caddy->jdata; - - opal_output_verbose(2, orte_state_base_framework.framework_output, - "%s state:dvm:check_job_complete on job %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (NULL == jdata) ? "NULL" : ORTE_JOBID_PRINT(jdata->jobid)); - - if (NULL == jdata || jdata->jobid == ORTE_PROC_MY_NAME->jobid) { - /* just check to see if the daemons are complete */ - OPAL_OUTPUT_VERBOSE((2, orte_state_base_framework.framework_output, - "%s state:dvm:check_job_complete - received NULL job, checking daemons", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - rtmod = orte_rml.get_routed(orte_mgmt_conduit); - if (0 == orte_routed.num_routes(rtmod)) { - /* orteds are done! */ - OPAL_OUTPUT_VERBOSE((2, orte_state_base_framework.framework_output, - "%s orteds complete - exiting", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - if (NULL == jdata) { - jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid); - } - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DAEMONS_TERMINATED); - OBJ_RELEASE(caddy); - return; - } - OBJ_RELEASE(caddy); - return; - } - - /* mark the job as terminated, but don't override any - * abnormal termination flags - */ - if (jdata->state < ORTE_JOB_STATE_UNTERMINATED) { - jdata->state = ORTE_JOB_STATE_TERMINATED; - } - - /* tell the IOF that the job is complete */ - if (NULL != orte_iof.complete) { - orte_iof.complete(jdata); - } - - /* tell the PMIx subsystem the job is complete */ - if (NULL != opal_pmix.server_deregister_nspace) { - opal_pmix.server_deregister_nspace(jdata->jobid, NULL, NULL); - } - - /* Release the resources used by this job. Since some errmgrs may want - * to continue using resources allocated to the job as part of their - * fault recovery procedure, we only do this once the job is "complete". - * Note that an aborted/killed job -is- flagged as complete and will - * therefore have its resources released. We need to do this after - * we call the errmgr so that any attempt to restart the job will - * avoid doing so in the exact same place as the current job - */ - if (NULL != jdata->map) { - map = jdata->map; - for (index = 0; index < map->nodes->size; index++) { - if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, index))) { - continue; - } - OPAL_OUTPUT_VERBOSE((2, orte_state_base_framework.framework_output, - "%s state:dvm releasing procs from node %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - node->name)); - for (i = 0; i < node->procs->size; i++) { - if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, i))) { - continue; - } - if (proc->name.jobid != jdata->jobid) { - /* skip procs from another job */ - continue; - } - if (!ORTE_FLAG_TEST(proc, ORTE_PROC_FLAG_TOOL)) { - node->slots_inuse--; - node->num_procs--; - } - - OPAL_OUTPUT_VERBOSE((2, orte_state_base_framework.framework_output, - "%s state:dvm releasing proc %s from node %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&proc->name), node->name)); - /* set the entry in the node array to NULL */ - opal_pointer_array_set_item(node->procs, i, NULL); - /* release the proc once for the map entry */ - OBJ_RELEASE(proc); - } - /* set the node location to NULL */ - opal_pointer_array_set_item(map->nodes, index, NULL); - /* maintain accounting */ - OBJ_RELEASE(node); - /* flag that the node is no longer in a map */ - ORTE_FLAG_UNSET(node, ORTE_NODE_FLAG_MAPPED); - } - OBJ_RELEASE(map); - jdata->map = NULL; - } - - if (ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_DEBUGGER_DAEMON)) { - /* this was a debugger daemon. notify that a debugger has detached */ - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_DEBUGGER_DETACH); - } else if (jdata->state != ORTE_JOB_STATE_NOTIFIED) { - OPAL_OUTPUT_VERBOSE((2, orte_state_base_framework.framework_output, - "%s state:dvm:check_job_completed state is terminated - activating notify", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_NOTIFY_COMPLETED); - /* mark the job as notified */ - jdata->state = ORTE_JOB_STATE_NOTIFIED; - } - - OBJ_RELEASE(caddy); -} - -static void cleanup_job(int sd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - orte_job_t *jdata; - - ORTE_ACQUIRE_OBJECT(caddy); - jdata = caddy->jdata; - - /* remove this object from the job array */ - opal_hash_table_set_value_uint32(orte_job_data, jdata->jobid, NULL); - - OBJ_RELEASE(caddy); -} - -typedef struct { - opal_list_t *info; - orte_job_t *jdata; -} mycaddy_t; - -static void notify_complete(int status, void *cbdata) -{ - mycaddy_t *mycaddy = (mycaddy_t*)cbdata; - - OPAL_LIST_RELEASE(mycaddy->info); - ORTE_ACTIVATE_JOB_STATE(mycaddy->jdata, ORTE_JOB_STATE_NOTIFIED); - OBJ_RELEASE(mycaddy->jdata); - free(mycaddy); -} - -static void dvm_notify(int sd, short args, void *cbdata) -{ - orte_state_caddy_t *caddy = (orte_state_caddy_t*)cbdata; - orte_job_t *jdata = caddy->jdata; - orte_proc_t *pptr=NULL; - int ret; - opal_buffer_t *reply; - orte_daemon_cmd_flag_t command; - orte_grpcomm_signature_t *sig; - bool notify = true; - opal_list_t *info; - opal_value_t *val; - opal_process_name_t pname, *proc, pnotify; - mycaddy_t *mycaddy; - - /* see if there was any problem */ - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_ABORTED_PROC, (void**)&pptr, OPAL_PTR) && NULL != pptr) { - ret = pptr->exit_code; - /* or whether we got cancelled by the user */ - } else if (orte_get_attribute(&jdata->attributes, ORTE_JOB_CANCELLED, NULL, OPAL_BOOL)) { - ret = ORTE_ERR_JOB_CANCELLED; - } else { - ret = ORTE_SUCCESS; - } - - if (0 == ret && orte_get_attribute(&jdata->attributes, ORTE_JOB_SILENT_TERMINATION, NULL, OPAL_BOOL)) { - notify = false; - } - /* if the jobid matches that of the requestor, then don't notify */ - proc = &pnotify; - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_LAUNCH_PROXY, (void**)&proc, OPAL_NAME)) { - if (pnotify.jobid == jdata->jobid) { - notify = false; - } - } - - if (notify) { - /* the source is the job that terminated */ - pname.jobid = jdata->jobid; - pname.vpid = OPAL_VPID_WILDCARD; - - info = OBJ_NEW(opal_list_t); - /* ensure this only goes to the job terminated event handler */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_EVENT_NON_DEFAULT); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(info, &val->super); - /* tell the server not to cache the event as subsequent jobs - * do not need to know about it */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_EVENT_DO_NOT_CACHE); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(info, &val->super); - /* provide the status */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_JOB_TERM_STATUS); - val->type = OPAL_STATUS; - val->data.status = ret; - opal_list_append(info, &val->super); - /* tell the requestor which job or proc */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PROCID); - val->type = OPAL_NAME; - val->data.name.jobid = jdata->jobid; - if (NULL != pptr) { - val->data.name.vpid = pptr->name.vpid; - } else { - val->data.name.vpid = ORTE_VPID_WILDCARD; - } - opal_list_append(info, &val->super); - /* pass along the proc to be notified */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_EVENT_CUSTOM_RANGE); - val->type = OPAL_NAME; - val->data.name.jobid = pnotify.jobid; - val->data.name.vpid = pnotify.vpid; - opal_list_append(info, &val->super); - /* setup the caddy */ - mycaddy = (mycaddy_t*)malloc(sizeof(mycaddy_t)); - mycaddy->info = info; - OBJ_RETAIN(jdata); - mycaddy->jdata = jdata; - opal_pmix.server_notify_event(OPAL_ERR_JOB_TERMINATED, &pname, - info, notify_complete, mycaddy); - } - - /* now ensure that _all_ daemons know that this job has terminated so even - * those that did not participate in it will know to cleanup the resources - * they assigned to the job. This is necessary now that the mapping function - * has been moved to the backend daemons - otherwise, non-participating daemons - * retain the slot assignments on the participating daemons, and then incorrectly - * map subsequent jobs thinking those nodes are still "busy" */ - reply = OBJ_NEW(opal_buffer_t); - command = ORTE_DAEMON_DVM_CLEANUP_JOB_CMD; - opal_dss.pack(reply, &command, 1, ORTE_DAEMON_CMD); - opal_dss.pack(reply, &jdata->jobid, 1, ORTE_JOBID); - sig = OBJ_NEW(orte_grpcomm_signature_t); - sig->signature = (orte_process_name_t*)malloc(sizeof(orte_process_name_t)); - sig->signature[0].jobid = ORTE_PROC_MY_NAME->jobid; - sig->signature[0].vpid = ORTE_VPID_WILDCARD; - orte_grpcomm.xcast(sig, ORTE_RML_TAG_DAEMON, reply); - OBJ_RELEASE(reply); - OBJ_RELEASE(sig); -} diff --git a/orte/mca/state/dvm/state_dvm.h b/orte/mca/state/dvm/state_dvm.h deleted file mode 100644 index 5137d8422de..00000000000 --- a/orte/mca/state/dvm/state_dvm.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - */ - -#ifndef MCA_STATE_DVM_EXPORT_H -#define MCA_STATE_DVM_EXPORT_H - -#include "orte_config.h" - -#include "orte/mca/state/state.h" - -BEGIN_C_DECLS - -/* - * Local Component structures - */ - -ORTE_MODULE_DECLSPEC extern orte_state_base_component_t mca_state_dvm_component; - -ORTE_DECLSPEC extern orte_state_base_module_t orte_state_dvm_module; - -END_C_DECLS - -#endif /* MCA_STATE_DVM_EXPORT_H */ diff --git a/orte/mca/state/dvm/state_dvm_component.c b/orte/mca/state/dvm/state_dvm_component.c deleted file mode 100644 index df17c61ed95..00000000000 --- a/orte/mca/state/dvm/state_dvm_component.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "opal/util/output.h" - -#include "orte/mca/state/state.h" -#include "orte/mca/state/base/base.h" -#include "state_dvm.h" - -/* - * Public string for version number - */ -const char *orte_state_dvm_component_version_string = - "ORTE STATE dvm MCA component version " ORTE_VERSION; - -/* - * Local functionality - */ -static int state_dvm_open(void); -static int state_dvm_close(void); -static int state_dvm_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -orte_state_base_component_t mca_state_dvm_component = -{ - /* Handle the general mca_component_t struct containing - * meta information about the component - */ - .base_version = { - ORTE_STATE_BASE_VERSION_1_0_0, - /* Component name and version */ - .mca_component_name = "dvm", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = state_dvm_open, - .mca_close_component = state_dvm_close, - .mca_query_component = state_dvm_component_query, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int state_dvm_open(void) -{ - return ORTE_SUCCESS; -} - -static int state_dvm_close(void) -{ - return ORTE_SUCCESS; -} - -static int state_dvm_component_query(mca_base_module_t **module, int *priority) -{ - /* used by DVM masters */ - if (ORTE_PROC_IS_MASTER) { - *priority = 100; - *module = (mca_base_module_t *)&orte_state_dvm_module; - return ORTE_SUCCESS; - } - - *priority = 0; - *module = NULL; - return ORTE_ERR_NOT_AVAILABLE; -} diff --git a/orte/tools/Makefile.am b/orte/tools/Makefile.am index 228f5f43af6..a1a3fcd35d5 100644 --- a/orte/tools/Makefile.am +++ b/orte/tools/Makefile.am @@ -42,12 +42,4 @@ DIST_SUBDIRS += \ tools/wrappers \ tools/orte-top \ tools/orte-info \ - tools/orte-server \ - tools/orte-dvm \ - tools/ompi-prun - -if OPAL_WANT_PRUN -SUBDIRS += \ - tools/ompi-prun \ - tools/orte-dvm -endif + tools/orte-server diff --git a/orte/tools/ompi-prun/Makefile.am b/orte/tools/ompi-prun/Makefile.am deleted file mode 100644 index 17ace88ea3b..00000000000 --- a/orte/tools/ompi-prun/Makefile.am +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 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) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This is not quite in the Automake spirit, but we have to do it. -# Since the totalview portion of the library must be built with -g, we -# must eliminate the CFLAGS that are passed in here by default (which -# may already have debugging and/or optimization flags). We use -# post-processed forms of the CFLAGS in the library targets down -# below. - -CFLAGS = $(CFLAGS_WITHOUT_OPTFLAGS) $(DEBUGGER_CFLAGS) - -include $(top_srcdir)/Makefile.ompi-rules - -man_pages = ompi-prun.1 -EXTRA_DIST = $(man_pages:.1=.1in) - -if OPAL_INSTALL_BINARIES - -bin_PROGRAMS = ompi-prun - -nodist_man_MANS = $(man_pages) - -# Ensure that the man pages are rebuilt if the opal_config.h file -# changes; a "good enough" way to know if configure was run again (and -# therefore the release date or version may have changed) -$(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h - -endif # OPAL_INSTALL_BINARIES - -ompi_prun_SOURCES = \ - main.c \ - prun.c \ - prun.h - -ompi_prun_LDADD = \ - $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la - -distclean-local: - rm -f $(man_pages) diff --git a/orte/tools/ompi-prun/main.c b/orte/tools/ompi-prun/main.c deleted file mode 100644 index 15b205b1378..00000000000 --- a/orte/tools/ompi-prun/main.c +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************** - * * - * Open MPI: Open Source High Performance Computing * - * * - * http://www.open-mpi.org/ * - * * - ***************************************************************************/ - -#include "prun.h" - -int main(int argc, char *argv[]) -{ - return prun(argc, argv); -} - -/* - * Copyright (c) 2004-2005 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) 2017-2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ diff --git a/orte/tools/ompi-prun/ompi-prun.1in b/orte/tools/ompi-prun/ompi-prun.1in deleted file mode 100644 index 32b88943462..00000000000 --- a/orte/tools/ompi-prun/ompi-prun.1in +++ /dev/null @@ -1,1597 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. -.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. -.\" Copyright (c) 2017-2018 Intel, Inc. All rights reserved. -.\" Copyright (c) 2017 Los Alamos National Security, LLC. All rights -.\" reserved. -.\" $COPYRIGHT$ -.\" -.\" Man page for PSRVR's prun command -.\" -.\" .TH name section center-footer left-footer center-header -.TH PRUN 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.\" ************************** -.\" Name Section -.\" ************************** -.SH NAME -. -prun \- Execute serial and parallel jobs with the PMIx Reference Server. - -. -.\" ************************** -.\" Synopsis Section -.\" ************************** -.SH SYNOPSIS -. -.PP -Single Process Multiple Data (SPMD) Model: - -.B prun -[ options ] -.B -[ ] -.P - -Multiple Instruction Multiple Data (MIMD) Model: - -.B prun -[ global_options ] - [ local_options1 ] -.B -[ ] : - [ local_options2 ] -.B -[ ] : - ... : - [ local_optionsN ] -.B -[ ] -.P - -Note that in both models, invoking \fIprun\fP via an absolute path -name is equivalent to specifying the \fI--prefix\fP option with a -\fI

\fR value equivalent to the directory where \fIprun\fR -resides, minus its last subdirectory. For example: - - \fB%\fP /usr/local/bin/prun ... - -is equivalent to - - \fB%\fP prun --prefix /usr/local - -. -.\" ************************** -.\" Quick Summary Section -.\" ************************** -.SH QUICK SUMMARY -. -If you are simply looking for how to run an application, you -probably want to use a command line of the following form: - - \fB%\fP prun [ -np X ] [ --hostfile ] - -This will run X copies of \fI\fR in your current run-time -environment (if running under a supported resource manager, PSRVR's -\fIprun\fR will usually automatically use the corresponding resource manager -process starter, as opposed to, for example, \fIrsh\fR or \fIssh\fR, -which require the use of a hostfile, or will default to running all X -copies on the localhost), scheduling (by default) in a round-robin fashion by -CPU slot. See the rest of this page for more details. -.P -Please note that prun automatically binds processes. Three binding patterns are used in the absence of any further directives: -.TP 18 -.B Bind to core: -when the number of processes is <= 2 -. -. -.TP -.B Bind to socket: -when the number of processes is > 2 -. -. -.TP -.B Bind to none: -when oversubscribed -. -. -.P -If your application uses threads, then you probably want to ensure that you are -either not bound at all (by specifying --bind-to none), or bound to multiple cores -using an appropriate binding level or specific number of processing elements per -application process. -. -.\" ************************** -.\" Options Section -.\" ************************** -.SH OPTIONS -. -.I prun -will send the name of the directory where it was invoked on the local -node to each of the remote nodes, and attempt to change to that -directory. See the "Current Working Directory" section below for further -details. -.\" -.\" Start options listing -.\" Indent 10 characters from start of first column to start of second column -.TP 10 -.B -The program executable. This is identified as the first non-recognized argument -to prun. -. -. -.TP -.B -Pass these run-time arguments to every new process. These must always -be the last arguments to \fIprun\fP. If an app context file is used, -\fI\fP will be ignored. -. -. -.TP -.B -h\fR,\fP --help -Display help for this command -. -. -.TP -.B -q\fR,\fP --quiet -Suppress informative messages from prun during application execution. -. -. -.TP -.B -v\fR,\fP --verbose -Be verbose -. -. -.TP -.B -V\fR,\fP --version -Print version number. If no other arguments are given, this will also -cause prun to exit. -. -. -.TP -.B -N \fR\fP -.br -Launch num processes per node on all allocated nodes (synonym for npernode). -. -. -. -.TP -.B -display-map\fR,\fP --display-map -Display a table showing the mapped location of each process prior to launch. -. -. -. -.TP -.B -display-allocation\fR,\fP --display-allocation -Display the detected resource allocation. -. -. -. -.TP -.B -output-proctable\fR,\fP --output-proctable -Output the debugger proctable after launch. -. -. -. -.TP -.B -max-vm-size\fR,\fP --max-vm-size \fR\fP -Number of processes to run. -. -. -. -.TP -.B -novm\fR,\fP --novm -Execute without creating an allocation-spanning virtual machine (only start -daemons on nodes hosting application procs). -. -. -. -.TP -.B -hnp\fR,\fP --hnp \fR\fP -Specify the URI of the \fRpsrvr\fP process, or the name of the file (specified as -file:filename) that contains that info. -. -. -. -.P -Use one of the following options to specify which hosts (nodes) within the \fRpsrvr\fP to run on. -. -. -.TP -.B -H\fR,\fP -host\fR,\fP --host \fR\fP -List of hosts on which to invoke processes. -. -. -.TP -.B -hostfile\fR,\fP --hostfile \fR\fP -Provide a hostfile to use. -.\" JJH - Should have man page for how to format a hostfile properly. -. -. -.TP -.B -default-hostfile\fR,\fP --default-hostfile \fR\fP -Provide a default hostfile. -. -. -.TP -.B -machinefile\fR,\fP --machinefile \fR\fP -Synonym for \fI-hostfile\fP. -. -. -. -. -.TP -.B -cpu-set\fR,\fP --cpu-set \fR\fP -Restrict launched processes to the specified logical cpus on each node (comma-separated -list). Note that the binding options will still apply within the specified envelope - e.g., -you can elect to bind each process to only one cpu within the specified cpu set. -. -. -. -.P -The following options specify the number of processes to launch. Note that none -of the options imply a particular binding policy - e.g., requesting N processes -for each socket does not imply that the processes will be bound to the socket. -. -. -.TP -.B -c\fR,\fP -n\fR,\fP --n\fR,\fP -np \fR<#>\fP -Run this many copies of the program on the given nodes. This option -indicates that the specified file is an executable program and not an -application context. If no value is provided for the number of copies to -execute (i.e., neither the "-np" nor its synonyms are provided on the command -line), prun will automatically execute a copy of the program on -each process slot (see below for description of a "process slot"). This -feature, however, can only be used in the SPMD model and will return an -error (without beginning execution of the application) otherwise. -. -. -.TP -.B —map-by ppr:N: -Launch N times the number of objects of the specified type on each node. -. -. -.TP -.B -npersocket\fR,\fP --npersocket \fR<#persocket>\fP -On each node, launch this many processes times the number of processor -sockets on the node. -The \fI-npersocket\fP option also turns on the \fI-bind-to-socket\fP option. -(deprecated in favor of --map-by ppr:n:socket) -. -. -.TP -.B -npernode\fR,\fP --npernode \fR<#pernode>\fP -On each node, launch this many processes. -(deprecated in favor of --map-by ppr:n:node) -. -. -.TP -.B -pernode\fR,\fP --pernode -On each node, launch one process -- equivalent to \fI-npernode\fP 1. -(deprecated in favor of --map-by ppr:1:node) -. -. -. -. -.P -To map processes: -. -. -.TP -.B --map-by \fR\fP -Map to the specified object, defaults to \fIsocket\fP. Supported options -include slot, hwthread, core, L1cache, L2cache, L3cache, socket, numa, -board, node, sequential, distance, and ppr. Any object can include -modifiers by adding a \fR:\fP and any combination of PE=n (bind n -processing elements to each proc), SPAN (load -balance the processes across the allocation), OVERSUBSCRIBE (allow -more processes on a node than processing elements), and NOOVERSUBSCRIBE. -This includes PPR, where the pattern would be terminated by another colon -to separate it from the modifiers. -. -.TP -.B -bycore\fR,\fP --bycore -Map processes by core (deprecated in favor of --map-by core) -. -.TP -.B -byslot\fR,\fP --byslot -Map and rank processes round-robin by slot. -. -.TP -.B -nolocal\fR,\fP --nolocal -Do not run any copies of the launched application on the same node as -prun is running. This option will override listing the localhost -with \fB--host\fR or any other host-specifying mechanism. -. -.TP -.B -nooversubscribe\fR,\fP --nooversubscribe -Do not oversubscribe any nodes; error (without starting any processes) -if the requested number of processes would cause oversubscription. -This option implicitly sets "max_slots" equal to the "slots" value for -each node. (Enabled by default). -. -.TP -.B -oversubscribe\fR,\fP --oversubscribe -Nodes are allowed to be oversubscribed, even on a managed system, and -overloading of processing elements. -. -.TP -.B -bynode\fR,\fP --bynode -Launch processes one per node, cycling by node in a round-robin -fashion. This spreads processes evenly among nodes and assigns -ranks in a round-robin, "by node" manner. -. -.TP -.B -cpu-list\fR,\fP --cpu-list \fR\fP -List of processor IDs to bind processes to [default=NULL]. -. -. -. -. -.P -To order processes' ranks: -. -. -.TP -.B --rank-by \fR\fP -Rank in round-robin fashion according to the specified object, -defaults to \fIslot\fP. Supported options -include slot, hwthread, core, L1cache, L2cache, L3cache, -socket, numa, board, and node. -. -. -. -. -.P -For process binding: -. -.TP -.B --bind-to \fR\fP -Bind processes to the specified object, defaults to \fIcore\fP. Supported options -include slot, hwthread, core, l1cache, l2cache, l3cache, socket, numa, board, and none. -. -.TP -.B -cpus-per-proc\fR,\fP --cpus-per-proc \fR<#perproc>\fP -Bind each process to the specified number of cpus. -(deprecated in favor of --map-by :PE=n) -. -.TP -.B -cpus-per-rank\fR,\fP --cpus-per-rank \fR<#perrank>\fP -Alias for \fI-cpus-per-proc\fP. -(deprecated in favor of --map-by :PE=n) -. -.TP -.B -bind-to-core\fR,\fP --bind-to-core -Bind processes to cores (deprecated in favor of --bind-to core) -. -.TP -.B -bind-to-socket\fR,\fP --bind-to-socket -Bind processes to processor sockets (deprecated in favor of --bind-to socket) -. -.TP -.B -report-bindings\fR,\fP --report-bindings -Report any bindings for launched processes. -. -. -. -. -.P -For rankfiles: -. -. -.TP -.B -rf\fR,\fP --rankfile \fR\fP -Provide a rankfile file. -. -. -. -. -.P -To manage standard I/O: -. -. -.TP -.B -output-filename\fR,\fP --output-filename \fR\fP -Redirect the stdout, stderr, and stddiag of all processes to a process-unique version of -the specified filename. Any directories in the filename will automatically be created. -Each output file will consist of filename.id, where the id will be the -processes' rank, left-filled with -zero's for correct ordering in listings. -. -. -.TP -.B -stdin\fR,\fP --stdin\fR \fP -The rank of the process that is to receive stdin. The -default is to forward stdin to rank 0, but this option -can be used to forward stdin to any process. It is also acceptable to -specify \fInone\fP, indicating that no processes are to receive stdin. -. -. -.TP -.B -merge-stderr-to-stdout\fR,\fP --merge-stderr-to-stdout -Merge stderr to stdout for each process. -. -. -.TP -.B -tag-output\fR,\fP --tag-output -Tag each line of output to stdout, stderr, and stddiag with \fB[jobid, MCW_rank]\fP -indicating the process jobid and rank of the process that generated the output, -and the channel which generated it. -. -. -.TP -.B -timestamp-output\fR,\fP --timestamp-output -Timestamp each line of output to stdout, stderr, and stddiag. -. -. -.TP -.B -xml\fR,\fP --xml -Provide all output to stdout, stderr, and stddiag in an xml format. -. -. -.TP -.B -xml-file\fR,\fP --xml-file \fR\fP -Provide all output in XML format to the specified file. -. -. -.TP -.B -xterm\fR,\fP --xterm \fR\fP -Display the output from the processes identified by their ranks in separate xterm windows. The ranks are specified -as a comma-separated list of ranges, with a -1 indicating all. A separate -window will be created for each specified process. -.B Note: -xterm will normally terminate the window upon termination of the process running -within it. However, by adding a "!" to the end of the list of specified ranks, -the proper options will be provided to ensure that xterm keeps the window open -\fIafter\fP the process terminates, thus allowing you to see the process' output. -Each xterm window will subsequently need to be manually closed. -.B Note: -In some environments, xterm may require that the executable be in the user's -path, or be specified in absolute or relative terms. Thus, it may be necessary -to specify a local executable as "./foo" instead of just "foo". If xterm fails to -find the executable, prun will hang, but still respond correctly to a ctrl-c. -If this happens, please check that the executable is being specified correctly -and try again. -. -. -. -. -.P -To manage files and runtime environment: -. -. -.TP -.B -path\fR,\fP --path \fR\fP - that will be used when attempting to locate the requested -executables. This is used prior to using the local PATH setting. -. -. -.TP -.B --prefix \fR\fP -Prefix directory that will be used to set the \fIPATH\fR and -\fILD_LIBRARY_PATH\fR on the remote node before invoking -the target process. See the "Remote Execution" section, below. -. -. -.TP -.B --noprefix -Disable the automatic --prefix behavior -. -. -.TP -.B -s\fR,\fP --preload-binary -Copy the specified executable(s) to remote machines prior to starting remote processes. The -executables will be copied to the session directory and will be deleted upon -completion of the job. -. -. -.TP -.B --preload-files \fR\fP -Preload the comma separated list of files to the current working directory of the remote -machines where processes will be launched prior to starting those processes. -. -. -.TP -.B -set-cwd-to-session-dir\fR,\fP --set-cwd-to-session-dir -Set the working directory of the started processes to their session directory. -. -. -.TP -.B -wd \fR\fP -Synonym for \fI-wdir\fP. -. -. -.TP -.B -wdir \fR\fP -Change to the directory before the user's program executes. -See the "Current Working Directory" section for notes on relative paths. -.B Note: -If the \fI-wdir\fP option appears both on the command line and in an -application context, the context will take precedence over the command -line. Thus, if the path to the desired wdir is different -on the backend nodes, then it must be specified as an absolute path that -is correct for the backend node. -. -. -.TP -.B -x \fR\fP -Export the specified environment variables to the remote nodes before -executing the program. Only one environment variable can be specified -per \fI-x\fP option. Existing environment variables can be specified -or new variable names specified with corresponding values. For -example: - \fB%\fP prun -x DISPLAY -x OFILE=/tmp/out ... - -The parser for the \fI-x\fP option is not very sophisticated; it does -not even understand quoted values. Users are advised to set variables -in the environment, and then use \fI-x\fP to export (not define) them. -. -. -. -. -.P -Setting MCA parameters: -. -. -.TP -.B -gpmca\fR,\fP --gpmca \fR \fP -Pass global MCA parameters that are applicable to all contexts. \fI\fP is -the parameter name; \fI\fP is the parameter value. -. -. -.TP -.B -pmca\fR,\fP --pmca \fR \fP -Send arguments to various MCA modules. See the "MCA" section, below. -. -. -.TP -.B -am \fR\fP -Aggregate MCA parameter set file list. -. -. -.TP -.B -tune\fR,\fP --tune \fR\fP -Specify a tune file to set arguments for various MCA modules and environment variables. -See the "Setting MCA parameters and environment variables from file" section, below. -. -. -. -. -.P -For debugging: -. -. -.TP -.B -debug\fR,\fP --debug -Invoke the user-level debugger indicated by the \fIorte_base_user_debugger\fP -MCA parameter. -. -. -.TP -.B --get-stack-traces -When paired with the -.B --timeout -option, -.I prun -will obtain and print out stack traces from all launched processes -that are still alive when the timeout expires. Note that obtaining -stack traces can take a little time and produce a lot of output, -especially for large process-count jobs. -. -. -.TP -.B -debugger\fR,\fP --debugger \fR\fP -Sequence of debuggers to search for when \fI--debug\fP is used (i.e. -a synonym for \fIorte_base_user_debugger\fP MCA parameter). -. -. -.TP -.B --timeout \fR -The maximum number of seconds that -.I prun -will run. After this many seconds, -.I prun -will abort the launched job and exit with a non-zero exit status. -Using -.B --timeout -can be also useful when combined with the -.B --get-stack-traces -option. -. -. -.TP -.B -tv\fR,\fP --tv -Launch processes under the TotalView debugger. -Deprecated backwards compatibility flag. Synonym for \fI--debug\fP. -. -. -. -. -.P -There are also other options: -. -. -.TP -.B --allow-run-as-root -Allow -.I prun -to run when executed by the root user -.RI ( prun -defaults to aborting when launched as the root user). -. -. -.TP -.B --app \fR\fP -Provide an appfile, ignoring all other command line options. -. -. -.TP -.B -cf\fR,\fP --cartofile \fR\fP -Provide a cartography file. -. -. -.TP -.B -continuous\fR,\fP --continuous -Job is to run until explicitly terminated. -. -. -.TP -.B -disable-recovery\fR,\fP --disable-recovery -Disable recovery (resets all recovery options to off). -. -. -.TP -.B -do-not-launch\fR,\fP --do-not-launch -Perform all necessary operations to prepare to launch the application, but do not actually launch it. -. -. -.TP -.B -do-not-resolve\fR,\fP --do-not-resolve -Do not attempt to resolve interfaces. -. -. -.TP -.B -enable-recovery\fR,\fP --enable-recovery -Enable recovery from process failure [Default = disabled]. -. -. -.TP -.B -index-argv-by-rank\fR,\fP --index-argv-by-rank -Uniquely index argv[0] for each process using its rank. -. -. -.TP -.B -max-restarts\fR,\fP --max-restarts \fR\fP -Max number of times to restart a failed process. -. -. -.TP -.B --ppr \fR\fP -Comma-separated list of number of processes on a given resource type [default: none]. -. -. -.TP -.B -report-child-jobs-separately\fR,\fP --report-child-jobs-separately -Return the exit status of the primary job only. -. -. -.TP -.B -report-events\fR,\fP --report-events \fR\fP -Report events to a tool listening at the specified URI. -. -. -.TP -.B -report-pid\fR,\fP --report-pid \fR\fP -Print out prun's PID during startup. The channel must be either a '-' to indicate -that the pid is to be output to stdout, a '+' to indicate that the pid is to be -output to stderr, or a filename to which the pid is to be written. -. -. -.TP -.B -report-uri\fR,\fP --report-uri \fR\fP -Print out prun's URI during startup. The channel must be either a '-' to indicate -that the URI is to be output to stdout, a '+' to indicate that the URI is to be -output to stderr, or a filename to which the URI is to be written. -. -. -.TP -.B -show-progress\fR,\fP --show-progress -Output a brief periodic report on launch progress. -. -. -.TP -.B -terminate\fR,\fP --terminate -Terminate the DVM. -. -. -.TP -.B -use-hwthread-cpus\fR,\fP --use-hwthread-cpus -Use hardware threads as independent cpus. -. -. -.TP -.B -use-regexp\fR,\fP --use-regexp -Use regular expressions for launch. -. -. -. -. -.P -The following options are useful for developers; they are not generally -useful to most users: -. -.TP -.B -d\fR,\fP --debug-devel -Enable debugging. This is not generally useful for most users. -. -. -.TP -.B -display-devel-allocation\fR,\fP --display-devel-allocation -Display a detailed list of the allocation being used by this job. -. -. -.TP -.B -display-devel-map\fR,\fP --display-devel-map -Display a more detailed table showing the mapped location of each process prior to launch. -. -. -.TP -.B -display-diffable-map\fR,\fP --display-diffable-map -Display a diffable process map just before launch. -. -. -.TP -.B -display-topo\fR,\fP --display-topo -Display the topology as part of the process map just before launch. -. -. -.TP -.B --report-state-on-timeout -When paired with the -.B --timeout -command line option, report the run-time subsystem state of each -process when the timeout expires. -. -. -.P -There may be other options listed with \fIprun --help\fP. -. -. -.\" ************************** -.\" Description Section -.\" ************************** -.SH DESCRIPTION -. -One invocation of \fIprun\fP starts an application running under PSRVR. If the application is single process multiple data (SPMD), the application -can be specified on the \fIprun\fP command line. - -If the application is multiple instruction multiple data (MIMD), comprising of -multiple programs, the set of programs and argument can be specified in one of -two ways: Extended Command Line Arguments, and Application Context. -.PP -An application context describes the MIMD program set including all arguments -in a separate file. -.\" See appcontext(5) for a description of the application context syntax. -This file essentially contains multiple \fIprun\fP command lines, less the -command name itself. The ability to specify different options for different -instantiations of a program is another reason to use an application context. -.PP -Extended command line arguments allow for the description of the application -layout on the command line using colons (\fI:\fP) to separate the specification -of programs and arguments. Some options are globally set across all specified -programs (e.g. --hostfile), while others are specific to a single program -(e.g. -np). -. -. -. -.SS Specifying Host Nodes -. -Host nodes can be identified on the \fIprun\fP command line with the \fI-host\fP -option or in a hostfile. -. -.PP -For example, -. -.TP 4 -prun -H aa,aa,bb ./a.out -launches two processes on node aa and one on bb. -. -.PP -Or, consider the hostfile -. - - \fB%\fP cat myhostfile - aa slots=2 - bb slots=2 - cc slots=2 - -. -.PP -Here, we list both the host names (aa, bb, and cc) but also how many "slots" -there are for each. Slots indicate how many processes can potentially execute -on a node. For best performance, the number of slots may be chosen to be the -number of cores on the node or the number of processor sockets. If the hostfile -does not provide slots information, PSRVR will attempt to discover the number -of cores (or hwthreads, if the use-hwthreads-as-cpus option is set) and set the -number of slots to that value. This default behavior also occurs when specifying -the \fI-host\fP option with a single hostname. Thus, the command -. -.TP 4 -prun -H aa ./a.out -launches a number of processes equal to the number of cores on node aa. -. -.PP -. -.TP 4 -prun -hostfile myhostfile ./a.out -will launch two processes on each of the three nodes. -. -.TP 4 -prun -hostfile myhostfile -host aa ./a.out -will launch two processes, both on node aa. -. -.TP 4 -prun -hostfile myhostfile -host dd ./a.out -will find no hosts to run on and abort with an error. -That is, the specified host dd is not in the specified hostfile. -. -.PP -When running under resource managers (e.g., SLURM, Torque, etc.), -PSRVR will obtain both the hostnames and the number of slots directly -from the resource manger. -. -.SS Specifying Number of Processes -. -As we have just seen, the number of processes to run can be set using the -hostfile. Other mechanisms exist. -. -.PP -The number of processes launched can be specified as a multiple of the -number of nodes or processor sockets available. For example, -. -.TP 4 -prun -H aa,bb -npersocket 2 ./a.out -launches processes 0-3 on node aa and process 4-7 on node bb, -where aa and bb are both dual-socket nodes. -The \fI-npersocket\fP option also turns on the \fI-bind-to-socket\fP option, -which is discussed in a later section. -. -.TP 4 -prun -H aa,bb -npernode 2 ./a.out -launches processes 0-1 on node aa and processes 2-3 on node bb. -. -.TP 4 -prun -H aa,bb -npernode 1 ./a.out -launches one process per host node. -. -.TP 4 -prun -H aa,bb -pernode ./a.out -is the same as \fI-npernode\fP 1. -. -. -.PP -Another alternative is to specify the number of processes with the -\fI-np\fP option. Consider now the hostfile -. - - \fB%\fP cat myhostfile - aa slots=4 - bb slots=4 - cc slots=4 - -. -.PP -Now, -. -.TP 4 -prun -hostfile myhostfile -np 6 ./a.out -will launch processes 0-3 on node aa and processes 4-5 on node bb. The remaining -slots in the hostfile will not be used since the \fI-np\fP option indicated -that only 6 processes should be launched. -. -.SS Mapping Processes to Nodes: Using Policies -. -The examples above illustrate the default mapping of process processes -to nodes. This mapping can also be controlled with various -\fIprun\fP options that describe mapping policies. -. -. -.PP -Consider the same hostfile as above, again with \fI-np\fP 6: -. - - node aa node bb node cc - - prun 0 1 2 3 4 5 - - prun --map-by node 0 3 1 4 2 5 - - prun -nolocal 0 1 2 3 4 5 -. -.PP -The \fI--map-by node\fP option will load balance the processes across -the available nodes, numbering each process in a round-robin fashion. -. -.PP -The \fI-nolocal\fP option prevents any processes from being mapped onto the -local host (in this case node aa). While \fIprun\fP typically consumes -few system resources, \fI-nolocal\fP can be helpful for launching very -large jobs where \fIprun\fP may actually need to use noticeable amounts -of memory and/or processing time. -. -.PP -Just as \fI-np\fP can specify fewer processes than there are slots, it can -also oversubscribe the slots. For example, with the same hostfile: -. -.TP 4 -prun -hostfile myhostfile -np 14 ./a.out -will launch processes 0-3 on node aa, 4-7 on bb, and 8-11 on cc. It will -then add the remaining two processes to whichever nodes it chooses. -. -.PP -One can also specify limits to oversubscription. For example, with the same -hostfile: -. -.TP 4 -prun -hostfile myhostfile -np 14 -nooversubscribe ./a.out -will produce an error since \fI-nooversubscribe\fP prevents oversubscription. -. -.PP -Limits to oversubscription can also be specified in the hostfile itself: -. - % cat myhostfile - aa slots=4 max_slots=4 - bb max_slots=4 - cc slots=4 -. -.PP -The \fImax_slots\fP field specifies such a limit. When it does, the -\fIslots\fP value defaults to the limit. Now: -. -.TP 4 -prun -hostfile myhostfile -np 14 ./a.out -causes the first 12 processes to be launched as before, but the remaining -two processes will be forced onto node cc. The other two nodes are -protected by the hostfile against oversubscription by this job. -. -.PP -Using the \fI--nooversubscribe\fR option can be helpful since PSRVR -currently does not get "max_slots" values from the resource manager. -. -.PP -Of course, \fI-np\fP can also be used with the \fI-H\fP or \fI-host\fP -option. For example, -. -.TP 4 -prun -H aa,bb -np 8 ./a.out -launches 8 processes. Since only two hosts are specified, after the first -two processes are mapped, one to aa and one to bb, the remaining processes -oversubscribe the specified hosts. -. -.PP -And here is a MIMD example: -. -.TP 4 -prun -H aa -np 1 hostname : -H bb,cc -np 2 uptime -will launch process 0 running \fIhostname\fP on node aa and processes 1 and 2 -each running \fIuptime\fP on nodes bb and cc, respectively. -. -.SS Mapping, Ranking, and Binding: Oh My! -. -PSRVR employs a three-phase procedure for assigning process locations and -ranks: -. -.TP 10 -\fBmapping\fP -Assigns a default location to each process -. -.TP 10 -\fBranking\fP -Assigns a rank value to each process -. -.TP 10 -\fBbinding\fP -Constrains each process to run on specific processors -. -.PP -The \fImapping\fP step is used to assign a default location to each process -based on the mapper being employed. Mapping by slot, node, and sequentially results -in the assignment of the processes to the node level. In contrast, mapping by object, allows -the mapper to assign the process to an actual object on each node. -. -.PP -\fBNote:\fP the location assigned to the process is independent of where it will be bound - the -assignment is used solely as input to the binding algorithm. -. -.PP -The mapping of process processes to nodes can be defined not just -with general policies but also, if necessary, using arbitrary mappings -that cannot be described by a simple policy. One can use the "sequential -mapper," which reads the hostfile line by line, assigning processes -to nodes in whatever order the hostfile specifies. Use the -\fI-pmca rmaps seq\fP option. For example, using the same hostfile -as before: -. -.PP -prun -hostfile myhostfile -pmca rmaps seq ./a.out -. -.PP -will launch three processes, one on each of nodes aa, bb, and cc, respectively. -The slot counts don't matter; one process is launched per line on -whatever node is listed on the line. -. -.PP -Another way to specify arbitrary mappings is with a rankfile, which -gives you detailed control over process binding as well. Rankfiles -are discussed below. -. -.PP -The second phase focuses on the \fIranking\fP of the process within -the job. PSRVR -separates this from the mapping procedure to allow more flexibility in the -relative placement of processes. This is best illustrated by considering the -following two cases where we used the —map-by ppr:2:socket option: -. -.PP - node aa node bb - - rank-by core 0 1 ! 2 3 4 5 ! 6 7 - - rank-by socket 0 2 ! 1 3 4 6 ! 5 7 - - rank-by socket:span 0 4 ! 1 5 2 6 ! 3 7 -. -.PP -Ranking by core and by slot provide the identical result - a simple -progression of ranks across each node. Ranking by -socket does a round-robin ranking within each node until all processes -have been assigned a rank, and then progresses to the next -node. Adding the \fIspan\fP modifier to the ranking directive causes -the ranking algorithm to treat the entire allocation as a single -entity - thus, the MCW ranks are assigned across all sockets before -circling back around to the beginning. -. -.PP -The \fIbinding\fP phase actually binds each process to a given set of processors. This can -improve performance if the operating system is placing processes -suboptimally. For example, it might oversubscribe some multi-core -processor sockets, leaving other sockets idle; this can lead -processes to contend unnecessarily for common resources. Or, it -might spread processes out too widely; this can be suboptimal if -application performance is sensitive to interprocess communication -costs. Binding can also keep the operating system from migrating -processes excessively, regardless of how optimally those processes -were placed to begin with. -. -.PP -The processors to be used for binding can be identified in terms of -topological groupings - e.g., binding to an l3cache will bind each -process to all processors within the scope of a single L3 cache within -their assigned location. Thus, if a process is assigned by the mapper -to a certain socket, then a \fI—bind-to l3cache\fP directive will -cause the process to be bound to the processors that share a single L3 -cache within that socket. -. -.PP -To help balance loads, the binding directive uses a round-robin method when binding to -levels lower than used in the mapper. For example, consider the case where a job is -mapped to the socket level, and then bound to core. Each socket will have multiple cores, -so if multiple processes are mapped to a given socket, the binding algorithm will assign -each process located to a socket to a unique core in a round-robin manner. -. -.PP -Alternatively, processes mapped by l2cache and then bound to socket will simply be bound -to all the processors in the socket where they are located. In this manner, users can -exert detailed control over relative MCW rank location and binding. -. -.PP -Finally, \fI--report-bindings\fP can be used to report bindings. -. -.PP -As an example, consider a node with two processor sockets, each comprising -four cores. We run \fIprun\fP with \fI-np 4 --report-bindings\fP and -the following additional options: -. - - % prun ... --map-by core --bind-to core - [...] ... binding child [...,0] to cpus 0001 - [...] ... binding child [...,1] to cpus 0002 - [...] ... binding child [...,2] to cpus 0004 - [...] ... binding child [...,3] to cpus 0008 - - % prun ... --map-by socket --bind-to socket - [...] ... binding child [...,0] to socket 0 cpus 000f - [...] ... binding child [...,1] to socket 1 cpus 00f0 - [...] ... binding child [...,2] to socket 0 cpus 000f - [...] ... binding child [...,3] to socket 1 cpus 00f0 - - % prun ... --map-by core:PE=2 --bind-to core - [...] ... binding child [...,0] to cpus 0003 - [...] ... binding child [...,1] to cpus 000c - [...] ... binding child [...,2] to cpus 0030 - [...] ... binding child [...,3] to cpus 00c0 - - % prun ... --bind-to none -. -.PP -Here, \fI--report-bindings\fP shows the binding of each process as a mask. -In the first case, the processes bind to successive cores as indicated by -the masks 0001, 0002, 0004, and 0008. In the second case, processes bind -to all cores on successive sockets as indicated by the masks 000f and 00f0. -The processes cycle through the processor sockets in a round-robin fashion -as many times as are needed. In the third case, the masks show us that -2 cores have been bound per process. In the fourth case, binding is -turned off and no bindings are reported. -. -.PP -PSRVR's support for process binding depends on the underlying -operating system. Therefore, certain process binding options may not be available -on every system. -. -.PP -Process binding can also be set with MCA parameters. -Their usage is less convenient than that of \fIprun\fP options. -On the other hand, MCA parameters can be set not only on the \fIprun\fP -command line, but alternatively in a system or user mca-params.conf file -or as environment variables, as described in the MCA section below. -Some examples include: -. -.PP - prun option MCA parameter key value - - --map-by core rmaps_base_mapping_policy core - --map-by socket rmaps_base_mapping_policy socket - --rank-by core rmaps_base_ranking_policy core - --bind-to core hwloc_base_binding_policy core - --bind-to socket hwloc_base_binding_policy socket - --bind-to none hwloc_base_binding_policy none -. -. -.SS Rankfiles -. -Rankfiles are text files that specify detailed information about how -individual processes should be mapped to nodes, and to which -processor(s) they should be bound. Each line of a rankfile specifies -the location of one process. The general form of each line in the -rankfile is: -. - - rank = slot= -. -.PP -For example: -. - - $ cat myrankfile - rank 0=aa slot=1:0-2 - rank 1=bb slot=0:0,1 - rank 2=cc slot=1-2 - $ prun -H aa,bb,cc,dd -rf myrankfile ./a.out -. -.PP -Means that -. - - Rank 0 runs on node aa, bound to logical socket 1, cores 0-2. - Rank 1 runs on node bb, bound to logical socket 0, cores 0 and 1. - Rank 2 runs on node cc, bound to logical cores 1 and 2. -. -.PP -Rankfiles can alternatively be used to specify \fIphysical\fP processor -locations. In this case, the syntax is somewhat different. Sockets are -no longer recognized, and the slot number given must be the number of -the physical PU as most OS's do not assign a unique physical identifier -to each core in the node. Thus, a proper physical rankfile looks something -like the following: -. - - $ cat myphysicalrankfile - rank 0=aa slot=1 - rank 1=bb slot=8 - rank 2=cc slot=6 -. -.PP -This means that -. - - Rank 0 will run on node aa, bound to the core that contains physical PU 1 - Rank 1 will run on node bb, bound to the core that contains physical PU 8 - Rank 2 will run on node cc, bound to the core that contains physical PU 6 -. -.PP -Rankfiles are treated as \fIlogical\fP by default, and the MCA parameter -rmaps_rank_file_physical must be set to 1 to indicate that the rankfile -is to be considered as \fIphysical\fP. -. -.PP -The hostnames listed above are "absolute," meaning that actual -resolveable hostnames are specified. However, hostnames can also be -specified as "relative," meaning that they are specified in relation -to an externally-specified list of hostnames (e.g., by prun's --host -argument, a hostfile, or a job scheduler). -. -.PP -The "relative" specification is of the form "+n", where X is an -integer specifying the Xth hostname in the set of all available -hostnames, indexed from 0. For example: -. - - $ cat myrankfile - rank 0=+n0 slot=1:0-2 - rank 1=+n1 slot=0:0,1 - rank 2=+n2 slot=1-2 - $ prun -H aa,bb,cc,dd -rf myrankfile ./a.out -. -.PP -All socket/core slot locations are be -specified as -.I logical -indexes. You can use tools such as HWLOC's "lstopo" to find the -logical indexes of socket and cores. -. -. -.SS Application Context or Executable Program? -. -To distinguish the two different forms, \fIprun\fP -looks on the command line for \fI--app\fP option. If -it is specified, then the file named on the command line is -assumed to be an application context. If it is not -specified, then the file is assumed to be an executable program. -. -. -. -.SS Locating Files -. -If no relative or absolute path is specified for a file, prun will first look for files by searching the directories specified -by the \fI--path\fP option. If there is no \fI--path\fP option set or -if the file is not found at the \fI--path\fP location, then prun -will search the user's PATH environment variable as defined on the -source node(s). -.PP -If a relative directory is specified, it must be relative to the initial -working directory determined by the specific starter used. For example when -using the rsh or ssh starters, the initial directory is $HOME by default. Other -starters may set the initial directory to the current working directory from -the invocation of \fIprun\fP. -. -. -. -.SS Current Working Directory -. -The \fI\-wdir\fP prun option (and its synonym, \fI\-wd\fP) allows -the user to change to an arbitrary directory before the program is -invoked. It can also be used in application context files to specify -working directories on specific nodes and/or for specific -applications. -.PP -If the \fI\-wdir\fP option appears both in a context file and on the -command line, the context file directory will override the command -line value. -.PP -If the \fI-wdir\fP option is specified, prun will attempt to -change to the specified directory on all of the remote nodes. If this -fails, \fIprun\fP will abort. -.PP -If the \fI-wdir\fP option is \fBnot\fP specified, prun will send -the directory name where \fIprun\fP was invoked to each of the -remote nodes. The remote nodes will try to change to that -directory. If they are unable (e.g., if the directory does not exist on -that node), then prun will use the default directory determined by -the starter. -.PP -All directory changing occurs before the user's program is invoked. -. -. -. -.SS Standard I/O -. -PSRVR directs UNIX standard input to /dev/null on all processes -except the rank 0 process. The rank 0 process -inherits standard input from \fIprun\fP. -.B Note: -The node that invoked \fIprun\fP need not be the same as the node where the -rank 0 process resides. PSRVR handles the redirection of -\fIprun\fP's standard input to the rank 0 process. -.PP -PSRVR directs UNIX standard output and error from remote nodes to the node -that invoked \fIprun\fP and prints it on the standard output/error of -\fIprun\fP. -Local processes inherit the standard output/error of \fIprun\fP and transfer -to it directly. -.PP -Thus it is possible to redirect standard I/O for applications by -using the typical shell redirection procedure on \fIprun\fP. - - \fB%\fP prun -np 2 my_app < my_input > my_output - -Note that in this example \fIonly\fP the rank 0 process will -receive the stream from \fImy_input\fP on stdin. The stdin on all the other -nodes will be tied to /dev/null. However, the stdout from all nodes will -be collected into the \fImy_output\fP file. -. -. -. -.SS Signal Propagation -. -When prun receives a SIGTERM and SIGINT, it will attempt to kill -the entire job by sending all processes in the job a SIGTERM, waiting -a small number of seconds, then sending all processes in the job a -SIGKILL. -. -.PP -SIGUSR1 and SIGUSR2 signals received by prun are propagated to -all processes in the job. -. -.PP -A SIGTSTOP signal to prun will cause a SIGSTOP signal to be sent -to all of the programs started by prun and likewise a SIGCONT signal -to prun will cause a SIGCONT sent. -. -.PP -Other signals are not currently propagated -by prun. -. -. -.SS Process Termination / Signal Handling -. -During the run of an application, if any process dies abnormally -(either exiting before invoking \fIPMIx_Finalize\fP, or dying as the result of a -signal), \fIprun\fP will print out an error message and kill the rest of the -application. -.PP -. -. -.SS Process Environment -. -Processes in the application inherit their environment from the -PSRVR daemon upon the node on which they are running. The -environment is typically inherited from the user's shell. On remote -nodes, the exact environment is determined by the boot MCA module -used. The \fIrsh\fR launch module, for example, uses either -\fIrsh\fR/\fIssh\fR to launch the PSRVR daemon on remote nodes, and -typically executes one or more of the user's shell-setup files before -launching the daemon. When running dynamically linked -applications which require the \fILD_LIBRARY_PATH\fR environment -variable to be set, care must be taken to ensure that it is correctly -set when booting PSRVR. -.PP -See the "Remote Execution" section for more details. -. -. -.SS Remote Execution -. -PSRVR requires that the \fIPATH\fR environment variable be set to -find executables on remote nodes (this is typically only necessary in -\fIrsh\fR- or \fIssh\fR-based environments -- batch/scheduled -environments typically copy the current environment to the execution -of remote jobs, so if the current environment has \fIPATH\fR and/or -\fILD_LIBRARY_PATH\fR set properly, the remote nodes will also have it -set properly). If PSRVR was compiled with shared library support, -it may also be necessary to have the \fILD_LIBRARY_PATH\fR environment -variable set on remote nodes as well (especially to find the shared -libraries required to run user applications). -.PP -However, it is not always desirable or possible to edit shell -startup files to set \fIPATH\fR and/or \fILD_LIBRARY_PATH\fR. The -\fI--prefix\fR option is provided for some simple configurations where -this is not possible. -.PP -The \fI--prefix\fR option takes a single argument: the base directory -on the remote node where PSRVR is installed. PSRVR will use -this directory to set the remote \fIPATH\fR and \fILD_LIBRARY_PATH\fR -before executing any user applications. This allows -running jobs without having pre-configured the \fIPATH\fR and -\fILD_LIBRARY_PATH\fR on the remote nodes. -.PP -PSRVR adds the basename of the current -node's "bindir" (the directory where PSRVR's executables are -installed) to the prefix and uses that to set the \fIPATH\fR on the -remote node. Similarly, PSRVR adds the basename of the current -node's "libdir" (the directory where PSRVR's libraries are -installed) to the prefix and uses that to set the -\fILD_LIBRARY_PATH\fR on the remote node. For example: -.TP 15 -Local bindir: -/local/node/directory/bin -.TP -Local libdir: -/local/node/directory/lib64 -.PP -If the following command line is used: - - \fB%\fP prun --prefix /remote/node/directory - -PSRVR will add "/remote/node/directory/bin" to the \fIPATH\fR -and "/remote/node/directory/lib64" to the \fLD_LIBRARY_PATH\fR on the -remote node before attempting to execute anything. -.PP -The \fI--prefix\fR option is not sufficient if the installation paths -on the remote node are different than the local node (e.g., if "/lib" -is used on the local node, but "/lib64" is used on the remote node), -or if the installation paths are something other than a subdirectory -under a common prefix. -.PP -Note that executing \fIprun\fR via an absolute pathname is -equivalent to specifying \fI--prefix\fR without the last subdirectory -in the absolute pathname to \fIprun\fR. For example: - - \fB%\fP /usr/local/bin/prun ... - -is equivalent to - - \fB%\fP prun --prefix /usr/local -. -. -. -.SS Exported Environment Variables -. -All environment variables that are named in the form PMIX_* will automatically -be exported to new processes on the local and remote nodes. Environmental -parameters can also be set/forwarded to the new processes using the MCA -parameter \fImca_base_env_list\fP. While the syntax of the \fI\-x\fP option and MCA param -allows the definition of new variables, note that the parser -for these options are currently not very sophisticated - it does not even -understand quoted values. Users are advised to set variables in the -environment and use the option to export them; not to define them. -. -. -. -.SS Setting MCA Parameters -. -The \fI-pmca\fP switch allows the passing of parameters to various MCA -(Modular Component Architecture) modules. -.\" PSRVR's MCA modules are described in detail in psrvrmca(7). -MCA modules have direct impact on programs because they allow tunable -parameters to be set at run time (such as which BTL communication device driver -to use, what parameters to pass to that BTL, etc.). -.PP -The \fI-pmca\fP switch takes two arguments: \fI\fP and \fI\fP. -The \fI\fP argument generally specifies which MCA module will receive the value. -For example, the \fI\fP "btl" is used to select which BTL to be used for -transporting messages. The \fI\fP argument is the value that is -passed. -For example: -. -.TP 4 -prun -pmca btl tcp,self -np 1 foo -Tells PSRVR to use the "tcp" and "self" BTLs, and to run a single copy of -"foo" on an allocated node. -. -.TP -prun -pmca btl self -np 1 foo -Tells PSRVR to use the "self" BTL, and to run a single copy of "foo" on an -allocated node. -.\" And so on. PSRVR's BTL MCA modules are described in psrvrmca_btl(7). -.PP -The \fI-pmca\fP switch can be used multiple times to specify different -\fI\fP and/or \fI\fP arguments. If the same \fI\fP is -specified more than once, the \fI\fPs are concatenated with a comma -(",") separating them. -.PP -Note that the \fI-pmca\fP switch is simply a shortcut for setting environment variables. -The same effect may be accomplished by setting corresponding environment -variables before running \fIprun\fP. -The form of the environment variables that PSRVR sets is: - - PMIX_MCA_= -.PP -Thus, the \fI-pmca\fP switch overrides any previously set environment -variables. The \fI-pmca\fP settings similarly override MCA parameters set -in the -$OPAL_PREFIX/etc/psrvr-mca-params.conf or $HOME/.psrvr/mca-params.conf -file. -. -.PP -Unknown \fI\fP arguments are still set as -environment variable -- they are not checked (by \fIprun\fP) for correctness. -Illegal or incorrect \fI\fP arguments may or may not be reported -- it -depends on the specific MCA module. -.PP -To find the available component types under the MCA architecture, or to find the -available parameters for a specific component, use the \fIpinfo\fP command. -See the \fIpinfo(1)\fP man page for detailed information on the command. -. -. -. -.SS Setting MCA parameters and environment variables from file. -The \fI-tune\fP command line option and its synonym \fI-pmca mca_base_envar_file_prefix\fP allows a user -to set mca parameters and environment variables with the syntax described below. -This option requires a single file or list of files separated by "," to follow. -.PP -A valid line in the file may contain zero or many "-x", "-pmca", or “--pmca†arguments. -The following patterns are supported: -pmca var val -pmca var "val" -x var=val -x var. -If any argument is duplicated in the file, the last value read will be used. -.PP -MCA parameters and environment specified on the command line have higher precedence than variables specified in the file. -. -. -. -.SS Running as root -. -The PSRVR team strongly advises against executing -.I prun -as the root user. Applications should be run as regular -(non-root) users. -. -.PP -Reflecting this advice, prun will refuse to run as root by default. -To override this default, you can add the -.I --allow-run-as-root -option to the -.I prun -command line. -. -.SS Exit status -. -There is no standard definition for what \fIprun\fP should return as an exit -status. After considerable discussion, we settled on the following method for -assigning the \fIprun\fP exit status (note: in the following description, -the "primary" job is the initial application started by prun - all jobs that -are spawned by that job are designated "secondary" jobs): -. -.IP \[bu] 2 -if all processes in the primary job normally terminate with exit status 0, we return 0 -.IP \[bu] -if one or more processes in the primary job normally terminate with non-zero exit status, -we return the exit status of the process with the lowest rank to have a non-zero status -.IP \[bu] -if all processes in the primary job normally terminate with exit status 0, and one or more -processes in a secondary job normally terminate with non-zero exit status, we (a) return -the exit status of the process with the lowest rank in the lowest jobid to have a non-zero -status, and (b) output a message summarizing the exit status of the primary and all secondary jobs. -.IP \[bu] -if the cmd line option --report-child-jobs-separately is set, we will return -only- the -exit status of the primary job. Any non-zero exit status in secondary jobs will be -reported solely in a summary print statement. -. -.PP -By default, PSRVR records and notes that processes exited with non-zero termination status. -This is generally not considered an "abnormal termination" - i.e., PSRVR will not abort a -job if one or more processes return a non-zero status. Instead, the default behavior simply -reports the number of processes terminating with non-zero status upon completion of the job. -.PP -However, in some cases it can be desirable to have the job abort when any process terminates -with non-zero status. For example, a non-PMIx job might detect a bad result from a calculation -and want to abort, but doesn't want to generate a core file. Or a PMIx job might continue past -a call to PMIx_Finalize, but indicate that all processes should abort due to some post-PMIx result. -.PP -It is not anticipated that this situation will occur frequently. However, in the interest of -serving the broader community, PSRVR now has a means for allowing users to direct that jobs be -aborted upon any process exiting with non-zero status. Setting the MCA parameter -"orte_abort_on_non_zero_status" to 1 will cause PSRVR to abort all processes once any process - exits with non-zero status. -.PP -Terminations caused in this manner will be reported on the console as an "abnormal termination", -with the first process to so exit identified along with its exit status. -.PP -.\" ************************** -.\" Return Value Section -.\" ************************** -. -.SH RETURN VALUE -. -\fIprun\fP returns 0 if all processes started by \fIprun\fP exit after calling -PMIx_Finalize. A non-zero value is returned if an internal error occurred in -prun, or one or more processes exited before calling PMIx_Finalize. If an -internal error occurred in prun, the corresponding error code is returned. -In the event that one or more processes exit before calling PMIx_Finalize, the -return value of the rank of the process that \fIprun\fP first notices died -before calling PMIx_Finalize will be returned. Note that, in general, this will -be the first process that died but is not guaranteed to be so. -. -.PP -If the -.B --timeout -command line option is used and the timeout expires before the job -completes (thereby forcing -.I prun -to kill the job) -.I prun -will return an exit status equivalent to the value of -.B ETIMEDOUT -(which is typically 110 on Linux and OS X systems). - -. -.\" ************************** -.\" See Also Section -.\" ************************** -. diff --git a/orte/tools/ompi-prun/prun b/orte/tools/ompi-prun/prun deleted file mode 100755 index 87fad39fec8..00000000000 --- a/orte/tools/ompi-prun/prun +++ /dev/null @@ -1,228 +0,0 @@ -#! /bin/sh - -# prun - temporary wrapper script for .libs/prun -# Generated by libtool (GNU libtool) 2.4.6 -# -# The prun program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s|\([`"$\\]\)|\\\1|g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/common/openmpi/foobar/orte/tools/prun; LIBRARY_PATH=/opt/local/lib; export LIBRARY_PATH; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; LD_LIBRARY_PATH=/home/common/openmpi/build/foobar/lib:/home/common/local/lib:/home/common/pmix/build/prrte/lib; export LD_LIBRARY_PATH; PATH=/home/common/openmpi/build/foobar/bin:/home/common/local/bin:/home/common/pmix/build/prrte/bin:/home/common/local/sbin:/usr/lib64/qt-3.3/bin:/home/rhc/perl5/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/rhc/.local/bin:/home/rhc/bin; export PATH; gcc -Wall -Wundef -Wno-long-long -Wsign-compare -Wmissing-prototypes -Wstrict-prototypes -Wcomment -pedantic -Werror-implicit-function-declaration -fno-strict-aliasing -mcx16 -pthread -g -o \$progdir/\$file main.o prun.o ../../../orte/.libs/libopen-rte.so /home/common/openmpi/foobar/opal/.libs/libopen-pal.so ../../../opal/.libs/libopen-pal.so -ldl -ludev -lrt -lm -lutil -lz -pthread -Wl,-rpath -Wl,/home/common/openmpi/foobar/orte/.libs -Wl,-rpath -Wl,/home/common/openmpi/foobar/opal/.libs -Wl,-rpath -Wl,/home/common/openmpi/build/foobar/lib)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4.6' - notinst_deplibs=' ../../../orte/libopen-rte.la /home/common/openmpi/foobar/opal/libopen-pal.la ../../../opal/libopen-pal.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ that is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options that match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../../../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /usr/bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "prun:prun:$LINENO: libtool wrapper (GNU libtool) 2.4.6" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "prun:prun:$LINENO: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "prun:prun:$LINENO: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case " $* " in - *\ --lt-*) - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done ;; - esac - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /usr/bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /usr/bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /usr/bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /usr/bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /usr/bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'prun' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /usr/bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - $ECHO "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: '$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/orte/tools/ompi-prun/prun.1 b/orte/tools/ompi-prun/prun.1 deleted file mode 100644 index 74ce2294db0..00000000000 --- a/orte/tools/ompi-prun/prun.1 +++ /dev/null @@ -1,1597 +0,0 @@ -.\" -*- nroff -*- -.\" Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. -.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. -.\" Copyright (c) 2017-2018 Intel, Inc. All rights reserved. -.\" Copyright (c) 2017 Los Alamos National Security, LLC. All rights -.\" reserved. -.\" $COPYRIGHT$ -.\" -.\" Man page for PSRVR's prun command -.\" -.\" .TH name section center-footer left-footer center-header -.TH PRUN 1 "Unreleased developer copy" "gitclone" "Open MPI" -.\" ************************** -.\" Name Section -.\" ************************** -.SH NAME -. -prun \- Execute serial and parallel jobs with the PMIx Reference Server. - -. -.\" ************************** -.\" Synopsis Section -.\" ************************** -.SH SYNOPSIS -. -.PP -Single Process Multiple Data (SPMD) Model: - -.B prun -[ options ] -.B -[ ] -.P - -Multiple Instruction Multiple Data (MIMD) Model: - -.B prun -[ global_options ] - [ local_options1 ] -.B -[ ] : - [ local_options2 ] -.B -[ ] : - ... : - [ local_optionsN ] -.B -[ ] -.P - -Note that in both models, invoking \fIprun\fP via an absolute path -name is equivalent to specifying the \fI--prefix\fP option with a -\fI\fR value equivalent to the directory where \fIprun\fR -resides, minus its last subdirectory. For example: - - \fB%\fP /usr/local/bin/prun ... - -is equivalent to - - \fB%\fP prun --prefix /usr/local - -. -.\" ************************** -.\" Quick Summary Section -.\" ************************** -.SH QUICK SUMMARY -. -If you are simply looking for how to run an application, you -probably want to use a command line of the following form: - - \fB%\fP prun [ -np X ] [ --hostfile ] - -This will run X copies of \fI\fR in your current run-time -environment (if running under a supported resource manager, PSRVR's -\fIprun\fR will usually automatically use the corresponding resource manager -process starter, as opposed to, for example, \fIrsh\fR or \fIssh\fR, -which require the use of a hostfile, or will default to running all X -copies on the localhost), scheduling (by default) in a round-robin fashion by -CPU slot. See the rest of this page for more details. -.P -Please note that prun automatically binds processes. Three binding patterns are used in the absence of any further directives: -.TP 18 -.B Bind to core: -when the number of processes is <= 2 -. -. -.TP -.B Bind to socket: -when the number of processes is > 2 -. -. -.TP -.B Bind to none: -when oversubscribed -. -. -.P -If your application uses threads, then you probably want to ensure that you are -either not bound at all (by specifying --bind-to none), or bound to multiple cores -using an appropriate binding level or specific number of processing elements per -application process. -. -.\" ************************** -.\" Options Section -.\" ************************** -.SH OPTIONS -. -.I prun -will send the name of the directory where it was invoked on the local -node to each of the remote nodes, and attempt to change to that -directory. See the "Current Working Directory" section below for further -details. -.\" -.\" Start options listing -.\" Indent 10 characters from start of first column to start of second column -.TP 10 -.B -The program executable. This is identified as the first non-recognized argument -to prun. -. -. -.TP -.B -Pass these run-time arguments to every new process. These must always -be the last arguments to \fIprun\fP. If an app context file is used, -\fI\fP will be ignored. -. -. -.TP -.B -h\fR,\fP --help -Display help for this command -. -. -.TP -.B -q\fR,\fP --quiet -Suppress informative messages from prun during application execution. -. -. -.TP -.B -v\fR,\fP --verbose -Be verbose -. -. -.TP -.B -V\fR,\fP --version -Print version number. If no other arguments are given, this will also -cause prun to exit. -. -. -.TP -.B -N \fR\fP -.br -Launch num processes per node on all allocated nodes (synonym for npernode). -. -. -. -.TP -.B -display-map\fR,\fP --display-map -Display a table showing the mapped location of each process prior to launch. -. -. -. -.TP -.B -display-allocation\fR,\fP --display-allocation -Display the detected resource allocation. -. -. -. -.TP -.B -output-proctable\fR,\fP --output-proctable -Output the debugger proctable after launch. -. -. -. -.TP -.B -max-vm-size\fR,\fP --max-vm-size \fR\fP -Number of processes to run. -. -. -. -.TP -.B -novm\fR,\fP --novm -Execute without creating an allocation-spanning virtual machine (only start -daemons on nodes hosting application procs). -. -. -. -.TP -.B -hnp\fR,\fP --hnp \fR\fP -Specify the URI of the \fRpsrvr\fP process, or the name of the file (specified as -file:filename) that contains that info. -. -. -. -.P -Use one of the following options to specify which hosts (nodes) within the \fRpsrvr\fP to run on. -. -. -.TP -.B -H\fR,\fP -host\fR,\fP --host \fR\fP -List of hosts on which to invoke processes. -. -. -.TP -.B -hostfile\fR,\fP --hostfile \fR\fP -Provide a hostfile to use. -.\" JJH - Should have man page for how to format a hostfile properly. -. -. -.TP -.B -default-hostfile\fR,\fP --default-hostfile \fR\fP -Provide a default hostfile. -. -. -.TP -.B -machinefile\fR,\fP --machinefile \fR\fP -Synonym for \fI-hostfile\fP. -. -. -. -. -.TP -.B -cpu-set\fR,\fP --cpu-set \fR\fP -Restrict launched processes to the specified logical cpus on each node (comma-separated -list). Note that the binding options will still apply within the specified envelope - e.g., -you can elect to bind each process to only one cpu within the specified cpu set. -. -. -. -.P -The following options specify the number of processes to launch. Note that none -of the options imply a particular binding policy - e.g., requesting N processes -for each socket does not imply that the processes will be bound to the socket. -. -. -.TP -.B -c\fR,\fP -n\fR,\fP --n\fR,\fP -np \fR<#>\fP -Run this many copies of the program on the given nodes. This option -indicates that the specified file is an executable program and not an -application context. If no value is provided for the number of copies to -execute (i.e., neither the "-np" nor its synonyms are provided on the command -line), prun will automatically execute a copy of the program on -each process slot (see below for description of a "process slot"). This -feature, however, can only be used in the SPMD model and will return an -error (without beginning execution of the application) otherwise. -. -. -.TP -.B —map-by ppr:N: -Launch N times the number of objects of the specified type on each node. -. -. -.TP -.B -npersocket\fR,\fP --npersocket \fR<#persocket>\fP -On each node, launch this many processes times the number of processor -sockets on the node. -The \fI-npersocket\fP option also turns on the \fI-bind-to-socket\fP option. -(deprecated in favor of --map-by ppr:n:socket) -. -. -.TP -.B -npernode\fR,\fP --npernode \fR<#pernode>\fP -On each node, launch this many processes. -(deprecated in favor of --map-by ppr:n:node) -. -. -.TP -.B -pernode\fR,\fP --pernode -On each node, launch one process -- equivalent to \fI-npernode\fP 1. -(deprecated in favor of --map-by ppr:1:node) -. -. -. -. -.P -To map processes: -. -. -.TP -.B --map-by \fR\fP -Map to the specified object, defaults to \fIsocket\fP. Supported options -include slot, hwthread, core, L1cache, L2cache, L3cache, socket, numa, -board, node, sequential, distance, and ppr. Any object can include -modifiers by adding a \fR:\fP and any combination of PE=n (bind n -processing elements to each proc), SPAN (load -balance the processes across the allocation), OVERSUBSCRIBE (allow -more processes on a node than processing elements), and NOOVERSUBSCRIBE. -This includes PPR, where the pattern would be terminated by another colon -to separate it from the modifiers. -. -.TP -.B -bycore\fR,\fP --bycore -Map processes by core (deprecated in favor of --map-by core) -. -.TP -.B -byslot\fR,\fP --byslot -Map and rank processes round-robin by slot. -. -.TP -.B -nolocal\fR,\fP --nolocal -Do not run any copies of the launched application on the same node as -prun is running. This option will override listing the localhost -with \fB--host\fR or any other host-specifying mechanism. -. -.TP -.B -nooversubscribe\fR,\fP --nooversubscribe -Do not oversubscribe any nodes; error (without starting any processes) -if the requested number of processes would cause oversubscription. -This option implicitly sets "max_slots" equal to the "slots" value for -each node. (Enabled by default). -. -.TP -.B -oversubscribe\fR,\fP --oversubscribe -Nodes are allowed to be oversubscribed, even on a managed system, and -overloading of processing elements. -. -.TP -.B -bynode\fR,\fP --bynode -Launch processes one per node, cycling by node in a round-robin -fashion. This spreads processes evenly among nodes and assigns -ranks in a round-robin, "by node" manner. -. -.TP -.B -cpu-list\fR,\fP --cpu-list \fR\fP -List of processor IDs to bind processes to [default=NULL]. -. -. -. -. -.P -To order processes' ranks: -. -. -.TP -.B --rank-by \fR\fP -Rank in round-robin fashion according to the specified object, -defaults to \fIslot\fP. Supported options -include slot, hwthread, core, L1cache, L2cache, L3cache, -socket, numa, board, and node. -. -. -. -. -.P -For process binding: -. -.TP -.B --bind-to \fR\fP -Bind processes to the specified object, defaults to \fIcore\fP. Supported options -include slot, hwthread, core, l1cache, l2cache, l3cache, socket, numa, board, and none. -. -.TP -.B -cpus-per-proc\fR,\fP --cpus-per-proc \fR<#perproc>\fP -Bind each process to the specified number of cpus. -(deprecated in favor of --map-by :PE=n) -. -.TP -.B -cpus-per-rank\fR,\fP --cpus-per-rank \fR<#perrank>\fP -Alias for \fI-cpus-per-proc\fP. -(deprecated in favor of --map-by :PE=n) -. -.TP -.B -bind-to-core\fR,\fP --bind-to-core -Bind processes to cores (deprecated in favor of --bind-to core) -. -.TP -.B -bind-to-socket\fR,\fP --bind-to-socket -Bind processes to processor sockets (deprecated in favor of --bind-to socket) -. -.TP -.B -report-bindings\fR,\fP --report-bindings -Report any bindings for launched processes. -. -. -. -. -.P -For rankfiles: -. -. -.TP -.B -rf\fR,\fP --rankfile \fR\fP -Provide a rankfile file. -. -. -. -. -.P -To manage standard I/O: -. -. -.TP -.B -output-filename\fR,\fP --output-filename \fR\fP -Redirect the stdout, stderr, and stddiag of all processes to a process-unique version of -the specified filename. Any directories in the filename will automatically be created. -Each output file will consist of filename.id, where the id will be the -processes' rank, left-filled with -zero's for correct ordering in listings. -. -. -.TP -.B -stdin\fR,\fP --stdin\fR \fP -The rank of the process that is to receive stdin. The -default is to forward stdin to rank 0, but this option -can be used to forward stdin to any process. It is also acceptable to -specify \fInone\fP, indicating that no processes are to receive stdin. -. -. -.TP -.B -merge-stderr-to-stdout\fR,\fP --merge-stderr-to-stdout -Merge stderr to stdout for each process. -. -. -.TP -.B -tag-output\fR,\fP --tag-output -Tag each line of output to stdout, stderr, and stddiag with \fB[jobid, MCW_rank]\fP -indicating the process jobid and rank of the process that generated the output, -and the channel which generated it. -. -. -.TP -.B -timestamp-output\fR,\fP --timestamp-output -Timestamp each line of output to stdout, stderr, and stddiag. -. -. -.TP -.B -xml\fR,\fP --xml -Provide all output to stdout, stderr, and stddiag in an xml format. -. -. -.TP -.B -xml-file\fR,\fP --xml-file \fR\fP -Provide all output in XML format to the specified file. -. -. -.TP -.B -xterm\fR,\fP --xterm \fR\fP -Display the output from the processes identified by their ranks in separate xterm windows. The ranks are specified -as a comma-separated list of ranges, with a -1 indicating all. A separate -window will be created for each specified process. -.B Note: -xterm will normally terminate the window upon termination of the process running -within it. However, by adding a "!" to the end of the list of specified ranks, -the proper options will be provided to ensure that xterm keeps the window open -\fIafter\fP the process terminates, thus allowing you to see the process' output. -Each xterm window will subsequently need to be manually closed. -.B Note: -In some environments, xterm may require that the executable be in the user's -path, or be specified in absolute or relative terms. Thus, it may be necessary -to specify a local executable as "./foo" instead of just "foo". If xterm fails to -find the executable, prun will hang, but still respond correctly to a ctrl-c. -If this happens, please check that the executable is being specified correctly -and try again. -. -. -. -. -.P -To manage files and runtime environment: -. -. -.TP -.B -path\fR,\fP --path \fR\fP - that will be used when attempting to locate the requested -executables. This is used prior to using the local PATH setting. -. -. -.TP -.B --prefix \fR\fP -Prefix directory that will be used to set the \fIPATH\fR and -\fILD_LIBRARY_PATH\fR on the remote node before invoking -the target process. See the "Remote Execution" section, below. -. -. -.TP -.B --noprefix -Disable the automatic --prefix behavior -. -. -.TP -.B -s\fR,\fP --preload-binary -Copy the specified executable(s) to remote machines prior to starting remote processes. The -executables will be copied to the session directory and will be deleted upon -completion of the job. -. -. -.TP -.B --preload-files \fR\fP -Preload the comma separated list of files to the current working directory of the remote -machines where processes will be launched prior to starting those processes. -. -. -.TP -.B -set-cwd-to-session-dir\fR,\fP --set-cwd-to-session-dir -Set the working directory of the started processes to their session directory. -. -. -.TP -.B -wd \fR\fP -Synonym for \fI-wdir\fP. -. -. -.TP -.B -wdir \fR\fP -Change to the directory before the user's program executes. -See the "Current Working Directory" section for notes on relative paths. -.B Note: -If the \fI-wdir\fP option appears both on the command line and in an -application context, the context will take precedence over the command -line. Thus, if the path to the desired wdir is different -on the backend nodes, then it must be specified as an absolute path that -is correct for the backend node. -. -. -.TP -.B -x \fR\fP -Export the specified environment variables to the remote nodes before -executing the program. Only one environment variable can be specified -per \fI-x\fP option. Existing environment variables can be specified -or new variable names specified with corresponding values. For -example: - \fB%\fP prun -x DISPLAY -x OFILE=/tmp/out ... - -The parser for the \fI-x\fP option is not very sophisticated; it does -not even understand quoted values. Users are advised to set variables -in the environment, and then use \fI-x\fP to export (not define) them. -. -. -. -. -.P -Setting MCA parameters: -. -. -.TP -.B -gpmca\fR,\fP --gpmca \fR \fP -Pass global MCA parameters that are applicable to all contexts. \fI\fP is -the parameter name; \fI\fP is the parameter value. -. -. -.TP -.B -pmca\fR,\fP --pmca \fR \fP -Send arguments to various MCA modules. See the "MCA" section, below. -. -. -.TP -.B -am \fR\fP -Aggregate MCA parameter set file list. -. -. -.TP -.B -tune\fR,\fP --tune \fR\fP -Specify a tune file to set arguments for various MCA modules and environment variables. -See the "Setting MCA parameters and environment variables from file" section, below. -. -. -. -. -.P -For debugging: -. -. -.TP -.B -debug\fR,\fP --debug -Invoke the user-level debugger indicated by the \fIorte_base_user_debugger\fP -MCA parameter. -. -. -.TP -.B --get-stack-traces -When paired with the -.B --timeout -option, -.I prun -will obtain and print out stack traces from all launched processes -that are still alive when the timeout expires. Note that obtaining -stack traces can take a little time and produce a lot of output, -especially for large process-count jobs. -. -. -.TP -.B -debugger\fR,\fP --debugger \fR\fP -Sequence of debuggers to search for when \fI--debug\fP is used (i.e. -a synonym for \fIorte_base_user_debugger\fP MCA parameter). -. -. -.TP -.B --timeout \fR -The maximum number of seconds that -.I prun -will run. After this many seconds, -.I prun -will abort the launched job and exit with a non-zero exit status. -Using -.B --timeout -can be also useful when combined with the -.B --get-stack-traces -option. -. -. -.TP -.B -tv\fR,\fP --tv -Launch processes under the TotalView debugger. -Deprecated backwards compatibility flag. Synonym for \fI--debug\fP. -. -. -. -. -.P -There are also other options: -. -. -.TP -.B --allow-run-as-root -Allow -.I prun -to run when executed by the root user -.RI ( prun -defaults to aborting when launched as the root user). -. -. -.TP -.B --app \fR\fP -Provide an appfile, ignoring all other command line options. -. -. -.TP -.B -cf\fR,\fP --cartofile \fR\fP -Provide a cartography file. -. -. -.TP -.B -continuous\fR,\fP --continuous -Job is to run until explicitly terminated. -. -. -.TP -.B -disable-recovery\fR,\fP --disable-recovery -Disable recovery (resets all recovery options to off). -. -. -.TP -.B -do-not-launch\fR,\fP --do-not-launch -Perform all necessary operations to prepare to launch the application, but do not actually launch it. -. -. -.TP -.B -do-not-resolve\fR,\fP --do-not-resolve -Do not attempt to resolve interfaces. -. -. -.TP -.B -enable-recovery\fR,\fP --enable-recovery -Enable recovery from process failure [Default = disabled]. -. -. -.TP -.B -index-argv-by-rank\fR,\fP --index-argv-by-rank -Uniquely index argv[0] for each process using its rank. -. -. -.TP -.B -max-restarts\fR,\fP --max-restarts \fR\fP -Max number of times to restart a failed process. -. -. -.TP -.B --ppr \fR\fP -Comma-separated list of number of processes on a given resource type [default: none]. -. -. -.TP -.B -report-child-jobs-separately\fR,\fP --report-child-jobs-separately -Return the exit status of the primary job only. -. -. -.TP -.B -report-events\fR,\fP --report-events \fR\fP -Report events to a tool listening at the specified URI. -. -. -.TP -.B -report-pid\fR,\fP --report-pid \fR\fP -Print out prun's PID during startup. The channel must be either a '-' to indicate -that the pid is to be output to stdout, a '+' to indicate that the pid is to be -output to stderr, or a filename to which the pid is to be written. -. -. -.TP -.B -report-uri\fR,\fP --report-uri \fR\fP -Print out prun's URI during startup. The channel must be either a '-' to indicate -that the URI is to be output to stdout, a '+' to indicate that the URI is to be -output to stderr, or a filename to which the URI is to be written. -. -. -.TP -.B -show-progress\fR,\fP --show-progress -Output a brief periodic report on launch progress. -. -. -.TP -.B -terminate\fR,\fP --terminate -Terminate the DVM. -. -. -.TP -.B -use-hwthread-cpus\fR,\fP --use-hwthread-cpus -Use hardware threads as independent cpus. -. -. -.TP -.B -use-regexp\fR,\fP --use-regexp -Use regular expressions for launch. -. -. -. -. -.P -The following options are useful for developers; they are not generally -useful to most users: -. -.TP -.B -d\fR,\fP --debug-devel -Enable debugging. This is not generally useful for most users. -. -. -.TP -.B -display-devel-allocation\fR,\fP --display-devel-allocation -Display a detailed list of the allocation being used by this job. -. -. -.TP -.B -display-devel-map\fR,\fP --display-devel-map -Display a more detailed table showing the mapped location of each process prior to launch. -. -. -.TP -.B -display-diffable-map\fR,\fP --display-diffable-map -Display a diffable process map just before launch. -. -. -.TP -.B -display-topo\fR,\fP --display-topo -Display the topology as part of the process map just before launch. -. -. -.TP -.B --report-state-on-timeout -When paired with the -.B --timeout -command line option, report the run-time subsystem state of each -process when the timeout expires. -. -. -.P -There may be other options listed with \fIprun --help\fP. -. -. -.\" ************************** -.\" Description Section -.\" ************************** -.SH DESCRIPTION -. -One invocation of \fIprun\fP starts an application running under PSRVR. If the application is single process multiple data (SPMD), the application -can be specified on the \fIprun\fP command line. - -If the application is multiple instruction multiple data (MIMD), comprising of -multiple programs, the set of programs and argument can be specified in one of -two ways: Extended Command Line Arguments, and Application Context. -.PP -An application context describes the MIMD program set including all arguments -in a separate file. -.\" See appcontext(5) for a description of the application context syntax. -This file essentially contains multiple \fIprun\fP command lines, less the -command name itself. The ability to specify different options for different -instantiations of a program is another reason to use an application context. -.PP -Extended command line arguments allow for the description of the application -layout on the command line using colons (\fI:\fP) to separate the specification -of programs and arguments. Some options are globally set across all specified -programs (e.g. --hostfile), while others are specific to a single program -(e.g. -np). -. -. -. -.SS Specifying Host Nodes -. -Host nodes can be identified on the \fIprun\fP command line with the \fI-host\fP -option or in a hostfile. -. -.PP -For example, -. -.TP 4 -prun -H aa,aa,bb ./a.out -launches two processes on node aa and one on bb. -. -.PP -Or, consider the hostfile -. - - \fB%\fP cat myhostfile - aa slots=2 - bb slots=2 - cc slots=2 - -. -.PP -Here, we list both the host names (aa, bb, and cc) but also how many "slots" -there are for each. Slots indicate how many processes can potentially execute -on a node. For best performance, the number of slots may be chosen to be the -number of cores on the node or the number of processor sockets. If the hostfile -does not provide slots information, PSRVR will attempt to discover the number -of cores (or hwthreads, if the use-hwthreads-as-cpus option is set) and set the -number of slots to that value. This default behavior also occurs when specifying -the \fI-host\fP option with a single hostname. Thus, the command -. -.TP 4 -prun -H aa ./a.out -launches a number of processes equal to the number of cores on node aa. -. -.PP -. -.TP 4 -prun -hostfile myhostfile ./a.out -will launch two processes on each of the three nodes. -. -.TP 4 -prun -hostfile myhostfile -host aa ./a.out -will launch two processes, both on node aa. -. -.TP 4 -prun -hostfile myhostfile -host dd ./a.out -will find no hosts to run on and abort with an error. -That is, the specified host dd is not in the specified hostfile. -. -.PP -When running under resource managers (e.g., SLURM, Torque, etc.), -PSRVR will obtain both the hostnames and the number of slots directly -from the resource manger. -. -.SS Specifying Number of Processes -. -As we have just seen, the number of processes to run can be set using the -hostfile. Other mechanisms exist. -. -.PP -The number of processes launched can be specified as a multiple of the -number of nodes or processor sockets available. For example, -. -.TP 4 -prun -H aa,bb -npersocket 2 ./a.out -launches processes 0-3 on node aa and process 4-7 on node bb, -where aa and bb are both dual-socket nodes. -The \fI-npersocket\fP option also turns on the \fI-bind-to-socket\fP option, -which is discussed in a later section. -. -.TP 4 -prun -H aa,bb -npernode 2 ./a.out -launches processes 0-1 on node aa and processes 2-3 on node bb. -. -.TP 4 -prun -H aa,bb -npernode 1 ./a.out -launches one process per host node. -. -.TP 4 -prun -H aa,bb -pernode ./a.out -is the same as \fI-npernode\fP 1. -. -. -.PP -Another alternative is to specify the number of processes with the -\fI-np\fP option. Consider now the hostfile -. - - \fB%\fP cat myhostfile - aa slots=4 - bb slots=4 - cc slots=4 - -. -.PP -Now, -. -.TP 4 -prun -hostfile myhostfile -np 6 ./a.out -will launch processes 0-3 on node aa and processes 4-5 on node bb. The remaining -slots in the hostfile will not be used since the \fI-np\fP option indicated -that only 6 processes should be launched. -. -.SS Mapping Processes to Nodes: Using Policies -. -The examples above illustrate the default mapping of process processes -to nodes. This mapping can also be controlled with various -\fIprun\fP options that describe mapping policies. -. -. -.PP -Consider the same hostfile as above, again with \fI-np\fP 6: -. - - node aa node bb node cc - - prun 0 1 2 3 4 5 - - prun --map-by node 0 3 1 4 2 5 - - prun -nolocal 0 1 2 3 4 5 -. -.PP -The \fI--map-by node\fP option will load balance the processes across -the available nodes, numbering each process in a round-robin fashion. -. -.PP -The \fI-nolocal\fP option prevents any processes from being mapped onto the -local host (in this case node aa). While \fIprun\fP typically consumes -few system resources, \fI-nolocal\fP can be helpful for launching very -large jobs where \fIprun\fP may actually need to use noticeable amounts -of memory and/or processing time. -. -.PP -Just as \fI-np\fP can specify fewer processes than there are slots, it can -also oversubscribe the slots. For example, with the same hostfile: -. -.TP 4 -prun -hostfile myhostfile -np 14 ./a.out -will launch processes 0-3 on node aa, 4-7 on bb, and 8-11 on cc. It will -then add the remaining two processes to whichever nodes it chooses. -. -.PP -One can also specify limits to oversubscription. For example, with the same -hostfile: -. -.TP 4 -prun -hostfile myhostfile -np 14 -nooversubscribe ./a.out -will produce an error since \fI-nooversubscribe\fP prevents oversubscription. -. -.PP -Limits to oversubscription can also be specified in the hostfile itself: -. - % cat myhostfile - aa slots=4 max_slots=4 - bb max_slots=4 - cc slots=4 -. -.PP -The \fImax_slots\fP field specifies such a limit. When it does, the -\fIslots\fP value defaults to the limit. Now: -. -.TP 4 -prun -hostfile myhostfile -np 14 ./a.out -causes the first 12 processes to be launched as before, but the remaining -two processes will be forced onto node cc. The other two nodes are -protected by the hostfile against oversubscription by this job. -. -.PP -Using the \fI--nooversubscribe\fR option can be helpful since PSRVR -currently does not get "max_slots" values from the resource manager. -. -.PP -Of course, \fI-np\fP can also be used with the \fI-H\fP or \fI-host\fP -option. For example, -. -.TP 4 -prun -H aa,bb -np 8 ./a.out -launches 8 processes. Since only two hosts are specified, after the first -two processes are mapped, one to aa and one to bb, the remaining processes -oversubscribe the specified hosts. -. -.PP -And here is a MIMD example: -. -.TP 4 -prun -H aa -np 1 hostname : -H bb,cc -np 2 uptime -will launch process 0 running \fIhostname\fP on node aa and processes 1 and 2 -each running \fIuptime\fP on nodes bb and cc, respectively. -. -.SS Mapping, Ranking, and Binding: Oh My! -. -PSRVR employs a three-phase procedure for assigning process locations and -ranks: -. -.TP 10 -\fBmapping\fP -Assigns a default location to each process -. -.TP 10 -\fBranking\fP -Assigns a rank value to each process -. -.TP 10 -\fBbinding\fP -Constrains each process to run on specific processors -. -.PP -The \fImapping\fP step is used to assign a default location to each process -based on the mapper being employed. Mapping by slot, node, and sequentially results -in the assignment of the processes to the node level. In contrast, mapping by object, allows -the mapper to assign the process to an actual object on each node. -. -.PP -\fBNote:\fP the location assigned to the process is independent of where it will be bound - the -assignment is used solely as input to the binding algorithm. -. -.PP -The mapping of process processes to nodes can be defined not just -with general policies but also, if necessary, using arbitrary mappings -that cannot be described by a simple policy. One can use the "sequential -mapper," which reads the hostfile line by line, assigning processes -to nodes in whatever order the hostfile specifies. Use the -\fI-pmca rmaps seq\fP option. For example, using the same hostfile -as before: -. -.PP -prun -hostfile myhostfile -pmca rmaps seq ./a.out -. -.PP -will launch three processes, one on each of nodes aa, bb, and cc, respectively. -The slot counts don't matter; one process is launched per line on -whatever node is listed on the line. -. -.PP -Another way to specify arbitrary mappings is with a rankfile, which -gives you detailed control over process binding as well. Rankfiles -are discussed below. -. -.PP -The second phase focuses on the \fIranking\fP of the process within -the job. PSRVR -separates this from the mapping procedure to allow more flexibility in the -relative placement of processes. This is best illustrated by considering the -following two cases where we used the —map-by ppr:2:socket option: -. -.PP - node aa node bb - - rank-by core 0 1 ! 2 3 4 5 ! 6 7 - - rank-by socket 0 2 ! 1 3 4 6 ! 5 7 - - rank-by socket:span 0 4 ! 1 5 2 6 ! 3 7 -. -.PP -Ranking by core and by slot provide the identical result - a simple -progression of ranks across each node. Ranking by -socket does a round-robin ranking within each node until all processes -have been assigned a rank, and then progresses to the next -node. Adding the \fIspan\fP modifier to the ranking directive causes -the ranking algorithm to treat the entire allocation as a single -entity - thus, the MCW ranks are assigned across all sockets before -circling back around to the beginning. -. -.PP -The \fIbinding\fP phase actually binds each process to a given set of processors. This can -improve performance if the operating system is placing processes -suboptimally. For example, it might oversubscribe some multi-core -processor sockets, leaving other sockets idle; this can lead -processes to contend unnecessarily for common resources. Or, it -might spread processes out too widely; this can be suboptimal if -application performance is sensitive to interprocess communication -costs. Binding can also keep the operating system from migrating -processes excessively, regardless of how optimally those processes -were placed to begin with. -. -.PP -The processors to be used for binding can be identified in terms of -topological groupings - e.g., binding to an l3cache will bind each -process to all processors within the scope of a single L3 cache within -their assigned location. Thus, if a process is assigned by the mapper -to a certain socket, then a \fI—bind-to l3cache\fP directive will -cause the process to be bound to the processors that share a single L3 -cache within that socket. -. -.PP -To help balance loads, the binding directive uses a round-robin method when binding to -levels lower than used in the mapper. For example, consider the case where a job is -mapped to the socket level, and then bound to core. Each socket will have multiple cores, -so if multiple processes are mapped to a given socket, the binding algorithm will assign -each process located to a socket to a unique core in a round-robin manner. -. -.PP -Alternatively, processes mapped by l2cache and then bound to socket will simply be bound -to all the processors in the socket where they are located. In this manner, users can -exert detailed control over relative MCW rank location and binding. -. -.PP -Finally, \fI--report-bindings\fP can be used to report bindings. -. -.PP -As an example, consider a node with two processor sockets, each comprising -four cores. We run \fIprun\fP with \fI-np 4 --report-bindings\fP and -the following additional options: -. - - % prun ... --map-by core --bind-to core - [...] ... binding child [...,0] to cpus 0001 - [...] ... binding child [...,1] to cpus 0002 - [...] ... binding child [...,2] to cpus 0004 - [...] ... binding child [...,3] to cpus 0008 - - % prun ... --map-by socket --bind-to socket - [...] ... binding child [...,0] to socket 0 cpus 000f - [...] ... binding child [...,1] to socket 1 cpus 00f0 - [...] ... binding child [...,2] to socket 0 cpus 000f - [...] ... binding child [...,3] to socket 1 cpus 00f0 - - % prun ... --map-by core:PE=2 --bind-to core - [...] ... binding child [...,0] to cpus 0003 - [...] ... binding child [...,1] to cpus 000c - [...] ... binding child [...,2] to cpus 0030 - [...] ... binding child [...,3] to cpus 00c0 - - % prun ... --bind-to none -. -.PP -Here, \fI--report-bindings\fP shows the binding of each process as a mask. -In the first case, the processes bind to successive cores as indicated by -the masks 0001, 0002, 0004, and 0008. In the second case, processes bind -to all cores on successive sockets as indicated by the masks 000f and 00f0. -The processes cycle through the processor sockets in a round-robin fashion -as many times as are needed. In the third case, the masks show us that -2 cores have been bound per process. In the fourth case, binding is -turned off and no bindings are reported. -. -.PP -PSRVR's support for process binding depends on the underlying -operating system. Therefore, certain process binding options may not be available -on every system. -. -.PP -Process binding can also be set with MCA parameters. -Their usage is less convenient than that of \fIprun\fP options. -On the other hand, MCA parameters can be set not only on the \fIprun\fP -command line, but alternatively in a system or user mca-params.conf file -or as environment variables, as described in the MCA section below. -Some examples include: -. -.PP - prun option MCA parameter key value - - --map-by core rmaps_base_mapping_policy core - --map-by socket rmaps_base_mapping_policy socket - --rank-by core rmaps_base_ranking_policy core - --bind-to core hwloc_base_binding_policy core - --bind-to socket hwloc_base_binding_policy socket - --bind-to none hwloc_base_binding_policy none -. -. -.SS Rankfiles -. -Rankfiles are text files that specify detailed information about how -individual processes should be mapped to nodes, and to which -processor(s) they should be bound. Each line of a rankfile specifies -the location of one process. The general form of each line in the -rankfile is: -. - - rank = slot= -. -.PP -For example: -. - - $ cat myrankfile - rank 0=aa slot=1:0-2 - rank 1=bb slot=0:0,1 - rank 2=cc slot=1-2 - $ prun -H aa,bb,cc,dd -rf myrankfile ./a.out -. -.PP -Means that -. - - Rank 0 runs on node aa, bound to logical socket 1, cores 0-2. - Rank 1 runs on node bb, bound to logical socket 0, cores 0 and 1. - Rank 2 runs on node cc, bound to logical cores 1 and 2. -. -.PP -Rankfiles can alternatively be used to specify \fIphysical\fP processor -locations. In this case, the syntax is somewhat different. Sockets are -no longer recognized, and the slot number given must be the number of -the physical PU as most OS's do not assign a unique physical identifier -to each core in the node. Thus, a proper physical rankfile looks something -like the following: -. - - $ cat myphysicalrankfile - rank 0=aa slot=1 - rank 1=bb slot=8 - rank 2=cc slot=6 -. -.PP -This means that -. - - Rank 0 will run on node aa, bound to the core that contains physical PU 1 - Rank 1 will run on node bb, bound to the core that contains physical PU 8 - Rank 2 will run on node cc, bound to the core that contains physical PU 6 -. -.PP -Rankfiles are treated as \fIlogical\fP by default, and the MCA parameter -rmaps_rank_file_physical must be set to 1 to indicate that the rankfile -is to be considered as \fIphysical\fP. -. -.PP -The hostnames listed above are "absolute," meaning that actual -resolveable hostnames are specified. However, hostnames can also be -specified as "relative," meaning that they are specified in relation -to an externally-specified list of hostnames (e.g., by prun's --host -argument, a hostfile, or a job scheduler). -. -.PP -The "relative" specification is of the form "+n", where X is an -integer specifying the Xth hostname in the set of all available -hostnames, indexed from 0. For example: -. - - $ cat myrankfile - rank 0=+n0 slot=1:0-2 - rank 1=+n1 slot=0:0,1 - rank 2=+n2 slot=1-2 - $ prun -H aa,bb,cc,dd -rf myrankfile ./a.out -. -.PP -All socket/core slot locations are be -specified as -.I logical -indexes. You can use tools such as HWLOC's "lstopo" to find the -logical indexes of socket and cores. -. -. -.SS Application Context or Executable Program? -. -To distinguish the two different forms, \fIprun\fP -looks on the command line for \fI--app\fP option. If -it is specified, then the file named on the command line is -assumed to be an application context. If it is not -specified, then the file is assumed to be an executable program. -. -. -. -.SS Locating Files -. -If no relative or absolute path is specified for a file, prun will first look for files by searching the directories specified -by the \fI--path\fP option. If there is no \fI--path\fP option set or -if the file is not found at the \fI--path\fP location, then prun -will search the user's PATH environment variable as defined on the -source node(s). -.PP -If a relative directory is specified, it must be relative to the initial -working directory determined by the specific starter used. For example when -using the rsh or ssh starters, the initial directory is $HOME by default. Other -starters may set the initial directory to the current working directory from -the invocation of \fIprun\fP. -. -. -. -.SS Current Working Directory -. -The \fI\-wdir\fP prun option (and its synonym, \fI\-wd\fP) allows -the user to change to an arbitrary directory before the program is -invoked. It can also be used in application context files to specify -working directories on specific nodes and/or for specific -applications. -.PP -If the \fI\-wdir\fP option appears both in a context file and on the -command line, the context file directory will override the command -line value. -.PP -If the \fI-wdir\fP option is specified, prun will attempt to -change to the specified directory on all of the remote nodes. If this -fails, \fIprun\fP will abort. -.PP -If the \fI-wdir\fP option is \fBnot\fP specified, prun will send -the directory name where \fIprun\fP was invoked to each of the -remote nodes. The remote nodes will try to change to that -directory. If they are unable (e.g., if the directory does not exist on -that node), then prun will use the default directory determined by -the starter. -.PP -All directory changing occurs before the user's program is invoked. -. -. -. -.SS Standard I/O -. -PSRVR directs UNIX standard input to /dev/null on all processes -except the rank 0 process. The rank 0 process -inherits standard input from \fIprun\fP. -.B Note: -The node that invoked \fIprun\fP need not be the same as the node where the -rank 0 process resides. PSRVR handles the redirection of -\fIprun\fP's standard input to the rank 0 process. -.PP -PSRVR directs UNIX standard output and error from remote nodes to the node -that invoked \fIprun\fP and prints it on the standard output/error of -\fIprun\fP. -Local processes inherit the standard output/error of \fIprun\fP and transfer -to it directly. -.PP -Thus it is possible to redirect standard I/O for applications by -using the typical shell redirection procedure on \fIprun\fP. - - \fB%\fP prun -np 2 my_app < my_input > my_output - -Note that in this example \fIonly\fP the rank 0 process will -receive the stream from \fImy_input\fP on stdin. The stdin on all the other -nodes will be tied to /dev/null. However, the stdout from all nodes will -be collected into the \fImy_output\fP file. -. -. -. -.SS Signal Propagation -. -When prun receives a SIGTERM and SIGINT, it will attempt to kill -the entire job by sending all processes in the job a SIGTERM, waiting -a small number of seconds, then sending all processes in the job a -SIGKILL. -. -.PP -SIGUSR1 and SIGUSR2 signals received by prun are propagated to -all processes in the job. -. -.PP -A SIGTSTOP signal to prun will cause a SIGSTOP signal to be sent -to all of the programs started by prun and likewise a SIGCONT signal -to prun will cause a SIGCONT sent. -. -.PP -Other signals are not currently propagated -by prun. -. -. -.SS Process Termination / Signal Handling -. -During the run of an application, if any process dies abnormally -(either exiting before invoking \fIPMIx_Finalize\fP, or dying as the result of a -signal), \fIprun\fP will print out an error message and kill the rest of the -application. -.PP -. -. -.SS Process Environment -. -Processes in the application inherit their environment from the -PSRVR daemon upon the node on which they are running. The -environment is typically inherited from the user's shell. On remote -nodes, the exact environment is determined by the boot MCA module -used. The \fIrsh\fR launch module, for example, uses either -\fIrsh\fR/\fIssh\fR to launch the PSRVR daemon on remote nodes, and -typically executes one or more of the user's shell-setup files before -launching the daemon. When running dynamically linked -applications which require the \fILD_LIBRARY_PATH\fR environment -variable to be set, care must be taken to ensure that it is correctly -set when booting PSRVR. -.PP -See the "Remote Execution" section for more details. -. -. -.SS Remote Execution -. -PSRVR requires that the \fIPATH\fR environment variable be set to -find executables on remote nodes (this is typically only necessary in -\fIrsh\fR- or \fIssh\fR-based environments -- batch/scheduled -environments typically copy the current environment to the execution -of remote jobs, so if the current environment has \fIPATH\fR and/or -\fILD_LIBRARY_PATH\fR set properly, the remote nodes will also have it -set properly). If PSRVR was compiled with shared library support, -it may also be necessary to have the \fILD_LIBRARY_PATH\fR environment -variable set on remote nodes as well (especially to find the shared -libraries required to run user applications). -.PP -However, it is not always desirable or possible to edit shell -startup files to set \fIPATH\fR and/or \fILD_LIBRARY_PATH\fR. The -\fI--prefix\fR option is provided for some simple configurations where -this is not possible. -.PP -The \fI--prefix\fR option takes a single argument: the base directory -on the remote node where PSRVR is installed. PSRVR will use -this directory to set the remote \fIPATH\fR and \fILD_LIBRARY_PATH\fR -before executing any user applications. This allows -running jobs without having pre-configured the \fIPATH\fR and -\fILD_LIBRARY_PATH\fR on the remote nodes. -.PP -PSRVR adds the basename of the current -node's "bindir" (the directory where PSRVR's executables are -installed) to the prefix and uses that to set the \fIPATH\fR on the -remote node. Similarly, PSRVR adds the basename of the current -node's "libdir" (the directory where PSRVR's libraries are -installed) to the prefix and uses that to set the -\fILD_LIBRARY_PATH\fR on the remote node. For example: -.TP 15 -Local bindir: -/local/node/directory/bin -.TP -Local libdir: -/local/node/directory/lib64 -.PP -If the following command line is used: - - \fB%\fP prun --prefix /remote/node/directory - -PSRVR will add "/remote/node/directory/bin" to the \fIPATH\fR -and "/remote/node/directory/lib64" to the \fLD_LIBRARY_PATH\fR on the -remote node before attempting to execute anything. -.PP -The \fI--prefix\fR option is not sufficient if the installation paths -on the remote node are different than the local node (e.g., if "/lib" -is used on the local node, but "/lib64" is used on the remote node), -or if the installation paths are something other than a subdirectory -under a common prefix. -.PP -Note that executing \fIprun\fR via an absolute pathname is -equivalent to specifying \fI--prefix\fR without the last subdirectory -in the absolute pathname to \fIprun\fR. For example: - - \fB%\fP /usr/local/bin/prun ... - -is equivalent to - - \fB%\fP prun --prefix /usr/local -. -. -. -.SS Exported Environment Variables -. -All environment variables that are named in the form PMIX_* will automatically -be exported to new processes on the local and remote nodes. Environmental -parameters can also be set/forwarded to the new processes using the MCA -parameter \fImca_base_env_list\fP. While the syntax of the \fI\-x\fP option and MCA param -allows the definition of new variables, note that the parser -for these options are currently not very sophisticated - it does not even -understand quoted values. Users are advised to set variables in the -environment and use the option to export them; not to define them. -. -. -. -.SS Setting MCA Parameters -. -The \fI-pmca\fP switch allows the passing of parameters to various MCA -(Modular Component Architecture) modules. -.\" PSRVR's MCA modules are described in detail in psrvrmca(7). -MCA modules have direct impact on programs because they allow tunable -parameters to be set at run time (such as which BTL communication device driver -to use, what parameters to pass to that BTL, etc.). -.PP -The \fI-pmca\fP switch takes two arguments: \fI\fP and \fI\fP. -The \fI\fP argument generally specifies which MCA module will receive the value. -For example, the \fI\fP "btl" is used to select which BTL to be used for -transporting messages. The \fI\fP argument is the value that is -passed. -For example: -. -.TP 4 -prun -pmca btl tcp,self -np 1 foo -Tells PSRVR to use the "tcp" and "self" BTLs, and to run a single copy of -"foo" on an allocated node. -. -.TP -prun -pmca btl self -np 1 foo -Tells PSRVR to use the "self" BTL, and to run a single copy of "foo" on an -allocated node. -.\" And so on. PSRVR's BTL MCA modules are described in psrvrmca_btl(7). -.PP -The \fI-pmca\fP switch can be used multiple times to specify different -\fI\fP and/or \fI\fP arguments. If the same \fI\fP is -specified more than once, the \fI\fPs are concatenated with a comma -(",") separating them. -.PP -Note that the \fI-pmca\fP switch is simply a shortcut for setting environment variables. -The same effect may be accomplished by setting corresponding environment -variables before running \fIprun\fP. -The form of the environment variables that PSRVR sets is: - - PMIX_MCA_= -.PP -Thus, the \fI-pmca\fP switch overrides any previously set environment -variables. The \fI-pmca\fP settings similarly override MCA parameters set -in the -$OPAL_PREFIX/etc/psrvr-mca-params.conf or $HOME/.psrvr/mca-params.conf -file. -. -.PP -Unknown \fI\fP arguments are still set as -environment variable -- they are not checked (by \fIprun\fP) for correctness. -Illegal or incorrect \fI\fP arguments may or may not be reported -- it -depends on the specific MCA module. -.PP -To find the available component types under the MCA architecture, or to find the -available parameters for a specific component, use the \fIpinfo\fP command. -See the \fIpinfo(1)\fP man page for detailed information on the command. -. -. -. -.SS Setting MCA parameters and environment variables from file. -The \fI-tune\fP command line option and its synonym \fI-pmca mca_base_envar_file_prefix\fP allows a user -to set mca parameters and environment variables with the syntax described below. -This option requires a single file or list of files separated by "," to follow. -.PP -A valid line in the file may contain zero or many "-x", "-pmca", or “--pmca†arguments. -The following patterns are supported: -pmca var val -pmca var "val" -x var=val -x var. -If any argument is duplicated in the file, the last value read will be used. -.PP -MCA parameters and environment specified on the command line have higher precedence than variables specified in the file. -. -. -. -.SS Running as root -. -The PSRVR team strongly advises against executing -.I prun -as the root user. Applications should be run as regular -(non-root) users. -. -.PP -Reflecting this advice, prun will refuse to run as root by default. -To override this default, you can add the -.I --allow-run-as-root -option to the -.I prun -command line. -. -.SS Exit status -. -There is no standard definition for what \fIprun\fP should return as an exit -status. After considerable discussion, we settled on the following method for -assigning the \fIprun\fP exit status (note: in the following description, -the "primary" job is the initial application started by prun - all jobs that -are spawned by that job are designated "secondary" jobs): -. -.IP \[bu] 2 -if all processes in the primary job normally terminate with exit status 0, we return 0 -.IP \[bu] -if one or more processes in the primary job normally terminate with non-zero exit status, -we return the exit status of the process with the lowest rank to have a non-zero status -.IP \[bu] -if all processes in the primary job normally terminate with exit status 0, and one or more -processes in a secondary job normally terminate with non-zero exit status, we (a) return -the exit status of the process with the lowest rank in the lowest jobid to have a non-zero -status, and (b) output a message summarizing the exit status of the primary and all secondary jobs. -.IP \[bu] -if the cmd line option --report-child-jobs-separately is set, we will return -only- the -exit status of the primary job. Any non-zero exit status in secondary jobs will be -reported solely in a summary print statement. -. -.PP -By default, PSRVR records and notes that processes exited with non-zero termination status. -This is generally not considered an "abnormal termination" - i.e., PSRVR will not abort a -job if one or more processes return a non-zero status. Instead, the default behavior simply -reports the number of processes terminating with non-zero status upon completion of the job. -.PP -However, in some cases it can be desirable to have the job abort when any process terminates -with non-zero status. For example, a non-PMIx job might detect a bad result from a calculation -and want to abort, but doesn't want to generate a core file. Or a PMIx job might continue past -a call to PMIx_Finalize, but indicate that all processes should abort due to some post-PMIx result. -.PP -It is not anticipated that this situation will occur frequently. However, in the interest of -serving the broader community, PSRVR now has a means for allowing users to direct that jobs be -aborted upon any process exiting with non-zero status. Setting the MCA parameter -"orte_abort_on_non_zero_status" to 1 will cause PSRVR to abort all processes once any process - exits with non-zero status. -.PP -Terminations caused in this manner will be reported on the console as an "abnormal termination", -with the first process to so exit identified along with its exit status. -.PP -.\" ************************** -.\" Return Value Section -.\" ************************** -. -.SH RETURN VALUE -. -\fIprun\fP returns 0 if all processes started by \fIprun\fP exit after calling -PMIx_Finalize. A non-zero value is returned if an internal error occurred in -prun, or one or more processes exited before calling PMIx_Finalize. If an -internal error occurred in prun, the corresponding error code is returned. -In the event that one or more processes exit before calling PMIx_Finalize, the -return value of the rank of the process that \fIprun\fP first notices died -before calling PMIx_Finalize will be returned. Note that, in general, this will -be the first process that died but is not guaranteed to be so. -. -.PP -If the -.B --timeout -command line option is used and the timeout expires before the job -completes (thereby forcing -.I prun -to kill the job) -.I prun -will return an exit status equivalent to the value of -.B ETIMEDOUT -(which is typically 110 on Linux and OS X systems). - -. -.\" ************************** -.\" See Also Section -.\" ************************** -. diff --git a/orte/tools/ompi-prun/prun.c b/orte/tools/ompi-prun/prun.c deleted file mode 100644 index 17683b803f5..00000000000 --- a/orte/tools/ompi-prun/prun.c +++ /dev/null @@ -1,1373 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2007-2017 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#include -#include -#ifdef HAVE_STRINGS_H -#include -#endif /* HAVE_STRINGS_H */ -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ -#ifdef HAVE_SYS_WAIT_H -#include -#endif /* HAVE_SYS_WAIT_H */ -#ifdef HAVE_SYS_TIME_H -#include -#endif /* HAVE_SYS_TIME_H */ -#include -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#include "opal/mca/event/event.h" -#include "opal/mca/installdirs/installdirs.h" -#include "opal/mca/pmix/base/base.h" -#include "opal/mca/base/base.h" -#include "opal/util/argv.h" -#include "opal/util/output.h" -#include "opal/util/basename.h" -#include "opal/util/cmd_line.h" -#include "opal/util/opal_environ.h" -#include "opal/util/opal_getcwd.h" -#include "opal/util/show_help.h" -#include "opal/util/fd.h" -#include "opal/sys/atomic.h" - -#include "opal/version.h" -#include "opal/runtime/opal.h" -#include "opal/runtime/opal_info_support.h" -#include "opal/runtime/opal_progress_threads.h" -#include "opal/util/os_path.h" -#include "opal/util/path.h" -#include "opal/class/opal_pointer_array.h" -#include "opal/dss/dss.h" - -#include "orte/runtime/runtime.h" -#include "orte/runtime/orte_globals.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/schizo/base/base.h" -#include "orte/mca/state/state.h" -#include "orte/orted/orted_submit.h" - -/* ensure I can behave like a daemon */ -#include "prun.h" - -typedef struct { - opal_object_t super; - opal_pmix_lock_t lock; - opal_list_t info; -} myinfo_t; -static void mcon(myinfo_t *p) -{ - OPAL_PMIX_CONSTRUCT_LOCK(&p->lock); - OBJ_CONSTRUCT(&p->info, opal_list_t); -} -static void mdes(myinfo_t *p) -{ - OPAL_PMIX_DESTRUCT_LOCK(&p->lock); - OPAL_LIST_DESTRUCT(&p->info); -} -static OBJ_CLASS_INSTANCE(myinfo_t, opal_object_t, - mcon, mdes); - -static struct { - bool terminate_dvm; - bool system_server_first; - bool system_server_only; - int pid; -} myoptions; - -static opal_list_t job_info; -static volatile bool active = false; -static orte_jobid_t myjobid = ORTE_JOBID_INVALID; -static myinfo_t myinfo; - -static int create_app(int argc, char* argv[], - opal_list_t *jdata, - opal_pmix_app_t **app, - bool *made_app, char ***app_env); -static int parse_locals(opal_list_t *jdata, int argc, char* argv[]); -static void set_classpath_jar_file(opal_pmix_app_t *app, int index, char *jarfile); -static size_t evid = INT_MAX; - - -static opal_cmd_line_init_t cmd_line_init[] = { - /* tell the dvm to terminate */ - { NULL, '\0', "terminate", "terminate", 0, - &myoptions.terminate_dvm, OPAL_CMD_LINE_TYPE_BOOL, - "Terminate the DVM", OPAL_CMD_LINE_OTYPE_DVM }, - - /* look first for a system server */ - { NULL, '\0', "system-server-first", "system-server-first", 0, - &myoptions.system_server_first, OPAL_CMD_LINE_TYPE_BOOL, - "First look for a system server and connect to it if found", OPAL_CMD_LINE_OTYPE_DVM }, - - /* connect only to a system server */ - { NULL, '\0', "system-server-only", "system-server-only", 0, - &myoptions.system_server_only, OPAL_CMD_LINE_TYPE_BOOL, - "Connect only to a system-level server", OPAL_CMD_LINE_OTYPE_DVM }, - - /* provide a connection PID */ - { NULL, '\0', "pid", "pid", 1, - &myoptions.pid, OPAL_CMD_LINE_TYPE_INT, - "PID of the session-level daemon to which we should connect", - OPAL_CMD_LINE_OTYPE_DVM }, - - /* End of list */ - { NULL, '\0', NULL, NULL, 0, - NULL, OPAL_CMD_LINE_TYPE_NULL, NULL } -}; - - -static void infocb(int status, - opal_list_t *info, - void *cbdata, - opal_pmix_release_cbfunc_t release_fn, - void *release_cbdata) -{ - opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata; - OPAL_ACQUIRE_OBJECT(lock); - - if (NULL != release_fn) { - release_fn(release_cbdata); - } - OPAL_PMIX_WAKEUP_THREAD(lock); -} - -static void regcbfunc(int status, size_t ref, void *cbdata) -{ - opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata; - OPAL_ACQUIRE_OBJECT(lock); - evid = ref; - OPAL_PMIX_WAKEUP_THREAD(lock); -} - -static void opcbfunc(int status, void *cbdata) -{ - opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata; - OPAL_ACQUIRE_OBJECT(lock); - OPAL_PMIX_WAKEUP_THREAD(lock); -} - -static bool fired = false; -static void evhandler(int status, - const opal_process_name_t *source, - opal_list_t *info, opal_list_t *results, - opal_pmix_notification_complete_fn_t cbfunc, - void *cbdata) -{ - opal_value_t *val; - int jobstatus=0; - orte_jobid_t jobid = ORTE_JOBID_INVALID; - - /* we should always have info returned to us - if not, there is - * nothing we can do */ - if (NULL != info) { - OPAL_LIST_FOREACH(val, info, opal_value_t) { - if (0 == strcmp(val->key, OPAL_PMIX_JOB_TERM_STATUS)) { - jobstatus = val->data.integer; - } else if (0 == strcmp(val->key, OPAL_PMIX_PROCID)) { - jobid = val->data.name.jobid; - } - } - if (orte_cmd_options.verbose && (myjobid != ORTE_JOBID_INVALID && jobid == myjobid)) { - opal_output(0, "JOB %s COMPLETED WITH STATUS %d", - ORTE_JOBID_PRINT(jobid), jobstatus); - } - } - - /* only terminate if this was our job - keep in mind that we - * can get notifications of job termination prior to our spawn - * having completed! */ - if (!fired && (myjobid != ORTE_JOBID_INVALID && jobid == myjobid)) { - fired = true; - active = false; - } - - /* we _always_ have to execute the evhandler callback or - * else the event progress engine will hang */ - if (NULL != cbfunc) { - cbfunc(OPAL_SUCCESS, NULL, NULL, NULL, cbdata); - } -} - -typedef struct { - opal_pmix_lock_t lock; - opal_list_t list; -} mylock_t; - - -static void setupcbfunc(int status, - opal_list_t *info, - void *provided_cbdata, - opal_pmix_op_cbfunc_t cbfunc, void *cbdata) -{ - mylock_t *mylock = (mylock_t*)provided_cbdata; - opal_value_t *kv; - - if (NULL != info) { - /* cycle across the provided info */ - while (NULL != (kv = (opal_value_t*)opal_list_remove_first(info))) { - opal_list_append(&mylock->list, &kv->super); - } - } - - /* release the caller */ - if (NULL != cbfunc) { - cbfunc(OPAL_SUCCESS, cbdata); - } - - OPAL_PMIX_WAKEUP_THREAD(&mylock->lock); -} - -static void launchhandler(int status, - const opal_process_name_t *source, - opal_list_t *info, opal_list_t *results, - opal_pmix_notification_complete_fn_t cbfunc, - void *cbdata) -{ - opal_value_t *p; - - /* the info list will include the launch directives, so - * transfer those to the myinfo_t for return to the main thread */ - while (NULL != (p = (opal_value_t*)opal_list_remove_first(info))) { - opal_list_append(&myinfo.info, &p->super); - } - - /* we _always_ have to execute the evhandler callback or - * else the event progress engine will hang */ - if (NULL != cbfunc) { - cbfunc(OPAL_SUCCESS, NULL, NULL, NULL, cbdata); - } - - /* now release the thread */ - OPAL_PMIX_WAKEUP_THREAD(&myinfo.lock); -} - -int prun(int argc, char *argv[]) -{ - int rc, i; - char *param; - opal_pmix_lock_t lock; - opal_list_t apps, *lt; - opal_pmix_app_t *app; - opal_value_t *val, *kv, *kv2; - opal_list_t info, codes; - struct timespec tp = {0, 100000}; - mylock_t mylock; - - /* init the globals */ - memset(&orte_cmd_options, 0, sizeof(orte_cmd_options)); - memset(&myoptions, 0, sizeof(myoptions)); - OBJ_CONSTRUCT(&job_info, opal_list_t); - OBJ_CONSTRUCT(&apps, opal_list_t); - - /* search the argv for MCA params */ - for (i=0; NULL != argv[i]; i++) { - if (':' == argv[i][0] || - NULL == argv[i+1] || NULL == argv[i+2]) { - break; - } - if (0 == strncmp(argv[i], "-"OPAL_MCA_CMD_LINE_ID, strlen("-"OPAL_MCA_CMD_LINE_ID)) || - 0 == strncmp(argv[i], "--"OPAL_MCA_CMD_LINE_ID, strlen("--"OPAL_MCA_CMD_LINE_ID)) || - 0 == strncmp(argv[i], "-g"OPAL_MCA_CMD_LINE_ID, strlen("-g"OPAL_MCA_CMD_LINE_ID)) || - 0 == strncmp(argv[i], "--g"OPAL_MCA_CMD_LINE_ID, strlen("--g"OPAL_MCA_CMD_LINE_ID))) { - (void) mca_base_var_env_name (argv[i+1], ¶m); - opal_setenv(param, argv[i+2], true, &environ); - free(param); - } else if (0 == strcmp(argv[i], "-am") || - 0 == strcmp(argv[i], "--am")) { - (void)mca_base_var_env_name("mca_base_param_file_prefix", ¶m); - opal_setenv(param, argv[i+1], true, &environ); - free(param); - } else if (0 == strcmp(argv[i], "-tune") || - 0 == strcmp(argv[i], "--tune")) { - (void)mca_base_var_env_name("mca_base_envar_file_prefix", ¶m); - opal_setenv(param, argv[i+1], true, &environ); - free(param); - } - } - - /* init only the util portion of OPAL */ - if (OPAL_SUCCESS != (rc = opal_init_util(&argc, &argv))) { - return rc; - } - - /* set our proc type for schizo selection */ - orte_process_info.proc_type = ORTE_PROC_TOOL; - - /* open the SCHIZO framework so we can setup the command line */ - if (ORTE_SUCCESS != (rc = mca_base_framework_open(&orte_schizo_base_framework, 0))) { - ORTE_ERROR_LOG(rc); - return rc; - } - if (ORTE_SUCCESS != (rc = orte_schizo_base_select())) { - ORTE_ERROR_LOG(rc); - return rc; - } - - /* setup our cmd line */ - orte_cmd_line = OBJ_NEW(opal_cmd_line_t); - if (OPAL_SUCCESS != (rc = opal_cmd_line_add(orte_cmd_line, cmd_line_init))) { - return rc; - } - - /* setup the rest of the cmd line only once */ - if (OPAL_SUCCESS != (rc = orte_schizo.define_cli(orte_cmd_line))) { - return rc; - } - - /* now that options have been defined, finish setup */ - mca_base_cmd_line_setup(orte_cmd_line); - - /* parse the result to get values */ - if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(orte_cmd_line, - true, false, argc, argv)) ) { - if (OPAL_ERR_SILENT != rc) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(rc)); - } - return rc; - } - - /* see if print version is requested. Do this before - * check for help so that --version --help works as - * one might expect. */ - if (orte_cmd_options.version) { - char *str; - str = opal_info_make_version_str("all", - OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION, - OPAL_GREEK_VERSION, - OPAL_REPO_REV); - if (NULL != str) { - fprintf(stdout, "%s (%s) %s\n\nReport bugs to %s\n", - "prun", "PMIx Reference Server", str, PACKAGE_BUGREPORT); - free(str); - } - exit(0); - } - - /* check if we are running as root - if we are, then only allow - * us to proceed if the allow-run-as-root flag was given. Otherwise, - * exit with a giant warning flag - */ - if (0 == geteuid() && !orte_cmd_options.run_as_root) { - /* show_help is not yet available, so print an error manually */ - fprintf(stderr, "--------------------------------------------------------------------------\n"); - if (orte_cmd_options.help) { - fprintf(stderr, "prun cannot provide the help message when run as root.\n\n"); - } else { - fprintf(stderr, "prun has detected an attempt to run as root.\n\n"); - } - - fprintf(stderr, "Running as root is *strongly* discouraged as any mistake (e.g., in\n"); - fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n"); - fprintf(stderr, "file system, leaving your system in an unusable state.\n\n"); - - fprintf(stderr, "We strongly suggest that you run prun as a non-root user.\n\n"); - - fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n"); - fprintf(stderr, "option to your command line. However, we reiterate our strong advice\n"); - fprintf(stderr, "against doing so - please do so at your own risk.\n"); - fprintf(stderr, "--------------------------------------------------------------------------\n"); - exit(1); - } - - /* process any mca params */ - rc = mca_base_cmd_line_process_args(orte_cmd_line, &environ, &environ); - if (ORTE_SUCCESS != rc) { - return rc; - } - - /* Check for help request */ - if (orte_cmd_options.help) { - char *str, *args = NULL; - args = opal_cmd_line_get_usage_msg(orte_cmd_line); - str = opal_show_help_string("help-orterun.txt", "orterun:usage", false, - "prun", "PSVR", OPAL_VERSION, - "prun", args, - PACKAGE_BUGREPORT); - if (NULL != str) { - printf("%s", str); - free(str); - } - free(args); - - /* If someone asks for help, that should be all we do */ - exit(0); - } - - /* ensure we ONLY take the ess/tool component */ - opal_setenv(OPAL_MCA_PREFIX"ess", "tool", true, &environ); - /* tell the ess/tool component how we want to connect */ - if (myoptions.system_server_only) { - opal_setenv(OPAL_MCA_PREFIX"ess_tool_system_server_only", "1", true, &environ); - } - if (myoptions.system_server_first) { - opal_setenv(OPAL_MCA_PREFIX"ess_tool_system_server_first", "1", true, &environ); - } - /* if they specified the DVM's pid, then pass it along */ - if (0 != myoptions.pid) { - asprintf(¶m, "%d", myoptions.pid); - opal_setenv(OPAL_MCA_PREFIX"ess_tool_server_pid", param, true, &environ); - free(param); - } - /* if they specified the URI, then pass it along */ - if (NULL != orte_cmd_options.hnp) { - opal_setenv("PMIX_MCA_ptl_tcp_server_uri", orte_cmd_options.hnp, true, &environ); - } - - /* now initialize ORTE */ - if (OPAL_SUCCESS != (rc = orte_init(&argc, &argv, ORTE_PROC_TOOL))) { - OPAL_ERROR_LOG(rc); - return rc; - } - - /* if the user just wants us to terminate a DVM, then do so */ - if (myoptions.terminate_dvm) { - OBJ_CONSTRUCT(&info, opal_list_t); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_JOB_CTRL_TERMINATE); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&info, &val->super); - fprintf(stderr, "TERMINATING DVM..."); - OPAL_PMIX_CONSTRUCT_LOCK(&lock); - rc = opal_pmix.job_control(NULL, &info, infocb, (void*)&lock); - OPAL_PMIX_WAIT_THREAD(&lock); - OPAL_PMIX_DESTRUCT_LOCK(&lock); - OPAL_LIST_DESTRUCT(&info); - fprintf(stderr, "DONE\n"); - goto DONE; - } - - /* get here if they want to run an application, so let's parse - * the cmd line to get it */ - - if (OPAL_SUCCESS != (rc = parse_locals(&apps, argc, argv))) { - OPAL_ERROR_LOG(rc); - OPAL_LIST_DESTRUCT(&apps); - goto DONE; - } - - /* bozo check */ - if (0 == opal_list_get_size(&apps)) { - opal_output(0, "No application specified!"); - goto DONE; - } - - /* init flag */ - active = true; - - /* register for job terminations so we get notified when - * our job completes */ - OPAL_PMIX_CONSTRUCT_LOCK(&lock); - OBJ_CONSTRUCT(&info, opal_list_t); - val = OBJ_NEW(opal_value_t); - val->key = strdup("foo"); - val->type = OPAL_INT; - val->data.integer = OPAL_ERR_JOB_TERMINATED; - opal_list_append(&info, &val->super); - opal_pmix.register_evhandler(&info, NULL, evhandler, regcbfunc, &lock); - OPAL_PMIX_WAIT_THREAD(&lock); - OPAL_PMIX_DESTRUCT_LOCK(&lock); - OPAL_LIST_DESTRUCT(&info); - - /* we want to be notified upon job completion */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_NOTIFY_COMPLETION); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - - /* see if they specified the personality */ - if (NULL != orte_cmd_options.personality) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PERSONALITY); - val->type = OPAL_STRING; - val->data.string = strdup(orte_cmd_options.personality); - opal_list_append(&job_info, &val->super); - } - - /* check for stdout/err directives */ - /* if we were asked to tag output, mark it so */ - if (orte_cmd_options.tag_output) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_TAG_OUTPUT); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - /* if we were asked to timestamp output, mark it so */ - if (orte_cmd_options.timestamp_output) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_TIMESTAMP_OUTPUT); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - /* if we were asked to output to files, pass it along */ - if (NULL != orte_cmd_options.output_filename) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_OUTPUT_TO_FILE); - val->type = OPAL_STRING; - /* if the given filename isn't an absolute path, then - * convert it to one so the name will be relative to - * the directory where prun was given as that is what - * the user will have seen */ - if (!opal_path_is_absolute(orte_cmd_options.output_filename)) { - char cwd[OPAL_PATH_MAX]; - getcwd(cwd, sizeof(cwd)); - val->data.string = opal_os_path(false, cwd, orte_cmd_options.output_filename, NULL); - } else { - val->data.string = strdup(orte_cmd_options.output_filename); - } - opal_list_append(&job_info, &val->super); - } - /* if we were asked to merge stderr to stdout, mark it so */ - if (orte_cmd_options.merge) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_MERGE_STDERR_STDOUT); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - - /* check what user wants us to do with stdin */ - if (NULL != orte_cmd_options.stdin_target) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_STDIN_TGT); - val->type = OPAL_UINT32; - opal_list_append(&job_info, &val->super); - if (0 == strcmp(orte_cmd_options.stdin_target, "all")) { - val->data.uint32 = ORTE_VPID_WILDCARD; - } else if (0 == strcmp(orte_cmd_options.stdin_target, "none")) { - val->data.uint32 = ORTE_VPID_INVALID; - } else { - val->data.uint32 = strtoul(orte_cmd_options.stdin_target, NULL, 10); - } - } - - /* if we want the argv's indexed, indicate that */ - if (orte_cmd_options.index_argv) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_INDEX_ARGV); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - - if (NULL != orte_cmd_options.mapping_policy) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_MAPBY); - val->type = OPAL_STRING; - val->data.string = strdup(orte_cmd_options.mapping_policy); - opal_list_append(&job_info, &val->super); - } else if (orte_cmd_options.pernode) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PPR); - val->type = OPAL_STRING; - val->data.string = strdup("1:node"); - opal_list_append(&job_info, &val->super); - } else if (0 < orte_cmd_options.npernode) { - /* define the ppr */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PPR); - val->type = OPAL_STRING; - (void)asprintf(&val->data.string, "%d:node", orte_cmd_options.npernode); - opal_list_append(&job_info, &val->super); - } else if (0 < orte_cmd_options.npersocket) { - /* define the ppr */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PPR); - val->type = OPAL_STRING; - (void)asprintf(&val->data.string, "%d:socket", orte_cmd_options.npernode); - opal_list_append(&job_info, &val->super); - } - - /* if the user specified cpus/rank, set it */ - if (0 < orte_cmd_options.cpus_per_proc) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_CPUS_PER_PROC); - val->type = OPAL_UINT32; - val->data.uint32 = orte_cmd_options.cpus_per_proc; - opal_list_append(&job_info, &val->super); - } - - /* if the user specified a ranking policy, then set it */ - if (NULL != orte_cmd_options.ranking_policy) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_RANKBY); - val->type = OPAL_STRING; - val->data.string = strdup(orte_cmd_options.ranking_policy); - opal_list_append(&job_info, &val->super); - } - - /* if the user specified a binding policy, then set it */ - if (NULL != orte_cmd_options.binding_policy) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_BINDTO); - val->type = OPAL_STRING; - val->data.string = strdup(orte_cmd_options.binding_policy); - opal_list_append(&job_info, &val->super); - } - - /* if they asked for nolocal, mark it so */ - if (orte_cmd_options.nolocal) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_NO_PROCS_ON_HEAD); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - if (orte_cmd_options.no_oversubscribe) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_NO_OVERSUBSCRIBE); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - if (orte_cmd_options.oversubscribe) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_NO_OVERSUBSCRIBE); - val->type = OPAL_BOOL; - val->data.flag = false; - opal_list_append(&job_info, &val->super); - } - if (orte_cmd_options.report_bindings) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_REPORT_BINDINGS); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - if (NULL != orte_cmd_options.cpu_list) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_CPU_LIST); - val->type = OPAL_STRING; - val->data.string = strdup(orte_cmd_options.cpu_list); - opal_list_append(&job_info, &val->super); - } - - /* mark if recovery was enabled on the cmd line */ - if (orte_enable_recovery) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_JOB_RECOVERABLE); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - /* record the max restarts */ - if (0 < orte_max_restarts) { - OPAL_LIST_FOREACH(app, &apps, opal_pmix_app_t) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_MAX_RESTARTS); - val->type = OPAL_UINT32; - val->data.uint32 = orte_max_restarts; - opal_list_append(&app->info, &val->super); - } - } - /* if continuous operation was specified */ - if (orte_cmd_options.continuous) { - /* mark this job as continuously operating */ - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_JOB_CONTINUOUS); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&job_info, &val->super); - } - - /* pickup any relevant envars */ - if (NULL != opal_pmix.server_setup_application) { - OBJ_CONSTRUCT(&info, opal_list_t); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_SETUP_APP_ENVARS); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&info, &val->super); - - OPAL_PMIX_CONSTRUCT_LOCK(&mylock.lock); - OBJ_CONSTRUCT(&mylock.list, opal_list_t); - rc = opal_pmix.server_setup_application(ORTE_PROC_MY_NAME->jobid, - &info, setupcbfunc, &mylock); - if (OPAL_SUCCESS != rc) { - OPAL_LIST_DESTRUCT(&info); - OPAL_PMIX_DESTRUCT_LOCK(&mylock.lock); - OBJ_DESTRUCT(&mylock.list); - goto DONE; - } - OPAL_PMIX_WAIT_THREAD(&mylock.lock); - OPAL_PMIX_DESTRUCT_LOCK(&mylock.lock); - /* transfer any returned ENVARS to the job_info */ - while (NULL != (val = (opal_value_t*)opal_list_remove_first(&mylock.list))) { - if (0 == strcmp(val->key, OPAL_PMIX_SET_ENVAR) || - 0 == strcmp(val->key, OPAL_PMIX_ADD_ENVAR) || - 0 == strcmp(val->key, OPAL_PMIX_UNSET_ENVAR) || - 0 == strcmp(val->key, OPAL_PMIX_PREPEND_ENVAR) || - 0 == strcmp(val->key, OPAL_PMIX_APPEND_ENVAR)) { - opal_list_append(&job_info, &val->super); - } else { - OBJ_RELEASE(val); - } - } - OPAL_LIST_DESTRUCT(&mylock.list); - } - - /* if we were launched by a tool wanting to direct our - * operation, then we need to pause here and give it - * a chance to tell us what we need to do */ - if (NULL != (param = getenv("PMIX_LAUNCHER_PAUSE_FOR_TOOL")) && - 0 == strcmp(param, "1")) { - /* register for the PMIX_LAUNCH_DIRECTIVE event */ - OPAL_PMIX_CONSTRUCT_LOCK(&lock); - OBJ_CONSTRUCT(&codes, opal_list_t); - val = OBJ_NEW(opal_value_t); - val->key = strdup("foo"); - val->type = OPAL_INT; - val->data.integer = OPAL_PMIX_LAUNCH_DIRECTIVE; - opal_list_append(&codes, &val->super); - /* setup the myinfo object to capture the returned - * values - must do so prior to registering in case - * the event has already arrived */ - OBJ_CONSTRUCT(&myinfo, myinfo_t); - /* go ahead and register */ - opal_pmix.register_evhandler(&codes, NULL, launchhandler, regcbfunc, &lock); - OPAL_PMIX_WAIT_THREAD(&lock); - OPAL_PMIX_DESTRUCT_LOCK(&lock); - OPAL_LIST_DESTRUCT(&codes); - /* now wait for the launch directives to arrive */ - OPAL_PMIX_WAIT_THREAD(&myinfo.lock); - /* process the returned directives */ - OPAL_LIST_FOREACH(val, &myinfo.info, opal_value_t) { - if (0 == strcmp(val->key, OPAL_PMIX_DEBUG_JOB_DIRECTIVES)) { - /* there will be a pointer to a list containing the directives */ - lt = (opal_list_t*)val->data.ptr; - while (NULL != (kv = (opal_value_t*)opal_list_remove_first(lt))) { - opal_output(0, "JOB DIRECTIVE: %s", kv->key); - opal_list_append(&job_info, &kv->super); - } - } else if (0 == strcmp(val->key, OPAL_PMIX_DEBUG_APP_DIRECTIVES)) { - /* there will be a pointer to a list containing the directives */ - lt = (opal_list_t*)val->data.ptr; - OPAL_LIST_FOREACH(kv, lt, opal_value_t) { - opal_output(0, "APP DIRECTIVE: %s", kv->key); - OPAL_LIST_FOREACH(app, &apps, opal_pmix_app_t) { - /* the value can only be on one list at a time, so replicate it */ - kv2 = OBJ_NEW(opal_value_t); - opal_value_xfer(kv2, kv); - opal_list_append(&app->info, &kv2->super); - } - } - } - } - } - - if (OPAL_SUCCESS != (rc = opal_pmix.spawn(&job_info, &apps, &myjobid))) { - opal_output(0, "Job failed to spawn: %s", opal_strerror(rc)); - goto DONE; - } - OPAL_LIST_DESTRUCT(&job_info); - OPAL_LIST_DESTRUCT(&apps); - - if (orte_cmd_options.verbose) { - opal_output(0, "JOB %s EXECUTING", OPAL_JOBID_PRINT(myjobid)); - } - - while (active) { - nanosleep(&tp, NULL); - } - OPAL_PMIX_CONSTRUCT_LOCK(&lock); - opal_pmix.deregister_evhandler(evid, opcbfunc, &lock); - OPAL_PMIX_WAIT_THREAD(&lock); - OPAL_PMIX_DESTRUCT_LOCK(&lock); - - DONE: - /* cleanup and leave */ - orte_finalize(); - return 0; -} - -static int parse_locals(opal_list_t *jdata, int argc, char* argv[]) -{ - int i, rc; - int temp_argc; - char **temp_argv, **env; - opal_pmix_app_t *app; - bool made_app; - - /* Make the apps */ - temp_argc = 0; - temp_argv = NULL; - opal_argv_append(&temp_argc, &temp_argv, argv[0]); - - /* NOTE: This bogus env variable is necessary in the calls to - create_app(), below. See comment immediately before the - create_app() function for an explanation. */ - - env = NULL; - for (i = 1; i < argc; ++i) { - if (0 == strcmp(argv[i], ":")) { - /* Make an app with this argv */ - if (opal_argv_count(temp_argv) > 1) { - if (NULL != env) { - opal_argv_free(env); - env = NULL; - } - app = NULL; - rc = create_app(temp_argc, temp_argv, jdata, &app, &made_app, &env); - if (OPAL_SUCCESS != rc) { - /* Assume that the error message has already been - printed; no need to cleanup -- we can just - exit */ - exit(1); - } - if (made_app) { - opal_list_append(jdata, &app->super); - } - - /* Reset the temps */ - - temp_argc = 0; - temp_argv = NULL; - opal_argv_append(&temp_argc, &temp_argv, argv[0]); - } - } else { - opal_argv_append(&temp_argc, &temp_argv, argv[i]); - } - } - - if (opal_argv_count(temp_argv) > 1) { - app = NULL; - rc = create_app(temp_argc, temp_argv, jdata, &app, &made_app, &env); - if (ORTE_SUCCESS != rc) { - /* Assume that the error message has already been printed; - no need to cleanup -- we can just exit */ - exit(1); - } - if (made_app) { - opal_list_append(jdata, &app->super); - } - } - if (NULL != env) { - opal_argv_free(env); - } - opal_argv_free(temp_argv); - - /* All done */ - - return ORTE_SUCCESS; -} - - -/* - * This function takes a "char ***app_env" parameter to handle the - * specific case: - * - * orterun --mca foo bar -app appfile - * - * That is, we'll need to keep foo=bar, but the presence of the app - * file will cause an invocation of parse_appfile(), which will cause - * one or more recursive calls back to create_app(). Since the - * foo=bar value applies globally to all apps in the appfile, we need - * to pass in the "base" environment (that contains the foo=bar value) - * when we parse each line in the appfile. - * - * This is really just a special case -- when we have a simple case like: - * - * orterun --mca foo bar -np 4 hostname - * - * Then the upper-level function (parse_locals()) calls create_app() - * with a NULL value for app_env, meaning that there is no "base" - * environment that the app needs to be created from. - */ -static int create_app(int argc, char* argv[], - opal_list_t *jdata, - opal_pmix_app_t **app_ptr, - bool *made_app, char ***app_env) -{ - char cwd[OPAL_PATH_MAX]; - int i, j, count, rc; - char *param, *value; - opal_pmix_app_t *app = NULL; - bool found = false; - char *appname = NULL; - opal_value_t *val; - - *made_app = false; - - /* parse the cmd line - do this every time thru so we can - * repopulate the globals */ - if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(orte_cmd_line, true, false, - argc, argv)) ) { - if (OPAL_ERR_SILENT != rc) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(rc)); - } - return rc; - } - - /* Setup application context */ - app = OBJ_NEW(opal_pmix_app_t); - opal_cmd_line_get_tail(orte_cmd_line, &count, &app->argv); - - /* See if we have anything left */ - if (0 == count) { - opal_show_help("help-orterun.txt", "orterun:executable-not-specified", - true, "prun", "prun"); - rc = OPAL_ERR_NOT_FOUND; - goto cleanup; - } - - /* Grab all MCA environment variables */ - app->env = opal_argv_copy(*app_env); - for (i=0; NULL != environ[i]; i++) { - if (0 == strncmp("PMIX_", environ[i], 5) || - 0 == strncmp("OMPI_", environ[i], 5)) { - /* check for duplicate in app->env - this - * would have been placed there by the - * cmd line processor. By convention, we - * always let the cmd line override the - * environment - */ - param = strdup(environ[i]); - value = strchr(param, '='); - *value = '\0'; - value++; - opal_setenv(param, value, false, &app->env); - free(param); - } - } - - /* set necessary env variables for external usage from tune conf file*/ - int set_from_file = 0; - char **vars = NULL; - if (OPAL_SUCCESS == mca_base_var_process_env_list_from_file(&vars) && - NULL != vars) { - for (i=0; NULL != vars[i]; i++) { - value = strchr(vars[i], '='); - /* terminate the name of the param */ - *value = '\0'; - /* step over the equals */ - value++; - /* overwrite any prior entry */ - opal_setenv(vars[i], value, true, &app->env); - /* save it for any comm_spawn'd apps */ - opal_setenv(vars[i], value, true, &orte_forwarded_envars); - } - set_from_file = 1; - opal_argv_free(vars); - } - /* Did the user request to export any environment variables on the cmd line? */ - char *env_set_flag; - env_set_flag = getenv("OMPI_MCA_mca_base_env_list"); - if (opal_cmd_line_is_taken(orte_cmd_line, "x")) { - if (NULL != env_set_flag) { - opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false); - return ORTE_ERR_FATAL; - } - j = opal_cmd_line_get_ninsts(orte_cmd_line, "x"); - for (i = 0; i < j; ++i) { - param = opal_cmd_line_get_param(orte_cmd_line, "x", i, 0); - - if (NULL != (value = strchr(param, '='))) { - /* terminate the name of the param */ - *value = '\0'; - /* step over the equals */ - value++; - /* overwrite any prior entry */ - opal_setenv(param, value, true, &app->env); - /* save it for any comm_spawn'd apps */ - opal_setenv(param, value, true, &orte_forwarded_envars); - } else { - value = getenv(param); - if (NULL != value) { - /* overwrite any prior entry */ - opal_setenv(param, value, true, &app->env); - /* save it for any comm_spawn'd apps */ - opal_setenv(param, value, true, &orte_forwarded_envars); - } else { - opal_output(0, "Warning: could not find environment variable \"%s\"\n", param); - } - } - } - } else if (NULL != env_set_flag) { - /* if mca_base_env_list was set, check if some of env vars were set via -x from a conf file. - * If this is the case, error out. - */ - if (!set_from_file) { - /* set necessary env variables for external usage */ - vars = NULL; - if (OPAL_SUCCESS == mca_base_var_process_env_list(env_set_flag, &vars) && - NULL != vars) { - for (i=0; NULL != vars[i]; i++) { - value = strchr(vars[i], '='); - /* terminate the name of the param */ - *value = '\0'; - /* step over the equals */ - value++; - /* overwrite any prior entry */ - opal_setenv(vars[i], value, true, &app->env); - /* save it for any comm_spawn'd apps */ - opal_setenv(vars[i], value, true, &orte_forwarded_envars); - } - opal_argv_free(vars); - } - } else { - opal_show_help("help-orterun.txt", "orterun:conflict-env-set", false); - return ORTE_ERR_FATAL; - } - } - - /* Did the user request a specific wdir? */ - - if (NULL != orte_cmd_options.wdir) { - /* if this is a relative path, convert it to an absolute path */ - if (opal_path_is_absolute(orte_cmd_options.wdir)) { - app->cwd = strdup(orte_cmd_options.wdir); - } else { - /* get the cwd */ - if (OPAL_SUCCESS != (rc = opal_getcwd(cwd, sizeof(cwd)))) { - opal_show_help("help-orterun.txt", "orterun:init-failure", - true, "get the cwd", rc); - goto cleanup; - } - /* construct the absolute path */ - app->cwd = opal_os_path(false, cwd, orte_cmd_options.wdir, NULL); - } - } else if (orte_cmd_options.set_cwd_to_session_dir) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_SET_SESSION_CWD); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&app->info, &val->super); - } else { - if (OPAL_SUCCESS != (rc = opal_getcwd(cwd, sizeof(cwd)))) { - opal_show_help("help-orterun.txt", "orterun:init-failure", - true, "get the cwd", rc); - goto cleanup; - } - app->cwd = strdup(cwd); - } - - /* Did the user specify a hostfile. Need to check for both - * hostfile and machine file. - * We can only deal with one hostfile per app context, otherwise give an error. - */ - found = false; - if (0 < (j = opal_cmd_line_get_ninsts(orte_cmd_line, "hostfile"))) { - if (1 < j) { - opal_show_help("help-orterun.txt", "orterun:multiple-hostfiles", - true, "prun", NULL); - return ORTE_ERR_FATAL; - } else { - value = opal_cmd_line_get_param(orte_cmd_line, "hostfile", 0, 0); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_HOSTFILE); - val->type = OPAL_STRING; - val->data.string = value; - opal_list_append(&app->info, &val->super); - found = true; - } - } - if (0 < (j = opal_cmd_line_get_ninsts(orte_cmd_line, "machinefile"))) { - if (1 < j || found) { - opal_show_help("help-orterun.txt", "orterun:multiple-hostfiles", - true, "prun", NULL); - return ORTE_ERR_FATAL; - } else { - value = opal_cmd_line_get_param(orte_cmd_line, "machinefile", 0, 0); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_HOSTFILE); - val->type = OPAL_STRING; - val->data.string = value; - opal_list_append(&app->info, &val->super); - } - } - - /* Did the user specify any hosts? */ - if (0 < (j = opal_cmd_line_get_ninsts(orte_cmd_line, "host"))) { - char **targ=NULL, *tval; - for (i = 0; i < j; ++i) { - value = opal_cmd_line_get_param(orte_cmd_line, "host", i, 0); - opal_argv_append_nosize(&targ, value); - } - tval = opal_argv_join(targ, ','); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_HOST); - val->type = OPAL_STRING; - val->data.string = tval; - opal_list_append(&app->info, &val->super); - } - - /* check for bozo error */ - if (0 > orte_cmd_options.num_procs) { - opal_show_help("help-orterun.txt", "orterun:negative-nprocs", - true, "prun", app->argv[0], - orte_cmd_options.num_procs, NULL); - return ORTE_ERR_FATAL; - } - - app->maxprocs = orte_cmd_options.num_procs; - - /* see if we need to preload the binary to - * find the app - don't do this for java apps, however, as we - * can't easily find the class on the cmd line. Java apps have to - * preload their binary via the preload_files option - */ - if (NULL == strstr(app->argv[0], "java")) { - if (orte_cmd_options.preload_binaries) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_SET_SESSION_CWD); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&app->info, &val->super); - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PRELOAD_BIN); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&app->info, &val->super); - } - } - if (NULL != orte_cmd_options.preload_files) { - val = OBJ_NEW(opal_value_t); - val->key = strdup(OPAL_PMIX_PRELOAD_FILES); - val->type = OPAL_BOOL; - val->data.flag = true; - opal_list_append(&app->info, &val->super); - } - - /* Do not try to find argv[0] here -- the starter is responsible - for that because it may not be relevant to try to find it on - the node where orterun is executing. So just strdup() argv[0] - into app. */ - - app->cmd = strdup(app->argv[0]); - if (NULL == app->cmd) { - opal_show_help("help-orterun.txt", "orterun:call-failed", - true, "prun", "library", "strdup returned NULL", errno); - rc = ORTE_ERR_NOT_FOUND; - goto cleanup; - } - - /* if this is a Java application, we have a bit more work to do. Such - * applications actually need to be run under the Java virtual machine - * and the "java" command will start the "executable". So we need to ensure - * that all the proper java-specific paths are provided - */ - appname = opal_basename(app->cmd); - if (0 == strcmp(appname, "java")) { - /* see if we were given a library path */ - found = false; - for (i=1; NULL != app->argv[i]; i++) { - if (NULL != strstr(app->argv[i], "java.library.path")) { - char *dptr; - /* find the '=' that delineates the option from the path */ - if (NULL == (dptr = strchr(app->argv[i], '='))) { - /* that's just wrong */ - rc = ORTE_ERR_BAD_PARAM; - goto cleanup; - } - /* step over the '=' */ - ++dptr; - /* yep - but does it include the path to the mpi libs? */ - found = true; - if (NULL == strstr(app->argv[i], opal_install_dirs.libdir)) { - /* doesn't appear to - add it to be safe */ - if (':' == app->argv[i][strlen(app->argv[i]-1)]) { - asprintf(&value, "-Djava.library.path=%s%s", dptr, opal_install_dirs.libdir); - } else { - asprintf(&value, "-Djava.library.path=%s:%s", dptr, opal_install_dirs.libdir); - } - free(app->argv[i]); - app->argv[i] = value; - } - break; - } - } - if (!found) { - /* need to add it right after the java command */ - asprintf(&value, "-Djava.library.path=%s", opal_install_dirs.libdir); - opal_argv_insert_element(&app->argv, 1, value); - free(value); - } - - /* see if we were given a class path */ - found = false; - for (i=1; NULL != app->argv[i]; i++) { - if (NULL != strstr(app->argv[i], "cp") || - NULL != strstr(app->argv[i], "classpath")) { - /* yep - but does it include the path to the mpi libs? */ - found = true; - /* check if mpi.jar exists - if so, add it */ - value = opal_os_path(false, opal_install_dirs.libdir, "mpi.jar", NULL); - if (access(value, F_OK ) != -1) { - set_classpath_jar_file(app, i+1, "mpi.jar"); - } - free(value); - /* check for oshmem support */ - value = opal_os_path(false, opal_install_dirs.libdir, "shmem.jar", NULL); - if (access(value, F_OK ) != -1) { - set_classpath_jar_file(app, i+1, "shmem.jar"); - } - free(value); - /* always add the local directory */ - asprintf(&value, "%s:%s", app->cwd, app->argv[i+1]); - free(app->argv[i+1]); - app->argv[i+1] = value; - break; - } - } - if (!found) { - /* check to see if CLASSPATH is in the environment */ - found = false; // just to be pedantic - for (i=0; NULL != environ[i]; i++) { - if (0 == strncmp(environ[i], "CLASSPATH", strlen("CLASSPATH"))) { - value = strchr(environ[i], '='); - ++value; /* step over the = */ - opal_argv_insert_element(&app->argv, 1, value); - /* check for mpi.jar */ - value = opal_os_path(false, opal_install_dirs.libdir, "mpi.jar", NULL); - if (access(value, F_OK ) != -1) { - set_classpath_jar_file(app, 1, "mpi.jar"); - } - free(value); - /* check for shmem.jar */ - value = opal_os_path(false, opal_install_dirs.libdir, "shmem.jar", NULL); - if (access(value, F_OK ) != -1) { - set_classpath_jar_file(app, 1, "shmem.jar"); - } - free(value); - /* always add the local directory */ - (void)asprintf(&value, "%s:%s", app->cwd, app->argv[1]); - free(app->argv[1]); - app->argv[1] = value; - opal_argv_insert_element(&app->argv, 1, "-cp"); - found = true; - break; - } - } - if (!found) { - /* need to add it right after the java command - have - * to include the working directory and trust that - * the user set cwd if necessary - */ - char *str, *str2; - /* always start with the working directory */ - str = strdup(app->cwd); - /* check for mpi.jar */ - value = opal_os_path(false, opal_install_dirs.libdir, "mpi.jar", NULL); - if (access(value, F_OK ) != -1) { - (void)asprintf(&str2, "%s:%s", str, value); - free(str); - str = str2; - } - free(value); - /* check for shmem.jar */ - value = opal_os_path(false, opal_install_dirs.libdir, "shmem.jar", NULL); - if (access(value, F_OK ) != -1) { - asprintf(&str2, "%s:%s", str, value); - free(str); - str = str2; - } - free(value); - opal_argv_insert_element(&app->argv, 1, str); - free(str); - opal_argv_insert_element(&app->argv, 1, "-cp"); - } - } - /* try to find the actual command - may not be perfect */ - for (i=1; i < opal_argv_count(app->argv); i++) { - if (NULL != strstr(app->argv[i], "java.library.path")) { - continue; - } else if (NULL != strstr(app->argv[i], "cp") || - NULL != strstr(app->argv[i], "classpath")) { - /* skip the next field */ - i++; - continue; - } - /* declare this the winner */ - opal_setenv("OMPI_COMMAND", app->argv[i], true, &app->env); - /* collect everything else as the cmd line */ - if ((i+1) < opal_argv_count(app->argv)) { - value = opal_argv_join(&app->argv[i+1], ' '); - opal_setenv("OMPI_ARGV", value, true, &app->env); - free(value); - } - break; - } - } else { - /* add the cmd to the environment for MPI_Info to pickup */ - opal_setenv("OMPI_COMMAND", appname, true, &app->env); - if (1 < opal_argv_count(app->argv)) { - value = opal_argv_join(&app->argv[1], ' '); - opal_setenv("OMPI_ARGV", value, true, &app->env); - free(value); - } - } - - *app_ptr = app; - app = NULL; - *made_app = true; - - /* All done */ - - cleanup: - if (NULL != app) { - OBJ_RELEASE(app); - } - if (NULL != appname) { - free(appname); - } - return rc; -} - -static void set_classpath_jar_file(opal_pmix_app_t *app, int index, char *jarfile) -{ - if (NULL == strstr(app->argv[index], jarfile)) { - /* nope - need to add it */ - char *fmt = ':' == app->argv[index][strlen(app->argv[index]-1)] - ? "%s%s/%s" : "%s:%s/%s"; - char *str; - asprintf(&str, fmt, app->argv[index], opal_install_dirs.libdir, jarfile); - free(app->argv[index]); - app->argv[index] = str; - } -} diff --git a/orte/tools/ompi-prun/prun.h b/orte/tools/ompi-prun/prun.h deleted file mode 100644 index eb86cc6d003..00000000000 --- a/orte/tools/ompi-prun/prun.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004-2010 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) 2007-2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2012-2013 Los Alamos National Security, LLC. - * All rights reserved - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PRUN_H -#define PRUN_H - -#include "orte_config.h" - -BEGIN_C_DECLS - -/** - * Main body of prun functionality - */ -int prun(int argc, char *argv[]); - -END_C_DECLS - -#endif /* ORTERUN_ORTERUN_H */ diff --git a/orte/tools/orte-dvm/Makefile.am b/orte/tools/orte-dvm/Makefile.am deleted file mode 100644 index 3723b846cd0..00000000000 --- a/orte/tools/orte-dvm/Makefile.am +++ /dev/null @@ -1,57 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 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) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# This is not quite in the Automake spirit, but we have to do it. -# Since the totalview portion of the library must be built with -g, we -# must eliminate the CFLAGS that are passed in here by default (which -# may already have debugging and/or optimization flags). We use -# post-processed forms of the CFLAGS in the library targets down -# below. - -CFLAGS = $(CFLAGS_WITHOUT_OPTFLAGS) $(DEBUGGER_CFLAGS) - -include $(top_srcdir)/Makefile.ompi-rules - -man_pages = orte-dvm.1 -EXTRA_DIST = $(man_pages:.1=.1in) - -if OPAL_INSTALL_BINARIES - -bin_PROGRAMS = orte-dvm - -nodist_man_MANS = $(man_pages) - -# Ensure that the man pages are rebuilt if the opal_config.h file -# changes; a "good enough" way to know if configure was run again (and -# therefore the release date or version may have changed) -$(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h - -endif # OPAL_INSTALL_BINARIES - -orte_dvm_SOURCES = \ - orte-dvm.c - -orte_dvm_LDADD = \ - $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la - -distclean-local: - rm -f $(man_pages) diff --git a/orte/tools/orte-dvm/orte-dvm.1in b/orte/tools/orte-dvm/orte-dvm.1in deleted file mode 100644 index d4d74df9136..00000000000 --- a/orte/tools/orte-dvm/orte-dvm.1in +++ /dev/null @@ -1,193 +0,0 @@ -.\†-*- nroff -*- -.\" Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. -.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. -.\†Copyright (c) 2015 Intel, Inc. All rights reserved -.\" $COPYRIGHT$ -.\" -.\" Man page for ORTE's orte-dvm command -.\" -.\" .TH name section center-footer left-footer center-header -.TH ORTE-DVM 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.\" ************************** -.\" Name Section -.\" ************************** -.SH NAME -. -orte-dvm, ompi_dvm \- Establish a Distributed Virtual Machine (DVM). - -.B Note: -\fIorte-dvm\fP and \fIompi-dvm\fP are synonyms for each -other. Using either of the names will produce the same behavior. -. -.\" ************************** -.\" Synopsis Section -.\" ************************** -.SH SYNOPSIS -. -.PP -.B orte-dvm -[ options ] -.P - -Invoking \fIorte-dvm\fP via an absolute path -name is equivalent to specifying the \fI--prefix\fP option with a -\fI\fR value equivalent to the directory where \fIorte-dvm\fR -resides, minus its last subdirectory. For example: - - \fB%\fP /usr/local/bin/orte-dvm ... - -is equivalent to - - \fB%\fP orte-dvm --prefix /usr/local - -. -.\" ************************** -.\" Quick Summary Section -.\" ************************** -.SH QUICK SUMMARY -. -\fIorte-dvm\fP will establish a DVM that can be used to execute subsequent -applications. Use of \fIorte-dvm\fP can be advantageous, for example, when you want to -execute a number of short-lived tasks. In such cases, the time required to start -the ORTE DVM can be a significant fraction of the time to execute the -overall application. Thus, creating a persistent DVM can speed the overall -execution. In addition, a persistent DVM will support executing multiple parallel -applications while maintaining separation between their respective cores. -.\" ************************** -.\" Options Section -.\" ************************** -.SH OPTIONS -. -.\" -.\" Start options listing -.\" Indent 10 characters from start of first column to start of second column -. -.TP -.B -h\fR,\fP --help -Display help for this command -. -. -.TP -.B -V\fR,\fP --version -Print version number. If no other arguments are given, this will also -cause orte-dvm to exit. -. -. -.P -Use one of the following options to specify which hosts (nodes) of the cluster to use -for the DVM. -. -. -.TP -.B -H\fR,\fP -host\fR,\fP --host \fR\fP -List of hosts for the DVM. -. -. -.TP -.B --hostfile\fR,\fP --hostfile \fR\fP -Provide a hostfile to use. -. -. -.TP -.B -machinefile\fR,\fP --machinefile \fR\fP -Synonym for \fI-hostfile\fP. -. -. -.TP -.B --prefix \fR\fP -Prefix directory that will be used to set the \fIPATH\fR and -\fILD_LIBRARY_PATH\fR on the remote node before invoking the ORTE daemon. -. -. -..P -Setting MCA parameters: -. -. -.TP -.B -gmca\fR,\fP --gmca \fR \fP -Pass global MCA parameters that are applicable to all contexts. \fI\fP is -the parameter name; \fI\fP is the parameter value. -. -. -.TP -.B -mca\fR,\fP --mca -Send arguments to various MCA modules. See the "MCA" section, below. -. -. -. -. -.TP -.B -report-uri\fR,\fP --report-uri -Print out orte-dvm's URI during startup. The channel must be either a '-' to indicate that -the URI is to be output to stdout, a '+' to indicate that the URI is to be output to stderr, -or a filename to which the URI is to be written. -. -. -.P -The following options are useful for developers; they are not generally -useful to most ORTE and/or MPI users: -. -.TP -.B -d\fR,\fP --debug-devel -Enable debugging of the ORTE layer. -. -. -.TP -.B --debug-daemons-file -Enable debugging of the ORTE daemons in the DVM, storing -output in files. -. -. -.P -There may be other options listed with \fIorte-dvm --help\fP. -. -. -.\" ************************** -.\" Description Section -.\" ************************** -.SH DESCRIPTION -. -\fIorte-dvm\fP starts a Distributed Virtual Machine (DVM) by launching -a daemon on each node of the allocation, as modified or specified by -the \fI-host\fP and \fI-hostfile\fP options. Applications can subsequently -be executed using the \fIorte-submit\fP command. -. -The DVM remains in operation until receiving the \fIorte-submit -terminate\fP -command. -. -. -. -.SS Specifying Host Nodes -. -Host nodes can be identified on the \fIorte-dvm\fP command line with the \fI-host\fP -option or in a hostfile. -. -.PP -For example, -. -.TP 4 -orte-dvm -H aa,aa,bb ./a.out -launches two processes on node aa and one on bb. -. -.PP -Or, consider the hostfile -. - - \fB%\fP cat myhostfile - aa slots=2 - bb slots=2 - cc slots=2 - -. -.PP -Here, we list both the host names (aa, bb, and cc) but also how many "slots" -there are for each. Slots indicate how many processes can potentially execute -on a node. For best performance, the number of slots may be chosen to be the -number of cores on the node or the number of processor sockets. If the hostfile -does not provide slots information, a default of 1 is assumed. -When running under resource managers (e.g., SLURM, Torque, etc.), -Open MPI will obtain both the hostnames and the number of slots directly -from the resource manger. -. -. diff --git a/orte/tools/orte-dvm/orte-dvm.c b/orte/tools/orte-dvm/orte-dvm.c deleted file mode 100644 index 522c539af33..00000000000 --- a/orte/tools/orte-dvm/orte-dvm.c +++ /dev/null @@ -1,482 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2008 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#include -#include -#ifdef HAVE_STRINGS_H -#include -#endif /* HAVE_STRINGS_H */ -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ -#ifdef HAVE_SYS_WAIT_H -#include -#endif /* HAVE_SYS_WAIT_H */ -#ifdef HAVE_SYS_TIME_H -#include -#endif /* HAVE_SYS_TIME_H */ -#include -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#include "opal/mca/event/event.h" -#include "opal/mca/installdirs/installdirs.h" -#include "opal/mca/base/base.h" -#include "opal/mca/pmix/pmix.h" -#include "opal/util/argv.h" -#include "opal/util/output.h" -#include "opal/util/basename.h" -#include "opal/util/cmd_line.h" -#include "opal/util/opal_environ.h" -#include "opal/util/opal_getcwd.h" -#include "opal/util/show_help.h" -#include "opal/util/fd.h" -#include "opal/util/daemon_init.h" - -#include "opal/version.h" -#include "opal/runtime/opal.h" -#include "opal/runtime/opal_info_support.h" -#include "opal/util/os_path.h" -#include "opal/util/path.h" -#include "opal/class/opal_pointer_array.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/grpcomm/grpcomm.h" -#include "orte/mca/odls/odls.h" -#include "orte/mca/oob/base/base.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/rml/base/rml_contact.h" -#include "orte/mca/state/state.h" - -#include "orte/runtime/runtime.h" -#include "orte/runtime/orte_globals.h" -#include "orte/util/show_help.h" -#include "orte/util/threads.h" - -#include "orte/orted/orted.h" - -/* - * Globals - */ -static bool want_prefix_by_default = (bool) ORTE_WANT_ORTERUN_PREFIX_BY_DEFAULT; - -/* - * Globals - */ -static struct { - bool help; - bool version; - char *prefix; - bool run_as_root; - bool set_sid; - bool daemonize; - bool system_server; - char *report_uri; - bool remote_connections; -} myglobals; - -static opal_cmd_line_init_t cmd_line_init[] = { - /* Various "obvious" options */ - { NULL, 'h', NULL, "help", 0, - &myglobals.help, OPAL_CMD_LINE_TYPE_BOOL, - "This help message" }, - { NULL, 'V', NULL, "version", 0, - &myglobals.version, OPAL_CMD_LINE_TYPE_BOOL, - "Print version and exit" }, - - { NULL, '\0', "prefix", "prefix", 1, - &myglobals.prefix, OPAL_CMD_LINE_TYPE_STRING, - "Prefix to be used to look for ORTE executables" }, - - { "orte_daemonize", '\0', NULL, "daemonize", 0, - &myglobals.daemonize, OPAL_CMD_LINE_TYPE_BOOL, - "Daemonize the orte-dvm into the background" }, - - { NULL, '\0', NULL, "set-sid", 0, - &myglobals.set_sid, OPAL_CMD_LINE_TYPE_BOOL, - "Direct the orte-dvm to separate from the current session"}, - - { "orte_debug_daemons", '\0', "debug-daemons", "debug-daemons", 0, - NULL, OPAL_CMD_LINE_TYPE_BOOL, - "Debug daemons" }, - - { "orte_debug", 'd', "debug-devel", "debug-devel", 0, - NULL, OPAL_CMD_LINE_TYPE_BOOL, - "Enable debugging of OpenRTE" }, - - { NULL, '\0', "allow-run-as-root", "allow-run-as-root", 0, - &myglobals.run_as_root, OPAL_CMD_LINE_TYPE_BOOL, - "Allow execution as root (STRONGLY DISCOURAGED)" }, - - /* Specify the launch agent to be used */ - { "orte_launch_agent", '\0', "launch-agent", "launch-agent", 1, - NULL, OPAL_CMD_LINE_TYPE_STRING, - "Command used to start processes on remote nodes (default: orted)" }, - - /* maximum size of VM - typically used to subdivide an allocation */ - { "orte_max_vm_size", '\0', "max-vm-size", "max-vm-size", 1, - NULL, OPAL_CMD_LINE_TYPE_INT, - "Maximum size of VM" }, - - /* Set a hostfile */ - { NULL, '\0', "hostfile", "hostfile", 1, - NULL, OPAL_CMD_LINE_TYPE_STRING, - "Provide a hostfile" }, - { NULL, '\0', "machinefile", "machinefile", 1, - NULL, OPAL_CMD_LINE_TYPE_STRING, - "Provide a hostfile" }, - { "orte_default_hostfile", '\0', "default-hostfile", "default-hostfile", 1, - NULL, OPAL_CMD_LINE_TYPE_STRING, - "Provide a default hostfile" }, - - { NULL, 'H', "host", "host", 1, - NULL, OPAL_CMD_LINE_TYPE_STRING, - "List of hosts to invoke processes on" }, - - { NULL, '\0', "system-server", "system-server", 0, - &myglobals.system_server, OPAL_CMD_LINE_TYPE_BOOL, - "Provide a system-level server connection point - only one allowed per node" }, - - { NULL, '\0', "report-uri", "report-uri", 1, - &myglobals.report_uri, OPAL_CMD_LINE_TYPE_STRING, - "Printout URI on stdout [-], stderr [+], or a file [anything else]", - OPAL_CMD_LINE_OTYPE_DEBUG }, - - { NULL, '\0', "remote-tools", "remote-tools", 0, - &myglobals.remote_connections, OPAL_CMD_LINE_TYPE_BOOL, - "Enable connections from remote tools" }, - - /* End of list */ - { NULL, '\0', NULL, NULL, 0, - NULL, OPAL_CMD_LINE_TYPE_NULL, NULL } -}; - -int main(int argc, char *argv[]) -{ - int rc, i, j; - opal_cmd_line_t cmd_line; - char *param, *value; - orte_job_t *jdata=NULL; - orte_app_context_t *app; - - /* Setup and parse the command line */ - memset(&myglobals, 0, sizeof(myglobals)); - /* find our basename (the name of the executable) so that we can - use it in pretty-print error messages */ - orte_basename = opal_basename(argv[0]); - - opal_cmd_line_create(&cmd_line, cmd_line_init); - mca_base_cmd_line_setup(&cmd_line); - if (OPAL_SUCCESS != (rc = opal_cmd_line_parse(&cmd_line, true, false, - argc, argv)) ) { - if (OPAL_ERR_SILENT != rc) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(rc)); - } - return rc; - } - - /* print version if requested. Do this before check for help so - that --version --help works as one might expect. */ - if (myglobals.version) { - char *str; - str = opal_info_make_version_str("all", - OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, - OPAL_RELEASE_VERSION, - OPAL_GREEK_VERSION, - OPAL_REPO_REV); - if (NULL != str) { - fprintf(stdout, "%s %s\n\nReport bugs to %s\n", - orte_basename, str, PACKAGE_BUGREPORT); - free(str); - } - exit(0); - } - - /* check if we are running as root - if we are, then only allow - * us to proceed if the allow-run-as-root flag was given. Otherwise, - * exit with a giant warning flag - */ - if (0 == geteuid() && !myglobals.run_as_root) { - /* show_help is not yet available, so print an error manually */ - fprintf(stderr, "--------------------------------------------------------------------------\n"); - if (myglobals.help) { - fprintf(stderr, "%s cannot provide the help message when run as root.\n\n", orte_basename); - } else { - fprintf(stderr, "%s has detected an attempt to run as root.\n\n", orte_basename); - } - - fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n"); - fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n"); - fprintf(stderr, "file system, leaving your system in an unusable state.\n\n"); - - fprintf(stderr, "We strongly suggest that you run %s as a non-root user.\n\n", orte_basename); - - fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n"); - fprintf(stderr, "option to your command line. However, we reiterate our strong advice\n"); - fprintf(stderr, "against doing so - please do so at your own risk.\n"); - fprintf(stderr, "--------------------------------------------------------------------------\n"); - exit(1); - } - - /* - * Since this process can now handle MCA/GMCA parameters, make sure to - * process them. - * NOTE: It is "safe" to call mca_base_cmd_line_process_args() before - * opal_init_util() since mca_base_cmd_line_process_args() does *not* - * depend upon opal_init_util() functionality. - */ - if (OPAL_SUCCESS != mca_base_cmd_line_process_args(&cmd_line, &environ, &environ)) { - exit(1); - } - - /* Need to initialize OPAL so that install_dirs are filled in */ - if (OPAL_SUCCESS != opal_init(&argc, &argv)) { - exit(1); - } - - /* Check for help request */ - if (myglobals.help) { - char *str, *args = NULL; - char *project_name = NULL; - if (0 == strcmp(orte_basename, "mpirun")) { - project_name = "Open MPI"; - } else { - project_name = "OpenRTE"; - } - args = opal_cmd_line_get_usage_msg(&cmd_line); - str = opal_show_help_string("help-orterun.txt", "orterun:usage", false, - orte_basename, project_name, OPAL_VERSION, - orte_basename, args, - PACKAGE_BUGREPORT); - if (NULL != str) { - printf("%s", str); - free(str); - } - free(args); - - /* If someone asks for help, that should be all we do */ - exit(0); - } - - if (myglobals.system_server) { - /* we should act as system-level PMIx server */ - opal_setenv(OPAL_MCA_PREFIX"pmix_system_server", "1", true, &environ); - } - /* always act as session-level PMIx server */ - opal_setenv(OPAL_MCA_PREFIX"pmix_session_server", "1", true, &environ); - /* if we were asked to report a uri, set the MCA param to do so */ - if (NULL != myglobals.report_uri) { - opal_setenv("PMIX_MCA_ptl_tcp_report_uri", myglobals.report_uri, true, &environ); - } - if (myglobals.remote_connections) { - opal_setenv("PMIX_MCA_ptl_tcp_remote_connections", "1", true, &environ); - } - - /* Setup MCA params */ - orte_register_params(); - - /* save the environment for launch purposes. This MUST be - * done so that we can pass it to any local procs we - * spawn - otherwise, those local procs won't see any - * non-MCA envars were set in the enviro prior to calling - * orterun - */ - orte_launch_environ = opal_argv_copy(environ); - -#if defined(HAVE_SETSID) - /* see if we were directed to separate from current session */ - if (myglobals.set_sid) { - setsid(); - } -#endif - - /* detach from controlling terminal - * otherwise, remain attached so output can get to us - */ - if(!orte_debug_flag && - !orte_debug_daemons_flag && - myglobals.daemonize) { - opal_daemon_init(NULL); - } - - /* Intialize our Open RTE environment */ - if (ORTE_SUCCESS != (rc = orte_init(&argc, &argv, ORTE_PROC_MASTER))) { - /* cannot call ORTE_ERROR_LOG as it could be the errmgr - * never got loaded! - */ - return rc; - } - /* finalize OPAL. As it was opened again from orte_init->opal_init - * we continue to have a reference count on it. So we have to finalize it twice... - */ - opal_finalize(); - - /* get the daemon job object - was created by ess/hnp component */ - if (NULL == (jdata = orte_get_job_data_object(ORTE_PROC_MY_NAME->jobid))) { - orte_show_help("help-orterun.txt", "bad-job-object", true, - orte_basename); - exit(0); - } - /* also should have created a daemon "app" */ - if (NULL == (app = (orte_app_context_t*)opal_pointer_array_get_item(jdata->apps, 0))) { - orte_show_help("help-orterun.txt", "bad-app-object", true, - orte_basename); - exit(0); - } - - /* Did the user specify a prefix, or want prefix by default? */ - if (opal_cmd_line_is_taken(&cmd_line, "prefix") || want_prefix_by_default) { - size_t param_len; - /* if both the prefix was given and we have a prefix - * given above, check to see if they match - */ - if (opal_cmd_line_is_taken(&cmd_line, "prefix") && - NULL != myglobals.prefix) { - /* if they don't match, then that merits a warning */ - param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0)); - /* ensure we strip any trailing '/' */ - if (0 == strcmp(OPAL_PATH_SEP, &(param[strlen(param)-1]))) { - param[strlen(param)-1] = '\0'; - } - value = strdup(myglobals.prefix); - if (0 == strcmp(OPAL_PATH_SEP, &(value[strlen(value)-1]))) { - value[strlen(value)-1] = '\0'; - } - if (0 != strcmp(param, value)) { - orte_show_help("help-orterun.txt", "orterun:app-prefix-conflict", - true, orte_basename, value, param); - /* let the global-level prefix take precedence since we - * know that one is being used - */ - free(param); - param = strdup(myglobals.prefix); - } - free(value); - } else if (NULL != myglobals.prefix) { - param = myglobals.prefix; - } else if (opal_cmd_line_is_taken(&cmd_line, "prefix")){ - /* must be --prefix alone */ - param = strdup(opal_cmd_line_get_param(&cmd_line, "prefix", 0, 0)); - } else { - /* --enable-orterun-prefix-default was given to orterun */ - param = strdup(opal_install_dirs.prefix); - } - - if (NULL != param) { - /* "Parse" the param, aka remove superfluous path_sep. */ - param_len = strlen(param); - while (0 == strcmp (OPAL_PATH_SEP, &(param[param_len-1]))) { - param[param_len-1] = '\0'; - param_len--; - if (0 == param_len) { - orte_show_help("help-orterun.txt", "orterun:empty-prefix", - true, orte_basename, orte_basename); - return ORTE_ERR_FATAL; - } - } - orte_set_attribute(&app->attributes, ORTE_APP_PREFIX_DIR, ORTE_ATTR_GLOBAL, param, OPAL_STRING); - free(param); - } - } - - /* Did the user specify a hostfile. Need to check for both - * hostfile and machine file. - * We can only deal with one hostfile per app context, otherwise give an error. - */ - if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "hostfile"))) { - if(1 < j) { - orte_show_help("help-orterun.txt", "orterun:multiple-hostfiles", - true, orte_basename, NULL); - return ORTE_ERR_FATAL; - } else { - value = opal_cmd_line_get_param(&cmd_line, "hostfile", 0, 0); - orte_set_attribute(&app->attributes, ORTE_APP_HOSTFILE, ORTE_ATTR_LOCAL, value, OPAL_STRING); - } - } - if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "machinefile"))) { - if(1 < j || orte_get_attribute(&app->attributes, ORTE_APP_HOSTFILE, NULL, OPAL_STRING)) { - orte_show_help("help-orterun.txt", "orterun:multiple-hostfiles", - true, orte_basename, NULL); - return ORTE_ERR_FATAL; - } else { - value = opal_cmd_line_get_param(&cmd_line, "machinefile", 0, 0); - orte_set_attribute(&app->attributes, ORTE_APP_HOSTFILE, ORTE_ATTR_LOCAL, value, OPAL_STRING); - } - } - - /* Did the user specify any hosts? */ - if (0 < (j = opal_cmd_line_get_ninsts(&cmd_line, "host"))) { - char **targ=NULL, *tval; - for (i = 0; i < j; ++i) { - value = opal_cmd_line_get_param(&cmd_line, "host", i, 0); - opal_argv_append_nosize(&targ, value); - } - tval = opal_argv_join(targ, ','); - orte_set_attribute(&app->attributes, ORTE_APP_DASH_HOST, ORTE_ATTR_LOCAL, tval, OPAL_STRING); - opal_argv_free(targ); - free(tval); - } - OBJ_DESTRUCT(&cmd_line); - - /* setup to listen for commands sent specifically to me, even though I would probably - * be the one sending them! Unfortunately, since I am a participating daemon, - * there are times I need to send a command to "all daemons", and that means *I* have - * to receive it too - */ - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DAEMON, - ORTE_RML_PERSISTENT, orte_daemon_recv, NULL); - - /* spawn the DVM - we skip the initial steps as this - * isn't a user-level application */ - ORTE_ACTIVATE_JOB_STATE(jdata, ORTE_JOB_STATE_ALLOCATE); - - /* loop the event lib until an exit event is detected */ - while (orte_event_base_active) { - opal_event_loop(orte_event_base, OPAL_EVLOOP_ONCE); - } - ORTE_ACQUIRE_OBJECT(orte_event_base_active); - - /* cleanup and leave */ - orte_finalize(); - - if (orte_debug_flag) { - fprintf(stderr, "exiting with status %d\n", orte_exit_status); - } - exit(orte_exit_status); -} From 0846c9d1125895a1509080d50f4eb05c0a59c7df Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Sun, 21 Oct 2018 11:37:25 +0300 Subject: [PATCH 165/674] COMMON/UCX: added error code to log output Also fixes a PGI compilation error with --enable-debug. Signed-off-by: Geoff Paulsen Signed-off-by: Sergey Oblomov (cherry picked from commit 1099d5f02327329e0c58d9403e3e0a7f1e1d1920) --- ompi/mca/osc/ucx/osc_ucx_active_target.c | 5 ++++- ompi/mca/osc/ucx/osc_ucx_component.c | 5 ++++- ompi/mca/pml/ucx/pml_ucx_datatype.c | 2 +- opal/mca/common/ucx/common_ucx.c | 10 +++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_active_target.c b/ompi/mca/osc/ucx/osc_ucx_active_target.c index 102cecabf65..3c0a1488eec 100644 --- a/ompi/mca/osc/ucx/osc_ucx_active_target.c +++ b/ompi/mca/osc/ucx/osc_ucx_active_target.c @@ -193,7 +193,10 @@ int ompi_osc_ucx_complete(struct ompi_win_t *win) { OSC_UCX_VERBOSE(1, "ucp_atomic_post failed: %d", status); } - opal_common_ucx_ep_flush(ep, mca_osc_ucx_component.ucp_worker); + ret = opal_common_ucx_ep_flush(ep, mca_osc_ucx_component.ucp_worker); + if (OMPI_SUCCESS != ret) { + OSC_UCX_VERBOSE(1, "opal_common_ucx_ep_flush failed: %d", ret); + } } OBJ_RELEASE(module->start_group); diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 659d0d14874..c983ea76705 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -822,7 +822,10 @@ int ompi_osc_ucx_free(struct ompi_win_t *win) { ucp_worker_progress(mca_osc_ucx_component.ucp_worker); } - opal_common_ucx_worker_flush(mca_osc_ucx_component.ucp_worker); + ret = opal_common_ucx_worker_flush(mca_osc_ucx_component.ucp_worker); + if (OMPI_SUCCESS != ret) { + OSC_UCX_VERBOSE(1, "opal_common_ucx_worker_flush failed: %d", ret); + } ret = module->comm->c_coll->coll_barrier(module->comm, module->comm->c_coll->coll_barrier_module); diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.c b/ompi/mca/pml/ucx/pml_ucx_datatype.c index 74b5fbe19c3..95f9da44cc8 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.c +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.c @@ -133,7 +133,7 @@ int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, { ucp_datatype_t ucp_datatype = (ucp_datatype_t)attr_val; - PML_UCX_ASSERT((void*)ucp_datatype == datatype->pml_data); + PML_UCX_ASSERT((uint64_t)ucp_datatype == datatype->pml_data); ucp_dt_destroy(ucp_datatype); datatype->pml_data = PML_UCX_DATATYPE_INVALID; diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index ad25108ae7c..2213f118eb2 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -80,6 +80,8 @@ OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t * OPAL_DECLSPEC void opal_common_ucx_mca_register(void) { + int ret; + opal_common_ucx.registered++; if (opal_common_ucx.registered > 1) { /* process once */ @@ -89,7 +91,13 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void) opal_common_ucx.output = opal_output_open(NULL); opal_output_set_verbosity(opal_common_ucx.output, opal_common_ucx.verbose); - mca_base_framework_open(&opal_memory_base_framework, 0); + ret = mca_base_framework_open(&opal_memory_base_framework, 0); + if (OPAL_SUCCESS != ret) { + /* failed to initialize memory framework - just exit */ + MCA_COMMON_UCX_VERBOSE(1, "failed to initialize memory base framework: %d, " + "memory hooks will not be used", ret); + return; + } /* Set memory hooks */ if (opal_common_ucx.opal_mem_hooks && From ba6ad9fe428a9e0cca2ceb90add6c7948e1112d2 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 30 Oct 2018 07:49:41 -0700 Subject: [PATCH 166/674] Remove stale defunct tools Signed-off-by: Ralph Castain (cherry picked from commit 05ac8fa71c0833eeeaa878b72a31503d361e145e) --- config/orte_config_files.m4 | 2 - ompi/mca/rte/orte/Makefile.am | 18 +- orte/tools/Makefile.am | 4 - orte/tools/orte-ps/Makefile.am | 47 -- orte/tools/orte-ps/help-orte-ps.txt | 46 -- orte/tools/orte-ps/orte-ps.1in | 101 --- orte/tools/orte-ps/orte-ps.c | 985 ----------------------- orte/tools/orte-top/Makefile.am | 47 -- orte/tools/orte-top/help-orte-top.txt | 82 -- orte/tools/orte-top/orte-top.1in | 106 --- orte/tools/orte-top/orte-top.c | 1041 ------------------------- 11 files changed, 1 insertion(+), 2478 deletions(-) delete mode 100644 orte/tools/orte-ps/Makefile.am delete mode 100644 orte/tools/orte-ps/help-orte-ps.txt delete mode 100644 orte/tools/orte-ps/orte-ps.1in delete mode 100644 orte/tools/orte-ps/orte-ps.c delete mode 100644 orte/tools/orte-top/Makefile.am delete mode 100644 orte/tools/orte-top/help-orte-top.txt delete mode 100644 orte/tools/orte-top/orte-top.1in delete mode 100644 orte/tools/orte-top/orte-top.c diff --git a/config/orte_config_files.m4 b/config/orte_config_files.m4 index b0f79dbb66f..191d280131c 100644 --- a/config/orte_config_files.m4 +++ b/config/orte_config_files.m4 @@ -25,9 +25,7 @@ AC_DEFUN([ORTE_CONFIG_FILES],[ orte/tools/wrappers/Makefile orte/tools/wrappers/ortecc-wrapper-data.txt orte/tools/wrappers/orte.pc - orte/tools/orte-ps/Makefile orte/tools/orte-clean/Makefile - orte/tools/orte-top/Makefile orte/tools/orte-info/Makefile orte/tools/orte-server/Makefile ]) diff --git a/ompi/mca/rte/orte/Makefile.am b/ompi/mca/rte/orte/Makefile.am index 30dd21b14da..34051dcea6c 100644 --- a/ompi/mca/rte/orte/Makefile.am +++ b/ompi/mca/rte/orte/Makefile.am @@ -28,7 +28,7 @@ libmca_rte_orte_la_SOURCES =$(sources) $(headers) libmca_rte_orte_la_LDFLAGS = -module -avoid-version libmca_rte_orte_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la -man_pages = mpirun.1 mpiexec.1 ompi-ps.1 ompi-clean.1 ompi-top.1 ompi-server.1 +man_pages = mpirun.1 mpiexec.1 ompi-clean.1 ompi-server.1 if OPAL_INSTALL_BINARIES nodist_man_MANS = $(man_pages) @@ -36,17 +36,13 @@ nodist_man_MANS = $(man_pages) install-exec-hook: (cd $(DESTDIR)$(bindir); rm -f mpirun$(EXEEXT); $(LN_S) orterun$(EXEEXT) mpirun$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f mpiexec$(EXEEXT); $(LN_S) orterun$(EXEEXT) mpiexec$(EXEEXT)) - (cd $(DESTDIR)$(bindir); rm -f ompi-ps$(EXEEXT); $(LN_S) orte-ps$(EXEEXT) ompi-ps$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f ompi-clean$(EXEEXT); $(LN_S) orte-clean$(EXEEXT) ompi-clean$(EXEEXT)) - (cd $(DESTDIR)$(bindir); rm -f ompi-top$(EXEEXT); $(LN_S) orte-top$(EXEEXT) ompi-top$(EXEEXT)) (cd $(DESTDIR)$(bindir); rm -f ompi-server$(EXEEXT); $(LN_S) orte-server$(EXEEXT) ompi-server$(EXEEXT)) uninstall-local: rm -f $(DESTDIR)$(bindir)/mpirun$(EXEEXT) \ $(DESTDIR)$(bindir)/mpiexec$(EXEEXT) \ - $(DESTDIR)$(bindir)/ompi-ps$(EXEEXT) \ $(DESTDIR)$(bindir)/ompi-clean$(EXEEXT) \ - $(DESTDIR)$(bindir)/ompi-top$(EXEEXT) \ $(DESTDIR)$(bindir)/ompi-server$(EXEEXT) endif # OPAL_INSTALL_BINARIES @@ -60,24 +56,12 @@ mpirun.1: $(top_builddir)/orte/tools/orterun/orterun.1 mpiexec.1: $(top_builddir)/orte/tools/orterun/orterun.1 cp -f $(top_builddir)/orte/tools/orterun/orterun.1 mpiexec.1 -$(top_builddir)/orte/tools/orte-ps/orte-ps.1: - (cd $(top_builddir)/orte/tools/orte-ps && $(MAKE) $(AM_MAKEFLAGS) orte-ps.1) - -ompi-ps.1: $(top_builddir)/orte/tools/orte-ps/orte-ps.1 - cp -f $(top_builddir)/orte/tools/orte-ps/orte-ps.1 ompi-ps.1 - $(top_builddir)/orte/tools/orte-clean/orte-clean.1: (cd $(top_builddir)/orte/tools/orte-clean && $(MAKE) $(AM_MAKEFLAGS) orte-clean.1) ompi-clean.1: $(top_builddir)/orte/tools/orte-clean/orte-clean.1 cp -f $(top_builddir)/orte/tools/orte-clean/orte-clean.1 ompi-clean.1 -$(top_builddir)/orte/tools/orte-top/orte-top.1: - (cd $(top_builddir)/orte/tools/orte-top && $(MAKE) $(AM_MAKEFLAGS) orte-top.1) - -ompi-top.1: $(top_builddir)/orte/tools/orte-top/orte-top.1 - cp -f $(top_builddir)/orte/tools/orte-top/orte-top.1 ompi-top.1 - $(top_builddir)/orte/tools/orte-server/orte-server.1: (cd $(top_builddir)/orte/tools/orte-server && $(MAKE) $(AM_MAKEFLAGS) orte-server.1) diff --git a/orte/tools/Makefile.am b/orte/tools/Makefile.am index a1a3fcd35d5..be78bb56ea1 100644 --- a/orte/tools/Makefile.am +++ b/orte/tools/Makefile.am @@ -26,20 +26,16 @@ SUBDIRS += \ tools/orte-clean \ - tools/orte-ps \ tools/orted \ tools/orterun \ tools/wrappers \ - tools/orte-top \ tools/orte-info \ tools/orte-server DIST_SUBDIRS += \ tools/orte-clean \ - tools/orte-ps \ tools/orted \ tools/orterun \ tools/wrappers \ - tools/orte-top \ tools/orte-info \ tools/orte-server diff --git a/orte/tools/orte-ps/Makefile.am b/orte/tools/orte-ps/Makefile.am deleted file mode 100644 index 758ea925097..00000000000 --- a/orte/tools/orte-ps/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 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) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -include $(top_srcdir)/Makefile.ompi-rules - -man_pages = orte-ps.1 -EXTRA_DIST = $(man_pages:.1=.1in) - -if OPAL_INSTALL_BINARIES - -bin_PROGRAMS = orte-ps - -nodist_man_MANS = $(man_pages) - -# Ensure that the man pages are rebuilt if the opal_config.h file -# changes; a "good enough" way to know if configure was run again (and -# therefore the release date or version may have changed) -$(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h - -dist_ortedata_DATA = help-orte-ps.txt - -endif # OPAL_INSTALL_BINARIES - -orte_ps_SOURCES = orte-ps.c -orte_ps_LDADD = \ - $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la - -distclean-local: - rm -f $(man_pages) diff --git a/orte/tools/orte-ps/help-orte-ps.txt b/orte/tools/orte-ps/help-orte-ps.txt deleted file mode 100644 index 875f7cd1b3f..00000000000 --- a/orte/tools/orte-ps/help-orte-ps.txt +++ /dev/null @@ -1,46 +0,0 @@ -# -*- text -*- -# -# Copyright (c) 2004-2005 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) 2012 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -# This is the US/English help file for Open MPI PS tool -# -[usage] -ompi-ps [OPTIONS] - Open MPI Job and Process Status Tool - -%s -# -[vpid-usage] -Error: You specified a vpid (%d) without also specifying a jobid. - Use the '-j' option to specify a jobid. -# -[need-vpid] -Error: You specified a jobid (%d) without also specifying a vpid. - Use the '-p' option to specify a vpid. -# -[invalid-vpid] -Error: The specified vpid (%d) is not valid for job %d. -# -[stale-hnp] -An attempt was made to obtain ps information from at least -one non-responsive HNP: - -HNP name: %s - -You may want to cleanup stale session directories in your temporary -directory (e.g., $TMPDIR). diff --git a/orte/tools/orte-ps/orte-ps.1in b/orte/tools/orte-ps/orte-ps.1in deleted file mode 100644 index aa6d3cb7cd3..00000000000 --- a/orte/tools/orte-ps/orte-ps.1in +++ /dev/null @@ -1,101 +0,0 @@ -.\" -.\" Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana -.\" University Research and Technology -.\" Corporation. All rights reserved. -.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. -.\" -.\" Man page for OMPI's ompi-ps command -.\" -.\" .TH name section center-footer left-footer center-header -.TH OMPI-PS 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.\" ************************** -.\" Name Section -.\" ************************** -.SH NAME -. -ompi-ps, orte-ps \- Displays information about the active jobs and processes -in Open MPI. -. -.PP -. -\fBNOTE:\fP \fIompi-ps\fP, and \fIorte-ps\fP are exact -synonyms for each other. Using any of the names will result in exactly -identical behavior. -. -.\" ************************** -.\" Synopsis Section -.\" ************************** -.SH SYNOPSIS -. -.B ompi-ps -.B [ options ] -. -.\" ************************** -.\" Options Section -.\" ************************** -.SH Options -. -\fIompi-ps\fR will display information about running job(s) in the current -universe. -. -.TP 10 -.B -h | --help -Display help for this command -. -. -.TP -.B -v | --verbose -Enable verbose output for debugging -. -. -.TP -.B --daemons -Display daemon job information. -. -. -.TP -.B -j | --jobid -Display the state of a specific job in the universe. By default all jobs will -be displayed. -. -. -.TP -.B -p | --vpid -Display the state of a specific vpid (process) in the universe. By default all -vpids cooresponding to processes will be displayed. Must be used in conjunction -with the \fB--jobid\fP option. -. -. -.TP -.B -n | --nodes -Display all of the allocated nodes, and their cooresponding states. By default -this is disabled. -. -. -.TP -.B -gmca | --gmca \fR \fP -Pass global MCA parameters that are applicable to all contexts. \fI\fP is -the parameter name; \fI\fP is the parameter value. -. -. -.TP -.B -mca | --mca -Send arguments to various MCA modules. -. -. -.\" ************************** -.\" Description Section -.\" ************************** -.SH DESCRIPTION -. -.PP -\fIompi-ps\fR displays the state of jobs running inside an Open RTE universe. -. -. -.\" ************************** -.\" See Also Section -.\" ************************** -. -.SH SEE ALSO -orterun(1), orte-clean(1) -. diff --git a/orte/tools/orte-ps/orte-ps.c b/orte/tools/orte-ps/orte-ps.c deleted file mode 100644 index 4f444ad0125..00000000000 --- a/orte/tools/orte-ps/orte-ps.c +++ /dev/null @@ -1,985 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2006-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @fie - * ORTE PS command - * - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#ifdef HAVE_SYS_STAT_H -#include -#endif /* HAVE_SYS_STAT_H */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ -#ifdef HAVE_SYS_WAIT_H -#include -#endif /* HAVE_SYS_WAIT_H */ -#include -#ifdef HAVE_DIRENT_H -#include -#endif /* HAVE_DIRENT_H */ - -#include "opal/util/basename.h" -#include "opal/util/cmd_line.h" -#include "opal/util/output.h" -#include "opal/util/opal_environ.h" -#include "opal/util/show_help.h" -#include "opal/mca/base/base.h" -#include "opal/runtime/opal.h" -#if OPAL_ENABLE_FT_CR == 1 -#include "opal/runtime/opal_cr.h" -#endif - -#include "orte/runtime/runtime.h" -#include "orte/util/error_strings.h" -#include "orte/util/hnp_contact.h" -#include "orte/util/name_fns.h" -#include "orte/util/show_help.h" -#include "orte/util/proc_info.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/util/comm/comm.h" -#if OPAL_ENABLE_FT_CR == 1 -#include "orte/mca/snapc/base/base.h" -#endif -#include "orte/runtime/orte_globals.h" - -struct orte_ps_mpirun_info_t { - /** This is an object, so it must have a super */ - opal_list_item_t super; - - /* HNP info */ - orte_hnp_contact_t *hnp; - - /* array of jobs */ - orte_std_cntr_t num_jobs; - orte_job_t **jobs; - - /* array of nodes */ - orte_std_cntr_t num_nodes; - orte_node_t **nodes; -}; -typedef struct orte_ps_mpirun_info_t orte_ps_mpirun_info_t; - -static void orte_ps_mpirun_info_construct(orte_ps_mpirun_info_t *ptr) -{ - ptr->hnp = NULL; - ptr->num_jobs = 0; - ptr->jobs = NULL; - ptr->num_nodes = 0; - ptr->nodes = NULL; -} -static void orte_ps_mpirun_info_destruct(orte_ps_mpirun_info_t *ptr) -{ - orte_std_cntr_t i; - - if (NULL != ptr->hnp) OBJ_RELEASE(ptr->hnp); - if (NULL != ptr->jobs) { - for (i=0; i < ptr->num_jobs; i++) { - OBJ_RELEASE(ptr->jobs[i]); - } - free(ptr->jobs); - } - if (NULL != ptr->nodes) { - for (i=0; i < ptr->num_nodes; i++) { - OBJ_RELEASE(ptr->nodes[i]); - } - free(ptr->nodes); - } -} - -OBJ_CLASS_INSTANCE(orte_ps_mpirun_info_t, - opal_list_item_t, - orte_ps_mpirun_info_construct, - orte_ps_mpirun_info_destruct); - -/****************** - * Local Functions - ******************/ -static int orte_ps_init(int argc, char *argv[]); -static int parse_args(int argc, char *argv[]); - -static int gather_information(orte_ps_mpirun_info_t *hnpinfo); -static int gather_active_jobs(orte_ps_mpirun_info_t *hnpinfo); -static int gather_nodes(orte_ps_mpirun_info_t *hnpinfo); -static int gather_vpid_info(orte_ps_mpirun_info_t *hnpinfo); - -static int pretty_print(orte_ps_mpirun_info_t *hnpinfo); -static int pretty_print_nodes(orte_node_t **nodes, orte_std_cntr_t num_nodes); -static int pretty_print_jobs(orte_job_t **jobs, orte_std_cntr_t num_jobs); -static int pretty_print_vpids(orte_job_t *job); -static void pretty_print_dashed_line(int len); - -static char *pretty_node_state(orte_node_state_t state); - -static int parseable_print(orte_ps_mpirun_info_t *hnpinfo); - -/***************************************** - * Global Vars for Command line Arguments - *****************************************/ -typedef struct { - bool help; - bool verbose; - bool parseable; - orte_jobid_t jobid; - bool nodes; - bool daemons; - int output; - pid_t pid; -} orte_ps_globals_t; - -orte_ps_globals_t orte_ps_globals = {0}; - -opal_cmd_line_init_t cmd_line_opts[] = { - { NULL, - 'h', NULL, "help", - 0, - &orte_ps_globals.help, OPAL_CMD_LINE_TYPE_BOOL, - "This help message" }, - - { NULL, - 'v', NULL, "verbose", - 0, - &orte_ps_globals.verbose, OPAL_CMD_LINE_TYPE_BOOL, - "Be Verbose" }, - - { NULL, - '\0', NULL, "parseable", - 0, - &orte_ps_globals.parseable, OPAL_CMD_LINE_TYPE_BOOL, - "Provide parseable output" }, - - { NULL, - '\0', NULL, "daemons", - 0, - &orte_ps_globals.daemons, OPAL_CMD_LINE_TYPE_INT, - "Display daemon job information" }, - - { NULL, - 'j', NULL, "jobid", - 1, - &orte_ps_globals.jobid, OPAL_CMD_LINE_TYPE_INT, - "Specify a local jobid for the given mpirun - a value from 0 to N" }, - - { NULL, - 'p', NULL, "pid", - 1, - &orte_ps_globals.pid, OPAL_CMD_LINE_TYPE_INT, - "Specify mpirun pid" }, - - { NULL, - 'n', NULL, "nodes", - 0, - &orte_ps_globals.nodes, OPAL_CMD_LINE_TYPE_INT, - "Display Node Information" }, - - /* End of list */ - { NULL, - '\0', NULL, NULL, - 0, - NULL, OPAL_CMD_LINE_TYPE_NULL, - NULL } -}; - -int -main(int argc, char *argv[]) -{ - int ret, exit_status = ORTE_SUCCESS; - opal_list_t hnp_list; - opal_list_item_t* item = NULL; - orte_ps_mpirun_info_t hnpinfo; - bool reported = false; - - /*************** - * Initialize - ***************/ - OBJ_CONSTRUCT(&hnp_list, opal_list_t); - - if (ORTE_SUCCESS != (ret = orte_ps_init(argc, argv))) { - exit_status = ret; - goto cleanup; - } - - /* - * Get the directory listing - */ - opal_output_verbose(10, orte_ps_globals.output, - "orte_ps: Acquiring list of HNPs and setting contact info into RML...\n"); - - if (ORTE_SUCCESS != (ret = orte_list_local_hnps(&hnp_list, true) ) ) { - exit_status = ret; - goto cleanup; - } - - opal_output_verbose(10, orte_ps_globals.output, - "orte_ps: Found %d HNPs\n", - (int)opal_list_get_size(&hnp_list)); - - /* - * For each hnp in the listing - */ - while (NULL != (item = opal_list_remove_first(&hnp_list))) { - orte_hnp_contact_t *hnp = (orte_hnp_contact_t*)item; - hnpinfo.hnp = hnp; - - opal_output_verbose(10, orte_ps_globals.output, - "orte_ps: Processing HNP %lu\n", - (unsigned long)hnpinfo.hnp->pid); - - if (0 < orte_ps_globals.pid && - hnpinfo.hnp->pid != orte_ps_globals.pid) { - continue; - } - - /* - * Gather the information - */ - opal_output_verbose(10, orte_ps_globals.output, - "orte_ps: Gathering Information for HNP: %s:%d\n", - ORTE_NAME_PRINT(&(hnpinfo.hnp->name)), - hnpinfo.hnp->pid); - - if( ORTE_SUCCESS != (ret = gather_information(&hnpinfo)) ) { - /* this could be due to a stale session directory - if so, - * just skip this entry, but don't abort - */ - if (!reported && ORTE_ERR_SILENT == ret) { - orte_show_help("help-orte-ps.txt", "stale-hnp", true, - ORTE_NAME_PRINT(&(hnpinfo.hnp->name))); - reported = true; - continue; - } - goto cleanup; - } - - /* Print the information */ - if (orte_ps_globals.parseable) { - if (ORTE_SUCCESS != (ret = parseable_print(&hnpinfo))) { - exit_status = ret; - goto cleanup; - } - } else { - if(ORTE_SUCCESS != (ret = pretty_print(&hnpinfo)) ) { - exit_status = ret; - goto cleanup; - } - } - } - - /*************** - * Cleanup - ***************/ - cleanup: - orte_finalize(); - - return exit_status; -} - -static int parse_args(int argc, char *argv[]) { - int ret; - opal_cmd_line_t cmd_line; - orte_ps_globals_t tmp = { false, /* help */ - false, /* verbose */ - false, /* parseable */ - ORTE_JOBID_WILDCARD, /* jobid */ - false, /* nodes */ - false, /* daemons */ - -1, /* output */ - 0}; /* pid */ - - orte_ps_globals = tmp; - - /* Parse the command line options */ - opal_cmd_line_create(&cmd_line, cmd_line_opts); - - mca_base_open(); - mca_base_cmd_line_setup(&cmd_line); - ret = opal_cmd_line_parse(&cmd_line, false, false, argc, argv); - - if (OPAL_SUCCESS != ret) { - if (OPAL_ERR_SILENT != ret) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(ret)); - } - return ret; - } - - /** - * Now start parsing our specific arguments - */ - if (orte_ps_globals.help) { - char *str, *args = NULL; - args = opal_cmd_line_get_usage_msg(&cmd_line); - str = opal_show_help_string("help-orte-ps.txt", "usage", true, - args); - if (NULL != str) { - printf("%s", str); - free(str); - } - free(args); - /* If we show the help message, that should be all we do */ - exit(0); - } - - /* if the jobid is given, then we need a pid */ - if (ORTE_JOBID_WILDCARD != orte_ps_globals.jobid && - 0 == orte_ps_globals.pid) { - orte_show_help("help-orte-ps.txt", "need-vpid", true, - orte_ps_globals.jobid); - return ORTE_ERROR; - } - - return ORTE_SUCCESS; -} - -static int orte_ps_init(int argc, char *argv[]) { - int ret; -#if OPAL_ENABLE_FT_CR == 1 - char * tmp_env_var = NULL; -#endif - - /* - * Make sure to init util before parse_args - * to ensure installdirs is setup properly - * before calling mca_base_open(); - */ - if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) { - return ret; - } - - /* - * Parse Command Line Arguments - */ - if (ORTE_SUCCESS != (ret = parse_args(argc, argv))) { - return ret; - } - - /* - * Setup OPAL Output handle from the verbose argument - */ - if( orte_ps_globals.verbose ) { - orte_ps_globals.output = opal_output_open(NULL); - opal_output_set_verbosity(orte_ps_globals.output, 10); - } else { - orte_ps_globals.output = 0; /* Default=STDERR */ - } - -#if OPAL_ENABLE_FT_CR == 1 - /* Disable the checkpoint notification routine for this - * tool. As we will never need to checkpoint this tool. - * Note: This must happen before opal_init(). - */ - opal_cr_set_enabled(false); - - /* Select the none component, since we don't actually use a checkpointer */ - (void) mca_base_var_env_name("crs", &tmp_env_var); - opal_setenv(tmp_env_var, - "none", - true, &environ); - free(tmp_env_var); - tmp_env_var = NULL; - - (void) mca_base_var_env_name("opal_cr_is_tool", &tmp_env_var); - opal_setenv(tmp_env_var, - "1", - true, &environ); - free(tmp_env_var); -#endif - - /* we are never allowed to operate as a distributed tool, - * so insist on the ess/tool component */ - opal_setenv("OMPI_MCA_ess", "tool", true, &environ); - - /*************************** - * We need all of OPAL and the TOOL portion of ORTE - ***************************/ - ret = orte_init(&argc, &argv, ORTE_PROC_TOOL); - - return ret; -} - -static int pretty_print(orte_ps_mpirun_info_t *hnpinfo) { - char *header; - int len_hdr; - - /* - * Print header and remember header length - */ - len_hdr = asprintf(&header, "Information from mpirun %s", ORTE_JOBID_PRINT(hnpinfo->hnp->name.jobid)); - - printf("\n\n%s\n", header); - free(header); - pretty_print_dashed_line(len_hdr); - - /* - * Print Node Information - */ - if( orte_ps_globals.nodes ) - pretty_print_nodes(hnpinfo->nodes, hnpinfo->num_nodes); - - /* - * Print Job Information - */ - pretty_print_jobs(hnpinfo->jobs, hnpinfo->num_jobs); - - return ORTE_SUCCESS; -} - -static int pretty_print_nodes(orte_node_t **nodes, orte_std_cntr_t num_nodes) { - int line_len; - int len_name = 0, - len_state = 0, - len_slots = 0, - len_slots_i = 0, - len_slots_m = 0; - orte_node_t *node; - orte_std_cntr_t i; - - /* - * Caculate segment lengths - */ - len_name = (int) strlen("Node Name"); - len_state = (int) strlen("State"); - len_slots = (int) strlen("Slots"); - len_slots_i = (int) strlen("Slots In Use"); - len_slots_m = (int) strlen("Slots Max"); - - for(i=0; i < num_nodes; i++) { - node = nodes[i]; - - if( NULL != node->name && - (int)strlen(node->name) > len_name) - len_name = (int) strlen(node->name); - - if( (int)strlen(pretty_node_state(node->state)) > len_state ) - len_state = (int)strlen(pretty_node_state(node->state)); - } - - line_len = (len_name + 3 + - len_state + 3 + - len_slots + 3 + - len_slots_i + 3 + - len_slots_m) + 2; - - /* - * Print the header - */ - printf("%*s | ", len_name, "Node Name"); - printf("%*s | ", len_state, "State"); - printf("%*s | ", len_slots, "Slots"); - printf("%*s | ", len_slots_m, "Slots Max"); - printf("%*s | ", len_slots_i, "Slots In Use"); - printf("\n"); - - pretty_print_dashed_line(line_len); - - /* - * Print Info - */ - for(i=0; i < num_nodes; i++) { - node = nodes[i]; - - printf("%*s | ", len_name, node->name); - printf("%*s | ", len_state, pretty_node_state(node->state)); - printf("%*d | ", len_slots, (uint)node->slots); - printf("%*d | ", len_slots_m, (uint)node->slots_max); - printf("%*d | ", len_slots_i, (uint)node->slots_inuse); - printf("\n"); - - } - - return ORTE_SUCCESS; -} - -static int pretty_print_jobs(orte_job_t **jobs, orte_std_cntr_t num_jobs) { - int len_jobid = 0, - len_state = 0, - len_slots = 0, - len_vpid_r = 0, - len_ckpt_s = 0, - len_ckpt_r = 0, - len_ckpt_l = 0; - int line_len; - orte_job_t *job; - orte_std_cntr_t i; - char *jobstr; - orte_jobid_t mask=0x0000ffff; -#if OPAL_ENABLE_FT_CR == 1 - char * state_str = NULL; - size_t ckpt_state; - char *snap_ref = NULL; - char *snap_loc = NULL; -#endif - - for(i=0; i < num_jobs; i++) { - job = jobs[i]; - - /* check the jobid to see if this is the daemons' job */ - if ((0 == (mask & job->jobid)) && !orte_ps_globals.daemons) { - continue; - } - - /* setup the printed name - do -not- free this! */ - jobstr = ORTE_JOBID_PRINT(job->jobid); - - /* - * Caculate segment lengths - */ - len_jobid = strlen(jobstr);; - len_state = (int) (strlen(orte_job_state_to_str(job->state)) < strlen("State") ? - strlen("State") : - strlen(orte_job_state_to_str(job->state))); - len_slots = 6; - len_vpid_r = (int) strlen("Num Procs"); -#if OPAL_ENABLE_FT_CR == 1 - orte_get_attribute(&job->attributes, ORTE_JOB_CKPT_STATE, (void**)&ckpt_state, OPAL_INT32); - orte_get_attribute(&job->attributes, ORTE_JOB_SNAPSHOT_REF, (void**)&snap_ref, OPAL_STRING); - orte_get_attribute(&job->attributes, ORTE_JOB_SNAPSHOT_LOC, (void**)&snap_loc, OPAL_STRING); - orte_snapc_ckpt_state_str(&state_str, ckpt_state); - len_ckpt_s = (int) (strlen(state_str) < strlen("Ckpt State") ? - strlen("Ckpt State") : - strlen(state_str) ); - len_ckpt_r = (int) (NULL == snap_ref ? strlen("Ckpt Ref") : (strlen(snap_ref) < strlen("Ckpt Ref") ? - strlen("Ckpt Ref") : strlen(snap_ref))); - len_ckpt_l = (int) (NULL == snap_loc ? strlen("Ckpt Loc") : (strlen(snap_loc) < strlen("Ckpt Loc") ? - strlen("Ckpt Loc") : strlen(snap_loc))); -#else - len_ckpt_s = -3; - len_ckpt_r = -3; - len_ckpt_l = -3; -#endif - - line_len = (len_jobid + 3 + - len_state + 3 + - len_slots + 3 + - len_vpid_r + 3 + - len_ckpt_s + 3 + - len_ckpt_r + 3 + - len_ckpt_l) - + 2; - - /* - * Print Header - */ - printf("\n"); - printf("%*s | ", len_jobid , "JobID"); - printf("%*s | ", len_state , "State"); - printf("%*s | ", len_slots , "Slots"); - printf("%*s | ", len_vpid_r , "Num Procs"); -#if OPAL_ENABLE_FT_CR == 1 - printf("%*s | ", len_ckpt_s , "Ckpt State"); - printf("%*s | ", len_ckpt_r , "Ckpt Ref"); - printf("%*s |", len_ckpt_l , "Ckpt Loc"); -#endif - printf("\n"); - - pretty_print_dashed_line(line_len); - - /* - * Print Info - */ - printf("%*s | ", len_jobid , ORTE_JOBID_PRINT(job->jobid)); - printf("%*s | ", len_state , orte_job_state_to_str(job->state)); - printf("%*d | ", len_slots , (uint)job->total_slots_alloc); - printf("%*d | ", len_vpid_r, job->num_procs); -#if OPAL_ENABLE_FT_CR == 1 - printf("%*s | ", len_ckpt_s, state_str); - printf("%*s | ", len_ckpt_r, (NULL == snap_ref ? "" : snap_ref)); - printf("%*s |", len_ckpt_l, (NULL == snap_loc ? "" : snap_loc)); -#endif - printf("\n"); - - - pretty_print_vpids(job); - printf("\n\n"); /* give a little room between job outputs */ - } - - return ORTE_SUCCESS; -} - -static int pretty_print_vpids(orte_job_t *job) { - int len_o_proc_name = 0, - len_proc_name = 0, - len_rank = 0, - len_pid = 0, - len_state = 0, - len_node = 0, - len_ckpt_s = 0, - len_ckpt_r = 0, - len_ckpt_l = 0; - int i, line_len; - orte_vpid_t v; - orte_proc_t *vpid; - orte_app_context_t *app; - char *o_proc_name; -#if OPAL_ENABLE_FT_CR == 1 - char *state_str = NULL; - size_t ckpt_state; - char *snap_ref = NULL; - char *snap_loc = NULL; -#endif - char **nodename = NULL; - - if (0 == job->num_procs) { - return ORTE_SUCCESS; - } - - /* - * Caculate segment lengths - */ - len_o_proc_name = (int)strlen("ORTE Name"); - len_proc_name = (int)strlen("Process Name"); - len_rank = (int)strlen("Local Rank"); - len_pid = 6; - len_state = 0; - len_node = 0; -#if OPAL_ENABLE_FT_CR == 1 - len_ckpt_s = strlen("Ckpt State"); - len_ckpt_r = strlen("Ckpt Ref"); - len_ckpt_l = strlen("Ckpt Loc"); -#else - len_ckpt_s = -3; - len_ckpt_r = -3; - len_ckpt_l = -3; -#endif - - nodename = (char **) malloc(job->num_procs * sizeof(char *)); - for(v=0; v < job->num_procs; v++) { - char *rankstr; - vpid = (orte_proc_t*)job->procs->addr[v]; - - /* - * Find my app context - */ - if( 0 >= (int)job->num_apps ) { - if( 0 == vpid->name.vpid ) { - if( (int)strlen("orterun") > len_proc_name) - len_proc_name = strlen("orterun"); - } - else { - if( (int)strlen("orted") > len_proc_name) - len_proc_name = strlen("orted"); - } - } - for( i = 0; i < (int)job->num_apps; ++i) { - app = (orte_app_context_t*)job->apps->addr[i]; - if( app->idx == vpid->app_idx ) { - if( (int)strlen(app->app) > len_proc_name) - len_proc_name = strlen(app->app); - break; - } - } - - o_proc_name = orte_util_print_name_args(&vpid->name); - if ((int)strlen(o_proc_name) > len_o_proc_name) - len_o_proc_name = strlen(o_proc_name); - - asprintf(&rankstr, "%u", (uint)vpid->local_rank); - if ((int)strlen(rankstr) > len_rank) - len_rank = strlen(rankstr); - free(rankstr); - - nodename[v] = NULL; - if( orte_get_attribute(&vpid->attributes, ORTE_PROC_NODENAME, (void**)&nodename[v], OPAL_STRING) && - (int)strlen(nodename[v]) > len_node) { - len_node = strlen(nodename[v]); - } else if ((int)strlen("Unknown") > len_node) { - len_node = strlen("Unknown"); - } - - if( (int)strlen(orte_proc_state_to_str(vpid->state)) > len_state) - len_state = strlen(orte_proc_state_to_str(vpid->state)); - -#if OPAL_ENABLE_FT_CR == 1 - orte_get_attribute(&vpid->attributes, ORTE_PROC_CKPT_STATE, (void**)&ckpt_state, OPAL_INT32); - orte_get_attribute(&vpid->attributes, ORTE_PROC_SNAPSHOT_REF, (void**)&snap_ref, OPAL_STRING); - orte_get_attribute(&vpid->attributes, ORTE_PROC_SNAPSHOT_LOC, (void**)&snap_loc, OPAL_STRING); - orte_snapc_ckpt_state_str(&state_str, ckpt_state); - if( (int)strlen(state_str) > len_ckpt_s) - len_ckpt_s = strlen(state_str); - - if(NULL != snap_ref && (int)strlen(snap_ref) > len_ckpt_r) - len_ckpt_r = strlen(snap_ref); - - if(NULL != snap_loc && (int)strlen(snap_loc) > len_ckpt_l) - len_ckpt_l = strlen(snap_loc); -#endif - } - - line_len = (len_o_proc_name + 3 + - len_proc_name + 3 + - len_rank + 3 + - len_pid + 3 + - len_state + 3 + - len_node + 3 + - len_ckpt_s + 3 + - len_ckpt_r + 3 + - len_ckpt_l) - + 2; - - /* - * Print Header - */ - printf("\t"); - printf("%*s | ", len_proc_name , "Process Name"); - printf("%*s | ", len_o_proc_name , "ORTE Name"); - printf("%*s | ", len_rank , "Local Rank"); - printf("%*s | ", len_pid , "PID"); - printf("%*s | ", len_node , "Node"); - printf("%*s | ", len_state , "State"); -#if OPAL_ENABLE_FT_CR == 1 - printf("%*s | ", len_ckpt_s , "Ckpt State"); - printf("%*s | ", len_ckpt_r , "Ckpt Ref"); - printf("%*s |", len_ckpt_l , "Ckpt Loc"); -#endif - printf("\n"); - - printf("\t"); - pretty_print_dashed_line(line_len); - - /* - * Print Info - */ - for(v=0; v < job->num_procs; v++) { - vpid = (orte_proc_t*)job->procs->addr[v]; - - printf("\t"); - - if( 0 >= (int)job->num_apps ) { - if( 0 == vpid->name.vpid ) { - printf("%*s | ", len_proc_name, "orterun"); - } else { - printf("%*s | ", len_proc_name, "orted"); - } - } - for( i = 0; i < (int)job->num_apps; ++i) { - app = (orte_app_context_t*)job->apps->addr[i]; - if( app->idx == vpid->app_idx ) { - printf("%*s | ", len_proc_name, app->app); - break; - } - } - - o_proc_name = orte_util_print_name_args(&vpid->name); - - printf("%*s | ", len_o_proc_name, o_proc_name); - printf("%*u | ", len_rank , (uint)vpid->local_rank); - printf("%*d | ", len_pid , vpid->pid); - printf("%*s | ", len_node , (NULL == nodename[v]) ? "Unknown" : nodename[v]); - printf("%*s | ", len_state , orte_proc_state_to_str(vpid->state)); - - if (NULL != nodename[v]) { - free(nodename[v]); - } -#if OPAL_ENABLE_FT_CR == 1 - printf("%*s | ", len_ckpt_s, state_str); - printf("%*s | ", len_ckpt_r, (NULL == snap_ref ? "" : snap_ref)); - printf("%*s |", len_ckpt_l, (NULL == snap_loc ? "" : snap_loc)); -#endif - printf("\n"); - - } - if (NULL != nodename) { - free(nodename); - } - return ORTE_SUCCESS; -} - -static void pretty_print_dashed_line(int len) { - static const char dashes[9] = "--------"; - - while (len >= 8) { - printf("%8.8s", dashes); - len -= 8; - } - printf("%*.*s\n", len, len, dashes); -} - -static int gather_information(orte_ps_mpirun_info_t *hnpinfo) { - int ret; - - if( ORTE_SUCCESS != (ret = gather_active_jobs(hnpinfo) )) { - goto cleanup; - } - - if( ORTE_SUCCESS != (ret = gather_nodes(hnpinfo) )) { - goto cleanup; - } - - if( ORTE_SUCCESS != (ret = gather_vpid_info(hnpinfo) )) { - goto cleanup; - } - - cleanup: - return ret; -} - -static int gather_active_jobs(orte_ps_mpirun_info_t *hnpinfo) { - int ret; - - if (ORTE_SUCCESS != (ret = orte_util_comm_query_job_info(&(hnpinfo->hnp->name), orte_ps_globals.jobid, - &hnpinfo->num_jobs, &hnpinfo->jobs))) { - ORTE_ERROR_LOG(ret); - } - - return ret; -} - -static int gather_nodes(orte_ps_mpirun_info_t *hnpinfo) { - int ret; - - if (ORTE_SUCCESS != (ret = orte_util_comm_query_node_info(&(hnpinfo->hnp->name), NULL, - &hnpinfo->num_nodes, &hnpinfo->nodes))) { - ORTE_ERROR_LOG(ret); - } - opal_output(0, "RECEIVED %d NODES", hnpinfo->num_nodes); - return ret; -} - -static int gather_vpid_info(orte_ps_mpirun_info_t *hnpinfo) { - int ret; - orte_std_cntr_t i; - int cnt; - orte_job_t *job; - orte_proc_t **procs; - - /* - * For each Job in the HNP - */ - for(i=0; i < hnpinfo->num_jobs; i++) { - job = hnpinfo->jobs[i]; - - /* - * Skip getting the vpid's for the HNP, unless asked to do so - * The HNP is always the first in the array - */ - if( 0 == i && !orte_ps_globals.daemons) { - continue; - } - - /* query the HNP for info on the procs in this job */ - if (ORTE_SUCCESS != (ret = orte_util_comm_query_proc_info(&(hnpinfo->hnp->name), - job->jobid, - ORTE_VPID_WILDCARD, - &cnt, - &procs))) { - ORTE_ERROR_LOG(ret); - } - job->procs->addr = (void**)procs; - job->procs->size = cnt; - job->num_procs = cnt; - } - - return ORTE_SUCCESS; -} - -static char *pretty_node_state(orte_node_state_t state) { - switch(state) { - case ORTE_NODE_STATE_DOWN: - return strdup("Down"); - break; - case ORTE_NODE_STATE_UP: - return strdup("Up"); - break; - case ORTE_NODE_STATE_REBOOT: - return strdup("Reboot"); - break; - case ORTE_NODE_STATE_UNKNOWN: - default: - return strdup("Unknown"); - break; - } -} - -static int parseable_print(orte_ps_mpirun_info_t *hnpinfo) -{ - orte_job_t **jobs; - orte_node_t **nodes; - orte_proc_t *proc; - orte_app_context_t *app; - char *appname; - int i, j; - char *nodename; - - /* don't include the daemon job in the number of jobs reported */ - printf("mpirun:%lu:num nodes:%d:num jobs:%d\n", - (unsigned long)hnpinfo->hnp->pid, hnpinfo->num_nodes, hnpinfo->num_jobs-1); - - if (orte_ps_globals.nodes) { - nodes = hnpinfo->nodes; - for (i=0; i < hnpinfo->num_nodes; i++) { - printf("node:%s:state:%s:slots:%d:in use:%d\n", - nodes[i]->name, pretty_node_state(nodes[i]->state), - nodes[i]->slots, nodes[i]->slots_inuse); - } - } - - jobs = hnpinfo->jobs; - /* skip job=0 as that's the daemon job */ - for (i=1; i < hnpinfo->num_jobs; i++) { - printf("jobid:%d:state:%s:slots:%d:num procs:%d\n", - ORTE_LOCAL_JOBID(jobs[i]->jobid), - orte_job_state_to_str(jobs[i]->state), - jobs[i]->total_slots_alloc, - jobs[i]->num_procs); - /* print the proc info */ - for (j=0; j < jobs[i]->procs->size; j++) { - if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jobs[i]->procs, j))) { - continue; - } - app = (orte_app_context_t*)opal_pointer_array_get_item(jobs[i]->apps, proc->app_idx); - if (NULL == app) { - appname = strdup("NULL"); - } else { - appname = opal_basename(app->app); - } - nodename = NULL; - orte_get_attribute(&proc->attributes, ORTE_PROC_NODENAME, (void**)&nodename, OPAL_STRING); - printf("process:%s:rank:%s:pid:%lu:node:%s:state:%s\n", - appname, ORTE_VPID_PRINT(proc->name.vpid), - (unsigned long)proc->pid, - (NULL == nodename) ? "unknown" : nodename, - orte_proc_state_to_str(proc->state)); - free(appname); - if (NULL != nodename) { - free(nodename); - } - } - } - - return ORTE_SUCCESS; -} diff --git a/orte/tools/orte-top/Makefile.am b/orte/tools/orte-top/Makefile.am deleted file mode 100644 index ab3b86508ad..00000000000 --- a/orte/tools/orte-top/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# -# 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) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -include $(top_srcdir)/Makefile.ompi-rules - -man_pages = orte-top.1 -EXTRA_DIST = orte-top.1in - -if OPAL_INSTALL_BINARIES - -bin_PROGRAMS = orte-top - -nodist_man_MANS = $(man_pages) - -# Ensure that the man pages are rebuilt if the opal_config.h file -# changes; a "good enough" way to know if configure was run again (and -# therefore the release date or version may have changed) -$(nodist_man_MANS): $(top_builddir)/opal/include/opal_config.h - -dist_ortedata_DATA = help-orte-top.txt - -endif # OPAL_INSTALL_BINARIES - -orte_top_SOURCES = orte-top.c -orte_top_LDADD = \ - $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la - -distclean-local: - rm -f $(man_pages) diff --git a/orte/tools/orte-top/help-orte-top.txt b/orte/tools/orte-top/help-orte-top.txt deleted file mode 100644 index 5eae695eedf..00000000000 --- a/orte/tools/orte-top/help-orte-top.txt +++ /dev/null @@ -1,82 +0,0 @@ -# -*- text -*- -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2009 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) 2012 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -# This is the US/English general help file for Open MPI's orte-top tool. -# -[orte-top:usage] -Return statistics on specified process ranks - -Usage: %s [OPTIONS] - -%s -# -[orte-top:pid-not-found] -We could not find an mpirun matching the provided pid on this machine. - -Pid provided: %d -# -[orte-top:no-contact-given] -This tool requires that you specify contact info for the mpirun executing -the specified rank(s). Please use the --help option for more information. -# -[orte-top:hnp-filename-bad] -We are unable to parse the filename where contact info for the -mpirun to be contacted was to be found. The option we were given was: - ---%s %s - -This appears to be missing the required ':' following the -keyword "file". Please use the --help option for more information on -the correct format for this command line option. -# -[orte-top:hnp-filename-access] -We are unable to access the filename where contact info for the -mpirun to be contacted was to be found. The filename we were given was: - -File: %s - -Please use the --help option for more information on -the correct format for this command line option. -# -[orte-top:hnp-file-bad] -We are unable to read the mpirun's contact info from the -given filename. The filename we were given was: - -FILE: %s - -Please use the --help option for more information on -the correct format for this command line option. -# -[orte-top:hnp-uri-bad] -We are unable to correctly parse the mpirun's contact info. The uri we were given was: - -URI: %s - -Please remember that this is *not* a standard uri, but -a special format used internally by Open MPI for communications. It can -best be generated by simply directing mpirun to put its -uri in a file, and then giving us that filename. -# -[orte-top:cant-open-logfile] -We are unable to open the specified output log file. - -File: %s - -Please use the --help option for more information on -the correct format for this command line option. diff --git a/orte/tools/orte-top/orte-top.1in b/orte/tools/orte-top/orte-top.1in deleted file mode 100644 index c33654a5b43..00000000000 --- a/orte/tools/orte-top/orte-top.1in +++ /dev/null @@ -1,106 +0,0 @@ -.\" -.\" Copyright (c) 2007 Los Alamos National Security, LLC -.\" All rights reserved. -.\" Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. -.\" -.\" Man page for OMPI's ompi-server command -.\" -.\" .TH name section center-footer left-footer center-header -.TH OMPI-TOP 1 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" -.\" ************************** -.\" Name Section -.\" ************************** -.SH NAME -. -ompi-top, orte-top \- Diagnostic to provide process info similar to the popular "top" program. -. -.PP -. -\fBNOTE:\fP \fIompi-top\fP, and \fIorte-top\fP are exact -synonyms for each other. Using any of the names will result in exactly -identical behavior. -. - -.\" ************************** -.\" Synopsis Section -.\" ************************** -.SH SYNOPSIS -. -.BR ompi-top " [ options ]" -. -.\" ************************** -.\" Options Section -.\" ************************** -.SH Options -. -\fIompi-top\fR collects and displays process information in a manner similar -to that of the popular "top" program. -. -.TP 10 -.B -h | --help -Display help for this command -. -. -.TP -.B -pid | --pid \fR\fP -The pid of the mpirun whose processes you want information about, or the name -of the file (specified as file:filename) that contains that info. Note that -the ompi-top command must be executed on the same node as mpirun to use this option. -. -. -.TP -.B -uri | --uri \fR\fP -Specify the URI of the mpirun whose processes you want information about, or the name -of the file (specified as file:filename) that contains that info. Note that -the ompi-top command does not have to be executed on the same node as mpirun to use this option. -. -. -.TP -.B -rank | --rank \fR\fP -The rank of the processes to be monitored. This can consist of a single rank, or -a comma-separated list of ranks. These can include rank ranges separated by a '-'. -If this option is not provided, or a value of -1 is given, ompi-top will default -to displaying information on all ranks. -. -. -.TP -.B -bynode | --bynode -Display the results grouped by node, with each node's processes reported in rank -order. If this option is not provided, ompi-top will default to displaying all -results in rank order. -. -. -.TP -.B -update-rate | --update-rate \fR\fP -The time (in seconds) between updates of the displayed information. If this option -is not provided, ompi-top will default to executing only once. -. -. -.TP -.B -timestamp | --timestamp -Provide an approximate time when each sample was taken. This time is approximate as it -only shows the time when the sample command was issued. -. -. -.TP -.B -log-file | --log-file \fR\fP -Log the results to the specified file instead of displaying them to stdout. -. -. -.\" ************************** -.\" Description Section -.\" ************************** -.SH DESCRIPTION -. -.PP -\fIompi-top\fR collects and displays process information in a manner similar -to that of the popular "top" program. It doesn't do the fancy screen display, but -does allow you to monitor available process information (to the limits of the underlying -operating system) of processes irrespective of their location. -. -.\" ************************** -.\" See Also Section -.\" ************************** -. -.SH SEE ALSO -. diff --git a/orte/tools/orte-top/orte-top.c b/orte/tools/orte-top/orte-top.c deleted file mode 100644 index 42e2f1f76fe..00000000000 --- a/orte/tools/orte-top/orte-top.c +++ /dev/null @@ -1,1041 +0,0 @@ -/* -*- 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-2011 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) 2007-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#include -#include -#include -#include - -#include "opal/util/cmd_line.h" -#include "opal/util/argv.h" -#include "opal/util/show_help.h" -#include "opal/util/opal_environ.h" -#include "opal/dss/dss.h" -#include "opal/mca/base/base.h" -#include "opal/mca/pmix/pmix.h" -#include "opal/runtime/opal.h" -#include "opal/mca/event/event.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/iof/base/base.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/odls/odls_types.h" -#include "orte/mca/routed/routed.h" -#include "orte/runtime/orte_globals.h" -#include "orte/util/hnp_contact.h" -#include "orte/util/name_fns.h" -#include "orte/util/show_help.h" -#include "orte/util/proc_info.h" -#include "orte/util/threads.h" -#include "orte/runtime/orte_wait.h" -#include "orte/mca/rml/base/rml_contact.h" -#include "orte/runtime/orte_quit.h" - -/* - * Local variables & functions - */ -static void abort_exit_callback(int fd, short flags, void *arg); -static opal_event_t term_handler; -static opal_event_t int_handler; -static opal_list_t hnp_list; -static bool all_recvd; -static int32_t num_replies; -static int32_t num_recvd; -static opal_buffer_t cmdbuf; -static FILE *fp = NULL; -static bool help; -static char *hnppidstr; -static char *hnpuristr; -static char *ranks; -static orte_hnp_contact_t *target_hnp; -static int update_rate; -static bool timestamp; -static char *logfile; -static bool bynode; -static opal_list_t recvd_stats; -static char *sample_time; -static bool need_header = true; -static int num_lines=0; -static bool fields_set = false; -static int nodefield = 0; -static int rankfield = 0; -static int pidfield = 0; -static int cmdfield = 0; -static int timefield = 6; -static int prifield = 0; -static int thrfield = 0; -static int vsizefield = 0; -static int rssfield = 0; -static int pkvfield = 0; -static int pfield = 0; - -/* flag what fields were actually found */ -static bool pri_found = false; -static bool thr_found = false; -static bool vsize_found = false; -static bool rss_found = false; -static bool pkv_found = false; -static bool p_found = false; - -#define MAX_LINES 20 - -opal_cmd_line_init_t cmd_line_opts[] = { - { NULL, - 'h', NULL, "help", - 0, - &help, OPAL_CMD_LINE_TYPE_BOOL, - "This help message" }, - - { NULL, - '\0', "pid", "pid", - 1, - &hnppidstr, OPAL_CMD_LINE_TYPE_STRING, - "The pid of the mpirun that you wish to query/monitor" }, - - { NULL, - '\0', "uri", "uri", - 1, - &hnpuristr, OPAL_CMD_LINE_TYPE_STRING, - "The uri of the mpirun that you wish to query/monitor" }, - - { NULL, - '\0', "rank", "rank", - 1, - &ranks, OPAL_CMD_LINE_TYPE_STRING, - "Rank whose resource usage is to be displayed/monitored" }, - - { NULL, - '\0', "update-rate", "update-rate", - 1, - &update_rate, OPAL_CMD_LINE_TYPE_INT, - "Number of seconds between updates" }, - - { NULL, - '\0', "timestamp", "timestamp", - 0, - ×tamp, OPAL_CMD_LINE_TYPE_BOOL, - "Time stamp each sample" }, - - { NULL, - '\0', "log-file", "log-file", - 1, - &logfile, OPAL_CMD_LINE_TYPE_STRING, - "Output file for returned statistics" }, - - { NULL, - '\0', "bynode", "bynode", - 0, - &bynode, OPAL_CMD_LINE_TYPE_BOOL, - "Group statistics by node, sorted by rank within each node" }, - - /* End of list */ - { NULL, - '\0', NULL, NULL, - 0, - NULL, OPAL_CMD_LINE_TYPE_NULL, - NULL } -}; - - -static void recv_stats(int status, orte_process_name_t* sender, - opal_buffer_t *buffer, orte_rml_tag_t tag, - void* cbdata); - -static void pretty_print(void); -static void print_headers(void); - -static void send_cmd(int fd, short dummy, void *arg) -{ - int ret; - opal_buffer_t *buf; - - all_recvd = false; - num_replies = INT_MAX; - num_recvd = 0; - buf = OBJ_NEW(opal_buffer_t); - opal_dss.copy_payload(buf, &cmdbuf); - if (0 > (ret = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &(target_hnp->name), buf, - ORTE_RML_TAG_DAEMON, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(buf); - orte_quit(0,0,NULL); - return; - } -} - -int -main(int argc, char *argv[]) -{ - int ret; - opal_cmd_line_t cmd_line; - opal_list_item_t* item = NULL; - orte_daemon_cmd_flag_t command; - pid_t hnppid; - orte_process_name_t proc; - char **r1=NULL, **r2; - int i; - orte_vpid_t vstart, vend; - int vint; - char *rtmod; - opal_value_t val; - - /*************** - * Initialize - ***************/ - - /* - * Make sure to init util before parse_args - * to ensure installdirs is setup properly - * before calling mca_base_open(); - */ - if( ORTE_SUCCESS != (ret = opal_init_util(&argc, &argv)) ) { - return ret; - } - - /* initialize the globals */ - help = false; - hnppidstr = NULL; - ranks = NULL; - target_hnp = NULL; - update_rate = -1; - timestamp = false; - logfile = NULL; - - /* Parse the command line options */ - opal_cmd_line_create(&cmd_line, cmd_line_opts); - - mca_base_open(); - mca_base_cmd_line_setup(&cmd_line); - ret = opal_cmd_line_parse(&cmd_line, false, false, argc, argv); - if (OPAL_SUCCESS != ret) { - if (OPAL_ERR_SILENT != ret) { - fprintf(stderr, "%s: command line error (%s)\n", argv[0], - opal_strerror(ret)); - } - return 1; - } - - /** - * Now start parsing our specific arguments - */ - if (help) { - char *str, *args = NULL; - args = opal_cmd_line_get_usage_msg(&cmd_line); - str = opal_show_help_string("help-orte-top.txt", "orte-top:usage", - true, "orte-top", args); - if (NULL != str) { - printf("%s", str); - free(str); - } - free(args); - /* If we show the help message, that should be all we do */ - return 0; - } - - /* we are never allowed to operate as a distributed tool, - * so insist on the ess/tool component */ - opal_setenv("OMPI_MCA_ess", "tool", true, &environ); - - /*************************** - * We need all of OPAL and the TOOL portion of ORTE - ***************************/ - if (ORTE_SUCCESS != orte_init(&argc, &argv, ORTE_PROC_TOOL)) { - orte_finalize(); - return 1; - } - - /* get our routed module */ - rtmod = orte_rml.get_routed(orte_mgmt_conduit); - - /* setup the list for recvd stats */ - OBJ_CONSTRUCT(&recvd_stats, opal_list_t); - - /** setup callbacks for abort signals - from this point - * forward, we need to abort in a manner that allows us - * to cleanup - */ - opal_event_signal_set(orte_event_base, &term_handler, SIGTERM, - abort_exit_callback, &term_handler); - opal_event_signal_add(&term_handler, NULL); - opal_event_signal_set(orte_event_base, &int_handler, SIGINT, - abort_exit_callback, &int_handler); - opal_event_signal_add(&int_handler, NULL); - - /* - * Must specify the mpirun pid - */ - if (NULL != hnppidstr) { - if (0 == strncmp(hnppidstr, "file", strlen("file")) || - 0 == strncmp(hnppidstr, "FILE", strlen("FILE"))) { - char input[1024], *filename; - FILE *fp; - - /* it is a file - get the filename */ - filename = strchr(hnppidstr, ':'); - if (NULL == filename) { - /* filename is not correctly formatted */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-bad", true, "pid", hnppidstr); - orte_finalize(); - exit(1); - } - ++filename; /* space past the : */ - - if (0 >= strlen(filename)) { - /* they forgot to give us the name! */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-bad", true, "pid", hnppidstr); - orte_finalize(); - exit(1); - } - - /* open the file and extract the pid */ - fp = fopen(filename, "r"); - if (NULL == fp) { /* can't find or read file! */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-access", true, filename); - orte_finalize(); - exit(1); - } - if (NULL == fgets(input, 1024, fp)) { - /* something malformed about file */ - fclose(fp); - orte_show_help("help-orte-top.txt", "orte-top:hnp-file-bad", true, filename); - orte_finalize(); - exit(1); - } - fclose(fp); - input[strlen(input)-1] = '\0'; /* remove newline */ - /* convert the pid */ - hnppid = strtoul(input, NULL, 10); - } else { - /* should just be the pid itself */ - hnppid = strtoul(hnppidstr, NULL, 10); - } - /* - * Get the list of available hnp's and setup contact info - * to them in the RML - */ - OBJ_CONSTRUCT(&hnp_list, opal_list_t); - if (ORTE_SUCCESS != (ret = orte_list_local_hnps(&hnp_list, true) ) ) { - orte_show_help("help-orte-top.txt", "orte-top:pid-not-found", true, hnppid); - orte_finalize(); - exit(1); - } - - /* - * For each hnp in the listing - */ - while (NULL != (item = opal_list_remove_first(&hnp_list))) { - orte_hnp_contact_t *hnp = (orte_hnp_contact_t*)item; - if (hnppid == hnp->pid) { - /* this is the one we want */ - target_hnp = hnp; - /* let it continue to run so we deconstruct the list */ - continue; - } - OBJ_RELEASE(hnp); - } - OBJ_DESTRUCT(&hnp_list); - - /* if we get here without finding the one we wanted, then abort */ - if (NULL == target_hnp) { - orte_show_help("help-orte-top.txt", "orte-top:pid-not-found", true, hnppid); - orte_finalize(); - exit(1); - } - } else if (NULL != hnpuristr) { - if (0 == strncmp(hnpuristr, "file", strlen("file")) || - 0 == strncmp(hnpuristr, "FILE", strlen("FILE"))) { - char input[1024], *filename; - FILE *fp; - - /* it is a file - get the filename */ - filename = strchr(hnpuristr, ':'); - if (NULL == filename) { - /* filename is not correctly formatted */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-bad", true, "uri", hnpuristr); - orte_finalize(); - exit(1); - } - ++filename; /* space past the : */ - - if (0 >= strlen(filename)) { - /* they forgot to give us the name! */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-bad", true, "uri", hnpuristr); - orte_finalize(); - exit(1); - } - - /* open the file and extract the uri */ - fp = fopen(filename, "r"); - if (NULL == fp) { /* can't find or read file! */ - orte_show_help("help-orte-top.txt", "orte-top:hnp-filename-access", true, filename); - orte_finalize(); - exit(1); - } - if (NULL == fgets(input, 1024, fp)) { - /* something malformed about file */ - fclose(fp); - orte_show_help("help-orte-top.txt", "orte-top:hnp-file-bad", true, filename); - orte_finalize(); - exit(1); - } - fclose(fp); - input[strlen(input)-1] = '\0'; /* remove newline */ - /* construct the target hnp info */ - target_hnp = OBJ_NEW(orte_hnp_contact_t); - target_hnp->rml_uri = strdup(input); - } else { - /* should just be the uri itself - construct the target hnp info */ - target_hnp = OBJ_NEW(orte_hnp_contact_t); - target_hnp->rml_uri = strdup(hnpuristr); - } - /* extract the name */ - if (ORTE_SUCCESS != orte_rml_base_parse_uris(target_hnp->rml_uri, &target_hnp->name, NULL)) { - orte_show_help("help-orte-top.txt", "orte-top:hnp-uri-bad", true, target_hnp->rml_uri); - orte_finalize(); - exit(1); - } - /* set the info in our contact table */ - OBJ_CONSTRUCT(&val, opal_value_t); - val.key = OPAL_PMIX_PROC_URI; - val.type = OPAL_STRING; - val.data.string = target_hnp->rml_uri; - if (OPAL_SUCCESS != (ret = opal_pmix.store_local(&target_hnp->name, &val))) { - ORTE_ERROR_LOG(ret); - val.key = NULL; - val.data.string = NULL; - OBJ_DESTRUCT(&val); - orte_show_help("help-orte-top.txt", "orte-top:hnp-uri-bad", true, target_hnp->rml_uri); - orte_finalize(); - exit(1); - } - val.key = NULL; - val.data.string = NULL; - OBJ_DESTRUCT(&val); - - /* set the route to be direct */ - if (ORTE_SUCCESS != orte_routed.update_route(rtmod, &target_hnp->name, &target_hnp->name)) { - orte_show_help("help-orte-top.txt", "orte-top:hnp-uri-bad", true, target_hnp->rml_uri); - orte_finalize(); - exit(1); - } - } else { - orte_show_help("help-orte-top.txt", "orte-top:no-contact-given", true); - orte_finalize(); - exit(1); - } - - /* set the target hnp as our lifeline so we will terminate if it exits */ - orte_routed.set_lifeline(rtmod, &target_hnp->name); - - /* if an output file was specified, open it */ - if (NULL != logfile) { - fp = fopen(logfile, "w"); - if (NULL == fp) { - orte_show_help("help-orte-top.txt", "orte-top:cant-open-logfile", true, logfile); - orte_finalize(); - exit(1); - } - } else { - fp = stdout; - } - - /* setup a non-blocking recv to get answers - we don't know how - * many daemons are going to send replies, so we just have to - * accept whatever comes back - */ - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_TOOL, - ORTE_RML_NON_PERSISTENT, recv_stats, NULL); - - - /* setup the command to get the resource usage */ - OBJ_CONSTRUCT(&cmdbuf, opal_buffer_t); - command = ORTE_DAEMON_TOP_CMD; - if (ORTE_SUCCESS != (ret = opal_dss.pack(&cmdbuf, &command, 1, ORTE_DAEMON_CMD))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - - proc.jobid = ORTE_PROC_MY_NAME->jobid+1; /* only support initial launch at this time */ - - /* parse the rank list - this can be a comma-separated list of ranks, - * each element being either a single rank or a range. We also allow - * for a -1 to indicate all ranks. If not rank is given, we assume -1 - */ - if (NULL == ranks) { - /* take all ranks */ - proc.vpid = ORTE_VPID_WILDCARD; - if (ORTE_SUCCESS != (ret = opal_dss.pack(&cmdbuf, &proc, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - goto SEND; - } - - /* split on commas */ - r1 = opal_argv_split(ranks, ','); - /* for each resulting element, check for range */ - for (i=0; i < opal_argv_count(r1); i++) { - r2 = opal_argv_split(r1[i], '-'); - if (1 < opal_argv_count(r2)) { - /* given range - get start and end */ - vstart = strtol(r2[0], NULL, 10); - vend = strtol(r2[1], NULL, 10); - } else { - /* check for wildcard - have to do this here because - * the -1 would have been caught in the split - */ - vint = strtol(r1[i], NULL, 10); - if (-1 == vint) { - proc.vpid = ORTE_VPID_WILDCARD; - if (ORTE_SUCCESS != (ret = opal_dss.pack(&cmdbuf, &proc, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - opal_argv_free(r2); - goto SEND; - } - vstart = strtol(r2[0], NULL, 10); - vend = vstart + 1; - } - for (proc.vpid = vstart; proc.vpid < vend; proc.vpid++) { - if (ORTE_SUCCESS != (ret = opal_dss.pack(&cmdbuf, &proc, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - } - opal_argv_free(r2); - } - -SEND: - if (NULL != r1) { - opal_argv_free(r1); - } - send_cmd(0, 0, NULL); - - /* now wait until the termination event fires */ - while (orte_event_base_active) { - opal_event_loop(orte_event_base, OPAL_EVLOOP_ONCE); - } - ORTE_ACQUIRE_OBJECT(orte_event_base_active); - - /*************** - * Cleanup - ***************/ -cleanup: - /* Remove the TERM and INT signal handlers */ - opal_event_signal_del(&term_handler); - opal_event_signal_del(&int_handler); - - while (NULL != (item = opal_list_remove_first(&recvd_stats))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&recvd_stats); - OBJ_DESTRUCT(&cmdbuf); - if (NULL != fp && fp != stdout) { - fclose(fp); - } - orte_finalize(); - - return ret; -} - -static void abort_exit_callback(int fd, short ign, void *arg) -{ - opal_list_item_t *item; - - /* Remove the TERM and INT signal handlers */ - opal_event_signal_del(&term_handler); - OBJ_DESTRUCT(&term_handler); - opal_event_signal_del(&int_handler); - OBJ_DESTRUCT(&int_handler); - - while (NULL != (item = opal_list_remove_first(&recvd_stats))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&recvd_stats); - OBJ_DESTRUCT(&cmdbuf); - if (NULL != fp && fp != stdout) { - fclose(fp); - } - ORTE_UPDATE_EXIT_STATUS(1); - orte_quit(0,0,NULL); -} - -static void recv_stats(int status, orte_process_name_t* sender, - opal_buffer_t *buffer, orte_rml_tag_t tag, - void* cbdata) -{ - int32_t n; - opal_pstats_t *stats; - orte_process_name_t proc; - int ret; - - /* if the sender is the HNP we contacted, this message - * contains info on the number of responses we should get - */ - if (sender->vpid == 0) { - n = 1; - if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &num_replies, &n, OPAL_INT32))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - n = 1; - if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &sample_time, &n, OPAL_STRING))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - } - - n = 1; - while (ORTE_SUCCESS == opal_dss.unpack(buffer, &proc, &n, ORTE_NAME)) { - n = 1; - if (ORTE_SUCCESS != (ret = opal_dss.unpack(buffer, &stats, &n, OPAL_PSTAT))) { - ORTE_ERROR_LOG(ret); - goto cleanup; - } - /* if field sizes are not yet set, do so now */ - if (!fields_set) { - int tmp; - char *ctmp; - - tmp = strlen(stats->node); - if (nodefield < tmp) { - nodefield = tmp; - } - - asprintf(&ctmp, "%d", stats->rank); - tmp = strlen(ctmp); - free(ctmp); - if (rankfield < tmp) { - rankfield = tmp; - } - - asprintf(&ctmp, "%lu", (unsigned long)stats->pid); - tmp = strlen(ctmp); - free(ctmp); - if (pidfield < tmp) { - pidfield = tmp; - } - - tmp = strlen(stats->cmd); - if (cmdfield < tmp) { - cmdfield = tmp; - } - - if (0 <= stats->priority) { - pri_found = true; - asprintf(&ctmp, "%d", stats->priority); - tmp = strlen(ctmp); - free(ctmp); - if (prifield < tmp) { - prifield = tmp; - } - } - - if (0 <= stats->num_threads) { - thr_found = true; - asprintf(&ctmp, "%d", stats->num_threads); - tmp = strlen(ctmp); - free(ctmp); - if (thrfield < tmp) { - thrfield = tmp; - } - } - - if (0 < stats->vsize) { - vsize_found = true; - asprintf(&ctmp, "%8.2f", stats->vsize); - tmp = strlen(ctmp); - free(ctmp); - if (vsizefield < tmp) { - vsizefield = tmp; - } - } - - if (0 < stats->rss) { - rss_found = true; - asprintf(&ctmp, "%8.2f", stats->rss); - tmp = strlen(ctmp); - free(ctmp); - if (rssfield < tmp) { - rssfield = tmp; - } - } - - if (0 < stats->peak_vsize) { - pkv_found = true; - asprintf(&ctmp, "%8.2f", stats->peak_vsize); - tmp = strlen(ctmp); - free(ctmp); - if (pkvfield < tmp) { - pkvfield = tmp; - } - } - - if (0 <= stats->processor) { - p_found = true; - asprintf(&ctmp, "%d", stats->processor); - tmp = strlen(ctmp); - free(ctmp); - if (pfield < tmp) { - pfield = tmp; - } - } - } - /* add it to the list */ - opal_list_append(&recvd_stats, &stats->super); - } - - cleanup: - /* check for completion */ - num_recvd++; - if (num_replies <= num_recvd) { - /* flag that field sizes are set */ - fields_set = true; - - /* pretty-print what we got */ - pretty_print(); - - /* see if we want to do it again */ - if (0 < update_rate) { - ORTE_TIMER_EVENT(update_rate, 0, send_cmd, ORTE_SYS_PRI); - } else { - orte_finalize(); - exit(0); - } - } - - /* repost the receive */ - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_TOOL, - ORTE_RML_NON_PERSISTENT, recv_stats, NULL); -} - -/* static values needed for printing */ -static int lennode = 0; -static int lenrank = 0; -static int lenpid = 0; -static int lencmd = 0; -static int lenstate = 0; -static int lentime = 0; -static int lenpri = 0; -static int lenthr = 0; -static int lenvsize = 0; -static int lenrss = 0; -static int lenpkv = 0; -static int lensh = 0; -static int lenp = 0; - -static void print_ranks(opal_list_t *statlist) -{ - opal_list_item_t *item; - opal_pstats_t *stats, *pstats; - int32_t minrank; - char pretty_time[32]; - int i; - - /* sort the results by rank */ - while (0 < opal_list_get_size(statlist)) { - minrank = INT32_MAX; - pstats = NULL; - for (item = opal_list_get_first(statlist); - item != opal_list_get_end(statlist); - item = opal_list_get_next(item)) { - stats = (opal_pstats_t*)item; - if (stats->rank < minrank) { - pstats = stats; - minrank = stats->rank; - } - } - memset(pretty_time, 0, sizeof(pretty_time)); - if (pstats->time.tv_sec >= 3600) { - snprintf(pretty_time, sizeof(pretty_time), "%5.1fH", - (double)pstats->time.tv_sec / (double)(3600)); - } else { - snprintf(pretty_time, sizeof(pretty_time), "%3ld:%02ld", - (unsigned long)pstats->time.tv_sec/60, - (unsigned long)pstats->time.tv_sec % 60); - } - - if (bynode) { - /* print blanks in the nodename field */ - for (i=0; i < lennode; i++) { - fprintf(fp, " "); - } - fprintf(fp, " | "); - /* print fields */ - fprintf(fp, "%*d | ", lenrank, pstats->rank); - } else { - fprintf(fp, "%*d | ", lenrank, pstats->rank); - fprintf(fp, "%*s | ", lennode, pstats->node); - } - fprintf(fp, "%*s | ", lencmd, pstats->cmd); - fprintf(fp, "%*lu | ", lenpid, (unsigned long)pstats->pid); - fprintf(fp, "%*c | ", lenstate, pstats->state[0]); - fprintf(fp, "%*s | ", lentime, pretty_time); - if (pri_found) { - fprintf(fp, "%*d | ", lenpri, pstats->priority); - } - if (thr_found) { - fprintf(fp, "%*d | ", lenthr, pstats->num_threads); - } - if (vsize_found) { - fprintf(fp, "%*lu | ", lenvsize, (unsigned long)pstats->vsize); - } - if (rss_found) { - fprintf(fp, "%*lu | ", lenvsize, (unsigned long)pstats->rss); - } - if (pkv_found) { - fprintf(fp, "%*lu | ", lenpkv, (unsigned long)pstats->peak_vsize); - } - if (p_found) { - fprintf(fp, "%*d | ", lenp, pstats->processor); - } - fprintf(fp, "\n"); - num_lines++; - opal_list_remove_item(statlist, &pstats->super); - OBJ_RELEASE(pstats); - } -} - -static void pretty_print(void) -{ - opal_list_item_t *item, *next; - opal_pstats_t *stats; - opal_list_t tmplist; - char *node; - - if (bynode) { - if (need_header) { - print_headers(); - need_header = false; - } - if (timestamp) { - fprintf(fp, "TIMESTAMP: %s\n", sample_time); - } - if (NULL != sample_time) { - free(sample_time); - sample_time = NULL; - } - /* sort the results by node and then rank */ - while (NULL != (item = opal_list_remove_first(&recvd_stats))) { - OBJ_CONSTRUCT(&tmplist, opal_list_t); - stats = (opal_pstats_t*)item; - node = strdup(stats->node); - opal_list_append(&tmplist, &stats->super); - /* cycle through the rest of the list looking - * for matching nodes - */ - item = opal_list_get_first(&recvd_stats); - while (item != opal_list_get_end(&recvd_stats)) { - stats = (opal_pstats_t*)item; - next = opal_list_get_next(item); - if (0 == strcmp(stats->node, node)) { - opal_list_remove_item(&recvd_stats, item); - opal_list_append(&tmplist, &stats->super); - } - item = next; - } - fprintf(fp, "%*s\n", lennode, node); - free(node); - print_ranks(&tmplist); - OBJ_DESTRUCT(&tmplist); - } - } else { - if (need_header) { - print_headers(); - need_header = false; - } - if (timestamp) { - fprintf(fp, "\n\nTIMESTAMP: %s\n", sample_time); - } - if (NULL != sample_time) { - free(sample_time); - sample_time = NULL; - } - print_ranks(&recvd_stats); - } - - /* provide some separation between iterations */ - fprintf(fp, "\n"); - - /* if we have printed more than MAX_LINES since the last header, - * flag that we need to print the header next time - */ - if (MAX_LINES < num_lines) { - need_header = true; - num_lines = 0; - fprintf(fp, "\n\n"); - } -} - -static void print_headers(void) -{ - int num_fields = 0; - int i; - int linelen; - - lennode = strlen("Nodename"); - if (nodefield > lennode) { - lennode = nodefield; - } - num_fields++; - - lenrank = strlen("Rank"); - if (rankfield > lenrank) { - lenrank = rankfield; - } - num_fields++; - - lenpid = strlen("Pid"); - if (pidfield > lenpid) { - lenpid = pidfield; - } - num_fields++; - - lencmd = strlen("Command"); - if (cmdfield > lencmd) { - lencmd = cmdfield; - } - num_fields++; - - lenstate = strlen("State"); - num_fields++; - - lentime = strlen("Time"); - if (timefield > lentime) { - lentime = timefield; - } - num_fields++; - - if (pri_found) { - lenpri = strlen("Pri"); - if (prifield > lenpri) { - lenpri = prifield; - } - num_fields++; - } - - if (thr_found) { - lenthr = strlen("#threads"); - if (thrfield > lenthr) { - lenthr = thrfield; - } - num_fields++; - } - - if (vsize_found) { - lenvsize = strlen("Vsize"); - if (vsizefield > lenvsize) { - lenvsize = vsizefield; - } - num_fields++; - } - - if (rss_found) { - lenrss = strlen("RSS"); - if (rssfield > lenrss) { - lenrss = rssfield; - } - num_fields++; - } - - if (pkv_found) { - lenpkv = strlen("Peak Vsize"); - if (pkvfield > lenpkv) { - lenpkv = pkvfield; - } - num_fields++; - } - - if (p_found) { - lenp = strlen("Processor"); - if (pfield > lenp) { - lenp = pfield; - } - num_fields++; - } - - linelen = lennode + lenrank + lenpid + lencmd + lenstate + lentime + lenpri + lenthr + lenvsize + lenrss + lenpkv + lensh + lenp; - /* add spacing */ - linelen += num_fields * 3; - - /* print the rip line */ - for(i = 0; i < linelen; ++i) { - fprintf(fp, "="); - } - fprintf(fp, "\n"); - - /* print the header */ - if (bynode) { - fprintf(fp, "%*s | ", lennode , "Nodename"); - fprintf(fp, "%*s | ", lenrank , "Rank"); - } else { - fprintf(fp, "%*s | ", lenrank , "Rank"); - fprintf(fp, "%*s | ", lennode , "Nodename"); - } - fprintf(fp, "%*s | ", lencmd , "Command"); - fprintf(fp, "%*s | ", lenpid , "Pid"); - fprintf(fp, "%*s | ", lenstate , "State"); - fprintf(fp, "%*s | ", lentime , "Time"); - if (pri_found) { - fprintf(fp, "%*s | ", lenpri , "Pri"); - } - if (thr_found) { - fprintf(fp, "%*s | ", lenthr , "#threads"); - } - if (vsize_found) { - fprintf(fp, "%*s | ", lenvsize , "Vsize"); - } - if (rss_found) { - fprintf(fp, "%*s | ", lenrss , "RSS"); - } - if (pkv_found) { - fprintf(fp, "%*s | ", lenpkv , "Peak Vsize"); - } - if (p_found) { - fprintf(fp, "%*s | ", lenp , "Processor"); - } - fprintf(fp, "\n"); - - /* print the separator */ - for(i = 0; i < linelen; ++i) { - fprintf(fp, "-"); - } - fprintf(fp, "\n"); - -} From 8a329a797c3c174c1a4cfbff669885551c1ce268 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Sun, 28 Oct 2018 19:00:23 +0200 Subject: [PATCH 167/674] SCOLL/BASIC: Fix invalid pSync pointer passed to barrier func mca_scoll_basic_alltoall() passed (pSync + 1) to barrier function, but the value of _SHMEM_ALLTOALL_SYNC_SIZE is 1, which made the barrier function use an invalid memory location. In particular, this location was not initialized to _SHMEM_SYNC_VALUE, which broke the barrier algorithm and it did not complete: One PE could read 0 from its peer and assume the peer already started the barrier, and then write 1 to the peer. Then, the peer entered the barrier and overwrote the 1 with 0, and then it waited forever to see '1' in its pSync. Found with shmem_verifier test suite. (picked from master 6754bf1) Signed-off-by: Yossi Itigin --- oshmem/mca/scoll/basic/scoll_basic_alltoall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c index 9843d985e78..1698ee13354 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c +++ b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c @@ -79,7 +79,7 @@ int mca_scoll_basic_alltoall(struct oshmem_group_t *group, /* Wait for operation completion */ SCOLL_VERBOSE(14, "[#%d] Wait for operation completion", group->my_pe); - rc = BARRIER_FUNC(group, pSync + 1, SCOLL_DEFAULT_ALG); + rc = BARRIER_FUNC(group, pSync, SCOLL_DEFAULT_ALG); /* Restore initial values */ SCOLL_VERBOSE(12, "PE#%d Restore special synchronization array", From 5a74ddb34d2a31321d54fe0c1969697729dbcb6f Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Wed, 24 Oct 2018 15:31:33 -0700 Subject: [PATCH 168/674] coll/tuned: Fix MPI_IN_PLACE processing in tuned algorithms PR #5450 addresses MPI_IN_PLACE processing for basic collective algorithms. But in conjunction with that, we need to check for MPI_IN_PLACE in tuned paths as well before calling ompi_datatype_type_size() as otherwise we segfault. MPI spec also stipulates to ignore sendcount and sendtype for Alltoall and Allgatherv operations. So, extending the check to these algorithms as well. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 88d781056f43934a93e16db556b340e72cdd3742) --- .../coll/tuned/coll_tuned_decision_fixed.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index 102e4ee11f3..0150fcc3b49 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -119,7 +119,11 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, int scount, the University of Tennessee (2GB MX) up to 64 nodes. Has better performance for messages of intermediate sizes than the old one */ /* determine block size */ - ompi_datatype_type_size(sdtype, &dsize); + if (MPI_IN_PLACE != sbuf) { + ompi_datatype_type_size(sdtype, &dsize); + } else { + ompi_datatype_type_size(rdtype, &dsize); + } block_dsize = dsize * (ptrdiff_t)scount; if ((block_dsize < (size_t) ompi_coll_tuned_alltoall_small_msg) @@ -549,7 +553,11 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(const void *sbuf, int scount, } /* Determine complete data size */ - ompi_datatype_type_size(sdtype, &dsize); + if (MPI_IN_PLACE != sbuf) { + ompi_datatype_type_size(sdtype, &dsize); + } else { + ompi_datatype_type_size(rdtype, &dsize); + } total_dsize = dsize * (ptrdiff_t)scount * (ptrdiff_t)communicator_size; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed" @@ -644,7 +652,12 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount, } /* Determine complete data size */ - ompi_datatype_type_size(sdtype, &dsize); + if (MPI_IN_PLACE != sbuf) { + ompi_datatype_type_size(sdtype, &dsize); + } else { + ompi_datatype_type_size(rdtype, &dsize); + } + total_dsize = 0; for (i = 0; i < communicator_size; i++) { total_dsize += dsize * (ptrdiff_t)rcounts[i]; From aaf15a6c174f425f87027985cbcf29084deed8f4 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 29 Oct 2018 16:51:27 +0200 Subject: [PATCH 169/674] OSHMEM/PROFILE: fixed profile build - added missing file to profile makefile - constants SHMEM_CTX_* are shifted into public header Signed-off-by: Sergey Oblomov (cherry picked from commit 4a3e83780c0303e7e4d0ff92d7ba85d3a2239737) --- oshmem/include/oshmem/constants.h | 5 ----- oshmem/include/shmem.h.in | 8 +++++++- oshmem/shmem/c/profile/Makefile.am | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/oshmem/include/oshmem/constants.h b/oshmem/include/oshmem/constants.h index 17a560692db..be8d4b20327 100644 --- a/oshmem/include/oshmem/constants.h +++ b/oshmem/include/oshmem/constants.h @@ -105,11 +105,6 @@ enum { #define SHMEM_UNDEFINED -32766 /* undefined stuff */ -#define SHMEM_CTX_PRIVATE (1<<0) -#define SHMEM_CTX_SERIALIZED (1<<1) -#define SHMEM_CTX_NOSTORE (1<<2) - - #ifndef UNREFERENCED_PARAMETER #define UNREFERENCED_PARAMETER(P) ((void)P) #endif diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 8d3478910f2..77b1a3ca21f 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -99,6 +99,10 @@ enum { #define SHMEM_VENDOR_STRING "http://www.open-mpi.org/" #define SHMEM_MAX_NAME_LEN 256 +#define SHMEM_CTX_PRIVATE (1<<0) +#define SHMEM_CTX_SERIALIZED (1<<1) +#define SHMEM_CTX_NOSTORE (1<<2) + /* * Deprecated (but still valid) names */ @@ -195,7 +199,9 @@ OSHMEM_DECLSPEC void *shmem_ptr(const void *ptr, int pe); typedef struct { int dummy; } * shmem_ctx_t; -#define SHMEM_CTX_DEFAULT oshmem_ctx_default; +#define SHMEM_CTX_DEFAULT oshmem_ctx_default + +extern shmem_ctx_t oshmem_ctx_default; OSHMEM_DECLSPEC int shmem_ctx_create(long options, shmem_ctx_t *ctx); OSHMEM_DECLSPEC void shmem_ctx_destroy(shmem_ctx_t ctx); diff --git a/oshmem/shmem/c/profile/Makefile.am b/oshmem/shmem/c/profile/Makefile.am index 4764c3810d3..717d9fbf2ef 100644 --- a/oshmem/shmem/c/profile/Makefile.am +++ b/oshmem/shmem/c/profile/Makefile.am @@ -38,6 +38,7 @@ OSHMEM_API_SOURCES = \ pshmem_align.c \ pshmem_query.c \ pshmem_p.c \ + pshmem_context.c \ pshmem_put.c \ pshmem_g.c \ pshmem_get.c \ From d3f08d010c5b3fd6615f22f6186f4dce5b236d6f Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 30 Oct 2018 22:19:23 +0200 Subject: [PATCH 170/674] OSHMEM/AMO: added missing C11 macro datatypes - added signed datatypes for atomic_add calls - added unsigned datatypes for atomic put/inc/get/fetch calls - fixed incorrect SHMEM_CTX_DEFAULT macro, added external declaration of oshmem_ctx_default variable Signed-off-by: Sergey Oblomov (cherry picked from commit f63d6da6d733e263385188b5470df195f092d041) --- oshmem/include/pshmem.h | 672 ++++++++++++++++++++++++------- oshmem/include/shmem.h.in | 636 ++++++++++++++++++++++------- oshmem/shmem/c/profile/defines.h | 330 +++++++++++---- oshmem/shmem/c/shmem_add.c | 12 + oshmem/shmem/c/shmem_and.c | 12 + oshmem/shmem/c/shmem_cswap.c | 12 + oshmem/shmem/c/shmem_fadd.c | 12 + oshmem/shmem/c/shmem_fand.c | 12 + oshmem/shmem/c/shmem_fetch.c | 12 + oshmem/shmem/c/shmem_finc.c | 12 + oshmem/shmem/c/shmem_for.c | 12 + oshmem/shmem/c/shmem_fxor.c | 12 + oshmem/shmem/c/shmem_g.c | 22 + oshmem/shmem/c/shmem_get.c | 24 ++ oshmem/shmem/c/shmem_get_nb.c | 24 ++ oshmem/shmem/c/shmem_iget.c | 24 ++ oshmem/shmem/c/shmem_inc.c | 14 +- oshmem/shmem/c/shmem_iput.c | 24 ++ oshmem/shmem/c/shmem_or.c | 12 + oshmem/shmem/c/shmem_p.c | 24 ++ oshmem/shmem/c/shmem_put.c | 24 ++ oshmem/shmem/c/shmem_put_nb.c | 24 ++ oshmem/shmem/c/shmem_set.c | 12 + oshmem/shmem/c/shmem_swap.c | 12 + oshmem/shmem/c/shmem_xor.c | 12 + 25 files changed, 1629 insertions(+), 369 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 718a7367956..8ee6931ebcc 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -105,6 +105,12 @@ OSHMEM_DECLSPEC void pshmem_ctx_long_p(shmem_ctx_t ctx, long* addr, long value, OSHMEM_DECLSPEC void pshmem_ctx_float_p(shmem_ctx_t ctx, float* addr, float value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_p(shmem_ctx_t ctx, double* addr, double value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_p(shmem_ctx_t ctx, long long* addr, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_p(shmem_ctx_t ctx, signed char* addr, signed char value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_p(shmem_ctx_t ctx, unsigned char* addr, unsigned char value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_p(shmem_ctx_t ctx, unsigned short* addr, unsigned short value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_p(shmem_ctx_t ctx, unsigned int* addr, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_p(shmem_ctx_t ctx, unsigned long* addr, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_p(shmem_ctx_t ctx, unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); OSHMEM_DECLSPEC void pshmem_char_p(char* addr, char value, int pe); @@ -114,25 +120,43 @@ OSHMEM_DECLSPEC void pshmem_long_p(long* addr, long value, int pe); OSHMEM_DECLSPEC void pshmem_float_p(float* addr, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_p(double* addr, double value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_p(long long* addr, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_schar_p(signed char* addr, signed char value, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_p(unsigned char* addr, unsigned char value, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_p(unsigned short* addr, unsigned short value, int pe); +OSHMEM_DECLSPEC void pshmem_uint_p(unsigned int* addr, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_p(unsigned long* addr, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_p(unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_p(long double* addr, long double value, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_p(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - char*: pshmem_ctx_char_p, \ - short*: pshmem_ctx_short_p, \ - int*: pshmem_ctx_int_p, \ - long*: pshmem_ctx_long_p, \ - long long*: pshmem_ctx_longlong_p, \ + char*: pshmem_ctx_char_p, \ + short*: pshmem_ctx_short_p, \ + int*: pshmem_ctx_int_p, \ + long*: pshmem_ctx_long_p, \ + long long*: pshmem_ctx_longlong_p, \ + signed char*: pshmem_ctx_schar_p, \ + unsigned char*: pshmem_ctx_uchar_p, \ + unsigned short*: pshmem_ctx_ushort_p, \ + unsigned int*: pshmem_ctx_uint_p, \ + unsigned long*: pshmem_ctx_ulong_p, \ + unsigned long long*: pshmem_ctx_ulonglong_p, \ float*: pshmem_ctx_float_p, \ double*: pshmem_ctx_double_p, \ long double*: pshmem_ctx_longdouble_p, \ - default: __oshmem_datatype_ignore), \ - char*: pshmem_char_p, \ - short*: pshmem_short_p, \ - int*: pshmem_int_p, \ - long*: pshmem_long_p, \ - long long*: pshmem_longlong_p, \ + default: __opshmem_datatype_ignore), \ + char*: pshmem_char_p, \ + short*: pshmem_short_p, \ + int*: pshmem_int_p, \ + long*: pshmem_long_p, \ + long long*: pshmem_longlong_p, \ + signed char*: pshmem_schar_p, \ + unsigned char*: pshmem_uchar_p, \ + unsigned short*: pshmem_ushort_p, \ + unsigned int*: pshmem_uint_p, \ + unsigned long*: pshmem_ulong_p, \ + unsigned long long*: pshmem_ulonglong_p, \ float*: pshmem_float_p, \ double*: pshmem_double_p, \ long double*: pshmem_longdouble_p)(__VA_ARGS__) @@ -143,39 +167,63 @@ OSHMEM_DECLSPEC void pshmem_longdouble_p(long double* addr, long double value, */ OSHMEM_DECLSPEC void pshmem_ctx_char_put(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_short_put(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_int_put(shmem_ctx_t ctx, int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int_put(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_put(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_put(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_put(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_put(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_put(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_put(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_put(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_put(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_put(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_put(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_put(short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_int_put(int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int_put(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_long_put(long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_float_put(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_put(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longlong_put(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_put(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_put(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_put(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_put(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_put(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_put(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_put(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ char*: pshmem_ctx_char_put, \ short*: pshmem_ctx_short_put, \ int*: pshmem_ctx_int_put, \ long*: pshmem_ctx_long_put, \ long long*: pshmem_ctx_longlong_put, \ + signed char*: pshmem_ctx_schar_put, \ + unsigned char*: pshmem_ctx_uchar_put, \ + unsigned short*: pshmem_ctx_ushort_put, \ + unsigned int*: pshmem_ctx_uint_put, \ + unsigned long*: pshmem_ctx_ulong_put, \ + unsigned long long*: pshmem_ctx_ulonglong_put, \ float*: pshmem_ctx_float_put, \ double*: pshmem_ctx_double_put, \ long double*: pshmem_ctx_longdouble_put, \ - default: __oshmem_datatype_ignore), \ - char*: pshmem_char_put, \ - short*: pshmem_short_put, \ - int*: pshmem_int_put, \ - long*: pshmem_long_put, \ - long long*: pshmem_longlong_put, \ + default: __opshmem_datatype_ignore), \ + char*: pshmem_char_put, \ + short*: pshmem_short_put, \ + int*: pshmem_int_put, \ + long*: pshmem_long_put, \ + long long*: pshmem_longlong_put, \ + signed char*: pshmem_schar_put, \ + unsigned char*: pshmem_uchar_put, \ + unsigned short*: pshmem_ushort_put, \ + unsigned int*: pshmem_uint_put, \ + unsigned long*: pshmem_ulong_put, \ + unsigned long long*: pshmem_ulonglong_put, \ float*: pshmem_float_put, \ double*: pshmem_double_put, \ long double*: pshmem_longdouble_put)(__VA_ARGS__) @@ -205,6 +253,12 @@ OSHMEM_DECLSPEC void pshmem_ctx_long_iput(shmem_ctx_t ctx, long* target, const l OSHMEM_DECLSPEC void pshmem_ctx_float_iput(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_iput(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_iput(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_iput(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_iput(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_iput(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_iput(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_iput(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_iput(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -214,6 +268,12 @@ OSHMEM_DECLSPEC void pshmem_long_iput(long* target, const long* source, ptrdiff_ OSHMEM_DECLSPEC void pshmem_float_iput(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_iput(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longlong_iput(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_iput(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_iput(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_iput(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_iput(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_iput(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_iput(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_iput(...) \ @@ -224,15 +284,27 @@ OSHMEM_DECLSPEC void pshmem_longdouble_iput(long double* target, const long doub int*: pshmem_ctx_int_iput, \ long*: pshmem_ctx_long_iput, \ long long*: pshmem_ctx_longlong_iput, \ + signed char*: pshmem_ctx_schar_iput, \ + unsigned char*: pshmem_ctx_uchar_iput, \ + unsigned short*: pshmem_ctx_ushort_iput, \ + unsigned int*: pshmem_ctx_uint_iput, \ + unsigned long*: pshmem_ctx_ulong_iput, \ + unsigned long long*: pshmem_ctx_ulonglong_iput, \ float*: pshmem_ctx_float_iput, \ double*: pshmem_ctx_double_iput, \ long double*: pshmem_ctx_longdouble_iput, \ - default: __oshmem_datatype_ignore), \ - char*: pshmem_char_iput, \ - short*: pshmem_short_iput, \ - int*: pshmem_int_iput, \ - long*: pshmem_long_iput, \ - long long*: pshmem_longlong_iput, \ + default: __opshmem_datatype_ignore), \ + char*: pshmem_char_iput, \ + short*: pshmem_short_iput, \ + int*: pshmem_int_iput, \ + long*: pshmem_long_iput, \ + long long*: pshmem_longlong_iput, \ + signed char*: pshmem_schar_iput, \ + unsigned char*: pshmem_uchar_iput, \ + unsigned short*: pshmem_ushort_iput, \ + unsigned int*: pshmem_uint_iput, \ + unsigned long*: pshmem_ulong_iput, \ + unsigned long long*: pshmem_ulonglong_iput, \ float*: pshmem_float_iput, \ double*: pshmem_double_iput, \ long double*: pshmem_longdouble_iput)(__VA_ARGS__) @@ -255,40 +327,64 @@ OSHMEM_DECLSPEC void pshmem_iput128(void* target, const void* source, ptrdiff_t */ OSHMEM_DECLSPEC void pshmem_ctx_char_put_nbi(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_short_put_nbi(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_int_put_nbi(shmem_ctx_t ctx, int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int_put_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_put_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_put_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_put_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_put_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_put_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_put_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_put_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_put_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_put_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_put_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_put_nbi(short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_int_put_nbi(int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int_put_nbi(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_long_put_nbi(long *target, const long *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_float_put_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_put_nbi(double *target, const double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_put_nbi(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_put_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_put_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_put_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_put_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_put_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_put_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ char*: pshmem_ctx_char_put_nbi, \ short*: pshmem_ctx_short_put_nbi, \ int*: pshmem_ctx_int_put_nbi, \ long*: pshmem_ctx_long_put_nbi, \ long long*: pshmem_ctx_longlong_put_nbi, \ + signed char*: pshmem_ctx_schar_put_nbi, \ + unsigned char*: pshmem_ctx_uchar_put_nbi, \ + unsigned short*: pshmem_ctx_ushort_put_nbi, \ + unsigned int*: pshmem_ctx_uint_put_nbi, \ + unsigned long*: pshmem_ctx_ulong_put_nbi, \ + unsigned long long*: pshmem_ctx_ulonglong_put_nbi, \ float*: pshmem_ctx_float_put_nbi, \ double*: pshmem_ctx_double_put_nbi, \ long double*: pshmem_ctx_longdouble_put_nbi, \ - default: __oshmem_datatype_ignore), \ - char*: pshmem_char_put_nbi, \ - short*: pshmem_short_put_nbi, \ - int*: pshmem_int_put_nbi, \ - long*: pshmem_long_put_nbi, \ - long long*: pshmem_longlong_put_nbi, \ + default: __opshmem_datatype_ignore), \ + char*: pshmem_char_put_nbi, \ + short*: pshmem_short_put_nbi, \ + int*: pshmem_int_put_nbi, \ + long*: pshmem_long_put_nbi, \ + long long*: pshmem_longlong_put_nbi, \ + signed char*: pshmem_schar_put_nbi, \ + unsigned char*: pshmem_uchar_put_nbi, \ + unsigned short*: pshmem_ushort_put_nbi, \ + unsigned int*: pshmem_uint_put_nbi, \ + unsigned long*: pshmem_ulong_put_nbi, \ + unsigned long long*: pshmem_ulonglong_put_nbi, \ float*: pshmem_float_put_nbi, \ double*: pshmem_double_put_nbi, \ long double*: pshmem_longdouble_put_nbi)(__VA_ARGS__) @@ -318,6 +414,12 @@ OSHMEM_DECLSPEC float pshmem_ctx_float_g(shmem_ctx_t ctx, const float* addr, in OSHMEM_DECLSPEC double pshmem_ctx_double_g(shmem_ctx_t ctx, const double* addr, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_g(shmem_ctx_t ctx, const long long* addr, int pe); OSHMEM_DECLSPEC long double pshmem_ctx_longdouble_g(shmem_ctx_t ctx, const long double* addr, int pe); +OSHMEM_DECLSPEC signed char pshmem_ctx_schar_g(shmem_ctx_t ctx, const signed char* addr, int pe); +OSHMEM_DECLSPEC unsigned char pshmem_ctx_uchar_g(shmem_ctx_t ctx, const unsigned char* addr, int pe); +OSHMEM_DECLSPEC unsigned short pshmem_ctx_ushort_g(shmem_ctx_t ctx, const unsigned short* addr, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_g(shmem_ctx_t ctx, const unsigned int* addr, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_g(shmem_ctx_t ctx, const unsigned long* addr, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_g(shmem_ctx_t ctx, const unsigned long long* addr, int pe); OSHMEM_DECLSPEC char pshmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short pshmem_short_g(const short* addr, int pe); @@ -327,6 +429,12 @@ OSHMEM_DECLSPEC float pshmem_float_g(const float* addr, int pe); OSHMEM_DECLSPEC double pshmem_double_g(const double* addr, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_g(const long long* addr, int pe); OSHMEM_DECLSPEC long double pshmem_longdouble_g(const long double* addr, int pe); +OSHMEM_DECLSPEC signed char pshmem_schar_g(const signed char* addr, int pe); +OSHMEM_DECLSPEC unsigned char pshmem_uchar_g(const unsigned char* addr, int pe); +OSHMEM_DECLSPEC unsigned short pshmem_ushort_g(const unsigned short* addr, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_uint_g(const unsigned int* addr, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_g(const unsigned long* addr, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_g(const unsigned long long* addr, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_g(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -336,15 +444,27 @@ OSHMEM_DECLSPEC long double pshmem_longdouble_g(const long double* addr, int pe int*: pshmem_ctx_int_g, \ long*: pshmem_ctx_long_g, \ long long*: pshmem_ctx_longlong_g, \ + signed char*: pshmem_ctx_schar_g, \ + unsigned char*: pshmem_ctx_uchar_g, \ + unsigned short*: pshmem_ctx_ushort_g, \ + unsigned int*: pshmem_ctx_uint_g, \ + unsigned long*: pshmem_ctx_ulong_g, \ + unsigned long long*: pshmem_ctx_ulonglong_g, \ float*: pshmem_ctx_float_g, \ double*: pshmem_ctx_double_g, \ long double*: pshmem_ctx_longdouble_g, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ char*: pshmem_char_g, \ short*: pshmem_short_g, \ int*: pshmem_int_g, \ long*: pshmem_long_g, \ long long*: pshmem_longlong_g, \ + signed char*: pshmem_schar_g, \ + unsigned char*: pshmem_char_g, \ + unsigned short*: pshmem_short_g, \ + unsigned int*: pshmem_int_g, \ + unsigned long*: pshmem_long_g, \ + unsigned long long*: pshmem_longlong_g, \ float*: pshmem_float_g, \ double*: pshmem_double_g, \ long double*: pshmem_longdouble_g)(__VA_ARGS__) @@ -360,6 +480,12 @@ OSHMEM_DECLSPEC void pshmem_ctx_long_get(shmem_ctx_t ctx, long *target, const l OSHMEM_DECLSPEC void pshmem_ctx_float_get(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_get(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_get(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_get(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_get(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_get(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_get(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_get(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_get(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_get(char *target, const char *source, size_t len, int pe); @@ -369,6 +495,12 @@ OSHMEM_DECLSPEC void pshmem_long_get(long *target, const long *source, size_t l OSHMEM_DECLSPEC void pshmem_float_get(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_get(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longlong_get(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_get(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_get(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_get(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_get(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_get(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_get(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_get(...) \ @@ -379,15 +511,27 @@ OSHMEM_DECLSPEC void pshmem_longdouble_get(long double *target, const long doub int*: pshmem_ctx_int_get, \ long*: pshmem_ctx_long_get, \ long long*: pshmem_ctx_longlong_get, \ + signed char*: pshmem_ctx_schar_get, \ + unsigned char*: pshmem_ctx_uchar_get, \ + unsigned short*: pshmem_ctx_ushort_get, \ + unsigned int*: pshmem_ctx_uint_get, \ + unsigned long*: pshmem_ctx_ulong_get, \ + unsigned long long*: pshmem_ctx_ulonglong_get, \ float*: pshmem_ctx_float_get, \ double*: pshmem_ctx_double_get, \ long double*: pshmem_ctx_longdouble_get, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ char*: pshmem_char_get, \ short*: pshmem_short_get, \ int*: pshmem_int_get, \ long*: pshmem_long_get, \ long long*: pshmem_longlong_get, \ + signed char*: pshmem_schar_get, \ + unsigned char*: pshmem_uchar_get, \ + unsigned short*: pshmem_ushort_get, \ + unsigned int*: pshmem_uint_get, \ + unsigned long*: pshmem_ulong_get, \ + unsigned long long*: pshmem_ulonglong_get, \ float*: pshmem_float_get, \ double*: pshmem_double_get, \ long double*: pshmem_longdouble_get)(__VA_ARGS__) @@ -413,11 +557,17 @@ OSHMEM_DECLSPEC void pshmem_getmem(void *target, const void *source, size_t len OSHMEM_DECLSPEC void pshmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -427,6 +577,12 @@ OSHMEM_DECLSPEC void pshmem_double_iget(double* target, const double* source, pt OSHMEM_DECLSPEC void pshmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_iget(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -436,15 +592,27 @@ OSHMEM_DECLSPEC void pshmem_long_iget(long* target, const long* source, ptrdiff_ int*: pshmem_ctx_int_iget, \ long*: pshmem_ctx_long_iget, \ long long*: pshmem_ctx_longlong_iget, \ + signed char*: pshmem_ctx_schar_iget, \ + unsigned char*: pshmem_ctx_uchar_iget, \ + unsigned short*: pshmem_ctx_ushort_iget, \ + unsigned int*: pshmem_ctx_uint_iget, \ + unsigned long*: pshmem_ctx_ulong_iget, \ + unsigned long long*: pshmem_ctx_ulonglong_iget, \ float*: pshmem_ctx_float_iget, \ double*: pshmem_ctx_double_iget, \ long double*: pshmem_ctx_longdouble_iget, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ char*: pshmem_char_iget, \ short*: pshmem_short_iget, \ int*: pshmem_int_iget, \ long*: pshmem_long_iget, \ long long*: pshmem_longlong_iget, \ + signed char*: pshmem_schar_iget, \ + unsigned char*: pshmem_uchar_iget, \ + unsigned short*: pshmem_ushort_iget, \ + unsigned int*: pshmem_uint_iget, \ + unsigned long*: pshmem_ulong_iget, \ + unsigned long long*: pshmem_ulonglong_iget, \ float*: pshmem_float_iget, \ double*: pshmem_double_iget, \ long double*: pshmem_longdouble_iget)(__VA_ARGS__) @@ -470,6 +638,12 @@ OSHMEM_DECLSPEC void pshmem_ctx_short_get_nbi(shmem_ctx_t ctx, short *target, c OSHMEM_DECLSPEC void pshmem_ctx_int_get_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_get_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_get_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_get_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_get_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_get_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_get_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_get_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_get_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); @@ -480,6 +654,12 @@ OSHMEM_DECLSPEC void pshmem_short_get_nbi(short *target, const short *source, s OSHMEM_DECLSPEC void pshmem_int_get_nbi(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_long_get_nbi(long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_get_nbi(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_get_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_get_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_get_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_get_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_get_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_float_get_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); @@ -492,15 +672,27 @@ OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long int*: pshmem_ctx_int_get_nbi, \ long*: pshmem_ctx_long_get_nbi, \ long long*: pshmem_ctx_longlong_get_nbi, \ + signed char*: pshmem_ctx_schar_get_nbi, \ + unsigned char*: pshmem_ctx_uchar_get_nbi, \ + unsigned short*: pshmem_ctx_ushort_get_nbi, \ + unsigned int*: pshmem_ctx_uint_get_nbi, \ + unsigned long*: pshmem_ctx_ulong_get_nbi, \ + unsigned long long*: pshmem_ctx_ulonglong_get_nbi, \ float*: pshmem_ctx_float_get_nbi, \ double*: pshmem_ctx_double_get_nbi, \ long double*: pshmem_ctx_longdouble_get_nbi, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ char*: pshmem_char_get_nbi, \ short*: pshmem_short_get_nbi, \ int*: pshmem_int_get_nbi, \ long*: pshmem_long_get_nbi, \ long long*: pshmem_longlong_get_nbi, \ + signed char*: pshmem_schar_get_nbi, \ + unsigned char*: pshmem_uchar_get_nbi, \ + unsigned short*: pshmem_ushort_get_nbi, \ + unsigned int*: pshmem_uint_get_nbi, \ + unsigned long*: pshmem_ulong_get_nbi, \ + unsigned long long*: pshmem_ulonglong_get_nbi, \ float*: pshmem_float_get_nbi, \ double*: pshmem_double_get_nbi, \ long double*: pshmem_longdouble_get_nbi)(__VA_ARGS__) @@ -525,29 +717,41 @@ OSHMEM_DECLSPEC void pshmem_get128_nbi(void *target, const void *source, size_t /* Atomic swap */ OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_swap(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_swap(shmem_ctx_t ctx, long *target, long value, int pe); -OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long*target, long long value, int pe); +OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC float pshmem_ctx_float_atomic_swap(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_ctx_double_atomic_swap(shmem_ctx_t ctx, double *target, double value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_swap(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_swap(long long*target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_swap(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_swap(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_swap(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC float pshmem_float_atomic_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_swap(double *target, double value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_swap(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_swap, \ - long*: pshmem_ctx_long_atomic_swap, \ - long long*: pshmem_ctx_longlong_atomic_swap, \ - float*: pshmem_ctx_float_atomic_swap, \ - double*: pshmem_ctx_double_atomic_swap, \ - default: __oshmem_datatype_ignore), \ - int*: pshmem_int_atomic_swap, \ - long*: pshmem_long_atomic_swap, \ - long long*: pshmem_longlong_atomic_swap, \ - float*: pshmem_float_atomic_swap, \ +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_swap, \ + long*: pshmem_ctx_long_atomic_swap, \ + long long*: pshmem_ctx_longlong_atomic_swap, \ + unsigned int*: pshmem_ctx_uint_atomic_swap, \ + unsigned long*: pshmem_ctx_ulong_atomic_swap, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_swap,\ + float*: pshmem_ctx_float_atomic_swap, \ + double*: pshmem_ctx_double_atomic_swap, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_swap, \ + long*: pshmem_long_atomic_swap, \ + long long*: pshmem_longlong_atomic_swap, \ + unsigned int*: pshmem_uint_atomic_swap, \ + unsigned long*: pshmem_ulong_atomic_swap, \ + unsigned long long*: pshmem_ulonglong_atomic_swap, \ + float*: pshmem_float_atomic_swap, \ double*: pshmem_double_atomic_swap)(__VA_ARGS__) #endif @@ -569,35 +773,47 @@ OSHMEM_DECLSPEC double pshmem_double_swap(double *target, double value, int pe); /* Atomic set */ OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_set(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_set(shmem_ctx_t ctx, long *target, long value, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long*target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_set(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_set(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_set(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_float_atomic_set(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_atomic_set(shmem_ctx_t ctx, double *target, double value, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_set(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_set(long *target, long value, int pe); -OSHMEM_DECLSPEC void pshmem_longlong_atomic_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_atomic_set(long long *target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_uint_atomic_set(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_atomic_set(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_set(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_float_atomic_set(float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_atomic_set(double *target, double value, int pe); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_set(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ int*: pshmem_ctx_int_atomic_set, \ long*: pshmem_ctx_long_atomic_set, \ long long*: pshmem_ctx_longlong_atomic_set, \ + unsigned int*: pshmem_ctx_uint_atomic_set, \ + unsigned long*: pshmem_ctx_ulong_atomic_set, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_set,\ float*: pshmem_ctx_float_atomic_set, \ double*: pshmem_ctx_double_atomic_set, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ int*: pshmem_int_atomic_set, \ long*: pshmem_long_atomic_set, \ long long*: pshmem_longlong_atomic_set, \ + unsigned int*: pshmem_uint_atomic_set, \ + unsigned long*: pshmem_ulong_atomic_set, \ + unsigned long long*: pshmem_ulonglong_atomic_set, \ float*: pshmem_float_atomic_set, \ double*: pshmem_double_atomic_set)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_set(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_set(long *target, long value, int pe); -OSHMEM_DECLSPEC void pshmem_longlong_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_set(long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_float_set(float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_set(double *target, double value, int pe); #if OSHMEMP_HAVE_C11 @@ -614,22 +830,34 @@ OSHMEM_DECLSPEC void pshmem_double_set(double *target, double value, int pe); OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_compare_swap(shmem_ctx_t ctx, int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_compare_swap(shmem_ctx_t ctx, long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_compare_swap(shmem_ctx_t ctx, long long *target, long long cond, long long value, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_compare_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int cond, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long cond, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long cond, unsigned long long value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_compare_swap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_compare_swap(long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_compare_swap(long long *target, long long cond, long long value, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_compare_swap(unsigned int *target, unsigned int cond, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_compare_swap(unsigned long *target, unsigned long cond, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_compare_swap(unsigned long long *target, unsigned long long cond, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_compare_swap(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_compare_swap, \ - long*: pshmem_ctx_long_atomic_compare_swap, \ - long long*: pshmem_ctx_longlong_atomic_compare_swap,\ - default: __oshmem_datatype_ignore), \ - int*: pshmem_int_atomic_compare_swap, \ - long*: pshmem_long_atomic_compare_swap, \ - long long*: pshmem_longlong_atomic_compare_swap)(__VA_ARGS__) +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_compare_swap(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_compare_swap, \ + long*: pshmem_ctx_long_atomic_compare_swap, \ + long long*: pshmem_ctx_longlong_atomic_compare_swap, \ + unsigned int*: pshmem_ctx_uint_atomic_compare_swap, \ + unsigned long*: pshmem_ctx_ulong_atomic_compare_swap, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_compare_swap, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_compare_swap, \ + long*: pshmem_long_atomic_compare_swap, \ + long long*: pshmem_longlong_atomic_compare_swap, \ + unsigned int*: pshmem_uint_atomic_compare_swap, \ + unsigned long*: pshmem_ulong_atomic_compare_swap, \ + unsigned long long*: pshmem_ulonglong_atomic_compare_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_cswap(int *target, int cond, int value, int pe); @@ -647,21 +875,33 @@ OSHMEM_DECLSPEC long long pshmem_longlong_cswap(long long *target, long long con OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_add(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_add(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_add(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_add(long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_add(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_fetch_add, \ - long*: pshmem_ctx_long_atomic_fetch_add, \ - long long*: pshmem_ctx_longlong_atomic_fetch_add, \ - default: __oshmem_datatype_ignore), \ - int*: pshmem_int_atomic_fetch_add, \ - long*: pshmem_long_atomic_fetch_add, \ - long long*: pshmem_longlong_atomic_fetch_add)(__VA_ARGS__) +OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_add(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_add(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_add(unsigned long long *target, unsigned long long value, int pe); +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_fetch_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_fetch_add, \ + long*: pshmem_ctx_long_atomic_fetch_add, \ + long long*: pshmem_ctx_longlong_atomic_fetch_add, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_add, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_add, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_add, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_add, \ + long*: pshmem_long_atomic_fetch_add, \ + long long*: pshmem_longlong_atomic_fetch_add, \ + unsigned int*: pshmem_uint_atomic_fetch_add, \ + unsigned long*: pshmem_ulong_atomic_fetch_add, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_fadd(int *target, int value, int pe); @@ -676,65 +916,101 @@ OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long valu #endif /* Atomic Fetch&And */ +OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_and(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_and(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_and(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_and(int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_and(long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_and(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_and(...) \ +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_fetch_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and, \ - default: __oshmem_datatype_ignore), \ - unsigned int*: pshmem_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ulong_atomic_fetch_and, \ + int*: pshmem_ctx_int_atomic_fetch_and, \ + long*: pshmem_ctx_long_atomic_fetch_and, \ + long long*: pshmem_ctx_longlong_atomic_fetch_and, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_and, \ + long*: pshmem_long_atomic_fetch_and, \ + long long*: pshmem_longlong_atomic_fetch_and, \ + unsigned int*: pshmem_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ulong_atomic_fetch_and, \ unsigned long long*: pshmem_ulonglong_atomic_fetch_and)(__VA_ARGS__) #endif /* Atomic Fetch&Or */ +OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_or(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_or(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_or(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_or(int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_or(long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_or(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_or(...) \ +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_fetch_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or, \ - default: __oshmem_datatype_ignore), \ - unsigned int*: pshmem_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ulong_atomic_fetch_or, \ + int*: pshmem_ctx_int_atomic_fetch_or, \ + long*: pshmem_ctx_long_atomic_fetch_or, \ + long long*: pshmem_ctx_longlong_atomic_fetch_or, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_or, \ + long*: pshmem_long_atomic_fetch_or, \ + long long*: pshmem_longlong_atomic_fetch_or, \ + unsigned int*: pshmem_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ulong_atomic_fetch_or, \ unsigned long long*: pshmem_ulonglong_atomic_fetch_or)(__VA_ARGS__) #endif /* Atomic Fetch&Xor */ +OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_xor(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_xor(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_xor(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_xor(int *target, int value, int pe); +OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_xor(long *target, long value, int pe); +OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_xor(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch_xor(...) \ +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_fetch_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor, \ - default: __oshmem_datatype_ignore), \ - unsigned int*: pshmem_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ulong_atomic_fetch_xor, \ + int*: pshmem_ctx_int_atomic_fetch_xor, \ + long*: pshmem_ctx_long_atomic_fetch_xor, \ + long long*: pshmem_ctx_longlong_atomic_fetch_xor, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_xor, \ + long*: pshmem_long_atomic_fetch_xor, \ + long long*: pshmem_longlong_atomic_fetch_xor, \ + unsigned int*: pshmem_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ulong_atomic_fetch_xor, \ unsigned long long*: pshmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__) #endif @@ -742,28 +1018,40 @@ OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_xor(unsigned lo OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch(shmem_ctx_t ctx, const int *target, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch(shmem_ctx_t ctx, const long *target, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch(shmem_ctx_t ctx, const long long *target, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch(shmem_ctx_t ctx, const unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch(shmem_ctx_t ctx, const unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch(shmem_ctx_t ctx, const unsigned long long *target, int pe); OSHMEM_DECLSPEC float pshmem_ctx_float_atomic_fetch(shmem_ctx_t ctx, const float *target, int pe); OSHMEM_DECLSPEC double pshmem_ctx_double_atomic_fetch(shmem_ctx_t ctx, const double *target, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch(const int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch(const long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch(const long long *target, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch(const unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch(const unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch(const unsigned long long *target, int pe); OSHMEM_DECLSPEC float pshmem_float_atomic_fetch(const float *target, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_fetch(const double *target, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_fetch(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_fetch, \ - long*: pshmem_ctx_long_atomic_fetch, \ - long long*: pshmem_ctx_longlong_atomic_fetch, \ - float*: pshmem_ctx_float_atomic_fetch, \ - double*: pshmem_ctx_double_atomic_fetch, \ - default: __oshmem_datatype_ignore), \ - int*: pshmem_int_atomic_fetch, \ - long*: pshmem_long_atomic_fetch, \ - long long*: pshmem_longlong_atomic_fetch, \ - float*: pshmem_float_atomic_fetch, \ +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_fetch(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_fetch, \ + long*: pshmem_ctx_long_atomic_fetch, \ + long long*: pshmem_ctx_longlong_atomic_fetch, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch, \ + float*: pshmem_ctx_float_atomic_fetch, \ + double*: pshmem_ctx_double_atomic_fetch, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch, \ + long*: pshmem_long_atomic_fetch, \ + long long*: pshmem_longlong_atomic_fetch, \ + unsigned int*: pshmem_uint_atomic_fetch, \ + unsigned long*: pshmem_ulong_atomic_fetch, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch, \ + float*: pshmem_float_atomic_fetch, \ double*: pshmem_double_atomic_fetch)(__VA_ARGS__) #endif @@ -772,35 +1060,47 @@ OSHMEM_DECLSPEC long pshmem_long_fetch(const long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_fetch(const long long *target, int pe); OSHMEM_DECLSPEC float pshmem_float_fetch(const float *target, int pe); OSHMEM_DECLSPEC double pshmem_double_fetch(const double *target, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_fetch(dst, pe) \ - _Generic(&*(dst), \ - int*: pshmem_int_fetch, \ - long*: pshmem_long_fetch, \ - long long*: pshmem_longlong_fetch, \ - float*: pshmem_float_fetch, \ - double*: pshmem_double_fetch)(dst, pe) +#if OSHMEMP_HAVE_C11 +#define pshmem_fetch(dst, pe) \ + _Generic(&*(dst), \ + int*: pshmem_int_fetch, \ + long*: pshmem_long_fetch, \ + long long*: pshmem_longlong_fetch, \ + float*: pshmem_float_fetch, \ + double*: pshmem_double_fetch)(dst, pe) #endif /* Atomic Fetch&Inc */ OSHMEM_DECLSPEC int pshmem_ctx_int_atomic_fetch_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC long pshmem_ctx_long_atomic_fetch_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_inc(shmem_ctx_t ctx, long long *target, int pe); +OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_inc(shmem_ctx_t ctx, unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long long *target, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_inc(int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_inc(long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_inc(long long *target, int pe); -#if OSHMEM_HAVE_C11 +OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_inc(unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_inc(unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_inc(unsigned long long *target, int pe); +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_fetch_inc(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ int*: pshmem_ctx_int_atomic_fetch_inc, \ long*: pshmem_ctx_long_atomic_fetch_inc, \ long long*: pshmem_ctx_longlong_atomic_fetch_inc, \ - default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_inc, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_inc, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_inc, \ + default: __opshmem_datatype_ignore), \ int*: pshmem_int_atomic_fetch_inc, \ long*: pshmem_long_atomic_fetch_inc, \ - long long*: pshmem_longlong_atomic_fetch_inc)(__VA_ARGS__) + long long*: pshmem_longlong_atomic_fetch_inc, \ + unsigned int*: pshmem_uint_atomic_fetch_inc, \ + unsigned long*: pshmem_ulong_atomic_fetch_inc, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int pshmem_int_finc(int *target, int pe); @@ -818,21 +1118,33 @@ OSHMEM_DECLSPEC long long pshmem_longlong_finc(long long *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_add(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_add(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_add(long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_atomic_add(long long *target, long long value, int pe); -#if OSHMEM_HAVE_C11 -#define pshmem_atomic_add(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_add, \ - long*: pshmem_ctx_long_atomic_add, \ - long long*: pshmem_ctx_longlong_atomic_add, \ - default: __oshmem_datatype_ignore), \ - int*: pshmem_int_atomic_add, \ - long*: pshmem_long_atomic_add, \ - long long*: pshmem_longlong_atomic_add)(__VA_ARGS__) +OSHMEM_DECLSPEC void pshmem_uint_atomic_add(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_atomic_add(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_add(unsigned long long *target, unsigned long long value, int pe); +#if OSHMEMP_HAVE_C11 +#define pshmem_atomic_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_add, \ + long*: pshmem_ctx_long_atomic_add, \ + long long*: pshmem_ctx_longlong_atomic_add, \ + unsigned int*: pshmem_ctx_uint_atomic_add, \ + unsigned long*: pshmem_ctx_ulong_atomic_add, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_add, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_add, \ + long*: pshmem_long_atomic_add, \ + long long*: pshmem_longlong_atomic_add, \ + unsigned int*: pshmem_uint_atomic_add, \ + unsigned long*: pshmem_ulong_atomic_add, \ + unsigned long long*: pshmem_ulonglong_atomic_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_add(int *target, int value, int pe); @@ -847,63 +1159,99 @@ OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int #endif /* Atomic And */ +OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_and(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_and(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_and(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int_atomic_and(int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_long_atomic_and(long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_atomic_and(long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_and, \ + long*: pshmem_ctx_long_atomic_and, \ + long long*: pshmem_ctx_longlong_atomic_and, \ unsigned int*: pshmem_ctx_uint_atomic_and, \ unsigned long*: pshmem_ctx_ulong_atomic_and, \ unsigned long long*: pshmem_ctx_ulonglong_atomic_and, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_and, \ + long*: pshmem_long_atomic_and, \ + long long*: pshmem_longlong_atomic_and, \ unsigned int*: pshmem_uint_atomic_and, \ unsigned long*: pshmem_ulong_atomic_and, \ unsigned long long*: pshmem_ulonglong_atomic_and)(__VA_ARGS__) #endif /* Atomic Or */ +OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_or(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_or(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_or(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int_atomic_or(int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_long_atomic_or(long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_atomic_or(long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_or, \ + long*: pshmem_ctx_long_atomic_or, \ + long long*: pshmem_ctx_longlong_atomic_or, \ unsigned int*: pshmem_ctx_uint_atomic_or, \ unsigned long*: pshmem_ctx_ulong_atomic_or, \ unsigned long long*: pshmem_ctx_ulonglong_atomic_or, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_or, \ + long*: pshmem_long_atomic_or, \ + long long*: pshmem_longlong_atomic_or, \ unsigned int*: pshmem_uint_atomic_or, \ unsigned long*: pshmem_ulong_atomic_or, \ unsigned long long*: pshmem_ulonglong_atomic_or)(__VA_ARGS__) #endif /* Atomic Xor */ +OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_xor(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_xor(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_xor(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int_atomic_xor(int *target, int value, int pe); +OSHMEM_DECLSPEC void pshmem_long_atomic_xor(long *target, long value, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_atomic_xor(long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: pshmem_ctx_int_atomic_xor, \ + long*: pshmem_ctx_long_atomic_xor, \ + long long*: pshmem_ctx_longlong_atomic_xor, \ unsigned int*: pshmem_ctx_uint_atomic_xor, \ unsigned long*: pshmem_ctx_ulong_atomic_xor, \ unsigned long long*: pshmem_ctx_ulonglong_atomic_xor, \ - default: __oshmem_datatype_ignore), \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_xor, \ + long*: pshmem_long_atomic_xor, \ + long long*: pshmem_longlong_atomic_xor, \ unsigned int*: pshmem_uint_atomic_xor, \ unsigned long*: pshmem_ulong_atomic_xor, \ unsigned long long*: pshmem_ulonglong_atomic_xor)(__VA_ARGS__) @@ -913,21 +1261,33 @@ OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_xor(unsigned long long *target, uns OSHMEM_DECLSPEC void pshmem_ctx_int_atomic_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_long_atomic_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_inc(shmem_ctx_t ctx, long long *target, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_inc(shmem_ctx_t ctx, unsigned int *target, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_inc(shmem_ctx_t ctx, unsigned long *target, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_inc(shmem_ctx_t ctx, unsigned long long *target, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_inc(int *target, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_inc(long *target, int pe); OSHMEM_DECLSPEC void pshmem_longlong_atomic_inc(long long *target, int pe); -#if OSHMEM_HAVE_C11 +OSHMEM_DECLSPEC void pshmem_uint_atomic_inc(unsigned int *target, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_atomic_inc(unsigned long *target, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_inc(unsigned long long *target, int pe); +#if OSHMEMP_HAVE_C11 #define pshmem_atomic_inc(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ int*: pshmem_ctx_int_atomic_inc, \ long*: pshmem_ctx_long_atomic_inc, \ long long*: pshmem_ctx_longlong_atomic_inc, \ - default: __oshmem_datatype_ignore), \ + unsigned int*: pshmem_ctx_uint_atomic_inc, \ + unsigned long*: pshmem_ctx_ulong_atomic_inc, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_inc,\ + default: __opshmem_datatype_ignore), \ int*: pshmem_int_atomic_inc, \ long*: pshmem_long_atomic_inc, \ - long long*: pshmem_longlong_atomic_inc)(__VA_ARGS__) + long long*: pshmem_longlong_atomic_inc, \ + unsigned int*: pshmem_uint_atomic_inc, \ + unsigned long*: pshmem_ulong_atomic_inc, \ + unsigned long long*: pshmem_ulonglong_atomic_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void pshmem_int_inc(int *target, int pe); @@ -961,7 +1321,7 @@ OSHMEM_DECLSPEC void pshmem_short_wait_until(volatile short *addr, int cmp, sho OSHMEM_DECLSPEC void pshmem_int_wait_until(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC void pshmem_long_wait_until(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC void pshmem_longlong_wait_until(volatile long long *addr, int cmp, long long value); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_wait_until(addr, cmp, value) \ _Generic(&*(addr), \ short*: pshmem_short_wait_until, \ @@ -974,7 +1334,7 @@ OSHMEM_DECLSPEC int pshmem_short_test(volatile short *addr, int cmp, short valu OSHMEM_DECLSPEC int pshmem_int_test(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC int pshmem_long_test(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC int pshmem_longlong_test(volatile long long *addr, int cmp, long long value); -#if OSHMEM_HAVE_C11 +#if OSHMEMP_HAVE_C11 #define pshmem_test(addr, cmp, value) \ _Generic(&*(addr), \ short*: pshmem_short_test, \ diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 8d3478910f2..dd6a482a377 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -195,7 +195,9 @@ OSHMEM_DECLSPEC void *shmem_ptr(const void *ptr, int pe); typedef struct { int dummy; } * shmem_ctx_t; -#define SHMEM_CTX_DEFAULT oshmem_ctx_default; +#define SHMEM_CTX_DEFAULT oshmem_ctx_default + +extern shmem_ctx_t oshmem_ctx_default; OSHMEM_DECLSPEC int shmem_ctx_create(long options, shmem_ctx_t *ctx); OSHMEM_DECLSPEC void shmem_ctx_destroy(shmem_ctx_t ctx); @@ -210,6 +212,12 @@ OSHMEM_DECLSPEC void shmem_ctx_long_p(shmem_ctx_t ctx, long* addr, long value, OSHMEM_DECLSPEC void shmem_ctx_float_p(shmem_ctx_t ctx, float* addr, float value, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_p(shmem_ctx_t ctx, double* addr, double value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_p(shmem_ctx_t ctx, long long* addr, long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_p(shmem_ctx_t ctx, signed char* addr, signed char value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_p(shmem_ctx_t ctx, unsigned char* addr, unsigned char value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_p(shmem_ctx_t ctx, unsigned short* addr, unsigned short value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_p(shmem_ctx_t ctx, unsigned int* addr, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_p(shmem_ctx_t ctx, unsigned long* addr, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_p(shmem_ctx_t ctx, unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); OSHMEM_DECLSPEC void shmem_char_p(char* addr, char value, int pe); @@ -219,6 +227,12 @@ OSHMEM_DECLSPEC void shmem_long_p(long* addr, long value, int pe); OSHMEM_DECLSPEC void shmem_float_p(float* addr, float value, int pe); OSHMEM_DECLSPEC void shmem_double_p(double* addr, double value, int pe); OSHMEM_DECLSPEC void shmem_longlong_p(long long* addr, long long value, int pe); +OSHMEM_DECLSPEC void shmem_schar_p(signed char* addr, signed char value, int pe); +OSHMEM_DECLSPEC void shmem_uchar_p(unsigned char* addr, unsigned char value, int pe); +OSHMEM_DECLSPEC void shmem_ushort_p(unsigned short* addr, unsigned short value, int pe); +OSHMEM_DECLSPEC void shmem_uint_p(unsigned int* addr, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ulong_p(unsigned long* addr, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_p(unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, int pe); #if OSHMEM_HAVE_C11 #define shmem_p(...) \ @@ -229,6 +243,12 @@ OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, i int*: shmem_ctx_int_p, \ long*: shmem_ctx_long_p, \ long long*: shmem_ctx_longlong_p, \ + signed char*: shmem_ctx_schar_p, \ + unsigned char*: shmem_ctx_uchar_p, \ + unsigned short*: shmem_ctx_ushort_p, \ + unsigned int*: shmem_ctx_uint_p, \ + unsigned long*: shmem_ctx_ulong_p, \ + unsigned long long*: shmem_ctx_ulonglong_p, \ float*: shmem_ctx_float_p, \ double*: shmem_ctx_double_p, \ long double*: shmem_ctx_longdouble_p, \ @@ -238,6 +258,12 @@ OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, i int*: shmem_int_p, \ long*: shmem_long_p, \ long long*: shmem_longlong_p, \ + signed char*: shmem_schar_p, \ + unsigned char*: shmem_uchar_p, \ + unsigned short*: shmem_ushort_p, \ + unsigned int*: shmem_uint_p, \ + unsigned long*: shmem_ulong_p, \ + unsigned long long*: shmem_ulonglong_p, \ float*: shmem_float_p, \ double*: shmem_double_p, \ long double*: shmem_longdouble_p)(__VA_ARGS__) @@ -248,41 +274,65 @@ OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, i */ OSHMEM_DECLSPEC void shmem_ctx_char_put(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_short_put(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_int_put(shmem_ctx_t ctx, int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int_put(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_put(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_put(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_put(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_put(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_put(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_put(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_put(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_put(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_put(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_put(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put(short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_int_put(int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int_put(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_long_put(long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_float_put(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_put(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longlong_put(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_put(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_put(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_put(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_put(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_put(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_put(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_put(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - char*: shmem_ctx_char_put, \ - short*: shmem_ctx_short_put, \ - int*: shmem_ctx_int_put, \ - long*: shmem_ctx_long_put, \ - long long*: shmem_ctx_longlong_put, \ - float*: shmem_ctx_float_put, \ - double*: shmem_ctx_double_put, \ - long double*: shmem_ctx_longdouble_put, \ - default: __oshmem_datatype_ignore), \ - char*: shmem_char_put, \ - short*: shmem_short_put, \ - int*: shmem_int_put, \ - long*: shmem_long_put, \ - long long*: shmem_longlong_put, \ - float*: shmem_float_put, \ - double*: shmem_double_put, \ +#define shmem_put(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ + char*: shmem_ctx_char_put, \ + short*: shmem_ctx_short_put, \ + int*: shmem_ctx_int_put, \ + long*: shmem_ctx_long_put, \ + long long*: shmem_ctx_longlong_put, \ + signed char*: shmem_ctx_schar_put, \ + unsigned char*: shmem_ctx_uchar_put, \ + unsigned short*: shmem_ctx_ushort_put, \ + unsigned int*: shmem_ctx_uint_put, \ + unsigned long*: shmem_ctx_ulong_put, \ + unsigned long long*: shmem_ctx_ulonglong_put, \ + float*: shmem_ctx_float_put, \ + double*: shmem_ctx_double_put, \ + long double*: shmem_ctx_longdouble_put, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_put, \ + short*: shmem_short_put, \ + int*: shmem_int_put, \ + long*: shmem_long_put, \ + long long*: shmem_longlong_put, \ + signed char*: shmem_schar_put, \ + unsigned char*: shmem_uchar_put, \ + unsigned short*: shmem_ushort_put, \ + unsigned int*: shmem_uint_put, \ + unsigned long*: shmem_ulong_put, \ + unsigned long long*: shmem_ulonglong_put, \ + float*: shmem_float_put, \ + double*: shmem_double_put, \ long double*: shmem_longdouble_put)(__VA_ARGS__) #endif @@ -311,6 +361,12 @@ OSHMEM_DECLSPEC void shmem_ctx_long_iput(shmem_ctx_t ctx, long* target, const lo OSHMEM_DECLSPEC void shmem_ctx_float_iput(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_iput(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_iput(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_iput(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_iput(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_iput(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_iput(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_iput(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iput(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -320,16 +376,28 @@ OSHMEM_DECLSPEC void shmem_long_iput(long* target, const long* source, ptrdiff_t OSHMEM_DECLSPEC void shmem_float_iput(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_iput(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_longlong_iput(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_iput(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_iput(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_iput(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_iput(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_iput(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_iput(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_iput(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ char*: shmem_ctx_char_iput, \ short*: shmem_ctx_short_iput, \ int*: shmem_ctx_int_iput, \ long*: shmem_ctx_long_iput, \ long long*: shmem_ctx_longlong_iput, \ + signed char*: shmem_ctx_schar_iput, \ + unsigned char*: shmem_ctx_uchar_iput, \ + unsigned short*: shmem_ctx_ushort_iput, \ + unsigned int*: shmem_ctx_uint_iput, \ + unsigned long*: shmem_ctx_ulong_iput, \ + unsigned long long*: shmem_ctx_ulonglong_iput, \ float*: shmem_ctx_float_iput, \ double*: shmem_ctx_double_iput, \ long double*: shmem_ctx_longdouble_iput, \ @@ -339,6 +407,12 @@ OSHMEM_DECLSPEC void shmem_longdouble_iput(long double* target, const long doubl int*: shmem_int_iput, \ long*: shmem_long_iput, \ long long*: shmem_longlong_iput, \ + signed char*: shmem_schar_iput, \ + unsigned char*: shmem_uchar_iput, \ + unsigned short*: shmem_ushort_iput, \ + unsigned int*: shmem_uint_iput, \ + unsigned long*: shmem_ulong_iput, \ + unsigned long long*: shmem_ulonglong_iput, \ float*: shmem_float_iput, \ double*: shmem_double_iput, \ long double*: shmem_longdouble_iput)(__VA_ARGS__) @@ -361,41 +435,65 @@ OSHMEM_DECLSPEC void shmem_iput128(void* target, const void* source, ptrdiff_t t */ OSHMEM_DECLSPEC void shmem_ctx_char_put_nbi(shmem_ctx_t ctx, char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_short_put_nbi(shmem_ctx_t ctx, short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_int_put_nbi(shmem_ctx_t ctx, int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int_put_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_put_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_put_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_put_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_put_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_put_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_put_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_put_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_put_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_put_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_put_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_int_put_nbi(int* target, const int* source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int_put_nbi(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_long_put_nbi(long *target, const long *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_float_put_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_put_nbi(double *target, const double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_longlong_put_nbi(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_put_nbi(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_put_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_put_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_put_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_put_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_put_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_put_nbi(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - char*: shmem_ctx_char_put_nbi, \ - short*: shmem_ctx_short_put_nbi, \ - int*: shmem_ctx_int_put_nbi, \ - long*: shmem_ctx_long_put_nbi, \ - long long*: shmem_ctx_longlong_put_nbi, \ - float*: shmem_ctx_float_put_nbi, \ - double*: shmem_ctx_double_put_nbi, \ - long double*: shmem_ctx_longdouble_put_nbi, \ - default: __oshmem_datatype_ignore), \ - char*: shmem_char_put_nbi, \ - short*: shmem_short_put_nbi, \ - int*: shmem_int_put_nbi, \ - long*: shmem_long_put_nbi, \ - long long*: shmem_longlong_put_nbi, \ - float*: shmem_float_put_nbi, \ - double*: shmem_double_put_nbi, \ +#define shmem_put_nbi(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + char*: shmem_ctx_char_put_nbi, \ + short*: shmem_ctx_short_put_nbi, \ + int*: shmem_ctx_int_put_nbi, \ + long*: shmem_ctx_long_put_nbi, \ + long long*: shmem_ctx_longlong_put_nbi, \ + signed char*: shmem_ctx_schar_put_nbi, \ + unsigned char*: shmem_ctx_uchar_put_nbi, \ + unsigned short*: shmem_ctx_ushort_put_nbi, \ + unsigned int*: shmem_ctx_uint_put_nbi, \ + unsigned long*: shmem_ctx_ulong_put_nbi, \ + unsigned long long*: shmem_ctx_ulonglong_put_nbi, \ + float*: shmem_ctx_float_put_nbi, \ + double*: shmem_ctx_double_put_nbi, \ + long double*: shmem_ctx_longdouble_put_nbi, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_put_nbi, \ + short*: shmem_short_put_nbi, \ + int*: shmem_int_put_nbi, \ + long*: shmem_long_put_nbi, \ + long long*: shmem_longlong_put_nbi, \ + signed char*: shmem_schar_put_nbi, \ + unsigned char*: shmem_uchar_put_nbi, \ + unsigned short*: shmem_ushort_put_nbi, \ + unsigned int*: shmem_uint_put_nbi, \ + unsigned long*: shmem_ulong_put_nbi, \ + unsigned long long*: shmem_ulonglong_put_nbi, \ + float*: shmem_float_put_nbi, \ + double*: shmem_double_put_nbi, \ long double*: shmem_longdouble_put_nbi)(__VA_ARGS__) #endif @@ -424,6 +522,12 @@ OSHMEM_DECLSPEC float shmem_ctx_float_g(shmem_ctx_t ctx, const float* addr, int OSHMEM_DECLSPEC double shmem_ctx_double_g(shmem_ctx_t ctx, const double* addr, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_g(shmem_ctx_t ctx, const long long* addr, int pe); OSHMEM_DECLSPEC long double shmem_ctx_longdouble_g(shmem_ctx_t ctx, const long double* addr, int pe); +OSHMEM_DECLSPEC signed char shmem_ctx_schar_g(shmem_ctx_t ctx, const signed char* addr, int pe); +OSHMEM_DECLSPEC unsigned char shmem_ctx_uchar_g(shmem_ctx_t ctx, const unsigned char* addr, int pe); +OSHMEM_DECLSPEC unsigned short shmem_ctx_ushort_g(shmem_ctx_t ctx, const unsigned short* addr, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_g(shmem_ctx_t ctx, const unsigned int* addr, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_g(shmem_ctx_t ctx, const unsigned long* addr, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_g(shmem_ctx_t ctx, const unsigned long long* addr, int pe); OSHMEM_DECLSPEC char shmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short shmem_short_g(const short* addr, int pe); @@ -433,26 +537,44 @@ OSHMEM_DECLSPEC float shmem_float_g(const float* addr, int pe); OSHMEM_DECLSPEC double shmem_double_g(const double* addr, int pe); OSHMEM_DECLSPEC long long shmem_longlong_g(const long long* addr, int pe); OSHMEM_DECLSPEC long double shmem_longdouble_g(const long double* addr, int pe); +OSHMEM_DECLSPEC signed char shmem_schar_g(const signed char* addr, int pe); +OSHMEM_DECLSPEC unsigned char shmem_uchar_g(const unsigned char* addr, int pe); +OSHMEM_DECLSPEC unsigned short shmem_ushort_g(const unsigned short* addr, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_g(const unsigned int* addr, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_g(const unsigned long* addr, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_g(const unsigned long long* addr, int pe); #if OSHMEM_HAVE_C11 -#define shmem_g(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - char*: shmem_ctx_char_g, \ - short*: shmem_ctx_short_g, \ - int*: shmem_ctx_int_g, \ - long*: shmem_ctx_long_g, \ - long long*: shmem_ctx_longlong_g, \ - float*: shmem_ctx_float_g, \ - double*: shmem_ctx_double_g, \ - long double*: shmem_ctx_longdouble_g, \ - default: __oshmem_datatype_ignore), \ - char*: shmem_char_g, \ - short*: shmem_short_g, \ - int*: shmem_int_g, \ - long*: shmem_long_g, \ - long long*: shmem_longlong_g, \ - float*: shmem_float_g, \ - double*: shmem_double_g, \ +#define shmem_g(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ + char*: shmem_ctx_char_g, \ + short*: shmem_ctx_short_g, \ + int*: shmem_ctx_int_g, \ + long*: shmem_ctx_long_g, \ + long long*: shmem_ctx_longlong_g, \ + signed char*: shmem_ctx_schar_g, \ + unsigned char*: shmem_ctx_uchar_g, \ + unsigned short*: shmem_ctx_ushort_g, \ + unsigned int*: shmem_ctx_uint_g, \ + unsigned long*: shmem_ctx_ulong_g, \ + unsigned long long*: shmem_ctx_ulonglong_g, \ + float*: shmem_ctx_float_g, \ + double*: shmem_ctx_double_g, \ + long double*: shmem_ctx_longdouble_g, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_g, \ + short*: shmem_short_g, \ + int*: shmem_int_g, \ + long*: shmem_long_g, \ + long long*: shmem_longlong_g, \ + signed char*: shmem_schar_g, \ + unsigned char*: shmem_uchar_g, \ + unsigned short*: shmem_ushort_g, \ + unsigned int*: shmem_uint_g, \ + unsigned long*: shmem_ulong_g, \ + unsigned long long*: shmem_ulonglong_g, \ + float*: shmem_float_g, \ + double*: shmem_double_g, \ long double*: shmem_longdouble_g)(__VA_ARGS__) #endif @@ -466,6 +588,12 @@ OSHMEM_DECLSPEC void shmem_ctx_long_get(shmem_ctx_t ctx, long *target, const lo OSHMEM_DECLSPEC void shmem_ctx_float_get(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_get(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_get(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_get(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_get(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_get(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_get(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_get(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_get(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_get(char *target, const char *source, size_t len, int pe); @@ -475,27 +603,45 @@ OSHMEM_DECLSPEC void shmem_long_get(long *target, const long *source, size_t le OSHMEM_DECLSPEC void shmem_float_get(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_get(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longlong_get(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_get(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_get(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_get(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_get(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_get(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_get(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 -#define shmem_get(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - char*: shmem_ctx_char_get, \ - short*: shmem_ctx_short_get, \ - int*: shmem_ctx_int_get, \ - long*: shmem_ctx_long_get, \ - long long*: shmem_ctx_longlong_get, \ - float*: shmem_ctx_float_get, \ - double*: shmem_ctx_double_get, \ - long double*: shmem_ctx_longdouble_get, \ - default: __oshmem_datatype_ignore), \ - char*: shmem_char_get, \ - short*: shmem_short_get, \ - int*: shmem_int_get, \ - long*: shmem_long_get, \ - long long*: shmem_longlong_get, \ - float*: shmem_float_get, \ - double*: shmem_double_get, \ +#define shmem_get(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ + char*: shmem_ctx_char_get, \ + short*: shmem_ctx_short_get, \ + int*: shmem_ctx_int_get, \ + long*: shmem_ctx_long_get, \ + long long*: shmem_ctx_longlong_get, \ + signed char*: shmem_ctx_schar_get, \ + unsigned char*: shmem_ctx_uchar_get, \ + unsigned short*: shmem_ctx_ushort_get, \ + unsigned int*: shmem_ctx_uint_get, \ + unsigned long*: shmem_ctx_ulong_get, \ + unsigned long long*: shmem_ctx_ulonglong_get, \ + float*: shmem_ctx_float_get, \ + double*: shmem_ctx_double_get, \ + long double*: shmem_ctx_longdouble_get, \ + default: __oshmem_datatype_ignore), \ + char*: shmem_char_get, \ + short*: shmem_short_get, \ + int*: shmem_int_get, \ + long*: shmem_long_get, \ + long long*: shmem_longlong_get, \ + signed char*: shmem_schar_get, \ + unsigned char*: shmem_uchar_get, \ + unsigned short*: shmem_ushort_get, \ + unsigned int*: shmem_uint_get, \ + unsigned long*: shmem_ulong_get, \ + unsigned long long*: shmem_ulonglong_get, \ + float*: shmem_float_get, \ + double*: shmem_double_get, \ long double*: shmem_longdouble_get)(__VA_ARGS__) #endif @@ -519,11 +665,17 @@ OSHMEM_DECLSPEC void shmem_getmem(void *target, const void *source, size_t len, OSHMEM_DECLSPEC void shmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -533,15 +685,27 @@ OSHMEM_DECLSPEC void shmem_double_iget(double* target, const double* source, ptr OSHMEM_DECLSPEC void shmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_iget(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ char*: shmem_ctx_char_iget, \ short*: shmem_ctx_short_iget, \ int*: shmem_ctx_int_iget, \ long*: shmem_ctx_long_iget, \ long long*: shmem_ctx_longlong_iget, \ + signed char*: shmem_ctx_schar_iget, \ + unsigned char*: shmem_ctx_uchar_iget, \ + unsigned short*: shmem_ctx_ushort_iget, \ + unsigned int*: shmem_ctx_uint_iget, \ + unsigned long*: shmem_ctx_ulong_iget, \ + unsigned long long*: shmem_ctx_ulonglong_iget, \ float*: shmem_ctx_float_iget, \ double*: shmem_ctx_double_iget, \ long double*: shmem_ctx_longdouble_iget, \ @@ -551,6 +715,12 @@ OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t int*: shmem_int_iget, \ long*: shmem_long_iget, \ long long*: shmem_longlong_iget, \ + signed char*: shmem_schar_iget, \ + unsigned char*: shmem_uchar_iget, \ + unsigned short*: shmem_ushort_iget, \ + unsigned int*: shmem_uint_iget, \ + unsigned long*: shmem_ulong_iget, \ + unsigned long long*: shmem_ulonglong_iget, \ float*: shmem_float_iget, \ double*: shmem_double_iget, \ long double*: shmem_longdouble_iget)(__VA_ARGS__) @@ -576,6 +746,12 @@ OSHMEM_DECLSPEC void shmem_ctx_short_get_nbi(shmem_ctx_t ctx, short *target, co OSHMEM_DECLSPEC void shmem_ctx_int_get_nbi(shmem_ctx_t ctx, int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_get_nbi(shmem_ctx_t ctx, long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_get_nbi(shmem_ctx_t ctx, long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_get_nbi(shmem_ctx_t ctx, signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_get_nbi(shmem_ctx_t ctx, unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_get_nbi(shmem_ctx_t ctx, unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_get_nbi(shmem_ctx_t ctx, unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_get_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_get_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); @@ -586,18 +762,30 @@ OSHMEM_DECLSPEC void shmem_short_get_nbi(short *target, const short *source, si OSHMEM_DECLSPEC void shmem_int_get_nbi(int *target, const int *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_long_get_nbi(long *target, const long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longlong_get_nbi(long long *target, const long long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_get_nbi(signed char *target, const signed char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_get_nbi(unsigned char *target, const unsigned char *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_get_nbi(unsigned short *target, const unsigned short *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_get_nbi(unsigned int *target, const unsigned int *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_get_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_get_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_float_get_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_get_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ char*: shmem_ctx_char_get_nbi, \ short*: shmem_ctx_short_get_nbi, \ int*: shmem_ctx_int_get_nbi, \ long*: shmem_ctx_long_get_nbi, \ long long*: shmem_ctx_longlong_get_nbi, \ + signed char*: shmem_ctx_schar_get_nbi, \ + unsigned char*: shmem_ctx_uchar_get_nbi, \ + unsigned short*: shmem_ctx_ushort_get_nbi, \ + unsigned int*: shmem_ctx_uint_get_nbi, \ + unsigned long*: shmem_ctx_ulong_get_nbi, \ + unsigned long long*: shmem_ctx_ulonglong_get_nbi, \ float*: shmem_ctx_float_get_nbi, \ double*: shmem_ctx_double_get_nbi, \ long double*: shmem_ctx_longdouble_get_nbi, \ @@ -607,6 +795,12 @@ OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long d int*: shmem_int_get_nbi, \ long*: shmem_long_get_nbi, \ long long*: shmem_longlong_get_nbi, \ + signed char*: shmem_schar_get_nbi, \ + unsigned char*: shmem_uchar_get_nbi, \ + unsigned short*: shmem_ushort_get_nbi, \ + unsigned int*: shmem_uint_get_nbi, \ + unsigned long*: shmem_ulong_get_nbi, \ + unsigned long long*: shmem_ulonglong_get_nbi, \ float*: shmem_float_get_nbi, \ double*: shmem_double_get_nbi, \ long double*: shmem_longdouble_get_nbi)(__VA_ARGS__) @@ -631,13 +825,19 @@ OSHMEM_DECLSPEC void shmem_get128_nbi(void *target, const void *source, size_t /* Atomic swap */ OSHMEM_DECLSPEC int shmem_ctx_int_atomic_swap(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_swap(shmem_ctx_t ctx, long *target, long value, int pe); -OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long*target, long long value, int pe); +OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_swap(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC float shmem_ctx_float_atomic_swap(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC double shmem_ctx_double_atomic_swap(shmem_ctx_t ctx, double *target, double value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_swap(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_swap(long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_swap(long long*target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_swap(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_swap(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_swap(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC float shmem_float_atomic_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double shmem_double_atomic_swap(double *target, double value, int pe); #if OSHMEM_HAVE_C11 @@ -647,12 +847,18 @@ OSHMEM_DECLSPEC double shmem_double_atomic_swap(double *target, double value, in int*: shmem_ctx_int_atomic_swap, \ long*: shmem_ctx_long_atomic_swap, \ long long*: shmem_ctx_longlong_atomic_swap, \ + unsigned int*: shmem_ctx_uint_atomic_swap, \ + unsigned long*: shmem_ctx_ulong_atomic_swap, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_swap,\ float*: shmem_ctx_float_atomic_swap, \ double*: shmem_ctx_double_atomic_swap, \ default: __oshmem_datatype_ignore), \ int*: shmem_int_atomic_swap, \ long*: shmem_long_atomic_swap, \ long long*: shmem_longlong_atomic_swap, \ + unsigned int*: shmem_uint_atomic_swap, \ + unsigned long*: shmem_ulong_atomic_swap, \ + unsigned long long*: shmem_ulonglong_atomic_swap, \ float*: shmem_float_atomic_swap, \ double*: shmem_double_atomic_swap)(__VA_ARGS__) #endif @@ -675,35 +881,47 @@ OSHMEM_DECLSPEC double shmem_double_swap(double *target, double value, int pe); /* Atomic set */ OSHMEM_DECLSPEC void shmem_ctx_int_atomic_set(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_atomic_set(shmem_ctx_t ctx, long *target, long value, int pe); -OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long*target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_set(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_set(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_set(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_set(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_float_atomic_set(shmem_ctx_t ctx, float *target, float value, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_atomic_set(shmem_ctx_t ctx, double *target, double value, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_set(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_set(long *target, long value, int pe); -OSHMEM_DECLSPEC void shmem_longlong_atomic_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_atomic_set(long long *target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_uint_atomic_set(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ulong_atomic_set(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_atomic_set(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_float_atomic_set(float *target, float value, int pe); OSHMEM_DECLSPEC void shmem_double_atomic_set(double *target, double value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_set(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: shmem_ctx_int_atomic_set, \ - long*: shmem_ctx_long_atomic_set, \ - long long*: shmem_ctx_longlong_atomic_set, \ - float*: shmem_ctx_float_atomic_set, \ - double*: shmem_ctx_double_atomic_set, \ - default: __oshmem_datatype_ignore), \ - int*: shmem_int_atomic_set, \ - long*: shmem_long_atomic_set, \ - long long*: shmem_longlong_atomic_set, \ - float*: shmem_float_atomic_set, \ +#define shmem_atomic_set(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ + int*: shmem_ctx_int_atomic_set, \ + long*: shmem_ctx_long_atomic_set, \ + long long*: shmem_ctx_longlong_atomic_set, \ + unsigned int*: shmem_ctx_uint_atomic_set, \ + unsigned long*: shmem_ctx_ulong_atomic_set, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_set,\ + float*: shmem_ctx_float_atomic_set, \ + double*: shmem_ctx_double_atomic_set, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_set, \ + long*: shmem_long_atomic_set, \ + long long*: shmem_longlong_atomic_set, \ + unsigned int*: shmem_uint_atomic_set, \ + unsigned long*: shmem_ulong_atomic_set, \ + unsigned long long*: shmem_ulonglong_atomic_set, \ + float*: shmem_float_atomic_set, \ double*: shmem_double_atomic_set)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_set(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_set(long *target, long value, int pe); -OSHMEM_DECLSPEC void shmem_longlong_set(long long*target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_set(long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_float_set(float *target, float value, int pe); OSHMEM_DECLSPEC void shmem_double_set(double *target, double value, int pe); #if OSHMEM_HAVE_C11 @@ -720,10 +938,16 @@ OSHMEM_DECLSPEC void shmem_double_set(double *target, double value, int pe); OSHMEM_DECLSPEC int shmem_ctx_int_atomic_compare_swap(shmem_ctx_t ctx, int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_compare_swap(shmem_ctx_t ctx, long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_compare_swap(shmem_ctx_t ctx, long long *target, long long cond, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_compare_swap(shmem_ctx_t ctx, unsigned int *target, unsigned int cond, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long *target, unsigned long cond, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_compare_swap(shmem_ctx_t ctx, unsigned long long *target, unsigned long long cond, unsigned long long value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_compare_swap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_compare_swap(long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_compare_swap(long long *target, long long cond, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_compare_swap(unsigned int *target, unsigned int cond, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_compare_swap(unsigned long *target, unsigned long cond, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_compare_swap(unsigned long long *target, unsigned long long cond, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_compare_swap(...) \ @@ -732,10 +956,16 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_compare_swap(long long *target, int*: shmem_ctx_int_atomic_compare_swap, \ long*: shmem_ctx_long_atomic_compare_swap, \ long long*: shmem_ctx_longlong_atomic_compare_swap, \ + unsigned int*: shmem_ctx_uint_atomic_compare_swap, \ + unsigned long*: shmem_ctx_ulong_atomic_compare_swap, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_compare_swap, \ default: __oshmem_datatype_ignore), \ int*: shmem_int_atomic_compare_swap, \ long*: shmem_long_atomic_compare_swap, \ - long long*: shmem_longlong_atomic_compare_swap)(__VA_ARGS__) + long long*: shmem_longlong_atomic_compare_swap, \ + unsigned int*: shmem_uint_atomic_compare_swap, \ + unsigned long*: shmem_ulong_atomic_compare_swap, \ + unsigned long long*: shmem_ulonglong_atomic_compare_swap)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_cswap(int *target, int cond, int value, int pe); @@ -754,21 +984,33 @@ OSHMEM_DECLSPEC long long shmem_longlong_cswap(long long *target, long long cond OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_add(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch_add(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_add(long *target, long value, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_add(long long *target, long long value, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_add(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_add(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_add(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_add(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: shmem_ctx_int_atomic_fetch_add, \ - long*: shmem_ctx_long_atomic_fetch_add, \ - long long*: shmem_ctx_longlong_atomic_fetch_add, \ - default: __oshmem_datatype_ignore), \ - int*: shmem_int_atomic_fetch_add, \ - long*: shmem_long_atomic_fetch_add, \ - long long*: shmem_longlong_atomic_fetch_add)(__VA_ARGS__) +#define shmem_atomic_fetch_add(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_add, \ + long*: shmem_ctx_long_atomic_fetch_add, \ + long long*: shmem_ctx_longlong_atomic_fetch_add, \ + unsigned int*: shmem_ctx_uint_atomic_fetch_add, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch_add, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_add, \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_add, \ + long*: shmem_long_atomic_fetch_add, \ + long long*: shmem_longlong_atomic_fetch_add, \ + unsigned int*: shmem_uint_atomic_fetch_add, \ + unsigned long*: shmem_ulong_atomic_fetch_add, \ + unsigned long long*: shmem_ulonglong_atomic_fetch_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_fadd(int *target, int value, int pe); @@ -783,10 +1025,16 @@ OSHMEM_DECLSPEC long long shmem_longlong_fadd(long long *target, long long value #endif /* Atomic Fetch&And */ +OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_and(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_and(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_and(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int shmem_int_atomic_fetch_and(int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_long_atomic_fetch_and(long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_and(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); @@ -794,41 +1042,65 @@ OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned lon #define shmem_atomic_fetch_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_and, \ + long*: shmem_ctx_long_atomic_fetch_and, \ + long long*: shmem_ctx_longlong_atomic_fetch_and, \ unsigned int*: shmem_ctx_uint_atomic_fetch_and, \ unsigned long*: shmem_ctx_ulong_atomic_fetch_and, \ unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_and, \ default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_and, \ + long*: shmem_long_atomic_fetch_and, \ + long long*: shmem_longlong_atomic_fetch_and, \ unsigned int*: shmem_uint_atomic_fetch_and, \ unsigned long*: shmem_ulong_atomic_fetch_and, \ unsigned long long*: shmem_ulonglong_atomic_fetch_and)(__VA_ARGS__) #endif /* Atomic Fetch&Or */ +OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_or(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_or(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_or(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int shmem_int_atomic_fetch_or(int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_long_atomic_fetch_or(long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_or(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_fetch_or(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_or, \ + long*: shmem_ctx_long_atomic_fetch_or, \ + long long*: shmem_ctx_longlong_atomic_fetch_or, \ unsigned int*: shmem_ctx_uint_atomic_fetch_or, \ unsigned long*: shmem_ctx_ulong_atomic_fetch_or, \ unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_or, \ - default: __oshmem_datatype_ignore), \ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_or, \ + long*: shmem_long_atomic_fetch_or, \ + long long*: shmem_longlong_atomic_fetch_or, \ unsigned int*: shmem_uint_atomic_fetch_or, \ unsigned long*: shmem_ulong_atomic_fetch_or, \ unsigned long long*: shmem_ulonglong_atomic_fetch_or)(__VA_ARGS__) #endif /* Atomic Fetch&Xor */ +OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_xor(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_xor(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_xor(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int shmem_int_atomic_fetch_xor(int *target, int value, int pe); +OSHMEM_DECLSPEC long shmem_long_atomic_fetch_xor(long *target, long value, int pe); +OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_xor(long long *target, long long value, int pe); OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); @@ -836,10 +1108,16 @@ OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned lon #define shmem_atomic_fetch_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_fetch_xor, \ + long*: shmem_ctx_long_atomic_fetch_xor, \ + long long*: shmem_ctx_longlong_atomic_fetch_xor, \ unsigned int*: shmem_ctx_uint_atomic_fetch_xor, \ unsigned long*: shmem_ctx_ulong_atomic_fetch_xor, \ unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_xor, \ default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_fetch_xor, \ + long*: shmem_long_atomic_fetch_xor, \ + long long*: shmem_longlong_atomic_fetch_xor, \ unsigned int*: shmem_uint_atomic_fetch_xor, \ unsigned long*: shmem_ulong_atomic_fetch_xor, \ unsigned long long*: shmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__) @@ -849,12 +1127,18 @@ OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned lon OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch(shmem_ctx_t ctx, const int *target, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch(shmem_ctx_t ctx, const long *target, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch(shmem_ctx_t ctx, const long long *target, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch(shmem_ctx_t ctx, const unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch(shmem_ctx_t ctx, const unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch(shmem_ctx_t ctx, const unsigned long long *target, int pe); OSHMEM_DECLSPEC float shmem_ctx_float_atomic_fetch(shmem_ctx_t ctx, const float *target, int pe); OSHMEM_DECLSPEC double shmem_ctx_double_atomic_fetch(shmem_ctx_t ctx, const double *target, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch(const int *target, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch(const long *target, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch(const long long *target, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch(const unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch(const unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch(const unsigned long long *target, int pe); OSHMEM_DECLSPEC float shmem_float_atomic_fetch(const float *target, int pe); OSHMEM_DECLSPEC double shmem_double_atomic_fetch(const double *target, int pe); #if OSHMEM_HAVE_C11 @@ -864,12 +1148,18 @@ OSHMEM_DECLSPEC double shmem_double_atomic_fetch(const double *target, int pe); int*: shmem_ctx_int_atomic_fetch, \ long*: shmem_ctx_long_atomic_fetch, \ long long*: shmem_ctx_longlong_atomic_fetch, \ + unsigned int*: shmem_ctx_uint_atomic_fetch, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch, \ float*: shmem_ctx_float_atomic_fetch, \ double*: shmem_ctx_double_atomic_fetch, \ default: __oshmem_datatype_ignore), \ int*: shmem_int_atomic_fetch, \ long*: shmem_long_atomic_fetch, \ long long*: shmem_longlong_atomic_fetch, \ + unsigned int*: shmem_uint_atomic_fetch, \ + unsigned long*: shmem_ulong_atomic_fetch, \ + unsigned long long*: shmem_ulonglong_atomic_fetch, \ float*: shmem_float_atomic_fetch, \ double*: shmem_double_atomic_fetch)(__VA_ARGS__) #endif @@ -893,21 +1183,33 @@ OSHMEM_DECLSPEC double shmem_double_fetch(const double *target, int pe); OSHMEM_DECLSPEC int shmem_ctx_int_atomic_fetch_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC long shmem_ctx_long_atomic_fetch_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_inc(shmem_ctx_t ctx, long long *target, int pe); +OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_inc(shmem_ctx_t ctx, unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_inc(shmem_ctx_t ctx, unsigned long long *target, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch_inc(int *target, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_inc(long *target, int pe); OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_inc(long long *target, int pe); +OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_inc(unsigned int *target, int pe); +OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_inc(unsigned long *target, int pe); +OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_inc(unsigned long long *target, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_fetch_inc(...) \ +#define shmem_atomic_fetch_inc(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: shmem_ctx_int_atomic_fetch_inc, \ - long*: shmem_ctx_long_atomic_fetch_inc, \ - long long*: shmem_ctx_longlong_atomic_fetch_inc, \ + int*: shmem_ctx_int_atomic_fetch_inc, \ + long*: shmem_ctx_long_atomic_fetch_inc, \ + long long*: shmem_ctx_longlong_atomic_fetch_inc, \ + unsigned int*: shmem_ctx_uint_atomic_fetch_inc, \ + unsigned long*: shmem_ctx_ulong_atomic_fetch_inc, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_fetch_inc, \ default: __oshmem_datatype_ignore), \ - int*: shmem_int_atomic_fetch_inc, \ - long*: shmem_long_atomic_fetch_inc, \ - long long*: shmem_longlong_atomic_fetch_inc)(__VA_ARGS__) + int*: shmem_int_atomic_fetch_inc, \ + long*: shmem_long_atomic_fetch_inc, \ + long long*: shmem_longlong_atomic_fetch_inc, \ + unsigned int*: shmem_uint_atomic_fetch_inc, \ + unsigned long*: shmem_ulong_atomic_fetch_inc, \ + unsigned long long*: shmem_ulonglong_atomic_fetch_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC int shmem_int_finc(int *target, int pe); @@ -925,10 +1227,16 @@ OSHMEM_DECLSPEC long long shmem_longlong_finc(long long *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_int_atomic_add(shmem_ctx_t ctx, int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_atomic_add(shmem_ctx_t ctx, long *target, long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_add(shmem_ctx_t ctx, long long *target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_add(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_add(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_add(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_add(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_add(long *target, long value, int pe); OSHMEM_DECLSPEC void shmem_longlong_atomic_add(long long *target, long long value, int pe); +OSHMEM_DECLSPEC void shmem_uint_atomic_add(unsigned int *target, unsigned int value, int pe); +OSHMEM_DECLSPEC void shmem_ulong_atomic_add(unsigned long *target, unsigned long value, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_atomic_add(unsigned long long *target, unsigned long long value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_add(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -936,10 +1244,16 @@ OSHMEM_DECLSPEC void shmem_longlong_atomic_add(long long *target, long long valu int*: shmem_ctx_int_atomic_add, \ long*: shmem_ctx_long_atomic_add, \ long long*: shmem_ctx_longlong_atomic_add, \ + unsigned int*: shmem_ctx_uint_atomic_add, \ + unsigned long*: shmem_ctx_ulong_atomic_add, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_add, \ default: __oshmem_datatype_ignore), \ int*: shmem_int_atomic_add, \ long*: shmem_long_atomic_add, \ - long long*: shmem_longlong_atomic_add)(__VA_ARGS__) + long long*: shmem_longlong_atomic_add, \ + unsigned int*: shmem_uint_atomic_add, \ + unsigned long*: shmem_ulong_atomic_add, \ + unsigned long long*: shmem_ulonglong_atomic_add)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_add(int *target, int value, int pe); @@ -954,10 +1268,16 @@ OSHMEM_DECLSPEC void shmem_longlong_add(long long *target, long long value, int #endif /* Atomic And */ +OSHMEM_DECLSPEC void shmem_ctx_int_atomic_and(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_long_atomic_and(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_and(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int_atomic_and(int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_long_atomic_and(long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_atomic_and(long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); @@ -965,20 +1285,32 @@ OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsi #define shmem_atomic_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_and, \ + long*: shmem_ctx_long_atomic_and, \ + long long*: shmem_ctx_longlong_atomic_and, \ unsigned int*: shmem_ctx_uint_atomic_and, \ unsigned long*: shmem_ctx_ulong_atomic_and, \ unsigned long long*: shmem_ctx_ulonglong_atomic_and, \ default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_and, \ + long*: shmem_long_atomic_and, \ + long long*: shmem_longlong_atomic_and, \ unsigned int*: shmem_uint_atomic_and, \ unsigned long*: shmem_ulong_atomic_and, \ unsigned long long*: shmem_ulonglong_atomic_and)(__VA_ARGS__) #endif /* Atomic Or */ +OSHMEM_DECLSPEC void shmem_ctx_int_atomic_or(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_long_atomic_or(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_or(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int_atomic_or(int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_long_atomic_or(long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_atomic_or(long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); @@ -986,20 +1318,32 @@ OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsig #define shmem_atomic_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_or, \ + long*: shmem_ctx_long_atomic_or, \ + long long*: shmem_ctx_longlong_atomic_or, \ unsigned int*: shmem_ctx_uint_atomic_or, \ unsigned long*: shmem_ctx_ulong_atomic_or, \ unsigned long long*: shmem_ctx_ulonglong_atomic_or, \ default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_or, \ + long*: shmem_long_atomic_or, \ + long long*: shmem_longlong_atomic_or, \ unsigned int*: shmem_uint_atomic_or, \ unsigned long*: shmem_ulong_atomic_or, \ unsigned long long*: shmem_ulonglong_atomic_or)(__VA_ARGS__) #endif /* Atomic Xor */ +OSHMEM_DECLSPEC void shmem_ctx_int_atomic_xor(shmem_ctx_t ctx, int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_long_atomic_xor(shmem_ctx_t ctx, long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_xor(shmem_ctx_t ctx, long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int_atomic_xor(int *target, int value, int pe); +OSHMEM_DECLSPEC void shmem_long_atomic_xor(long *target, long value, int pe); +OSHMEM_DECLSPEC void shmem_longlong_atomic_xor(long long *target, long long value, int pe); OSHMEM_DECLSPEC void shmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); @@ -1007,10 +1351,16 @@ OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsi #define shmem_atomic_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ + int*: shmem_ctx_int_atomic_xor, \ + long*: shmem_ctx_long_atomic_xor, \ + long long*: shmem_ctx_longlong_atomic_xor, \ unsigned int*: shmem_ctx_uint_atomic_xor, \ unsigned long*: shmem_ctx_ulong_atomic_xor, \ unsigned long long*: shmem_ctx_ulonglong_atomic_xor, \ default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_xor, \ + long*: shmem_long_atomic_xor, \ + long long*: shmem_longlong_atomic_xor, \ unsigned int*: shmem_uint_atomic_xor, \ unsigned long*: shmem_ulong_atomic_xor, \ unsigned long long*: shmem_ulonglong_atomic_xor)(__VA_ARGS__) @@ -1020,21 +1370,33 @@ OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsi OSHMEM_DECLSPEC void shmem_ctx_int_atomic_inc(shmem_ctx_t ctx, int *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_long_atomic_inc(shmem_ctx_t ctx, long *target, int pe); OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_inc(shmem_ctx_t ctx, long long *target, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_inc(shmem_ctx_t ctx, unsigned int *target, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_inc(shmem_ctx_t ctx, unsigned long *target, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_inc(shmem_ctx_t ctx, unsigned long long *target, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_inc(int *target, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_inc(long *target, int pe); OSHMEM_DECLSPEC void shmem_longlong_atomic_inc(long long *target, int pe); +OSHMEM_DECLSPEC void shmem_uint_atomic_inc(unsigned int *target, int pe); +OSHMEM_DECLSPEC void shmem_ulong_atomic_inc(unsigned long *target, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_atomic_inc(unsigned long long *target, int pe); #if OSHMEM_HAVE_C11 -#define shmem_atomic_inc(...) \ - _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ - shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: shmem_ctx_int_atomic_inc, \ - long*: shmem_ctx_long_atomic_inc, \ - long long*: shmem_ctx_longlong_atomic_inc, \ - default: __oshmem_datatype_ignore), \ - int*: shmem_int_atomic_inc, \ - long*: shmem_long_atomic_inc, \ - long long*: shmem_longlong_atomic_inc)(__VA_ARGS__) +#define shmem_atomic_inc(...) \ + _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ + shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ + int*: shmem_ctx_int_atomic_inc, \ + long*: shmem_ctx_long_atomic_inc, \ + long long*: shmem_ctx_longlong_atomic_inc, \ + unsigned int*: shmem_ctx_uint_atomic_inc, \ + unsigned long*: shmem_ctx_ulong_atomic_inc, \ + unsigned long long*: shmem_ctx_ulonglong_atomic_inc,\ + default: __oshmem_datatype_ignore), \ + int*: shmem_int_atomic_inc, \ + long*: shmem_long_atomic_inc, \ + long long*: shmem_longlong_atomic_inc, \ + unsigned int*: shmem_uint_atomic_inc, \ + unsigned long*: shmem_ulong_atomic_inc, \ + unsigned long long*: shmem_ulonglong_atomic_inc)(__VA_ARGS__) #endif OSHMEM_DECLSPEC void shmem_int_inc(int *target, int pe); diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index 9357c0459bd..2ce3fd97ab2 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -80,6 +80,12 @@ #define shmem_ctx_float_p pshmem_ctx_float_p #define shmem_ctx_double_p pshmem_ctx_double_p #define shmem_ctx_longlong_p pshmem_ctx_longlong_p +#define shmem_ctx_schar_p pshmem_ctx_schar_p +#define shmem_ctx_uchar_p pshmem_ctx_uchar_p +#define shmem_ctx_ushort_p pshmem_ctx_ushort_p +#define shmem_ctx_uint_p pshmem_ctx_uint_p +#define shmem_ctx_ulong_p pshmem_ctx_ulong_p +#define shmem_ctx_ulonglong_p pshmem_ctx_ulonglong_p #define shmem_ctx_longdouble_p pshmem_ctx_longdouble_p #define shmem_char_p pshmem_char_p #define shmem_short_p pshmem_short_p @@ -88,6 +94,12 @@ #define shmem_float_p pshmem_float_p #define shmem_double_p pshmem_double_p #define shmem_longlong_p pshmem_longlong_p +#define shmem_schar_p pshmem_schar_p +#define shmem_uchar_p pshmem_uchar_p +#define shmem_ushort_p pshmem_ushort_p +#define shmem_uint_p pshmem_uint_p +#define shmem_ulong_p pshmem_ulong_p +#define shmem_ulonglong_p pshmem_ulonglong_p #define shmem_longdouble_p pshmem_longdouble_p #define shmemx_int16_p pshmemx_int16_p #define shmemx_int32_p pshmemx_int32_p @@ -103,6 +115,12 @@ #define shmem_ctx_float_put pshmem_ctx_float_put #define shmem_ctx_double_put pshmem_ctx_double_put #define shmem_ctx_longlong_put pshmem_ctx_longlong_put +#define shmem_ctx_schar_put pshmem_ctx_schar_put +#define shmem_ctx_uchar_put pshmem_ctx_uchar_put +#define shmem_ctx_ushort_put pshmem_ctx_ushort_put +#define shmem_ctx_uint_put pshmem_ctx_uint_put +#define shmem_ctx_ulong_put pshmem_ctx_ulong_put +#define shmem_ctx_ulonglong_put pshmem_ctx_ulonglong_put #define shmem_ctx_longdouble_put pshmem_ctx_longdouble_put #define shmem_char_put pshmem_char_put /* shmem-compat.h */ #define shmem_short_put pshmem_short_put @@ -111,6 +129,12 @@ #define shmem_float_put pshmem_float_put #define shmem_double_put pshmem_double_put #define shmem_longlong_put pshmem_longlong_put +#define shmem_schar_put pshmem_schar_put +#define shmem_uchar_put pshmem_uchar_put +#define shmem_ushort_put pshmem_ushort_put +#define shmem_uint_put pshmem_uint_put +#define shmem_ulong_put pshmem_ulong_put +#define shmem_ulonglong_put pshmem_ulonglong_put #define shmem_longdouble_put pshmem_longdouble_put #define shmem_ctx_put8 pshmem_ctx_put8 @@ -129,22 +153,34 @@ /* * Strided put routines */ -#define shmem_ctx_char_iput pshmem_ctx_char_iput -#define shmem_ctx_short_iput pshmem_ctx_short_iput -#define shmem_ctx_int_iput pshmem_ctx_int_iput -#define shmem_ctx_float_iput pshmem_ctx_float_iput -#define shmem_ctx_double_iput pshmem_ctx_double_iput -#define shmem_ctx_longlong_iput pshmem_ctx_longlong_iput -#define shmem_ctx_longdouble_iput pshmem_ctx_longdouble_iput -#define shmem_ctx_long_iput pshmem_ctx_long_iput -#define shmem_char_iput pshmem_char_iput -#define shmem_short_iput pshmem_short_iput -#define shmem_int_iput pshmem_int_iput -#define shmem_float_iput pshmem_float_iput -#define shmem_double_iput pshmem_double_iput -#define shmem_longlong_iput pshmem_longlong_iput -#define shmem_longdouble_iput pshmem_longdouble_iput -#define shmem_long_iput pshmem_long_iput +#define shmem_ctx_char_iput pshmem_ctx_char_iput +#define shmem_ctx_short_iput pshmem_ctx_short_iput +#define shmem_ctx_int_iput pshmem_ctx_int_iput +#define shmem_ctx_long_iput pshmem_ctx_long_iput +#define shmem_ctx_float_iput pshmem_ctx_float_iput +#define shmem_ctx_double_iput pshmem_ctx_double_iput +#define shmem_ctx_longlong_iput pshmem_ctx_longlong_iput +#define shmem_ctx_schar_iput pshmem_ctx_schar_iput +#define shmem_ctx_uchar_iput pshmem_ctx_uchar_iput +#define shmem_ctx_ushort_iput pshmem_ctx_ushort_iput +#define shmem_ctx_uint_iput pshmem_ctx_uint_iput +#define shmem_ctx_ulong_iput pshmem_ctx_ulong_iput +#define shmem_ctx_ulonglong_iput pshmem_ctx_ulonglong_iput +#define shmem_ctx_longdouble_iput pshmem_ctx_longdouble_iput +#define shmem_char_iput pshmem_char_iput +#define shmem_short_iput pshmem_short_iput +#define shmem_int_iput pshmem_int_iput +#define shmem_long_iput pshmem_long_iput +#define shmem_float_iput pshmem_float_iput +#define shmem_double_iput pshmem_double_iput +#define shmem_longlong_iput pshmem_longlong_iput +#define shmem_schar_iput pshmem_schar_iput +#define shmem_uchar_iput pshmem_uchar_iput +#define shmem_ushort_iput pshmem_ushort_iput +#define shmem_uint_iput pshmem_uint_iput +#define shmem_ulong_iput pshmem_ulong_iput +#define shmem_ulonglong_iput pshmem_ulonglong_iput +#define shmem_longdouble_iput pshmem_longdouble_iput #define shmem_ctx_iput8 pshmem_ctx_iput8 #define shmem_ctx_iput16 pshmem_ctx_iput16 @@ -160,22 +196,34 @@ /* * Non-block data put routines */ -#define shmem_ctx_char_put_nbi pshmem_ctx_char_put_nbi -#define shmem_ctx_short_put_nbi pshmem_ctx_short_put_nbi -#define shmem_ctx_int_put_nbi pshmem_ctx_int_put_nbi -#define shmem_ctx_long_put_nbi pshmem_ctx_long_put_nbi -#define shmem_ctx_float_put_nbi pshmem_ctx_float_put_nbi -#define shmem_ctx_double_put_nbi pshmem_ctx_double_put_nbi -#define shmem_ctx_longlong_put_nbi pshmem_ctx_longlong_put_nbi -#define shmem_ctx_longdouble_put_nbi pshmem_ctx_longdouble_put_nbi -#define shmem_char_put_nbi pshmem_char_put_nbi -#define shmem_short_put_nbi pshmem_short_put_nbi -#define shmem_int_put_nbi pshmem_int_put_nbi -#define shmem_long_put_nbi pshmem_long_put_nbi -#define shmem_float_put_nbi pshmem_float_put_nbi -#define shmem_double_put_nbi pshmem_double_put_nbi -#define shmem_longlong_put_nbi pshmem_longlong_put_nbi -#define shmem_longdouble_put_nbi pshmem_longdouble_put_nbi +#define shmem_ctx_char_put_nbi pshmem_ctx_char_put_nbi +#define shmem_ctx_short_put_nbi pshmem_ctx_short_put_nbi +#define shmem_ctx_int_put_nbi pshmem_ctx_int_put_nbi +#define shmem_ctx_long_put_nbi pshmem_ctx_long_put_nbi +#define shmem_ctx_float_put_nbi pshmem_ctx_float_put_nbi +#define shmem_ctx_double_put_nbi pshmem_ctx_double_put_nbi +#define shmem_ctx_longlong_put_nbi pshmem_ctx_longlong_put_nbi +#define shmem_ctx_schar_put_nbi pshmem_ctx_schar_put_nbi +#define shmem_ctx_uchar_put_nbi pshmem_ctx_uchar_put_nbi +#define shmem_ctx_ushort_put_nbi pshmem_ctx_ushort_put_nbi +#define shmem_ctx_uint_put_nbi pshmem_ctx_uint_put_nbi +#define shmem_ctx_ulong_put_nbi pshmem_ctx_ulong_put_nbi +#define shmem_ctx_ulonglong_put_nbi pshmem_ctx_ulonglong_put_nbi +#define shmem_ctx_longdouble_put_nbi pshmem_ctx_longdouble_put_nbi +#define shmem_char_put_nbi pshmem_char_put_nbi +#define shmem_short_put_nbi pshmem_short_put_nbi +#define shmem_int_put_nbi pshmem_int_put_nbi +#define shmem_long_put_nbi pshmem_long_put_nbi +#define shmem_float_put_nbi pshmem_float_put_nbi +#define shmem_double_put_nbi pshmem_double_put_nbi +#define shmem_longlong_put_nbi pshmem_longlong_put_nbi +#define shmem_schar_put_nbi pshmem_schar_put_nbi +#define shmem_uchar_put_nbi pshmem_uchar_put_nbi +#define shmem_ushort_put_nbi pshmem_ushort_put_nbi +#define shmem_uint_put_nbi pshmem_uint_put_nbi +#define shmem_ulong_put_nbi pshmem_ulong_put_nbi +#define shmem_ulonglong_put_nbi pshmem_ulonglong_put_nbi +#define shmem_longdouble_put_nbi pshmem_longdouble_put_nbi #define shmem_ctx_put8_nbi pshmem_ctx_put8_nbi #define shmem_ctx_put16_nbi pshmem_ctx_put16_nbi @@ -200,6 +248,12 @@ #define shmem_ctx_float_g pshmem_ctx_float_g #define shmem_ctx_double_g pshmem_ctx_double_g #define shmem_ctx_longlong_g pshmem_ctx_longlong_g +#define shmem_ctx_schar_g pshmem_ctx_schar_g +#define shmem_ctx_uchar_g pshmem_ctx_uchar_g +#define shmem_ctx_ushort_g pshmem_ctx_ushort_g +#define shmem_ctx_uint_g pshmem_ctx_uint_g +#define shmem_ctx_ulong_g pshmem_ctx_ulong_g +#define shmem_ctx_ulonglong_g pshmem_ctx_ulonglong_g #define shmem_ctx_longdouble_g pshmem_ctx_longdouble_g #define shmem_char_g pshmem_char_g #define shmem_short_g pshmem_short_g @@ -208,6 +262,12 @@ #define shmem_float_g pshmem_float_g #define shmem_double_g pshmem_double_g #define shmem_longlong_g pshmem_longlong_g +#define shmem_schar_g pshmem_schar_g +#define shmem_uchar_g pshmem_uchar_g +#define shmem_ushort_g pshmem_ushort_g +#define shmem_uint_g pshmem_uint_g +#define shmem_ulong_g pshmem_ulong_g +#define shmem_ulonglong_g pshmem_ulonglong_g #define shmem_longdouble_g pshmem_longdouble_g #define shmemx_int16_g pshmemx_int16_g #define shmemx_int32_g pshmemx_int32_g @@ -223,6 +283,12 @@ #define shmem_ctx_float_get pshmem_ctx_float_get #define shmem_ctx_double_get pshmem_ctx_double_get #define shmem_ctx_longlong_get pshmem_ctx_longlong_get +#define shmem_ctx_schar_get pshmem_ctx_schar_get +#define shmem_ctx_uchar_get pshmem_ctx_uchar_get +#define shmem_ctx_ushort_get pshmem_ctx_ushort_get +#define shmem_ctx_uint_get pshmem_ctx_uint_get +#define shmem_ctx_ulong_get pshmem_ctx_ulong_get +#define shmem_ctx_ulonglong_get pshmem_ctx_ulonglong_get #define shmem_ctx_longdouble_get pshmem_ctx_longdouble_get #define shmem_char_get pshmem_char_get /* shmem-compat.h */ #define shmem_short_get pshmem_short_get @@ -231,6 +297,12 @@ #define shmem_float_get pshmem_float_get #define shmem_double_get pshmem_double_get #define shmem_longlong_get pshmem_longlong_get +#define shmem_schar_get pshmem_schar_get +#define shmem_uchar_get pshmem_uchar_get +#define shmem_ushort_get pshmem_ushort_get +#define shmem_uint_get pshmem_uint_get +#define shmem_ulong_get pshmem_ulong_get +#define shmem_ulonglong_get pshmem_ulonglong_get #define shmem_longdouble_get pshmem_longdouble_get #define shmem_ctx_get8 pshmem_ctx_get8 @@ -249,22 +321,34 @@ /* * Strided get routines */ -#define shmem_ctx_char_iget pshmem_ctx_char_iget -#define shmem_ctx_short_iget pshmem_ctx_short_iget -#define shmem_ctx_int_iget pshmem_ctx_int_iget -#define shmem_ctx_float_iget pshmem_ctx_float_iget -#define shmem_ctx_double_iget pshmem_ctx_double_iget -#define shmem_ctx_longlong_iget pshmem_ctx_longlong_iget -#define shmem_ctx_longdouble_iget pshmem_ctx_longdouble_iget -#define shmem_ctx_long_iget pshmem_ctx_long_iget -#define shmem_char_iget pshmem_char_iget -#define shmem_short_iget pshmem_short_iget -#define shmem_int_iget pshmem_int_iget -#define shmem_float_iget pshmem_float_iget -#define shmem_double_iget pshmem_double_iget -#define shmem_longlong_iget pshmem_longlong_iget -#define shmem_longdouble_iget pshmem_longdouble_iget -#define shmem_long_iget pshmem_long_iget +#define shmem_ctx_char_iget pshmem_ctx_char_iget +#define shmem_ctx_short_iget pshmem_ctx_short_iget +#define shmem_ctx_int_iget pshmem_ctx_int_iget +#define shmem_ctx_long_iget pshmem_ctx_long_iget +#define shmem_ctx_float_iget pshmem_ctx_float_iget +#define shmem_ctx_double_iget pshmem_ctx_double_iget +#define shmem_ctx_longlong_iget pshmem_ctx_longlong_iget +#define shmem_ctx_schar_iget pshmem_ctx_schar_iget +#define shmem_ctx_uchar_iget pshmem_ctx_uchar_iget +#define shmem_ctx_ushort_iget pshmem_ctx_ushort_iget +#define shmem_ctx_uint_iget pshmem_ctx_uint_iget +#define shmem_ctx_ulong_iget pshmem_ctx_ulong_iget +#define shmem_ctx_ulonglong_iget pshmem_ctx_ulonglong_iget +#define shmem_ctx_longdouble_iget pshmem_ctx_longdouble_iget +#define shmem_char_iget pshmem_char_iget +#define shmem_short_iget pshmem_short_iget +#define shmem_int_iget pshmem_int_iget +#define shmem_long_iget pshmem_long_iget +#define shmem_float_iget pshmem_float_iget +#define shmem_double_iget pshmem_double_iget +#define shmem_longlong_iget pshmem_longlong_iget +#define shmem_schar_iget pshmem_schar_iget +#define shmem_uchar_iget pshmem_uchar_iget +#define shmem_ushort_iget pshmem_ushort_iget +#define shmem_uint_iget pshmem_uint_iget +#define shmem_ulong_iget pshmem_ulong_iget +#define shmem_ulonglong_iget pshmem_ulonglong_iget +#define shmem_longdouble_iget pshmem_longdouble_iget #define shmem_ctx_iget8 pshmem_ctx_iget8 #define shmem_ctx_iget16 pshmem_ctx_iget16 @@ -280,22 +364,34 @@ /* * Non-block data get routines */ -#define shmem_ctx_char_get_nbi pshmem_ctx_char_get_nbi -#define shmem_ctx_short_get_nbi pshmem_ctx_short_get_nbi -#define shmem_ctx_int_get_nbi pshmem_ctx_int_get_nbi -#define shmem_ctx_long_get_nbi pshmem_ctx_long_get_nbi -#define shmem_ctx_float_get_nbi pshmem_ctx_float_get_nbi -#define shmem_ctx_double_get_nbi pshmem_ctx_double_get_nbi -#define shmem_ctx_longlong_get_nbi pshmem_ctx_longlong_get_nbi -#define shmem_ctx_longdouble_get_nbi pshmem_ctx_longdouble_get_nbi -#define shmem_char_get_nbi pshmem_char_get_nbi -#define shmem_short_get_nbi pshmem_short_get_nbi -#define shmem_int_get_nbi pshmem_int_get_nbi -#define shmem_long_get_nbi pshmem_long_get_nbi -#define shmem_float_get_nbi pshmem_float_get_nbi -#define shmem_double_get_nbi pshmem_double_get_nbi -#define shmem_longlong_get_nbi pshmem_longlong_get_nbi -#define shmem_longdouble_get_nbi pshmem_longdouble_get_nbi +#define shmem_ctx_char_get_nbi pshmem_ctx_char_get_nbi +#define shmem_ctx_short_get_nbi pshmem_ctx_short_get_nbi +#define shmem_ctx_int_get_nbi pshmem_ctx_int_get_nbi +#define shmem_ctx_long_get_nbi pshmem_ctx_long_get_nbi +#define shmem_ctx_float_get_nbi pshmem_ctx_float_get_nbi +#define shmem_ctx_double_get_nbi pshmem_ctx_double_get_nbi +#define shmem_ctx_longlong_get_nbi pshmem_ctx_longlong_get_nbi +#define shmem_ctx_schar_get_nbi pshmem_ctx_schar_get_nbi +#define shmem_ctx_uchar_get_nbi pshmem_ctx_uchar_get_nbi +#define shmem_ctx_ushort_get_nbi pshmem_ctx_ushort_get_nbi +#define shmem_ctx_uint_get_nbi pshmem_ctx_uint_get_nbi +#define shmem_ctx_ulong_get_nbi pshmem_ctx_ulong_get_nbi +#define shmem_ctx_ulonglong_get_nbi pshmem_ctx_ulonglong_get_nbi +#define shmem_ctx_longdouble_get_nbi pshmem_ctx_longdouble_get_nbi +#define shmem_char_get_nbi pshmem_char_get_nbi +#define shmem_short_get_nbi pshmem_short_get_nbi +#define shmem_int_get_nbi pshmem_int_get_nbi +#define shmem_long_get_nbi pshmem_long_get_nbi +#define shmem_float_get_nbi pshmem_float_get_nbi +#define shmem_double_get_nbi pshmem_double_get_nbi +#define shmem_longlong_get_nbi pshmem_longlong_get_nbi +#define shmem_schar_get_nbi pshmem_schar_get_nbi +#define shmem_uchar_get_nbi pshmem_uchar_get_nbi +#define shmem_ushort_get_nbi pshmem_ushort_get_nbi +#define shmem_uint_get_nbi pshmem_uint_get_nbi +#define shmem_ulong_get_nbi pshmem_ulong_get_nbi +#define shmem_ulonglong_get_nbi pshmem_ulonglong_get_nbi +#define shmem_longdouble_get_nbi pshmem_longdouble_get_nbi #define shmem_ctx_get8_nbi pshmem_ctx_get8_nbi #define shmem_ctx_get16_nbi pshmem_ctx_get16_nbi @@ -319,11 +415,17 @@ #define shmem_ctx_int_atomic_swap pshmem_ctx_int_atomic_swap #define shmem_ctx_long_atomic_swap pshmem_ctx_long_atomic_swap #define shmem_ctx_longlong_atomic_swap pshmem_ctx_longlong_atomic_swap +#define shmem_ctx_uint_atomic_swap pshmem_ctx_uint_atomic_swap +#define shmem_ctx_ulong_atomic_swap pshmem_ctx_ulong_atomic_swap +#define shmem_ctx_ulonglong_atomic_swap pshmem_ctx_ulonglong_atomic_swap #define shmem_double_atomic_swap pshmem_double_atomic_swap #define shmem_float_atomic_swap pshmem_float_atomic_swap #define shmem_int_atomic_swap pshmem_int_atomic_swap #define shmem_long_atomic_swap pshmem_long_atomic_swap #define shmem_longlong_atomic_swap pshmem_longlong_atomic_swap +#define shmem_uint_atomic_swap pshmem_uint_atomic_swap +#define shmem_ulong_atomic_swap pshmem_ulong_atomic_swap +#define shmem_ulonglong_atomic_swap pshmem_ulonglong_atomic_swap #define shmem_double_swap pshmem_double_swap #define shmem_float_swap pshmem_float_swap #define shmem_int_swap pshmem_int_swap @@ -338,11 +440,17 @@ #define shmem_ctx_int_atomic_set pshmem_ctx_int_atomic_set #define shmem_ctx_long_atomic_set pshmem_ctx_long_atomic_set #define shmem_ctx_longlong_atomic_set pshmem_ctx_longlong_atomic_set +#define shmem_ctx_uint_atomic_set pshmem_ctx_uint_atomic_set +#define shmem_ctx_ulong_atomic_set pshmem_ctx_ulong_atomic_set +#define shmem_ctx_ulonglong_atomic_set pshmem_ctx_ulonglong_atomic_set #define shmem_double_atomic_set pshmem_double_atomic_set #define shmem_float_atomic_set pshmem_float_atomic_set #define shmem_int_atomic_set pshmem_int_atomic_set #define shmem_long_atomic_set pshmem_long_atomic_set #define shmem_longlong_atomic_set pshmem_longlong_atomic_set +#define shmem_uint_atomic_set pshmem_uint_atomic_set +#define shmem_ulong_atomic_set pshmem_ulong_atomic_set +#define shmem_ulonglong_atomic_set pshmem_ulonglong_atomic_set #define shmem_double_set pshmem_double_set #define shmem_float_set pshmem_float_set #define shmem_int_set pshmem_int_set @@ -355,9 +463,15 @@ #define shmem_ctx_int_atomic_compare_swap pshmem_ctx_int_atomic_compare_swap #define shmem_ctx_long_atomic_compare_swap pshmem_ctx_long_atomic_compare_swap #define shmem_ctx_longlong_atomic_compare_swap pshmem_ctx_longlong_atomic_compare_swap +#define shmem_ctx_uint_atomic_compare_swap pshmem_ctx_uint_atomic_compare_swap +#define shmem_ctx_ulong_atomic_compare_swap pshmem_ctx_ulong_atomic_compare_swap +#define shmem_ctx_ulonglong_atomic_compare_swap pshmem_ctx_ulonglong_atomic_compare_swap #define shmem_int_atomic_compare_swap pshmem_int_atomic_compare_swap #define shmem_long_atomic_compare_swap pshmem_long_atomic_compare_swap #define shmem_longlong_atomic_compare_swap pshmem_longlong_atomic_compare_swap +#define shmem_uint_atomic_compare_swap pshmem_uint_atomic_compare_swap +#define shmem_ulong_atomic_compare_swap pshmem_ulong_atomic_compare_swap +#define shmem_ulonglong_atomic_compare_swap pshmem_ulonglong_atomic_compare_swap #define shmem_int_cswap pshmem_int_cswap #define shmem_long_cswap pshmem_long_cswap #define shmem_longlong_cswap pshmem_longlong_cswap @@ -365,22 +479,34 @@ #define shmemx_int64_cswap pshmemx_int64_cswap /* Atomic Fetch&Add */ -#define shmem_ctx_int_atomic_fetch_add pshmem_ctx_int_atomic_fetch_add -#define shmem_ctx_long_atomic_fetch_add pshmem_ctx_long_atomic_fetch_add -#define shmem_ctx_longlong_atomic_fetch_add pshmem_ctx_longlong_atomic_fetch_add -#define shmem_int_atomic_fetch_add pshmem_int_atomic_fetch_add -#define shmem_long_atomic_fetch_add pshmem_long_atomic_fetch_add -#define shmem_longlong_atomic_fetch_add pshmem_longlong_atomic_fetch_add -#define shmem_int_fadd pshmem_int_fadd -#define shmem_long_fadd pshmem_long_fadd -#define shmem_longlong_fadd pshmem_longlong_fadd -#define shmemx_int32_fadd pshmemx_int32_fadd -#define shmemx_int64_fadd pshmemx_int64_fadd +#define shmem_ctx_int_atomic_fetch_add pshmem_ctx_int_atomic_fetch_add +#define shmem_ctx_long_atomic_fetch_add pshmem_ctx_long_atomic_fetch_add +#define shmem_ctx_longlong_atomic_fetch_add pshmem_ctx_longlong_atomic_fetch_add +#define shmem_ctx_uint_atomic_fetch_add pshmem_ctx_uint_atomic_fetch_add +#define shmem_ctx_ulong_atomic_fetch_add pshmem_ctx_ulong_atomic_fetch_add +#define shmem_ctx_ulonglong_atomic_fetch_add pshmem_ctx_ulonglong_atomic_fetch_add +#define shmem_int_atomic_fetch_add pshmem_int_atomic_fetch_add +#define shmem_long_atomic_fetch_add pshmem_long_atomic_fetch_add +#define shmem_longlong_atomic_fetch_add pshmem_longlong_atomic_fetch_add +#define shmem_uint_atomic_fetch_add pshmem_uint_atomic_fetch_add +#define shmem_ulong_atomic_fetch_add pshmem_ulong_atomic_fetch_add +#define shmem_ulonglong_atomic_fetch_add pshmem_ulonglong_atomic_fetch_add +#define shmem_int_fadd pshmem_int_fadd +#define shmem_long_fadd pshmem_long_fadd +#define shmem_longlong_fadd pshmem_longlong_fadd +#define shmemx_int32_fadd pshmemx_int32_fadd +#define shmemx_int64_fadd pshmemx_int64_fadd /* Atomic Fetch&And */ +#define shmem_int_atomic_fetch_and pshmem_int_atomic_fetch_and +#define shmem_long_atomic_fetch_and pshmem_long_atomic_fetch_and +#define shmem_longlong_atomic_fetch_and pshmem_longlong_atomic_fetch_and #define shmem_uint_atomic_fetch_and pshmem_uint_atomic_fetch_and #define shmem_ulong_atomic_fetch_and pshmem_ulong_atomic_fetch_and #define shmem_ulonglong_atomic_fetch_and pshmem_ulonglong_atomic_fetch_and +#define shmem_ctx_int_atomic_fetch_and pshmem_ctx_int_atomic_fetch_and +#define shmem_ctx_long_atomic_fetch_and pshmem_ctx_long_atomic_fetch_and +#define shmem_ctx_longlong_atomic_fetch_and pshmem_ctx_longlong_atomic_fetch_and #define shmem_ctx_uint_atomic_fetch_and pshmem_ctx_uint_atomic_fetch_and #define shmem_ctx_ulong_atomic_fetch_and pshmem_ctx_ulong_atomic_fetch_and #define shmem_ctx_ulonglong_atomic_fetch_and pshmem_ctx_ulonglong_atomic_fetch_and @@ -390,9 +516,15 @@ #define shmemx_uint64_atomic_fetch_and pshmemx_uint64_atomic_fetch_and /* Atomic Fetch&Or */ +#define shmem_int_atomic_fetch_or pshmem_int_atomic_fetch_or +#define shmem_long_atomic_fetch_or pshmem_long_atomic_fetch_or +#define shmem_longlong_atomic_fetch_or pshmem_longlong_atomic_fetch_or #define shmem_uint_atomic_fetch_or pshmem_uint_atomic_fetch_or #define shmem_ulong_atomic_fetch_or pshmem_ulong_atomic_fetch_or #define shmem_ulonglong_atomic_fetch_or pshmem_ulonglong_atomic_fetch_or +#define shmem_ctx_int_atomic_fetch_or pshmem_ctx_int_atomic_fetch_or +#define shmem_ctx_long_atomic_fetch_or pshmem_ctx_long_atomic_fetch_or +#define shmem_ctx_longlong_atomic_fetch_or pshmem_ctx_longlong_atomic_fetch_or #define shmem_ctx_uint_atomic_fetch_or pshmem_ctx_uint_atomic_fetch_or #define shmem_ctx_ulong_atomic_fetch_or pshmem_ctx_ulong_atomic_fetch_or #define shmem_ctx_ulonglong_atomic_fetch_or pshmem_ctx_ulonglong_atomic_fetch_or @@ -402,9 +534,15 @@ #define shmemx_uint64_atomic_fetch_or pshmemx_uint64_atomic_fetch_or /* Atomic Fetch&Xor */ +#define shmem_int_atomic_fetch_xor pshmem_int_atomic_fetch_xor +#define shmem_long_atomic_fetch_xor pshmem_long_atomic_fetch_xor +#define shmem_longlong_atomic_fetch_xor pshmem_longlong_atomic_fetch_xor #define shmem_uint_atomic_fetch_xor pshmem_uint_atomic_fetch_xor #define shmem_ulong_atomic_fetch_xor pshmem_ulong_atomic_fetch_xor #define shmem_ulonglong_atomic_fetch_xor pshmem_ulonglong_atomic_fetch_xor +#define shmem_ctx_int_atomic_fetch_xor pshmem_ctx_int_atomic_fetch_xor +#define shmem_ctx_long_atomic_fetch_xor pshmem_ctx_long_atomic_fetch_xor +#define shmem_ctx_longlong_atomic_fetch_xor pshmem_ctx_longlong_atomic_fetch_xor #define shmem_ctx_uint_atomic_fetch_xor pshmem_ctx_uint_atomic_fetch_xor #define shmem_ctx_ulong_atomic_fetch_xor pshmem_ctx_ulong_atomic_fetch_xor #define shmem_ctx_ulonglong_atomic_fetch_xor pshmem_ctx_ulonglong_atomic_fetch_xor @@ -419,11 +557,17 @@ #define shmem_ctx_int_atomic_fetch pshmem_ctx_int_atomic_fetch #define shmem_ctx_long_atomic_fetch pshmem_ctx_long_atomic_fetch #define shmem_ctx_longlong_atomic_fetch pshmem_ctx_longlong_atomic_fetch +#define shmem_ctx_uint_atomic_fetch pshmem_ctx_uint_atomic_fetch +#define shmem_ctx_ulong_atomic_fetch pshmem_ctx_ulong_atomic_fetch +#define shmem_ctx_ulonglong_atomic_fetch pshmem_ctx_ulonglong_atomic_fetch #define shmem_double_atomic_fetch pshmem_double_atomic_fetch #define shmem_float_atomic_fetch pshmem_float_atomic_fetch #define shmem_int_atomic_fetch pshmem_int_atomic_fetch #define shmem_long_atomic_fetch pshmem_long_atomic_fetch #define shmem_longlong_atomic_fetch pshmem_longlong_atomic_fetch +#define shmem_uint_atomic_fetch pshmem_uint_atomic_fetch +#define shmem_ulong_atomic_fetch pshmem_ulong_atomic_fetch +#define shmem_ulonglong_atomic_fetch pshmem_ulonglong_atomic_fetch #define shmem_double_fetch pshmem_double_fetch #define shmem_float_fetch pshmem_float_fetch #define shmem_int_fetch pshmem_int_fetch @@ -436,6 +580,12 @@ #define shmem_ctx_int_atomic_fetch_inc pshmem_ctx_int_atomic_fetch_inc #define shmem_ctx_long_atomic_fetch_inc pshmem_ctx_long_atomic_fetch_inc #define shmem_ctx_longlong_atomic_fetch_inc pshmem_ctx_longlong_atomic_fetch_inc +#define shmem_ctx_uint_atomic_fetch_inc pshmem_ctx_uint_atomic_fetch_inc +#define shmem_ctx_ulong_atomic_fetch_inc pshmem_ctx_ulong_atomic_fetch_inc +#define shmem_ctx_ulonglong_atomic_fetch_inc pshmem_ctx_ulonglong_atomic_fetch_inc +#define shmem_uint_atomic_fetch_inc pshmem_uint_atomic_fetch_inc +#define shmem_ulong_atomic_fetch_inc pshmem_ulong_atomic_fetch_inc +#define shmem_ulonglong_atomic_fetch_inc pshmem_ulonglong_atomic_fetch_inc #define shmem_int_atomic_fetch_inc pshmem_int_atomic_fetch_inc #define shmem_long_atomic_fetch_inc pshmem_long_atomic_fetch_inc #define shmem_longlong_atomic_fetch_inc pshmem_longlong_atomic_fetch_inc @@ -449,9 +599,15 @@ #define shmem_ctx_int_atomic_add pshmem_ctx_int_atomic_add #define shmem_ctx_long_atomic_add pshmem_ctx_long_atomic_add #define shmem_ctx_longlong_atomic_add pshmem_ctx_longlong_atomic_add +#define shmem_ctx_uint_atomic_add pshmem_ctx_uint_atomic_add +#define shmem_ctx_ulong_atomic_add pshmem_ctx_ulong_atomic_add +#define shmem_ctx_ulonglong_atomic_add pshmem_ctx_ulonglong_atomic_add #define shmem_int_atomic_add pshmem_int_atomic_add #define shmem_long_atomic_add pshmem_long_atomic_add #define shmem_longlong_atomic_add pshmem_longlong_atomic_add +#define shmem_uint_atomic_add pshmem_uint_atomic_add +#define shmem_ulong_atomic_add pshmem_ulong_atomic_add +#define shmem_ulonglong_atomic_add pshmem_ulonglong_atomic_add #define shmem_int_add pshmem_int_add #define shmem_long_add pshmem_long_add #define shmem_longlong_add pshmem_longlong_add @@ -459,9 +615,15 @@ #define shmemx_int64_add pshmemx_int64_add /* Atomic And */ +#define shmem_int_atomic_and pshmem_int_atomic_and +#define shmem_long_atomic_and pshmem_long_atomic_and +#define shmem_longlong_atomic_and pshmem_longlong_atomic_and #define shmem_uint_atomic_and pshmem_uint_atomic_and #define shmem_ulong_atomic_and pshmem_ulong_atomic_and #define shmem_ulonglong_atomic_and pshmem_ulonglong_atomic_and +#define shmem_ctx_int_atomic_and pshmem_ctx_int_atomic_and +#define shmem_ctx_long_atomic_and pshmem_ctx_long_atomic_and +#define shmem_ctx_longlong_atomic_and pshmem_ctx_longlong_atomic_and #define shmem_ctx_uint_atomic_and pshmem_ctx_uint_atomic_and #define shmem_ctx_ulong_atomic_and pshmem_ctx_ulong_atomic_and #define shmem_ctx_ulonglong_atomic_and pshmem_ctx_ulonglong_atomic_and @@ -471,9 +633,15 @@ #define shmemx_uint64_atomic_and pshmemx_uint64_atomic_and /* Atomic Or */ +#define shmem_int_atomic_or pshmem_int_atomic_or +#define shmem_long_atomic_or pshmem_long_atomic_or +#define shmem_longlong_atomic_or pshmem_longlong_atomic_or #define shmem_uint_atomic_or pshmem_uint_atomic_or #define shmem_ulong_atomic_or pshmem_ulong_atomic_or #define shmem_ulonglong_atomic_or pshmem_ulonglong_atomic_or +#define shmem_ctx_int_atomic_or pshmem_ctx_int_atomic_or +#define shmem_ctx_long_atomic_or pshmem_ctx_long_atomic_or +#define shmem_ctx_longlong_atomic_or pshmem_ctx_longlong_atomic_or #define shmem_ctx_uint_atomic_or pshmem_ctx_uint_atomic_or #define shmem_ctx_ulong_atomic_or pshmem_ctx_ulong_atomic_or #define shmem_ctx_ulonglong_atomic_or pshmem_ctx_ulonglong_atomic_or @@ -483,9 +651,15 @@ #define shmemx_uint64_atomic_or pshmemx_uint64_atomic_or /* Atomic Xor */ +#define shmem_int_atomic_xor pshmem_int_atomic_xor +#define shmem_long_atomic_xor pshmem_long_atomic_xor +#define shmem_longlong_atomic_xor pshmem_longlong_atomic_xor #define shmem_uint_atomic_xor pshmem_uint_atomic_xor #define shmem_ulong_atomic_xor pshmem_ulong_atomic_xor #define shmem_ulonglong_atomic_xor pshmem_ulonglong_atomic_xor +#define shmem_ctx_int_atomic_xor pshmem_ctx_int_atomic_xor +#define shmem_ctx_long_atomic_xor pshmem_ctx_long_atomic_xor +#define shmem_ctx_longlong_atomic_xor pshmem_ctx_longlong_atomic_xor #define shmem_ctx_uint_atomic_xor pshmem_ctx_uint_atomic_xor #define shmem_ctx_ulong_atomic_xor pshmem_ctx_ulong_atomic_xor #define shmem_ctx_ulonglong_atomic_xor pshmem_ctx_ulonglong_atomic_xor @@ -498,9 +672,15 @@ #define shmem_ctx_int_atomic_inc pshmem_ctx_int_atomic_inc #define shmem_ctx_long_atomic_inc pshmem_ctx_long_atomic_inc #define shmem_ctx_longlong_atomic_inc pshmem_ctx_longlong_atomic_inc +#define shmem_ctx_uint_atomic_inc pshmem_ctx_uint_atomic_inc +#define shmem_ctx_ulong_atomic_inc pshmem_ctx_ulong_atomic_inc +#define shmem_ctx_ulonglong_atomic_inc pshmem_ctx_ulonglong_atomic_inc #define shmem_int_atomic_inc pshmem_int_atomic_inc #define shmem_long_atomic_inc pshmem_long_atomic_inc #define shmem_longlong_atomic_inc pshmem_longlong_atomic_inc +#define shmem_uint_atomic_inc pshmem_uint_atomic_inc +#define shmem_ulong_atomic_inc pshmem_ulong_atomic_inc +#define shmem_ulonglong_atomic_inc pshmem_ulonglong_atomic_inc #define shmem_int_inc pshmem_int_inc #define shmem_long_inc pshmem_long_inc #define shmem_longlong_inc pshmem_longlong_inc diff --git a/oshmem/shmem/c/shmem_add.c b/oshmem/shmem/c/shmem_add.c index 9ca5c62c770..f4ce217ab2a 100644 --- a/oshmem/shmem/c/shmem_add.c +++ b/oshmem/shmem/c/shmem_add.c @@ -63,9 +63,15 @@ #pragma weak shmem_ctx_int_atomic_add = pshmem_ctx_int_atomic_add #pragma weak shmem_ctx_long_atomic_add = pshmem_ctx_long_atomic_add #pragma weak shmem_ctx_longlong_atomic_add = pshmem_ctx_longlong_atomic_add +#pragma weak shmem_ctx_uint_atomic_add = pshmem_ctx_uint_atomic_add +#pragma weak shmem_ctx_ulong_atomic_add = pshmem_ctx_ulong_atomic_add +#pragma weak shmem_ctx_ulonglong_atomic_add = pshmem_ctx_ulonglong_atomic_add #pragma weak shmem_int_atomic_add = pshmem_int_atomic_add #pragma weak shmem_long_atomic_add = pshmem_long_atomic_add #pragma weak shmem_longlong_atomic_add = pshmem_longlong_atomic_add +#pragma weak shmem_uint_atomic_add = pshmem_uint_atomic_add +#pragma weak shmem_ulong_atomic_add = pshmem_ulong_atomic_add +#pragma weak shmem_ulonglong_atomic_add = pshmem_ulonglong_atomic_add #pragma weak shmem_int_add = pshmem_int_add #pragma weak shmem_long_add = pshmem_long_add #pragma weak shmem_longlong_add = pshmem_longlong_add @@ -74,12 +80,18 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +SHMEM_CTX_TYPE_ATOMIC_ADD(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_ADD(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_ADD(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_ATOMIC_ADD(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_ADD(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_ADD(_longlong, long long, shmem) SHMEM_TYPE_ATOMIC_ADD(_int, int, shmem) SHMEM_TYPE_ATOMIC_ADD(_long, long, shmem) SHMEM_TYPE_ATOMIC_ADD(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_ADD(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_ADD(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_ADD(_ulonglong, unsigned long long, shmem) /* deprecated APIs */ #define SHMEM_TYPE_ADD(type_name, type, prefix) \ diff --git a/oshmem/shmem/c/shmem_and.c b/oshmem/shmem/c/shmem_and.c index 2402a6c0f51..040f00c8bc7 100644 --- a/oshmem/shmem/c/shmem_and.c +++ b/oshmem/shmem/c/shmem_and.c @@ -25,9 +25,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_and = pshmem_int_atomic_and +#pragma weak shmem_long_atomic_and = pshmem_long_atomic_and +#pragma weak shmem_longlong_atomic_and = pshmem_longlong_atomic_and #pragma weak shmem_uint_atomic_and = pshmem_uint_atomic_and #pragma weak shmem_ulong_atomic_and = pshmem_ulong_atomic_and #pragma weak shmem_ulonglong_atomic_and = pshmem_ulonglong_atomic_and +#pragma weak shmem_ctx_int_atomic_and = pshmem_ctx_int_atomic_and +#pragma weak shmem_ctx_long_atomic_and = pshmem_ctx_long_atomic_and +#pragma weak shmem_ctx_longlong_atomic_and = pshmem_ctx_longlong_atomic_and #pragma weak shmem_ctx_uint_atomic_and = pshmem_ctx_uint_atomic_and #pragma weak shmem_ctx_ulong_atomic_and = pshmem_ctx_ulong_atomic_and #pragma weak shmem_ctx_ulonglong_atomic_and = pshmem_ctx_ulonglong_atomic_and @@ -38,9 +44,15 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +OSHMEM_TYPE_OP(int, int, shmem, and) +OSHMEM_TYPE_OP(long, long, shmem, and) +OSHMEM_TYPE_OP(longlong, long long, shmem, and) OSHMEM_TYPE_OP(uint, unsigned int, shmem, and) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, and) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, and) +OSHMEM_CTX_TYPE_OP(int, int, shmem, and) +OSHMEM_CTX_TYPE_OP(long, long, shmem, and) +OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, and) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, and) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, and) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, and) diff --git a/oshmem/shmem/c/shmem_cswap.c b/oshmem/shmem/c/shmem_cswap.c index 12ef8e4a042..9322e91d283 100644 --- a/oshmem/shmem/c/shmem_cswap.c +++ b/oshmem/shmem/c/shmem_cswap.c @@ -65,12 +65,18 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_ctx_uint_atomic_compare_swap = pshmem_ctx_uint_atomic_compare_swap +#pragma weak shmem_ctx_ulong_atomic_compare_swap = pshmem_ctx_ulong_atomic_compare_swap +#pragma weak shmem_ctx_ulonglong_atomic_compare_swap = pshmem_ctx_ulonglong_atomic_compare_swap #pragma weak shmem_ctx_int_atomic_compare_swap = pshmem_ctx_int_atomic_compare_swap #pragma weak shmem_ctx_long_atomic_compare_swap = pshmem_ctx_long_atomic_compare_swap #pragma weak shmem_ctx_longlong_atomic_compare_swap = pshmem_ctx_longlong_atomic_compare_swap #pragma weak shmem_int_atomic_compare_swap = pshmem_int_atomic_compare_swap #pragma weak shmem_long_atomic_compare_swap = pshmem_long_atomic_compare_swap #pragma weak shmem_longlong_atomic_compare_swap = pshmem_longlong_atomic_compare_swap +#pragma weak shmem_uint_atomic_compare_swap = pshmem_uint_atomic_compare_swap +#pragma weak shmem_ulong_atomic_compare_swap = pshmem_ulong_atomic_compare_swap +#pragma weak shmem_ulonglong_atomic_compare_swap = pshmem_ulonglong_atomic_compare_swap #pragma weak shmem_int_cswap = pshmem_int_cswap #pragma weak shmem_long_cswap = pshmem_long_cswap #pragma weak shmem_longlong_cswap = pshmem_longlong_cswap @@ -82,9 +88,15 @@ SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_COMPARE_SWAP(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_int, int, shmem) SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_long, long, shmem) SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_COMPARE_SWAP(_ulonglong, unsigned long long, shmem) /* deprecated APIs */ #define SHMEM_TYPE_CSWAP(type_name, type, prefix) \ diff --git a/oshmem/shmem/c/shmem_fadd.c b/oshmem/shmem/c/shmem_fadd.c index 16c59a4ada0..669b21f2a6a 100644 --- a/oshmem/shmem/c/shmem_fadd.c +++ b/oshmem/shmem/c/shmem_fadd.c @@ -67,9 +67,15 @@ #pragma weak shmem_ctx_int_atomic_fetch_add = pshmem_ctx_int_atomic_fetch_add #pragma weak shmem_ctx_long_atomic_fetch_add = pshmem_ctx_long_atomic_fetch_add #pragma weak shmem_ctx_longlong_atomic_fetch_add = pshmem_ctx_longlong_atomic_fetch_add +#pragma weak shmem_ctx_uint_atomic_fetch_add = pshmem_ctx_uint_atomic_fetch_add +#pragma weak shmem_ctx_ulong_atomic_fetch_add = pshmem_ctx_ulong_atomic_fetch_add +#pragma weak shmem_ctx_ulonglong_atomic_fetch_add = pshmem_ctx_ulonglong_atomic_fetch_add #pragma weak shmem_int_atomic_fetch_add = pshmem_int_atomic_fetch_add #pragma weak shmem_long_atomic_fetch_add = pshmem_long_atomic_fetch_add #pragma weak shmem_longlong_atomic_fetch_add = pshmem_longlong_atomic_fetch_add +#pragma weak shmem_uint_atomic_fetch_add = pshmem_uint_atomic_fetch_add +#pragma weak shmem_ulong_atomic_fetch_add = pshmem_ulong_atomic_fetch_add +#pragma weak shmem_ulonglong_atomic_fetch_add = pshmem_ulonglong_atomic_fetch_add #pragma weak shmem_int_fadd = pshmem_int_fadd #pragma weak shmem_long_fadd = pshmem_long_fadd #pragma weak shmem_longlong_fadd = pshmem_longlong_fadd @@ -81,9 +87,15 @@ SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_ADD(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_FETCH_ADD(_int, int, shmem) SHMEM_TYPE_ATOMIC_FETCH_ADD(_long, long, shmem) SHMEM_TYPE_ATOMIC_FETCH_ADD(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_FETCH_ADD(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_FETCH_ADD(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_FETCH_ADD(_ulonglong, unsigned long long, shmem) /* deprecated APIs */ #define SHMEM_TYPE_FADD(type_name, type, prefix) \ diff --git a/oshmem/shmem/c/shmem_fand.c b/oshmem/shmem/c/shmem_fand.c index 2b452a40520..57b1db280e8 100644 --- a/oshmem/shmem/c/shmem_fand.c +++ b/oshmem/shmem/c/shmem_fand.c @@ -27,9 +27,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_fetch_and = pshmem_int_atomic_fetch_and +#pragma weak shmem_long_atomic_fetch_and = pshmem_long_atomic_fetch_and +#pragma weak shmem_longlong_atomic_fetch_and = pshmem_longlong_atomic_fetch_and #pragma weak shmem_uint_atomic_fetch_and = pshmem_uint_atomic_fetch_and #pragma weak shmem_ulong_atomic_fetch_and = pshmem_ulong_atomic_fetch_and #pragma weak shmem_ulonglong_atomic_fetch_and = pshmem_ulonglong_atomic_fetch_and +#pragma weak shmem_ctx_int_atomic_fetch_and = pshmem_ctx_int_atomic_fetch_and +#pragma weak shmem_ctx_long_atomic_fetch_and = pshmem_ctx_long_atomic_fetch_and +#pragma weak shmem_ctx_longlong_atomic_fetch_and = pshmem_ctx_longlong_atomic_fetch_and #pragma weak shmem_ctx_uint_atomic_fetch_and = pshmem_ctx_uint_atomic_fetch_and #pragma weak shmem_ctx_ulong_atomic_fetch_and = pshmem_ctx_ulong_atomic_fetch_and #pragma weak shmem_ctx_ulonglong_atomic_fetch_and = pshmem_ctx_ulonglong_atomic_fetch_and @@ -42,9 +48,15 @@ unsigned int shmem_uint_atomic_fand(unsigned int *target, unsigned int value, int pe); +OSHMEM_TYPE_FOP(int, int, shmem, and) +OSHMEM_TYPE_FOP(long, long, shmem, and) +OSHMEM_TYPE_FOP(longlong, long long, shmem, and) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, and) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, and) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, and) +OSHMEM_CTX_TYPE_FOP(int, int, shmem, and) +OSHMEM_CTX_TYPE_FOP(long, long, shmem, and) +OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, and) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, and) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, and) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, and) diff --git a/oshmem/shmem/c/shmem_fetch.c b/oshmem/shmem/c/shmem_fetch.c index 95c688ea02e..38ddc051913 100644 --- a/oshmem/shmem/c/shmem_fetch.c +++ b/oshmem/shmem/c/shmem_fetch.c @@ -68,11 +68,17 @@ #pragma weak shmem_ctx_int_atomic_fetch = pshmem_ctx_int_atomic_fetch #pragma weak shmem_ctx_long_atomic_fetch = pshmem_ctx_long_atomic_fetch #pragma weak shmem_ctx_longlong_atomic_fetch = pshmem_ctx_longlong_atomic_fetch +#pragma weak shmem_ctx_uint_atomic_fetch = pshmem_ctx_uint_atomic_fetch +#pragma weak shmem_ctx_ulong_atomic_fetch = pshmem_ctx_ulong_atomic_fetch +#pragma weak shmem_ctx_ulonglong_atomic_fetch = pshmem_ctx_ulonglong_atomic_fetch #pragma weak shmem_ctx_double_atomic_fetch = pshmem_ctx_double_atomic_fetch #pragma weak shmem_ctx_float_atomic_fetch = pshmem_ctx_float_atomic_fetch #pragma weak shmem_int_atomic_fetch = pshmem_int_atomic_fetch #pragma weak shmem_long_atomic_fetch = pshmem_long_atomic_fetch #pragma weak shmem_longlong_atomic_fetch = pshmem_longlong_atomic_fetch +#pragma weak shmem_uint_atomic_fetch = pshmem_uint_atomic_fetch +#pragma weak shmem_ulong_atomic_fetch = pshmem_ulong_atomic_fetch +#pragma weak shmem_ulonglong_atomic_fetch = pshmem_ulonglong_atomic_fetch #pragma weak shmem_double_atomic_fetch = pshmem_double_atomic_fetch #pragma weak shmem_float_atomic_fetch = pshmem_float_atomic_fetch #pragma weak shmem_int_fetch = pshmem_int_fetch @@ -88,11 +94,17 @@ SHMEM_CTX_TYPE_ATOMIC_FETCH(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH(_double, double, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH(_float, float, shmem) SHMEM_TYPE_ATOMIC_FETCH(_int, int, shmem) SHMEM_TYPE_ATOMIC_FETCH(_long, long, shmem) SHMEM_TYPE_ATOMIC_FETCH(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_FETCH(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_FETCH(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_FETCH(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_FETCH(_double, double, shmem) SHMEM_TYPE_ATOMIC_FETCH(_float, float, shmem) diff --git a/oshmem/shmem/c/shmem_finc.c b/oshmem/shmem/c/shmem_finc.c index dc507797e23..8a1bb425efa 100644 --- a/oshmem/shmem/c/shmem_finc.c +++ b/oshmem/shmem/c/shmem_finc.c @@ -68,9 +68,15 @@ #pragma weak shmem_ctx_int_atomic_fetch_inc = pshmem_ctx_int_atomic_fetch_inc #pragma weak shmem_ctx_long_atomic_fetch_inc = pshmem_ctx_long_atomic_fetch_inc #pragma weak shmem_ctx_longlong_atomic_fetch_inc = pshmem_ctx_longlong_atomic_fetch_inc +#pragma weak shmem_ctx_uint_atomic_fetch_inc = pshmem_ctx_uint_atomic_fetch_inc +#pragma weak shmem_ctx_ulong_atomic_fetch_inc = pshmem_ctx_ulong_atomic_fetch_inc +#pragma weak shmem_ctx_ulonglong_atomic_fetch_inc = pshmem_ctx_ulonglong_atomic_fetch_inc #pragma weak shmem_int_atomic_fetch_inc = pshmem_int_atomic_fetch_inc #pragma weak shmem_long_atomic_fetch_inc = pshmem_long_atomic_fetch_inc #pragma weak shmem_longlong_atomic_fetch_inc = pshmem_longlong_atomic_fetch_inc +#pragma weak shmem_uint_atomic_fetch_inc = pshmem_uint_atomic_fetch_inc +#pragma weak shmem_ulong_atomic_fetch_inc = pshmem_ulong_atomic_fetch_inc +#pragma weak shmem_ulonglong_atomic_fetch_inc = pshmem_ulonglong_atomic_fetch_inc #pragma weak shmem_int_finc = pshmem_int_finc #pragma weak shmem_long_finc = pshmem_long_finc #pragma weak shmem_longlong_finc = pshmem_longlong_finc @@ -82,9 +88,15 @@ SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_FETCH_INC(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_FETCH_INC(_int, int, shmem) SHMEM_TYPE_ATOMIC_FETCH_INC(_long, long, shmem) SHMEM_TYPE_ATOMIC_FETCH_INC(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_FETCH_INC(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_FETCH_INC(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_FETCH_INC(_ulonglong, unsigned long long, shmem) /* deprecated APIs */ #define SHMEM_TYPE_FINC(type_name, type, prefix) \ diff --git a/oshmem/shmem/c/shmem_for.c b/oshmem/shmem/c/shmem_for.c index c30bef03b1c..71c5be3bfc3 100644 --- a/oshmem/shmem/c/shmem_for.c +++ b/oshmem/shmem/c/shmem_for.c @@ -27,9 +27,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_fetch_or = pshmem_int_atomic_fetch_or +#pragma weak shmem_long_atomic_fetch_or = pshmem_long_atomic_fetch_or +#pragma weak shmem_longlong_atomic_fetch_or = pshmem_longlong_atomic_fetch_or #pragma weak shmem_uint_atomic_fetch_or = pshmem_uint_atomic_fetch_or #pragma weak shmem_ulong_atomic_fetch_or = pshmem_ulong_atomic_fetch_or #pragma weak shmem_ulonglong_atomic_fetch_or = pshmem_ulonglong_atomic_fetch_or +#pragma weak shmem_ctx_int_atomic_fetch_or = pshmem_ctx_int_atomic_fetch_or +#pragma weak shmem_ctx_long_atomic_fetch_or = pshmem_ctx_long_atomic_fetch_or +#pragma weak shmem_ctx_longlong_atomic_fetch_or = pshmem_ctx_longlong_atomic_fetch_or #pragma weak shmem_ctx_uint_atomic_fetch_or = pshmem_ctx_uint_atomic_fetch_or #pragma weak shmem_ctx_ulong_atomic_fetch_or = pshmem_ctx_ulong_atomic_fetch_or #pragma weak shmem_ctx_ulonglong_atomic_fetch_or = pshmem_ctx_ulonglong_atomic_fetch_or @@ -40,9 +46,15 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +OSHMEM_TYPE_FOP(int, int, shmem, or) +OSHMEM_TYPE_FOP(long, long, shmem, or) +OSHMEM_TYPE_FOP(longlong, long long, shmem, or) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, or) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, or) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, or) +OSHMEM_CTX_TYPE_FOP(int, int, shmem, or) +OSHMEM_CTX_TYPE_FOP(long, long, shmem, or) +OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, or) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, or) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, or) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, or) diff --git a/oshmem/shmem/c/shmem_fxor.c b/oshmem/shmem/c/shmem_fxor.c index 413daca45cf..88375f65ba5 100644 --- a/oshmem/shmem/c/shmem_fxor.c +++ b/oshmem/shmem/c/shmem_fxor.c @@ -27,9 +27,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_fetch_xor = pshmem_int_atomic_fetch_xor +#pragma weak shmem_long_atomic_fetch_xor = pshmem_long_atomic_fetch_xor +#pragma weak shmem_longlong_atomic_fetch_xor = pshmem_longlong_atomic_fetch_xor #pragma weak shmem_uint_atomic_fetch_xor = pshmem_uint_atomic_fetch_xor #pragma weak shmem_ulong_atomic_fetch_xor = pshmem_ulong_atomic_fetch_xor #pragma weak shmem_ulonglong_atomic_fetch_xor = pshmem_ulonglong_atomic_fetch_xor +#pragma weak shmem_ctx_int_atomic_fetch_xor = pshmem_ctx_int_atomic_fetch_xor +#pragma weak shmem_ctx_long_atomic_fetch_xor = pshmem_ctx_long_atomic_fetch_xor +#pragma weak shmem_ctx_longlong_atomic_fetch_xor = pshmem_ctx_longlong_atomic_fetch_xor #pragma weak shmem_ctx_uint_atomic_fetch_xor = pshmem_ctx_uint_atomic_fetch_xor #pragma weak shmem_ctx_ulong_atomic_fetch_xor = pshmem_ctx_ulong_atomic_fetch_xor #pragma weak shmem_ctx_ulonglong_atomic_fetch_xor = pshmem_ctx_ulonglong_atomic_fetch_xor @@ -40,9 +46,15 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +OSHMEM_TYPE_FOP(int, int, shmem, xor) +OSHMEM_TYPE_FOP(long, long, shmem, xor) +OSHMEM_TYPE_FOP(longlong, long long, shmem, xor) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, xor) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, xor) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_CTX_TYPE_FOP(int, int, shmem, xor) +OSHMEM_CTX_TYPE_FOP(long, long, shmem, xor) +OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, xor) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, xor) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, xor) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, xor) diff --git a/oshmem/shmem/c/shmem_g.c b/oshmem/shmem/c/shmem_g.c index 7ab13913635..be4583877cd 100644 --- a/oshmem/shmem/c/shmem_g.c +++ b/oshmem/shmem/c/shmem_g.c @@ -63,6 +63,11 @@ #pragma weak shmem_ctx_int_g = pshmem_ctx_int_g #pragma weak shmem_ctx_long_g = pshmem_ctx_long_g #pragma weak shmem_ctx_longlong_g = pshmem_ctx_longlong_g +#pragma weak shmem_ctx_uchar_g = pshmem_ctx_uchar_g +#pragma weak shmem_ctx_ushort_g = pshmem_ctx_ushort_g +#pragma weak shmem_ctx_uint_g = pshmem_ctx_uint_g +#pragma weak shmem_ctx_ulong_g = pshmem_ctx_ulong_g +#pragma weak shmem_ctx_ulonglong_g = pshmem_ctx_ulonglong_g #pragma weak shmem_ctx_float_g = pshmem_ctx_float_g #pragma weak shmem_ctx_double_g = pshmem_ctx_double_g #pragma weak shmem_ctx_longdouble_g = pshmem_ctx_longdouble_g @@ -71,6 +76,11 @@ #pragma weak shmem_int_g = pshmem_int_g #pragma weak shmem_long_g = pshmem_long_g #pragma weak shmem_longlong_g = pshmem_longlong_g +#pragma weak shmem_uchar_g = pshmem_uchar_g +#pragma weak shmem_ushort_g = pshmem_ushort_g +#pragma weak shmem_uint_g = pshmem_uint_g +#pragma weak shmem_ulong_g = pshmem_ulong_g +#pragma weak shmem_ulonglong_g = pshmem_ulonglong_g #pragma weak shmem_float_g = pshmem_float_g #pragma weak shmem_double_g = pshmem_double_g #pragma weak shmem_longdouble_g = pshmem_longdouble_g @@ -85,6 +95,12 @@ SHMEM_CTX_TYPE_G(_short, short, shmem) SHMEM_CTX_TYPE_G(_int, int, shmem) SHMEM_CTX_TYPE_G(_long, long, shmem) SHMEM_CTX_TYPE_G(_longlong, long long, shmem) +SHMEM_CTX_TYPE_G(_schar, signed char, shmem) +SHMEM_CTX_TYPE_G(_uchar, unsigned char, shmem) +SHMEM_CTX_TYPE_G(_ushort, unsigned short, shmem) +SHMEM_CTX_TYPE_G(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_G(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_G(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_G(_float, float, shmem) SHMEM_CTX_TYPE_G(_double, double, shmem) SHMEM_CTX_TYPE_G(_longdouble, long double, shmem) @@ -93,6 +109,12 @@ SHMEM_TYPE_G(_short, short, shmem) SHMEM_TYPE_G(_int, int, shmem) SHMEM_TYPE_G(_long, long, shmem) SHMEM_TYPE_G(_longlong, long long, shmem) +SHMEM_TYPE_G(_schar, signed char, shmem) +SHMEM_TYPE_G(_uchar, unsigned char, shmem) +SHMEM_TYPE_G(_ushort, unsigned short, shmem) +SHMEM_TYPE_G(_uint, unsigned int, shmem) +SHMEM_TYPE_G(_ulong, unsigned long, shmem) +SHMEM_TYPE_G(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_G(_float, float, shmem) SHMEM_TYPE_G(_double, double, shmem) SHMEM_TYPE_G(_longdouble, long double, shmem) diff --git a/oshmem/shmem/c/shmem_get.c b/oshmem/shmem/c/shmem_get.c index 9537030138a..7ea009f6e09 100644 --- a/oshmem/shmem/c/shmem_get.c +++ b/oshmem/shmem/c/shmem_get.c @@ -62,6 +62,12 @@ #pragma weak shmem_ctx_int_get = pshmem_ctx_int_get #pragma weak shmem_ctx_long_get = pshmem_ctx_long_get #pragma weak shmem_ctx_longlong_get = pshmem_ctx_longlong_get +#pragma weak shmem_ctx_schar_get = pshmem_ctx_schar_get +#pragma weak shmem_ctx_uchar_get = pshmem_ctx_uchar_get +#pragma weak shmem_ctx_ushort_get = pshmem_ctx_ushort_get +#pragma weak shmem_ctx_uint_get = pshmem_ctx_uint_get +#pragma weak shmem_ctx_ulong_get = pshmem_ctx_ulong_get +#pragma weak shmem_ctx_ulonglong_get = pshmem_ctx_ulonglong_get #pragma weak shmem_ctx_float_get = pshmem_ctx_float_get #pragma weak shmem_ctx_double_get = pshmem_ctx_double_get #pragma weak shmem_ctx_longdouble_get = pshmem_ctx_longdouble_get @@ -70,6 +76,12 @@ #pragma weak shmem_int_get = pshmem_int_get #pragma weak shmem_long_get = pshmem_long_get #pragma weak shmem_longlong_get = pshmem_longlong_get +#pragma weak shmem_schar_get = pshmem_schar_get +#pragma weak shmem_uchar_get = pshmem_uchar_get +#pragma weak shmem_ushort_get = pshmem_ushort_get +#pragma weak shmem_uint_get = pshmem_uint_get +#pragma weak shmem_ulong_get = pshmem_ulong_get +#pragma weak shmem_ulonglong_get = pshmem_ulonglong_get #pragma weak shmem_float_get = pshmem_float_get #pragma weak shmem_double_get = pshmem_double_get #pragma weak shmem_longdouble_get = pshmem_longdouble_get @@ -93,6 +105,12 @@ SHMEM_CTX_TYPE_GET(_short, short) SHMEM_CTX_TYPE_GET(_int, int) SHMEM_CTX_TYPE_GET(_long, long) SHMEM_CTX_TYPE_GET(_longlong, long long) +SHMEM_CTX_TYPE_GET(_schar, signed char) +SHMEM_CTX_TYPE_GET(_uchar, unsigned char) +SHMEM_CTX_TYPE_GET(_ushort, unsigned short) +SHMEM_CTX_TYPE_GET(_uint, unsigned int) +SHMEM_CTX_TYPE_GET(_ulong, unsigned long) +SHMEM_CTX_TYPE_GET(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_GET(_float, float) SHMEM_CTX_TYPE_GET(_double, double) SHMEM_CTX_TYPE_GET(_longdouble, long double) @@ -101,6 +119,12 @@ SHMEM_TYPE_GET(_short, short) SHMEM_TYPE_GET(_int, int) SHMEM_TYPE_GET(_long, long) SHMEM_TYPE_GET(_longlong, long long) +SHMEM_TYPE_GET(_schar, signed char) +SHMEM_TYPE_GET(_uchar, unsigned char) +SHMEM_TYPE_GET(_ushort, unsigned short) +SHMEM_TYPE_GET(_uint, unsigned int) +SHMEM_TYPE_GET(_ulong, unsigned long) +SHMEM_TYPE_GET(_ulonglong, unsigned long long) SHMEM_TYPE_GET(_float, float) SHMEM_TYPE_GET(_double, double) SHMEM_TYPE_GET(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_get_nb.c b/oshmem/shmem/c/shmem_get_nb.c index 971223f91fe..093a97e059c 100644 --- a/oshmem/shmem/c/shmem_get_nb.c +++ b/oshmem/shmem/c/shmem_get_nb.c @@ -62,6 +62,12 @@ #pragma weak shmem_ctx_int_get_nbi = pshmem_ctx_int_get_nbi #pragma weak shmem_ctx_long_get_nbi = pshmem_ctx_long_get_nbi #pragma weak shmem_ctx_longlong_get_nbi = pshmem_ctx_longlong_get_nbi +#pragma weak shmem_ctx_schar_get_nbi = pshmem_ctx_schar_get_nbi +#pragma weak shmem_ctx_uchar_get_nbi = pshmem_ctx_uchar_get_nbi +#pragma weak shmem_ctx_ushort_get_nbi = pshmem_ctx_ushort_get_nbi +#pragma weak shmem_ctx_uint_get_nbi = pshmem_ctx_uint_get_nbi +#pragma weak shmem_ctx_ulong_get_nbi = pshmem_ctx_ulong_get_nbi +#pragma weak shmem_ctx_ulonglong_get_nbi = pshmem_ctx_ulonglong_get_nbi #pragma weak shmem_ctx_float_get_nbi = pshmem_ctx_float_get_nbi #pragma weak shmem_ctx_double_get_nbi = pshmem_ctx_double_get_nbi #pragma weak shmem_ctx_longdouble_get_nbi = pshmem_ctx_longdouble_get_nbi @@ -70,6 +76,12 @@ #pragma weak shmem_int_get_nbi = pshmem_int_get_nbi #pragma weak shmem_long_get_nbi = pshmem_long_get_nbi #pragma weak shmem_longlong_get_nbi = pshmem_longlong_get_nbi +#pragma weak shmem_schar_get_nbi = pshmem_schar_get_nbi +#pragma weak shmem_uchar_get_nbi = pshmem_uchar_get_nbi +#pragma weak shmem_ushort_get_nbi = pshmem_ushort_get_nbi +#pragma weak shmem_uint_get_nbi = pshmem_uint_get_nbi +#pragma weak shmem_ulong_get_nbi = pshmem_ulong_get_nbi +#pragma weak shmem_ulonglong_get_nbi = pshmem_ulonglong_get_nbi #pragma weak shmem_float_get_nbi = pshmem_float_get_nbi #pragma weak shmem_double_get_nbi = pshmem_double_get_nbi #pragma weak shmem_longdouble_get_nbi = pshmem_longdouble_get_nbi @@ -93,6 +105,12 @@ SHMEM_CTX_TYPE_GET_NB(_short, short) SHMEM_CTX_TYPE_GET_NB(_int, int) SHMEM_CTX_TYPE_GET_NB(_long, long) SHMEM_CTX_TYPE_GET_NB(_longlong, long long) +SHMEM_CTX_TYPE_GET_NB(_schar, signed char) +SHMEM_CTX_TYPE_GET_NB(_uchar, unsigned char) +SHMEM_CTX_TYPE_GET_NB(_ushort, unsigned short) +SHMEM_CTX_TYPE_GET_NB(_uint, unsigned int) +SHMEM_CTX_TYPE_GET_NB(_ulong, unsigned long) +SHMEM_CTX_TYPE_GET_NB(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_GET_NB(_float, float) SHMEM_CTX_TYPE_GET_NB(_double, double) SHMEM_CTX_TYPE_GET_NB(_longdouble, long double) @@ -101,6 +119,12 @@ SHMEM_TYPE_GET_NB(_short, short) SHMEM_TYPE_GET_NB(_int, int) SHMEM_TYPE_GET_NB(_long, long) SHMEM_TYPE_GET_NB(_longlong, long long) +SHMEM_TYPE_GET_NB(_schar, signed char) +SHMEM_TYPE_GET_NB(_uchar, unsigned char) +SHMEM_TYPE_GET_NB(_ushort, unsigned short) +SHMEM_TYPE_GET_NB(_uint, unsigned int) +SHMEM_TYPE_GET_NB(_ulong, unsigned long) +SHMEM_TYPE_GET_NB(_ulonglong, unsigned long long) SHMEM_TYPE_GET_NB(_float, float) SHMEM_TYPE_GET_NB(_double, double) SHMEM_TYPE_GET_NB(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_iget.c b/oshmem/shmem/c/shmem_iget.c index 300d3c310e6..f570a88db9f 100644 --- a/oshmem/shmem/c/shmem_iget.c +++ b/oshmem/shmem/c/shmem_iget.c @@ -67,6 +67,12 @@ #pragma weak shmem_ctx_int_iget = pshmem_ctx_int_iget #pragma weak shmem_ctx_long_iget = pshmem_ctx_long_iget #pragma weak shmem_ctx_longlong_iget = pshmem_ctx_longlong_iget +#pragma weak shmem_ctx_schar_iget = pshmem_ctx_schar_iget +#pragma weak shmem_ctx_uchar_iget = pshmem_ctx_uchar_iget +#pragma weak shmem_ctx_ushort_iget = pshmem_ctx_ushort_iget +#pragma weak shmem_ctx_uint_iget = pshmem_ctx_uint_iget +#pragma weak shmem_ctx_ulong_iget = pshmem_ctx_ulong_iget +#pragma weak shmem_ctx_ulonglong_iget = pshmem_ctx_ulonglong_iget #pragma weak shmem_ctx_float_iget = pshmem_ctx_float_iget #pragma weak shmem_ctx_double_iget = pshmem_ctx_double_iget #pragma weak shmem_ctx_longdouble_iget = pshmem_ctx_longdouble_iget @@ -75,6 +81,12 @@ #pragma weak shmem_int_iget = pshmem_int_iget #pragma weak shmem_long_iget = pshmem_long_iget #pragma weak shmem_longlong_iget = pshmem_longlong_iget +#pragma weak shmem_schar_iget = pshmem_schar_iget +#pragma weak shmem_uchar_iget = pshmem_uchar_iget +#pragma weak shmem_ushort_iget = pshmem_ushort_iget +#pragma weak shmem_uint_iget = pshmem_uint_iget +#pragma weak shmem_ulong_iget = pshmem_ulong_iget +#pragma weak shmem_ulonglong_iget = pshmem_ulonglong_iget #pragma weak shmem_float_iget = pshmem_float_iget #pragma weak shmem_double_iget = pshmem_double_iget #pragma weak shmem_longdouble_iget = pshmem_longdouble_iget @@ -96,6 +108,12 @@ SHMEM_CTX_TYPE_IGET(_short, short) SHMEM_CTX_TYPE_IGET(_int, int) SHMEM_CTX_TYPE_IGET(_long, long) SHMEM_CTX_TYPE_IGET(_longlong, long long) +SHMEM_CTX_TYPE_IGET(_schar, signed char) +SHMEM_CTX_TYPE_IGET(_uchar, unsigned char) +SHMEM_CTX_TYPE_IGET(_ushort, unsigned short) +SHMEM_CTX_TYPE_IGET(_uint, unsigned int) +SHMEM_CTX_TYPE_IGET(_ulong, unsigned long) +SHMEM_CTX_TYPE_IGET(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_IGET(_float, float) SHMEM_CTX_TYPE_IGET(_double, double) SHMEM_CTX_TYPE_IGET(_longdouble, long double) @@ -104,6 +122,12 @@ SHMEM_TYPE_IGET(_short, short) SHMEM_TYPE_IGET(_int, int) SHMEM_TYPE_IGET(_long, long) SHMEM_TYPE_IGET(_longlong, long long) +SHMEM_TYPE_IGET(_schar, signed char) +SHMEM_TYPE_IGET(_uchar, unsigned char) +SHMEM_TYPE_IGET(_ushort, unsigned short) +SHMEM_TYPE_IGET(_uint, unsigned int) +SHMEM_TYPE_IGET(_ulong, unsigned long) +SHMEM_TYPE_IGET(_ulonglong, unsigned long long) SHMEM_TYPE_IGET(_float, float) SHMEM_TYPE_IGET(_double, double) SHMEM_TYPE_IGET(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_inc.c b/oshmem/shmem/c/shmem_inc.c index f3e022d3b60..0701609d5bf 100644 --- a/oshmem/shmem/c/shmem_inc.c +++ b/oshmem/shmem/c/shmem_inc.c @@ -63,9 +63,15 @@ #pragma weak shmem_ctx_int_atomic_inc = pshmem_ctx_int_atomic_inc #pragma weak shmem_ctx_long_atomic_inc = pshmem_ctx_long_atomic_inc #pragma weak shmem_ctx_longlong_atomic_inc = pshmem_ctx_longlong_atomic_inc +#pragma weak shmem_ctx_uint_atomic_inc = pshmem_ctx_uint_atomic_inc +#pragma weak shmem_ctx_ulong_atomic_inc = pshmem_ctx_ulong_atomic_inc +#pragma weak shmem_ctx_ulonglong_atomic_inc = pshmem_ctx_ulonglong_atomic_inc #pragma weak shmem_int_atomic_inc = pshmem_int_atomic_inc #pragma weak shmem_long_atomic_inc = pshmem_long_atomic_inc #pragma weak shmem_longlong_atomic_inc = pshmem_longlong_atomic_inc +#pragma weak shmem_uint_atomic_inc = pshmem_uint_atomic_inc +#pragma weak shmem_ulong_atomic_inc = pshmem_ulong_atomic_inc +#pragma weak shmem_ulonglong_atomic_inc = pshmem_ulonglong_atomic_inc #pragma weak shmem_int_inc = pshmem_int_inc #pragma weak shmem_long_inc = pshmem_long_inc #pragma weak shmem_longlong_inc = pshmem_longlong_inc @@ -77,14 +83,20 @@ SHMEM_CTX_TYPE_ATOMIC_INC(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_INC(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_INC(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_INC(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_INC(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_INC(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_INC(_int, int, shmem) SHMEM_TYPE_ATOMIC_INC(_long, long, shmem) SHMEM_TYPE_ATOMIC_INC(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_INC(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_INC(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_INC(_ulonglong, unsigned long long, shmem) #define SHMEM_TYPE_INC(type_name, type, prefix) \ void prefix##type_name##_inc(type *target, int pe) \ { \ - DO_SHMEM_TYPE_ATOMIC_INC(oshmem_ctx_default, type_name, \ + DO_SHMEM_TYPE_ATOMIC_INC(oshmem_ctx_default, type_name, \ type, target, pe); \ return ; \ } diff --git a/oshmem/shmem/c/shmem_iput.c b/oshmem/shmem/c/shmem_iput.c index 9b0137b1987..2eb492c3aef 100644 --- a/oshmem/shmem/c/shmem_iput.c +++ b/oshmem/shmem/c/shmem_iput.c @@ -68,6 +68,12 @@ #pragma weak shmem_ctx_int_iput = pshmem_ctx_int_iput #pragma weak shmem_ctx_long_iput = pshmem_ctx_long_iput #pragma weak shmem_ctx_longlong_iput = pshmem_ctx_longlong_iput +#pragma weak shmem_ctx_schar_iput = pshmem_ctx_schar_iput +#pragma weak shmem_ctx_uchar_iput = pshmem_ctx_uchar_iput +#pragma weak shmem_ctx_ushort_iput = pshmem_ctx_ushort_iput +#pragma weak shmem_ctx_uint_iput = pshmem_ctx_uint_iput +#pragma weak shmem_ctx_ulong_iput = pshmem_ctx_ulong_iput +#pragma weak shmem_ctx_ulonglong_iput = pshmem_ctx_ulonglong_iput #pragma weak shmem_ctx_float_iput = pshmem_ctx_float_iput #pragma weak shmem_ctx_double_iput = pshmem_ctx_double_iput #pragma weak shmem_ctx_longdouble_iput = pshmem_ctx_longdouble_iput @@ -76,6 +82,12 @@ #pragma weak shmem_int_iput = pshmem_int_iput #pragma weak shmem_long_iput = pshmem_long_iput #pragma weak shmem_longlong_iput = pshmem_longlong_iput +#pragma weak shmem_schar_iput = pshmem_schar_iput +#pragma weak shmem_uchar_iput = pshmem_uchar_iput +#pragma weak shmem_ushort_iput = pshmem_ushort_iput +#pragma weak shmem_uint_iput = pshmem_uint_iput +#pragma weak shmem_ulong_iput = pshmem_ulong_iput +#pragma weak shmem_ulonglong_iput = pshmem_ulonglong_iput #pragma weak shmem_float_iput = pshmem_float_iput #pragma weak shmem_double_iput = pshmem_double_iput #pragma weak shmem_longdouble_iput = pshmem_longdouble_iput @@ -97,6 +109,12 @@ SHMEM_CTX_TYPE_IPUT(_short, short) SHMEM_CTX_TYPE_IPUT(_int, int) SHMEM_CTX_TYPE_IPUT(_long, long) SHMEM_CTX_TYPE_IPUT(_longlong, long long) +SHMEM_CTX_TYPE_IPUT(_schar, signed char) +SHMEM_CTX_TYPE_IPUT(_uchar, unsigned char) +SHMEM_CTX_TYPE_IPUT(_ushort, unsigned short) +SHMEM_CTX_TYPE_IPUT(_uint, unsigned int) +SHMEM_CTX_TYPE_IPUT(_ulong, unsigned long) +SHMEM_CTX_TYPE_IPUT(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_IPUT(_float, float) SHMEM_CTX_TYPE_IPUT(_double, double) SHMEM_CTX_TYPE_IPUT(_longdouble, long double) @@ -105,6 +123,12 @@ SHMEM_TYPE_IPUT(_short, short) SHMEM_TYPE_IPUT(_int, int) SHMEM_TYPE_IPUT(_long, long) SHMEM_TYPE_IPUT(_longlong, long long) +SHMEM_TYPE_IPUT(_schar, signed char) +SHMEM_TYPE_IPUT(_uchar, unsigned char) +SHMEM_TYPE_IPUT(_ushort, unsigned short) +SHMEM_TYPE_IPUT(_uint, unsigned int) +SHMEM_TYPE_IPUT(_ulong, unsigned long) +SHMEM_TYPE_IPUT(_ulonglong, unsigned long long) SHMEM_TYPE_IPUT(_float, float) SHMEM_TYPE_IPUT(_double, double) SHMEM_TYPE_IPUT(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_or.c b/oshmem/shmem/c/shmem_or.c index 1ae67efbc60..8e3ddf4a34f 100644 --- a/oshmem/shmem/c/shmem_or.c +++ b/oshmem/shmem/c/shmem_or.c @@ -25,9 +25,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_or = pshmem_int_atomic_or +#pragma weak shmem_long_atomic_or = pshmem_long_atomic_or +#pragma weak shmem_longlong_atomic_or = pshmem_longlong_atomic_or #pragma weak shmem_uint_atomic_or = pshmem_uint_atomic_or #pragma weak shmem_ulong_atomic_or = pshmem_ulong_atomic_or #pragma weak shmem_ulonglong_atomic_or = pshmem_ulonglong_atomic_or +#pragma weak shmem_ctx_int_atomic_or = pshmem_ctx_int_atomic_or +#pragma weak shmem_ctx_long_atomic_or = pshmem_ctx_long_atomic_or +#pragma weak shmem_ctx_longlong_atomic_or = pshmem_ctx_longlong_atomic_or #pragma weak shmem_ctx_uint_atomic_or = pshmem_ctx_uint_atomic_or #pragma weak shmem_ctx_ulong_atomic_or = pshmem_ctx_ulong_atomic_or #pragma weak shmem_ctx_ulonglong_atomic_or = pshmem_ctx_ulonglong_atomic_or @@ -38,9 +44,15 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +OSHMEM_TYPE_OP(int, int, shmem, or) +OSHMEM_TYPE_OP(long, long, shmem, or) +OSHMEM_TYPE_OP(longlong, long long, shmem, or) OSHMEM_TYPE_OP(uint, unsigned int, shmem, or) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, or) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, or) +OSHMEM_CTX_TYPE_OP(int, int, shmem, or) +OSHMEM_CTX_TYPE_OP(long, long, shmem, or) +OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, or) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, or) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, or) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, or) diff --git a/oshmem/shmem/c/shmem_p.c b/oshmem/shmem/c/shmem_p.c index 2f38b32cb34..2df7c737989 100644 --- a/oshmem/shmem/c/shmem_p.c +++ b/oshmem/shmem/c/shmem_p.c @@ -64,6 +64,12 @@ #pragma weak shmem_ctx_int_p = pshmem_ctx_int_p #pragma weak shmem_ctx_long_p = pshmem_ctx_long_p #pragma weak shmem_ctx_longlong_p = pshmem_ctx_longlong_p +#pragma weak shmem_ctx_schar_p = pshmem_ctx_schar_p +#pragma weak shmem_ctx_uchar_p = pshmem_ctx_uchar_p +#pragma weak shmem_ctx_ushort_p = pshmem_ctx_ushort_p +#pragma weak shmem_ctx_uint_p = pshmem_ctx_uint_p +#pragma weak shmem_ctx_ulong_p = pshmem_ctx_ulong_p +#pragma weak shmem_ctx_ulonglong_p = pshmem_ctx_ulonglong_p #pragma weak shmem_ctx_float_p = pshmem_ctx_float_p #pragma weak shmem_ctx_double_p = pshmem_ctx_double_p #pragma weak shmem_ctx_longdouble_p = pshmem_ctx_longdouble_p @@ -72,6 +78,12 @@ #pragma weak shmem_int_p = pshmem_int_p #pragma weak shmem_long_p = pshmem_long_p #pragma weak shmem_longlong_p = pshmem_longlong_p +#pragma weak shmem_schar_p = pshmem_schar_p +#pragma weak shmem_uchar_p = pshmem_uchar_p +#pragma weak shmem_ushort_p = pshmem_ushort_p +#pragma weak shmem_uint_p = pshmem_uint_p +#pragma weak shmem_ulong_p = pshmem_ulong_p +#pragma weak shmem_ulonglong_p = pshmem_ulonglong_p #pragma weak shmem_float_p = pshmem_float_p #pragma weak shmem_double_p = pshmem_double_p #pragma weak shmem_longdouble_p = pshmem_longdouble_p @@ -86,6 +98,12 @@ SHMEM_CTX_TYPE_P(_short, short, shmem) SHMEM_CTX_TYPE_P(_int, int, shmem) SHMEM_CTX_TYPE_P(_long, long, shmem) SHMEM_CTX_TYPE_P(_longlong, long long, shmem) +SHMEM_CTX_TYPE_P(_schar, signed char, shmem) +SHMEM_CTX_TYPE_P(_uchar, unsigned char, shmem) +SHMEM_CTX_TYPE_P(_ushort, unsigned short, shmem) +SHMEM_CTX_TYPE_P(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_P(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_P(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_P(_float, float, shmem) SHMEM_CTX_TYPE_P(_double, double, shmem) SHMEM_CTX_TYPE_P(_longdouble, long double, shmem) @@ -94,6 +112,12 @@ SHMEM_TYPE_P(_short, short, shmem) SHMEM_TYPE_P(_int, int, shmem) SHMEM_TYPE_P(_long, long, shmem) SHMEM_TYPE_P(_longlong, long long, shmem) +SHMEM_TYPE_P(_schar, signed char, shmem) +SHMEM_TYPE_P(_uchar, unsigned char, shmem) +SHMEM_TYPE_P(_ushort, unsigned short, shmem) +SHMEM_TYPE_P(_uint, unsigned int, shmem) +SHMEM_TYPE_P(_ulong, unsigned long, shmem) +SHMEM_TYPE_P(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_P(_float, float, shmem) SHMEM_TYPE_P(_double, double, shmem) SHMEM_TYPE_P(_longdouble, long double, shmem) diff --git a/oshmem/shmem/c/shmem_put.c b/oshmem/shmem/c/shmem_put.c index c734409ea70..ad829131f31 100644 --- a/oshmem/shmem/c/shmem_put.c +++ b/oshmem/shmem/c/shmem_put.c @@ -65,6 +65,12 @@ #pragma weak shmem_ctx_int_put = pshmem_ctx_int_put #pragma weak shmem_ctx_long_put = pshmem_ctx_long_put #pragma weak shmem_ctx_longlong_put = pshmem_ctx_longlong_put +#pragma weak shmem_ctx_schar_put = pshmem_ctx_schar_put +#pragma weak shmem_ctx_uchar_put = pshmem_ctx_uchar_put +#pragma weak shmem_ctx_ushort_put = pshmem_ctx_ushort_put +#pragma weak shmem_ctx_uint_put = pshmem_ctx_uint_put +#pragma weak shmem_ctx_ulong_put = pshmem_ctx_ulong_put +#pragma weak shmem_ctx_ulonglong_put = pshmem_ctx_ulonglong_put #pragma weak shmem_ctx_float_put = pshmem_ctx_float_put #pragma weak shmem_ctx_double_put = pshmem_ctx_double_put #pragma weak shmem_ctx_longdouble_put = pshmem_ctx_longdouble_put @@ -73,6 +79,12 @@ #pragma weak shmem_int_put = pshmem_int_put #pragma weak shmem_long_put = pshmem_long_put #pragma weak shmem_longlong_put = pshmem_longlong_put +#pragma weak shmem_schar_put = pshmem_schar_put +#pragma weak shmem_uchar_put = pshmem_uchar_put +#pragma weak shmem_ushort_put = pshmem_ushort_put +#pragma weak shmem_uint_put = pshmem_uint_put +#pragma weak shmem_ulong_put = pshmem_ulong_put +#pragma weak shmem_ulonglong_put = pshmem_ulonglong_put #pragma weak shmem_float_put = pshmem_float_put #pragma weak shmem_double_put = pshmem_double_put #pragma weak shmem_longdouble_put = pshmem_longdouble_put @@ -96,6 +108,12 @@ SHMEM_CTX_TYPE_PUT(_short, short) SHMEM_CTX_TYPE_PUT(_int, int) SHMEM_CTX_TYPE_PUT(_long, long) SHMEM_CTX_TYPE_PUT(_longlong, long long) +SHMEM_CTX_TYPE_PUT(_schar, signed char) +SHMEM_CTX_TYPE_PUT(_uchar, unsigned char) +SHMEM_CTX_TYPE_PUT(_ushort, unsigned short) +SHMEM_CTX_TYPE_PUT(_uint, unsigned int) +SHMEM_CTX_TYPE_PUT(_ulong, unsigned long) +SHMEM_CTX_TYPE_PUT(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_PUT(_float, float) SHMEM_CTX_TYPE_PUT(_double, double) SHMEM_CTX_TYPE_PUT(_longdouble, long double) @@ -104,6 +122,12 @@ SHMEM_TYPE_PUT(_short, short) SHMEM_TYPE_PUT(_int, int) SHMEM_TYPE_PUT(_long, long) SHMEM_TYPE_PUT(_longlong, long long) +SHMEM_TYPE_PUT(_schar, signed char) +SHMEM_TYPE_PUT(_uchar, unsigned char) +SHMEM_TYPE_PUT(_ushort, unsigned short) +SHMEM_TYPE_PUT(_uint, unsigned int) +SHMEM_TYPE_PUT(_ulong, unsigned long) +SHMEM_TYPE_PUT(_ulonglong, unsigned long long) SHMEM_TYPE_PUT(_float, float) SHMEM_TYPE_PUT(_double, double) SHMEM_TYPE_PUT(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_put_nb.c b/oshmem/shmem/c/shmem_put_nb.c index eb422ad6762..27926f90068 100644 --- a/oshmem/shmem/c/shmem_put_nb.c +++ b/oshmem/shmem/c/shmem_put_nb.c @@ -69,6 +69,12 @@ #pragma weak shmem_int_put_nbi = pshmem_int_put_nbi #pragma weak shmem_long_put_nbi = pshmem_long_put_nbi #pragma weak shmem_longlong_put_nbi = pshmem_longlong_put_nbi +#pragma weak shmem_schar_put_nbi = pshmem_schar_put_nbi +#pragma weak shmem_uchar_put_nbi = pshmem_uchar_put_nbi +#pragma weak shmem_ushort_put_nbi = pshmem_ushort_put_nbi +#pragma weak shmem_uint_put_nbi = pshmem_uint_put_nbi +#pragma weak shmem_ulong_put_nbi = pshmem_ulong_put_nbi +#pragma weak shmem_ulonglong_put_nbi = pshmem_ulonglong_put_nbi #pragma weak shmem_float_put_nbi = pshmem_float_put_nbi #pragma weak shmem_double_put_nbi = pshmem_double_put_nbi #pragma weak shmem_longdouble_put_nbi = pshmem_longdouble_put_nbi @@ -83,6 +89,12 @@ #pragma weak shmem_ctx_int_put_nbi = pshmem_ctx_int_put_nbi #pragma weak shmem_ctx_long_put_nbi = pshmem_ctx_long_put_nbi #pragma weak shmem_ctx_longlong_put_nbi = pshmem_ctx_longlong_put_nbi +#pragma weak shmem_ctx_schar_put_nbi = pshmem_ctx_schar_put_nbi +#pragma weak shmem_ctx_uchar_put_nbi = pshmem_ctx_uchar_put_nbi +#pragma weak shmem_ctx_ushort_put_nbi = pshmem_ctx_ushort_put_nbi +#pragma weak shmem_ctx_uint_put_nbi = pshmem_ctx_uint_put_nbi +#pragma weak shmem_ctx_ulong_put_nbi = pshmem_ctx_ulong_put_nbi +#pragma weak shmem_ctx_ulonglong_put_nbi = pshmem_ctx_ulonglong_put_nbi #pragma weak shmem_ctx_float_put_nbi = pshmem_ctx_float_put_nbi #pragma weak shmem_ctx_double_put_nbi = pshmem_ctx_double_put_nbi #pragma weak shmem_ctx_longdouble_put_nbi = pshmem_ctx_longdouble_put_nbi @@ -100,6 +112,12 @@ SHMEM_CTX_TYPE_PUT_NB(_short, short) SHMEM_CTX_TYPE_PUT_NB(_int, int) SHMEM_CTX_TYPE_PUT_NB(_long, long) SHMEM_CTX_TYPE_PUT_NB(_longlong, long long) +SHMEM_CTX_TYPE_PUT_NB(_schar, signed char) +SHMEM_CTX_TYPE_PUT_NB(_uchar, unsigned char) +SHMEM_CTX_TYPE_PUT_NB(_ushort, unsigned short) +SHMEM_CTX_TYPE_PUT_NB(_uint, unsigned int) +SHMEM_CTX_TYPE_PUT_NB(_ulong, unsigned long) +SHMEM_CTX_TYPE_PUT_NB(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_PUT_NB(_float, float) SHMEM_CTX_TYPE_PUT_NB(_double, double) SHMEM_CTX_TYPE_PUT_NB(_longdouble, long double) @@ -108,6 +126,12 @@ SHMEM_TYPE_PUT_NB(_short, short) SHMEM_TYPE_PUT_NB(_int, int) SHMEM_TYPE_PUT_NB(_long, long) SHMEM_TYPE_PUT_NB(_longlong, long long) +SHMEM_TYPE_PUT_NB(_schar, signed char) +SHMEM_TYPE_PUT_NB(_uchar, unsigned char) +SHMEM_TYPE_PUT_NB(_ushort, unsigned short) +SHMEM_TYPE_PUT_NB(_uint, unsigned int) +SHMEM_TYPE_PUT_NB(_ulong, unsigned long) +SHMEM_TYPE_PUT_NB(_ulonglong, unsigned long long) SHMEM_TYPE_PUT_NB(_float, float) SHMEM_TYPE_PUT_NB(_double, double) SHMEM_TYPE_PUT_NB(_longdouble, long double) diff --git a/oshmem/shmem/c/shmem_set.c b/oshmem/shmem/c/shmem_set.c index 7c9df841f3a..78503dc66b4 100644 --- a/oshmem/shmem/c/shmem_set.c +++ b/oshmem/shmem/c/shmem_set.c @@ -62,11 +62,17 @@ #pragma weak shmem_ctx_int_atomic_set = pshmem_ctx_int_atomic_set #pragma weak shmem_ctx_long_atomic_set = pshmem_ctx_long_atomic_set #pragma weak shmem_ctx_longlong_atomic_set = pshmem_ctx_longlong_atomic_set +#pragma weak shmem_ctx_uint_atomic_set = pshmem_ctx_uint_atomic_set +#pragma weak shmem_ctx_ulong_atomic_set = pshmem_ctx_ulong_atomic_set +#pragma weak shmem_ctx_ulonglong_atomic_set = pshmem_ctx_ulonglong_atomic_set #pragma weak shmem_ctx_float_atomic_set = pshmem_ctx_float_atomic_set #pragma weak shmem_ctx_double_atomic_set = pshmem_ctx_double_atomic_set #pragma weak shmem_int_atomic_set = pshmem_int_atomic_set #pragma weak shmem_long_atomic_set = pshmem_long_atomic_set #pragma weak shmem_longlong_atomic_set = pshmem_longlong_atomic_set +#pragma weak shmem_uint_atomic_set = pshmem_uint_atomic_set +#pragma weak shmem_ulong_atomic_set = pshmem_ulong_atomic_set +#pragma weak shmem_ulonglong_atomic_set = pshmem_ulonglong_atomic_set #pragma weak shmem_float_atomic_set = pshmem_float_atomic_set #pragma weak shmem_double_atomic_set = pshmem_double_atomic_set #pragma weak shmem_int_set = pshmem_int_set @@ -82,11 +88,17 @@ SHMEM_CTX_TYPE_ATOMIC_SET(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_SET(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_SET(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_SET(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_SET(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_SET(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_ATOMIC_SET(_float, float, shmem) SHMEM_CTX_TYPE_ATOMIC_SET(_double, double, shmem) SHMEM_TYPE_ATOMIC_SET(_int, int, shmem) SHMEM_TYPE_ATOMIC_SET(_long, long, shmem) SHMEM_TYPE_ATOMIC_SET(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_SET(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_SET(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_SET(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_SET(_float, float, shmem) SHMEM_TYPE_ATOMIC_SET(_double, double, shmem) diff --git a/oshmem/shmem/c/shmem_swap.c b/oshmem/shmem/c/shmem_swap.c index 5ee0e1e949c..27b46a4e0f6 100644 --- a/oshmem/shmem/c/shmem_swap.c +++ b/oshmem/shmem/c/shmem_swap.c @@ -65,11 +65,17 @@ #pragma weak shmem_ctx_int_atomic_swap = pshmem_ctx_int_atomic_swap #pragma weak shmem_ctx_long_atomic_swap = pshmem_ctx_long_atomic_swap #pragma weak shmem_ctx_longlong_atomic_swap = pshmem_ctx_longlong_atomic_swap +#pragma weak shmem_ctx_uint_atomic_swap = pshmem_ctx_uint_atomic_swap +#pragma weak shmem_ctx_ulong_atomic_swap = pshmem_ctx_ulong_atomic_swap +#pragma weak shmem_ctx_ulonglong_atomic_swap = pshmem_ctx_ulonglong_atomic_swap #pragma weak shmem_ctx_float_atomic_swap = pshmem_ctx_float_atomic_swap #pragma weak shmem_ctx_double_atomic_swap = pshmem_ctx_double_atomic_swap #pragma weak shmem_int_atomic_swap = pshmem_int_atomic_swap #pragma weak shmem_long_atomic_swap = pshmem_long_atomic_swap #pragma weak shmem_longlong_atomic_swap = pshmem_longlong_atomic_swap +#pragma weak shmem_uint_atomic_swap = pshmem_uint_atomic_swap +#pragma weak shmem_ulong_atomic_swap = pshmem_ulong_atomic_swap +#pragma weak shmem_ulonglong_atomic_swap = pshmem_ulonglong_atomic_swap #pragma weak shmem_float_atomic_swap = pshmem_float_atomic_swap #pragma weak shmem_double_atomic_swap = pshmem_double_atomic_swap #pragma weak shmem_int_swap = pshmem_int_swap @@ -85,11 +91,17 @@ SHMEM_CTX_TYPE_ATOMIC_SWAP(_int, int, shmem) SHMEM_CTX_TYPE_ATOMIC_SWAP(_long, long, shmem) SHMEM_CTX_TYPE_ATOMIC_SWAP(_longlong, long long, shmem) +SHMEM_CTX_TYPE_ATOMIC_SWAP(_uint, unsigned int, shmem) +SHMEM_CTX_TYPE_ATOMIC_SWAP(_ulong, unsigned long, shmem) +SHMEM_CTX_TYPE_ATOMIC_SWAP(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_ATOMIC_SWAP(_float, float, shmem) SHMEM_CTX_TYPE_ATOMIC_SWAP(_double, double, shmem) SHMEM_TYPE_ATOMIC_SWAP(_int, int, shmem) SHMEM_TYPE_ATOMIC_SWAP(_long, long, shmem) SHMEM_TYPE_ATOMIC_SWAP(_longlong, long long, shmem) +SHMEM_TYPE_ATOMIC_SWAP(_uint, unsigned int, shmem) +SHMEM_TYPE_ATOMIC_SWAP(_ulong, unsigned long, shmem) +SHMEM_TYPE_ATOMIC_SWAP(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_ATOMIC_SWAP(_float, float, shmem) SHMEM_TYPE_ATOMIC_SWAP(_double, double, shmem) diff --git a/oshmem/shmem/c/shmem_xor.c b/oshmem/shmem/c/shmem_xor.c index 55538798bda..dd762ed98f4 100644 --- a/oshmem/shmem/c/shmem_xor.c +++ b/oshmem/shmem/c/shmem_xor.c @@ -25,9 +25,15 @@ */ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" +#pragma weak shmem_int_atomic_xor = pshmem_int_atomic_xor +#pragma weak shmem_long_atomic_xor = pshmem_long_atomic_xor +#pragma weak shmem_longlong_atomic_xor = pshmem_longlong_atomic_xor #pragma weak shmem_uint_atomic_xor = pshmem_uint_atomic_xor #pragma weak shmem_ulong_atomic_xor = pshmem_ulong_atomic_xor #pragma weak shmem_ulonglong_atomic_xor = pshmem_ulonglong_atomic_xor +#pragma weak shmem_ctx_int_atomic_xor = pshmem_ctx_int_atomic_xor +#pragma weak shmem_ctx_long_atomic_xor = pshmem_ctx_long_atomic_xor +#pragma weak shmem_ctx_longlong_atomic_xor = pshmem_ctx_longlong_atomic_xor #pragma weak shmem_ctx_uint_atomic_xor = pshmem_ctx_uint_atomic_xor #pragma weak shmem_ctx_ulong_atomic_xor = pshmem_ctx_ulong_atomic_xor #pragma weak shmem_ctx_ulonglong_atomic_xor = pshmem_ctx_ulonglong_atomic_xor @@ -38,9 +44,15 @@ #include "oshmem/shmem/c/profile/defines.h" #endif +OSHMEM_TYPE_OP(int, int, shmem, xor) +OSHMEM_TYPE_OP(long, long, shmem, xor) +OSHMEM_TYPE_OP(longlong, long long, shmem, xor) OSHMEM_TYPE_OP(uint, unsigned int, shmem, xor) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, xor) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_CTX_TYPE_OP(int, int, shmem, xor) +OSHMEM_CTX_TYPE_OP(long, long, shmem, xor) +OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, xor) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, xor) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, xor) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, xor) From b416c8afe24ccd50cf3a6e41266d967e70602871 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 1 Nov 2018 11:33:34 +0200 Subject: [PATCH 171/674] OSHMEM/AMO: code beautify - added to split API groups to simplify human processing Signed-off-by: Sergey Oblomov (cherry picked from commit 6e7810208966d73e0a56f74b536aa5c56b9a8d1c) --- oshmem/shmem/c/profile/defines.h | 55 ++++++++++++++++++++++++++++++++ oshmem/shmem/c/shmem_add.c | 3 ++ oshmem/shmem/c/shmem_and.c | 2 ++ oshmem/shmem/c/shmem_cswap.c | 3 ++ oshmem/shmem/c/shmem_fadd.c | 3 ++ oshmem/shmem/c/shmem_fand.c | 2 ++ oshmem/shmem/c/shmem_fetch.c | 3 ++ oshmem/shmem/c/shmem_finc.c | 3 ++ oshmem/shmem/c/shmem_for.c | 2 ++ oshmem/shmem/c/shmem_fxor.c | 2 ++ oshmem/shmem/c/shmem_g.c | 2 ++ oshmem/shmem/c/shmem_get.c | 3 ++ oshmem/shmem/c/shmem_get_nb.c | 3 ++ oshmem/shmem/c/shmem_iget.c | 3 ++ oshmem/shmem/c/shmem_inc.c | 3 ++ oshmem/shmem/c/shmem_iput.c | 3 ++ oshmem/shmem/c/shmem_or.c | 2 ++ oshmem/shmem/c/shmem_p.c | 2 ++ oshmem/shmem/c/shmem_put.c | 3 ++ oshmem/shmem/c/shmem_put_nb.c | 3 ++ oshmem/shmem/c/shmem_set.c | 3 ++ oshmem/shmem/c/shmem_swap.c | 3 ++ oshmem/shmem/c/shmem_xor.c | 2 ++ 23 files changed, 113 insertions(+) diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index 2ce3fd97ab2..625ce52b26c 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -87,6 +87,7 @@ #define shmem_ctx_ulong_p pshmem_ctx_ulong_p #define shmem_ctx_ulonglong_p pshmem_ctx_ulonglong_p #define shmem_ctx_longdouble_p pshmem_ctx_longdouble_p + #define shmem_char_p pshmem_char_p #define shmem_short_p pshmem_short_p #define shmem_int_p pshmem_int_p @@ -101,6 +102,7 @@ #define shmem_ulong_p pshmem_ulong_p #define shmem_ulonglong_p pshmem_ulonglong_p #define shmem_longdouble_p pshmem_longdouble_p + #define shmemx_int16_p pshmemx_int16_p #define shmemx_int32_p pshmemx_int32_p #define shmemx_int64_p pshmemx_int64_p @@ -122,6 +124,7 @@ #define shmem_ctx_ulong_put pshmem_ctx_ulong_put #define shmem_ctx_ulonglong_put pshmem_ctx_ulonglong_put #define shmem_ctx_longdouble_put pshmem_ctx_longdouble_put + #define shmem_char_put pshmem_char_put /* shmem-compat.h */ #define shmem_short_put pshmem_short_put #define shmem_int_put pshmem_int_put @@ -143,6 +146,7 @@ #define shmem_ctx_put64 pshmem_ctx_put64 #define shmem_ctx_put128 pshmem_ctx_put128 #define shmem_ctx_putmem pshmem_ctx_putmem + #define shmem_put8 pshmem_put8 #define shmem_put16 pshmem_put16 #define shmem_put32 pshmem_put32 @@ -167,6 +171,7 @@ #define shmem_ctx_ulong_iput pshmem_ctx_ulong_iput #define shmem_ctx_ulonglong_iput pshmem_ctx_ulonglong_iput #define shmem_ctx_longdouble_iput pshmem_ctx_longdouble_iput + #define shmem_char_iput pshmem_char_iput #define shmem_short_iput pshmem_short_iput #define shmem_int_iput pshmem_int_iput @@ -187,6 +192,7 @@ #define shmem_ctx_iput32 pshmem_ctx_iput32 #define shmem_ctx_iput64 pshmem_ctx_iput64 #define shmem_ctx_iput128 pshmem_ctx_iput128 + #define shmem_iput8 pshmem_iput8 #define shmem_iput16 pshmem_iput16 #define shmem_iput32 pshmem_iput32 @@ -210,6 +216,7 @@ #define shmem_ctx_ulong_put_nbi pshmem_ctx_ulong_put_nbi #define shmem_ctx_ulonglong_put_nbi pshmem_ctx_ulonglong_put_nbi #define shmem_ctx_longdouble_put_nbi pshmem_ctx_longdouble_put_nbi + #define shmem_char_put_nbi pshmem_char_put_nbi #define shmem_short_put_nbi pshmem_short_put_nbi #define shmem_int_put_nbi pshmem_int_put_nbi @@ -231,6 +238,7 @@ #define shmem_ctx_put64_nbi pshmem_ctx_put64_nbi #define shmem_ctx_put128_nbi pshmem_ctx_put128_nbi #define shmem_ctx_putmem_nbi pshmem_ctx_putmem_nbi + #define shmem_put8_nbi pshmem_put8_nbi #define shmem_put16_nbi pshmem_put16_nbi #define shmem_put32_nbi pshmem_put32_nbi @@ -255,6 +263,7 @@ #define shmem_ctx_ulong_g pshmem_ctx_ulong_g #define shmem_ctx_ulonglong_g pshmem_ctx_ulonglong_g #define shmem_ctx_longdouble_g pshmem_ctx_longdouble_g + #define shmem_char_g pshmem_char_g #define shmem_short_g pshmem_short_g #define shmem_int_g pshmem_int_g @@ -269,6 +278,7 @@ #define shmem_ulong_g pshmem_ulong_g #define shmem_ulonglong_g pshmem_ulonglong_g #define shmem_longdouble_g pshmem_longdouble_g + #define shmemx_int16_g pshmemx_int16_g #define shmemx_int32_g pshmemx_int32_g #define shmemx_int64_g pshmemx_int64_g @@ -290,6 +300,7 @@ #define shmem_ctx_ulong_get pshmem_ctx_ulong_get #define shmem_ctx_ulonglong_get pshmem_ctx_ulonglong_get #define shmem_ctx_longdouble_get pshmem_ctx_longdouble_get + #define shmem_char_get pshmem_char_get /* shmem-compat.h */ #define shmem_short_get pshmem_short_get #define shmem_int_get pshmem_int_get @@ -311,6 +322,7 @@ #define shmem_ctx_get64 pshmem_ctx_get64 #define shmem_ctx_get128 pshmem_ctx_get128 #define shmem_ctx_getmem pshmem_ctx_getmem + #define shmem_get8 pshmem_get8 #define shmem_get16 pshmem_get16 #define shmem_get32 pshmem_get32 @@ -335,6 +347,7 @@ #define shmem_ctx_ulong_iget pshmem_ctx_ulong_iget #define shmem_ctx_ulonglong_iget pshmem_ctx_ulonglong_iget #define shmem_ctx_longdouble_iget pshmem_ctx_longdouble_iget + #define shmem_char_iget pshmem_char_iget #define shmem_short_iget pshmem_short_iget #define shmem_int_iget pshmem_int_iget @@ -355,6 +368,7 @@ #define shmem_ctx_iget32 pshmem_ctx_iget32 #define shmem_ctx_iget64 pshmem_ctx_iget64 #define shmem_ctx_iget128 pshmem_ctx_iget128 + #define shmem_iget8 pshmem_iget8 #define shmem_iget16 pshmem_iget16 #define shmem_iget32 pshmem_iget32 @@ -378,6 +392,7 @@ #define shmem_ctx_ulong_get_nbi pshmem_ctx_ulong_get_nbi #define shmem_ctx_ulonglong_get_nbi pshmem_ctx_ulonglong_get_nbi #define shmem_ctx_longdouble_get_nbi pshmem_ctx_longdouble_get_nbi + #define shmem_char_get_nbi pshmem_char_get_nbi #define shmem_short_get_nbi pshmem_short_get_nbi #define shmem_int_get_nbi pshmem_int_get_nbi @@ -399,6 +414,7 @@ #define shmem_ctx_get64_nbi pshmem_ctx_get64_nbi #define shmem_ctx_get128_nbi pshmem_ctx_get128_nbi #define shmem_ctx_getmem_nbi pshmem_ctx_getmem_nbi + #define shmem_get8_nbi pshmem_get8_nbi #define shmem_get16_nbi pshmem_get16_nbi #define shmem_get32_nbi pshmem_get32_nbi @@ -418,6 +434,7 @@ #define shmem_ctx_uint_atomic_swap pshmem_ctx_uint_atomic_swap #define shmem_ctx_ulong_atomic_swap pshmem_ctx_ulong_atomic_swap #define shmem_ctx_ulonglong_atomic_swap pshmem_ctx_ulonglong_atomic_swap + #define shmem_double_atomic_swap pshmem_double_atomic_swap #define shmem_float_atomic_swap pshmem_float_atomic_swap #define shmem_int_atomic_swap pshmem_int_atomic_swap @@ -426,11 +443,13 @@ #define shmem_uint_atomic_swap pshmem_uint_atomic_swap #define shmem_ulong_atomic_swap pshmem_ulong_atomic_swap #define shmem_ulonglong_atomic_swap pshmem_ulonglong_atomic_swap + #define shmem_double_swap pshmem_double_swap #define shmem_float_swap pshmem_float_swap #define shmem_int_swap pshmem_int_swap #define shmem_long_swap pshmem_long_swap #define shmem_longlong_swap pshmem_longlong_swap + #define shmemx_int32_swap pshmemx_int32_swap #define shmemx_int64_swap pshmemx_int64_swap @@ -443,6 +462,7 @@ #define shmem_ctx_uint_atomic_set pshmem_ctx_uint_atomic_set #define shmem_ctx_ulong_atomic_set pshmem_ctx_ulong_atomic_set #define shmem_ctx_ulonglong_atomic_set pshmem_ctx_ulonglong_atomic_set + #define shmem_double_atomic_set pshmem_double_atomic_set #define shmem_float_atomic_set pshmem_float_atomic_set #define shmem_int_atomic_set pshmem_int_atomic_set @@ -451,11 +471,13 @@ #define shmem_uint_atomic_set pshmem_uint_atomic_set #define shmem_ulong_atomic_set pshmem_ulong_atomic_set #define shmem_ulonglong_atomic_set pshmem_ulonglong_atomic_set + #define shmem_double_set pshmem_double_set #define shmem_float_set pshmem_float_set #define shmem_int_set pshmem_int_set #define shmem_long_set pshmem_long_set #define shmem_longlong_set pshmem_longlong_set + #define shmemx_int32_set pshmemx_int32_set #define shmemx_int64_set pshmemx_int64_set @@ -466,15 +488,18 @@ #define shmem_ctx_uint_atomic_compare_swap pshmem_ctx_uint_atomic_compare_swap #define shmem_ctx_ulong_atomic_compare_swap pshmem_ctx_ulong_atomic_compare_swap #define shmem_ctx_ulonglong_atomic_compare_swap pshmem_ctx_ulonglong_atomic_compare_swap + #define shmem_int_atomic_compare_swap pshmem_int_atomic_compare_swap #define shmem_long_atomic_compare_swap pshmem_long_atomic_compare_swap #define shmem_longlong_atomic_compare_swap pshmem_longlong_atomic_compare_swap #define shmem_uint_atomic_compare_swap pshmem_uint_atomic_compare_swap #define shmem_ulong_atomic_compare_swap pshmem_ulong_atomic_compare_swap #define shmem_ulonglong_atomic_compare_swap pshmem_ulonglong_atomic_compare_swap + #define shmem_int_cswap pshmem_int_cswap #define shmem_long_cswap pshmem_long_cswap #define shmem_longlong_cswap pshmem_longlong_cswap + #define shmemx_int32_cswap pshmemx_int32_cswap #define shmemx_int64_cswap pshmemx_int64_cswap @@ -485,15 +510,18 @@ #define shmem_ctx_uint_atomic_fetch_add pshmem_ctx_uint_atomic_fetch_add #define shmem_ctx_ulong_atomic_fetch_add pshmem_ctx_ulong_atomic_fetch_add #define shmem_ctx_ulonglong_atomic_fetch_add pshmem_ctx_ulonglong_atomic_fetch_add + #define shmem_int_atomic_fetch_add pshmem_int_atomic_fetch_add #define shmem_long_atomic_fetch_add pshmem_long_atomic_fetch_add #define shmem_longlong_atomic_fetch_add pshmem_longlong_atomic_fetch_add #define shmem_uint_atomic_fetch_add pshmem_uint_atomic_fetch_add #define shmem_ulong_atomic_fetch_add pshmem_ulong_atomic_fetch_add #define shmem_ulonglong_atomic_fetch_add pshmem_ulonglong_atomic_fetch_add + #define shmem_int_fadd pshmem_int_fadd #define shmem_long_fadd pshmem_long_fadd #define shmem_longlong_fadd pshmem_longlong_fadd + #define shmemx_int32_fadd pshmemx_int32_fadd #define shmemx_int64_fadd pshmemx_int64_fadd @@ -504,12 +532,14 @@ #define shmem_uint_atomic_fetch_and pshmem_uint_atomic_fetch_and #define shmem_ulong_atomic_fetch_and pshmem_ulong_atomic_fetch_and #define shmem_ulonglong_atomic_fetch_and pshmem_ulonglong_atomic_fetch_and + #define shmem_ctx_int_atomic_fetch_and pshmem_ctx_int_atomic_fetch_and #define shmem_ctx_long_atomic_fetch_and pshmem_ctx_long_atomic_fetch_and #define shmem_ctx_longlong_atomic_fetch_and pshmem_ctx_longlong_atomic_fetch_and #define shmem_ctx_uint_atomic_fetch_and pshmem_ctx_uint_atomic_fetch_and #define shmem_ctx_ulong_atomic_fetch_and pshmem_ctx_ulong_atomic_fetch_and #define shmem_ctx_ulonglong_atomic_fetch_and pshmem_ctx_ulonglong_atomic_fetch_and + #define shmemx_int32_atomic_fetch_and pshmemx_int32_atomic_fetch_and #define shmemx_int64_atomic_fetch_and pshmemx_int64_atomic_fetch_and #define shmemx_uint32_atomic_fetch_and pshmemx_uint32_atomic_fetch_and @@ -522,12 +552,14 @@ #define shmem_uint_atomic_fetch_or pshmem_uint_atomic_fetch_or #define shmem_ulong_atomic_fetch_or pshmem_ulong_atomic_fetch_or #define shmem_ulonglong_atomic_fetch_or pshmem_ulonglong_atomic_fetch_or + #define shmem_ctx_int_atomic_fetch_or pshmem_ctx_int_atomic_fetch_or #define shmem_ctx_long_atomic_fetch_or pshmem_ctx_long_atomic_fetch_or #define shmem_ctx_longlong_atomic_fetch_or pshmem_ctx_longlong_atomic_fetch_or #define shmem_ctx_uint_atomic_fetch_or pshmem_ctx_uint_atomic_fetch_or #define shmem_ctx_ulong_atomic_fetch_or pshmem_ctx_ulong_atomic_fetch_or #define shmem_ctx_ulonglong_atomic_fetch_or pshmem_ctx_ulonglong_atomic_fetch_or + #define shmemx_int32_atomic_fetch_or pshmemx_int32_atomic_fetch_or #define shmemx_int64_atomic_fetch_or pshmemx_int64_atomic_fetch_or #define shmemx_uint32_atomic_fetch_or pshmemx_uint32_atomic_fetch_or @@ -540,12 +572,14 @@ #define shmem_uint_atomic_fetch_xor pshmem_uint_atomic_fetch_xor #define shmem_ulong_atomic_fetch_xor pshmem_ulong_atomic_fetch_xor #define shmem_ulonglong_atomic_fetch_xor pshmem_ulonglong_atomic_fetch_xor + #define shmem_ctx_int_atomic_fetch_xor pshmem_ctx_int_atomic_fetch_xor #define shmem_ctx_long_atomic_fetch_xor pshmem_ctx_long_atomic_fetch_xor #define shmem_ctx_longlong_atomic_fetch_xor pshmem_ctx_longlong_atomic_fetch_xor #define shmem_ctx_uint_atomic_fetch_xor pshmem_ctx_uint_atomic_fetch_xor #define shmem_ctx_ulong_atomic_fetch_xor pshmem_ctx_ulong_atomic_fetch_xor #define shmem_ctx_ulonglong_atomic_fetch_xor pshmem_ctx_ulonglong_atomic_fetch_xor + #define shmemx_int32_atomic_fetch_xor pshmemx_int32_atomic_fetch_xor #define shmemx_int64_atomic_fetch_xor pshmemx_int64_atomic_fetch_xor #define shmemx_uint32_atomic_fetch_xor pshmemx_uint32_atomic_fetch_xor @@ -560,6 +594,7 @@ #define shmem_ctx_uint_atomic_fetch pshmem_ctx_uint_atomic_fetch #define shmem_ctx_ulong_atomic_fetch pshmem_ctx_ulong_atomic_fetch #define shmem_ctx_ulonglong_atomic_fetch pshmem_ctx_ulonglong_atomic_fetch + #define shmem_double_atomic_fetch pshmem_double_atomic_fetch #define shmem_float_atomic_fetch pshmem_float_atomic_fetch #define shmem_int_atomic_fetch pshmem_int_atomic_fetch @@ -568,11 +603,13 @@ #define shmem_uint_atomic_fetch pshmem_uint_atomic_fetch #define shmem_ulong_atomic_fetch pshmem_ulong_atomic_fetch #define shmem_ulonglong_atomic_fetch pshmem_ulonglong_atomic_fetch + #define shmem_double_fetch pshmem_double_fetch #define shmem_float_fetch pshmem_float_fetch #define shmem_int_fetch pshmem_int_fetch #define shmem_long_fetch pshmem_long_fetch #define shmem_longlong_fetch pshmem_longlong_fetch + #define shmemx_int32_fetch pshmemx_int32_fetch #define shmemx_int64_fetch pshmemx_int64_fetch @@ -583,15 +620,18 @@ #define shmem_ctx_uint_atomic_fetch_inc pshmem_ctx_uint_atomic_fetch_inc #define shmem_ctx_ulong_atomic_fetch_inc pshmem_ctx_ulong_atomic_fetch_inc #define shmem_ctx_ulonglong_atomic_fetch_inc pshmem_ctx_ulonglong_atomic_fetch_inc + #define shmem_uint_atomic_fetch_inc pshmem_uint_atomic_fetch_inc #define shmem_ulong_atomic_fetch_inc pshmem_ulong_atomic_fetch_inc #define shmem_ulonglong_atomic_fetch_inc pshmem_ulonglong_atomic_fetch_inc #define shmem_int_atomic_fetch_inc pshmem_int_atomic_fetch_inc #define shmem_long_atomic_fetch_inc pshmem_long_atomic_fetch_inc #define shmem_longlong_atomic_fetch_inc pshmem_longlong_atomic_fetch_inc + #define shmem_int_finc pshmem_int_finc #define shmem_long_finc pshmem_long_finc #define shmem_longlong_finc pshmem_longlong_finc + #define shmemx_int32_finc pshmemx_int32_finc #define shmemx_int64_finc pshmemx_int64_finc @@ -602,15 +642,18 @@ #define shmem_ctx_uint_atomic_add pshmem_ctx_uint_atomic_add #define shmem_ctx_ulong_atomic_add pshmem_ctx_ulong_atomic_add #define shmem_ctx_ulonglong_atomic_add pshmem_ctx_ulonglong_atomic_add + #define shmem_int_atomic_add pshmem_int_atomic_add #define shmem_long_atomic_add pshmem_long_atomic_add #define shmem_longlong_atomic_add pshmem_longlong_atomic_add #define shmem_uint_atomic_add pshmem_uint_atomic_add #define shmem_ulong_atomic_add pshmem_ulong_atomic_add #define shmem_ulonglong_atomic_add pshmem_ulonglong_atomic_add + #define shmem_int_add pshmem_int_add #define shmem_long_add pshmem_long_add #define shmem_longlong_add pshmem_longlong_add + #define shmemx_int32_add pshmemx_int32_add #define shmemx_int64_add pshmemx_int64_add @@ -621,14 +664,17 @@ #define shmem_uint_atomic_and pshmem_uint_atomic_and #define shmem_ulong_atomic_and pshmem_ulong_atomic_and #define shmem_ulonglong_atomic_and pshmem_ulonglong_atomic_and + #define shmem_ctx_int_atomic_and pshmem_ctx_int_atomic_and #define shmem_ctx_long_atomic_and pshmem_ctx_long_atomic_and #define shmem_ctx_longlong_atomic_and pshmem_ctx_longlong_atomic_and #define shmem_ctx_uint_atomic_and pshmem_ctx_uint_atomic_and #define shmem_ctx_ulong_atomic_and pshmem_ctx_ulong_atomic_and #define shmem_ctx_ulonglong_atomic_and pshmem_ctx_ulonglong_atomic_and + #define shmemx_int32_atomic_and pshmemx_int32_atomic_and #define shmemx_int64_atomic_and pshmemx_int64_atomic_and + #define shmemx_uint32_atomic_and pshmemx_uint32_atomic_and #define shmemx_uint64_atomic_and pshmemx_uint64_atomic_and @@ -639,14 +685,17 @@ #define shmem_uint_atomic_or pshmem_uint_atomic_or #define shmem_ulong_atomic_or pshmem_ulong_atomic_or #define shmem_ulonglong_atomic_or pshmem_ulonglong_atomic_or + #define shmem_ctx_int_atomic_or pshmem_ctx_int_atomic_or #define shmem_ctx_long_atomic_or pshmem_ctx_long_atomic_or #define shmem_ctx_longlong_atomic_or pshmem_ctx_longlong_atomic_or #define shmem_ctx_uint_atomic_or pshmem_ctx_uint_atomic_or #define shmem_ctx_ulong_atomic_or pshmem_ctx_ulong_atomic_or #define shmem_ctx_ulonglong_atomic_or pshmem_ctx_ulonglong_atomic_or + #define shmemx_int32_atomic_or pshmemx_int32_atomic_or #define shmemx_int64_atomic_or pshmemx_int64_atomic_or + #define shmemx_uint32_atomic_or pshmemx_uint32_atomic_or #define shmemx_uint64_atomic_or pshmemx_uint64_atomic_or @@ -657,14 +706,17 @@ #define shmem_uint_atomic_xor pshmem_uint_atomic_xor #define shmem_ulong_atomic_xor pshmem_ulong_atomic_xor #define shmem_ulonglong_atomic_xor pshmem_ulonglong_atomic_xor + #define shmem_ctx_int_atomic_xor pshmem_ctx_int_atomic_xor #define shmem_ctx_long_atomic_xor pshmem_ctx_long_atomic_xor #define shmem_ctx_longlong_atomic_xor pshmem_ctx_longlong_atomic_xor #define shmem_ctx_uint_atomic_xor pshmem_ctx_uint_atomic_xor #define shmem_ctx_ulong_atomic_xor pshmem_ctx_ulong_atomic_xor #define shmem_ctx_ulonglong_atomic_xor pshmem_ctx_ulonglong_atomic_xor + #define shmemx_int32_atomic_xor pshmemx_int32_atomic_xor #define shmemx_int64_atomic_xor pshmemx_int64_atomic_xor + #define shmemx_uint32_atomic_xor pshmemx_uint32_atomic_xor #define shmemx_uint64_atomic_xor pshmemx_uint64_atomic_xor @@ -675,15 +727,18 @@ #define shmem_ctx_uint_atomic_inc pshmem_ctx_uint_atomic_inc #define shmem_ctx_ulong_atomic_inc pshmem_ctx_ulong_atomic_inc #define shmem_ctx_ulonglong_atomic_inc pshmem_ctx_ulonglong_atomic_inc + #define shmem_int_atomic_inc pshmem_int_atomic_inc #define shmem_long_atomic_inc pshmem_long_atomic_inc #define shmem_longlong_atomic_inc pshmem_longlong_atomic_inc #define shmem_uint_atomic_inc pshmem_uint_atomic_inc #define shmem_ulong_atomic_inc pshmem_ulong_atomic_inc #define shmem_ulonglong_atomic_inc pshmem_ulonglong_atomic_inc + #define shmem_int_inc pshmem_int_inc #define shmem_long_inc pshmem_long_inc #define shmem_longlong_inc pshmem_longlong_inc + #define shmemx_int32_inc pshmemx_int32_inc #define shmemx_int64_inc pshmemx_int64_inc diff --git a/oshmem/shmem/c/shmem_add.c b/oshmem/shmem/c/shmem_add.c index f4ce217ab2a..6435496892a 100644 --- a/oshmem/shmem/c/shmem_add.c +++ b/oshmem/shmem/c/shmem_add.c @@ -66,15 +66,18 @@ #pragma weak shmem_ctx_uint_atomic_add = pshmem_ctx_uint_atomic_add #pragma weak shmem_ctx_ulong_atomic_add = pshmem_ctx_ulong_atomic_add #pragma weak shmem_ctx_ulonglong_atomic_add = pshmem_ctx_ulonglong_atomic_add + #pragma weak shmem_int_atomic_add = pshmem_int_atomic_add #pragma weak shmem_long_atomic_add = pshmem_long_atomic_add #pragma weak shmem_longlong_atomic_add = pshmem_longlong_atomic_add #pragma weak shmem_uint_atomic_add = pshmem_uint_atomic_add #pragma weak shmem_ulong_atomic_add = pshmem_ulong_atomic_add #pragma weak shmem_ulonglong_atomic_add = pshmem_ulonglong_atomic_add + #pragma weak shmem_int_add = pshmem_int_add #pragma weak shmem_long_add = pshmem_long_add #pragma weak shmem_longlong_add = pshmem_longlong_add + #pragma weak shmemx_int32_add = pshmemx_int32_add #pragma weak shmemx_int64_add = pshmemx_int64_add #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_and.c b/oshmem/shmem/c/shmem_and.c index 040f00c8bc7..5c40cc955b4 100644 --- a/oshmem/shmem/c/shmem_and.c +++ b/oshmem/shmem/c/shmem_and.c @@ -31,12 +31,14 @@ #pragma weak shmem_uint_atomic_and = pshmem_uint_atomic_and #pragma weak shmem_ulong_atomic_and = pshmem_ulong_atomic_and #pragma weak shmem_ulonglong_atomic_and = pshmem_ulonglong_atomic_and + #pragma weak shmem_ctx_int_atomic_and = pshmem_ctx_int_atomic_and #pragma weak shmem_ctx_long_atomic_and = pshmem_ctx_long_atomic_and #pragma weak shmem_ctx_longlong_atomic_and = pshmem_ctx_longlong_atomic_and #pragma weak shmem_ctx_uint_atomic_and = pshmem_ctx_uint_atomic_and #pragma weak shmem_ctx_ulong_atomic_and = pshmem_ctx_ulong_atomic_and #pragma weak shmem_ctx_ulonglong_atomic_and = pshmem_ctx_ulonglong_atomic_and + #pragma weak shmemx_int32_atomic_and = pshmemx_int32_atomic_and #pragma weak shmemx_int64_atomic_and = pshmemx_int64_atomic_and #pragma weak shmemx_uint32_atomic_and = pshmemx_uint32_atomic_and diff --git a/oshmem/shmem/c/shmem_cswap.c b/oshmem/shmem/c/shmem_cswap.c index 9322e91d283..99e3b1f9420 100644 --- a/oshmem/shmem/c/shmem_cswap.c +++ b/oshmem/shmem/c/shmem_cswap.c @@ -71,15 +71,18 @@ #pragma weak shmem_ctx_int_atomic_compare_swap = pshmem_ctx_int_atomic_compare_swap #pragma weak shmem_ctx_long_atomic_compare_swap = pshmem_ctx_long_atomic_compare_swap #pragma weak shmem_ctx_longlong_atomic_compare_swap = pshmem_ctx_longlong_atomic_compare_swap + #pragma weak shmem_int_atomic_compare_swap = pshmem_int_atomic_compare_swap #pragma weak shmem_long_atomic_compare_swap = pshmem_long_atomic_compare_swap #pragma weak shmem_longlong_atomic_compare_swap = pshmem_longlong_atomic_compare_swap #pragma weak shmem_uint_atomic_compare_swap = pshmem_uint_atomic_compare_swap #pragma weak shmem_ulong_atomic_compare_swap = pshmem_ulong_atomic_compare_swap #pragma weak shmem_ulonglong_atomic_compare_swap = pshmem_ulonglong_atomic_compare_swap + #pragma weak shmem_int_cswap = pshmem_int_cswap #pragma weak shmem_long_cswap = pshmem_long_cswap #pragma weak shmem_longlong_cswap = pshmem_longlong_cswap + #pragma weak shmemx_int32_cswap = pshmemx_int32_cswap #pragma weak shmemx_int64_cswap = pshmemx_int64_cswap #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_fadd.c b/oshmem/shmem/c/shmem_fadd.c index 669b21f2a6a..33f18973aca 100644 --- a/oshmem/shmem/c/shmem_fadd.c +++ b/oshmem/shmem/c/shmem_fadd.c @@ -70,15 +70,18 @@ #pragma weak shmem_ctx_uint_atomic_fetch_add = pshmem_ctx_uint_atomic_fetch_add #pragma weak shmem_ctx_ulong_atomic_fetch_add = pshmem_ctx_ulong_atomic_fetch_add #pragma weak shmem_ctx_ulonglong_atomic_fetch_add = pshmem_ctx_ulonglong_atomic_fetch_add + #pragma weak shmem_int_atomic_fetch_add = pshmem_int_atomic_fetch_add #pragma weak shmem_long_atomic_fetch_add = pshmem_long_atomic_fetch_add #pragma weak shmem_longlong_atomic_fetch_add = pshmem_longlong_atomic_fetch_add #pragma weak shmem_uint_atomic_fetch_add = pshmem_uint_atomic_fetch_add #pragma weak shmem_ulong_atomic_fetch_add = pshmem_ulong_atomic_fetch_add #pragma weak shmem_ulonglong_atomic_fetch_add = pshmem_ulonglong_atomic_fetch_add + #pragma weak shmem_int_fadd = pshmem_int_fadd #pragma weak shmem_long_fadd = pshmem_long_fadd #pragma weak shmem_longlong_fadd = pshmem_longlong_fadd + #pragma weak shmemx_int32_fadd = pshmemx_int32_fadd #pragma weak shmemx_int64_fadd = pshmemx_int64_fadd #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_fand.c b/oshmem/shmem/c/shmem_fand.c index 57b1db280e8..e1b03d60f73 100644 --- a/oshmem/shmem/c/shmem_fand.c +++ b/oshmem/shmem/c/shmem_fand.c @@ -33,12 +33,14 @@ #pragma weak shmem_uint_atomic_fetch_and = pshmem_uint_atomic_fetch_and #pragma weak shmem_ulong_atomic_fetch_and = pshmem_ulong_atomic_fetch_and #pragma weak shmem_ulonglong_atomic_fetch_and = pshmem_ulonglong_atomic_fetch_and + #pragma weak shmem_ctx_int_atomic_fetch_and = pshmem_ctx_int_atomic_fetch_and #pragma weak shmem_ctx_long_atomic_fetch_and = pshmem_ctx_long_atomic_fetch_and #pragma weak shmem_ctx_longlong_atomic_fetch_and = pshmem_ctx_longlong_atomic_fetch_and #pragma weak shmem_ctx_uint_atomic_fetch_and = pshmem_ctx_uint_atomic_fetch_and #pragma weak shmem_ctx_ulong_atomic_fetch_and = pshmem_ctx_ulong_atomic_fetch_and #pragma weak shmem_ctx_ulonglong_atomic_fetch_and = pshmem_ctx_ulonglong_atomic_fetch_and + #pragma weak shmemx_int32_atomic_fetch_and = pshmemx_int32_atomic_fetch_and #pragma weak shmemx_int64_atomic_fetch_and = pshmemx_int64_atomic_fetch_and #pragma weak shmemx_uint32_atomic_fetch_and = pshmemx_uint32_atomic_fetch_and diff --git a/oshmem/shmem/c/shmem_fetch.c b/oshmem/shmem/c/shmem_fetch.c index 38ddc051913..fe02d5a16e5 100644 --- a/oshmem/shmem/c/shmem_fetch.c +++ b/oshmem/shmem/c/shmem_fetch.c @@ -73,6 +73,7 @@ #pragma weak shmem_ctx_ulonglong_atomic_fetch = pshmem_ctx_ulonglong_atomic_fetch #pragma weak shmem_ctx_double_atomic_fetch = pshmem_ctx_double_atomic_fetch #pragma weak shmem_ctx_float_atomic_fetch = pshmem_ctx_float_atomic_fetch + #pragma weak shmem_int_atomic_fetch = pshmem_int_atomic_fetch #pragma weak shmem_long_atomic_fetch = pshmem_long_atomic_fetch #pragma weak shmem_longlong_atomic_fetch = pshmem_longlong_atomic_fetch @@ -81,11 +82,13 @@ #pragma weak shmem_ulonglong_atomic_fetch = pshmem_ulonglong_atomic_fetch #pragma weak shmem_double_atomic_fetch = pshmem_double_atomic_fetch #pragma weak shmem_float_atomic_fetch = pshmem_float_atomic_fetch + #pragma weak shmem_int_fetch = pshmem_int_fetch #pragma weak shmem_long_fetch = pshmem_long_fetch #pragma weak shmem_longlong_fetch = pshmem_longlong_fetch #pragma weak shmem_double_fetch = pshmem_double_fetch #pragma weak shmem_float_fetch = pshmem_float_fetch + #pragma weak shmemx_int32_fetch = pshmemx_int32_fetch #pragma weak shmemx_int64_fetch = pshmemx_int64_fetch #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_finc.c b/oshmem/shmem/c/shmem_finc.c index 8a1bb425efa..de3ae9b2dd1 100644 --- a/oshmem/shmem/c/shmem_finc.c +++ b/oshmem/shmem/c/shmem_finc.c @@ -71,15 +71,18 @@ #pragma weak shmem_ctx_uint_atomic_fetch_inc = pshmem_ctx_uint_atomic_fetch_inc #pragma weak shmem_ctx_ulong_atomic_fetch_inc = pshmem_ctx_ulong_atomic_fetch_inc #pragma weak shmem_ctx_ulonglong_atomic_fetch_inc = pshmem_ctx_ulonglong_atomic_fetch_inc + #pragma weak shmem_int_atomic_fetch_inc = pshmem_int_atomic_fetch_inc #pragma weak shmem_long_atomic_fetch_inc = pshmem_long_atomic_fetch_inc #pragma weak shmem_longlong_atomic_fetch_inc = pshmem_longlong_atomic_fetch_inc #pragma weak shmem_uint_atomic_fetch_inc = pshmem_uint_atomic_fetch_inc #pragma weak shmem_ulong_atomic_fetch_inc = pshmem_ulong_atomic_fetch_inc #pragma weak shmem_ulonglong_atomic_fetch_inc = pshmem_ulonglong_atomic_fetch_inc + #pragma weak shmem_int_finc = pshmem_int_finc #pragma weak shmem_long_finc = pshmem_long_finc #pragma weak shmem_longlong_finc = pshmem_longlong_finc + #pragma weak shmemx_int32_finc = pshmemx_int32_finc #pragma weak shmemx_int64_finc = pshmemx_int64_finc #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_for.c b/oshmem/shmem/c/shmem_for.c index 71c5be3bfc3..5bd8a21e489 100644 --- a/oshmem/shmem/c/shmem_for.c +++ b/oshmem/shmem/c/shmem_for.c @@ -33,12 +33,14 @@ #pragma weak shmem_uint_atomic_fetch_or = pshmem_uint_atomic_fetch_or #pragma weak shmem_ulong_atomic_fetch_or = pshmem_ulong_atomic_fetch_or #pragma weak shmem_ulonglong_atomic_fetch_or = pshmem_ulonglong_atomic_fetch_or + #pragma weak shmem_ctx_int_atomic_fetch_or = pshmem_ctx_int_atomic_fetch_or #pragma weak shmem_ctx_long_atomic_fetch_or = pshmem_ctx_long_atomic_fetch_or #pragma weak shmem_ctx_longlong_atomic_fetch_or = pshmem_ctx_longlong_atomic_fetch_or #pragma weak shmem_ctx_uint_atomic_fetch_or = pshmem_ctx_uint_atomic_fetch_or #pragma weak shmem_ctx_ulong_atomic_fetch_or = pshmem_ctx_ulong_atomic_fetch_or #pragma weak shmem_ctx_ulonglong_atomic_fetch_or = pshmem_ctx_ulonglong_atomic_fetch_or + #pragma weak shmemx_int32_atomic_fetch_or = pshmemx_int32_atomic_fetch_or #pragma weak shmemx_int64_atomic_fetch_or = pshmemx_int64_atomic_fetch_or #pragma weak shmemx_uint32_atomic_fetch_or = pshmemx_uint32_atomic_fetch_or diff --git a/oshmem/shmem/c/shmem_fxor.c b/oshmem/shmem/c/shmem_fxor.c index 88375f65ba5..ee762bf12bb 100644 --- a/oshmem/shmem/c/shmem_fxor.c +++ b/oshmem/shmem/c/shmem_fxor.c @@ -33,12 +33,14 @@ #pragma weak shmem_uint_atomic_fetch_xor = pshmem_uint_atomic_fetch_xor #pragma weak shmem_ulong_atomic_fetch_xor = pshmem_ulong_atomic_fetch_xor #pragma weak shmem_ulonglong_atomic_fetch_xor = pshmem_ulonglong_atomic_fetch_xor + #pragma weak shmem_ctx_int_atomic_fetch_xor = pshmem_ctx_int_atomic_fetch_xor #pragma weak shmem_ctx_long_atomic_fetch_xor = pshmem_ctx_long_atomic_fetch_xor #pragma weak shmem_ctx_longlong_atomic_fetch_xor = pshmem_ctx_longlong_atomic_fetch_xor #pragma weak shmem_ctx_uint_atomic_fetch_xor = pshmem_ctx_uint_atomic_fetch_xor #pragma weak shmem_ctx_ulong_atomic_fetch_xor = pshmem_ctx_ulong_atomic_fetch_xor #pragma weak shmem_ctx_ulonglong_atomic_fetch_xor = pshmem_ctx_ulonglong_atomic_fetch_xor + #pragma weak shmemx_int32_atomic_fetch_xor = pshmemx_int32_atomic_fetch_xor #pragma weak shmemx_int64_atomic_fetch_xor = pshmemx_int64_atomic_fetch_xor #pragma weak shmemx_uint32_atomic_fetch_xor = pshmemx_uint32_atomic_fetch_xor diff --git a/oshmem/shmem/c/shmem_g.c b/oshmem/shmem/c/shmem_g.c index be4583877cd..e53aec5724e 100644 --- a/oshmem/shmem/c/shmem_g.c +++ b/oshmem/shmem/c/shmem_g.c @@ -71,6 +71,7 @@ #pragma weak shmem_ctx_float_g = pshmem_ctx_float_g #pragma weak shmem_ctx_double_g = pshmem_ctx_double_g #pragma weak shmem_ctx_longdouble_g = pshmem_ctx_longdouble_g + #pragma weak shmem_char_g = pshmem_char_g #pragma weak shmem_short_g = pshmem_short_g #pragma weak shmem_int_g = pshmem_int_g @@ -84,6 +85,7 @@ #pragma weak shmem_float_g = pshmem_float_g #pragma weak shmem_double_g = pshmem_double_g #pragma weak shmem_longdouble_g = pshmem_longdouble_g + #pragma weak shmemx_int16_g = pshmemx_int16_g #pragma weak shmemx_int32_g = pshmemx_int32_g #pragma weak shmemx_int64_g = pshmemx_int64_g diff --git a/oshmem/shmem/c/shmem_get.c b/oshmem/shmem/c/shmem_get.c index 7ea009f6e09..8270cbe645a 100644 --- a/oshmem/shmem/c/shmem_get.c +++ b/oshmem/shmem/c/shmem_get.c @@ -71,6 +71,7 @@ #pragma weak shmem_ctx_float_get = pshmem_ctx_float_get #pragma weak shmem_ctx_double_get = pshmem_ctx_double_get #pragma weak shmem_ctx_longdouble_get = pshmem_ctx_longdouble_get + #pragma weak shmem_char_get = pshmem_char_get #pragma weak shmem_short_get = pshmem_short_get #pragma weak shmem_int_get = pshmem_int_get @@ -85,12 +86,14 @@ #pragma weak shmem_float_get = pshmem_float_get #pragma weak shmem_double_get = pshmem_double_get #pragma weak shmem_longdouble_get = pshmem_longdouble_get + #pragma weak shmem_ctx_getmem = pshmem_ctx_getmem #pragma weak shmem_ctx_get8 = pshmem_ctx_get8 #pragma weak shmem_ctx_get16 = pshmem_ctx_get16 #pragma weak shmem_ctx_get32 = pshmem_ctx_get32 #pragma weak shmem_ctx_get64 = pshmem_ctx_get64 #pragma weak shmem_ctx_get128 = pshmem_ctx_get128 + #pragma weak shmem_getmem = pshmem_getmem #pragma weak shmem_get8 = pshmem_get8 #pragma weak shmem_get16 = pshmem_get16 diff --git a/oshmem/shmem/c/shmem_get_nb.c b/oshmem/shmem/c/shmem_get_nb.c index 093a97e059c..7afe4412c1f 100644 --- a/oshmem/shmem/c/shmem_get_nb.c +++ b/oshmem/shmem/c/shmem_get_nb.c @@ -71,6 +71,7 @@ #pragma weak shmem_ctx_float_get_nbi = pshmem_ctx_float_get_nbi #pragma weak shmem_ctx_double_get_nbi = pshmem_ctx_double_get_nbi #pragma weak shmem_ctx_longdouble_get_nbi = pshmem_ctx_longdouble_get_nbi + #pragma weak shmem_char_get_nbi = pshmem_char_get_nbi #pragma weak shmem_short_get_nbi = pshmem_short_get_nbi #pragma weak shmem_int_get_nbi = pshmem_int_get_nbi @@ -85,12 +86,14 @@ #pragma weak shmem_float_get_nbi = pshmem_float_get_nbi #pragma weak shmem_double_get_nbi = pshmem_double_get_nbi #pragma weak shmem_longdouble_get_nbi = pshmem_longdouble_get_nbi + #pragma weak shmem_ctx_get8_nbi = pshmem_ctx_get8_nbi #pragma weak shmem_ctx_get16_nbi = pshmem_ctx_get16_nbi #pragma weak shmem_ctx_get32_nbi = pshmem_ctx_get32_nbi #pragma weak shmem_ctx_get64_nbi = pshmem_ctx_get64_nbi #pragma weak shmem_ctx_get128_nbi = pshmem_ctx_get128_nbi #pragma weak shmem_ctx_getmem_nbi = pshmem_ctx_getmem_nbi + #pragma weak shmem_get8_nbi = pshmem_get8_nbi #pragma weak shmem_get16_nbi = pshmem_get16_nbi #pragma weak shmem_get32_nbi = pshmem_get32_nbi diff --git a/oshmem/shmem/c/shmem_iget.c b/oshmem/shmem/c/shmem_iget.c index f570a88db9f..30e82a2366e 100644 --- a/oshmem/shmem/c/shmem_iget.c +++ b/oshmem/shmem/c/shmem_iget.c @@ -76,6 +76,7 @@ #pragma weak shmem_ctx_float_iget = pshmem_ctx_float_iget #pragma weak shmem_ctx_double_iget = pshmem_ctx_double_iget #pragma weak shmem_ctx_longdouble_iget = pshmem_ctx_longdouble_iget + #pragma weak shmem_char_iget = pshmem_char_iget #pragma weak shmem_short_iget = pshmem_short_iget #pragma weak shmem_int_iget = pshmem_int_iget @@ -90,11 +91,13 @@ #pragma weak shmem_float_iget = pshmem_float_iget #pragma weak shmem_double_iget = pshmem_double_iget #pragma weak shmem_longdouble_iget = pshmem_longdouble_iget + #pragma weak shmem_ctx_iget8 = pshmem_ctx_iget8 #pragma weak shmem_ctx_iget16 = pshmem_ctx_iget16 #pragma weak shmem_ctx_iget32 = pshmem_ctx_iget32 #pragma weak shmem_ctx_iget64 = pshmem_ctx_iget64 #pragma weak shmem_ctx_iget128 = pshmem_ctx_iget128 + #pragma weak shmem_iget8 = pshmem_iget8 #pragma weak shmem_iget16 = pshmem_iget16 #pragma weak shmem_iget32 = pshmem_iget32 diff --git a/oshmem/shmem/c/shmem_inc.c b/oshmem/shmem/c/shmem_inc.c index 0701609d5bf..8c44c0258d1 100644 --- a/oshmem/shmem/c/shmem_inc.c +++ b/oshmem/shmem/c/shmem_inc.c @@ -66,15 +66,18 @@ #pragma weak shmem_ctx_uint_atomic_inc = pshmem_ctx_uint_atomic_inc #pragma weak shmem_ctx_ulong_atomic_inc = pshmem_ctx_ulong_atomic_inc #pragma weak shmem_ctx_ulonglong_atomic_inc = pshmem_ctx_ulonglong_atomic_inc + #pragma weak shmem_int_atomic_inc = pshmem_int_atomic_inc #pragma weak shmem_long_atomic_inc = pshmem_long_atomic_inc #pragma weak shmem_longlong_atomic_inc = pshmem_longlong_atomic_inc #pragma weak shmem_uint_atomic_inc = pshmem_uint_atomic_inc #pragma weak shmem_ulong_atomic_inc = pshmem_ulong_atomic_inc #pragma weak shmem_ulonglong_atomic_inc = pshmem_ulonglong_atomic_inc + #pragma weak shmem_int_inc = pshmem_int_inc #pragma weak shmem_long_inc = pshmem_long_inc #pragma weak shmem_longlong_inc = pshmem_longlong_inc + #pragma weak shmemx_int32_inc = pshmemx_int32_inc #pragma weak shmemx_int64_inc = pshmemx_int64_inc #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_iput.c b/oshmem/shmem/c/shmem_iput.c index 2eb492c3aef..ffd59479ce9 100644 --- a/oshmem/shmem/c/shmem_iput.c +++ b/oshmem/shmem/c/shmem_iput.c @@ -77,6 +77,7 @@ #pragma weak shmem_ctx_float_iput = pshmem_ctx_float_iput #pragma weak shmem_ctx_double_iput = pshmem_ctx_double_iput #pragma weak shmem_ctx_longdouble_iput = pshmem_ctx_longdouble_iput + #pragma weak shmem_char_iput = pshmem_char_iput #pragma weak shmem_short_iput = pshmem_short_iput #pragma weak shmem_int_iput = pshmem_int_iput @@ -91,11 +92,13 @@ #pragma weak shmem_float_iput = pshmem_float_iput #pragma weak shmem_double_iput = pshmem_double_iput #pragma weak shmem_longdouble_iput = pshmem_longdouble_iput + #pragma weak shmem_ctx_iput8 = pshmem_ctx_iput8 #pragma weak shmem_ctx_iput16 = pshmem_ctx_iput16 #pragma weak shmem_ctx_iput32 = pshmem_ctx_iput32 #pragma weak shmem_ctx_iput64 = pshmem_ctx_iput64 #pragma weak shmem_ctx_iput128 = pshmem_ctx_iput128 + #pragma weak shmem_iput8 = pshmem_iput8 #pragma weak shmem_iput16 = pshmem_iput16 #pragma weak shmem_iput32 = pshmem_iput32 diff --git a/oshmem/shmem/c/shmem_or.c b/oshmem/shmem/c/shmem_or.c index 8e3ddf4a34f..e03e057a6ca 100644 --- a/oshmem/shmem/c/shmem_or.c +++ b/oshmem/shmem/c/shmem_or.c @@ -31,12 +31,14 @@ #pragma weak shmem_uint_atomic_or = pshmem_uint_atomic_or #pragma weak shmem_ulong_atomic_or = pshmem_ulong_atomic_or #pragma weak shmem_ulonglong_atomic_or = pshmem_ulonglong_atomic_or + #pragma weak shmem_ctx_int_atomic_or = pshmem_ctx_int_atomic_or #pragma weak shmem_ctx_long_atomic_or = pshmem_ctx_long_atomic_or #pragma weak shmem_ctx_longlong_atomic_or = pshmem_ctx_longlong_atomic_or #pragma weak shmem_ctx_uint_atomic_or = pshmem_ctx_uint_atomic_or #pragma weak shmem_ctx_ulong_atomic_or = pshmem_ctx_ulong_atomic_or #pragma weak shmem_ctx_ulonglong_atomic_or = pshmem_ctx_ulonglong_atomic_or + #pragma weak shmemx_int32_atomic_or = pshmemx_int32_atomic_or #pragma weak shmemx_int64_atomic_or = pshmemx_int64_atomic_or #pragma weak shmemx_uint32_atomic_or = pshmemx_uint32_atomic_or diff --git a/oshmem/shmem/c/shmem_p.c b/oshmem/shmem/c/shmem_p.c index 2df7c737989..782407d9d02 100644 --- a/oshmem/shmem/c/shmem_p.c +++ b/oshmem/shmem/c/shmem_p.c @@ -73,6 +73,7 @@ #pragma weak shmem_ctx_float_p = pshmem_ctx_float_p #pragma weak shmem_ctx_double_p = pshmem_ctx_double_p #pragma weak shmem_ctx_longdouble_p = pshmem_ctx_longdouble_p + #pragma weak shmem_char_p = pshmem_char_p #pragma weak shmem_short_p = pshmem_short_p #pragma weak shmem_int_p = pshmem_int_p @@ -87,6 +88,7 @@ #pragma weak shmem_float_p = pshmem_float_p #pragma weak shmem_double_p = pshmem_double_p #pragma weak shmem_longdouble_p = pshmem_longdouble_p + #pragma weak shmemx_int16_p = pshmemx_int16_p #pragma weak shmemx_int32_p = pshmemx_int32_p #pragma weak shmemx_int64_p = pshmemx_int64_p diff --git a/oshmem/shmem/c/shmem_put.c b/oshmem/shmem/c/shmem_put.c index ad829131f31..76a62a642db 100644 --- a/oshmem/shmem/c/shmem_put.c +++ b/oshmem/shmem/c/shmem_put.c @@ -74,6 +74,7 @@ #pragma weak shmem_ctx_float_put = pshmem_ctx_float_put #pragma weak shmem_ctx_double_put = pshmem_ctx_double_put #pragma weak shmem_ctx_longdouble_put = pshmem_ctx_longdouble_put + #pragma weak shmem_char_put = pshmem_char_put #pragma weak shmem_short_put = pshmem_short_put #pragma weak shmem_int_put = pshmem_int_put @@ -88,12 +89,14 @@ #pragma weak shmem_float_put = pshmem_float_put #pragma weak shmem_double_put = pshmem_double_put #pragma weak shmem_longdouble_put = pshmem_longdouble_put + #pragma weak shmem_ctx_putmem = pshmem_ctx_putmem #pragma weak shmem_ctx_put8 = pshmem_ctx_put8 #pragma weak shmem_ctx_put16 = pshmem_ctx_put16 #pragma weak shmem_ctx_put32 = pshmem_ctx_put32 #pragma weak shmem_ctx_put64 = pshmem_ctx_put64 #pragma weak shmem_ctx_put128 = pshmem_ctx_put128 + #pragma weak shmem_putmem = pshmem_putmem #pragma weak shmem_put8 = pshmem_put8 #pragma weak shmem_put16 = pshmem_put16 diff --git a/oshmem/shmem/c/shmem_put_nb.c b/oshmem/shmem/c/shmem_put_nb.c index 27926f90068..a04f50b5e2a 100644 --- a/oshmem/shmem/c/shmem_put_nb.c +++ b/oshmem/shmem/c/shmem_put_nb.c @@ -78,12 +78,14 @@ #pragma weak shmem_float_put_nbi = pshmem_float_put_nbi #pragma weak shmem_double_put_nbi = pshmem_double_put_nbi #pragma weak shmem_longdouble_put_nbi = pshmem_longdouble_put_nbi + #pragma weak shmem_put8_nbi = pshmem_put8_nbi #pragma weak shmem_put16_nbi = pshmem_put16_nbi #pragma weak shmem_put32_nbi = pshmem_put32_nbi #pragma weak shmem_put64_nbi = pshmem_put64_nbi #pragma weak shmem_put128_nbi = pshmem_put128_nbi #pragma weak shmem_putmem_nbi = pshmem_putmem_nbi + #pragma weak shmem_ctx_char_put_nbi = pshmem_ctx_char_put_nbi #pragma weak shmem_ctx_short_put_nbi = pshmem_ctx_short_put_nbi #pragma weak shmem_ctx_int_put_nbi = pshmem_ctx_int_put_nbi @@ -98,6 +100,7 @@ #pragma weak shmem_ctx_float_put_nbi = pshmem_ctx_float_put_nbi #pragma weak shmem_ctx_double_put_nbi = pshmem_ctx_double_put_nbi #pragma weak shmem_ctx_longdouble_put_nbi = pshmem_ctx_longdouble_put_nbi + #pragma weak shmem_ctx_put8_nbi = pshmem_ctx_put8_nbi #pragma weak shmem_ctx_put16_nbi = pshmem_ctx_put16_nbi #pragma weak shmem_ctx_put32_nbi = pshmem_ctx_put32_nbi diff --git a/oshmem/shmem/c/shmem_set.c b/oshmem/shmem/c/shmem_set.c index 78503dc66b4..5091882714e 100644 --- a/oshmem/shmem/c/shmem_set.c +++ b/oshmem/shmem/c/shmem_set.c @@ -67,6 +67,7 @@ #pragma weak shmem_ctx_ulonglong_atomic_set = pshmem_ctx_ulonglong_atomic_set #pragma weak shmem_ctx_float_atomic_set = pshmem_ctx_float_atomic_set #pragma weak shmem_ctx_double_atomic_set = pshmem_ctx_double_atomic_set + #pragma weak shmem_int_atomic_set = pshmem_int_atomic_set #pragma weak shmem_long_atomic_set = pshmem_long_atomic_set #pragma weak shmem_longlong_atomic_set = pshmem_longlong_atomic_set @@ -75,11 +76,13 @@ #pragma weak shmem_ulonglong_atomic_set = pshmem_ulonglong_atomic_set #pragma weak shmem_float_atomic_set = pshmem_float_atomic_set #pragma weak shmem_double_atomic_set = pshmem_double_atomic_set + #pragma weak shmem_int_set = pshmem_int_set #pragma weak shmem_long_set = pshmem_long_set #pragma weak shmem_longlong_set = pshmem_longlong_set #pragma weak shmem_float_set = pshmem_float_set #pragma weak shmem_double_set = pshmem_double_set + #pragma weak shmemx_int32_set = pshmemx_int32_set #pragma weak shmemx_int64_set = pshmemx_int64_set #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_swap.c b/oshmem/shmem/c/shmem_swap.c index 27b46a4e0f6..b6586d0934d 100644 --- a/oshmem/shmem/c/shmem_swap.c +++ b/oshmem/shmem/c/shmem_swap.c @@ -70,6 +70,7 @@ #pragma weak shmem_ctx_ulonglong_atomic_swap = pshmem_ctx_ulonglong_atomic_swap #pragma weak shmem_ctx_float_atomic_swap = pshmem_ctx_float_atomic_swap #pragma weak shmem_ctx_double_atomic_swap = pshmem_ctx_double_atomic_swap + #pragma weak shmem_int_atomic_swap = pshmem_int_atomic_swap #pragma weak shmem_long_atomic_swap = pshmem_long_atomic_swap #pragma weak shmem_longlong_atomic_swap = pshmem_longlong_atomic_swap @@ -78,11 +79,13 @@ #pragma weak shmem_ulonglong_atomic_swap = pshmem_ulonglong_atomic_swap #pragma weak shmem_float_atomic_swap = pshmem_float_atomic_swap #pragma weak shmem_double_atomic_swap = pshmem_double_atomic_swap + #pragma weak shmem_int_swap = pshmem_int_swap #pragma weak shmem_long_swap = pshmem_long_swap #pragma weak shmem_longlong_swap = pshmem_longlong_swap #pragma weak shmem_float_swap = pshmem_float_swap #pragma weak shmem_double_swap = pshmem_double_swap + #pragma weak shmemx_int32_swap = pshmemx_int32_swap #pragma weak shmemx_int64_swap = pshmemx_int64_swap #include "oshmem/shmem/c/profile/defines.h" diff --git a/oshmem/shmem/c/shmem_xor.c b/oshmem/shmem/c/shmem_xor.c index dd762ed98f4..0a2aa8af18d 100644 --- a/oshmem/shmem/c/shmem_xor.c +++ b/oshmem/shmem/c/shmem_xor.c @@ -31,12 +31,14 @@ #pragma weak shmem_uint_atomic_xor = pshmem_uint_atomic_xor #pragma weak shmem_ulong_atomic_xor = pshmem_ulong_atomic_xor #pragma weak shmem_ulonglong_atomic_xor = pshmem_ulonglong_atomic_xor + #pragma weak shmem_ctx_int_atomic_xor = pshmem_ctx_int_atomic_xor #pragma weak shmem_ctx_long_atomic_xor = pshmem_ctx_long_atomic_xor #pragma weak shmem_ctx_longlong_atomic_xor = pshmem_ctx_longlong_atomic_xor #pragma weak shmem_ctx_uint_atomic_xor = pshmem_ctx_uint_atomic_xor #pragma weak shmem_ctx_ulong_atomic_xor = pshmem_ctx_ulong_atomic_xor #pragma weak shmem_ctx_ulonglong_atomic_xor = pshmem_ctx_ulonglong_atomic_xor + #pragma weak shmemx_int32_atomic_xor = pshmemx_int32_atomic_xor #pragma weak shmemx_int64_atomic_xor = pshmemx_int64_atomic_xor #pragma weak shmemx_uint32_atomic_xor = pshmemx_uint32_atomic_xor From bbfde1533bdf398aaf0a70a8f8eae5e118ca0020 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 31 Oct 2018 14:50:15 -0600 Subject: [PATCH 172/674] btl/openib: fix a problem with ib query Under certain circumstances, ibv_exp_query_device was returning an error due to uninitialized fields in the extended attributes struct. Fixes: #5810 Fixes: #5914 Signed-off-by: Howard Pritchard (cherry picked from commit 8126779a354b3e0c720d3e1790f7b936dd5b93b2) --- opal/mca/btl/openib/btl_openib_component.c | 1 + 1 file changed, 1 insertion(+) diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index 28fd735ab96..5c7cce7b57b 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -1692,6 +1692,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev) goto error; } #if HAVE_DECL_IBV_EXP_QUERY_DEVICE + memset(&device->ib_exp_dev_attr, 0, sizeof(device->ib_exp_dev_attr)); device->ib_exp_dev_attr.comp_mask = IBV_EXP_DEVICE_ATTR_RESERVED - 1; if(ibv_exp_query_device(device->ib_dev_context, &device->ib_exp_dev_attr)){ BTL_ERROR(("error obtaining device attributes for %s errno says %s", From 2d3b4bb91abb078e7c2abfe65e8b19dcc33aab10 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Wed, 31 Oct 2018 04:37:10 -0500 Subject: [PATCH 173/674] mpi.h: restore some MPI-deprecated items to default builds Commit 89da9651b inadvertantly #if'ed out both deprecated *and* removed items from mpi.h. The intent was only to #if out items that have been *removed* from the MPI specification and leave all items that are merely deprecated. This commit also re-orders the deleted typedef+functions to be in the same order as they are listed in MPI-3.1 chapter 17, just to make verifying/checking the code easier. Note that --enable-mpi1-compatibility can still be used to restore prototypes for the items that have been removed from the MPI specification (e.g., MPI_Address()). Signed-off-by: Geoffrey Paulsen Signed-off-by: Jeff Squyres (cherry picked from commit b03a39d359b019d2d7803d194fd03b2fcdffddce) --- ompi/include/mpi.h.in | 248 ++++++++++++++++++++++++------------------ 1 file changed, 140 insertions(+), 108 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 2db11d336f6..0cf5c1f94f7 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -19,7 +19,7 @@ * 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) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2017-2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -377,7 +377,6 @@ typedef struct ompi_status_public_t ompi_status_public_t; /* * User typedefs - * */ typedef int (MPI_Datarep_extent_function)(MPI_Datatype, MPI_Aint *, void *); typedef int (MPI_Datarep_conversion_function)(void *, MPI_Datatype, @@ -389,7 +388,6 @@ typedef void (MPI_Comm_errhandler_function)(MPI_Comm *, int *, ...); allows us to maintain a stable ABI within OMPI, at least for apps that don't use MPI I/O. */ typedef void (ompi_file_errhandler_fn)(MPI_File *, int *, ...); -typedef ompi_file_errhandler_fn MPI_File_errhandler_function; typedef void (MPI_Win_errhandler_function)(MPI_Win *, int *, ...); typedef void (MPI_User_function)(void *, void *, int *, MPI_Datatype *); typedef int (MPI_Comm_copy_attr_function)(MPI_Comm, int, void *, @@ -406,28 +404,17 @@ typedef int (MPI_Grequest_query_function)(void *, MPI_Status *); typedef int (MPI_Grequest_free_function)(void *); typedef int (MPI_Grequest_cancel_function)(void *, int); -#if !OMPI_OMIT_MPI1_COMPAT_DECLS /* - * Removed typedefs. These will be deleted in a future Open MPI release. + * Deprecated typedefs. Usage is discouraged, as these may be deleted + * in future versions of the MPI Standard. */ typedef MPI_Comm_errhandler_function MPI_Comm_errhandler_fn - __mpi_interface_removed__("MPI_Comm_errhandler_fn was removed in MPI-3.0; use MPI_Comm_errhandler_function instead"); + __mpi_interface_deprecated__("MPI_Comm_errhandler_fn was deprecated in MPI-2.2; use MPI_Comm_errhandler_function instead"); typedef ompi_file_errhandler_fn MPI_File_errhandler_fn - __mpi_interface_removed__("MPI_File_errhandler_fn was removed in MPI-3.0; use MPI_File_errhandler_function instead"); + __mpi_interface_deprecated__("MPI_File_errhandler_fn was deprecated in MPI-2.2; use MPI_File_errhandler_function instead"); +typedef ompi_file_errhandler_fn MPI_File_errhandler_function; typedef MPI_Win_errhandler_function MPI_Win_errhandler_fn - __mpi_interface_removed__("MPI_Win_errhandler_fn was removed in MPI-3.0; use MPI_Win_errhandler_function instead"); - -/* - * NOTE: We intentionally do *not* mark the following as - * deprecated/removed because they are used below in function - * prototypes (and would therefore emit warnings, just for #including - * ). - */ -typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...); -typedef int (MPI_Copy_function)(MPI_Comm, int, void *, - void *, void *, int *); -typedef int (MPI_Delete_function)(MPI_Comm, int, void *, void *); -#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ + __mpi_interface_deprecated__("MPI_Win_errhandler_fn was deprecated in MPI-2.2; use MPI_Win_errhandler_function instead"); /* @@ -806,9 +793,6 @@ enum { protection for this case. */ #if !defined(OMPI_COMPILING_FORTRAN_WRAPPERS) -#define MPI_NULL_DELETE_FN OMPI_C_MPI_NULL_DELETE_FN -#define MPI_NULL_COPY_FN OMPI_C_MPI_NULL_COPY_FN -#define MPI_DUP_FN OMPI_C_MPI_DUP_FN #define MPI_TYPE_NULL_DELETE_FN OMPI_C_MPI_TYPE_NULL_DELETE_FN #define MPI_TYPE_NULL_COPY_FN OMPI_C_MPI_TYPE_NULL_COPY_FN @@ -877,24 +861,6 @@ OMPI_DECLSPEC int OMPI_C_MPI_WIN_DUP_FN( MPI_Win window, int win_keyval, void* attribute_val_in, void* attribute_val_out, int* flag ); -#if !OMPI_OMIT_MPI1_COMPAT_DECLS -/* - * Removed in MPI-3.0. Will be deleted in a future Open MPI release. - */ -OMPI_DECLSPEC int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, - void* attribute_val_out, - void* extra_state ); -OMPI_DECLSPEC int OMPI_C_MPI_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, - void* extra_state, - void* attribute_val_in, - void* attribute_val_out, - int* flag ); -OMPI_DECLSPEC int OMPI_C_MPI_DUP_FN( MPI_Comm comm, int comm_keyval, - void* extra_state, - void* attribute_val_in, - void* attribute_val_out, - int* flag ); -#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ /* * External variables @@ -1037,10 +1003,19 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; #if !OMPI_OMIT_MPI1_COMPAT_DECLS /* - * Removed datatypes + * Removed datatypes. These datatypes are only available if Open MPI + * was configured with --enable-mpi1-compatibility. + * + * These datatypes were formally removed from the MPI specification + * and should no longer be used in MPI applications. */ -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb __mpi_interface_removed__("MPI_LB was removed in MPI-3.0"); -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub __mpi_interface_removed__("MPI_UB was removed in MPI-3.0"); +#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) +#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) + +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb + __mpi_interface_removed__("MPI_LB was removed in MPI-3.0; use MPI_Type_create_resized instead."); +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub + __mpi_interface_removed__("MPI_UB was removed in MPI-3.0; use MPI_Type_create_resized instead."); #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ /* @@ -1090,13 +1065,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub __mpi_interfa #define MPI_LONG_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_long_int) #define MPI_SHORT_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_short_int) #define MPI_2INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_2int) -#if !OMPI_OMIT_MPI1_COMPAT_DECLS -/* - * Removed datatypes - */ -#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) -#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) -#endif + #define MPI_WCHAR OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_wchar) #if OPAL_HAVE_LONG_LONG #define MPI_LONG_LONG_INT OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_long_long_int) @@ -2624,89 +2593,152 @@ OMPI_DECLSPEC int MPI_T_pvar_readreset(MPI_T_pvar_session session, MPI_T_pvar_h OMPI_DECLSPEC int MPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *name, int *name_len); OMPI_DECLSPEC int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, int *name_len); - -#if !OMPI_OMIT_MPI1_COMPAT_DECLS /* - * Removed APIs + * Deprecated prototypes. Usage is discouraged, as these may be + * deleted in future versions of the MPI Standard. */ -OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("MPI_Address is superseded by MPI_Get_address in MPI-2.0"); OMPI_DECLSPEC int MPI_Attr_delete(MPI_Comm comm, int keyval) - __mpi_interface_deprecated__("MPI_Attr_delete is superseded by MPI_Comm_delete_attr in MPI-2.0"); + __mpi_interface_deprecated__("MPI_Attr_delete was deprecated in MPI-2.0; use MPI_Comm_delete_attr instead"); +OMPI_DECLSPEC int PMPI_Attr_delete(MPI_Comm comm, int keyval) + __mpi_interface_deprecated__("PMPI_Attr_delete was deprecated in MPI-2.0; use PMPI_Comm_delete_attr instead"); OMPI_DECLSPEC int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) - __mpi_interface_deprecated__("MPI_Attr_get is superseded by MPI_Comm_get_attr in MPI-2.0"); + __mpi_interface_deprecated__("MPI_Attr_get was deprecated in MPI-2.0; use MPI_Comm_get_attr instead"); +OMPI_DECLSPEC int PMPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) + __mpi_interface_deprecated__("PMPI_Attr_get was deprecated in MPI-2.0; use PMPI_Comm_get_attr instead"); OMPI_DECLSPEC int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) - __mpi_interface_deprecated__("MPI_Attr_put is superseded by MPI_Comm_set_attr in MPI-2.0"); -OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function, - MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_create is superseded by MPI_Comm_create_errhandler in MPI-2.0"); -OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_get is superseded by MPI_Comm_get_errhandler in MPI-2.0"); -OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("MPI_Errhandler_set is superseded by MPI_Comm_set_errhandler in MPI-2.0"); + __mpi_interface_deprecated__("MPI_Attr_put was deprecated in MPI-2.0; use MPI_Comm_set_attr instead"); +OMPI_DECLSPEC int PMPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) + __mpi_interface_deprecated__("PMPI_Attr_put was deprecated in MPI-2.0; use PMPI_Comm_set_attr instead"); + +/* + * Even though MPI_Copy_function and MPI_Delete_function are + * deprecated, we do not use the attributes marking them as such, + * because otherwise the compiler will warn for all the functions that + * are declared using them (e.g., MPI_Keyval_create). + */ +typedef int (MPI_Copy_function)(MPI_Comm, int, void *, + void *, void *, int *); +/* MPI_Copy_function was deprecated in MPI-2.0; use MPI_Comm_copy_attr_function instead. */ +typedef int (MPI_Delete_function)(MPI_Comm, int, void *, void *); +/* MPI_Delete_function was deprecated in MPI-2.0; use MPI_Comm_delete_attr_function instead. */ OMPI_DECLSPEC int MPI_Keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void *extra_state) - __mpi_interface_deprecated__("MPI_Keyval_create is superseded by MPI_Comm_create_keyval in MPI-2.0"); + __mpi_interface_deprecated__("MPI_Keyval_create was deprecated in MPI-2.0; use MPI_Comm_create_keyval instead."); +OMPI_DECLSPEC int PMPI_Keyval_create(MPI_Copy_function *copy_fn, + MPI_Delete_function *delete_fn, + int *keyval, void *extra_state) + __mpi_interface_deprecated__("PMPI_Keyval_create was deprecated in MPI-2.0; use PMPI_Comm_create_keyval instead."); OMPI_DECLSPEC int MPI_Keyval_free(int *keyval) - __mpi_interface_deprecated__("MPI_Keyval_free is superseded by MPI_Comm_free_keyval in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("MPI_Type_extent is superseded by MPI_Type_get_extent in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[], - MPI_Aint array_of_displacements[], - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hindexed is superseded by MPI_Type_create_hindexed in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, - MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("MPI_Type_lb has been removed, use MPI_Type_get_extent in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[], - MPI_Aint array_of_displacements[], - MPI_Datatype array_of_types[], - MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_struct is superseded by MPI_Type_create_struct in MPI-2.0"); -OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("MPI_Type_ub has been removed, use MPI_Type_get_extent in MPI-2.0"); + __mpi_interface_deprecated__("MPI_Keyval_free was deprecated in MPI-2.0; MPI_Comm_free_keyval instead."); +OMPI_DECLSPEC int PMPI_Keyval_free(int *keyval) + __mpi_interface_deprecated__("PMPI_Keyval_free was deprecated in MPI-2.0; PMPI_Comm_free_keyval instead."); + +#if !defined(OMPI_COMPILING_FORTRAN_WRAPPERS) +#define MPI_DUP_FN OMPI_C_MPI_DUP_FN +#endif +OMPI_DECLSPEC int OMPI_C_MPI_DUP_FN( MPI_Comm comm, int comm_keyval, + void* extra_state, + void* attribute_val_in, + void* attribute_val_out, + int* flag ) + __mpi_interface_deprecated__("MPI_DUP_FN was deprecated in MPI-2.0; use MPI_COMM_DUP_FN instead."); + +#if !defined(OMPI_COMPILING_FORTRAN_WRAPPERS) +#define MPI_NULL_COPY_FN OMPI_C_MPI_NULL_COPY_FN +#endif +OMPI_DECLSPEC int OMPI_C_MPI_NULL_COPY_FN( MPI_Comm comm, int comm_keyval, + void* extra_state, + void* attribute_val_in, + void* attribute_val_out, + int* flag ) + __mpi_interface_deprecated__("MPI_NULL_COPY_FN was deprecated in MPI-2.0; use MPI_COMM_NULL_COPY_FN instead."); + +#if !defined(OMPI_COMPILING_FORTRAN_WRAPPERS) +#define MPI_NULL_DELETE_FN OMPI_C_MPI_NULL_DELETE_FN +#endif +OMPI_DECLSPEC int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, + void* attribute_val_out, + void* extra_state ) + __mpi_interface_deprecated__("MPI_NULL_DELETE_FN was deprecated in MPI-2.0; use MPI_COMM_NULL_DELETE_FN instead."); + +#if !OMPI_OMIT_MPI1_COMPAT_DECLS +/* + * Removed typedefs. These typedefs are only available if Open MPI + * was configured with --enable-mpi1-compatibility. + * + * These typedefs were formally removed from the MPI specification + * and should no longer be used in MPI applications. + * + * Even though MPI_Handler_function is removed, we do not use the + * attributes marking it as such, because otherwise the compiler + * will warn for all the functions that are declared using them + * (e.g., MPI_Errhandler_create). + */ +typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...); +/* MPI_Handler_function was removed in MPI-3.0; use MPI_Comm_use_errhandler_function instead. */ + +/* + * Removed prototypes. These prototypes are only available if Open + * MPI was configured with --enable-mpi1-compatibility. + * + * These functions were formally removed from the MPI specification + * and should no longer be used in MPI applications. + */ +OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address) + __mpi_interface_removed__("MPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("MPI_Address is superseded by MPI_Get_address in MPI-2.0"); -OMPI_DECLSPEC int PMPI_Attr_delete(MPI_Comm comm, int keyval) - __mpi_interface_deprecated__("MPI_Attr_delete is superseded by MPI_Comm_delete_attr in MPI-2.0"); -OMPI_DECLSPEC int PMPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag) - __mpi_interface_deprecated__("MPI_Attr_get is superseded by MPI_Comm_get_attr in MPI-2.0"); -OMPI_DECLSPEC int PMPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val) - __mpi_interface_deprecated__("MPI_Attr_put is superseded by MPI_Comm_set_attr in MPI-2.0"); + __mpi_interface_removed__("PMPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); +OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function, + MPI_Errhandler *errhandler) + __mpi_interface_removed__("MPI_Errhandler_create was removed in MPI-3.0; use MPI_Comm_create_errhandler instead."); OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_create is superseded by MPI_Comm_create_errhandler in MPI-2.0"); + __mpi_interface_removed__("PMPI_Errhandler_create was removed in MPI-3.0; use PMPI_Comm_create_errhandler instead."); +OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) + __mpi_interface_removed__("MPI_Errhandler_get was removed in MPI-3.0; use MPI_Comm_get_errhandler instead."); OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_get is superseded by MPI_Comm_get_errhandler in MPI-2.0"); + __mpi_interface_removed__("PMPI_Errhandler_get was removed in MPI-3.0; use PMPI_Comm_get_errhandler instead."); +OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) + __mpi_interface_removed__("MPI_Errhandler_set was removed in MPI-3.0; use MPI_Comm_set_errhandler instead."); OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("MPI_Errhandler_set is superseded by MPI_Comm_set_errhandler in MPI-2.0"); -OMPI_DECLSPEC int PMPI_Keyval_create(MPI_Copy_function *copy_fn, - MPI_Delete_function *delete_fn, - int *keyval, void *extra_state) - __mpi_interface_deprecated__("MPI_Keyval_create is superseded by MPI_Comm_create_keyval in MPI-2.0"); -OMPI_DECLSPEC int PMPI_Keyval_free(int *keyval) - __mpi_interface_deprecated__("MPI_Keyval_free is superseded by MPI_Comm_free_keyval in MPI-2.0"); + __mpi_interface_removed__("PMPI_Errhandler_set was removed in MPI-3.0; use PMPI_Comm_set_errhandler instead."); +OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) + __mpi_interface_removed__("MPI_Type_extent was removed in MPI-3.0; use MPI_Type_get_extent instead."); OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("MPI_Type_extent is superseded by MPI_Type_get_extent in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_extent was removed in MPI-3.0; use PMPI_Type_get_extent instead."); +OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[], + MPI_Aint array_of_displacements[], + MPI_Datatype oldtype, MPI_Datatype *newtype) + __mpi_interface_removed__("MPI_Type_hindexed was removed in MPI-3.0; use MPI_Type_create_hindexed instead."); OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hindexed is superseded by MPI_Type_create_hindexed in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_hindexed was removed in MPI-3.0; use PMPI_Type_create_hindexed instead."); +OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, + MPI_Datatype oldtype, MPI_Datatype *newtype) + __mpi_interface_removed__("MPI_Type_hvector was removed in MPI-3.0; use MPI_Type_create_hvector instead."); OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_hvector was removed in MPI-3.0; use PMPI_Type_create_hvector instead."); +OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) + __mpi_interface_removed__("MPI_Type_lb has been removed in MPI-3.0; use MPI_Type_get_extent instead."); OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("MPI_Type_lb has been removed, use MPI_Type_get_extent in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_lb has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); +OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[], + MPI_Aint array_of_displacements[], + MPI_Datatype array_of_types[], + MPI_Datatype *newtype) + __mpi_interface_removed__("MPI_Type_struct was removed in MPI-3.0; use MPI_Type_create_struct instead."); OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype array_of_types[], MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_struct is superseded by MPI_Type_create_struct in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_struct was removed in MPI-3.0; use PMPI_Type_create_struct instead."); +OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) + __mpi_interface_removed__("MPI_Type_ub has been removed in MPI-3.0; use MPI_Type_get_extent instead."); OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("MPI_Type_ub has been removed, use MPI_Type_get_extent in MPI-2.0"); + __mpi_interface_removed__("PMPI_Type_ub has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ #if defined(c_plusplus) || defined(__cplusplus) From f5dbecd5e768a6641bf52562e329279d4a8c7828 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 5 Nov 2018 02:25:43 -0600 Subject: [PATCH 174/674] README: updating LSF version supported to 9.1.1 or later Signed-off-by: Geoffrey Paulsen (cherry picked from commit 010059589877a4e7985a1c4daa86fd74ea840ab0) --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index bdfbd26eef4..ae3e5695098 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007 Myricom, Inc. All rights reserved. -Copyright (c) 2008-2017 IBM Corporation. All rights reserved. +Copyright (c) 2008-2018 IBM Corporation. All rights reserved. Copyright (c) 2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2011 University of Houston. All rights reserved. Copyright (c) 2013-2017 Intel, Inc. All rights reserved. @@ -115,7 +115,7 @@ General notes - The run-time systems that are currently supported are: - rsh / ssh - PBS Pro, Torque - - Platform LSF (v7.0.2 and later) + - Platform LSF (v9.1.1 and later) - SLURM - Cray XE, XC, and XK - Oracle Grid Engine (OGE) 6.1, 6.2 and open source Grid Engine From e57c3fb3c9c4775e36efe9321acd8f64f1743094 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 5 Nov 2018 11:45:42 -0700 Subject: [PATCH 175/674] opal/asm: work around possible gcc compiler bug It seems in some cases (gcc older than v6.0.0) the __atomic_thread_fence is a no-op with __ATOMIC_ACQUIRE. This appears to be the case with X86_64 so go ahead and use __ATOMIC_SEQ_CST for the x86_64 read memory barrier. This should not cause any performance issues as it is equivalent to the memory barrier in the hand-written atomics. References #6014 Signed-off-by: Nathan Hjelm (cherry picked from commit 30119ee339eea086f43e3392352899187a4a73c7) Signed-off-by: Nathan Hjelm --- opal/include/opal/sys/gcc_builtin/atomic.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opal/include/opal/sys/gcc_builtin/atomic.h b/opal/include/opal/sys/gcc_builtin/atomic.h index c6ef6eb9c30..d85ff02bd6a 100644 --- a/opal/include/opal/sys/gcc_builtin/atomic.h +++ b/opal/include/opal/sys/gcc_builtin/atomic.h @@ -15,6 +15,8 @@ * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +59,14 @@ static inline void opal_atomic_mb(void) static inline void opal_atomic_rmb(void) { +#if OPAL_ASSEMBLY_ARCH == OPAL_X86_64 + /* work around a bug in older gcc versions where ACQUIRE seems to get + * treated as a no-op instead of being equivalent to + * __asm__ __volatile__("": : :"memory") */ + __atomic_thread_fence (__ATOMIC_SEQ_CST); +#else __atomic_thread_fence (__ATOMIC_ACQUIRE); +#endif } static inline void opal_atomic_wmb(void) From 5efc76ef4436b29b5f7ce04d2efbe91258cb4f59 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 6 Nov 2018 10:37:14 -0700 Subject: [PATCH 176/674] pmix3x: fix potential memory barrier bug with __atomic builtin atomics See open-mpi/ompi#6014 for more information. Signed-off-by: Nathan Hjelm --- .../pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h index 0c47d83988e..1bd1110dce8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h @@ -16,6 +16,8 @@ * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,7 +60,14 @@ static inline void pmix_atomic_mb(void) static inline void pmix_atomic_rmb(void) { +#if OPAL_ASSEMBLY_ARCH == OPAL_X86_64 + /* work around a bug in older gcc versions where ACQUIRE seems to get + * treated as a no-op instead of being equivalent to + * __asm__ __volatile__("": : :"memory") */ + __atomic_thread_fence (__ATOMIC_SEQ_CST); +#else __atomic_thread_fence (__ATOMIC_ACQUIRE); +#endif } static inline void pmix_atomic_wmb(void) From d0efdfd9c86ce22800fb7d50b6ac7191810520fa Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 3 Nov 2018 16:20:45 -0400 Subject: [PATCH 177/674] MPI_Type_get_envelope: remove MPI-1 deleted names Several names are now no longer returned by MPI_Type_get_envelope. Signed-off-by: Jeff Squyres (cherry picked from commit 65eb118e087b0bdaa9c92a12eba151eb30994590) --- ompi/mpi/man/man3/MPI_Type_get_envelope.3in | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/ompi/mpi/man/man3/MPI_Type_get_envelope.3in b/ompi/mpi/man/man3/MPI_Type_get_envelope.3in index 5832e9094ea..e624a291c04 100644 --- a/ompi/mpi/man/man3/MPI_Type_get_envelope.3in +++ b/ompi/mpi/man/man3/MPI_Type_get_envelope.3in @@ -84,20 +84,11 @@ MPI_COMBINER_NAMED a named predefined data type MPI_COMBINER_DUP MPI_Type_dup MPI_COMBINER_CONTIGUOUS MPI_Type_contiguous MPI_COMBINER_VECTOR MPI_Type_vector -MPI_COMBINER_HVECTOR_INTEGER MPI_Type_hvector from Fortran -MPI_COMBINER_HVECTOR MPI_Type_hvector from C or C++ - and MPI_Type_create for - all languages +MPI_COMBINER_HVECTOR MPI_Type_hvector MPI_COMBINER_INDEXED MPI_Type_indexed -MPI_COMBINER_HINDEXED_INTEGER MPI_Type_hindexed from Fortran -MPI_COMBINER_HINDEXED MPI_Type_hindexed from C or C++ - and MPI_Type_create_hindexed - for all languages +MPI_COMBINER_HINDEXED MPI_Type_hindexed MPI_COMBINER_INDEXED_BLOCK MPI_Type_create_indexed_block -MPI_COMBINER_STRUCT_INTEGER MPI_Type_struct from Fortran -MPI_COMBINER_STRUCT MPI_Type_struct from C or C++ - and MPI_Type_create_struct - for all languages +MPI_COMBINER_STRUCT MPI_Type_struct MPI_COMBINER_SUBARRAY MPI_Type_create_subarray MPI_COMBINER_DARRAY MPI_Type_create_darray MPI_COMBINER_F90_REAL MPI_Type_create_f90_real From f149f64f7ec76aa1c4e23e795da84611a2ae6646 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 3 Nov 2018 16:25:16 -0400 Subject: [PATCH 178/674] README: Update information about UCX Signed-off-by: Jeff Squyres (cherry picked from commit 78552e81c1b66a2a3e0e4c27e5c9994c4b6ed52f) --- README | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/README b/README index ae3e5695098..05e18cbf35e 100644 --- a/README +++ b/README @@ -705,6 +705,32 @@ Network Support mechanisms for Open MPI to utilize single-copy semantics for shared memory. +- In prior versions of Open MPI, InfiniBand and RoCE support was + provided through the openib BTL and ob1 PML plugins. Starting with + Open MPI 4.0.0, InfiniBand support through the openib+ob1 plugins is + both deprecated and superseded by the UCX PML component. + + UCX is an open-source optimized communication library which supports + multiple networks, including RoCE, InfiniBand, uGNI, TCP, shared + memory, and others. + + While the openib BTL depended on libibverbs, the UCX PML depends on + the UCX library. The UCX library can be downloaded from + http://www.openucx.org/ or from various Linux distribution + repositories (e.g., Fedora/RedHat yum repositories). The UCX + library is also part of Mellanox OFED and Mellanox HPC-X binary + distributions. + + Once installed, Open MPI can be built with UCX support by adding + --with-ucx to the Open MPI configure command. Once Open MPI is + configured to use UCX, the runtime will automatically select the UCX + PML if one of the supported networks is detected (e.g., InfiniBand). + It's possible to force using UCX in the mpirun or oshrun command + lines by specifying any or all of the following mca parameters: + "-mca pml ucx" for MPI point-to-point operations, "-mca spml ucx" + for OpenSHMEM support, and "-mca osc ucx" for MPI RMA (one-sided) + operations. + Open MPI Extensions ------------------- @@ -1017,6 +1043,19 @@ NETWORKING SUPPORT / OPTIONS covers most cases. This option is only needed for special configurations. +--with-ucx= + Specify the directory where the UCX libraries and header files are + located. This option is generally only necessary if the UCX headers + and libraries are not in default compiler/linker search paths. + +--with-ucx-libdir= + Look in directory for the UCX libraries. By default, Open MPI will + look in /lib and /lib64, which covers + most cases. This option is only needed for special configurations. + +--with-usnic + Abort configure if Cisco usNIC support cannot be built. + --with-verbs= Specify the directory where the verbs (also known as OpenFabrics verbs, or Linux verbs, and previously known as OpenIB) libraries and @@ -1062,8 +1101,6 @@ NETWORKING SUPPORT / OPTIONS package, configure will safely abort with a helpful message telling you that you should not use --with-verbs-usnic. ---with-usnic - Abort configure if Cisco usNIC support cannot be built. RUN-TIME SYSTEM SUPPORT @@ -1999,7 +2036,7 @@ timer - High-resolution timers Each framework typically has one or more components that are used at run-time. For example, the btl framework is used by the MPI layer to send bytes across different types underlying networks. The tcp btl, -for example, sends messages across TCP-based networks; the openib btl +for example, sends messages across TCP-based networks; the UCX PML sends messages across OpenFabrics-based networks. Each component typically has some tunable parameters that can be From 740567ff92b8a86c1a52579c12d3dddfb118636e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 3 Nov 2018 16:25:29 -0400 Subject: [PATCH 179/674] README: Add extensive information about deleted MPI-1 syms Signed-off-by: Jeff Squyres (cherry picked from commit e2ab41efac01c965a205cf020844d7ff5cc54de7) --- README | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README b/README index 05e18cbf35e..60b3e576fe7 100644 --- a/README +++ b/README @@ -479,6 +479,56 @@ MPI Functionality and Features - All MPI-3 functionality is supported. +- Note that starting with Open MPI v4.0.0, prototypes for several + legacy MPI-1 symbols that were deleted in the MPI-3.0 specification + (which was published in 2012) are no longer available by default in + mpi.h. Specifically, several MPI-1 symbols were deprecated in the + 1996 publishing of the MPI-2.0 specification. These deprecated + symbols were eventually removed from the MPI-3.0 specification in + 2012. + + The symbols that now no longer appear by default in Open MPI's mpi.h + are: + + - MPI_Address (replaced by MPI_Get_address) + - MPI_Errhandler_create (replaced by MPI_Comm_create_errhandler) + - MPI_Errhandler_get (replaced by MPI_Comm_get_errhandler) + - MPI_Errhandler_set (replaced by MPI_Comm_set_errhandler) + - MPI_Type_extent (replaced by MPI_Type_get_extent) + - MPI_Type_hindexed (replaced by MPI_Type_create_hindexed) + - MPI_Type_hvector (replaced by MPI_Type_create_hvector) + - MPI_Type_lb (replaced by MPI_Type_get_extent) + - MPI_Type_struct (replaced by MPI_Type_create_struct) + - MPI_Type_ub (replaced by MPI_Type_get_extent) + - MPI_LB (replaced by MPI_Type_create_resized) + - MPI_UB (replaced by MPI_Type_create_resized) + - MPI_COMBINER_HINDEXED_INTEGER + - MPI_COMBINER_HVECTOR_INTEGER + - MPI_COMBINER_STRUCT_INTEGER + - MPI_Handler_function (replaced by MPI_Comm_errhandler_function) + + Although these symbols are no longer prototyped in mpi.h, they + are still present in the MPI library in Open MPI v4.0.x. This + enables legacy MPI applications to link and run successfully with + Open MPI v4.0.x, even though they will fail to compile. + + *** Future releases of Open MPI beyond the v4.0.x series may + remove these symbols altogether. + + *** The Open MPI team STRONGLY encourages all MPI application + developers to stop using these constructs that were first + deprecated over 20 years ago, and finally removed from the MPI + specification in MPI-3.0 (in 2012). + + *** The Open MPI FAQ (https://www.open-mpi.org/faq/) contains + examples of how to update legacy MPI applications using these + deleted symbols to use the "new" symbols. + + All that being said, if you are unable to immediately update your + application to stop using these legacy MPI-1 symbols, you can + re-enable them in mpi.h by configuring Open MPI with the + --enable-mpi-compatibility flag. + - Rank reordering support is available using the TreeMatch library. It is activated for the graph and dist_graph topologies. From 7cb6cbc80f165702b1db0f571dcabd98b59357fa Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 3 Nov 2018 15:28:32 -0700 Subject: [PATCH 180/674] README: More updates for v4.0.0 Move the UCX and MXM text up to flow better with the rest of the text+content. Also emphasize that MXM is deprecated. Signed-off-by: Jeff Squyres (cherry picked from commit 4ec8e6fe2250f67b8a2213f0699a9ee18c3d1a91) --- README | 153 +++++++++++++++++++++++++++++++++------------------------ 1 file changed, 89 insertions(+), 64 deletions(-) diff --git a/README b/README index 60b3e576fe7..e5051541818 100644 --- a/README +++ b/README @@ -640,11 +640,11 @@ OpenSHMEM Collectives Network Support --------------- -- There are four main MPI network models available: "ob1", "cm", - "yalla", and "ucx". "ob1" uses BTL ("Byte Transfer Layer") +- There are several main MPI network models available: "ob1", "cm", + "ucx", and "yalla". "ob1" uses BTL ("Byte Transfer Layer") components for each supported network. "cm" uses MTL ("Matching - Transport Layer") components for each supported network. "yalla" - uses the Mellanox MXM transport. "ucx" uses the OpenUCX transport. + Transport Layer") components for each supported network. "ucx" uses + the OpenUCX transport. - "ob1" supports a variety of networks that can be used in combination with each other: @@ -667,42 +667,93 @@ Network Support - OpenFabrics Interfaces ("libfabric" tag matching) - Portals 4 - Open MPI will, by default, choose to use "cm" when one of the - above transports can be used, unless OpenUCX or MXM support is - detected, in which case the "ucx" or "yalla" PML will be used - by default. Otherwise, "ob1" will be used and the corresponding - BTLs will be selected. Users can force the use of ob1 or cm if - desired by setting the "pml" MCA parameter at run-time: + - UCX is the Unified Communication X (UCX) communication library + (http://www.openucx.org/). This is an open-source project + developed in collaboration between industry, laboratories, and + academia to create an open-source production grade communication + framework for data centric and high-performance applications. The + UCX library can be downloaded from repositories (e.g., + Fedora/RedHat yum repositories). The UCX library is also part of + Mellanox OFED and Mellanox HPC-X binary distributions. - shell$ mpirun --mca pml ob1 ... + UCX currently supports: + + - OpenFabrics Verbs (including InfiniBand and RoCE) + - Cray's uGNI + - TCP + - Shared memory + - NVIDIA CUDA drivers + + While users can manually select any of the above transports at run + time, Open MPI will select a default transport as follows: + + 1. If InfiniBand devices are available, use the UCX PML. + + 2. If PSM, PSM2, or other tag-matching-supporting Libfabric + transport devices are available (e.g., Cray uGNI), use the "cm" + PML and a single appropriate corresponding "mtl" module. + + 3. If MXM/InfiniBand devices are availble, use the "yalla" PML + (NOTE: the "yalla"/MXM PML is deprecated -- see below). + + 4. Otherwise, use the ob1 PML and one or more appropriate "btl" + modules. + + Users can override Open MPI's default selection algorithms and force + the use of a specific transport if desired by setting the "pml" MCA + parameter (and potentially the "btl" and/or "mtl" MCA parameters) at + run-time: + + shell$ mpirun --mca pml ob1 --mca btl [comma-delimted-BTLs] ... + or + shell$ mpirun --mca pml cm --mca mtl [MTL] ... or - shell$ mpirun --mca pml cm ... - -- Similarly, there are two OpenSHMEM network models available: "ucx", - and "ikrit": - - "ucx" interfaces directly with UCX; - - "ikrit" interfaces directly with Mellanox MXM. - -- UCX is the Unified Communication X (UCX) communication library - (http://www.openucx.org/). - This is an open-source project developed in collaboration between - industry, laboratories, and academia to create an open-source - production grade communication framework for data centric and - high-performance applications. - UCX currently supports: - - OFA Verbs; - - Cray's uGNI; - - NVIDIA CUDA drivers. - -- MXM is the Mellanox Messaging Accelerator library utilizing a full - range of IB transports to provide the following messaging services - to the upper level MPI/OpenSHMEM libraries: - - - Usage of all available IB transports - - Native RDMA support - - Progress thread - - Shared memory communication - - Hardware-assisted reliability + shell$ mpirun --mca pml ucx ... + + As alluded to above, there is actually a fourth MPI point-to-point + transport, but it is deprecated and will likely be removed in a + future Open MPI release: + + - "yalla" uses the Mellanox MXM transport library. MXM is the + deprecated Mellanox Messaging Accelerator library, utilizing a + full range of IB transports to provide the following messaging + services to the upper level MPI/OpenSHMEM libraries. MXM is only + included in this release of Open MPI for backwards compatibility; + the "ucx" PML should be used insead. + +- The main OpenSHMEM network model is "ucx"; it interfaces directly + with UCX. + + The "ikrit" OpenSHMEM network model is also available, but is + deprecated; it uses the deprecated Mellanox Message Accelerator + (MXM) library. + +- In prior versions of Open MPI, InfiniBand and RoCE support was + provided through the openib BTL and ob1 PML plugins. Starting with + Open MPI 4.0.0, InfiniBand support through the openib+ob1 plugins is + both deprecated and superseded by the ucx PML component. + + While the openib BTL depended on libibverbs, the UCX PML depends on + the UCX library. + + Once installed, Open MPI can be built with UCX support by adding + --with-ucx to the Open MPI configure command. Once Open MPI is + configured to use UCX, the runtime will automatically select the UCX + PML if one of the supported networks is detected (e.g., InfiniBand). + It's possible to force using UCX in the mpirun or oshrun command + lines by specifying any or all of the following mca parameters: + "--mca pml ucx" for MPI point-to-point operations, "--mca spml ucx" + for OpenSHMEM support, and "--mca osc ucx" for MPI RMA (one-sided) + operations. + +- Although the ob1 PML+openib BTL is still the default for iWARP and + RoCE devices, it will reject InfiniBand defaults (by default) so + that they will use the ucx PML. If using the openib BTL is still + desired, set the following MCA parameters: + + # Note that "vader" is Open MPI's shared memory BTL + $ mpirun --mca pml ob1 --mca btl openib,vader,self \ + --mca btl_openib_allow_ib 1 ... - The usnic BTL is support for Cisco's usNIC device ("userspace NIC") on Cisco UCS servers with the Virtualized Interface Card (VIC). @@ -755,32 +806,6 @@ Network Support mechanisms for Open MPI to utilize single-copy semantics for shared memory. -- In prior versions of Open MPI, InfiniBand and RoCE support was - provided through the openib BTL and ob1 PML plugins. Starting with - Open MPI 4.0.0, InfiniBand support through the openib+ob1 plugins is - both deprecated and superseded by the UCX PML component. - - UCX is an open-source optimized communication library which supports - multiple networks, including RoCE, InfiniBand, uGNI, TCP, shared - memory, and others. - - While the openib BTL depended on libibverbs, the UCX PML depends on - the UCX library. The UCX library can be downloaded from - http://www.openucx.org/ or from various Linux distribution - repositories (e.g., Fedora/RedHat yum repositories). The UCX - library is also part of Mellanox OFED and Mellanox HPC-X binary - distributions. - - Once installed, Open MPI can be built with UCX support by adding - --with-ucx to the Open MPI configure command. Once Open MPI is - configured to use UCX, the runtime will automatically select the UCX - PML if one of the supported networks is detected (e.g., InfiniBand). - It's possible to force using UCX in the mpirun or oshrun command - lines by specifying any or all of the following mca parameters: - "-mca pml ucx" for MPI point-to-point operations, "-mca spml ucx" - for OpenSHMEM support, and "-mca osc ucx" for MPI RMA (one-sided) - operations. - Open MPI Extensions ------------------- From 9a7320fdab68ad94aac44b8e875211fa19a9a317 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 6 Nov 2018 10:04:15 -0800 Subject: [PATCH 181/674] README: Clarify that only IB->openib is deprecated Per feedback from https://github.com/open-mpi/ompi/pull/6028, remove "+ob1" from the sentence to emphasize that it's only IB usage through openib that is deprecated/superceded (i.e., ob1 is definitely not deprecated). Signed-off-by: Jeff Squyres (cherry picked from commit 6cb415982615c504b97748d8c4007a352edd7246) --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index e5051541818..ebadc8976ba 100644 --- a/README +++ b/README @@ -730,8 +730,8 @@ Network Support - In prior versions of Open MPI, InfiniBand and RoCE support was provided through the openib BTL and ob1 PML plugins. Starting with - Open MPI 4.0.0, InfiniBand support through the openib+ob1 plugins is - both deprecated and superseded by the ucx PML component. + Open MPI 4.0.0, InfiniBand support through the openib plugin is both + deprecated and superseded by the ucx PML component. While the openib BTL depended on libibverbs, the UCX PML depends on the UCX library. From 76d4c1843ede232f5ffbd7f5722d7a87a30b34f8 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 8 Nov 2018 11:50:47 -0500 Subject: [PATCH 182/674] orte-rmaps-base: update out-of-slots show_help message Update the show_help message for when there are not enough slots to run an application. Also, remove a bunch of copies of this message in various show_help text files that aren't used/referred to anywhere in the code. Signed-off-by: Jeff Squyres (cherry picked from commit 430c659908f9c1ba1ff652379a694314718ff3d8) --- orte/mca/rmaps/base/help-orte-rmaps-base.txt | 33 ++++++++++++++++--- .../rmaps/rank_file/help-rmaps_rank_file.txt | 10 +----- .../rmaps/round_robin/help-orte-rmaps-rr.txt | 10 +----- orte/mca/rmaps/seq/help-orte-rmaps-seq.txt | 12 +------ orte/mca/rtc/base/help-orte-rtc-base.txt | 9 +---- 5 files changed, 32 insertions(+), 42 deletions(-) diff --git a/orte/mca/rmaps/base/help-orte-rmaps-base.txt b/orte/mca/rmaps/base/help-orte-rmaps-base.txt index 88dcab07a96..db28a746ccb 100644 --- a/orte/mca/rmaps/base/help-orte-rmaps-base.txt +++ b/orte/mca/rmaps/base/help-orte-rmaps-base.txt @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2011-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011 Los Alamos National Security, LLC. # All rights reserved. # Copyright (c) 2014-2018 Intel, Inc. All rights reserved. @@ -23,12 +23,35 @@ # This is the US/English general help file for Open RTE's orterun. # [orte-rmaps-base:alloc-error] -There are not enough slots available in the system to satisfy the %d slots -that were requested by the application: +There are not enough slots available in the system to satisfy the %d +slots that were requested by the application: + %s -Either request fewer slots for your application, or make more slots available -for use. +Either request fewer slots for your application, or make more slots +available for use. + +A "slot" is the Open MPI term for an allocatable unit where we can +launch a process. The number of slots available are defined by the +environment in which Open MPI processes are run: + + 1. Hostfile, via "slots=N" clauses (N defaults to number of + processor cores if not provided) + 2. The --host:N command line parameter (N defaults to 1 if not + provided) + 3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.) + 4. If neither a hostfile, the --hosts command line parameter, nor an + RM is present, Open MPI defaults to the number of processor + cores + +In all the above cases, if you want Open MPI to default to the number +of hardware threads instead of the number of processor cores, use the +--use-hwthread-cpus option. + +Alternatively, you can use the --oversubscribe option to ignore the +number of available slots when deciding the number of processes to +launch. +# [orte-rmaps-base:not-all-mapped-alloc] Some of the requested hosts are not included in the current allocation for the application: diff --git a/orte/mca/rmaps/rank_file/help-rmaps_rank_file.txt b/orte/mca/rmaps/rank_file/help-rmaps_rank_file.txt index ce1705acd88..f357bf20f37 100644 --- a/orte/mca/rmaps/rank_file/help-rmaps_rank_file.txt +++ b/orte/mca/rmaps/rank_file/help-rmaps_rank_file.txt @@ -1,6 +1,6 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. # All rights reserved. # $COPYRIGHT$ @@ -90,14 +90,6 @@ some systems may require using full hostnames, such as [bad-index] Rankfile claimed host %s by index that is bigger than number of allocated hosts. # -[orte-rmaps-rf:alloc-error] -There are not enough slots available in the system to satisfy the %d slots -that were requested by the application: - %s - -Either request fewer slots for your application, or make more slots available -for use. -# [bad-rankfile] Error, invalid rank (%d) in the rankfile (%s) # diff --git a/orte/mca/rmaps/round_robin/help-orte-rmaps-rr.txt b/orte/mca/rmaps/round_robin/help-orte-rmaps-rr.txt index 2adb9781274..ca459dd7c56 100644 --- a/orte/mca/rmaps/round_robin/help-orte-rmaps-rr.txt +++ b/orte/mca/rmaps/round_robin/help-orte-rmaps-rr.txt @@ -11,6 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2018 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,15 +20,6 @@ # # This is the US/English general help file for Open RTE's orterun. # -[orte-rmaps-rr:alloc-error] -There are not enough slots available in the system to satisfy the %d slots -that were requested: - - application: %s - host: %s - -Either request fewer slots for your application, or make more slots available -for use. [orte-rmaps-rr:multi-apps-and-zero-np] RMAPS found multiple applications to be launched, with at least one that failed to specify the number of processes to execute. diff --git a/orte/mca/rmaps/seq/help-orte-rmaps-seq.txt b/orte/mca/rmaps/seq/help-orte-rmaps-seq.txt index 5fbe1095932..fbab660928b 100644 --- a/orte/mca/rmaps/seq/help-orte-rmaps-seq.txt +++ b/orte/mca/rmaps/seq/help-orte-rmaps-seq.txt @@ -10,6 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyright (c) 2018 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -18,19 +19,8 @@ # # This is the US/English general help file for Open RTE's orterun. # -[orte-rmaps-seq:alloc-error] -There are not enough slots available in the system to satisfy the %d slots -that were requested by the application: - - %s - -Either request fewer slots for your application or make more slots -available for use. If oversubscription is intended, add ---oversubscribe to the command line. -# [orte-rmaps-seq:resource-not-found] The specified hostfile contained a node (%s) that is not in your allocation. We therefore cannot map a process rank to it. Please check your allocation and hostfile to ensure the hostfile only contains allocated nodes. - diff --git a/orte/mca/rtc/base/help-orte-rtc-base.txt b/orte/mca/rtc/base/help-orte-rtc-base.txt index ade22e57b2a..8414cc58850 100644 --- a/orte/mca/rtc/base/help-orte-rtc-base.txt +++ b/orte/mca/rtc/base/help-orte-rtc-base.txt @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011 Los Alamos National Security, LLC. # All rights reserved. # Copyright (c) 2014 Intel, Inc. All rights reserved. @@ -22,13 +22,6 @@ # # This is the US/English general help file for Open RTE's orterun. # -[orte-rtc-base:alloc-error] -There are not enough slots available in the system to satisfy the %d slots -that were requested by the application: - %s - -Either request fewer slots for your application, or make more slots available -for use. [orte-rtc-base:not-all-mapped-alloc] Some of the requested hosts are not included in the current allocation for the application: From 8be14b9b07ac4740224cd6923ecd287b0462a35f Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 8 Nov 2018 14:21:47 -0800 Subject: [PATCH 183/674] orte-rmaps-base: slightly amend help message Follow on to 430c659908: clarify the help message and fix one typo. Signed-off-by: Jeff Squyres (cherry picked from commit e9bf318dcb2f337267211f37e6d59c9f8bf5d8be) --- orte/mca/rmaps/base/help-orte-rmaps-base.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/orte/mca/rmaps/base/help-orte-rmaps-base.txt b/orte/mca/rmaps/base/help-orte-rmaps-base.txt index db28a746ccb..0d4724aeec7 100644 --- a/orte/mca/rmaps/base/help-orte-rmaps-base.txt +++ b/orte/mca/rmaps/base/help-orte-rmaps-base.txt @@ -37,12 +37,11 @@ environment in which Open MPI processes are run: 1. Hostfile, via "slots=N" clauses (N defaults to number of processor cores if not provided) - 2. The --host:N command line parameter (N defaults to 1 if not - provided) + 2. The --host command line parameter, via a ":N" suffix on the + hostname (N defaults to 1 if not provided) 3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.) - 4. If neither a hostfile, the --hosts command line parameter, nor an - RM is present, Open MPI defaults to the number of processor - cores + 4. If none of a hostfile, the --host command line parameter, or an + RM is present, Open MPI defaults to the number of processor cores In all the above cases, if you want Open MPI to default to the number of hardware threads instead of the number of processor cores, use the From c6d8caf30280311336b2db3f374c982cb4cd3ee9 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 8 Nov 2018 17:38:26 -0500 Subject: [PATCH 184/674] README: Make LSF text more accurate Also remove a now-outdated LSF reference. Signed-off-by: Jeff Squyres (cherry picked from commit 419852ab433e578a790e8882711a20f2f570f0a2) --- README | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/README b/README index ebadc8976ba..b12f361a25a 100644 --- a/README +++ b/README @@ -115,7 +115,7 @@ General notes - The run-time systems that are currently supported are: - rsh / ssh - PBS Pro, Torque - - Platform LSF (v9.1.1 and later) + - Platform LSF (tested with v9.1.1 and later) - SLURM - Cray XE, XC, and XK - Oracle Grid Engine (OGE) 6.1, 6.2 and open source Grid Engine @@ -1206,13 +1206,6 @@ RUN-TIME SYSTEM SUPPORT LSF is a resource manager system, frequently used as a batch scheduler in HPC systems. - NOTE: If you are using LSF version 7.0.5, you will need to add - "LIBS=-ldl" to the configure command line. For example: - - ./configure LIBS=-ldl --with-lsf ... - - This workaround should *only* be needed for LSF 7.0.5. - --with-lsf-libdir= Look in directory for the LSF libraries. By default, Open MPI will look in /lib and /lib64, which covers From 9366c6eb2ee1bd1feb89079ca33a94e5e65a29b4 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 6 Nov 2018 13:57:31 +0900 Subject: [PATCH 185/674] mpiext/cuda: do not include automatically generated file into dist tarball ompi/mpiext/cuda/c/mpiext_cuda_c.h is automatically generated from ompi/mpiext/cuda/c/mpiext_cuda_c.h.in at configure time. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@f8318f0a8ffa9d0ca109a7fbb6ebec9f5522a687) (cherry picked from commit open-mpi/ompi@b3ce25af95d2d3395a4b1ea78c068de45f29cf2c) --- ompi/mpiext/cuda/c/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ompi/mpiext/cuda/c/Makefile.am b/ompi/mpiext/cuda/c/Makefile.am index 41f0ab5fd52..719fa109895 100644 --- a/ompi/mpiext/cuda/c/Makefile.am +++ b/ompi/mpiext/cuda/c/Makefile.am @@ -4,6 +4,8 @@ # Corporation. All rights reserved. # Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2015 NVIDIA, Inc. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -28,7 +30,7 @@ noinst_LTLIBRARIES = libmpiext_cuda_c.la ompidir = $(ompiincludedir)/ompi/mpiext/cuda/c # This is the header file that is installed. -ompi_HEADERS = mpiext_cuda_c.h +nodist_ompi_HEADERS = mpiext_cuda_c.h # Sources for the convenience libtool library. Other than the one # header file, all source files in the extension have no file naming From 116a140be8cce39a5c07ce6db19a6426ae48f276 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 13 Nov 2018 07:18:57 -0700 Subject: [PATCH 186/674] roll to v4.0.1a1 long live 4.0.1! Signed-off-by: Howard Pritchard --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 76e724ec509..53f92372838 100644 --- a/VERSION +++ b/VERSION @@ -16,7 +16,7 @@ # ... major=4 -minor=0 +minor=1 release=0 # greek is generally used for alpha or beta release tags. If it is @@ -26,7 +26,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc5 +greek=a1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From e1f75d5ff17c852b165e044885fd057e4aa762a1 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Mon, 29 Oct 2018 14:31:47 -0500 Subject: [PATCH 187/674] Add OPAL_VPID to unpacking * Needed to properly read PMIx job data like the following - `OPAL_PMIX_LOCALLDR` - `OPAL_PMIX_RANK` - `OPAL_PMIX_GLOBAL_RANK` - `OPAL_PMIX_APPLDR` - `OPAL_PMIX_APP_RANK` Signed-off-by: Joshua Hursey (cherry picked from commit a557c4130c42a5a41aba5c08e606e7129d0bcb6d) --- opal/dss/dss_load_unload.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/opal/dss/dss_load_unload.c b/opal/dss/dss_load_unload.c index 0fa02d01c28..b35b58d6512 100644 --- a/opal/dss/dss_load_unload.c +++ b/opal/dss/dss_load_unload.c @@ -12,6 +12,7 @@ * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -372,6 +373,10 @@ int opal_value_unload(opal_value_t *kv, *data = kv->data.ptr; break; + case OPAL_VPID: + memcpy(*data, &kv->data.name.vpid, sizeof(opal_vpid_t)); + break; + default: OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); return OPAL_ERR_NOT_SUPPORTED; From 012e27af77bdf384226916e3eafa66fe424e5cb7 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 12 Nov 2018 15:08:22 +0200 Subject: [PATCH 188/674] OSC: set UCX module used by default - OSC/UCX module set priority to 200 to be used by default Signed-off-by: Sergey Oblomov (cherry picked from commit 36934a8bb2484c3d27d14683d65012ff422334f4) --- ompi/mca/osc/ucx/osc_ucx_component.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index c983ea76705..2bb9e7badbd 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -103,9 +103,9 @@ static int component_open(void) { static int component_register(void) { char *description_str; - mca_osc_ucx_component.priority = 0; - asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", - mca_osc_ucx_component.priority); + mca_osc_ucx_component.priority = 200; + opal_asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", + mca_osc_ucx_component.priority); (void) mca_base_component_var_register(&mca_osc_ucx_component.super.osc_version, "priority", description_str, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_ucx_component.priority); From 38a4953707a97d83e80e595e42851fe871e76c4e Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 14 Nov 2018 10:03:13 +0200 Subject: [PATCH 189/674] OSC/UCX: added UCX version evaluation - added UCX version evaluation to set OSC UCX priority Signed-off-by: Sergey Oblomov (cherry picked from commit e91f214982391b8e1b26be39147c357d32b8380e) --- ompi/mca/osc/ucx/osc_ucx_component.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 2bb9e7badbd..1326e7be1be 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -17,6 +17,8 @@ #include "osc_ucx.h" #include "osc_ucx_request.h" +#define UCX_VERSION(_major, _minor, _build) (((_major) * 100) + (_minor)) + #define memcpy_off(_dst, _src, _len, _off) \ memcpy(((char*)(_dst)) + (_off), _src, _len); \ (_off) += (_len); @@ -102,10 +104,17 @@ static int component_open(void) { } static int component_register(void) { + unsigned major = 0; + unsigned minor = 0; + unsigned release_number = 0; char *description_str; - mca_osc_ucx_component.priority = 200; - opal_asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", - mca_osc_ucx_component.priority); + + ucp_get_version(&major, &minor, &release_number); + + mca_osc_ucx_component.priority = UCX_VERSION(major, minor, release_number) >= UCX_VERSION(1, 5, 0) ? 200 : 0; + + asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", + mca_osc_ucx_component.priority); (void) mca_base_component_var_register(&mca_osc_ucx_component.super.osc_version, "priority", description_str, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_ucx_component.priority); From 63cbe36cabd7ac783e363b0b1ffa4833d06de733 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 21 Nov 2018 19:08:24 +0200 Subject: [PATCH 190/674] OSHMEM/AMO: added int/uint/32/64 atomics calls - added int/uint/32/64 atomics calls - added SHMEM_SYNC_SIZE macro Signed-off-by: Sergey Oblomov (cherry picked from commit 4c071da565b152dbceb8f48368327bd0ae218942) --- oshmem/include/pshmem.h | 198 +++++++++++++++++++++++-------- oshmem/include/pshmemx.h | 2 - oshmem/include/shmem.h.in | 104 ++++++++++++++-- oshmem/include/shmemx.h | 2 - oshmem/shmem/c/profile/defines.h | 69 +++++++++++ oshmem/shmem/c/shmem_and.c | 18 +++ oshmem/shmem/c/shmem_fand.c | 20 +++- oshmem/shmem/c/shmem_for.c | 18 +++ oshmem/shmem/c/shmem_fxor.c | 18 +++ oshmem/shmem/c/shmem_g.c | 2 + oshmem/shmem/c/shmem_or.c | 18 +++ oshmem/shmem/c/shmem_wait.c | 44 +++++++ oshmem/shmem/c/shmem_xor.c | 18 +++ 13 files changed, 464 insertions(+), 67 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 8ee6931ebcc..f209c18b9b4 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -922,6 +922,10 @@ OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_and(shmem_ctx_t ctx, OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_ctx_int32_atomic_fetch_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_ctx_int64_atomic_fetch_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_ctx_uint32_atomic_fetch_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_ctx_uint64_atomic_fetch_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_and(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_and(long *target, long value, int pe); @@ -929,23 +933,35 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_and(long long *target, lo OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_and(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_and(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_and(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_and(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_atomic_fetch_and(...) \ +#define pshmem_atomic_fetch_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_fetch_and, \ - long*: pshmem_ctx_long_atomic_fetch_and, \ - long long*: pshmem_ctx_longlong_atomic_fetch_and, \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and, \ - default: __opshmem_datatype_ignore), \ - int*: pshmem_int_atomic_fetch_and, \ - long*: pshmem_long_atomic_fetch_and, \ - long long*: pshmem_longlong_atomic_fetch_and, \ - unsigned int*: pshmem_uint_atomic_fetch_and, \ - unsigned long*: pshmem_ulong_atomic_fetch_and, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_and)(__VA_ARGS__) + int*: pshmem_ctx_int_atomic_fetch_and, \ + long*: pshmem_ctx_long_atomic_fetch_and, \ + long long*: pshmem_ctx_longlong_atomic_fetch_and, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_and, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_and, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_and, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_and, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_and, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_and, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_and, \ + long*: pshmem_long_atomic_fetch_and, \ + long long*: pshmem_longlong_atomic_fetch_and, \ + unsigned int*: pshmem_uint_atomic_fetch_and, \ + unsigned long*: pshmem_ulong_atomic_fetch_and, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_and, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_and, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_and, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_and, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_and)(__VA_ARGS__) #endif /* Atomic Fetch&Or */ @@ -955,6 +971,10 @@ OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_or(shmem_ctx_t ctx, l OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_ctx_int32_atomic_fetch_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_ctx_int64_atomic_fetch_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_ctx_uint32_atomic_fetch_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_ctx_uint64_atomic_fetch_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_or(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_or(long *target, long value, int pe); @@ -962,23 +982,35 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_or(long long *target, lon OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_or(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_or(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_or(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_or(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_atomic_fetch_or(...) \ +#define pshmem_atomic_fetch_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_fetch_or, \ - long*: pshmem_ctx_long_atomic_fetch_or, \ - long long*: pshmem_ctx_longlong_atomic_fetch_or, \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or, \ - default: __opshmem_datatype_ignore), \ - int*: pshmem_int_atomic_fetch_or, \ - long*: pshmem_long_atomic_fetch_or, \ - long long*: pshmem_longlong_atomic_fetch_or, \ - unsigned int*: pshmem_uint_atomic_fetch_or, \ - unsigned long*: pshmem_ulong_atomic_fetch_or, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_or)(__VA_ARGS__) + int*: pshmem_ctx_int_atomic_fetch_or, \ + long*: pshmem_ctx_long_atomic_fetch_or, \ + long long*: pshmem_ctx_longlong_atomic_fetch_or, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_or, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_or, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_or, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_or, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_or, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_or, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_or, \ + long*: pshmem_long_atomic_fetch_or, \ + long long*: pshmem_longlong_atomic_fetch_or, \ + unsigned int*: pshmem_uint_atomic_fetch_or, \ + unsigned long*: pshmem_ulong_atomic_fetch_or, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_or, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_or, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_or, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_or, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_or)(__VA_ARGS__) #endif /* Atomic Fetch&Xor */ @@ -988,6 +1020,10 @@ OSHMEM_DECLSPEC long long pshmem_ctx_longlong_atomic_fetch_xor(shmem_ctx_t ctx, OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_ctx_int32_atomic_fetch_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_ctx_int64_atomic_fetch_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_ctx_uint32_atomic_fetch_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_ctx_uint64_atomic_fetch_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int pshmem_int_atomic_fetch_xor(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_atomic_fetch_xor(long *target, long value, int pe); @@ -995,23 +1031,35 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_xor(long long *target, lo OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_xor(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_xor(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_xor(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_xor(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 -#define pshmem_atomic_fetch_xor(...) \ +#define pshmem_atomic_fetch_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ - int*: pshmem_ctx_int_atomic_fetch_xor, \ - long*: pshmem_ctx_long_atomic_fetch_xor, \ - long long*: pshmem_ctx_longlong_atomic_fetch_xor, \ - unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ - unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor, \ - default: __opshmem_datatype_ignore), \ - int*: pshmem_int_atomic_fetch_xor, \ - long*: pshmem_long_atomic_fetch_xor, \ - long long*: pshmem_longlong_atomic_fetch_xor, \ - unsigned int*: pshmem_uint_atomic_fetch_xor, \ - unsigned long*: pshmem_ulong_atomic_fetch_xor, \ - unsigned long long*: pshmem_ulonglong_atomic_fetch_xor)(__VA_ARGS__) + int*: pshmem_ctx_int_atomic_fetch_xor, \ + long*: pshmem_ctx_long_atomic_fetch_xor, \ + long long*: pshmem_ctx_longlong_atomic_fetch_xor, \ + unsigned int*: pshmem_ctx_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ctx_ulong_atomic_fetch_xor, \ + unsigned long long*: pshmem_ctx_ulonglong_atomic_fetch_xor, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_xor, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_xor, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_xor, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_xor, \ + default: __opshmem_datatype_ignore), \ + int*: pshmem_int_atomic_fetch_xor, \ + long*: pshmem_long_atomic_fetch_xor, \ + long long*: pshmem_longlong_atomic_fetch_xor, \ + unsigned int*: pshmem_uint_atomic_fetch_xor, \ + unsigned long*: pshmem_ulong_atomic_fetch_xor, \ + unsigned long long*: pshmem_ulonglong_atomic_fetch_xor, \ + int32_t*: pshmem_ctx_int32_atomic_fetch_xor, \ + int64_t*: pshmem_ctx_int64_atomic_fetch_xor, \ + uint32_t*: pshmem_ctx_uint32_atomic_fetch_xor, \ + uint64_t*: pshmem_ctx_uint64_atomic_fetch_xor)(__VA_ARGS__) #endif /* Atomic Fetch */ @@ -1165,6 +1213,10 @@ OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_and(shmem_ctx_t ctx, long long * OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_atomic_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_atomic_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_atomic_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_atomic_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_and(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_and(long *target, long value, int pe); @@ -1172,6 +1224,10 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_and(long long *target, long long val OSHMEM_DECLSPEC void pshmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int32_atomic_and(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int64_atomic_and(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_atomic_and(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_atomic_and(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_atomic_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1198,6 +1254,10 @@ OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_or(shmem_ctx_t ctx, long long *t OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_atomic_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_atomic_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_atomic_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_atomic_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_or(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_or(long *target, long value, int pe); @@ -1205,6 +1265,10 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_or(long long *target, long long valu OSHMEM_DECLSPEC void pshmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int32_atomic_or(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int64_atomic_or(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_atomic_or(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_atomic_or(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_atomic_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1231,6 +1295,10 @@ OSHMEM_DECLSPEC void pshmem_ctx_longlong_atomic_xor(shmem_ctx_t ctx, long long * OSHMEM_DECLSPEC void pshmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_atomic_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_atomic_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_atomic_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_atomic_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void pshmem_int_atomic_xor(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_atomic_xor(long *target, long value, int pe); @@ -1238,6 +1306,10 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_xor(long long *target, long long val OSHMEM_DECLSPEC void pshmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void pshmem_int32_atomic_xor(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int64_atomic_xor(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_atomic_xor(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_atomic_xor(uint64_t *target, uint64_t value, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_atomic_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1321,26 +1393,54 @@ OSHMEM_DECLSPEC void pshmem_short_wait_until(volatile short *addr, int cmp, sho OSHMEM_DECLSPEC void pshmem_int_wait_until(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC void pshmem_long_wait_until(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC void pshmem_longlong_wait_until(volatile long long *addr, int cmp, long long value); +OSHMEM_DECLSPEC void pshmem_ushort_wait_until(volatile unsigned short *addr, int cmp, unsigned short value); +OSHMEM_DECLSPEC void pshmem_uint_wait_until(volatile unsigned int *addr, int cmp, unsigned int value); +OSHMEM_DECLSPEC void pshmem_ulong_wait_until(volatile unsigned long *addr, int cmp, unsigned long value); +OSHMEM_DECLSPEC void pshmem_ulonglong_wait_until(volatile unsigned long long *addr, int cmp, unsigned long long value); +OSHMEM_DECLSPEC void pshmem_int32_wait_until(volatile int32_t *addr, int cmp, int32_t value); +OSHMEM_DECLSPEC void pshmem_int64_wait_until(volatile int64_t *addr, int cmp, int64_t value); +OSHMEM_DECLSPEC void pshmem_uint32_wait_until(volatile uint32_t *addr, int cmp, uint32_t value); +OSHMEM_DECLSPEC void pshmem_uint64_wait_until(volatile uint64_t *addr, int cmp, uint64_t value); +OSHMEM_DECLSPEC void pshmem_size_wait_until(volatile size_t *addr, int cmp, size_t value); +OSHMEM_DECLSPEC void pshmem_ptrdiff_wait_until(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); #if OSHMEMP_HAVE_C11 #define pshmem_wait_until(addr, cmp, value) \ _Generic(&*(addr), \ short*: pshmem_short_wait_until, \ int*: pshmem_int_wait_until, \ long*: pshmem_long_wait_until, \ - long long*: pshmem_longlong_wait_until)(addr, cmp, value) + long long*: pshmem_longlong_wait_until, \ + unsigned short*: pshmem_short_wait_until, \ + unsigned int*: pshmem_int_wait_until, \ + unsigned long*: pshmem_long_wait_until, \ + unsigned long long*: pshmem_longlong_wait_until)(addr, cmp, value) #endif OSHMEM_DECLSPEC int pshmem_short_test(volatile short *addr, int cmp, short value); OSHMEM_DECLSPEC int pshmem_int_test(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC int pshmem_long_test(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC int pshmem_longlong_test(volatile long long *addr, int cmp, long long value); +OSHMEM_DECLSPEC int pshmem_ushort_test(volatile unsigned short *addr, int cmp, unsigned short value); +OSHMEM_DECLSPEC int pshmem_uint_test(volatile unsigned int *addr, int cmp, unsigned int value); +OSHMEM_DECLSPEC int pshmem_ulong_test(volatile unsigned long *addr, int cmp, unsigned long value); +OSHMEM_DECLSPEC int pshmem_ulonglong_test(volatile unsigned long long *addr, int cmp, unsigned long long value); +OSHMEM_DECLSPEC int pshmem_int32_test(volatile int32_t *addr, int cmp, int32_t value); +OSHMEM_DECLSPEC int pshmem_int64_test(volatile int64_t *addr, int cmp, int64_t value); +OSHMEM_DECLSPEC int pshmem_uint32_test(volatile uint32_t *addr, int cmp, uint32_t value); +OSHMEM_DECLSPEC int pshmem_uint64_test(volatile uint64_t *addr, int cmp, uint64_t value); +OSHMEM_DECLSPEC int pshmem_size_test(volatile size_t *addr, int cmp, size_t value); +OSHMEM_DECLSPEC int pshmem_ptrdiff_test(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); #if OSHMEMP_HAVE_C11 -#define pshmem_test(addr, cmp, value) \ - _Generic(&*(addr), \ - short*: pshmem_short_test, \ - int*: pshmem_int_test, \ - long*: pshmem_long_test, \ - long long*: pshmem_longlong_test)(addr, cmp, value) +#define pshmem_test(addr, cmp, value) \ + _Generic(&*(addr), \ + short*: pshmem_short_test, \ + int*: pshmem_int_test, \ + long*: pshmem_long_test, \ + long long*: pshmem_longlong_test, \ + unsigned short*: pshmem_short_test, \ + unsigned int*: pshmem_int_test, \ + unsigned long*: pshmem_long_test, \ + unsigned long long*: pshmem_longlong_test)(addr, cmp, value) #endif /* diff --git a/oshmem/include/pshmemx.h b/oshmem/include/pshmemx.h index 50a141a97dd..0b85cb06bb6 100644 --- a/oshmem/include/pshmemx.h +++ b/oshmem/include/pshmemx.h @@ -218,8 +218,6 @@ OSHMEM_DECLSPEC void pshmemx_int64_prod_to_all(int64_t *target, const int64_t *s #define pshmem_int32_wait pshmemx_int32_wait #define pshmem_int64_wait pshmemx_int64_wait -#define pshmem_int32_wait_until pshmemx_int32_wait_until -#define pshmem_int64_wait_until pshmemx_int64_wait_until #define pshmem_int16_and_to_all pshmemx_int16_and_to_all #define pshmem_int32_and_to_all pshmemx_int32_and_to_all diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 8e79b3e7597..76fa82d769e 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -150,6 +150,7 @@ enum shmem_wait_ops { #define SHMEM_ALLTOALLS_SYNC_SIZE _SHMEM_ALLTOALLS_SYNC_SIZE #define SHMEM_REDUCE_MIN_WRKDATA_SIZE _SHMEM_REDUCE_MIN_WRKDATA_SIZE #define SHMEM_SYNC_VALUE _SHMEM_SYNC_VALUE +#define SHMEM_SYNC_SIZE _SHMEM_COLLECT_SYNC_SIZE /* @@ -1035,6 +1036,10 @@ OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_and(shmem_ctx_t ctx, l OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch_and(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_and(long *target, long value, int pe); @@ -1042,6 +1047,10 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_and(long long *target, lon OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_and(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_and(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_and(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_and(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_and(uint64_t *target, uint64_t value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_fetch_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1068,6 +1077,10 @@ OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_or(shmem_ctx_t ctx, lo OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch_or(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_or(long *target, long value, int pe); @@ -1075,6 +1088,10 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_or(long long *target, long OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_or(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_or(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_or(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_or(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_or(uint64_t *target, uint64_t value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_fetch_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1101,6 +1118,10 @@ OSHMEM_DECLSPEC long long shmem_ctx_longlong_atomic_fetch_xor(shmem_ctx_t ctx, l OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_atomic_fetch_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_atomic_fetch_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_ctx_int32_atomic_fetch_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_ctx_int64_atomic_fetch_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_atomic_fetch_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_atomic_fetch_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC int shmem_int_atomic_fetch_xor(int *target, int value, int pe); OSHMEM_DECLSPEC long shmem_long_atomic_fetch_xor(long *target, long value, int pe); @@ -1108,6 +1129,10 @@ OSHMEM_DECLSPEC long long shmem_longlong_atomic_fetch_xor(long long *target, lon OSHMEM_DECLSPEC unsigned int shmem_uint_atomic_fetch_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_atomic_fetch_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_atomic_fetch_xor(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC int32_t shmem_int32_atomic_fetch_xor(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC int64_t shmem_int64_atomic_fetch_xor(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC uint32_t shmem_uint32_atomic_fetch_xor(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC uint64_t shmem_uint64_atomic_fetch_xor(uint64_t *target, uint64_t value, int pe); #if OSHMEM_HAVE_C11 #define shmem_atomic_fetch_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1278,6 +1303,10 @@ OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_and(shmem_ctx_t ctx, long long *t OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_and(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_and(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_and(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_and(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_and(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_and(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_and(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_and(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_and(long *target, long value, int pe); @@ -1285,6 +1314,11 @@ OSHMEM_DECLSPEC void shmem_longlong_atomic_and(long long *target, long long valu OSHMEM_DECLSPEC void shmem_uint_atomic_and(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_and(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_and(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int32_atomic_and(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_int64_atomic_and(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint32_atomic_and(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint64_atomic_and(uint64_t *target, uint64_t value, int pe); + #if OSHMEM_HAVE_C11 #define shmem_atomic_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1311,6 +1345,10 @@ OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_or(shmem_ctx_t ctx, long long *ta OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_or(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_or(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_or(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_or(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_or(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_or(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_or(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_or(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_or(long *target, long value, int pe); @@ -1318,6 +1356,11 @@ OSHMEM_DECLSPEC void shmem_longlong_atomic_or(long long *target, long long value OSHMEM_DECLSPEC void shmem_uint_atomic_or(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_or(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_or(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int32_atomic_or(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_int64_atomic_or(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint32_atomic_or(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint64_atomic_or(uint64_t *target, uint64_t value, int pe); + #if OSHMEM_HAVE_C11 #define shmem_atomic_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1344,6 +1387,10 @@ OSHMEM_DECLSPEC void shmem_ctx_longlong_atomic_xor(shmem_ctx_t ctx, long long *t OSHMEM_DECLSPEC void shmem_ctx_uint_atomic_xor(shmem_ctx_t ctx, unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulong_atomic_xor(shmem_ctx_t ctx, unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_atomic_xor(shmem_ctx_t ctx, unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_atomic_xor(shmem_ctx_t ctx, int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_atomic_xor(shmem_ctx_t ctx, int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_atomic_xor(shmem_ctx_t ctx, uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_atomic_xor(shmem_ctx_t ctx, uint64_t *target, uint64_t value, int pe); OSHMEM_DECLSPEC void shmem_int_atomic_xor(int *target, int value, int pe); OSHMEM_DECLSPEC void shmem_long_atomic_xor(long *target, long value, int pe); @@ -1351,6 +1398,11 @@ OSHMEM_DECLSPEC void shmem_longlong_atomic_xor(long long *target, long long valu OSHMEM_DECLSPEC void shmem_uint_atomic_xor(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void shmem_ulong_atomic_xor(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_atomic_xor(unsigned long long *target, unsigned long long value, int pe); +OSHMEM_DECLSPEC void shmem_int32_atomic_xor(int32_t *target, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_int64_atomic_xor(int64_t *target, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint32_atomic_xor(uint32_t *target, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint64_atomic_xor(uint64_t *target, uint64_t value, int pe); + #if OSHMEM_HAVE_C11 #define shmem_atomic_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -1434,26 +1486,54 @@ OSHMEM_DECLSPEC void shmem_short_wait_until(volatile short *addr, int cmp, shor OSHMEM_DECLSPEC void shmem_int_wait_until(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC void shmem_long_wait_until(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC void shmem_longlong_wait_until(volatile long long *addr, int cmp, long long value); +OSHMEM_DECLSPEC void shmem_ushort_wait_until(volatile unsigned short *addr, int cmp, unsigned short value); +OSHMEM_DECLSPEC void shmem_uint_wait_until(volatile unsigned int *addr, int cmp, unsigned int value); +OSHMEM_DECLSPEC void shmem_ulong_wait_until(volatile unsigned long *addr, int cmp, unsigned long value); +OSHMEM_DECLSPEC void shmem_ulonglong_wait_until(volatile unsigned long long *addr, int cmp, unsigned long long value); +OSHMEM_DECLSPEC void shmem_int32_wait_until(volatile int32_t *addr, int cmp, int32_t value); +OSHMEM_DECLSPEC void shmem_int64_wait_until(volatile int64_t *addr, int cmp, int64_t value); +OSHMEM_DECLSPEC void shmem_uint32_wait_until(volatile uint32_t *addr, int cmp, uint32_t value); +OSHMEM_DECLSPEC void shmem_uint64_wait_until(volatile uint64_t *addr, int cmp, uint64_t value); +OSHMEM_DECLSPEC void shmem_size_wait_until(volatile size_t *addr, int cmp, size_t value); +OSHMEM_DECLSPEC void shmem_ptrdiff_wait_until(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); #if OSHMEM_HAVE_C11 -#define shmem_wait_until(addr, cmp, value) \ - _Generic(&*(addr), \ - short*: shmem_short_wait_until, \ - int*: shmem_int_wait_until, \ - long*: shmem_long_wait_until, \ - long long*: shmem_longlong_wait_until)(addr, cmp, value) +#define shmem_wait_until(addr, cmp, value) \ + _Generic(&*(addr), \ + short*: shmem_short_wait_until, \ + int*: shmem_int_wait_until, \ + long*: shmem_long_wait_until, \ + long long*: shmem_longlong_wait_until, \ + unsigned short*: shmem_ushort_wait_until, \ + unsigned int*: shmem_uint_wait_until, \ + unsigned long*: shmem_ulong_wait_until, \ + unsigned long long*: shmem_ulonglong_wait_until)(addr, cmp, value) #endif OSHMEM_DECLSPEC int shmem_short_test(volatile short *addr, int cmp, short value); OSHMEM_DECLSPEC int shmem_int_test(volatile int *addr, int cmp, int value); OSHMEM_DECLSPEC int shmem_long_test(volatile long *addr, int cmp, long value); OSHMEM_DECLSPEC int shmem_longlong_test(volatile long long *addr, int cmp, long long value); +OSHMEM_DECLSPEC int shmem_ushort_test(volatile unsigned short *addr, int cmp, unsigned short value); +OSHMEM_DECLSPEC int shmem_uint_test(volatile unsigned int *addr, int cmp, unsigned int value); +OSHMEM_DECLSPEC int shmem_ulong_test(volatile unsigned long *addr, int cmp, unsigned long value); +OSHMEM_DECLSPEC int shmem_ulonglong_test(volatile unsigned long long *addr, int cmp, unsigned long long value); +OSHMEM_DECLSPEC int shmem_int32_test(volatile int32_t *addr, int cmp, int32_t value); +OSHMEM_DECLSPEC int shmem_int64_test(volatile int64_t *addr, int cmp, int64_t value); +OSHMEM_DECLSPEC int shmem_uint32_test(volatile uint32_t *addr, int cmp, uint32_t value); +OSHMEM_DECLSPEC int shmem_uint64_test(volatile uint64_t *addr, int cmp, uint64_t value); +OSHMEM_DECLSPEC int shmem_size_test(volatile size_t *addr, int cmp, size_t value); +OSHMEM_DECLSPEC int shmem_ptrdiff_test(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); #if OSHMEM_HAVE_C11 -#define shmem_test(addr, cmp, value) \ - _Generic(&*(addr), \ - short*: shmem_short_test, \ - int*: shmem_int_test, \ - long*: shmem_long_test, \ - long long*: shmem_longlong_test)(addr, cmp, value) +#define shmem_test(addr, cmp, value) \ + _Generic(&*(addr), \ + short*: shmem_short_test, \ + int*: shmem_int_test, \ + long*: shmem_long_test, \ + long long*: shmem_longlong_test, \ + unsigned short*: shmem_ushort_test, \ + unsigned int*: shmem_uint_test, \ + unsigned long*: shmem_ulong_test, \ + unsigned long long*: shmem_ulonglong_test)(addr, cmp, value) #endif /* diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index da67a0cb51f..46bf8130094 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -204,8 +204,6 @@ OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *so #define shmem_int32_wait shmemx_int32_wait #define shmem_int64_wait shmemx_int64_wait -#define shmem_int32_wait_until shmemx_int32_wait_until -#define shmem_int64_wait_until shmemx_int64_wait_until #define shmem_int16_and_to_all shmemx_int16_and_to_all #define shmem_int32_and_to_all shmemx_int32_and_to_all diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index 625ce52b26c..f4187e474c6 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -532,6 +532,10 @@ #define shmem_uint_atomic_fetch_and pshmem_uint_atomic_fetch_and #define shmem_ulong_atomic_fetch_and pshmem_ulong_atomic_fetch_and #define shmem_ulonglong_atomic_fetch_and pshmem_ulonglong_atomic_fetch_and +#define shmem_int32_atomic_fetch_and pshmem_int32_atomic_fetch_and +#define shmem_int64_atomic_fetch_and pshmem_int64_atomic_fetch_and +#define shmem_uint32_atomic_fetch_and pshmem_uint32_atomic_fetch_and +#define shmem_uint64_atomic_fetch_and pshmem_uint64_atomic_fetch_and #define shmem_ctx_int_atomic_fetch_and pshmem_ctx_int_atomic_fetch_and #define shmem_ctx_long_atomic_fetch_and pshmem_ctx_long_atomic_fetch_and @@ -539,6 +543,10 @@ #define shmem_ctx_uint_atomic_fetch_and pshmem_ctx_uint_atomic_fetch_and #define shmem_ctx_ulong_atomic_fetch_and pshmem_ctx_ulong_atomic_fetch_and #define shmem_ctx_ulonglong_atomic_fetch_and pshmem_ctx_ulonglong_atomic_fetch_and +#define shmem_ctx_int32_atomic_fetch_and pshmem_ctx_int32_atomic_fetch_and +#define shmem_ctx_int64_atomic_fetch_and pshmem_ctx_int64_atomic_fetch_and +#define shmem_ctx_uint32_atomic_fetch_and pshmem_ctx_uint32_atomic_fetch_and +#define shmem_ctx_uint64_atomic_fetch_and pshmem_ctx_uint64_atomic_fetch_and #define shmemx_int32_atomic_fetch_and pshmemx_int32_atomic_fetch_and #define shmemx_int64_atomic_fetch_and pshmemx_int64_atomic_fetch_and @@ -552,6 +560,10 @@ #define shmem_uint_atomic_fetch_or pshmem_uint_atomic_fetch_or #define shmem_ulong_atomic_fetch_or pshmem_ulong_atomic_fetch_or #define shmem_ulonglong_atomic_fetch_or pshmem_ulonglong_atomic_fetch_or +#define shmem_int32_atomic_fetch_or pshmem_int32_atomic_fetch_or +#define shmem_int64_atomic_fetch_or pshmem_int64_atomic_fetch_or +#define shmem_uint32_atomic_fetch_or pshmem_uint32_atomic_fetch_or +#define shmem_uint64_atomic_fetch_or pshmem_uint64_atomic_fetch_or #define shmem_ctx_int_atomic_fetch_or pshmem_ctx_int_atomic_fetch_or #define shmem_ctx_long_atomic_fetch_or pshmem_ctx_long_atomic_fetch_or @@ -559,6 +571,10 @@ #define shmem_ctx_uint_atomic_fetch_or pshmem_ctx_uint_atomic_fetch_or #define shmem_ctx_ulong_atomic_fetch_or pshmem_ctx_ulong_atomic_fetch_or #define shmem_ctx_ulonglong_atomic_fetch_or pshmem_ctx_ulonglong_atomic_fetch_or +#define shmem_ctx_int32_atomic_fetch_or pshmem_ctx_int32_atomic_fetch_or +#define shmem_ctx_int64_atomic_fetch_or pshmem_ctx_int64_atomic_fetch_or +#define shmem_ctx_uint32_atomic_fetch_or pshmem_ctx_uint32_atomic_fetch_or +#define shmem_ctx_uint64_atomic_fetch_or pshmem_ctx_uint64_atomic_fetch_or #define shmemx_int32_atomic_fetch_or pshmemx_int32_atomic_fetch_or #define shmemx_int64_atomic_fetch_or pshmemx_int64_atomic_fetch_or @@ -572,6 +588,10 @@ #define shmem_uint_atomic_fetch_xor pshmem_uint_atomic_fetch_xor #define shmem_ulong_atomic_fetch_xor pshmem_ulong_atomic_fetch_xor #define shmem_ulonglong_atomic_fetch_xor pshmem_ulonglong_atomic_fetch_xor +#define shmem_int32_atomic_fetch_xor pshmem_int32_atomic_fetch_xor +#define shmem_int64_atomic_fetch_xor pshmem_int64_atomic_fetch_xor +#define shmem_uint32_atomic_fetch_xor pshmem_uint32_atomic_fetch_xor +#define shmem_uint64_atomic_fetch_xor pshmem_uint64_atomic_fetch_xor #define shmem_ctx_int_atomic_fetch_xor pshmem_ctx_int_atomic_fetch_xor #define shmem_ctx_long_atomic_fetch_xor pshmem_ctx_long_atomic_fetch_xor @@ -579,6 +599,10 @@ #define shmem_ctx_uint_atomic_fetch_xor pshmem_ctx_uint_atomic_fetch_xor #define shmem_ctx_ulong_atomic_fetch_xor pshmem_ctx_ulong_atomic_fetch_xor #define shmem_ctx_ulonglong_atomic_fetch_xor pshmem_ctx_ulonglong_atomic_fetch_xor +#define shmem_ctx_int32_atomic_fetch_xor pshmem_ctx_int32_atomic_fetch_xor +#define shmem_ctx_int64_atomic_fetch_xor pshmem_ctx_int64_atomic_fetch_xor +#define shmem_ctx_uint32_atomic_fetch_xor pshmem_ctx_uint32_atomic_fetch_xor +#define shmem_ctx_uint64_atomic_fetch_xor pshmem_ctx_uint64_atomic_fetch_xor #define shmemx_int32_atomic_fetch_xor pshmemx_int32_atomic_fetch_xor #define shmemx_int64_atomic_fetch_xor pshmemx_int64_atomic_fetch_xor @@ -664,6 +688,10 @@ #define shmem_uint_atomic_and pshmem_uint_atomic_and #define shmem_ulong_atomic_and pshmem_ulong_atomic_and #define shmem_ulonglong_atomic_and pshmem_ulonglong_atomic_and +#define shmem_int32_atomic_and pshmem_int32_atomic_and +#define shmem_int64_atomic_and pshmem_int64_atomic_and +#define shmem_uint32_atomic_and pshmem_uint32_atomic_and +#define shmem_uint64_atomic_and pshmem_uint64_atomic_and #define shmem_ctx_int_atomic_and pshmem_ctx_int_atomic_and #define shmem_ctx_long_atomic_and pshmem_ctx_long_atomic_and @@ -671,6 +699,10 @@ #define shmem_ctx_uint_atomic_and pshmem_ctx_uint_atomic_and #define shmem_ctx_ulong_atomic_and pshmem_ctx_ulong_atomic_and #define shmem_ctx_ulonglong_atomic_and pshmem_ctx_ulonglong_atomic_and +#define shmem_ctx_int32_atomic_and pshmem_ctx_int32_atomic_and +#define shmem_ctx_int64_atomic_and pshmem_ctx_int64_atomic_and +#define shmem_ctx_uint32_atomic_and pshmem_ctx_uint32_atomic_and +#define shmem_ctx_uint64_atomic_and pshmem_ctx_uint64_atomic_and #define shmemx_int32_atomic_and pshmemx_int32_atomic_and #define shmemx_int64_atomic_and pshmemx_int64_atomic_and @@ -685,6 +717,10 @@ #define shmem_uint_atomic_or pshmem_uint_atomic_or #define shmem_ulong_atomic_or pshmem_ulong_atomic_or #define shmem_ulonglong_atomic_or pshmem_ulonglong_atomic_or +#define shmem_int32_atomic_or pshmem_int32_atomic_or +#define shmem_int64_atomic_or pshmem_int64_atomic_or +#define shmem_uint32_atomic_or pshmem_uint32_atomic_or +#define shmem_uint64_atomic_or pshmem_uint64_atomic_or #define shmem_ctx_int_atomic_or pshmem_ctx_int_atomic_or #define shmem_ctx_long_atomic_or pshmem_ctx_long_atomic_or @@ -692,6 +728,10 @@ #define shmem_ctx_uint_atomic_or pshmem_ctx_uint_atomic_or #define shmem_ctx_ulong_atomic_or pshmem_ctx_ulong_atomic_or #define shmem_ctx_ulonglong_atomic_or pshmem_ctx_ulonglong_atomic_or +#define shmem_ctx_int32_atomic_or pshmem_ctx_int32_atomic_or +#define shmem_ctx_int64_atomic_or pshmem_ctx_int64_atomic_or +#define shmem_ctx_uint32_atomic_or pshmem_ctx_uint32_atomic_or +#define shmem_ctx_uint64_atomic_or pshmem_ctx_uint64_atomic_or #define shmemx_int32_atomic_or pshmemx_int32_atomic_or #define shmemx_int64_atomic_or pshmemx_int64_atomic_or @@ -706,6 +746,10 @@ #define shmem_uint_atomic_xor pshmem_uint_atomic_xor #define shmem_ulong_atomic_xor pshmem_ulong_atomic_xor #define shmem_ulonglong_atomic_xor pshmem_ulonglong_atomic_xor +#define shmem_int32_atomic_xor pshmem_int32_atomic_xor +#define shmem_int64_atomic_xor pshmem_int64_atomic_xor +#define shmem_uint32_atomic_xor pshmem_uint32_atomic_xor +#define shmem_uint64_atomic_xor pshmem_uint64_atomic_xor #define shmem_ctx_int_atomic_xor pshmem_ctx_int_atomic_xor #define shmem_ctx_long_atomic_xor pshmem_ctx_long_atomic_xor @@ -713,6 +757,10 @@ #define shmem_ctx_uint_atomic_xor pshmem_ctx_uint_atomic_xor #define shmem_ctx_ulong_atomic_xor pshmem_ctx_ulong_atomic_xor #define shmem_ctx_ulonglong_atomic_xor pshmem_ctx_ulonglong_atomic_xor +#define shmem_ctx_int32_atomic_xor pshmem_ctx_int32_atomic_xor +#define shmem_ctx_int64_atomic_xor pshmem_ctx_int64_atomic_xor +#define shmem_ctx_uint32_atomic_xor pshmem_ctx_uint32_atomic_xor +#define shmem_ctx_uint64_atomic_xor pshmem_ctx_uint64_atomic_xor #define shmemx_int32_atomic_xor pshmemx_int32_atomic_xor #define shmemx_int64_atomic_xor pshmemx_int64_atomic_xor @@ -764,6 +812,17 @@ #define shmem_int_wait_until pshmem_int_wait_until #define shmem_long_wait_until pshmem_long_wait_until #define shmem_longlong_wait_until pshmem_longlong_wait_until +#define shmem_ushort_wait_until pshmem_ushort_wait_until +#define shmem_uint_wait_until pshmem_uint_wait_until +#define shmem_ulong_wait_until pshmem_ulong_wait_until +#define shmem_ulonglong_wait_until pshmem_ulonglong_wait_until +#define shmem_int32_wait_until pshmem_int32_wait_until +#define shmem_int64_wait_until pshmem_int64_wait_until +#define shmem_uint32_wait_until pshmem_uint32_wait_until +#define shmem_uint64_wait_until pshmem_uint64_wait_until +#define shmem_size_wait_until pshmem_size_wait_until +#define shmem_ptrdiff_wait_until pshmem_ptrdiff_wait_until + #define shmemx_int32_wait_until pshmemx_int32_wait_until #define shmemx_int64_wait_until pshmemx_int64_wait_until @@ -771,6 +830,16 @@ #define shmem_int_test pshmem_int_test #define shmem_long_test pshmem_long_test #define shmem_longlong_test pshmem_longlong_test +#define shmem_ushort_test pshmem_ushort_test +#define shmem_uint_test pshmem_uint_test +#define shmem_ulong_test pshmem_ulong_test +#define shmem_ulonglong_test pshmem_ulonglong_test +#define shmem_int32_test pshmem_int32_test +#define shmem_int64_test pshmem_int64_test +#define shmem_uint32_test pshmem_uint32_test +#define shmem_uint64_test pshmem_uint64_test +#define shmem_size_test pshmem_size_test +#define shmem_ptrdiff_test pshmem_ptrdiff_test /* * Barrier sync routines diff --git a/oshmem/shmem/c/shmem_and.c b/oshmem/shmem/c/shmem_and.c index 5c40cc955b4..0f4c5be9d39 100644 --- a/oshmem/shmem/c/shmem_and.c +++ b/oshmem/shmem/c/shmem_and.c @@ -31,6 +31,10 @@ #pragma weak shmem_uint_atomic_and = pshmem_uint_atomic_and #pragma weak shmem_ulong_atomic_and = pshmem_ulong_atomic_and #pragma weak shmem_ulonglong_atomic_and = pshmem_ulonglong_atomic_and +#pragma weak shmem_int32_atomic_and = pshmem_int32_atomic_and +#pragma weak shmem_int64_atomic_and = pshmem_int64_atomic_and +#pragma weak shmem_uint32_atomic_and = pshmem_uint32_atomic_and +#pragma weak shmem_uint64_atomic_and = pshmem_uint64_atomic_and #pragma weak shmem_ctx_int_atomic_and = pshmem_ctx_int_atomic_and #pragma weak shmem_ctx_long_atomic_and = pshmem_ctx_long_atomic_and @@ -38,6 +42,10 @@ #pragma weak shmem_ctx_uint_atomic_and = pshmem_ctx_uint_atomic_and #pragma weak shmem_ctx_ulong_atomic_and = pshmem_ctx_ulong_atomic_and #pragma weak shmem_ctx_ulonglong_atomic_and = pshmem_ctx_ulonglong_atomic_and +#pragma weak shmem_ctx_int32_atomic_and = pshmem_ctx_int32_atomic_and +#pragma weak shmem_ctx_int64_atomic_and = pshmem_ctx_int64_atomic_and +#pragma weak shmem_ctx_uint32_atomic_and = pshmem_ctx_uint32_atomic_and +#pragma weak shmem_ctx_uint64_atomic_and = pshmem_ctx_uint64_atomic_and #pragma weak shmemx_int32_atomic_and = pshmemx_int32_atomic_and #pragma weak shmemx_int64_atomic_and = pshmemx_int64_atomic_and @@ -52,12 +60,22 @@ OSHMEM_TYPE_OP(longlong, long long, shmem, and) OSHMEM_TYPE_OP(uint, unsigned int, shmem, and) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, and) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, and) +OSHMEM_TYPE_OP(int32, int32_t, shmem, and) +OSHMEM_TYPE_OP(int64, int64_t, shmem, and) +OSHMEM_TYPE_OP(uint32, uint32_t, shmem, and) +OSHMEM_TYPE_OP(uint64, uint64_t, shmem, and) + OSHMEM_CTX_TYPE_OP(int, int, shmem, and) OSHMEM_CTX_TYPE_OP(long, long, shmem, and) OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, and) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, and) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, and) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, and) +OSHMEM_CTX_TYPE_OP(int32, int32_t, shmem, and) +OSHMEM_CTX_TYPE_OP(int64, int64_t, shmem, and) +OSHMEM_CTX_TYPE_OP(uint32, uint32_t, shmem, and) +OSHMEM_CTX_TYPE_OP(uint64, uint64_t, shmem, and) + OSHMEM_TYPE_OP(int32, int32_t, shmemx, and) OSHMEM_TYPE_OP(int64, int64_t, shmemx, and) OSHMEM_TYPE_OP(uint32, uint32_t, shmemx, and) diff --git a/oshmem/shmem/c/shmem_fand.c b/oshmem/shmem/c/shmem_fand.c index e1b03d60f73..6761844f291 100644 --- a/oshmem/shmem/c/shmem_fand.c +++ b/oshmem/shmem/c/shmem_fand.c @@ -33,6 +33,10 @@ #pragma weak shmem_uint_atomic_fetch_and = pshmem_uint_atomic_fetch_and #pragma weak shmem_ulong_atomic_fetch_and = pshmem_ulong_atomic_fetch_and #pragma weak shmem_ulonglong_atomic_fetch_and = pshmem_ulonglong_atomic_fetch_and +#pragma weak shmem_int32_atomic_fetch_and = pshmem_int32_atomic_fetch_and +#pragma weak shmem_int64_atomic_fetch_and = pshmem_int64_atomic_fetch_and +#pragma weak shmem_uint32_atomic_fetch_and = pshmem_uint32_atomic_fetch_and +#pragma weak shmem_uint64_atomic_fetch_and = pshmem_uint64_atomic_fetch_and #pragma weak shmem_ctx_int_atomic_fetch_and = pshmem_ctx_int_atomic_fetch_and #pragma weak shmem_ctx_long_atomic_fetch_and = pshmem_ctx_long_atomic_fetch_and @@ -40,6 +44,10 @@ #pragma weak shmem_ctx_uint_atomic_fetch_and = pshmem_ctx_uint_atomic_fetch_and #pragma weak shmem_ctx_ulong_atomic_fetch_and = pshmem_ctx_ulong_atomic_fetch_and #pragma weak shmem_ctx_ulonglong_atomic_fetch_and = pshmem_ctx_ulonglong_atomic_fetch_and +#pragma weak shmem_ctx_int32_atomic_fetch_and = pshmem_ctx_int32_atomic_fetch_and +#pragma weak shmem_ctx_int64_atomic_fetch_and = pshmem_ctx_int64_atomic_fetch_and +#pragma weak shmem_ctx_uint32_atomic_fetch_and = pshmem_ctx_uint32_atomic_fetch_and +#pragma weak shmem_ctx_uint64_atomic_fetch_and = pshmem_ctx_uint64_atomic_fetch_and #pragma weak shmemx_int32_atomic_fetch_and = pshmemx_int32_atomic_fetch_and #pragma weak shmemx_int64_atomic_fetch_and = pshmemx_int64_atomic_fetch_and @@ -48,20 +56,28 @@ #include "oshmem/shmem/c/profile/defines.h" #endif - unsigned int shmem_uint_atomic_fand(unsigned int *target, unsigned int value, int pe); - OSHMEM_TYPE_FOP(int, int, shmem, and) OSHMEM_TYPE_FOP(long, long, shmem, and) OSHMEM_TYPE_FOP(longlong, long long, shmem, and) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, and) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, and) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, and) +OSHMEM_TYPE_FOP(int32, int32_t, shmem, and) +OSHMEM_TYPE_FOP(int64, int64_t, shmem, and) +OSHMEM_TYPE_FOP(uint32, uint32_t, shmem, and) +OSHMEM_TYPE_FOP(uint64, uint64_t, shmem, and) + OSHMEM_CTX_TYPE_FOP(int, int, shmem, and) OSHMEM_CTX_TYPE_FOP(long, long, shmem, and) OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, and) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, and) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, and) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, and) +OSHMEM_CTX_TYPE_FOP(int32, int32_t, shmem, and) +OSHMEM_CTX_TYPE_FOP(int64, int64_t, shmem, and) +OSHMEM_CTX_TYPE_FOP(uint32, uint32_t, shmem, and) +OSHMEM_CTX_TYPE_FOP(uint64, uint64_t, shmem, and) + OSHMEM_TYPE_FOP(int32, int32_t, shmemx, and) OSHMEM_TYPE_FOP(int64, int64_t, shmemx, and) OSHMEM_TYPE_FOP(uint32, uint32_t, shmemx, and) diff --git a/oshmem/shmem/c/shmem_for.c b/oshmem/shmem/c/shmem_for.c index 5bd8a21e489..4d0e732004d 100644 --- a/oshmem/shmem/c/shmem_for.c +++ b/oshmem/shmem/c/shmem_for.c @@ -33,6 +33,10 @@ #pragma weak shmem_uint_atomic_fetch_or = pshmem_uint_atomic_fetch_or #pragma weak shmem_ulong_atomic_fetch_or = pshmem_ulong_atomic_fetch_or #pragma weak shmem_ulonglong_atomic_fetch_or = pshmem_ulonglong_atomic_fetch_or +#pragma weak shmem_int32_atomic_fetch_or = pshmem_int32_atomic_fetch_or +#pragma weak shmem_int64_atomic_fetch_or = pshmem_int64_atomic_fetch_or +#pragma weak shmem_uint32_atomic_fetch_or = pshmem_uint32_atomic_fetch_or +#pragma weak shmem_uint64_atomic_fetch_or = pshmem_uint64_atomic_fetch_or #pragma weak shmem_ctx_int_atomic_fetch_or = pshmem_ctx_int_atomic_fetch_or #pragma weak shmem_ctx_long_atomic_fetch_or = pshmem_ctx_long_atomic_fetch_or @@ -40,6 +44,10 @@ #pragma weak shmem_ctx_uint_atomic_fetch_or = pshmem_ctx_uint_atomic_fetch_or #pragma weak shmem_ctx_ulong_atomic_fetch_or = pshmem_ctx_ulong_atomic_fetch_or #pragma weak shmem_ctx_ulonglong_atomic_fetch_or = pshmem_ctx_ulonglong_atomic_fetch_or +#pragma weak shmem_ctx_int32_atomic_fetch_or = pshmem_ctx_int32_atomic_fetch_or +#pragma weak shmem_ctx_int64_atomic_fetch_or = pshmem_ctx_int64_atomic_fetch_or +#pragma weak shmem_ctx_uint32_atomic_fetch_or = pshmem_ctx_uint32_atomic_fetch_or +#pragma weak shmem_ctx_uint64_atomic_fetch_or = pshmem_ctx_uint64_atomic_fetch_or #pragma weak shmemx_int32_atomic_fetch_or = pshmemx_int32_atomic_fetch_or #pragma weak shmemx_int64_atomic_fetch_or = pshmemx_int64_atomic_fetch_or @@ -54,12 +62,22 @@ OSHMEM_TYPE_FOP(longlong, long long, shmem, or) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, or) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, or) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, or) +OSHMEM_TYPE_FOP(int32, int32_t, shmem, or) +OSHMEM_TYPE_FOP(int64, int64_t, shmem, or) +OSHMEM_TYPE_FOP(uint32, uint32_t, shmem, or) +OSHMEM_TYPE_FOP(uint64, uint64_t, shmem, or) + OSHMEM_CTX_TYPE_FOP(int, int, shmem, or) OSHMEM_CTX_TYPE_FOP(long, long, shmem, or) OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, or) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, or) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, or) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, or) +OSHMEM_CTX_TYPE_FOP(int32, int32_t, shmem, or) +OSHMEM_CTX_TYPE_FOP(int64, int64_t, shmem, or) +OSHMEM_CTX_TYPE_FOP(uint32, uint32_t, shmem, or) +OSHMEM_CTX_TYPE_FOP(uint64, uint64_t, shmem, or) + OSHMEM_TYPE_FOP(int32, int32_t, shmemx, or) OSHMEM_TYPE_FOP(int64, int64_t, shmemx, or) OSHMEM_TYPE_FOP(uint32, uint32_t, shmemx, or) diff --git a/oshmem/shmem/c/shmem_fxor.c b/oshmem/shmem/c/shmem_fxor.c index ee762bf12bb..41fe2249c6b 100644 --- a/oshmem/shmem/c/shmem_fxor.c +++ b/oshmem/shmem/c/shmem_fxor.c @@ -33,6 +33,10 @@ #pragma weak shmem_uint_atomic_fetch_xor = pshmem_uint_atomic_fetch_xor #pragma weak shmem_ulong_atomic_fetch_xor = pshmem_ulong_atomic_fetch_xor #pragma weak shmem_ulonglong_atomic_fetch_xor = pshmem_ulonglong_atomic_fetch_xor +#pragma weak shmem_int32_atomic_fetch_xor = pshmem_int32_atomic_fetch_xor +#pragma weak shmem_int64_atomic_fetch_xor = pshmem_int64_atomic_fetch_xor +#pragma weak shmem_uint32_atomic_fetch_xor = pshmem_uint32_atomic_fetch_xor +#pragma weak shmem_uint64_atomic_fetch_xor = pshmem_uint64_atomic_fetch_xor #pragma weak shmem_ctx_int_atomic_fetch_xor = pshmem_ctx_int_atomic_fetch_xor #pragma weak shmem_ctx_long_atomic_fetch_xor = pshmem_ctx_long_atomic_fetch_xor @@ -40,6 +44,10 @@ #pragma weak shmem_ctx_uint_atomic_fetch_xor = pshmem_ctx_uint_atomic_fetch_xor #pragma weak shmem_ctx_ulong_atomic_fetch_xor = pshmem_ctx_ulong_atomic_fetch_xor #pragma weak shmem_ctx_ulonglong_atomic_fetch_xor = pshmem_ctx_ulonglong_atomic_fetch_xor +#pragma weak shmem_ctx_int32_atomic_fetch_xor = pshmem_ctx_int32_atomic_fetch_xor +#pragma weak shmem_ctx_int64_atomic_fetch_xor = pshmem_ctx_int64_atomic_fetch_xor +#pragma weak shmem_ctx_uint32_atomic_fetch_xor = pshmem_ctx_uint32_atomic_fetch_xor +#pragma weak shmem_ctx_uint64_atomic_fetch_xor = pshmem_ctx_uint64_atomic_fetch_xor #pragma weak shmemx_int32_atomic_fetch_xor = pshmemx_int32_atomic_fetch_xor #pragma weak shmemx_int64_atomic_fetch_xor = pshmemx_int64_atomic_fetch_xor @@ -54,12 +62,22 @@ OSHMEM_TYPE_FOP(longlong, long long, shmem, xor) OSHMEM_TYPE_FOP(uint, unsigned int, shmem, xor) OSHMEM_TYPE_FOP(ulong, unsigned long, shmem, xor) OSHMEM_TYPE_FOP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_TYPE_FOP(int32, int32_t, shmem, xor) +OSHMEM_TYPE_FOP(int64, int64_t, shmem, xor) +OSHMEM_TYPE_FOP(uint32, uint32_t, shmem, xor) +OSHMEM_TYPE_FOP(uint64, uint64_t, shmem, xor) + OSHMEM_CTX_TYPE_FOP(int, int, shmem, xor) OSHMEM_CTX_TYPE_FOP(long, long, shmem, xor) OSHMEM_CTX_TYPE_FOP(longlong, long long, shmem, xor) OSHMEM_CTX_TYPE_FOP(uint, unsigned int, shmem, xor) OSHMEM_CTX_TYPE_FOP(ulong, unsigned long, shmem, xor) OSHMEM_CTX_TYPE_FOP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_CTX_TYPE_FOP(int32, int32_t, shmem, xor) +OSHMEM_CTX_TYPE_FOP(int64, int64_t, shmem, xor) +OSHMEM_CTX_TYPE_FOP(uint32, uint32_t, shmem, xor) +OSHMEM_CTX_TYPE_FOP(uint64, uint64_t, shmem, xor) + OSHMEM_TYPE_FOP(int32, int32_t, shmemx, xor) OSHMEM_TYPE_FOP(int64, int64_t, shmemx, xor) OSHMEM_TYPE_FOP(uint32, uint32_t, shmemx, xor) diff --git a/oshmem/shmem/c/shmem_g.c b/oshmem/shmem/c/shmem_g.c index e53aec5724e..112953060ed 100644 --- a/oshmem/shmem/c/shmem_g.c +++ b/oshmem/shmem/c/shmem_g.c @@ -63,6 +63,7 @@ #pragma weak shmem_ctx_int_g = pshmem_ctx_int_g #pragma weak shmem_ctx_long_g = pshmem_ctx_long_g #pragma weak shmem_ctx_longlong_g = pshmem_ctx_longlong_g +#pragma weak shmem_ctx_schar_g = pshmem_ctx_schar_g #pragma weak shmem_ctx_uchar_g = pshmem_ctx_uchar_g #pragma weak shmem_ctx_ushort_g = pshmem_ctx_ushort_g #pragma weak shmem_ctx_uint_g = pshmem_ctx_uint_g @@ -77,6 +78,7 @@ #pragma weak shmem_int_g = pshmem_int_g #pragma weak shmem_long_g = pshmem_long_g #pragma weak shmem_longlong_g = pshmem_longlong_g +#pragma weak shmem_schar_g = pshmem_schar_g #pragma weak shmem_uchar_g = pshmem_uchar_g #pragma weak shmem_ushort_g = pshmem_ushort_g #pragma weak shmem_uint_g = pshmem_uint_g diff --git a/oshmem/shmem/c/shmem_or.c b/oshmem/shmem/c/shmem_or.c index e03e057a6ca..7bdbb59ad34 100644 --- a/oshmem/shmem/c/shmem_or.c +++ b/oshmem/shmem/c/shmem_or.c @@ -31,6 +31,10 @@ #pragma weak shmem_uint_atomic_or = pshmem_uint_atomic_or #pragma weak shmem_ulong_atomic_or = pshmem_ulong_atomic_or #pragma weak shmem_ulonglong_atomic_or = pshmem_ulonglong_atomic_or +#pragma weak shmem_int32_atomic_or = pshmem_int32_atomic_or +#pragma weak shmem_int64_atomic_or = pshmem_int64_atomic_or +#pragma weak shmem_uint32_atomic_or = pshmem_uint32_atomic_or +#pragma weak shmem_uint64_atomic_or = pshmem_uint64_atomic_or #pragma weak shmem_ctx_int_atomic_or = pshmem_ctx_int_atomic_or #pragma weak shmem_ctx_long_atomic_or = pshmem_ctx_long_atomic_or @@ -38,6 +42,10 @@ #pragma weak shmem_ctx_uint_atomic_or = pshmem_ctx_uint_atomic_or #pragma weak shmem_ctx_ulong_atomic_or = pshmem_ctx_ulong_atomic_or #pragma weak shmem_ctx_ulonglong_atomic_or = pshmem_ctx_ulonglong_atomic_or +#pragma weak shmem_ctx_int32_atomic_or = pshmem_ctx_int32_atomic_or +#pragma weak shmem_ctx_int64_atomic_or = pshmem_ctx_int64_atomic_or +#pragma weak shmem_ctx_uint32_atomic_or = pshmem_ctx_uint32_atomic_or +#pragma weak shmem_ctx_uint64_atomic_or = pshmem_ctx_uint64_atomic_or #pragma weak shmemx_int32_atomic_or = pshmemx_int32_atomic_or #pragma weak shmemx_int64_atomic_or = pshmemx_int64_atomic_or @@ -52,12 +60,22 @@ OSHMEM_TYPE_OP(longlong, long long, shmem, or) OSHMEM_TYPE_OP(uint, unsigned int, shmem, or) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, or) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, or) +OSHMEM_TYPE_OP(int32, int32_t, shmem, or) +OSHMEM_TYPE_OP(int64, int64_t, shmem, or) +OSHMEM_TYPE_OP(uint32, uint32_t, shmem, or) +OSHMEM_TYPE_OP(uint64, uint64_t, shmem, or) + OSHMEM_CTX_TYPE_OP(int, int, shmem, or) OSHMEM_CTX_TYPE_OP(long, long, shmem, or) OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, or) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, or) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, or) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, or) +OSHMEM_CTX_TYPE_OP(int32, int32_t, shmem, or) +OSHMEM_CTX_TYPE_OP(int64, int64_t, shmem, or) +OSHMEM_CTX_TYPE_OP(uint32, uint32_t, shmem, or) +OSHMEM_CTX_TYPE_OP(uint64, uint64_t, shmem, or) + OSHMEM_TYPE_OP(int32, int32_t, shmemx, or) OSHMEM_TYPE_OP(int64, int64_t, shmemx, or) OSHMEM_TYPE_OP(uint32, uint32_t, shmemx, or) diff --git a/oshmem/shmem/c/shmem_wait.c b/oshmem/shmem/c/shmem_wait.c index 521f788bc4b..1c94dd2c106 100644 --- a/oshmem/shmem/c/shmem_wait.c +++ b/oshmem/shmem/c/shmem_wait.c @@ -48,16 +48,39 @@ #pragma weak shmem_longlong_wait = pshmem_longlong_wait #pragma weak shmemx_int32_wait = pshmemx_int32_wait #pragma weak shmemx_int64_wait = pshmemx_int64_wait + #pragma weak shmem_short_wait_until = pshmem_short_wait_until #pragma weak shmem_int_wait_until = pshmem_int_wait_until #pragma weak shmem_long_wait_until = pshmem_long_wait_until #pragma weak shmem_longlong_wait_until = pshmem_longlong_wait_until +#pragma weak shmem_ushort_wait_until = pshmem_ushort_wait_until +#pragma weak shmem_uint_wait_until = pshmem_uint_wait_until +#pragma weak shmem_ulong_wait_until = pshmem_ulong_wait_until +#pragma weak shmem_ulonglong_wait_until = pshmem_ulonglong_wait_until +#pragma weak shmem_int32_wait_until = pshmem_int32_wait_until +#pragma weak shmem_int64_wait_until = pshmem_int64_wait_until +#pragma weak shmem_uint32_wait_until = pshmem_uint32_wait_until +#pragma weak shmem_uint64_wait_until = pshmem_uint64_wait_until +#pragma weak shmem_size_wait_until = pshmem_size_wait_until +#pragma weak shmem_ptrdiff_wait_until = pshmem_ptrdiff_wait_until + #pragma weak shmemx_int32_wait_until = pshmemx_int32_wait_until #pragma weak shmemx_int64_wait_until = pshmemx_int64_wait_until + #pragma weak shmem_short_test = pshmem_short_test #pragma weak shmem_int_test = pshmem_int_test #pragma weak shmem_long_test = pshmem_long_test #pragma weak shmem_longlong_test = pshmem_longlong_test +#pragma weak shmem_ushort_test = pshmem_ushort_test +#pragma weak shmem_uint_test = pshmem_uint_test +#pragma weak shmem_ulong_test = pshmem_ulong_test +#pragma weak shmem_ulonglong_test = pshmem_ulonglong_test +#pragma weak shmem_int32_test = pshmem_int32_test +#pragma weak shmem_int64_test = pshmem_int64_test +#pragma weak shmem_uint32_test = pshmem_uint32_test +#pragma weak shmem_uint64_test = pshmem_uint64_test +#pragma weak shmem_size_test = pshmem_size_test +#pragma weak shmem_ptrdiff_test = pshmem_ptrdiff_test #include "oshmem/shmem/c/profile/defines.h" #endif @@ -90,6 +113,17 @@ SHMEM_TYPE_WAIT_UNTIL(_short, volatile short, SHMEM_SHORT, shmem) SHMEM_TYPE_WAIT_UNTIL(_int, volatile int, SHMEM_INT, shmem) SHMEM_TYPE_WAIT_UNTIL(_long, volatile long, SHMEM_LONG, shmem) SHMEM_TYPE_WAIT_UNTIL(_longlong, volatile long long, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_ushort, volatile unsigned short, SHMEM_SHORT, shmem) +SHMEM_TYPE_WAIT_UNTIL(_uint, volatile unsigned int, SHMEM_INT, shmem) +SHMEM_TYPE_WAIT_UNTIL(_ulong, volatile unsigned long, SHMEM_LONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_ulonglong, volatile unsigned long long, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_int32, volatile int32_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_int64, volatile int64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_uint32, volatile uint32_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_uint64, volatile uint64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_size, volatile size_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_ptrdiff, volatile ptrdiff_t, SHMEM_LLONG, shmem) + SHMEM_TYPE_WAIT_UNTIL(_int32, int32_t, SHMEM_INT32_T, shmemx) SHMEM_TYPE_WAIT_UNTIL(_int64, int64_t, SHMEM_INT64_T, shmemx) @@ -115,3 +149,13 @@ SHMEM_TYPE_TEST(_short, volatile short, SHMEM_SHORT, shmem) SHMEM_TYPE_TEST(_int, volatile int, SHMEM_INT, shmem) SHMEM_TYPE_TEST(_long, volatile long, SHMEM_LONG, shmem) SHMEM_TYPE_TEST(_longlong, volatile long long, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_ushort, volatile unsigned short, SHMEM_SHORT, shmem) +SHMEM_TYPE_TEST(_uint, volatile unsigned int, SHMEM_INT, shmem) +SHMEM_TYPE_TEST(_ulong, volatile unsigned long, SHMEM_LONG, shmem) +SHMEM_TYPE_TEST(_ulonglong, volatile unsigned long long, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_int32, volatile int32_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_int64, volatile int64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_uint32, volatile uint32_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_uint64, volatile uint64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_size, volatile size_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_ptrdiff, volatile ptrdiff_t, SHMEM_LLONG, shmem) diff --git a/oshmem/shmem/c/shmem_xor.c b/oshmem/shmem/c/shmem_xor.c index 0a2aa8af18d..b2209ce6648 100644 --- a/oshmem/shmem/c/shmem_xor.c +++ b/oshmem/shmem/c/shmem_xor.c @@ -31,6 +31,10 @@ #pragma weak shmem_uint_atomic_xor = pshmem_uint_atomic_xor #pragma weak shmem_ulong_atomic_xor = pshmem_ulong_atomic_xor #pragma weak shmem_ulonglong_atomic_xor = pshmem_ulonglong_atomic_xor +#pragma weak shmem_int32_atomic_xor = pshmem_int32_atomic_xor +#pragma weak shmem_int64_atomic_xor = pshmem_int64_atomic_xor +#pragma weak shmem_uint32_atomic_xor = pshmem_uint32_atomic_xor +#pragma weak shmem_uint64_atomic_xor = pshmem_uint64_atomic_xor #pragma weak shmem_ctx_int_atomic_xor = pshmem_ctx_int_atomic_xor #pragma weak shmem_ctx_long_atomic_xor = pshmem_ctx_long_atomic_xor @@ -38,6 +42,10 @@ #pragma weak shmem_ctx_uint_atomic_xor = pshmem_ctx_uint_atomic_xor #pragma weak shmem_ctx_ulong_atomic_xor = pshmem_ctx_ulong_atomic_xor #pragma weak shmem_ctx_ulonglong_atomic_xor = pshmem_ctx_ulonglong_atomic_xor +#pragma weak shmem_ctx_int32_atomic_xor = pshmem_ctx_int32_atomic_xor +#pragma weak shmem_ctx_int64_atomic_xor = pshmem_ctx_int64_atomic_xor +#pragma weak shmem_ctx_uint32_atomic_xor = pshmem_ctx_uint32_atomic_xor +#pragma weak shmem_ctx_uint64_atomic_xor = pshmem_ctx_uint64_atomic_xor #pragma weak shmemx_int32_atomic_xor = pshmemx_int32_atomic_xor #pragma weak shmemx_int64_atomic_xor = pshmemx_int64_atomic_xor @@ -52,12 +60,22 @@ OSHMEM_TYPE_OP(longlong, long long, shmem, xor) OSHMEM_TYPE_OP(uint, unsigned int, shmem, xor) OSHMEM_TYPE_OP(ulong, unsigned long, shmem, xor) OSHMEM_TYPE_OP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_TYPE_OP(int32, int32_t, shmem, xor) +OSHMEM_TYPE_OP(int64, int64_t, shmem, xor) +OSHMEM_TYPE_OP(uint32, uint32_t, shmem, xor) +OSHMEM_TYPE_OP(uint64, uint64_t, shmem, xor) + OSHMEM_CTX_TYPE_OP(int, int, shmem, xor) OSHMEM_CTX_TYPE_OP(long, long, shmem, xor) OSHMEM_CTX_TYPE_OP(longlong, long long, shmem, xor) OSHMEM_CTX_TYPE_OP(uint, unsigned int, shmem, xor) OSHMEM_CTX_TYPE_OP(ulong, unsigned long, shmem, xor) OSHMEM_CTX_TYPE_OP(ulonglong, unsigned long long, shmem, xor) +OSHMEM_CTX_TYPE_OP(int32, int32_t, shmem, xor) +OSHMEM_CTX_TYPE_OP(int64, int64_t, shmem, xor) +OSHMEM_CTX_TYPE_OP(uint32, uint32_t, shmem, xor) +OSHMEM_CTX_TYPE_OP(uint64, uint64_t, shmem, xor) + OSHMEM_TYPE_OP(int32, int32_t, shmemx, xor) OSHMEM_TYPE_OP(int64, int64_t, shmemx, xor) OSHMEM_TYPE_OP(uint32, uint32_t, shmemx, xor) From 6f68483fd5e395b8698cd12c993b73e972220044 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 26 Nov 2018 17:07:45 +0900 Subject: [PATCH 191/674] README & man: Update pcollreq documentation The feature of persistent collectives is approved in the Sept. 2018 MPI Forum meeting and 2018 Draft Specification of the MPI standard is published during SC18. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 5f0fcf0f456aaa43f36215859412f33f79ac91f9) --- README | 16 ++++++++-------- ompi/mpiext/pcollreq/README.txt | 3 ++- ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in | 6 +++--- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README b/README index b12f361a25a..ec660702bdd 100644 --- a/README +++ b/README @@ -815,14 +815,14 @@ Open MPI Extensions - The following extensions are included in this version of Open MPI: - - pcollreq: Provides routines for persistent collective - communication operations and persistent neighborhood collective - communication operations, which are proposed in the MPI Forum as - of June 2018. The function names are prefixed with MPIX_ instead - of MPI_, like MPIX_Barrier_init, because they are not standardized - yet. Future versions of Open MPI will switch to the MPI_ prefix - once the MPI Standard which includes this feature is published. - See their man page for more details. + - pcollreq: Provides routines for persistent collective communication + operations and persistent neighborhood collective communication + operations, which are planned to be included in the next MPI + Standard after MPI-3.1 as of Nov. 2018. The function names are + prefixed with MPIX_ instead of MPI_, like MPIX_Barrier_init, + because they are not standardized yet. Future versions of Open MPI + will switch to the MPI_ prefix once the MPI Standard which includes + this feature is published. See their man page for more details. - affinity: Provides the OMPI_Affinity_str() routine on retrieving a string that contains what resources a process is bound to. See its man page for more details. diff --git a/ompi/mpiext/pcollreq/README.txt b/ompi/mpiext/pcollreq/README.txt index 0b30de9fe89..7dd491f81df 100644 --- a/ompi/mpiext/pcollreq/README.txt +++ b/ompi/mpiext/pcollreq/README.txt @@ -4,7 +4,8 @@ $COPYRIGHT$ This extension provides the feature of persistent collective communication operations and persistent neighborhood collective communication operations, -which is proposed in the MPI Forum as of June 2018. +which is planned to be included in the next MPI Standard after MPI-3.1 as +of Nov. 2018. See MPIX_Barrier_init(3) for more details. diff --git a/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in b/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in index d63d0ca253a..db6cccc9c54 100644 --- a/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in +++ b/ompi/mpiext/pcollreq/c/MPIX_Barrier_init.3in @@ -529,16 +529,16 @@ MPIX_Neighbor_alltoallw_init(\fIsendbuf\fP, \fIsendcounts\fP, \fIsdispls\fP, \fI .ft R Creates a persistent communication request for a collective operation or neighborhood collective operation. -As of Sept. 2018, the feature of persistent collective communication operations and persistent collective neighborhood communication operations is planned to be included in the next MPI Standerd after MPI-3.1. +As of Nov. 2018, the feature of persistent collective communication operations and persistent collective neighborhood communication operations is planned to be included in the next MPI Standard after MPI-3.1. .nf https://github.com/mpi-forum/mpi-issues/issues/25 .fi -Open MPI implements its draft version shown in the following URL. +Open MPI implements 2018 Draft Specification of the MPI standard shown in the following URL. .nf - https://github.com/mpi-forum/mpi-issues/files/2078076/mpi32-report-ticket25-austin-vote-june2018.pdf + https://www.mpi-forum.org/docs/drafts/mpi-2018-draft-report.pdf .fi The interface may still change in the standard. Therefore the prefix \fIMPIX_\fP is used instead of \fIMPI_\fP for these request creation routines. To start, complete, and free the created request, usual MPI routines (\fIMPI_Start\fP etc.) can be used. From a112d10c93f289a0a5825c161875f0abe9b0fbab Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Sun, 25 Nov 2018 19:28:36 +0200 Subject: [PATCH 192/674] pml_ucx: initialize req_mpi_object.comm for error handler without this fix, an error handler invoked on pml_ucx request would segfault while trying to dereference requests[i]->req_mpi_object.comm (picked from master f36eeef) Signed-off-by: Yossi Itigin --- ompi/mca/pml/ucx/pml_ucx.c | 37 +++++++++++++++++------------- ompi/mca/pml/ucx/pml_ucx_request.c | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 2e10a3b768c..bcb689e1de8 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -477,11 +477,12 @@ int mca_pml_ucx_irecv_init(void *buf, size_t count, ompi_datatype_t *datatype, PML_UCX_TRACE_RECV("irecv_init request *%p=%p", buf, count, datatype, src, tag, comm, (void*)request, (void*)req); - req->ompi.req_state = OMPI_REQUEST_INACTIVE; - req->flags = 0; - req->buffer = buf; - req->count = count; - req->datatype.datatype = mca_pml_ucx_get_datatype(datatype); + req->ompi.req_state = OMPI_REQUEST_INACTIVE; + req->ompi.req_mpi_object.comm = comm; + req->flags = 0; + req->buffer = buf; + req->count = count; + req->datatype.datatype = mca_pml_ucx_get_datatype(datatype); PML_UCX_MAKE_RECV_TAG(req->tag, req->recv.tag_mask, tag, src, comm); @@ -510,7 +511,8 @@ int mca_pml_ucx_irecv(void *buf, size_t count, ompi_datatype_t *datatype, } PML_UCX_VERBOSE(8, "got request %p", (void*)req); - *request = req; + req->req_mpi_object.comm = comm; + *request = req; return OMPI_SUCCESS; } @@ -582,13 +584,15 @@ int mca_pml_ucx_isend_init(const void *buf, size_t count, ompi_datatype_t *datat return OMPI_ERROR; } - req->ompi.req_state = OMPI_REQUEST_INACTIVE; - req->flags = MCA_PML_UCX_REQUEST_FLAG_SEND; - req->buffer = (void *)buf; - req->count = count; - req->tag = PML_UCX_MAKE_SEND_TAG(tag, comm); - req->send.mode = mode; - req->send.ep = ep; + req->ompi.req_state = OMPI_REQUEST_INACTIVE; + req->ompi.req_mpi_object.comm = comm; + req->flags = MCA_PML_UCX_REQUEST_FLAG_SEND; + req->buffer = (void *)buf; + req->count = count; + req->tag = PML_UCX_MAKE_SEND_TAG(tag, comm); + req->send.mode = mode; + req->send.ep = ep; + if (MCA_PML_BASE_SEND_BUFFERED == mode) { req->datatype.ompi_datatype = datatype; OBJ_RETAIN(datatype); @@ -706,7 +710,8 @@ int mca_pml_ucx_isend(const void *buf, size_t count, ompi_datatype_t *datatype, return OMPI_SUCCESS; } else if (!UCS_PTR_IS_ERR(req)) { PML_UCX_VERBOSE(8, "got request %p", (void*)req); - *request = req; + req->req_mpi_object.comm = comm; + *request = req; return OMPI_SUCCESS; } else { PML_UCX_ERROR("ucx send failed: %s", ucs_status_string(UCS_PTR_STATUS(req))); @@ -786,7 +791,7 @@ int mca_pml_ucx_send(const void *buf, size_t count, ompi_datatype_t *datatype, i } int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm, - int *matched, ompi_status_public_t* mpi_status) + int *matched, ompi_status_public_t* mpi_status) { static unsigned progress_count = 0; @@ -811,7 +816,7 @@ int mca_pml_ucx_iprobe(int src, int tag, struct ompi_communicator_t* comm, } int mca_pml_ucx_probe(int src, int tag, struct ompi_communicator_t* comm, - ompi_status_public_t* mpi_status) + ompi_status_public_t* mpi_status) { ucp_tag_t ucp_tag, ucp_tag_mask; ucp_tag_recv_info_t info; diff --git a/ompi/mca/pml/ucx/pml_ucx_request.c b/ompi/mca/pml/ucx/pml_ucx_request.c index 8602386e0cd..536ac95e79b 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.c +++ b/ompi/mca/pml/ucx/pml_ucx_request.c @@ -228,7 +228,7 @@ void mca_pml_ucx_completed_request_init(ompi_request_t *ompi_req) mca_pml_ucx_request_init_common(ompi_req, false, OMPI_REQUEST_ACTIVE, mca_pml_completed_request_free, mca_pml_completed_request_cancel); + ompi_req->req_mpi_object.comm = &ompi_mpi_comm_world.comm; ompi_request_complete(ompi_req, false); - } From cb6841ac64d856776ac672c7f9a9ff081c5c1758 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 26 Nov 2018 09:39:30 +0900 Subject: [PATCH 193/674] configury: fix auto-generated mpi-[f08-]ext-module.F90 prefer #include vs include in order to correctly handle long Fortran lines. We use the full path, and it can be very long, this is why it cannot be passed to the Fortran compiler. Thanks Igor Andriyash and Axel Huebl for reporting this issue. Refs open-mpi/ompi#6106 Signed-off-by: Gilles Gouaillardet (cherry picked from commit 475d0355d7ce2d31b582944c685fae13d711b3c9) --- config/ompi_ext.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index ab3920d2fbc..72f47d390d3 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -5,8 +5,8 @@ dnl University Research and Technology dnl Corporation. All rights reserved. dnl Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved dnl Copyright (c) 2011-2012 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2015-2017 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2018 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2017 The University of Tennessee and The University dnl of Tennessee Research Foundation. All rights dnl reserved. @@ -568,7 +568,7 @@ EOF if test "$enabled_mpifh" = 1; then mpifh_component_header="mpiext_${component}_mpifh.h" cat >> $mpiusempi_ext_h <> $mpiusempif08_ext_h < Date: Fri, 23 Nov 2018 12:05:19 +0200 Subject: [PATCH 194/674] OSHMEM: added processing of zero-length collectives - according spec 1.4, annex C shmem collectives should process calls where number of elements is zero independently from pointer value - added zero-count processing - it just call barrier to sync ranks Signed-off-by: Sergey Oblomov (cherry picked from commit 9de128afaf5224193a88f00c897f5d5c94336f99) --- oshmem/mca/scoll/basic/scoll_basic_alltoall.c | 18 ++++++++++-------- oshmem/mca/scoll/basic/scoll_basic_broadcast.c | 12 +++++++++++- oshmem/mca/scoll/basic/scoll_basic_collect.c | 6 +++--- oshmem/mca/scoll/basic/scoll_basic_reduce.c | 7 ++++--- oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 6 +++--- oshmem/runtime/runtime.h | 8 ++++++++ oshmem/shmem/c/shmem_alltoall.c | 12 ++++++------ oshmem/shmem/c/shmem_broadcast.c | 8 ++++---- oshmem/shmem/c/shmem_collect.c | 6 +++--- oshmem/shmem/c/shmem_reduce.c | 8 ++++---- 10 files changed, 56 insertions(+), 35 deletions(-) diff --git a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c index 1698ee13354..82934655eac 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c +++ b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c @@ -61,15 +61,17 @@ int mca_scoll_basic_alltoall(struct oshmem_group_t *group, return OSHMEM_ERR_BAD_PARAM; } - if ((sst == 1) && (dst == 1)) { - rc = a2a_alg_simple(group, target, source, nelems, element_size); - } else { - rc = a2as_alg_simple(group, target, source, dst, sst, nelems, - element_size); - } + if (nelems) { + if ((sst == 1) && (dst == 1)) { + rc = a2a_alg_simple(group, target, source, nelems, element_size); + } else { + rc = a2as_alg_simple(group, target, source, dst, sst, nelems, + element_size); + } - if (rc != OSHMEM_SUCCESS) { - return rc; + if (rc != OSHMEM_SUCCESS) { + return rc; + } } /* quiet is needed because scoll level barrier does not diff --git a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c index ef9bf1869b5..01dd35f73c7 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c +++ b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c @@ -131,7 +131,7 @@ static int _algorithm_central_counter(struct oshmem_group_t *group, group->my_pe, pSync[0], PE_root); /* Check if this PE is the root */ - if (PE_root == group->my_pe) { + if ((PE_root == group->my_pe) && nlong) { int pe_cur = 0; SCOLL_VERBOSE(14, @@ -192,6 +192,16 @@ static int _algorithm_binomial_tree(struct oshmem_group_t *group, "[#%d] pSync[0] = %ld root = #%d", group->my_pe, pSync[0], PE_root); + if (OPAL_UNLIKELY(!nlong)) { + SCOLL_VERBOSE(14, "[#%d] Wait for operation completion", group->my_pe); + /* wait until root finishes sending data */ + rc = BARRIER_FUNC(group, + (pSync + 1), + SCOLL_DEFAULT_ALG); + return rc; + } + + vrank = (my_id + group->proc_count - root_id) % group->proc_count; hibit = opal_hibit(vrank, dim); diff --git a/oshmem/mca/scoll/basic/scoll_basic_collect.c b/oshmem/mca/scoll/basic/scoll_basic_collect.c index eda5f93406c..b6f5df65f7c 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_collect.c +++ b/oshmem/mca/scoll/basic/scoll_basic_collect.c @@ -66,7 +66,7 @@ int mca_scoll_basic_collect(struct oshmem_group_t *group, if ((rc == OSHMEM_SUCCESS) && oshmem_proc_group_is_member(group)) { int i = 0; - if (nlong_type) { + if (nlong_type && nlong) { alg = (alg == SCOLL_DEFAULT_ALG ? mca_scoll_basic_param_collect_algorithm : alg); switch (alg) { @@ -156,7 +156,7 @@ static int _algorithm_f_central_counter(struct oshmem_group_t *group, group->my_pe); SCOLL_VERBOSE(15, "[#%d] pSync[0] = %ld", group->my_pe, pSync[0]); - if (PE_root == group->my_pe) { + if ((PE_root == group->my_pe) && nlong) { int pe_cur = 0; memcpy((void*) ((unsigned char*) target + 0 * nlong), @@ -543,7 +543,7 @@ static int _algorithm_central_collector(struct oshmem_group_t *group, /* Set own data size */ pSync[0] = (nlong ? (long)nlong : SHMEM_SYNC_READY); - if (PE_root == group->my_pe) { + if ((PE_root == group->my_pe) && nlong) { long value = 0; int pe_cur = 0; long wait_pe_count = 0; diff --git a/oshmem/mca/scoll/basic/scoll_basic_reduce.c b/oshmem/mca/scoll/basic/scoll_basic_reduce.c index 9d6db9eed47..22c64b47e78 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_reduce.c +++ b/oshmem/mca/scoll/basic/scoll_basic_reduce.c @@ -79,8 +79,9 @@ int mca_scoll_basic_reduce(struct oshmem_group_t *group, int i = 0; if (pSync) { - alg = (alg == SCOLL_DEFAULT_ALG ? - mca_scoll_basic_param_reduce_algorithm : alg); + alg = (nlong ? (alg == SCOLL_DEFAULT_ALG ? + mca_scoll_basic_param_reduce_algorithm : alg) : + SCOLL_ALG_REDUCE_CENTRAL_COUNTER ); switch (alg) { case SCOLL_ALG_REDUCE_CENTRAL_COUNTER: { @@ -185,7 +186,7 @@ static int _algorithm_central_counter(struct oshmem_group_t *group, SCOLL_VERBOSE(12, "[#%d] Reduce algorithm: Central Counter", group->my_pe); - if (PE_root == group->my_pe) { + if ((PE_root == group->my_pe) && nlong) { int pe_cur = 0; void *target_cur = NULL; diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index 8506dd524d8..df4392acc26 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -61,7 +61,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, * and considering this contradiction, we cast size_t to int here * in case if the value is less than INT_MAX and fallback to previous module otherwise. */ #ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS - if (INT_MAX < nlong) { + if ((INT_MAX < nlong) || !nlong) { MPI_COLL_VERBOSE(20,"RUNNING FALLBACK BCAST"); PREVIOUS_SCOLL_FN(mpi_module, broadcast, group, PE_root, @@ -104,7 +104,7 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, void *sbuf, *rbuf; MPI_COLL_VERBOSE(20,"RUNNING MPI ALLGATHER"); mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_collect_module; - if (nlong_type == true) { + if ((nlong_type == true) && nlong) { sbuf = (void *) source; rbuf = target; stype = &ompi_mpi_char.dt; @@ -184,7 +184,7 @@ int mca_scoll_mpi_reduce(struct oshmem_group_t *group, * and considering this contradiction, we cast size_t to int here * in case if the value is less than INT_MAX and fallback to previous module otherwise. */ #ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS - if (INT_MAX < count) { + if ((INT_MAX < count) || !nlong) { MPI_COLL_VERBOSE(20,"RUNNING FALLBACK REDUCE"); PREVIOUS_SCOLL_FN(mpi_module, reduce, group, op, diff --git a/oshmem/runtime/runtime.h b/oshmem/runtime/runtime.h index f0a093438d7..28f22f3eab7 100644 --- a/oshmem/runtime/runtime.h +++ b/oshmem/runtime/runtime.h @@ -200,6 +200,13 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void); RUNTIME_CHECK_ERROR("Required address %p is not in symmetric space\n", ((void*)x)); \ oshmem_shmem_abort(-1); \ } +/* Check if address is in symmetric space or size is zero */ +#define RUNTIME_CHECK_ADDR_SIZE(x,s) \ + if (OPAL_UNLIKELY((s) && !MCA_MEMHEAP_CALL(is_symmetric_addr((x))))) \ + { \ + RUNTIME_CHECK_ERROR("Required address %p is not in symmetric space\n", ((void*)x)); \ + oshmem_shmem_abort(-1); \ + } #define RUNTIME_CHECK_WITH_MEMHEAP_SIZE(x) \ if (OPAL_UNLIKELY((long)(x) > MCA_MEMHEAP_CALL(size))) \ { \ @@ -212,6 +219,7 @@ OSHMEM_DECLSPEC int oshmem_shmem_register_params(void); #define RUNTIME_CHECK_INIT() #define RUNTIME_CHECK_PE(x) #define RUNTIME_CHECK_ADDR(x) +#define RUNTIME_CHECK_ADDR_SIZE(x,s) #define RUNTIME_CHECK_WITH_MEMHEAP_SIZE(x) #endif /* OSHMEM_PARAM_CHECK */ diff --git a/oshmem/shmem/c/shmem_alltoall.c b/oshmem/shmem/c/shmem_alltoall.c index 57f40f67bd8..0bc115f713d 100644 --- a/oshmem/shmem/c/shmem_alltoall.c +++ b/oshmem/shmem/c/shmem_alltoall.c @@ -30,7 +30,7 @@ static void _shmem_alltoall(void *target, int PE_size, long *pSync); -#define SHMEM_TYPE_ALLTOALL(name, element_size) \ +#define SHMEM_TYPE_ALLTOALL(name, element_size) \ void shmem##name(void *target, \ const void *source, \ size_t nelems, \ @@ -40,15 +40,15 @@ static void _shmem_alltoall(void *target, long *pSync) \ { \ RUNTIME_CHECK_INIT(); \ - RUNTIME_CHECK_ADDR(target); \ - RUNTIME_CHECK_ADDR(source); \ + RUNTIME_CHECK_ADDR_SIZE(target, nelems); \ + RUNTIME_CHECK_ADDR_SIZE(source, nelems); \ \ _shmem_alltoall(target, source, 1, 1, nelems, element_size, \ PE_start, logPE_stride, PE_size, \ pSync); \ } -#define SHMEM_TYPE_ALLTOALLS(name, element_size) \ +#define SHMEM_TYPE_ALLTOALLS(name, element_size) \ void shmem##name(void *target, \ const void *source, \ ptrdiff_t dst, ptrdiff_t sst, \ @@ -59,8 +59,8 @@ static void _shmem_alltoall(void *target, long *pSync) \ { \ RUNTIME_CHECK_INIT(); \ - RUNTIME_CHECK_ADDR(target); \ - RUNTIME_CHECK_ADDR(source); \ + RUNTIME_CHECK_ADDR_SIZE(target, nelems); \ + RUNTIME_CHECK_ADDR_SIZE(source, nelems); \ \ _shmem_alltoall(target, source, dst, sst, nelems, element_size, \ PE_start, logPE_stride, PE_size, \ diff --git a/oshmem/shmem/c/shmem_broadcast.c b/oshmem/shmem/c/shmem_broadcast.c index a618df733ca..676cec02f25 100644 --- a/oshmem/shmem/c/shmem_broadcast.c +++ b/oshmem/shmem/c/shmem_broadcast.c @@ -29,7 +29,7 @@ static void _shmem_broadcast(void *target, int PE_size, long *pSync); -#define SHMEM_TYPE_BROADCAST(name, element_size) \ +#define SHMEM_TYPE_BROADCAST(name, element_size) \ void shmem##name( void *target, \ const void *source, \ size_t nelems, \ @@ -40,10 +40,10 @@ static void _shmem_broadcast(void *target, long *pSync) \ { \ RUNTIME_CHECK_INIT(); \ - RUNTIME_CHECK_ADDR(target); \ - RUNTIME_CHECK_ADDR(source); \ + RUNTIME_CHECK_ADDR_SIZE(target, nelems); \ + RUNTIME_CHECK_ADDR_SIZE(source, nelems); \ \ - _shmem_broadcast( target, source, nelems * element_size, \ + _shmem_broadcast( target, source, nelems * element_size, \ PE_root, PE_start, logPE_stride, PE_size, \ pSync); \ } diff --git a/oshmem/shmem/c/shmem_collect.c b/oshmem/shmem/c/shmem_collect.c index 91502035fcc..423093d6c18 100644 --- a/oshmem/shmem/c/shmem_collect.c +++ b/oshmem/shmem/c/shmem_collect.c @@ -39,10 +39,10 @@ static void _shmem_collect(void *target, long *pSync) \ { \ RUNTIME_CHECK_INIT(); \ - RUNTIME_CHECK_ADDR(target); \ - RUNTIME_CHECK_ADDR(source); \ + RUNTIME_CHECK_ADDR_SIZE(target, nelems); \ + RUNTIME_CHECK_ADDR_SIZE(source, nelems); \ \ - _shmem_collect( target, source, nelems * element_size, \ + _shmem_collect( target, source, nelems * element_size, \ PE_start, logPE_stride, PE_size, \ pSync, \ nelems_type); \ diff --git a/oshmem/shmem/c/shmem_reduce.c b/oshmem/shmem/c/shmem_reduce.c index 11654196abf..02c47023ce7 100644 --- a/oshmem/shmem/c/shmem_reduce.c +++ b/oshmem/shmem/c/shmem_reduce.c @@ -26,8 +26,8 @@ * object of every PE in the active set. The active set of PEs is defined by the triple PE_start, * logPE_stride and PE_size. */ -#define SHMEM_TYPE_REDUCE_OP(name, type_name, type, prefix) \ - void prefix##type_name##_##name##_to_all( type *target, \ +#define SHMEM_TYPE_REDUCE_OP(name, type_name, type, prefix) \ + void prefix##type_name##_##name##_to_all( type *target, \ const type *source, \ int nreduce, \ int PE_start, \ @@ -40,8 +40,8 @@ oshmem_group_t* group = NULL; \ \ RUNTIME_CHECK_INIT(); \ - RUNTIME_CHECK_ADDR(target); \ - RUNTIME_CHECK_ADDR(source); \ + RUNTIME_CHECK_ADDR_SIZE(target, nreduce); \ + RUNTIME_CHECK_ADDR_SIZE(source, nreduce); \ \ { \ group = oshmem_proc_group_create_nofail(PE_start, 1< Date: Mon, 26 Nov 2018 10:41:33 +0200 Subject: [PATCH 195/674] OSHMEM/COLL: optimization on zero-length ops - removed barrier call on zero-length operations Signed-off-by: Sergey Oblomov (cherry picked from commit ff2fd0679eb4b31bfd840395d73746612e2670f4) --- oshmem/mca/scoll/basic/scoll_basic_alltoall.c | 23 ++++++++++-------- .../mca/scoll/basic/scoll_basic_broadcast.c | 7 +++++- oshmem/mca/scoll/basic/scoll_basic_collect.c | 11 ++++++--- oshmem/mca/scoll/basic/scoll_basic_reduce.c | 12 ++++++---- oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 24 ++++++++++++++++--- 5 files changed, 56 insertions(+), 21 deletions(-) diff --git a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c index 82934655eac..6a87e85578f 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_alltoall.c +++ b/oshmem/mca/scoll/basic/scoll_basic_alltoall.c @@ -61,17 +61,20 @@ int mca_scoll_basic_alltoall(struct oshmem_group_t *group, return OSHMEM_ERR_BAD_PARAM; } - if (nelems) { - if ((sst == 1) && (dst == 1)) { - rc = a2a_alg_simple(group, target, source, nelems, element_size); - } else { - rc = a2as_alg_simple(group, target, source, dst, sst, nelems, - element_size); - } + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nelems)) { + return OPAL_SUCCESS; + } - if (rc != OSHMEM_SUCCESS) { - return rc; - } + if ((sst == 1) && (dst == 1)) { + rc = a2a_alg_simple(group, target, source, nelems, element_size); + } else { + rc = a2as_alg_simple(group, target, source, dst, sst, nelems, + element_size); + } + + if (rc != OSHMEM_SUCCESS) { + return rc; } /* quiet is needed because scoll level barrier does not diff --git a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c index 01dd35f73c7..66fc848cdc4 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c +++ b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c @@ -55,6 +55,11 @@ int mca_scoll_basic_broadcast(struct oshmem_group_t *group, if ((rc == OSHMEM_SUCCESS) && oshmem_proc_group_is_member(group)) { int i = 0; + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + if (pSync) { alg = (alg == SCOLL_DEFAULT_ALG ? mca_scoll_basic_param_broadcast_algorithm : alg); @@ -131,7 +136,7 @@ static int _algorithm_central_counter(struct oshmem_group_t *group, group->my_pe, pSync[0], PE_root); /* Check if this PE is the root */ - if ((PE_root == group->my_pe) && nlong) { + if (PE_root == group->my_pe) { int pe_cur = 0; SCOLL_VERBOSE(14, diff --git a/oshmem/mca/scoll/basic/scoll_basic_collect.c b/oshmem/mca/scoll/basic/scoll_basic_collect.c index b6f5df65f7c..e631a315575 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_collect.c +++ b/oshmem/mca/scoll/basic/scoll_basic_collect.c @@ -66,7 +66,12 @@ int mca_scoll_basic_collect(struct oshmem_group_t *group, if ((rc == OSHMEM_SUCCESS) && oshmem_proc_group_is_member(group)) { int i = 0; - if (nlong_type && nlong) { + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OPAL_SUCCESS; + } + + if (nlong_type) { alg = (alg == SCOLL_DEFAULT_ALG ? mca_scoll_basic_param_collect_algorithm : alg); switch (alg) { @@ -156,7 +161,7 @@ static int _algorithm_f_central_counter(struct oshmem_group_t *group, group->my_pe); SCOLL_VERBOSE(15, "[#%d] pSync[0] = %ld", group->my_pe, pSync[0]); - if ((PE_root == group->my_pe) && nlong) { + if (PE_root == group->my_pe) { int pe_cur = 0; memcpy((void*) ((unsigned char*) target + 0 * nlong), @@ -543,7 +548,7 @@ static int _algorithm_central_collector(struct oshmem_group_t *group, /* Set own data size */ pSync[0] = (nlong ? (long)nlong : SHMEM_SYNC_READY); - if ((PE_root == group->my_pe) && nlong) { + if (PE_root == group->my_pe) { long value = 0; int pe_cur = 0; long wait_pe_count = 0; diff --git a/oshmem/mca/scoll/basic/scoll_basic_reduce.c b/oshmem/mca/scoll/basic/scoll_basic_reduce.c index 22c64b47e78..b7f6f123106 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_reduce.c +++ b/oshmem/mca/scoll/basic/scoll_basic_reduce.c @@ -78,10 +78,14 @@ int mca_scoll_basic_reduce(struct oshmem_group_t *group, if ((rc == OSHMEM_SUCCESS) && oshmem_proc_group_is_member(group)) { int i = 0; + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + if (pSync) { - alg = (nlong ? (alg == SCOLL_DEFAULT_ALG ? - mca_scoll_basic_param_reduce_algorithm : alg) : - SCOLL_ALG_REDUCE_CENTRAL_COUNTER ); + alg = (alg == SCOLL_DEFAULT_ALG ? + mca_scoll_basic_param_reduce_algorithm : alg); switch (alg) { case SCOLL_ALG_REDUCE_CENTRAL_COUNTER: { @@ -186,7 +190,7 @@ static int _algorithm_central_counter(struct oshmem_group_t *group, SCOLL_VERBOSE(12, "[#%d] Reduce algorithm: Central Counter", group->my_pe); - if ((PE_root == group->my_pe) && nlong) { + if (PE_root == group->my_pe) { int pe_cur = 0; void *target_cur = NULL; diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index df4392acc26..a52a8325880 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -54,6 +54,12 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, } dtype = &ompi_mpi_char.dt; root = oshmem_proc_group_find_id(group, PE_root); + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + /* Open SHMEM specification has the following constrains (page 85): * "If using C/C++, nelems must be of type integer. If you are using Fortran, it must be a * default integer value". And also fortran signature says "INTEGER". @@ -61,7 +67,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, * and considering this contradiction, we cast size_t to int here * in case if the value is less than INT_MAX and fallback to previous module otherwise. */ #ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS - if ((INT_MAX < nlong) || !nlong) { + if (INT_MAX < nlong) { MPI_COLL_VERBOSE(20,"RUNNING FALLBACK BCAST"); PREVIOUS_SCOLL_FN(mpi_module, broadcast, group, PE_root, @@ -104,7 +110,13 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, void *sbuf, *rbuf; MPI_COLL_VERBOSE(20,"RUNNING MPI ALLGATHER"); mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_collect_module; - if ((nlong_type == true) && nlong) { + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + + if (nlong_type == true) { sbuf = (void *) source; rbuf = target; stype = &ompi_mpi_char.dt; @@ -177,6 +189,12 @@ int mca_scoll_mpi_reduce(struct oshmem_group_t *group, dtype = shmem_dtype_to_ompi_dtype(op); h_op = shmem_op_to_ompi_op(op->op); count = nlong/op->dt_size; + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + /* Open SHMEM specification has the following constrains (page 85): * "If using C/C++, nelems must be of type integer. If you are using Fortran, it must be a * default integer value". And also fortran signature says "INTEGER". @@ -184,7 +202,7 @@ int mca_scoll_mpi_reduce(struct oshmem_group_t *group, * and considering this contradiction, we cast size_t to int here * in case if the value is less than INT_MAX and fallback to previous module otherwise. */ #ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS - if ((INT_MAX < count) || !nlong) { + if (INT_MAX < count) { MPI_COLL_VERBOSE(20,"RUNNING FALLBACK REDUCE"); PREVIOUS_SCOLL_FN(mpi_module, reduce, group, op, From 5838760a3a799a82d9ca75fa418046326d5ebdc3 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 26 Nov 2018 16:53:48 +0200 Subject: [PATCH 196/674] OSHMEM/COLL/BCAST: removed unnecessary bcast call - removed unnecessary bcast call on zero-length request Signed-off-by: Sergey Oblomov (cherry picked from commit c93927e27a8e4241236d82c0d34ea445aa619aff) --- oshmem/mca/scoll/basic/scoll_basic_broadcast.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c index 66fc848cdc4..80059d462d1 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c +++ b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c @@ -197,16 +197,6 @@ static int _algorithm_binomial_tree(struct oshmem_group_t *group, "[#%d] pSync[0] = %ld root = #%d", group->my_pe, pSync[0], PE_root); - if (OPAL_UNLIKELY(!nlong)) { - SCOLL_VERBOSE(14, "[#%d] Wait for operation completion", group->my_pe); - /* wait until root finishes sending data */ - rc = BARRIER_FUNC(group, - (pSync + 1), - SCOLL_DEFAULT_ALG); - return rc; - } - - vrank = (my_id + group->proc_count - root_id) % group->proc_count; hibit = opal_hibit(vrank, dim); From 6651672711ebbfe7aad122c02ce68f332de09aff Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 27 Nov 2018 14:20:28 +0200 Subject: [PATCH 197/674] OSC/UCX: set max level value to 60 Signed-off-by: Sergey Oblomov (cherry picked from commit 2d230b3aacce0185f0d46e69f608071b670eeb3c) --- ompi/mca/osc/ucx/osc_ucx_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 1326e7be1be..8014ac6f23a 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -111,7 +111,7 @@ static int component_register(void) { ucp_get_version(&major, &minor, &release_number); - mca_osc_ucx_component.priority = UCX_VERSION(major, minor, release_number) >= UCX_VERSION(1, 5, 0) ? 200 : 0; + mca_osc_ucx_component.priority = UCX_VERSION(major, minor, release_number) >= UCX_VERSION(1, 5, 0) ? 60 : 0; asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", mca_osc_ucx_component.priority); From e56c179d58db5ffa8a50c3e797f787ef62837934 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 28 Nov 2018 14:01:09 -0800 Subject: [PATCH 198/674] README: Fix a typo Signed-off-by: Jeff Squyres (cherry picked from commit e6241eaf6ba6bffeb6b85def68e420a7ab66dce8) --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index b12f361a25a..d5321a10ca5 100644 --- a/README +++ b/README @@ -527,7 +527,7 @@ MPI Functionality and Features All that being said, if you are unable to immediately update your application to stop using these legacy MPI-1 symbols, you can re-enable them in mpi.h by configuring Open MPI with the - --enable-mpi-compatibility flag. + --enable-mpi1-compatibility flag. - Rank reordering support is available using the TreeMatch library. It is activated for the graph and dist_graph topologies. From c5346751e623cfbe02abe0c28179b9f92abbc577 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Wed, 14 Nov 2018 14:31:54 -0500 Subject: [PATCH 199/674] Plug two memory leaks in rdma osc Signed-off-by: Joseph Schuchart (cherry picked from commit 91885f5876129aa4fb43ed4b3404c9d1ca7e08b8) --- ompi/mca/osc/rdma/osc_rdma_component.c | 19 ++++++++++--------- ompi/mca/osc/rdma/osc_rdma_module.c | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index ef0fad453c7..ee57b94c659 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -41,6 +41,7 @@ #include "opal/threads/mutex.h" #include "opal/util/arch.h" #include "opal/util/argv.h" +#include "opal/util/printf.h" #include "opal/align.h" #if OPAL_CUDA_SUPPORT #include "opal/datatype/opal_datatype_cuda.h" @@ -584,16 +585,16 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s } } - /* allocate the shared memory segment */ - ret = asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d", - mca_osc_rdma_component.backing_directory, ompi_process_info.nodename, - OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm)); - if (0 > ret) { - ret = OMPI_ERR_OUT_OF_RESOURCE; - break; - } - if (0 == local_rank) { + /* allocate the shared memory segment */ + ret = opal_asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d", + mca_osc_rdma_component.backing_directory, ompi_process_info.nodename, + OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm)); + if (0 > ret) { + ret = OMPI_ERR_OUT_OF_RESOURCE; + break; + } + /* allocate enough space for the state + data for all local ranks */ ret = opal_shmem_segment_create (&module->seg_ds, data_file, total_size); free (data_file); diff --git a/ompi/mca/osc/rdma/osc_rdma_module.c b/ompi/mca/osc/rdma/osc_rdma_module.c index e7d04fb96fe..40765cb2d23 100644 --- a/ompi/mca/osc/rdma/osc_rdma_module.c +++ b/ompi/mca/osc/rdma/osc_rdma_module.c @@ -111,7 +111,7 @@ int ompi_osc_rdma_free(ompi_win_t *win) OBJ_DESTRUCT(&module->peer_hash); } else if (NULL != module->comm) { - for (int i = 0 ; i < ompi_comm_rank (module->comm) ; ++i) { + for (int i = 0 ; i < ompi_comm_size (module->comm) ; ++i) { if (NULL != module->peer_array[i]) { OBJ_RELEASE(module->peer_array[i]); } From 98c8492057e6222af6404b352430d0dd7553d253 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 29 Nov 2018 07:30:10 -0800 Subject: [PATCH 200/674] Fix typo for rmaps_base_oversubscribe Causes the MCA param to be ignored, while the cmd line option still works. Thanks to @iassiour for the report! Signed-off-by: Ralph Castain --- orte/mca/rmaps/base/rmaps_base_map_job.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_map_job.c b/orte/mca/rmaps/base/rmaps_base_map_job.c index a06c3187fb8..3300783a707 100644 --- a/orte/mca/rmaps/base/rmaps_base_map_job.c +++ b/orte/mca/rmaps/base/rmaps_base_map_job.c @@ -210,13 +210,11 @@ void orte_rmaps_base_map_job(int fd, short args, void *cbdata) if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(jdata->map->mapping))) { if (!(ORTE_MAPPING_SUBSCRIBE_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping))) { ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE); + } else if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) { + ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE); } else { - /* pass along the directive */ - if (ORTE_MAPPING_NO_OVERSUBSCRIBE & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) { - ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE); - } else { - ORTE_UNSET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE); - } + ORTE_UNSET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_NO_OVERSUBSCRIBE); + ORTE_SET_MAPPING_DIRECTIVE(jdata->map->mapping, ORTE_MAPPING_SUBSCRIBE_GIVEN); } } From 0c3e76ec908444c51c2ef774da4cd89ecce49f99 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 6 Dec 2018 11:22:10 +0900 Subject: [PATCH 201/674] roll to v4.0.1a1 fixes previous commit open-mpi/ompi@116a140be8cce39a5c07ce6db19a6426ae48f276 that incorrectly rolled to v4.1.0a1 Signed-off-by: Gilles Gouaillardet --- VERSION | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 53f92372838..bf34f81c217 100644 --- a/VERSION +++ b/VERSION @@ -3,9 +3,11 @@ # Copyright (c) 2011 NVIDIA Corporation. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2018 IBM Corporation. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. +# Copyright (c) 2018 IBM Corporation. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # This is the VERSION file for Open MPI, describing the precise # version of Open MPI in this distribution. The various components of @@ -16,8 +18,8 @@ # ... major=4 -minor=1 -release=0 +minor=0 +release=1 # greek is generally used for alpha or beta release tags. If it is # non-empty, it will be appended to the version number. It does not From 057118dbe645d57c76558ed0601236a7461d57b6 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 26 Oct 2018 15:24:37 +0900 Subject: [PATCH 202/674] btl/uct: fix AC_CHECK_DECLS usage AC_CHECK_DECLS take a comma separated list of macros/symbols, so replace the whitespace separator with a comma. Signed-off-by: Gilles Gouaillardet (cherry picked from commit b715dd26572ab18fdba92f06143456c0f9d6380a) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/configure.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index eae8c6abfc8..cdee689f8ea 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -14,6 +14,8 @@ # Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011-2018 Los Alamos National Security, LLC. # All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -39,7 +41,7 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $btl_uct_CPPFLAGS" - AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE UCT_CB_FLAG_SYNC], [], [], [[#include ]]) + AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE, UCT_CB_FLAG_SYNC], [], [], [[#include ]]) CPPFLAGS="$CPPFLAGS_save" OPAL_VAR_SCOPE_POP From 095786168915ac927d190fcf851a20e971c19c11 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 5 Dec 2018 16:30:54 -0700 Subject: [PATCH 203/674] btl/uct: fix some issues when using UCX over ugni Though not a recommended configuration it is possible to use Open MPI over UCX over uGNI. This configuration had some issues related to the connection management and tl selection. This commit fixes those issues. Signed-off-by: Nathan Hjelm (cherry picked from commit e07a64c52d92adf51732ea78e17b679f6deffa12) Signed-off-by: Nathan Hjelm --- opal/mca/btl/uct/btl_uct_component.c | 5 +++- opal/mca/btl/uct/btl_uct_endpoint.c | 35 ++++++++++++++++++++++++---- opal/mca/btl/uct/btl_uct_tl.c | 4 +++- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index 74f85480c33..c8bc9e93775 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -14,6 +14,9 @@ * reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -50,7 +53,7 @@ static int mca_btl_uct_component_register(void) MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_LOCAL, &mca_btl_uct_component.memory_domains); - mca_btl_uct_component.allowed_transports = "dc_mlx5,rc_mlx5,ud,any"; + mca_btl_uct_component.allowed_transports = "dc_mlx5,rc_mlx5,ud,ugni_rdma,ugni_smsg,any"; (void) mca_base_component_var_register(&mca_btl_uct_component.super.btl_version, "transports", "Comma-delimited list of transports to use sorted by increasing " "priority. The list of transports available can be queried using ucx_info. Special" diff --git a/opal/mca/btl/uct/btl_uct_endpoint.c b/opal/mca/btl/uct/btl_uct_endpoint.c index 804820bbba7..40349673e27 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.c +++ b/opal/mca/btl/uct/btl_uct_endpoint.c @@ -2,6 +2,8 @@ /* * Copyright (c) 2018 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -137,11 +139,26 @@ static void mca_btl_uct_connection_ep_destruct (mca_btl_uct_connection_ep_t *ep) OBJ_CLASS_INSTANCE(mca_btl_uct_connection_ep_t, opal_object_t, mca_btl_uct_connection_ep_construct, mca_btl_uct_connection_ep_destruct); +struct mca_btl_uct_conn_completion_t { + uct_completion_t super; + volatile bool complete; +}; +typedef struct mca_btl_uct_conn_completion_t mca_btl_uct_conn_completion_t; + +static void mca_btl_uct_endpoint_flush_complete (uct_completion_t *self, ucs_status_t status) +{ + mca_btl_uct_conn_completion_t *completion = (mca_btl_uct_conn_completion_t *) self; + BTL_VERBOSE(("connection flush complete")); + completion->complete = true; +} + static int mca_btl_uct_endpoint_send_conn_req (mca_btl_uct_module_t *uct_btl, mca_btl_base_endpoint_t *endpoint, mca_btl_uct_device_context_t *conn_tl_context, mca_btl_uct_conn_req_t *request, size_t request_length) { mca_btl_uct_connection_ep_t *conn_ep = endpoint->conn_ep; + mca_btl_uct_conn_completion_t completion = {.super = {.count = 1, .func = mca_btl_uct_endpoint_flush_complete}, + .complete = false}; ucs_status_t ucs_status; BTL_VERBOSE(("sending connection request to peer. context id: %d, type: %d, length: %" PRIsize_t, @@ -170,10 +187,18 @@ static int mca_btl_uct_endpoint_send_conn_req (mca_btl_uct_module_t *uct_btl, mc } while (1); /* for now we just wait for the connection request to complete before continuing */ - do { - ucs_status = uct_ep_flush (conn_ep->uct_ep, 0, NULL); - mca_btl_uct_context_progress (conn_tl_context); - } while (UCS_INPROGRESS == ucs_status); + ucs_status = uct_ep_flush (conn_ep->uct_ep, 0, &completion.super); + if (UCS_OK != ucs_status && UCS_INPROGRESS != ucs_status) { + /* NTH: I don't know if this path is needed. For some networks we must use a completion. */ + do { + ucs_status = uct_ep_flush (conn_ep->uct_ep, 0, NULL); + mca_btl_uct_context_progress (conn_tl_context); + } while (UCS_INPROGRESS == ucs_status); + } else { + do { + mca_btl_uct_context_progress (conn_tl_context); + } while (!completion.complete); + } opal_mutex_lock (&endpoint->ep_lock); @@ -284,8 +309,8 @@ int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t *uct_btl, mca_btl_uct_end void *ep_addr, int tl_index) { mca_btl_uct_tl_endpoint_t *tl_endpoint = endpoint->uct_eps[context_id] + tl_index; - mca_btl_uct_device_context_t *tl_context = mca_btl_uct_module_get_rdma_context_specific (uct_btl, context_id); mca_btl_uct_tl_t *tl = (tl_index == uct_btl->rdma_tl->tl_index) ? uct_btl->rdma_tl : uct_btl->am_tl; + mca_btl_uct_device_context_t *tl_context = mca_btl_uct_module_get_tl_context_specific (uct_btl, tl, context_id); uint8_t *rdma_tl_data = NULL, *conn_tl_data = NULL, *am_tl_data = NULL, *tl_data; mca_btl_uct_connection_ep_t *conn_ep = NULL; mca_btl_uct_modex_t *modex; diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index 0c8f27d9234..9c70124d668 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -4,6 +4,8 @@ * reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,7 +28,7 @@ * @brief Convert UCT capabilities to BTL flags */ static uint64_t mca_btl_uct_cap_to_btl_flag[][2] = { - {UCT_IFACE_FLAG_AM_ZCOPY, MCA_BTL_FLAGS_SEND}, + {UCT_IFACE_FLAG_AM_SHORT, MCA_BTL_FLAGS_SEND}, {UCT_IFACE_FLAG_PUT_ZCOPY, MCA_BTL_FLAGS_PUT}, {UCT_IFACE_FLAG_GET_ZCOPY, MCA_BTL_FLAGS_GET}, {0,0}, From 195a07d03d2ac51d1317d938ca4880e561231b11 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 7 Dec 2018 16:07:07 +0900 Subject: [PATCH 204/674] pmix/pmix3x: fix macros usage in embedded pmix3x Use PMIX_* macros instead of OPAL_* macros master does things differently, so this is a one-off commit Signed-off-by: Gilles Gouaillardet --- opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h index 1bd1110dce8..b1f1a1c832a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h @@ -60,7 +60,7 @@ static inline void pmix_atomic_mb(void) static inline void pmix_atomic_rmb(void) { -#if OPAL_ASSEMBLY_ARCH == OPAL_X86_64 +#if PMIX_ASSEMBLY_ARCH == PMIX_X86_64 /* work around a bug in older gcc versions where ACQUIRE seems to get * treated as a no-op instead of being equivalent to * __asm__ __volatile__("": : :"memory") */ From ffbe85c65f060b4c5d2a42a97d1e6917001c9733 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 26 Oct 2018 15:24:37 +0900 Subject: [PATCH 205/674] btl/uct: fix AC_CHECK_DECLS usage AC_CHECK_DECLS take a comma separated list of macros/symbols, so replace the whitespace separator with a comma. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b715dd26572ab18fdba92f06143456c0f9d6380a) --- opal/mca/btl/uct/configure.m4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index eae8c6abfc8..cdee689f8ea 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -14,6 +14,8 @@ # Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011-2018 Los Alamos National Security, LLC. # All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -39,7 +41,7 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ CPPFLAGS_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $btl_uct_CPPFLAGS" - AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE UCT_CB_FLAG_SYNC], [], [], [[#include ]]) + AC_CHECK_DECLS([UCT_PROGRESS_THREAD_SAFE, UCT_CB_FLAG_SYNC], [], [], [[#include ]]) CPPFLAGS="$CPPFLAGS_save" OPAL_VAR_SCOPE_POP From dd2b1ce49b5e14d04b4575d8751ae2e4be30c489 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 7 Dec 2018 16:16:35 +0900 Subject: [PATCH 206/674] btl/uct: fix a warning Use the PRIsize_t macro to correctly print a size_t Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@78aa6fdd1df3d2cdc0fbe293b52a9f0fed222f6b) --- opal/mca/btl/uct/btl_uct_tl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index 0c8f27d9234..1c1932e911e 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -221,7 +221,7 @@ int mca_btl_uct_process_connection_request (mca_btl_uct_module_t *module, mca_bt /* to avoid a race with send adding pending frags grab the lock here */ OPAL_THREAD_SCOPED_LOCK(&endpoint->ep_lock,{ - BTL_VERBOSE(("connection ready. sending %d frags", opal_list_get_size (&module->pending_frags))); + BTL_VERBOSE(("connection ready. sending %" PRIsize_t " frags", opal_list_get_size (&module->pending_frags))); (void) opal_atomic_or_fetch_32 (&tl_endpoint->flags, MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY); opal_atomic_wmb (); From 80113a368fed82b6c1e9c604d0fadf2aaab8114b Mon Sep 17 00:00:00 2001 From: Matias A Cabral Date: Tue, 4 Dec 2018 15:31:09 -0800 Subject: [PATCH 207/674] MTL/PSM2: Do not lower the priority when all processes are local. The intention of lowering the priority when all processes are local was to favor Vader BTL. However, in builds including the OFI MTL it gets selected instead. Reviewed-by: Spruit, Neil R Reviewed-by: Gopalakrishnan, Aravind Signed-off-by: Matias Cabral (cherry picked from commit fc8582c5606b7a3d1b711f8f7b6144808290a48f) --- ompi/mca/mtl/psm2/mtl_psm2_component.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index 21922cadf84..add970e5684 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -124,10 +124,6 @@ ompi_mtl_psm2_component_register(void) * process assume it is ompi_info or this is most likely going to spawn, for * which all PSM2 devices are needed */ setenv("PSM2_DEVICES", "self,shm", 0); - /* ob1 is much faster than psm2 with shared memory */ - param_priority = 10; - } else { - param_priority = 40; } (void) mca_base_component_var_register (&mca_mtl_psm2_component.super.mtl_version, From b2327049c1cdadb1f2a2cbd90cf046043425ac53 Mon Sep 17 00:00:00 2001 From: Matias A Cabral Date: Fri, 7 Dec 2018 14:46:34 -0800 Subject: [PATCH 208/674] MTL/PSM2: add missing default priority Missing default priority after PR #6153 Signed-off-by: Matias Cabral (cherry picked from commit c76c6d8b2801ca43ba33168a0b92522786c7c5bb) --- ompi/mca/mtl/psm2/mtl_psm2_component.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index add970e5684..30cb0ed5e77 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -126,6 +126,7 @@ ompi_mtl_psm2_component_register(void) setenv("PSM2_DEVICES", "self,shm", 0); } + param_priority = 40; (void) mca_base_component_var_register (&mca_mtl_psm2_component.super.mtl_version, "priority", "Priority of the PSM2 MTL component", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, From f446472f0606a1d20858f2bb87f4e7321e697c9c Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 11 Dec 2018 14:21:59 +0900 Subject: [PATCH 209/674] btl/uct: fix a typo in configure.m4 remove whitespace around '=' when setting btl_uct_LIBS Thanks Ake Sandgren for reporting this Refs. open-mpi/ompi#6173 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b89deeb1bbd21eda73414b3f51f1d2ab3529dc42) --- opal/mca/btl/uct/configure.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index eae8c6abfc8..01c46b33dcf 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -47,7 +47,7 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ AS_IF([test "$btl_uct_happy" = "yes"], [$1 - btl_uct_LIBS = "$btl_uct_LIBS -luct" + btl_uct_LIBS="$btl_uct_LIBS -luct" ], [$2]) From 5e4a6db23bdfcd01b3275ea351444fdc977e2797 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Mon, 26 Nov 2018 13:58:06 +0100 Subject: [PATCH 210/674] Re-add removed deprecate-only MPI-2.0 symbols See #6114 Signed-off-by: Bert Wesarg (cherry picked from commit b3f3281290c322455cdb87fb5a8e746e67c89fbc) --- ompi/mpi/c/Makefile.am | 11 ++++++----- ompi/mpi/c/profile/Makefile.am | 10 +++++----- ompi/mpi/fortran/mpif-h/Makefile.am | 10 +++++----- ompi/mpi/fortran/mpif-h/profile/Makefile.am | 10 +++++----- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index e12a5483889..d4c822beba2 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -78,6 +78,9 @@ libmpi_c_mpi_la_SOURCES = \ ialltoallv.c \ alltoallw.c \ ialltoallw.c \ + attr_delete.c \ + attr_get.c \ + attr_put.c \ barrier.c \ ibarrier.c \ bcast.c \ @@ -285,6 +288,8 @@ libmpi_c_mpi_la_SOURCES = \ ineighbor_alltoallv.c \ neighbor_alltoallw.c \ ineighbor_alltoallw.c \ + keyval_create.c \ + keyval_free.c \ op_c2f.c \ op_commutative.c \ op_create.c \ @@ -431,17 +436,13 @@ libmpi_c_mpi_la_SOURCES = \ win_unlock_all.c \ win_wait.c + if OMPI_ENABLE_MPI1_COMPAT libmpi_c_mpi_la_SOURCES += \ address.c \ - attr_delete.c \ - attr_get.c \ - attr_put.c \ errhandler_create.c \ errhandler_get.c \ errhandler_set.c \ - keyval_create.c \ - keyval_free.c \ type_extent.c \ type_hindexed.c \ type_hvector.c \ diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index 698c5c61abd..5330752db5c 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -58,6 +58,9 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pialltoallv.c \ palltoallw.c \ pialltoallw.c \ + pattr_delete.c \ + pattr_get.c \ + pattr_put.c \ pbarrier.c \ pibarrier.c \ pbcast.c \ @@ -265,6 +268,8 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pineighbor_alltoallv.c \ pneighbor_alltoallw.c \ pineighbor_alltoallw.c \ + pkeyval_create.c \ + pkeyval_free.c \ pop_c2f.c \ pop_create.c \ pop_commutative.c \ @@ -414,14 +419,9 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ if OMPI_ENABLE_MPI1_COMPAT nodist_libmpi_c_pmpi_la_SOURCES += \ paddress.c \ - pattr_delete.c \ - pattr_get.c \ - pattr_put.c \ perrhandler_create.c \ perrhandler_get.c \ perrhandler_set.c \ - pkeyval_create.c \ - pkeyval_free.c \ ptype_extent.c \ ptype_hindexed.c \ ptype_hvector.c \ diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index db54c677143..e44b770977b 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -138,6 +138,9 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ alltoall_f.c \ alltoallv_f.c \ alltoallw_f.c \ + attr_delete_f.c \ + attr_get_f.c \ + attr_put_f.c \ barrier_f.c \ bcast_f.c \ bsend_f.c \ @@ -335,6 +338,8 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ iscatterv_f.c \ issend_f.c \ is_thread_main_f.c \ + keyval_create_f.c \ + keyval_free_f.c \ lookup_name_f.c \ mprobe_f.c \ mrecv_f.c \ @@ -480,14 +485,9 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ if OMPI_ENABLE_MPI1_COMPAT lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ address_f.c \ - attr_delete_f.c \ - attr_get_f.c \ - attr_put_f.c \ errhandler_create_f.c \ errhandler_get_f.c \ errhandler_set_f.c \ - keyval_create_f.c \ - keyval_free_f.c \ type_extent_f.c \ type_hindexed_f.c \ type_hvector_f.c \ diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index fbd0bbc7b78..5566b85b28a 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -54,6 +54,9 @@ linked_files = \ palltoall_f.c \ palltoallv_f.c \ palltoallw_f.c \ + pattr_delete_f.c \ + pattr_get_f.c \ + pattr_put_f.c \ pbarrier_f.c \ pbcast_f.c \ pbsend_f.c \ @@ -251,6 +254,8 @@ linked_files = \ pisend_f.c \ pissend_f.c \ pis_thread_main_f.c \ + pkeyval_create_f.c \ + pkeyval_free_f.c \ plookup_name_f.c \ pmprobe_f.c \ pmrecv_f.c \ @@ -395,14 +400,9 @@ linked_files = \ if OMPI_ENABLE_MPI1_COMPAT linked_files += \ paddress_f.c \ - pattr_delete_f.c \ - pattr_get_f.c \ - pattr_put_f.c \ perrhandler_create_f.c \ perrhandler_get_f.c \ perrhandler_set_f.c \ - pkeyval_create_f.c \ - pkeyval_free_f.c \ ptype_extent_f.c \ ptype_hindexed_f.c \ ptype_hvector_f.c \ From 0ade49c286bcc28985ffdf3ac47ae3dd52bcaeb8 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 27 Nov 2018 13:40:32 +0900 Subject: [PATCH 211/674] mpi/c: add back (some more) deprecated subroutines - MPI_NULL_DELETE_FN - MPI_NULL_COPY_FN - MPI_DUP_FN Signed-off-by: Gilles Gouaillardet (cherry picked from commit 5a968306d6ae8c051dd50219cdae767e85e8db7c) --- ompi/mpi/c/attr_fn.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ompi/mpi/c/attr_fn.c b/ompi/mpi/c/attr_fn.c index d6ab52bc704..5667f242420 100644 --- a/ompi/mpi/c/attr_fn.c +++ b/ompi/mpi/c/attr_fn.c @@ -9,6 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -131,11 +133,6 @@ int OMPI_C_MPI_COMM_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, return MPI_SUCCESS; } -#if !defined(OMPI_ENABLE_MPI1_COMPAT) - -#error "Need to delete the code below now that the removed functions are no longer shipping" - -#elif OMPI_ENABLE_MPI1_COMPAT int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, void* attribute_val_out, void* extra_state ) @@ -159,4 +156,3 @@ int OMPI_C_MPI_DUP_FN( MPI_Comm comm, int comm_keyval, void* extra_state, *(void**)attribute_val_out = attribute_val_in; return MPI_SUCCESS; } -#endif From a79ce7d17f4a3b92e18748c5d738d9eb56d7603e Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 6 Dec 2018 15:05:10 +0900 Subject: [PATCH 212/674] mpiext: updates for header file locations Per discussion on https://github.com/open-mpi/ompi/pull/6030 and https://github.com/open-mpi/ompi/pull/6145, move around where MPI extension header files are installed (specifically: the installation tree path does not need to match the source tree path). For reference, header files were installed like this : - /include/openmpi/ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_mpifh.h - /include/openmpi/ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h and they are now installed like this : - /include/openmpi/mpiext/mpiext_pcollreq_mpifh.h - /include/openmpi/mpiext/mpiext_pcollreq_c.h Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@975e3cd0c9e7f23261971568dbb01234043ea1ab) --- config/ompi_ext.m4 | 21 +++++++++++---------- ompi/mpiext/affinity/c/Makefile.am | 4 +++- ompi/mpiext/cr/c/Makefile.am | 4 +++- ompi/mpiext/cuda/c/Makefile.am | 2 +- ompi/mpiext/example/c/Makefile.am | 4 +++- ompi/mpiext/example/mpif-h/Makefile.am | 4 +++- ompi/mpiext/pcollreq/c/Makefile.am | 2 +- ompi/mpiext/pcollreq/c/profile/Makefile.am | 2 +- ompi/mpiext/pcollreq/mpif-h/Makefile.am | 2 +- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index 72f47d390d3..1ba7ac1679f 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -405,11 +405,15 @@ AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[ #-------------------- # # C: -# - c/mpiext__c.h: is included in mpi_ext.h +# - c/mpiext__c.h: is installed to +# /openmpi/mpiext/mpiext__c.h and is included in +# mpi_ext.h # - c/libmpiext_.la: convneience library slurped into libmpi.la # # mpi.f.h: -# - mpif-h/mpiext__mpifh.h: is included mpi mpif_ext.h +# - mpif-h/mpiext__mpifh.h: is installed to +# openmpi/mpiext/mpiext__mpifh.h and is included mpi +# mpif_ext.h # - mpif-h/libmpiext__mpifh.la: convenience library slurped # into libmpi_mpifh.la # @@ -461,7 +465,7 @@ AC_DEFUN([EXT_PROCESS_COMPONENT],[ ############### # C Bindings ############### - test_header="${srcdir}/ompi/mpiext/$component/c/mpiext_${component}_c.h" + test_header="${srcdir}/ompi/mpiext/${component}/c/mpiext_${component}_c.h" AC_MSG_CHECKING([if MPI Extension $component has C bindings]) @@ -479,14 +483,14 @@ AC_DEFUN([EXT_PROCESS_COMPONENT],[ $3="$$3 $component" # JMS Where is this needed? - EXT_C_HEADERS="$EXT_C_HEADERS mpiext/$component/c/mpiext_${component}_c.h" + EXT_C_HEADERS="$EXT_C_HEADERS mpiext/c/mpiext_${component}_c.h" component_header="mpiext_${component}_c.h" cat >> $mpi_ext_h <) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/affinity/c +ompidir = $(ompiincludedir)/mpiext/ # This is the header file that is installed. ompi_HEADERS = mpiext_affinity_c.h diff --git a/ompi/mpiext/cr/c/Makefile.am b/ompi/mpiext/cr/c/Makefile.am index fe54fe557b1..9a35c553814 100644 --- a/ompi/mpiext/cr/c/Makefile.am +++ b/ompi/mpiext/cr/c/Makefile.am @@ -3,6 +3,8 @@ # University Research and Technology # Corporation. All rights reserved. # Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -22,7 +24,7 @@ noinst_LTLIBRARIES = libmpiext_cr_c.la # This is where the top-level header file (that is included in # ) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/cr/c +ompidir = $(ompiincludedir)/mpiext # This is the header file that is installed. ompi_HEADERS = mpiext_cr_c.h diff --git a/ompi/mpiext/cuda/c/Makefile.am b/ompi/mpiext/cuda/c/Makefile.am index 719fa109895..f303cc70824 100644 --- a/ompi/mpiext/cuda/c/Makefile.am +++ b/ompi/mpiext/cuda/c/Makefile.am @@ -27,7 +27,7 @@ noinst_LTLIBRARIES = libmpiext_cuda_c.la # This is where the top-level header file (that is included in # ) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/cuda/c +ompidir = $(ompiincludedir)/mpiext # This is the header file that is installed. nodist_ompi_HEADERS = mpiext_cuda_c.h diff --git a/ompi/mpiext/example/c/Makefile.am b/ompi/mpiext/example/c/Makefile.am index 7f9e74df6c8..ac8996b9862 100644 --- a/ompi/mpiext/example/c/Makefile.am +++ b/ompi/mpiext/example/c/Makefile.am @@ -4,6 +4,8 @@ # Corporation. All rights reserved. # Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -23,7 +25,7 @@ noinst_LTLIBRARIES = libmpiext_example_c.la # This is where the top-level header file (that is included in # ) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/example/c +ompidir = $(ompiincludedir)/mpiext # This is the header file that is installed. ompi_HEADERS = mpiext_example_c.h diff --git a/ompi/mpiext/example/mpif-h/Makefile.am b/ompi/mpiext/example/mpif-h/Makefile.am index fdd1c2a257a..e73e4d7710f 100644 --- a/ompi/mpiext/example/mpif-h/Makefile.am +++ b/ompi/mpiext/example/mpif-h/Makefile.am @@ -4,6 +4,8 @@ # Corporation. All rights reserved. # Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2018 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -26,7 +28,7 @@ noinst_LTLIBRARIES = # Directory where the header file to be included in mpif-ext.h must be # installed. -ompidir = $(ompiincludedir)/ompi/mpiext/example/mpif-h +ompidir = $(ompiincludedir)/mpiext # Just like noinst_LTLIBRARIES, set this macro to empty and # conditionally add to it later. diff --git a/ompi/mpiext/pcollreq/c/Makefile.am b/ompi/mpiext/pcollreq/c/Makefile.am index 7b5f2eba83b..d4aeb8ef362 100644 --- a/ompi/mpiext/pcollreq/c/Makefile.am +++ b/ompi/mpiext/pcollreq/c/Makefile.am @@ -23,7 +23,7 @@ noinst_LTLIBRARIES = libmpiext_pcollreq_c.la # This is where the top-level header file (that is included in # ) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/pcollreq/c +ompidir = $(ompiincludedir)/mpiext # This is the header file that is installed. ompi_HEADERS = mpiext_pcollreq_c.h diff --git a/ompi/mpiext/pcollreq/c/profile/Makefile.am b/ompi/mpiext/pcollreq/c/profile/Makefile.am index 9fee858081c..95595743229 100644 --- a/ompi/mpiext/pcollreq/c/profile/Makefile.am +++ b/ompi/mpiext/pcollreq/c/profile/Makefile.am @@ -22,7 +22,7 @@ noinst_LTLIBRARIES = libpmpiext_pcollreq_c.la # This is where the top-level header file (that is included in # ) must be installed. -ompidir = $(ompiincludedir)/ompi/mpiext/pcollreq/c +ompidir = $(ompiincludedir)/mpiext # This is the header file that is installed. ompi_HEADERS = pmpiext_pcollreq_c.h diff --git a/ompi/mpiext/pcollreq/mpif-h/Makefile.am b/ompi/mpiext/pcollreq/mpif-h/Makefile.am index e08b846df1f..7282ac086d7 100644 --- a/ompi/mpiext/pcollreq/mpif-h/Makefile.am +++ b/ompi/mpiext/pcollreq/mpif-h/Makefile.am @@ -31,7 +31,7 @@ noinst_LTLIBRARIES = # Directory where the header file to be included in mpif-ext.h must be # installed. -ompidir = $(ompiincludedir)/ompi/mpiext/pcollreq/mpif-h +ompidir = $(ompiincludedir)/mpiext # Just like noinst_LTLIBRARIES, set this macro to empty and # conditionally add to it later. From ec8b2c47a9927ec64240948bdb1ee33d19d8b2ee Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 1 Dec 2018 11:58:35 -0800 Subject: [PATCH 213/674] ompi_ext.m4: ensure ext name <= 26 characters Ensure that MPI extensions with mpif.h bindings have names that are <=26 characters long. 26 is the magic number that still allows us to have an "include ..." line in the user-facing mpif-ext.h header file that includes this extension's header file without going over 72 characters. Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@c0faf34855d0e8c7a263872a115d8ec64e9147e8) --- config/ompi_ext.m4 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index 1ba7ac1679f..827658e6db3 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -513,6 +513,33 @@ EOF EXT_MPIFH_HEADERS="$EXT_MPIFH_HEADERS mpiext/mpiext_${component}_mpifh.h" $4="$$4 $component" + # Per https://github.com/open-mpi/ompi/pull/6030, we will end + # up putting a user-visible Fortran "include" statement in the + # installed mpif-ext.h file, and we therefore have to ensure + # that the total length of the line is <=72 characters. Doing + # a little math here: + # + # leading indent spaces: 6 chars + # "include '": 9 chars + # "openmpi/mpiext/mpiext_NAME_mpifh.h": without NAME, 30 chars + # trailing "'": 1 char + # + # 6+9+30+1 = 46 chars overhead. + # 72-46 = 26 characters left for NAME. + # + # It would be exceedingly unusual to have an MPI extension + # name > 26 characters. But just in case, put a check here + # to make sure: error out if the MPI extension name is > 26 + # characters (because otherwise it'll just be a really weird / + # hard to diagnose compile error when a user tries to compile + # a Fortran MPI application that includes `mpif-ext.h`). + len=`echo $component | wc -c` + result=`expr $len \> 26` + AS_IF([test $result -eq 1], + [AC_MSG_WARN([MPI extension name too long: $component]) + AC_MSG_WARN([For esoteric reasons, MPI Extensions with mpif.h bindings must have a name that is <= 26 characters]) + AC_MSG_ERROR([Cannot continue])]) + component_header="mpiext_${component}_mpifh.h" cat >> $mpif_ext_h < Date: Thu, 6 Dec 2018 15:22:29 +0900 Subject: [PATCH 214/674] mpi/c: Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX} This commit fixes edge cases of `r = 38` and `r = 308`. As defined in the MPI standard, `TYPE_CREATE_F90_REAL` and `TYPE_CREATE_F90_COMPLEX` must be consistent with the Fortran `SELECTED_REAL_KIND` function. The `SELECTED_REAL_KIND` function is defined based on the `RANGE` function. The `RANGE` function returns `INT(MIN(LOG10(HUGE(X)), -LOG10(TINY(X))))` for a real value `X`. The old code considers only `INT(LOG10(HUGE(X)))` using `*_MAX_10_EXP`. This commit adds `INT(-LOG10(TINY(X)))` part using `*_MIN_10_EXP`. This bug affected the following `p`-`r` combinations. | p | r | expected | returned | expected | returned | | :------------ | --: | :-------- | :-------- | :------- | :-------- | | MPI_UNDEFINED | 38 | REAL8 | REAL4 | COMPLEX16 | COMPLEX8 | | 0 <= p <= 6 | 38 | REAL8 | REAL4 | COMPLEX16 | COMPLEX8 | | MPI_UNDEFINED | 308 | REAL16 | REAL8 | COMPLEX32 | COMPLEX16 | | 0 <= p <= 15 | 308 | REAL16 | REAL8 | COMPLEX32 | COMPLEX16 | MPICH returns the same result as Open MPI with this fix. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 6fb01f64fe2bcdb4668e520eb458ffd3477e5e6f) --- ompi/mpi/c/type_create_f90_complex.c | 9 +++++---- ompi/mpi/c/type_create_f90_real.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ompi/mpi/c/type_create_f90_complex.c b/ompi/mpi/c/type_create_f90_complex.c index e8ec6d6f9ab..6d82c571429 100644 --- a/ompi/mpi/c/type_create_f90_complex.c +++ b/ompi/mpi/c/type_create_f90_complex.c @@ -17,6 +17,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -80,10 +81,10 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype) * cache. */ - if( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt; - else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_ldblcplex.dt; - else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_dblcplex.dt; - else *newtype = &ompi_mpi_cplex.dt; + if ( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) || (-LDBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt; + else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) || (-DBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_ldblcplex.dt; + else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) || (-FLT_MIN_10_EXP < r) ) *newtype = &ompi_mpi_dblcplex.dt; + else *newtype = &ompi_mpi_cplex.dt; if( *newtype != &ompi_mpi_datatype_null.dt ) { ompi_datatype_t* datatype; diff --git a/ompi/mpi/c/type_create_f90_real.c b/ompi/mpi/c/type_create_f90_real.c index de2ee83fac4..d131fc2a4f8 100644 --- a/ompi/mpi/c/type_create_f90_real.c +++ b/ompi/mpi/c/type_create_f90_real.c @@ -17,6 +17,7 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -80,10 +81,10 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype) * cache. */ - if( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt; - else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) ) *newtype = &ompi_mpi_long_double.dt; - else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) ) *newtype = &ompi_mpi_double.dt; - else *newtype = &ompi_mpi_float.dt; + if ( (LDBL_DIG < p) || (LDBL_MAX_10_EXP < r) || (-LDBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_datatype_null.dt; + else if( (DBL_DIG < p) || (DBL_MAX_10_EXP < r) || (-DBL_MIN_10_EXP < r) ) *newtype = &ompi_mpi_long_double.dt; + else if( (FLT_DIG < p) || (FLT_MAX_10_EXP < r) || (-FLT_MIN_10_EXP < r) ) *newtype = &ompi_mpi_double.dt; + else *newtype = &ompi_mpi_float.dt; if( *newtype != &ompi_mpi_datatype_null.dt ) { ompi_datatype_t* datatype; From 2d9c936082fbbdb46433d7d7f745e34cde33462e Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 17 Dec 2018 16:13:55 -0800 Subject: [PATCH 215/674] If job is fully described, there will be no ppn string to unpack Signed-off-by: Ralph Castain (cherry picked from commit d7283807410c1d37d966180847debe1d43361e92) --- orte/mca/odls/base/odls_base_default_fns.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index f98dd7468b0..4f3a77fce1f 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -606,17 +606,17 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer, } } - /* extract the ppn regex */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &ppn, &cnt, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - goto REPORT_ERROR; - } - /* if the job is fully described, then mpirun will have computed * and sent us the complete array of procs in the orte_job_t, so we * don't need to do anything more here */ if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_FULLY_DESCRIBED, NULL, OPAL_BOOL)) { + /* extract the ppn regex */ + cnt = 1; + if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &ppn, &cnt, OPAL_STRING))) { + ORTE_ERROR_LOG(rc); + goto REPORT_ERROR; + } + if (!ORTE_PROC_IS_HNP) { /* populate the node array of the job map and the proc array of * the job object so we know how many procs are on each node */ From 4aa91e1ffb178debf79d9bbd61784bed46b9f917 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 29 Nov 2018 09:15:39 -0600 Subject: [PATCH 216/674] Return MPI1 function implementations to build list Adding the implementations of the functions that were removed from the MPI standard to the build list, regardless of the state of the OMPI_ENABLE_MPI1_COMPAT. According to the README, we want the OMPI_ENABLE_MPI1_COMPAT configure flag to control which MPI prototypes are exposed in mpi.h, NOT, which are built into the mpi library. Those will remain in the mpi library until a future major release (5.0?) NOTE: for the Fortran implementations, we instead define OMPI_OMIT_MPI1_COMPAT_DECLS to 0 instead of OMPI_ENABLE_MPI1_COMPAT to 1. I'm not sure why, but this seems to work correctly. Also changing the removed MPI_Errhandler_create implementation to use the non removed MPI_Comm_errhandler_function prototype (prototype remains unchanged from MPI_Comm_errhandler_fn) NOTE: This commit is *NOT* a cherry-pick from master, because on master, we are no longer building those symbols by default, but on v4.0.x we _ARE_ still building these symbols by default. This is because the v4.0.x branch is to remain backwards compatible with v3.0.x, while at the same time removing the "removed" symbols from mpi.h (unless the user configures with --enable-mpi1-compatibility) Signed-off-by: Geoffrey Paulsen --- ompi/include/mpi.h.in | 6 +++--- ompi/mpi/c/Makefile.am | 4 ++-- ompi/mpi/c/address.c | 11 +++++++++++ ompi/mpi/c/errhandler_create.c | 6 +++++- ompi/mpi/c/errhandler_get.c | 4 ++++ ompi/mpi/c/errhandler_set.c | 4 ++++ ompi/mpi/c/profile/Makefile.am | 4 ++-- ompi/mpi/c/type_extent.c | 4 ++++ ompi/mpi/c/type_hindexed.c | 4 ++++ ompi/mpi/c/type_hvector.c | 4 ++++ ompi/mpi/c/type_lb.c | 4 ++++ ompi/mpi/c/type_struct.c | 4 ++++ ompi/mpi/c/type_ub.c | 4 ++++ ompi/mpi/fortran/mpif-h/Makefile.am | 5 ++--- ompi/mpi/fortran/mpif-h/address_f.c | 1 + ompi/mpi/fortran/mpif-h/errhandler_create_f.c | 1 + ompi/mpi/fortran/mpif-h/errhandler_get_f.c | 1 + ompi/mpi/fortran/mpif-h/errhandler_set_f.c | 1 + ompi/mpi/fortran/mpif-h/profile/Makefile.am | 4 ++-- ompi/mpi/fortran/mpif-h/type_extent_f.c | 1 + ompi/mpi/fortran/mpif-h/type_hindexed_f.c | 1 + ompi/mpi/fortran/mpif-h/type_hvector_f.c | 1 + ompi/mpi/fortran/mpif-h/type_lb_f.c | 1 + ompi/mpi/fortran/mpif-h/type_struct_f.c | 1 + ompi/mpi/fortran/mpif-h/type_ub_f.c | 1 + 25 files changed, 69 insertions(+), 13 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 0cf5c1f94f7..4168e6fcb79 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -279,7 +279,7 @@ # define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__)) # endif # endif -# if OMPI_ENABLE_MPI1_COMPAT +# if (OMPI_ENABLE_MPI1_COMPAT && !OMPI_BUILDING) # define __mpi_interface_removed__(msg) __mpi_interface_deprecated__(msg) # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 # endif @@ -1001,7 +1001,7 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; -#if !OMPI_OMIT_MPI1_COMPAT_DECLS +#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) /* * Removed datatypes. These datatypes are only available if Open MPI * was configured with --enable-mpi1-compatibility. @@ -2662,7 +2662,7 @@ OMPI_DECLSPEC int OMPI_C_MPI_NULL_DELETE_FN( MPI_Comm comm, int comm_keyval, void* extra_state ) __mpi_interface_deprecated__("MPI_NULL_DELETE_FN was deprecated in MPI-2.0; use MPI_COMM_NULL_DELETE_FN instead."); -#if !OMPI_OMIT_MPI1_COMPAT_DECLS +#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) /* * Removed typedefs. These typedefs are only available if Open MPI * was configured with --enable-mpi1-compatibility. diff --git a/ompi/mpi/c/Makefile.am b/ompi/mpi/c/Makefile.am index d4c822beba2..25b32809aeb 100644 --- a/ompi/mpi/c/Makefile.am +++ b/ompi/mpi/c/Makefile.am @@ -437,7 +437,8 @@ libmpi_c_mpi_la_SOURCES = \ win_wait.c -if OMPI_ENABLE_MPI1_COMPAT +# include all of the removed MPI functions in library +# for v4.0.x regardless of state of OMPI_ENABLE_MPI1_COMPAT libmpi_c_mpi_la_SOURCES += \ address.c \ errhandler_create.c \ @@ -449,7 +450,6 @@ libmpi_c_mpi_la_SOURCES += \ type_lb.c \ type_struct.c \ type_ub.c -endif # Conditionally install the header files diff --git a/ompi/mpi/c/address.c b/ompi/mpi/c/address.c index 67b27bef58e..bb864a6b2ab 100644 --- a/ompi/mpi/c/address.c +++ b/ompi/mpi/c/address.c @@ -21,6 +21,17 @@ #include "ompi_config.h" #include +/* This implementation has been removed from the MPI 3.1 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + * + * To prevent having to port these implementations of removed functions + * to the newer MPI calls, we are defining ENABLE_MPI1_COMPAT to 1 + * before including the c bindings. + */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/errhandler_create.c b/ompi/mpi/c/errhandler_create.c index cae93f98f40..3af43d57446 100644 --- a/ompi/mpi/c/errhandler_create.c +++ b/ompi/mpi/c/errhandler_create.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" @@ -31,7 +35,7 @@ #define MPI_Errhandler_create PMPI_Errhandler_create #endif -int MPI_Errhandler_create(MPI_Handler_function *function, +int MPI_Errhandler_create(MPI_Comm_errhandler_function *function, MPI_Errhandler *errhandler) { diff --git a/ompi/mpi/c/errhandler_get.c b/ompi/mpi/c/errhandler_get.c index 7125506b7ed..e5caf07c3bb 100644 --- a/ompi/mpi/c/errhandler_get.c +++ b/ompi/mpi/c/errhandler_get.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/errhandler_set.c b/ompi/mpi/c/errhandler_set.c index c861b058903..686f97f1648 100644 --- a/ompi/mpi/c/errhandler_set.c +++ b/ompi/mpi/c/errhandler_set.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/profile/Makefile.am b/ompi/mpi/c/profile/Makefile.am index 5330752db5c..4a239d7e2ab 100644 --- a/ompi/mpi/c/profile/Makefile.am +++ b/ompi/mpi/c/profile/Makefile.am @@ -416,7 +416,8 @@ nodist_libmpi_c_pmpi_la_SOURCES = \ pwin_unlock_all.c \ pwin_wait.c -if OMPI_ENABLE_MPI1_COMPAT +# include all of the removed MPI functions in library +# for v4.0.x regardless of state of OMPI_ENABLE_MPI1_COMPAT nodist_libmpi_c_pmpi_la_SOURCES += \ paddress.c \ perrhandler_create.c \ @@ -428,7 +429,6 @@ nodist_libmpi_c_pmpi_la_SOURCES += \ ptype_lb.c \ ptype_struct.c \ ptype_ub.c -endif # # Sym link in the sources from the real MPI directory diff --git a/ompi/mpi/c/type_extent.c b/ompi/mpi/c/type_extent.c index 4c4a4a5f59e..8984b467bb4 100644 --- a/ompi/mpi/c/type_extent.c +++ b/ompi/mpi/c/type_extent.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/type_hindexed.c b/ompi/mpi/c/type_hindexed.c index 89d3b46bdd3..ad071fd5a15 100644 --- a/ompi/mpi/c/type_hindexed.c +++ b/ompi/mpi/c/type_hindexed.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/type_hvector.c b/ompi/mpi/c/type_hvector.c index 2c1517b565a..469aba75d55 100644 --- a/ompi/mpi/c/type_hvector.c +++ b/ompi/mpi/c/type_hvector.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/type_lb.c b/ompi/mpi/c/type_lb.c index 269f7bd245a..b8ba200c874 100644 --- a/ompi/mpi/c/type_lb.c +++ b/ompi/mpi/c/type_lb.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/c/type_struct.c b/ompi/mpi/c/type_struct.c index 575e26453f7..13572552ce0 100644 --- a/ompi/mpi/c/type_struct.c +++ b/ompi/mpi/c/type_struct.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #if OMPI_BUILD_MPI_PROFILING diff --git a/ompi/mpi/c/type_ub.c b/ompi/mpi/c/type_ub.c index a7d16909d66..1544116a6f9 100644 --- a/ompi/mpi/c/type_ub.c +++ b/ompi/mpi/c/type_ub.c @@ -20,6 +20,10 @@ #include "ompi_config.h" +/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. + * see comments in address.c for more information. */ +#define ENABLE_MPI1_COMPAT 1 + #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" #include "ompi/communicator/communicator.h" diff --git a/ompi/mpi/fortran/mpif-h/Makefile.am b/ompi/mpi/fortran/mpif-h/Makefile.am index e44b770977b..2c0a6c050f0 100644 --- a/ompi/mpi/fortran/mpif-h/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/Makefile.am @@ -481,8 +481,8 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ win_flush_local_f.c \ win_flush_local_all_f.c - -if OMPI_ENABLE_MPI1_COMPAT +# include all of the removed MPI functions in library +# for v4.0.x regardless of state of OMPI_ENABLE_MPI1_COMPAT lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ address_f.c \ errhandler_create_f.c \ @@ -495,7 +495,6 @@ lib@OMPI_LIBMPI_NAME@_mpifh_la_SOURCES += \ type_struct_f.c \ type_ub_f.c endif -endif # # Conditionally install the header files diff --git a/ompi/mpi/fortran/mpif-h/address_f.c b/ompi/mpi/fortran/mpif-h/address_f.c index 85d1369ae2d..1abdf8cfb18 100644 --- a/ompi/mpi/fortran/mpif-h/address_f.c +++ b/ompi/mpi/fortran/mpif-h/address_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/errhandler_create_f.c b/ompi/mpi/fortran/mpif-h/errhandler_create_f.c index 9805f652806..41a59bcc1df 100644 --- a/ompi/mpi/fortran/mpif-h/errhandler_create_f.c +++ b/ompi/mpi/fortran/mpif-h/errhandler_create_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/errhandler_get_f.c b/ompi/mpi/fortran/mpif-h/errhandler_get_f.c index 5ca661aa10d..313dafd8df0 100644 --- a/ompi/mpi/fortran/mpif-h/errhandler_get_f.c +++ b/ompi/mpi/fortran/mpif-h/errhandler_get_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/errhandler_set_f.c b/ompi/mpi/fortran/mpif-h/errhandler_set_f.c index d6ea8a94b32..713c35f7374 100644 --- a/ompi/mpi/fortran/mpif-h/errhandler_set_f.c +++ b/ompi/mpi/fortran/mpif-h/errhandler_set_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2008-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index 5566b85b28a..7c1e6afe08d 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -397,7 +397,8 @@ linked_files = \ pwin_flush_local_f.c \ pwin_flush_local_all_f.c -if OMPI_ENABLE_MPI1_COMPAT +# include all of the removed MPI functions in library +# for v4.0.x regardless of state of OMPI_ENABLE_MPI1_COMPAT linked_files += \ paddress_f.c \ perrhandler_create_f.c \ @@ -409,7 +410,6 @@ linked_files += \ ptype_lb_f.c \ ptype_struct_f.c \ ptype_ub_f.c -endif # # Sym link in the sources from the real MPI directory diff --git a/ompi/mpi/fortran/mpif-h/type_extent_f.c b/ompi/mpi/fortran/mpif-h/type_extent_f.c index a2baf215a6b..cbc7384fd23 100644 --- a/ompi/mpi/fortran/mpif-h/type_extent_f.c +++ b/ompi/mpi/fortran/mpif-h/type_extent_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/type_hindexed_f.c b/ompi/mpi/fortran/mpif-h/type_hindexed_f.c index 3b48ec31cef..e33ff79c76f 100644 --- a/ompi/mpi/fortran/mpif-h/type_hindexed_f.c +++ b/ompi/mpi/fortran/mpif-h/type_hindexed_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/type_hvector_f.c b/ompi/mpi/fortran/mpif-h/type_hvector_f.c index 1bc5720e9bb..5380a006ddd 100644 --- a/ompi/mpi/fortran/mpif-h/type_hvector_f.c +++ b/ompi/mpi/fortran/mpif-h/type_hvector_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/type_lb_f.c b/ompi/mpi/fortran/mpif-h/type_lb_f.c index 3867c35ad29..f442b1a2ef9 100644 --- a/ompi/mpi/fortran/mpif-h/type_lb_f.c +++ b/ompi/mpi/fortran/mpif-h/type_lb_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/type_struct_f.c b/ompi/mpi/fortran/mpif-h/type_struct_f.c index 03a05d9a548..bb6b10a1fd4 100644 --- a/ompi/mpi/fortran/mpif-h/type_struct_f.c +++ b/ompi/mpi/fortran/mpif-h/type_struct_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/ompi/mpi/fortran/mpif-h/type_ub_f.c b/ompi/mpi/fortran/mpif-h/type_ub_f.c index 17a468a6343..dbfd000d231 100644 --- a/ompi/mpi/fortran/mpif-h/type_ub_f.c +++ b/ompi/mpi/fortran/mpif-h/type_ub_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow From d9b0dad828e89d1c21d7d61b59ff2cce30dd9ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bouteiller?= Date: Tue, 23 Oct 2018 22:42:35 -0400 Subject: [PATCH 217/674] Correctly propagate the oversubscribe flag to the spawnees This is a cherry-pick of master (2820aef). The propagation is intended to resolve issue #6130 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Bouteiller --- orte/mca/rmaps/base/rmaps_base_map_job.c | 2 +- orte/mca/rmaps/round_robin/rmaps_rr_mappers.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_map_job.c b/orte/mca/rmaps/base/rmaps_base_map_job.c index 3300783a707..66a46b3ba08 100644 --- a/orte/mca/rmaps/base/rmaps_base_map_job.c +++ b/orte/mca/rmaps/base/rmaps_base_map_job.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 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 + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, diff --git a/orte/mca/rmaps/round_robin/rmaps_rr_mappers.c b/orte/mca/rmaps/round_robin/rmaps_rr_mappers.c index 6426b1e4940..c515e9e41b8 100644 --- a/orte/mca/rmaps/round_robin/rmaps_rr_mappers.c +++ b/orte/mca/rmaps/round_robin/rmaps_rr_mappers.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University + * Copyright (c) 2004-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -172,7 +172,14 @@ int orte_rmaps_rr_byslot(orte_job_t *jdata, --nxtra_nodes; } } - num_procs_to_assign = node->slots - node->slots_inuse + extra_procs_to_assign; + if(node->slots <= node->slots_inuse) { + /* nodes are already oversubscribed */ + num_procs_to_assign = extra_procs_to_assign; + } + else { + /* nodes have some room */ + num_procs_to_assign = node->slots - node->slots_inuse + extra_procs_to_assign; + } opal_output_verbose(2, orte_rmaps_base_framework.framework_output, "mca:rmaps:rr:slot adding up to %d procs to node %s", num_procs_to_assign, node->name); From 20d231defa9503e9f49ffa87430070b2d510d5eb Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 22 Dec 2018 03:37:06 -0800 Subject: [PATCH 218/674] odls_base_default_fns.c: put the free() in the right place Fixes CID 1441826. Signed-off-by: Jeff Squyres (cherry picked from commit f96c04244db6dbd7f3546d0d1d93e771933f4094) --- orte/mca/odls/base/odls_base_default_fns.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index 4f3a77fce1f..34b6268f603 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -13,7 +13,7 @@ * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -632,21 +632,20 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer, goto REPORT_ERROR; } } + free(ppn); + /* compute the ranks and add the proc objects * to the jdata->procs array */ if (ORTE_SUCCESS != (rc = orte_rmaps_base_compute_vpids(jdata))) { ORTE_ERROR_LOG(rc); - free(ppn); goto REPORT_ERROR; } /* and finally, compute the local and node ranks */ if (ORTE_SUCCESS != (rc = orte_rmaps_base_compute_local_ranks(jdata))) { ORTE_ERROR_LOG(rc); - free(ppn); goto REPORT_ERROR; } } - free(ppn); /* unpack the buffer containing any application setup info - there * might not be any, so it isn't an error if we don't find things */ From 1a1a932acc2897cbbeb90c4d6100b66e1459783f Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 27 Dec 2018 15:39:47 -0800 Subject: [PATCH 219/674] romio321: ensure to distribute ompi_grequestx.h Refs https://github.com/open-mpi/ompi/issues/6227. Thanks to George Marselis for reporting. Signed-off-by: Jeff Squyres (cherry picked from commit 62321be186dd7d3efcedc2e801f226f6660ea0c4) --- ompi/mca/io/romio321/romio/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/mca/io/romio321/romio/Makefile.am b/ompi/mca/io/romio321/romio/Makefile.am index 69d70142df8..71d82a9fa73 100644 --- a/ompi/mca/io/romio321/romio/Makefile.am +++ b/ompi/mca/io/romio321/romio/Makefile.am @@ -68,6 +68,9 @@ AM_CPPFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/include noinst_HEADERS += include/mpio.h noinst_HEADERS += include/io_romio_conv.h +# Included for Open MPI's --enable-grequest-extensions feature. +noinst_HEADERS += include/ompi_grequestx.h + # ------------------------------------------------------------------------ SUBDIRS = From ad4b33336deb0cfe54a8ae37fde917f9e7a82bb5 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Tue, 1 Jan 2019 19:50:28 +0200 Subject: [PATCH 220/674] oshmem/scoll: fix shmem_collect32/64 for zero-size length Fixes scoll_basic failures with shmem_verifier, caused by recent changes in handling of zero-size collectives. - Check for zero-size length only for fixed size collect (shmem_fcollect), but not for variable-size collect (shmem_collect) - Add 'nlong_type' parameter to internal broadcast function, to indicate whether the 'nlong' parameter is valid on non-root PEs, since it's used by shmem_collect algorithm. Before this change, some components assumed it's true (scoll_mpi) while others assumed it's false (scoll_basic). - In scoll_basic, if nlong_type==false, do not exit if nlong==0, since this parameter may not be the same on all PEs. - In scoll_mpi, fallback to scoll_basic if nlong_type==false, since MPI requires the 'count' argument of MPI_Bcast to be valid on all ranks. (Picked from master 939162e) Signed-off-by: Yossi Itigin --- oshmem/mca/scoll/base/scoll_base_select.c | 1 + oshmem/mca/scoll/basic/scoll_basic.h | 1 + .../mca/scoll/basic/scoll_basic_broadcast.c | 3 +- oshmem/mca/scoll/basic/scoll_basic_collect.c | 14 +++++--- oshmem/mca/scoll/basic/scoll_basic_reduce.c | 4 +++ oshmem/mca/scoll/fca/scoll_fca.h | 1 + oshmem/mca/scoll/fca/scoll_fca_ops.c | 1 + oshmem/mca/scoll/mpi/scoll_mpi.h | 1 + oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 35 +++++++++++-------- oshmem/mca/scoll/scoll.h | 1 + oshmem/shmem/c/shmem_broadcast.c | 1 + oshmem/shmem/fortran/shmem_broadcast_f.c | 4 ++- 12 files changed, 45 insertions(+), 22 deletions(-) diff --git a/oshmem/mca/scoll/base/scoll_base_select.c b/oshmem/mca/scoll/base/scoll_base_select.c index fdaddfe1699..15d5a8d714b 100644 --- a/oshmem/mca/scoll/base/scoll_base_select.c +++ b/oshmem/mca/scoll/base/scoll_base_select.c @@ -77,6 +77,7 @@ static int scoll_null_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg) { if (oshmem_proc_group_is_member(group)) { diff --git a/oshmem/mca/scoll/basic/scoll_basic.h b/oshmem/mca/scoll/basic/scoll_basic.h index b45b8380f8d..066ff6cacdd 100644 --- a/oshmem/mca/scoll/basic/scoll_basic.h +++ b/oshmem/mca/scoll/basic/scoll_basic.h @@ -61,6 +61,7 @@ int mca_scoll_basic_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg); int mca_scoll_basic_collect(struct oshmem_group_t *group, void *target, diff --git a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c index 80059d462d1..44c8436a0ea 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_broadcast.c +++ b/oshmem/mca/scoll/basic/scoll_basic_broadcast.c @@ -41,6 +41,7 @@ int mca_scoll_basic_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg) { int rc = OSHMEM_SUCCESS; @@ -56,7 +57,7 @@ int mca_scoll_basic_broadcast(struct oshmem_group_t *group, int i = 0; /* Do nothing on zero-length request */ - if (OPAL_UNLIKELY(!nlong)) { + if (OPAL_UNLIKELY(nlong_type && !nlong)) { return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/scoll/basic/scoll_basic_collect.c b/oshmem/mca/scoll/basic/scoll_basic_collect.c index e631a315575..e5fb03f5350 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_collect.c +++ b/oshmem/mca/scoll/basic/scoll_basic_collect.c @@ -66,12 +66,13 @@ int mca_scoll_basic_collect(struct oshmem_group_t *group, if ((rc == OSHMEM_SUCCESS) && oshmem_proc_group_is_member(group)) { int i = 0; - /* Do nothing on zero-length request */ - if (OPAL_UNLIKELY(!nlong)) { - return OPAL_SUCCESS; - } - if (nlong_type) { + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OPAL_SUCCESS; + } + alg = (alg == SCOLL_DEFAULT_ALG ? mca_scoll_basic_param_collect_algorithm : alg); switch (alg) { @@ -198,6 +199,7 @@ static int _algorithm_f_central_counter(struct oshmem_group_t *group, target, group->proc_count * nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } @@ -308,6 +310,7 @@ static int _algorithm_f_tournament(struct oshmem_group_t *group, target, group->proc_count * nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } @@ -629,6 +632,7 @@ static int _algorithm_central_collector(struct oshmem_group_t *group, target, offset, (pSync + 1), + false, SCOLL_DEFAULT_ALG); } diff --git a/oshmem/mca/scoll/basic/scoll_basic_reduce.c b/oshmem/mca/scoll/basic/scoll_basic_reduce.c index b7f6f123106..b8ecb9e7daf 100644 --- a/oshmem/mca/scoll/basic/scoll_basic_reduce.c +++ b/oshmem/mca/scoll/basic/scoll_basic_reduce.c @@ -242,6 +242,7 @@ static int _algorithm_central_counter(struct oshmem_group_t *group, target, nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } @@ -360,6 +361,7 @@ static int _algorithm_tournament(struct oshmem_group_t *group, target, nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } @@ -639,6 +641,7 @@ static int _algorithm_linear(struct oshmem_group_t *group, target, nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } @@ -807,6 +810,7 @@ static int _algorithm_log(struct oshmem_group_t *group, target, nlong, (pSync + 1), + true, SCOLL_DEFAULT_ALG); } diff --git a/oshmem/mca/scoll/fca/scoll_fca.h b/oshmem/mca/scoll/fca/scoll_fca.h index 38215ec8684..e220abe3152 100644 --- a/oshmem/mca/scoll/fca/scoll_fca.h +++ b/oshmem/mca/scoll/fca/scoll_fca.h @@ -115,6 +115,7 @@ int mca_scoll_fca_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int algorithm_type); int mca_scoll_fca_collect(struct oshmem_group_t *group, void *target, diff --git a/oshmem/mca/scoll/fca/scoll_fca_ops.c b/oshmem/mca/scoll/fca/scoll_fca_ops.c index 0aa05c29755..f5f6edf1679 100644 --- a/oshmem/mca/scoll/fca/scoll_fca_ops.c +++ b/oshmem/mca/scoll/fca/scoll_fca_ops.c @@ -50,6 +50,7 @@ int mca_scoll_fca_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg) { mca_scoll_fca_module_t *fca_module = diff --git a/oshmem/mca/scoll/mpi/scoll_mpi.h b/oshmem/mca/scoll/mpi/scoll_mpi.h index 4c30f8193b4..40d163e74cb 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi.h +++ b/oshmem/mca/scoll/mpi/scoll_mpi.h @@ -90,6 +90,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg); int mca_scoll_mpi_collect(struct oshmem_group_t *group, diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index a52a8325880..eb03dfec2df 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -38,6 +38,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg) { mca_scoll_mpi_module_t *mpi_module; @@ -54,20 +55,14 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, } dtype = &ompi_mpi_char.dt; root = oshmem_proc_group_find_id(group, PE_root); - - /* Do nothing on zero-length request */ - if (OPAL_UNLIKELY(!nlong)) { - return OSHMEM_SUCCESS; - } - /* Open SHMEM specification has the following constrains (page 85): * "If using C/C++, nelems must be of type integer. If you are using Fortran, it must be a * default integer value". And also fortran signature says "INTEGER". * Since ompi coll components doesn't support size_t at the moment, * and considering this contradiction, we cast size_t to int here * in case if the value is less than INT_MAX and fallback to previous module otherwise. */ + if (OPAL_UNLIKELY(!nlong_type || (INT_MAX < nlong))) { #ifdef INCOMPATIBLE_SHMEM_OMPI_COLL_APIS - if (INT_MAX < nlong) { MPI_COLL_VERBOSE(20,"RUNNING FALLBACK BCAST"); PREVIOUS_SCOLL_FN(mpi_module, broadcast, group, PE_root, @@ -75,13 +70,21 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, source, nlong, pSync, + nlong_type, SCOLL_DEFAULT_ALG); return rc; - } - rc = mpi_module->comm->c_coll->coll_bcast(buf, (int)nlong, dtype, root, mpi_module->comm, mpi_module->comm->c_coll->coll_bcast_module); #else - rc = mpi_module->comm->c_coll->coll_bcast(buf, nlong, dtype, root, mpi_module->comm, mpi_module->comm->c_coll->coll_bcast_module); + MPI_COLL_ERROR(20, "variable broadcast length, or exceeds INT_MAX: %zu", nlong); + return OSHMEM_ERR_NOT_SUPPORTED; #endif + } + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + + rc = mpi_module->comm->c_coll->coll_bcast(buf, nlong, dtype, root, mpi_module->comm, mpi_module->comm->c_coll->coll_bcast_module); if (OMPI_SUCCESS != rc){ MPI_COLL_VERBOSE(20,"RUNNING FALLBACK BCAST"); PREVIOUS_SCOLL_FN(mpi_module, broadcast, group, @@ -90,6 +93,7 @@ int mca_scoll_mpi_broadcast(struct oshmem_group_t *group, source, nlong, pSync, + nlong_type, SCOLL_DEFAULT_ALG); } return rc; @@ -111,12 +115,13 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, MPI_COLL_VERBOSE(20,"RUNNING MPI ALLGATHER"); mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_collect_module; - /* Do nothing on zero-length request */ - if (OPAL_UNLIKELY(!nlong)) { - return OSHMEM_SUCCESS; - } - if (nlong_type == true) { + + /* Do nothing on zero-length request */ + if (OPAL_UNLIKELY(!nlong)) { + return OSHMEM_SUCCESS; + } + sbuf = (void *) source; rbuf = target; stype = &ompi_mpi_char.dt; diff --git a/oshmem/mca/scoll/scoll.h b/oshmem/mca/scoll/scoll.h index cc6cfe6094f..4839e0d9c52 100644 --- a/oshmem/mca/scoll/scoll.h +++ b/oshmem/mca/scoll/scoll.h @@ -122,6 +122,7 @@ typedef int (*mca_scoll_base_module_broadcast_fn_t)(struct oshmem_group_t *group const void *source, size_t nlong, long *pSync, + bool nlong_type, int alg); typedef int (*mca_scoll_base_module_collect_fn_t)(struct oshmem_group_t *group, void *target, diff --git a/oshmem/shmem/c/shmem_broadcast.c b/oshmem/shmem/c/shmem_broadcast.c index 676cec02f25..ec11f50d585 100644 --- a/oshmem/shmem/c/shmem_broadcast.c +++ b/oshmem/shmem/c/shmem_broadcast.c @@ -78,6 +78,7 @@ static void _shmem_broadcast(void *target, source, nbytes, pSync, + true, SCOLL_DEFAULT_ALG); out: oshmem_proc_group_destroy(group); diff --git a/oshmem/shmem/fortran/shmem_broadcast_f.c b/oshmem/shmem/fortran/shmem_broadcast_f.c index d3d737de96a..af2a9b7185c 100644 --- a/oshmem/shmem/fortran/shmem_broadcast_f.c +++ b/oshmem/shmem/fortran/shmem_broadcast_f.c @@ -93,7 +93,9 @@ SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, FPTR_2_VOID_PTR(target), \ FPTR_2_VOID_PTR(source), \ OMPI_FINT_2_INT(*nlong) * op->dt_size, \ - FPTR_2_VOID_PTR(pSync), SCOLL_DEFAULT_ALG );\ + FPTR_2_VOID_PTR(pSync), \ + true, \ + SCOLL_DEFAULT_ALG );\ out: \ oshmem_proc_group_destroy(group);\ RUNTIME_CHECK_RC(rc); \ From 61108b6228f8450c93a8b050fc1da6228fd09517 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 8 Jan 2019 10:09:10 +0900 Subject: [PATCH 221/674] pmix/ext3x: fix support for external PMIx v3.1 The PMIX_MODEX and PMIX_INFO_ARRAY macros were removed from the PMIx 3.1 standard. Open MPI does not really need them (they are only used to be reported as not supported), so smply #ifdef protect them to support an external PMIx v3.1 The change only need to be done in ext3x/ext3x.c. But since this file is automatically generated from pmix3x/pmix3x.c, we have to update the latter file. Refs. open-mpi/ompi#6247 Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@950ba16aa16576582eb71941ec45996239c10a46) --- opal/mca/pmix/pmix3x/pmix3x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix3x.c b/opal/mca/pmix/pmix3x/pmix3x.c index 73288ff842e..5e0e91342b0 100644 --- a/opal/mca/pmix/pmix3x/pmix3x.c +++ b/opal/mca/pmix/pmix3x/pmix3x.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -1106,10 +1106,12 @@ int pmix3x_value_unload(opal_value_t *kv, OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); rc = OPAL_ERR_NOT_SUPPORTED; break; +#ifdef PMIX_MODEX case PMIX_MODEX: OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); rc = OPAL_ERR_NOT_SUPPORTED; break; +#endif /* PMIX_MODEX */ case PMIX_PERSIST: kv->type = OPAL_PERSIST; kv->data.uint8 = pmix3x_convert_persist(v->data.persist); @@ -1218,10 +1220,12 @@ int pmix3x_value_unload(opal_value_t *kv, OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); rc = OPAL_ERR_NOT_SUPPORTED; break; +#ifdef PMIX_INFO_ARRAY case PMIX_INFO_ARRAY: OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); rc = OPAL_ERR_NOT_SUPPORTED; break; +#endif /* PMIX_INFO_ARRAY */ case PMIX_IOF_CHANNEL: OPAL_ERROR_LOG(OPAL_ERR_NOT_SUPPORTED); rc = OPAL_ERR_NOT_SUPPORTED; From 140842668fc13bde97785a308d17e4e76fab5441 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 7 Jan 2019 13:00:48 -0700 Subject: [PATCH 222/674] btl/vader: don't try to set reachabilty in add_procs if not requested This commit fixes a bug where add_procs can incorrectly return an error when going through the dynamic add_procs path. This doesn't happen normally, only when pml/ob1 is not in use. References #6201 Signed-off-by: Nathan Hjelm (cherry picked from commit 30b8336cb40e586e5d926b2b52cd78bf3751e5d3) --- opal/mca/btl/vader/btl_vader_module.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index c28012ffc7f..ff0ec13f8ce 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -17,6 +17,8 @@ * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -276,7 +278,7 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl, continue; } - if (my_proc != procs[proc]) { + if (my_proc != procs[proc] && reachability) { /* add this proc to shared memory accessibility list */ rc = opal_bitmap_set_bit (reachability, proc); if(OPAL_SUCCESS != rc) { From b7fbdeb759d44ad4a1e7acce0fb68c7223f4a76d Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 7 Jan 2019 14:24:58 -0700 Subject: [PATCH 223/674] btl/vader: minor correction to match ompi coding style Signed-off-by: Nathan Hjelm (cherry picked from commit edaf08bf6d6ed24573187376921fe67a449851b2) --- opal/mca/btl/vader/btl_vader_module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index ff0ec13f8ce..bcc25f0f00b 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -278,7 +278,7 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl, continue; } - if (my_proc != procs[proc] && reachability) { + if (my_proc != procs[proc] && NULL != reachability) { /* add this proc to shared memory accessibility list */ rc = opal_bitmap_set_bit (reachability, proc); if(OPAL_SUCCESS != rc) { From ef7ab9bf9699fa81ba27aed7a32305e9f3e313c4 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 7 Dec 2018 14:03:30 +0200 Subject: [PATCH 224/674] OSHMEM: added missing API for get/put operations - added calls for datatypes int/uint/8/16/32/size/ptrdiff for shmem_g/get/iget/get_nbi/_p/put/iput/put_nbi Signed-off-by: Sergey Oblomov (cherry picked from commit cfa9150934481ff19cbd9f2454da6d40a290f08a) --- oshmem/include/pshmem.h | 220 ++++++++++++++++++++++++++----- oshmem/include/pshmemx.h | 8 -- oshmem/include/shmem.h.in | 220 ++++++++++++++++++++++++++----- oshmem/include/shmemx.h | 8 -- oshmem/shmem/c/profile/defines.h | 161 +++++++++++++++++++++- oshmem/shmem/c/shmem_g.c | 96 ++++++++++---- oshmem/shmem/c/shmem_get.c | 97 ++++++++++---- oshmem/shmem/c/shmem_get_nb.c | 95 +++++++++---- oshmem/shmem/c/shmem_iget.c | 97 ++++++++++---- oshmem/shmem/c/shmem_iput.c | 95 +++++++++---- oshmem/shmem/c/shmem_p.c | 96 ++++++++++---- oshmem/shmem/c/shmem_put.c | 97 ++++++++++---- oshmem/shmem/c/shmem_put_nb.c | 99 ++++++++++---- 13 files changed, 1091 insertions(+), 298 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index f209c18b9b4..428705e014e 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -112,6 +112,16 @@ OSHMEM_DECLSPEC void pshmem_ctx_uint_p(shmem_ctx_t ctx, unsigned int* addr, uns OSHMEM_DECLSPEC void pshmem_ctx_ulong_p(shmem_ctx_t ctx, unsigned long* addr, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_p(shmem_ctx_t ctx, unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_p(shmem_ctx_t ctx, int8_t* addr, int8_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_p(shmem_ctx_t ctx, int16_t* addr, int16_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_p(shmem_ctx_t ctx, int32_t* addr, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_p(shmem_ctx_t ctx, int64_t* addr, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_p(shmem_ctx_t ctx, uint8_t* addr, uint8_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_p(shmem_ctx_t ctx, uint16_t* addr, uint16_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_p(shmem_ctx_t ctx, uint32_t* addr, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_p(shmem_ctx_t ctx, uint64_t* addr, uint64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_p(shmem_ctx_t ctx, size_t* addr, size_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_p(shmem_ctx_t ctx, ptrdiff_t* addr, ptrdiff_t value, int pe); OSHMEM_DECLSPEC void pshmem_char_p(char* addr, char value, int pe); OSHMEM_DECLSPEC void pshmem_short_p(short* addr, short value, int pe); @@ -127,6 +137,16 @@ OSHMEM_DECLSPEC void pshmem_uint_p(unsigned int* addr, unsigned int value, int OSHMEM_DECLSPEC void pshmem_ulong_p(unsigned long* addr, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_p(unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_p(long double* addr, long double value, int pe); +OSHMEM_DECLSPEC void pshmem_int8_p(int8_t* addr, int8_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int16_p(int16_t* addr, int16_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int32_p(int32_t* addr, int32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_int64_p(int64_t* addr, int64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_p(uint8_t* addr, uint8_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_p(uint16_t* addr, uint16_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_p(uint32_t* addr, uint32_t value, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_p(uint64_t* addr, uint64_t value, int pe); +OSHMEM_DECLSPEC void pshmem_size_p(size_t* addr, size_t value, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_p(ptrdiff_t* addr, ptrdiff_t value, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_p(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -179,6 +199,16 @@ OSHMEM_DECLSPEC void pshmem_ctx_uint_put(shmem_ctx_t ctx, unsigned int *target, OSHMEM_DECLSPEC void pshmem_ctx_ulong_put(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_put(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_put(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_put(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_put(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_put(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_put(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_put(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_put(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_put(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_put(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_put(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_put(short *target, const short *source, size_t len, int pe); @@ -194,6 +224,16 @@ OSHMEM_DECLSPEC void pshmem_uint_put(unsigned int *target, const unsigned int * OSHMEM_DECLSPEC void pshmem_ulong_put(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_put(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_put(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_put(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_put(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_put(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_put(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_put(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_put(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_put(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_put(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_put(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_put(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -260,6 +300,16 @@ OSHMEM_DECLSPEC void pshmem_ctx_uint_iput(shmem_ctx_t ctx, unsigned int* target, OSHMEM_DECLSPEC void pshmem_ctx_ulong_iput(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_iput(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_iput(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_iput(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_iput(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_iput(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_iput(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_iput(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_iput(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_iput(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_iput(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_iput(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_iput(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -275,6 +325,16 @@ OSHMEM_DECLSPEC void pshmem_uint_iput(unsigned int* target, const unsigned int* OSHMEM_DECLSPEC void pshmem_ulong_iput(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_iput(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_iput(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_iput(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_iput(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_iput(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_iput(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_iput(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_iput(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_iput(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_iput(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_iput(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_iput(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -339,8 +399,17 @@ OSHMEM_DECLSPEC void pshmem_ctx_uint_put_nbi(shmem_ctx_t ctx, unsigned int *tar OSHMEM_DECLSPEC void pshmem_ctx_ulong_put_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_put_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_put_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_put_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_put_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_put_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_put_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_put_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_put_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_put_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_put_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_put_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_put_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_put_nbi(short *target, const short *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_int_put_nbi(int *target, const int *source, size_t len, int pe); @@ -355,6 +424,16 @@ OSHMEM_DECLSPEC void pshmem_uint_put_nbi(unsigned int *target, const unsigned i OSHMEM_DECLSPEC void pshmem_ulong_put_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_put_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_put_nbi(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_put_nbi(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_put_nbi(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_put_nbi(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_put_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_put_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_put_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_put_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_put_nbi(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_put_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_put_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -402,6 +481,7 @@ OSHMEM_DECLSPEC void pshmem_put16_nbi(void *target, const void *source, size_t OSHMEM_DECLSPEC void pshmem_put32_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_put64_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_put128_nbi(void *target, const void *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_putmem_nbi(void *target, const void *source, size_t len, int pe); /* * Elemental get routines @@ -420,6 +500,16 @@ OSHMEM_DECLSPEC unsigned short pshmem_ctx_ushort_g(shmem_ctx_t ctx, const unsig OSHMEM_DECLSPEC unsigned int pshmem_ctx_uint_g(shmem_ctx_t ctx, const unsigned int* addr, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ctx_ulong_g(shmem_ctx_t ctx, const unsigned long* addr, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ctx_ulonglong_g(shmem_ctx_t ctx, const unsigned long long* addr, int pe); +OSHMEM_DECLSPEC int8_t pshmem_ctx_int8_g(shmem_ctx_t ctx, const int8_t* addr, int pe); +OSHMEM_DECLSPEC int16_t pshmem_ctx_int16_g(shmem_ctx_t ctx, const int16_t* addr, int pe); +OSHMEM_DECLSPEC int32_t pshmem_ctx_int32_g(shmem_ctx_t ctx, const int32_t* addr, int pe); +OSHMEM_DECLSPEC int64_t pshmem_ctx_int64_g(shmem_ctx_t ctx, const int64_t* addr, int pe); +OSHMEM_DECLSPEC uint8_t pshmem_ctx_uint8_g(shmem_ctx_t ctx, const uint8_t* addr, int pe); +OSHMEM_DECLSPEC uint16_t pshmem_ctx_uint16_g(shmem_ctx_t ctx, const uint16_t* addr, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_ctx_uint32_g(shmem_ctx_t ctx, const uint32_t* addr, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_ctx_uint64_g(shmem_ctx_t ctx, const uint64_t* addr, int pe); +OSHMEM_DECLSPEC size_t pshmem_ctx_size_g(shmem_ctx_t ctx, const size_t* addr, int pe); +OSHMEM_DECLSPEC ptrdiff_t pshmem_ctx_ptrdiff_g(shmem_ctx_t ctx, const ptrdiff_t* addr, int pe); OSHMEM_DECLSPEC char pshmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short pshmem_short_g(const short* addr, int pe); @@ -435,6 +525,16 @@ OSHMEM_DECLSPEC unsigned short pshmem_ushort_g(const unsigned short* addr, int OSHMEM_DECLSPEC unsigned int pshmem_uint_g(const unsigned int* addr, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_g(const unsigned long* addr, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_g(const unsigned long long* addr, int pe); +OSHMEM_DECLSPEC int8_t pshmem_int8_g(const int8_t* addr, int pe); +OSHMEM_DECLSPEC int16_t pshmem_int16_g(const int16_t* addr, int pe); +OSHMEM_DECLSPEC int32_t pshmem_int32_g(const int32_t* addr, int pe); +OSHMEM_DECLSPEC int64_t pshmem_int64_g(const int64_t* addr, int pe); +OSHMEM_DECLSPEC uint8_t pshmem_uint8_g(const uint8_t* addr, int pe); +OSHMEM_DECLSPEC uint16_t pshmem_uint16_g(const uint16_t* addr, int pe); +OSHMEM_DECLSPEC uint32_t pshmem_uint32_g(const uint32_t* addr, int pe); +OSHMEM_DECLSPEC uint64_t pshmem_uint64_g(const uint64_t* addr, int pe); +OSHMEM_DECLSPEC size_t pshmem_size_g(const size_t* addr, int pe); +OSHMEM_DECLSPEC ptrdiff_t pshmem_ptrdiff_g(const ptrdiff_t* addr, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_g(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -487,6 +587,16 @@ OSHMEM_DECLSPEC void pshmem_ctx_uint_get(shmem_ctx_t ctx, unsigned int *target, OSHMEM_DECLSPEC void pshmem_ctx_ulong_get(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_get(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_get(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_get(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_get(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_get(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_get(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_get(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_get(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_get(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_get(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_get(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_get(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_short_get(short *target, const short *source, size_t len, int pe); @@ -502,6 +612,16 @@ OSHMEM_DECLSPEC void pshmem_uint_get(unsigned int *target, const unsigned int * OSHMEM_DECLSPEC void pshmem_ulong_get(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_get(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_get(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_get(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_get(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_get(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_get(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_get(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_get(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_get(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_get(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_get(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_get(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -554,35 +674,55 @@ OSHMEM_DECLSPEC void pshmem_getmem(void *target, const void *source, size_t len /* * Strided get routines */ -OSHMEM_DECLSPEC void pshmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); - -OSHMEM_DECLSPEC void pshmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_int_iget(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_float_iget(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_double_iget(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void pshmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_iget(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_iget(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_iget(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_iget(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_iget(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_iget(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_iget(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_iget(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_iget(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_iget(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); + +OSHMEM_DECLSPEC void pshmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int_iget(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_float_iget(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_double_iget(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_iget(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_iget(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_iget(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_iget(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_iget(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_iget(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_iget(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_iget(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_iget(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_iget(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_iget(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -647,6 +787,16 @@ OSHMEM_DECLSPEC void pshmem_ctx_ulonglong_get_nbi(shmem_ctx_t ctx, unsigned lon OSHMEM_DECLSPEC void pshmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int8_get_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int16_get_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int32_get_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_int64_get_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint8_get_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint16_get_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint32_get_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_uint64_get_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_size_get_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ctx_ptrdiff_get_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_getmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_char_get_nbi(char *target, const char *source, size_t len, int pe); @@ -663,6 +813,16 @@ OSHMEM_DECLSPEC void pshmem_ulonglong_get_nbi(unsigned long long *target, const OSHMEM_DECLSPEC void pshmem_float_get_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int8_get_nbi(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int16_get_nbi(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int32_get_nbi(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_int64_get_nbi(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint8_get_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint16_get_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint32_get_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_uint64_get_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_size_get_nbi(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void pshmem_ptrdiff_get_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEMP_HAVE_C11 #define pshmem_get_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ diff --git a/oshmem/include/pshmemx.h b/oshmem/include/pshmemx.h index 0b85cb06bb6..5a0f7f5a95c 100644 --- a/oshmem/include/pshmemx.h +++ b/oshmem/include/pshmemx.h @@ -184,14 +184,6 @@ OSHMEM_DECLSPEC void pshmemx_int64_prod_to_all(int64_t *target, const int64_t *s /* * Backward compatibility section */ -#define pshmem_int16_p pshmemx_int16_p -#define pshmem_int32_p pshmemx_int32_p -#define pshmem_int64_p pshmemx_int64_p - -#define pshmem_int16_g pshmemx_int16_g -#define pshmem_int32_g pshmemx_int32_g -#define pshmem_int64_g pshmemx_int64_g - #define pshmem_int32_swap pshmemx_int32_swap #define pshmem_int64_swap pshmemx_int64_swap diff --git a/oshmem/include/shmem.h.in b/oshmem/include/shmem.h.in index 76fa82d769e..853659b613b 100644 --- a/oshmem/include/shmem.h.in +++ b/oshmem/include/shmem.h.in @@ -224,6 +224,16 @@ OSHMEM_DECLSPEC void shmem_ctx_uint_p(shmem_ctx_t ctx, unsigned int* addr, unsi OSHMEM_DECLSPEC void shmem_ctx_ulong_p(shmem_ctx_t ctx, unsigned long* addr, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_p(shmem_ctx_t ctx, unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_p(shmem_ctx_t ctx, long double* addr, long double value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_p(shmem_ctx_t ctx, int8_t* addr, int8_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_p(shmem_ctx_t ctx, int16_t* addr, int16_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_p(shmem_ctx_t ctx, int32_t* addr, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_p(shmem_ctx_t ctx, int64_t* addr, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_p(shmem_ctx_t ctx, uint8_t* addr, uint8_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_p(shmem_ctx_t ctx, uint16_t* addr, uint16_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_p(shmem_ctx_t ctx, uint32_t* addr, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_p(shmem_ctx_t ctx, uint64_t* addr, uint64_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_p(shmem_ctx_t ctx, size_t* addr, size_t value, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_p(shmem_ctx_t ctx, ptrdiff_t* addr, ptrdiff_t value, int pe); OSHMEM_DECLSPEC void shmem_char_p(char* addr, char value, int pe); OSHMEM_DECLSPEC void shmem_short_p(short* addr, short value, int pe); @@ -239,6 +249,16 @@ OSHMEM_DECLSPEC void shmem_uint_p(unsigned int* addr, unsigned int value, int p OSHMEM_DECLSPEC void shmem_ulong_p(unsigned long* addr, unsigned long value, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_p(unsigned long long* addr, unsigned long long value, int pe); OSHMEM_DECLSPEC void shmem_longdouble_p(long double* addr, long double value, int pe); +OSHMEM_DECLSPEC void shmem_int8_p(int8_t* addr, int8_t value, int pe); +OSHMEM_DECLSPEC void shmem_int16_p(int16_t* addr, int16_t value, int pe); +OSHMEM_DECLSPEC void shmem_int32_p(int32_t* addr, int32_t value, int pe); +OSHMEM_DECLSPEC void shmem_int64_p(int64_t* addr, int64_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint8_p(uint8_t* addr, uint8_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint16_p(uint16_t* addr, uint16_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint32_p(uint32_t* addr, uint32_t value, int pe); +OSHMEM_DECLSPEC void shmem_uint64_p(uint64_t* addr, uint64_t value, int pe); +OSHMEM_DECLSPEC void shmem_size_p(size_t* addr, size_t value, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_p(ptrdiff_t* addr, ptrdiff_t value, int pe); #if OSHMEM_HAVE_C11 #define shmem_p(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -291,6 +311,16 @@ OSHMEM_DECLSPEC void shmem_ctx_uint_put(shmem_ctx_t ctx, unsigned int *target, OSHMEM_DECLSPEC void shmem_ctx_ulong_put(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_put(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_put(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_put(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_put(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_put(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_put(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_put(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_put(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_put(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_put(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_put(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_put(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put(short *target, const short *source, size_t len, int pe); @@ -306,6 +336,16 @@ OSHMEM_DECLSPEC void shmem_uint_put(unsigned int *target, const unsigned int *s OSHMEM_DECLSPEC void shmem_ulong_put(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_put(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_put(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_put(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_put(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_put(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_put(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_put(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_put(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_put(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_put(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_put(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_put(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -373,6 +413,16 @@ OSHMEM_DECLSPEC void shmem_ctx_uint_iput(shmem_ctx_t ctx, unsigned int* target, OSHMEM_DECLSPEC void shmem_ctx_ulong_iput(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iput(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_iput(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_iput(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_iput(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_iput(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_iput(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_iput(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_iput(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_iput(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_iput(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_iput(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_iput(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_iput(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_iput(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); @@ -388,6 +438,16 @@ OSHMEM_DECLSPEC void shmem_uint_iput(unsigned int* target, const unsigned int* s OSHMEM_DECLSPEC void shmem_ulong_iput(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_iput(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_iput(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_iput(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_iput(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_iput(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_iput(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_iput(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_iput(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_iput(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_iput(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_iput(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_iput(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_iput(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -452,6 +512,16 @@ OSHMEM_DECLSPEC void shmem_ctx_uint_put_nbi(shmem_ctx_t ctx, unsigned int *targ OSHMEM_DECLSPEC void shmem_ctx_ulong_put_nbi(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_put_nbi(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_put_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_put_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_put_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_put_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_put_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_put_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_put_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_put_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_put_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_put_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_put_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_put_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_put_nbi(short *target, const short *source, size_t len, int pe); @@ -467,6 +537,16 @@ OSHMEM_DECLSPEC void shmem_uint_put_nbi(unsigned int *target, const unsigned in OSHMEM_DECLSPEC void shmem_ulong_put_nbi(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_put_nbi(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_put_nbi(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_put_nbi(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_put_nbi(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_put_nbi(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_put_nbi(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_put_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_put_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_put_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_put_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_put_nbi(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_put_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_put_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -533,6 +613,16 @@ OSHMEM_DECLSPEC unsigned short shmem_ctx_ushort_g(shmem_ctx_t ctx, const unsign OSHMEM_DECLSPEC unsigned int shmem_ctx_uint_g(shmem_ctx_t ctx, const unsigned int* addr, int pe); OSHMEM_DECLSPEC unsigned long shmem_ctx_ulong_g(shmem_ctx_t ctx, const unsigned long* addr, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ctx_ulonglong_g(shmem_ctx_t ctx, const unsigned long long* addr, int pe); +OSHMEM_DECLSPEC int8_t shmem_ctx_int8_g(shmem_ctx_t ctx, const int8_t* addr, int pe); +OSHMEM_DECLSPEC int16_t shmem_ctx_int16_g(shmem_ctx_t ctx, const int16_t* addr, int pe); +OSHMEM_DECLSPEC int32_t shmem_ctx_int32_g(shmem_ctx_t ctx, const int32_t* addr, int pe); +OSHMEM_DECLSPEC int64_t shmem_ctx_int64_g(shmem_ctx_t ctx, const int64_t* addr, int pe); +OSHMEM_DECLSPEC uint8_t shmem_ctx_uint8_g(shmem_ctx_t ctx, const uint8_t* addr, int pe); +OSHMEM_DECLSPEC uint16_t shmem_ctx_uint16_g(shmem_ctx_t ctx, const uint16_t* addr, int pe); +OSHMEM_DECLSPEC uint32_t shmem_ctx_uint32_g(shmem_ctx_t ctx, const uint32_t* addr, int pe); +OSHMEM_DECLSPEC uint64_t shmem_ctx_uint64_g(shmem_ctx_t ctx, const uint64_t* addr, int pe); +OSHMEM_DECLSPEC size_t shmem_ctx_size_g(shmem_ctx_t ctx, const size_t* addr, int pe); +OSHMEM_DECLSPEC ptrdiff_t shmem_ctx_ptrdiff_g(shmem_ctx_t ctx, const ptrdiff_t* addr, int pe); OSHMEM_DECLSPEC char shmem_char_g(const char* addr, int pe); OSHMEM_DECLSPEC short shmem_short_g(const short* addr, int pe); @@ -548,6 +638,16 @@ OSHMEM_DECLSPEC unsigned short shmem_ushort_g(const unsigned short* addr, int p OSHMEM_DECLSPEC unsigned int shmem_uint_g(const unsigned int* addr, int pe); OSHMEM_DECLSPEC unsigned long shmem_ulong_g(const unsigned long* addr, int pe); OSHMEM_DECLSPEC unsigned long long shmem_ulonglong_g(const unsigned long long* addr, int pe); +OSHMEM_DECLSPEC int8_t shmem_int8_g(const int8_t* addr, int pe); +OSHMEM_DECLSPEC int16_t shmem_int16_g(const int16_t* addr, int pe); +OSHMEM_DECLSPEC int32_t shmem_int32_g(const int32_t* addr, int pe); +OSHMEM_DECLSPEC int64_t shmem_int64_g(const int64_t* addr, int pe); +OSHMEM_DECLSPEC uint8_t shmem_uint8_g(const uint8_t* addr, int pe); +OSHMEM_DECLSPEC uint16_t shmem_uint16_g(const uint16_t* addr, int pe); +OSHMEM_DECLSPEC uint32_t shmem_uint32_g(const uint32_t* addr, int pe); +OSHMEM_DECLSPEC uint64_t shmem_uint64_g(const uint64_t* addr, int pe); +OSHMEM_DECLSPEC size_t shmem_size_g(const size_t* addr, int pe); +OSHMEM_DECLSPEC ptrdiff_t shmem_ptrdiff_g(const ptrdiff_t* addr, int pe); #if OSHMEM_HAVE_C11 #define shmem_g(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -600,6 +700,16 @@ OSHMEM_DECLSPEC void shmem_ctx_uint_get(shmem_ctx_t ctx, unsigned int *target, OSHMEM_DECLSPEC void shmem_ctx_ulong_get(shmem_ctx_t ctx, unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_ulonglong_get(shmem_ctx_t ctx, unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_get(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_get(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_get(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_get(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_get(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_get(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_get(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_get(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_get(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_get(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_get(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_get(short *target, const short *source, size_t len, int pe); @@ -615,6 +725,16 @@ OSHMEM_DECLSPEC void shmem_uint_get(unsigned int *target, const unsigned int *s OSHMEM_DECLSPEC void shmem_ulong_get(unsigned long *target, const unsigned long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ulonglong_get(unsigned long long *target, const unsigned long long *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_get(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_get(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_get(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_get(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_get(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_get(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_get(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_get(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_get(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_get(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_get(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -667,35 +787,55 @@ OSHMEM_DECLSPEC void shmem_getmem(void *target, const void *source, size_t len, /* * Strided get routines */ -OSHMEM_DECLSPEC void shmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); - -OSHMEM_DECLSPEC void shmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_int_iget(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_float_iget(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_double_iget(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -OSHMEM_DECLSPEC void shmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_char_iget(shmem_ctx_t ctx, char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_short_iget(shmem_ctx_t ctx, short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int_iget(shmem_ctx_t ctx, int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_long_iget(shmem_ctx_t ctx, long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longlong_iget(shmem_ctx_t ctx, long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_schar_iget(shmem_ctx_t ctx, signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uchar_iget(shmem_ctx_t ctx, unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ushort_iget(shmem_ctx_t ctx, unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint_iget(shmem_ctx_t ctx, unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulong_iget(shmem_ctx_t ctx, unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ulonglong_iget(shmem_ctx_t ctx, unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_float_iget(shmem_ctx_t ctx, float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_double_iget(shmem_ctx_t ctx, double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_longdouble_iget(shmem_ctx_t ctx, long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_iget(shmem_ctx_t ctx, int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_iget(shmem_ctx_t ctx, int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_iget(shmem_ctx_t ctx, int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_iget(shmem_ctx_t ctx, int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_iget(shmem_ctx_t ctx, uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_iget(shmem_ctx_t ctx, uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_iget(shmem_ctx_t ctx, uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_iget(shmem_ctx_t ctx, uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_iget(shmem_ctx_t ctx, size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_iget(shmem_ctx_t ctx, ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); + +OSHMEM_DECLSPEC void shmem_char_iget(char* target, const char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_short_iget(short* target, const short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int_iget(int* target, const int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_float_iget(float* target, const float* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_double_iget(double* target, const double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_longlong_iget(long long* target, const long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_longdouble_iget(long double* target, const long double* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_long_iget(long* target, const long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_schar_iget(signed char* target, const signed char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uchar_iget(unsigned char* target, const unsigned char* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ushort_iget(unsigned short* target, const unsigned short* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint_iget(unsigned int* target, const unsigned int* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulong_iget(unsigned long* target, const unsigned long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ulonglong_iget(unsigned long long* target, const unsigned long long* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_iget(int8_t* target, const int8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_iget(int16_t* target, const int16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_iget(int32_t* target, const int32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_iget(int64_t* target, const int64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_iget(uint8_t* target, const uint8_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_iget(uint16_t* target, const uint16_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_iget(uint32_t* target, const uint32_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_iget(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_iget(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_iget(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_iget(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -760,8 +900,17 @@ OSHMEM_DECLSPEC void shmem_ctx_ulonglong_get_nbi(shmem_ctx_t ctx, unsigned long OSHMEM_DECLSPEC void shmem_ctx_float_get_nbi(shmem_ctx_t ctx, float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_double_get_nbi(shmem_ctx_t ctx, double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_ctx_longdouble_get_nbi(shmem_ctx_t ctx, long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int8_get_nbi(shmem_ctx_t ctx, int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int16_get_nbi(shmem_ctx_t ctx, int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int32_get_nbi(shmem_ctx_t ctx, int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_int64_get_nbi(shmem_ctx_t ctx, int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint8_get_nbi(shmem_ctx_t ctx, uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint16_get_nbi(shmem_ctx_t ctx, uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint32_get_nbi(shmem_ctx_t ctx, uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_uint64_get_nbi(shmem_ctx_t ctx, uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_size_get_nbi(shmem_ctx_t ctx, size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ctx_ptrdiff_get_nbi(shmem_ctx_t ctx, ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -OSHMEM_DECLSPEC void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_char_get_nbi(char *target, const char *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_short_get_nbi(short *target, const short *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_int_get_nbi(int *target, const int *source, size_t len, int pe); @@ -776,6 +925,16 @@ OSHMEM_DECLSPEC void shmem_ulonglong_get_nbi(unsigned long long *target, const OSHMEM_DECLSPEC void shmem_float_get_nbi(float *target, const float *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_double_get_nbi(double *target, const double *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_longdouble_get_nbi(long double *target, const long double *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int8_get_nbi(int8_t *target, const int8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int16_get_nbi(int16_t *target, const int16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int32_get_nbi(int32_t *target, const int32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_int64_get_nbi(int64_t *target, const int64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint8_get_nbi(uint8_t *target, const uint8_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint16_get_nbi(uint16_t *target, const uint16_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint32_get_nbi(uint32_t *target, const uint32_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_uint64_get_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_size_get_nbi(size_t *target, const size_t *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_ptrdiff_get_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); #if OSHMEM_HAVE_C11 #define shmem_get_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ @@ -823,6 +982,7 @@ OSHMEM_DECLSPEC void shmem_get16_nbi(void *target, const void *source, size_t l OSHMEM_DECLSPEC void shmem_get32_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_get64_nbi(void *target, const void *source, size_t len, int pe); OSHMEM_DECLSPEC void shmem_get128_nbi(void *target, const void *source, size_t len, int pe); +OSHMEM_DECLSPEC void shmem_getmem_nbi(void *target, const void *source, size_t len, int pe); /* * Atomic operations diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index 46bf8130094..b3b55cb7dd1 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -171,14 +171,6 @@ OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *so /* * Backward compatibility section */ -#define shmem_int16_p shmemx_int16_p -#define shmem_int32_p shmemx_int32_p -#define shmem_int64_p shmemx_int64_p - -#define shmem_int16_g shmemx_int16_g -#define shmem_int32_g shmemx_int32_g -#define shmem_int64_g shmemx_int64_g - #define shmem_int32_swap shmemx_int32_swap #define shmem_int64_swap shmemx_int64_swap diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index f4187e474c6..22936efcfa5 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -72,7 +72,6 @@ /* * Elemental put routines */ - #define shmem_ctx_char_p pshmem_ctx_char_p #define shmem_ctx_short_p pshmem_ctx_short_p #define shmem_ctx_int_p pshmem_ctx_int_p @@ -87,6 +86,16 @@ #define shmem_ctx_ulong_p pshmem_ctx_ulong_p #define shmem_ctx_ulonglong_p pshmem_ctx_ulonglong_p #define shmem_ctx_longdouble_p pshmem_ctx_longdouble_p +#define shmem_ctx_int8_p pshmem_ctx_int8_p +#define shmem_ctx_int16_p pshmem_ctx_int16_p +#define shmem_ctx_int32_p pshmem_ctx_int32_p +#define shmem_ctx_int64_p pshmem_ctx_int64_p +#define shmem_ctx_uint8_p pshmem_ctx_uint8_p +#define shmem_ctx_uint16_p pshmem_ctx_uint16_p +#define shmem_ctx_uint32_p pshmem_ctx_uint32_p +#define shmem_ctx_uint64_p pshmem_ctx_uint64_p +#define shmem_ctx_size_p pshmem_ctx_size_p +#define shmem_ctx_ptrdiff_p pshmem_ctx_ptrdiff_p #define shmem_char_p pshmem_char_p #define shmem_short_p pshmem_short_p @@ -102,6 +111,16 @@ #define shmem_ulong_p pshmem_ulong_p #define shmem_ulonglong_p pshmem_ulonglong_p #define shmem_longdouble_p pshmem_longdouble_p +#define shmem_int8_p pshmem_int8_p +#define shmem_int16_p pshmem_int16_p +#define shmem_int32_p pshmem_int32_p +#define shmem_int64_p pshmem_int64_p +#define shmem_uint8_p pshmem_uint8_p +#define shmem_uint16_p pshmem_uint16_p +#define shmem_uint32_p pshmem_uint32_p +#define shmem_uint64_p pshmem_uint64_p +#define shmem_size_p pshmem_size_p +#define shmem_ptrdiff_p pshmem_ptrdiff_p #define shmemx_int16_p pshmemx_int16_p #define shmemx_int32_p pshmemx_int32_p @@ -124,6 +143,16 @@ #define shmem_ctx_ulong_put pshmem_ctx_ulong_put #define shmem_ctx_ulonglong_put pshmem_ctx_ulonglong_put #define shmem_ctx_longdouble_put pshmem_ctx_longdouble_put +#define shmem_ctx_int8_put pshmem_ctx_int8_put +#define shmem_ctx_int16_put pshmem_ctx_int16_put +#define shmem_ctx_int32_put pshmem_ctx_int32_put +#define shmem_ctx_int64_put pshmem_ctx_int64_put +#define shmem_ctx_uint8_put pshmem_ctx_uint8_put +#define shmem_ctx_uint16_put pshmem_ctx_uint16_put +#define shmem_ctx_uint32_put pshmem_ctx_uint32_put +#define shmem_ctx_uint64_put pshmem_ctx_uint64_put +#define shmem_ctx_size_put pshmem_ctx_size_put +#define shmem_ctx_ptrdiff_put pshmem_ctx_ptrdiff_put #define shmem_char_put pshmem_char_put /* shmem-compat.h */ #define shmem_short_put pshmem_short_put @@ -139,6 +168,16 @@ #define shmem_ulong_put pshmem_ulong_put #define shmem_ulonglong_put pshmem_ulonglong_put #define shmem_longdouble_put pshmem_longdouble_put +#define shmem_int8_put pshmem_int8_put +#define shmem_int16_put pshmem_int16_put +#define shmem_int32_put pshmem_int32_put +#define shmem_int64_put pshmem_int64_put +#define shmem_uint8_put pshmem_uint8_put +#define shmem_uint16_put pshmem_uint16_put +#define shmem_uint32_put pshmem_uint32_put +#define shmem_uint64_put pshmem_uint64_put +#define shmem_size_put pshmem_size_put +#define shmem_ptrdiff_put pshmem_ptrdiff_put #define shmem_ctx_put8 pshmem_ctx_put8 #define shmem_ctx_put16 pshmem_ctx_put16 @@ -171,6 +210,16 @@ #define shmem_ctx_ulong_iput pshmem_ctx_ulong_iput #define shmem_ctx_ulonglong_iput pshmem_ctx_ulonglong_iput #define shmem_ctx_longdouble_iput pshmem_ctx_longdouble_iput +#define shmem_ctx_int8_iput pshmem_ctx_int8_iput +#define shmem_ctx_int16_iput pshmem_ctx_int16_iput +#define shmem_ctx_int32_iput pshmem_ctx_int32_iput +#define shmem_ctx_int64_iput pshmem_ctx_int64_iput +#define shmem_ctx_uint8_iput pshmem_ctx_uint8_iput +#define shmem_ctx_uint16_iput pshmem_ctx_uint16_iput +#define shmem_ctx_uint32_iput pshmem_ctx_uint32_iput +#define shmem_ctx_uint64_iput pshmem_ctx_uint64_iput +#define shmem_ctx_size_iput pshmem_ctx_size_iput +#define shmem_ctx_ptrdiff_iput pshmem_ctx_ptrdiff_iput #define shmem_char_iput pshmem_char_iput #define shmem_short_iput pshmem_short_iput @@ -186,6 +235,16 @@ #define shmem_ulong_iput pshmem_ulong_iput #define shmem_ulonglong_iput pshmem_ulonglong_iput #define shmem_longdouble_iput pshmem_longdouble_iput +#define shmem_int8_iput pshmem_int8_iput +#define shmem_int16_iput pshmem_int16_iput +#define shmem_int32_iput pshmem_int32_iput +#define shmem_int64_iput pshmem_int64_iput +#define shmem_uint8_iput pshmem_uint8_iput +#define shmem_uint16_iput pshmem_uint16_iput +#define shmem_uint32_iput pshmem_uint32_iput +#define shmem_uint64_iput pshmem_uint64_iput +#define shmem_size_iput pshmem_size_iput +#define shmem_ptrdiff_iput pshmem_ptrdiff_iput #define shmem_ctx_iput8 pshmem_ctx_iput8 #define shmem_ctx_iput16 pshmem_ctx_iput16 @@ -216,6 +275,16 @@ #define shmem_ctx_ulong_put_nbi pshmem_ctx_ulong_put_nbi #define shmem_ctx_ulonglong_put_nbi pshmem_ctx_ulonglong_put_nbi #define shmem_ctx_longdouble_put_nbi pshmem_ctx_longdouble_put_nbi +#define shmem_ctx_int8_put_nbi pshmem_ctx_int8_put_nbi +#define shmem_ctx_int16_put_nbi pshmem_ctx_int16_put_nbi +#define shmem_ctx_int32_put_nbi pshmem_ctx_int32_put_nbi +#define shmem_ctx_int64_put_nbi pshmem_ctx_int64_put_nbi +#define shmem_ctx_uint8_put_nbi pshmem_ctx_uint8_put_nbi +#define shmem_ctx_uint16_put_nbi pshmem_ctx_uint16_put_nbi +#define shmem_ctx_uint32_put_nbi pshmem_ctx_uint32_put_nbi +#define shmem_ctx_uint64_put_nbi pshmem_ctx_uint64_put_nbi +#define shmem_ctx_size_put_nbi pshmem_ctx_size_put_nbi +#define shmem_ctx_ptrdiff_put_nbi pshmem_ctx_ptrdiff_put_nbi #define shmem_char_put_nbi pshmem_char_put_nbi #define shmem_short_put_nbi pshmem_short_put_nbi @@ -231,6 +300,16 @@ #define shmem_ulong_put_nbi pshmem_ulong_put_nbi #define shmem_ulonglong_put_nbi pshmem_ulonglong_put_nbi #define shmem_longdouble_put_nbi pshmem_longdouble_put_nbi +#define shmem_int8_put_nbi pshmem_int8_put_nbi +#define shmem_int16_put_nbi pshmem_int16_put_nbi +#define shmem_int32_put_nbi pshmem_int32_put_nbi +#define shmem_int64_put_nbi pshmem_int64_put_nbi +#define shmem_uint8_put_nbi pshmem_uint8_put_nbi +#define shmem_uint16_put_nbi pshmem_uint16_put_nbi +#define shmem_uint32_put_nbi pshmem_uint32_put_nbi +#define shmem_uint64_put_nbi pshmem_uint64_put_nbi +#define shmem_size_put_nbi pshmem_size_put_nbi +#define shmem_ptrdiff_put_nbi pshmem_ptrdiff_put_nbi #define shmem_ctx_put8_nbi pshmem_ctx_put8_nbi #define shmem_ctx_put16_nbi pshmem_ctx_put16_nbi @@ -263,6 +342,16 @@ #define shmem_ctx_ulong_g pshmem_ctx_ulong_g #define shmem_ctx_ulonglong_g pshmem_ctx_ulonglong_g #define shmem_ctx_longdouble_g pshmem_ctx_longdouble_g +#define shmem_ctx_int8_g pshmem_ctx_int8_g +#define shmem_ctx_int16_g pshmem_ctx_int16_g +#define shmem_ctx_int32_g pshmem_ctx_int32_g +#define shmem_ctx_int64_g pshmem_ctx_int64_g +#define shmem_ctx_uint8_g pshmem_ctx_uint8_g +#define shmem_ctx_uint16_g pshmem_ctx_uint16_g +#define shmem_ctx_uint32_g pshmem_ctx_uint32_g +#define shmem_ctx_uint64_g pshmem_ctx_uint64_g +#define shmem_ctx_size_g pshmem_ctx_size_g +#define shmem_ctx_ptrdiff_g pshmem_ctx_ptrdiff_g #define shmem_char_g pshmem_char_g #define shmem_short_g pshmem_short_g @@ -278,6 +367,16 @@ #define shmem_ulong_g pshmem_ulong_g #define shmem_ulonglong_g pshmem_ulonglong_g #define shmem_longdouble_g pshmem_longdouble_g +#define shmem_int8_g pshmem_int8_g +#define shmem_int16_g pshmem_int16_g +#define shmem_int32_g pshmem_int32_g +#define shmem_int64_g pshmem_int64_g +#define shmem_uint8_g pshmem_uint8_g +#define shmem_uint16_g pshmem_uint16_g +#define shmem_uint32_g pshmem_uint32_g +#define shmem_uint64_g pshmem_uint64_g +#define shmem_size_g pshmem_size_g +#define shmem_ptrdiff_g pshmem_ptrdiff_g #define shmemx_int16_g pshmemx_int16_g #define shmemx_int32_g pshmemx_int32_g @@ -300,6 +399,16 @@ #define shmem_ctx_ulong_get pshmem_ctx_ulong_get #define shmem_ctx_ulonglong_get pshmem_ctx_ulonglong_get #define shmem_ctx_longdouble_get pshmem_ctx_longdouble_get +#define shmem_ctx_int8_get pshmem_ctx_int8_get +#define shmem_ctx_int16_get pshmem_ctx_int16_get +#define shmem_ctx_int32_get pshmem_ctx_int32_get +#define shmem_ctx_int64_get pshmem_ctx_int64_get +#define shmem_ctx_uint8_get pshmem_ctx_uint8_get +#define shmem_ctx_uint16_get pshmem_ctx_uint16_get +#define shmem_ctx_uint32_get pshmem_ctx_uint32_get +#define shmem_ctx_uint64_get pshmem_ctx_uint64_get +#define shmem_ctx_size_get pshmem_ctx_size_get +#define shmem_ctx_ptrdiff_get pshmem_ctx_ptrdiff_get #define shmem_char_get pshmem_char_get /* shmem-compat.h */ #define shmem_short_get pshmem_short_get @@ -315,6 +424,16 @@ #define shmem_ulong_get pshmem_ulong_get #define shmem_ulonglong_get pshmem_ulonglong_get #define shmem_longdouble_get pshmem_longdouble_get +#define shmem_int8_get pshmem_int8_get +#define shmem_int16_get pshmem_int16_get +#define shmem_int32_get pshmem_int32_get +#define shmem_int64_get pshmem_int64_get +#define shmem_uint8_get pshmem_uint8_get +#define shmem_uint16_get pshmem_uint16_get +#define shmem_uint32_get pshmem_uint32_get +#define shmem_uint64_get pshmem_uint64_get +#define shmem_size_get pshmem_size_get +#define shmem_ptrdiff_get pshmem_ptrdiff_get #define shmem_ctx_get8 pshmem_ctx_get8 #define shmem_ctx_get16 pshmem_ctx_get16 @@ -347,6 +466,16 @@ #define shmem_ctx_ulong_iget pshmem_ctx_ulong_iget #define shmem_ctx_ulonglong_iget pshmem_ctx_ulonglong_iget #define shmem_ctx_longdouble_iget pshmem_ctx_longdouble_iget +#define shmem_ctx_int8_iget pshmem_ctx_int8_iget +#define shmem_ctx_int16_iget pshmem_ctx_int16_iget +#define shmem_ctx_int32_iget pshmem_ctx_int32_iget +#define shmem_ctx_int64_iget pshmem_ctx_int64_iget +#define shmem_ctx_uint8_iget pshmem_ctx_uint8_iget +#define shmem_ctx_uint16_iget pshmem_ctx_uint16_iget +#define shmem_ctx_uint32_iget pshmem_ctx_uint32_iget +#define shmem_ctx_uint64_iget pshmem_ctx_uint64_iget +#define shmem_ctx_size_iget pshmem_ctx_size_iget +#define shmem_ctx_ptrdiff_iget pshmem_ctx_ptrdiff_iget #define shmem_char_iget pshmem_char_iget #define shmem_short_iget pshmem_short_iget @@ -362,6 +491,16 @@ #define shmem_ulong_iget pshmem_ulong_iget #define shmem_ulonglong_iget pshmem_ulonglong_iget #define shmem_longdouble_iget pshmem_longdouble_iget +#define shmem_int8_iget pshmem_int8_iget +#define shmem_int16_iget pshmem_int16_iget +#define shmem_int32_iget pshmem_int32_iget +#define shmem_int64_iget pshmem_int64_iget +#define shmem_uint8_iget pshmem_uint8_iget +#define shmem_uint16_iget pshmem_uint16_iget +#define shmem_uint32_iget pshmem_uint32_iget +#define shmem_uint64_iget pshmem_uint64_iget +#define shmem_size_iget pshmem_size_iget +#define shmem_ptrdiff_iget pshmem_ptrdiff_iget #define shmem_ctx_iget8 pshmem_ctx_iget8 #define shmem_ctx_iget16 pshmem_ctx_iget16 @@ -392,6 +531,16 @@ #define shmem_ctx_ulong_get_nbi pshmem_ctx_ulong_get_nbi #define shmem_ctx_ulonglong_get_nbi pshmem_ctx_ulonglong_get_nbi #define shmem_ctx_longdouble_get_nbi pshmem_ctx_longdouble_get_nbi +#define shmem_ctx_int8_get_nbi pshmem_ctx_int8_get_nbi +#define shmem_ctx_int16_get_nbi pshmem_ctx_int16_get_nbi +#define shmem_ctx_int32_get_nbi pshmem_ctx_int32_get_nbi +#define shmem_ctx_int64_get_nbi pshmem_ctx_int64_get_nbi +#define shmem_ctx_uint8_get_nbi pshmem_ctx_uint8_get_nbi +#define shmem_ctx_uint16_get_nbi pshmem_ctx_uint16_get_nbi +#define shmem_ctx_uint32_get_nbi pshmem_ctx_uint32_get_nbi +#define shmem_ctx_uint64_get_nbi pshmem_ctx_uint64_get_nbi +#define shmem_ctx_size_get_nbi pshmem_ctx_size_get_nbi +#define shmem_ctx_ptrdiff_get_nbi pshmem_ctx_ptrdiff_get_nbi #define shmem_char_get_nbi pshmem_char_get_nbi #define shmem_short_get_nbi pshmem_short_get_nbi @@ -407,6 +556,16 @@ #define shmem_ulong_get_nbi pshmem_ulong_get_nbi #define shmem_ulonglong_get_nbi pshmem_ulonglong_get_nbi #define shmem_longdouble_get_nbi pshmem_longdouble_get_nbi +#define shmem_int8_get_nbi pshmem_int8_get_nbi +#define shmem_int16_get_nbi pshmem_int16_get_nbi +#define shmem_int32_get_nbi pshmem_int32_get_nbi +#define shmem_int64_get_nbi pshmem_int64_get_nbi +#define shmem_uint8_get_nbi pshmem_uint8_get_nbi +#define shmem_uint16_get_nbi pshmem_uint16_get_nbi +#define shmem_uint32_get_nbi pshmem_uint32_get_nbi +#define shmem_uint64_get_nbi pshmem_uint64_get_nbi +#define shmem_size_get_nbi pshmem_size_get_nbi +#define shmem_ptrdiff_get_nbi pshmem_ptrdiff_get_nbi #define shmem_ctx_get8_nbi pshmem_ctx_get8_nbi #define shmem_ctx_get16_nbi pshmem_ctx_get16_nbi diff --git a/oshmem/shmem/c/shmem_g.c b/oshmem/shmem/c/shmem_g.c index 112953060ed..aa96afaba68 100644 --- a/oshmem/shmem/c/shmem_g.c +++ b/oshmem/shmem/c/shmem_g.c @@ -58,35 +58,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_g = pshmem_ctx_char_g -#pragma weak shmem_ctx_short_g = pshmem_ctx_short_g -#pragma weak shmem_ctx_int_g = pshmem_ctx_int_g -#pragma weak shmem_ctx_long_g = pshmem_ctx_long_g -#pragma weak shmem_ctx_longlong_g = pshmem_ctx_longlong_g -#pragma weak shmem_ctx_schar_g = pshmem_ctx_schar_g -#pragma weak shmem_ctx_uchar_g = pshmem_ctx_uchar_g -#pragma weak shmem_ctx_ushort_g = pshmem_ctx_ushort_g -#pragma weak shmem_ctx_uint_g = pshmem_ctx_uint_g -#pragma weak shmem_ctx_ulong_g = pshmem_ctx_ulong_g -#pragma weak shmem_ctx_ulonglong_g = pshmem_ctx_ulonglong_g -#pragma weak shmem_ctx_float_g = pshmem_ctx_float_g -#pragma weak shmem_ctx_double_g = pshmem_ctx_double_g +#pragma weak shmem_ctx_char_g = pshmem_ctx_char_g +#pragma weak shmem_ctx_short_g = pshmem_ctx_short_g +#pragma weak shmem_ctx_int_g = pshmem_ctx_int_g +#pragma weak shmem_ctx_long_g = pshmem_ctx_long_g +#pragma weak shmem_ctx_float_g = pshmem_ctx_float_g +#pragma weak shmem_ctx_double_g = pshmem_ctx_double_g +#pragma weak shmem_ctx_longlong_g = pshmem_ctx_longlong_g +#pragma weak shmem_ctx_schar_g = pshmem_ctx_schar_g +#pragma weak shmem_ctx_uchar_g = pshmem_ctx_uchar_g +#pragma weak shmem_ctx_ushort_g = pshmem_ctx_ushort_g +#pragma weak shmem_ctx_uint_g = pshmem_ctx_uint_g +#pragma weak shmem_ctx_ulong_g = pshmem_ctx_ulong_g +#pragma weak shmem_ctx_ulonglong_g = pshmem_ctx_ulonglong_g #pragma weak shmem_ctx_longdouble_g = pshmem_ctx_longdouble_g +#pragma weak shmem_ctx_int8_g = pshmem_ctx_int8_g +#pragma weak shmem_ctx_int16_g = pshmem_ctx_int16_g +#pragma weak shmem_ctx_int32_g = pshmem_ctx_int32_g +#pragma weak shmem_ctx_int64_g = pshmem_ctx_int64_g +#pragma weak shmem_ctx_uint8_g = pshmem_ctx_uint8_g +#pragma weak shmem_ctx_uint16_g = pshmem_ctx_uint16_g +#pragma weak shmem_ctx_uint32_g = pshmem_ctx_uint32_g +#pragma weak shmem_ctx_uint64_g = pshmem_ctx_uint64_g +#pragma weak shmem_ctx_size_g = pshmem_ctx_size_g +#pragma weak shmem_ctx_ptrdiff_g = pshmem_ctx_ptrdiff_g -#pragma weak shmem_char_g = pshmem_char_g -#pragma weak shmem_short_g = pshmem_short_g -#pragma weak shmem_int_g = pshmem_int_g -#pragma weak shmem_long_g = pshmem_long_g -#pragma weak shmem_longlong_g = pshmem_longlong_g -#pragma weak shmem_schar_g = pshmem_schar_g -#pragma weak shmem_uchar_g = pshmem_uchar_g -#pragma weak shmem_ushort_g = pshmem_ushort_g -#pragma weak shmem_uint_g = pshmem_uint_g -#pragma weak shmem_ulong_g = pshmem_ulong_g -#pragma weak shmem_ulonglong_g = pshmem_ulonglong_g -#pragma weak shmem_float_g = pshmem_float_g -#pragma weak shmem_double_g = pshmem_double_g -#pragma weak shmem_longdouble_g = pshmem_longdouble_g +#pragma weak shmem_char_g = pshmem_char_g +#pragma weak shmem_short_g = pshmem_short_g +#pragma weak shmem_int_g = pshmem_int_g +#pragma weak shmem_long_g = pshmem_long_g +#pragma weak shmem_float_g = pshmem_float_g +#pragma weak shmem_double_g = pshmem_double_g +#pragma weak shmem_longlong_g = pshmem_longlong_g +#pragma weak shmem_schar_g = pshmem_schar_g +#pragma weak shmem_uchar_g = pshmem_uchar_g +#pragma weak shmem_ushort_g = pshmem_ushort_g +#pragma weak shmem_uint_g = pshmem_uint_g +#pragma weak shmem_ulong_g = pshmem_ulong_g +#pragma weak shmem_ulonglong_g = pshmem_ulonglong_g +#pragma weak shmem_longdouble_g = pshmem_longdouble_g +#pragma weak shmem_int8_g = pshmem_int8_g +#pragma weak shmem_int16_g = pshmem_int16_g +#pragma weak shmem_int32_g = pshmem_int32_g +#pragma weak shmem_int64_g = pshmem_int64_g +#pragma weak shmem_uint8_g = pshmem_uint8_g +#pragma weak shmem_uint16_g = pshmem_uint16_g +#pragma weak shmem_uint32_g = pshmem_uint32_g +#pragma weak shmem_uint64_g = pshmem_uint64_g +#pragma weak shmem_size_g = pshmem_size_g +#pragma weak shmem_ptrdiff_g = pshmem_ptrdiff_g #pragma weak shmemx_int16_g = pshmemx_int16_g #pragma weak shmemx_int32_g = pshmemx_int32_g @@ -108,6 +128,17 @@ SHMEM_CTX_TYPE_G(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_G(_float, float, shmem) SHMEM_CTX_TYPE_G(_double, double, shmem) SHMEM_CTX_TYPE_G(_longdouble, long double, shmem) +SHMEM_CTX_TYPE_G(_int8, int8_t, shmem) +SHMEM_CTX_TYPE_G(_int16, int16_t, shmem) +SHMEM_CTX_TYPE_G(_int32, int32_t, shmem) +SHMEM_CTX_TYPE_G(_int64, int64_t, shmem) +SHMEM_CTX_TYPE_G(_uint8, uint8_t, shmem) +SHMEM_CTX_TYPE_G(_uint16, uint16_t, shmem) +SHMEM_CTX_TYPE_G(_uint32, uint32_t, shmem) +SHMEM_CTX_TYPE_G(_uint64, uint64_t, shmem) +SHMEM_CTX_TYPE_G(_size, size_t, shmem) +SHMEM_CTX_TYPE_G(_ptrdiff, ptrdiff_t, shmem) + SHMEM_TYPE_G(_char, char, shmem) SHMEM_TYPE_G(_short, short, shmem) SHMEM_TYPE_G(_int, int, shmem) @@ -122,6 +153,17 @@ SHMEM_TYPE_G(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_G(_float, float, shmem) SHMEM_TYPE_G(_double, double, shmem) SHMEM_TYPE_G(_longdouble, long double, shmem) +SHMEM_TYPE_G(_int8, int8_t, shmem) +SHMEM_TYPE_G(_int16, int16_t, shmem) +SHMEM_TYPE_G(_int32, int32_t, shmem) +SHMEM_TYPE_G(_int64, int64_t, shmem) +SHMEM_TYPE_G(_uint8, uint8_t, shmem) +SHMEM_TYPE_G(_uint16, uint16_t, shmem) +SHMEM_TYPE_G(_uint32, uint32_t, shmem) +SHMEM_TYPE_G(_uint64, uint64_t, shmem) +SHMEM_TYPE_G(_size, size_t, shmem) +SHMEM_TYPE_G(_ptrdiff, ptrdiff_t, shmem) + SHMEM_TYPE_G(_int16, int16_t, shmemx) SHMEM_TYPE_G(_int32, int32_t, shmemx) SHMEM_TYPE_G(_int64, int64_t, shmemx) diff --git a/oshmem/shmem/c/shmem_get.c b/oshmem/shmem/c/shmem_get.c index 8270cbe645a..452557fdd6a 100644 --- a/oshmem/shmem/c/shmem_get.c +++ b/oshmem/shmem/c/shmem_get.c @@ -57,35 +57,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_get = pshmem_ctx_char_get -#pragma weak shmem_ctx_short_get = pshmem_ctx_short_get -#pragma weak shmem_ctx_int_get = pshmem_ctx_int_get -#pragma weak shmem_ctx_long_get = pshmem_ctx_long_get -#pragma weak shmem_ctx_longlong_get = pshmem_ctx_longlong_get -#pragma weak shmem_ctx_schar_get = pshmem_ctx_schar_get -#pragma weak shmem_ctx_uchar_get = pshmem_ctx_uchar_get -#pragma weak shmem_ctx_ushort_get = pshmem_ctx_ushort_get -#pragma weak shmem_ctx_uint_get = pshmem_ctx_uint_get -#pragma weak shmem_ctx_ulong_get = pshmem_ctx_ulong_get -#pragma weak shmem_ctx_ulonglong_get = pshmem_ctx_ulonglong_get -#pragma weak shmem_ctx_float_get = pshmem_ctx_float_get -#pragma weak shmem_ctx_double_get = pshmem_ctx_double_get +#pragma weak shmem_ctx_char_get = pshmem_ctx_char_get +#pragma weak shmem_ctx_short_get = pshmem_ctx_short_get +#pragma weak shmem_ctx_int_get = pshmem_ctx_int_get +#pragma weak shmem_ctx_long_get = pshmem_ctx_long_get +#pragma weak shmem_ctx_float_get = pshmem_ctx_float_get +#pragma weak shmem_ctx_double_get = pshmem_ctx_double_get +#pragma weak shmem_ctx_longlong_get = pshmem_ctx_longlong_get +#pragma weak shmem_ctx_schar_get = pshmem_ctx_schar_get +#pragma weak shmem_ctx_uchar_get = pshmem_ctx_uchar_get +#pragma weak shmem_ctx_ushort_get = pshmem_ctx_ushort_get +#pragma weak shmem_ctx_uint_get = pshmem_ctx_uint_get +#pragma weak shmem_ctx_ulong_get = pshmem_ctx_ulong_get +#pragma weak shmem_ctx_ulonglong_get = pshmem_ctx_ulonglong_get #pragma weak shmem_ctx_longdouble_get = pshmem_ctx_longdouble_get - -#pragma weak shmem_char_get = pshmem_char_get -#pragma weak shmem_short_get = pshmem_short_get -#pragma weak shmem_int_get = pshmem_int_get -#pragma weak shmem_long_get = pshmem_long_get -#pragma weak shmem_longlong_get = pshmem_longlong_get -#pragma weak shmem_schar_get = pshmem_schar_get -#pragma weak shmem_uchar_get = pshmem_uchar_get -#pragma weak shmem_ushort_get = pshmem_ushort_get -#pragma weak shmem_uint_get = pshmem_uint_get -#pragma weak shmem_ulong_get = pshmem_ulong_get -#pragma weak shmem_ulonglong_get = pshmem_ulonglong_get -#pragma weak shmem_float_get = pshmem_float_get -#pragma weak shmem_double_get = pshmem_double_get -#pragma weak shmem_longdouble_get = pshmem_longdouble_get +#pragma weak shmem_ctx_int8_get = pshmem_ctx_int8_get +#pragma weak shmem_ctx_int16_get = pshmem_ctx_int16_get +#pragma weak shmem_ctx_int32_get = pshmem_ctx_int32_get +#pragma weak shmem_ctx_int64_get = pshmem_ctx_int64_get +#pragma weak shmem_ctx_uint8_get = pshmem_ctx_uint8_get +#pragma weak shmem_ctx_uint16_get = pshmem_ctx_uint16_get +#pragma weak shmem_ctx_uint32_get = pshmem_ctx_uint32_get +#pragma weak shmem_ctx_uint64_get = pshmem_ctx_uint64_get +#pragma weak shmem_ctx_size_get = pshmem_ctx_size_get +#pragma weak shmem_ctx_ptrdiff_get = pshmem_ctx_ptrdiff_get + +#pragma weak shmem_char_get = pshmem_char_get +#pragma weak shmem_short_get = pshmem_short_get +#pragma weak shmem_int_get = pshmem_int_get +#pragma weak shmem_long_get = pshmem_long_get +#pragma weak shmem_float_get = pshmem_float_get +#pragma weak shmem_double_get = pshmem_double_get +#pragma weak shmem_longlong_get = pshmem_longlong_get +#pragma weak shmem_schar_get = pshmem_schar_get +#pragma weak shmem_uchar_get = pshmem_uchar_get +#pragma weak shmem_ushort_get = pshmem_ushort_get +#pragma weak shmem_uint_get = pshmem_uint_get +#pragma weak shmem_ulong_get = pshmem_ulong_get +#pragma weak shmem_ulonglong_get = pshmem_ulonglong_get +#pragma weak shmem_longdouble_get = pshmem_longdouble_get +#pragma weak shmem_int8_get = pshmem_int8_get +#pragma weak shmem_int16_get = pshmem_int16_get +#pragma weak shmem_int32_get = pshmem_int32_get +#pragma weak shmem_int64_get = pshmem_int64_get +#pragma weak shmem_uint8_get = pshmem_uint8_get +#pragma weak shmem_uint16_get = pshmem_uint16_get +#pragma weak shmem_uint32_get = pshmem_uint32_get +#pragma weak shmem_uint64_get = pshmem_uint64_get +#pragma weak shmem_size_get = pshmem_size_get +#pragma weak shmem_ptrdiff_get = pshmem_ptrdiff_get #pragma weak shmem_ctx_getmem = pshmem_ctx_getmem #pragma weak shmem_ctx_get8 = pshmem_ctx_get8 @@ -117,6 +137,17 @@ SHMEM_CTX_TYPE_GET(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_GET(_float, float) SHMEM_CTX_TYPE_GET(_double, double) SHMEM_CTX_TYPE_GET(_longdouble, long double) +SHMEM_CTX_TYPE_GET(_int8, int8_t) +SHMEM_CTX_TYPE_GET(_int16, int16_t) +SHMEM_CTX_TYPE_GET(_int32, int32_t) +SHMEM_CTX_TYPE_GET(_int64, int64_t) +SHMEM_CTX_TYPE_GET(_uint8, uint8_t) +SHMEM_CTX_TYPE_GET(_uint16, uint16_t) +SHMEM_CTX_TYPE_GET(_uint32, uint32_t) +SHMEM_CTX_TYPE_GET(_uint64, uint64_t) +SHMEM_CTX_TYPE_GET(_size, size_t) +SHMEM_CTX_TYPE_GET(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_GET(_char, char) SHMEM_TYPE_GET(_short, short) SHMEM_TYPE_GET(_int, int) @@ -131,6 +162,16 @@ SHMEM_TYPE_GET(_ulonglong, unsigned long long) SHMEM_TYPE_GET(_float, float) SHMEM_TYPE_GET(_double, double) SHMEM_TYPE_GET(_longdouble, long double) +SHMEM_TYPE_GET(_int8, int8_t) +SHMEM_TYPE_GET(_int16, int16_t) +SHMEM_TYPE_GET(_int32, int32_t) +SHMEM_TYPE_GET(_int64, int64_t) +SHMEM_TYPE_GET(_uint8, uint8_t) +SHMEM_TYPE_GET(_uint16, uint16_t) +SHMEM_TYPE_GET(_uint32, uint32_t) +SHMEM_TYPE_GET(_uint64, uint64_t) +SHMEM_TYPE_GET(_size, size_t) +SHMEM_TYPE_GET(_ptrdiff, ptrdiff_t) #define DO_SHMEM_GETMEM(ctx, target, source, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ diff --git a/oshmem/shmem/c/shmem_get_nb.c b/oshmem/shmem/c/shmem_get_nb.c index 7afe4412c1f..877b7ac0201 100644 --- a/oshmem/shmem/c/shmem_get_nb.c +++ b/oshmem/shmem/c/shmem_get_nb.c @@ -57,35 +57,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_get_nbi = pshmem_ctx_char_get_nbi -#pragma weak shmem_ctx_short_get_nbi = pshmem_ctx_short_get_nbi -#pragma weak shmem_ctx_int_get_nbi = pshmem_ctx_int_get_nbi -#pragma weak shmem_ctx_long_get_nbi = pshmem_ctx_long_get_nbi -#pragma weak shmem_ctx_longlong_get_nbi = pshmem_ctx_longlong_get_nbi -#pragma weak shmem_ctx_schar_get_nbi = pshmem_ctx_schar_get_nbi -#pragma weak shmem_ctx_uchar_get_nbi = pshmem_ctx_uchar_get_nbi -#pragma weak shmem_ctx_ushort_get_nbi = pshmem_ctx_ushort_get_nbi -#pragma weak shmem_ctx_uint_get_nbi = pshmem_ctx_uint_get_nbi -#pragma weak shmem_ctx_ulong_get_nbi = pshmem_ctx_ulong_get_nbi -#pragma weak shmem_ctx_ulonglong_get_nbi = pshmem_ctx_ulonglong_get_nbi -#pragma weak shmem_ctx_float_get_nbi = pshmem_ctx_float_get_nbi -#pragma weak shmem_ctx_double_get_nbi = pshmem_ctx_double_get_nbi +#pragma weak shmem_ctx_char_get_nbi = pshmem_ctx_char_get_nbi +#pragma weak shmem_ctx_short_get_nbi = pshmem_ctx_short_get_nbi +#pragma weak shmem_ctx_int_get_nbi = pshmem_ctx_int_get_nbi +#pragma weak shmem_ctx_long_get_nbi = pshmem_ctx_long_get_nbi +#pragma weak shmem_ctx_float_get_nbi = pshmem_ctx_float_get_nbi +#pragma weak shmem_ctx_double_get_nbi = pshmem_ctx_double_get_nbi +#pragma weak shmem_ctx_longlong_get_nbi = pshmem_ctx_longlong_get_nbi +#pragma weak shmem_ctx_schar_get_nbi = pshmem_ctx_schar_get_nbi +#pragma weak shmem_ctx_uchar_get_nbi = pshmem_ctx_uchar_get_nbi +#pragma weak shmem_ctx_ushort_get_nbi = pshmem_ctx_ushort_get_nbi +#pragma weak shmem_ctx_uint_get_nbi = pshmem_ctx_uint_get_nbi +#pragma weak shmem_ctx_ulong_get_nbi = pshmem_ctx_ulong_get_nbi +#pragma weak shmem_ctx_ulonglong_get_nbi = pshmem_ctx_ulonglong_get_nbi #pragma weak shmem_ctx_longdouble_get_nbi = pshmem_ctx_longdouble_get_nbi +#pragma weak shmem_ctx_int8_get_nbi = pshmem_ctx_int8_get_nbi +#pragma weak shmem_ctx_int16_get_nbi = pshmem_ctx_int16_get_nbi +#pragma weak shmem_ctx_int32_get_nbi = pshmem_ctx_int32_get_nbi +#pragma weak shmem_ctx_int64_get_nbi = pshmem_ctx_int64_get_nbi +#pragma weak shmem_ctx_uint8_get_nbi = pshmem_ctx_uint8_get_nbi +#pragma weak shmem_ctx_uint16_get_nbi = pshmem_ctx_uint16_get_nbi +#pragma weak shmem_ctx_uint32_get_nbi = pshmem_ctx_uint32_get_nbi +#pragma weak shmem_ctx_uint64_get_nbi = pshmem_ctx_uint64_get_nbi +#pragma weak shmem_ctx_size_get_nbi = pshmem_ctx_size_get_nbi +#pragma weak shmem_ctx_ptrdiff_get_nbi = pshmem_ctx_ptrdiff_get_nbi -#pragma weak shmem_char_get_nbi = pshmem_char_get_nbi -#pragma weak shmem_short_get_nbi = pshmem_short_get_nbi -#pragma weak shmem_int_get_nbi = pshmem_int_get_nbi -#pragma weak shmem_long_get_nbi = pshmem_long_get_nbi -#pragma weak shmem_longlong_get_nbi = pshmem_longlong_get_nbi -#pragma weak shmem_schar_get_nbi = pshmem_schar_get_nbi -#pragma weak shmem_uchar_get_nbi = pshmem_uchar_get_nbi -#pragma weak shmem_ushort_get_nbi = pshmem_ushort_get_nbi -#pragma weak shmem_uint_get_nbi = pshmem_uint_get_nbi -#pragma weak shmem_ulong_get_nbi = pshmem_ulong_get_nbi -#pragma weak shmem_ulonglong_get_nbi = pshmem_ulonglong_get_nbi -#pragma weak shmem_float_get_nbi = pshmem_float_get_nbi -#pragma weak shmem_double_get_nbi = pshmem_double_get_nbi -#pragma weak shmem_longdouble_get_nbi = pshmem_longdouble_get_nbi +#pragma weak shmem_char_get_nbi = pshmem_char_get_nbi +#pragma weak shmem_short_get_nbi = pshmem_short_get_nbi +#pragma weak shmem_int_get_nbi = pshmem_int_get_nbi +#pragma weak shmem_long_get_nbi = pshmem_long_get_nbi +#pragma weak shmem_float_get_nbi = pshmem_float_get_nbi +#pragma weak shmem_double_get_nbi = pshmem_double_get_nbi +#pragma weak shmem_longlong_get_nbi = pshmem_longlong_get_nbi +#pragma weak shmem_schar_get_nbi = pshmem_schar_get_nbi +#pragma weak shmem_uchar_get_nbi = pshmem_uchar_get_nbi +#pragma weak shmem_ushort_get_nbi = pshmem_ushort_get_nbi +#pragma weak shmem_uint_get_nbi = pshmem_uint_get_nbi +#pragma weak shmem_ulong_get_nbi = pshmem_ulong_get_nbi +#pragma weak shmem_ulonglong_get_nbi = pshmem_ulonglong_get_nbi +#pragma weak shmem_longdouble_get_nbi = pshmem_longdouble_get_nbi +#pragma weak shmem_int8_get_nbi = pshmem_int8_get_nbi +#pragma weak shmem_int16_get_nbi = pshmem_int16_get_nbi +#pragma weak shmem_int32_get_nbi = pshmem_int32_get_nbi +#pragma weak shmem_int64_get_nbi = pshmem_int64_get_nbi +#pragma weak shmem_uint8_get_nbi = pshmem_uint8_get_nbi +#pragma weak shmem_uint16_get_nbi = pshmem_uint16_get_nbi +#pragma weak shmem_uint32_get_nbi = pshmem_uint32_get_nbi +#pragma weak shmem_uint64_get_nbi = pshmem_uint64_get_nbi +#pragma weak shmem_size_get_nbi = pshmem_size_get_nbi +#pragma weak shmem_ptrdiff_get_nbi = pshmem_ptrdiff_get_nbi #pragma weak shmem_ctx_get8_nbi = pshmem_ctx_get8_nbi #pragma weak shmem_ctx_get16_nbi = pshmem_ctx_get16_nbi @@ -117,6 +137,17 @@ SHMEM_CTX_TYPE_GET_NB(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_GET_NB(_float, float) SHMEM_CTX_TYPE_GET_NB(_double, double) SHMEM_CTX_TYPE_GET_NB(_longdouble, long double) +SHMEM_CTX_TYPE_GET_NB(_int8, int8_t) +SHMEM_CTX_TYPE_GET_NB(_int16, int16_t) +SHMEM_CTX_TYPE_GET_NB(_int32, int32_t) +SHMEM_CTX_TYPE_GET_NB(_int64, int64_t) +SHMEM_CTX_TYPE_GET_NB(_uint8, uint8_t) +SHMEM_CTX_TYPE_GET_NB(_uint16, uint16_t) +SHMEM_CTX_TYPE_GET_NB(_uint32, uint32_t) +SHMEM_CTX_TYPE_GET_NB(_uint64, uint64_t) +SHMEM_CTX_TYPE_GET_NB(_size, size_t) +SHMEM_CTX_TYPE_GET_NB(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_GET_NB(_char, char) SHMEM_TYPE_GET_NB(_short, short) SHMEM_TYPE_GET_NB(_int, int) @@ -131,6 +162,16 @@ SHMEM_TYPE_GET_NB(_ulonglong, unsigned long long) SHMEM_TYPE_GET_NB(_float, float) SHMEM_TYPE_GET_NB(_double, double) SHMEM_TYPE_GET_NB(_longdouble, long double) +SHMEM_TYPE_GET_NB(_int8, int8_t) +SHMEM_TYPE_GET_NB(_int16, int16_t) +SHMEM_TYPE_GET_NB(_int32, int32_t) +SHMEM_TYPE_GET_NB(_int64, int64_t) +SHMEM_TYPE_GET_NB(_uint8, uint8_t) +SHMEM_TYPE_GET_NB(_uint16, uint16_t) +SHMEM_TYPE_GET_NB(_uint32, uint32_t) +SHMEM_TYPE_GET_NB(_uint64, uint64_t) +SHMEM_TYPE_GET_NB(_size, size_t) +SHMEM_TYPE_GET_NB(_ptrdiff, ptrdiff_t) #define DO_SHMEM_GETMEM_NB(ctx, target, source, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ diff --git a/oshmem/shmem/c/shmem_iget.c b/oshmem/shmem/c/shmem_iget.c index 30e82a2366e..eb4d31cf802 100644 --- a/oshmem/shmem/c/shmem_iget.c +++ b/oshmem/shmem/c/shmem_iget.c @@ -62,35 +62,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_iget = pshmem_ctx_char_iget -#pragma weak shmem_ctx_short_iget = pshmem_ctx_short_iget -#pragma weak shmem_ctx_int_iget = pshmem_ctx_int_iget -#pragma weak shmem_ctx_long_iget = pshmem_ctx_long_iget -#pragma weak shmem_ctx_longlong_iget = pshmem_ctx_longlong_iget -#pragma weak shmem_ctx_schar_iget = pshmem_ctx_schar_iget -#pragma weak shmem_ctx_uchar_iget = pshmem_ctx_uchar_iget -#pragma weak shmem_ctx_ushort_iget = pshmem_ctx_ushort_iget -#pragma weak shmem_ctx_uint_iget = pshmem_ctx_uint_iget -#pragma weak shmem_ctx_ulong_iget = pshmem_ctx_ulong_iget -#pragma weak shmem_ctx_ulonglong_iget = pshmem_ctx_ulonglong_iget -#pragma weak shmem_ctx_float_iget = pshmem_ctx_float_iget -#pragma weak shmem_ctx_double_iget = pshmem_ctx_double_iget +#pragma weak shmem_ctx_char_iget = pshmem_ctx_char_iget +#pragma weak shmem_ctx_short_iget = pshmem_ctx_short_iget +#pragma weak shmem_ctx_int_iget = pshmem_ctx_int_iget +#pragma weak shmem_ctx_long_iget = pshmem_ctx_long_iget +#pragma weak shmem_ctx_float_iget = pshmem_ctx_float_iget +#pragma weak shmem_ctx_double_iget = pshmem_ctx_double_iget +#pragma weak shmem_ctx_longlong_iget = pshmem_ctx_longlong_iget +#pragma weak shmem_ctx_schar_iget = pshmem_ctx_schar_iget +#pragma weak shmem_ctx_uchar_iget = pshmem_ctx_uchar_iget +#pragma weak shmem_ctx_ushort_iget = pshmem_ctx_ushort_iget +#pragma weak shmem_ctx_uint_iget = pshmem_ctx_uint_iget +#pragma weak shmem_ctx_ulong_iget = pshmem_ctx_ulong_iget +#pragma weak shmem_ctx_ulonglong_iget = pshmem_ctx_ulonglong_iget #pragma weak shmem_ctx_longdouble_iget = pshmem_ctx_longdouble_iget - -#pragma weak shmem_char_iget = pshmem_char_iget -#pragma weak shmem_short_iget = pshmem_short_iget -#pragma weak shmem_int_iget = pshmem_int_iget -#pragma weak shmem_long_iget = pshmem_long_iget -#pragma weak shmem_longlong_iget = pshmem_longlong_iget -#pragma weak shmem_schar_iget = pshmem_schar_iget -#pragma weak shmem_uchar_iget = pshmem_uchar_iget -#pragma weak shmem_ushort_iget = pshmem_ushort_iget -#pragma weak shmem_uint_iget = pshmem_uint_iget -#pragma weak shmem_ulong_iget = pshmem_ulong_iget -#pragma weak shmem_ulonglong_iget = pshmem_ulonglong_iget -#pragma weak shmem_float_iget = pshmem_float_iget -#pragma weak shmem_double_iget = pshmem_double_iget -#pragma weak shmem_longdouble_iget = pshmem_longdouble_iget +#pragma weak shmem_ctx_int8_iget = pshmem_ctx_int8_iget +#pragma weak shmem_ctx_int16_iget = pshmem_ctx_int16_iget +#pragma weak shmem_ctx_int32_iget = pshmem_ctx_int32_iget +#pragma weak shmem_ctx_int64_iget = pshmem_ctx_int64_iget +#pragma weak shmem_ctx_uint8_iget = pshmem_ctx_uint8_iget +#pragma weak shmem_ctx_uint16_iget = pshmem_ctx_uint16_iget +#pragma weak shmem_ctx_uint32_iget = pshmem_ctx_uint32_iget +#pragma weak shmem_ctx_uint64_iget = pshmem_ctx_uint64_iget +#pragma weak shmem_ctx_size_iget = pshmem_ctx_size_iget +#pragma weak shmem_ctx_ptrdiff_iget = pshmem_ctx_ptrdiff_iget + +#pragma weak shmem_char_iget = pshmem_char_iget +#pragma weak shmem_short_iget = pshmem_short_iget +#pragma weak shmem_int_iget = pshmem_int_iget +#pragma weak shmem_long_iget = pshmem_long_iget +#pragma weak shmem_float_iget = pshmem_float_iget +#pragma weak shmem_double_iget = pshmem_double_iget +#pragma weak shmem_longlong_iget = pshmem_longlong_iget +#pragma weak shmem_schar_iget = pshmem_schar_iget +#pragma weak shmem_uchar_iget = pshmem_uchar_iget +#pragma weak shmem_ushort_iget = pshmem_ushort_iget +#pragma weak shmem_uint_iget = pshmem_uint_iget +#pragma weak shmem_ulong_iget = pshmem_ulong_iget +#pragma weak shmem_ulonglong_iget = pshmem_ulonglong_iget +#pragma weak shmem_longdouble_iget = pshmem_longdouble_iget +#pragma weak shmem_int8_iget = pshmem_int8_iget +#pragma weak shmem_int16_iget = pshmem_int16_iget +#pragma weak shmem_int32_iget = pshmem_int32_iget +#pragma weak shmem_int64_iget = pshmem_int64_iget +#pragma weak shmem_uint8_iget = pshmem_uint8_iget +#pragma weak shmem_uint16_iget = pshmem_uint16_iget +#pragma weak shmem_uint32_iget = pshmem_uint32_iget +#pragma weak shmem_uint64_iget = pshmem_uint64_iget +#pragma weak shmem_size_iget = pshmem_size_iget +#pragma weak shmem_ptrdiff_iget = pshmem_ptrdiff_iget #pragma weak shmem_ctx_iget8 = pshmem_ctx_iget8 #pragma weak shmem_ctx_iget16 = pshmem_ctx_iget16 @@ -120,6 +140,17 @@ SHMEM_CTX_TYPE_IGET(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_IGET(_float, float) SHMEM_CTX_TYPE_IGET(_double, double) SHMEM_CTX_TYPE_IGET(_longdouble, long double) +SHMEM_CTX_TYPE_IGET(_int8, int8_t) +SHMEM_CTX_TYPE_IGET(_int16, int16_t) +SHMEM_CTX_TYPE_IGET(_int32, int32_t) +SHMEM_CTX_TYPE_IGET(_int64, int64_t) +SHMEM_CTX_TYPE_IGET(_uint8, uint8_t) +SHMEM_CTX_TYPE_IGET(_uint16, uint16_t) +SHMEM_CTX_TYPE_IGET(_uint32, uint32_t) +SHMEM_CTX_TYPE_IGET(_uint64, uint64_t) +SHMEM_CTX_TYPE_IGET(_size, size_t) +SHMEM_CTX_TYPE_IGET(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_IGET(_char, char) SHMEM_TYPE_IGET(_short, short) SHMEM_TYPE_IGET(_int, int) @@ -134,6 +165,16 @@ SHMEM_TYPE_IGET(_ulonglong, unsigned long long) SHMEM_TYPE_IGET(_float, float) SHMEM_TYPE_IGET(_double, double) SHMEM_TYPE_IGET(_longdouble, long double) +SHMEM_TYPE_IGET(_int8, int8_t) +SHMEM_TYPE_IGET(_int16, int16_t) +SHMEM_TYPE_IGET(_int32, int32_t) +SHMEM_TYPE_IGET(_int64, int64_t) +SHMEM_TYPE_IGET(_uint8, uint8_t) +SHMEM_TYPE_IGET(_uint16, uint16_t) +SHMEM_TYPE_IGET(_uint32, uint32_t) +SHMEM_TYPE_IGET(_uint64, uint64_t) +SHMEM_TYPE_IGET(_size, size_t) +SHMEM_TYPE_IGET(_ptrdiff, ptrdiff_t) #define DO_SHMEM_IGETMEM(ctx, target, source, tst, sst, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ diff --git a/oshmem/shmem/c/shmem_iput.c b/oshmem/shmem/c/shmem_iput.c index ffd59479ce9..0e83b6c8495 100644 --- a/oshmem/shmem/c/shmem_iput.c +++ b/oshmem/shmem/c/shmem_iput.c @@ -63,35 +63,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_iput = pshmem_ctx_char_iput -#pragma weak shmem_ctx_short_iput = pshmem_ctx_short_iput -#pragma weak shmem_ctx_int_iput = pshmem_ctx_int_iput -#pragma weak shmem_ctx_long_iput = pshmem_ctx_long_iput -#pragma weak shmem_ctx_longlong_iput = pshmem_ctx_longlong_iput -#pragma weak shmem_ctx_schar_iput = pshmem_ctx_schar_iput -#pragma weak shmem_ctx_uchar_iput = pshmem_ctx_uchar_iput -#pragma weak shmem_ctx_ushort_iput = pshmem_ctx_ushort_iput -#pragma weak shmem_ctx_uint_iput = pshmem_ctx_uint_iput -#pragma weak shmem_ctx_ulong_iput = pshmem_ctx_ulong_iput -#pragma weak shmem_ctx_ulonglong_iput = pshmem_ctx_ulonglong_iput -#pragma weak shmem_ctx_float_iput = pshmem_ctx_float_iput -#pragma weak shmem_ctx_double_iput = pshmem_ctx_double_iput +#pragma weak shmem_ctx_char_iput = pshmem_ctx_char_iput +#pragma weak shmem_ctx_short_iput = pshmem_ctx_short_iput +#pragma weak shmem_ctx_int_iput = pshmem_ctx_int_iput +#pragma weak shmem_ctx_long_iput = pshmem_ctx_long_iput +#pragma weak shmem_ctx_float_iput = pshmem_ctx_float_iput +#pragma weak shmem_ctx_double_iput = pshmem_ctx_double_iput +#pragma weak shmem_ctx_longlong_iput = pshmem_ctx_longlong_iput +#pragma weak shmem_ctx_schar_iput = pshmem_ctx_schar_iput +#pragma weak shmem_ctx_uchar_iput = pshmem_ctx_uchar_iput +#pragma weak shmem_ctx_ushort_iput = pshmem_ctx_ushort_iput +#pragma weak shmem_ctx_uint_iput = pshmem_ctx_uint_iput +#pragma weak shmem_ctx_ulong_iput = pshmem_ctx_ulong_iput +#pragma weak shmem_ctx_ulonglong_iput = pshmem_ctx_ulonglong_iput #pragma weak shmem_ctx_longdouble_iput = pshmem_ctx_longdouble_iput +#pragma weak shmem_ctx_int8_iput = pshmem_ctx_int8_iput +#pragma weak shmem_ctx_int16_iput = pshmem_ctx_int16_iput +#pragma weak shmem_ctx_int32_iput = pshmem_ctx_int32_iput +#pragma weak shmem_ctx_int64_iput = pshmem_ctx_int64_iput +#pragma weak shmem_ctx_uint8_iput = pshmem_ctx_uint8_iput +#pragma weak shmem_ctx_uint16_iput = pshmem_ctx_uint16_iput +#pragma weak shmem_ctx_uint32_iput = pshmem_ctx_uint32_iput +#pragma weak shmem_ctx_uint64_iput = pshmem_ctx_uint64_iput +#pragma weak shmem_ctx_size_iput = pshmem_ctx_size_iput +#pragma weak shmem_ctx_ptrdiff_iput = pshmem_ctx_ptrdiff_iput -#pragma weak shmem_char_iput = pshmem_char_iput -#pragma weak shmem_short_iput = pshmem_short_iput -#pragma weak shmem_int_iput = pshmem_int_iput -#pragma weak shmem_long_iput = pshmem_long_iput -#pragma weak shmem_longlong_iput = pshmem_longlong_iput -#pragma weak shmem_schar_iput = pshmem_schar_iput -#pragma weak shmem_uchar_iput = pshmem_uchar_iput -#pragma weak shmem_ushort_iput = pshmem_ushort_iput -#pragma weak shmem_uint_iput = pshmem_uint_iput -#pragma weak shmem_ulong_iput = pshmem_ulong_iput -#pragma weak shmem_ulonglong_iput = pshmem_ulonglong_iput -#pragma weak shmem_float_iput = pshmem_float_iput -#pragma weak shmem_double_iput = pshmem_double_iput -#pragma weak shmem_longdouble_iput = pshmem_longdouble_iput +#pragma weak shmem_char_iput = pshmem_char_iput +#pragma weak shmem_short_iput = pshmem_short_iput +#pragma weak shmem_int_iput = pshmem_int_iput +#pragma weak shmem_long_iput = pshmem_long_iput +#pragma weak shmem_float_iput = pshmem_float_iput +#pragma weak shmem_double_iput = pshmem_double_iput +#pragma weak shmem_longlong_iput = pshmem_longlong_iput +#pragma weak shmem_schar_iput = pshmem_schar_iput +#pragma weak shmem_uchar_iput = pshmem_uchar_iput +#pragma weak shmem_ushort_iput = pshmem_ushort_iput +#pragma weak shmem_uint_iput = pshmem_uint_iput +#pragma weak shmem_ulong_iput = pshmem_ulong_iput +#pragma weak shmem_ulonglong_iput = pshmem_ulonglong_iput +#pragma weak shmem_longdouble_iput = pshmem_longdouble_iput +#pragma weak shmem_int8_iput = pshmem_int8_iput +#pragma weak shmem_int16_iput = pshmem_int16_iput +#pragma weak shmem_int32_iput = pshmem_int32_iput +#pragma weak shmem_int64_iput = pshmem_int64_iput +#pragma weak shmem_uint8_iput = pshmem_uint8_iput +#pragma weak shmem_uint16_iput = pshmem_uint16_iput +#pragma weak shmem_uint32_iput = pshmem_uint32_iput +#pragma weak shmem_uint64_iput = pshmem_uint64_iput +#pragma weak shmem_size_iput = pshmem_size_iput +#pragma weak shmem_ptrdiff_iput = pshmem_ptrdiff_iput #pragma weak shmem_ctx_iput8 = pshmem_ctx_iput8 #pragma weak shmem_ctx_iput16 = pshmem_ctx_iput16 @@ -121,6 +141,17 @@ SHMEM_CTX_TYPE_IPUT(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_IPUT(_float, float) SHMEM_CTX_TYPE_IPUT(_double, double) SHMEM_CTX_TYPE_IPUT(_longdouble, long double) +SHMEM_CTX_TYPE_IPUT(_int8, int8_t) +SHMEM_CTX_TYPE_IPUT(_int16, int16_t) +SHMEM_CTX_TYPE_IPUT(_int32, int32_t) +SHMEM_CTX_TYPE_IPUT(_int64, int64_t) +SHMEM_CTX_TYPE_IPUT(_uint8, uint8_t) +SHMEM_CTX_TYPE_IPUT(_uint16, uint16_t) +SHMEM_CTX_TYPE_IPUT(_uint32, uint32_t) +SHMEM_CTX_TYPE_IPUT(_uint64, uint64_t) +SHMEM_CTX_TYPE_IPUT(_size, size_t) +SHMEM_CTX_TYPE_IPUT(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_IPUT(_char, char) SHMEM_TYPE_IPUT(_short, short) SHMEM_TYPE_IPUT(_int, int) @@ -135,6 +166,16 @@ SHMEM_TYPE_IPUT(_ulonglong, unsigned long long) SHMEM_TYPE_IPUT(_float, float) SHMEM_TYPE_IPUT(_double, double) SHMEM_TYPE_IPUT(_longdouble, long double) +SHMEM_TYPE_IPUT(_int8, int8_t) +SHMEM_TYPE_IPUT(_int16, int16_t) +SHMEM_TYPE_IPUT(_int32, int32_t) +SHMEM_TYPE_IPUT(_int64, int64_t) +SHMEM_TYPE_IPUT(_uint8, uint8_t) +SHMEM_TYPE_IPUT(_uint16, uint16_t) +SHMEM_TYPE_IPUT(_uint32, uint32_t) +SHMEM_TYPE_IPUT(_uint64, uint64_t) +SHMEM_TYPE_IPUT(_size, size_t) +SHMEM_TYPE_IPUT(_ptrdiff, ptrdiff_t) #define DO_SHMEM_IPUTMEM(ctx, target, source, tst, sst, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ diff --git a/oshmem/shmem/c/shmem_p.c b/oshmem/shmem/c/shmem_p.c index 782407d9d02..974333a4361 100644 --- a/oshmem/shmem/c/shmem_p.c +++ b/oshmem/shmem/c/shmem_p.c @@ -59,35 +59,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_p = pshmem_ctx_char_p -#pragma weak shmem_ctx_short_p = pshmem_ctx_short_p -#pragma weak shmem_ctx_int_p = pshmem_ctx_int_p -#pragma weak shmem_ctx_long_p = pshmem_ctx_long_p -#pragma weak shmem_ctx_longlong_p = pshmem_ctx_longlong_p -#pragma weak shmem_ctx_schar_p = pshmem_ctx_schar_p -#pragma weak shmem_ctx_uchar_p = pshmem_ctx_uchar_p -#pragma weak shmem_ctx_ushort_p = pshmem_ctx_ushort_p -#pragma weak shmem_ctx_uint_p = pshmem_ctx_uint_p -#pragma weak shmem_ctx_ulong_p = pshmem_ctx_ulong_p -#pragma weak shmem_ctx_ulonglong_p = pshmem_ctx_ulonglong_p -#pragma weak shmem_ctx_float_p = pshmem_ctx_float_p -#pragma weak shmem_ctx_double_p = pshmem_ctx_double_p +#pragma weak shmem_ctx_char_p = pshmem_ctx_char_p +#pragma weak shmem_ctx_short_p = pshmem_ctx_short_p +#pragma weak shmem_ctx_int_p = pshmem_ctx_int_p +#pragma weak shmem_ctx_long_p = pshmem_ctx_long_p +#pragma weak shmem_ctx_float_p = pshmem_ctx_float_p +#pragma weak shmem_ctx_double_p = pshmem_ctx_double_p +#pragma weak shmem_ctx_longlong_p = pshmem_ctx_longlong_p +#pragma weak shmem_ctx_schar_p = pshmem_ctx_schar_p +#pragma weak shmem_ctx_uchar_p = pshmem_ctx_uchar_p +#pragma weak shmem_ctx_ushort_p = pshmem_ctx_ushort_p +#pragma weak shmem_ctx_uint_p = pshmem_ctx_uint_p +#pragma weak shmem_ctx_ulong_p = pshmem_ctx_ulong_p +#pragma weak shmem_ctx_ulonglong_p = pshmem_ctx_ulonglong_p #pragma weak shmem_ctx_longdouble_p = pshmem_ctx_longdouble_p +#pragma weak shmem_ctx_int8_p = pshmem_ctx_int8_p +#pragma weak shmem_ctx_int16_p = pshmem_ctx_int16_p +#pragma weak shmem_ctx_int32_p = pshmem_ctx_int32_p +#pragma weak shmem_ctx_int64_p = pshmem_ctx_int64_p +#pragma weak shmem_ctx_uint8_p = pshmem_ctx_uint8_p +#pragma weak shmem_ctx_uint16_p = pshmem_ctx_uint16_p +#pragma weak shmem_ctx_uint32_p = pshmem_ctx_uint32_p +#pragma weak shmem_ctx_uint64_p = pshmem_ctx_uint64_p +#pragma weak shmem_ctx_size_p = pshmem_ctx_size_p +#pragma weak shmem_ctx_ptrdiff_p = pshmem_ctx_ptrdiff_p -#pragma weak shmem_char_p = pshmem_char_p -#pragma weak shmem_short_p = pshmem_short_p -#pragma weak shmem_int_p = pshmem_int_p -#pragma weak shmem_long_p = pshmem_long_p -#pragma weak shmem_longlong_p = pshmem_longlong_p -#pragma weak shmem_schar_p = pshmem_schar_p -#pragma weak shmem_uchar_p = pshmem_uchar_p -#pragma weak shmem_ushort_p = pshmem_ushort_p -#pragma weak shmem_uint_p = pshmem_uint_p -#pragma weak shmem_ulong_p = pshmem_ulong_p -#pragma weak shmem_ulonglong_p = pshmem_ulonglong_p -#pragma weak shmem_float_p = pshmem_float_p -#pragma weak shmem_double_p = pshmem_double_p -#pragma weak shmem_longdouble_p = pshmem_longdouble_p +#pragma weak shmem_char_p = pshmem_char_p +#pragma weak shmem_short_p = pshmem_short_p +#pragma weak shmem_int_p = pshmem_int_p +#pragma weak shmem_long_p = pshmem_long_p +#pragma weak shmem_float_p = pshmem_float_p +#pragma weak shmem_double_p = pshmem_double_p +#pragma weak shmem_longlong_p = pshmem_longlong_p +#pragma weak shmem_schar_p = pshmem_schar_p +#pragma weak shmem_uchar_p = pshmem_uchar_p +#pragma weak shmem_ushort_p = pshmem_ushort_p +#pragma weak shmem_uint_p = pshmem_uint_p +#pragma weak shmem_ulong_p = pshmem_ulong_p +#pragma weak shmem_ulonglong_p = pshmem_ulonglong_p +#pragma weak shmem_longdouble_p = pshmem_longdouble_p +#pragma weak shmem_int8_p = pshmem_int8_p +#pragma weak shmem_int16_p = pshmem_int16_p +#pragma weak shmem_int32_p = pshmem_int32_p +#pragma weak shmem_int64_p = pshmem_int64_p +#pragma weak shmem_uint8_p = pshmem_uint8_p +#pragma weak shmem_uint16_p = pshmem_uint16_p +#pragma weak shmem_uint32_p = pshmem_uint32_p +#pragma weak shmem_uint64_p = pshmem_uint64_p +#pragma weak shmem_size_p = pshmem_size_p +#pragma weak shmem_ptrdiff_p = pshmem_ptrdiff_p #pragma weak shmemx_int16_p = pshmemx_int16_p #pragma weak shmemx_int32_p = pshmemx_int32_p @@ -109,6 +129,17 @@ SHMEM_CTX_TYPE_P(_ulonglong, unsigned long long, shmem) SHMEM_CTX_TYPE_P(_float, float, shmem) SHMEM_CTX_TYPE_P(_double, double, shmem) SHMEM_CTX_TYPE_P(_longdouble, long double, shmem) +SHMEM_CTX_TYPE_P(_int8, int8_t, shmem) +SHMEM_CTX_TYPE_P(_int16, int16_t, shmem) +SHMEM_CTX_TYPE_P(_int32, int32_t, shmem) +SHMEM_CTX_TYPE_P(_int64, int64_t, shmem) +SHMEM_CTX_TYPE_P(_uint8, uint8_t, shmem) +SHMEM_CTX_TYPE_P(_uint16, uint16_t, shmem) +SHMEM_CTX_TYPE_P(_uint32, uint32_t, shmem) +SHMEM_CTX_TYPE_P(_uint64, uint64_t, shmem) +SHMEM_CTX_TYPE_P(_size, size_t, shmem) +SHMEM_CTX_TYPE_P(_ptrdiff, ptrdiff_t, shmem) + SHMEM_TYPE_P(_char, char, shmem) SHMEM_TYPE_P(_short, short, shmem) SHMEM_TYPE_P(_int, int, shmem) @@ -123,6 +154,17 @@ SHMEM_TYPE_P(_ulonglong, unsigned long long, shmem) SHMEM_TYPE_P(_float, float, shmem) SHMEM_TYPE_P(_double, double, shmem) SHMEM_TYPE_P(_longdouble, long double, shmem) +SHMEM_TYPE_P(_int8, int8_t, shmem) +SHMEM_TYPE_P(_int16, int16_t, shmem) +SHMEM_TYPE_P(_int32, int32_t, shmem) +SHMEM_TYPE_P(_int64, int64_t, shmem) +SHMEM_TYPE_P(_uint8, uint8_t, shmem) +SHMEM_TYPE_P(_uint16, uint16_t, shmem) +SHMEM_TYPE_P(_uint32, uint32_t, shmem) +SHMEM_TYPE_P(_uint64, uint64_t, shmem) +SHMEM_TYPE_P(_size, size_t, shmem) +SHMEM_TYPE_P(_ptrdiff, ptrdiff_t, shmem) + SHMEM_TYPE_P(_int16, int16_t, shmemx) SHMEM_TYPE_P(_int32, int32_t, shmemx) SHMEM_TYPE_P(_int64, int64_t, shmemx) diff --git a/oshmem/shmem/c/shmem_put.c b/oshmem/shmem/c/shmem_put.c index 76a62a642db..98b6f24c7b8 100644 --- a/oshmem/shmem/c/shmem_put.c +++ b/oshmem/shmem/c/shmem_put.c @@ -60,35 +60,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_ctx_char_put = pshmem_ctx_char_put -#pragma weak shmem_ctx_short_put = pshmem_ctx_short_put -#pragma weak shmem_ctx_int_put = pshmem_ctx_int_put -#pragma weak shmem_ctx_long_put = pshmem_ctx_long_put -#pragma weak shmem_ctx_longlong_put = pshmem_ctx_longlong_put -#pragma weak shmem_ctx_schar_put = pshmem_ctx_schar_put -#pragma weak shmem_ctx_uchar_put = pshmem_ctx_uchar_put -#pragma weak shmem_ctx_ushort_put = pshmem_ctx_ushort_put -#pragma weak shmem_ctx_uint_put = pshmem_ctx_uint_put -#pragma weak shmem_ctx_ulong_put = pshmem_ctx_ulong_put -#pragma weak shmem_ctx_ulonglong_put = pshmem_ctx_ulonglong_put -#pragma weak shmem_ctx_float_put = pshmem_ctx_float_put -#pragma weak shmem_ctx_double_put = pshmem_ctx_double_put +#pragma weak shmem_ctx_char_put = pshmem_ctx_char_put +#pragma weak shmem_ctx_short_put = pshmem_ctx_short_put +#pragma weak shmem_ctx_int_put = pshmem_ctx_int_put +#pragma weak shmem_ctx_long_put = pshmem_ctx_long_put +#pragma weak shmem_ctx_float_put = pshmem_ctx_float_put +#pragma weak shmem_ctx_double_put = pshmem_ctx_double_put +#pragma weak shmem_ctx_longlong_put = pshmem_ctx_longlong_put +#pragma weak shmem_ctx_schar_put = pshmem_ctx_schar_put +#pragma weak shmem_ctx_uchar_put = pshmem_ctx_uchar_put +#pragma weak shmem_ctx_ushort_put = pshmem_ctx_ushort_put +#pragma weak shmem_ctx_uint_put = pshmem_ctx_uint_put +#pragma weak shmem_ctx_ulong_put = pshmem_ctx_ulong_put +#pragma weak shmem_ctx_ulonglong_put = pshmem_ctx_ulonglong_put #pragma weak shmem_ctx_longdouble_put = pshmem_ctx_longdouble_put - -#pragma weak shmem_char_put = pshmem_char_put -#pragma weak shmem_short_put = pshmem_short_put -#pragma weak shmem_int_put = pshmem_int_put -#pragma weak shmem_long_put = pshmem_long_put -#pragma weak shmem_longlong_put = pshmem_longlong_put -#pragma weak shmem_schar_put = pshmem_schar_put -#pragma weak shmem_uchar_put = pshmem_uchar_put -#pragma weak shmem_ushort_put = pshmem_ushort_put -#pragma weak shmem_uint_put = pshmem_uint_put -#pragma weak shmem_ulong_put = pshmem_ulong_put -#pragma weak shmem_ulonglong_put = pshmem_ulonglong_put -#pragma weak shmem_float_put = pshmem_float_put -#pragma weak shmem_double_put = pshmem_double_put -#pragma weak shmem_longdouble_put = pshmem_longdouble_put +#pragma weak shmem_ctx_int8_put = pshmem_ctx_int8_put +#pragma weak shmem_ctx_int16_put = pshmem_ctx_int16_put +#pragma weak shmem_ctx_int32_put = pshmem_ctx_int32_put +#pragma weak shmem_ctx_int64_put = pshmem_ctx_int64_put +#pragma weak shmem_ctx_uint8_put = pshmem_ctx_uint8_put +#pragma weak shmem_ctx_uint16_put = pshmem_ctx_uint16_put +#pragma weak shmem_ctx_uint32_put = pshmem_ctx_uint32_put +#pragma weak shmem_ctx_uint64_put = pshmem_ctx_uint64_put +#pragma weak shmem_ctx_size_put = pshmem_ctx_size_put +#pragma weak shmem_ctx_ptrdiff_put = pshmem_ctx_ptrdiff_put + +#pragma weak shmem_char_put = pshmem_char_put +#pragma weak shmem_short_put = pshmem_short_put +#pragma weak shmem_int_put = pshmem_int_put +#pragma weak shmem_long_put = pshmem_long_put +#pragma weak shmem_float_put = pshmem_float_put +#pragma weak shmem_double_put = pshmem_double_put +#pragma weak shmem_longlong_put = pshmem_longlong_put +#pragma weak shmem_schar_put = pshmem_schar_put +#pragma weak shmem_uchar_put = pshmem_uchar_put +#pragma weak shmem_ushort_put = pshmem_ushort_put +#pragma weak shmem_uint_put = pshmem_uint_put +#pragma weak shmem_ulong_put = pshmem_ulong_put +#pragma weak shmem_ulonglong_put = pshmem_ulonglong_put +#pragma weak shmem_longdouble_put = pshmem_longdouble_put +#pragma weak shmem_int8_put = pshmem_int8_put +#pragma weak shmem_int16_put = pshmem_int16_put +#pragma weak shmem_int32_put = pshmem_int32_put +#pragma weak shmem_int64_put = pshmem_int64_put +#pragma weak shmem_uint8_put = pshmem_uint8_put +#pragma weak shmem_uint16_put = pshmem_uint16_put +#pragma weak shmem_uint32_put = pshmem_uint32_put +#pragma weak shmem_uint64_put = pshmem_uint64_put +#pragma weak shmem_size_put = pshmem_size_put +#pragma weak shmem_ptrdiff_put = pshmem_ptrdiff_put #pragma weak shmem_ctx_putmem = pshmem_ctx_putmem #pragma weak shmem_ctx_put8 = pshmem_ctx_put8 @@ -120,6 +140,17 @@ SHMEM_CTX_TYPE_PUT(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_PUT(_float, float) SHMEM_CTX_TYPE_PUT(_double, double) SHMEM_CTX_TYPE_PUT(_longdouble, long double) +SHMEM_CTX_TYPE_PUT(_int8, int8_t) +SHMEM_CTX_TYPE_PUT(_int16, int16_t) +SHMEM_CTX_TYPE_PUT(_int32, int32_t) +SHMEM_CTX_TYPE_PUT(_int64, int64_t) +SHMEM_CTX_TYPE_PUT(_uint8, uint8_t) +SHMEM_CTX_TYPE_PUT(_uint16, uint16_t) +SHMEM_CTX_TYPE_PUT(_uint32, uint32_t) +SHMEM_CTX_TYPE_PUT(_uint64, uint64_t) +SHMEM_CTX_TYPE_PUT(_size, size_t) +SHMEM_CTX_TYPE_PUT(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_PUT(_char, char) SHMEM_TYPE_PUT(_short, short) SHMEM_TYPE_PUT(_int, int) @@ -134,6 +165,16 @@ SHMEM_TYPE_PUT(_ulonglong, unsigned long long) SHMEM_TYPE_PUT(_float, float) SHMEM_TYPE_PUT(_double, double) SHMEM_TYPE_PUT(_longdouble, long double) +SHMEM_TYPE_PUT(_int8, int8_t) +SHMEM_TYPE_PUT(_int16, int16_t) +SHMEM_TYPE_PUT(_int32, int32_t) +SHMEM_TYPE_PUT(_int64, int64_t) +SHMEM_TYPE_PUT(_uint8, uint8_t) +SHMEM_TYPE_PUT(_uint16, uint16_t) +SHMEM_TYPE_PUT(_uint32, uint32_t) +SHMEM_TYPE_PUT(_uint64, uint64_t) +SHMEM_TYPE_PUT(_size, size_t) +SHMEM_TYPE_PUT(_ptrdiff, ptrdiff_t) #define DO_SHMEM_PUTMEM(ctx, target, source, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ diff --git a/oshmem/shmem/c/shmem_put_nb.c b/oshmem/shmem/c/shmem_put_nb.c index a04f50b5e2a..0ec88120e54 100644 --- a/oshmem/shmem/c/shmem_put_nb.c +++ b/oshmem/shmem/c/shmem_put_nb.c @@ -64,20 +64,55 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_char_put_nbi = pshmem_char_put_nbi -#pragma weak shmem_short_put_nbi = pshmem_short_put_nbi -#pragma weak shmem_int_put_nbi = pshmem_int_put_nbi -#pragma weak shmem_long_put_nbi = pshmem_long_put_nbi -#pragma weak shmem_longlong_put_nbi = pshmem_longlong_put_nbi -#pragma weak shmem_schar_put_nbi = pshmem_schar_put_nbi -#pragma weak shmem_uchar_put_nbi = pshmem_uchar_put_nbi -#pragma weak shmem_ushort_put_nbi = pshmem_ushort_put_nbi -#pragma weak shmem_uint_put_nbi = pshmem_uint_put_nbi -#pragma weak shmem_ulong_put_nbi = pshmem_ulong_put_nbi -#pragma weak shmem_ulonglong_put_nbi = pshmem_ulonglong_put_nbi -#pragma weak shmem_float_put_nbi = pshmem_float_put_nbi -#pragma weak shmem_double_put_nbi = pshmem_double_put_nbi -#pragma weak shmem_longdouble_put_nbi = pshmem_longdouble_put_nbi +#pragma weak shmem_ctx_char_put_nbi = pshmem_ctx_char_put_nbi +#pragma weak shmem_ctx_short_put_nbi = pshmem_ctx_short_put_nbi +#pragma weak shmem_ctx_int_put_nbi = pshmem_ctx_int_put_nbi +#pragma weak shmem_ctx_long_put_nbi = pshmem_ctx_long_put_nbi +#pragma weak shmem_ctx_float_put_nbi = pshmem_ctx_float_put_nbi +#pragma weak shmem_ctx_double_put_nbi = pshmem_ctx_double_put_nbi +#pragma weak shmem_ctx_longlong_put_nbi = pshmem_ctx_longlong_put_nbi +#pragma weak shmem_ctx_schar_put_nbi = pshmem_ctx_schar_put_nbi +#pragma weak shmem_ctx_uchar_put_nbi = pshmem_ctx_uchar_put_nbi +#pragma weak shmem_ctx_ushort_put_nbi = pshmem_ctx_ushort_put_nbi +#pragma weak shmem_ctx_uint_put_nbi = pshmem_ctx_uint_put_nbi +#pragma weak shmem_ctx_ulong_put_nbi = pshmem_ctx_ulong_put_nbi +#pragma weak shmem_ctx_ulonglong_put_nbi = pshmem_ctx_ulonglong_put_nbi +#pragma weak shmem_ctx_longdouble_put_nbi = pshmem_ctx_longdouble_put_nbi +#pragma weak shmem_ctx_int8_put_nbi = pshmem_ctx_int8_put_nbi +#pragma weak shmem_ctx_int16_put_nbi = pshmem_ctx_int16_put_nbi +#pragma weak shmem_ctx_int32_put_nbi = pshmem_ctx_int32_put_nbi +#pragma weak shmem_ctx_int64_put_nbi = pshmem_ctx_int64_put_nbi +#pragma weak shmem_ctx_uint8_put_nbi = pshmem_ctx_uint8_put_nbi +#pragma weak shmem_ctx_uint16_put_nbi = pshmem_ctx_uint16_put_nbi +#pragma weak shmem_ctx_uint32_put_nbi = pshmem_ctx_uint32_put_nbi +#pragma weak shmem_ctx_uint64_put_nbi = pshmem_ctx_uint64_put_nbi +#pragma weak shmem_ctx_size_put_nbi = pshmem_ctx_size_put_nbi +#pragma weak shmem_ctx_ptrdiff_put_nbi = pshmem_ctx_ptrdiff_put_nbi + +#pragma weak shmem_char_put_nbi = pshmem_char_put_nbi +#pragma weak shmem_short_put_nbi = pshmem_short_put_nbi +#pragma weak shmem_int_put_nbi = pshmem_int_put_nbi +#pragma weak shmem_long_put_nbi = pshmem_long_put_nbi +#pragma weak shmem_float_put_nbi = pshmem_float_put_nbi +#pragma weak shmem_double_put_nbi = pshmem_double_put_nbi +#pragma weak shmem_longlong_put_nbi = pshmem_longlong_put_nbi +#pragma weak shmem_schar_put_nbi = pshmem_schar_put_nbi +#pragma weak shmem_uchar_put_nbi = pshmem_uchar_put_nbi +#pragma weak shmem_ushort_put_nbi = pshmem_ushort_put_nbi +#pragma weak shmem_uint_put_nbi = pshmem_uint_put_nbi +#pragma weak shmem_ulong_put_nbi = pshmem_ulong_put_nbi +#pragma weak shmem_ulonglong_put_nbi = pshmem_ulonglong_put_nbi +#pragma weak shmem_longdouble_put_nbi = pshmem_longdouble_put_nbi +#pragma weak shmem_int8_put_nbi = pshmem_int8_put_nbi +#pragma weak shmem_int16_put_nbi = pshmem_int16_put_nbi +#pragma weak shmem_int32_put_nbi = pshmem_int32_put_nbi +#pragma weak shmem_int64_put_nbi = pshmem_int64_put_nbi +#pragma weak shmem_uint8_put_nbi = pshmem_uint8_put_nbi +#pragma weak shmem_uint16_put_nbi = pshmem_uint16_put_nbi +#pragma weak shmem_uint32_put_nbi = pshmem_uint32_put_nbi +#pragma weak shmem_uint64_put_nbi = pshmem_uint64_put_nbi +#pragma weak shmem_size_put_nbi = pshmem_size_put_nbi +#pragma weak shmem_ptrdiff_put_nbi = pshmem_ptrdiff_put_nbi #pragma weak shmem_put8_nbi = pshmem_put8_nbi #pragma weak shmem_put16_nbi = pshmem_put16_nbi @@ -86,21 +121,6 @@ #pragma weak shmem_put128_nbi = pshmem_put128_nbi #pragma weak shmem_putmem_nbi = pshmem_putmem_nbi -#pragma weak shmem_ctx_char_put_nbi = pshmem_ctx_char_put_nbi -#pragma weak shmem_ctx_short_put_nbi = pshmem_ctx_short_put_nbi -#pragma weak shmem_ctx_int_put_nbi = pshmem_ctx_int_put_nbi -#pragma weak shmem_ctx_long_put_nbi = pshmem_ctx_long_put_nbi -#pragma weak shmem_ctx_longlong_put_nbi = pshmem_ctx_longlong_put_nbi -#pragma weak shmem_ctx_schar_put_nbi = pshmem_ctx_schar_put_nbi -#pragma weak shmem_ctx_uchar_put_nbi = pshmem_ctx_uchar_put_nbi -#pragma weak shmem_ctx_ushort_put_nbi = pshmem_ctx_ushort_put_nbi -#pragma weak shmem_ctx_uint_put_nbi = pshmem_ctx_uint_put_nbi -#pragma weak shmem_ctx_ulong_put_nbi = pshmem_ctx_ulong_put_nbi -#pragma weak shmem_ctx_ulonglong_put_nbi = pshmem_ctx_ulonglong_put_nbi -#pragma weak shmem_ctx_float_put_nbi = pshmem_ctx_float_put_nbi -#pragma weak shmem_ctx_double_put_nbi = pshmem_ctx_double_put_nbi -#pragma weak shmem_ctx_longdouble_put_nbi = pshmem_ctx_longdouble_put_nbi - #pragma weak shmem_ctx_put8_nbi = pshmem_ctx_put8_nbi #pragma weak shmem_ctx_put16_nbi = pshmem_ctx_put16_nbi #pragma weak shmem_ctx_put32_nbi = pshmem_ctx_put32_nbi @@ -124,6 +144,17 @@ SHMEM_CTX_TYPE_PUT_NB(_ulonglong, unsigned long long) SHMEM_CTX_TYPE_PUT_NB(_float, float) SHMEM_CTX_TYPE_PUT_NB(_double, double) SHMEM_CTX_TYPE_PUT_NB(_longdouble, long double) +SHMEM_CTX_TYPE_PUT_NB(_int8, int8_t) +SHMEM_CTX_TYPE_PUT_NB(_int16, int16_t) +SHMEM_CTX_TYPE_PUT_NB(_int32, int32_t) +SHMEM_CTX_TYPE_PUT_NB(_int64, int64_t) +SHMEM_CTX_TYPE_PUT_NB(_uint8, uint8_t) +SHMEM_CTX_TYPE_PUT_NB(_uint16, uint16_t) +SHMEM_CTX_TYPE_PUT_NB(_uint32, uint32_t) +SHMEM_CTX_TYPE_PUT_NB(_uint64, uint64_t) +SHMEM_CTX_TYPE_PUT_NB(_size, size_t) +SHMEM_CTX_TYPE_PUT_NB(_ptrdiff, ptrdiff_t) + SHMEM_TYPE_PUT_NB(_char, char) SHMEM_TYPE_PUT_NB(_short, short) SHMEM_TYPE_PUT_NB(_int, int) @@ -138,6 +169,16 @@ SHMEM_TYPE_PUT_NB(_ulonglong, unsigned long long) SHMEM_TYPE_PUT_NB(_float, float) SHMEM_TYPE_PUT_NB(_double, double) SHMEM_TYPE_PUT_NB(_longdouble, long double) +SHMEM_TYPE_PUT_NB(_int8, int8_t) +SHMEM_TYPE_PUT_NB(_int16, int16_t) +SHMEM_TYPE_PUT_NB(_int32, int32_t) +SHMEM_TYPE_PUT_NB(_int64, int64_t) +SHMEM_TYPE_PUT_NB(_uint8, uint8_t) +SHMEM_TYPE_PUT_NB(_uint16, uint16_t) +SHMEM_TYPE_PUT_NB(_uint32, uint32_t) +SHMEM_TYPE_PUT_NB(_uint64, uint64_t) +SHMEM_TYPE_PUT_NB(_size, size_t) +SHMEM_TYPE_PUT_NB(_ptrdiff, ptrdiff_t) #define DO_SHMEM_PUTMEM_NB(ctx, target, source, element_size, nelems, pe) do { \ int rc = OSHMEM_SUCCESS; \ From 979b4019361a184741df9adaa39df6a8f5694e53 Mon Sep 17 00:00:00 2001 From: Risto Toijala Date: Tue, 8 Jan 2019 13:50:33 +0200 Subject: [PATCH 225/674] mpi/fortran: Fix valgrind warnings for type create Valgrind warns that *newtype is uninitialized when calling from Fortran as e.g. use mpi integer :: t, err call MPI_Type_create_f90_integer(5, t, err) Since newtype is intent(out), this should not happen. There is no reason to convert the type using PMPI_Type_f2c, only to over- write it immediately afterwards. The other type_create_* functions did not convert newtype. The valgrind warnings: ==28441== Conditional jump or move depends on uninitialised value(s) ==28441== at 0x581B555: PMPI_Type_f2c (in [...]/lib/libmpi.so.0.0.0) ==28441== by 0x4E87AB7: MPI_TYPE_CREATE_F90_INTEGER (in [...]/lib/libmpi_mpifh.so.0.0.0) ==28441== by 0x400BA1: MAIN__ (in [...]) ==28441== by 0x400C46: main (in [...]) ==28441== ==28441== Conditional jump or move depends on uninitialised value(s) ==28441== at 0x581B563: PMPI_Type_f2c (in [...]/lib/libmpi.so.0.0.0) ==28441== by 0x4E87AB7: MPI_TYPE_CREATE_F90_INTEGER (in [...]/lib/libmpi_mpifh.so.0.0.0) ==28441== by 0x400BA1: MAIN__ (in [..]) ==28441== by 0x400C46: main (in [...]) ==28441== ==28441== Use of uninitialised value of size 8 ==28441== at 0x581B577: PMPI_Type_f2c (in [...]/lib/libmpi.so.0.0.0) ==28441== by 0x4E87AB7: MPI_TYPE_CREATE_F90_INTEGER (in [...]/lib/libmpi_mpifh.so.0.0.0) ==28441== by 0x400BA1: MAIN__ (in [...]) ==28441== by 0x400C46: main (in [...]) ==28441== Signed-off-by: Risto Toijala (cherry picked from commit f14a0f4fc981a488150ac7426683e94645f9fdf7) --- ompi/mpi/fortran/mpif-h/type_create_f90_complex_f.c | 2 +- ompi/mpi/fortran/mpif-h/type_create_f90_integer_f.c | 2 +- ompi/mpi/fortran/mpif-h/type_create_f90_real_f.c | 2 +- ompi/mpi/fortran/mpif-h/type_create_hindexed_f.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mpi/fortran/mpif-h/type_create_f90_complex_f.c b/ompi/mpi/fortran/mpif-h/type_create_f90_complex_f.c index 66f0f26a64f..df9c8c8e033 100644 --- a/ompi/mpi/fortran/mpif-h/type_create_f90_complex_f.c +++ b/ompi/mpi/fortran/mpif-h/type_create_f90_complex_f.c @@ -70,7 +70,7 @@ void ompi_type_create_f90_complex_f(MPI_Fint *p, MPI_Fint *r, MPI_Fint *newtype, MPI_Fint *ierr) { int c_ierr; - MPI_Datatype c_newtype = PMPI_Type_f2c(*newtype); + MPI_Datatype c_newtype; c_ierr = PMPI_Type_create_f90_complex(OMPI_FINT_2_INT(*p), OMPI_FINT_2_INT(*r), diff --git a/ompi/mpi/fortran/mpif-h/type_create_f90_integer_f.c b/ompi/mpi/fortran/mpif-h/type_create_f90_integer_f.c index 2356218b59a..385e9bd2f28 100644 --- a/ompi/mpi/fortran/mpif-h/type_create_f90_integer_f.c +++ b/ompi/mpi/fortran/mpif-h/type_create_f90_integer_f.c @@ -70,7 +70,7 @@ void ompi_type_create_f90_integer_f(MPI_Fint *r, MPI_Fint *newtype, MPI_Fint *ierr) { int c_ierr; - MPI_Datatype c_new = PMPI_Type_f2c(*newtype); + MPI_Datatype c_new; c_ierr = PMPI_Type_create_f90_integer(OMPI_FINT_2_INT(*r), &c_new); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); diff --git a/ompi/mpi/fortran/mpif-h/type_create_f90_real_f.c b/ompi/mpi/fortran/mpif-h/type_create_f90_real_f.c index 70d6de28992..949afed45bf 100644 --- a/ompi/mpi/fortran/mpif-h/type_create_f90_real_f.c +++ b/ompi/mpi/fortran/mpif-h/type_create_f90_real_f.c @@ -70,7 +70,7 @@ void ompi_type_create_f90_real_f(MPI_Fint *p, MPI_Fint *r, MPI_Fint *newtype, MPI_Fint *ierr) { int c_ierr; - MPI_Datatype c_new = PMPI_Type_f2c(*newtype); + MPI_Datatype c_new; c_ierr = PMPI_Type_create_f90_real(OMPI_FINT_2_INT(*p), OMPI_FINT_2_INT(*r), diff --git a/ompi/mpi/fortran/mpif-h/type_create_hindexed_f.c b/ompi/mpi/fortran/mpif-h/type_create_hindexed_f.c index b68745b6ede..416764943d7 100644 --- a/ompi/mpi/fortran/mpif-h/type_create_hindexed_f.c +++ b/ompi/mpi/fortran/mpif-h/type_create_hindexed_f.c @@ -75,7 +75,7 @@ void ompi_type_create_hindexed_f(MPI_Fint *count, { int c_ierr; MPI_Datatype c_old = PMPI_Type_f2c(*oldtype); - MPI_Datatype c_new = PMPI_Type_f2c(*newtype); + MPI_Datatype c_new; OMPI_ARRAY_NAME_DECL(array_of_blocklengths); OMPI_ARRAY_FINT_2_INT(array_of_blocklengths, *count); From cca3caa84fbf1826c45121470e862d5cfa5a9f17 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sun, 13 Jan 2019 12:57:46 +0900 Subject: [PATCH 226/674] configury: enhance C11 detection clang 5.0 on trusty is busted with respect to C11 atomics This can be evidenced with the simple program below. This test was added into OPAL_PROG_CC_C11_HELPER() and disable C11 atomics if it fails. _Atomic uint32_t a; uint32_t b; atomic_fetch_xor_explicit(&a, b, memory_order_relaxed); Refs. open-mpi/ompi#6264 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@d1fadebc65a7a7bcfce14641e389f02307f580e2) --- config/opal_setup_cc.m4 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/config/opal_setup_cc.m4 b/config/opal_setup_cc.m4 index e6cb81c1387..1382e218ce5 100644 --- a/config/opal_setup_cc.m4 +++ b/config/opal_setup_cc.m4 @@ -14,7 +14,7 @@ dnl Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights dnl reserved. -dnl Copyright (c) 2015-2018 Research Organization for Information Science +dnl Copyright (c) 2015-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl @@ -59,7 +59,11 @@ AC_DEFUN([OPAL_PROG_CC_C11_HELPER],[ OPAL_CC_HELPER([if $CC $1 supports C11 _Static_assert], [opal_prog_cc_c11_helper__static_assert_available], [[#include ]],[[_Static_assert(sizeof(int64_t) == 8, "WTH");]]) - AS_IF([test $opal_prog_cc_c11_helper__Thread_local_available -eq 1 && test $opal_prog_cc_c11_helper_atomic_var_available -eq 1], + OPAL_CC_HELPER([if $CC $1 supports C11 atomic_fetch_xor_explicit], [opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available], + [[#include +#include ]],[[_Atomic uint32_t a; uint32_t b; atomic_fetch_xor_explicit(&a, b, memory_order_relaxed);]]) + + AS_IF([test $opal_prog_cc_c11_helper__Thread_local_available -eq 1 && test $opal_prog_cc_c11_helper_atomic_var_available -eq 1 && test $opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available -eq 1], [$2], [$3]) @@ -127,7 +131,7 @@ AC_DEFUN([OPAL_SETUP_CC],[ AC_REQUIRE([_OPAL_PROG_CC]) AC_REQUIRE([AM_PROG_CC_C_O]) - OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc__thread_available]) + OPAL_VAR_SCOPE_PUSH([opal_prog_cc_c11_helper__Thread_local_available opal_prog_cc_c11_helper_atomic_var_available opal_prog_cc_c11_helper__Atomic_available opal_prog_cc_c11_helper__static_assert_available opal_prog_cc_c11_helper__Generic_available opal_prog_cc__thread_available opal_prog_cc_c11_helper_atomic_fetch_xor_explicit_available]) # AC_PROG_CC_C99 changes CC (instead of CFLAGS) so save CC (without c99 # flags) for use in our wrappers. From 2fc5ab7c8f133d6de3b76c43626f3d282bea423d Mon Sep 17 00:00:00 2001 From: heasterday Date: Mon, 10 Dec 2018 18:14:16 -0700 Subject: [PATCH 227/674] Update mpool_hugepage_component.c Signed-off-by: Hunter Easterday (cherry picked from commit ad0d2c451e63301e5a3b595f9df67bd5c813955e) (cherry picked from commit 509380d99fc7e293f18a2dbb495ef73f9f4cbfef) --- .../mpool/hugepage/mpool_hugepage_component.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/opal/mca/mpool/hugepage/mpool_hugepage_component.c b/opal/mca/mpool/hugepage/mpool_hugepage_component.c index 02320b9f91e..712301a38c5 100644 --- a/opal/mca/mpool/hugepage/mpool_hugepage_component.c +++ b/opal/mca/mpool/hugepage/mpool_hugepage_component.c @@ -264,12 +264,17 @@ static void mca_mpool_hugepage_find_hugepages (void) { hp->path = strdup (mntent->mnt_dir); hp->page_size = page_size; - - OPAL_OUTPUT_VERBOSE((MCA_BASE_VERBOSE_INFO, opal_mpool_base_framework.framework_output, - "found huge page with size = %lu, path = %s, mmap flags = 0x%x", - hp->page_size, hp->path, hp->mmap_flags)); - - opal_list_append (&mca_mpool_hugepage_component.huge_pages, &hp->super); + + if(0 == access (hp->path, R_OK | W_OK)){ + opal_output_verbose (MCA_BASE_VERBOSE_INFO, opal_mpool_base_framework.framework_output, + "found huge page with size = %lu, path = %s, mmap flags = 0x%x, adding to list", + hp->page_size, hp->path, hp->mmap_flags); + opal_list_append (&mca_mpool_hugepage_component.huge_pages, &hp->super); + } else { + opal_output_verbose (MCA_BASE_VERBOSE_INFO, opal_mpool_base_framework.framework_output, + "found huge page with size = %lu, path = %s, mmap flags = 0x%x, with invalid " + "permissions, skipping", hp->page_size, hp->path, hp->mmap_flags); + } } opal_list_sort (&mca_mpool_hugepage_component.huge_pages, page_compare); From 335f8c5100d6922dc95d87bde2c590c0ded543b1 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 10 Jan 2019 10:17:50 -0800 Subject: [PATCH 228/674] Update to PMIx 3.1.2 Update the OPAL glue configure code to correctly link the opal/pmix3 component to the hwloc used by OMPI instead of defaulting to the system-level hwloc. Required a corresponding update to the PMIx hwloc configure code so we treat hwloc the same way we handle libevent in embedded scenarios. Roll to PMIx v3.1.2 for plugging of memory leaks and addition of faster PMIx_Get response Signed-off-by: Ralph Castain --- .gitignore | 2 + opal/mca/pmix/pmix3x/configure.m4 | 6 +- opal/mca/pmix/pmix3x/pmix/INSTALL | 24 +- opal/mca/pmix/pmix3x/pmix/LICENSE | 6 +- opal/mca/pmix/pmix3x/pmix/Makefile.am | 4 - opal/mca/pmix/pmix3x/pmix/NEWS | 99 +- opal/mca/pmix/pmix3x/pmix/README | 27 +- opal/mca/pmix/pmix3x/pmix/VERSION | 15 +- opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 51 +- .../pmix3x/pmix/config/pmix_check_lock.m4 | 2 + .../pmix/config/pmix_check_os_flavors.m4 | 9 +- .../pmix3x/pmix/config/pmix_config_asm.m4 | 579 +++-- opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 | 4 +- .../pmix/pmix3x/pmix/config/pmix_setup_cc.m4 | 13 +- .../pmix/pmix3x/pmix/config/pmix_setup_cli.m4 | 4 +- .../pmix3x/pmix/config/pmix_setup_hwloc.m4 | 78 +- .../pmix3x/pmix/config/pmix_setup_libevent.m4 | 9 +- .../pmix/pmix3x/pmix/config/pmix_summary.m4 | 79 + opal/mca/pmix/pmix3x/pmix/configure.ac | 6 +- opal/mca/pmix/pmix3x/pmix/contrib/Makefile.am | 2 - .../pmix/contrib/cron-run-all-md2nroff.pl | 187 -- opal/mca/pmix/pmix3x/pmix/contrib/md2nroff.pl | 164 -- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- .../mca/pmix/pmix3x/pmix/examples/Makefile.am | 29 +- opal/mca/pmix/pmix3x/pmix/examples/alloc.c | 133 +- opal/mca/pmix/pmix3x/pmix/examples/client.c | 216 +- opal/mca/pmix/pmix3x/pmix/examples/client2.c | 28 +- opal/mca/pmix/pmix3x/pmix/examples/dmodex.c | 24 +- opal/mca/pmix/pmix3x/pmix/examples/dynamic.c | 4 +- opal/mca/pmix/pmix3x/pmix/examples/examples.h | 124 + opal/mca/pmix/pmix3x/pmix/examples/fault.c | 97 +- opal/mca/pmix/pmix3x/pmix/examples/jctrl.c | 71 +- opal/mca/pmix/pmix3x/pmix/examples/tool.c | 179 +- opal/mca/pmix/pmix3x/pmix/include/Makefile.am | 5 +- opal/mca/pmix/pmix3x/pmix/include/pmix.h | 12 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 961 +++++--- .../pmix/pmix3x/pmix/include/pmix_extend.h | 155 ++ .../pmix/pmix3x/pmix/include/pmix_server.h | 8 +- .../pmix3x/pmix/include/pmix_version.h.in | 4 +- opal/mca/pmix/pmix3x/pmix/man/Makefile.am | 60 - opal/mca/pmix/pmix3x/pmix/man/README | 186 -- .../pmix/pmix3x/pmix/man/man3/pmix_abort.3 | 62 - .../pmix/pmix3x/pmix/man/man3/pmix_commit.3 | 35 - .../pmix/pmix3x/pmix/man/man3/pmix_finalize.3 | 45 - .../mca/pmix/pmix3x/pmix/man/man3/pmix_init.3 | 52 - .../pmix3x/pmix/man/man3/pmix_initialized.3 | 30 - opal/mca/pmix/pmix3x/pmix/man/man3/pmix_put.3 | 60 - opal/mca/pmix/pmix3x/pmix/man/man7/pmix.7 | 35 - .../pmix3x/pmix/man/man7/pmix_constants.7 | 79 - .../pmix/src/atomics/sys/Makefile.include | 5 +- .../pmix/src/atomics/sys/architecture.h | 3 +- .../pmix3x/pmix/src/atomics/sys/arm/atomic.h | 20 +- .../pmix/src/atomics/sys/arm64/atomic.h | 30 +- .../pmix/pmix3x/pmix/src/atomics/sys/atomic.h | 146 +- .../pmix3x/pmix/src/atomics/sys/atomic_impl.h | 94 +- .../pmix3x/pmix/src/atomics/sys/atomic_stdc.h | 262 +++ .../pmix/pmix3x/pmix/src/atomics/sys/cma.h | 10 +- .../pmix/src/atomics/sys/gcc_builtin/atomic.h | 46 +- .../pmix3x/pmix/src/atomics/sys/ia32/atomic.h | 20 +- .../pmix/src/atomics/sys/powerpc/atomic.h | 32 +- .../pmix/src/atomics/sys/sparcv9/atomic.h | 26 +- .../src/atomics/sys/sync_builtin/atomic.h | 30 +- .../pmix/pmix3x/pmix/src/atomics/sys/timer.h | 2 +- .../pmix/src/atomics/sys/x86_64/atomic.h | 38 +- .../pmix/src/atomics/sys/x86_64/timer.h | 2 +- .../pmix/pmix3x/pmix/src/class/pmix_hotel.h | 16 +- .../pmix/pmix3x/pmix/src/class/pmix_list.h | 4 +- .../pmix/pmix3x/pmix/src/class/pmix_object.h | 2 +- opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c | 20 +- opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c | 30 +- .../pmix/pmix3x/pmix/src/client/pmix_client.c | 58 +- .../pmix/src/client/pmix_client_fence.c | 4 +- .../pmix3x/pmix/src/client/pmix_client_get.c | 121 +- .../pmix3x/pmix/src/client/pmix_client_pub.c | 2 +- .../pmix/src/client/pmix_client_spawn.c | 113 +- .../pmix3x/pmix/src/common/pmix_control.c | 4 + .../pmix/pmix3x/pmix/src/common/pmix_data.c | 14 +- .../pmix/pmix3x/pmix/src/common/pmix_iof.h | 2 +- .../pmix/pmix3x/pmix/src/common/pmix_query.c | 169 +- .../pmix3x/pmix/src/common/pmix_strings.c | 13 +- .../pmix/pmix3x/pmix/src/event/pmix_event.h | 135 +- .../pmix/src/event/pmix_event_notification.c | 314 ++- .../pmix/src/event/pmix_event_registration.c | 66 +- .../pmix3x/pmix/src/hwloc/hwloc-internal.h | 4 +- opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c | 4 +- .../pmix3x/pmix/src/include/Makefile.include | 5 +- .../pmix/src/include/pmix_config_bottom.h | 3 +- .../pmix3x/pmix/src/include/pmix_globals.c | 105 +- .../pmix3x/pmix/src/include/pmix_globals.h | 33 +- .../pmix3x/pmix/src/include/pmix_stdatomic.h | 67 + .../pmix3x/pmix/src/include/pmix_stdint.h | 5 +- .../base/pmix_mca_base_component_repository.c | 8 +- .../pmix3x/pmix/src/mca/bfrops/base/base.h | 24 +- .../src/mca/bfrops/base/bfrop_base_copy.c | 83 +- .../pmix/src/mca/bfrops/base/bfrop_base_fns.c | 23 +- .../src/mca/bfrops/base/bfrop_base_pack.c | 69 +- .../src/mca/bfrops/base/bfrop_base_print.c | 46 - .../src/mca/bfrops/base/bfrop_base_unpack.c | 99 +- .../pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h | 2 +- .../pmix3x/pmix/src/mca/bfrops/v12/copy.c | 33 +- .../pmix3x/pmix/src/mca/bfrops/v12/internal.h | 53 +- .../pmix3x/pmix/src/mca/bfrops/v12/pack.c | 7 +- .../pmix3x/pmix/src/mca/bfrops/v12/unpack.c | 16 +- .../pmix3x/pmix/src/mca/bfrops/v20/copy.c | 978 ++++---- .../pmix3x/pmix/src/mca/bfrops/v20/internal.h | 53 +- .../pmix3x/pmix/src/mca/bfrops/v20/pack.c | 17 +- .../pmix3x/pmix/src/mca/bfrops/v20/print.c | 10 +- .../pmix3x/pmix/src/mca/bfrops/v20/unpack.c | 21 +- .../pmix/src/mca/bfrops/v21/bfrop_pmix21.c | 244 +- .../pmix/src/mca/bfrops/v3/bfrop_pmix3.c | 245 +- .../pmix3x/pmix/src/mca/common/Makefile.am | 25 + .../pmix/src/mca/common/dstore/Makefile.am | 59 + .../pmix/src/mca/common/dstore/configure.m4 | 17 + .../dstore/dstore_base.c} | 2053 +++++++---------- .../pmix/src/mca/common/dstore/dstore_base.h | 139 ++ .../src/mca/common/dstore/dstore_common.h | 79 + .../pmix/src/mca/common/dstore/dstore_file.h | 161 ++ .../src/mca/common/dstore/dstore_segment.c | 302 +++ .../src/mca/common/dstore/dstore_segment.h | 70 + .../pmix/pmix3x/pmix/src/mca/gds/base/base.h | 13 + .../pmix/src/mca/gds/base/gds_base_fns.c | 99 + .../pmix3x/pmix/src/mca/gds/ds12/Makefile.am | 24 +- .../pmix/src/mca/gds/ds12/gds_ds12_base.c | 170 ++ .../pmix/src/mca/gds/ds12/gds_ds12_base.h | 21 + ...store_component.c => gds_ds12_component.c} | 2 +- .../pmix/src/mca/gds/ds12/gds_ds12_file.c | 176 ++ .../pmix/src/mca/gds/ds12/gds_ds12_file.h | 20 + .../pmix/src/mca/gds/ds12/gds_ds12_lock.c | 25 + .../pmix/src/mca/gds/ds12/gds_ds12_lock.h | 29 + .../src/mca/gds/ds12/gds_ds12_lock_fcntl.c | 233 ++ .../src/mca/gds/ds12/gds_ds12_lock_pthread.c | 274 +++ .../pmix/src/mca/gds/ds12/gds_ds20_file.c | 166 ++ .../pmix3x/pmix/src/mca/gds/ds12/gds_dstore.h | 129 -- .../pmix3x/pmix/src/mca/gds/ds21/Makefile.am | 62 + .../pmix/src/mca/gds/ds21/gds_ds21_base.c | 176 ++ .../pmix/src/mca/gds/ds21/gds_ds21_base.h | 21 + .../src/mca/gds/ds21/gds_ds21_component.c | 93 + .../pmix/src/mca/gds/ds21/gds_ds21_file.c | 188 ++ .../pmix/src/mca/gds/ds21/gds_ds21_file.h | 19 + .../pmix/src/mca/gds/ds21/gds_ds21_lock.c | 25 + .../pmix/src/mca/gds/ds21/gds_ds21_lock.h | 30 + .../src/mca/gds/ds21/gds_ds21_lock_pthread.c | 438 ++++ opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h | 37 +- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.c | 41 +- .../pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c | 19 +- .../src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c | 19 +- .../src/mca/pif/linux_ipv6/pif_linux_ipv6.c | 19 +- opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h | 18 +- .../pmix/src/mca/pif/posix_ipv4/pif_posix.c | 18 +- .../mca/pif/solaris_ipv6/pif_solaris_ipv6.c | 8 +- .../src/mca/pinstalldirs/config/Makefile.am | 4 +- .../pmix/src/mca/plog/stdfd/plog_stdfd.c | 2 +- .../pmix/pmix3x/pmix/src/mca/pnet/base/base.h | 2 +- .../pmix/src/mca/pnet/base/pnet_base_fns.c | 76 +- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c | 49 +- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h | 4 +- .../src/mca/pnet/opa/pnet_opa_component.c | 21 +- opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h | 12 +- .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c | 77 +- .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h | 4 +- .../src/mca/pnet/tcp/pnet_tcp_component.c | 21 +- .../pmix3x/pmix/src/mca/pnet/test/pnet_test.c | 42 +- .../pmix/src/mca/preg/base/preg_base_frame.c | 2 + .../pmix/src/mca/preg/native/preg_native.c | 24 +- .../pmix3x/pmix/src/mca/preg/preg_types.h | 2 + .../pmix/src/mca/psensor/file/psensor_file.c | 2 +- .../mca/psensor/heartbeat/psensor_heartbeat.c | 2 +- .../src/mca/pshmem/base/pshmem_base_frame.c | 5 +- .../pmix/src/mca/pshmem/mmap/pshmem_mmap.c | 4 +- .../pmix/src/mca/ptl/base/ptl_base_frame.c | 4 + .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 167 +- opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h | 22 +- .../pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h | 88 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 592 +++-- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h | 4 + .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 555 +++-- .../pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c | 4 +- .../src/mca/ptl/usock/ptl_usock_component.c | 13 +- .../pmix3x/pmix/src/runtime/pmix_finalize.c | 10 +- .../pmix/pmix3x/pmix/src/runtime/pmix_init.c | 41 +- .../pmix3x/pmix/src/runtime/pmix_params.c | 28 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 863 ++++--- .../pmix3x/pmix/src/server/pmix_server_get.c | 156 +- .../pmix3x/pmix/src/server/pmix_server_ops.c | 866 ++++--- .../pmix3x/pmix/src/server/pmix_server_ops.h | 39 +- .../pmix/pmix3x/pmix/src/threads/mutex_unix.h | 8 +- .../pmix3x/pmix/src/threads/thread_usage.h | 19 +- .../pmix/pmix3x/pmix/src/threads/wait_sync.h | 2 +- .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 147 +- .../pmix3x/pmix/src/tools/pevent/Makefile.am | 3 +- .../pmix3x/pmix/src/tools/pevent/pevent.c | 6 +- .../pmix3x/pmix/src/tools/plookup/Makefile.am | 5 +- .../pmix3x/pmix/src/tools/plookup/plookup.c | 4 +- .../pmix/src/tools/pmix_info/Makefile.am | 4 +- .../pmix3x/pmix/src/tools/pps/Makefile.am | 5 +- opal/mca/pmix/pmix3x/pmix/src/util/argv.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/basename.c | 8 +- opal/mca/pmix/pmix3x/pmix/src/util/error.c | 26 +- opal/mca/pmix/pmix3x/pmix/src/util/hash.c | 4 +- .../pmix/pmix3x/pmix/src/util/keyval_parse.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/net.c | 16 - opal/mca/pmix/pmix3x/pmix/src/util/os_path.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/os_path.h | 9 +- opal/mca/pmix/pmix3x/pmix/src/util/output.c | 4 +- opal/mca/pmix/pmix3x/pmix/src/util/pif.c | 26 +- .../mca/pmix/pmix3x/pmix/src/util/show_help.c | 16 +- .../mca/pmix/pmix3x/pmix/src/util/show_help.h | 15 +- opal/mca/pmix/pmix3x/pmix/test/Makefile.am | 8 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.c | 23 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.h | 11 +- opal/mca/pmix/pmix3x/pmix/test/pmix_client.c | 7 +- opal/mca/pmix/pmix3x/pmix/test/pmix_test.c | 86 +- .../pmix/pmix3x/pmix/test/server_callbacks.c | 78 +- .../pmix/pmix3x/pmix/test/simple/simpclient.c | 1 + .../pmix/pmix3x/pmix/test/simple/simpdie.c | 8 +- .../pmix/pmix3x/pmix/test/simple/simpdmodex.c | 4 +- .../pmix/pmix3x/pmix/test/simple/simptest.c | 234 +- .../pmix/pmix3x/pmix/test/simple/simptool.c | 3 +- opal/mca/pmix/pmix3x/pmix/test/test_common.c | 13 +- opal/mca/pmix/pmix3x/pmix/test/test_common.h | 14 +- opal/mca/pmix/pmix3x/pmix/test/test_server.c | 978 ++++++++ opal/mca/pmix/pmix3x/pmix/test/test_server.h | 80 + opal/mca/pmix/pmix3x/pmix/test/utils.c | 179 +- opal/mca/pmix/pmix3x/pmix/test/utils.h | 5 +- 224 files changed, 12876 insertions(+), 6699 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 delete mode 100755 opal/mca/pmix/pmix3x/pmix/contrib/cron-run-all-md2nroff.pl delete mode 100755 opal/mca/pmix/pmix3x/pmix/contrib/md2nroff.pl create mode 100644 opal/mca/pmix/pmix3x/pmix/examples/examples.h create mode 100644 opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/Makefile.am delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/README delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_abort.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_commit.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_finalize.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_init.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_initialized.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man3/pmix_put.3 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man7/pmix.7 delete mode 100644 opal/mca/pmix/pmix3x/pmix/man/man7/pmix_constants.7 create mode 100644 opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/configure.m4 rename opal/mca/pmix/pmix3x/pmix/src/mca/{gds/ds12/gds_dstore.c => common/dstore/dstore_base.c} (55%) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_file.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.h rename opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/{gds_dstore_component.c => gds_ds12_component.c} (99%) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c delete mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c create mode 100644 opal/mca/pmix/pmix3x/pmix/test/test_server.c create mode 100644 opal/mca/pmix/pmix3x/pmix/test/test_server.h diff --git a/.gitignore b/.gitignore index 07ae3be8020..d40aac1e60f 100644 --- a/.gitignore +++ b/.gitignore @@ -365,6 +365,8 @@ opal/mca/hwloc/base/static-components.h.new.struct opal/mca/installdirs/config/install_dirs.h +!opal/mca/pmix/pmix*/pmix/AUTHORS +!opal/mca/pmix/pmix*/pmix/contrib/perf_tools/Makefile opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h opal/mca/pmix/pmix*/pmix/include/pmix/autogen/config.h.in opal/mca/pmix/pmix*/pmix/src/include/private/autogen/config.h.in diff --git a/opal/mca/pmix/pmix3x/configure.m4 b/opal/mca/pmix/pmix3x/configure.m4 index 6188960eb3b..10cd639e09b 100644 --- a/opal/mca/pmix/pmix3x/configure.m4 +++ b/opal/mca/pmix/pmix3x/configure.m4 @@ -13,7 +13,7 @@ # Copyright (c) 2011-2013 Los Alamos National Security, LLC. # All rights reserved. # Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015-2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -53,14 +53,14 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[ opal_pmix_pmix3x_timing_flag=--disable-pmix-timing fi - opal_pmix_pmix3x_args="$opal_pmix_pmix3x_timing_flag --without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\"" + opal_pmix_pmix3x_args="$opal_pmix_pmix3x_timing_flag --without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\"" AS_IF([test "$enable_debug" = "yes"], [opal_pmix_pmix3x_args="--enable-debug $opal_pmix_pmix3x_args" CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"], [opal_pmix_pmix3x_args="--disable-debug $opal_pmix_pmix3x_args" CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"]) AC_MSG_CHECKING([if want to install standalone libpmix]) - AS_IF([test "$enable_install_libpmix" == "yes"], + AS_IF([test "$enable_install_libpmix" = "yes"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) opal_pmix_pmix3x_args="--with-pmix-symbol-rename=OPAL_MCA_PMIX3X_ --enable-embedded-mode $opal_pmix_pmix3x_args"]) diff --git a/opal/mca/pmix/pmix3x/pmix/INSTALL b/opal/mca/pmix/pmix3x/pmix/INSTALL index 08fdfe641ff..3fac5ad5866 100644 --- a/opal/mca/pmix/pmix3x/pmix/INSTALL +++ b/opal/mca/pmix/pmix3x/pmix/INSTALL @@ -9,7 +9,7 @@ Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, Copyright (c) 2004-2005 The Regents of the University of California. All rights reserved. Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. -Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +Copyright (c) 2013-2019 Intel, Inc. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -22,9 +22,9 @@ For More Information This file is a *very* short overview of building and installing the PMIx library. Much more information is available in the -FAQ section on the PMIx web site: +How-To section on the PMIx web site: - http://pmix.github.io/pmix/faq + https://pmix.org/support/how-to/ Developer Builds @@ -56,6 +56,24 @@ shell$ ./configure --prefix=/where/to/install [...lots of output...] shell$ make all install +NOTE: this version of PMIx requires the Libevent package to build +and operate. Any version of Libevent greater than or equal to +2.0.21 is acceptable. + +NOTE: this version of PMIx optionally supports the HWLOC package +for providing topology information to both the host environment +(by collecting local inventory for rollup) and local client +processes. Any version of HWLOC greater than 1.10 is supported, +although versions in the 2.x series are recommended. + +Note that you must point configure at the libevent installation +using the --with-libevent= option if it is in a non-standard +location. Similarly, non-standard locations for the HWLOC package +must be specified using the --with-hwloc= option. In both +cases, PMIx will automatically detect these packages in standard +locations and build-in support for them unless otherwise specified +using the respective configure option. + If you need special access to install, then you can execute "make all" as a user with write permissions in the build tree, and a separate "make install" as a user with write permissions to the diff --git a/opal/mca/pmix/pmix3x/pmix/LICENSE b/opal/mca/pmix/pmix3x/pmix/LICENSE index 06f1248793d..3eb0a094e01 100644 --- a/opal/mca/pmix/pmix3x/pmix/LICENSE +++ b/opal/mca/pmix/pmix3x/pmix/LICENSE @@ -26,7 +26,7 @@ Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. Copyright (c) 2006-2010 The University of Houston. All rights reserved. Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. Copyright (c) 2007-2008 UT-Battelle, LLC. All rights reserved. -Copyright (c) 2007-2018 IBM Corporation. All rights reserved. +Copyright (c) 2007-2019 IBM Corporation. All rights reserved. Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing Centre, Federal Republic of Germany Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany @@ -36,7 +36,7 @@ Copyright (c) 2008-2009 Institut National de Recherche en Informatique. All rights reserved. Copyright (c) 2007 Lawrence Livermore National Security, LLC. All rights reserved. -Copyright (c) 2007-2018 Mellanox Technologies. All rights reserved. +Copyright (c) 2007-2019 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. Copyright (c) 2008-2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. @@ -45,7 +45,7 @@ Copyright (c) 2010 ARM ltd. All rights reserved. Copyright (c) 2010-2011 Alex Brick . All rights reserved. Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. -Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +Copyright (c) 2013-2019 Intel, Inc. All rights reserved. Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.am b/opal/mca/pmix/pmix3x/pmix/Makefile.am index 9d1013c08c0..78fdedaafce 100644 --- a/opal/mca/pmix/pmix3x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.am @@ -37,10 +37,6 @@ dist_pmixdata_DATA = if ! PMIX_EMBEDDED_MODE dist_pmixdata_DATA += contrib/pmix-valgrind.supp -if PMIX_HAVE_PANDOC -SUBDIRS += man -endif - endif if PMIX_TESTS_EXAMPLES diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index 4ca89d8505b..abc79780523 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -1,4 +1,4 @@ -Copyright (c) 2015-2018 Intel, Inc. All rights reserved. +Copyright (c) 2015-2019 Intel, Inc. All rights reserved. Copyright (c) 2017 IBM Corporation. All rights reserved. $COPYRIGHT$ @@ -17,8 +17,61 @@ the README file, PMIx typically maintains two separate version series simultaneously - the current release and one that is locked to only bug fixes. Since these series are semi-independent of each other, a single NEWS-worthy item might apply to different series. For -example, a bug might be fixed in the master, and then moved to the -current release as well as the "stable" bug fix release branch. +example, a bug might be fixed in the master, and then moved to +multiple release branches. + + +3.1.2 -- 24 Jan 2019 +---------------------- + - Fix a bug in macro identifying system events + - Restore some non-standard macros to the pmix_extend.h + header - these are considered "deprecated" and will be + removed from public-facing headers in future releases + + +3.1.1 -- 18 Jan 2019 +---------------------- +- Fix a bug in registration of default event handlers + that somehow slipped thru testing + + +3.1.0 -- 17 Jan 2019 +---------------------- +**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE +**** WITH THE PMIX v3 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE +**** DEFINITIONS MEET THE v3 STANDARD SPECIFICATIONS. + - Add a new, faster dstore GDS component 'ds21' + - Performance optimizations for the dstore GDS components. + - Plug miscellaneous memory leaks + - Silence an unnecessary warning message when checking connection + to a non-supporting server + - Ensure lost-connection events get delivered to default event + handlers + - Correctly handle cache refresh for queries + - Protect against race conditions between host and internal library + when dealing with async requests + - Cleanup tool operations and add support for connections to + remote servers. Initial support for debugger direct/indirect + launch verified with PRRTE. Cleanup setting of tmpdir options. + Drop rendezvous files when acting as a launcher + - Automatically store the server URI for easy access by client + - Provide MCA parameter to control TCP connect retry/timeout + - Update event notification system to properly evict oldest events + when more space is needed + - Fix a number of error paths + - Update IOF cache code to properly drop oldest message. Provide + MCA parameter for setting cache size. + - Handle setsockopt(SO_RCVTIMEO) not being supported + - Ensure that epilogs get run even when connections unexpectedly + terminate. Properly split epilog strings to process multiple + paths + - Pass the tool's command line to the server so it can be returned + in queries + - Add support for C11 atomics + - Support collection and forwarding of fabric-specific envars + - Improve handling of hwloc configure option + - Fix PMIx_server_generate_regex to preserve node ordering + - Fix a bug when registering default event handlers 3.0.2 -- 18 Sept 2018 @@ -89,6 +142,46 @@ current release as well as the "stable" bug fix release branch. - Fix several memory and file descriptor leaks +2.2.2 -- 24 Jan 2019 +---------------------- + - Fix a bug in macro identifying system events + + +2.2.1 -- 18 Jan 2019 +---------------------- + - Fix a bug in registration of default event handlers + that somehow slipped thru testing + + +2.2.0 -- 17 Jan 2019 +---------------------- +**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE +**** WITH THE PMIX v2.2 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE +**** DEFINITIONS MEET THE v2.2 STANDARD SPECIFICATIONS. + - Add a new, faster dstore GDS component 'ds21' + - Performance optimizations for the dstore GDS components. + - Plug miscellaneous memory leaks + - Silence an unnecessary warning message when checking connection + to a non-supporting server + - Ensure lost-connection events get delivered to default event + handlers + - Correctly handle cache refresh for queries + - Protect against race conditions between host and internal library + when dealing with async requests + - Cleanup tool operations and add support for connections to + remote servers. + - Automatically store the server URI for easy access by client + - Provide MCA parameter to control TCP connect retry/timeout + - Update event notification system to properly evict oldest events + when more space is needed + - Fix a number of error paths + - Handle setsockopt(SO_RCVTIMEO) not being supported + - Pass the tool's command line to the server so it can be returned + in queries + - Add support for C11 atomics + - Fix a bug when registering default event handlers + + 2.1.4 -- 18 Sep 2018 ---------------------- - Updated configury to silence warnings on older compilers diff --git a/opal/mca/pmix/pmix3x/pmix/README b/opal/mca/pmix/pmix3x/pmix/README index 22b0ec55bb8..fa96176b7e2 100644 --- a/opal/mca/pmix/pmix3x/pmix/README +++ b/opal/mca/pmix/pmix3x/pmix/README @@ -43,6 +43,11 @@ joe@mycomputer.example.com!). You can subscribe to the list here: https://groups.google.com/d/forum/pmix +Finally, just to round out all the possible ways to communicate with the +PMIx community, you are invited to join the community's Slack channel: + + pmix-workspace.slack.com + Thanks for your time. =========================================================================== @@ -192,21 +197,22 @@ PMIx's version numbers are the union of several different values: major, minor, release, and an optional quantifier. * Major: The major number is the first integer in the version string - (e.g., v1.2.3). Changes in the major number typically indicate a - significant change in the code base and/or end-user - functionality. The major number is always included in the version - number. + (e.g., v1.2.3) and indicates the corresponding version of the PMIx + Standard. In other words, a PMIx library release starting with "v2" + indicates that the implementation conforms to version 2 of the PMIx + Standard. * Minor: The minor number is the second integer in the version string (e.g., v1.2.3). Changes in the minor number typically indicate a incremental change in the code base and/or end-user - functionality. The minor number is always included in the version - number: + functionality, but not the supported version of the Standard. + The minor number is always included in the version number. * Release: The release number is the third integer in the version string (e.g., v1.2.3). Changes in the release number typically indicate a bug fix in the code base and/or end-user - functionality. + functionality. The release number is always included in the + version number. * Quantifier: PMIx version numbers sometimes have an arbitrary string affixed to the end of the version number. Common strings @@ -293,16 +299,15 @@ Application Binary Interface (ABI) Compatibility ------------------------------------------------ PMIx provides forward ABI compatibility in all versions of a given -feature release series and its corresponding -super stable series. For example, on a single platform, an pmix +feature release series. For example, on a single platform, an pmix application linked against PMIx v1.3.2 shared libraries can be updated to point to the shared libraries in any successive v1.3.x or v1.4 release and still work properly (e.g., via the LD_LIBRARY_PATH environment variable or other operating system mechanism). -PMIx reserves the right to break ABI compatibility at new feature +PMIx reserves the right to break ABI compatibility at new major release series. For example, the same pmix application from above -(linked against PMIx v1.3.2 shared libraries) will *not* work with +(linked against PMIx v1.3.2 shared libraries) may *not* work with PMIx v1.5 shared libraries. =========================================================================== diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index c10266b70b6..a81e5274f87 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -14,7 +14,7 @@ # ... major=3 -minor=0 +minor=1 release=2 # greek is used for alpha or beta release tags. If it is non-empty, @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gite574b10d +repo_rev=git0f7075f7 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Sep 18, 2018" +date="Jan 24, 2019" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,6 +75,13 @@ date="Sep 18, 2018" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:2:2 +libpmix_so_version=4:22:2 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 + +# "Common" components install standalone libraries that are run-time +# # linked by one or more components. So they need to be versioned as +# # well. Yuck; this somewhat breaks the +# # components-don't-affect-the-build-system abstraction. +# +libmca_common_dstore_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index aeca068068d..5d1660649f5 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -17,7 +17,7 @@ dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. -dnl Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. dnl Copyright (c) 2015-2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 Mellanox Technologies, Inc. @@ -189,12 +189,36 @@ AC_DEFUN([PMIX_SETUP_CORE],[ [Link the output PMIx library to this extra lib (used in embedded mode)])) AC_MSG_CHECKING([for extra lib]) AS_IF([test ! -z "$with_pmix_extra_lib"], - [AC_MSG_RESULT([$with_pmix_extra_lib]) - PMIX_EXTRA_LIB=$with_pmix_extra_lib], + [AS_IF([test "$with_pmix_extra_lib" == "yes" || test "$with_pmix_extra_lib" == "no"], + [AC_MSG_RESULT([ERROR]) + AC_MSG_WARN([Invalid value for --with-extra-pmix-lib:]) + AC_MSG_WARN([ $with_pmix_extra_lib]) + AC_MSG_WARN([Must be path name of the library to add]) + AC_MSG_ERROR([Cannot continue])], + [AC_MSG_RESULT([$with_pmix_extra_lib]) + PMIX_EXTRA_LIB=$with_pmix_extra_lib])], [AC_MSG_RESULT([no]) PMIX_EXTRA_LIB=]) AC_SUBST(PMIX_EXTRA_LIB) + # Add any extra libtool lib? + AC_ARG_WITH([pmix-extra-ltlib], + AC_HELP_STRING([--with-pmix-extra-ltlib=LIB], + [Link any embedded components/tools that require it to the provided libtool lib (used in embedded mode)])) + AC_MSG_CHECKING([for extra ltlib]) + AS_IF([test ! -z "$with_pmix_extra_ltlib"], + [AS_IF([test "$with_pmix_extra_ltlib" == "yes" || test "$with_pmix_extra_ltlib" == "no"], + [AC_MSG_RESULT([ERROR]) + AC_MSG_WARN([Invalid value for --with-pmix-extra-ltlib:]) + AC_MSG_WARN([ $with_pmix_extra_ltlib]) + AC_MSG_WARN([Must be path name of the library to add]) + AC_MSG_ERROR([Cannot continue])], + [AC_MSG_RESULT([$with_pmix_extra_ltlib]) + PMIX_EXTRA_LTLIB=$with_pmix_extra_ltlib])], + [AC_MSG_RESULT([no]) + PMIX_EXTRA_LTLIB=]) + AC_SUBST(PMIX_EXTRA_LTLIB) + # # Package/brand string # @@ -391,7 +415,8 @@ AC_DEFUN([PMIX_SETUP_CORE],[ crt_externs.h signal.h \ ioLib.h sockLib.h hostLib.h limits.h \ sys/statfs.h sys/statvfs.h \ - netdb.h ucred.h zlib.h]) + netdb.h ucred.h zlib.h sys/auxv.h \ + sys/sysctl.h]) AC_CHECK_HEADERS([sys/mount.h], [], [], [AC_INCLUDES_DEFAULT @@ -655,10 +680,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[ [AC_DEFINE_UNQUOTED([HAVE_UNIX_BYTESWAP], [1], [whether unix byteswap routines -- htonl, htons, nothl, ntohs -- are available])]) - # check pandoc separately so we can setup an AM_CONDITIONAL off it - AC_CHECK_PROG([pmix_have_pandoc], [pandoc], [yes], [no]) - AM_CONDITIONAL([PMIX_HAVE_PANDOC], [test "x$pmix_have_pandoc" = "xyes"]) - # # Make sure we can copy va_lists (need check declared, not linkable) # @@ -1078,20 +1099,6 @@ AC_DEFINE_UNQUOTED([PMIX_ENABLE_TIMING], [$WANT_PMIX_TIMING], [Whether we want developer-level timing support or not]) # -# Install header files -# -AC_MSG_CHECKING([if want to head developer-level header files]) -AC_ARG_WITH(devel-headers, - AC_HELP_STRING([--with-devel-headers], - [also install developer-level header files (only for internal PMIx developers, default: disabled)])) -if test "$with_devel_headers" = "yes"; then - AC_MSG_RESULT([yes]) - WANT_INSTALL_HEADERS=1 -else - AC_MSG_RESULT([no]) - WANT_INSTALL_HEADERS=0 -fi - # # Install backward compatibility support for PMI-1 and PMI-2 # diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 index 69f184506c4..0590dcf56cd 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 @@ -57,4 +57,6 @@ AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[ fi fi LIBS="$orig_libs" + AM_CONDITIONAL([HAVE_DSTORE_PTHREAD_LOCK], [test "$_x_ac_pthread_lock_found" = "1"]) + AM_CONDITIONAL([HAVE_DSTORE_FCNTL_LOCK], [test "$_x_ac_fcntl_lock_found" = "1"]) ]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_os_flavors.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_os_flavors.m4 index 5c333ff5111..fa08cf906c5 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_os_flavors.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_os_flavors.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. dnl Copyright (c) 2014 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl @@ -57,6 +57,13 @@ AC_DEFUN([PMIX_CHECK_OS_FLAVORS], [$pmix_have_solaris], [Whether or not we have solaris]) + AS_IF([test "$pmix_found_apple" = "yes"], + [pmix_have_apple=1], + [pmix_have_apple=0]) + AC_DEFINE_UNQUOTED([PMIX_HAVE_APPLE], + [$pmix_have_apple], + [Whether or not we have apple]) + # check for sockaddr_in (a good sign we have TCP) AC_CHECK_HEADERS([netdb.h netinet/in.h netinet/tcp.h]) AC_CHECK_TYPES([struct sockaddr_in], diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 index 062440499a6..a46b73ad4d4 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_asm.m4 @@ -2,22 +2,22 @@ dnl dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana dnl University Research and Technology dnl Corporation. All rights reserved. -dnl Copyright (c) 2004-2015 The University of Tennessee and The University +dnl Copyright (c) 2004-2018 The University of Tennessee and The University dnl of Tennessee Research Foundation. All rights dnl reserved. dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, 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) 2008-2015 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2015-2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights +dnl Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2017 Amazon.com, Inc. or its affiliates. All Rights dnl reserved. -dnl Copyright (c) 2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -25,65 +25,262 @@ dnl dnl $HEADER$ dnl +dnl This is a C test to see if 128-bit __atomic_compare_exchange_n() +dnl actually works (e.g., it compiles and links successfully on +dnl ARM64+clang, but returns incorrect answers as of August 2018). +AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE],[[ +#include +#include +#include -AC_DEFUN([PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ +typedef union { + uint64_t fake@<:@2@:>@; + __int128 real; +} pmix128; + +static void test1(void) +{ + // As of Aug 2018, we could not figure out a way to assign 128-bit + // constants -- the compilers would not accept it. So use a fake + // union to assign 2 uin64_t's to make a single __int128. + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; + pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real, + desired.real, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + if ( !(r == false && ptr.real == expected.real)) { + exit(1); + } +} + +static void test2(void) +{ + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 expected = ptr; + pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __atomic_compare_exchange_n(&ptr.real, &expected.real, + desired.real, true, + __ATOMIC_RELAXED, __ATOMIC_RELAXED); + if (!(r == true && ptr.real == desired.real)) { + exit(2); + } +} + +int main(int argc, char** argv) +{ + test1(); + test2(); + return 0; +} +]]) + +dnl ------------------------------------------------------------------ + +dnl This is a C test to see if 128-bit __sync_bool_compare_and_swap() +dnl actually works (e.g., it compiles and links successfully on +dnl ARM64+clang, but returns incorrect answers as of August 2018). +AC_DEFUN([PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE],[[ +#include +#include +#include + +typedef union { + uint64_t fake@<:@2@:>@; + __int128 real; +} pmix128; + +static void test1(void) +{ + // As of Aug 2018, we could not figure out a way to assign 128-bit + // constants -- the compilers would not accept it. So use a fake + // union to assign 2 uin64_t's to make a single __int128. + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 oldval = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; + pmix128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real); + if (!(r == false && ptr.real != newval.real)) { + exit(1); + } +} + +static void test2(void) +{ + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 oldval = ptr; + pmix128 newval = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = __sync_bool_compare_and_swap(&ptr.real, oldval.real, newval.real); + if (!(r == true && ptr.real == newval.real)) { + exit(2); + } +} + +int main(int argc, char** argv) +{ + test1(); + test2(); + return 0; +} +]]) - PMIX_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result CFLAGS_save]) +dnl This is a C test to see if 128-bit __atomic_compare_exchange_n() +dnl actually works (e.g., it compiles and links successfully on +dnl ARM64+clang, but returns incorrect answers as of August 2018). +AC_DEFUN([PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE],[[ +#include +#include +#include +#include - AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128], - [enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])]) +typedef union { + uint64_t fake@<:@2@:>@; + _Atomic __int128 real; +} pmix128; - sync_bool_compare_and_swap_128_result=0 +static void test1(void) +{ + // As of Aug 2018, we could not figure out a way to assign 128-bit + // constants -- the compilers would not accept it. So use a fake + // union to assign 2 uin64_t's to make a single __int128. + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 expected = { .fake = { 0x11EEDDCCBBAA0099, 0x88776655443322FF }}; + pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real, + desired.real, true, + atomic_relaxed, atomic_relaxed); + if ( !(r == false && ptr.real == expected.real)) { + exit(1); + } +} - if test ! "$enable_cross_cmpset128" = "yes" ; then - AC_MSG_CHECKING([for processor support of __sync builtin atomic compare-and-swap on 128-bit values]) +static void test2(void) +{ + pmix128 ptr = { .fake = { 0xFFEEDDCCBBAA0099, 0x8877665544332211 }}; + pmix128 expected = ptr; + pmix128 desired = { .fake = { 0x1122DDCCBBAA0099, 0x887766554433EEFF }}; + bool r = atomic_compare_exchange_strong (&ptr.real, &expected.real, + desired.real, true, + atomic_relaxed, atomic_relaxed); + if (!(r == true && ptr.real == desired.real)) { + exit(2); + } +} - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) +int main(int argc, char** argv) +{ + test1(); + test2(); + return 0; +} +]]) - if test $sync_bool_compare_and_swap_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" +dnl ------------------------------------------------------------------ - AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);])], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) +dnl +dnl Check to see if a specific function is linkable. +dnl +dnl Check with: +dnl 1. No compiler/linker flags. +dnl 2. CFLAGS += -mcx16 +dnl 3. LIBS += -latomic +dnl 4. Finally, if it links ok with any of #1, #2, or #3, actually try +dnl to run the test code (if we're not cross-compiling) and verify +dnl that it actually gives us the correct result. +dnl +dnl Note that we unfortunately can't use AC SEARCH_LIBS because its +dnl check incorrectly fails (because these functions are special compiler +dnl intrinsics -- SEARCH_LIBS tries with "check FUNC()", which the +dnl compiler complains doesn't match the internal prototype). So we have +dnl to use our own LINK_IFELSE tests. Indeed, since these functions are +dnl so special, we actually need a valid source code that calls the +dnl functions with correct arguments, etc. It's not enough, for example, +dnl to do the usual "try to set a function pointer to the symbol" trick to +dnl determine if these functions are available, because the compiler may +dnl not implement these as actual symbols. So just try to link a real +dnl test code. +dnl +dnl $1: function name to print +dnl $2: program to test +dnl $3: action if any of 1, 2, or 3 succeeds +dnl #4: action if all of 1, 2, and 3 fail +dnl +AC_DEFUN([PMIX_ASM_CHECK_ATOMIC_FUNC],[ + PMIX_VAR_SCOPE_PUSH([pmix_asm_check_func_happy pmix_asm_check_func_CFLAGS_save pmix_asm_check_func_LIBS_save]) + + pmix_asm_check_func_CFLAGS_save=$CFLAGS + pmix_asm_check_func_LIBS_save=$LIBS + + dnl Check with no compiler/linker flags + AC_MSG_CHECKING([for $1]) + AC_LINK_IFELSE([$2], + [pmix_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [pmix_asm_check_func_happy=0 + AC_MSG_RESULT([no])]) + + dnl If that didn't work, try again with CFLAGS+=mcx16 + AS_IF([test $pmix_asm_check_func_happy -eq 0], + [AC_MSG_CHECKING([for $1 with -mcx16]) + CFLAGS="$CFLAGS -mcx16" + AC_LINK_IFELSE([$2], + [pmix_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [pmix_asm_check_func_happy=0 + CFLAGS=$pmix_asm_check_func_CFLAGS_save + AC_MSG_RESULT([no])]) + ]) + + dnl If that didn't work, try again with LIBS+=-latomic + AS_IF([test $pmix_asm_check_func_happy -eq 0], + [AC_MSG_CHECKING([for $1 with -latomic]) + LIBS="$LIBS -latomic" + AC_LINK_IFELSE([$2], + [pmix_asm_check_func_happy=1 + AC_MSG_RESULT([yes])], + [pmix_asm_check_func_happy=0 + LIBS=$pmix_asm_check_func_LIBS_save + AC_MSG_RESULT([no])]) + ]) + + dnl If we have it, try it and make sure it gives a correct result. + dnl As of Aug 2018, we know that it links but does *not* work on clang + dnl 6 on ARM64. + AS_IF([test $pmix_asm_check_func_happy -eq 1], + [AC_MSG_CHECKING([if $1() gives correct results]) + AC_RUN_IFELSE([$2], + [AC_MSG_RESULT([yes])], + [pmix_asm_check_func_happy=0 + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) - CFLAGS=$CFLAGS_save - fi - else - AC_MSG_CHECKING([for compiler support of __sync builtin atomic compare-and-swap on 128-bit values]) + dnl If we were unsuccessful, restore CFLAGS/LIBS + AS_IF([test $pmix_asm_check_func_happy -eq 0], + [CFLAGS=$pmix_asm_check_func_CFLAGS_save + LIBS=$pmix_asm_check_func_LIBS_save]) - # Check if the compiler supports the __sync builtin - AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1], - [AC_MSG_RESULT([no])]) + dnl Run the user actions + AS_IF([test $pmix_asm_check_func_happy -eq 1], [$3], [$4]) - if test $sync_bool_compare_and_swap_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" + PMIX_VAR_SCOPE_POP +]) + +dnl ------------------------------------------------------------------ - AC_MSG_CHECKING([for __sync builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_TRY_LINK([], [__int128 x = 0; __sync_bool_compare_and_swap (&x, 0, 1);], - [AC_MSG_RESULT([yes]) - sync_bool_compare_and_swap_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])]) +AC_DEFUN([PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128], [ + PMIX_VAR_SCOPE_PUSH([sync_bool_compare_and_swap_128_result]) - CFLAGS=$CFLAGS_save - fi - fi + # Do we have __sync_bool_compare_and_swap? + # Use a special macro because we need to check with a few different + # CFLAGS/LIBS. + PMIX_ASM_CHECK_ATOMIC_FUNC([__sync_bool_compare_and_swap], + [AC_LANG_SOURCE(PMIX_SYNC_BOOL_COMPARE_AND_SWAP_TEST_SOURCE)], + [sync_bool_compare_and_swap_128_result=1], + [sync_bool_compare_and_swap_128_result=0]) - AC_DEFINE_UNQUOTED([PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128], [$sync_bool_compare_and_swap_128_result], - [Whether the __sync builtin atomic compare and swap supports 128-bit values]) + AC_DEFINE_UNQUOTED([PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128], + [$sync_bool_compare_and_swap_128_result], + [Whether the __sync builtin atomic compare and swap supports 128-bit values]) PMIX_VAR_SCOPE_POP ]) @@ -112,7 +309,7 @@ __sync_add_and_fetch(&tmp, 1);], pmix_asm_sync_have_64bit=0]) AC_DEFINE_UNQUOTED([PMIX_ASM_SYNC_HAVE_64BIT],[$pmix_asm_sync_have_64bit], - [Whether 64-bit is supported by the __sync builtin atomics]) + [Whether 64-bit is supported by the __sync builtin atomics]) # Check for 128-bit support PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128 @@ -120,73 +317,110 @@ __sync_add_and_fetch(&tmp, 1);], AC_DEFUN([PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128], [ + PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result atomic_compare_exchange_n_128_CFLAGS_save atomic_compare_exchange_n_128_LIBS_save]) + + atomic_compare_exchange_n_128_CFLAGS_save=$CFLAGS + atomic_compare_exchange_n_128_LIBS_save=$LIBS + + # Do we have __sync_bool_compare_and_swap? + # Use a special macro because we need to check with a few different + # CFLAGS/LIBS. + PMIX_ASM_CHECK_ATOMIC_FUNC([__atomic_compare_exchange_n], + [AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_N_TEST_SOURCE)], + [atomic_compare_exchange_n_128_result=1], + [atomic_compare_exchange_n_128_result=0]) + + # If we have it and it works, check to make sure it is always lock + # free. + AS_IF([test $atomic_compare_exchange_n_128_result -eq 1], + [AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])], + [AC_MSG_RESULT([yes])], + [atomic_compare_exchange_n_128_result=0 + # If this test fails, need to reset CFLAGS/LIBS (the + # above tests atomically set CFLAGS/LIBS or not; this + # test is running after the fact, so we have to undo + # the side-effects of setting CFLAGS/LIBS if the above + # tests passed). + CFLAGS=$atomic_compare_exchange_n_128_CFLAGS_save + LIBS=$atomic_compare_exchange_n_128_LIBS_save + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) + + AC_DEFINE_UNQUOTED([PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128], + [$atomic_compare_exchange_n_128_result], + [Whether the __atomic builtin atomic compare swap is both supported and lock-free on 128-bit values]) + + dnl If we could not find decent support for 128-bits __atomic let's + dnl try the GCC _sync + AS_IF([test $atomic_compare_exchange_n_128_result -eq 0], + [PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128]) - PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_n_128_result CFLAGS_save]) - - AC_ARG_ENABLE([cross-cmpset128],[AC_HELP_STRING([--enable-cross-cmpset128], - [enable the use of the __sync builtin atomic compare-and-swap 128 when cross compiling])]) - - atomic_compare_exchange_n_128_result=0 - - if test ! "$enable_cross_cmpset128" = "yes" ; then - AC_MSG_CHECKING([for processor support of __atomic builtin atomic compare-and-swap on 128-bit values]) - - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) + PMIX_VAR_SCOPE_POP +]) - if test $atomic_compare_exchange_n_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" +AC_DEFUN([PMIX_CHECK_GCC_ATOMIC_BUILTINS], [ + AC_MSG_CHECKING([for __atomic builtin atomics]) - AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);])], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])], - [AC_MSG_RESULT([no (cross compiling)])]) + AC_TRY_LINK([ +#include +uint32_t tmp, old = 0; +uint64_t tmp64, old64 = 0;], [ +__atomic_thread_fence(__ATOMIC_SEQ_CST); +__atomic_compare_exchange_n(&tmp, &old, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp, 1, __ATOMIC_RELAXED); +__atomic_compare_exchange_n(&tmp64, &old64, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED); +__atomic_add_fetch(&tmp64, 1, __ATOMIC_RELAXED);], + [AC_MSG_RESULT([yes]) + $1], + [AC_MSG_RESULT([no]) + $2]) - CFLAGS=$CFLAGS_save - fi + # Check for 128-bit support + PMIX_CHECK_GCC_BUILTIN_CSWAP_INT128 +]) - if test $atomic_compare_exchange_n_128_result = 1 ; then - AC_MSG_CHECKING([if __int128 atomic compare-and-swap is always lock-free]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([], [if (!__atomic_always_lock_free(16, 0)) { return 1; }])], +AC_DEFUN([PMIX_CHECK_C11_CSWAP_INT128], [ + PMIX_VAR_SCOPE_PUSH([atomic_compare_exchange_result atomic_compare_exchange_CFLAGS_save atomic_compare_exchange_LIBS_save]) + + atomic_compare_exchange_CFLAGS_save=$CFLAGS + atomic_compare_exchange_LIBS_save=$LIBS + + # Do we have C11 atomics on 128-bit integers? + # Use a special macro because we need to check with a few different + # CFLAGS/LIBS. + PMIX_ASM_CHECK_ATOMIC_FUNC([atomic_compare_exchange_strong_16], + [AC_LANG_SOURCE(PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_TEST_SOURCE)], + [atomic_compare_exchange_result=1], + [atomic_compare_exchange_result=0]) + + # If we have it and it works, check to make sure it is always lock + # free. + AS_IF([test $atomic_compare_exchange_result -eq 1], + [AC_MSG_CHECKING([if C11 __int128 atomic compare-and-swap is always lock-free]) + AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [_Atomic __int128_t x; if (!atomic_is_lock_free(&x)) { return 1; }])], [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128 - atomic_compare_exchange_n_128_result=0], - [AC_MSG_RESULT([no (cross compiling)])]) - fi - else - AC_MSG_CHECKING([for compiler support of __atomic builtin atomic compare-and-swap on 128-bit values]) - - # Check if the compiler supports the __atomic builtin - AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1], - [AC_MSG_RESULT([no])]) - - if test $atomic_compare_exchange_n_128_result = 0 ; then - CFLAGS_save=$CFLAGS - CFLAGS="$CFLAGS -mcx16" - - AC_MSG_CHECKING([for __atomic builtin atomic compare-and-swap on 128-bit values with -mcx16 flag]) - AC_TRY_LINK([], [__int128 x = 0, y = 0; __atomic_compare_exchange_n (&x, &y, 1, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);], - [AC_MSG_RESULT([yes]) - atomic_compare_exchange_n_128_result=1 - CFLAGS_save="$CFLAGS"], - [AC_MSG_RESULT([no])]) - - CFLAGS=$CFLAGS_save - fi - fi - - AC_DEFINE_UNQUOTED([PMIX_HAVE_GCC_BUILTIN_CSWAP_INT128], [$atomic_compare_exchange_n_128_result], - [Whether the __atomic builtin atomic compare and swap is lock-free on 128-bit values]) + [atomic_compare_exchange_result=0 + # If this test fails, need to reset CFLAGS/LIBS (the + # above tests atomically set CFLAGS/LIBS or not; this + # test is running after the fact, so we have to undo + # the side-effects of setting CFLAGS/LIBS if the above + # tests passed). + CFLAGS=$atomic_compare_exchange_CFLAGS_save + LIBS=$atomic_compare_exchange_LIBS_save + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) + + AC_DEFINE_UNQUOTED([PMIX_HAVE_C11_CSWAP_INT128], + [$atomic_compare_exchange_result], + [Whether C11 atomic compare swap is both supported and lock-free on 128-bit values]) + + dnl If we could not find decent support for 128-bits atomic let's + dnl try the GCC _sync + AS_IF([test $atomic_compare_exchange_result -eq 0], + [PMIX_CHECK_SYNC_BUILTIN_CSWAP_INT128]) PMIX_VAR_SCOPE_POP ]) @@ -533,7 +767,7 @@ dnl PMIX_CHECK_ASM_TYPE dnl dnl Sets PMIX_ASM_TYPE to the prefix for the function type to dnl set a symbol's type as function (needed on ELF for shared -dnl libaries). If no .type directive is needed, sets PMIX_ASM_TYPE +dnl libraries). If no .type directive is needed, sets PMIX_ASM_TYPE dnl to an empty string dnl dnl We look for @ \# % @@ -727,7 +961,7 @@ AC_DEFUN([PMIX_CHECK_SPARCV8PLUS],[ AC_MSG_CHECKING([if have Sparc v8+/v9 support]) sparc_result=0 PMIX_TRY_ASSEMBLE([$pmix_cv_asm_text - casa [%o0] 0x80, %o1, %o2], + casa [%o0] 0x80, %o1, %o2], [sparc_result=1], [sparc_result=0]) if test "$sparc_result" = "1" ; then @@ -746,35 +980,8 @@ dnl dnl PMIX_CHECK_CMPXCHG16B dnl dnl ################################################################# -AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[ - PMIX_VAR_SCOPE_PUSH([cmpxchg16b_result]) - - AC_ARG_ENABLE([cross-cmpxchg16b],[AC_HELP_STRING([--enable-cross-cmpxchg16b], - [enable the use of the cmpxchg16b instruction when cross compiling])]) - - if test ! "$enable_cross_cmpxchg16b" = "yes" ; then - AC_MSG_CHECKING([if processor supports x86_64 16-byte compare-and-exchange]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([[unsigned char tmp[16];]],[[ - __asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])], - [AC_MSG_RESULT([yes]) - cmpxchg16b_result=1], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0], - [AC_MSG_RESULT([no (cross-compiling)]) - cmpxchg16b_result=0]) - else - AC_MSG_CHECKING([if assembler supports x86_64 16-byte compare-and-exchange]) - - PMIX_TRY_ASSEMBLE([$pmix_cv_asm_text - cmpxchg16b 0], - [AC_MSG_RESULT([yes]) - cmpxchg16b_result=1], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0]) - fi - if test "$cmpxchg16b_result" = 1; then - AC_MSG_CHECKING([if compiler correctly handles volatile 128bits]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([#include +AC_DEFUN([PMIX_CMPXCHG16B_TEST_SOURCE],[[ +#include #include union pmix_counted_pointer_t { @@ -788,8 +995,10 @@ union pmix_counted_pointer_t { int128_t value; #endif }; -typedef union pmix_counted_pointer_t pmix_counted_pointer_t;], - [volatile pmix_counted_pointer_t a; +typedef union pmix_counted_pointer_t pmix_counted_pointer_t; + +int main(int argc, char* argv) { + volatile pmix_counted_pointer_t a; pmix_counted_pointer_t b; a.data.counter = 0; @@ -814,12 +1023,28 @@ typedef union pmix_counted_pointer_t pmix_counted_pointer_t;], return (a.value != b.value); #else return 0; -#endif])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - cmpxchg16b_result=0], - [AC_MSG_RESULT([untested, assuming ok])]) - fi +#endif +} +]]) + +AC_DEFUN([PMIX_CHECK_CMPXCHG16B],[ + PMIX_VAR_SCOPE_PUSH([cmpxchg16b_result]) + + PMIX_ASM_CHECK_ATOMIC_FUNC([cmpxchg16b], + [AC_LANG_PROGRAM([[unsigned char tmp[16];]], + [[__asm__ __volatile__ ("lock cmpxchg16b (%%rsi)" : : "S" (tmp) : "memory", "cc");]])], + [cmpxchg16b_result=1], + [cmpxchg16b_result=0]) + # If we have it, make sure it works. + AS_IF([test $cmpxchg16b_result -eq 1], + [AC_MSG_CHECKING([if cmpxchg16b_result works]) + AC_RUN_IFELSE([AC_LANG_SOURCE(PMIX_CMPXCHG16B_TEST_SOURCE)], + [AC_MSG_RESULT([yes])], + [cmpxchg16b_result=0 + AC_MSG_RESULT([no])], + [AC_MSG_RESULT([cannot test -- assume yes (cross compiling)])]) + ]) + AC_DEFINE_UNQUOTED([PMIX_HAVE_CMPXCHG16B], [$cmpxchg16b_result], [Whether the processor supports the cmpxchg16b instruction]) PMIX_VAR_SCOPE_POP @@ -832,7 +1057,7 @@ dnl dnl Check if the compiler is capable of doing GCC-style inline dnl assembly. Some compilers emit a warning and ignore the inline dnl assembly (xlc on OS X) and compile without error. Therefore, -dnl the test attempts to run the emited code to check that the +dnl the test attempts to run the emitted code to check that the dnl assembly is actually run. To run this test, one argument to dnl the macro must be an assembly instruction in gcc format to move dnl the value 0 into the register containing the variable ret. @@ -885,7 +1110,7 @@ return ret; if test "$asm_result" = "yes" ; then PMIX_C_GCC_INLINE_ASSEMBLY=1 - pmix_cv_asm_inline_supported="yes" + pmix_cv_asm_inline_supported="yes" else PMIX_C_GCC_INLINE_ASSEMBLY=0 fi @@ -912,18 +1137,30 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ AC_REQUIRE([PMIX_SETUP_CC]) AC_REQUIRE([AM_PROG_AS]) + AC_ARG_ENABLE([c11-atomics],[AC_HELP_STRING([--enable-c11-atomics], + [Enable use of C11 atomics if available (default: enabled)])]) + AC_ARG_ENABLE([builtin-atomics], [AC_HELP_STRING([--enable-builtin-atomics], - [Enable use of __sync builtin atomics (default: enabled)])], - [], [enable_builtin_atomics="yes"]) + [Enable use of __sync builtin atomics (default: disabled)])]) - pmix_cv_asm_builtin="BUILTIN_NO" - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"], - [PMIX_CHECK_GCC_ATOMIC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_GCC"], [])]) - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" != "no"], - [PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], [])]) - AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], - [AC_MSG_WARN([__sync builtin atomics requested but not found - proceeding with inline atomics])]) + PMIX_CHECK_C11_CSWAP_INT128 + + if test "x$enable_c11_atomics" != "xno" && test "$pmix_cv_c11_supported" = "yes" ; then + pmix_cv_asm_builtin="BUILTIN_C11" + PMIX_CHECK_C11_CSWAP_INT128 + elif test "x$enable_c11_atomics" = "xyes"; then + AC_MSG_WARN([C11 atomics were requested but are not supported]) + AC_MSG_ERROR([Cannot continue]) + else + pmix_cv_asm_builtin="BUILTIN_NO" + AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], + [PMIX_CHECK_GCC_ATOMIC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_GCC"], [])]) + AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], + [PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], [])]) + AS_IF([test "$pmix_cv_asm_builtin" = "BUILTIN_NO" && test "$enable_builtin_atomics" = "yes"], + [AC_MSG_ERROR([__sync builtin atomics requested but not found.])]) + fi PMIX_CHECK_ASM_PROC PMIX_CHECK_ASM_TEXT @@ -960,9 +1197,9 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ ia64-*) pmix_cv_asm_arch="IA64" PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; - aarch64*) + aarch64*) pmix_cv_asm_arch="ARM64" PMIX_ASM_SUPPORT_64BIT=1 PMIX_ASM_ARM_VERSION=8 @@ -994,7 +1231,7 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ # uses Linux kernel helpers for some atomic operations pmix_cv_asm_arch="ARM" PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; mips-*|mips64*) @@ -1002,7 +1239,7 @@ AC_DEFUN([PMIX_CONFIG_ASM],[ # a MIPS III machine (r4000 and later) pmix_cv_asm_arch="MIPS" PMIX_CHECK_SYNC_BUILTINS([pmix_cv_asm_builtin="BUILTIN_SYNC"], - [AC_MSG_ERROR([No atomic primitives available for $host])]) + [AC_MSG_ERROR([No atomic primitives available for $host])]) ;; powerpc-*|powerpc64-*|powerpcle-*|powerpc64le-*|rs6000-*|ppc-*) @@ -1070,11 +1307,11 @@ AC_MSG_ERROR([Can not continue.]) ;; esac - if test "x$PMIX_ASM_SUPPORT_64BIT" = "x1" && test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" && - test "$pmix_asm_sync_have_64bit" = "0" ; then - # __sync builtins exist but do not implement 64-bit support. Fall back on inline asm. - pmix_cv_asm_builtin="BUILTIN_NO" - fi + if test "x$PMIX_ASM_SUPPORT_64BIT" = "x1" && test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" && + test "$pmix_asm_sync_have_64bit" = "0" ; then + # __sync builtins exist but do not implement 64-bit support. Fall back on inline asm. + pmix_cv_asm_builtin="BUILTIN_NO" + fi if test "$pmix_cv_asm_builtin" = "BUILTIN_SYNC" || test "$pmix_cv_asm_builtin" = "BUILTIN_GCC" ; then AC_DEFINE([PMIX_C_GCC_INLINE_ASSEMBLY], [1], @@ -1097,7 +1334,7 @@ AC_MSG_ERROR([Can not continue.]) ;; esac - pmix_cv_asm_inline_supported="no" + pmix_cv_asm_inline_supported="no" # now that we know our architecture, try to inline assemble PMIX_CHECK_INLINE_C_GCC([$PMIX_GCC_INLINE_ASSIGN]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 index 262e6f4a88e..2978c928b9a 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_mca.m4 @@ -11,7 +11,7 @@ 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-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2013-2016 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -428,7 +428,7 @@ AC_DEFUN([MCA_CONFIGURE_FRAMEWORK],[ # Create the final .h file that will be included in the type's # top-level glue. This lists all the static components. We don't # need to do this for "common". - if test "$2" != "common"; then + if test "$1" != "common"; then cat > $outfile <]],[[_Static_assert(sizeof(int64_t) == 8, "WTH");]]) - AS_IF([test $pmix_prog_cc_c11_helper__Thread_local_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_var_available -eq 1], + PMIX_CC_HELPER([if $CC $1 supports C11 atomic_fetch_xor_explicit], [pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available], + [[#include +#include ]],[[_Atomic uint32_t a; uint32_t b; atomic_fetch_xor_explicit(&a, b, memory_order_relaxed);]]) + + + AS_IF([test $pmix_prog_cc_c11_helper__Thread_local_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_var_available -eq 1 && test $pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available -eq 1], [$2], [$3]) @@ -128,7 +133,7 @@ AC_DEFUN([PMIX_SETUP_CC],[ AC_REQUIRE([_PMIX_PROG_CC]) AC_REQUIRE([AM_PROG_CC_C_O]) - PMIX_VAR_SCOPE_PUSH([pmix_prog_cc_c11_helper__Thread_local_available pmix_prog_cc_c11_helper_atomic_var_available pmix_prog_cc_c11_helper__Atomic_available pmix_prog_cc_c11_helper__static_assert_available pmix_prog_cc_c11_helper__Generic_available pmix_prog_cc__thread_available]) + PMIX_VAR_SCOPE_PUSH([pmix_prog_cc_c11_helper__Thread_local_available pmix_prog_cc_c11_helper_atomic_var_available pmix_prog_cc_c11_helper__Atomic_available pmix_prog_cc_c11_helper__static_assert_available pmix_prog_cc_c11_helper__Generic_available pmix_prog_cc__thread_available pmix_prog_cc_c11_helper_atomic_fetch_xor_explicit_available]) PMIX_PROG_CC_C11 diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 index 9e66a4133fb..043c0c4d44f 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_cli.m4 @@ -2,7 +2,8 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2018 Cisco, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -33,6 +34,7 @@ AC_DEFUN([PMIX_CAPTURE_CONFIGURE_CLI],[ eval "$1=\$$1\\ \$quoted_arg" done + AC_DEFINE_UNQUOTED([$1], ["$$1"], [Capture the configure cmd line]) PMIX_VAR_SCOPE_POP AC_SUBST($1) ]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 index 86a9b9d4473..8f6ed75176d 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -13,6 +13,43 @@ # MCA_hwloc_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([PMIX_HWLOC_CONFIG],[ + AC_ARG_WITH([hwloc-header], + [AC_HELP_STRING([--with-hwloc-header=HEADER], + [The value that should be included in C files to include hwloc.h])]) + + AC_ARG_ENABLE([embedded-hwloc], + [AC_HELP_STRING([--enable-embedded-hwloc], + [Enable use of locally embedded hwloc])]) + + AS_IF([test "$enable_embedded_hwloc" = "yes"], + [_PMIX_HWLOC_EMBEDDED_MODE], + [_PMIX_HWLOC_EXTERNAL]) + + AC_MSG_CHECKING([hwloc header]) + AC_DEFINE_UNQUOTED([PMIX_HWLOC_HEADER], [$PMIX_HWLOC_HEADER], + [Location of hwloc.h]) + AC_MSG_RESULT([$PMIX_HWLOC_HEADER]) + + AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support], + [Whether or not we have hwloc support]) + + PMIX_SUMMARY_ADD([[External Packages]],[[HWLOC]], [pmix_hwloc], [$pmix_hwloc_support_will_build ($pmix_hwloc_source)]) +]) + +AC_DEFUN([_PMIX_HWLOC_EMBEDDED_MODE],[ + AC_MSG_CHECKING([for hwloc]) + AC_MSG_RESULT([assumed available (embedded mode)]) + + AS_IF([test -z "$with_hwloc_header" || test "$with_hwloc_header" = "yes"], + [PMIX_HWLOC_HEADER=""], + [PMIX_HWLOC_HEADER="$with_hwloc_header"]) + + pmix_hwloc_support=1 + pmix_hwloc_source=embedded + pmix_hwloc_support_will_build=yes + ]) + +AC_DEFUN([_PMIX_HWLOC_EXTERNAL],[ PMIX_VAR_SCOPE_PUSH([pmix_hwloc_dir pmix_hwloc_libdir pmix_hwloc_standard_lib_location pmix_hwloc_standard_header_location]) AC_ARG_WITH([hwloc], @@ -45,6 +82,17 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ AC_MSG_RESULT([$pmix_hwloc_dir and $pmix_hwloc_libdir])], [AC_MSG_RESULT([$with_hwloc_libdir])]) else + pmix_hwloc_dir=/usr/include + if test -d /usr/lib; then + pmix_hwloc_libdir=/usr/lib + elif test -d /usr/lib64; then + pmix_hwloc_libdir=/usr/lib64 + else + AC_MSG_RESULT([not found]) + AC_MSG_WARN([Could not find /usr/lib or /usr/lib64 - you may]) + AC_MSG_WARN([need to specify --with-hwloc_libdir=]) + AC_MSG_ERROR([Can not continue]) + fi AC_MSG_RESULT([(default search paths)]) pmix_hwloc_standard_header_location=yes pmix_hwloc_standard_lib_location=yes @@ -62,18 +110,13 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ [$pmix_hwloc_libdir], [pmix_hwloc_support=1], [pmix_hwloc_support=0]) - if test $pmix_hwloc_support = "1"; then - LIBS="$LIBS -lhwloc" - PMIX_EMBEDDED_LIBS="$PMIX_EMBEDDED_LIBS -lhwloc" - if test "$pmix_hwloc_standard_header_location" != "yes"; then - PMIX_EMBEDDED_CPPFLAGS="$PMIX_EMBEDDED_CPPFLAGS $pmix_hwloc_CPPFLAGS" - CPPFLAGS="$CPPFLAGS $pmix_hwloc_CPPFLAGS" - fi - if test "$pmix_hwloc_standard_lib_location" != "yes"; then - PMIX_EMBEDDED_LDFLAGS="$PMIX_EMBEDDED_LDFLAGS $pmix_hwloc_LDFLAGS" - LDFLAGS="$LDFLAGS $pmix_hwloc_LDFLAGS" - fi - fi + + AS_IF([test "$pmix_hwloc_standard_header_location" != "yes"], + [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_hwloc_CPPFLAGS)]) + + AS_IF([test "$pmix_hwloc_standard_lib_location" != "yes"], + [PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_hwloc_LDFLAGS)]) + PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_hwloc_LIBS) fi if test ! -z "$with_hwloc" && test "$with_hwloc" != "no" && test "$pmix_hwloc_support" != "1"; then @@ -98,11 +141,16 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ AC_MSG_CHECKING([will hwloc support be built]) if test "$pmix_hwloc_support" != "1"; then AC_MSG_RESULT([no]) + pmix_hwloc_source=none + pmix_hwloc_support_will_build=no else AC_MSG_RESULT([yes]) + pmix_hwloc_source=$pmix_hwloc_dir + pmix_hwloc_support_will_build=yes fi - AC_DEFINE_UNQUOTED([PMIX_HAVE_HWLOC], [$pmix_hwloc_support], - [Whether or not we have hwloc support]) + # Set output variables + PMIX_HWLOC_HEADER="" + PMIX_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 index 739f0b8f22a..2348a87aacb 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -35,6 +35,8 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[ AC_DEFINE_UNQUOTED([PMIX_EVENT2_THREAD_HEADER], [$PMIX_EVENT2_THREAD_HEADER], [Location of event2/thread.h]) AC_MSG_RESULT([$PMIX_EVENT2_THREAD_HEADER]) + + PMIX_SUMMARY_ADD([[External Packages]],[[Libevent]], [pmix_libevent], [yes ($pmix_libevent_source)]) ]) AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[ @@ -47,6 +49,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[ [PMIX_EVENT_HEADER="$with_libevent_header" PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"]) + pmix_libevent_source=embedded ]) AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ @@ -115,9 +118,8 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ AS_IF([test "$pmix_event_defaults" = "no"], [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) - PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) - + PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) # Ensure that this libevent has the symbol # "evthread_set_lock_callbacks", which will only exist if @@ -138,6 +140,7 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ # Set output variables PMIX_EVENT_HEADER="" PMIX_EVENT2_THREAD_HEADER="" + pmix_libevent_source=$pmix_event_dir PMIX_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 new file mode 100644 index 00000000000..9b9bc9024e1 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_summary.m4 @@ -0,0 +1,79 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights +dnl reserved. +dnl Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved +dnl Copyright (c) 2016 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2018-2019 Intel, Inc. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl +AC_DEFUN([PMIX_SUMMARY_ADD],[ + PMIX_VAR_SCOPE_PUSH([pmix_summary_section pmix_summary_line pmix_summary_section_current]) + + dnl need to replace spaces in the section name with somethis else. _ seems like a reasonable + dnl choice. if this changes remember to change PMIX_PRINT_SUMMARY as well. + pmix_summary_section=$(echo $1 | tr ' ' '_') + pmix_summary_line="$2: $4" + pmix_summary_section_current=$(eval echo \$pmix_summary_values_$pmix_summary_section) + + if test -z "$pmix_summary_section_current" ; then + if test -z "$pmix_summary_sections" ; then + pmix_summary_sections=$pmix_summary_section + else + pmix_summary_sections="$pmix_summary_sections $pmix_summary_section" + fi + eval pmix_summary_values_$pmix_summary_section=\"$pmix_summary_line\" + else + eval pmix_summary_values_$pmix_summary_section=\"$pmix_summary_section_current,$pmix_summary_line\" + fi + + PMIX_VAR_SCOPE_POP +]) + +AC_DEFUN([PMIX_SUMMARY_PRINT],[ + PMIX_VAR_SCOPE_PUSH([pmix_summary_section pmix_summary_section_name]) + cat < \$repo_arg, - "source-branch=s" => \$source_branch_arg, - "pages-branch=s" => \$pages_branch_arg, - "logfile-dir=s" => \$logfile_dir_arg, - "help|h" => \$help_arg, - "verbose" => \$verbose_arg, - ); - -if (!$ok || $help_arg) { - print "Invalid command line argument.\n\n" - if (!$ok); - print "Options: - --help | -h Print this message - --repo Git repo to be updated - --source-branch Branch containing source files (default: master) - --pages-branch Branch where man pages are to be output (default: gh-pages) - --logfile-dir Directory where execution log is to be written (default: /tmp) - --verbose Print debug info during execution\n"; - exit($ok ? 0 : 1); -} - -# Sanity checks -die "Must specify a git repo" - if (!defined($repo_arg)); - -##################################################################### - -my $logfile_dir = $logfile_dir_arg; -my $logfile_counter = 1; - -sub doit { - my $allowed_to_fail = shift; - my $cmd = shift; - my $stdout_file = shift; - - # Put a prefix on the logfiles so that we know that they belong to - # this script, and put a counter so that we know the sequence of - # logfiles - $stdout_file = "runall-md2nroff-$logfile_counter-$stdout_file"; - ++$logfile_counter; - - # Redirect stdout if requested - if (defined $stdout_file) { - $stdout_file = "$logfile_dir/$stdout_file.log"; - unlink($stdout_file); - $cmd .= " >$stdout_file"; - } elsif (!$verbose_arg && $cmd !~ />/) { - $cmd .= " >/dev/null"; - } - $cmd .= " 2>&1"; - - my $rc = system($cmd); - if (0 != $rc && !$allowed_to_fail) { - # If we die/fail, ensure to change out of the temp tree so - # that it can be removed upon exit. - chdir("/"); - die "Command $cmd failed: exit status $rc"; - } - - system("cat $stdout_file") - if ($verbose_arg && defined($stdout_file) && -f $stdout_file); -} - -sub verbose { - print @_ - if ($verbose_arg); -} - -##################################################################### - -# Setup a logfile dir just for this run -my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = - localtime(time); -$logfile_dir = - sprintf("%s/cron-run-all-md2nroff-logs-%04d-%02d-%02d-%02d%02d", - $logfile_dir_arg, $year + 1900, $mon + 1, $mday, - $hour, $min); -my $rc = system("mkdir $logfile_dir"); -if ($rc != 0 || ! -d $logfile_dir || ! -w $logfile_dir) { - chdir("/"); - die "mkdir of $logfile_dir failed, or can't write to it"; -} - -# First, git clone the source branch of the repo -verbose("*** Cloning repo: $repo_arg / $source_branch_arg...\n"); -my $tmpdir = File::Temp->newdir(); - -chdir($tmpdir); -doit(0, "git clone --single-branch --branch $source_branch_arg $repo_arg source", "git-clone"); - -# Next, git clone the pages branch of repo -if (defined($pages_branch_arg)) { - verbose("*** Cloning repo: $repo_arg / $pages_branch_arg...\n"); - doit(0, "git clone --single-branch --branch $pages_branch_arg $repo_arg pages", "git-clone2"); -} - -##################################################################### - -# Find all the *.\d.md files in the source repo -verbose("*** Finding markdown man pages...\n"); -opendir(DIR, "source/man"); -my @markdown_files = grep { /\.\d\.md$/ && -f "source/man/$_" } readdir(DIR); -closedir(DIR); -verbose("Found: @markdown_files\n"); - -##################################################################### - -# Copy each of the markdown files to the pages branch checkout -if (defined($pages_branch_arg)) { - chdir("pages/master"); - foreach my $file (@markdown_files) { - doit(0, "cp ../../source/man/$file man/$file", "loop-cp"); - - # Is there a new man page? If so, we need to "git add" it. - my $out = `git status --porcelain man/$file`; - doit(0, "git add man/$file", "loop-git-add") - if ($out =~ /^\?\?/); - } - - # Git commit those files in the pages repo and push them to the - # upstream repo so that they go live. If nothing changed, the commit - # and push will be no-ops. - chdir(".."); - doit(1, "git commit --no-verify -a -m \"Updated Markdown man pages from $source_branch_arg\"", - "git-commit-first"); - doit(1, "git push", "git-push-first"); -} - -##################################################################### - -# Now process each of the Markdown files in the source repo and -# generate new nroff man pages. -chdir("$tmpdir/source/man"); -foreach my $file (@markdown_files) { - doit(0, "../contrib/md2nroff.pl --source $file", "loop2-md2nroff"); - - # Did we generate a new man page? If so, we need to "git add" it. - my $man_file = basename($file); - - $man_file =~ m/\.(\d)\.md$/; - my $section = $1; - - $man_file =~ s/\.md$//; - - my $full_filename = "man$section/$man_file"; - - my $out = `git status --porcelain $full_filename`; - doit(0, "git add $full_filename", "loop2-git-add") - if ($out =~ /^\?\?/); -} - -# Similar to above: commit the newly-generated nroff pages and push -# them back upstream. If nothing changed, these will be no-ops. -doit(1, "git commit --no-verify -a -m \"Updated nroff-generated man pages\"", "git-commit-final"); -doit(1, "git push", "git-push-final"); - -# chdir out of the tmpdir so that it can be removed -chdir("/"); - -# If we get here, we finished successfully, so there's no need to keep -# the logfile dir around -system("rm -rf $logfile_dir"); - -exit(0); diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/md2nroff.pl b/opal/mca/pmix/pmix3x/pmix/contrib/md2nroff.pl deleted file mode 100755 index 9eb33fe94b6..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/contrib/md2nroff.pl +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env perl - -# Script to convert markdown to nroff man pages. -# -# The main conversion work is done via pandoc. But pandoc doesn't do -# everything exactly the way we want it, so use some perl regular -# expressions to fix up what pandoc doesn't get right. -# -# Do a "smart" write of the resulting output man page -- only write to -# the output file if the contents have actually changed compared to -# what was already there. - -use strict; -use warnings; - -use POSIX; -use File::Basename; -use Getopt::Long; -use File::Temp qw/tempfile/; - -my $source_arg; -my $target_arg; -my $help_arg; - -my $ok = Getopt::Long::GetOptions("source=s" => \$source_arg, - "target=s" => \$target_arg, - "help|h" => \$help_arg, - ); - -if ($help_arg) { - print "$0 --source input_MD_file --target output_nroff_file\n"; - exit(0); -} - -# Sanity checks -die "Must specify a source file" - if (!defined($source_arg)); -die "Source file does not exist ($source_arg)" - if (! -r $source_arg); - -my $pandoc = `which pandoc`; -die "Cannot find pandoc executable" - if ($pandoc eq ""); - -##################################################################### - -my $file = $source_arg; -$file =~ m/(\d+).md/; -my $section = $1; -die "Could not figure out the man page section: $source_arg" - if (!defined($section)); -my $shortfile = basename($file); -$shortfile =~ s/\.$section\.md$//; - -# If the target file was not specified, derive it from the source file -my $target; -if (!defined($target_arg)) { - $target_arg = $source_arg; - - $target_arg =~ m/\.(\d)\.md$/; - my $section = $1; - - my $dirname = dirname($target_arg); - my $basename = basename($target_arg); - $basename =~ s/\.md$//; - - $target = "$dirname/man$section/$basename"; -} else { - $target = $target_arg; -} - -print "*** Processing: $file -> $target\n"; - -# Read in the file -my $pandoc_input; -open(IN, $file) - || die "Can't open $file"; -$pandoc_input .= $_ - while (); -close(IN); - -# Remove the Jekyll header -$pandoc_input =~ s/.*---\n.+?---\n//s; - -# Remove the {% include ... %} directives -$pandoc_input =~ s/\n{0,1}\s*{%\s+include .+?\s+%}\s*\n/\n/g; - -# Change {% highlight c %} to ```c -$pandoc_input =~ s/^\s*{%\s+highlight\s+c\s+%}\s*$/\n```c/gmi; - -# Change {% endhighlight %} to ``` -$pandoc_input =~ s/^\s*\{\%\s+endhighlight\s+\%\}\s*$/```\n/gmi; - -# Pandoc does not handle markdown links in output nroff properly, -# so just remove all links. -while ($pandoc_input =~ m/\[(.+?)\]\(.+?\)/) { - my $text = $1; - $pandoc_input =~ s/\[(.+?)\]\(.+?\)/$text/; -} - -# Add the pandoc header -$pandoc_input = "% $shortfile($section) PMIx Programmer's Manual | \@VERSION\@ -% PMIx -% \@DATE\@\n\n$pandoc_input"; - -# Generate the nroff output -my ($fh, $temp_filename) = tempfile(); -print $fh $pandoc_input; -close($fh); - -open(IN, "pandoc -s --from=markdown --to=man $temp_filename|") - || die "Can't run pandoc"; -my $pandoc_nroff; -$pandoc_nroff .= $_ - while (); -close(IN); -unlink($temp_filename); - -# Now that we have the nroff string result, is it different than the -# target file? -my $write_nroff = 1; -if (-r $target) { - # If the target file exists, read it in - open(IN, $target) - || die "Can't open $target"; - my $target_nroff; - $target_nroff .= $_ - while (); - close(IN); - - # Remove the date from the target nroff string so that we can - # compare and ignore if the date has changed. Note that some - # versions of pandoc render dates as xxxx\-xx\-xx, and others - # render it as xxxx-xx-xx. Handle both. - $target_nroff =~ s/\"\d\d\d\d\\\-\d\d\\\-\d\d\"/\"\\\@DATE\\\@\"/; - $target_nroff =~ s/\"\d\d\d\d\-\d\d\-\d\d\"/\"\\\@DATE\\\@\"/; - - $write_nroff = 0 - if ($pandoc_nroff eq $target_nroff); -} - -# Do we need to write a new target nroff? -if ($write_nroff) { - - # What's the date right now? - my $now_string = strftime "%Y\\-%m\\-%d", localtime; - $pandoc_nroff =~ s/\\\@DATE\\\@/$now_string/g; - - # Make sure the target directory exists - my $dirname = dirname($target); - mkdir($dirname) - if (! -d $dirname); - - open(OUT, ">$target") - || die "Can't write to $target"; - print OUT $pandoc_nroff; - close(OUT); - - print "--> Wrote new $target\n"; -} else { - print "--> $target unchanged; not written\n"; -} - -exit(0); diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index b73d36ee39a..ba7ec977ba5 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.0.2 +Version: 3.1.2 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/examples/Makefile.am b/opal/mca/pmix/pmix3x/pmix/examples/Makefile.am index 72ed7216131..b928ab2d589 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/examples/Makefile.am @@ -11,13 +11,14 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ # +headers = examples.h AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/include -I$(top_builddir)/include/pmix @@ -28,56 +29,56 @@ if !WANT_HIDDEN noinst_PROGRAMS += server endif -client_SOURCES = client.c +client_SOURCES = client.c examples.h client_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) client_LDADD = $(top_builddir)/src/libpmix.la -client2_SOURCES = client2.c +client2_SOURCES = client2.c examples.h client2_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) client2_LDADD = $(top_builddir)/src/libpmix.la -debugger_SOURCES = debugger.c +debugger_SOURCES = debugger.c examples.h debugger_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) debugger_LDADD = $(top_builddir)/src/libpmix.la -debuggerd_SOURCES = debuggerd.c +debuggerd_SOURCES = debuggerd.c examples.h debuggerd_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) debuggerd_LDADD = $(top_builddir)/src/libpmix.la -alloc_SOURCES = alloc.c +alloc_SOURCES = alloc.c examples.h alloc_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) alloc_LDADD = $(top_builddir)/src/libpmix.la -jctrl_SOURCES = jctrl.c +jctrl_SOURCES = jctrl.c examples.h jctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) jctrl_LDADD = $(top_builddir)/src/libpmix.la -dmodex_SOURCES = dmodex.c +dmodex_SOURCES = dmodex.c examples.h dmodex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) dmodex_LDADD = $(top_builddir)/src/libpmix.la -dynamic_SOURCES = dynamic.c +dynamic_SOURCES = dynamic.c examples.h dynamic_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) dynamic_LDADD = $(top_builddir)/src/libpmix.la -fault_SOURCES = fault.c +fault_SOURCES = fault.c examples.h fault_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) fault_LDADD = $(top_builddir)/src/libpmix.la -pub_SOURCES = pub.c +pub_SOURCES = pub.c examples.h pub_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pub_LDADD = $(top_builddir)/src/libpmix.la -pubi_SOURCES = pubi.c +pubi_SOURCES = pubi.c examples.h pubi_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pubi_LDADD = $(top_builddir)/src/libpmix.la -tool_SOURCES = tool.c +tool_SOURCES = tool.c examples.h tool_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) tool_LDADD = $(top_builddir)/src/libpmix.la if !WANT_HIDDEN -server_SOURCES = server.c +server_SOURCES = server.c examples.h server_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) server_LDADD = $(top_builddir)/src/libpmix.la endif diff --git a/opal/mca/pmix/pmix3x/pmix/examples/alloc.c b/opal/mca/pmix/pmix3x/pmix/examples/alloc.c index f0cdf43a0ea..6984c1e1e96 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/alloc.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/alloc.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -30,16 +30,7 @@ #include #include - -/* define a structure for collecting returned - * info from an allocation request */ -typedef struct { - volatile bool active; - pmix_info_t *info; - size_t ninfo; -} mydata_t; - -static volatile bool waiting_for_allocation = true; +#include "examples.h" /* this is a callback function for the PMIx_Query and * PMIx_Allocate APIs. The query will callback with a status indicating @@ -59,7 +50,7 @@ static void infocbfunc(pmix_status_t status, pmix_release_cbfunc_t release_fn, void *release_cbdata) { - mydata_t *mq = (mydata_t*)cbdata; + myquery_data_t *mq = (myquery_data_t*)cbdata; size_t n; fprintf(stderr, "Allocation request returned %s", PMIx_Error_string(status)); @@ -75,6 +66,9 @@ static void infocbfunc(pmix_status_t status, PMIX_INFO_XFER(&mq->info[n], &info[n]); } } + /* the status returned here indicates whether the requested + * information was found or not - preserve it */ + mq->lock.status = status; /* let the library release the data and cleanup from * the operation */ @@ -83,7 +77,7 @@ static void infocbfunc(pmix_status_t status, } /* release the block */ - mq->active = false; + DEBUG_WAKEUP_THREAD(&mq->lock); } /* this is an event notification function that we explicitly request @@ -100,12 +94,37 @@ static void release_fn(size_t evhdlr_registration_id, pmix_event_notification_cbfunc_fn_t cbfunc, void *cbdata) { + myrel_t *lock; + size_t n; + + /* find the return object */ + lock = NULL; + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) { + lock = (myrel_t*)info[n].value.data.ptr; + break; + } + } + /* if the object wasn't returned, then that is an error */ + if (NULL == lock) { + fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n"); + /* let the event handler progress */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + } + return; + } + /* tell the event handler state machine that we are the last step */ if (NULL != cbfunc) { cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); } - /* flag that the allocation is complete so we can exit */ - waiting_for_allocation = false; + /* the status will be PMIX_ERR_ALLOC_COMPLETE since that is the code + * we registered to receive. The result of the allocation request is + * in the info array - for now, just assume success */ + lock->lock.status = PMIX_SUCCESS; + /* release the lock */ + DEBUG_WAKEUP_THREAD(&lock->lock); } /* event handler registration is done asynchronously because it @@ -114,18 +133,20 @@ static void release_fn(size_t evhdlr_registration_id, * the status of the request (success or an error), plus a numerical index * to the registered event. The index is used later on to deregister * an event handler - if we don't explicitly deregister it, then the - * PMIx server will do so when it see us exit */ + * PMIx server will do so when it sees us exit */ static void evhandler_reg_callbk(pmix_status_t status, size_t evhandler_ref, void *cbdata) { - volatile int *active = (volatile int*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; if (PMIX_SUCCESS != status) { fprintf(stderr, "EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", status, (unsigned long)evhandler_ref); } - *active = status; + lock->status = status; + lock->evhandler_ref = evhandler_ref; + DEBUG_WAKEUP_THREAD(lock); } int main(int argc, char **argv) @@ -138,11 +159,12 @@ int main(int argc, char **argv) uint32_t nprocs; pmix_info_t *info; uint64_t nnodes = 12; - mydata_t mydata; + myquery_data_t mydata; pmix_query_t *query; char *myallocation = "MYALLOCATION"; - volatile int active; - pmix_status_t code = PMIX_NOTIFY_ALLOC_COMPLETE; + mylock_t mylock; + pmix_status_t code; + myrel_t myrel; /* init us */ if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { @@ -163,63 +185,64 @@ int main(int argc, char **argv) PMIX_VALUE_RELEASE(val); fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); - /* initialize the return info struct */ - mydata.info = NULL; - mydata.ninfo = 0; - if (0 == myproc.rank) { /* try to get an allocation */ - mydata.active = true; + DEBUG_CONSTRUCT_MYQUERY(&mydata); PMIX_INFO_CREATE(info, 2); PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_NUM_NODES, &nnodes, PMIX_UINT64); PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING); - if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, NULL))) { + if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(PMIX_ALLOC_NEW, info, 2, infocbfunc, &mydata))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Allocation_request_nb failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } - while (mydata.active) { - usleep(10); - } + DEBUG_WAIT_THREAD(&mydata.lock); PMIX_INFO_FREE(info, 2); - if (NULL != mydata.info) { - PMIX_INFO_FREE(mydata.info, mydata.ninfo); - } + fprintf(stderr, "Client ns %s rank %d: Allocation returned status: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status)); + DEBUG_DESTRUCT_MYQUERY(&mydata); + } else if (1 == myproc.rank) { - /* register a handler specifically for when the allocation - * operation completes */ - PMIX_INFO_CREATE(info, 1); + /* demonstrate a notification based approach - register a handler + * specifically for when the allocation operation completes */ + DEBUG_CONSTRUCT_MYREL(&myrel); + PMIX_INFO_CREATE(info, 2); PMIX_INFO_LOAD(&info[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING); - active = -1; - PMIx_Register_event_handler(&code, 1, info, 1, - release_fn, evhandler_reg_callbk, (void*)&active); - while (-1 == active) { - usleep(10); - } - if (0 != active) { - exit(active); - } - PMIX_INFO_FREE(info, 1); + PMIX_INFO_LOAD(&info[1], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER); + DEBUG_CONSTRUCT_LOCK(&mylock); + code = PMIX_NOTIFY_ALLOC_COMPLETE; + PMIx_Register_event_handler(&code, 1, info, 2, + release_fn, evhandler_reg_callbk, (void*)&mylock); + DEBUG_WAIT_THREAD(&mylock); + PMIX_INFO_FREE(info, 2); + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + /* now wait to hear that the request is complete */ - while (waiting_for_allocation) { - usleep(10); - } + DEBUG_WAIT_THREAD(&myrel.lock); + fprintf(stderr, "[%s:%d] Allocation returned status: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(myrel.lock.status)); + DEBUG_DESTRUCT_MYREL(&myrel); + } else { - /* I am not the root rank, so let me wait a little while and then - * query the status of the allocation request */ + /* demonstrate a query-based approach - wait a little while and ask to + * see if it was done */ usleep(10); + DEBUG_CONSTRUCT_MYQUERY(&mydata); + PMIX_QUERY_CREATE(query, 1); PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_ALLOC_STATUS); PMIX_INFO_CREATE(query[0].qualifiers, 1); PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_ALLOC_ID, myallocation, PMIX_STRING); - mydata.active = true; + if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, 1, infocbfunc, (void*)&mydata))) { fprintf(stderr, "PMIx_Query_info failed: %d\n", rc); goto done; } - while (mydata.active) { - usleep(10); - } + DEBUG_WAIT_THREAD(&mydata.lock); PMIX_QUERY_FREE(query, 1); + fprintf(stderr, "[%s:%d] Allocation returned status: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(mydata.lock.status)); + DEBUG_DESTRUCT_MYQUERY(&mydata); } done: diff --git a/opal/mca/pmix/pmix3x/pmix/examples/client.c b/opal/mca/pmix/pmix3x/pmix/examples/client.c index 7e38608950c..519ef649d62 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/client.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/client.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -31,8 +31,8 @@ #include #include +#include "examples.h" -static volatile bool waiting_for_debugger = true; static pmix_proc_t myproc; /* this is the event notification function we pass down below @@ -66,10 +66,36 @@ static void release_fn(size_t evhdlr_registration_id, pmix_event_notification_cbfunc_fn_t cbfunc, void *cbdata) { + myrel_t *lock; + size_t n; + + /* find the return object */ + lock = NULL; + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) { + lock = (myrel_t*)info[n].value.data.ptr; + break; + } + } + /* if the object wasn't returned, then that is an error */ + if (NULL == lock) { + fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n"); + /* let the event handler progress */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + } + return; + } + + /* tell the event handler state machine that we are the last step */ if (NULL != cbfunc) { cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); } - waiting_for_debugger = false; + /* the status will be PMIX_ERR_DEBUGGER_RELEASE since that is the code + * we registered to receive, so just return success */ + lock->lock.status = PMIX_SUCCESS; + /* release the lock */ + DEBUG_WAKEUP_THREAD(&lock->lock); } /* event handler registration is done asynchronously because it @@ -83,27 +109,34 @@ static void evhandler_reg_callbk(pmix_status_t status, size_t evhandler_ref, void *cbdata) { - volatile int *active = (volatile int*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; if (PMIX_SUCCESS != status) { fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref); } - *active = status; + lock->status = status; + lock->evhandler_ref = evhandler_ref; + DEBUG_WAKEUP_THREAD(lock); } int main(int argc, char **argv) { - int rc; + pmix_status_t rc; pmix_value_t value; pmix_value_t *val = &value; - char *tmp, *ptr, *p; + char *tmp; pmix_proc_t proc; - uint32_t nprocs, m, n, local_cnt, *localpeers; + uint32_t nprocs, n; pmix_info_t *info; - bool flag, local; - volatile int active; + bool flag; + mylock_t mylock; + myrel_t myrel; pmix_status_t dbg = PMIX_ERR_DEBUGGER_RELEASE; + pid_t pid; + + pid = getpid(); + fprintf(stderr, "Client %lu: Running\n", (unsigned long)pid); /* init us - note that the call to "init" includes the return of * any job-related info provided by the RM. This includes any @@ -114,20 +147,21 @@ int main(int argc, char **argv) fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank, rc); exit(0); } - fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); + fprintf(stderr, "Client ns %s rank %d pid %lu: Running\n", myproc.nspace, myproc.rank, (unsigned long)pid); /* register our default event handler - again, this isn't strictly * required, but is generally good practice */ - active = -1; + DEBUG_CONSTRUCT_LOCK(&mylock); PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, evhandler_reg_callbk, (void*)&active); - while (-1 == active) { - sleep(1); - } - if (0 != active) { + notification_fn, evhandler_reg_callbk, (void*)&mylock); + DEBUG_WAIT_THREAD(&mylock); + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + + if (PMIX_SUCCESS != rc) { fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank); - exit(active); + goto done; } /* job-related info is found in our nspace, assigned to the @@ -145,21 +179,24 @@ int main(int argc, char **argv) * debugger */ if (PMIX_SUCCESS == (rc = PMIx_Get(&proc, PMIX_DEBUG_WAIT_FOR_NOTIFY, NULL, 0, &val))) { /* register for debugger release */ - active = -1; - PMIx_Register_event_handler(&dbg, 1, NULL, 0, - release_fn, evhandler_reg_callbk, (void*)&active); + DEBUG_CONSTRUCT_LOCK(&mylock); + PMIX_INFO_CREATE(info, 1); + DEBUG_CONSTRUCT_MYREL(&myrel); + PMIX_INFO_LOAD(&info[0], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER); + PMIx_Register_event_handler(&dbg, 1, info, 1, + release_fn, evhandler_reg_callbk, (void*)&mylock); /* wait for registration to complete */ - while (-1 == active) { - sleep(1); - } - if (0 != active) { + DEBUG_WAIT_THREAD(&mylock); + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + PMIX_INFO_FREE(info, 1); + if (PMIX_SUCCESS != rc) { fprintf(stderr, "[%s:%d] Debug handler registration failed\n", myproc.nspace, myproc.rank); - exit(active); + goto done; } /* wait for debugger release */ - while (waiting_for_debugger) { - sleep(1); - } + DEBUG_WAIT_THREAD(&myrel.lock); + DEBUG_DESTRUCT_MYREL(&myrel); } /* get our universe size */ @@ -196,7 +233,7 @@ int main(int argc, char **argv) value.type = PMIX_UINT64; value.data.uint64 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Put local failed: %d\n", myproc.nspace, myproc.rank, rc); + fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } free(tmp); @@ -207,7 +244,7 @@ int main(int argc, char **argv) value.type = PMIX_STRING; value.data.string = "1234"; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Put remote failed: %d\n", myproc.nspace, myproc.rank, rc); + fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } free(tmp); @@ -230,96 +267,53 @@ int main(int argc, char **argv) } PMIX_INFO_FREE(info, 1); - /* get the number of local peers */ - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_SIZE failed: %d", myproc.nspace, myproc.rank, rc); - goto done; - } - local_cnt = val->data.uint32; - PMIX_VALUE_RELEASE(val); - - /* create an array for the peers */ - localpeers = (uint32_t*)malloc(local_cnt * sizeof(int)); - - /* get the list of local peers */ - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get PMIX_LOCAL_PEERS failed: %d", myproc.nspace, myproc.rank, rc); - goto done; - } - ptr = strdup(val->data.string); - PMIX_VALUE_RELEASE(val); - - /* populate the peers array */ - p = strtok(ptr, ","); - localpeers[0] = strtoul(p, NULL, 10); - for (n=1; n < local_cnt; n++) { - p = strtok(NULL, ","); - localpeers[n] = strtoul(p, NULL, 10); - } - free(ptr); - /* check the returned data */ for (n=0; n < nprocs; n++) { - if (n == myproc.rank) { - continue; + if (0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank)) { + exit(1); + } + if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + goto done; + } + if (PMIX_UINT64 != val->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + if (1234 != val->data.uint64) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); + PMIX_VALUE_RELEASE(val); + free(tmp); + goto done; + } + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); + PMIX_VALUE_RELEASE(val); + free(tmp); + if (0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank)) { + exit(1); } - proc.rank = n; - local = false; - for (m=0; m < local_cnt; m++) { - if (localpeers[m] == proc.rank) { - local = true; - break; - } + if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); + goto done; } - if (local) { - if (0 > asprintf(&tmp, "%s-%d-local", proc.nspace, proc.rank)) { - exit(1); - } - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); - goto done; - } - if (PMIX_UINT64 != val->type) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; - } - if (1234 != val->data.uint64) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); + if (PMIX_STRING != val->type) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); PMIX_VALUE_RELEASE(val); free(tmp); - } else { - if (0 > asprintf(&tmp, "%s-%d-remote", proc.nspace, proc.rank)) { - exit(1); - } - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, myproc.rank, tmp, rc); - goto done; - } - if (PMIX_STRING != val->type) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; - } - if (0 != strcmp(val->data.string, "1234")) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); - PMIX_VALUE_RELEASE(val); - free(tmp); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); + goto done; + } + if (0 != strcmp(val->data.string, "1234")) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); PMIX_VALUE_RELEASE(val); free(tmp); + goto done; } + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s returned correct\n", myproc.nspace, myproc.rank, tmp); + PMIX_VALUE_RELEASE(val); + free(tmp); } - free(localpeers); done: /* finalize us */ diff --git a/opal/mca/pmix/pmix3x/pmix/examples/client2.c b/opal/mca/pmix/pmix3x/pmix/examples/client2.c index 9b7f7e6c0fe..4021c15ec7c 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/client2.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/client2.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include #include +#include "examples.h" static pmix_proc_t myproc; @@ -62,25 +63,27 @@ static void evhandler_reg_callbk(pmix_status_t status, size_t evhandler_ref, void *cbdata) { - volatile int *active = (volatile int*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; if (PMIX_SUCCESS != status) { fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref); } - *active = status; + lock->status = status; + lock->evhandler_ref = evhandler_ref; + DEBUG_WAKEUP_THREAD(lock); } int main(int argc, char **argv) { - int rc; + pmix_status_t rc; pmix_value_t value; pmix_value_t *val, *vptr; pmix_proc_t proc; uint32_t nprocs, n, k; pmix_info_t *info; bool flag; - volatile int active; + mylock_t mylock; pmix_data_array_t da, *dptr; /* init us - note that the call to "init" includes the return of @@ -97,15 +100,16 @@ int main(int argc, char **argv) /* register our default event handler - again, this isn't strictly * required, but is generally good practice */ - active = -1; + DEBUG_CONSTRUCT_LOCK(&mylock); PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, evhandler_reg_callbk, (void*)&active); - while (-1 == active) { - sleep(1); - } - if (0 != active) { + notification_fn, evhandler_reg_callbk, (void*)&mylock); + DEBUG_WAIT_THREAD(&mylock); + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + + if (PMIX_SUCCESS != rc) { fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank); - exit(active); + goto done; } /* job-related info is found in our nspace, assigned to the diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c index c093d5bc829..76a1ac8ca0c 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -33,24 +33,19 @@ #include #include +#include "examples.h" static uint32_t nprocs; static pmix_proc_t myproc; static uint32_t getcount = 0; -#define WAIT_FOR_COMPLETION(a) \ - do { \ - while ((a)) { \ - usleep(10); \ - } \ - } while (0) - static void opcbfunc(pmix_status_t status, void *cbdata) { - bool *active = (bool*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; fprintf(stderr, "%s:%d completed fence_nb\n", myproc.nspace, myproc.rank); - *active = false; + lock->status = status; + DEBUG_WAKEUP_THREAD(lock); } static void valcbfunc(pmix_status_t status, @@ -98,7 +93,7 @@ int main(int argc, char **argv) char *tmp; pmix_proc_t proc; uint32_t n, num_gets; - bool active; + mylock_t mylock; /* init us */ if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { @@ -170,9 +165,10 @@ int main(int argc, char **argv) PMIX_PROC_CONSTRUCT(&proc); (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - active = true; - if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &active))) { + DEBUG_CONSTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &mylock))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); + DEBUG_DESTRUCT_LOCK(&mylock); goto done; } @@ -203,7 +199,7 @@ int main(int argc, char **argv) } /* wait for the first fence to finish */ - WAIT_FOR_COMPLETION(active); + DEBUG_WAIT_THREAD(&mylock); /* wait for all my "get" calls to complete */ while (getcount < num_gets) { diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c index 4ffe501f02f..d7c0d3701ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -35,7 +35,7 @@ #include #include - +#include "examples.h" static pmix_proc_t myproc; diff --git a/opal/mca/pmix/pmix3x/pmix/examples/examples.h b/opal/mca/pmix/pmix3x/pmix/examples/examples.h new file mode 100644 index 00000000000..d2e5ab7696d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/examples/examples.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2006-2013 Los Alamos National Security, LLC. + * All rights reserved. + * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include + +typedef struct { + pthread_mutex_t mutex; + pthread_cond_t cond; + volatile bool active; + pmix_status_t status; + int count; + size_t evhandler_ref; +} mylock_t; + +#define DEBUG_CONSTRUCT_LOCK(l) \ + do { \ + pthread_mutex_init(&(l)->mutex, NULL); \ + pthread_cond_init(&(l)->cond, NULL); \ + (l)->active = true; \ + (l)->status = PMIX_SUCCESS; \ + (l)->count = 0; \ + (l)->evhandler_ref = 0; \ + } while(0) + +#define DEBUG_DESTRUCT_LOCK(l) \ + do { \ + pthread_mutex_destroy(&(l)->mutex); \ + pthread_cond_destroy(&(l)->cond); \ + } while(0) + +#define DEBUG_WAIT_THREAD(lck) \ + do { \ + pthread_mutex_lock(&(lck)->mutex); \ + while ((lck)->active) { \ + pthread_cond_wait(&(lck)->cond, &(lck)->mutex); \ + } \ + pthread_mutex_unlock(&(lck)->mutex); \ + } while(0) + +#define DEBUG_WAKEUP_THREAD(lck) \ + do { \ + pthread_mutex_lock(&(lck)->mutex); \ + (lck)->active = false; \ + pthread_cond_broadcast(&(lck)->cond); \ + pthread_mutex_unlock(&(lck)->mutex); \ + } while(0) + +/* define a structure for collecting returned + * info from a query */ +typedef struct { + mylock_t lock; + pmix_info_t *info; + size_t ninfo; +} myquery_data_t; + +#define DEBUG_CONSTRUCT_MYQUERY(q) \ + do { \ + DEBUG_CONSTRUCT_LOCK(&((q)->lock)); \ + (q)->info = NULL; \ + (q)->ninfo = 0; \ + } while(0) + +#define DEBUG_DESTRUCT_MYQUERY(q) \ + do { \ + DEBUG_DESTRUCT_LOCK(&((q)->lock)); \ + if (NULL != (q)->info) { \ + PMIX_INFO_FREE((q)->info, (q)->ninfo); \ + } \ + } while(0) + +/* define a structure for releasing when a given + * nspace terminates */ +typedef struct { + mylock_t lock; + char *nspace; + int exit_code; + bool exit_code_given; +} myrel_t; + + +#define DEBUG_CONSTRUCT_MYREL(r) \ + do { \ + DEBUG_CONSTRUCT_LOCK(&((r)->lock)); \ + (r)->nspace = NULL; \ + (r)->exit_code = 0; \ + (r)->exit_code_given = false; \ + } while(0) + +#define DEBUG_DESTRUCT_MYREL(r) \ + do { \ + DEBUG_DESTRUCT_LOCK(&((r)->lock)); \ + if (NULL != (r)->nspace) { \ + free((r)->nspace); \ + } \ + } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/examples/fault.c b/opal/mca/pmix/pmix3x/pmix/examples/fault.c index a197f589619..abab3886816 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/fault.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/fault.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -28,11 +28,12 @@ #include #include #include +#include #include +#include "examples.h" static pmix_proc_t myproc; -static bool completed; static void notification_fn(size_t evhdlr_registration_id, pmix_status_t status, @@ -42,22 +43,67 @@ static void notification_fn(size_t evhdlr_registration_id, pmix_event_notification_cbfunc_fn_t cbfunc, void *cbdata) { - fprintf(stderr, "Client %s:%d NOTIFIED with status %d\n", myproc.nspace, myproc.rank, status); - completed = true; + myrel_t *lock; + bool found; + int exit_code; + size_t n; + pmix_proc_t *affected = NULL; + + /* find our return object */ + lock = NULL; + found = false; + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) { + lock = (myrel_t*)info[n].value.data.ptr; + /* not every RM will provide an exit code, but check if one was given */ + } else if (0 == strncmp(info[n].key, PMIX_EXIT_CODE, PMIX_MAX_KEYLEN)) { + exit_code = info[n].value.data.integer; + found = true; + } else if (0 == strncmp(info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { + affected = info[n].value.data.proc; + } + } + /* if the object wasn't returned, then that is an error */ + if (NULL == lock) { + fprintf(stderr, "LOCK WASN'T RETURNED IN RELEASE CALLBACK\n"); + /* let the event handler progress */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + } + return; + } + + /* tell the event handler state machine that we are the last step */ + if (NULL != cbfunc) { + cbfunc(PMIX_EVENT_ACTION_COMPLETE, NULL, 0, NULL, NULL, cbdata); + } + fprintf(stderr, "DEBUGGER DAEMON NOTIFIED TERMINATED - AFFECTED %s\n", + (NULL == affected) ? "NULL" : affected->nspace); + + if (found) { + lock->exit_code = exit_code; + lock->exit_code_given = true; + } + DEBUG_WAKEUP_THREAD(&lock->lock); } static void op_callbk(pmix_status_t status, void *cbdata) { + mylock_t *lock = (mylock_t*)cbdata; fprintf(stderr, "Client %s:%d OP CALLBACK CALLED WITH STATUS %d\n", myproc.nspace, myproc.rank, status); + DEBUG_WAKEUP_THREAD(lock); } -static void errhandler_reg_callbk(pmix_status_t status, +static void evhandler_reg_callbk(pmix_status_t status, size_t errhandler_ref, void *cbdata) { + mylock_t *lock = (mylock_t*)cbdata; + fprintf(stderr, "Client %s:%d ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu\n", myproc.nspace, myproc.rank, status, (unsigned long)errhandler_ref); + DEBUG_WAKEUP_THREAD(lock); } int main(int argc, char **argv) @@ -67,6 +113,10 @@ int main(int argc, char **argv) pmix_value_t *val = &value; pmix_proc_t proc; uint32_t nprocs; + pmix_info_t *info; + mylock_t mylock; + myrel_t myrel; + pmix_status_t code[2] = {PMIX_ERR_PROC_ABORTED, PMIX_ERR_JOB_TERMINATED}; /* init us */ if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { @@ -87,11 +137,27 @@ int main(int argc, char **argv) nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); - completed = false; - /* register our errhandler */ - PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, errhandler_reg_callbk, NULL); + /* register another handler specifically for when the target + * job completes */ + DEBUG_CONSTRUCT_MYREL(&myrel); + PMIX_INFO_CREATE(info, 2); + PMIX_INFO_LOAD(&info[0], PMIX_EVENT_RETURN_OBJECT, &myrel, PMIX_POINTER); + /* only call me back when one of us terminates */ + PMIX_INFO_LOAD(&info[1], PMIX_NSPACE, myproc.nspace, PMIX_STRING); + + DEBUG_CONSTRUCT_LOCK(&mylock); + PMIx_Register_event_handler(code, 2, info, 2, + notification_fn, evhandler_reg_callbk, (void*)&mylock); + DEBUG_WAIT_THREAD(&mylock); + if (PMIX_SUCCESS != mylock.status) { + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + PMIX_INFO_FREE(info, 2); + goto done; + } + DEBUG_DESTRUCT_LOCK(&mylock); + PMIX_INFO_FREE(info, 2); /* call fence to sync */ PMIX_PROC_CONSTRUCT(&proc); @@ -109,17 +175,16 @@ int main(int argc, char **argv) exit(1); } /* everyone simply waits */ - while (!completed) { - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 100000; - nanosleep(&ts, NULL); - } + DEBUG_WAIT_THREAD(&myrel.lock); + DEBUG_DESTRUCT_MYREL(&myrel); done: /* finalize us */ fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank); - PMIx_Deregister_event_handler(1, op_callbk, NULL); + DEBUG_CONSTRUCT_LOCK(&mylock); + PMIx_Deregister_event_handler(1, op_callbk, &mylock); + DEBUG_WAIT_THREAD(&mylock); + DEBUG_DESTRUCT_LOCK(&mylock); if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc); diff --git a/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c b/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c index 5c1c1d1f73d..0dc244b3c62 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/jctrl.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include #include +#include "examples.h" static pmix_proc_t myproc; @@ -63,13 +64,15 @@ static void evhandler_reg_callbk(pmix_status_t status, size_t evhandler_ref, void *cbdata) { - volatile int *active = (volatile int*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; if (PMIX_SUCCESS != status) { fprintf(stderr, "Client %s:%d EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", myproc.nspace, myproc.rank, status, (unsigned long)evhandler_ref); } - *active = status; + lock->status = status; + lock->evhandler_ref = evhandler_ref; + DEBUG_WAKEUP_THREAD(lock); } static void infocbfunc(pmix_status_t status, @@ -78,26 +81,27 @@ static void infocbfunc(pmix_status_t status, pmix_release_cbfunc_t release_fn, void *release_cbdata) { - volatile int *active = (volatile int*)cbdata; + mylock_t *lock = (mylock_t*)cbdata; /* release the caller */ if (NULL != release_fn) { release_fn(release_cbdata); } - *active = status; + lock->status = status; + DEBUG_WAKEUP_THREAD(lock); } int main(int argc, char **argv) { - int rc; + pmix_status_t rc; pmix_value_t value; pmix_value_t *val = &value; pmix_proc_t proc; uint32_t nprocs, n; pmix_info_t *info, *iptr; bool flag; - volatile int active; + mylock_t mylock; pmix_data_array_t *dptr; /* init us - note that the call to "init" includes the return of @@ -111,15 +115,16 @@ int main(int argc, char **argv) /* register our default event handler - again, this isn't strictly * required, but is generally good practice */ - active = -1; + DEBUG_CONSTRUCT_LOCK(&mylock); PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, evhandler_reg_callbk, (void*)&active); - while (-1 == active) { - sleep(1); - } - if (0 != active) { + notification_fn, evhandler_reg_callbk, (void*)&mylock); + /* wait for registration to complete */ + DEBUG_WAIT_THREAD(&mylock); + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != rc) { fprintf(stderr, "[%s:%d] Default handler registration failed\n", myproc.nspace, myproc.rank); - exit(active); + goto done; } /* job-related info is found in our nspace, assigned to the @@ -145,12 +150,8 @@ int main(int argc, char **argv) PMIX_INFO_LOAD(&info[0], PMIX_JOB_CTRL_PREEMPTIBLE, (void*)&flag, PMIX_BOOL); /* can't use "load" to load a pmix_data_array_t */ (void)strncpy(info[1].key, PMIX_JOB_CTRL_CHECKPOINT_METHOD, PMIX_MAX_KEYLEN); - info[1].value.type = PMIX_DATA_ARRAY; - dptr = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); - info[1].value.data.darray = dptr; - dptr->type = PMIX_INFO; - dptr->size = 2; - PMIX_INFO_CREATE(dptr->array, dptr->size); + PMIX_DATA_ARRAY_CREATE(info[1].value.data.darray, 2, PMIX_INFO); + dptr = info[1].value.data.darray; rc = SIGUSR2; iptr = (pmix_info_t*)dptr->array; PMIX_INFO_LOAD(&iptr[0], PMIX_JOB_CTRL_CHECKPOINT_SIGNAL, &rc, PMIX_INT); @@ -159,18 +160,19 @@ int main(int argc, char **argv) /* since this is informational and not a requested operation, the target parameter * doesn't mean anything and can be ignored */ - active = -1; - if (PMIX_SUCCESS != (rc = PMIx_Job_control_nb(NULL, 0, info, 2, infocbfunc, (void*)&active))) { + DEBUG_CONSTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != (rc = PMIx_Job_control_nb(NULL, 0, info, 2, infocbfunc, (void*)&mylock))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, rc); + DEBUG_DESTRUCT_LOCK(&mylock); goto done; } - while (-1 == active) { - sleep(1); - } + DEBUG_WAIT_THREAD(&mylock); PMIX_INFO_FREE(info, 2); - if (0 != active) { + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != rc) { fprintf(stderr, "Client ns %s rank %d: PMIx_Job_control_nb failed: %d\n", myproc.nspace, myproc.rank, rc); - exit(active); + goto done; } /* now request that this process be monitored using heartbeats */ @@ -185,20 +187,21 @@ int main(int argc, char **argv) PMIX_INFO_LOAD(&info[2], PMIX_MONITOR_HEARTBEAT_DROPS, &n, PMIX_UINT32); /* make the request */ - active = -1; + DEBUG_CONSTRUCT_LOCK(&mylock); if (PMIX_SUCCESS != (rc = PMIx_Process_monitor_nb(iptr, PMIX_MONITOR_HEARTBEAT_ALERT, - info, 3, infocbfunc, (void*)&active))) { + info, 3, infocbfunc, (void*)&mylock))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, rc); + DEBUG_DESTRUCT_LOCK(&mylock); goto done; } - while (-1 == active) { - sleep(1); - } + DEBUG_WAIT_THREAD(&mylock); PMIX_INFO_FREE(iptr, 1); PMIX_INFO_FREE(info, 3); - if (0 != active) { + rc = mylock.status; + DEBUG_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS != rc) { fprintf(stderr, "Client ns %s rank %d: PMIx_Process_monitor_nb failed: %d\n", myproc.nspace, myproc.rank, rc); - exit(active); + goto done; } /* send a heartbeat */ diff --git a/opal/mca/pmix/pmix3x/pmix/examples/tool.c b/opal/mca/pmix/pmix3x/pmix/examples/tool.c index 6818e49c5a3..e10699309eb 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/tool.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/tool.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -29,6 +29,7 @@ #include #include +#include "examples.h" static void cbfunc(pmix_status_t status, pmix_info_t *info, size_t ninfo, @@ -36,15 +37,28 @@ static void cbfunc(pmix_status_t status, pmix_release_cbfunc_t release_fn, void *release_cbdata) { - volatile bool *active = (volatile bool*)cbdata; + myquery_data_t *mq = (myquery_data_t*)cbdata; + size_t n; - /* do something with the returned info - it will be + mq->lock.status = status; + + /* save the returned info - it will be * released in the release_fn */ + if (0 < ninfo) { + PMIX_INFO_CREATE(mq->info, ninfo); + mq->ninfo = ninfo; + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&mq->info[n], &info[n]); + } + } + /* let the library release the data */ if (NULL != release_fn) { release_fn(release_cbdata); } - *active = false; + + /* release the block */ + DEBUG_WAKEUP_THREAD(&mq->lock); } int main(int argc, char **argv) @@ -52,31 +66,154 @@ int main(int argc, char **argv) pmix_status_t rc; pmix_proc_t myproc; pmix_query_t *query; - size_t nq; - volatile bool active; + size_t nq, ninfo = 0, n, m; + myquery_data_t mydata; + pmix_info_t *info = NULL, *iptr; + char *server_uri = NULL; + char *nspace = NULL; + char *nodename = NULL; + pmix_data_array_t *darray, *dptr; + bool geturi = false; + char hostname[1024]; + + gethostname(hostname, 1024); + for (n=1; n < (size_t)argc; n++) { + if (0 == strcmp("-u", argv[n]) || 0 == strcmp("--url", argv[n])) { + if (NULL == argv[n+1]) { + fprintf(stderr, "Must provide URI argument to %s option\n", argv[n]); + exit(1); + } + server_uri = argv[n+1]; + } else if (0 == strcmp("-nspace", argv[n]) || 0 == strcmp("--nspace", argv[n])) { + if (NULL == argv[n+1]) { + fprintf(stderr, "Must provide nspace argument to %s option\n", argv[n]); + exit(1); + } + nspace = argv[n+1]; + } else if (0 == strcmp("-uri", argv[n]) || 0 == strcmp("--uri", argv[n])) { + /* retrieve the PMIx server's uri from the indicated node */ + nodename = argv[n+1]; + geturi = true; + } + } + + if (NULL != server_uri) { + ninfo = 1; + PMIX_INFO_CREATE(info, ninfo); + PMIX_INFO_LOAD(&info[0], PMIX_SERVER_URI, server_uri, PMIX_STRING); + fprintf(stderr, "Connecting to %s\n", server_uri); + } /* init us */ - if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, NULL, 0))) { + if (PMIX_SUCCESS != (rc = PMIx_tool_init(&myproc, info, ninfo))) { fprintf(stderr, "PMIx_tool_init failed: %d\n", rc); exit(rc); } + if (NULL != info) { + PMIX_INFO_FREE(info, ninfo); + } - /* query something */ - nq = 2; - PMIX_QUERY_CREATE(query, nq); - query[0].keys = (char**)malloc(2 * sizeof(char*)); - query[0].keys[0] = strdup("foobar"); - query[0].keys[1] = NULL; - query[1].keys = (char**)malloc(2 * sizeof(char*)); - query[1].keys[0] = strdup("spastic"); - query[1].keys[1] = NULL; - active = true; - if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&active))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc); + if (geturi) { + nq = 1; + PMIX_QUERY_CREATE(query, nq); + PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_SERVER_URI); + if (NULL != nodename) { + PMIX_QUERY_QUALIFIERS_CREATE(&query[0], 1); + PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_HOSTNAME, nodename, PMIX_STRING); + } + DEBUG_CONSTRUCT_MYQUERY(&mydata); + if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + DEBUG_WAIT_THREAD(&mydata.lock); + /* find the response */ + if (PMIX_SUCCESS == mydata.lock.status) { + /* should be in the first key */ + if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_SERVER_URI)) { + fprintf(stderr, "PMIx server URI for node %s: %s\n", + (NULL == nodename) ? hostname : nodename, + mydata.info[0].value.data.string); + } else { + fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key); + } + } else { + fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status)); + } + DEBUG_DESTRUCT_MYQUERY(&mydata); goto done; } - while(active) { - usleep(10); + + if (NULL == nspace) { + /* query the list of active nspaces */ + nq = 1; + PMIX_QUERY_CREATE(query, nq); + PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_QUERY_NAMESPACE_INFO); + DEBUG_CONSTRUCT_MYQUERY(&mydata); + if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + DEBUG_WAIT_THREAD(&mydata.lock); + /* find the response */ + if (PMIX_SUCCESS == mydata.lock.status) { + /* should be in the first key */ + if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_QUERY_NAMESPACE_INFO)) { + darray = mydata.info[0].value.data.darray; + fprintf(stderr, "ACTIVE NSPACES:\n"); + if (NULL == darray || 0 == darray->size || NULL == darray->array) { + fprintf(stderr, "\tNone\n"); + } else { + info = (pmix_info_t*)darray->array; + if (NULL == info) { + fprintf(stderr, "Error\n"); + } else { + for (n=0; n < darray->size; n++) { + dptr = info[n].value.data.darray; + if (NULL == dptr || 0 == dptr->size || NULL == dptr->array) { + fprintf(stderr, "Error in array %s\n", (NULL == dptr) ? "NULL" : "NON-NULL"); + break; + } + iptr = (pmix_info_t*)dptr->array; + for (m=0; m < dptr->size; m++) { + fprintf(stderr, "\t%s", iptr[m].value.data.string); + } + fprintf(stderr, "\n"); + } + } + } + } else { + fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key); + } + } else { + fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status)); + } + DEBUG_DESTRUCT_MYQUERY(&mydata); + } else { + nq = 1; + PMIX_QUERY_CREATE(query, nq); + PMIX_ARGV_APPEND(rc, query[0].keys, PMIX_JOB_SIZE); + PMIX_INFO_CREATE(query[0].qualifiers, 1); + query[0].nqual = 1; + PMIX_INFO_LOAD(&query[0].qualifiers[0], PMIX_NSPACE, nspace, PMIX_STRING); + DEBUG_CONSTRUCT_MYQUERY(&mydata); + if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&mydata))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Query_info failed: %d\n", myproc.nspace, myproc.rank, rc); + goto done; + } + DEBUG_WAIT_THREAD(&mydata.lock); + /* find the response */ + if (PMIX_SUCCESS == mydata.lock.status) { + /* should be in the first key */ + if (PMIX_CHECK_KEY(&mydata.info[0], PMIX_JOB_SIZE)) { + fprintf(stderr, "JOB SIZE FOR NSPACE %s: %lu\n", nspace, (unsigned long)mydata.info[0].value.data.uint32); + } else { + fprintf(stderr, "Query returned wrong info key at first posn: %s\n", mydata.info[0].key); + } + } else { + fprintf(stderr, "Query returned error: %s\n", PMIx_Error_string(mydata.lock.status)); + } + DEBUG_DESTRUCT_MYQUERY(&mydata); } done: diff --git a/opal/mca/pmix/pmix3x/pmix/include/Makefile.am b/opal/mca/pmix/pmix3x/pmix/include/Makefile.am index 3b205f72c57..5c0ff27f100 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/include/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # # $COPYRIGHT$ # @@ -14,7 +14,8 @@ if WANT_PRIMARY_HEADERS include_HEADERS = \ pmix.h \ pmix_server.h \ - pmix_tool.h + pmix_tool.h \ + pmix_extend.h if WANT_PMI_BACKWARD include_HEADERS += \ diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix.h b/opal/mca/pmix/pmix3x/pmix/include/pmix.h index ae54d85b70a..ba29692c99d 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix.h @@ -129,7 +129,7 @@ PMIX_EXPORT pmix_status_t PMIx_Abort(int status, const char msg[], * the information locally until _PMIx_Commit_ is called. The provided scope * value is passed to the local PMIx server, which will distribute the data * as directed. */ -PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val); +PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const pmix_key_t key, pmix_value_t *val); /* Push all previously _PMIx_Put_ values to the local PMIx server. @@ -200,7 +200,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs * an error. The timeout parameter can help avoid "hangs" due to programming * errors that prevent the target proc from ever exposing its data. */ -PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], +PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const pmix_key_t key, const pmix_info_t info[], size_t ninfo, pmix_value_t **val); @@ -208,7 +208,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], * be executed once the specified data has been _PMIx_Put_ * by the identified process and retrieved by the local server. The info * array is used as described above for the blocking form of this call. */ -PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char key[], +PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t key, const pmix_info_t info[], size_t ninfo, pmix_value_cbfunc_t cbfunc, void *cbdata); @@ -337,7 +337,7 @@ PMIX_EXPORT pmix_status_t PMIx_Unpublish_nb(char **keys, */ PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo, const pmix_app_t apps[], size_t napps, - char nspace[]); + pmix_nspace_t nspace); /* Non-blocking form of the _PMIx_Spawn_ function. The callback @@ -394,7 +394,7 @@ PMIX_EXPORT pmix_status_t PMIx_Disconnect_nb(const pmix_proc_t ranges[], size_t * for releasing the array when done with it - the PMIX_PROC_FREE macro is * provided for this purpose. */ -PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *nspace, +PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const pmix_nspace_t nspace, pmix_proc_t **procs, size_t *nprocs); @@ -402,7 +402,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const char *n * that nspace. The returned string will contain a comma-delimited list * of nodenames. The caller is responsible for releasing the string * when done with it */ -PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist); +PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist); /* Query information about the system in general - can include * a list of active nspaces, network topology, etc. Also can be diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index 9554745ffc2..35aecfabbc2 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -1,10 +1,10 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,6 +84,10 @@ extern "C" { #define PMIX_MAX_NSLEN 255 #define PMIX_MAX_KEYLEN 511 +/* define abstract types for namespaces and keys */ +typedef char pmix_nspace_t[PMIX_MAX_NSLEN+1]; +typedef char pmix_key_t[PMIX_MAX_KEYLEN+1]; + /* define a type for rank values */ typedef uint32_t pmix_rank_t; @@ -104,6 +108,9 @@ typedef uint32_t pmix_rank_t; #define PMIX_RANK_LOCAL_NODE UINT32_MAX-2 // all ranks on local node /* define an invalid value */ #define PMIX_RANK_INVALID UINT32_MAX-3 +/* define a boundary for valid ranks */ +#define PMIX_RANK_VALID UINT32_MAX-50 + /**** PMIX ENVIRONMENTAL PARAMETERS ****/ /* There are a few environmental parameters used by PMIx for @@ -115,6 +122,9 @@ typedef uint32_t pmix_rank_t; * a tool can connect with further instructions. This envar will be * set by the tool and is _not_ intended for the direct use of users. * + * PMIX_LAUNCHER_RENDEZVOUS_FILE - if set, contains the full pathname + * of a file the launcher is to write that contains its connection info. + * Works in addition to anything else the launcher may output. */ /* define a set of "standard" PMIx attributes that can @@ -140,7 +150,6 @@ typedef uint32_t pmix_rank_t; // client rendezvous points and contact info #define PMIX_SYSTEM_TMPDIR "pmix.sys.tmpdir" // (char*) temp directory for this system, where PMIx // server will place tool rendezvous points and contact info -#define PMIX_REGISTER_NODATA "pmix.reg.nodata" // (bool) Registration is for nspace only, do not copy job data #define PMIX_SERVER_ENABLE_MONITORING "pmix.srv.monitor" // (bool) Enable PMIx internal monitoring by server #define PMIX_SERVER_NSPACE "pmix.srv.nspace" // (char*) Name of the nspace to use for this server #define PMIX_SERVER_RANK "pmix.srv.rank" // (pmix_rank_t) Rank of this server @@ -164,6 +173,7 @@ typedef uint32_t pmix_rank_t; // from the specified processes to this tool #define PMIX_RECONNECT_SERVER "pmix.cnct.recon" // (bool) tool is requesting to change server connections #define PMIX_LAUNCHER "pmix.tool.launcher" // (bool) tool is a launcher and needs rendezvous files created +#define PMIX_LAUNCHER_RENDEZVOUS_FILE "pmix.tool.lncrnd" // (char*) Pathname of file where connection info is to be stored /* identification attributes */ #define PMIX_USERID "pmix.euid" // (uint32_t) effective user id @@ -274,7 +284,6 @@ typedef uint32_t pmix_rank_t; /* topology info */ #define PMIX_NET_TOPO "pmix.ntopo" // (char*) xml-representation of network topology #define PMIX_LOCAL_TOPO "pmix.ltopo" // (char*) xml-representation of local node topology -#define PMIX_NODE_LIST "pmix.nlist" // (char*) comma-delimited list of nodes running procs for this job #define PMIX_TOPOLOGY "pmix.topo" // (hwloc_topology_t) pointer to the PMIx client's internal topology object #define PMIX_TOPOLOGY_XML "pmix.topo.xml" // (char*) XML-based description of topology #define PMIX_TOPOLOGY_FILE "pmix.topo.file" // (char*) full path to file containing XML topology description @@ -330,8 +339,6 @@ typedef uint32_t pmix_rank_t; /* event handler registration and notification info keys */ #define PMIX_EVENT_HDLR_NAME "pmix.evname" // (char*) string name identifying this handler -#define PMIX_EVENT_JOB_LEVEL "pmix.evjob" // (bool) register for job-specific events only -#define PMIX_EVENT_ENVIRO_LEVEL "pmix.evenv" // (bool) register for environment events only #define PMIX_EVENT_HDLR_FIRST "pmix.evfirst" // (bool) invoke this event handler before any other handlers #define PMIX_EVENT_HDLR_LAST "pmix.evlast" // (bool) invoke this event handler after all other handlers have been called #define PMIX_EVENT_HDLR_FIRST_IN_CATEGORY "pmix.evfirstcat" // (bool) invoke this event handler before any other handlers in this category @@ -349,7 +356,9 @@ typedef uint32_t pmix_rank_t; // registered it #define PMIX_EVENT_DO_NOT_CACHE "pmix.evnocache" // (bool) instruct the PMIx server not to cache the event #define PMIX_EVENT_SILENT_TERMINATION "pmix.evsilentterm" // (bool) do not generate an event when this job normally terminates - +#define PMIX_EVENT_PROXY "pmix.evproxy" // (pmix_proc_t*) PMIx server that sourced the event +#define PMIX_EVENT_TEXT_MESSAGE "pmix.evtext" // (char*) text message suitable for output by recipient - e.g., describing + // the cause of the event /* fault tolerance-related events */ #define PMIX_EVENT_TERMINATE_SESSION "pmix.evterm.sess" // (bool) RM intends to terminate session @@ -406,22 +415,16 @@ typedef uint32_t pmix_rank_t; #define PMIX_FWD_STDERR "pmix.fwd.stderr" // (bool) forward stderr from the spawned processes to this process (typically used by a tool) #define PMIX_FWD_STDDIAG "pmix.fwd.stddiag" // (bool) if a diagnostic channel exists, forward any output on it // from the spawned processes to this process (typically used by a tool) - - -/* connect attributes */ -#define PMIX_CONNECT_NOTIFY_EACH "pmix.cnct.each" // (bool) notify the other participants of the connection by event - // each time a process connects -#define PMIX_CONNECT_NOTIFY_REQ "pmix.cnct.req" // (bool) notify all other participants that they are requested to - // connect -#define PMIX_CONNECT_OPTIONAL "pmix.cnt.opt" // (bool) participation is optional - do not return error if procs - // terminate without having connected -#define PMIX_CONNECT_XCHG_ONLY "pmix.cnt.xchg" // (bool) provide participants with job-level info for all participating - // nspaces, but do not assign a new nspace or rank -#define PMIX_CONNECT_ID "pmix.cnt.id" // (char*) an application-provided string identifier for a PMIx_Connect operation. - +#define PMIX_SPAWN_TOOL "pmix.spwn.tool" // (bool) job being spawned is a tool +#define PMIX_CMD_LINE "pmix.cmd.line" // (char*) command line executing in the specified nspace /* query attributes */ -#define PMIX_QUERY_NAMESPACES "pmix.qry.ns" // (char*) request a comma-delimited list of active nspaces +#define PMIX_QUERY_REFRESH_CACHE "pmix.qry.rfsh" // (bool) retrieve updated information from server + // to update local cache +#define PMIX_QUERY_NAMESPACES "pmix.qry.ns" // (char*) return a comma-delimited list of active namespaces +#define PMIX_QUERY_NAMESPACE_INFO "pmix.qry.nsinfo" // (pmix_data_array_t) request an array of active nspace information - each + // element will contain an array including the namespace plus the + // command line of the application executing within it #define PMIX_QUERY_JOB_STATUS "pmix.qry.jst" // (pmix_status_t) status of a specified currently executing job #define PMIX_QUERY_QUEUE_LIST "pmix.qry.qlst" // (char*) request a comma-delimited list of scheduler queues #define PMIX_QUERY_QUEUE_STATUS "pmix.qry.qst" // (TBD) status of a specified scheduler queue @@ -442,6 +445,49 @@ typedef uint32_t pmix_rank_t; #define PMIX_TIME_REMAINING "pmix.time.remaining" // (char*) query number of seconds (uint32_t) remaining in allocation // for the specified nspace +/* information retrieval attributes */ +#define PMIX_SESSION_INFO "pmix.ssn.info" // (bool) Return information about the specified session. If information + // about a session other than the one containing the requesting + // process is desired, then the attribute array must contain a + // PMIX_SESSION_ID attribute identifying the desired target. +#define PMIX_JOB_INFO "pmix.job.info" // (bool) Return information about the specified job or namespace. If + // information about a job or namespace other than the one containing + // the requesting process is desired, then the attribute array must + // contain a PMIX_JOBID or PMIX_NSPACE attribute identifying the + // desired target. Similarly, if information is requested about a + // job or namespace in a session other than the one containing the + // requesting process, then an attribute identifying the target + // session must be provided. +#define PMIX_APP_INFO "pmix.app.info" // (bool) Return information about the specified application. If information + // about an application other than the one containing the requesting + // process is desired, then the attribute array must contain a + // PMIX_APPNUM attribute identifying the desired target. Similarly, + // if information is requested about an application in a job or session + // other than the one containing the requesting process, then attributes + // identifying the target job and/or session must be provided. +#define PMIX_NODE_INFO "pmix.node.info" // (bool) Return information about the specified node. If information about a + // node other than the one containing the requesting process is desired, + // then the attribute array must contain either the PMIX_NODEID or + // PMIX_HOSTNAME attribute identifying the desired target. + +/* information storage attributes */ +#define PMIX_SESSION_INFO_ARRAY "pmix.ssn.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing + // session-level information. The PMIX_SESSION_ID attribute is required + // to be included in the array. +#define PMIX_JOB_INFO_ARRAY "pmix.job.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing job-level + // information. Information is registered one job (aka namespace) at a time + // via the PMIx_server_register_nspace API. Thus, there is no requirement that + // the array contain either the PMIX_NSPACE or PMIX_JOBID attributes, though + // either or both of them may be included. +#define PMIX_APP_INFO_ARRAY "pmix.app.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing app-level + // information. The PMIX_NSPACE or PMIX_JOBID attributes of the job containing + // the appplication, plus its PMIX_APPNUM attribute, are required to be + // included in the array. +#define PMIX_NODE_INFO_ARRAY "pmix.node.arr" // (pmix_data_array_t) Provide an array of pmix_info_t containing node-level + // information. At a minimum, either the PMIX_NODEID or PMIX_HOSTNAME + // attribute is required to be included in the array, though both may be + // included. + /* log attributes */ #define PMIX_LOG_SOURCE "pmix.log.source" // (pmix_proc_t*) ID of source of the log request #define PMIX_LOG_STDERR "pmix.log.stderr" // (char*) log string to stderr @@ -747,75 +793,67 @@ typedef int pmix_status_t; #define PMIX_ERR_V2X_BASE -100 /* v2.x communication errors */ -#define PMIX_ERR_LOST_CONNECTION_TO_SERVER (PMIX_ERR_V2X_BASE - 1) -#define PMIX_ERR_LOST_PEER_CONNECTION (PMIX_ERR_V2X_BASE - 2) -#define PMIX_ERR_LOST_CONNECTION_TO_CLIENT (PMIX_ERR_V2X_BASE - 3) +#define PMIX_ERR_LOST_CONNECTION_TO_SERVER -101 +#define PMIX_ERR_LOST_PEER_CONNECTION -102 +#define PMIX_ERR_LOST_CONNECTION_TO_CLIENT -103 /* used by the query system */ -#define PMIX_QUERY_PARTIAL_SUCCESS (PMIX_ERR_V2X_BASE - 4) +#define PMIX_QUERY_PARTIAL_SUCCESS -104 /* request responses */ -#define PMIX_NOTIFY_ALLOC_COMPLETE (PMIX_ERR_V2X_BASE - 5) +#define PMIX_NOTIFY_ALLOC_COMPLETE -105 /* job control */ -#define PMIX_JCTRL_CHECKPOINT (PMIX_ERR_V2X_BASE - 6) // monitored by client to trigger checkpoint operation -#define PMIX_JCTRL_CHECKPOINT_COMPLETE (PMIX_ERR_V2X_BASE - 7) // sent by client and monitored by server to notify that requested +#define PMIX_JCTRL_CHECKPOINT -106 // monitored by client to trigger checkpoint operation +#define PMIX_JCTRL_CHECKPOINT_COMPLETE -107 // sent by client and monitored by server to notify that requested // checkpoint operation has completed -#define PMIX_JCTRL_PREEMPT_ALERT (PMIX_ERR_V2X_BASE - 8) // monitored by client to detect RM intends to preempt -/* monitoring */ -#define PMIX_MONITOR_HEARTBEAT_ALERT (PMIX_ERR_V2X_BASE - 9) -#define PMIX_MONITOR_FILE_ALERT (PMIX_ERR_V2X_BASE - 10) -#define PMIX_PROC_TERMINATED (PMIX_ERR_V2X_BASE - 11) +#define PMIX_JCTRL_PREEMPT_ALERT -108 // monitored by client to detect RM intends to preempt -/* define a starting point for operational error constants so - * we avoid renumbering when making additions */ -#define PMIX_ERR_OP_BASE PMIX_ERR_V2X_BASE-30 +/* monitoring */ +#define PMIX_MONITOR_HEARTBEAT_ALERT -109 +#define PMIX_MONITOR_FILE_ALERT -110 +#define PMIX_PROC_TERMINATED -111 +#define PMIX_ERR_INVALID_TERMINATION -112 /* operational */ -#define PMIX_ERR_EVENT_REGISTRATION (PMIX_ERR_OP_BASE - 14) -#define PMIX_ERR_JOB_TERMINATED (PMIX_ERR_OP_BASE - 15) -#define PMIX_ERR_UPDATE_ENDPOINTS (PMIX_ERR_OP_BASE - 16) -#define PMIX_MODEL_DECLARED (PMIX_ERR_OP_BASE - 17) -#define PMIX_GDS_ACTION_COMPLETE (PMIX_ERR_OP_BASE - 18) -#define PMIX_PROC_HAS_CONNECTED (PMIX_ERR_OP_BASE - 19) -#define PMIX_CONNECT_REQUESTED (PMIX_ERR_OP_BASE - 20) -#define PMIX_MODEL_RESOURCES (PMIX_ERR_OP_BASE - 21) // model resource usage has changed -#define PMIX_OPENMP_PARALLEL_ENTERED (PMIX_ERR_OP_BASE - 22) // an OpenMP parallel region has been entered -#define PMIX_OPENMP_PARALLEL_EXITED (PMIX_ERR_OP_BASE - 23) // an OpenMP parallel region has completed -#define PMIX_LAUNCH_DIRECTIVE (PMIX_ERR_OP_BASE - 24) -#define PMIX_LAUNCHER_READY (PMIX_ERR_OP_BASE - 25) -#define PMIX_OPERATION_IN_PROGRESS (PMIX_ERR_OP_BASE - 26) -#define PMIX_OPERATION_SUCCEEDED (PMIX_ERR_OP_BASE - 27) -/* gap for group codes */ - - -/* define a starting point for system error constants so - * we avoid renumbering when making additions */ -#define PMIX_ERR_SYS_BASE PMIX_ERR_OP_BASE-100 +#define PMIX_ERR_EVENT_REGISTRATION -144 +#define PMIX_ERR_JOB_TERMINATED -145 +#define PMIX_ERR_UPDATE_ENDPOINTS -146 +#define PMIX_MODEL_DECLARED -147 +#define PMIX_GDS_ACTION_COMPLETE -148 +#define PMIX_PROC_HAS_CONNECTED -149 +#define PMIX_CONNECT_REQUESTED -150 +#define PMIX_MODEL_RESOURCES -151 // model resource usage has changed +#define PMIX_OPENMP_PARALLEL_ENTERED -152 // an OpenMP parallel region has been entered +#define PMIX_OPENMP_PARALLEL_EXITED -153 // an OpenMP parallel region has completed +#define PMIX_LAUNCH_DIRECTIVE -154 +#define PMIX_LAUNCHER_READY -155 +#define PMIX_OPERATION_IN_PROGRESS -156 +#define PMIX_OPERATION_SUCCEEDED -157 +#define PMIX_ERR_INVALID_OPERATION -158 /* system failures */ -#define PMIX_ERR_NODE_DOWN (PMIX_ERR_SYS_BASE - 1) -#define PMIX_ERR_NODE_OFFLINE (PMIX_ERR_SYS_BASE - 2) +#define PMIX_ERR_NODE_DOWN -231 +#define PMIX_ERR_NODE_OFFLINE -232 +#define PMIX_ERR_SYS_OTHER -330 - -/* define a starting point for event handler error constants so - * we avoid renumbering when making additions */ -#define PMIX_ERR_EVHDLR_BASE PMIX_ERR_SYS_BASE-100 +/* define a macro for identifying system event values */ +#define PMIX_SYSTEM_EVENT(a) \ + ((a) <= PMIX_ERR_NODE_DOWN && PMIX_ERR_SYS_OTHER <= (a)) /* used by event handlers */ -#define PMIX_EVENT_NO_ACTION_TAKEN (PMIX_ERR_EVHDLR_BASE - 1) -#define PMIX_EVENT_PARTIAL_ACTION_TAKEN (PMIX_ERR_EVHDLR_BASE - 2) -#define PMIX_EVENT_ACTION_DEFERRED (PMIX_ERR_EVHDLR_BASE - 3) -#define PMIX_EVENT_ACTION_COMPLETE (PMIX_ERR_EVHDLR_BASE - 4) - +#define PMIX_EVENT_NO_ACTION_TAKEN -331 +#define PMIX_EVENT_PARTIAL_ACTION_TAKEN -332 +#define PMIX_EVENT_ACTION_DEFERRED -333 +#define PMIX_EVENT_ACTION_COMPLETE -334 /* define a starting point for PMIx internal error codes * that are never exposed outside the library */ -#define PMIX_INTERNAL_ERR_BASE -1000 +#define PMIX_INTERNAL_ERR_BASE -1330 /* define a starting point for user-level defined error * constants - negative values larger than this are guaranteed * not to conflict with PMIx values. Definitions should always * be based on the PMIX_EXTERNAL_ERR_BASE constant and -not- a * specific value as the value of the constant may change */ -#define PMIX_EXTERNAL_ERR_BASE -2000 +#define PMIX_EXTERNAL_ERR_BASE PMIX_INTERNAL_ERR_BASE-2000 /**** PMIX DATA TYPES ****/ typedef uint16_t pmix_data_type_t; @@ -850,7 +888,7 @@ typedef uint16_t pmix_data_type_t; #define PMIX_BUFFER 26 #define PMIX_BYTE_OBJECT 27 #define PMIX_KVAL 28 -#define PMIX_MODEX 29 +// Hole left by deprecation/removal of PMIX_MODEX #define PMIX_PERSIST 30 #define PMIX_POINTER 31 #define PMIX_SCOPE 32 @@ -865,9 +903,7 @@ typedef uint16_t pmix_data_type_t; #define PMIX_QUERY 41 #define PMIX_COMPRESSED_STRING 42 // string compressed with zlib #define PMIX_ALLOC_DIRECTIVE 43 -/**** DEPRECATED ****/ -#define PMIX_INFO_ARRAY 44 -/**** ****/ +// Hole left by deprecation/removal of PMIX_INFO_ARRAY #define PMIX_IOF_CHANNEL 45 #define PMIX_ENVAR 46 /********************/ @@ -894,7 +930,7 @@ typedef uint8_t pmix_scope_t; #define PMIX_GLOBAL 3 // share with all procs (local + remote) #define PMIX_INTERNAL 4 // store data in the internal tables -/* define a range for data "published" by PMI +/* define a range for data "published" by PMIx */ typedef uint8_t pmix_data_range_t; #define PMIX_RANGE_UNDEF 0 @@ -920,6 +956,7 @@ typedef uint8_t pmix_persistence_t; * command directives via pmix_info_t arrays */ typedef uint32_t pmix_info_directives_t; #define PMIX_INFO_REQD 0x00000001 +#define PMIX_INFO_ARRAY_END 0x00000002 // mark the end of an array created by PMIX_INFO_CREATE /* the top 16-bits are reserved for internal use by * implementers - these may be changed inside the * PMIx library */ @@ -952,15 +989,34 @@ typedef uint16_t pmix_iof_channel_t; #define PMIX_FWD_STDDIAG_CHANNEL 0x0008 #define PMIX_FWD_ALL_CHANNELS 0x00ff - /* declare a convenience macro for checking keys */ #define PMIX_CHECK_KEY(a, b) \ (0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN)) +#define PMIX_LOAD_KEY(a, b) \ + do { \ + memset((a), 0, PMIX_MAX_KEYLEN+1); \ + pmix_strncpy((a), (b), PMIX_MAX_KEYLEN); \ + }while(0) + +/* define a convenience macro for loading nspaces */ +#define PMIX_LOAD_NSPACE(a, b) \ + do { \ + memset((a), 0, PMIX_MAX_NSLEN+1); \ + pmix_strncpy((a), (b), PMIX_MAX_NSLEN); \ + }while(0) + /* define a convenience macro for checking nspaces */ #define PMIX_CHECK_NSPACE(a, b) \ (0 == strncmp((a), (b), PMIX_MAX_NSLEN)) +/* define a convenience macro for loading names */ +#define PMIX_LOAD_PROCID(a, b, c) \ + do { \ + PMIX_LOAD_NSPACE((a)->nspace, (b)); \ + (a)->rank = (c); \ + }while(0) + /* define a convenience macro for checking names */ #define PMIX_CHECK_PROCID(a, b) \ (PMIX_CHECK_NSPACE((a)->nspace, (b)->nspace) && ((a)->rank == (b)->rank || (PMIX_RANK_WILDCARD == (a)->rank || PMIX_RANK_WILDCARD == (b)->rank))) @@ -993,15 +1049,18 @@ typedef struct pmix_byte_object { } \ } while(0) -#define PMIX_BYTE_OBJECT_FREE(m, n) \ - do { \ - size_t _n; \ - for (_n=0; _n < n; _n++) { \ - if (NULL != (m)[_n].bytes) { \ - free((m)[_n].bytes); \ - } \ - } \ - free((m)); \ +#define PMIX_BYTE_OBJECT_FREE(m, n) \ + do { \ + size_t _bon; \ + if (NULL != (m)) { \ + for (_bon=0; _bon < n; _bon++) { \ + if (NULL != (m)[_bon].bytes) { \ + free((m)[_bon].bytes); \ + } \ + } \ + free((m)); \ + (m) = NULL; \ + } \ } while(0) #define PMIX_BYTE_OBJECT_LOAD(b, d, s) \ @@ -1034,10 +1093,10 @@ typedef struct { } while (0) #define PMIX_ENVAR_FREE(m, n) \ do { \ - size_t _k; \ + size_t _ek; \ if (NULL != (m)) { \ - for (_k=0; _k < (n); _k++) { \ - PMIX_ENVAR_DESTRUCT(&(m)[_k]); \ + for (_ek=0; _ek < (n); _ek++) { \ + PMIX_ENVAR_DESTRUCT(&(m)[_ek]); \ } \ free((m)); \ } \ @@ -1130,7 +1189,7 @@ typedef struct pmix_data_buffer { /**** PMIX PROC OBJECT ****/ typedef struct pmix_proc { - char nspace[PMIX_MAX_NSLEN+1]; + pmix_nspace_t nspace; pmix_rank_t rank; } pmix_proc_t; #define PMIX_PROC_CREATE(m, n) \ @@ -1162,7 +1221,7 @@ typedef struct pmix_proc { #define PMIX_PROC_LOAD(m, n, r) \ do { \ PMIX_PROC_CONSTRUCT((m)); \ - (void)strncpy((m)->nspace, (n), PMIX_MAX_NSLEN); \ + pmix_strncpy((m)->nspace, (n), PMIX_MAX_NSLEN); \ (m)->rank = (r); \ } while(0) @@ -1172,9 +1231,9 @@ typedef struct pmix_proc { memset((t), 0, PMIX_MAX_NSLEN+1); \ _len = strlen((c)); \ if ((_len + strlen((n))) < PMIX_MAX_NSLEN) { \ - (void)strncpy((t), (c), PMIX_MAX_NSLEN); \ + pmix_strncpy((t), (c), PMIX_MAX_NSLEN); \ (t)[_len] = ':'; \ - (void)strncpy(&(t)[_len+1], (n), PMIX_MAX_NSLEN - _len - 1); \ + pmix_strncpy(&(t)[_len+1], (n), PMIX_MAX_NSLEN - _len); \ } \ } while(0) @@ -1241,34 +1300,24 @@ typedef struct pmix_proc_info { } while (0) -/**** PMIX VALUE STRUCT ****/ -typedef struct pmix_info_t pmix_info_t; +/**** PMIX DATA ARRAY STRUCT ****/ typedef struct pmix_data_array { pmix_data_type_t type; size_t size; void *array; } pmix_data_array_t; -#define PMIX_DATA_ARRAY_CONSTRUCT(m, n, t) \ - do { \ - (m)->type = (t); \ - (m)->size = (n); \ - } while(0) -#define PMIX_DATA_ARRAY_CREATE(m, n, t) \ - do { \ - (m) = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); \ - PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ - } while(0) -typedef struct pmix_info_array { - size_t size; - pmix_info_t *array; -} pmix_info_array_t; -/********************/ +/**** THE PMIX_DATA_ARRAY SUPPORT MACROS ARE DEFINED ****/ +/**** DOWN BELOW (NEAR THE BOTTOM OF THE FILE) TO ****/ +/**** AVOID CIRCULAR DEPENDENCIES ****/ + + +/**** PMIX VALUE STRUCT ****/ /* NOTE: operations can supply a collection of values under - * a single key by passing a pmix_value_t containing an - * array of type PMIX_INFO_ARRAY, with each array element + * a single key by passing a pmix_value_t containing a + * data array of type PMIX_INFO, with each array element * containing its own pmix_info_t object */ typedef struct pmix_value { @@ -1306,9 +1355,6 @@ typedef struct pmix_value { void *ptr; pmix_alloc_directive_t adir; pmix_envar_t envar; - /**** DEPRECATED ****/ - pmix_info_array_t *array; - /********************/ } data; } pmix_value_t; /* allocate and initialize a specified number of value structs */ @@ -1345,16 +1391,36 @@ typedef struct pmix_value { #define PMIX_VALUE_FREE(m, n) \ do { \ - size_t _s; \ + size_t _vv; \ if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_VALUE_DESTRUCT(&((m)[_s])); \ + for (_vv=0; _vv < (n); _vv++) { \ + PMIX_VALUE_DESTRUCT(&((m)[_vv])); \ } \ free((m)); \ (m) = NULL; \ } \ } while (0) +#define PMIX_VALUE_LOAD(v, d, t) \ + pmix_value_load((v), (d), (t)) + +#define PMIX_VALUE_UNLOAD(r, k, d, s) \ + (r) = pmix_value_unload((k), (d), (s)) + +#define PMIX_VALUE_XFER(r, v, s) \ + do { \ + if (NULL == (v)) { \ + (v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \ + if (NULL == (v)) { \ + (r) = PMIX_ERR_NOMEM; \ + } else { \ + (r) = pmix_value_xfer((v), (s)); \ + } \ + } else { \ + (r) = pmix_value_xfer((v), (s)); \ + } \ + } while(0) + #define PMIX_VALUE_GET_NUMBER(s, m, n, t) \ do { \ (s) = PMIX_SUCCESS; \ @@ -1384,60 +1450,47 @@ typedef struct pmix_value { (n) = (t)((m)->data.fval); \ } else if (PMIX_DOUBLE == (m)->type) { \ (n) = (t)((m)->data.dval); \ + } else if (PMIX_PID == (m)->type) { \ + (n) = (t)((m)->data.pid); \ } else { \ (s) = PMIX_ERR_BAD_PARAM; \ } \ } while(0) -/* expose some functions that are resolved in the - * PMIx library, but part of a header that - * includes internal functions - we don't - * want to expose the entire header here. For - * consistency, we provide macro versions as well - */ -void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type); -#define PMIX_VALUE_LOAD(v, d, t) \ - pmix_value_load((v), (d), (t)) - -pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data, size_t *sz); -#define PMIX_VALUE_UNLOAD(r, k, d, s) \ - (r) = pmix_value_unload((k), (d), (s)) - -pmix_status_t pmix_value_xfer(pmix_value_t *kv, pmix_value_t *src); -#define PMIX_VALUE_XFER(r, v, s) \ - do { \ - if (NULL == (v)) { \ - (v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \ - if (NULL == (v)) { \ - (r) = PMIX_ERR_NOMEM; \ - } else { \ - (r) = pmix_value_xfer((v), (s)); \ - } \ - } else { \ - (r) = pmix_value_xfer((v), (s)); \ - } \ +#define PMIX_VALUE_COMPRESSED_STRING_UNPACK(s) \ + do { \ + char *tmp; \ + /* if this is a compressed string, then uncompress it */ \ + if (PMIX_COMPRESSED_STRING == (s)->type) { \ + pmix_util_uncompress_string(&tmp, (uint8_t*)(s)->data.bo.bytes, \ + (s)->data.bo.size); \ + if (NULL == tmp) { \ + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); \ + rc = PMIX_ERR_NOMEM; \ + PMIX_VALUE_RELEASE(s); \ + val = NULL; \ + } else { \ + PMIX_VALUE_DESTRUCT(s); \ + (s)->data.string = tmp; \ + (s)->type = PMIX_STRING; \ + } \ + } \ } while(0) -pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg); -#define PMIX_ARGV_APPEND(r, a, b) \ - (r) = pmix_argv_append_nosize(&(a), (b)) - -pmix_status_t pmix_setenv(const char *name, const char *value, - bool overwrite, char ***env); -#define PMIX_SETENV(r, a, b, c) \ - (r) = pmix_setenv((a), (b), true, (c)) - /**** PMIX INFO STRUCT ****/ -struct pmix_info_t { - char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator +typedef struct pmix_info { + pmix_key_t key; pmix_info_directives_t flags; // bit-mask of flags pmix_value_t value; -}; +} pmix_info_t; /* utility macros for working with pmix_info_t structs */ #define PMIX_INFO_CREATE(m, n) \ do { \ + pmix_info_t *_i; \ (m) = (pmix_info_t*)calloc((n), sizeof(pmix_info_t)); \ + _i = (pmix_info_t*)(m); \ + _i[(n)-1].flags = PMIX_INFO_ARRAY_END; \ } while (0) #define PMIX_INFO_CONSTRUCT(m) \ @@ -1451,22 +1504,22 @@ struct pmix_info_t { PMIX_VALUE_DESTRUCT(&(m)->value); \ } while (0) -#define PMIX_INFO_FREE(m, n) \ - do { \ - size_t _s; \ - if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_INFO_DESTRUCT(&((m)[_s])); \ - } \ - free((m)); \ - (m) = NULL; \ - } \ +#define PMIX_INFO_FREE(m, n) \ + do { \ + size_t _is; \ + if (NULL != (m)) { \ + for (_is=0; _is < (n); _is++) { \ + PMIX_INFO_DESTRUCT(&((m)[_is])); \ + } \ + free((m)); \ + (m) = NULL; \ + } \ } while (0) #define PMIX_INFO_LOAD(m, k, v, t) \ do { \ if (NULL != (k)) { \ - (void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ + pmix_strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ } \ (m)->flags = 0; \ pmix_value_load(&((m)->value), (v), (t)); \ @@ -1474,46 +1527,30 @@ struct pmix_info_t { #define PMIX_INFO_XFER(d, s) \ do { \ if (NULL != (s)->key) { \ - (void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ + pmix_strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ } \ (d)->flags = (s)->flags; \ pmix_value_xfer(&(d)->value, (pmix_value_t*)&(s)->value); \ } while(0) + +/* macros for setting and unsetting the "reqd" flag + * in a pmix_info_t */ #define PMIX_INFO_REQUIRED(m) \ (m)->flags |= PMIX_INFO_REQD #define PMIX_INFO_OPTIONAL(m) \ (m)->flags &= ~PMIX_INFO_REQD +/* macros for testing the "reqd" flag in a pmix_info_t */ #define PMIX_INFO_IS_REQUIRED(m) \ (m)->flags & PMIX_INFO_REQD #define PMIX_INFO_IS_OPTIONAL(m) \ !((m)->flags & PMIX_INFO_REQD) -#define PMIX_INFO_UNLOAD(r, v, l) \ - do { \ - pmix_info_t *_info; \ - size_t _n, _ninfo; \ - pmix_kval_t *_kv; \ - _info = (pmix_info_t*)(v)->data.darray->array; \ - _ninfo = (v)->data.darray->size; \ - for (_n = 0; _n < _ninfo; _n++){ \ - _kv = PMIX_NEW(pmix_kval_t); \ - if (NULL == _kv) { \ - (r) = PMIX_ERR_NOMEM; \ - break; \ - } \ - if (NULL != _info[_n].key) { \ - _kv->key = strdup(_info[_n].key); \ - } \ - PMIX_VALUE_XFER((r), _kv->value, &_info[_n].value);\ - if (PMIX_SUCCESS != (r)) { \ - PMIX_RELEASE(_kv); \ - break; \ - } \ - pmix_list_append((l), &_kv->super); \ - } \ - } while(0) +/* macro for testing end of the array */ +#define PMIX_INFO_IS_END(m) \ + (m)->flags & PMIX_INFO_ARRAY_END + /* define a special macro for checking if a boolean * info is true - when info structs are provided, a * type of PMIX_UNDEF is taken to imply a boolean "true" @@ -1526,7 +1563,7 @@ struct pmix_info_t { /**** PMIX LOOKUP RETURN STRUCT ****/ typedef struct pmix_pdata { pmix_proc_t proc; - char key[PMIX_MAX_KEYLEN+1]; // ensure room for the NULL terminator + pmix_key_t key; pmix_value_t value; } pmix_pdata_t; @@ -1556,10 +1593,11 @@ typedef struct pmix_pdata { #define PMIX_PDATA_FREE(m, n) \ do { \ - size_t _s; \ - if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_PDATA_DESTRUCT(&((m)[_s])); \ + size_t _ps; \ + pmix_pdata_t *_pdf = (pmix_pdata_t*)(m); \ + if (NULL != _pdf) { \ + for (_ps=0; _ps < (n); _ps++) { \ + PMIX_PDATA_DESTRUCT(&(_pdf[_ps])); \ } \ free((m)); \ (m) = NULL; \ @@ -1570,9 +1608,9 @@ typedef struct pmix_pdata { do { \ if (NULL != (m)) { \ memset((m), 0, sizeof(pmix_pdata_t)); \ - (void)strncpy((m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \ + pmix_strncpy((m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \ (m)->proc.rank = (p)->rank; \ - (void)strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ + pmix_strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ pmix_value_load(&((m)->value), (v), (t)); \ } \ } while (0) @@ -1581,9 +1619,9 @@ typedef struct pmix_pdata { do { \ if (NULL != (d)) { \ memset((d), 0, sizeof(pmix_pdata_t)); \ - (void)strncpy((d)->proc.nspace, (s)->proc.nspace, PMIX_MAX_NSLEN); \ + pmix_strncpy((d)->proc.nspace, (s)->proc.nspace, PMIX_MAX_NSLEN); \ (d)->proc.rank = (s)->proc.rank; \ - (void)strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ + pmix_strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ pmix_value_xfer(&((d)->value), &((s)->value)); \ } \ } while (0) @@ -1605,6 +1643,12 @@ typedef struct pmix_app { (m) = (pmix_app_t*)calloc((n), sizeof(pmix_app_t)); \ } while (0) +#define PMIX_APP_INFO_CREATE(m, n) \ + do { \ + (m)->ninfo = (n); \ + PMIX_INFO_CREATE((m)->info, (m)->ninfo); \ + } while(0) + #define PMIX_APP_RELEASE(m) \ do { \ PMIX_APP_DESTRUCT((m)); \ @@ -1619,21 +1663,21 @@ typedef struct pmix_app { #define PMIX_APP_DESTRUCT(m) \ do { \ - size_t _ii; \ + size_t _aii; \ if (NULL != (m)->cmd) { \ free((m)->cmd); \ (m)->cmd = NULL; \ } \ if (NULL != (m)->argv) { \ - for (_ii=0; NULL != (m)->argv[_ii]; _ii++) { \ - free((m)->argv[_ii]); \ + for (_aii=0; NULL != (m)->argv[_aii]; _aii++) { \ + free((m)->argv[_aii]); \ } \ free((m)->argv); \ (m)->argv = NULL; \ } \ if (NULL != (m)->env) { \ - for (_ii=0; NULL != (m)->env[_ii]; _ii++) { \ - free((m)->env[_ii]); \ + for (_aii=0; NULL != (m)->env[_aii]; _aii++) { \ + free((m)->env[_aii]); \ } \ free((m)->env); \ (m)->env = NULL; \ @@ -1643,20 +1687,18 @@ typedef struct pmix_app { (m)->cwd = NULL; \ } \ if (NULL != (m)->info) { \ - for (_ii=0; _ii < (m)->ninfo; _ii++) { \ - PMIX_INFO_DESTRUCT(&(m)->info[_ii]); \ - } \ - free((m)->info); \ + PMIX_INFO_FREE((m)->info, (m)->ninfo); \ (m)->info = NULL; \ + (m)->ninfo = 0; \ } \ } while (0) #define PMIX_APP_FREE(m, n) \ do { \ - size_t _s; \ + size_t _as; \ if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_APP_DESTRUCT(&((m)[_s])); \ + for (_as=0; _as < (n); _as++) { \ + PMIX_APP_DESTRUCT(&((m)[_as])); \ } \ free((m)); \ (m) = NULL; \ @@ -1676,6 +1718,12 @@ typedef struct pmix_query { (m) = (pmix_query_t*)calloc((n) , sizeof(pmix_query_t)); \ } while (0) +#define PMIX_QUERY_QUALIFIERS_CREATE(m, n) \ + do { \ + (m)->nqual = (n); \ + PMIX_INFO_CREATE((m)->qualifiers, (m)->nqual); \ + } while(0) + #define PMIX_QUERY_RELEASE(m) \ do { \ PMIX_QUERY_DESTRUCT((m)); \ @@ -1690,29 +1738,27 @@ typedef struct pmix_query { #define PMIX_QUERY_DESTRUCT(m) \ do { \ - size_t _ii; \ + size_t _qi; \ if (NULL != (m)->keys) { \ - for (_ii=0; NULL != (m)->keys[_ii]; _ii++) { \ - free((m)->keys[_ii]); \ + for (_qi=0; NULL != (m)->keys[_qi]; _qi++) { \ + free((m)->keys[_qi]); \ } \ free((m)->keys); \ (m)->keys = NULL; \ } \ if (NULL != (m)->qualifiers) { \ - for (_ii=0; _ii < (m)->nqual; _ii++) { \ - PMIX_INFO_DESTRUCT(&(m)->qualifiers[_ii]); \ - } \ - free((m)->qualifiers); \ + PMIX_INFO_FREE((m)->qualifiers, (m)->nqual); \ (m)->qualifiers = NULL; \ + (m)->nqual = 0; \ } \ } while (0) #define PMIX_QUERY_FREE(m, n) \ do { \ - size_t _s; \ + size_t _qs; \ if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_QUERY_DESTRUCT(&((m)[_s])); \ + for (_qs=0; _qs < (n); _qs++) { \ + PMIX_QUERY_DESTRUCT(&((m)[_qs])); \ } \ free((m)); \ (m) = NULL; \ @@ -1720,52 +1766,152 @@ typedef struct pmix_query { } while (0) +/**** GENERIC HELPER MACROS ****/ +/* Append a string (by value) to an new or existing NULL-terminated + * argv array. + * + * @param argv Pointer to an argv array. + * @param str Pointer to the string to append. + * + * @retval PMIX_SUCCESS On success + * @retval PMIX_ERROR On failure + * + * This function adds a string to an argv array of strings by value; + * it is permissable to pass a string on the stack as the str + * argument to this function. + * + * To add the first entry to an argv array, call this function with + * (*argv == NULL). This function will allocate an array of length + * 2; the first entry will point to a copy of the string passed in + * arg, the second entry will be set to NULL. + * + * If (*argv != NULL), it will be realloc'ed to be 1 (char*) larger, + * and the next-to-last entry will point to a copy of the string + * passed in arg. The last entry will be set to NULL. + * + * Just to reinforce what was stated above: the string is copied by + * value into the argv array; there is no need to keep the original + * string (i.e., the arg parameter) after invoking this function. + */ +#define PMIX_ARGV_APPEND(r, a, b) \ + (r) = pmix_argv_append_nosize(&(a), (b)) -/**** PMIX MODEX STRUCT ****/ -typedef struct pmix_modex_data { - char nspace[PMIX_MAX_NSLEN+1]; - int rank; - uint8_t *blob; - size_t size; -} pmix_modex_data_t; -/* utility macros for working with pmix_modex_t structs */ -#define PMIX_MODEX_CREATE(m, n) \ - do { \ - (m) = (pmix_modex_data_t*)calloc((n) , sizeof(pmix_modex_data_t)); \ - } while (0) +/* Prepend a string to a new or existing NULL-terminated + * argv array - same as above only prepend + */ +#define PMIX_ARGV_PREPEND(r, a, b) \ + (r) = pmix_argv_prepend_nosize(a, b) -#define PMIX_MODEX_RELEASE(m) \ - do { \ - PMIX_MODEX_DESTRUCT((m)); \ - free((m)); \ - (m) = NULL; \ - } while (0) +/* Append to an argv-style array, but only if the provided argument + * doesn't already exist somewhere in the array. Ignore the size of the array. + * + * @param argv Pointer to an argv array. + * @param str Pointer to the string to append. + * @param bool Whether or not to overwrite a matching value if found + * + * @retval PMIX_SUCCESS On success + * @retval PMIX_ERROR On failure + * + * This function is identical to the pmix_argv_append_nosize() function + * except that it only appends the provided argument if it does not already + * exist in the provided array, or overwrites it if it is. + */ +#define PMIX_ARGV_APPEND_UNIQUE(r, a, b, c) \ + (r) = pmix_argv_append_unique_nosize(a, b, c) -#define PMIX_MODEX_CONSTRUCT(m) \ - do { \ - memset((m), 0, sizeof(pmix_modex_data_t)); \ - } while (0) +/* Free a NULL-terminated argv array. + * + * @param argv Argv array to free. + * + * This function frees an argv array and all of the strings that it + * contains. Since the argv parameter is passed by value, it is not + * set to NULL in the caller's scope upon return. + * + * It is safe to invoke this function with a NULL pointer. It is + * not safe to invoke this function with a non-NULL-terminated argv + * array. + */ +#define PMIX_ARGV_FREE(a) pmix_argv_free(a) -#define PMIX_MODEX_DESTRUCT(m) \ - do { \ - if (NULL != (m)->blob) { \ - free((m)->blob); \ - (m)->blob = NULL; \ - } \ - } while (0) +/* + * Split a string into a NULL-terminated argv array. Do not include empty + * strings in result array. + * + * @param src_string Input string. + * @param delimiter Delimiter character. + * + * @retval argv pointer to new argv array on success + * @retval NULL on error + * + * All strings are insertted into the argv array by value; the + * newly-allocated array makes no references to the src_string + * argument (i.e., it can be freed after calling this function + * without invalidating the output argv). + */ +#define PMIX_ARGV_SPLIT(a, b, c) \ + (a) = pmix_argv_split(b, c) -#define PMIX_MODEX_FREE(m, n) \ - do { \ - size_t _s; \ - if (NULL != (m)) { \ - for (_s=0; _s < (n); _s++) { \ - PMIX_MODEX_DESTRUCT(&((m)[_s])); \ - } \ - free((m)); \ - (m) = NULL; \ - } \ - } while (0) +/* + * Return the length of a NULL-terminated argv array. + * + * @param argv The input argv array. + * + * @retval 0 If NULL is passed as argv. + * @retval count Number of entries in the argv array. + * + * The argv array must be NULL-terminated. + */ +#define PMIX_ARGV_COUNT(r, a) \ + (r) = pmix_argv_count(a) + +/* + * Join all the elements of an argv array into a single + * newly-allocated string. + * + * @param argv The input argv array. + * @param delimiter Delimiter character placed between each argv string. + * + * @retval new_string Output string on success. + * @retval NULL On failure. + * + * Similar to the Perl join function, this function takes an input + * argv and joins them into into a single string separated by the + * delimiter character. + * + * It is the callers responsibility to free the returned string. + */ +#define PMIX_ARGV_JOIN(a, b, c) \ + (a) = pmix_argv_join(b, c) + +/* + * Copy a NULL-terminated argv array. + * + * @param argv The input argv array. + * + * @retval argv Copied argv array on success. + * @retval NULL On failure. + * + * Copy an argv array, including copying all off its strings. + * Specifically, the output argv will be an array of the same length + * as the input argv, and strcmp(argv_in[i], argv_out[i]) will be 0. + */ +#define PMIX_ARGV_COPY(a, b) \ + (a) = pmix_argv_copy(b) + +/* + * Set an environmenal paramter in an env array + * + * @retval r Return pmix_status_t status + * + * @param a Name of the environmental param + * + * @param b String value of the environmental param + * + * @param c Address of the NULL-terminated env array + */ +#define PMIX_SETENV(r, a, b, c) \ + (r) = pmix_setenv((a), (b), true, (c)) /**** CALLBACK FUNCTIONS FOR NON-BLOCKING OPERATIONS ****/ @@ -1794,7 +1940,7 @@ typedef void (*pmix_modex_cbfunc_t)(pmix_status_t status, * released by the library upon return from the callback function, so * the receiver must copy it if it needs to be retained */ typedef void (*pmix_spawn_cbfunc_t)(pmix_status_t status, - char nspace[], void *cbdata); + pmix_nspace_t nspace, void *cbdata); /* define a callback for common operations that simply return * a status. Examples include the non-blocking versions of @@ -1902,6 +2048,10 @@ typedef void (*pmix_notification_fn_t)(size_t evhdlr_registration_id, typedef void (*pmix_hdlr_reg_cbfunc_t)(pmix_status_t status, size_t refid, void *cbdata); +/* maintain backward compatibility with v2 definition - change of name */ +typedef void (*pmix_evhdlr_reg_cbfunc_t)(pmix_status_t status, + size_t evhdlr_ref, + void *cbdata); /* define a callback function for calls to PMIx_Get_nb. The status * indicates if the requested data was found or not - a pointer to the @@ -2080,7 +2230,7 @@ PMIX_EXPORT void PMIx_Deregister_event_handler(size_t evhdlr_ref, PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); /* Provide a string representation for several types of value. Note @@ -2114,7 +2264,7 @@ PMIX_EXPORT const char* PMIx_Get_version(void); * proc. This is data that has only internal scope - it will * never be "pushed" externally */ PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc, - const char *key, pmix_value_t *val); + const pmix_key_t key, pmix_value_t *val); /** * Top-level interface function to pack one or more values into a @@ -2344,71 +2494,10 @@ PMIX_EXPORT pmix_status_t PMIx_Data_copy_payload(pmix_data_buffer_t *dest, pmix_data_buffer_t *src); -/* Key-Value pair management macros */ -// TODO: add all possible types/fields here. - -#define PMIX_VAL_FIELD_int(x) ((x)->data.integer) -#define PMIX_VAL_FIELD_uint32_t(x) ((x)->data.uint32) -#define PMIX_VAL_FIELD_uint16_t(x) ((x)->data.uint16) -#define PMIX_VAL_FIELD_string(x) ((x)->data.string) -#define PMIX_VAL_FIELD_float(x) ((x)->data.fval) -#define PMIX_VAL_FIELD_byte(x) ((x)->data.byte) -#define PMIX_VAL_FIELD_flag(x) ((x)->data.flag) - -#define PMIX_VAL_TYPE_int PMIX_INT -#define PMIX_VAL_TYPE_uint32_t PMIX_UINT32 -#define PMIX_VAL_TYPE_uint16_t PMIX_UINT16 -#define PMIX_VAL_TYPE_string PMIX_STRING -#define PMIX_VAL_TYPE_float PMIX_FLOAT -#define PMIX_VAL_TYPE_byte PMIX_BYTE -#define PMIX_VAL_TYPE_flag PMIX_BOOL - -#define PMIX_VAL_set_assign(_v, _field, _val ) \ - do { \ - (_v)->type = PMIX_VAL_TYPE_ ## _field; \ - PMIX_VAL_FIELD_ ## _field((_v)) = _val; \ - } while (0) +static inline void pmix_darray_destruct(pmix_data_array_t *m); -#define PMIX_VAL_set_strdup(_v, _field, _val ) \ - do { \ - (_v)->type = PMIX_VAL_TYPE_ ## _field; \ - PMIX_VAL_FIELD_ ## _field((_v)) = strdup(_val); \ - } while (0) - -#define PMIX_VAL_SET_int PMIX_VAL_set_assign -#define PMIX_VAL_SET_uint32_t PMIX_VAL_set_assign -#define PMIX_VAL_SET_uint16_t PMIX_VAL_set_assign -#define PMIX_VAL_SET_string PMIX_VAL_set_strdup -#define PMIX_VAL_SET_float PMIX_VAL_set_assign -#define PMIX_VAL_SET_byte PMIX_VAL_set_assign -#define PMIX_VAL_SET_flag PMIX_VAL_set_assign - -#define PMIX_VAL_SET(_v, _field, _val ) \ - PMIX_VAL_SET_ ## _field(_v, _field, _val) - -#define PMIX_VAL_cmp_val(_val1, _val2) ((_val1) != (_val2)) -#define PMIX_VAL_cmp_float(_val1, _val2) (((_val1)>(_val2))?(((_val1)-(_val2))>0.000001):(((_val2)-(_val1))>0.000001)) -#define PMIX_VAL_cmp_ptr(_val1, _val2) strncmp(_val1, _val2, strlen(_val1)+1) - -#define PMIX_VAL_CMP_int PMIX_VAL_cmp_val -#define PMIX_VAL_CMP_uint32_t PMIX_VAL_cmp_val -#define PMIX_VAL_CMP_uint16_t PMIX_VAL_cmp_val -#define PMIX_VAL_CMP_float PMIX_VAL_cmp_float -#define PMIX_VAL_CMP_string PMIX_VAL_cmp_ptr -#define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val -#define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val - -#define PMIX_VAL_ASSIGN(_v, _field, _val) \ - PMIX_VAL_set_assign(_v, _field, _val) - -#define PMIX_VAL_CMP(_field, _val1, _val2) \ - PMIX_VAL_CMP_ ## _field(_val1, _val2) - -#define PMIX_VAL_FREE(_v) \ - PMIx_free_value_data(_v) - -static inline void pmix_value_destruct(pmix_value_t * m) { - size_t _n; +static inline void pmix_value_destruct(pmix_value_t * m) +{ if (PMIX_STRING == (m)->type) { if (NULL != (m)->data.string) { free((m)->data.string); @@ -2422,66 +2511,178 @@ static inline void pmix_value_destruct(pmix_value_t * m) { (m)->data.bo.size = 0; } } else if (PMIX_DATA_ARRAY == (m)->type) { - if (NULL != (m)->data.darray && NULL != (m)->data.darray->array) { - if (PMIX_STRING == (m)->data.darray->type) { - char **_str = (char**)(m)->data.darray->array; - for (_n=0; _n < (m)->data.darray->size; _n++) { - if (NULL != _str[_n]) { - free(_str[_n]); - } - } - } else if (PMIX_PROC_INFO == (m)->data.darray->type) { - pmix_proc_info_t *_info = - (pmix_proc_info_t*)(m)->data.darray->array; - for (_n=0; _n < (m)->data.darray->size; _n++) { - PMIX_PROC_INFO_DESTRUCT(&_info[_n]); - } - } else if (PMIX_INFO == (m)->data.darray->type) { - pmix_info_t *_info = - (pmix_info_t*)(m)->data.darray->array; - for (_n=0; _n < (m)->data.darray->size; _n++) { - pmix_value_destruct(&_info[_n].value); - } - } else if (PMIX_BYTE_OBJECT == (m)->data.darray->type) { - pmix_byte_object_t *_obj = - (pmix_byte_object_t*)(m)->data.darray->array; - for (_n=0; _n < (m)->data.darray->size; _n++) { - if (NULL != _obj[_n].bytes) { - free(_obj[_n].bytes); - } - } - } - free((m)->data.darray->array); - (m)->data.darray->array = NULL; - (m)->data.darray->size = 0; - } if (NULL != (m)->data.darray) { + pmix_darray_destruct((m)->data.darray); free((m)->data.darray); (m)->data.darray = NULL; } - /**** DEPRECATED ****/ - } else if (PMIX_INFO_ARRAY == (m)->type) { - pmix_info_t *_p = (pmix_info_t*)((m)->data.array->array); - for (_n=0; _n < (m)->data.array->size; _n++) { - if (PMIX_STRING == _p[_n].value.type) { - if (NULL != _p[_n].value.data.string) { - free(_p[_n].value.data.string); - } - } else if (PMIX_BYTE_OBJECT == _p[_n].value.type) { - if (NULL != _p[_n].value.data.bo.bytes) { - free(_p[_n].value.data.bo.bytes); - } - } else if (PMIX_PROC_INFO == _p[_n].value.type) { - PMIX_PROC_INFO_DESTRUCT(_p[_n].value.data.pinfo); - } - } - free(_p); - /********************/ } else if (PMIX_ENVAR == (m)->type) { PMIX_ENVAR_DESTRUCT(&(m)->data.envar); + } else if (PMIX_PROC == (m)->type) { + PMIX_PROC_RELEASE((m)->data.proc); } } +static inline void pmix_darray_destruct(pmix_data_array_t *m) +{ + if (NULL != m) { + if (PMIX_INFO == m->type) { + pmix_info_t *_info = (pmix_info_t*)m->array; + PMIX_INFO_FREE(_info, m->size); + } else if (PMIX_PROC == m->type) { + pmix_proc_t *_p = (pmix_proc_t*)m->array; + PMIX_PROC_FREE(_p, m->size); + } else if (PMIX_PROC_INFO == m->type) { + pmix_proc_info_t *_pi = (pmix_proc_info_t*)m->array; + PMIX_PROC_INFO_FREE(_pi, m->size); + } else if (PMIX_ENVAR == m->type) { + pmix_envar_t *_e = (pmix_envar_t*)m->array; + PMIX_ENVAR_FREE(_e, m->size); + } else if (PMIX_VALUE == m->type) { + pmix_value_t *_v = (pmix_value_t*)m->array; + PMIX_VALUE_FREE(_v, m->size); + } else if (PMIX_PDATA == m->type) { + pmix_pdata_t *_pd = (pmix_pdata_t*)m->array; + PMIX_PDATA_FREE(_pd, m->size); + } else if (PMIX_QUERY == m->type) { + pmix_query_t *_q = (pmix_query_t*)m->array; + PMIX_QUERY_FREE(_q, m->size); + } else if (PMIX_APP == m->type) { + pmix_app_t *_a = (pmix_app_t*)m->array; + PMIX_APP_FREE(_a, m->size); + } else if (PMIX_BYTE_OBJECT == m->type) { + pmix_byte_object_t *_b = (pmix_byte_object_t*)m->array; + PMIX_BYTE_OBJECT_FREE(_b, m->size); + } else if (PMIX_STRING == m->type) { + char **_s = (char**)m->array; + size_t _si; + for (_si=0; _si < m->size; _si++) { + free(_s[_si]); + } + free(m->array); + m->array = NULL; + } else { + free(m->array); + } + } +} + +#define PMIX_DATA_ARRAY_CONSTRUCT(m, n, t) \ + do { \ + (m)->type = (t); \ + (m)->size = (n); \ + if (0 < (n)) { \ + if (PMIX_INFO == (t)) { \ + PMIX_INFO_CREATE((m)->array, (n)); \ + } else if (PMIX_PROC == (t)) { \ + PMIX_PROC_CREATE((m)->array, (n)); \ + } else if (PMIX_PROC_INFO == (t)) { \ + PMIX_PROC_INFO_CREATE((m)->array, (n)); \ + } else if (PMIX_ENVAR == (t)) { \ + PMIX_ENVAR_CREATE((m)->array, (n)); \ + } else if (PMIX_VALUE == (t)) { \ + PMIX_VALUE_CREATE((m)->array, (n)); \ + } else if (PMIX_PDATA == (t)) { \ + PMIX_PDATA_CREATE((m)->array, (n)); \ + } else if (PMIX_QUERY == (t)) { \ + PMIX_QUERY_CREATE((m)->array, (n)); \ + } else if (PMIX_APP == (t)) { \ + PMIX_APP_CREATE((m)->array, (n)); \ + } else if (PMIX_BYTE_OBJECT == (t)) { \ + PMIX_BYTE_OBJECT_CREATE((m)->array, (n)); \ + } else if (PMIX_ALLOC_DIRECTIVE == (t) || \ + PMIX_PROC_STATE == (t) || \ + PMIX_PERSIST == (t) || \ + PMIX_SCOPE == (t) || \ + PMIX_DATA_RANGE == (t) || \ + PMIX_BYTE == (t) || \ + PMIX_INT8 == (t) || \ + PMIX_UINT8 == (t)) { \ + (m)->array = calloc((n), sizeof(int8_t)); \ + } else if (PMIX_STRING == (t)) { \ + (m)->array = calloc((n), sizeof(char*)); \ + } else if (PMIX_SIZE == (t)) { \ + (m)->array = calloc((n), sizeof(size_t)); \ + } else if (PMIX_PID == (t)) { \ + (m)->array = calloc((n), sizeof(pid_t)); \ + } else if (PMIX_INT == (t) || \ + PMIX_UINT == (t) || \ + PMIX_STATUS == (t)) { \ + (m)->array = calloc((n), sizeof(int)); \ + } else if (PMIX_IOF_CHANNEL == (t) || \ + PMIX_DATA_TYPE == (t) || \ + PMIX_INT16 == (t) || \ + PMIX_UINT16 == (t)) { \ + (m)->array = calloc((n), sizeof(int16_t)); \ + } else if (PMIX_PROC_RANK == (t) || \ + PMIX_INFO_DIRECTIVES == (t) || \ + PMIX_INT32 == (t) || \ + PMIX_UINT32 == (t)) { \ + (m)->array = calloc((n), sizeof(int32_t)); \ + } else if (PMIX_INT64 == (t) || \ + PMIX_UINT64 == (t)) { \ + (m)->array = calloc((n), sizeof(int64_t)); \ + } else if (PMIX_FLOAT == (t)) { \ + (m)->array = calloc((n), sizeof(float)); \ + } else if (PMIX_DOUBLE == (t)) { \ + (m)->array = calloc((n), sizeof(double)); \ + } else if (PMIX_TIMEVAL == (t)) { \ + (m)->array = calloc((n), sizeof(struct timeval)); \ + } else if (PMIX_TIME == (t)) { \ + (m)->array = calloc((n), sizeof(time_t)); \ + } \ + } else { \ + (m)->array = NULL; \ + } \ + } while(0) +#define PMIX_DATA_ARRAY_CREATE(m, n, t) \ + do { \ + (m) = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); \ + PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ + } while(0) + +#define PMIX_DATA_ARRAY_DESTRUCT(m) pmix_darray_destruct(m) + +#define PMIX_DATA_ARRAY_FREE(m) \ + do { \ + if (NULL != (m)) { \ + PMIX_DATA_ARRAY_DESTRUCT(m); \ + free((m)); \ + (m) = NULL; \ + } \ + } while(0) + + +/** + * Provide a safe version of strncpy that doesn't generate + * a ton of spurious warnings. Note that not every environment + * provides nice string functions, and we aren't concerned about + * max performance here + * + * @param dest Destination string. + * @param src Source string. + * @param len Size of the dest array - 1 + * + */ +static inline void pmix_strncpy(char *dest, const char *src, size_t len) +{ + size_t i, k; + char *new_dest = dest; + + /* use an algorithm that also protects against + * non-NULL-terminated src strings */ + for (i=0, k=0; i <= len; ++i, ++src, ++new_dest) { + ++k; + *new_dest = *src; + if ('\0' == *src) { + break; + } + } + dest[k-1] = '\0'; +} + +#include + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h new file mode 100644 index 00000000000..f6f320abab5 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_extend.h @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015 Artem Y. Polyakov . + * All rights reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer listed + * in this license in the documentation and/or other materials + * provided with the distribution. + * + * - Neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * The copyright holders provide no reassurances that the source code + * provided does not infringe any patent, copyright, or any other + * intellectual property rights of third parties. The copyright holders + * disclaim any liability to any recipient for claims brought against + * recipient by any third party for infringement of that parties + * intellectual property rights. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $HEADER$ + */ + +#ifndef PMIx_EXTEND_H +#define PMIx_EXTEND_H + +#if defined(c_plusplus) || defined(__cplusplus) +extern "C" { +#endif + +/* expose some functions that are resolved in the + * PMIx library, but part of a header that + * includes internal functions - we don't + * want to expose the entire header here. These + * back the associated macros included in the + * PMIx Standard + */ +void pmix_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type); + +pmix_status_t pmix_value_unload(pmix_value_t *kv, void **data, size_t *sz); + +pmix_status_t pmix_value_xfer(pmix_value_t *kv, const pmix_value_t *src); + +pmix_status_t pmix_argv_append_nosize(char ***argv, const char *arg); + +pmix_status_t pmix_argv_prepend_nosize(char ***argv, const char *arg); + +pmix_status_t pmix_argv_append_unique_nosize(char ***argv, const char *arg, bool overwrite); + +void pmix_argv_free(char **argv); + +char **pmix_argv_split(const char *src_string, int delimiter); + +int pmix_argv_count(char **argv); + +char *pmix_argv_join(char **argv, int delimiter); + +char **pmix_argv_copy(char **argv); + +pmix_status_t pmix_setenv(const char *name, const char *value, + bool overwrite, char ***env); + + +/* the following are a set of legacy macros not included in the + * PMIx Standard, but used in some codes (e.g., the Slurm plugin). + * These should be considered "deprecated" and will be removed + * in the next major release of the PRI */ +#define PMIX_VAL_FIELD_int(x) ((x)->data.integer) +#define PMIX_VAL_FIELD_uint32_t(x) ((x)->data.uint32) +#define PMIX_VAL_FIELD_uint16_t(x) ((x)->data.uint16) +#define PMIX_VAL_FIELD_string(x) ((x)->data.string) +#define PMIX_VAL_FIELD_float(x) ((x)->data.fval) +#define PMIX_VAL_FIELD_byte(x) ((x)->data.byte) +#define PMIX_VAL_FIELD_flag(x) ((x)->data.flag) + +#define PMIX_VAL_TYPE_int PMIX_INT +#define PMIX_VAL_TYPE_uint32_t PMIX_UINT32 +#define PMIX_VAL_TYPE_uint16_t PMIX_UINT16 +#define PMIX_VAL_TYPE_string PMIX_STRING +#define PMIX_VAL_TYPE_float PMIX_FLOAT +#define PMIX_VAL_TYPE_byte PMIX_BYTE +#define PMIX_VAL_TYPE_flag PMIX_BOOL + +#define PMIX_VAL_set_assign(_v, _field, _val ) \ + do { \ + (_v)->type = PMIX_VAL_TYPE_ ## _field; \ + PMIX_VAL_FIELD_ ## _field((_v)) = _val; \ + } while (0) + +#define PMIX_VAL_set_strdup(_v, _field, _val ) \ + do { \ + (_v)->type = PMIX_VAL_TYPE_ ## _field; \ + PMIX_VAL_FIELD_ ## _field((_v)) = strdup(_val); \ + } while (0) + +#define PMIX_VAL_SET_int PMIX_VAL_set_assign +#define PMIX_VAL_SET_uint32_t PMIX_VAL_set_assign +#define PMIX_VAL_SET_uint16_t PMIX_VAL_set_assign +#define PMIX_VAL_SET_string PMIX_VAL_set_strdup +#define PMIX_VAL_SET_float PMIX_VAL_set_assign +#define PMIX_VAL_SET_byte PMIX_VAL_set_assign +#define PMIX_VAL_SET_flag PMIX_VAL_set_assign + +#define PMIX_VAL_SET(_v, _field, _val ) \ + PMIX_VAL_SET_ ## _field(_v, _field, _val) + +#define PMIX_VAL_cmp_val(_val1, _val2) ((_val1) != (_val2)) +#define PMIX_VAL_cmp_float(_val1, _val2) (((_val1)>(_val2))?(((_val1)-(_val2))>0.000001):(((_val2)-(_val1))>0.000001)) +#define PMIX_VAL_cmp_ptr(_val1, _val2) strncmp(_val1, _val2, strlen(_val1)+1) + +#define PMIX_VAL_CMP_int PMIX_VAL_cmp_val +#define PMIX_VAL_CMP_uint32_t PMIX_VAL_cmp_val +#define PMIX_VAL_CMP_uint16_t PMIX_VAL_cmp_val +#define PMIX_VAL_CMP_float PMIX_VAL_cmp_float +#define PMIX_VAL_CMP_string PMIX_VAL_cmp_ptr +#define PMIX_VAL_CMP_byte PMIX_VAL_cmp_val +#define PMIX_VAL_CMP_flag PMIX_VAL_cmp_val + +#define PMIX_VAL_ASSIGN(_v, _field, _val) \ + PMIX_VAL_set_assign(_v, _field, _val) + +#define PMIX_VAL_CMP(_field, _val1, _val2) \ + PMIX_VAL_CMP_ ## _field(_val1, _val2) + +#define PMIX_VAL_FREE(_v) \ + PMIx_free_value_data(_v) + +#if defined(c_plusplus) || defined(__cplusplus) +} +#endif + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h index ecc08307fec..4d3f36bbd43 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h @@ -596,7 +596,7 @@ PMIX_EXPORT pmix_status_t PMIx_generate_ppn(const char *input, char **ppn); * for the PMIx server library to correctly handle collectives * as a collective operation call can occur before all the * procs have been started */ -PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int nlocalprocs, +PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace, int nlocalprocs, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); @@ -605,7 +605,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int n * intended to support persistent PMIx servers by providing * an opportunity for the host RM to tell the PMIx server * library to release all memory for a completed job */ -PMIX_EXPORT void PMIx_server_deregister_nspace(const char nspace[], +PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, pmix_op_cbfunc_t cbfunc, void *cbdata); /* Register a client process with the PMIx server library. The @@ -676,7 +676,7 @@ typedef void (*pmix_setup_application_cbfunc_t)(pmix_status_t status, * operation in case network libraries need to perform some action * before responding. Any returned env will be distributed along * with the application */ -PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const char nspace[], +PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const pmix_nspace_t nspace, pmix_info_t info[], size_t ninfo, pmix_setup_application_cbfunc_t cbfunc, void *cbdata); @@ -692,7 +692,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_application(const char nspace[], * for the first local client - i.e., they will only be executed * once for a given nspace */ -PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const char nspace[], +PMIX_EXPORT pmix_status_t PMIx_server_setup_local_support(const pmix_nspace_t nspace, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata); diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in index dc8570f38fe..44987a65929 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in @@ -2,7 +2,7 @@ * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,5 +19,5 @@ #define PMIX_VERSION_MINOR @pmixminor@ #define PMIX_VERSION_RELEASE @pmixrelease@ -#define PMIX_NUMERIC_VERSION 0x00030001 +#define PMIX_NUMERIC_VERSION 0x00030100 #endif diff --git a/opal/mca/pmix/pmix3x/pmix/man/Makefile.am b/opal/mca/pmix/pmix3x/pmix/man/Makefile.am deleted file mode 100644 index 7c0f8bffe46..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/Makefile.am +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2004-2005 The Regents of the University of California. -# All rights reserved. -# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -if !PMIX_EMBEDDED_MODE - -man_MANS = \ - man3/pmix_init.3 \ - man3/pmix_finalize.3 \ - man3/pmix_initialized.3 \ - man3/pmix_abort.3 \ - man3/pmix_put.3 \ - man3/pmix_commit.3 \ - man7/pmix.7 \ - man7/pmix_constants.7 - -EXTRA_DIST = $(man_MANS) - -man3/pmix_init.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_init.3.md; - -man3/pmix_finalize.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_finalize.3.md; - -man3/pmix_initialized.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_initialized.3.md; - -man3/pmix_abort.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_abort.3.md; - -man3/pmix_put.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_put.3.md; - -man3/pmix_commit.3: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_commit.3.md; - -man7/pmix.7: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix.7.md; - -man7/pmix_constants.7: - $(top_srcdir)/contrib/md2nroff.pl --source=pmix_constants.7.md; - -endif # !PMIX_EMBEDDED_MODE diff --git a/opal/mca/pmix/pmix3x/pmix/man/README b/opal/mca/pmix/pmix3x/pmix/man/README deleted file mode 100644 index 73c605cb7f0..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/README +++ /dev/null @@ -1,186 +0,0 @@ -This file describes how the developer side of man pages work in PMIx. - -The Definitive Source Of Truth man pages are the Markdown man pages in -this directory (i.e., the files ending in ..md. If you want to -edit man pages, you need to edit the ..md pages. Do NOT edit -the . nroff man pages directly; these files are automatically -generated -- you will lose any manual edits the next time those files -are generated. - -The Markdown web pages are rendered in two different ways: - -1. Nroff man pages. These man pages are put into the `master` branch - and later included in PMIx distribution tarballs. - -2. HTML. The http://open-mpi.github.io/pmix/ web site (which is - served by the Github web servers) automatically renders the content - of the `gh-pages` branch of the PMIx repo. - -Markdown syntax -=============== - -The definitive man pages are the Markdown man pages. To edit them, -you need to understand the syntax used in these files. - -The canonical reference for Markdown is here: - - http://daringfireball.net/projects/markdown/syntax - -Note, however, that the PMIx Markdown man pages are served via -the Github Pages web servers, which use a system called Jekyll to -render the Markdown into HTML (https://github.com/jekyll/jekyll). -As such, there are a few Jekyll annotations in the PMIx Markdown -pages (so that they can be served up properly from Github's web -servers). - -If you're familiar with Markdown, you should be ok. But there are a -small number differences and quirks with which you should be familiar: - -1. The first few lines of each file are a YAML header and include - directive for Jekyll. DO NOT REMOVE THIS HEADER (or the file will - not render to HTML properly when served up from Github's web - servers). Here's a sample YAML header from pmix.7.md: - ---- -layout: page -title: PMIx(7) -tagline: PMIx Programmer's Manual ---- -{% include JB/setup %} - - The whole block is needed, and it must be the first input in the - file. - -2. In Github-flavored Markdown, you may be used to using "fenced - blocks" for multi-line code blocks, like this: - -```c -void my_c_code(void) { - int i; - /* Hello, world */ -} -``` - - Such fenced blocks will not work in Jekyll. Instead, you must - delineate your code blocks with Jekyll delimiters: - -{% highlight c %} -void my_c_code(void) { - int i; - /* Hello, world */ -} -{% endhighlight %} - - This will result in a pretty code box in the rendered HTML output, - and it will be syntax highlighted for the C language. Leave the - "c" out of the first directive if your multi-line block is not C - code, and then it won't do C syntax highlighting. - -3. The PMIx man pages are full of 2-level lists of things. E.g., - lists of functions, and then in some of the functions, there is a - sub-list of flags that can be used with that function. - - The convention used in the PMIx man pages is to highlight a - word/phrase representing each list item. Then use a ":" to start - the next line that describes that item. For example: - -*PMIX_FLOAT* -: A single-precision floating point value (IEEE 754). - - This will make the token "PMIX_FLOAT" be highlighted in both - HTML and nroff output, and then the paragraph that comes after it - will be properly delimited and indented. - - To make a sub-list inside an item, use the same format, but prefix - the sub-list items with "-", like this: - -*scope* -: Flag that controls the visible scope of the data. - -- *PMIX_GLOBAL* -: Indicates that the data is to be visible to all applications executed - by this user. - -4. There may be a small number of places in the PMIx man pages where - there are unnumbered lists with deliberate line breaks. For - example: - -foo / bar -baz / goo -: Something really intelligent - - Note the first line is "foo / bar", and then there is - a deliberate line break, and then the second line is "baz / goo". - - To effect the deliberate line break, you have to put two blank - spaces after "bar". To show that graphically (showing "_" - for " "): - -foo / bar__ -baz / goo -: Something really intelligent - -5. The "SEE ALSO" items at the end of each man page are linked to - their corresponding man pages. Note that the links are made to - ".html" files -- *not* ".md" files. If you care, the reason is - because the Github web servers statically generate .html files from - the .md files when you git push to the gh-pages branch. Hence, the - man pages are actually served from static .html files on the Github - web servers. - - Also, since links are meaningless in nroff, they are effectively - ignored in the resulting nroff output. - -Workflow -======== - -The workflow is like this: - -1. Developer edits ..md files for new changes. - -2. In a perfect world, the developer makes perfect edits and pushes - the changes up to `master`. An automated cron job will eventually - notice the new pages, and do two things: - - 2a. Copy the modified Markdown pages to the `gh-master` branch (so - that they go live on the web site). - - 2b. Re-generate any relevant nroff man pages in `master`. - - The automated cron job actually does exist and does these things, - but it should only be relied upon once a developer is sure that - their changes to the Markdown man pages are correct. - -3. To check that the changes will render properly, developers should - do two things: - - 3a. Run "make nroff". This will convert all the Markdown man pages - into nroff man pages (in the man/ directory). Check to ensure - that your changes look appropriate in the rendered nroff - output. - - *CAUTION* The "pandoc" utility is used to generate the nroff - files from the Markdown source. Different versions of pandoc - will generate slightly different nroff output. Meaning: when - you run "make nroff", you might end up changing every nroff man - page, simply because your version of pandoc is different than - the last person who ran it. Please only check in your changes, - if possible. - - 3b. Check out the `gh-pages` branch from PMIx and copy any - modified Markdown pages into the "master/man" directory (i.e., - the directory for man pages from the master development - branch). - - Then run the "jekyll serve" command from the top-level - directory in `gh-pages`. This runs a local web server on your - computer and renders the Markdown files into HTML such that you - can point a browser to http://127.0.0.1:4000 and see the web - site. - - If you make any changes to files in the tree where "jekyll" is - running, Jekyll will notice the changes and automatically - re-generate the relevant HTML. Meaning: you can just refresh - the page from http://127.0.0.1:4000 in your browser and you'll - see your changes -- there's no need to restart Jekyll to force - it to notice new changes. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_abort.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_abort.3 deleted file mode 100644 index ea0690ae943..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_abort.3 +++ /dev/null @@ -1,62 +0,0 @@ -.TH "pmix_abort" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Abort \- Abort the specified processes -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -pmix\\_status\\_t\ PMIx\\_Abort(int\ status,\ const\ char\ msg[], -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ pmix\\_proc\\_t\ procs[],\ size_t\ nprocs); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]status\f[] : Status value to be returned. -A value of zero is permitted by PMIx, but may not be returned by some -resource managers. -.PP -\f[I]msg\f[] : A string message to be displayed -.PP -\f[I]procs\f[] : An array of pmix_proc_t structures defining the -processes to be aborted. -A \f[I]NULL\f[] for the proc array indicates that all processes in the -caller\[aq]s nspace are to be aborted. -A wildcard value for the rank in any structure indicates that all -processes in that nspace are to be aborted. -.PP -\f[I]nprocs\f[] : Number of pmix_proc_t structures in the \f[I]procs\f[] -array -.SH DESCRIPTION -.PP -Request that the provided array of procs be aborted, returning the -provided \f[I]status\f[] and printing the provided message. -A \f[I]NULL\f[] for the proc array indicates that all processes in the -caller\[aq]s nspace are to be aborted. -.PP -The response to this request is somewhat dependent on the specific -resource manager and its configuration (e.g., some resource managers -will not abort the application if the provided \f[I]status\f[] is zero -unless specifically configured to do so), and thus lies outside the -control of PMIx itself. -However, the client will inform the RM of the request that the -application be aborted, regardless of the value of the provided -\f[I]status\f[]. -.PP -Passing a \f[I]NULL\f[] msg parameter is allowed. -Note that race conditions caused by multiple processes calling -PMIx_Abort are left to the server implementation to resolve with regard -to which status is returned and what messages (if any) are printed. -.SH RETURN VALUE -.PP -Returns PMIX_SUCCESS on success. -On error, a negative value corresponding to a PMIx errno is returned. -.SH ERRORS -.PP -PMIx errno values are defined in \f[C]pmix_common.h\f[]. -.SH NOTES -.SH SEE ALSO -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_commit.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_commit.3 deleted file mode 100644 index 31dd4fc2f76..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_commit.3 +++ /dev/null @@ -1,35 +0,0 @@ -.TH "pmix_commit" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Commit \- Push all previously \f[I]PMIx_Put\f[] values to the local -PMIx server. -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -pmix\\_status\\_t\ PMIx_Commit(void); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]none\f[] -.SH DESCRIPTION -.PP -This is an asynchronous operation \- the library will immediately return -to the caller while the data is transmitted to the local server in the -background -.SH RETURN VALUE -.PP -Returns PMIX_SUCCESS on success. -On error, a negative value corresponding to a PMIx errno is returned. -.SH ERRORS -.PP -PMIx errno values are defined in \f[C]pmix_common.h\f[]. -.SH NOTES -.SH SEE ALSO -.PP -\f[C]PMIx_Put\f[](3) -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_finalize.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_finalize.3 deleted file mode 100644 index 6b15282945b..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_finalize.3 +++ /dev/null @@ -1,45 +0,0 @@ -.TH "pmix_finalize" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Finalize \- Finalize the PMIx Client -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -pmix\\_status\\_t\ PMIx\\_Finalize(const\ pmix\\_info\\_t\ info[],\ size_t\ ninfo); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]info\f[] : An optional array of pmix_info_t structures -.PP -\f[I]ninfo\f[] : Number of pmix_info_t structures in the pmix_info_t -array -.SH DESCRIPTION -.PP -Finalize the PMIx client, closing the connection with the local PMIx -server and releasing all malloc\[aq]d memory. -.PP -The info array is used to pass user requests regarding the fence -operation. -This can include: -.IP "(a)" 4 -PMIX_EMBED_BARRIER \- By default, \f[I]PMIx_Finalize\f[] does not -include an internal barrier operation. -This attribute directs \f[I]PMIx_Finalize\f[] to execute a barrier as -part of the finalize operation. -.SH RETURN VALUE -.PP -Returns PMIX_SUCCESS on success. -On error, a negative value corresponding to a PMIx errno is returned. -.SH ERRORS -.PP -PMIx errno values are defined in \f[C]pmix_common.h\f[]. -.SH NOTES -.SH SEE ALSO -.PP -\f[C]PMIx_Init\f[](3) -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_init.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_init.3 deleted file mode 100644 index b988200b33b..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_init.3 +++ /dev/null @@ -1,52 +0,0 @@ -.TH "pmix_init" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Init \- Initialize the PMIx Client -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -pmix\\_status\\_t\ PMIx_Init(pmix\\_proc\\_t\ *proc); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]proc\f[] : Pointer to a pmix_proc_t object in which the -client\[aq]s namespace and rank are to be returned. -.SH DESCRIPTION -.PP -Initialize the PMIx client, returning the process identifier assigned to -this client\[aq]s application in the provided pmix_proc_t struct. -Passing a value of \f[I]NULL\f[] for this parameter is allowed if the -user wishes solely to initialize the PMIx system and does not require -return of the identifier at that time. -.PP -When called, the PMIx client will check for the required connection -information of the local PMIx server and will establish the connection. -If the information is not found, or the server connection fails, then an -appropriate error constant will be returned. -.PP -If successful, the function will return PMIX_SUCCESS and will fill the -provided structure with the server\-assigned namespace and rank of the -process within the application. -In addition, all startup information provided by the resource manager -will be made available to the client process via subsequent calls to -\f[I]PMIx_Get\f[]. -.PP -Note that the PMIx client library is referenced counted, and so multiple -calls to PMIx_Init are allowed. -Thus, one way to obtain the namespace and rank of the process is to -simply call PMIx_Init with a non\-NULL parameter. -.SH RETURN VALUE -.PP -Returns PMIX_SUCCESS on success. -On error, a negative value corresponding to a PMIx errno is returned. -.SH ERRORS -.PP -PMIx errno values are defined in \f[C]pmix_common.h\f[]. -.SH NOTES -.SH SEE ALSO -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_initialized.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_initialized.3 deleted file mode 100644 index 6e2170f35c4..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_initialized.3 +++ /dev/null @@ -1,30 +0,0 @@ -.TH "pmix_initialized" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Initialized \- Check if \f[I]PMIx_Init\f[] has been called -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -int\ PMIx_Initialized(void); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]none\f[] -.SH DESCRIPTION -.PP -Check to see if the PMIx Client library has been intialized -.SH RETURN VALUE -.PP -Returns \f[I]true\f[] if the PMIx Client has been initialized, and -\f[I]false\f[] if not. -.SH ERRORS -.SH NOTES -.SH SEE ALSO -.PP -\f[C]PMIx_Init\f[](3) -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_put.3 b/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_put.3 deleted file mode 100644 index e960583e404..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man3/pmix_put.3 +++ /dev/null @@ -1,60 +0,0 @@ -.TH "pmix_put" "3" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx_Put \- Push a value into the client\[aq]s namespace -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ - -pmix\\_status\\_t\ PMIx\\_Init(pmix\\_scope\\_t\ scope,\ const\ char\ key[],\ pmix\\_value\\_t\ *val); -\f[] -.fi -.SH ARGUMENTS -.PP -\f[I]scope\f[] : Defines a scope for data "put" by PMI per the -following: -.IP "(a)" 4 -PMI_LOCAL \- the data is intended only for other application processes -on the same node. -Data marked in this way will not be included in data packages sent to -remote requestors -.IP "(b)" 4 -PMI_REMOTE \- the data is intended solely for application processes on -remote nodes. -Data marked in this way will not be shared with other processes on the -same node -.IP "(c)" 4 -PMI_GLOBAL \- the data is to be shared with all other requesting -processes, regardless of location -.PP -\f[I]key\f[] : String key identifying the information. -This can be either one of the PMIx defined attributes, or a -user\-defined value -.PP -\f[I]val\f[] : Pointer to a pmix_value_t structure containing the data -to be pushed along with the type of the provided data. -.SH DESCRIPTION -.PP -Push a value into the client\[aq]s namespace. -The client library will cache the information locally until -\f[I]PMIx_Commit\f[] is called. -The provided scope value is passed to the local PMIx server, which will -distribute the data as directed. -.SH RETURN VALUE -.PP -Returns PMIX_SUCCESS on success. -On error, a negative value corresponding to a PMIx errno is returned. -.SH ERRORS -.PP -PMIx errno values are defined in \f[C]pmix_common.h\f[]. -.SH NOTES -.PP -See \[aq]pmix_common.h\[aq] for definition of the pmix_value_t -structure. -.SH SEE ALSO -.PP -\f[C]PMIx_Constants\f[](7), \f[C]PMIx_Structures\f[](7) -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man7/pmix.7 b/opal/mca/pmix/pmix3x/pmix/man/man7/pmix.7 deleted file mode 100644 index d2e545af94f..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man7/pmix.7 +++ /dev/null @@ -1,35 +0,0 @@ -.TH "pmix" "7" "2015\-10\-29" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -Process Management Interface \- Exascale -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ -\f[] -.fi -.SH OVERVIEW -.PP -The Process Management Interface (PMI) has been used for quite some time -as a means of exchanging wireup information needed for interprocess -communication. -Two versions (PMI\-1 and PMI\-2) have been released as part of the MPICH -effort. -While PMI\-2 demonstrates better scaling properties than its PMI\-1 -predecessor, attaining rapid launch and wireup of the roughly 1M -processes executing across 100k nodes expected for exascale operations -remains challenging. -.PP -PMI Exascale (PMIx) represents an attempt to resolve these questions by -providing an extended version of the PMI standard specifically designed -to support clusters up to and including exascale sizes. -The overall objective of the project is not to branch the existing -pseudo\-standard definitions \- in fact, PMIx fully supports both of the -existing PMI\-1 and PMI\-2 APIs \- but rather to (a) augment and extend -those APIs to eliminate some current restrictions that impact -scalability, and (b) provide a reference implementation of the -PMI\-server that demonstrates the desired level of scalability. -.SH SEE ALSO -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/man/man7/pmix_constants.7 b/opal/mca/pmix/pmix3x/pmix/man/man7/pmix_constants.7 deleted file mode 100644 index bd6414cb7a2..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/man/man7/pmix_constants.7 +++ /dev/null @@ -1,79 +0,0 @@ -.TH "pmix_constants" "7" "2016\-03\-01" "PMIx Programmer\[aq]s Manual" "\@VERSION\@" -.SH NAME -.PP -PMIx Constants -.SH SYNOPSIS -.IP -.nf -\f[C] -#include\ -\f[] -.fi -.SH OVERVIEW -.PP -PMIx relies on the following types of constants: -.PP -\f[I]Maximum Sizes\f[] : In order to minimize malloc performance -penalties, PMIx utilizes constant\-sized arrays wherever possible. -These constants provide the user with the maximum size of the various -array types. -.PP -\f[I]Attributes\f[] : . -.PP -\f[I]Errors\f[] : PMIx uses negative error constants, with 0 indicating -"success". -.SH MAXIMUM SIZES -.PP -The . -.PP -\f[I]PMIX_MAX_NSLEN\f[] : The maximum length of a namespace. -Note that any declaration of an array to hold a key string must include -one extra space for the terminating \f[I]NULL\f[]. -.PP -\f[I]PMIX_MAX_KEYLEN\f[] : Maximum length of the key string used in -structures such as the \f[I]pmix\f[]info_t_. -Note that any declaration of an array to hold a key string must include -one extra space for the terminating \f[I]NULL\f[]. -.SH ATTRIBUTES -.PP -Define a set of "standard" PMIx attributes that can be queried using the -PMIx_Get function. -Implementations (and users) are free to extend as desired \- thus, -functions calling PMIx_Get must be capable of handling the "not found" -condition. -Note that these are attributes of the system and the job as opposed to -values the application (or underlying programming library) might choose -to expose \- i.e., they are values provided by the resource manager as -opposed to the application. -Thus, these keys are RESERVED for use by PMIx, and users should avoid -defining any attribute starting with the keyword \f[I]PMIX\f[]. -.PP -A list of the current PMIx attributes, and the type of their associated -data value, is provided here. -.PP -\f[I]PMIX_ATTR_UNDEF (NULL)\f[] : Used to initialize an attribute field, -indicating that the attribute has not yet been assigned. -.PP -\f[I]PMIX_USERID (uint32_t)\f[] : . -.PP -\f[I]PMIX_GRPID (uint32_t)\f[] : An access domain represents a single -logical connection into a fabric. -It may map to a single physical or virtual NIC or a port. -An access domain defines the boundary across which fabric resources may -be associated. -Each access domain belongs to a single fabric domain. -.PP -\f[I]PMIX_CPUSET (char*)\f[] : . -.SH ERROR CONSTANTS -.PP -\&. -.PP -\f[I]PMIX_SUCCESS\f[] : Indicates that the operation was successful. -.PP -\f[I]PMIX_ERROR\f[] : A general error code \- an error occurred, but no -specific reason can be provided. -.SH SEE ALSO -.PP -\f[C]pmix\f[](7) -.SH AUTHORS -PMIx. diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include index dbd384e3e5a..20b9a3c8f84 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/Makefile.include @@ -15,7 +15,7 @@ # reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -30,7 +30,8 @@ headers += \ atomics/sys/atomic.h \ atomics/sys/atomic_impl.h \ atomics/sys/timer.h \ - atomics/sys/cma.h + atomics/sys/cma.h \ + atomics/sys/atomic_stdc.h include atomics/sys/x86_64/Makefile.include include atomics/sys/arm/Makefile.include diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h index cb386f67b3c..9fa0f4eefb3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/architecture.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Research Organization for Information Science @@ -47,6 +47,7 @@ #define PMIX_BUILTIN_SYNC 0200 #define PMIX_BUILTIN_GCC 0202 #define PMIX_BUILTIN_NO 0203 +#define PMIX_BUILTIN_C11 0204 /* Formats */ #define PMIX_DEFAULT 1000 /* standard for given architecture */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm/atomic.h index 1598547f34d..43a18b21511 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm/atomic.h @@ -12,9 +12,9 @@ * All rights reserved. * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2010 ARM ltd. All rights reserved. - * Copyright (c) 2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -110,7 +110,7 @@ void pmix_atomic_isync(void) #define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1 #define PMIX_HAVE_ATOMIC_MATH_32 1 -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev, tmp; bool ret; @@ -138,7 +138,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { bool rc; @@ -149,7 +149,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval); @@ -158,7 +158,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t #if (PMIX_ASM_SUPPORT_64BIT == 1) #define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1 -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; int tmp; @@ -189,7 +189,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { bool rc; @@ -200,7 +200,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval); @@ -210,7 +210,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t #define PMIX_HAVE_ATOMIC_ADD_32 1 -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int inc) +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int inc) { int32_t t, old; int tmp; @@ -231,7 +231,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int inc) } #define PMIX_HAVE_ATOMIC_SUB_32 1 -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int dec) +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int dec) { int32_t t, old; int tmp; diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm64/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm64/atomic.h index b3df2624313..1026fa5556f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm64/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/arm64/atomic.h @@ -12,9 +12,9 @@ * All rights reserved. * Copyright (c) 2010 IBM Corporation. All rights reserved. * Copyright (c) 2010 ARM ltd. All rights reserved. - * Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2016-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -83,7 +83,7 @@ static inline void pmix_atomic_isync (void) * *********************************************************************/ -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev, tmp; bool ret; @@ -103,7 +103,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add return ret; } -static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval) +static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr, int32_t newval) { int32_t ret, tmp; @@ -122,7 +122,7 @@ static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev, tmp; bool ret; @@ -143,7 +143,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev, tmp; bool ret; @@ -165,7 +165,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t #define pmix_atomic_ll_32(addr, ret) \ do { \ - volatile int32_t *_addr = (addr); \ + pmix_atomic_int32_t *_addr = (addr); \ int32_t _ret; \ \ __asm__ __volatile__ ("ldaxr %w0, [%1] \n" \ @@ -177,7 +177,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t #define pmix_atomic_sc_32(addr, newval, ret) \ do { \ - volatile int32_t *_addr = (addr); \ + pmix_atomic_int32_t *_addr = (addr); \ int32_t _newval = (int32_t) newval; \ int _ret; \ \ @@ -189,7 +189,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t ret = (_ret == 0); \ } while (0) -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; int tmp; @@ -210,7 +210,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add return ret; } -static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newval) +static inline int64_t pmix_atomic_swap_64 (pmix_atomic_int64_t *addr, int64_t newval) { int64_t ret; int tmp; @@ -230,7 +230,7 @@ static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newva atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; int tmp; @@ -252,7 +252,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; int tmp; @@ -275,7 +275,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t #define pmix_atomic_ll_64(addr, ret) \ do { \ - volatile int64_t *_addr = (addr); \ + pmix_atomic_int64_t *_addr = (addr); \ int64_t _ret; \ \ __asm__ __volatile__ ("ldaxr %0, [%1] \n" \ @@ -287,7 +287,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t #define pmix_atomic_sc_64(addr, newval, ret) \ do { \ - volatile int64_t *_addr = (addr); \ + pmix_atomic_int64_t *_addr = (addr); \ int64_t _newval = (int64_t) newval; \ int _ret; \ \ @@ -300,7 +300,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t } while (0) #define PMIX_ASM_MAKE_ATOMIC(type, bits, name, inst, reg) \ - static inline type pmix_atomic_fetch_ ## name ## _ ## bits (volatile type *addr, type value) \ + static inline type pmix_atomic_fetch_ ## name ## _ ## bits (pmix_atomic_ ## type *addr, type value) \ { \ type newval, old; \ int32_t tmp; \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h index f28ee1d35a2..5aca60ea366 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic.h @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -57,7 +57,13 @@ #include #include "src/atomics/sys/architecture.h" -#include "src/include/pmix_stdint.h" +#include "src/include/pmix_stdatomic.h" + +#if PMIX_ASSEMBLY_BUILTIN == PMIX_BUILTIN_C11 + +#include "atomic_stdc.h" + +#else /* !PMIX_C_HAVE__ATOMIC */ /* do some quick #define cleanup in cases where we are doing testing... */ @@ -93,7 +99,7 @@ BEGIN_C_DECLS */ struct pmix_atomic_lock_t { union { - volatile int32_t lock; /**< The lock address (an integer) */ + pmix_atomic_int32_t lock; /**< The lock address (an integer) */ volatile unsigned char sparc_lock; /**< The lock address on sparc */ char padding[sizeof(int)]; /**< Array for optional padding */ } u; @@ -148,6 +154,8 @@ enum { PMIX_ATOMIC_LOCK_LOCKED = 1 }; +#define PMIX_ATOMIC_LOCK_INIT {.u = {.lock = PMIX_ATOMIC_LOCK_UNLOCKED}} + /********************************************************************** * * Load the appropriate architecture files and set some reasonable @@ -351,19 +359,19 @@ void pmix_atomic_unlock(pmix_atomic_lock_t *lock); #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32 static inline #endif -bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, +bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval); #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32 static inline #endif -bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, +bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval); #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_32 static inline #endif -bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, +bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval); #endif @@ -376,19 +384,19 @@ bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64 static inline #endif -bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, +bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval); #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64 static inline #endif -bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, +bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval); #if PMIX_HAVE_INLINE_ATOMIC_COMPARE_EXCHANGE_64 static inline #endif -bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, +bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval); #endif @@ -400,20 +408,20 @@ bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t #if defined(DOXYGEN) || PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 -static inline int32_t pmix_atomic_add_fetch_32(volatile int32_t *addr, int delta); -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int delta); -static inline int32_t pmix_atomic_and_fetch_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_or_fetch_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_xor_fetch_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_sub_fetch_32(volatile int32_t *addr, int delta); -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int delta); -static inline int32_t pmix_atomic_min_fetch_32 (volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_max_fetch_32 (volatile int32_t *addr, int32_t value); -static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_add_fetch_32(pmix_atomic_int32_t *addr, int delta); +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int delta); +static inline int32_t pmix_atomic_and_fetch_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_or_fetch_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_xor_fetch_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_sub_fetch_32(pmix_atomic_int32_t *addr, int delta); +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int delta); +static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value); +static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value); #endif /* PMIX_HAVE_ATOMIC_MATH_32 */ @@ -430,19 +438,19 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t #if defined(DOXYGEN) || PMIX_HAVE_ATOMIC_MATH_64 || PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 -static inline int64_t pmix_atomic_add_fetch_64(volatile int64_t *addr, int64_t delta); -static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta); -static inline int64_t pmix_atomic_and_fetch_64(volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_or_fetch_64(volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_sub_fetch_64(volatile int64_t *addr, int64_t delta); -static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta); -static inline int64_t pmix_atomic_min_fetch_64 (volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t value); -static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_add_fetch_64(pmix_atomic_int64_t *addr, int64_t delta); +static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta); +static inline int64_t pmix_atomic_and_fetch_64(pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_or_fetch_64(pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_sub_fetch_64(pmix_atomic_int64_t *addr, int64_t delta); +static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta); +static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value); +static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value); #endif /* PMIX_HAVE_ATOMIC_MATH_64 */ @@ -459,7 +467,7 @@ static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t */ #if defined(DOXYGEN) || PMIX_ENABLE_DEBUG static inline size_t -pmix_atomic_add_fetch_size_t(volatile size_t *addr, size_t delta) +pmix_atomic_add_fetch_size_t(pmix_atomic_size_t *addr, size_t delta) { #if SIZEOF_SIZE_T == 4 return (size_t) pmix_atomic_add_fetch_32((int32_t*) addr, delta); @@ -471,7 +479,7 @@ pmix_atomic_add_fetch_size_t(volatile size_t *addr, size_t delta) } static inline size_t -pmix_atomic_fetch_add_size_t(volatile size_t *addr, size_t delta) +pmix_atomic_fetch_add_size_t(pmix_atomic_size_t *addr, size_t delta) { #if SIZEOF_SIZE_T == 4 return (size_t) pmix_atomic_fetch_add_32((int32_t*) addr, delta); @@ -483,7 +491,7 @@ pmix_atomic_fetch_add_size_t(volatile size_t *addr, size_t delta) } static inline size_t -pmix_atomic_sub_fetch_size_t(volatile size_t *addr, size_t delta) +pmix_atomic_sub_fetch_size_t(pmix_atomic_size_t *addr, size_t delta) { #if SIZEOF_SIZE_T == 4 return (size_t) pmix_atomic_sub_fetch_32((int32_t*) addr, delta); @@ -495,7 +503,7 @@ pmix_atomic_sub_fetch_size_t(volatile size_t *addr, size_t delta) } static inline size_t -pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta) +pmix_atomic_fetch_sub_size_t(pmix_atomic_size_t *addr, size_t delta) { #if SIZEOF_SIZE_T == 4 return (size_t) pmix_atomic_fetch_sub_32((int32_t*) addr, delta); @@ -508,15 +516,15 @@ pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta) #else #if SIZEOF_SIZE_T == 4 -#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_32((volatile int32_t *) addr, delta)) -#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_32((volatile int32_t *) addr, delta)) -#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_32((volatile int32_t *) addr, delta)) -#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_32((volatile int32_t *) addr, delta)) +#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_32((pmix_atomic_int32_t *) addr, delta)) +#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_32((pmix_atomic_int32_t *) addr, delta)) +#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_32((pmix_atomic_int32_t *) addr, delta)) +#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_32((pmix_atomic_int32_t *) addr, delta)) #elif SIZEOF_SIZE_T == 8 -#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_64((volatile int64_t *) addr, delta)) -#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_64((volatile int64_t *) addr, delta)) -#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_64((volatile int64_t *) addr, delta)) -#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_64((volatile int64_t *) addr, delta)) +#define pmix_atomic_add_fetch_size_t(addr, delta) ((size_t) pmix_atomic_add_fetch_64((pmix_atomic_int64_t *) addr, delta)) +#define pmix_atomic_fetch_add_size_t(addr, delta) ((size_t) pmix_atomic_fetch_add_64((pmix_atomic_int64_t *) addr, delta)) +#define pmix_atomic_sub_fetch_size_t(addr, delta) ((size_t) pmix_atomic_sub_fetch_64((pmix_atomic_int64_t *) addr, delta)) +#define pmix_atomic_fetch_sub_size_t(addr, delta) ((size_t) pmix_atomic_fetch_sub_64((pmix_atomic_int64_t *) addr, delta)) #else #error "Unknown size_t size" #endif @@ -526,20 +534,20 @@ pmix_atomic_fetch_sub_size_t(volatile size_t *addr, size_t delta) /* these are always done with inline functions, so always mark as static inline */ -static inline bool pmix_atomic_compare_exchange_strong_xx (volatile void *addr, void *oldval, +static inline bool pmix_atomic_compare_exchange_strong_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval, int64_t newval, size_t length); -static inline bool pmix_atomic_compare_exchange_strong_acq_xx (volatile void *addr, void *oldval, +static inline bool pmix_atomic_compare_exchange_strong_acq_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval, int64_t newval, size_t length); -static inline bool pmix_atomic_compare_exchange_strong_rel_xx (volatile void *addr, void *oldval, +static inline bool pmix_atomic_compare_exchange_strong_rel_xx (pmix_atomic_intptr_t *addr, intptr_t *oldval, int64_t newval, size_t length); -static inline bool pmix_atomic_compare_exchange_strong_ptr (volatile void* addr, void *oldval, - void *newval); -static inline bool pmix_atomic_compare_exchange_strong_acq_ptr (volatile void* addr, void *oldval, - void *newval); -static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* addr, void *oldval, - void *newval); +static inline bool pmix_atomic_compare_exchange_strong_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, + intptr_t newval); +static inline bool pmix_atomic_compare_exchange_strong_acq_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, + intptr_t newval); +static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, + intptr_t newval); /** * Atomic compare and set of generic type with relaxed semantics. This @@ -555,7 +563,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a * See pmix_atomic_compare_exchange_* for pseudo-code. */ #define pmix_atomic_compare_exchange_strong( ADDR, OLDVAL, NEWVAL ) \ - pmix_atomic_compare_exchange_strong_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \ + pmix_atomic_compare_exchange_strong_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \ (intptr_t)(NEWVAL), sizeof(*(ADDR)) ) /** @@ -572,7 +580,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a * See pmix_atomic_compare_exchange_acq_* for pseudo-code. */ #define pmix_atomic_compare_exchange_strong_acq( ADDR, OLDVAL, NEWVAL ) \ - pmix_atomic_compare_exchange_strong_acq_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \ + pmix_atomic_compare_exchange_strong_acq_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \ (intptr_t)(NEWVAL), sizeof(*(ADDR)) ) /** @@ -589,7 +597,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a * See pmix_atomic_compare_exchange_rel_* for pseudo-code. */ #define pmix_atomic_compare_exchange_strong_rel( ADDR, OLDVAL, NEWVAL ) \ - pmix_atomic_compare_exchange_strong_rel_xx( (volatile void*)(ADDR), (void *)(OLDVAL), \ + pmix_atomic_compare_exchange_strong_rel_xx( (pmix_atomic_intptr_t*)(ADDR), (intptr_t *)(OLDVAL), \ (intptr_t)(NEWVAL), sizeof(*(ADDR)) ) @@ -597,15 +605,15 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_ptr (volatile void* a #if defined(DOXYGEN) || (PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64) -static inline void pmix_atomic_add_xx(volatile void* addr, +static inline void pmix_atomic_add_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length); -static inline void pmix_atomic_sub_xx(volatile void* addr, +static inline void pmix_atomic_sub_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length); -static inline intptr_t pmix_atomic_add_fetch_ptr( volatile void* addr, void* delta ); -static inline intptr_t pmix_atomic_fetch_add_ptr( volatile void* addr, void* delta ); -static inline intptr_t pmix_atomic_sub_fetch_ptr( volatile void* addr, void* delta ); -static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* delta ); +static inline intptr_t pmix_atomic_add_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta ); +static inline intptr_t pmix_atomic_fetch_add_ptr( pmix_atomic_intptr_t* addr, void* delta ); +static inline intptr_t pmix_atomic_sub_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta ); +static inline intptr_t pmix_atomic_fetch_sub_ptr( pmix_atomic_intptr_t* addr, void* delta ); /** * Atomically increment the content depending on the type. This @@ -618,7 +626,7 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del * @param delta Value to add (converted to ). */ #define pmix_atomic_add( ADDR, VALUE ) \ - pmix_atomic_add_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ + pmix_atomic_add_xx( (pmix_atomic_intptr_t*)(ADDR), (int32_t)(VALUE), \ sizeof(*(ADDR)) ) /** @@ -632,7 +640,7 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del * @param delta Value to substract (converted to ). */ #define pmix_atomic_sub( ADDR, VALUE ) \ - pmix_atomic_sub_xx( (volatile void*)(ADDR), (int32_t)(VALUE), \ + pmix_atomic_sub_xx( (pmix_atomic_intptr_t*)(ADDR), (int32_t)(VALUE), \ sizeof(*(ADDR)) ) #endif /* PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64 */ @@ -644,6 +652,8 @@ static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, void* del */ #include "src/atomics/sys/atomic_impl.h" +#endif /* !PMIX_C_HAVE__ATOMIC */ + END_C_DECLS #endif /* PMIX_SYS_ATOMIC_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h index d3a3f40dd31..ee605ca8cf1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h @@ -11,9 +11,9 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +41,7 @@ #if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 #if !defined(PMIX_HAVE_ATOMIC_MIN_32) -static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value) { int32_t old = *addr; do { @@ -58,7 +58,7 @@ static inline int32_t pmix_atomic_fetch_min_32 (volatile int32_t *addr, int32_t #endif /* PMIX_HAVE_ATOMIC_MIN_32 */ #if !defined(PMIX_HAVE_ATOMIC_MAX_32) -static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value) { int32_t old = *addr; do { @@ -74,7 +74,7 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t #endif /* PMIX_HAVE_ATOMIC_MAX_32 */ #define PMIX_ATOMIC_DEFINE_CMPXCG_OP(type, bits, operation, name) \ - static inline type pmix_atomic_fetch_ ## name ## _ ## bits (volatile type *addr, type value) \ + static inline type pmix_atomic_fetch_ ## name ## _ ## bits (pmix_atomic_ ## type *addr, type value) \ { \ type oldval; \ do { \ @@ -86,7 +86,7 @@ static inline int32_t pmix_atomic_fetch_max_32 (volatile int32_t *addr, int32_t #if !defined(PMIX_HAVE_ATOMIC_SWAP_32) #define PMIX_HAVE_ATOMIC_SWAP_32 1 -static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, +static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr, int32_t newval) { int32_t old = *addr; @@ -139,7 +139,7 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int32_t, 32, -, sub) #if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 #if !defined(PMIX_HAVE_ATOMIC_MIN_64) -static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value) { int64_t old = *addr; do { @@ -156,7 +156,7 @@ static inline int64_t pmix_atomic_fetch_min_64 (volatile int64_t *addr, int64_t #endif /* PMIX_HAVE_ATOMIC_MIN_64 */ #if !defined(PMIX_HAVE_ATOMIC_MAX_64) -static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value) { int64_t old = *addr; do { @@ -173,7 +173,7 @@ static inline int64_t pmix_atomic_fetch_max_64 (volatile int64_t *addr, int64_t #if !defined(PMIX_HAVE_ATOMIC_SWAP_64) #define PMIX_HAVE_ATOMIC_SWAP_64 1 -static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr, +static inline int64_t pmix_atomic_swap_64(pmix_atomic_int64_t *addr, int64_t newval) { int64_t old = *addr; @@ -236,15 +236,15 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int64_t, 64, -, sub) #if PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 #define PMIX_ATOMIC_DEFINE_CMPXCG_XX(semantics) \ static inline bool \ - pmix_atomic_compare_exchange_strong ## semantics ## xx (volatile void* addr, void *oldval, \ + pmix_atomic_compare_exchange_strong ## semantics ## xx (pmix_atomic_intptr_t* addr, intptr_t *oldval, \ int64_t newval, const size_t length) \ { \ switch (length) { \ case 4: \ - return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, \ + return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, \ (int32_t *) oldval, (int32_t) newval); \ case 8: \ - return pmix_atomic_compare_exchange_strong_64 ((volatile int64_t *) addr, \ + return pmix_atomic_compare_exchange_strong_64 ((pmix_atomic_int64_t *) addr, \ (int64_t *) oldval, (int64_t) newval); \ } \ abort(); \ @@ -252,12 +252,12 @@ PMIX_ATOMIC_DEFINE_CMPXCG_OP(int64_t, 64, -, sub) #elif PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 #define PMIX_ATOMIC_DEFINE_CMPXCG_XX(semantics) \ static inline bool \ - pmix_atomic_compare_exchange_strong ## semantics ## xx (volatile void* addr, void *oldval, \ + pmix_atomic_compare_exchange_strong ## semantics ## xx (pmix_atomic_intptr_t* addr, intptr_t *oldval, \ int64_t newval, const size_t length) \ { \ switch (length) { \ case 4: \ - return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, \ + return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, \ (int32_t *) oldval, (int32_t) newval); \ } \ abort(); \ @@ -273,16 +273,16 @@ PMIX_ATOMIC_DEFINE_CMPXCG_XX(_rel_) #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 #define PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(semantics) \ static inline bool \ - pmix_atomic_compare_exchange_strong ## semantics ## ptr (volatile void* addr, void *oldval, void *newval) \ + pmix_atomic_compare_exchange_strong ## semantics ## ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, intptr_t newval) \ { \ - return pmix_atomic_compare_exchange_strong_32 ((volatile int32_t *) addr, (int32_t *) oldval, (int32_t) newval); \ + return pmix_atomic_compare_exchange_strong_32 ((pmix_atomic_int32_t *) addr, (int32_t *) oldval, (int32_t) newval); \ } #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 #define PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(semantics) \ static inline bool \ - pmix_atomic_compare_exchange_strong ## semantics ## ptr (volatile void* addr, void *oldval, void *newval) \ + pmix_atomic_compare_exchange_strong ## semantics ## ptr (pmix_atomic_intptr_t* addr, intptr_t *oldval, intptr_t newval) \ { \ - return pmix_atomic_compare_exchange_strong_64 ((volatile int64_t *) addr, (int64_t *) oldval, (int64_t) newval); \ + return pmix_atomic_compare_exchange_strong_64 ((pmix_atomic_int64_t *) addr, (int64_t *) oldval, (int64_t) newval); \ } #else #error "Can not define pmix_atomic_compare_exchange_strong_ptr with existing atomics" @@ -298,9 +298,9 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_) #if (PMIX_HAVE_ATOMIC_SWAP_32 || PMIX_HAVE_ATOMIC_SWAP_64) #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SWAP_32 -#define pmix_atomic_swap_ptr(addr, value) (void *) pmix_atomic_swap_32((int32_t *) addr, (int32_t) value) +#define pmix_atomic_swap_ptr(addr, value) (intptr_t) pmix_atomic_swap_32((pmix_atomic_int32_t *) addr, (int32_t) value) #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SWAP_64 -#define pmix_atomic_swap_ptr(addr, value) (void *) pmix_atomic_swap_64((int64_t *) addr, (int64_t) value) +#define pmix_atomic_swap_ptr(addr, value) (intptr_t) pmix_atomic_swap_64((pmix_atomic_int64_t *) addr, (int64_t) value) #endif #endif /* (PMIX_HAVE_ATOMIC_SWAP_32 || PMIX_HAVE_ATOMIC_SWAP_64) */ @@ -309,15 +309,15 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_) #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_LLSC_32 -#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_32((volatile int32_t *) (addr), ret) -#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_32((volatile int32_t *) (addr), (intptr_t) (value), ret) +#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_32((pmix_atomic_int32_t *) (addr), ret) +#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_32((pmix_atomic_int32_t *) (addr), (intptr_t) (value), ret) #define PMIX_HAVE_ATOMIC_LLSC_PTR 1 #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_LLSC_64 -#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_64((volatile int64_t *) (addr), ret) -#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_64((volatile int64_t *) (addr), (intptr_t) (value), ret) +#define pmix_atomic_ll_ptr(addr, ret) pmix_atomic_ll_64((pmix_atomic_int64_t *) (addr), ret) +#define pmix_atomic_sc_ptr(addr, value, ret) pmix_atomic_sc_64((pmix_atomic_int64_t *) (addr), (intptr_t) (value), ret) #define PMIX_HAVE_ATOMIC_LLSC_PTR 1 @@ -332,18 +332,18 @@ PMIX_ATOMIC_DEFINE_CMPXCG_PTR_XX(_rel_) #if PMIX_HAVE_ATOMIC_MATH_32 || PMIX_HAVE_ATOMIC_MATH_64 static inline void - pmix_atomic_add_xx(volatile void* addr, int32_t value, size_t length) + pmix_atomic_add_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length) { switch( length ) { #if PMIX_HAVE_ATOMIC_ADD_32 case 4: - (void) pmix_atomic_fetch_add_32( (volatile int32_t*)addr, (int32_t)value ); + (void) pmix_atomic_fetch_add_32( (pmix_atomic_int32_t*)addr, (int32_t)value ); break; #endif /* PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 */ #if PMIX_HAVE_ATOMIC_ADD_64 case 8: - (void) pmix_atomic_fetch_add_64( (volatile int64_t*)addr, (int64_t)value ); + (void) pmix_atomic_fetch_add_64( (pmix_atomic_int64_t*)addr, (int64_t)value ); break; #endif /* PMIX_HAVE_ATOMIC_ADD_64 */ default: @@ -355,18 +355,18 @@ static inline void static inline void -pmix_atomic_sub_xx(volatile void* addr, int32_t value, size_t length) +pmix_atomic_sub_xx(pmix_atomic_intptr_t* addr, int32_t value, size_t length) { switch( length ) { #if PMIX_HAVE_ATOMIC_SUB_32 case 4: - (void) pmix_atomic_fetch_sub_32( (volatile int32_t*)addr, (int32_t)value ); + (void) pmix_atomic_fetch_sub_32( (pmix_atomic_int32_t*)addr, (int32_t)value ); break; #endif /* PMIX_HAVE_ATOMIC_SUB_32 */ #if PMIX_HAVE_ATOMIC_SUB_64 case 8: - (void) pmix_atomic_fetch_sub_64( (volatile int64_t*)addr, (int64_t)value ); + (void) pmix_atomic_fetch_sub_64( (pmix_atomic_int64_t*)addr, (int64_t)value ); break; #endif /* PMIX_HAVE_ATOMIC_SUB_64 */ default: @@ -377,7 +377,7 @@ pmix_atomic_sub_xx(volatile void* addr, int32_t value, size_t length) } #define PMIX_ATOMIC_DEFINE_OP_FETCH(op, operation, type, ptr_type, suffix) \ - static inline type pmix_atomic_ ## op ## _fetch_ ## suffix (volatile ptr_type *addr, type value) \ + static inline type pmix_atomic_ ## op ## _fetch_ ## suffix (pmix_atomic_ ## ptr_type *addr, type value) \ { \ return pmix_atomic_fetch_ ## op ## _ ## suffix (addr, value) operation value; \ } @@ -388,13 +388,13 @@ PMIX_ATOMIC_DEFINE_OP_FETCH(or, |, int32_t, int32_t, 32) PMIX_ATOMIC_DEFINE_OP_FETCH(xor, ^, int32_t, int32_t, 32) PMIX_ATOMIC_DEFINE_OP_FETCH(sub, -, int32_t, int32_t, 32) -static inline int32_t pmix_atomic_min_fetch_32 (volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value) { int32_t old = pmix_atomic_fetch_min_32 (addr, value); return old <= value ? old : value; } -static inline int32_t pmix_atomic_max_fetch_32 (volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value) { int32_t old = pmix_atomic_fetch_max_32 (addr, value); return old >= value ? old : value; @@ -407,13 +407,13 @@ PMIX_ATOMIC_DEFINE_OP_FETCH(or, |, int64_t, int64_t, 64) PMIX_ATOMIC_DEFINE_OP_FETCH(xor, ^, int64_t, int64_t, 64) PMIX_ATOMIC_DEFINE_OP_FETCH(sub, -, int64_t, int64_t, 64) -static inline int64_t pmix_atomic_min_fetch_64 (volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value) { int64_t old = pmix_atomic_fetch_min_64 (addr, value); return old <= value ? old : value; } -static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value) { int64_t old = pmix_atomic_fetch_max_64 (addr, value); return old >= value ? old : value; @@ -421,52 +421,52 @@ static inline int64_t pmix_atomic_max_fetch_64 (volatile int64_t *addr, int64_t #endif -static inline intptr_t pmix_atomic_fetch_add_ptr( volatile void* addr, +static inline intptr_t pmix_atomic_fetch_add_ptr( pmix_atomic_intptr_t* addr, void* delta ) { #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_ADD_32 - return pmix_atomic_fetch_add_32((int32_t*) addr, (unsigned long) delta); + return pmix_atomic_fetch_add_32((pmix_atomic_int32_t*) addr, (unsigned long) delta); #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_ADD_64 - return pmix_atomic_fetch_add_64((int64_t*) addr, (unsigned long) delta); + return pmix_atomic_fetch_add_64((pmix_atomic_int64_t*) addr, (unsigned long) delta); #else abort (); return 0; #endif } -static inline intptr_t pmix_atomic_add_fetch_ptr( volatile void* addr, +static inline intptr_t pmix_atomic_add_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta ) { #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_ADD_32 - return pmix_atomic_add_fetch_32((int32_t*) addr, (unsigned long) delta); + return pmix_atomic_add_fetch_32((pmix_atomic_int32_t*) addr, (unsigned long) delta); #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_ADD_64 - return pmix_atomic_add_fetch_64((int64_t*) addr, (unsigned long) delta); + return pmix_atomic_add_fetch_64((pmix_atomic_int64_t*) addr, (unsigned long) delta); #else abort (); return 0; #endif } -static inline intptr_t pmix_atomic_fetch_sub_ptr( volatile void* addr, +static inline intptr_t pmix_atomic_fetch_sub_ptr( pmix_atomic_intptr_t* addr, void* delta ) { #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SUB_32 - return pmix_atomic_fetch_sub_32((int32_t*) addr, (unsigned long) delta); + return pmix_atomic_fetch_sub_32((pmix_atomic_int32_t*) addr, (unsigned long) delta); #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SUB_32 - return pmix_atomic_fetch_sub_64((int64_t*) addr, (unsigned long) delta); + return pmix_atomic_fetch_sub_64((pmix_atomic_int64_t*) addr, (unsigned long) delta); #else abort(); return 0; #endif } -static inline intptr_t pmix_atomic_sub_fetch_ptr( volatile void* addr, +static inline intptr_t pmix_atomic_sub_fetch_ptr( pmix_atomic_intptr_t* addr, void* delta ) { #if SIZEOF_VOID_P == 4 && PMIX_HAVE_ATOMIC_SUB_32 - return pmix_atomic_sub_fetch_32((int32_t*) addr, (unsigned long) delta); + return pmix_atomic_sub_fetch_32((pmix_atomic_int32_t*) addr, (unsigned long) delta); #elif SIZEOF_VOID_P == 8 && PMIX_HAVE_ATOMIC_SUB_32 - return pmix_atomic_sub_fetch_64((int64_t*) addr, (unsigned long) delta); + return pmix_atomic_sub_fetch_64((pmix_atomic_int64_t*) addr, (unsigned long) delta); #else abort(); return 0; diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h new file mode 100644 index 00000000000..7c4a6089090 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h @@ -0,0 +1,262 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/* This file provides shims between the pmix atomics interface and the C11 atomics interface. It + * is intended as the first step in moving to using C11 atomics across the entire codebase. Once + * all officially supported compilers offer C11 atomic (GCC 4.9.0+, icc 2018+, pgi, xlc, etc) then + * this shim will go away and the codebase will be updated to use C11's atomic support + * directly. + * This shim contains some functions already present in atomic_impl.h because we do not include + * atomic_impl.h when using C11 atomics. It would require alot of #ifdefs to avoid duplicate + * definitions to be worthwhile. */ + +#if !defined(PMIX_ATOMIC_STDC_H) +#define PMIX_ATOMIC_STDC_H + +#include +#include +#include "src/include/pmix_stdint.h" + +#define PMIX_HAVE_ATOMIC_MEM_BARRIER 1 + +#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1 +#define PMIX_HAVE_ATOMIC_SWAP_32 1 + +#define PMIX_HAVE_ATOMIC_MATH_32 1 +#define PMIX_HAVE_ATOMIC_ADD_32 1 +#define PMIX_HAVE_ATOMIC_AND_32 1 +#define PMIX_HAVE_ATOMIC_OR_32 1 +#define PMIX_HAVE_ATOMIC_XOR_32 1 +#define PMIX_HAVE_ATOMIC_SUB_32 1 + +#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1 +#define PMIX_HAVE_ATOMIC_SWAP_64 1 + +#define PMIX_HAVE_ATOMIC_MATH_64 1 +#define PMIX_HAVE_ATOMIC_ADD_64 1 +#define PMIX_HAVE_ATOMIC_AND_64 1 +#define PMIX_HAVE_ATOMIC_OR_64 1 +#define PMIX_HAVE_ATOMIC_XOR_64 1 +#define PMIX_HAVE_ATOMIC_SUB_64 1 + +#define PMIX_HAVE_ATOMIC_LLSC_32 0 +#define PMIX_HAVE_ATOMIC_LLSC_64 0 +#define PMIX_HAVE_ATOMIC_LLSC_PTR 0 + +#define PMIX_HAVE_ATOMIC_MIN_32 1 +#define PMIX_HAVE_ATOMIC_MAX_32 1 + +#define PMIX_HAVE_ATOMIC_MIN_64 1 +#define PMIX_HAVE_ATOMIC_MAX_64 1 + +#define PMIX_HAVE_ATOMIC_SPINLOCKS 1 + +static inline void pmix_atomic_mb (void) +{ + atomic_thread_fence (memory_order_seq_cst); +} + +static inline void pmix_atomic_wmb (void) +{ + atomic_thread_fence (memory_order_release); +} + +static inline void pmix_atomic_rmb (void) +{ + atomic_thread_fence (memory_order_acquire); +} + +#define pmix_atomic_compare_exchange_strong_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_acq_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_acq_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_acq_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_acquire, memory_order_relaxed) + +#define pmix_atomic_compare_exchange_strong_rel_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_rel_64(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_rel_ptr(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_release, memory_order_relaxed) + +#define pmix_atomic_compare_exchange_strong(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_relaxed, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_acq(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_acquire, memory_order_relaxed) +#define pmix_atomic_compare_exchange_strong_rel(addr, oldval, newval) atomic_compare_exchange_strong_explicit (addr, oldval, newval, memory_order_release, memory_order_relaxed) + +#define pmix_atomic_swap_32(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) +#define pmix_atomic_swap_64(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) +#define pmix_atomic_swap_ptr(addr, value) atomic_exchange_explicit (addr, value, memory_order_relaxed) + +#define PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(op, bits, type, operator) \ + static inline type pmix_atomic_fetch_ ## op ##_## bits (pmix_atomic_ ## type *addr, type value) \ + { \ + return atomic_fetch_ ## op ## _explicit (addr, value, memory_order_relaxed); \ + } \ + \ + static inline type pmix_atomic_## op ## _fetch_ ## bits (pmix_atomic_ ## type *addr, type value) \ + { \ + return atomic_fetch_ ## op ## _explicit (addr, value, memory_order_relaxed) operator value; \ + } + +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, 32, int32_t, +) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, 64, int64_t, +) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(add, size_t, size_t, +) + +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, 32, int32_t, -) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, 64, int64_t, -) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(sub, size_t, size_t, -) + +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(or, 32, int32_t, |) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(or, 64, int64_t, |) + +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(xor, 32, int32_t, ^) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(xor, 64, int64_t, ^) + +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(and, 32, int32_t, &) +PMIX_ATOMIC_STDC_DEFINE_FETCH_OP(and, 64, int64_t, &) + +#define pmix_atomic_add(addr, value) (void) atomic_fetch_add_explicit (addr, value, memory_order_relaxed) + +static inline int32_t pmix_atomic_fetch_min_32 (pmix_atomic_int32_t *addr, int32_t value) +{ + int32_t old = *addr; + do { + if (old <= value) { + break; + } + } while (!pmix_atomic_compare_exchange_strong_32 (addr, &old, value)); + + return old; +} + +static inline int32_t pmix_atomic_fetch_max_32 (pmix_atomic_int32_t *addr, int32_t value) +{ + int32_t old = *addr; + do { + if (old >= value) { + break; + } + } while (!pmix_atomic_compare_exchange_strong_32 (addr, &old, value)); + + return old; +} + +static inline int64_t pmix_atomic_fetch_min_64 (pmix_atomic_int64_t *addr, int64_t value) +{ + int64_t old = *addr; + do { + if (old <= value) { + break; + } + } while (!pmix_atomic_compare_exchange_strong_64 (addr, &old, value)); + + return old; +} + +static inline int64_t pmix_atomic_fetch_max_64 (pmix_atomic_int64_t *addr, int64_t value) +{ + int64_t old = *addr; + do { + if (old >= value) { + break; + } + } while (!pmix_atomic_compare_exchange_strong_64 (addr, &old, value)); + + return old; +} + +static inline int32_t pmix_atomic_min_fetch_32 (pmix_atomic_int32_t *addr, int32_t value) +{ + int32_t old = pmix_atomic_fetch_min_32 (addr, value); + return old <= value ? old : value; +} + +static inline int32_t pmix_atomic_max_fetch_32 (pmix_atomic_int32_t *addr, int32_t value) +{ + int32_t old = pmix_atomic_fetch_max_32 (addr, value); + return old >= value ? old : value; +} + +static inline int64_t pmix_atomic_min_fetch_64 (pmix_atomic_int64_t *addr, int64_t value) +{ + int64_t old = pmix_atomic_fetch_min_64 (addr, value); + return old <= value ? old : value; +} + +static inline int64_t pmix_atomic_max_fetch_64 (pmix_atomic_int64_t *addr, int64_t value) +{ + int64_t old = pmix_atomic_fetch_max_64 (addr, value); + return old >= value ? old : value; +} + +#define PMIX_ATOMIC_LOCK_UNLOCKED false +#define PMIX_ATOMIC_LOCK_LOCKED true + +#define PMIX_ATOMIC_LOCK_INIT ATOMIC_FLAG_INIT + +typedef atomic_flag pmix_atomic_lock_t; + +/* + * Lock initialization function. It set the lock to UNLOCKED. + */ +static inline void pmix_atomic_lock_init (pmix_atomic_lock_t *lock, bool value) +{ + atomic_flag_clear (lock); +} + + +static inline int pmix_atomic_trylock (pmix_atomic_lock_t *lock) +{ + return (int) atomic_flag_test_and_set (lock); +} + + +static inline void pmix_atomic_lock(pmix_atomic_lock_t *lock) +{ + while (pmix_atomic_trylock (lock)) { + } +} + + +static inline void pmix_atomic_unlock (pmix_atomic_lock_t *lock) +{ + atomic_flag_clear (lock); +} + + +#if PMIX_HAVE_C11_CSWAP_INT128 + +/* the C11 atomic compare-exchange is lock free so use it */ +#define pmix_atomic_compare_exchange_strong_128 atomic_compare_exchange_strong + +#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1 + +#elif PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128 + +/* fall back on the __sync builtin if available since it will emit the expected instruction on x86_64 (cmpxchng16b) */ +__pmix_attribute_always_inline__ +static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, + pmix_int128_t *oldval, pmix_int128_t newval) +{ + pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); + bool ret = prev == *oldval; + *oldval = prev; + return ret; +} + +#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1 + +#else + +#define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 0 + +#endif + +#endif /* !defined(PMIX_ATOMIC_STDC_H) */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h index 3eacce23351..967d13c63f4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/cma.h @@ -4,7 +4,7 @@ * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ */ @@ -85,13 +85,13 @@ #elif PMIX_ASSEMBLY_ARCH == PMIX_S390 -#define __NR_process_vm_readv 340 -#define __NR_process_vm_writev 341 +#define __NR_process_vm_readv 340 +#define __NR_process_vm_writev 341 #elif PMIX_ASSEMBLY_ARCH == PMIX_S390X -#define __NR_process_vm_readv 340 -#define __NR_process_vm_writev 341 +#define __NR_process_vm_readv 340 +#define __NR_process_vm_writev 341 #else #error "Unsupported architecture for process_vm_readv and process_vm_writev syscalls" diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h index b1f1a1c832a..e07c4d88196 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/gcc_builtin/atomic.h @@ -11,13 +11,13 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2018 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) 2018 Intel, Inc. All rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -86,103 +86,103 @@ static inline void pmix_atomic_wmb(void) /* * Suppress numerous (spurious ?) warnings from Oracle Studio compilers * see https://community.oracle.com/thread/3968347 - */ + */ #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) #pragma error_messages(off, E_ARG_INCOMPATIBLE_WITH_ARG_L) #endif -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); } -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED); } -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); } -static inline int32_t pmix_atomic_swap_32 (volatile int32_t *addr, int32_t newval) +static inline int32_t pmix_atomic_swap_32 (pmix_atomic_int32_t *addr, int32_t newval) { int32_t oldval; __atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED); return oldval; } -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int32_t delta) +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta) { return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED); } -static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value) { return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED); } -static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value) { return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED); } -static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value) { return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED); } -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t delta) +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta) { return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED); } -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); } -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_RELEASE, __ATOMIC_RELAXED); } -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED); } -static inline int64_t pmix_atomic_swap_64 (volatile int64_t *addr, int64_t newval) +static inline int64_t pmix_atomic_swap_64 (pmix_atomic_int64_t *addr, int64_t newval) { int64_t oldval; __atomic_exchange (addr, &newval, &oldval, __ATOMIC_RELAXED); return oldval; } -static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta) +static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta) { return __atomic_fetch_add (addr, delta, __ATOMIC_RELAXED); } -static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value) { return __atomic_fetch_and (addr, value, __ATOMIC_RELAXED); } -static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value) { return __atomic_fetch_or (addr, value, __ATOMIC_RELAXED); } -static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value) { return __atomic_fetch_xor (addr, value, __ATOMIC_RELAXED); } -static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta) +static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta) { return __atomic_fetch_sub (addr, delta, __ATOMIC_RELAXED); } @@ -191,7 +191,7 @@ static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t d #define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_128 1 -static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr, +static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval) { return __atomic_compare_exchange_n (addr, oldval, newval, false, @@ -204,7 +204,7 @@ static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128 /* __atomic version is not lock-free so use legacy __sync version */ -static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr, +static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_pmix_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval) { pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia32/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia32/atomic.h index 4e8a6d81455..c50c162a6ed 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia32/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/ia32/atomic.h @@ -13,9 +13,9 @@ * Copyright (c) 2007-2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -85,7 +85,7 @@ static inline void pmix_atomic_isync(void) *********************************************************************/ #if PMIX_GCC_INLINE_ASSEMBLY -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { unsigned char ret; __asm__ __volatile__ ( @@ -107,15 +107,15 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add #define PMIX_HAVE_ATOMIC_SWAP_32 1 -static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr, - int32_t newval) +static inline int32_t pmix_atomic_swap_32( pmix_atomic_int32_t *addr, + int32_t newval) { int32_t oldval; __asm__ __volatile__("xchg %1, %0" : - "=r" (oldval), "=m" (*addr) : - "0" (newval), "m" (*addr) : - "memory"); + "=r" (oldval), "=m" (*addr) : + "0" (newval), "m" (*addr) : + "memory"); return oldval; } @@ -131,7 +131,7 @@ static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr, * * Atomically adds @i to @v. */ -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i) +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int i) { int ret = i; __asm__ __volatile__( @@ -151,7 +151,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i) * * Atomically subtracts @i from @v. */ -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i) +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int i) { int ret = -i; __asm__ __volatile__( diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h index e5ce2663082..cfb46eb5194 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h @@ -13,7 +13,7 @@ * Copyright (c) 2010-2017 IBM Corporation. All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -145,7 +145,7 @@ void pmix_atomic_isync(void) #define PMIX_ASM_VALUE64(x) x #endif -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev; bool ret; @@ -171,7 +171,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add * load the arguments to/from the stack. This sequence may cause the ll reservation to be cancelled. */ #define pmix_atomic_ll_32(addr, ret) \ do { \ - volatile int32_t *_addr = (addr); \ + pmix_atomic_int32_t *_addr = (addr); \ int32_t _ret; \ __asm__ __volatile__ ("lwarx %0, 0, %1 \n\t" \ : "=&r" (_ret) \ @@ -182,7 +182,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add #define pmix_atomic_sc_32(addr, value, ret) \ do { \ - volatile int32_t *_addr = (addr); \ + pmix_atomic_int32_t *_addr = (addr); \ int32_t _ret, _foo, _newval = (int32_t) value; \ \ __asm__ __volatile__ (" stwcx. %4, 0, %3 \n\t" \ @@ -201,7 +201,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { bool rc; @@ -212,13 +212,13 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval); } -static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval) +static inline int32_t pmix_atomic_swap_32(pmix_atomic_int32_t *addr, int32_t newval) { int32_t ret; @@ -240,7 +240,7 @@ static inline int32_t pmix_atomic_swap_32(volatile int32_t *addr, int32_t newval #if PMIX_GCC_INLINE_ASSEMBLY #define PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(type, instr) \ -static inline int64_t pmix_atomic_fetch_ ## type ## _64(volatile int64_t* v, int64_t val) \ +static inline int64_t pmix_atomic_fetch_ ## type ## _64(pmix_atomic_int64_t* v, int64_t val) \ { \ int64_t t, old; \ \ @@ -262,7 +262,7 @@ PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(or, or) PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(xor, xor) PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_64(sub, subf) -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; bool ret; @@ -285,7 +285,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #define pmix_atomic_ll_64(addr, ret) \ do { \ - volatile int64_t *_addr = (addr); \ + pmix_atomic_int64_t *_addr = (addr); \ int64_t _ret; \ __asm__ __volatile__ ("ldarx %0, 0, %1 \n\t" \ : "=&r" (_ret) \ @@ -296,7 +296,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #define pmix_atomic_sc_64(addr, value, ret) \ do { \ - volatile int64_t *_addr = (addr); \ + pmix_atomic_int64_t *_addr = (addr); \ int64_t _foo, _newval = (int64_t) value; \ int32_t _ret; \ \ @@ -311,7 +311,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add ret = _ret; \ } while (0) -static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr, int64_t newval) +static inline int64_t pmix_atomic_swap_64(pmix_atomic_int64_t *addr, int64_t newval) { int64_t ret; @@ -336,7 +336,7 @@ static inline int64_t pmix_atomic_swap_64(volatile int64_t *addr, int64_t newval #if PMIX_GCC_INLINE_ASSEMBLY -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev; int ret; @@ -383,7 +383,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add atomic_?mb can be inlined). Instead, we "inline" them by hand in the assembly, meaning there is one function call overhead instead of two */ -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { bool rc; @@ -394,7 +394,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval); @@ -402,7 +402,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t #define PMIX_ATOMIC_POWERPC_DEFINE_ATOMIC_32(type, instr) \ -static inline int32_t pmix_atomic_fetch_ ## type ## _32(volatile int32_t* v, int val) \ +static inline int32_t pmix_atomic_fetch_ ## type ## _32(pmix_atomic_int32_t* v, int val) \ { \ int32_t t, old; \ \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h index 45afeea54d5..e74a152090f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sparcv9/atomic.h @@ -13,9 +13,9 @@ * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,7 +32,7 @@ #define ASI_P "0x80" -#define MEMBAR(type) __asm__ __volatile__ ("membar " type : : : "memory") +#define MEPMIXMBAR(type) __asm__ __volatile__ ("membar " type : : : "memory") /********************************************************************** @@ -56,19 +56,19 @@ static inline void pmix_atomic_mb(void) { - MEMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad"); + MEPMIXMBAR("#LoadLoad | #LoadStore | #StoreStore | #StoreLoad"); } static inline void pmix_atomic_rmb(void) { - MEMBAR("#LoadLoad"); + MEPMIXMBAR("#LoadLoad"); } static inline void pmix_atomic_wmb(void) { - MEMBAR("#StoreStore"); + MEPMIXMBAR("#StoreStore"); } static inline void pmix_atomic_isync(void) @@ -86,7 +86,7 @@ static inline void pmix_atomic_isync(void) *********************************************************************/ #if PMIX_GCC_INLINE_ASSEMBLY -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) * @@ -108,7 +108,7 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add } -static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { bool rc; @@ -119,7 +119,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_32 (volatile int32_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_32 (addr, oldval, newval); @@ -128,7 +128,7 @@ static inline bool pmix_atomic_compare_exchange_strong_rel_32 (volatile int32_t #if PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) * @@ -150,7 +150,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #else /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */ -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { /* casa [reg(rs1)] %asi, reg(rs2), reg(rd) * @@ -180,7 +180,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #endif /* PMIX_ASSEMBLY_ARCH == PMIX_SPARCV9_64 */ -static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_acq_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { bool rc; @@ -191,7 +191,7 @@ static inline bool pmix_atomic_compare_exchange_strong_acq_64 (volatile int64_t } -static inline bool pmix_atomic_compare_exchange_strong_rel_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_rel_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { pmix_atomic_wmb(); return pmix_atomic_compare_exchange_strong_64 (addr, oldval, newval); diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h index 2c91411e194..240d297f7a5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/sync_builtin/atomic.h @@ -11,11 +11,11 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. - * Copyright (c) 2014-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,7 +58,7 @@ static inline void pmix_atomic_wmb(void) #define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_32 1 -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { int32_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); bool ret = prev == *oldval; @@ -72,31 +72,31 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add #define PMIX_HAVE_ATOMIC_MATH_32 1 #define PMIX_HAVE_ATOMIC_ADD_32 1 -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t *addr, int32_t delta) +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t *addr, int32_t delta) { return __sync_fetch_and_add(addr, delta); } #define PMIX_HAVE_ATOMIC_AND_32 1 -static inline int32_t pmix_atomic_fetch_and_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_and_32(pmix_atomic_int32_t *addr, int32_t value) { return __sync_fetch_and_and(addr, value); } #define PMIX_HAVE_ATOMIC_OR_32 1 -static inline int32_t pmix_atomic_fetch_or_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_or_32(pmix_atomic_int32_t *addr, int32_t value) { return __sync_fetch_and_or(addr, value); } #define PMIX_HAVE_ATOMIC_XOR_32 1 -static inline int32_t pmix_atomic_fetch_xor_32(volatile int32_t *addr, int32_t value) +static inline int32_t pmix_atomic_fetch_xor_32(pmix_atomic_int32_t *addr, int32_t value) { return __sync_fetch_and_xor(addr, value); } #define PMIX_HAVE_ATOMIC_SUB_32 1 -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t delta) +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t *addr, int32_t delta) { return __sync_fetch_and_sub(addr, delta); } @@ -105,7 +105,7 @@ static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t *addr, int32_t d #define PMIX_HAVE_ATOMIC_COMPARE_EXCHANGE_64 1 -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { int64_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); bool ret = prev == *oldval; @@ -118,31 +118,31 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #define PMIX_HAVE_ATOMIC_MATH_64 1 #define PMIX_HAVE_ATOMIC_ADD_64 1 -static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t *addr, int64_t delta) +static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t *addr, int64_t delta) { return __sync_fetch_and_add(addr, delta); } #define PMIX_HAVE_ATOMIC_AND_64 1 -static inline int64_t pmix_atomic_fetch_and_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_and_64(pmix_atomic_int64_t *addr, int64_t value) { return __sync_fetch_and_and(addr, value); } #define PMIX_HAVE_ATOMIC_OR_64 1 -static inline int64_t pmix_atomic_fetch_or_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_or_64(pmix_atomic_int64_t *addr, int64_t value) { return __sync_fetch_and_or(addr, value); } #define PMIX_HAVE_ATOMIC_XOR_64 1 -static inline int64_t pmix_atomic_fetch_xor_64(volatile int64_t *addr, int64_t value) +static inline int64_t pmix_atomic_fetch_xor_64(pmix_atomic_int64_t *addr, int64_t value) { return __sync_fetch_and_xor(addr, value); } #define PMIX_HAVE_ATOMIC_SUB_64 1 -static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t delta) +static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t *addr, int64_t delta) { return __sync_fetch_and_sub(addr, delta); } @@ -150,7 +150,7 @@ static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t *addr, int64_t d #endif #if PMIX_HAVE_SYNC_BUILTIN_CSWAP_INT128 -static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr, +static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval) { pmix_int128_t prev = __sync_val_compare_and_swap (addr, *oldval, newval); diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h index b2a562e4218..e3fdc1326e8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/timer.h @@ -13,7 +13,7 @@ * Copyright (c) 2016 Broadcom Limited. All rights reserved. * Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/atomic.h index f2144eb0467..005d2d66c20 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/atomic.h @@ -11,11 +11,11 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserverd. - * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights + * Copyright (c) 2012-2018 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) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -83,7 +83,7 @@ static inline void pmix_atomic_isync(void) *********************************************************************/ #if PMIX_GCC_INLINE_ASSEMBLY -static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *addr, int32_t *oldval, int32_t newval) +static inline bool pmix_atomic_compare_exchange_strong_32 (pmix_atomic_int32_t *addr, int32_t *oldval, int32_t newval) { unsigned char ret; __asm__ __volatile__ ( @@ -103,13 +103,13 @@ static inline bool pmix_atomic_compare_exchange_strong_32 (volatile int32_t *add #if PMIX_GCC_INLINE_ASSEMBLY -static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *addr, int64_t *oldval, int64_t newval) +static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t *addr, int64_t *oldval, int64_t newval) { unsigned char ret; __asm__ __volatile__ ( SMPLOCK "cmpxchgq %3,%2 \n\t" "sete %0 \n\t" - : "=qm" (ret), "+a" (*oldval), "+m" (*((volatile long*)addr)) + : "=qm" (ret), "+a" (*oldval), "+m" (*((pmix_atomic_long_t *)addr)) : "q"(newval) : "memory", "cc" ); @@ -124,7 +124,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (volatile int64_t *add #if PMIX_GCC_INLINE_ASSEMBLY && PMIX_HAVE_CMPXCHG16B && HAVE_PMIX_INT128_T -static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval) +static inline bool pmix_atomic_compare_exchange_strong_128 (pmix_atomic_int128_t *addr, pmix_int128_t *oldval, pmix_int128_t newval) { unsigned char ret; @@ -151,15 +151,15 @@ static inline bool pmix_atomic_compare_exchange_strong_128 (volatile pmix_int128 #define PMIX_HAVE_ATOMIC_SWAP_64 1 -static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr, - int32_t newval) +static inline int32_t pmix_atomic_swap_32( pmix_atomic_int32_t *addr, + int32_t newval) { int32_t oldval; __asm__ __volatile__("xchg %1, %0" : - "=r" (oldval), "+m" (*addr) : - "0" (newval) : - "memory"); + "=r" (oldval), "+m" (*addr) : + "0" (newval) : + "memory"); return oldval; } @@ -167,15 +167,15 @@ static inline int32_t pmix_atomic_swap_32( volatile int32_t *addr, #if PMIX_GCC_INLINE_ASSEMBLY -static inline int64_t pmix_atomic_swap_64( volatile int64_t *addr, +static inline int64_t pmix_atomic_swap_64( pmix_atomic_int64_t *addr, int64_t newval) { int64_t oldval; __asm__ __volatile__("xchgq %1, %0" : - "=r" (oldval), "+m" (*addr) : - "0" (newval) : - "memory"); + "=r" (oldval), "+m" (*addr) : + "0" (newval) : + "memory"); return oldval; } @@ -197,7 +197,7 @@ static inline int64_t pmix_atomic_swap_64( volatile int64_t *addr, * * Atomically adds @i to @v. */ -static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i) +static inline int32_t pmix_atomic_fetch_add_32(pmix_atomic_int32_t* v, int i) { int ret = i; __asm__ __volatile__( @@ -218,7 +218,7 @@ static inline int32_t pmix_atomic_fetch_add_32(volatile int32_t* v, int i) * * Atomically adds @i to @v. */ -static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t* v, int64_t i) +static inline int64_t pmix_atomic_fetch_add_64(pmix_atomic_int64_t* v, int64_t i) { int64_t ret = i; __asm__ __volatile__( @@ -239,7 +239,7 @@ static inline int64_t pmix_atomic_fetch_add_64(volatile int64_t* v, int64_t i) * * Atomically subtracts @i from @v. */ -static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i) +static inline int32_t pmix_atomic_fetch_sub_32(pmix_atomic_int32_t* v, int i) { int ret = -i; __asm__ __volatile__( @@ -260,7 +260,7 @@ static inline int32_t pmix_atomic_fetch_sub_32(volatile int32_t* v, int i) * * Atomically subtracts @i from @v. */ -static inline int64_t pmix_atomic_fetch_sub_64(volatile int64_t* v, int64_t i) +static inline int64_t pmix_atomic_fetch_sub_64(pmix_atomic_int64_t* v, int64_t i) { int64_t ret = -i; __asm__ __volatile__( diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/timer.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/timer.h index 6b25f9aafee..31054235a55 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/timer.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/x86_64/timer.h @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. ALl rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h index 02a246bfdd5..883a2c5c6ce 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -190,6 +190,7 @@ static inline pmix_status_t pmix_hotel_checkin(pmix_hotel_t *hotel, /* Do we have any rooms available? */ if (PMIX_UNLIKELY(hotel->last_unoccupied_room < 0)) { + *room_num = -1; return PMIX_ERR_OUT_OF_RESOURCE; } @@ -247,6 +248,10 @@ static inline void pmix_hotel_checkout(pmix_hotel_t *hotel, int room_num) /* Bozo check */ assert(room_num < hotel->num_rooms); + if (0 > room_num) { + /* occupant wasn't checked in */ + return; + } /* If there's an occupant in the room, check them out */ room = &(hotel->rooms[room_num]); @@ -285,6 +290,11 @@ static inline void pmix_hotel_checkout_and_return_occupant(pmix_hotel_t *hotel, /* Bozo check */ assert(room_num < hotel->num_rooms); + if (0 > room_num) { + /* occupant wasn't checked in */ + *occupant = NULL; + return; + } /* If there's an occupant in the room, check them out */ room = &(hotel->rooms[room_num]); @@ -339,6 +349,10 @@ static inline void pmix_hotel_knock(pmix_hotel_t *hotel, int room_num, void **oc assert(room_num < hotel->num_rooms); *occupant = NULL; + if (0 > room_num) { + /* occupant wasn't checked in */ + return; + } /* If there's an occupant in the room, have them come to the door */ room = &(hotel->rooms[room_num]); diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h index df3f6a2280d..f29bea22a95 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_list.h @@ -13,7 +13,7 @@ * Copyright (c) 2007 Voltaire All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -109,7 +109,7 @@ struct pmix_list_item_t #if PMIX_ENABLE_DEBUG /** Atomic reference count for debugging */ - volatile int32_t pmix_list_item_refcount; + pmix_atomic_int32_t pmix_list_item_refcount; /** The list this item belong to */ volatile struct pmix_list_t* pmix_list_item_belong_to; #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h index 8ad7f90f105..7b7ed41a72c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_object.h @@ -192,7 +192,7 @@ struct pmix_object_t { uint64_t obj_magic_id; #endif pmix_class_t *obj_class; /**< class descriptor */ - volatile int32_t obj_reference_count; /**< reference count */ + pmix_atomic_int32_t obj_reference_count; /**< reference count */ #if PMIX_ENABLE_DEBUG const char* cls_init_file_name; /**< In debug mode store the file where the object get contructed */ int cls_init_lineno; /**< In debug mode store the line number where the object get contructed */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c index 1c8517ea0e7..dd5cb66e7d9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -75,7 +75,7 @@ PMIX_EXPORT int PMI_Init(int *spawned) *spawned = 0; } pmi_singleton = true; - (void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); + pmix_strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); myproc.rank = 0; pmi_init = 1; return PMI_SUCCESS; @@ -242,7 +242,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[ proc.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) && (NULL != val) && (PMIX_STRING == val->type)) { - strncpy(value, val->data.string, length); + pmix_strncpy(value, val->data.string, length-1); PMIX_VALUE_FREE(val, 1); return PMI_SUCCESS; } else { @@ -259,7 +259,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[ /* retrieve the data from PMIx - since we don't have a rank, * we indicate that by passing the UNDEF value */ - (void)strncpy(proc.nspace, kvsname, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, kvsname, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_UNDEF; rc = PMIx_Get(&proc, key, NULL, 0, &val); @@ -267,7 +267,7 @@ PMIX_EXPORT int PMI_KVS_Get( const char kvsname[], const char key[], char value[ if (PMIX_STRING != val->type) { rc = PMIX_ERROR; } else if (NULL != val->data.string) { - (void)strncpy(value, val->data.string, length); + pmix_strncpy(value, val->data.string, length-1); } PMIX_VALUE_RELEASE(val); } @@ -445,7 +445,7 @@ PMIX_EXPORT int PMI_Publish_name(const char service_name[], const char port[]) } /* pass the service/port */ - (void) strncpy(info.key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(info.key, service_name, PMIX_MAX_KEYLEN); info.value.type = PMIX_STRING; info.value.data.string = (char*) port; @@ -497,7 +497,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[]) PMIX_PDATA_CONSTRUCT(&pdata); /* pass the service */ - (void) strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN); /* PMI-1 doesn't want the nspace back */ if (PMIX_SUCCESS != (rc = PMIx_Lookup(&pdata, 1, NULL, 0))) { @@ -514,7 +514,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[]) * potential we could overrun it. As this feature * isn't widely supported in PMI-1, try being * conservative */ - (void) strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN); + pmix_strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN); PMIX_PDATA_DESTRUCT(&pdata); return PMIX_SUCCESS; @@ -535,7 +535,7 @@ PMIX_EXPORT int PMI_Get_id(char id_str[], int length) return PMI_ERR_INVALID_LENGTH; } - (void) strncpy(id_str, myproc.nspace, length); + pmix_strncpy(id_str, myproc.nspace, length-1); return PMI_SUCCESS; } @@ -742,7 +742,7 @@ PMIX_EXPORT int PMI_Spawn_multiple(int count, apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t)); /* copy the info objects */ for (j = 0; j < apps[i].ninfo; j++) { - (void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN); + pmix_strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN); apps[i].info[j].value.type = PMIX_STRING; apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c index 2ad443c7382..4adf6ba37de 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmi2.c @@ -79,7 +79,7 @@ PMIX_EXPORT int PMI2_Init(int *spawned, int *size, int *rank, int *appnum) *appnum = 0; } pmi2_singleton = true; - (void)strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); + pmix_strncpy(myproc.nspace, "1234", PMIX_MAX_NSLEN); myproc.rank = 0; pmi2_init = 1; return PMI2_SUCCESS; @@ -227,7 +227,7 @@ PMIX_EXPORT int PMI2_Job_Spawn(int count, const char * cmds[], apps[i].info = (pmix_info_t*)malloc(apps[i].ninfo * sizeof(pmix_info_t)); /* copy the info objects */ for (j=0; j < apps[i].ninfo; j++) { - (void)strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN); + pmix_strncpy(apps[i].info[j].key, info_keyval_vectors[i][j].key, PMIX_MAX_KEYLEN); apps[i].info[j].value.type = PMIX_STRING; apps[i].info[j].value.data.string = strdup(info_keyval_vectors[i][j].val); } @@ -271,7 +271,7 @@ PMIX_EXPORT int PMI2_Job_GetId(char jobid[], int jobid_size) if (NULL == jobid) { return PMI2_ERR_INVALID_ARGS; } - (void)strncpy(jobid, myproc.nspace, jobid_size); + pmix_strncpy(jobid, myproc.nspace, jobid_size-1); return PMI2_SUCCESS; } @@ -339,7 +339,7 @@ PMIX_EXPORT int PMI2_Job_Connect(const char jobid[], PMI2_Connect_comm_t *conn) } memset(proc.nspace, 0, sizeof(proc.nspace)); - (void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1); + pmix_strncpy(proc.nspace, (jobid ? jobid : proc.nspace), PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; rc = PMIx_Connect(&proc, 1, NULL, 0); return convert_err(rc); @@ -357,7 +357,7 @@ PMIX_EXPORT int PMI2_Job_Disconnect(const char jobid[]) } memset(proc.nspace, 0, sizeof(proc.nspace)); - (void)strncpy(proc.nspace, (jobid ? jobid : proc.nspace), sizeof(proc.nspace)-1); + pmix_strncpy(proc.nspace, (jobid ? jobid : proc.nspace), PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; rc = PMIx_Disconnect(&proc, 1, NULL, 0); return convert_err(rc); @@ -455,7 +455,7 @@ PMIX_EXPORT int PMI2_KVS_Get(const char *jobid, int src_pmi_id, pmix_output_verbose(3, pmix_globals.debug_output, "PMI2_KVS_Get: key=%s jobid=%s src_pmi_id=%d", key, (jobid ? jobid : "null"), src_pmi_id); - (void)strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, (jobid ? jobid : myproc.nspace), PMIX_MAX_NSLEN); if (src_pmi_id == PMI2_ID_NULL) { /* the rank is UNDEF */ proc.rank = PMIX_RANK_UNDEF; @@ -468,7 +468,7 @@ PMIX_EXPORT int PMI2_KVS_Get(const char *jobid, int src_pmi_id, if (PMIX_STRING != val->type) { rc = PMIX_ERROR; } else if (NULL != val->data.string) { - (void)strncpy(value, val->data.string, maxvalue); + pmix_strncpy(value, val->data.string, maxvalue-1); *vallen = strlen(val->data.string); } PMIX_VALUE_RELEASE(val); @@ -511,7 +511,7 @@ PMIX_EXPORT int PMI2_Info_GetNodeAttr(const char name[], if (PMIX_STRING != val->type) { rc = PMIX_ERROR; } else if (NULL != val->data.string) { - (void)strncpy(value, val->data.string, valuelen); + pmix_strncpy(value, val->data.string, valuelen-1); *found = 1; } PMIX_VALUE_RELEASE(val); @@ -586,7 +586,7 @@ PMIX_EXPORT int PMI2_Info_GetJobAttr(const char name[], char value[], int valuel proc.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS == PMIx_Get(&proc, PMIX_ANL_MAP, NULL, 0, &val) && (NULL != val) && (PMIX_STRING == val->type)) { - strncpy(value, val->data.string, valuelen); + pmix_strncpy(value, val->data.string, valuelen); PMIX_VALUE_FREE(val, 1); *found = 1; return PMI2_SUCCESS; @@ -610,7 +610,7 @@ PMIX_EXPORT int PMI2_Info_GetJobAttr(const char name[], char value[], int valuel if (PMIX_STRING != val->type) { rc = PMIX_ERROR; } else if (NULL != val->data.string) { - (void)strncpy(value, val->data.string, valuelen); + pmix_strncpy(value, val->data.string, valuelen-1); *found = 1; } PMIX_VALUE_RELEASE(val); @@ -648,14 +648,14 @@ PMIX_EXPORT int PMI2_Nameserv_publish(const char service_name[], } /* pass the service/port */ - (void)strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(info[0].key, service_name, PMIX_MAX_KEYLEN); info[0].value.type = PMIX_STRING; info[0].value.data.string = (char*)port; nvals = 1; /* if provided, add any other value */ if (NULL != info_ptr) { - (void)strncpy(info[1].key, info_ptr->key, PMIX_MAX_KEYLEN); + pmix_strncpy(info[1].key, info_ptr->key, PMIX_MAX_KEYLEN); info[1].value.type = PMIX_STRING; info[1].value.data.string = (char*)info_ptr->val; nvals = 2; @@ -689,12 +689,12 @@ PMIX_EXPORT int PMI2_Nameserv_lookup(const char service_name[], PMIX_PDATA_CONSTRUCT(&pdata[1]); /* pass the service */ - (void)strncpy(pdata[0].key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(pdata[0].key, service_name, PMIX_MAX_KEYLEN); nvals = 1; /* if provided, add any other value */ if (NULL != info_ptr) { - (void)strncpy(pdata[1].key, info_ptr->key, PMIX_MAX_KEYLEN); + pmix_strncpy(pdata[1].key, info_ptr->key, PMIX_MAX_KEYLEN); pdata[1].value.type = PMIX_STRING; pdata[1].value.data.string = info_ptr->val; nvals = 2; @@ -716,7 +716,7 @@ PMIX_EXPORT int PMI2_Nameserv_lookup(const char service_name[], } /* return the port */ - (void)strncpy(port, pdata[0].value.data.string, portLen); + pmix_strncpy(port, pdata[0].value.data.string, portLen-1); PMIX_PDATA_DESTRUCT(&pdata[0]); if (NULL != info_ptr) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index 3e4c9433fbf..a99f7141922 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -53,7 +53,7 @@ #include PMIX_EVENT2_THREAD_HEADER static const char pmix_version_string[] = PMIX_VERSION; - +static pmix_status_t pmix_init_result = PMIX_ERR_INIT; #include "src/class/pmix_list.h" #include "src/event/pmix_event.h" @@ -268,6 +268,9 @@ static void notification_fn(size_t evhdlr_registration_id, char *name = NULL; size_t n; + pmix_output_verbose(2, pmix_client_globals.base_output, + "[%s:%d] DEBUGGER RELEASE RECVD", + pmix_globals.myid.nspace, pmix_globals.myid.rank); if (NULL != info) { lock = NULL; for (n=0; n < ninfo; n++) { @@ -439,7 +442,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, * rank should be known. So return them here if * requested */ if (NULL != proc) { - (void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); proc->rank = pmix_globals.myid.rank; } ++pmix_globals.init_cntr; @@ -450,10 +453,13 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, if (NULL != info) { _check_for_notify(info, ninfo); } - return PMIX_SUCCESS; + return pmix_init_result; } + ++pmix_globals.init_cntr; + /* if we don't see the required info, then we cannot init */ if (NULL == (evar = getenv("PMIX_NAMESPACE"))) { + pmix_init_result = PMIX_ERR_INVALID_NAMESPACE; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INVALID_NAMESPACE; } @@ -463,6 +469,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, if (PMIX_SUCCESS != (rc = pmix_rte_init(PMIX_PROC_CLIENT, info, ninfo, pmix_client_notify_recv))) { PMIX_ERROR_LOG(rc); + pmix_init_result = rc; PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } @@ -480,24 +487,25 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_pointer_array_init(&pmix_client_globals.peers, 1, INT_MAX, 1); pmix_client_globals.myserver = PMIX_NEW(pmix_peer_t); if (NULL == pmix_client_globals.myserver) { + pmix_init_result = PMIX_ERR_NOMEM; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOMEM; } - pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t); + pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); if (NULL == pmix_client_globals.myserver->nptr) { PMIX_RELEASE(pmix_client_globals.myserver); + pmix_init_result = PMIX_ERR_NOMEM; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOMEM; } pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); if (NULL == pmix_client_globals.myserver->info) { PMIX_RELEASE(pmix_client_globals.myserver); + pmix_init_result = PMIX_ERR_NOMEM; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOMEM; } - pmix_output_verbose(2, pmix_client_globals.base_output, - "pmix: init called"); /* setup the base verbosity */ if (0 < pmix_client_globals.base_verbose) { /* set default output */ @@ -506,17 +514,21 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_client_globals.base_verbose); } + pmix_output_verbose(2, pmix_client_globals.base_output, + "pmix: init called"); + /* we require our nspace */ if (NULL != proc) { - (void)strncpy(proc->nspace, evar, PMIX_MAX_NSLEN); + pmix_strncpy(proc->nspace, evar, PMIX_MAX_NSLEN); } - (void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN); - /* set the global pmix_nspace_t object for our peer */ + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, evar); + /* set the global pmix_namespace_t object for our peer */ pmix_globals.mypeer->nptr->nspace = strdup(evar); /* we also require our rank */ if (NULL == (evar = getenv("PMIX_RANK"))) { /* let the caller know that the server isn't available yet */ + pmix_init_result = PMIX_ERR_DATA_VALUE_NOT_FOUND; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_DATA_VALUE_NOT_FOUND; } @@ -528,6 +540,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, /* setup a rank_info object for us */ pmix_globals.mypeer->info = PMIX_NEW(pmix_rank_info_t); if (NULL == pmix_globals.mypeer->info) { + pmix_init_result = PMIX_ERR_NOMEM; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOMEM; } @@ -540,6 +553,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, evar = getenv("PMIX_SECURITY_MODE"); pmix_globals.mypeer->nptr->compat.psec = pmix_psec_base_assign_module(evar); if (NULL == pmix_globals.mypeer->nptr->compat.psec) { + pmix_init_result = PMIX_ERR_INIT; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INIT; } @@ -574,6 +588,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_client_globals.myserver->nptr->compat.gds = pmix_gds_base_assign_module(NULL, 0); } if (NULL == pmix_client_globals.myserver->nptr->compat.gds) { + pmix_init_result = PMIX_ERR_INIT; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INIT; } @@ -596,6 +611,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_globals.mypeer->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1); if (NULL == pmix_globals.mypeer->nptr->compat.gds) { PMIX_INFO_DESTRUCT(&ginfo); + pmix_init_result = PMIX_ERR_INIT; PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INIT; } @@ -604,6 +620,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, /* connect to the server */ rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); if (PMIX_SUCCESS != rc) { + pmix_init_result = rc; PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } @@ -619,6 +636,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(req); + pmix_init_result = rc; PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } @@ -627,6 +645,7 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, req, job_data, (void*)&cb); if (PMIX_SUCCESS != rc) { + pmix_init_result = rc; PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } @@ -636,15 +655,16 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_DESTRUCT(&cb); if (PMIX_SUCCESS == rc) { - pmix_globals.init_cntr++; + pmix_init_result = PMIX_SUCCESS; } else { + pmix_init_result = rc; PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } PMIX_RELEASE_THREAD(&pmix_global_lock); /* look for a debugger attach key */ - (void)strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); wildcard.rank = PMIX_RANK_WILDCARD; PMIX_INFO_LOAD(&ginfo, PMIX_OPTIONAL, NULL, PMIX_BOOL); if (PMIX_SUCCESS == PMIx_Get(&wildcard, PMIX_DEBUG_STOP_IN_INIT, &ginfo, 1, &val)) { @@ -655,7 +675,9 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, PMIX_CONSTRUCT_LOCK(&releaselock); PMIX_INFO_LOAD(&evinfo[0], PMIX_EVENT_RETURN_OBJECT, &releaselock, PMIX_POINTER); PMIX_INFO_LOAD(&evinfo[1], PMIX_EVENT_HDLR_NAME, "WAIT-FOR-DEBUGGER", PMIX_STRING); - + pmix_output_verbose(2, pmix_client_globals.base_output, + "[%s:%d] WAITING IN INIT FOR DEBUGGER", + pmix_globals.myid.nspace, pmix_globals.myid.rank); PMIx_Register_event_handler(&code, 1, evinfo, 2, notification_fn, evhandler_reg_callbk, (void*)®lock); /* wait for registration to complete */ @@ -1003,7 +1025,9 @@ static void _putfn(int sd, short args, void *cbdata) PMIX_WAKEUP_THREAD(&cb->lock); } -PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, const char key[], pmix_value_t *val) +PMIX_EXPORT pmix_status_t PMIx_Put(pmix_scope_t scope, + const pmix_key_t key, + pmix_value_t *val) { pmix_cb_t *cb; pmix_status_t rc; @@ -1212,7 +1236,7 @@ static void _resolve_peers(int sd, short args, void *cbdata) /* need to thread-shift this request */ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, - const char *nspace, + const pmix_nspace_t nspace, pmix_proc_t **procs, size_t *nprocs) { pmix_cb_t *cb; @@ -1239,7 +1263,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, /* if the nspace wasn't found, then we need to * ask the server for that info */ if (PMIX_ERR_INVALID_NAMESPACE == cb->status) { - (void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; /* any key will suffice as it will bring down * the entire data blob */ @@ -1285,7 +1309,7 @@ static void _resolve_nodes(int fd, short args, void *cbdata) } /* need to thread-shift this request */ -PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist) +PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist) { pmix_cb_t *cb; pmix_status_t rc; @@ -1309,7 +1333,7 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const char *nspace, char **nodelist /* if the nspace wasn't found, then we need to * ask the server for that info */ if (PMIX_ERR_INVALID_NAMESPACE == cb->status) { - (void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; /* any key will suffice as it will bring down * the entire data blob */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c index d3e182d584d..7a587dcad46 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -147,7 +147,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs /* if we are given a NULL proc, then the caller is referencing * all procs within our own nspace */ if (NULL == procs) { - (void)strncpy(rg.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(rg.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); rg.rank = PMIX_RANK_WILDCARD; rgs = &rg; nrg = 1; diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index 04a2e09184a..46d6c62db8f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -5,7 +5,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2016 Mellanox Technologies, Inc. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -75,8 +75,15 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, static void _value_cbfunc(pmix_status_t status, pmix_value_t *kv, void *cbdata); +static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t key, + const pmix_info_t info[], size_t ninfo, + pmix_value_t **val); -PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], +static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb); + + +PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, + const pmix_key_t key, const pmix_info_t info[], size_t ninfo, pmix_value_t **val) { @@ -91,12 +98,17 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], } PMIX_RELEASE_THREAD(&pmix_global_lock); - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix:client get for %s:%d key %s", (NULL == proc) ? "NULL" : proc->nspace, (NULL == proc) ? PMIX_RANK_UNDEF : proc->rank, (NULL == key) ? "NULL" : key); + /* try to get data directly, without threadshift */ + if (PMIX_SUCCESS == (rc = _getfn_fastpath(proc, key, info, ninfo, val))) { + goto done; + } + /* create a callback object as we need to pass it to the * recv routine so we know which callback to use when * the return message is recvd */ @@ -115,13 +127,14 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const char key[], } PMIX_RELEASE(cb); - pmix_output_verbose(2, pmix_client_globals.get_verbose, + done: + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix:client get completed"); return rc; } -PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key, +PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t key, const pmix_info_t info[], size_t ninfo, pmix_value_cbfunc_t cbfunc, void *cbdata) { @@ -149,7 +162,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key, * Either case is supported. However, we don't currently * support the case where -both- values are NULL */ if (NULL == proc && NULL == key) { - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: get_nb value error - both proc and key are NULL"); return PMIX_ERR_BAD_PARAM; } @@ -157,7 +170,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key, /* if the key is NULL, the rank cannot be WILDCARD as * we cannot return all info from every rank */ if (NULL != proc && PMIX_RANK_WILDCARD == proc->rank && NULL == key) { - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: get_nb value error - WILDCARD rank and key is NULL"); return PMIX_ERR_BAD_PARAM; } @@ -179,7 +192,7 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const char *key, rank = proc->rank; } - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: get_nb value for proc %s:%u key %s", nm, rank, (NULL == key) ? "NULL" : key); @@ -284,7 +297,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_proc_t proc; pmix_kval_t *kv; - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: get_nb callback recvd"); if (NULL == cb) { @@ -294,7 +307,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, } /* cache the proc id */ - (void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); proc.rank = cb->pname.rank; /* a zero-byte buffer indicates that this recv is being @@ -407,7 +420,7 @@ static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb) /* copy the list elements */ n=0; PMIX_LIST_FOREACH(kv, kvs, pmix_kval_t) { - (void)strncpy(info[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(info[n].key, kv->key, PMIX_MAX_KEYLEN); pmix_value_xfer(&info[n].value, kv->value); ++n; } @@ -472,6 +485,55 @@ static void infocb(pmix_status_t status, } } +static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t key, + const pmix_info_t info[], size_t ninfo, + pmix_value_t **val) +{ + pmix_cb_t *cb = PMIX_NEW(pmix_cb_t); + pmix_status_t rc = PMIX_SUCCESS; + size_t n; + + /* scan the incoming directives */ + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) { + cb->scope = info[n].value.data.scope; + break; + } + } + } + cb->proc = (pmix_proc_t*)proc; + cb->copy = true; + cb->key = (char*)key; + cb->info = (pmix_info_t*)info; + cb->ninfo = ninfo; + + PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_globals.mypeer); + if (PMIX_SUCCESS == rc) { + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); + if (PMIX_SUCCESS == rc) { + goto done; + } + } + PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_client_globals.myserver); + if (PMIX_SUCCESS == rc) { + PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + if (PMIX_SUCCESS == rc) { + goto done; + } + } + PMIX_RELEASE(cb); + return rc; + + done: + rc = process_values(val, cb); + if (NULL != *val) { + PMIX_VALUE_COMPRESSED_STRING_UNPACK(*val); + } + PMIX_RELEASE(cb); + return rc; +} + static void _getnbfn(int fd, short flags, void *cbdata) { pmix_cb_t *cb = (pmix_cb_t*)cbdata; @@ -480,7 +542,6 @@ static void _getnbfn(int fd, short flags, void *cbdata) pmix_value_t *val = NULL; pmix_status_t rc; size_t n; - char *tmp; pmix_proc_t proc; bool optional = false; bool immediate = false; @@ -490,13 +551,13 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* cb was passed to us from another thread - acquire it */ PMIX_ACQUIRE_OBJECT(cb); - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: getnbfn value for proc %s:%u key %s", cb->pname.nspace, cb->pname.rank, (NULL == cb->key) ? "NULL" : cb->key); /* set the proc object identifier */ - (void)strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); proc.rank = cb->pname.rank; /* scan the incoming directives */ @@ -528,12 +589,12 @@ static void _getnbfn(int fd, short flags, void *cbdata) cb->copy = true; PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); if (PMIX_SUCCESS == rc) { - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client data found in internal storage"); rc = process_values(&val, cb); goto respond; } - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client data NOT found in internal storage"); /* if the key is NULL or starts with "pmix", then they are looking @@ -545,7 +606,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) cb->copy = true; PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); if (PMIX_SUCCESS != rc) { - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client job-level data NOT found"); if (0 != strncmp(cb->pname.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) { /* we are asking about the job-level info from another @@ -559,7 +620,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) * job-level info. In some cases, a server may elect not * to provide info at init to save memory */ if (immediate) { - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client IMMEDIATE given - querying data"); /* the direct modex request doesn't pass a key as it * was intended to support non-job-level information. @@ -579,16 +640,16 @@ static void _getnbfn(int fd, short flags, void *cbdata) return; } /* we should have had this info, so respond with the error */ - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client returning NOT FOUND error"); goto respond; } else { - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client NULL KEY - returning error"); goto respond; } } - pmix_output_verbose(5, pmix_client_globals.get_verbose, + pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client job-level data NOT found"); rc = process_values(&val, cb); goto respond; @@ -608,19 +669,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* if a callback was provided, execute it */ if (NULL != cb->cbfunc.valuefn) { if (NULL != val) { - /* if this is a compressed string, then uncompress it */ - if (PMIX_COMPRESSED_STRING == val->type) { - pmix_util_uncompress_string(&tmp, (uint8_t*)val->data.bo.bytes, val->data.bo.size); - if (NULL == tmp) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - rc = PMIX_ERR_NOMEM; - PMIX_VALUE_RELEASE(val); - val = NULL; - } else { - PMIX_VALUE_DESTRUCT(val); - PMIX_VAL_ASSIGN(val, string, tmp); - } - } + PMIX_VALUE_COMPRESSED_STRING_UNPACK(val); } cb->cbfunc.valuefn(rc, val, cb->cbdata); } @@ -644,7 +693,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) * us to attempt to retrieve it from the server */ if (optional) { /* they don't want us to try and retrieve it */ - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "PMIx_Get key=%s for rank = %u, namespace = %s was not found - request was optional", cb->key, cb->pname.rank, cb->pname.nspace); rc = PMIX_ERR_NOT_FOUND; @@ -672,7 +721,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) goto respond; } - pmix_output_verbose(2, pmix_client_globals.get_verbose, + pmix_output_verbose(2, pmix_client_globals.get_output, "%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, cb->pname.nspace, cb->pname.rank, cb->key); diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c index cee3dcaf940..bd6795eac5e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c @@ -660,7 +660,7 @@ static void lookup_cbfunc(pmix_status_t status, pmix_pdata_t pdata[], size_t nda for (j=0; j < cb->nvals; j++) { if (0 == strcmp(pdata[i].key, tgt[j].key)) { /* transfer the publishing proc id */ - (void)strncpy(tgt[j].proc.nspace, pdata[i].proc.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(tgt[j].proc.nspace, pdata[i].proc.nspace, PMIX_MAX_NSLEN); tgt[j].proc.rank = pdata[i].proc.rank; /* transfer the value to the pmix_info_t */ PMIX_BFROPS_VALUE_XFER(cb->status, pmix_client_globals.myserver, &tgt[j].value, &pdata[i].value); diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c index f04dcec34d1..b7aefc4316f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_spawn.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -49,6 +49,7 @@ #include "src/class/pmix_list.h" #include "src/threads/threads.h" #include "src/mca/bfrops/bfrops.h" +#include "src/mca/pnet/base/base.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" @@ -64,7 +65,7 @@ static void spawn_cbfunc(pmix_status_t status, char nspace[], void *cbdata); PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo, const pmix_app_t apps[], size_t napps, - char nspace[]) + pmix_nspace_t nspace) { pmix_status_t rc; pmix_cb_t *cb; @@ -104,7 +105,7 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn(const pmix_info_t job_info[], size_t ninfo, PMIX_WAIT_THREAD(&cb->lock); rc = cb->status; if (NULL != nspace) { - (void)strncpy(nspace, cb->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(nspace, cb->pname.nspace, PMIX_MAX_NSLEN); } PMIX_RELEASE(cb); @@ -119,6 +120,12 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin pmix_cmd_t cmd = PMIX_SPAWNNB_CMD; pmix_status_t rc; pmix_cb_t *cb; + size_t n, m; + pmix_app_t *aptr; + bool jobenvars = false; + char *harvest[2] = {"PMIX_MCA_", NULL}; + pmix_kval_t *kv; + pmix_list_t ilist; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -137,6 +144,70 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin } PMIX_RELEASE_THREAD(&pmix_global_lock); + /* check job info for directives */ + if (NULL != job_info) { + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&job_info[n], PMIX_SETUP_APP_ENVARS)) { + PMIX_CONSTRUCT(&ilist, pmix_list_t); + rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist); + if (PMIX_SUCCESS != rc) { + PMIX_LIST_DESTRUCT(&ilist); + return rc; + } + PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { + /* cycle across all the apps and set this envar */ + for (m=0; m < napps; m++) { + aptr = (pmix_app_t*)&apps[m]; + pmix_setenv(kv->value->data.envar.envar, + kv->value->data.envar.value, + true, &aptr->env); + } + } + jobenvars = true; + PMIX_LIST_DESTRUCT(&ilist); + break; + } + } + } + + for (n=0; n < napps; n++) { + /* do a quick check of the apps directive array to ensure + * the ninfo field has been set */ + aptr = (pmix_app_t*)&apps[n]; + if (NULL != aptr->info && 0 == aptr->ninfo) { + /* look for the info marked as "end" */ + m = 0; + while (!(PMIX_INFO_IS_END(&aptr->info[m])) && m < SIZE_MAX) { + ++m; + } + if (SIZE_MAX == m) { + /* nothing we can do */ + return PMIX_ERR_BAD_PARAM; + } + aptr->ninfo = m; + } + if (!jobenvars) { + for (m=0; m < aptr->ninfo; m++) { + if (PMIX_CHECK_KEY(&aptr->info[m], PMIX_SETUP_APP_ENVARS)) { + PMIX_CONSTRUCT(&ilist, pmix_list_t); + rc = pmix_pnet_base_harvest_envars(harvest, NULL, &ilist); + if (PMIX_SUCCESS != rc) { + PMIX_LIST_DESTRUCT(&ilist); + return rc; + } + PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { + pmix_setenv(kv->value->data.envar.envar, + kv->value->data.envar.value, + true, &aptr->env); + } + jobenvars = true; + PMIX_LIST_DESTRUCT(&ilist); + break; + } + } + } + } + msg = PMIX_NEW(pmix_buffer_t); /* pack the cmd */ PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, @@ -240,27 +311,25 @@ static void wait_cbfunc(struct pmix_peer_t *pr, PMIX_ERROR_LOG(rc); ret = rc; } - if (PMIX_SUCCESS == ret) { - /* unpack the namespace */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, - buf, &n2, &cnt, PMIX_STRING); + /* unpack the namespace */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, + buf, &n2, &cnt, PMIX_STRING); + if (PMIX_SUCCESS != rc && PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { + PMIX_ERROR_LOG(rc); + ret = rc; + } + pmix_output_verbose(1, pmix_globals.debug_output, + "pmix:client recv '%s'", n2); + + if (NULL != n2) { + /* protect length */ + pmix_strncpy(nspace, n2, PMIX_MAX_NSLEN); + free(n2); + PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, buf); + /* extract and process any job-related info for this nspace */ if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - ret = rc; - } - pmix_output_verbose(1, pmix_globals.debug_output, - "pmix:client recv '%s'", n2); - - if (NULL != n2) { - /* protect length */ - (void)strncpy(nspace, n2, PMIX_MAX_NSLEN); - free(n2); - PMIX_GDS_STORE_JOB_INFO(rc, pmix_globals.mypeer, nspace, buf); - /* extract and process any job-related info for this nspace */ - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c index 615db82630b..1c2f74308a0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c @@ -4,6 +4,8 @@ * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -105,6 +107,8 @@ static void query_cbfunc(struct pmix_peer_t *peer, /* release the caller */ if (NULL != cd->cbfunc) { cd->cbfunc(results->status, results->info, results->ninfo, cd->cbdata, relcbfunc, results); + } else { + PMIX_RELEASE(results); } PMIX_RELEASE(cd); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c index 39ca2bcf291..a9e32c661f6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c @@ -98,7 +98,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) /* didn't find it, so try to get the library version of the target * from the host - the result will be cached, so we will only have * to retrieve it once */ - (void)strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN); wildcard.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != (rc = PMIx_Get(&wildcard, PMIX_BFROPS_MODULE, NULL, 0, &value))) { /* couldn't get it - nothing we can do */ @@ -110,7 +110,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) PMIX_RELEASE(value); return NULL; } - peer->nptr = PMIX_NEW(pmix_nspace_t); + peer->nptr = PMIX_NEW(pmix_namespace_t); if (NULL == peer->nptr) { PMIX_RELEASE(peer); PMIX_RELEASE(value); @@ -137,15 +137,9 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) return pmix_client_globals.myserver; } - /* if the target is another member of my nspace, then - * they must be using the same version */ - if (0 == strncmp(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) { - return pmix_globals.mypeer; - } - /* try to get the library version of this peer - the result will be * cached, so we will only have to retrieve it once */ - (void)strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(wildcard.nspace, proc->nspace, PMIX_MAX_NSLEN); wildcard.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != (rc = PMIx_Get(&wildcard, PMIX_BFROPS_MODULE, NULL, 0, &value))) { /* couldn't get it - nothing we can do */ @@ -157,7 +151,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) PMIX_RELEASE(value); return NULL; } - peer->nptr = PMIX_NEW(pmix_nspace_t); + peer->nptr = PMIX_NEW(pmix_namespace_t); if (NULL == peer->nptr) { PMIX_RELEASE(peer); PMIX_RELEASE(value); diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h index fcc5f7b3da8..3525c5fb471 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h @@ -148,7 +148,7 @@ pmix_iof_fd_always_ready(int fd) "defining endpt: file %s line %d fd %d", \ __FILE__, __LINE__, (fid))); \ PMIX_CONSTRUCT((snk), pmix_iof_sink_t); \ - (void)strncpy((snk)->name.nspace, (nm)->nspace, PMIX_MAX_NSLEN); \ + pmix_strncpy((snk)->name.nspace, (nm)->nspace, PMIX_MAX_NSLEN); \ (snk)->name.rank = (nm)->rank; \ (snk)->tag = (tg); \ if (0 <= (fid)) { \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c index 33bc025dafd..c40f08b6a0e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -53,6 +53,8 @@ static void query_cbfunc(struct pmix_peer_t *peer, pmix_status_t rc; pmix_shift_caddy_t *results; int cnt; + size_t n; + pmix_kval_t *kv; pmix_output_verbose(2, pmix_globals.debug_output, "pmix:query cback from server"); @@ -88,6 +90,19 @@ static void query_cbfunc(struct pmix_peer_t *peer, results->status = rc; goto complete; } + /* locally cache the results */ + for (n=0; n < results->ninfo; n++) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(results->info[n].key); + PMIX_VALUE_CREATE(kv->value, 1); + PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, + kv->value, &results->info[n].value); + + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, PMIX_INTERNAL, + kv); + PMIX_RELEASE(kv); // maintain accounting + } } complete: @@ -100,6 +115,22 @@ static void query_cbfunc(struct pmix_peer_t *peer, PMIX_RELEASE(cd); } +static void _local_relcb(void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + PMIX_RELEASE(cd); +} + +static void _local_cbfunc(int sd, short args, void *cbdata) +{ + pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata; + if (NULL != cd->cbfunc) { + cd->cbfunc(cd->status, cd->info, cd->ninfo, cd->cbdata, _local_relcb, cd); + return; + } + PMIX_RELEASE(cd); +} + PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nqueries, pmix_info_cbfunc_t cbfunc, void *cbdata) @@ -108,6 +139,11 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque pmix_cmd_t cmd = PMIX_QUERY_CMD; pmix_buffer_t *msg; pmix_status_t rc; + pmix_cb_t cb; + size_t n, p; + pmix_list_t results; + pmix_kval_t *kv, *kvnxt; + pmix_proc_t proc; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -124,6 +160,128 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque return PMIX_ERR_BAD_PARAM; } + /* do a quick check of the qualifiers array to ensure + * the nqual field has been set */ + for (n=0; n < nqueries; n++) { + if (NULL != queries[n].qualifiers && 0 == queries[n].nqual) { + /* look for the info marked as "end" */ + p = 0; + while (!(PMIX_INFO_IS_END(&queries[n].qualifiers[p])) && p < SIZE_MAX) { + ++p; + } + if (SIZE_MAX == p) { + /* nothing we can do */ + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_BAD_PARAM; + } + queries[n].nqual = p; + } + } + + /* setup the list of local results */ + PMIX_CONSTRUCT(&results, pmix_list_t); + + /* check the directives to see if they want us to refresh + * the local cached results - if we wanted to optimize this + * more, we would check each query and allow those that don't + * want to be refreshed to be executed locally, and those that + * did would be sent to the host. However, for now we simply + * */ + memset(proc.nspace, 0, PMIX_MAX_NSLEN+1); + proc.rank = PMIX_RANK_INVALID; + for (n=0; n < nqueries; n++) { + for (p=0; p < queries[n].nqual; p++) { + if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) { + if (PMIX_INFO_TRUE(&queries[n].qualifiers[p])) { + PMIX_LIST_DESTRUCT(&results); + goto query; + } + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) { + PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace); + proc.rank = queries[n].qualifiers[p].value.data.proc->rank; + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) { + PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string); + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) { + proc.rank = queries[n].qualifiers[p].value.data.rank; + } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_HOSTNAME)) { + if (0 != strcmp(queries[n].qualifiers[p].value.data.string, pmix_globals.hostname)) { + /* asking about a different host, so ask for the info */ + PMIX_LIST_DESTRUCT(&results); + goto query; + } + } + } + /* we get here if a refresh isn't required - first try a local + * "get" on the data to see if we already have it */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.copy = false; + /* set the proc */ + if (PMIX_RANK_INVALID == proc.rank && + 0 == strlen(proc.nspace)) { + /* use our id */ + cb.proc = &pmix_globals.myid; + } else { + if (0 == strlen(proc.nspace)) { + /* use our nspace */ + PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); + } + if (PMIX_RANK_INVALID == proc.rank) { + /* user the wildcard rank */ + proc.rank = PMIX_RANK_WILDCARD; + } + cb.proc = &proc; + } + for (p=0; NULL != queries[n].keys[p]; p++) { + cb.key = queries[n].keys[p]; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS != rc) { + /* needs to be passed to the host */ + PMIX_LIST_DESTRUCT(&results); + PMIX_DESTRUCT(&cb); + goto query; + } + /* need to retain this result */ + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &cb.kvs, pmix_kval_t) { + pmix_list_remove_item(&cb.kvs, &kv->super); + pmix_list_append(&results, &kv->super); + } + PMIX_DESTRUCT(&cb); + } + } + + /* if we get here, then all queries were completely locally + * resolved, so construct the results for return */ + cd = PMIX_NEW(pmix_query_caddy_t); + cd->cbfunc = cbfunc; + cd->cbdata = cbdata; + cd->status = PMIX_SUCCESS; + cd->ninfo = pmix_list_get_size(&results); + PMIX_INFO_CREATE(cd->info, cd->ninfo); + n = 0; + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &results, pmix_kval_t) { + PMIX_LOAD_KEY(cd->info[n].key, kv->key); + rc = pmix_value_xfer(&cd->info[n].value, kv->value); + if (PMIX_SUCCESS != rc) { + cd->status = rc; + PMIX_INFO_FREE(cd->info, cd->ninfo); + break; + } + ++n; + } + /* done with the list of results */ + PMIX_LIST_DESTRUCT(&results); + /* we need to thread-shift as we are not allowed to + * execute the callback function prior to returning + * from the API */ + PMIX_THREADSHIFT(cd, _local_cbfunc); + /* regardless of the result of the query, we return + * PMIX_SUCCESS here to indicate that the operation + * was accepted for processing */ + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_SUCCESS; + + + query: /* if we are the server, then we just issue the query and * return the response */ if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && @@ -135,10 +293,10 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque } pmix_output_verbose(2, pmix_globals.debug_output, "pmix:query handed to RM"); - pmix_host_server.query(&pmix_globals.myid, - queries, nqueries, - cbfunc, cbdata); - return PMIX_SUCCESS; + rc = pmix_host_server.query(&pmix_globals.myid, + queries, nqueries, + cbfunc, cbdata); + return rc; } /* if we aren't connected, don't attempt to send */ @@ -177,6 +335,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque PMIX_RELEASE(cd); return rc; } + pmix_output_verbose(2, pmix_globals.debug_output, "pmix:query sending to server"); PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c index 7ee50b50fa9..48a2d5c7a19 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_strings.c @@ -12,6 +12,8 @@ * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -241,25 +243,24 @@ PMIX_EXPORT const char* PMIx_IOF_channel_string(pmix_iof_channel_t channel) { size_t cnt=0; - memset(answer, 0, sizeof(answer)); if (PMIX_FWD_STDIN_CHANNEL & channel) { - strncpy(&answer[cnt], "STDIN ", strlen("STDIN ")); + strcpy(&answer[cnt], "STDIN "); cnt += strlen("STDIN "); } if (PMIX_FWD_STDOUT_CHANNEL & channel) { - strncpy(&answer[cnt], "STDOUT ", strlen("STDOUT ")); + strcpy(&answer[cnt], "STDOUT "); cnt += strlen("STDOUT "); } if (PMIX_FWD_STDERR_CHANNEL & channel) { - strncpy(&answer[cnt], "STDERR ", strlen("STDERR ")); + strcpy(&answer[cnt], "STDERR "); cnt += strlen("STDERR "); } if (PMIX_FWD_STDDIAG_CHANNEL & channel) { - strncpy(&answer[cnt], "STDDIAG ", strlen("STDDIAG ")); + strcpy(&answer[cnt], "STDDIAG "); cnt += strlen("STDDIAG "); } if (0 == cnt) { - strncpy(&answer[cnt], "NONE", strlen("NONE")); + strcpy(&answer[cnt], "NONE"); } return answer; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h index 1cd7d3fe719..6ba6b774932 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h @@ -172,63 +172,84 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, void pmix_event_timeout_cb(int fd, short flags, void *arg); -#define PMIX_REPORT_EVENT(e, p, r, f) \ - do { \ - pmix_event_chain_t *ch, *cp; \ - size_t n, ninfo; \ - pmix_info_t *info; \ - pmix_proc_t proc; \ - \ - ch = NULL; \ - /* see if we already have this event cached */ \ - PMIX_LIST_FOREACH(cp, &pmix_globals.cached_events, pmix_event_chain_t) { \ - if (cp->status == (e)) { \ - ch = cp; \ - break; \ - } \ - } \ - if (NULL == ch) { \ - /* nope - need to add it */ \ - ch = PMIX_NEW(pmix_event_chain_t); \ - ch->status = (e); \ - ch->range = (r); \ - (void)strncpy(ch->source.nspace, \ - (p)->nptr->nspace, \ - PMIX_MAX_NSLEN); \ - ch->source.rank = (p)->info->pname.rank; \ - ch->ninfo = 0; \ - ch->nallocated = 2; \ - ch->final_cbfunc = (f); \ - ch->final_cbdata = ch; \ - PMIX_INFO_CREATE(ch->info, ch->nallocated); \ - /* cache it */ \ - pmix_list_append(&pmix_globals.cached_events, &ch->super); \ - ch->timer_active = true; \ - pmix_event_assign(&ch->ev, pmix_globals.evbase, -1, 0, \ - pmix_event_timeout_cb, ch); \ - PMIX_POST_OBJECT(ch); \ - pmix_event_add(&ch->ev, &pmix_globals.event_window); \ - } else { \ - /* add this peer to the array of sources */ \ - (void)strncpy(proc.nspace, (p)->nptr->nspace, PMIX_MAX_NSLEN); \ - proc.rank = (p)->info->pname.rank; \ - ninfo = ch->nallocated + 1; \ - PMIX_INFO_CREATE(info, ninfo); \ - /* must keep the hdlr name and return object at the end, so prepend */ \ - PMIX_INFO_LOAD(&info[0], PMIX_PROCID, \ - &proc, PMIX_PROC); \ - for (n=0; n < ch->ninfo; n++) { \ - PMIX_INFO_XFER(&info[n+1], &ch->info[n]); \ - } \ - PMIX_INFO_FREE(ch->info, ch->nallocated); \ - ch->nallocated = ninfo; \ - ch->info = info; \ - ch->ninfo = ninfo - 2; \ - /* reset the timer */ \ - pmix_event_del(&ch->ev); \ - PMIX_POST_OBJECT(ch); \ - pmix_event_add(&ch->ev, &pmix_globals.event_window); \ - } \ +#define PMIX_REPORT_EVENT(e, p, r, f) \ + do { \ + pmix_event_chain_t *ch, *cp; \ + size_t n, ninfo; \ + pmix_info_t *info; \ + pmix_proc_t proc; \ + \ + ch = NULL; \ + /* see if we already have this event cached */ \ + PMIX_LIST_FOREACH(cp, &pmix_globals.cached_events, pmix_event_chain_t) { \ + if (cp->status == (e)) { \ + ch = cp; \ + break; \ + } \ + } \ + if (NULL == ch) { \ + /* nope - need to add it */ \ + ch = PMIX_NEW(pmix_event_chain_t); \ + ch->status = (e); \ + ch->range = (r); \ + PMIX_LOAD_PROCID(&ch->source, (p)->nptr->nspace, \ + (p)->info->pname.rank); \ + PMIX_PROC_CREATE(ch->affected, 1); \ + ch->naffected = 1; \ + PMIX_LOAD_PROCID(ch->affected, (p)->nptr->nspace, \ + (p)->info->pname.rank); \ + /* if I'm a client or tool and this is my server, then we don't */ \ + /* set the targets - otherwise, we do */ \ + if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && \ + !PMIX_CHECK_PROCID(&pmix_client_globals.myserver->info->pname, \ + &(p)->info->pname)) { \ + PMIX_PROC_CREATE(ch->targets, 1); \ + ch->ntargets = 1; \ + PMIX_LOAD_PROCID(ch->targets, (p)->nptr->nspace, PMIX_RANK_WILDCARD); \ + } \ + /* if this is lost-connection-to-server, then we let it go to */ \ + /* the default event handler - otherwise, we don't */ \ + if (PMIX_ERR_LOST_CONNECTION_TO_SERVER != (e) && \ + PMIX_ERR_UNREACH != (e)) { \ + ch->ninfo = 1; \ + ch->nallocated = 3; \ + PMIX_INFO_CREATE(ch->info, ch->nallocated); \ + /* mark for non-default handlers only */ \ + PMIX_INFO_LOAD(&ch->info[0], PMIX_EVENT_NON_DEFAULT, NULL, PMIX_BOOL); \ + } else { \ + ch->nallocated = 2; \ + PMIX_INFO_CREATE(ch->info, ch->nallocated); \ + } \ + ch->final_cbfunc = (f); \ + ch->final_cbdata = ch; \ + /* cache it */ \ + pmix_list_append(&pmix_globals.cached_events, &ch->super); \ + ch->timer_active = true; \ + pmix_event_assign(&ch->ev, pmix_globals.evbase, -1, 0, \ + pmix_event_timeout_cb, ch); \ + PMIX_POST_OBJECT(ch); \ + pmix_event_add(&ch->ev, &pmix_globals.event_window); \ + } else { \ + /* add this peer to the array of sources */ \ + pmix_strncpy(proc.nspace, (p)->nptr->nspace, PMIX_MAX_NSLEN); \ + proc.rank = (p)->info->pname.rank; \ + ninfo = ch->nallocated + 1; \ + PMIX_INFO_CREATE(info, ninfo); \ + /* must keep the hdlr name and return object at the end, so prepend */ \ + PMIX_INFO_LOAD(&info[0], PMIX_PROCID, \ + &proc, PMIX_PROC); \ + for (n=0; n < ch->ninfo; n++) { \ + PMIX_INFO_XFER(&info[n+1], &ch->info[n]); \ + } \ + PMIX_INFO_FREE(ch->info, ch->nallocated); \ + ch->nallocated = ninfo; \ + ch->info = info; \ + ch->ninfo = ninfo - 2; \ + /* reset the timer */ \ + pmix_event_del(&ch->ev); \ + PMIX_POST_OBJECT(ch); \ + pmix_event_add(&ch->ev, &pmix_globals.event_window); \ + } \ } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index d59cfdee170..c2585ea84ae 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * * $COPYRIGHT$ @@ -39,7 +39,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, const pmix_proc_t *source, pmix_data_range_t range, - pmix_info_t info[], size_t ninfo, + const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { int rc; @@ -51,18 +51,20 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, return PMIX_ERR_INIT; } - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); + pmix_output_verbose(2, pmix_server_globals.event_output, - "pmix_server_notify_event source = %s:%d event_status = %d", + "pmix_server_notify_event source = %s:%d event_status = %s", (NULL == source) ? "UNKNOWN" : source->nspace, - (NULL == source) ? PMIX_RANK_WILDCARD : source->rank, status); + (NULL == source) ? PMIX_RANK_WILDCARD : source->rank, PMIx_Error_string(status)); + rc = pmix_server_notify_client_of_event(status, source, range, info, ninfo, cbfunc, cbdata); - if (PMIX_SUCCESS != rc) { + + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { PMIX_ERROR_LOG(rc); } return rc; @@ -108,6 +110,49 @@ static void notify_event_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, PMIX_RELEASE(cb); } +static pmix_status_t notify_event_cache(pmix_notify_caddy_t *cd) +{ + pmix_status_t rc; + int j; + pmix_notify_caddy_t *pk; + int idx; + time_t etime; + + /* add to our cache */ + rc = pmix_hotel_checkin(&pmix_globals.notifications, cd, &cd->room); + /* if there wasn't room, then search for the longest tenured + * occupant and evict them */ + if (PMIX_SUCCESS != rc) { + etime = 0; + idx = -1; + for (j=0; j < pmix_globals.max_events; j++) { + pmix_hotel_knock(&pmix_globals.notifications, j, (void**)&pk); + if (NULL == pk) { + /* hey, there is room! */ + pmix_hotel_checkin_with_res(&pmix_globals.notifications, cd, &cd->room); + return PMIX_SUCCESS; + } + /* check the age */ + if (0 == j) { + etime = pk->ts; + idx = j; + } else { + if (difftime(pk->ts, etime) < 0) { + etime = pk->ts; + idx = j; + } + } + } + if (0 <= idx) { + /* we found the oldest occupant - evict it */ + pmix_hotel_checkout_and_return_occupant(&pmix_globals.notifications, idx, (void**)&pk); + PMIX_RELEASE(pk); + rc = pmix_hotel_checkin(&pmix_globals.notifications, cd, &cd->room); + } + } + return rc; +} + /* as a client, we pass the notification to our server */ static pmix_status_t notify_server_of_event(pmix_status_t status, const pmix_proc_t *source, @@ -121,11 +166,13 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, pmix_cb_t *cb; pmix_event_chain_t *chain; size_t n; - pmix_notify_caddy_t *cd, *rbout; + pmix_notify_caddy_t *cd; pmix_output_verbose(2, pmix_client_globals.event_output, - "client: notifying server %s:%d of status %s for range %s", + "[%s:%d] client: notifying server %s:%d of status %s for range %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, + pmix_client_globals.myserver->info->pname.nspace, + pmix_client_globals.myserver->info->pname.rank, PMIx_Error_string(status), PMIx_Data_range_string(range)); if (PMIX_RANGE_PROC_LOCAL != range) { @@ -172,7 +219,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, /* setup for our own local callbacks */ chain = PMIX_NEW(pmix_event_chain_t); chain->status = status; - (void)strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); chain->source.rank = pmix_globals.myid.rank; /* we always leave space for event hdlr name and a callback object */ chain->nallocated = ninfo + 2; @@ -185,10 +232,10 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; if (NULL == source) { - (void)strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN); + pmix_strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN); cd->source.rank = PMIX_RANK_UNDEF; } else { - (void)strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN); cd->source.rank = source->rank; } cd->range = range; @@ -200,28 +247,28 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, for (n=0; n < cd->ninfo; n++) { PMIX_INFO_XFER(&cd->info[n], &chain->info[n]); } - if (NULL != chain->targets) { - cd->ntargets = chain->ntargets; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); - } - if (NULL != chain->affected) { - cd->naffected = chain->naffected; - PMIX_PROC_CREATE(cd->affected, cd->naffected); - if (NULL == cd->affected) { - cd->naffected = 0; - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); + } + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + rc = PMIX_ERR_NOMEM; + goto cleanup; } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); } - - /* add to our cache */ - rbout = pmix_ring_buffer_push(&pmix_globals.notifications, cd); - /* if an older event was bumped, release it */ - if (NULL != rbout) { - PMIX_RELEASE(rbout); + /* cache it */ + rc = notify_event_cache(cd); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(cd); + goto cleanup; } if (PMIX_RANGE_PROC_LOCAL != range && NULL != msg) { @@ -235,8 +282,10 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, cb->cbdata = cbdata; /* send to the server */ pmix_output_verbose(2, pmix_client_globals.event_output, - "client: notifying server %s:%d - sending", - pmix_globals.myid.nspace, pmix_globals.myid.rank); + "[%s:%d] client: notifying server %s:%d - sending", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + pmix_client_globals.myserver->info->pname.nspace, + pmix_client_globals.myserver->info->pname.rank); PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, msg, notify_event_cbfunc, cb); if (PMIX_SUCCESS != rc) { @@ -306,9 +355,9 @@ static void progress_local_event_hdlr(pmix_status_t status, /* save this handler's returned status */ if (NULL != chain->evhdlr->name) { - (void)strncpy(newinfo[cnt].key, chain->evhdlr->name, PMIX_MAX_KEYLEN); + pmix_strncpy(newinfo[cnt].key, chain->evhdlr->name, PMIX_MAX_KEYLEN); } else { - (void)strncpy(newinfo[cnt].key, "UNKNOWN", PMIX_MAX_KEYLEN); + pmix_strncpy(newinfo[cnt].key, "UNKNOWN", PMIX_MAX_KEYLEN); } newinfo[cnt].value.type = PMIX_STATUS; newinfo[cnt].value.data.status = status; @@ -710,6 +759,8 @@ void pmix_invoke_local_event_hdlr(pmix_event_chain_t *chain) /* we still have to call their final callback */ if (NULL != chain->final_cbfunc) { chain->final_cbfunc(rc, chain->final_cbdata); + } else { + PMIX_RELEASE(chain); } return; @@ -756,17 +807,19 @@ static void local_cbfunc(pmix_status_t status, void *cbdata) static void _notify_client_event(int sd, short args, void *cbdata) { pmix_notify_caddy_t *cd = (pmix_notify_caddy_t*)cbdata; - pmix_notify_caddy_t *rbout; pmix_regevents_info_t *reginfoptr; pmix_peer_events_info_t *pr; pmix_event_chain_t *chain; - size_t n; + size_t n, nleft; bool matched, holdcd; pmix_buffer_t *bfr; pmix_cmd_t cmd = PMIX_NOTIFY_CMD; pmix_status_t rc; pmix_list_t trk; pmix_namelist_t *nm; + pmix_namespace_t *nptr, *tmp; + pmix_range_trkr_t rngtrk; + pmix_proc_t proc; /* need to acquire the object from its originating thread */ PMIX_ACQUIRE_OBJECT(cd); @@ -796,11 +849,9 @@ static void _notify_client_event(int sd, short args, void *cbdata) * the message until all local procs have received it, or it ages to * the point where it gets pushed out by more recent events */ PMIX_RETAIN(cd); - rbout = pmix_ring_buffer_push(&pmix_globals.notifications, cd); - - /* if an older event was bumped, release it */ - if (NULL != rbout) { - PMIX_RELEASE(rbout); + rc = notify_event_cache(cd); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); } } @@ -808,7 +859,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) * against our registrations */ chain = PMIX_NEW(pmix_event_chain_t); chain->status = cd->status; - (void)strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(chain->source.nspace, cd->source.nspace, PMIX_MAX_NSLEN); chain->source.rank = cd->source.rank; /* we always leave space for a callback object and * the evhandler name. */ @@ -817,29 +868,52 @@ static void _notify_client_event(int sd, short args, void *cbdata) /* prep the chain for processing */ pmix_prep_event_chain(chain, cd->info, cd->ninfo, true); - if (0 < cd->ninfo) { - /* copy setup to the cd object */ - cd->nondefault = chain->nondefault; - if (NULL != chain->targets) { - cd->ntargets = chain->ntargets; - PMIX_PROC_CREATE(cd->targets, cd->ntargets); - memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); - } - if (NULL != chain->affected) { - cd->naffected = chain->naffected; - PMIX_PROC_CREATE(cd->affected, cd->naffected); - if (NULL == cd->affected) { - cd->naffected = 0; - /* notify the caller */ - if (NULL != cd->cbfunc) { - cd->cbfunc(PMIX_ERR_NOMEM, cd->cbdata); + /* copy setup to the cd object */ + cd->nondefault = chain->nondefault; + if (NULL != chain->targets) { + cd->ntargets = chain->ntargets; + PMIX_PROC_CREATE(cd->targets, cd->ntargets); + memcpy(cd->targets, chain->targets, cd->ntargets * sizeof(pmix_proc_t)); + /* compute the number of targets that need to be notified */ + nleft = 0; + for (n=0; n < cd->ntargets; n++) { + /* if this is a single proc, then increment by one */ + if (PMIX_RANK_VALID >= cd->targets[n].rank) { + ++nleft; + } else { + /* look up the nspace for this proc */ + nptr = NULL; + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + if (PMIX_CHECK_NSPACE(tmp->nspace, cd->targets[n].nspace)) { + nptr = tmp; + break; + } } - PMIX_RELEASE(cd); - PMIX_RELEASE(chain); - return; + /* if we don't yet know it, then nothing to do */ + if (NULL == nptr) { + nleft = SIZE_MAX; + break; + } + /* might notify all local members */ + nleft += nptr->nlocalprocs; } - memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); } + cd->nleft = nleft; + } + if (NULL != chain->affected) { + cd->naffected = chain->naffected; + PMIX_PROC_CREATE(cd->affected, cd->naffected); + if (NULL == cd->affected) { + cd->naffected = 0; + /* notify the caller */ + if (NULL != cd->cbfunc) { + cd->cbfunc(PMIX_ERR_NOMEM, cd->cbdata); + } + PMIX_RELEASE(cd); + PMIX_RELEASE(chain); + return; + } + memcpy(cd->affected, chain->affected, cd->naffected * sizeof(pmix_proc_t)); } /* if they provided a PMIX_EVENT_CUSTOM_RANGE info object but @@ -856,10 +930,11 @@ static void _notify_client_event(int sd, short args, void *cbdata) return; } - holdcd = false; if (PMIX_RANGE_PROC_LOCAL != cd->range) { PMIX_CONSTRUCT(&trk, pmix_list_t); + rngtrk.procs = NULL; + rngtrk.nprocs = 0; /* cycle across our registered events and send the message to * any client who registered for it */ PMIX_LIST_FOREACH(reginfoptr, &pmix_server_globals.events, pmix_regevents_info_t) { @@ -883,18 +958,33 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (matched) { continue; } - /* if we were given specific targets, check if this is one */ + /* check if the affected procs (if given) match those they + * wanted to know about */ + if (!pmix_notify_check_affected(cd->affected, cd->naffected, + pr->affected, pr->naffected)) { + continue; + } + /* check the range */ + if (NULL == cd->targets) { + rngtrk.procs = &cd->source; + rngtrk.nprocs = 1; + } else { + rngtrk.procs = cd->targets; + rngtrk.nprocs = cd->ntargets; + } + rngtrk.range = cd->range; + PMIX_LOAD_PROCID(&proc, pr->peer->info->pname.nspace, pr->peer->info->pname.rank); + if (!pmix_notify_check_range(&rngtrk, &proc)) { + continue; + } if (NULL != cd->targets) { - matched = false; - for (n=0; n < cd->ntargets; n++) { - if (PMIX_CHECK_PROCID(&pr->peer->info->pname, &cd->targets[n])) { - matched = true; - break; - } - } - if (!matched) { - /* do not notify this one */ - continue; + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if the event was cached and this is the last one, + * then evict this event from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + PMIX_RELEASE(cd); } } pmix_output_verbose(2, pmix_server_globals.event_output, @@ -950,15 +1040,17 @@ static void _notify_client_event(int sd, short args, void *cbdata) continue; } } - PMIX_SERVER_QUEUE_REPLY(pr->peer, 0, bfr); + PMIX_SERVER_QUEUE_REPLY(rc, pr->peer, 0, bfr); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(bfr); + } } } } PMIX_LIST_DESTRUCT(&trk); if (PMIX_RANGE_LOCAL != cd->range && PMIX_CHECK_PROCID(&cd->source, &pmix_globals.myid)) { /* if we are the source, then we need to post this upwards as - * well so the host RM can broadcast it as necessary - we rely - * on the host RM to _not_ deliver this back to us! */ + * well so the host RM can broadcast it as necessary */ if (NULL != pmix_host_server.notify_event) { /* mark that we sent it upstairs so we don't release * the caddy until we return from the host RM */ @@ -1002,23 +1094,27 @@ pmix_status_t pmix_server_notify_client_of_event(pmix_status_t status, "pmix_server: notify client of event %s", PMIx_Error_string(status)); - /* check for prior processing */ - if (NULL != info && PMIX_CHECK_KEY(&info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY)) { - return PMIX_OPERATION_SUCCEEDED; + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_PROXY) && + PMIX_CHECK_PROCID(info[n].value.data.proc, &pmix_globals.myid)) { + return PMIX_OPERATION_SUCCEEDED; + } + } } cd = PMIX_NEW(pmix_notify_caddy_t); cd->status = status; if (NULL == source) { - (void)strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN); + pmix_strncpy(cd->source.nspace, "UNDEF", PMIX_MAX_NSLEN); cd->source.rank = PMIX_RANK_UNDEF; } else { - (void)strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->source.nspace, source->nspace, PMIX_MAX_NSLEN); cd->source.rank = source->rank; } cd->range = range; /* have to copy the info to preserve it for future when cached */ - if (0 < ninfo) { + if (0 < ninfo && NULL != info) { cd->ninfo = ninfo; PMIX_INFO_CREATE(cd->info, cd->ninfo); /* need to copy the info */ @@ -1053,37 +1149,34 @@ bool pmix_notify_check_range(pmix_range_trkr_t *rng, return true; } if (PMIX_RANGE_NAMESPACE == rng->range) { - if (0 == strncmp(pmix_globals.myid.nspace, proc->nspace, PMIX_MAX_NSLEN)) { - return true; + for (n=0; n < rng->nprocs; n++) { + if (PMIX_CHECK_NSPACE(rng->procs[n].nspace, proc->nspace)) { + return true; + } } return false; } if (PMIX_RANGE_PROC_LOCAL == rng->range) { - if (0 == strncmp(pmix_globals.myid.nspace, proc->nspace, PMIX_MAX_NSLEN) && - pmix_globals.myid.rank == proc->rank) { - return true; + for (n=0; n < rng->nprocs; n++) { + if (PMIX_CHECK_PROCID(&rng->procs[n], proc)) { + return true; + } } return false; } if (PMIX_RANGE_CUSTOM == rng->range) { - if (NULL != rng->procs) { - /* see if this proc was included */ - for (n=0; n < rng->nprocs; n++) { - if (0 != strncmp(rng->procs[n].nspace, proc->nspace, PMIX_MAX_NSLEN)) { - continue; - } - if (PMIX_RANK_WILDCARD == rng->procs[n].rank || - rng->procs[n].rank == proc->rank) { - return true; - } + /* see if this proc was included */ + for (n=0; n < rng->nprocs; n++) { + if (0 != strncmp(rng->procs[n].nspace, proc->nspace, PMIX_MAX_NSLEN)) { + continue; + } + if (PMIX_RANK_WILDCARD == rng->procs[n].rank || + rng->procs[n].rank == proc->rank) { + return true; } - /* if we get here, then this proc isn't in range */ - return false; - } else { - /* if they didn't give us a list, then assume - * everyone included */ - return true; } + /* if we get here, then this proc isn't in range */ + return false; } /* if it is anything else, then reject it */ @@ -1106,12 +1199,7 @@ bool pmix_notify_check_affected(pmix_proc_t *interested, size_t ninterested, /* check if the two overlap */ for (n=0; n < naffected; n++) { for (m=0; m < ninterested; m++) { - if (0 != strncmp(affected[n].nspace, interested[m].nspace, PMIX_MAX_NSLEN)) { - continue; - } - if (PMIX_RANK_WILDCARD == interested[m].rank || - PMIX_RANK_WILDCARD == affected[n].rank || - affected[n].rank == interested[m].rank) { + if (PMIX_CHECK_PROCID(&affected[n], &interested[m])) { return true; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c index d1c95358ffb..2607d6b101d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -95,7 +95,11 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, PMIX_BFROPS_UNPACK(rc, peer, buf, &ret, &cnt, PMIX_STATUS); if ((PMIX_SUCCESS != rc) || (PMIX_SUCCESS != ret)) { - PMIX_ERROR_LOG(rc); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } else { + PMIX_ERROR_LOG(ret); + } /* remove the err handler and call the error handler reg completion callback fn.*/ if (NULL == rb->list) { if (NULL != rb->hdlr) { @@ -293,11 +297,7 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer) PMIX_INFO_CREATE(cd2->info, cd2->ninfo); n=0; PMIX_LIST_FOREACH(ixfer, xfer, pmix_info_caddy_t) { - (void)strncpy(cd2->info[n].key, ixfer->info[n].key, PMIX_MAX_KEYLEN); - PMIX_BFROPS_VALUE_LOAD(pmix_client_globals.myserver, - &cd2->info[n].value, - &ixfer->info[n].value.data, - ixfer->info[n].value.type); + PMIX_INFO_XFER(&cd2->info[n], ixfer->info); ++n; } } @@ -333,16 +333,17 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer) NULL != pmix_host_server.register_events) { pmix_output_verbose(2, pmix_client_globals.event_output, "pmix: _add_hdlr registering with server"); - if (PMIX_SUCCESS != (rc = pmix_host_server.register_events(cd->codes, cd->ncodes, - cd2->info, cd2->ninfo, - reg_cbfunc, cd2))) { + rc = pmix_host_server.register_events(cd->codes, cd->ncodes, + cd2->info, cd2->ninfo, + reg_cbfunc, cd2); + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { if (NULL != cd2->info) { PMIX_INFO_FREE(cd2->info, cd2->ninfo); } PMIX_RELEASE(cd2); return rc; } - return PMIX_ERR_WOULD_BLOCK; + return PMIX_SUCCESS; } else { if (NULL != cd2->info) { PMIX_INFO_FREE(cd2->info, cd2->ninfo); @@ -355,13 +356,15 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer) static void check_cached_events(pmix_rshift_caddy_t *cd) { - size_t i, n; + size_t n; pmix_notify_caddy_t *ncd; bool found, matched; pmix_event_chain_t *chain; + int j; - for (i=0; i < (size_t)pmix_globals.notifications.size; i++) { - if (NULL == (ncd = (pmix_notify_caddy_t*)pmix_ring_buffer_poke(&pmix_globals.notifications, i))) { + for (j=0; j < pmix_globals.max_events; j++) { + pmix_hotel_knock(&pmix_globals.notifications, j, (void**)&ncd); + if (NULL == ncd) { continue; } found = false; @@ -381,15 +384,11 @@ static void check_cached_events(pmix_rshift_caddy_t *cd) if (!found) { continue; } - /* if we were given specific targets, check if we are one */ + /* if we were given specific targets, check if we are one */ if (NULL != ncd->targets) { matched = false; for (n=0; n < ncd->ntargets; n++) { - if (0 != strncmp(pmix_globals.myid.nspace, ncd->targets[n].nspace, PMIX_MAX_NSLEN)) { - continue; - } - if (PMIX_RANK_WILDCARD == ncd->targets[n].rank || - pmix_globals.myid.rank == ncd->targets[n].rank) { + if (PMIX_CHECK_PROCID(&pmix_globals.myid, &ncd->targets[n])) { matched = true; break; } @@ -407,7 +406,7 @@ static void check_cached_events(pmix_rshift_caddy_t *cd) /* create the chain */ chain = PMIX_NEW(pmix_event_chain_t); chain->status = ncd->status; - (void)strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(chain->source.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); chain->source.rank = pmix_globals.myid.rank; /* we always leave space for event hdlr name and a callback object */ chain->nallocated = ncd->ninfo + 2; @@ -439,6 +438,12 @@ static void check_cached_events(pmix_rshift_caddy_t *cd) } } } + /* check this event out of the cache since we + * are processing it */ + pmix_hotel_checkout(&pmix_globals.notifications, ncd->room); + /* release the storage */ + PMIX_RELEASE(ncd); + /* we don't want this chain to propagate, so indicate it * should only be run as a single-shot */ chain->endchain = true; @@ -493,8 +498,6 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) } } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_HDLR_NAME, PMIX_MAX_KEYLEN)) { name = cd->info[n].value.data.string; - } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_ENVIRO_LEVEL, PMIX_MAX_KEYLEN)) { - cd->enviro = PMIX_INFO_TRUE(&cd->info[n]); } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_RETURN_OBJECT, PMIX_MAX_KEYLEN)) { cbobject = cd->info[n].value.data.ptr; } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_HDLR_FIRST_IN_CATEGORY, PMIX_MAX_KEYLEN)) { @@ -519,17 +522,34 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { cd->affected = cd->info[n].value.data.proc; cd->naffected = 1; + ixfer = PMIX_NEW(pmix_info_caddy_t); + ixfer->info = &cd->info[n]; + ixfer->ninfo = 1; + pmix_list_append(&xfer, &ixfer->super); } else if (0 == strncmp(cd->info[n].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) { cd->affected = (pmix_proc_t*)cd->info[n].value.data.darray->array; cd->naffected = cd->info[n].value.data.darray->size; + ixfer = PMIX_NEW(pmix_info_caddy_t); + ixfer->info = &cd->info[n]; + ixfer->ninfo = 1; + pmix_list_append(&xfer, &ixfer->super); } else { ixfer = PMIX_NEW(pmix_info_caddy_t); ixfer->info = &cd->info[n]; + ixfer->ninfo = 1; pmix_list_append(&xfer, &ixfer->super); } } } + /* check the codes for system events */ + for (n=0; n < cd->ncodes; n++) { + if (PMIX_SYSTEM_EVENT(cd->codes[n])) { + cd->enviro = true; + break; + } + } + /* if they indicated this is to be the "first" or "last" event, then * first check to ensure they didn't already direct some * other event into the same cherished position */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h index 1e731323b71..7468985a049 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc-internal.h @@ -3,7 +3,7 @@ * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -22,7 +22,7 @@ #include #if PMIX_HAVE_HWLOC -#include +#include PMIX_HWLOC_HEADER #if HWLOC_API_VERSION < 0x00010b00 #define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE diff --git a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c index 84050ef7bb2..14dbae90765 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c +++ b/opal/mca/pmix/pmix3x/pmix/src/hwloc/hwloc.c @@ -82,7 +82,7 @@ static int set_flags(hwloc_topology_t topo, unsigned int flags) } return PMIX_SUCCESS; } -#endif +#endif // have_hwloc pmix_status_t pmix_hwloc_get_topology(pmix_info_t *info, size_t ninfo) { @@ -493,7 +493,7 @@ pmix_status_t pmix_hwloc_get_topology(pmix_info_t *info, size_t ninfo) return PMIX_SUCCESS; #else // PMIX_HAVE_HWLOC - return PMIX_ERR_NOT_SUPPORTED; + return PMIX_SUCCESS; #endif } diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include b/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include index 7fcbe03aeb1..4ab3952e1c9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include +++ b/opal/mca/pmix/pmix3x/pmix/src/include/Makefile.include @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. # Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -41,7 +41,8 @@ headers += \ include/pmix_config_top.h \ include/pmix_config_bottom.h \ include/pmix_portable_platform.h \ - include/frameworks.h + include/frameworks.h \ + include/pmix_stdatomic.h endif ! PMIX_EMBEDDED_MODE diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h index 8e9cf2a1131..bea74d6e290 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_config_bottom.h @@ -13,7 +13,7 @@ * Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -573,4 +573,5 @@ typedef PMIX_PTRDIFF_TYPE ptrdiff_t; #undef HAVE_CONFIG_H #endif /* PMIX_BUILDING */ + #endif /* PMIX_CONFIG_BOTTOM_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c index 8096896b24e..8959ba56845 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c @@ -1,9 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -96,7 +96,7 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cleanup_dir_t, pmix_list_item_t, cdcon, cddes); -static void nscon(pmix_nspace_t *p) +static void nscon(pmix_namespace_t *p) { p->nspace = NULL; p->nprocs = 0; @@ -113,7 +113,7 @@ static void nscon(pmix_nspace_t *p) PMIX_CONSTRUCT(&p->epilog.ignores, pmix_list_t); PMIX_CONSTRUCT(&p->setup_data, pmix_list_t); } -static void nsdes(pmix_nspace_t *p) +static void nsdes(pmix_namespace_t *p) { if (NULL != p->nspace) { free(p->nspace); @@ -130,7 +130,7 @@ static void nsdes(pmix_nspace_t *p) PMIX_LIST_DESTRUCT(&p->epilog.ignores); PMIX_LIST_DESTRUCT(&p->setup_data); } -PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_nspace_t, +PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_namespace_t, pmix_list_item_t, nscon, nsdes); @@ -238,6 +238,9 @@ static void iofreqdes(pmix_iof_req_t *p) if (NULL != p->peer) { PMIX_RELEASE(p->peer); } + if (NULL != p->pname.nspace) { + free(p->pname.nspace); + } } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_iof_req_t, pmix_list_item_t, @@ -344,6 +347,8 @@ static void qdes(pmix_query_caddy_t *p) { PMIX_DESTRUCT_LOCK(&p->lock); PMIX_BYTE_OBJECT_DESTRUCT(&p->bo); + PMIX_PROC_FREE(p->targets, p->ntargets); + PMIX_INFO_FREE(p->info, p->ninfo); } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t, pmix_object_t, @@ -355,32 +360,38 @@ void pmix_execute_epilog(pmix_epilog_t *epi) pmix_cleanup_dir_t *cd, *cdnext; struct stat statbuf; int rc; + char **tmp; + size_t n; /* start with any specified files */ PMIX_LIST_FOREACH_SAFE(cf, cfnext, &epi->cleanup_files, pmix_cleanup_file_t) { /* check the effective uid/gid of the file and ensure it * matches that of the peer - we do this to provide at least * some minimum level of protection */ - rc = stat(cf->path, &statbuf); - if (0 != rc) { - pmix_output_verbose(10, pmix_globals.debug_output, - "File %s failed to stat: %d", cf->path, rc); - continue; - } - if (statbuf.st_uid != epi->uid || - statbuf.st_gid != epi->gid) { - pmix_output_verbose(10, pmix_globals.debug_output, - "File %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)", - cf->path, - (unsigned long)statbuf.st_uid, (unsigned long)epi->uid, - (unsigned long)statbuf.st_gid, (unsigned long)epi->gid); - continue; - } - rc = unlink(cf->path); - if (0 != rc) { - pmix_output_verbose(10, pmix_globals.debug_output, - "File %s failed to unlink: %d", cf->path, rc); + tmp = pmix_argv_split(cf->path, ','); + for (n=0; NULL != tmp[n]; n++) { + rc = stat(tmp[n], &statbuf); + if (0 != rc) { + pmix_output_verbose(10, pmix_globals.debug_output, + "File %s failed to stat: %d", tmp[n], rc); + continue; + } + if (statbuf.st_uid != epi->uid || + statbuf.st_gid != epi->gid) { + pmix_output_verbose(10, pmix_globals.debug_output, + "File %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)", + cf->path, + (unsigned long)statbuf.st_uid, (unsigned long)epi->uid, + (unsigned long)statbuf.st_gid, (unsigned long)epi->gid); + continue; + } + rc = unlink(tmp[n]); + if (0 != rc) { + pmix_output_verbose(10, pmix_globals.debug_output, + "File %s failed to unlink: %d", tmp[n], rc); + } } + pmix_argv_free(tmp); pmix_list_remove_item(&epi->cleanup_files, &cf->super); PMIX_RELEASE(cf); } @@ -390,27 +401,31 @@ void pmix_execute_epilog(pmix_epilog_t *epi) /* check the effective uid/gid of the file and ensure it * matches that of the peer - we do this to provide at least * some minimum level of protection */ - rc = stat(cd->path, &statbuf); - if (0 != rc) { - pmix_output_verbose(10, pmix_globals.debug_output, - "Directory %s failed to stat: %d", cd->path, rc); - continue; - } - if (statbuf.st_uid != epi->uid || - statbuf.st_gid != epi->gid) { - pmix_output_verbose(10, pmix_globals.debug_output, - "Directory %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)", - cd->path, - (unsigned long)statbuf.st_uid, (unsigned long)epi->uid, - (unsigned long)statbuf.st_gid, (unsigned long)epi->gid); - continue; - } - if ((statbuf.st_mode & S_IRWXU) == S_IRWXU) { - dirpath_destroy(cd->path, cd, epi); - } else { - pmix_output_verbose(10, pmix_globals.debug_output, - "Directory %s lacks permissions", cd->path); + tmp = pmix_argv_split(cd->path, ','); + for (n=0; NULL != tmp[n]; n++) { + rc = stat(tmp[n], &statbuf); + if (0 != rc) { + pmix_output_verbose(10, pmix_globals.debug_output, + "Directory %s failed to stat: %d", tmp[n], rc); + continue; + } + if (statbuf.st_uid != epi->uid || + statbuf.st_gid != epi->gid) { + pmix_output_verbose(10, pmix_globals.debug_output, + "Directory %s uid/gid doesn't match: uid %lu(%lu) gid %lu(%lu)", + cd->path, + (unsigned long)statbuf.st_uid, (unsigned long)epi->uid, + (unsigned long)statbuf.st_gid, (unsigned long)epi->gid); + continue; + } + if ((statbuf.st_mode & S_IRWXU) == S_IRWXU) { + dirpath_destroy(tmp[n], cd, epi); + } else { + pmix_output_verbose(10, pmix_globals.debug_output, + "Directory %s lacks permissions", tmp[n]); + } } + pmix_argv_free(tmp); pmix_list_remove_item(&epi->cleanup_dirs, &cd->super); PMIX_RELEASE(cd); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 9f565214a76..212b5b51014 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,7 +36,7 @@ #include "src/class/pmix_hash_table.h" #include "src/class/pmix_list.h" -#include "src/class/pmix_ring_buffer.h" +#include "src/class/pmix_hotel.h" #include "src/event/pmix_event.h" #include "src/threads/threads.h" @@ -178,14 +178,14 @@ typedef struct { // from this nspace pmix_list_t setup_data; // list of pmix_kval_t containing info structs having blobs // for setting up the local node for this nspace/application -} pmix_nspace_t; -PMIX_CLASS_DECLARATION(pmix_nspace_t); +} pmix_namespace_t; +PMIX_CLASS_DECLARATION(pmix_namespace_t); -/* define a caddy for quickly creating a list of pmix_nspace_t +/* define a caddy for quickly creating a list of pmix_namespace_t * objects for local, dedicated purposes */ typedef struct { pmix_list_item_t super; - pmix_nspace_t *ns; + pmix_namespace_t *ns; } pmix_nspace_caddy_t; PMIX_CLASS_DECLARATION(pmix_nspace_caddy_t); @@ -219,7 +219,7 @@ PMIX_CLASS_DECLARATION(pmix_info_caddy_t); * by the socket, not the process nspace/rank */ typedef struct pmix_peer_t { pmix_object_t super; - pmix_nspace_t *nptr; // point to the nspace object for this process + pmix_namespace_t *nptr; // point to the nspace object for this process pmix_rank_info_t *info; pmix_proc_type_t proc_type; pmix_listener_protocol_t protocol; @@ -278,6 +278,11 @@ PMIX_CLASS_DECLARATION(pmix_query_caddy_t); * - instanced in pmix_server_ops.c */ typedef struct { pmix_list_item_t super; + pmix_event_t ev; + bool event_active; + bool lost_connection; // tracker went thru lost connection procedure + bool local; // operation is strictly local + char *id; // string identifier for the collective pmix_cmd_t type; pmix_proc_t pname; bool hybrid; // true if participating procs are from more than one nspace @@ -295,6 +300,7 @@ typedef struct { pmix_collect_t collect_type; // whether or not data is to be returned at completion pmix_modex_cbfunc_t modexcbfunc; pmix_op_cbfunc_t op_cbfunc; + void *cbdata; } pmix_server_trkr_t; PMIX_CLASS_DECLARATION(pmix_server_trkr_t); @@ -340,6 +346,7 @@ PMIX_CLASS_DECLARATION(pmix_server_caddy_t); pmix_release_cbfunc_t relfn; pmix_hdlr_reg_cbfunc_t hdlrregcbfn; pmix_op_cbfunc_t opcbfn; + pmix_modex_cbfunc_t modexcbfunc; } cbfunc; void *cbdata; size_t ref; @@ -394,6 +401,11 @@ typedef struct { pmix_object_t super; pmix_event_t ev; pmix_lock_t lock; + /* timestamp receipt of the notification so we + * can evict the oldest one if we get overwhelmed */ + time_t ts; + /* what room of the hotel they are in */ + int room; pmix_status_t status; pmix_proc_t source; pmix_data_range_t range; @@ -403,6 +415,7 @@ typedef struct { */ pmix_proc_t *targets; size_t ntargets; + size_t nleft; // number of targets left to be notified /* When generating a notification, the originator can * specify the range of procs affected by this event. * For example, when creating a JOB_TERMINATED event, @@ -438,6 +451,8 @@ typedef struct { pmix_peer_t *mypeer; // my own peer object uid_t uid; // my effective uid gid_t gid; // my effective gid + char *hostname; // my hostname + uint32_t nodeid; // my nodeid, if given int pindex; pmix_event_base_t *evbase; bool external_evbase; @@ -448,7 +463,9 @@ typedef struct { struct timeval event_window; pmix_list_t cached_events; // events waiting in the window prior to processing pmix_list_t iof_requests; // list of pmix_iof_req_t IOF requests - pmix_ring_buffer_t notifications; // ring buffer of pending notifications + int max_events; // size of the notifications hotel + int event_eviction_time; // max time to cache notifications + pmix_hotel_t notifications; // hotel of pending notifications /* processes also need a place where they can store * their own internal data - e.g., data provided by * the user via the store_internal interface, as well diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h new file mode 100644 index 00000000000..eb9562a6e6d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdatomic.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#if !defined(PMIX_STDATOMIC_H) +#define PMIX_STDATOMIC_H + +#include "pmix_stdint.h" + +#if PMIX_ASSEMBLY_BUILTIN != PMIX_BUILTIN_C11 + +typedef volatile int pmix_atomic_int_t; +typedef volatile long pmix_atomic_long_t; + +typedef volatile int32_t pmix_atomic_int32_t; +typedef volatile uint32_t pmix_atomic_uint32_t; +typedef volatile int64_t pmix_atomic_int64_t; +typedef volatile uint64_t pmix_atomic_uint64_t; + +typedef volatile size_t pmix_atomic_size_t; +typedef volatile ssize_t pmix_atomic_ssize_t; +typedef volatile intptr_t pmix_atomic_intptr_t; +typedef volatile uintptr_t pmix_atomic_uintptr_t; + +#else /* PMIX_HAVE_C__ATOMIC */ + +#include + +typedef atomic_int pmix_atomic_int_t; +typedef atomic_long pmix_atomic_long_t; + +typedef _Atomic int32_t pmix_atomic_int32_t; +typedef _Atomic uint32_t pmix_atomic_uint32_t; +typedef _Atomic int64_t pmix_atomic_int64_t; +typedef _Atomic uint64_t pmix_atomic_uint64_t; + +typedef _Atomic size_t pmix_atomic_size_t; +typedef _Atomic ssize_t pmix_atomic_ssize_t; +typedef _Atomic intptr_t pmix_atomic_intptr_t; +typedef _Atomic uintptr_t pmix_atomic_uintptr_t; + +#endif /* PMIX_HAVE_C__ATOMIC */ + +#if HAVE_PMIX_INT128_T + +/* do not use C11 atomics for __int128 if they are not lock free */ +#if PMIX_HAVE_C11_CSWAP_INT128 + +typedef _Atomic pmix_int128_t pmix_atomic_int128_t; + +#else + +typedef volatile pmix_int128_t pmix_atomic_int128_t; + +#endif + +#endif + +#endif /* !defined(PMIX_STDATOMIC_H) */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdint.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdint.h index 28c3099ef37..86d1cc7afe1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdint.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_stdint.h @@ -14,7 +14,7 @@ * reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,8 @@ #ifndef PMIX_STDINT_H #define PMIX_STDINT_H 1 +#include "pmix_config.h" + /* * Include what we can and define what is missing. */ @@ -125,3 +127,4 @@ typedef unsigned long long uintptr_t; #endif #endif /* PMIX_STDINT_H */ + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c index d34e32b7b09..eb7dda21b56 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -164,12 +164,12 @@ static int process_repository_item (const char *filename, void *data) return PMIX_ERR_OUT_OF_RESOURCE; } - /* strncpy does not guarantee a \0 */ + /* pmix_strncpy does not guarantee a \0 */ ri->ri_type[PMIX_MCA_BASE_MAX_TYPE_NAME_LEN] = '\0'; - strncpy (ri->ri_type, type, PMIX_MCA_BASE_MAX_TYPE_NAME_LEN); + pmix_strncpy (ri->ri_type, type, PMIX_MCA_BASE_MAX_TYPE_NAME_LEN); ri->ri_name[PMIX_MCA_BASE_MAX_TYPE_NAME_LEN] = '\0'; - strncpy (ri->ri_name, name, PMIX_MCA_BASE_MAX_COMPONENT_NAME_LEN); + pmix_strncpy (ri->ri_name, name, PMIX_MCA_BASE_MAX_COMPONENT_NAME_LEN); pmix_list_append (component_list, &ri->super); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h index 318f076fdca..41ee2de2663 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/base.h @@ -205,6 +205,12 @@ PMIX_EXPORT extern pmix_bfrops_globals_t pmix_bfrops_globals; free(tmpbuf); \ } while (0) +/* for backwards compatibility */ +typedef struct pmix_info_array { + size_t size; + pmix_info_t *array; +} pmix_info_array_t; + /** * Internal struct used for holding registered bfrop functions @@ -268,7 +274,7 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_stub_copy_payload(struct pmix_peer_t *peer pmix_buffer_t *src); PMIX_EXPORT pmix_status_t pmix_bfrops_stub_value_xfer(struct pmix_peer_t *peer, pmix_value_t *dest, - pmix_value_t *src); + const pmix_value_t *src); PMIX_EXPORT void pmix_bfrops_stub_value_load(struct pmix_peer_t *peer, pmix_value_t *v, void *data, pmix_data_type_t type); @@ -496,9 +502,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_string(char **dest, char *src, PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_value(pmix_value_t **dest, pmix_value_t *src, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest, - pmix_info_array_t *src, - pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, pmix_data_type_t type); @@ -514,9 +517,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_buf(pmix_buffer_t **dest, PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_kval(pmix_kval_t **dest, pmix_kval_t *src, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest, - pmix_modex_data_t *src, - pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, pmix_data_type_t type); @@ -538,10 +538,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest, PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest, pmix_envar_t *src, pmix_data_type_t type); -/**** DEPRECATED ****/ -PMIX_EXPORT pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest, - pmix_info_array_t *src, - pmix_data_type_t type); /* * "Standard" print functions @@ -596,8 +592,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_status(char **output, char *pre PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_value(char **output, char *prefix, pmix_value_t *src, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_array(char **output, char *prefix, - pmix_info_array_t *src, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_proc(char **output, char *prefix, pmix_proc_t *src, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_app(char **output, char *prefix, @@ -608,8 +602,6 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_buf(char **output, char *prefix pmix_buffer_t *src, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_kval(char **output, char *prefix, pmix_kval_t *src, pmix_data_type_t type); -PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_modex(char **output, char *prefix, - pmix_modex_data_t *src, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_persist(char **output, char *prefix, pmix_persistence_t *src, pmix_data_type_t type); PMIX_EXPORT pmix_status_t pmix_bfrops_base_print_bo(char **output, char *prefix, @@ -678,7 +670,7 @@ PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_unload(pmix_value_t *kv, size_t *sz); PMIX_EXPORT pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p, - pmix_value_t *src); + const pmix_value_t *src); PMIX_EXPORT pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p, pmix_value_t *p1); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c index 481eb69e76a..d5bf41e94fd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_copy.c @@ -236,7 +236,7 @@ pmix_status_t pmix_bfrops_base_copy_info(pmix_info_t **dest, pmix_data_type_t type) { *dest = (pmix_info_t*)malloc(sizeof(pmix_info_t)); - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); (*dest)->flags = src->flags; return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value); } @@ -267,7 +267,7 @@ pmix_status_t pmix_bfrops_base_copy_app(pmix_app_t **dest, (*dest)->ninfo = src->ninfo; (*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t)); for (j=0; j < src->ninfo; j++) { - (void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value); } return PMIX_SUCCESS; @@ -300,32 +300,11 @@ pmix_status_t pmix_bfrops_base_copy_proc(pmix_proc_t **dest, if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; } - (void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); (*dest)->rank = src->rank; return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_copy_modex(pmix_modex_data_t **dest, - pmix_modex_data_t *src, - pmix_data_type_t type) -{ - *dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t)); - if (NULL == *dest) { - return PMIX_ERR_OUT_OF_RESOURCE; - } - (*dest)->blob = NULL; - (*dest)->size = 0; - if (NULL != src->blob) { - (*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t)); - if (NULL == (*dest)->blob) { - return PMIX_ERR_OUT_OF_RESOURCE; - } - memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t)); - (*dest)->size = src->size; - } - return PMIX_SUCCESS; -} - pmix_status_t pmix_bfrop_base_copy_persist(pmix_persistence_t **dest, pmix_persistence_t *src, pmix_data_type_t type) @@ -357,9 +336,9 @@ pmix_status_t pmix_bfrops_base_copy_pdata(pmix_pdata_t **dest, pmix_data_type_t type) { *dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t)); - (void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); (*dest)->proc.rank = src->proc.rank; - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); return pmix_bfrops_base_value_xfer(&(*dest)->value, &src->value); } @@ -405,7 +384,6 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest, pmix_buffer_t *pb, *sb; pmix_byte_object_t *pbo, *sbo; pmix_kval_t *pk, *sk; - pmix_modex_data_t *pm, *sm; pmix_proc_info_t *pi, *si; pmix_query_t *pq, *sq; pmix_envar_t *pe, *se; @@ -699,31 +677,6 @@ pmix_status_t pmix_bfrops_base_copy_darray(pmix_data_array_t **dest, } } break; - case PMIX_MODEX: - PMIX_MODEX_CREATE(p->array, src->size); - if (NULL == p->array) { - free(p); - return PMIX_ERR_NOMEM; - } - pm = (pmix_modex_data_t*)p->array; - sm = (pmix_modex_data_t*)src->array; - for (n=0; n < src->size; n++) { - memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t)); - if (NULL != sm[n].blob && 0 < sm[n].size) { - pm[n].blob = (uint8_t*)malloc(sm[n].size); - if (NULL == pm[n].blob) { - PMIX_MODEX_FREE(pm, src->size); - free(p); - return PMIX_ERR_NOMEM; - } - memcpy(pm[n].blob, sm[n].blob, sm[n].size); - pm[n].size = sm[n].size; - } else { - pm[n].blob = NULL; - pm[n].size = 0; - } - } - break; case PMIX_PERSIST: p->array = (pmix_persistence_t*)malloc(src->size * sizeof(pmix_persistence_t)); if (NULL == p->array) { @@ -876,32 +829,6 @@ pmix_status_t pmix_bfrops_base_copy_query(pmix_query_t **dest, return PMIX_SUCCESS; } -/**** DEPRECATED ****/ -pmix_status_t pmix_bfrops_base_copy_array(pmix_info_array_t **dest, - pmix_info_array_t *src, - pmix_data_type_t type) -{ - pmix_info_t *d1, *s1; - - *dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); - if (NULL == (*dest)) { - return PMIX_ERR_NOMEM; - } - (*dest)->size = src->size; - if (0 < src->size) { - (*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t)); - if (NULL == (*dest)->array) { - free(*dest); - return PMIX_ERR_NOMEM; - } - d1 = (pmix_info_t*)(*dest)->array; - s1 = (pmix_info_t*)src->array; - memcpy(d1, s1, src->size * sizeof(pmix_info_t)); - } - return PMIX_SUCCESS; -} -/*******************/ - pmix_status_t pmix_bfrops_base_copy_envar(pmix_envar_t **dest, pmix_envar_t *src, pmix_data_type_t type) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c index bcd083baf57..e93f14889a0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_fns.c @@ -46,7 +46,7 @@ PMIX_EXPORT pmix_status_t pmix_value_unload(pmix_value_t *kv, } PMIX_EXPORT pmix_status_t pmix_value_xfer(pmix_value_t *dest, - pmix_value_t *src) + const pmix_value_t *src) { return pmix_bfrops_base_value_xfer(dest, src); } @@ -509,11 +509,8 @@ pmix_value_cmp_t pmix_bfrops_base_value_cmp(pmix_value_t *p, /* Xfer FUNCTIONS FOR GENERIC PMIX TYPES */ pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p, - pmix_value_t *src) + const pmix_value_t *src) { - size_t n; - pmix_info_t *p1, *s1; - /* copy the right field */ p->type = src->type; switch (src->type) { @@ -643,22 +640,6 @@ pmix_status_t pmix_bfrops_base_value_xfer(pmix_value_t *p, p->data.envar.separator = src->data.envar.separator; break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - p->data.array->size = src->data.array->size; - if (0 < src->data.array->size) { - p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t)); - if (NULL == p->data.array->array) { - return PMIX_ERR_NOMEM; - } - p1 = (pmix_info_t*)p->data.array->array; - s1 = (pmix_info_t*)src->data.array->array; - for (n=0; n < src->data.darray->size; n++) { - PMIX_INFO_XFER(&p1[n], &s1[n]); - } - } - break; - /********************/ default: pmix_output(0, "PMIX-XFER-VALUE: UNSUPPORTED TYPE %d", (int)src->type); return PMIX_ERROR; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c index 2e66dfe57b2..4045d874ecf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_pack.c @@ -703,28 +703,6 @@ pmix_status_t pmix_bfrops_base_pack_kval(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_pack_modex(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - pmix_modex_data_t *ptr; - int32_t i; - int ret; - - ptr = (pmix_modex_data_t *) src; - - for (i = 0; i < num_vals; ++i) { - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { - return ret; - } - if( 0 < ptr[i].size){ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { - return ret; - } - } - } - return PMIX_SUCCESS; -} - pmix_status_t pmix_bfrops_base_pack_persist(pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { @@ -1007,13 +985,6 @@ pmix_status_t pmix_bfrops_base_pack_darray(pmix_buffer_t *buffer, const void *sr } break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_array(buffer, p[i].array, p[i].size, PMIX_INFO_ARRAY))) { - return ret; - } - break; - /********************/ default: pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", __FILE__, __LINE__, (int)p[i].type); @@ -1236,17 +1207,10 @@ pmix_status_t pmix_bfrops_base_pack_val(pmix_buffer_t *buffer, } break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_array(buffer, p->data.array, 1, PMIX_INFO_ARRAY))) { - return ret; - } - break; - /********************/ default: - pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", - __FILE__, __LINE__, (int)p->type); - return PMIX_ERROR; + pmix_output(0, "PACK-PMIX-VALUE[%s:%d]: UNSUPPORTED TYPE %d", + __FILE__, __LINE__, (int)p->type); + return PMIX_ERROR; } return PMIX_SUCCESS; } @@ -1257,33 +1221,6 @@ pmix_status_t pmix_bfrops_base_pack_alloc_directive(pmix_buffer_t *buffer, const return pmix_bfrops_base_pack_byte(buffer, src, num_vals, PMIX_UINT8); } - -/**** DEPRECATED ****/ -pmix_status_t pmix_bfrops_base_pack_array(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) -{ - pmix_info_array_t *ptr; - int32_t i; - pmix_status_t ret; - - ptr = (pmix_info_array_t *) src; - - for (i = 0; i < num_vals; ++i) { - /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { - return ret; - } - if (0 < ptr[i].size) { - /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { - return ret; - } - } - } - - return PMIX_SUCCESS; -} - pmix_status_t pmix_bfrops_base_pack_iof_channel(pmix_buffer_t *buffer, const void *src, int32_t num_vals, pmix_data_type_t type) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c index c02fce285b1..d17a731257b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_print.c @@ -1021,12 +1021,6 @@ int pmix_bfrops_base_print_status(char **output, char *prefix, src->data.envar.separator); break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - rc = asprintf(output, "%sPMIX_VALUE: Data type: INFO_ARRAY\tARRAY SIZE: %ld", - prefx, (long)src->data.array->size); - break; - /********************/ default: rc = asprintf(output, "%sPMIX_VALUE: Data type: UNKNOWN\tValue: UNPRINTABLE", prefx); break; @@ -1143,12 +1137,6 @@ int pmix_bfrops_base_print_kval(char **output, char *prefix, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_print_modex(char **output, char *prefix, - pmix_modex_data_t *src, pmix_data_type_t type) -{ - return PMIX_SUCCESS; -} - int pmix_bfrops_base_print_persist(char **output, char *prefix, pmix_persistence_t *src, pmix_data_type_t type) { @@ -1702,37 +1690,3 @@ pmix_status_t pmix_bfrops_base_print_envar(char **output, char *prefix, return PMIX_SUCCESS; } } - - -/**** DEPRECATED ****/ -pmix_status_t pmix_bfrops_base_print_array(char **output, char *prefix, - pmix_info_array_t *src, pmix_data_type_t type) -{ - size_t j; - char *tmp, *tmp2, *tmp3, *pfx; - pmix_info_t *s1; - - if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) { - return PMIX_ERR_NOMEM; - } - if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) { - free(tmp); - return PMIX_ERR_NOMEM; - } - s1 = (pmix_info_t*)src->array; - - for (j=0; j < src->size; j++) { - pmix_bfrops_base_print_info(&tmp2, pfx, &s1[j], PMIX_INFO); - if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) { - free(tmp); - free(tmp2); - return PMIX_ERR_NOMEM; - } - free(tmp); - free(tmp2); - tmp = tmp3; - } - *output = tmp; - return PMIX_SUCCESS; -} -/********************/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c index afd685b4374..051c35d82a6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/base/bfrop_base_unpack.c @@ -764,21 +764,9 @@ pmix_status_t pmix_bfrops_base_unpack_val(pmix_buffer_t *buffer, return ret; } break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - /* this field is now a pointer, so we must allocate storage for it */ - val->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); - if (NULL == val->data.array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_array(buffer, val->data.array, &m, PMIX_INFO_ARRAY))) { - return ret; - } - break; - /********************/ default: - pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type); - return PMIX_ERROR; + pmix_output(0, "UNPACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)val->type); + return PMIX_ERROR; } return PMIX_SUCCESS; @@ -836,7 +824,7 @@ pmix_status_t pmix_bfrops_base_unpack_info(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack the directives */ m=1; @@ -890,7 +878,7 @@ pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_buffer_t *buffer, void *dest, PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to @@ -982,7 +970,7 @@ pmix_status_t pmix_bfrops_base_unpack_proc(pmix_buffer_t *buffer, void *dest, PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; } - (void)strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); + pmix_strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); free(tmp); /* unpack the rank */ m=1; @@ -1111,38 +1099,6 @@ pmix_status_t pmix_bfrops_base_unpack_kval(pmix_buffer_t *buffer, void *dest, return PMIX_SUCCESS; } -pmix_status_t pmix_bfrops_base_unpack_modex(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - pmix_modex_data_t *ptr; - int32_t i, n, m; - pmix_status_t ret; - - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, - "pmix_bfrop_unpack: %d modex", *num_vals); - - ptr = (pmix_modex_data_t *) dest; - n = *num_vals; - - for (i = 0; i < n; ++i) { - memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); - /* unpack the number of bytes */ - m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { - return ret; - } - if (0 < ptr[i].size) { - ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); - m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { - return ret; - } - } - } - return PMIX_SUCCESS; -} - - pmix_status_t pmix_bfrops_base_unpack_persist(pmix_buffer_t *buffer, void *dest, int32_t *num_vals, pmix_data_type_t type) { @@ -1539,17 +1495,6 @@ pmix_status_t pmix_bfrops_base_unpack_darray(pmix_buffer_t *buffer, void *dest, return ret; } break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - ptr[i].array = (pmix_info_array_t*)malloc(m * sizeof(pmix_info_array_t)); - if (NULL == ptr[i].array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_array(buffer, ptr[i].array, &m, ptr[i].type))) { - return ret; - } - break; - /********************/ default: return PMIX_ERR_NOT_SUPPORTED; } @@ -1657,37 +1602,3 @@ pmix_status_t pmix_bfrops_base_unpack_envar(pmix_buffer_t *buffer, void *dest, } return PMIX_SUCCESS; } - -/**** DEPRECATED ****/ -pmix_status_t pmix_bfrops_base_unpack_array(pmix_buffer_t *buffer, void *dest, - int32_t *num_vals, pmix_data_type_t type) -{ - pmix_info_array_t *ptr; - int32_t i, n, m; - pmix_status_t ret; - - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, - "pmix_bfrop_unpack: %d info arrays", *num_vals); - - ptr = (pmix_info_array_t*) dest; - n = *num_vals; - - for (i = 0; i < n; ++i) { - pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, - "pmix_bfrop_unpack: init array[%d]", i); - memset(&ptr[i], 0, sizeof(pmix_info_array_t)); - /* unpack the size of this array */ - m=1; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { - return ret; - } - if (0 < ptr[i].size) { - ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); - m=ptr[i].size; - if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { - return ret; - } - } - } - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h index bfb4013b875..258b727afe8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/bfrops.h @@ -324,7 +324,7 @@ typedef pmix_status_t (*pmix_bfrop_print_fn_t)(char **output, char *prefix, * @retval PMIX_ERROR(s) An appropriate error code */ typedef pmix_status_t (*pmix_bfrop_value_xfer_fn_t)(pmix_value_t *dest, - pmix_value_t *src); + const pmix_value_t *src); /** diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c index d833e4bdc86..c4eeeb14bbc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -225,10 +225,8 @@ pmix_value_cmp_t pmix12_bfrop_value_cmp(pmix_value_t *p, pmix_value_t *p1) return PMIX_VALUE1_GREATER; } /* COPY FUNCTIONS FOR GENERIC PMIX TYPES */ -pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src) +pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src) { - pmix_info_t *p1, *s1; - /* copy the right field */ p->type = src->type; switch (src->type) { @@ -300,22 +298,7 @@ pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src) p->data.tv.tv_usec = src->data.tv.tv_usec; break; case PMIX_INFO_ARRAY: - p->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); - if (NULL == p->data.array) { - return PMIX_ERR_NOMEM; - } - p->data.array->size = src->data.array->size; - if (0 < src->data.array->size) { - p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t)); - if (NULL == p->data.array->array) { - free(p->data.array); - return PMIX_ERR_NOMEM; - } - p1 = (pmix_info_t*)p->data.array->array; - s1 = (pmix_info_t*)src->data.array->array; - memcpy(p1, s1, src->data.array->size * sizeof(pmix_info_t)); - } - break; + return PMIX_ERR_NOT_SUPPORTED; case PMIX_BYTE_OBJECT: if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) { p->data.bo.bytes = malloc(src->data.bo.size); @@ -356,7 +339,7 @@ pmix_status_t pmix12_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src, pmix_data_type_t type) { *dest = (pmix_info_t*)malloc(sizeof(pmix_info_t)); - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); return pmix_value_xfer(&(*dest)->value, &src->value); } @@ -381,7 +364,7 @@ pmix_status_t pmix12_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src, (*dest)->ninfo = src->ninfo; (*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t)); for (j=0; j < src->ninfo; j++) { - (void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); pmix_value_xfer(&(*dest)->info[j].value, &src->info[j].value); } return PMIX_SUCCESS; @@ -427,7 +410,7 @@ pmix_status_t pmix12_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; } - (void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); (*dest)->rank = src->rank; return PMIX_SUCCESS; } @@ -484,9 +467,9 @@ pmix_status_t pmix12_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_data_type_t type) { *dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t)); - (void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); (*dest)->proc.rank = src->proc.rank; - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); return pmix_value_xfer(&(*dest)->value, &src->value); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h index 78dbf47666f..9c74c855685 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/internal.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -41,6 +41,55 @@ BEGIN_C_DECLS +/* DEPRECATED data type values */ +#define PMIX_MODEX 29 +#define PMIX_INFO_ARRAY 44 + +/**** PMIX MODEX STRUCT - DEPRECATED ****/ +typedef struct pmix_modex_data { + char nspace[PMIX_MAX_NSLEN+1]; + int rank; + uint8_t *blob; + size_t size; +} pmix_modex_data_t; +/* utility macros for working with pmix_modex_t structs */ +#define PMIX_MODEX_CREATE(m, n) \ + do { \ + (m) = (pmix_modex_data_t*)calloc((n) , sizeof(pmix_modex_data_t)); \ + } while (0) + +#define PMIX_MODEX_RELEASE(m) \ + do { \ + PMIX_MODEX_DESTRUCT((m)); \ + free((m)); \ + (m) = NULL; \ + } while (0) + +#define PMIX_MODEX_CONSTRUCT(m) \ + do { \ + memset((m), 0, sizeof(pmix_modex_data_t)); \ + } while (0) + +#define PMIX_MODEX_DESTRUCT(m) \ + do { \ + if (NULL != (m)->blob) { \ + free((m)->blob); \ + (m)->blob = NULL; \ + } \ + } while (0) + +#define PMIX_MODEX_FREE(m, n) \ + do { \ + size_t _s; \ + if (NULL != (m)) { \ + for (_s=0; _s < (n); _s++) { \ + PMIX_MODEX_DESTRUCT(&((m)[_s])); \ + } \ + free((m)); \ + (m) = NULL; \ + } \ + } while (0) + /* * Implementations of API functions */ @@ -58,7 +107,7 @@ pmix_status_t pmix12_bfrop_print(char **output, char *prefix, void *src, pmix_da pmix_status_t pmix12_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src); -pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src); +pmix_status_t pmix12_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src); void pmix12_bfrop_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c index 07f9a74a27d..efddd287de5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/pack.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -537,11 +537,6 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, return ret; } break; - case PMIX_INFO_ARRAY: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.array, 1, PMIX_INFO_ARRAY))) { - return ret; - } - break; case PMIX_BYTE_OBJECT: if (PMIX_SUCCESS != (ret = pmix12_bfrop_pack_buffer(buffer, &p->data.bo, 1, PMIX_BYTE_OBJECT))) { return ret; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c index 5604637f1b7..a001728ef02 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -670,7 +670,13 @@ static pmix_status_t unpack_val(pmix_buffer_t *buffer, pmix_value_t *val) } break; case PMIX_INFO_ARRAY: - if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.array, &m, PMIX_INFO_ARRAY))) { + /* we don't know anything about info array's so we + * have to convert this to a data array */ + val->data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); + val->data.darray->type = PMIX_INFO_ARRAY; + val->data.darray->size = m; + /* unpack into it */ + if (PMIX_SUCCESS != (ret = pmix12_bfrop_unpack_buffer(buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { return ret; } break; @@ -743,7 +749,7 @@ pmix_status_t pmix12_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to @@ -797,7 +803,7 @@ pmix_status_t pmix12_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to @@ -881,7 +887,7 @@ pmix_status_t pmix12_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); + pmix_strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); free(tmp); /* unpack the rank */ m=1; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c index 53fbf9b264c..06720cf32ec 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -337,7 +337,7 @@ bool pmix_value_cmp(pmix_value_t *p, pmix_value_t *p1) /* COPY FUNCTIONS FOR GENERIC PMIX TYPES - we * are not allocating memory and so we cannot * use the regular copy functions */ -pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src) +pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src) { size_t n, m; pmix_status_t rc; @@ -356,518 +356,506 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src) /* copy the right field */ p->type = src->type; switch (src->type) { - case PMIX_UNDEF: - break; - case PMIX_BOOL: - p->data.flag = src->data.flag; - break; - case PMIX_BYTE: - p->data.byte = src->data.byte; - break; - case PMIX_STRING: - if (NULL != src->data.string) { - p->data.string = strdup(src->data.string); - } else { - p->data.string = NULL; - } - break; - case PMIX_SIZE: - p->data.size = src->data.size; - break; - case PMIX_PID: - p->data.pid = src->data.pid; - break; - case PMIX_INT: - /* to avoid alignment issues */ - memcpy(&p->data.integer, &src->data.integer, sizeof(int)); - break; - case PMIX_INT8: - p->data.int8 = src->data.int8; - break; - case PMIX_INT16: - /* to avoid alignment issues */ - memcpy(&p->data.int16, &src->data.int16, 2); - break; - case PMIX_INT32: - /* to avoid alignment issues */ - memcpy(&p->data.int32, &src->data.int32, 4); - break; - case PMIX_INT64: - /* to avoid alignment issues */ - memcpy(&p->data.int64, &src->data.int64, 8); - break; - case PMIX_UINT: - /* to avoid alignment issues */ - memcpy(&p->data.uint, &src->data.uint, sizeof(unsigned int)); - break; - case PMIX_UINT8: - p->data.uint8 = src->data.uint8; - break; - case PMIX_UINT16: - /* to avoid alignment issues */ - memcpy(&p->data.uint16, &src->data.uint16, 2); - break; - case PMIX_UINT32: - /* to avoid alignment issues */ - memcpy(&p->data.uint32, &src->data.uint32, 4); - break; - case PMIX_UINT64: - /* to avoid alignment issues */ - memcpy(&p->data.uint64, &src->data.uint64, 8); - break; - case PMIX_FLOAT: - p->data.fval = src->data.fval; - break; - case PMIX_DOUBLE: - p->data.dval = src->data.dval; - break; - case PMIX_TIMEVAL: - memcpy(&p->data.tv, &src->data.tv, sizeof(struct timeval)); - break; - case PMIX_TIME: - memcpy(&p->data.time, &src->data.time, sizeof(time_t)); - break; - case PMIX_STATUS: - memcpy(&p->data.status, &src->data.status, sizeof(pmix_status_t)); - break; - case PMIX_PROC: - memcpy(&p->data.proc, &src->data.proc, sizeof(pmix_proc_t)); - break; - case PMIX_PROC_RANK: - memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t)); - break; - case PMIX_BYTE_OBJECT: - case PMIX_COMPRESSED_STRING: - memset(&p->data.bo, 0, sizeof(pmix_byte_object_t)); - if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) { - p->data.bo.bytes = malloc(src->data.bo.size); - memcpy(p->data.bo.bytes, src->data.bo.bytes, src->data.bo.size); - p->data.bo.size = src->data.bo.size; - } else { - p->data.bo.bytes = NULL; - p->data.bo.size = 0; - } - break; - case PMIX_PERSIST: - memcpy(&p->data.persist, &src->data.persist, sizeof(pmix_persistence_t)); - break; - case PMIX_SCOPE: - memcpy(&p->data.scope, &src->data.scope, sizeof(pmix_scope_t)); - break; - case PMIX_DATA_RANGE: - memcpy(&p->data.range, &src->data.range, sizeof(pmix_data_range_t)); - break; - case PMIX_PROC_STATE: - memcpy(&p->data.state, &src->data.state, sizeof(pmix_proc_state_t)); - break; - case PMIX_PROC_INFO: - PMIX_PROC_INFO_CREATE(p->data.pinfo, 1); - if (NULL != src->data.pinfo->hostname) { - p->data.pinfo->hostname = strdup(src->data.pinfo->hostname); - } - if (NULL != src->data.pinfo->executable_name) { - p->data.pinfo->executable_name = strdup(src->data.pinfo->executable_name); - } - memcpy(&p->data.pinfo->pid, &src->data.pinfo->pid, sizeof(pid_t)); - memcpy(&p->data.pinfo->exit_code, &src->data.pinfo->exit_code, sizeof(int)); - memcpy(&p->data.pinfo->state, &src->data.pinfo->state, sizeof(pmix_proc_state_t)); - break; - case PMIX_DATA_ARRAY: - p->data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); - p->data.darray->type = src->data.darray->type; - p->data.darray->size = src->data.darray->size; - if (0 == p->data.darray->size || NULL == src->data.darray->array) { - p->data.darray->array = NULL; - p->data.darray->size = 0; + case PMIX_UNDEF: break; - } - /* allocate space and do the copy */ - switch (src->data.darray->type) { - case PMIX_UINT8: - case PMIX_INT8: - case PMIX_BYTE: - p->data.darray->array = (char*)malloc(src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size); - break; - case PMIX_UINT16: - case PMIX_INT16: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint16_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint16_t)); - break; - case PMIX_UINT32: - case PMIX_INT32: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint32_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint32_t)); - break; - case PMIX_UINT64: - case PMIX_INT64: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint64_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint64_t)); - break; - case PMIX_BOOL: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(bool)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(bool)); - break; - case PMIX_SIZE: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(size_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(size_t)); - break; - case PMIX_PID: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(pid_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pid_t)); + case PMIX_BOOL: + p->data.flag = src->data.flag; + break; + case PMIX_BYTE: + p->data.byte = src->data.byte; + break; + case PMIX_STRING: + if (NULL != src->data.string) { + p->data.string = strdup(src->data.string); + } else { + p->data.string = NULL; + } + break; + case PMIX_SIZE: + p->data.size = src->data.size; + break; + case PMIX_PID: + p->data.pid = src->data.pid; + break; + case PMIX_INT: + /* to avoid alignment issues */ + memcpy(&p->data.integer, &src->data.integer, sizeof(int)); + break; + case PMIX_INT8: + p->data.int8 = src->data.int8; + break; + case PMIX_INT16: + /* to avoid alignment issues */ + memcpy(&p->data.int16, &src->data.int16, 2); + break; + case PMIX_INT32: + /* to avoid alignment issues */ + memcpy(&p->data.int32, &src->data.int32, 4); + break; + case PMIX_INT64: + /* to avoid alignment issues */ + memcpy(&p->data.int64, &src->data.int64, 8); + break; + case PMIX_UINT: + /* to avoid alignment issues */ + memcpy(&p->data.uint, &src->data.uint, sizeof(unsigned int)); + break; + case PMIX_UINT8: + p->data.uint8 = src->data.uint8; + break; + case PMIX_UINT16: + /* to avoid alignment issues */ + memcpy(&p->data.uint16, &src->data.uint16, 2); + break; + case PMIX_UINT32: + /* to avoid alignment issues */ + memcpy(&p->data.uint32, &src->data.uint32, 4); + break; + case PMIX_UINT64: + /* to avoid alignment issues */ + memcpy(&p->data.uint64, &src->data.uint64, 8); + break; + case PMIX_FLOAT: + p->data.fval = src->data.fval; + break; + case PMIX_DOUBLE: + p->data.dval = src->data.dval; + break; + case PMIX_TIMEVAL: + memcpy(&p->data.tv, &src->data.tv, sizeof(struct timeval)); + break; + case PMIX_TIME: + memcpy(&p->data.time, &src->data.time, sizeof(time_t)); + break; + case PMIX_STATUS: + memcpy(&p->data.status, &src->data.status, sizeof(pmix_status_t)); + break; + case PMIX_PROC: + memcpy(&p->data.proc, &src->data.proc, sizeof(pmix_proc_t)); + break; + case PMIX_PROC_RANK: + memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t)); + break; + case PMIX_BYTE_OBJECT: + case PMIX_COMPRESSED_STRING: + memset(&p->data.bo, 0, sizeof(pmix_byte_object_t)); + if (NULL != src->data.bo.bytes && 0 < src->data.bo.size) { + p->data.bo.bytes = malloc(src->data.bo.size); + memcpy(p->data.bo.bytes, src->data.bo.bytes, src->data.bo.size); + p->data.bo.size = src->data.bo.size; + } else { + p->data.bo.bytes = NULL; + p->data.bo.size = 0; + } + break; + case PMIX_PERSIST: + memcpy(&p->data.persist, &src->data.persist, sizeof(pmix_persistence_t)); + break; + case PMIX_SCOPE: + memcpy(&p->data.scope, &src->data.scope, sizeof(pmix_scope_t)); + break; + case PMIX_DATA_RANGE: + memcpy(&p->data.range, &src->data.range, sizeof(pmix_data_range_t)); + break; + case PMIX_PROC_STATE: + memcpy(&p->data.state, &src->data.state, sizeof(pmix_proc_state_t)); + break; + case PMIX_PROC_INFO: + PMIX_PROC_INFO_CREATE(p->data.pinfo, 1); + if (NULL != src->data.pinfo->hostname) { + p->data.pinfo->hostname = strdup(src->data.pinfo->hostname); + } + if (NULL != src->data.pinfo->executable_name) { + p->data.pinfo->executable_name = strdup(src->data.pinfo->executable_name); + } + memcpy(&p->data.pinfo->pid, &src->data.pinfo->pid, sizeof(pid_t)); + memcpy(&p->data.pinfo->exit_code, &src->data.pinfo->exit_code, sizeof(int)); + memcpy(&p->data.pinfo->state, &src->data.pinfo->state, sizeof(pmix_proc_state_t)); + break; + case PMIX_DATA_ARRAY: + p->data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); + p->data.darray->type = src->data.darray->type; + p->data.darray->size = src->data.darray->size; + if (0 == p->data.darray->size || NULL == src->data.darray->array) { + p->data.darray->array = NULL; + p->data.darray->size = 0; break; - case PMIX_STRING: - p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - prarray = (char**)p->data.darray->array; - strarray = (char**)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (NULL != strarray[n]) { - prarray[n] = strdup(strarray[n]); + } + /* allocate space and do the copy */ + switch (src->data.darray->type) { + case PMIX_UINT8: + case PMIX_INT8: + case PMIX_BYTE: + p->data.darray->array = (char*)malloc(src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - } - break; - case PMIX_INT: - case PMIX_UINT: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(int)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(int)); - break; - case PMIX_FLOAT: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(float)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(float)); - break; - case PMIX_DOUBLE: - p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(double)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(double)); - break; - case PMIX_TIMEVAL: - p->data.darray->array = (struct timeval*)malloc(src->data.darray->size * sizeof(struct timeval)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(struct timeval)); - break; - case PMIX_TIME: - p->data.darray->array = (time_t*)malloc(src->data.darray->size * sizeof(time_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(time_t)); - break; - case PMIX_STATUS: - p->data.darray->array = (pmix_status_t*)malloc(src->data.darray->size * sizeof(pmix_status_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_status_t)); - break; - case PMIX_VALUE: - PMIX_VALUE_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pv = (pmix_value_t*)p->data.darray->array; - sv = (pmix_value_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (PMIX_SUCCESS != (rc = pmix20_bfrop_value_xfer(&pv[n], &sv[n]))) { - PMIX_VALUE_FREE(pv, src->data.darray->size); - return rc; + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size); + break; + case PMIX_UINT16: + case PMIX_INT16: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint16_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - } - break; - case PMIX_PROC: - PMIX_PROC_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_proc_t)); - break; - case PMIX_APP: - PMIX_APP_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pa = (pmix_app_t*)p->data.darray->array; - sa = (pmix_app_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (NULL != sa[n].cmd) { - pa[n].cmd = strdup(sa[n].cmd); + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint16_t)); + break; + case PMIX_UINT32: + case PMIX_INT32: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint32_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != sa[n].argv) { - pa[n].argv = pmix_argv_copy(sa[n].argv); + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint32_t)); + break; + case PMIX_UINT64: + case PMIX_INT64: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(uint64_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != sa[n].env) { - pa[n].env = pmix_argv_copy(sa[n].env); + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(uint64_t)); + break; + case PMIX_BOOL: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(bool)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != sa[n].cwd) { - pa[n].cwd = strdup(sa[n].cwd); + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(bool)); + break; + case PMIX_SIZE: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(size_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(size_t)); + break; + case PMIX_PID: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(pid_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - pa[n].maxprocs = sa[n].maxprocs; - if (0 < sa[n].ninfo && NULL != sa[n].info) { - PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo); - if (NULL == pa[n].info) { - PMIX_APP_FREE(pa, src->data.darray->size); - return PMIX_ERR_NOMEM; + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pid_t)); + break; + case PMIX_STRING: + p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + prarray = (char**)p->data.darray->array; + strarray = (char**)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (NULL != strarray[n]) { + prarray[n] = strdup(strarray[n]); } - pa[n].ninfo = sa[n].ninfo; - for (m=0; m < pa[n].ninfo; m++) { - PMIX_INFO_XFER(&pa[n].info[m], &sa[n].info[m]); + } + break; + case PMIX_INT: + case PMIX_UINT: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(int)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(int)); + break; + case PMIX_FLOAT: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(float)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(float)); + break; + case PMIX_DOUBLE: + p->data.darray->array = (char*)malloc(src->data.darray->size * sizeof(double)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(double)); + break; + case PMIX_TIMEVAL: + p->data.darray->array = (struct timeval*)malloc(src->data.darray->size * sizeof(struct timeval)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(struct timeval)); + break; + case PMIX_TIME: + p->data.darray->array = (time_t*)malloc(src->data.darray->size * sizeof(time_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(time_t)); + break; + case PMIX_STATUS: + p->data.darray->array = (pmix_status_t*)malloc(src->data.darray->size * sizeof(pmix_status_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_status_t)); + break; + case PMIX_VALUE: + PMIX_VALUE_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pv = (pmix_value_t*)p->data.darray->array; + sv = (pmix_value_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (PMIX_SUCCESS != (rc = pmix20_bfrop_value_xfer(&pv[n], &sv[n]))) { + PMIX_VALUE_FREE(pv, src->data.darray->size); + return rc; } } - } - break; - case PMIX_INFO: - PMIX_INFO_CREATE(p->data.darray->array, src->data.darray->size); - p1 = (pmix_info_t*)p->data.darray->array; - s1 = (pmix_info_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type); - } - break; - case PMIX_PDATA: - PMIX_PDATA_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pd = (pmix_pdata_t*)p->data.darray->array; - sd = (pmix_pdata_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type); - } - break; - case PMIX_BUFFER: - p->data.darray->array = (pmix_buffer_t*)malloc(src->data.darray->size * sizeof(pmix_buffer_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pb = (pmix_buffer_t*)p->data.darray->array; - sb = (pmix_buffer_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - PMIX_CONSTRUCT(&pb[n], pmix_buffer_t); - pmix20_bfrop_copy_payload(&pb[n], &sb[n]); - } - break; - case PMIX_BYTE_OBJECT: - case PMIX_COMPRESSED_STRING: - p->data.darray->array = (pmix_byte_object_t*)malloc(src->data.darray->size * sizeof(pmix_byte_object_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pbo = (pmix_byte_object_t*)p->data.darray->array; - sbo = (pmix_byte_object_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (NULL != sbo[n].bytes && 0 < sbo[n].size) { - pbo[n].size = sbo[n].size; - pbo[n].bytes = (char*)malloc(pbo[n].size); - memcpy(pbo[n].bytes, sbo[n].bytes, pbo[n].size); - } else { - pbo[n].bytes = NULL; - pbo[n].size = 0; + break; + case PMIX_PROC: + PMIX_PROC_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - } - break; - case PMIX_KVAL: - p->data.darray->array = (pmix_kval_t*)calloc(src->data.darray->size , sizeof(pmix_kval_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pk = (pmix_kval_t*)p->data.darray->array; - sk = (pmix_kval_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (NULL != sk[n].key) { - pk[n].key = strdup(sk[n].key); + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_proc_t)); + break; + case PMIX_APP: + PMIX_APP_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != sk[n].value) { - PMIX_VALUE_CREATE(pk[n].value, 1); - if (NULL == pk[n].value) { - free(p->data.darray->array); - return PMIX_ERR_NOMEM; + pa = (pmix_app_t*)p->data.darray->array; + sa = (pmix_app_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (NULL != sa[n].cmd) { + pa[n].cmd = strdup(sa[n].cmd); } - if (PMIX_SUCCESS != (rc = pmix20_bfrop_value_xfer(pk[n].value, sk[n].value))) { - return rc; + if (NULL != sa[n].argv) { + pa[n].argv = pmix_argv_copy(sa[n].argv); + } + if (NULL != sa[n].env) { + pa[n].env = pmix_argv_copy(sa[n].env); + } + if (NULL != sa[n].cwd) { + pa[n].cwd = strdup(sa[n].cwd); + } + pa[n].maxprocs = sa[n].maxprocs; + if (0 < sa[n].ninfo && NULL != sa[n].info) { + PMIX_INFO_CREATE(pa[n].info, sa[n].ninfo); + if (NULL == pa[n].info) { + PMIX_APP_FREE(pa, src->data.darray->size); + return PMIX_ERR_NOMEM; + } + pa[n].ninfo = sa[n].ninfo; + for (m=0; m < pa[n].ninfo; m++) { + PMIX_INFO_XFER(&pa[n].info[m], &sa[n].info[m]); + } } } - } - break; - case PMIX_MODEX: - PMIX_MODEX_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pm = (pmix_modex_data_t*)p->data.darray->array; - sm = (pmix_modex_data_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t)); - if (NULL != sm[n].blob && 0 < sm[n].size) { - pm[n].blob = (uint8_t*)malloc(sm[n].size); - if (NULL == pm[n].blob) { - return PMIX_ERR_NOMEM; + break; + case PMIX_INFO: + PMIX_INFO_CREATE(p->data.darray->array, src->data.darray->size); + p1 = (pmix_info_t*)p->data.darray->array; + s1 = (pmix_info_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type); + } + break; + case PMIX_PDATA: + PMIX_PDATA_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pd = (pmix_pdata_t*)p->data.darray->array; + sd = (pmix_pdata_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type); + } + break; + case PMIX_BUFFER: + p->data.darray->array = (pmix_buffer_t*)malloc(src->data.darray->size * sizeof(pmix_buffer_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pb = (pmix_buffer_t*)p->data.darray->array; + sb = (pmix_buffer_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + PMIX_CONSTRUCT(&pb[n], pmix_buffer_t); + pmix20_bfrop_copy_payload(&pb[n], &sb[n]); + } + break; + case PMIX_BYTE_OBJECT: + case PMIX_COMPRESSED_STRING: + p->data.darray->array = (pmix_byte_object_t*)malloc(src->data.darray->size * sizeof(pmix_byte_object_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pbo = (pmix_byte_object_t*)p->data.darray->array; + sbo = (pmix_byte_object_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (NULL != sbo[n].bytes && 0 < sbo[n].size) { + pbo[n].size = sbo[n].size; + pbo[n].bytes = (char*)malloc(pbo[n].size); + memcpy(pbo[n].bytes, sbo[n].bytes, pbo[n].size); + } else { + pbo[n].bytes = NULL; + pbo[n].size = 0; } - memcpy(pm[n].blob, sm[n].blob, sm[n].size); - pm[n].size = sm[n].size; - } else { - pm[n].blob = NULL; - pm[n].size = 0; } - } - break; - case PMIX_PERSIST: - p->data.darray->array = (pmix_persistence_t*)malloc(src->data.darray->size * sizeof(pmix_persistence_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_persistence_t)); - break; - case PMIX_POINTER: - p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - prarray = (char**)p->data.darray->array; - strarray = (char**)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - prarray[n] = strarray[n]; - } - break; - case PMIX_SCOPE: - p->data.darray->array = (pmix_scope_t*)malloc(src->data.darray->size * sizeof(pmix_scope_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_scope_t)); - break; - case PMIX_DATA_RANGE: - p->data.darray->array = (pmix_data_range_t*)malloc(src->data.darray->size * sizeof(pmix_data_range_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_data_range_t)); - break; - case PMIX_COMMAND: - p->data.darray->array = (pmix_cmd_t*)malloc(src->data.darray->size * sizeof(pmix_cmd_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_cmd_t)); - break; - case PMIX_INFO_DIRECTIVES: - p->data.darray->array = (pmix_info_directives_t*)malloc(src->data.darray->size * sizeof(pmix_info_directives_t)); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_info_directives_t)); - break; - case PMIX_PROC_INFO: - PMIX_PROC_INFO_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pi = (pmix_proc_info_t*)p->data.darray->array; - si = (pmix_proc_info_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t)); - if (NULL != si[n].hostname) { - pi[n].hostname = strdup(si[n].hostname); - } else { - pi[n].hostname = NULL; + break; + case PMIX_KVAL: + p->data.darray->array = (pmix_kval_t*)calloc(src->data.darray->size , sizeof(pmix_kval_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != si[n].executable_name) { - pi[n].executable_name = strdup(si[n].executable_name); - } else { - pi[n].executable_name = NULL; + pk = (pmix_kval_t*)p->data.darray->array; + sk = (pmix_kval_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (NULL != sk[n].key) { + pk[n].key = strdup(sk[n].key); + } + if (NULL != sk[n].value) { + PMIX_VALUE_CREATE(pk[n].value, 1); + if (NULL == pk[n].value) { + free(p->data.darray->array); + return PMIX_ERR_NOMEM; + } + if (PMIX_SUCCESS != (rc = pmix20_bfrop_value_xfer(pk[n].value, sk[n].value))) { + return rc; + } + } } - pi[n].pid = si[n].pid; - pi[n].exit_code = si[n].exit_code; - pi[n].state = si[n].state; - } - break; - case PMIX_DATA_ARRAY: - return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays - case PMIX_QUERY: - PMIX_QUERY_CREATE(p->data.darray->array, src->data.darray->size); - if (NULL == p->data.darray->array) { - return PMIX_ERR_NOMEM; - } - pq = (pmix_query_t*)p->data.darray->array; - sq = (pmix_query_t*)src->data.darray->array; - for (n=0; n < src->data.darray->size; n++) { - if (NULL != sq[n].keys) { - pq[n].keys = pmix_argv_copy(sq[n].keys); + break; + case PMIX_MODEX: + PMIX_MODEX_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pm = (pmix_modex_data_t*)p->data.darray->array; + sm = (pmix_modex_data_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + memcpy(&pm[n], &sm[n], sizeof(pmix_modex_data_t)); + if (NULL != sm[n].blob && 0 < sm[n].size) { + pm[n].blob = (uint8_t*)malloc(sm[n].size); + if (NULL == pm[n].blob) { + return PMIX_ERR_NOMEM; + } + memcpy(pm[n].blob, sm[n].blob, sm[n].size); + pm[n].size = sm[n].size; + } else { + pm[n].blob = NULL; + pm[n].size = 0; + } + } + break; + case PMIX_PERSIST: + p->data.darray->array = (pmix_persistence_t*)malloc(src->data.darray->size * sizeof(pmix_persistence_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; } - if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) { - PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual); - if (NULL == pq[n].qualifiers) { - PMIX_QUERY_FREE(pq, src->data.darray->size); - return PMIX_ERR_NOMEM; + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_persistence_t)); + break; + case PMIX_POINTER: + p->data.darray->array = (char**)malloc(src->data.darray->size * sizeof(char*)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + prarray = (char**)p->data.darray->array; + strarray = (char**)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + prarray[n] = strarray[n]; + } + break; + case PMIX_SCOPE: + p->data.darray->array = (pmix_scope_t*)malloc(src->data.darray->size * sizeof(pmix_scope_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_scope_t)); + break; + case PMIX_DATA_RANGE: + p->data.darray->array = (pmix_data_range_t*)malloc(src->data.darray->size * sizeof(pmix_data_range_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_data_range_t)); + break; + case PMIX_COMMAND: + p->data.darray->array = (pmix_cmd_t*)malloc(src->data.darray->size * sizeof(pmix_cmd_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_cmd_t)); + break; + case PMIX_INFO_DIRECTIVES: + p->data.darray->array = (pmix_info_directives_t*)malloc(src->data.darray->size * sizeof(pmix_info_directives_t)); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.darray->array, src->data.darray->array, src->data.darray->size * sizeof(pmix_info_directives_t)); + break; + case PMIX_PROC_INFO: + PMIX_PROC_INFO_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pi = (pmix_proc_info_t*)p->data.darray->array; + si = (pmix_proc_info_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + memcpy(&pi[n].proc, &si[n].proc, sizeof(pmix_proc_t)); + if (NULL != si[n].hostname) { + pi[n].hostname = strdup(si[n].hostname); + } else { + pi[n].hostname = NULL; } - for (m=0; m < sq[n].nqual; m++) { - PMIX_INFO_XFER(&pq[n].qualifiers[m], &sq[n].qualifiers[m]); + if (NULL != si[n].executable_name) { + pi[n].executable_name = strdup(si[n].executable_name); + } else { + pi[n].executable_name = NULL; } - pq[n].nqual = sq[n].nqual; - } else { - pq[n].qualifiers = NULL; - pq[n].nqual = 0; + pi[n].pid = si[n].pid; + pi[n].exit_code = si[n].exit_code; + pi[n].state = si[n].state; } - } - break; - default: - return PMIX_ERR_UNKNOWN_DATA_TYPE; - } - break; - case PMIX_POINTER: - memcpy(&p->data.ptr, &src->data.ptr, sizeof(void*)); - break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - p->data.array->size = src->data.array->size; - if (0 < src->data.array->size) { - p->data.array->array = (pmix_info_t*)malloc(src->data.array->size * sizeof(pmix_info_t)); - if (NULL == p->data.array->array) { - return PMIX_ERR_NOMEM; - } - p1 = (pmix_info_t*)p->data.array->array; - s1 = (pmix_info_t*)src->data.array->array; - for (n=0; n < src->data.darray->size; n++) { - PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type); + break; + case PMIX_DATA_ARRAY: + return PMIX_ERR_NOT_SUPPORTED; // don't support iterative arrays + case PMIX_QUERY: + PMIX_QUERY_CREATE(p->data.darray->array, src->data.darray->size); + if (NULL == p->data.darray->array) { + return PMIX_ERR_NOMEM; + } + pq = (pmix_query_t*)p->data.darray->array; + sq = (pmix_query_t*)src->data.darray->array; + for (n=0; n < src->data.darray->size; n++) { + if (NULL != sq[n].keys) { + pq[n].keys = pmix_argv_copy(sq[n].keys); + } + if (NULL != sq[n].qualifiers && 0 < sq[n].nqual) { + PMIX_INFO_CREATE(pq[n].qualifiers, sq[n].nqual); + if (NULL == pq[n].qualifiers) { + PMIX_QUERY_FREE(pq, src->data.darray->size); + return PMIX_ERR_NOMEM; + } + for (m=0; m < sq[n].nqual; m++) { + PMIX_INFO_XFER(&pq[n].qualifiers[m], &sq[n].qualifiers[m]); + } + pq[n].nqual = sq[n].nqual; + } else { + pq[n].qualifiers = NULL; + pq[n].nqual = 0; + } + } + break; + default: + return PMIX_ERR_UNKNOWN_DATA_TYPE; } - } - break; - /********************/ - default: - pmix_output(0, "COPY-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)src->type); - return PMIX_ERROR; + break; + case PMIX_POINTER: + memcpy(&p->data.ptr, &src->data.ptr, sizeof(void*)); + break; + /**** DEPRECATED ****/ + case PMIX_INFO_ARRAY: + return PMIX_ERR_NOT_SUPPORTED; + /********************/ + default: + pmix_output(0, "COPY-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)src->type); + return PMIX_ERROR; } return PMIX_SUCCESS; } @@ -895,7 +883,7 @@ pmix_status_t pmix20_bfrop_copy_info(pmix_info_t **dest, pmix_info_t *src, pmix_data_type_t type) { *dest = (pmix_info_t*)malloc(sizeof(pmix_info_t)); - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); (*dest)->flags = src->flags; return pmix20_bfrop_value_xfer(&(*dest)->value, &src->value); } @@ -924,7 +912,7 @@ pmix_status_t pmix20_bfrop_copy_app(pmix_app_t **dest, pmix_app_t *src, (*dest)->ninfo = src->ninfo; (*dest)->info = (pmix_info_t*)malloc(src->ninfo * sizeof(pmix_info_t)); for (j=0; j < src->ninfo; j++) { - (void)strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->info[j].key, src->info[j].key, PMIX_MAX_KEYLEN); pmix20_bfrop_value_xfer(&(*dest)->info[j].value, &src->info[j].value); } return PMIX_SUCCESS; @@ -955,7 +943,7 @@ pmix_status_t pmix20_bfrop_copy_proc(pmix_proc_t **dest, pmix_proc_t *src, if (NULL == *dest) { return PMIX_ERR_OUT_OF_RESOURCE; } - (void)strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->nspace, src->nspace, PMIX_MAX_NSLEN); (*dest)->rank = src->rank; return PMIX_SUCCESS; } @@ -1008,9 +996,9 @@ pmix_status_t pmix20_bfrop_copy_pdata(pmix_pdata_t **dest, pmix_pdata_t *src, pmix_data_type_t type) { *dest = (pmix_pdata_t*)malloc(sizeof(pmix_pdata_t)); - (void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); (*dest)->proc.rank = src->proc.rank; - (void)strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); + pmix_strncpy((*dest)->key, src->key, PMIX_MAX_KEYLEN); return pmix20_bfrop_value_xfer(&(*dest)->value, &src->value); } @@ -1018,7 +1006,7 @@ pmix_status_t pmix20_bfrop_copy_pinfo(pmix_proc_info_t **dest, pmix_proc_info_t pmix_data_type_t type) { *dest = (pmix_proc_info_t*)malloc(sizeof(pmix_proc_info_t)); - (void)strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); + pmix_strncpy((*dest)->proc.nspace, src->proc.nspace, PMIX_MAX_NSLEN); (*dest)->proc.rank = src->proc.rank; if (NULL != src->hostname) { (*dest)->hostname = strdup(src->hostname); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h index d85ac2985c2..1478687f6c7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/internal.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -42,6 +42,55 @@ BEGIN_C_DECLS +/* DEPRECATED data type values */ +#define PMIX_MODEX 29 +#define PMIX_INFO_ARRAY 44 + +/**** PMIX MODEX STRUCT - DEPRECATED ****/ +typedef struct pmix_modex_data { + char nspace[PMIX_MAX_NSLEN+1]; + int rank; + uint8_t *blob; + size_t size; +} pmix_modex_data_t; +/* utility macros for working with pmix_modex_t structs */ +#define PMIX_MODEX_CREATE(m, n) \ + do { \ + (m) = (pmix_modex_data_t*)calloc((n) , sizeof(pmix_modex_data_t)); \ + } while (0) + +#define PMIX_MODEX_RELEASE(m) \ + do { \ + PMIX_MODEX_DESTRUCT((m)); \ + free((m)); \ + (m) = NULL; \ + } while (0) + +#define PMIX_MODEX_CONSTRUCT(m) \ + do { \ + memset((m), 0, sizeof(pmix_modex_data_t)); \ + } while (0) + +#define PMIX_MODEX_DESTRUCT(m) \ + do { \ + if (NULL != (m)->blob) { \ + free((m)->blob); \ + (m)->blob = NULL; \ + } \ + } while (0) + +#define PMIX_MODEX_FREE(m, n) \ + do { \ + size_t _s; \ + if (NULL != (m)) { \ + for (_s=0; _s < (n); _s++) { \ + PMIX_MODEX_DESTRUCT(&((m)[_s])); \ + } \ + free((m)); \ + (m) = NULL; \ + } \ + } while (0) + /* * Implementations of API functions */ @@ -59,7 +108,7 @@ pmix_status_t pmix20_bfrop_print(char **output, char *prefix, void *src, pmix_da pmix_status_t pmix20_bfrop_copy_payload(pmix_buffer_t *dest, pmix_buffer_t *src); -pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, pmix_value_t *src); +pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src); void pmix20_bfrop_value_load(pmix_value_t *v, const void *data, pmix_data_type_t type); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c index 91636204497..6aa194b8b97 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/pack.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -613,13 +613,6 @@ static pmix_status_t pack_val(pmix_buffer_t *buffer, return ret; } break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_buffer(buffer, p->data.array, 1, PMIX_INFO_ARRAY))) { - return ret; - } - break; - /********************/ default: pmix_output(0, "PACK-PMIX-VALUE: UNSUPPORTED TYPE %d", (int)p->type); return PMIX_ERROR; @@ -1035,10 +1028,9 @@ pmix_status_t pmix20_bfrop_pack_alloc_directive(pmix_buffer_t *buffer, const voi return pmix20_bfrop_pack_byte(buffer, src, num_vals, PMIX_UINT8); } - /**** DEPRECATED ****/ pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, - int32_t num_vals, pmix_data_type_t type) + int32_t num_vals, pmix_data_type_t type) { pmix_info_array_t *ptr; int32_t i; @@ -1048,12 +1040,12 @@ pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, for (i = 0; i < num_vals; ++i) { /* pack the size */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { return ret; } if (0 < ptr[i].size) { /* pack the values */ - if (PMIX_SUCCESS != (ret = pmix20_bfrop_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { return ret; } } @@ -1062,3 +1054,4 @@ pmix_status_t pmix20_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, return PMIX_SUCCESS; } /********************/ + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c index 500bd87f1c1..a9009be364d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/print.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -761,7 +761,7 @@ pmix_status_t pmix20_bfrop_print_status(char **output, char *prefix, * PMIX_VALUE */ pmix_status_t pmix20_bfrop_print_value(char **output, char *prefix, - pmix_value_t *src, pmix_data_type_t type) + pmix_value_t *src, pmix_data_type_t type) { char *prefx; int rc; @@ -904,12 +904,6 @@ pmix_status_t pmix20_bfrop_print_status(char **output, char *prefix, rc = asprintf(output, "%sPMIX_VALUE: Data type: DATA_ARRAY\tARRAY SIZE: %ld", prefx, (long)src->data.darray->size); break; - /**** DEPRECATED ****/ - case PMIX_INFO_ARRAY: - rc = asprintf(output, "%sPMIX_VALUE: Data type: INFO_ARRAY\tARRAY SIZE: %ld", - prefx, (long)src->data.array->size); - break; - /********************/ default: rc = asprintf(output, "%sPMIX_VALUE: Data type: UNKNOWN\tValue: UNPRINTABLE", prefx); break; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c index f812a005bc1..91ce264fd30 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/unpack.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -756,12 +756,13 @@ pmix_status_t pmix20_bfrop_unpack_status(pmix_buffer_t *buffer, void *dest, break; /**** DEPRECATED ****/ case PMIX_INFO_ARRAY: - /* this field is now a pointer, so we must allocate storage for it */ - val->data.array = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); - if (NULL == val->data.array) { - return PMIX_ERR_NOMEM; - } - if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, val->data.array, &m, PMIX_INFO_ARRAY))) { + /* we don't know anything about info array's so we + * have to convert this to a data array */ + val->data.darray = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); + val->data.darray->type = PMIX_INFO_ARRAY; + val->data.darray->size = m; + /* unpack into it */ + if (PMIX_SUCCESS != (ret = pmix20_bfrop_unpack_buffer(buffer, &val->data.darray->array, &m, PMIX_INFO_ARRAY))) { return ret; } break; @@ -825,7 +826,7 @@ pmix_status_t pmix20_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest, PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack the flags */ m=1; @@ -882,7 +883,7 @@ pmix_status_t pmix20_bfrop_unpack_pdata(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); + pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN); free(tmp); /* unpack value - since the value structure is statically-defined * instead of a pointer in this struct, we directly unpack it to @@ -962,7 +963,7 @@ pmix_status_t pmix20_bfrop_unpack_proc(pmix_buffer_t *buffer, void *dest, if (NULL == tmp) { return PMIX_ERROR; } - (void)strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); + pmix_strncpy(ptr[i].nspace, tmp, PMIX_MAX_NSLEN); free(tmp); /* unpack the rank */ m=1; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c index adcc3cba565..8100b70ed64 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/bfrop_pmix21.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -63,6 +63,37 @@ pmix_bfrops_module_t pmix_bfrops_pmix21_module = { .data_type_string = data_type_string }; +/* DEPRECATED data type values */ +#define PMIX_MODEX 29 +#define PMIX_INFO_ARRAY 44 + +/**** PMIX MODEX STRUCT - DEPRECATED ****/ +typedef struct pmix_modex_data { + char nspace[PMIX_MAX_NSLEN+1]; + int rank; + uint8_t *blob; + size_t size; +} pmix_modex_data_t; + +static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_copy_array(pmix_info_array_t **dest, + pmix_info_array_t *src, + pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, + pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_print_array(char **output, char *prefix, + pmix_info_array_t *src, pmix_data_type_t type); +static pmix_status_t pmix21_bfrop_print_modex(char **output, char *prefix, + pmix_modex_data_t *src, pmix_data_type_t type); + + static pmix_status_t init(void) { /* some standard types don't require anything special */ @@ -265,10 +296,10 @@ static pmix_status_t init(void) &mca_bfrops_v21_component.types); PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX, - pmix_bfrops_base_pack_modex, - pmix_bfrops_base_unpack_modex, - pmix_bfrops_base_copy_modex, - pmix_bfrops_base_print_modex, + pmix21_bfrop_pack_modex, + pmix21_bfrop_unpack_modex, + pmix21_bfrop_copy_modex, + pmix21_bfrop_print_modex, &mca_bfrops_v21_component.types); /* these are fixed-sized values and can be done by base */ @@ -374,10 +405,10 @@ static pmix_status_t init(void) /**** DEPRECATED ****/ PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY, - pmix_bfrops_base_pack_array, - pmix_bfrops_base_unpack_array, - pmix_bfrops_base_copy_array, - pmix_bfrops_base_print_array, + pmix21_bfrop_pack_array, + pmix21_bfrop_unpack_array, + pmix21_bfrop_copy_array, + pmix21_bfrop_print_array, &mca_bfrops_v21_component.types); /********************/ @@ -446,3 +477,198 @@ static const char* data_type_string(pmix_data_type_t type) { return pmix_bfrops_base_data_type_string(&mca_bfrops_v21_component.types, type); } + +/**** DEPRECATED ****/ +static pmix_status_t pmix21_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + pmix_info_array_t *ptr; + int32_t i; + pmix_status_t ret; + + ptr = (pmix_info_array_t *) src; + + for (i = 0; i < num_vals; ++i) { + /* pack the size */ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + /* pack the values */ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + return ret; + } + } + } + + return PMIX_SUCCESS; +} + +static pmix_status_t pmix21_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + pmix_modex_data_t *ptr; + int32_t i; + pmix_status_t ret; + + ptr = (pmix_modex_data_t *) src; + + for (i = 0; i < num_vals; ++i) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + return ret; + } + if( 0 < ptr[i].size){ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + +/********************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix21_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + pmix_info_array_t *ptr; + int32_t i, n, m; + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix21_bfrop_unpack: %d info arrays", *num_vals); + + ptr = (pmix_info_array_t*) dest; + n = *num_vals; + + for (i = 0; i < n; ++i) { + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix21_bfrop_unpack: init array[%d]", i); + memset(&ptr[i], 0, sizeof(pmix_info_array_t)); + /* unpack the size of this array */ + m=1; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); + m=ptr[i].size; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + +static pmix_status_t pmix21_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + pmix_modex_data_t *ptr; + int32_t i, n, m; + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix20_bfrop_unpack: %d modex", *num_vals); + + ptr = (pmix_modex_data_t *) dest; + n = *num_vals; + + for (i = 0; i < n; ++i) { + memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); + /* unpack the number of bytes */ + m=1; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); + m=ptr[i].size; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + +/********************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix21_bfrop_copy_array(pmix_info_array_t **dest, + pmix_info_array_t *src, + pmix_data_type_t type) +{ + pmix_info_t *d1, *s1; + + *dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); + (*dest)->size = src->size; + (*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t)); + d1 = (pmix_info_t*)(*dest)->array; + s1 = (pmix_info_t*)src->array; + memcpy(d1, s1, src->size * sizeof(pmix_info_t)); + return PMIX_SUCCESS; +} + +static pmix_status_t pmix21_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, + pmix_data_type_t type) +{ + *dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t)); + if (NULL == *dest) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + (*dest)->blob = NULL; + (*dest)->size = 0; + if (NULL != src->blob) { + (*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t)); + if (NULL == (*dest)->blob) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t)); + (*dest)->size = src->size; + } + return PMIX_SUCCESS; +} + +/*******************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix21_bfrop_print_array(char **output, char *prefix, + pmix_info_array_t *src, pmix_data_type_t type) +{ + size_t j; + char *tmp, *tmp2, *tmp3, *pfx; + pmix_info_t *s1; + + if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) { + return PMIX_ERR_NOMEM; + } + if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) { + free(tmp); + return PMIX_ERR_NOMEM; + } + s1 = (pmix_info_t*)src->array; + + for (j=0; j < src->size; j++) { + pmix_bfrops_base_print_info(&tmp2, pfx, &s1[j], PMIX_INFO); + if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) { + free(tmp); + free(tmp2); + return PMIX_ERR_NOMEM; + } + free(tmp); + free(tmp2); + tmp = tmp3; + } + *output = tmp; + return PMIX_SUCCESS; +} + +static pmix_status_t pmix21_bfrop_print_modex(char **output, char *prefix, + pmix_modex_data_t *src, pmix_data_type_t type) +{ + return PMIX_SUCCESS; +} + +/********************/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c index 828cb39ac63..eac138a80dc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/bfrop_pmix3.c @@ -63,6 +63,37 @@ pmix_bfrops_module_t pmix_bfrops_pmix3_module = { .data_type_string = data_type_string }; +/* DEPRECATED data type values */ +#define PMIX_MODEX 29 +#define PMIX_INFO_ARRAY 44 + +/**** PMIX MODEX STRUCT - DEPRECATED ****/ +typedef struct pmix_modex_data { + char nspace[PMIX_MAX_NSLEN+1]; + int rank; + uint8_t *blob; + size_t size; +} pmix_modex_data_t; + +static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_copy_array(pmix_info_array_t **dest, + pmix_info_array_t *src, + pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, + pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_print_array(char **output, char *prefix, + pmix_info_array_t *src, pmix_data_type_t type); +static pmix_status_t pmix3_bfrop_print_modex(char **output, char *prefix, + pmix_modex_data_t *src, pmix_data_type_t type); + + static pmix_status_t init(void) { /* some standard types don't require anything special */ @@ -265,10 +296,10 @@ static pmix_status_t init(void) &mca_bfrops_v3_component.types); PMIX_REGISTER_TYPE("PMIX_MODEX", PMIX_MODEX, - pmix_bfrops_base_pack_modex, - pmix_bfrops_base_unpack_modex, - pmix_bfrops_base_copy_modex, - pmix_bfrops_base_print_modex, + pmix3_bfrop_pack_modex, + pmix3_bfrop_unpack_modex, + pmix3_bfrop_copy_modex, + pmix3_bfrop_print_modex, &mca_bfrops_v3_component.types); /* these are fixed-sized values and can be done by base */ @@ -390,10 +421,10 @@ static pmix_status_t init(void) /**** DEPRECATED ****/ PMIX_REGISTER_TYPE("PMIX_INFO_ARRAY", PMIX_INFO_ARRAY, - pmix_bfrops_base_pack_array, - pmix_bfrops_base_unpack_array, - pmix_bfrops_base_copy_array, - pmix_bfrops_base_print_array, + pmix3_bfrop_pack_array, + pmix3_bfrop_unpack_array, + pmix3_bfrop_copy_array, + pmix3_bfrop_print_array, &mca_bfrops_v3_component.types); /********************/ @@ -462,3 +493,201 @@ static const char* data_type_string(pmix_data_type_t type) { return pmix_bfrops_base_data_type_string(&mca_bfrops_v3_component.types, type); } + +/**** DEPRECATED ****/ +static pmix_status_t pmix3_bfrop_pack_array(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + pmix_info_array_t *ptr; + int32_t i; + pmix_status_t ret; + + ptr = (pmix_info_array_t *) src; + + for (i = 0; i < num_vals; ++i) { + /* pack the size */ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + /* pack the values */ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_info(buffer, ptr[i].array, ptr[i].size, PMIX_INFO))) { + return ret; + } + } + } + + return PMIX_SUCCESS; +} + +static pmix_status_t pmix3_bfrop_pack_modex(pmix_buffer_t *buffer, const void *src, + int32_t num_vals, pmix_data_type_t type) +{ + pmix_modex_data_t *ptr; + int32_t i; + pmix_status_t ret; + + ptr = (pmix_modex_data_t *) src; + + for (i = 0; i < num_vals; ++i) { + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_sizet(buffer, &ptr[i].size, 1, PMIX_SIZE))) { + return ret; + } + if( 0 < ptr[i].size){ + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_pack_byte(buffer, ptr[i].blob, ptr[i].size, PMIX_UINT8))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + + +/********************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix3_bfrop_unpack_array(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + pmix_info_array_t *ptr; + int32_t i, n, m; + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix3_bfrop_unpack: %d info arrays", *num_vals); + + ptr = (pmix_info_array_t*) dest; + n = *num_vals; + + for (i = 0; i < n; ++i) { + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix3_bfrop_unpack: init array[%d]", i); + memset(&ptr[i], 0, sizeof(pmix_info_array_t)); + /* unpack the size of this array */ + m=1; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + ptr[i].array = (pmix_info_t*)malloc(ptr[i].size * sizeof(pmix_info_t)); + m=ptr[i].size; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_value(buffer, ptr[i].array, &m, PMIX_INFO))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + +static pmix_status_t pmix3_bfrop_unpack_modex(pmix_buffer_t *buffer, void *dest, + int32_t *num_vals, pmix_data_type_t type) +{ + pmix_modex_data_t *ptr; + int32_t i, n, m; + pmix_status_t ret; + + pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output, + "pmix20_bfrop_unpack: %d modex", *num_vals); + + ptr = (pmix_modex_data_t *) dest; + n = *num_vals; + + for (i = 0; i < n; ++i) { + memset(&ptr[i], 0, sizeof(pmix_modex_data_t)); + /* unpack the number of bytes */ + m=1; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_sizet(buffer, &ptr[i].size, &m, PMIX_SIZE))) { + return ret; + } + if (0 < ptr[i].size) { + ptr[i].blob = (uint8_t*)malloc(ptr[i].size * sizeof(uint8_t)); + m=ptr[i].size; + if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_byte(buffer, ptr[i].blob, &m, PMIX_UINT8))) { + return ret; + } + } + } + return PMIX_SUCCESS; +} + + +/********************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix3_bfrop_copy_array(pmix_info_array_t **dest, + pmix_info_array_t *src, + pmix_data_type_t type) +{ + pmix_info_t *d1, *s1; + + *dest = (pmix_info_array_t*)malloc(sizeof(pmix_info_array_t)); + (*dest)->size = src->size; + (*dest)->array = (pmix_info_t*)malloc(src->size * sizeof(pmix_info_t)); + d1 = (pmix_info_t*)(*dest)->array; + s1 = (pmix_info_t*)src->array; + memcpy(d1, s1, src->size * sizeof(pmix_info_t)); + return PMIX_SUCCESS; +} + +static pmix_status_t pmix3_bfrop_copy_modex(pmix_modex_data_t **dest, pmix_modex_data_t *src, + pmix_data_type_t type) +{ + *dest = (pmix_modex_data_t*)malloc(sizeof(pmix_modex_data_t)); + if (NULL == *dest) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + (*dest)->blob = NULL; + (*dest)->size = 0; + if (NULL != src->blob) { + (*dest)->blob = (uint8_t*)malloc(src->size * sizeof(uint8_t)); + if (NULL == (*dest)->blob) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + memcpy((*dest)->blob, src->blob, src->size * sizeof(uint8_t)); + (*dest)->size = src->size; + } + return PMIX_SUCCESS; +} + +/*******************/ + +/**** DEPRECATED ****/ +static pmix_status_t pmix3_bfrop_print_array(char **output, char *prefix, + pmix_info_array_t *src, pmix_data_type_t type) +{ + size_t j; + char *tmp, *tmp2, *tmp3, *pfx; + pmix_info_t *s1; + + if (0 > asprintf(&tmp, "%sARRAY SIZE: %ld", prefix, (long)src->size)) { + return PMIX_ERR_NOMEM; + } + if (0 > asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix)) { + free(tmp); + return PMIX_ERR_NOMEM; + } + s1 = (pmix_info_t*)src->array; + + for (j=0; j < src->size; j++) { + pmix_bfrops_base_print_info(&tmp2, pfx, &s1[j], PMIX_INFO); + if (0 > asprintf(&tmp3, "%s%s", tmp, tmp2)) { + free(tmp); + free(tmp2); + return PMIX_ERR_NOMEM; + } + free(tmp); + free(tmp2); + tmp = tmp3; + } + *output = tmp; + return PMIX_SUCCESS; +} + +static pmix_status_t pmix3_bfrop_print_modex(char **output, char *prefix, + pmix_modex_data_t *src, pmix_data_type_t type) +{ + return PMIX_SUCCESS; +} + + +/********************/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/common/Makefile.am new file mode 100644 index 00000000000..4567c654307 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/Makefile.am @@ -0,0 +1,25 @@ +# +# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Note that this file must exist, even though it is empty (there is no +# "base" directory for the common framework). autogen.pl and +# opal_mca.m4 assume that every framework has a top-level Makefile.am. +# We *could* adjust the framework glue code to exclude "common" from +# this requirement, but it's just a lot easier to have an empty +# Makefile.am here. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/Makefile.am new file mode 100644 index 00000000000..50c601838fc --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/Makefile.am @@ -0,0 +1,59 @@ +# +# Copyright (c) 2018 Mellanox Technologies. All rights reserved. +# +# Copyright (c) 2018 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Header files + +AM_CPPFLAGS = $(LTDLINCL) + +headers = \ + dstore_common.h \ + dstore_base.h \ + dstore_segment.h \ + dstore_file.h + +# Source files + +sources = \ + dstore_base.c \ + dstore_segment.c + +lib_LTLIBRARIES = +noinst_LTLIBRARIES = +comp_inst = libmca_common_dstore.la +comp_noinst = libmca_common_dstore_noinst.la + +if MCA_BUILD_pmix_common_dstore_DSO +lib_LTLIBRARIES += $(comp_inst) +else +noinst_LTLIBRARIES += $(comp_noinst) +endif + +libmca_common_dstore_la_SOURCES = $(headers) $(sources) +libmca_common_dstore_la_LDFLAGS = -version-info $(libmca_common_dstore_so_version) +libmca_common_dstore_noinst_la_SOURCES = $(headers) $(sources) + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +pmixdir = $(pmixincludedir)/$(subdir) +pmix_HEADERS = $(headers) +endif + +all-local: + if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + $(LN_S) "$(comp_noinst)" "$(comp_inst)"; \ + fi + +clean-local: + if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + fi diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/configure.m4 new file mode 100644 index 00000000000..ca90b6568fe --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/configure.m4 @@ -0,0 +1,17 @@ +# -*- shell-script -*- +# +# Copyright (c) 2018 Mellanox Technologies. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_pmix_common_dstore_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_pmix_common_dstore_CONFIG], [ + AC_CONFIG_FILES([src/mca/common/dstore/Makefile]) + $1 +])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c similarity index 55% rename from opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c rename to opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c index 52465412253..c0fc676e6c9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c @@ -1,9 +1,9 @@ /* * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science + * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ @@ -50,8 +50,10 @@ #include "src/mca/preg/preg.h" #include "src/mca/gds/base/base.h" -#include "gds_dstore.h" #include "src/mca/pshmem/base/base.h" +#include "dstore_common.h" +#include "dstore_base.h" +#include "dstore_segment.h" #define ESH_REGION_EXTENSION "EXTENSION_SLOT" #define ESH_REGION_INVALIDATED "INVALIDATED" @@ -60,418 +62,89 @@ #define ESH_ENV_NS_DATA_SEG_SIZE "NS_DATA_SEG_SIZE" #define ESH_ENV_LINEAR "SM_USE_LINEAR_SEARCH" -#define ESH_MIN_KEY_LEN (sizeof(ESH_REGION_INVALIDATED)) - -#define ESH_KV_SIZE(addr) \ -__pmix_attribute_extension__ ({ \ - size_t sz; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - sz = ESH_KV_SIZE_V12(addr); \ - } else { \ - sz = ESH_KV_SIZE_V20(addr); \ - } \ - sz; \ -}) - -#define ESH_KNAME_PTR(addr) \ -__pmix_attribute_extension__ ({ \ - char *name_ptr; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - name_ptr = ESH_KNAME_PTR_V12(addr); \ - } else { \ - name_ptr = ESH_KNAME_PTR_V20(addr); \ - } \ - name_ptr; \ -}) - -#define ESH_KNAME_LEN(key) \ -__pmix_attribute_extension__ ({ \ - size_t len; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - len = ESH_KNAME_LEN_V12(key); \ - } else { \ - len = ESH_KNAME_LEN_V20(key); \ - } \ - len; \ -}) - -#define ESH_DATA_PTR(addr) \ -__pmix_attribute_extension__ ({ \ - uint8_t *data_ptr; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - data_ptr = ESH_DATA_PTR_V12(addr); \ - } else { \ - data_ptr = ESH_DATA_PTR_V20(addr); \ - } \ - data_ptr; \ -}) - -#define ESH_DATA_SIZE(addr, data_ptr) \ -__pmix_attribute_extension__ ({ \ - size_t sz; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - sz = ESH_DATA_SIZE_V12(addr); \ - } else { \ - sz = ESH_DATA_SIZE_V20(addr, data_ptr); \ - } \ - sz; \ -}) - -#define ESH_KEY_SIZE(key, size) \ -__pmix_attribute_extension__ ({ \ - size_t len; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - len = ESH_KEY_SIZE_V12(key, size); \ - } else { \ - len = ESH_KEY_SIZE_V20(key, size); \ - } \ - len; \ -}) - -#define EXT_SLOT_SIZE() \ -__pmix_attribute_extension__ ({ \ - size_t sz; \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - sz = EXT_SLOT_SIZE_V12(); \ - } else { \ - sz = EXT_SLOT_SIZE_V20(); \ - } \ - sz; \ -}) - -#define ESH_PUT_KEY(addr, key, buffer, size) \ -__pmix_attribute_extension__ ({ \ - if (PMIX_PROC_IS_V1(_client_peer())) { \ - ESH_PUT_KEY_V12(addr, key, buffer, size); \ - } else { \ - ESH_PUT_KEY_V20(addr, key, buffer, size); \ - } \ -}) - -/* PMIx v2.x dstore specific macro */ -#define ESH_KV_SIZE_V20(addr) \ -__pmix_attribute_extension__ ({ \ - size_t sz; \ - memcpy(&sz, addr, sizeof(size_t)); \ - sz; \ -}) - -#define ESH_KNAME_PTR_V20(addr) \ -__pmix_attribute_extension__ ({ \ - char *name_ptr = (char *)addr + sizeof(size_t); \ - name_ptr; \ -}) - -#define ESH_KNAME_LEN_V20(key) \ -__pmix_attribute_extension__ ({ \ - size_t kname_len = strlen(key) + 1; \ - size_t len = (kname_len < ESH_MIN_KEY_LEN) ? \ - ESH_MIN_KEY_LEN : kname_len; \ - len; \ -}) - -#define ESH_DATA_PTR_V20(addr) \ -__pmix_attribute_extension__ ({ \ - size_t kname_len = \ - ESH_KNAME_LEN_V20(ESH_KNAME_PTR_V20(addr)); \ - uint8_t *data_ptr = addr + sizeof(size_t) + kname_len; \ - data_ptr; \ -}) - -#define ESH_DATA_SIZE_V20(addr, data_ptr) \ -__pmix_attribute_extension__ ({ \ - size_t sz = ESH_KV_SIZE_V20(addr); \ - size_t data_size = sz - (data_ptr - addr); \ - data_size; \ -}) - -#define ESH_KEY_SIZE_V20(key, size) \ -__pmix_attribute_extension__ ({ \ - size_t len = \ - sizeof(size_t) + ESH_KNAME_LEN_V20(key) + size; \ - len; \ -}) - -/* in ext slot new offset will be stored in case if - * new data were added for the same process during - * next commit - */ -#define EXT_SLOT_SIZE_V20() \ - (ESH_KEY_SIZE_V20(ESH_REGION_EXTENSION, sizeof(size_t))) - - -#define ESH_PUT_KEY_V20(addr, key, buffer, size) \ -__pmix_attribute_extension__ ({ \ - size_t sz = ESH_KEY_SIZE_V20(key, size); \ - memcpy(addr, &sz, sizeof(size_t)); \ - memset(addr + sizeof(size_t), 0, \ - ESH_KNAME_LEN_V20(key)); \ - strncpy((char *)addr + sizeof(size_t), \ - key, ESH_KNAME_LEN_V20(key)); \ - memcpy(addr + sizeof(size_t) + ESH_KNAME_LEN_V20(key), \ - buffer, size); \ -}) - -/* PMIx v1.2 dstore specific macro */ -#define ESH_KEY_SIZE_V12(key, size) \ -__pmix_attribute_extension__ ({ \ - size_t len = strlen(key) + 1 + sizeof(size_t) + size; \ - len; \ -}) - -/* in ext slot new offset will be stored in case if - * new data were added for the same process during - * next commit - */ -#define EXT_SLOT_SIZE_V12() \ - (ESH_KEY_SIZE_V12(ESH_REGION_EXTENSION, sizeof(size_t))) - -#define ESH_KV_SIZE_V12(addr) \ -__pmix_attribute_extension__ ({ \ - size_t sz; \ - memcpy(&sz, addr + \ - ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)), \ - sizeof(size_t)); \ - sz += ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)) + \ - sizeof(size_t); \ - sz; \ -}) - -#define ESH_KNAME_PTR_V12(addr) \ -__pmix_attribute_extension__ ({ \ - char *name_ptr = (char *)addr; \ - name_ptr; \ -}) - -#define ESH_KNAME_LEN_V12(key) \ -__pmix_attribute_extension__ ({ \ - size_t len = strlen((char*)key) + 1; \ - len; \ -}) - -#define ESH_DATA_PTR_V12(addr) \ -__pmix_attribute_extension__ ({ \ - uint8_t *data_ptr = \ - addr + \ - sizeof(size_t) + \ - ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)); \ - data_ptr; \ -}) - -#define ESH_DATA_SIZE_V12(addr) \ -__pmix_attribute_extension__ ({ \ - size_t data_size; \ - memcpy(&data_size, \ - addr + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)), \ - sizeof(size_t)); \ - data_size; \ -}) - -#define ESH_PUT_KEY_V12(addr, key, buffer, size) \ -__pmix_attribute_extension__ ({ \ - size_t sz = size; \ - memset(addr, 0, ESH_KNAME_LEN_V12(key)); \ - strncpy((char *)addr, key, ESH_KNAME_LEN_V12(key)); \ - memcpy(addr + ESH_KNAME_LEN_V12(key), &sz, \ - sizeof(size_t)); \ - memcpy(addr + ESH_KNAME_LEN_V12(key) + sizeof(size_t), \ - buffer, size); \ -}) - -#ifdef ESH_PTHREAD_LOCK -#define _ESH_LOCK(rwlock, func) \ -__pmix_attribute_extension__ ({ \ - pmix_status_t ret = PMIX_SUCCESS; \ - int rc; \ - rc = pthread_rwlock_##func(rwlock); \ - if (0 != rc) { \ - switch (errno) { \ - case EINVAL: \ - ret = PMIX_ERR_INIT; \ - break; \ - case EPERM: \ - ret = PMIX_ERR_NO_PERMISSIONS; \ - break; \ - } \ - } \ - if (ret) { \ - pmix_output(0, "%s %d:%s lock failed: %s", \ - __FILE__, __LINE__, __func__, strerror(errno)); \ - } \ - ret; \ -}) - -#define _ESH_WRLOCK(rwlock) _ESH_LOCK(rwlock, wrlock) -#define _ESH_RDLOCK(rwlock) _ESH_LOCK(rwlock, rdlock) -#define _ESH_UNLOCK(rwlock) _ESH_LOCK(rwlock, unlock) -#endif - -#ifdef ESH_FCNTL_LOCK -#define _ESH_LOCK(lockfd, operation) \ -__pmix_attribute_extension__ ({ \ - pmix_status_t ret = PMIX_SUCCESS; \ - int i; \ - struct flock fl = {0}; \ - fl.l_type = operation; \ - fl.l_whence = SEEK_SET; \ - for(i = 0; i < 10; i++) { \ - if( 0 > fcntl(lockfd, F_SETLKW, &fl) ) { \ - switch( errno ){ \ - case EINTR: \ - continue; \ - case ENOENT: \ - case EINVAL: \ - ret = PMIX_ERR_NOT_FOUND; \ - break; \ - case EBADF: \ - ret = PMIX_ERR_BAD_PARAM; \ - break; \ - case EDEADLK: \ - case EFAULT: \ - case ENOLCK: \ - ret = PMIX_ERR_RESOURCE_BUSY; \ - break; \ - default: \ - ret = PMIX_ERROR; \ - break; \ - } \ - } \ - break; \ - } \ - if (ret) { \ - pmix_output(0, "%s %d:%s lock failed: %s", \ - __FILE__, __LINE__, __func__, strerror(errno)); \ - } \ - ret; \ -}) - -#define _ESH_WRLOCK(lock) _ESH_LOCK(lock, F_WRLCK) -#define _ESH_RDLOCK(lock) _ESH_LOCK(lock, F_RDLCK) -#define _ESH_UNLOCK(lock) _ESH_LOCK(lock, F_UNLCK) -#endif - #define ESH_INIT_SESSION_TBL_SIZE 2 #define ESH_INIT_NS_MAP_TBL_SIZE 2 -static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_buffer_t *buf); -static seg_desc_t *_create_new_segment(segment_type type, const ns_map_data_t *ns_map, uint32_t id); -static seg_desc_t *_attach_new_segment(segment_type type, const ns_map_data_t *ns_map, uint32_t id); -static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info); -static int _put_ns_info_to_initial_segment(const ns_map_data_t *ns_map, pmix_pshmem_seg_t *metaseg, pmix_pshmem_seg_t *dataseg); -static ns_seg_info_t *_get_ns_info_from_initial_segment(const ns_map_data_t *ns_map); -static ns_track_elem_t *_get_track_elem_for_namespace(ns_map_data_t *ns_map); -static rank_meta_info *_get_rank_meta_info(pmix_rank_t rank, seg_desc_t *segdesc); -static uint8_t *_get_data_region_by_offset(seg_desc_t *segdesc, size_t offset); -static void _update_initial_segment_info(const ns_map_data_t *ns_map); -static void _set_constants_from_env(void); -static void _delete_sm_desc(seg_desc_t *desc); -static int _pmix_getpagesize(void); -static inline ssize_t _get_univ_size(const char *nspace); - -static inline ns_map_data_t * _esh_session_map_search_server(const char *nspace); -static inline ns_map_data_t * _esh_session_map_search_client(const char *nspace); -static inline ns_map_data_t * _esh_session_map(const char *nspace, size_t tbl_idx); -static inline void _esh_session_map_clean(ns_map_t *m); -static inline int _esh_jobuid_tbl_search(uid_t jobuid, size_t *tbl_idx); -static inline int _esh_session_tbl_add(size_t *tbl_idx); -static inline int _esh_session_init(size_t idx, ns_map_data_t *m, size_t jobuid, int setjobuid); -static inline void _esh_session_release(session_t *s); -static inline void _esh_ns_track_cleanup(void); -static inline void _esh_sessions_cleanup(void); -static inline void _esh_ns_map_cleanup(void); +static int _store_data_for_rank(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_info, + pmix_rank_t rank, pmix_buffer_t *buf); +static int _update_ns_elem(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_elem, ns_seg_info_t *info); +static int _put_ns_info_to_initial_segment(pmix_common_dstore_ctx_t *ds_ctx, + const ns_map_data_t *ns_map, pmix_pshmem_seg_t *metaseg, + pmix_pshmem_seg_t *dataseg); +static ns_seg_info_t *_get_ns_info_from_initial_segment(pmix_common_dstore_ctx_t *ds_ctx, + const ns_map_data_t *ns_map); +static ns_track_elem_t *_get_track_elem_for_namespace(pmix_common_dstore_ctx_t *ds_ctx, + ns_map_data_t *ns_map); +static rank_meta_info *_get_rank_meta_info(pmix_common_dstore_ctx_t *ds_ctx, pmix_rank_t rank, + pmix_dstore_seg_desc_t *segdesc); +static uint8_t *_get_data_region_by_offset(pmix_common_dstore_ctx_t *ds_ctx, + pmix_dstore_seg_desc_t *segdesc, size_t offset); +static void _update_initial_segment_info(pmix_common_dstore_ctx_t *ds_ctx, + const ns_map_data_t *ns_map); +static void _set_constants_from_env(pmix_common_dstore_ctx_t *ds_ctx); +static inline ssize_t _get_univ_size(pmix_common_dstore_ctx_t *ds_ctx, const char *nspace); + +static inline ns_map_data_t * _esh_session_map_search_server(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace); +static inline ns_map_data_t * _esh_session_map_search_client(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace); +static inline ns_map_data_t * _esh_session_map(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, uint32_t local_size, + size_t tbl_idx); +static inline void _esh_session_map_clean(pmix_common_dstore_ctx_t *ds_ctx, ns_map_t *m); +static inline int _esh_jobuid_tbl_search(pmix_common_dstore_ctx_t *ds_ctx, + uid_t jobuid, size_t *tbl_idx); +static inline int _esh_session_tbl_add(pmix_common_dstore_ctx_t *ds_ctx, size_t *tbl_idx); +static int _esh_session_init(pmix_common_dstore_ctx_t *ds_ctx, size_t idx, ns_map_data_t *m, + uint32_t local_size, size_t jobuid, int setjobuid); +static void _esh_session_release(pmix_common_dstore_ctx_t *ds_ctx, size_t idx); +static inline void _esh_ns_track_cleanup(pmix_common_dstore_ctx_t *ds_ctx); +static inline void _esh_sessions_cleanup(pmix_common_dstore_ctx_t *ds_ctx); +static inline void _esh_ns_map_cleanup(pmix_common_dstore_ctx_t *ds_ctx); static inline int _esh_dir_del(const char *dirname); -static inline void _client_compat_save(pmix_peer_t *peer); -static inline pmix_peer_t * _client_peer(void); +static inline void _client_compat_save(pmix_common_dstore_ctx_t *ds_ctx, pmix_peer_t *peer); +static inline pmix_peer_t * _client_peer(pmix_common_dstore_ctx_t *ds_ctx); static inline int _my_client(const char *nspace, pmix_rank_t rank); -static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo); +static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_byte_object_t *bo); -static void dstore_finalize(void); +static pmix_status_t _dstore_store_nolock(pmix_common_dstore_ctx_t *ds_ctx, + ns_map_data_t *ns_map, + pmix_rank_t rank, + pmix_kval_t *kv); -static pmix_status_t dstore_setup_fork(const pmix_proc_t *peer, char ***env); +static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, pmix_rank_t rank, + const char *key, pmix_value_t **kvs); -static pmix_status_t dstore_cache_job_info(struct pmix_nspace_t *ns, - pmix_info_t info[], size_t ninfo); +ns_map_data_t * (*_esh_session_map_search)(const char *nspace) = NULL; -static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, - pmix_buffer_t *reply); +#define _ESH_SESSION_lock(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].lock) -static pmix_status_t dstore_store_job_info(const char *nspace, - pmix_buffer_t *job_data); +#define _ESH_SESSION_path(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].nspace_path) -static pmix_status_t _dstore_store(const char *nspace, - pmix_rank_t rank, - pmix_kval_t *kv); +#define _ESH_SESSION_lockfile(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].lockfile) -static pmix_status_t dstore_store(const pmix_proc_t *proc, - pmix_scope_t scope, - pmix_kval_t *kv); - -static pmix_status_t _dstore_fetch(const char *nspace, - pmix_rank_t rank, - const char *key, pmix_value_t **kvs); - -static pmix_status_t dstore_fetch(const pmix_proc_t *proc, - pmix_scope_t scope, bool copy, - const char *key, - pmix_info_t info[], size_t ninfo, - pmix_list_t *kvs); - -static pmix_status_t dstore_add_nspace(const char *nspace, - pmix_info_t info[], - size_t ninfo); - -static pmix_status_t dstore_del_nspace(const char* nspace); - -static pmix_status_t dstore_assign_module(pmix_info_t *info, size_t ninfo, - int *priority); - -static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo); - -pmix_gds_base_module_t pmix_ds12_module = { - .name = "ds12", - .init = dstore_init, - .finalize = dstore_finalize, - .assign_module = dstore_assign_module, - .cache_job_info = dstore_cache_job_info, - .register_job_info = dstore_register_job_info, - .store_job_info = dstore_store_job_info, - .store = dstore_store, - .store_modex = dstore_store_modex, - .fetch = dstore_fetch, - .setup_fork = dstore_setup_fork, - .add_nspace = dstore_add_nspace, - .del_nspace = dstore_del_nspace, -}; - -static char *_base_path = NULL; -static size_t _initial_segment_size = 0; -static size_t _max_ns_num; -static size_t _meta_segment_size = 0; -static size_t _max_meta_elems; -static size_t _data_segment_size = 0; -static size_t _lock_segment_size = 0; -static uid_t _jobuid; -static char _setjobuid = 0; -static pmix_peer_t *_clients_peer = NULL; - -static pmix_value_array_t *_session_array = NULL; -static pmix_value_array_t *_ns_map_array = NULL; -static pmix_value_array_t *_ns_track_array = NULL; +#define _ESH_SESSION_setjobuid(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].setjobuid) -ns_map_data_t * (*_esh_session_map_search)(const char *nspace) = NULL; -int (*_esh_lock_init)(size_t idx) = NULL; +#define _ESH_SESSION_jobuid(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].jobuid) + +#define _ESH_SESSION_sm_seg_first(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].sm_seg_first) +#define _ESH_SESSION_sm_seg_last(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].sm_seg_last) -#define _ESH_SESSION_path(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].nspace_path) -#define _ESH_SESSION_lockfile(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].lockfile) -#define _ESH_SESSION_setjobuid(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].setjobuid) -#define _ESH_SESSION_jobuid(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].jobuid) -#define _ESH_SESSION_sm_seg_first(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].sm_seg_first) -#define _ESH_SESSION_sm_seg_last(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].sm_seg_last) -#define _ESH_SESSION_ns_info(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].ns_info) +#define _ESH_SESSION_ns_info(session_array, tbl_idx) \ + (PMIX_VALUE_ARRAY_GET_BASE(session_array, session_t)[tbl_idx].ns_info) #ifdef ESH_PTHREAD_LOCK #define _ESH_SESSION_pthread_rwlock(tbl_idx) (PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t)[tbl_idx].rwlock) @@ -484,14 +157,13 @@ int (*_esh_lock_init)(size_t idx) = NULL; #define _ESH_SESSION_lock(tbl_idx) _ESH_SESSION_lockfd(tbl_idx) #endif -/* If _direct_mode is set, it means that we use linear search - * along the array of rank meta info objects inside a meta segment - * to find the requested rank. Otherwise, we do a fast lookup - * based on rank and directly compute offset. - * This mode is called direct because it's effectively used in - * sparse communication patterns when direct modex is usually used. - */ -static int _direct_mode = 0; +#define _ESH_LOCK(ds_ctx, session_id, operation) \ +__pmix_attribute_extension__ ({ \ + pmix_status_t rc = PMIX_SUCCESS; \ + rc = ds_ctx->lock_cbs->operation(_ESH_SESSION_lock(ds_ctx->session_array, \ + session_id)); \ + rc; \ +}) static void ncon(ns_track_elem_t *p) { memset(&p->ns_map, 0, sizeof(p->ns_map)); @@ -503,8 +175,8 @@ static void ncon(ns_track_elem_t *p) { } static void ndes(ns_track_elem_t *p) { - _delete_sm_desc(p->meta_seg); - _delete_sm_desc(p->data_seg); + pmix_common_dstor_delete_sm_desc(p->meta_seg); + pmix_common_dstor_delete_sm_desc(p->data_seg); memset(&p->ns_map, 0, sizeof(p->ns_map)); p->in_use = false; } @@ -513,153 +185,11 @@ PMIX_CLASS_INSTANCE(ns_track_elem_t, pmix_value_array_t, ncon, ndes); -static inline void _esh_session_map_clean(ns_map_t *m) { +static inline void _esh_session_map_clean(pmix_common_dstore_ctx_t *ds_ctx, ns_map_t *m) { memset(m, 0, sizeof(*m)); m->data.track_idx = -1; } -#ifdef ESH_FCNTL_LOCK -static inline int _flock_init(size_t idx) { - pmix_status_t rc = PMIX_SUCCESS; - - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - _ESH_SESSION_lock(idx) = open(_ESH_SESSION_lockfile(idx), O_CREAT | O_RDWR | O_EXCL, 0600); - - /* if previous launch was crashed, the lockfile might not be deleted and unlocked, - * so we delete it and create a new one. */ - if (_ESH_SESSION_lock(idx) < 0) { - unlink(_ESH_SESSION_lockfile(idx)); - _ESH_SESSION_lock(idx) = open(_ESH_SESSION_lockfile(idx), O_CREAT | O_RDWR, 0600); - if (_ESH_SESSION_lock(idx) < 0) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - } - if (_ESH_SESSION_setjobuid(idx) > 0) { - if (0 > chown(_ESH_SESSION_lockfile(idx), (uid_t) _ESH_SESSION_jobuid(idx), (gid_t) -1)) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - if (0 > chmod(_ESH_SESSION_lockfile(idx), S_IRUSR | S_IWGRP | S_IRGRP)) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - } - } - else { - _ESH_SESSION_lock(idx) = open(_ESH_SESSION_lockfile(idx), O_RDONLY); - if (-1 == _ESH_SESSION_lock(idx)) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - } - return rc; -} -#endif - -#ifdef ESH_PTHREAD_LOCK -static inline int _rwlock_init(size_t idx) { - pmix_status_t rc = PMIX_SUCCESS; - size_t size = _lock_segment_size; - pthread_rwlockattr_t attr; - - if ((NULL != _ESH_SESSION_pthread_seg(idx)) || (NULL != _ESH_SESSION_pthread_rwlock(idx))) { - rc = PMIX_ERR_INIT; - return rc; - } - _ESH_SESSION_pthread_seg(idx) = (pmix_pshmem_seg_t *)malloc(sizeof(pmix_pshmem_seg_t)); - if (NULL == _ESH_SESSION_pthread_seg(idx)) { - rc = PMIX_ERR_OUT_OF_RESOURCE; - return rc; - } - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_create(_ESH_SESSION_pthread_seg(idx), _ESH_SESSION_lockfile(idx), size))) { - return rc; - } - memset(_ESH_SESSION_pthread_seg(idx)->seg_base_addr, 0, size); - if (_ESH_SESSION_setjobuid(idx) > 0) { - if (0 > chown(_ESH_SESSION_lockfile(idx), (uid_t) _ESH_SESSION_jobuid(idx), (gid_t) -1)){ - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - /* set the mode as required */ - if (0 > chmod(_ESH_SESSION_lockfile(idx), S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - } - _ESH_SESSION_pthread_rwlock(idx) = (pthread_rwlock_t *)_ESH_SESSION_pthread_seg(idx)->seg_base_addr; - - if (0 != pthread_rwlockattr_init(&attr)) { - rc = PMIX_ERR_INIT; - pmix_pshmem.segment_detach(_ESH_SESSION_pthread_seg(idx)); - return rc; - } - if (0 != pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) { - rc = PMIX_ERR_INIT; - pmix_pshmem.segment_detach(_ESH_SESSION_pthread_seg(idx)); - pthread_rwlockattr_destroy(&attr); - return rc; - } -#ifdef HAVE_PTHREAD_SETKIND - if (0 != pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) { - rc = PMIX_ERR_INIT; - pmix_pshmem.segment_detach(_ESH_SESSION_pthread_seg(idx)); - pthread_rwlockattr_destroy(&attr); - return rc; - } -#endif - if (0 != pthread_rwlock_init(_ESH_SESSION_pthread_rwlock(idx), &attr)) { - rc = PMIX_ERR_INIT; - pmix_pshmem.segment_detach(_ESH_SESSION_pthread_seg(idx)); - pthread_rwlockattr_destroy(&attr); - return rc; - } - if (0 != pthread_rwlockattr_destroy(&attr)) { - rc = PMIX_ERR_INIT; - return rc; - } - - } - else { - _ESH_SESSION_pthread_seg(idx)->seg_size = size; - snprintf(_ESH_SESSION_pthread_seg(idx)->seg_name, PMIX_PATH_MAX, "%s", _ESH_SESSION_lockfile(idx)); - if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_attach(_ESH_SESSION_pthread_seg(idx), PMIX_PSHMEM_RW))) { - return rc; - } - _ESH_SESSION_pthread_rwlock(idx) = (pthread_rwlock_t *)_ESH_SESSION_pthread_seg(idx)->seg_base_addr; - } - - return rc; -} - -static inline void _rwlock_release(session_t *s) { - pmix_status_t rc; - - if (0 != pthread_rwlock_destroy(s->rwlock)) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return; - } - - /* detach & unlink from current desc */ - if (s->rwlock_seg->seg_cpid == getpid()) { - pmix_pshmem.segment_unlink(s->rwlock_seg); - } - pmix_pshmem.segment_detach(s->rwlock_seg); - - free(s->rwlock_seg); - s->rwlock_seg = NULL; - s->rwlock = NULL; -} -#endif - static inline int _esh_dir_del(const char *path) { DIR *dir; @@ -715,132 +245,133 @@ static inline int _esh_dir_del(const char *path) return rc; } -static inline int _esh_tbls_init(void) +static inline int _esh_tbls_init(pmix_common_dstore_ctx_t *ds_ctx) { pmix_status_t rc = PMIX_SUCCESS; size_t idx; /* initial settings */ - _ns_track_array = NULL; - _session_array = NULL; - _ns_map_array = NULL; + ds_ctx->ns_track_array = NULL; + ds_ctx->session_array = NULL; + ds_ctx->ns_map_array = NULL; /* Setup namespace tracking array */ - if (NULL == (_ns_track_array = PMIX_NEW(pmix_value_array_t))) { + if (NULL == (ds_ctx->ns_track_array = PMIX_NEW(pmix_value_array_t))) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc = pmix_value_array_init(_ns_track_array, sizeof(ns_track_elem_t)))){ + if (PMIX_SUCCESS != (rc = pmix_value_array_init(ds_ctx->ns_track_array, sizeof(ns_track_elem_t)))){ PMIX_ERROR_LOG(rc); goto err_exit; } /* Setup sessions table */ - if (NULL == (_session_array = PMIX_NEW(pmix_value_array_t))){ + if (NULL == (ds_ctx->session_array = PMIX_NEW(pmix_value_array_t))){ rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc = pmix_value_array_init(_session_array, sizeof(session_t)))) { + if (PMIX_SUCCESS != (rc = pmix_value_array_init(ds_ctx->session_array, sizeof(session_t)))) { PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(_session_array, ESH_INIT_SESSION_TBL_SIZE))) { + if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(ds_ctx->session_array, ESH_INIT_SESSION_TBL_SIZE))) { PMIX_ERROR_LOG(rc); goto err_exit; } for (idx = 0; idx < ESH_INIT_SESSION_TBL_SIZE; idx++) { - memset(pmix_value_array_get_item(_session_array, idx), 0, sizeof(session_t)); + memset(pmix_value_array_get_item(ds_ctx->session_array, idx), 0, sizeof(session_t)); } /* Setup namespace map array */ - if (NULL == (_ns_map_array = PMIX_NEW(pmix_value_array_t))) { + if (NULL == (ds_ctx->ns_map_array = PMIX_NEW(pmix_value_array_t))) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc = pmix_value_array_init(_ns_map_array, sizeof(ns_map_t)))) { + if (PMIX_SUCCESS != (rc = pmix_value_array_init(ds_ctx->ns_map_array, sizeof(ns_map_t)))) { PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(_ns_map_array, ESH_INIT_NS_MAP_TBL_SIZE))) { + if (PMIX_SUCCESS != (rc = pmix_value_array_set_size(ds_ctx->ns_map_array, ESH_INIT_NS_MAP_TBL_SIZE))) { PMIX_ERROR_LOG(rc); goto err_exit; } for (idx = 0; idx < ESH_INIT_NS_MAP_TBL_SIZE; idx++) { - _esh_session_map_clean(pmix_value_array_get_item(_ns_map_array, idx)); + _esh_session_map_clean(ds_ctx, pmix_value_array_get_item(ds_ctx->ns_map_array, idx)); } return PMIX_SUCCESS; err_exit: - if (NULL != _ns_track_array) { - PMIX_RELEASE(_ns_track_array); + if (NULL != ds_ctx->ns_track_array) { + PMIX_RELEASE(ds_ctx->ns_track_array); } - if (NULL != _session_array) { - PMIX_RELEASE(_session_array); + if (NULL != ds_ctx->session_array) { + PMIX_RELEASE(ds_ctx->session_array); } - if (NULL != _ns_map_array) { - PMIX_RELEASE(_ns_map_array); + if (NULL != ds_ctx->ns_map_array) { + PMIX_RELEASE(ds_ctx->ns_map_array); } return rc; } -static inline void _esh_ns_map_cleanup(void) +static inline void _esh_ns_map_cleanup(pmix_common_dstore_ctx_t *ds_ctx) { size_t idx; size_t size; ns_map_t *ns_map; - if (NULL == _ns_map_array) { + if (NULL == ds_ctx->ns_map_array) { return; } - size = pmix_value_array_get_size(_ns_map_array); - ns_map = PMIX_VALUE_ARRAY_GET_BASE(_ns_map_array, ns_map_t); + size = pmix_value_array_get_size(ds_ctx->ns_map_array); + ns_map = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_map_array, ns_map_t); for (idx = 0; idx < size; idx++) { - if(ns_map[idx].in_use) - _esh_session_map_clean(&ns_map[idx]); + if(ns_map[idx].in_use) { + _esh_session_map_clean(ds_ctx, &ns_map[idx]); + } } - PMIX_RELEASE(_ns_map_array); - _ns_map_array = NULL; + PMIX_RELEASE(ds_ctx->ns_map_array); + ds_ctx->ns_map_array = NULL; } -static inline void _esh_sessions_cleanup(void) +static inline void _esh_sessions_cleanup(pmix_common_dstore_ctx_t *ds_ctx) { size_t idx; size_t size; session_t *s_tbl; - if (NULL == _session_array) { + if (NULL == ds_ctx->session_array) { return; } - size = pmix_value_array_get_size(_session_array); - s_tbl = PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t); + size = pmix_value_array_get_size(ds_ctx->session_array); + s_tbl = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->session_array, session_t); for (idx = 0; idx < size; idx++) { if(s_tbl[idx].in_use) - _esh_session_release(&s_tbl[idx]); + _esh_session_release(ds_ctx, idx); } - PMIX_RELEASE(_session_array); - _session_array = NULL; + PMIX_RELEASE(ds_ctx->session_array); + ds_ctx->session_array = NULL; } -static inline void _esh_ns_track_cleanup(void) +static inline void _esh_ns_track_cleanup(pmix_common_dstore_ctx_t *ds_ctx) { int size; ns_track_elem_t *ns_trk; - if (NULL == _ns_track_array) { + if (NULL == ds_ctx->ns_track_array) { return; } - size = pmix_value_array_get_size(_ns_track_array); - ns_trk = PMIX_VALUE_ARRAY_GET_BASE(_ns_track_array, ns_track_elem_t); + size = pmix_value_array_get_size(ds_ctx->ns_track_array); + ns_trk = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_track_array, ns_track_elem_t); for (int i = 0; i < size; i++) { ns_track_elem_t *trk = ns_trk + i; @@ -849,15 +380,17 @@ static inline void _esh_ns_track_cleanup(void) } } - PMIX_RELEASE(_ns_track_array); - _ns_track_array = NULL; + PMIX_RELEASE(ds_ctx->ns_track_array); + ds_ctx->ns_track_array = NULL; } -static inline ns_map_data_t * _esh_session_map(const char *nspace, size_t tbl_idx) +static inline ns_map_data_t * _esh_session_map(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, uint32_t local_size, + size_t tbl_idx) { size_t map_idx; - size_t size = pmix_value_array_get_size(_ns_map_array);; - ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(_ns_map_array, ns_map_t);; + size_t size = pmix_value_array_get_size(ds_ctx->ns_map_array); + ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_map_array, ns_map_t); ns_map_t *new_map = NULL; if (NULL == nspace) { @@ -868,32 +401,33 @@ static inline ns_map_data_t * _esh_session_map(const char *nspace, size_t tbl_id for(map_idx = 0; map_idx < size; map_idx++) { if (!ns_map[map_idx].in_use) { ns_map[map_idx].in_use = true; - strncpy(ns_map[map_idx].data.name, nspace, sizeof(ns_map[map_idx].data.name)-1); + pmix_strncpy(ns_map[map_idx].data.name, nspace, sizeof(ns_map[map_idx].data.name)-1); ns_map[map_idx].data.tbl_idx = tbl_idx; return &ns_map[map_idx].data; } } - if (NULL == (new_map = pmix_value_array_get_item(_ns_map_array, map_idx))) { + if (NULL == (new_map = pmix_value_array_get_item(ds_ctx->ns_map_array, map_idx))) { PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); return NULL; } - _esh_session_map_clean(new_map); + _esh_session_map_clean(ds_ctx, new_map); new_map->in_use = true; new_map->data.tbl_idx = tbl_idx; - strncpy(new_map->data.name, nspace, sizeof(new_map->data.name)-1); + pmix_strncpy(new_map->data.name, nspace, sizeof(new_map->data.name)-1); return &new_map->data; } -static inline int _esh_jobuid_tbl_search(uid_t jobuid, size_t *tbl_idx) +static inline int _esh_jobuid_tbl_search(pmix_common_dstore_ctx_t *ds_ctx, + uid_t jobuid, size_t *tbl_idx) { size_t idx, size; session_t *session_tbl = NULL; - size = pmix_value_array_get_size(_session_array); - session_tbl = PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t); + size = pmix_value_array_get_size(ds_ctx->session_array); + session_tbl = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->session_array, session_t); for(idx = 0; idx < size; idx++) { if (session_tbl[idx].in_use && session_tbl[idx].jobuid == jobuid) { @@ -905,37 +439,38 @@ static inline int _esh_jobuid_tbl_search(uid_t jobuid, size_t *tbl_idx) return PMIX_ERR_NOT_FOUND; } -static inline int _esh_session_tbl_add(size_t *tbl_idx) +static inline int _esh_session_tbl_add(pmix_common_dstore_ctx_t *ds_ctx, size_t *tbl_idx) { size_t idx; - size_t size = pmix_value_array_get_size(_session_array); - session_t *s_tbl = PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t); + size_t size = pmix_value_array_get_size(ds_ctx->session_array); + session_t *s_tbl = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->session_array, session_t); session_t *new_sesion; pmix_status_t rc = PMIX_SUCCESS; for(idx = 0; idx < size; idx ++) { if (0 == s_tbl[idx].in_use) { - s_tbl[idx].in_use = 1; - *tbl_idx = idx; - return PMIX_SUCCESS; + goto done; } } - if (NULL == (new_sesion = pmix_value_array_get_item(_session_array, idx))) { + if (NULL == (new_sesion = pmix_value_array_get_item(ds_ctx->session_array, idx))) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); return rc; } + +done: s_tbl[idx].in_use = 1; *tbl_idx = idx; return PMIX_SUCCESS; } -static inline ns_map_data_t * _esh_session_map_search_server(const char *nspace) +static inline ns_map_data_t * _esh_session_map_search_server(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace) { - size_t idx, size = pmix_value_array_get_size(_ns_map_array); - ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(_ns_map_array, ns_map_t); + size_t idx, size = pmix_value_array_get_size(ds_ctx->ns_map_array); + ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_map_array, ns_map_t); if (NULL == nspace) { return NULL; } @@ -949,10 +484,11 @@ static inline ns_map_data_t * _esh_session_map_search_server(const char *nspace) return NULL; } -static inline ns_map_data_t * _esh_session_map_search_client(const char *nspace) +static inline ns_map_data_t * _esh_session_map_search_client(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace) { - size_t idx, size = pmix_value_array_get_size(_ns_map_array); - ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(_ns_map_array, ns_map_t); + size_t idx, size = pmix_value_array_get_size(ds_ctx->ns_map_array); + ns_map_t *ns_map = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_map_array, ns_map_t); if (NULL == nspace) { return NULL; @@ -964,29 +500,19 @@ static inline ns_map_data_t * _esh_session_map_search_client(const char *nspace) return &ns_map[idx].data; } } - return _esh_session_map(nspace, 0); + return _esh_session_map(ds_ctx, nspace, 0, 0); } -static inline int _esh_session_init(size_t idx, ns_map_data_t *m, size_t jobuid, int setjobuid) +static int _esh_session_init(pmix_common_dstore_ctx_t *ds_ctx, size_t idx, ns_map_data_t *m, + uint32_t local_size, size_t jobuid, int setjobuid) { - seg_desc_t *seg = NULL; - session_t *s = &(PMIX_VALUE_ARRAY_GET_ITEM(_session_array, session_t, idx)); + pmix_dstore_seg_desc_t *seg = NULL; + session_t *s = &(PMIX_VALUE_ARRAY_GET_ITEM(ds_ctx->session_array, session_t, idx)); pmix_status_t rc = PMIX_SUCCESS; s->setjobuid = setjobuid; s->jobuid = jobuid; - s->nspace_path = strdup(_base_path); - - /* create a lock file to prevent clients from reading while server is writing to the shared memory. - * This situation is quite often, especially in case of direct modex when clients might ask for data - * simultaneously.*/ - if(0 > asprintf(&s->lockfile, "%s/dstore_sm.lock", s->nspace_path)) { - rc = PMIX_ERR_OUT_OF_RESOURCE; - PMIX_ERROR_LOG(rc); - return rc; - } - PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, - "%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, s->lockfile)); + s->nspace_path = strdup(ds_ctx->base_path); if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { if (0 != mkdir(s->nspace_path, 0770)) { @@ -1005,7 +531,8 @@ static inline int _esh_session_init(size_t idx, ns_map_data_t *m, size_t jobuid, return rc; } } - seg = _create_new_segment(INITIAL_SEGMENT, m, 0); + seg = pmix_common_dstor_create_new_segment(PMIX_DSTORE_INITIAL_SEGMENT, ds_ctx->base_path, + m->name, 0, ds_ctx->jobuid, ds_ctx->setjobuid); if( NULL == seg ){ rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); @@ -1013,245 +540,92 @@ static inline int _esh_session_init(size_t idx, ns_map_data_t *m, size_t jobuid, } } else { - seg = _attach_new_segment(INITIAL_SEGMENT, m, 0); + seg = pmix_common_dstor_attach_new_segment(PMIX_DSTORE_INITIAL_SEGMENT, ds_ctx->base_path, m->name, 0); if( NULL == seg ){ rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); return rc; } } - - if (NULL == _esh_lock_init) { - rc = PMIX_ERR_INIT; - PMIX_ERROR_LOG(rc); - return rc; - } - if ( PMIX_SUCCESS != (rc = _esh_lock_init(m->tbl_idx))) { - PMIX_ERROR_LOG(rc); - return rc; - } - s->sm_seg_first = seg; s->sm_seg_last = s->sm_seg_first; + return PMIX_SUCCESS; } -static inline void _esh_session_release(session_t *s) +static void _esh_session_release(pmix_common_dstore_ctx_t *ds_ctx, size_t idx) { + session_t *s = &(PMIX_VALUE_ARRAY_GET_ITEM(ds_ctx->session_array, session_t, idx)); + if (!s->in_use) { return; } - _delete_sm_desc(s->sm_seg_first); - /* if the lock fd was somehow set, then we - * need to close it */ - if (0 != s->lockfd) { - close(s->lockfd); - } + pmix_common_dstor_delete_sm_desc(s->sm_seg_first); + + ds_ctx->lock_cbs->finalize(&_ESH_SESSION_lock(ds_ctx->session_array, idx)); - if (NULL != s->lockfile) { - if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - unlink(s->lockfile); - } - free(s->lockfile); - } if (NULL != s->nspace_path) { if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { _esh_dir_del(s->nspace_path); } free(s->nspace_path); } -#ifdef ESH_PTHREAD_LOCK - _rwlock_release(s); -#endif memset ((char *) s, 0, sizeof(*s)); } -static void _set_constants_from_env() +static void _set_constants_from_env(pmix_common_dstore_ctx_t *ds_ctx) { char *str; - int page_size = _pmix_getpagesize(); + int page_size = pmix_common_dstor_getpagesize(); if( NULL != (str = getenv(ESH_ENV_INITIAL_SEG_SIZE)) ) { - _initial_segment_size = strtoul(str, NULL, 10); - if ((size_t)page_size > _initial_segment_size) { - _initial_segment_size = (size_t)page_size; + ds_ctx->initial_segment_size = strtoul(str, NULL, 10); + if ((size_t)page_size > ds_ctx->initial_segment_size) { + ds_ctx->initial_segment_size = (size_t)page_size; } } - if (0 == _initial_segment_size) { - _initial_segment_size = INITIAL_SEG_SIZE; + if (0 == ds_ctx->initial_segment_size) { + ds_ctx->initial_segment_size = INITIAL_SEG_SIZE; } if( NULL != (str = getenv(ESH_ENV_NS_META_SEG_SIZE)) ) { - _meta_segment_size = strtoul(str, NULL, 10); - if ((size_t)page_size > _meta_segment_size) { - _meta_segment_size = (size_t)page_size; + ds_ctx->meta_segment_size = strtoul(str, NULL, 10); + if ((size_t)page_size > ds_ctx->meta_segment_size) { + ds_ctx->meta_segment_size = (size_t)page_size; } } - if (0 == _meta_segment_size) { - _meta_segment_size = NS_META_SEG_SIZE; + if (0 == ds_ctx->meta_segment_size) { + ds_ctx->meta_segment_size = NS_META_SEG_SIZE; } if( NULL != (str = getenv(ESH_ENV_NS_DATA_SEG_SIZE)) ) { - _data_segment_size = strtoul(str, NULL, 10); - if ((size_t)page_size > _data_segment_size) { - _data_segment_size = (size_t)page_size; + ds_ctx->data_segment_size = strtoul(str, NULL, 10); + if ((size_t)page_size > ds_ctx->data_segment_size) { + ds_ctx->data_segment_size = (size_t)page_size; } } - if (0 == _data_segment_size) { - _data_segment_size = NS_DATA_SEG_SIZE; + if (0 == ds_ctx->data_segment_size) { + ds_ctx->data_segment_size = NS_DATA_SEG_SIZE; } if (NULL != (str = getenv(ESH_ENV_LINEAR))) { if (1 == strtoul(str, NULL, 10)) { - _direct_mode = 1; + ds_ctx->direct_mode = 1; } } - _lock_segment_size = page_size; - _max_ns_num = (_initial_segment_size - sizeof(size_t) * 2) / sizeof(ns_seg_info_t); - _max_meta_elems = (_meta_segment_size - sizeof(size_t)) / sizeof(rank_meta_info); + ds_ctx->lock_segment_size = page_size; + ds_ctx->max_ns_num = (ds_ctx->initial_segment_size - sizeof(size_t) * 2) / sizeof(ns_seg_info_t); + ds_ctx->max_meta_elems = (ds_ctx->meta_segment_size - sizeof(size_t)) / sizeof(rank_meta_info); -} + pmix_common_dstor_init_segment_info(ds_ctx->initial_segment_size, ds_ctx->meta_segment_size, + ds_ctx->data_segment_size); -static void _delete_sm_desc(seg_desc_t *desc) -{ - seg_desc_t *tmp; - - /* free all global segments */ - while (NULL != desc) { - tmp = desc->next; - /* detach & unlink from current desc */ - if (desc->seg_info.seg_cpid == getpid()) { - pmix_pshmem.segment_unlink(&desc->seg_info); - } - pmix_pshmem.segment_detach(&desc->seg_info); - free(desc); - desc = tmp; - } -} - -static int _pmix_getpagesize(void) -{ -#if defined(_SC_PAGESIZE ) - return sysconf(_SC_PAGESIZE); -#elif defined(_SC_PAGE_SIZE) - return sysconf(_SC_PAGE_SIZE); -#else - return 65536; /* safer to overestimate than under */ -#endif -} - -static seg_desc_t *_create_new_segment(segment_type type, const ns_map_data_t *ns_map, uint32_t id) -{ - pmix_status_t rc; - char file_name[PMIX_PATH_MAX]; - size_t size; - seg_desc_t *new_seg = NULL; - - PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, - "%s:%d:%s: segment type %d, nspace %s, id %u", - __FILE__, __LINE__, __func__, type, ns_map->name, id)); - - switch (type) { - case INITIAL_SEGMENT: - size = _initial_segment_size; - snprintf(file_name, PMIX_PATH_MAX, "%s/initial-pmix_shared-segment-%u", - _ESH_SESSION_path(ns_map->tbl_idx), id); - break; - case NS_META_SEGMENT: - size = _meta_segment_size; - snprintf(file_name, PMIX_PATH_MAX, "%s/smseg-%s-%u", - _ESH_SESSION_path(ns_map->tbl_idx), ns_map->name, id); - break; - case NS_DATA_SEGMENT: - size = _data_segment_size; - snprintf(file_name, PMIX_PATH_MAX, "%s/smdataseg-%s-%d", - _ESH_SESSION_path(ns_map->tbl_idx), ns_map->name, id); - break; - default: - PMIX_ERROR_LOG(PMIX_ERROR); - return NULL; - } - new_seg = (seg_desc_t*)malloc(sizeof(seg_desc_t)); - if (new_seg) { - new_seg->id = id; - new_seg->next = NULL; - new_seg->type = type; - rc = pmix_pshmem.segment_create(&new_seg->seg_info, file_name, size); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto err_exit; - } - memset(new_seg->seg_info.seg_base_addr, 0, size); - - - if (_ESH_SESSION_setjobuid(ns_map->tbl_idx) > 0){ - rc = PMIX_ERR_PERM; - if (0 > chown(file_name, (uid_t) _ESH_SESSION_jobuid(ns_map->tbl_idx), (gid_t) -1)){ - PMIX_ERROR_LOG(rc); - goto err_exit; - } - /* set the mode as required */ - if (0 > chmod(file_name, S_IRUSR | S_IRGRP | S_IWGRP )) { - PMIX_ERROR_LOG(rc); - goto err_exit; - } - } - } - return new_seg; - -err_exit: - if( NULL != new_seg ){ - free(new_seg); - } - return NULL; -} - -static seg_desc_t *_attach_new_segment(segment_type type, const ns_map_data_t *ns_map, uint32_t id) -{ - pmix_status_t rc; - seg_desc_t *new_seg = NULL; - new_seg = (seg_desc_t*)malloc(sizeof(seg_desc_t)); - new_seg->id = id; - new_seg->next = NULL; - new_seg->type = type; - - PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, - "%s:%d:%s: segment type %d, nspace %s, id %u", - __FILE__, __LINE__, __func__, type, ns_map->name, id)); - - switch (type) { - case INITIAL_SEGMENT: - new_seg->seg_info.seg_size = _initial_segment_size; - snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/initial-pmix_shared-segment-%u", - _ESH_SESSION_path(ns_map->tbl_idx), id); - break; - case NS_META_SEGMENT: - new_seg->seg_info.seg_size = _meta_segment_size; - snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/smseg-%s-%u", - _ESH_SESSION_path(ns_map->tbl_idx), ns_map->name, id); - break; - case NS_DATA_SEGMENT: - new_seg->seg_info.seg_size = _data_segment_size; - snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/smdataseg-%s-%d", - _ESH_SESSION_path(ns_map->tbl_idx), ns_map->name, id); - break; - default: - free(new_seg); - PMIX_ERROR_LOG(PMIX_ERROR); - return NULL; - } - rc = pmix_pshmem.segment_attach(&new_seg->seg_info, PMIX_PSHMEM_RONLY); - if (PMIX_SUCCESS != rc) { - free(new_seg); - new_seg = NULL; - PMIX_ERROR_LOG(rc); - } - return new_seg; } /* This function synchronizes the content of initial shared segment and the local track list. */ -static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) +static int _update_ns_elem(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_elem, + ns_seg_info_t *info) { - seg_desc_t *seg, *tmp = NULL; + pmix_dstore_seg_desc_t *seg, *tmp = NULL; size_t i, offs; ns_map_data_t *ns_map = NULL; pmix_status_t rc; @@ -1260,7 +634,7 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) "%s:%d:%s", __FILE__, __LINE__, __func__)); - if (NULL == (ns_map = _esh_session_map_search(info->ns_map.name))) { + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, info->ns_map.name))) { rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); return rc; @@ -1276,14 +650,16 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) /* synchronize number of meta segments for the target namespace. */ for (i = ns_elem->num_meta_seg; i < info->num_meta_seg; i++) { if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - seg = _create_new_segment(NS_META_SEGMENT, &info->ns_map, i); + seg = pmix_common_dstor_create_new_segment(PMIX_DSTORE_NS_META_SEGMENT, ds_ctx->base_path, + info->ns_map.name, i, ds_ctx->jobuid, + ds_ctx->setjobuid); if (NULL == seg) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); return rc; } } else { - seg = _attach_new_segment(NS_META_SEGMENT, &info->ns_map, i); + seg = pmix_common_dstor_attach_new_segment(PMIX_DSTORE_NS_META_SEGMENT, ds_ctx->base_path, info->ns_map.name, i); if (NULL == seg) { rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); @@ -1309,7 +685,9 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) /* synchronize number of data segments for the target namespace. */ for (i = ns_elem->num_data_seg; i < info->num_data_seg; i++) { if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - seg = _create_new_segment(NS_DATA_SEGMENT, &info->ns_map, i); + seg = pmix_common_dstor_create_new_segment(PMIX_DSTORE_NS_DATA_SEGMENT, ds_ctx->base_path, + info->ns_map.name, i, ds_ctx->jobuid, + ds_ctx->setjobuid); if (NULL == seg) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); @@ -1318,7 +696,7 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) offs = sizeof(size_t);//shift on offset field itself memcpy(seg->seg_info.seg_base_addr, &offs, sizeof(size_t)); } else { - seg = _attach_new_segment(NS_DATA_SEGMENT, &info->ns_map, i); + seg = pmix_common_dstor_attach_new_segment(PMIX_DSTORE_NS_DATA_SEGMENT, ds_ctx->base_path, info->ns_map.name, i); if (NULL == seg) { rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); @@ -1338,66 +716,54 @@ static int _update_ns_elem(ns_track_elem_t *ns_elem, ns_seg_info_t *info) return PMIX_SUCCESS; } -static seg_desc_t *extend_segment(seg_desc_t *segdesc, const ns_map_data_t *ns_map) -{ - seg_desc_t *tmp, *seg; - - PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, - "%s:%d:%s", - __FILE__, __LINE__, __func__)); - /* find last segment */ - tmp = segdesc; - while (NULL != tmp->next) { - tmp = tmp->next; - } - /* create another segment, the old one is full. */ - seg = _create_new_segment(segdesc->type, ns_map, tmp->id + 1); - tmp->next = seg; - - return seg; -} - -static int _put_ns_info_to_initial_segment(const ns_map_data_t *ns_map, pmix_pshmem_seg_t *metaseg, pmix_pshmem_seg_t *dataseg) +static int _put_ns_info_to_initial_segment(pmix_common_dstore_ctx_t *ds_ctx, + const ns_map_data_t *ns_map, pmix_pshmem_seg_t *metaseg, + pmix_pshmem_seg_t *dataseg) { ns_seg_info_t elem; size_t num_elems; - num_elems = *((size_t*)(_ESH_SESSION_sm_seg_last(ns_map->tbl_idx)->seg_info.seg_base_addr)); - seg_desc_t *last_seg = _ESH_SESSION_sm_seg_last(ns_map->tbl_idx); + num_elems = *((size_t*)(_ESH_SESSION_sm_seg_last(ds_ctx->session_array, + ns_map->tbl_idx)->seg_info.seg_base_addr)); + pmix_dstore_seg_desc_t *last_seg = _ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx); pmix_status_t rc; PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s", __FILE__, __LINE__, __func__)); - if (_max_ns_num == num_elems) { + if (ds_ctx->max_ns_num == num_elems) { num_elems = 0; - if (NULL == (last_seg = extend_segment(last_seg, ns_map))) { + if (NULL == (last_seg = pmix_common_dstor_extend_segment(last_seg, ds_ctx->base_path, ns_map->name, + ds_ctx->jobuid, ds_ctx->setjobuid))) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); return rc; } /* mark previous segment as full */ size_t full = 1; - memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ns_map->tbl_idx)->seg_info.seg_base_addr + sizeof(size_t)), &full, sizeof(size_t)); - _ESH_SESSION_sm_seg_last(ns_map->tbl_idx) = last_seg; - memset(_ESH_SESSION_sm_seg_last(ns_map->tbl_idx)->seg_info.seg_base_addr, 0, _initial_segment_size); + memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx)->seg_info.seg_base_addr + + sizeof(size_t)), &full, sizeof(size_t)); + _ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx) = last_seg; + memset(_ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx)->seg_info.seg_base_addr, + 0, ds_ctx->initial_segment_size); } memset(&elem.ns_map, 0, sizeof(elem.ns_map)); - strncpy(elem.ns_map.name, ns_map->name, sizeof(elem.ns_map.name)-1); + pmix_strncpy(elem.ns_map.name, ns_map->name, sizeof(elem.ns_map.name)-1); elem.ns_map.tbl_idx = ns_map->tbl_idx; elem.num_meta_seg = 1; elem.num_data_seg = 1; - memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ns_map->tbl_idx)->seg_info.seg_base_addr) + sizeof(size_t) * 2 + num_elems * sizeof(ns_seg_info_t), - &elem, sizeof(ns_seg_info_t)); + memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx)->seg_info.seg_base_addr) + + sizeof(size_t) * 2 + num_elems * sizeof(ns_seg_info_t), &elem, sizeof(ns_seg_info_t)); num_elems++; - memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ns_map->tbl_idx)->seg_info.seg_base_addr), &num_elems, sizeof(size_t)); + memcpy((uint8_t*)(_ESH_SESSION_sm_seg_last(ds_ctx->session_array, ns_map->tbl_idx)->seg_info.seg_base_addr), + &num_elems, sizeof(size_t)); return PMIX_SUCCESS; } /* clients should sync local info with information from initial segment regularly */ -static void _update_initial_segment_info(const ns_map_data_t *ns_map) +static void _update_initial_segment_info(pmix_common_dstore_ctx_t *ds_ctx, const ns_map_data_t *ns_map) { - seg_desc_t *tmp; - tmp = _ESH_SESSION_sm_seg_first(ns_map->tbl_idx); + pmix_dstore_seg_desc_t *tmp; + tmp = _ESH_SESSION_sm_seg_first(ds_ctx->session_array, ns_map->tbl_idx); PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, "%s:%d:%s", __FILE__, __LINE__, __func__)); @@ -1406,7 +772,8 @@ static void _update_initial_segment_info(const ns_map_data_t *ns_map) do { /* check if current segment was marked as full but no more next segment is in the chain */ if (NULL == tmp->next && 1 == *((size_t*)((uint8_t*)(tmp->seg_info.seg_base_addr) + sizeof(size_t)))) { - tmp->next = _attach_new_segment(INITIAL_SEGMENT, ns_map, tmp->id+1); + tmp->next = pmix_common_dstor_attach_new_segment(PMIX_DSTORE_INITIAL_SEGMENT, ds_ctx->base_path, + ns_map->name, tmp->id+1); } tmp = tmp->next; } @@ -1414,11 +781,12 @@ static void _update_initial_segment_info(const ns_map_data_t *ns_map) } /* this function will be used by clients to get ns data from the initial segment and add them to the tracker list */ -static ns_seg_info_t *_get_ns_info_from_initial_segment(const ns_map_data_t *ns_map) +static ns_seg_info_t *_get_ns_info_from_initial_segment(pmix_common_dstore_ctx_t *ds_ctx, + const ns_map_data_t *ns_map) { pmix_status_t rc; size_t i; - seg_desc_t *tmp; + pmix_dstore_seg_desc_t *tmp; ns_seg_info_t *elem, *cur_elem; elem = NULL; size_t num_elems; @@ -1426,7 +794,7 @@ static ns_seg_info_t *_get_ns_info_from_initial_segment(const ns_map_data_t *ns_ PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, "%s:%d:%s", __FILE__, __LINE__, __func__)); - tmp = _ESH_SESSION_sm_seg_first(ns_map->tbl_idx); + tmp = _ESH_SESSION_sm_seg_first(ds_ctx->session_array, ns_map->tbl_idx); rc = 1; /* go through all global segments */ @@ -1448,10 +816,11 @@ static ns_seg_info_t *_get_ns_info_from_initial_segment(const ns_map_data_t *ns_ return elem; } -static ns_track_elem_t *_get_track_elem_for_namespace(ns_map_data_t *ns_map) +static ns_track_elem_t *_get_track_elem_for_namespace(pmix_common_dstore_ctx_t *ds_ctx, + ns_map_data_t *ns_map) { ns_track_elem_t *new_elem = NULL; - size_t size = pmix_value_array_get_size(_ns_track_array); + size_t size = pmix_value_array_get_size(ds_ctx->ns_track_array); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: nspace %s", @@ -1464,27 +833,27 @@ static ns_track_elem_t *_get_track_elem_for_namespace(ns_map_data_t *ns_map) } /* data for this namespace should be already stored in shared memory region. */ /* so go and just put new data. */ - return pmix_value_array_get_item(_ns_track_array, ns_map->track_idx); + return pmix_value_array_get_item(ds_ctx->ns_track_array, ns_map->track_idx); } /* create shared memory regions for this namespace and store its info locally * to operate with address and detach/unlink afterwards. */ - if (NULL == (new_elem = pmix_value_array_get_item(_ns_track_array, size))) { + if (NULL == (new_elem = pmix_value_array_get_item(ds_ctx->ns_track_array, size))) { return NULL; } PMIX_CONSTRUCT(new_elem, ns_track_elem_t); - strncpy(new_elem->ns_map.name, ns_map->name, sizeof(new_elem->ns_map.name)-1); + pmix_strncpy(new_elem->ns_map.name, ns_map->name, sizeof(new_elem->ns_map.name)-1); /* save latest track idx to info of nspace */ ns_map->track_idx = size; return new_elem; } -static rank_meta_info *_get_rank_meta_info(pmix_rank_t rank, seg_desc_t *segdesc) +static rank_meta_info *_get_rank_meta_info(pmix_common_dstore_ctx_t *ds_ctx, pmix_rank_t rank, pmix_dstore_seg_desc_t *segdesc) { size_t i; rank_meta_info *elem = NULL; - seg_desc_t *tmp = segdesc; + pmix_dstore_seg_desc_t *tmp = segdesc; size_t num_elems, rel_offset; int id; rank_meta_info *cur_elem; @@ -1495,7 +864,7 @@ static rank_meta_info *_get_rank_meta_info(pmix_rank_t rank, seg_desc_t *segdesc "%s:%d:%s", __FILE__, __LINE__, __func__)); - if (1 == _direct_mode) { + if (1 == ds_ctx->direct_mode) { /* do linear search to find the requested rank inside all meta segments * for this namespace. */ /* go through all existing meta segments for this namespace */ @@ -1514,8 +883,8 @@ static rank_meta_info *_get_rank_meta_info(pmix_rank_t rank, seg_desc_t *segdesc } else { /* directly compute index of meta segment (id) and relative offset (rel_offset) * inside this segment for fast lookup a rank_meta_info object for the requested rank. */ - id = rcount/_max_meta_elems; - rel_offset = (rcount%_max_meta_elems) * sizeof(rank_meta_info) + sizeof(size_t); + id = rcount/ds_ctx->max_meta_elems; + rel_offset = (rcount % ds_ctx->max_meta_elems) * sizeof(rank_meta_info) + sizeof(size_t); /* go through all existing meta segments for this namespace. * Stop at id number if it exists. */ while (NULL != tmp->next && 0 != id) { @@ -1534,10 +903,10 @@ static rank_meta_info *_get_rank_meta_info(pmix_rank_t rank, seg_desc_t *segdesc return elem; } -static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) +static int set_rank_meta_info(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_info, rank_meta_info *rinfo) { /* it's claimed that there is still no meta info for this rank stored */ - seg_desc_t *tmp; + pmix_dstore_seg_desc_t *tmp; size_t num_elems, rel_offset; int id, count; rank_meta_info *cur_elem; @@ -1554,18 +923,19 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) (unsigned long)rinfo->offset, (unsigned long)rinfo->count)); tmp = ns_info->meta_seg; - if (1 == _direct_mode) { + if (1 == ds_ctx->direct_mode) { /* get the last meta segment to put new rank_meta_info at the end. */ while (NULL != tmp->next) { tmp = tmp->next; } num_elems = *((size_t*)(tmp->seg_info.seg_base_addr)); - if (_max_meta_elems <= num_elems) { + if (ds_ctx->max_meta_elems <= num_elems) { PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, "%s:%d:%s: extend meta segment for nspace %s", __FILE__, __LINE__, __func__, ns_info->ns_map.name)); /* extend meta segment, so create a new one */ - tmp = extend_segment(tmp, &ns_info->ns_map); + tmp = pmix_common_dstor_extend_segment(tmp, ds_ctx->base_path, ns_info->ns_map.name, + ds_ctx->jobuid, ds_ctx->setjobuid); if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; @@ -1573,7 +943,7 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) ns_info->num_meta_seg++; memset(tmp->seg_info.seg_base_addr, 0, sizeof(rank_meta_info)); /* update number of meta segments for namespace in initial_segment */ - ns_seg_info_t *elem = _get_ns_info_from_initial_segment(&ns_info->ns_map); + ns_seg_info_t *elem = _get_ns_info_from_initial_segment(ds_ctx, &ns_info->ns_map); if (NULL == elem) { PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; @@ -1591,8 +961,8 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) /* directly compute index of meta segment (id) and relative offset (rel_offset) * inside this segment for fast lookup a rank_meta_info object for the requested rank. */ size_t rcount = rinfo->rank == PMIX_RANK_WILDCARD ? 0 : rinfo->rank + 1; - id = rcount/_max_meta_elems; - rel_offset = (rcount % _max_meta_elems) * sizeof(rank_meta_info) + sizeof(size_t); + id = rcount/ds_ctx->max_meta_elems; + rel_offset = (rcount % ds_ctx->max_meta_elems) * sizeof(rank_meta_info) + sizeof(size_t); count = id; /* go through all existing meta segments for this namespace. * Stop at id number if it exists. */ @@ -1604,7 +974,8 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) if ((int)ns_info->num_meta_seg < (id+1)) { while ((int)ns_info->num_meta_seg != (id+1)) { /* extend meta segment, so create a new one */ - tmp = extend_segment(tmp, &ns_info->ns_map); + tmp = pmix_common_dstor_extend_segment(tmp, ds_ctx->base_path, ns_info->ns_map.name, + ds_ctx->jobuid, ds_ctx->setjobuid); if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; @@ -1613,7 +984,7 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) ns_info->num_meta_seg++; } /* update number of meta segments for namespace in initial_segment */ - ns_seg_info_t *elem = _get_ns_info_from_initial_segment(&ns_info->ns_map); + ns_seg_info_t *elem = _get_ns_info_from_initial_segment(ds_ctx, &ns_info->ns_map); if (NULL == elem) { PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; @@ -1629,9 +1000,9 @@ static int set_rank_meta_info(ns_track_elem_t *ns_info, rank_meta_info *rinfo) return PMIX_SUCCESS; } -static uint8_t *_get_data_region_by_offset(seg_desc_t *segdesc, size_t offset) +static uint8_t *_get_data_region_by_offset(pmix_common_dstore_ctx_t *ds_ctx, pmix_dstore_seg_desc_t *segdesc, size_t offset) { - seg_desc_t *tmp = segdesc; + pmix_dstore_seg_desc_t *tmp = segdesc; size_t rel_offset = offset; uint8_t *dataaddr = NULL; @@ -1641,8 +1012,8 @@ static uint8_t *_get_data_region_by_offset(seg_desc_t *segdesc, size_t offset) /* go through all existing data segments for this namespace */ do { - if (rel_offset >= _data_segment_size) { - rel_offset -= _data_segment_size; + if (rel_offset >= ds_ctx->data_segment_size) { + rel_offset -= ds_ctx->data_segment_size; } else { dataaddr = tmp->seg_info.seg_base_addr + rel_offset; } @@ -1652,10 +1023,10 @@ static uint8_t *_get_data_region_by_offset(seg_desc_t *segdesc, size_t offset) return dataaddr; } -static size_t get_free_offset(seg_desc_t *data_seg) +static size_t get_free_offset(pmix_common_dstore_ctx_t *ds_ctx, pmix_dstore_seg_desc_t *data_seg) { size_t offset; - seg_desc_t *tmp; + pmix_dstore_seg_desc_t *tmp; int id = 0; tmp = data_seg; /* first find the last data segment */ @@ -1668,35 +1039,42 @@ static size_t get_free_offset(seg_desc_t *data_seg) /* this is the first created data segment, the first 8 bytes are used to place the free offset value itself */ offset = sizeof(size_t); } - return (id * _data_segment_size + offset); + return (id * ds_ctx->data_segment_size + offset); } -static int put_empty_ext_slot(seg_desc_t *dataseg) +static int put_empty_ext_slot(pmix_common_dstore_ctx_t *ds_ctx, pmix_dstore_seg_desc_t *dataseg) { size_t global_offset, rel_offset, data_ended, val = 0; uint8_t *addr; - global_offset = get_free_offset(dataseg); - rel_offset = global_offset % _data_segment_size; - if (rel_offset + EXT_SLOT_SIZE() > _data_segment_size) { + pmix_status_t rc; + + global_offset = get_free_offset(ds_ctx, dataseg); + rel_offset = global_offset % ds_ctx->data_segment_size; + if (rel_offset + PMIX_DS_SLOT_SIZE(ds_ctx) > ds_ctx->data_segment_size) { PMIX_ERROR_LOG(PMIX_ERROR); return PMIX_ERROR; } - addr = _get_data_region_by_offset(dataseg, global_offset); - ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&val, sizeof(size_t)); - + addr = _get_data_region_by_offset(ds_ctx, dataseg, global_offset); + PMIX_DS_PUT_KEY(rc, ds_ctx, addr, ESH_REGION_EXTENSION, (void*)&val, sizeof(size_t)); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + return rc; + } /* update offset at the beginning of current segment */ - data_ended = rel_offset + EXT_SLOT_SIZE(); + data_ended = rel_offset + PMIX_DS_SLOT_SIZE(ds_ctx); addr = (uint8_t*)(addr - rel_offset); memcpy(addr, &data_ended, sizeof(size_t)); return PMIX_SUCCESS; } -static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, char *key, void *buffer, size_t size) +static size_t put_data_to_the_end(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_info, + pmix_dstore_seg_desc_t *dataseg, char *key, void *buffer, size_t size) { size_t offset, id = 0; - seg_desc_t *tmp; + pmix_dstore_seg_desc_t *tmp; size_t global_offset, data_ended; uint8_t *addr; + pmix_status_t rc; PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, "%s:%d:%s: key %s", @@ -1707,17 +1085,19 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, tmp = tmp->next; id++; } - global_offset = get_free_offset(dataseg); - offset = global_offset % _data_segment_size; + global_offset = get_free_offset(ds_ctx, dataseg); + offset = global_offset % ds_ctx->data_segment_size; /* We should provide additional space at the end of segment to * place EXTENSION_SLOT to have an ability to enlarge data for this rank.*/ - if ((sizeof(size_t) + ESH_KEY_SIZE(key, size) + EXT_SLOT_SIZE()) > _data_segment_size) { + if ((sizeof(size_t) + PMIX_DS_KEY_SIZE(ds_ctx, key, size) + PMIX_DS_SLOT_SIZE(ds_ctx)) > + ds_ctx->data_segment_size) { /* this is an error case: segment is so small that cannot place evem a single key-value pair. * warn a user about it and fail. */ offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */ pmix_output(0, "PLEASE set NS_DATA_SEG_SIZE to value which is larger when %lu.", - (unsigned long)(sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + size + EXT_SLOT_SIZE())); + (unsigned long)(sizeof(size_t) + strlen(key) + 1 + sizeof(size_t) + + size + PMIX_DS_SLOT_SIZE(ds_ctx))); return offset; } @@ -1728,10 +1108,12 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, * new segment wasn't allocated to us but (global_offset % _data_segment_size) == 0 * so if offset is 0 here - we need to allocate the segment as well */ - if ( (0 == offset) || ( (offset + ESH_KEY_SIZE(key, size) + EXT_SLOT_SIZE()) > _data_segment_size) ) { + if ( (0 == offset) || ( (offset + PMIX_DS_KEY_SIZE(ds_ctx, key, size) + + PMIX_DS_SLOT_SIZE(ds_ctx)) > ds_ctx->data_segment_size) ) { id++; /* create a new data segment. */ - tmp = extend_segment(tmp, &ns_info->ns_map); + tmp = pmix_common_dstor_extend_segment(tmp, ds_ctx->base_path, ns_info->ns_map.name, + ds_ctx->jobuid, ds_ctx->setjobuid); if (NULL == tmp) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */ @@ -1739,7 +1121,7 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, } ns_info->num_data_seg++; /* update_ns_info_in_initial_segment */ - ns_seg_info_t *elem = _get_ns_info_from_initial_segment(&ns_info->ns_map); + ns_seg_info_t *elem = _get_ns_info_from_initial_segment(ds_ctx, &ns_info->ns_map); if (NULL == elem) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); offset = 0; /* offset cannot be 0 in normal case, so we use this value to indicate a problem. */ @@ -1748,12 +1130,16 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, elem->num_data_seg++; offset = sizeof(size_t); } - global_offset = offset + id * _data_segment_size; + global_offset = offset + id * ds_ctx->data_segment_size; addr = (uint8_t*)(tmp->seg_info.seg_base_addr)+offset; - ESH_PUT_KEY(addr, key, buffer, size); + PMIX_DS_PUT_KEY(rc, ds_ctx, addr, key, buffer, size); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + return 0; + } /* update offset at the beginning of current segment */ - data_ended = offset + ESH_KEY_SIZE(key, size); + data_ended = offset + PMIX_DS_KEY_SIZE(ds_ctx, key, size); addr = (uint8_t*)(tmp->seg_info.seg_base_addr); memcpy(addr, &data_ended, sizeof(size_t)); PMIX_OUTPUT_VERBOSE((1, pmix_gds_base_framework.framework_output, @@ -1761,17 +1147,18 @@ static size_t put_data_to_the_end(ns_track_elem_t *ns_info, seg_desc_t *dataseg, __FILE__, __LINE__, __func__, key, (unsigned long)offset, (unsigned long)data_ended, - (unsigned long)(id * _data_segment_size), + (unsigned long)(id * ds_ctx->data_segment_size), (unsigned long)size)); return global_offset; } -static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t *kval, rank_meta_info **rinfo, int data_exist) +static int pmix_sm_store(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_info, + pmix_rank_t rank, pmix_kval_t *kval, rank_meta_info **rinfo, int data_exist) { size_t offset, size, kval_cnt; pmix_buffer_t buffer; pmix_status_t rc; - seg_desc_t *datadesc; + pmix_dstore_seg_desc_t *datadesc; uint8_t *addr; PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, @@ -1781,7 +1168,7 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t datadesc = ns_info->data_seg; /* pack value to the buffer */ PMIX_CONSTRUCT(&buffer, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, _client_peer(), &buffer, kval->value, 1, PMIX_VALUE); + PMIX_BFROPS_PACK(rc, _client_peer(ds_ctx), &buffer, kval->value, 1, PMIX_VALUE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto exit; @@ -1791,8 +1178,8 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t if (0 == data_exist) { /* there is no data blob for this rank yet, so add it. */ size_t free_offset; - free_offset = get_free_offset(datadesc); - offset = put_data_to_the_end(ns_info, datadesc, kval->key, buffer.base_ptr, size); + free_offset = get_free_offset(ds_ctx, datadesc); + offset = put_data_to_the_end(ds_ctx, ns_info, datadesc, kval->key, buffer.base_ptr, size); if (0 == offset) { /* this is an error */ rc = PMIX_ERROR; @@ -1806,11 +1193,15 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t * because previous segment is already full. */ if (free_offset != offset && NULL != *rinfo) { /* here we compare previous free offset with the offset where we just put data. - * It should be equal in the normal case. It it's not true, then it means that + * It should be equal in the normal case. If it's not true, then it means that * segment was extended, and we put data to the next segment, so we now need to * put extension slot at the end of previous segment with a "reference" to a new_offset */ - addr = _get_data_region_by_offset(datadesc, free_offset); - ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t)); + addr = _get_data_region_by_offset(ds_ctx, datadesc, free_offset); + PMIX_DS_PUT_KEY(rc, ds_ctx, addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t)); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + return 0; + } } if (NULL == *rinfo) { *rinfo = (rank_meta_info*)malloc(sizeof(rank_meta_info)); @@ -1821,7 +1212,7 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t (*rinfo)->count++; } else if (NULL != *rinfo) { /* there is data blob for this rank */ - addr = _get_data_region_by_offset(datadesc, (*rinfo)->offset); + addr = _get_data_region_by_offset(ds_ctx, datadesc, (*rinfo)->offset); if (NULL == addr) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); @@ -1843,8 +1234,8 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t * ..... * extension slot which has key = EXTENSION_SLOT and a size_t value for offset to next data address for this process. */ - if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) { - memcpy(&offset, ESH_DATA_PTR(addr), sizeof(size_t)); + if(PMIX_DS_KEY_IS_EXTSLOT(ds_ctx, addr)) { + memcpy(&offset, PMIX_DS_DATA_PTR(ds_ctx, addr), sizeof(size_t)); if (0 < offset) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %lu, replace flag %d %s is filled with %lu value", @@ -1852,7 +1243,7 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t (unsigned long)rank, data_exist, ESH_REGION_EXTENSION, (unsigned long)offset)); /* go to next item, updating address */ - addr = _get_data_region_by_offset(datadesc, offset); + addr = _get_data_region_by_offset(ds_ctx, datadesc, offset); if (NULL == addr) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); @@ -1861,20 +1252,21 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t } else { /* should not be, we should be out of cycle when this happens */ } - } else if (0 == strncmp(ESH_KNAME_PTR(addr), kval->key, ESH_KNAME_LEN(kval->key))) { + } else if (0 == strncmp(PMIX_DS_KNAME_PTR(ds_ctx, addr), kval->key, + PMIX_DS_KNAME_LEN(ds_ctx, kval->key))) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %u, replace flag %d found target key %s", __FILE__, __LINE__, __func__, rank, data_exist, kval->key)); /* target key is found, compare value sizes */ - if (ESH_DATA_SIZE(addr, ESH_DATA_PTR(addr)) != size) { + if (PMIX_DS_DATA_SIZE(ds_ctx, addr, PMIX_DS_DATA_PTR(ds_ctx, addr)) != size) { //if (1) { /* if we want to test replacing values for existing keys. */ /* invalidate current value and store another one at the end of data region. */ - strncpy(ESH_KNAME_PTR(addr), ESH_REGION_INVALIDATED, ESH_KNAME_LEN(ESH_REGION_INVALIDATED)); + PMIX_DS_KEY_SET_INVALID(ds_ctx, addr); /* decrementing count, it will be incremented back when we add a new value for this key at the end of region. */ (*rinfo)->count--; kval_cnt--; /* go to next item, updating address */ - addr += ESH_KV_SIZE(addr); + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %u, replace flag %d mark key %s regions as invalidated. put new data at the end.", __FILE__, __LINE__, __func__, rank, data_exist, kval->key)); @@ -1883,23 +1275,25 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t "%s:%d:%s: for rank %u, replace flag %d replace data for key %s type %d in place", __FILE__, __LINE__, __func__, rank, data_exist, kval->key, kval->value->type)); /* replace old data with new one. */ - memset(ESH_DATA_PTR(addr), 0, ESH_DATA_SIZE(addr, ESH_DATA_PTR(addr))); - memcpy(ESH_DATA_PTR(addr), buffer.base_ptr, size); - addr += ESH_KV_SIZE(addr); + memset(PMIX_DS_DATA_PTR(ds_ctx, addr), 0, + PMIX_DS_DATA_SIZE(ds_ctx, addr, PMIX_DS_DATA_PTR(ds_ctx, addr))); + memcpy(PMIX_DS_DATA_PTR(ds_ctx, addr), buffer.base_ptr, size); + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); add_to_the_end = 0; break; } } else { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %u, replace flag %d skip %s key, look for %s key", - __FILE__, __LINE__, __func__, rank, data_exist, ESH_KNAME_PTR(addr), kval->key)); + __FILE__, __LINE__, __func__, rank, data_exist, + PMIX_DS_KNAME_PTR(ds_ctx, addr), kval->key)); /* Skip it: key is "INVALIDATED" or key is valid but different from target one. */ - if (0 != strncmp(ESH_REGION_INVALIDATED, ESH_KNAME_PTR(addr), ESH_KNAME_LEN(ESH_KNAME_PTR(addr)))) { + if (!PMIX_DS_KEY_IS_INVALID(ds_ctx, addr)) { /* count only valid items */ kval_cnt--; } /* go to next item, updating address */ - addr += ESH_KV_SIZE(addr); + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); } } if (1 == add_to_the_end) { @@ -1908,9 +1302,68 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t * for the same key. */ size_t free_offset; (*rinfo)->count++; - free_offset = get_free_offset(datadesc); + free_offset = get_free_offset(ds_ctx, datadesc); + + /* + * Remove trailing extention slot if we are continuing + * same ranks data. + * + * When keys are stored individually through _store_data_for_rank + * an empty extention slot is placed every time. + * + * This is required because there is no information about whether or not the next key + * will belong to the same rank. + * + * As the result EACH keys stored with _store_data_for_rank is + * followed by extension slot. This slows down search and increases + * the memory footprint. + * + * The following code tries to deal with such one-key-at-a-time + * situation by: + * - checking if the last key-value for this rank is an extention + * slot + * - If this is the case - checks if this key-value pair is the + * last one at the moment and can be safely deleted. + * - if it is - current segment's offset pointer is decreased by + * the size of the extention slot key-value effectively removing + * it from the dstor + */ + if (PMIX_DS_KEY_IS_EXTSLOT(ds_ctx, addr)){ + /* Find the last data segment */ + pmix_dstore_seg_desc_t *ldesc = datadesc; + uint8_t *segstart; + size_t offs_past_extslot = 0; + size_t offs_cur_segment = 0; + while (NULL != ldesc->next) { + ldesc = ldesc->next; + } + + /* Calculate the offset of the end of the extension slot */ + offs_cur_segment = free_offset % ds_ctx->data_segment_size; + segstart = ldesc->seg_info.seg_base_addr; + offs_past_extslot = (addr + PMIX_DS_KV_SIZE(ds_ctx, addr)) - segstart; + + /* We can erase extension slot if: + * - address of the ext slot belongs to the occupied part of the + * last segment + * - local offset within the segment is equal to the local + * offset of the end of extension slot + */ + if( ( (addr > segstart) && (addr < (segstart + offs_cur_segment)) ) + && (offs_cur_segment == offs_past_extslot) ) { + /* Calculate a new free offset that doesn't account this + * extension slot */ + size_t new_offset = addr - segstart; + /* Rewrite segment's offset information to exclude + * extension slot */ + memcpy(segstart, &new_offset, sizeof(size_t)); + /* Recalculate free_offset */ + free_offset = get_free_offset(ds_ctx, datadesc); + } + } + /* add to the end */ - offset = put_data_to_the_end(ns_info, datadesc, kval->key, buffer.base_ptr, size); + offset = put_data_to_the_end(ds_ctx, ns_info, datadesc, kval->key, buffer.base_ptr, size); if (0 == offset) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); @@ -1921,11 +1374,11 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t * data for different ranks, and that's why next element is EXTENSION_SLOT. * We put new data to the end of data region and just update EXTENSION_SLOT value by new offset. */ - if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) { + if (PMIX_DS_KEY_IS_EXTSLOT(ds_ctx, addr)) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %u, replace flag %d %s should be filled with offset %lu value", __FILE__, __LINE__, __func__, rank, data_exist, ESH_REGION_EXTENSION, offset)); - memcpy(ESH_DATA_PTR(addr), &offset, sizeof(size_t)); + memcpy(PMIX_DS_DATA_PTR(ds_ctx, addr), &offset, sizeof(size_t)); } else { /* (2) - we point to the first free offset, no more data is stored further in this segment. * There is no EXTENSION_SLOT by this addr since we continue pushing data for the same rank, @@ -1935,7 +1388,11 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t * forcibly and store new offset in its value. */ if (free_offset != offset) { /* segment was extended, need to put extension slot by free_offset indicating new_offset */ - ESH_PUT_KEY(addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t)); + PMIX_DS_PUT_KEY(rc, ds_ctx, addr, ESH_REGION_EXTENSION, (void*)&offset, sizeof(size_t)); + if (rc != PMIX_SUCCESS) { + PMIX_ERROR_LOG(rc); + return 0; + } } } PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, @@ -1948,12 +1405,13 @@ static int pmix_sm_store(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_kval_t return rc; } -static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix_buffer_t *buf) +static int _store_data_for_rank(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns_info, + pmix_rank_t rank, pmix_buffer_t *buf) { pmix_status_t rc; pmix_kval_t *kp; - seg_desc_t *metadesc, *datadesc; + pmix_dstore_seg_desc_t *metadesc, *datadesc; int32_t cnt; rank_meta_info *rinfo = NULL; @@ -1974,11 +1432,11 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix num_elems = *((size_t*)(metadesc->seg_info.seg_base_addr)); data_exist = 0; - /* when we don't use linear search (_direct_mode ==0 ) we don't use num_elems field, + /* when we don't use linear search (direct_mode == 0) we don't use num_elems field, * so anyway try to get rank_meta_info first. */ - if (0 < num_elems || 0 == _direct_mode) { + if (0 < num_elems || 0 == ds_ctx->direct_mode) { /* go through all elements in meta segment and look for target rank. */ - rinfo = _get_rank_meta_info(rank, metadesc); + rinfo = _get_rank_meta_info(ds_ctx, rank, metadesc); if (NULL != rinfo) { data_exist = 1; } @@ -1987,14 +1445,14 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix * so unpack these buffers, and then unpack kvals from each modex buffer, * storing them in the shared memory dstore. */ - free_offset = get_free_offset(datadesc); + free_offset = get_free_offset(ds_ctx, datadesc); cnt = 1; kp = PMIX_NEW(pmix_kval_t); PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, buf, kp, &cnt, PMIX_KVAL); while(PMIX_SUCCESS == rc) { pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "pmix: unpacked key %s", kp->key); - if (PMIX_SUCCESS != (rc = pmix_sm_store(ns_info, rank, kp, &rinfo, data_exist))) { + if (PMIX_SUCCESS != (rc = pmix_sm_store(ds_ctx, ns_info, rank, kp, &rinfo, data_exist))) { PMIX_ERROR_LOG(rc); if (NULL != rinfo) { free(rinfo); @@ -2021,7 +1479,7 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix * in that case we don't reserve space for EXTENSION_SLOT, it's * already reserved. * */ - new_free_offset = get_free_offset(datadesc); + new_free_offset = get_free_offset(ds_ctx, datadesc); if (new_free_offset != free_offset) { /* Reserve space for EXTENSION_SLOT at the end of data blob. * We need it to split data for one rank from data for different @@ -2029,7 +1487,7 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix * We also put EXTENSION_SLOT at the end of each data segment, and * its value points to the beginning of next data segment. * */ - rc = put_empty_ext_slot(ns_info->data_seg); + rc = put_empty_ext_slot(ds_ctx, ns_info->data_seg); if (PMIX_SUCCESS != rc) { if ((0 == data_exist) && NULL != rinfo) { free(rinfo); @@ -2042,7 +1500,7 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix /* if this is the first data posted for this rank, then * update meta info for it */ if (0 == data_exist) { - set_rank_meta_info(ns_info, rinfo); + set_rank_meta_info(ds_ctx, ns_info, rinfo); if (NULL != rinfo) { free(rinfo); } @@ -2051,13 +1509,13 @@ static int _store_data_for_rank(ns_track_elem_t *ns_info, pmix_rank_t rank, pmix return rc; } -static inline ssize_t _get_univ_size(const char *nspace) +static inline ssize_t _get_univ_size(pmix_common_dstore_ctx_t *ds_ctx, const char *nspace) { ssize_t nprocs = 0; pmix_value_t *val; int rc; - rc = _dstore_fetch(nspace, PMIX_RANK_WILDCARD, PMIX_UNIV_SIZE, &val); + rc = _dstore_fetch(ds_ctx, nspace, PMIX_RANK_WILDCARD, PMIX_UNIV_SIZE, &val); if( PMIX_SUCCESS != rc ) { PMIX_ERROR_LOG(rc); return rc; @@ -2072,23 +1530,39 @@ static inline ssize_t _get_univ_size(const char *nspace) return nprocs; } -static pmix_status_t dstore_cache_job_info(struct pmix_nspace_t *ns, +PMIX_EXPORT pmix_status_t pmix_common_dstor_cache_job_info(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo) { return PMIX_SUCCESS; } -static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo) + +pmix_common_dstore_ctx_t *pmix_common_dstor_init(const char *ds_name, pmix_info_t info[], size_t ninfo, + pmix_common_lock_callbacks_t *lock_cb, + pmix_common_dstore_file_cbs_t *file_cb) { pmix_status_t rc; size_t n; char *dstor_tmpdir = NULL; - size_t tbl_idx=0; + size_t tbl_idx = 0; ns_map_data_t *ns_map = NULL; + pmix_common_dstore_ctx_t *ds_ctx = NULL; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "pmix:gds:dstore init"); + ds_ctx = (pmix_common_dstore_ctx_t*) malloc(sizeof(*ds_ctx)); + if (NULL == ds_ctx) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + return NULL; + } + memset(ds_ctx, 0, sizeof(*ds_ctx)); + + /* assign lock callbacks */ + ds_ctx->lock_cbs = lock_cb; + ds_ctx->file_cbs = file_cb; + /* open the pshmem and select the active plugins */ if( PMIX_SUCCESS != (rc = pmix_mca_base_framework_open(&pmix_pshmem_base_framework, 0)) ) { PMIX_ERROR_LOG(rc); @@ -2099,17 +1573,10 @@ static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo) goto err_exit; } - _jobuid = getuid(); - _setjobuid = 0; - -#ifdef ESH_PTHREAD_LOCK - _esh_lock_init = _rwlock_init; -#endif -#ifdef ESH_FCNTL_LOCK - _esh_lock_init = _flock_init; -#endif + ds_ctx->jobuid = getuid(); + ds_ctx->setjobuid = 0; - if (PMIX_SUCCESS != (rc = _esh_tbls_init())) { + if (PMIX_SUCCESS != (rc = _esh_tbls_init(ds_ctx))) { PMIX_ERROR_LOG(rc); goto err_exit; } @@ -2120,23 +1587,19 @@ static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo) goto err_exit; } - _set_constants_from_env(); - - if (NULL != _base_path) { - free(_base_path); - _base_path = NULL; - } + _set_constants_from_env(ds_ctx); + ds_ctx->ds_name = strdup(ds_name); /* find the temp dir */ if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - _esh_session_map_search = _esh_session_map_search_server; + ds_ctx->session_map_search = (session_map_search_fn_t)_esh_session_map_search_server; /* scan incoming info for directives */ if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strcmp(PMIX_USERID, info[n].key)) { - _jobuid = info[n].value.data.uint32; - _setjobuid = 1; + ds_ctx->jobuid = info[n].value.data.uint32; + ds_ctx->setjobuid = 1; continue; } if (0 == strcmp(PMIX_DSTPATH, info[n].key)) { @@ -2182,67 +1645,109 @@ static pmix_status_t dstore_init(pmix_info_t info[], size_t ninfo) } } - rc = asprintf(&_base_path, "%s/pmix_dstor_%d", dstor_tmpdir, getpid()); - if ((0 > rc) || (NULL == _base_path)) { + rc = asprintf(&ds_ctx->base_path, "%s/pmix_dstor_%s_%d", dstor_tmpdir, + ds_ctx->ds_name, getpid()); + if ((0 > rc) || (NULL == ds_ctx->base_path)) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - if (0 != mkdir(_base_path, 0770)) { + if (0 != mkdir(ds_ctx->base_path, 0770)) { if (EEXIST != errno) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); goto err_exit; } } - if (_setjobuid > 0) { - if (chown(_base_path, (uid_t) _jobuid, (gid_t) -1) < 0){ + if (ds_ctx->setjobuid > 0) { + if (chown(ds_ctx->base_path, (uid_t) ds_ctx->jobuid, (gid_t) -1) < 0){ rc = PMIX_ERR_NO_PERMISSIONS; PMIX_ERROR_LOG(rc); goto err_exit; } } - _esh_session_map_search = _esh_session_map_search_server; - return PMIX_SUCCESS; + ds_ctx->session_map_search = _esh_session_map_search_server; + return ds_ctx; } /* for clients */ else { - if (NULL == (dstor_tmpdir = getenv(PMIX_DSTORE_ESH_BASE_PATH))){ - return PMIX_ERR_NOT_AVAILABLE; // simply disqualify ourselves + char *env_name = NULL; + int ds_ver = 0; + + sscanf(ds_ctx->ds_name, "ds%d", &ds_ver); + if (0 == ds_ver) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto err_exit; + } + if (0 > asprintf(&env_name, PMIX_DSTORE_VER_BASE_PATH_FMT, ds_ver)) { + rc = PMIX_ERR_NOMEM; + PMIX_ERROR_LOG(rc); + goto err_exit; } - if (NULL == (_base_path = strdup(dstor_tmpdir))) { + dstor_tmpdir = getenv(env_name); + free(env_name); + + if (NULL == dstor_tmpdir) { + dstor_tmpdir = getenv(PMIX_DSTORE_ESH_BASE_PATH); + } + if (NULL == dstor_tmpdir){ + rc = PMIX_ERR_NOT_AVAILABLE; // simply disqualify ourselves + goto err_exit; + } + if (NULL == (ds_ctx->base_path = strdup(dstor_tmpdir))) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - _esh_session_map_search = _esh_session_map_search_client; + ds_ctx->session_map_search = _esh_session_map_search_client; + /* init ds_ctx protect lock */ + if (0 != pthread_mutex_init(&ds_ctx->lock, NULL)) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto err_exit; + } } - rc = _esh_session_tbl_add(&tbl_idx); + rc = _esh_session_tbl_add(ds_ctx, &tbl_idx); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto err_exit; } - ns_map = _esh_session_map(pmix_globals.myid.nspace, tbl_idx); + char *nspace = NULL; + /* if we don't see the required info, then we cannot init */ + if (NULL == (nspace = getenv("PMIX_NAMESPACE"))) { + rc = PMIX_ERR_INVALID_NAMESPACE; + PMIX_ERROR_LOG(rc); + goto err_exit; + } + /* lock init */ + rc = ds_ctx->lock_cbs->init(&_ESH_SESSION_lock(ds_ctx->session_array, tbl_idx), ds_ctx->base_path, nspace, 1, ds_ctx->jobuid, ds_ctx->setjobuid); + if (rc != PMIX_SUCCESS) { + goto err_exit; + } + ns_map = _esh_session_map(ds_ctx, nspace, 0, tbl_idx); if (NULL == ns_map) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); goto err_exit; } - if (PMIX_SUCCESS != (rc =_esh_session_init(tbl_idx, ns_map, _jobuid, _setjobuid))) { + if (PMIX_SUCCESS != (rc =_esh_session_init(ds_ctx, tbl_idx, ns_map, 1, + ds_ctx->jobuid, ds_ctx->setjobuid))) { PMIX_ERROR_LOG(rc); goto err_exit; } - return PMIX_SUCCESS; + return ds_ctx; err_exit: - return rc; + pmix_common_dstor_finalize(ds_ctx); + return NULL; } -static void dstore_finalize(void) +PMIX_EXPORT void pmix_common_dstor_finalize(pmix_common_dstore_ctx_t *ds_ctx) { struct stat st = {0}; pmix_status_t rc = PMIX_SUCCESS; @@ -2250,42 +1755,45 @@ static void dstore_finalize(void) PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s", __FILE__, __LINE__, __func__)); - _esh_sessions_cleanup(); - _esh_ns_map_cleanup(); - _esh_ns_track_cleanup(); + _esh_sessions_cleanup(ds_ctx); + _esh_ns_map_cleanup(ds_ctx); + _esh_ns_track_cleanup(ds_ctx); pmix_pshmem.finalize(); - if (NULL != _base_path){ + if (NULL != ds_ctx->base_path){ if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { - if (lstat(_base_path, &st) >= 0){ - if (PMIX_SUCCESS != (rc = _esh_dir_del(_base_path))) { + if (lstat(ds_ctx->base_path, &st) >= 0){ + if (PMIX_SUCCESS != (rc = _esh_dir_del(ds_ctx->base_path))) { PMIX_ERROR_LOG(rc); } } } - free(_base_path); - _base_path = NULL; + free(ds_ctx->base_path); + ds_ctx->base_path = NULL; } - if (NULL != _clients_peer) { - PMIX_RELEASE(_clients_peer->nptr); - PMIX_RELEASE(_clients_peer); + if (NULL != ds_ctx->clients_peer) { + PMIX_RELEASE(ds_ctx->clients_peer->nptr); + PMIX_RELEASE(ds_ctx->clients_peer); } /* close the pshmem framework */ if( PMIX_SUCCESS != (rc = pmix_mca_base_framework_close(&pmix_pshmem_base_framework)) ) { PMIX_ERROR_LOG(rc); } + free(ds_ctx->ds_name); + free(ds_ctx->base_path); + free(ds_ctx); } -static pmix_status_t _dstore_store(const char *nspace, - pmix_rank_t rank, - pmix_kval_t *kv) +static pmix_status_t _dstore_store_nolock(pmix_common_dstore_ctx_t *ds_ctx, + ns_map_data_t *ns_map, + pmix_rank_t rank, + pmix_kval_t *kv) { - pmix_status_t rc = PMIX_SUCCESS, tmp_rc; + pmix_status_t rc = PMIX_SUCCESS; ns_track_elem_t *elem; pmix_buffer_t xfer; ns_seg_info_t ns_info; - ns_map_data_t *ns_map = NULL; if (NULL == kv) { return PMIX_ERROR; @@ -2293,19 +1801,7 @@ static pmix_status_t _dstore_store(const char *nspace, PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for %s:%u", - __FILE__, __LINE__, __func__, nspace, rank)); - - if (NULL == (ns_map = _esh_session_map_search(nspace))) { - rc = PMIX_ERROR; - PMIX_ERROR_LOG(rc); - return rc; - } - - /* set exclusive lock */ - if (PMIX_SUCCESS != (rc = _ESH_WRLOCK(_ESH_SESSION_lock(ns_map->tbl_idx)))) { - PMIX_ERROR_LOG(rc); - return rc; - } + __FILE__, __LINE__, __func__, ns_map->name, rank)); /* First of all, we go through local track list (list of ns_track_elem_t structures) * and look for an element for the target namespace. @@ -2317,36 +1813,36 @@ static pmix_status_t _dstore_store(const char *nspace, * All this stuff is done inside _get_track_elem_for_namespace function. */ - elem = _get_track_elem_for_namespace(ns_map); + elem = _get_track_elem_for_namespace(ds_ctx, ns_map); if (NULL == elem) { rc = PMIX_ERR_OUT_OF_RESOURCE; PMIX_ERROR_LOG(rc); - goto err_exit; + goto exit; } /* If a new element was just created, we need to create corresponding meta and * data segments and update corresponding element's fields. */ if (NULL == elem->meta_seg || NULL == elem->data_seg) { memset(&ns_info.ns_map, 0, sizeof(ns_info.ns_map)); - strncpy(ns_info.ns_map.name, ns_map->name, sizeof(ns_info.ns_map.name)-1); + pmix_strncpy(ns_info.ns_map.name, ns_map->name, sizeof(ns_info.ns_map.name)-1); ns_info.ns_map.tbl_idx = ns_map->tbl_idx; ns_info.num_meta_seg = 1; ns_info.num_data_seg = 1; - rc = _update_ns_elem(elem, &ns_info); + rc = _update_ns_elem(ds_ctx, elem, &ns_info); if (PMIX_SUCCESS != rc || NULL == elem->meta_seg || NULL == elem->data_seg) { PMIX_ERROR_LOG(rc); - goto err_exit; + goto exit; } /* zero created shared memory segments for this namespace */ - memset(elem->meta_seg->seg_info.seg_base_addr, 0, _meta_segment_size); - memset(elem->data_seg->seg_info.seg_base_addr, 0, _data_segment_size); + memset(elem->meta_seg->seg_info.seg_base_addr, 0, ds_ctx->meta_segment_size); + memset(elem->data_seg->seg_info.seg_base_addr, 0, ds_ctx->data_segment_size); /* put ns's shared segments info to the global meta segment. */ - rc = _put_ns_info_to_initial_segment(ns_map, &elem->meta_seg->seg_info, &elem->data_seg->seg_info); + rc = _put_ns_info_to_initial_segment(ds_ctx, ns_map, &elem->meta_seg->seg_info, &elem->data_seg->seg_info); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto err_exit; + goto exit; } } @@ -2355,34 +1851,28 @@ static pmix_status_t _dstore_store(const char *nspace, PMIX_CONSTRUCT(&xfer, pmix_buffer_t); PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, kv->value->data.bo.bytes, kv->value->data.bo.size); - rc = _store_data_for_rank(elem, rank, &xfer); + rc = _store_data_for_rank(ds_ctx, elem, rank, &xfer); PMIX_DESTRUCT(&xfer); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto err_exit; - } - - /* unset lock */ - if (PMIX_SUCCESS != (rc = _ESH_UNLOCK(_ESH_SESSION_lock(ns_map->tbl_idx)))) { - PMIX_ERROR_LOG(rc); + goto exit; } - return rc; -err_exit: - /* unset lock */ - if (PMIX_SUCCESS != (tmp_rc = _ESH_UNLOCK(_ESH_SESSION_lock(ns_map->tbl_idx)))) { - PMIX_ERROR_LOG(tmp_rc); - } +exit: return rc; } -static pmix_status_t dstore_store(const pmix_proc_t *proc, - pmix_scope_t scope, - pmix_kval_t *kv) +PMIX_EXPORT pmix_status_t pmix_common_dstor_store(pmix_common_dstore_ctx_t *ds_ctx, + const pmix_proc_t *proc, + pmix_scope_t scope, + pmix_kval_t *kv) { pmix_status_t rc = PMIX_SUCCESS; + ns_map_data_t *ns_map; + pmix_kval_t *kv2; + pmix_buffer_t tmp; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds: dstore store for key '%s' scope %d", @@ -2393,26 +1883,51 @@ static pmix_status_t dstore_store(const pmix_proc_t *proc, PMIX_ERROR_LOG(rc); return rc; } - else { - pmix_kval_t *kv2; - kv2 = PMIX_NEW(pmix_kval_t); - PMIX_VALUE_CREATE(kv2->value, 1); - kv2->value->type = PMIX_BYTE_OBJECT; - pmix_buffer_t tmp; - PMIX_CONSTRUCT(&tmp, pmix_buffer_t); + kv2 = PMIX_NEW(pmix_kval_t); + PMIX_VALUE_CREATE(kv2->value, 1); + kv2->value->type = PMIX_BYTE_OBJECT; - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, kv, 1, PMIX_KVAL); - PMIX_UNLOAD_BUFFER(&tmp, kv2->value->data.bo.bytes, kv2->value->data.bo.size); + PMIX_CONSTRUCT(&tmp, pmix_buffer_t); + + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, kv, 1, PMIX_KVAL); + PMIX_UNLOAD_BUFFER(&tmp, kv2->value->data.bo.bytes, kv2->value->data.bo.size); + + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc->nspace))) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto exit; + } + + /* set exclusive lock */ + rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_lock); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } - rc = _dstore_store(proc->nspace, proc->rank, kv2); - PMIX_RELEASE(kv2); - PMIX_DESTRUCT(&tmp); + rc = _dstore_store_nolock(ds_ctx, ns_map, proc->rank, kv2); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; } + + /* unset lock */ + rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_unlock); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } + +exit: + PMIX_RELEASE(kv2); + PMIX_DESTRUCT(&tmp); + return rc; } -static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, +static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, pmix_rank_t rank, const char *key, pmix_value_t **kvs) { ns_seg_info_t *ns_info = NULL; @@ -2420,7 +1935,7 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, ns_track_elem_t *elem; rank_meta_info *rinfo = NULL; size_t kval_cnt = 0; - seg_desc_t *meta_seg, *data_seg; + pmix_dstore_seg_desc_t *meta_seg, *data_seg; uint8_t *addr; pmix_buffer_t buffer; pmix_value_t val, *kval = NULL; @@ -2431,6 +1946,8 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, bool key_found = false; pmix_info_t *info = NULL; size_t ninfo; + size_t keyhash = 0; + bool lock_is_set = false; PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for %s:%u look for key %s", @@ -2440,34 +1957,38 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, PMIX_OUTPUT_VERBOSE((7, pmix_gds_base_framework.framework_output, "dstore: Does not support passed parameters")); rc = PMIX_ERR_BAD_PARAM; - PMIX_ERROR_LOG(rc); - return rc; + goto error; } PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for %s:%u look for key %s", __FILE__, __LINE__, __func__, nspace, rank, key)); - if (NULL == (ns_map = _esh_session_map_search(nspace))) { + /* protect info of dstore segments before it will be updated */ + if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (0 != (rc = pthread_mutex_lock(&ds_ctx->lock))) { + goto error; + } + lock_is_set = true; + } + + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, nspace))) { /* This call is issued from the the client. * client must have the session, otherwise the error is fatal. */ rc = PMIX_ERR_FATAL; - PMIX_ERROR_LOG(rc); - return rc; + goto error; } if (NULL == kvs) { rc = PMIX_ERR_FATAL; - PMIX_ERROR_LOG(rc); - return rc; + goto error; } if (PMIX_RANK_UNDEF == rank) { - ssize_t _nprocs = _get_univ_size(ns_map->name); + ssize_t _nprocs = _get_univ_size(ds_ctx, ns_map->name); if( 0 > _nprocs ){ - PMIX_ERROR_LOG(rc); - return rc; + goto error; } nprocs = (size_t) _nprocs; cur_rank = 0; @@ -2477,11 +1998,11 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, } /* grab shared lock */ - if (PMIX_SUCCESS != (lock_rc = _ESH_RDLOCK(_ESH_SESSION_lock(ns_map->tbl_idx)))) { + lock_rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, rd_lock); + if (PMIX_SUCCESS != lock_rc) { /* Something wrong with the lock. The error is fatal */ - rc = PMIX_ERR_FATAL; - PMIX_ERROR_LOG(lock_rc); - return lock_rc; + rc = lock_rc; + goto error; } /* First of all, we go through all initial segments and look at their field. @@ -2497,9 +2018,9 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, */ /* first update local information about initial segments. they can be extended, so then we need to attach to new segments. */ - _update_initial_segment_info(ns_map); + _update_initial_segment_info(ds_ctx, ns_map); - ns_info = _get_ns_info_from_initial_segment(ns_map); + ns_info = _get_ns_info_from_initial_segment(ds_ctx, ns_map); if (NULL == ns_info) { /* no data for this namespace is found in the shared memory. */ PMIX_OUTPUT_VERBOSE((7, pmix_gds_base_framework.framework_output, @@ -2510,7 +2031,7 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, } /* get ns_track_elem_t object for the target namespace from the local track list. */ - elem = _get_track_elem_for_namespace(ns_map); + elem = _get_track_elem_for_namespace(ds_ctx, ns_map); if (NULL == elem) { /* Shouldn't happen! */ rc = PMIX_ERR_FATAL; @@ -2521,7 +2042,7 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, /* need to update tracker: * attach to shared memory regions for this namespace and store its info locally * to operate with address and detach/unlink afterwards. */ - rc = _update_ns_elem(elem, ns_info); + rc = _update_ns_elem(ds_ctx, elem, ns_info); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto done; @@ -2531,9 +2052,21 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, meta_seg = elem->meta_seg; data_seg = elem->data_seg; + if( NULL != key ) { + keyhash = PMIX_DS_KEY_HASH(ds_ctx, key); + } + + /* all segment data updated, ctx lock may released */ + if (lock_is_set) { + lock_is_set = false; + if (0 != (rc = pthread_mutex_unlock(&ds_ctx->lock))) { + goto error; + } + } + while (nprocs--) { /* Get the rank meta info in the shared meta segment. */ - rinfo = _get_rank_meta_info(cur_rank, meta_seg); + rinfo = _get_rank_meta_info(ds_ctx, cur_rank, meta_seg); if (NULL == rinfo) { PMIX_OUTPUT_VERBOSE((7, pmix_gds_base_framework.framework_output, "%s:%d:%s: no data for this rank is found in the shared memory. rank %u", @@ -2541,7 +2074,7 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, all_ranks_found = false; continue; } - addr = _get_data_region_by_offset(data_seg, rinfo->offset); + addr = _get_data_region_by_offset(ds_ctx, data_seg, rinfo->offset); if (NULL == addr) { /* This means that meta-info is broken - error is fatal */ rc = PMIX_ERR_FATAL; @@ -2593,22 +2126,22 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, * EXTENSION slot which has key = EXTENSION_SLOT and a size_t value for offset * to next data address for this process. */ - if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_INVALIDATED, ESH_KNAME_LEN(ESH_REGION_INVALIDATED))) { + if (PMIX_DS_KEY_IS_INVALID(ds_ctx, addr)) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, skip %s region", __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_INVALIDATED)); /* skip it * go to next item, updating address */ - addr += ESH_KV_SIZE(addr); - } else if (0 == strncmp(ESH_KNAME_PTR(addr), ESH_REGION_EXTENSION, ESH_KNAME_LEN(ESH_REGION_EXTENSION))) { + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); + } else if (PMIX_DS_KEY_IS_EXTSLOT(ds_ctx, addr)) { size_t offset; - memcpy(&offset, ESH_DATA_PTR(addr), sizeof(size_t)); + memcpy(&offset, PMIX_DS_DATA_PTR(ds_ctx, addr), sizeof(size_t)); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, reached %s with %lu value", __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_REGION_EXTENSION, offset)); if (0 < offset) { /* go to next item, updating address */ - addr = _get_data_region_by_offset(data_seg, offset); + addr = _get_data_region_by_offset(ds_ctx, data_seg, offset); if (NULL == addr) { /* This shouldn't happen - error is fatal */ rc = PMIX_ERR_FATAL; @@ -2625,21 +2158,22 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, } else if (NULL == key) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, found target key %s", - __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_KNAME_PTR(addr))); + __FILE__, __LINE__, __func__, nspace, cur_rank, PMIX_DS_KNAME_PTR(ds_ctx, addr))); - uint8_t *data_ptr = ESH_DATA_PTR(addr); - size_t data_size = ESH_DATA_SIZE(addr, data_ptr); + uint8_t *data_ptr = PMIX_DS_DATA_PTR(ds_ctx, addr); + size_t data_size = PMIX_DS_DATA_SIZE(ds_ctx, addr, data_ptr); PMIX_CONSTRUCT(&buffer, pmix_buffer_t); - PMIX_LOAD_BUFFER(_client_peer(), &buffer, data_ptr, data_size); + PMIX_LOAD_BUFFER(_client_peer(ds_ctx), &buffer, data_ptr, data_size); int cnt = 1; /* unpack value for this key from the buffer. */ PMIX_VALUE_CONSTRUCT(&val); - PMIX_BFROPS_UNPACK(rc, _client_peer(), &buffer, &val, &cnt, PMIX_VALUE); + PMIX_BFROPS_UNPACK(rc, _client_peer(ds_ctx), &buffer, &val, &cnt, PMIX_VALUE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto done; } - strncpy(info[kval_cnt - 1].key, ESH_KNAME_PTR(addr), ESH_KNAME_LEN((char *)addr)); + pmix_strncpy(info[kval_cnt - 1].key, PMIX_DS_KNAME_PTR(ds_ctx, addr), + PMIX_DS_KNAME_LEN(ds_ctx, addr)); pmix_value_xfer(&info[kval_cnt - 1].value, &val); PMIX_VALUE_DESTRUCT(&val); buffer.base_ptr = NULL; @@ -2648,30 +2182,24 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, key_found = true; kval_cnt--; - addr += ESH_KV_SIZE(addr); - } else if (0 == strncmp(ESH_KNAME_PTR(addr), key, ESH_KNAME_LEN(key))) { + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); + } else if (PMIX_DS_KEY_MATCH(ds_ctx, addr, key, keyhash)) { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, found target key %s", __FILE__, __LINE__, __func__, nspace, cur_rank, key)); /* target key is found, get value */ - uint8_t *data_ptr = ESH_DATA_PTR(addr); - size_t data_size = ESH_DATA_SIZE(addr, data_ptr); + uint8_t *data_ptr = PMIX_DS_DATA_PTR(ds_ctx, addr); + size_t data_size = PMIX_DS_DATA_SIZE(ds_ctx, addr, data_ptr); PMIX_CONSTRUCT(&buffer, pmix_buffer_t); - PMIX_LOAD_BUFFER(_client_peer(), &buffer, data_ptr, data_size); + PMIX_LOAD_BUFFER(_client_peer(ds_ctx), &buffer, data_ptr, data_size); int cnt = 1; /* unpack value for this key from the buffer. */ - PMIX_VALUE_CONSTRUCT(&val); - PMIX_BFROPS_UNPACK(rc, _client_peer(), &buffer, &val, &cnt, PMIX_VALUE); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto done; - } - PMIX_BFROPS_COPY(rc, _client_peer(), (void**)kvs, &val, PMIX_VALUE); + *kvs = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_BFROPS_UNPACK(rc, _client_peer(ds_ctx), &buffer, (void*)*kvs, &cnt, PMIX_VALUE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); goto done; } - PMIX_VALUE_DESTRUCT(&val); buffer.base_ptr = NULL; buffer.bytes_used = 0; PMIX_DESTRUCT(&buffer); @@ -2680,9 +2208,10 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, } else { PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, skip key %s look for key %s", - __FILE__, __LINE__, __func__, nspace, cur_rank, ESH_KNAME_PTR(addr), key)); + __FILE__, __LINE__, __func__, nspace, cur_rank, + PMIX_DS_KNAME_PTR(ds_ctx, addr), key)); /* go to next item, updating address */ - addr += ESH_KV_SIZE(addr); + addr += PMIX_DS_KV_SIZE(ds_ctx, addr); kval_cnt--; } } @@ -2694,10 +2223,16 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, done: /* unset lock */ - if (PMIX_SUCCESS != (lock_rc = _ESH_UNLOCK(_ESH_SESSION_lock(ns_map->tbl_idx)))) { + lock_rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, rd_unlock); + if (PMIX_SUCCESS != lock_rc) { PMIX_ERROR_LOG(lock_rc); } + /* unset ds_ctx lock */ + if (lock_is_set) { + pthread_mutex_unlock(&ds_ctx->lock); + } + if( rc != PMIX_SUCCESS ){ if ((NULL == key) && (kval_cnt > 0)) { if( NULL != info ) { @@ -2724,13 +2259,21 @@ static pmix_status_t _dstore_fetch(const char *nspace, pmix_rank_t rank, } rc = PMIX_ERR_NOT_FOUND; return rc; + +error: + if (lock_is_set) { + pthread_mutex_unlock(&ds_ctx->lock); + } + PMIX_ERROR_LOG(rc); + return rc; } -static pmix_status_t dstore_fetch(const pmix_proc_t *proc, - pmix_scope_t scope, bool copy, - const char *key, - pmix_info_t info[], size_t ninfo, - pmix_list_t *kvs) +PMIX_EXPORT pmix_status_t pmix_common_dstor_fetch(pmix_common_dstore_ctx_t *ds_ctx, + const pmix_proc_t *proc, + pmix_scope_t scope, bool copy, + const char *key, + pmix_info_t info[], size_t ninfo, + pmix_list_t *kvs) { pmix_kval_t *kv; pmix_value_t *val; @@ -2739,7 +2282,7 @@ static pmix_status_t dstore_fetch(const pmix_proc_t *proc, pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "gds: dstore fetch `%s`", key == NULL ? "NULL" : key); - rc = _dstore_fetch(proc->nspace, proc->rank, key, &val); + rc = _dstore_fetch(ds_ctx, proc->nspace, proc->rank, key, &val); if (PMIX_SUCCESS == rc) { if( NULL == key ) { pmix_info_t *info; @@ -2787,7 +2330,8 @@ static pmix_status_t dstore_fetch(const pmix_proc_t *proc, return rc; } -static pmix_status_t dstore_setup_fork(const pmix_proc_t *peer, char ***env) +PMIX_EXPORT pmix_status_t pmix_common_dstor_setup_fork(pmix_common_dstore_ctx_t *ds_ctx, const char *base_path_env, + const pmix_proc_t *peer, char ***env) { pmix_status_t rc = PMIX_SUCCESS; ns_map_data_t *ns_map = NULL; @@ -2795,41 +2339,43 @@ static pmix_status_t dstore_setup_fork(const pmix_proc_t *peer, char ***env) pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "gds: dstore setup fork"); - if (NULL == _esh_session_map_search) { + if (NULL == ds_ctx->session_map_search) { rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); return rc; } - if (NULL == (ns_map = _esh_session_map_search(peer->nspace))) { + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, peer->nspace))) { rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); return rc; } - if ((NULL == _base_path) || (strlen(_base_path) == 0)){ + if ((NULL == ds_ctx->base_path) || (strlen(ds_ctx->base_path) == 0)){ rc = PMIX_ERR_NOT_AVAILABLE; PMIX_ERROR_LOG(rc); return rc; } - if(PMIX_SUCCESS != (rc = pmix_setenv(PMIX_DSTORE_ESH_BASE_PATH, - _ESH_SESSION_path(ns_map->tbl_idx), true, env))){ + if(PMIX_SUCCESS != (rc = pmix_setenv(base_path_env, + _ESH_SESSION_path(ds_ctx->session_array, ns_map->tbl_idx), + true, env))){ PMIX_ERROR_LOG(rc); } + return rc; } -static pmix_status_t dstore_add_nspace(const char *nspace, - pmix_info_t info[], - size_t ninfo) +PMIX_EXPORT pmix_status_t pmix_common_dstor_add_nspace(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, pmix_info_t info[], size_t ninfo) { - pmix_status_t rc; + pmix_status_t rc = PMIX_SUCCESS; size_t tbl_idx=0; - uid_t jobuid = _jobuid; - char setjobuid = _setjobuid; + uid_t jobuid = ds_ctx->jobuid; + char setjobuid = ds_ctx->setjobuid; size_t n; ns_map_data_t *ns_map = NULL; + uint32_t local_size = 0; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "gds: dstore add nspace"); @@ -2841,31 +2387,36 @@ static pmix_status_t dstore_add_nspace(const char *nspace, setjobuid = 1; continue; } + if (0 == strcmp(PMIX_LOCAL_SIZE, info[n].key)) { + local_size = info[n].value.data.uint32; + continue; + } } } - if (PMIX_SUCCESS != _esh_jobuid_tbl_search(jobuid, &tbl_idx)) { + if (PMIX_SUCCESS != _esh_jobuid_tbl_search(ds_ctx, jobuid, &tbl_idx)) { - rc = _esh_session_tbl_add(&tbl_idx); + rc = _esh_session_tbl_add(ds_ctx, &tbl_idx); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return rc; } - ns_map = _esh_session_map(nspace, tbl_idx); + ns_map = _esh_session_map(ds_ctx, nspace, local_size, tbl_idx); if (NULL == ns_map) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); return rc; } - if (PMIX_SUCCESS != (rc =_esh_session_init(tbl_idx, ns_map, jobuid, setjobuid))) { + if (PMIX_SUCCESS != (rc =_esh_session_init(ds_ctx, tbl_idx, ns_map, + local_size, jobuid, setjobuid))) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); return rc; } } else { - ns_map = _esh_session_map(nspace, tbl_idx); + ns_map = _esh_session_map(ds_ctx, nspace, local_size, tbl_idx); if (NULL == ns_map) { rc = PMIX_ERROR; PMIX_ERROR_LOG(rc); @@ -2873,10 +2424,19 @@ static pmix_status_t dstore_add_nspace(const char *nspace, } } + /* lock init */ + ds_ctx->lock_cbs->init(&_ESH_SESSION_lock(ds_ctx->session_array, tbl_idx), + ds_ctx->base_path, nspace, local_size, ds_ctx->jobuid, + ds_ctx->setjobuid); + if (NULL == _ESH_SESSION_lock(ds_ctx->session_array, tbl_idx)) { + PMIX_ERROR_LOG(rc); + return rc; + } + return PMIX_SUCCESS; } -static pmix_status_t dstore_del_nspace(const char* nspace) +PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t *ds_ctx, const char* nspace) { pmix_status_t rc = PMIX_SUCCESS; size_t map_idx, size; @@ -2891,20 +2451,20 @@ static pmix_status_t dstore_del_nspace(const char* nspace) PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s delete nspace `%s`", __FILE__, __LINE__, __func__, nspace)); - if (NULL == (ns_map_data = _esh_session_map_search(nspace))) { + if (NULL == (ns_map_data = ds_ctx->session_map_search(ds_ctx, nspace))) { rc = PMIX_ERR_NOT_AVAILABLE; return rc; } dstor_track_idx = ns_map_data->track_idx; session_tbl_idx = ns_map_data->tbl_idx; - size = pmix_value_array_get_size(_ns_map_array); - ns_map = PMIX_VALUE_ARRAY_GET_BASE(_ns_map_array, ns_map_t); + size = pmix_value_array_get_size(ds_ctx->ns_map_array); + ns_map = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_map_array, ns_map_t); for (map_idx = 0; map_idx < size; map_idx++){ if (ns_map[map_idx].in_use && (ns_map[map_idx].data.tbl_idx == ns_map_data->tbl_idx)) { if (0 == strcmp(ns_map[map_idx].data.name, nspace)) { - _esh_session_map_clean(&ns_map[map_idx]); + _esh_session_map_clean(ds_ctx, &ns_map[map_idx]); continue; } in_use++; @@ -2914,68 +2474,29 @@ static pmix_status_t dstore_del_nspace(const char* nspace) /* A lot of nspaces may be using same session info * session record can only be deleted once all references are gone */ if (!in_use) { - session_tbl = PMIX_VALUE_ARRAY_GET_BASE(_session_array, session_t); + session_tbl = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->session_array, session_t); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s delete session for jobuid: %d", __FILE__, __LINE__, __func__, session_tbl[session_tbl_idx].jobuid)); - size = pmix_value_array_get_size(_ns_track_array); + size = pmix_value_array_get_size(ds_ctx->ns_track_array); if (size && (dstor_track_idx >= 0)) { - if((dstor_track_idx + 1) > size) { + if((dstor_track_idx + 1) > (int)size) { rc = PMIX_ERR_VALUE_OUT_OF_BOUNDS; PMIX_ERROR_LOG(rc); goto exit; } - trk = pmix_value_array_get_item(_ns_track_array, dstor_track_idx); + trk = pmix_value_array_get_item(ds_ctx->ns_track_array, dstor_track_idx); if (true == trk->in_use) { PMIX_DESTRUCT(trk); + pmix_value_array_remove_item(ds_ctx->ns_track_array, dstor_track_idx); } } - _esh_session_release(&session_tbl[session_tbl_idx]); + _esh_session_release(ds_ctx, session_tbl_idx); } exit: return rc; } -static pmix_status_t dstore_assign_module(pmix_info_t *info, size_t ninfo, - int *priority) -{ - size_t n, m; - char **options; - - *priority = 20; - if (NULL != info) { - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) { - options = pmix_argv_split(info[n].value.data.string, ','); - for (m=0; NULL != options[m]; m++) { - if (0 == strcmp(options[m], "ds12")) { - /* they specifically asked for us */ - *priority = 100; - break; - } - if (0 == strcmp(options[m], "dstore")) { - /* they are asking for any dstore module - we - * take an intermediate priority in case another - * dstore is more modern than us */ - *priority = 50; - break; - } - } - pmix_argv_free(options); - break; - } - } - } - -#if 0 - if PMIX_GDS_MODULE != "ds12" - *proirity = 0; - else PMIX_GDS_MODULE == "ds12" || !PMIX_GDS_MODULE - *priority = -1; -#endif - return PMIX_SUCCESS; -} - static inline int _my_client(const char *nspace, pmix_rank_t rank) { pmix_peer_t *peer; @@ -2998,16 +2519,59 @@ static inline int _my_client(const char *nspace, pmix_rank_t rank) * host has received data from some other peer. It therefore * always contains data solely from remote procs, and we * shall store it accordingly */ -static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, - pmix_list_t *cbs, - pmix_byte_object_t *bo) +PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t *buf) { - pmix_nspace_t *ns = (pmix_nspace_t*)nspace; + pmix_status_t rc = PMIX_SUCCESS; + pmix_status_t rc1 = PMIX_SUCCESS; + pmix_namespace_t *ns = (pmix_namespace_t*)nspace; + ns_map_data_t *ns_map; + + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, ns->nspace))) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + return rc; + } + + /* set exclusive lock */ + rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_lock); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + + rc = pmix_gds_base_store_modex(nspace, cbs, buf, (pmix_gds_base_store_modex_cb_fn_t)_dstor_store_modex_cb, ds_ctx); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + + /* unset lock */ + rc1 = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_unlock); + if (PMIX_SUCCESS != rc1) { + PMIX_ERROR_LOG(rc1); + if (PMIX_SUCCESS == rc) { + rc = rc1; + } + } + + return rc; +} + +static pmix_status_t _dstor_store_modex_cb(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_byte_object_t *bo) +{ + pmix_namespace_t *ns = (pmix_namespace_t*)nspace; pmix_status_t rc = PMIX_SUCCESS; int32_t cnt; pmix_buffer_t pbkt; pmix_proc_t proc; pmix_kval_t *kv; + ns_map_data_t *ns_map; + pmix_buffer_t tmp; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:dstore:store_modex for nspace %s", @@ -3048,6 +2612,10 @@ static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, PMIX_DESTRUCT(&pbkt); return PMIX_SUCCESS; } + + /* Prepare a buffer to be provided to the dstor store primitive */ + PMIX_CONSTRUCT(&tmp, pmix_buffer_t); + /* unpack the remaining values until we hit the end of the buffer */ cnt = 1; kv = PMIX_NEW(pmix_kval_t); @@ -3063,29 +2631,68 @@ static pmix_status_t dstore_store_modex(struct pmix_nspace_t *nspace, PMIX_DESTRUCT(&pbkt); return rc; } - if (PMIX_SUCCESS != (rc = dstore_store(&proc, PMIX_REMOTE, kv))) { - PMIX_ERROR_LOG(rc); - } - PMIX_RELEASE(kv); // maintain accounting as the hash increments the ref count - /* continue along */ + + /* place the key to the to be provided to _dstore_store_nolock */ + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &tmp, kv, 1, PMIX_KVAL); + + /* Release the kv to maintain accounting + * as the hash increments the ref count */ + PMIX_RELEASE(kv); + + /* proceed to the next element */ kv = PMIX_NEW(pmix_kval_t); cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); } - PMIX_RELEASE(kv); // maintain accounting + + /* Release the kv that didn't received the value + * because input buffer was exhausted */ + PMIX_RELEASE(kv); if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) { PMIX_ERROR_LOG(rc); } else { rc = PMIX_SUCCESS; } + + /* Create a key-value pair with the buffer + * to be passed to _dstore_store_nolock */ + kv = PMIX_NEW(pmix_kval_t); + PMIX_VALUE_CREATE(kv->value, 1); + kv->value->type = PMIX_BYTE_OBJECT; + PMIX_UNLOAD_BUFFER(&tmp, kv->value->data.bo.bytes, kv->value->data.bo.size); + + /* Get the namespace map element for the process "proc" */ + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc.nspace))) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + bo->bytes = pbkt.base_ptr; + bo->size = pbkt.bytes_used; // restore the incoming data + pbkt.base_ptr = NULL; + PMIX_DESTRUCT(&pbkt); + return rc; + } + + /* Store all keys at once */ + rc = _dstore_store_nolock(ds_ctx, ns_map, proc.rank, kv); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + + /* Release all resources */ + PMIX_RELEASE(kv); + PMIX_DESTRUCT(&tmp); + + /* Reset the input buffer */ bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data + bo->size = pbkt.bytes_used; pbkt.base_ptr = NULL; PMIX_DESTRUCT(&pbkt); + return rc; } -static pmix_status_t _store_job_info(pmix_proc_t *proc) +static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_data_t *ns_map, + pmix_proc_t *proc) { pmix_cb_t cb; pmix_kval_t *kv; @@ -3113,7 +2720,7 @@ static pmix_status_t _store_job_info(pmix_proc_t *proc) } PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - if ((PMIX_PROC_IS_V1(_client_peer()) || PMIX_PROC_IS_V20(_client_peer())) && + if ((PMIX_PROC_IS_V1(_client_peer(ds_ctx)) || PMIX_PROC_IS_V20(_client_peer(ds_ctx))) && 0 != strncmp("pmix.", kv->key, 4) && kv->value->type == PMIX_DATA_ARRAY) { pmix_info_t *info; @@ -3150,7 +2757,7 @@ static pmix_status_t _store_job_info(pmix_proc_t *proc) } PMIX_UNLOAD_BUFFER(&buf, kvp->value->data.bo.bytes, kvp->value->data.bo.size); - if (PMIX_SUCCESS != (rc = _dstore_store(proc->nspace, proc->rank, kvp))) { + if (PMIX_SUCCESS != (rc = _dstore_store_nolock(ds_ctx, ns_map, proc->rank, kvp))) { PMIX_ERROR_LOG(rc); goto exit; } @@ -3162,11 +2769,12 @@ static pmix_status_t _store_job_info(pmix_proc_t *proc) return rc; } -static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, - pmix_buffer_t *reply) +PMIX_EXPORT pmix_status_t pmix_common_dstor_register_job_info(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_peer_t *pr, + pmix_buffer_t *reply) { pmix_peer_t *peer = (pmix_peer_t*)pr; - pmix_nspace_t *ns = peer->nptr; + pmix_namespace_t *ns = peer->nptr; char *msg; pmix_status_t rc; pmix_proc_t proc; @@ -3178,10 +2786,25 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, peer->info->pname.nspace, peer->info->pname.rank); if (0 == ns->ndelivered) { // don't store twice - _client_compat_save(peer); - (void)strncpy(proc.nspace, ns->nspace, PMIX_MAX_NSLEN); + ns_map_data_t *ns_map; + + _client_compat_save(ds_ctx, peer); + pmix_strncpy(proc.nspace, ns->nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - rc = _store_job_info(&proc); + if (NULL == (ns_map = ds_ctx->session_map_search(ds_ctx, proc.nspace))) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + return rc; + } + + /* set exclusive lock */ + rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_lock); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + + rc = _store_job_info(ds_ctx, ns_map, &proc); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return rc; @@ -3189,12 +2812,18 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, for (rank=0; rank < ns->nprocs; rank++) { proc.rank = rank; - rc = _store_job_info(&proc); + rc = _store_job_info(ds_ctx, ns_map, &proc); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return rc; } } + /* unset lock */ + rc = _ESH_LOCK(ds_ctx, ns_map->tbl_idx, wr_unlock); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } } /* answer to client */ @@ -3208,7 +2837,9 @@ static pmix_status_t dstore_register_job_info(struct pmix_peer_t *pr, return rc; } -static pmix_status_t dstore_store_job_info(const char *nspace, pmix_buffer_t *buf) +PMIX_EXPORT pmix_status_t pmix_common_dstor_store_job_info(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, + pmix_buffer_t *job_data) { pmix_status_t rc = PMIX_SUCCESS; @@ -3217,7 +2848,7 @@ static pmix_status_t dstore_store_job_info(const char *nspace, pmix_buffer_t *b pmix_globals.myid.nspace, pmix_globals.myid.rank, nspace); /* check buf data */ - if ((NULL == buf) || (0 == buf->bytes_used)) { + if ((NULL == job_data) || (0 == job_data->bytes_used)) { rc = PMIX_ERR_BAD_PARAM; PMIX_ERROR_LOG(rc); return rc; @@ -3225,23 +2856,23 @@ static pmix_status_t dstore_store_job_info(const char *nspace, pmix_buffer_t *b return rc; } -static void _client_compat_save(pmix_peer_t *peer) +static void _client_compat_save(pmix_common_dstore_ctx_t *ds_ctx, pmix_peer_t *peer) { - pmix_nspace_t *nptr = NULL; + pmix_namespace_t *nptr = NULL; - if (NULL == _clients_peer) { - _clients_peer = PMIX_NEW(pmix_peer_t); - nptr = PMIX_NEW(pmix_nspace_t); - _clients_peer->nptr = nptr; + if (NULL == ds_ctx->clients_peer) { + ds_ctx->clients_peer = PMIX_NEW(pmix_peer_t); + nptr = PMIX_NEW(pmix_namespace_t); + ds_ctx->clients_peer->nptr = nptr; } - _clients_peer->nptr->compat = peer->nptr->compat; - _clients_peer->proc_type = peer->proc_type; + ds_ctx->clients_peer->nptr->compat = peer->nptr->compat; + ds_ctx->clients_peer->proc_type = peer->proc_type; } -static inline pmix_peer_t * _client_peer(void) +static inline pmix_peer_t * _client_peer(pmix_common_dstore_ctx_t *ds_ctx) { - if (NULL == _clients_peer) { + if (NULL == ds_ctx->clients_peer) { return pmix_globals.mypeer; } - return _clients_peer; + return ds_ctx->clients_peer; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h new file mode 100644 index 00000000000..7989ae6ca56 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_DSTORE_H +#define PMIX_DSTORE_H + +#include + + +#include "src/mca/gds/gds.h" +#include "src/mca/pshmem/pshmem.h" + +BEGIN_C_DECLS + +#include +#include "src/class/pmix_value_array.h" +#include "dstore_common.h" +#include "dstore_segment.h" +#include "dstore_file.h" + +#define INITIAL_SEG_SIZE 4096 +#define NS_META_SEG_SIZE (1<<22) +#define NS_DATA_SEG_SIZE (1<<22) + +#define PMIX_DSTORE_ESH_BASE_PATH "PMIX_DSTORE_ESH_BASE_PATH" +#define PMIX_DSTORE_VER_BASE_PATH_FMT "PMIX_DSTORE_%d_BASE_PATH" + +typedef struct ns_map_data_s ns_map_data_t; +typedef struct session_s session_t; +typedef struct ns_map_s ns_map_t; + +typedef ns_map_data_t * (*session_map_search_fn_t)(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace); + +struct pmix_common_dstore_ctx_s { + char *ds_name; + char *base_path; + uid_t jobuid; + char setjobuid; + + pmix_value_array_t *session_array; + pmix_value_array_t *ns_map_array; + pmix_value_array_t *ns_track_array; + + pmix_common_lock_callbacks_t *lock_cbs; + pmix_common_dstore_file_cbs_t *file_cbs; + + size_t initial_segment_size; + size_t meta_segment_size; + size_t data_segment_size; + size_t lock_segment_size; + + size_t max_ns_num; + size_t max_meta_elems; + + session_map_search_fn_t session_map_search; + pmix_peer_t *clients_peer; + /* If _direct_mode is set, it means that we use linear search + * along the array of rank meta info objects inside a meta segment + * to find the requested rank. Otherwise, we do a fast lookup + * based on rank and directly compute offset. + * This mode is called direct because it's effectively used in + * sparse communication patterns when direct modex is usually used. + */ + int direct_mode; + /* dstore ctx protect lock, uses for clients only */ + pthread_mutex_t lock; +}; + +struct session_s { + int in_use; + uid_t jobuid; + char setjobuid; + char *nspace_path; + pmix_dstore_seg_desc_t *sm_seg_first; + pmix_dstore_seg_desc_t *sm_seg_last; + pmix_common_dstor_lock_ctx_t lock; +}; + +struct ns_map_data_s { + char name[PMIX_MAX_NSLEN+1]; + size_t tbl_idx; + int track_idx; +}; + +struct ns_map_s { + int in_use; + ns_map_data_t data; +}; + +/* initial segment format: + * size_t num_elems; + * size_t full; //indicate to client that it needs to attach to the next segment + * ns_seg_info_t ns_seg_info[max_ns_num]; + */ + +typedef struct { + ns_map_data_t ns_map; + size_t num_meta_seg;/* read by clients to attach to this number of segments. */ + size_t num_data_seg; +} ns_seg_info_t; + +/* meta segment format: + * size_t num_elems; + * rank_meta_info meta_info[max_meta_elems]; + */ + +typedef struct { + size_t rank; + size_t offset; + size_t count; +} rank_meta_info; + +typedef struct { + pmix_value_array_t super; + ns_map_data_t ns_map; + size_t num_meta_seg; + size_t num_data_seg; + pmix_dstore_seg_desc_t *meta_seg; + pmix_dstore_seg_desc_t *data_seg; + bool in_use; +} ns_track_elem_t; + +typedef struct { + pmix_list_item_t super; + pmix_common_dstor_lock_ctx_t *lock; +} lock_track_item_t; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h new file mode 100644 index 00000000000..466eccd9a5d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_common.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_GDS_DS_BASE_H_ +#define PMIX_GDS_DS_BASE_H_ + +#include +#include +#include + +#include "src/include/pmix_globals.h" +#include "src/class/pmix_list.h" +#include "src/mca/gds/gds.h" +#include "src/mca/pshmem/pshmem.h" +#include "src/mca/common/dstore/dstore_file.h" + +typedef void* pmix_common_dstor_lock_ctx_t; + +typedef pmix_status_t (*pmix_common_dstor_lock_init_fn_t)(pmix_common_dstor_lock_ctx_t *ctx, + const char *base_path, const char *name, + uint32_t local_size, uid_t uid, bool setuid); +typedef void (*pmix_common_dstor_lock_finalize_fn_t)(pmix_common_dstor_lock_ctx_t *ctx); +typedef pmix_status_t (*pmix_common_dstor_lock_rd_get_fn_t)(pmix_common_dstor_lock_ctx_t ctx); +typedef pmix_status_t (*pmix_common_dstor_lock_rd_rel_fn_t)(pmix_common_dstor_lock_ctx_t ctx); +typedef pmix_status_t (*pmix_common_dstor_lock_wr_get_fn_t)(pmix_common_dstor_lock_ctx_t ctx); +typedef pmix_status_t (*pmix_common_dstor_lock_wr_rel_fn_t)(pmix_common_dstor_lock_ctx_t ctx); + +typedef struct { + pmix_common_dstor_lock_init_fn_t init; + pmix_common_dstor_lock_finalize_fn_t finalize; + pmix_common_dstor_lock_rd_get_fn_t rd_lock; + pmix_common_dstor_lock_rd_rel_fn_t rd_unlock; + pmix_common_dstor_lock_wr_get_fn_t wr_lock; + pmix_common_dstor_lock_wr_rel_fn_t wr_unlock; +} pmix_common_lock_callbacks_t; + +typedef struct pmix_common_dstore_ctx_s pmix_common_dstore_ctx_t; + +PMIX_EXPORT pmix_common_dstore_ctx_t *pmix_common_dstor_init(const char *ds_name, pmix_info_t info[], size_t ninfo, + pmix_common_lock_callbacks_t *lock_cb, + pmix_common_dstore_file_cbs_t *file_cb); +PMIX_EXPORT void pmix_common_dstor_finalize(pmix_common_dstore_ctx_t *ds_ctx); +PMIX_EXPORT pmix_status_t pmix_common_dstor_add_nspace(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, pmix_info_t info[], size_t ninfo); +PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t *ds_ctx, const char* nspace); +PMIX_EXPORT pmix_status_t pmix_common_dstor_setup_fork(pmix_common_dstore_ctx_t *ds_ctx, const char *base_path_env, + const pmix_proc_t *peer, char ***env); +PMIX_EXPORT pmix_status_t pmix_common_dstor_cache_job_info(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *ns, + pmix_info_t info[], size_t ninfo); +PMIX_EXPORT pmix_status_t pmix_common_dstor_register_job_info(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_peer_t *pr, + pmix_buffer_t *reply); +PMIX_EXPORT pmix_status_t pmix_common_dstor_store_job_info(pmix_common_dstore_ctx_t *ds_ctx, + const char *nspace, + pmix_buffer_t *job_data); +PMIX_EXPORT pmix_status_t pmix_common_dstor_store(pmix_common_dstore_ctx_t *ds_ctx, + const pmix_proc_t *proc, + pmix_scope_t scope, + pmix_kval_t *kv); +PMIX_EXPORT pmix_status_t pmix_common_dstor_fetch(pmix_common_dstore_ctx_t *ds_ctx, + const pmix_proc_t *proc, + pmix_scope_t scope, bool copy, + const char *key, + pmix_info_t info[], size_t ninfo, + pmix_list_t *kvs); +PMIX_EXPORT pmix_status_t pmix_common_dstor_store_modex(pmix_common_dstore_ctx_t *ds_ctx, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t *buff); +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_file.h new file mode 100644 index 00000000000..576149b0569 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_file.h @@ -0,0 +1,161 @@ +#ifndef DSTORE_FORMAT_H +#define DSTORE_FORMAT_H + +typedef size_t (*pmix_common_dstore_kv_size_fn)(uint8_t *addr); +typedef char* (*pmix_common_dstore_key_name_ptr_fn)(uint8_t *addr); +typedef size_t (*pmix_common_dstore_key_name_len_fn)(char *key); +typedef uint8_t* (*pmix_common_dstore_data_ptr_fn)(uint8_t *addr); +typedef size_t (*pmix_common_dstore_data_size_fn)(uint8_t *addr, uint8_t* data_ptr); +typedef size_t (*pmix_common_dstore_key_size_fn)(char *key, size_t data_size); +typedef size_t (*pmix_common_dstore_ext_slot_size_fn)(void); +typedef int (*pmix_common_dstore_put_key_fn)(uint8_t *addr, char *key, void *buf, + size_t size); +typedef bool (*pmix_common_dstore_is_invalid_fn)(uint8_t *addr); +typedef bool (*pmix_common_dstore_is_extslot_fn)(uint8_t *addr); +typedef void (*pmix_common_dstore_set_invalid_fn)(uint8_t *addr); +typedef size_t (*pmix_common_dstore_key_hash_fn)(const char *key); +typedef bool (*pmix_common_dstore_key_match_fn)(uint8_t *addr, const char *key, + size_t key_hash); + +typedef struct { + const char *name; + pmix_common_dstore_kv_size_fn kval_size; + pmix_common_dstore_key_name_ptr_fn kname_ptr; + pmix_common_dstore_key_name_len_fn kname_len; + pmix_common_dstore_data_ptr_fn data_ptr; + pmix_common_dstore_data_size_fn data_size; + pmix_common_dstore_key_size_fn key_size; + pmix_common_dstore_ext_slot_size_fn ext_slot_size; + pmix_common_dstore_put_key_fn put_key; + pmix_common_dstore_is_invalid_fn is_invalid; + pmix_common_dstore_is_extslot_fn is_extslot; + pmix_common_dstore_set_invalid_fn set_invalid; + pmix_common_dstore_key_hash_fn key_hash; + pmix_common_dstore_key_match_fn key_match; +} pmix_common_dstore_file_cbs_t; + +#define ESH_REGION_EXTENSION "EXTENSION_SLOT" +#define ESH_REGION_INVALIDATED "INVALIDATED" +#define ESH_ENV_INITIAL_SEG_SIZE "INITIAL_SEG_SIZE" +#define ESH_ENV_NS_META_SEG_SIZE "NS_META_SEG_SIZE" +#define ESH_ENV_NS_DATA_SEG_SIZE "NS_DATA_SEG_SIZE" +#define ESH_ENV_LINEAR "SM_USE_LINEAR_SEARCH" + +#define ESH_MIN_KEY_LEN (sizeof(ESH_REGION_INVALIDATED)) + +#define PMIX_DS_PUT_KEY(rc, ctx, addr, key, buf, size) \ + do { \ + rc = PMIX_ERROR; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->put_key) { \ + rc = (ctx)->file_cbs->put_key(addr, key, buf, size); \ + } \ + } while(0) + +#define PMIX_DS_KV_SIZE(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + size_t size = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->kval_size) { \ + size = (ctx)->file_cbs->kval_size(addr); \ + } \ + size; \ +}) + +#define PMIX_DS_KNAME_PTR(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + char *name_ptr = NULL; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->kname_ptr) { \ + name_ptr = (ctx)->file_cbs->kname_ptr(addr); \ + } \ + name_ptr; \ +}) + +#define PMIX_DS_KNAME_LEN(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + size_t len = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->kname_len) { \ + len = (ctx)->file_cbs->kname_len((char*)addr); \ + } \ + len; \ +}) + +#define PMIX_DS_DATA_PTR(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + uint8_t *data_ptr = NULL; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->data_ptr) { \ + data_ptr = (ctx)->file_cbs->data_ptr(addr); \ + } \ + data_ptr; \ +}) + +#define PMIX_DS_DATA_SIZE(ctx, addr, data_ptr) \ +__pmix_attribute_extension__ ({ \ + size_t size = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->data_size) { \ + size = (ctx)->file_cbs->data_size(addr, data_ptr); \ + } \ + size; \ +}) + +#define PMIX_DS_KEY_SIZE(ctx, key, data_size) \ +__pmix_attribute_extension__ ({ \ + size_t __size = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->key_size) { \ + __size = (ctx)->file_cbs->key_size(key, data_size); \ + } \ + __size; \ +}) + +#define PMIX_DS_SLOT_SIZE(ctx) \ +__pmix_attribute_extension__ ({ \ + size_t __size = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->ext_slot_size) { \ + __size = (ctx)->file_cbs->ext_slot_size(); \ + } \ + __size; \ +}) + +#define PMIX_DS_KEY_HASH(ctx, key) \ +__pmix_attribute_extension__ ({ \ + size_t keyhash = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->key_hash) { \ + keyhash = (ctx)->file_cbs->key_hash(key); \ + } \ + keyhash; \ +}) + +#define PMIX_DS_KEY_MATCH(ctx, addr, key, hash) \ +__pmix_attribute_extension__ ({ \ + int ret = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->key_match) { \ + ret = (ctx)->file_cbs->key_match(addr, key, hash); \ + } \ + ret; \ +}) + +#define PMIX_DS_KEY_IS_INVALID(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + int ret = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->is_invalid) { \ + ret = (ctx)->file_cbs->is_invalid(addr); \ + } \ + ret; \ +}) + +#define PMIX_DS_KEY_SET_INVALID(ctx, addr) \ + do { \ + if ((ctx)->file_cbs && (ctx)->file_cbs->set_invalid) { \ + (ctx)->file_cbs->set_invalid(addr); \ + } \ + } while(0) + +#define PMIX_DS_KEY_IS_EXTSLOT(ctx, addr) \ +__pmix_attribute_extension__ ({ \ + int ret = 0; \ + if ((ctx)->file_cbs && (ctx)->file_cbs->is_invalid) { \ + ret = (ctx)->file_cbs->is_extslot(addr); \ + } \ + ret; \ +}) + + +#endif // DSTORE_FORMAT_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c new file mode 100644 index 00000000000..a219bed9c0b --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c @@ -0,0 +1,302 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif + +#ifdef HAVE_SYS_AUXV_H +#include +#endif + +#include + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/base/base.h" +#include "src/mca/pshmem/base/base.h" +#include "src/util/error.h" +#include "src/util/output.h" + +#include "dstore_common.h" +#include "dstore_segment.h" + +static size_t _initial_segment_size; +static size_t _meta_segment_size; +static size_t _data_segment_size; + +PMIX_EXPORT int pmix_common_dstor_getpagesize(void) +{ +#if defined(_SC_PAGESIZE ) + return sysconf(_SC_PAGESIZE); +#elif defined(_SC_PAGE_SIZE) + return sysconf(_SC_PAGE_SIZE); +#else + return 65536; /* safer to overestimate than under */ +#endif +} + +PMIX_EXPORT size_t pmix_common_dstor_getcacheblocksize(void) +{ + size_t cache_line = 0; + +#if defined(_SC_LEVEL1_DCACHE_LINESIZE) + cache_line = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); +#endif +#if (defined(HAVE_SYS_AUXV_H)) && (defined(AT_DCACHEBSIZE)) + if (0 == cache_line) { + cache_line = getauxval(AT_DCACHEBSIZE); + } +#endif + return cache_line; +} + +PMIX_EXPORT void pmix_common_dstor_init_segment_info(size_t initial_segment_size, + size_t meta_segment_size, + size_t data_segment_size) +{ + _initial_segment_size = initial_segment_size; + _meta_segment_size = meta_segment_size; + _data_segment_size = data_segment_size; +} + +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_create_new_lock_seg(const char *base_path, size_t size, + const char *name, uint32_t id, uid_t uid, bool setuid) +{ + pmix_status_t rc; + char file_name[PMIX_PATH_MAX]; + pmix_dstore_seg_desc_t *new_seg = NULL; + + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s: segment type %d, nspace %s, id %u", + __FILE__, __LINE__, __func__, PMIX_DSTORE_NS_LOCK_SEGMENT, + name, id)); + + snprintf(file_name, PMIX_PATH_MAX, "%s/smlockseg-%s", base_path, name); + new_seg = (pmix_dstore_seg_desc_t*)malloc(sizeof(pmix_dstore_seg_desc_t)); + if (new_seg) { + new_seg->id = id; + new_seg->next = NULL; + new_seg->type = PMIX_DSTORE_NS_LOCK_SEGMENT; + rc = pmix_pshmem.segment_create(&new_seg->seg_info, file_name, size); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto err_exit; + } + memset(new_seg->seg_info.seg_base_addr, 0, size); + + if (setuid > 0){ + rc = PMIX_ERR_PERM; + if (0 > chown(file_name, (uid_t) uid, (gid_t) -1)){ + PMIX_ERROR_LOG(rc); + goto err_exit; + } + /* set the mode as required */ + if (0 > chmod(file_name, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )) { + PMIX_ERROR_LOG(rc); + goto err_exit; + } + } + } + return new_seg; + + err_exit: + if( NULL != new_seg ){ + free(new_seg); + } + return NULL; + +} + +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_attach_new_lock_seg(const char *base_path, + size_t size, const char *name, uint32_t id) +{ + pmix_status_t rc; + pmix_dstore_seg_desc_t *new_seg = NULL; + new_seg = (pmix_dstore_seg_desc_t*)malloc(sizeof(pmix_dstore_seg_desc_t)); + new_seg->id = id; + new_seg->next = NULL; + new_seg->type = PMIX_DSTORE_NS_LOCK_SEGMENT; + new_seg->seg_info.seg_size = size; + + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s: segment type %d, name %s, id %u", + __FILE__, __LINE__, __func__, new_seg->type, name, id)); + + snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/smlockseg-%s", + base_path, name); + rc = pmix_pshmem.segment_attach(&new_seg->seg_info, PMIX_PSHMEM_RW); + if (PMIX_SUCCESS != rc) { + free(new_seg); + new_seg = NULL; + } + return new_seg; +} + +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_create_new_segment(pmix_dstore_segment_type type, + const char *base_path, const char *name, uint32_t id, + uid_t uid, bool setuid) +{ + pmix_status_t rc; + char file_name[PMIX_PATH_MAX]; + size_t size; + pmix_dstore_seg_desc_t *new_seg = NULL; + + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s: segment type %d, nspace %s, id %u", + __FILE__, __LINE__, __func__, type, name, id)); + + switch (type) { + case PMIX_DSTORE_INITIAL_SEGMENT: + size = _initial_segment_size; + snprintf(file_name, PMIX_PATH_MAX, "%s/initial-pmix_shared-segment-%u", + base_path, id); + break; + case PMIX_DSTORE_NS_META_SEGMENT: + size = _meta_segment_size; + snprintf(file_name, PMIX_PATH_MAX, "%s/smseg-%s-%u", base_path, name, id); + break; + case PMIX_DSTORE_NS_DATA_SEGMENT: + size = _data_segment_size; + snprintf(file_name, PMIX_PATH_MAX, "%s/smdataseg-%s-%d", base_path, name, id); + break; + default: + PMIX_ERROR_LOG(PMIX_ERROR); + return NULL; + } + new_seg = (pmix_dstore_seg_desc_t*)malloc(sizeof(pmix_dstore_seg_desc_t)); + if (new_seg) { + new_seg->id = id; + new_seg->next = NULL; + new_seg->type = type; + rc = pmix_pshmem.segment_create(&new_seg->seg_info, file_name, size); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto err_exit; + } + memset(new_seg->seg_info.seg_base_addr, 0, size); + + if (setuid > 0){ + rc = PMIX_ERR_PERM; + if (0 > chown(file_name, (uid_t) uid, (gid_t) -1)){ + PMIX_ERROR_LOG(rc); + goto err_exit; + } + /* set the mode as required */ + if (0 > chmod(file_name, S_IRUSR | S_IRGRP | S_IWGRP )) { + PMIX_ERROR_LOG(rc); + goto err_exit; + } + } + } + return new_seg; + +err_exit: + if( NULL != new_seg ){ + free(new_seg); + } + return NULL; +} + +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_attach_new_segment(pmix_dstore_segment_type type, const char *base_path, + const char *name, uint32_t id) +{ + pmix_status_t rc; + pmix_dstore_seg_desc_t *new_seg = NULL; + new_seg = (pmix_dstore_seg_desc_t*)malloc(sizeof(pmix_dstore_seg_desc_t)); + new_seg->id = id; + new_seg->next = NULL; + new_seg->type = type; + + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s: segment type %d, nspace %s, id %u", + __FILE__, __LINE__, __func__, type, name, id)); + + switch (type) { + case PMIX_DSTORE_INITIAL_SEGMENT: + new_seg->seg_info.seg_size = _initial_segment_size; + snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/initial-pmix_shared-segment-%u", + base_path, id); + break; + case PMIX_DSTORE_NS_META_SEGMENT: + new_seg->seg_info.seg_size = _meta_segment_size; + snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/smseg-%s-%u", + base_path, name, id); + break; + case PMIX_DSTORE_NS_DATA_SEGMENT: + new_seg->seg_info.seg_size = _data_segment_size; + snprintf(new_seg->seg_info.seg_name, PMIX_PATH_MAX, "%s/smdataseg-%s-%d", + base_path, name, id); + break; + default: + free(new_seg); + PMIX_ERROR_LOG(PMIX_ERROR); + return NULL; + } + rc = pmix_pshmem.segment_attach(&new_seg->seg_info, PMIX_PSHMEM_RONLY); + if (PMIX_SUCCESS != rc) { + free(new_seg); + new_seg = NULL; + PMIX_ERROR_LOG(rc); + } + return new_seg; +} + +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_extend_segment(pmix_dstore_seg_desc_t *segdesc, const char *base_path, + const char *name, uid_t uid, bool setuid) +{ + pmix_dstore_seg_desc_t *tmp, *seg; + + PMIX_OUTPUT_VERBOSE((2, pmix_gds_base_framework.framework_output, + "%s:%d:%s", + __FILE__, __LINE__, __func__)); + /* find last segment */ + tmp = segdesc; + while (NULL != tmp->next) { + tmp = tmp->next; + } + /* create another segment, the old one is full. */ + seg = pmix_common_dstor_create_new_segment(segdesc->type, base_path, name, tmp->id + 1, uid, setuid); + tmp->next = seg; + + return seg; +} + +PMIX_EXPORT void pmix_common_dstor_delete_sm_desc(pmix_dstore_seg_desc_t *desc) +{ + pmix_dstore_seg_desc_t *tmp; + + /* free all global segments */ + while (NULL != desc) { + tmp = desc->next; + /* detach & unlink from current desc */ + if (desc->seg_info.seg_cpid == getpid()) { + pmix_pshmem.segment_unlink(&desc->seg_info); + } + pmix_pshmem.segment_detach(&desc->seg_info); + free(desc); + desc = tmp; + } +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h new file mode 100644 index 00000000000..6430273faab --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/base/base.h" +#include "src/mca/pshmem/base/base.h" + +#include "dstore_common.h" + +#ifndef DSTORE_SEGMENT_H +#define DSTORE_SEGMENT_H + +/* this structs are used to store information about + * shared segments addresses locally at each process, + * so they are common for different types of segments + * and don't have a specific content (namespace's info, + * rank's meta info, ranks's data). */ + +typedef struct pmix_dstore_seg_desc_t pmix_dstore_seg_desc_t; + +typedef enum { + PMIX_DSTORE_INITIAL_SEGMENT, + PMIX_DSTORE_NS_META_SEGMENT, + PMIX_DSTORE_NS_DATA_SEGMENT, + PMIX_DSTORE_NS_LOCK_SEGMENT, +} pmix_dstore_segment_type; + +struct pmix_dstore_seg_desc_t { + pmix_dstore_segment_type type; + pmix_pshmem_seg_t seg_info; + uint32_t id; + pmix_dstore_seg_desc_t *next; +}; + +PMIX_EXPORT int pmix_common_dstor_getpagesize(void); +PMIX_EXPORT size_t pmix_common_dstor_getcacheblocksize(void); +PMIX_EXPORT void pmix_common_dstor_init_segment_info(size_t initial_segment_size, + size_t meta_segment_size, + size_t data_segment_size); +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_create_new_segment(pmix_dstore_segment_type type, + const char *base_path, const char *name, uint32_t id, + uid_t uid, bool setuid); +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_attach_new_segment(pmix_dstore_segment_type type, + const char *base_path, + const char *name, uint32_t id); +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_extend_segment(pmix_dstore_seg_desc_t *segdesc, + const char *base_path, + const char *name, uid_t uid, bool setuid); +PMIX_EXPORT void pmix_common_dstor_delete_sm_desc(pmix_dstore_seg_desc_t *desc); +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_create_new_lock_seg(const char *base_path, size_t size, + const char *name, uint32_t id, uid_t uid, bool setuid); +PMIX_EXPORT pmix_dstore_seg_desc_t *pmix_common_dstor_attach_new_lock_seg(const char *base_path, + size_t size, const char *name, uint32_t id); + +#endif // DSTORE_SEGMENT_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h index 3ada366984f..242fc4dabd4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/base.h @@ -14,6 +14,7 @@ * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -76,6 +77,12 @@ struct pmix_gds_globals_t { }; typedef struct pmix_gds_globals_t pmix_gds_globals_t; +typedef void * pmix_gds_base_store_modex_cbdata_t; +typedef pmix_status_t (*pmix_gds_base_store_modex_cb_fn_t)(pmix_gds_base_store_modex_cbdata_t cbdata, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_byte_object_t *bo); + PMIX_EXPORT extern pmix_gds_globals_t pmix_gds_globals; /* get a list of available support - caller must free results @@ -98,6 +105,12 @@ PMIX_EXPORT pmix_gds_base_module_t* pmix_gds_base_assign_module(pmix_info_t *inf PMIX_EXPORT pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, char ***env); +PMIX_EXPORT pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t *xfer, + pmix_gds_base_store_modex_cb_fn_t cb_fn, + pmix_gds_base_store_modex_cbdata_t cbdata); + END_C_DECLS #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c index 16e88485c9f..b9f8533c0ef 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c @@ -3,6 +3,9 @@ * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ * @@ -83,3 +86,99 @@ pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, return PMIX_SUCCESS; } + +pmix_status_t pmix_gds_base_store_modex(struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t * buff, + pmix_gds_base_store_modex_cb_fn_t cb_fn, + pmix_gds_base_store_modex_cbdata_t cbdata) +{ + pmix_status_t rc = PMIX_SUCCESS; + pmix_namespace_t * ns = (pmix_namespace_t *)nspace; + pmix_buffer_t bkt; + pmix_byte_object_t bo, bo2; + int32_t cnt = 1; + char byte; + pmix_collect_t ctype; + bool have_ctype = false; + + /* Loop over the enclosed byte object envelopes and + * store them in our GDS module */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + buff, &bo, &cnt, PMIX_BYTE_OBJECT); + while (PMIX_SUCCESS == rc) { + PMIX_CONSTRUCT(&bkt, pmix_buffer_t); + PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, bo.bytes, bo.size); + /* unpack the data collection flag */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + &bkt, &byte, &cnt, PMIX_BYTE); + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { + /* no data was returned, so we are done with this blob */ + PMIX_DESTRUCT(&bkt); + break; + } + if (PMIX_SUCCESS != rc) { + /* we have an error */ + PMIX_DESTRUCT(&bkt); + goto error; + } + + // Check that this blob was accumulated with the same data collection setting + if (have_ctype) { + if (ctype != (pmix_collect_t)byte) { + rc = PMIX_ERR_INVALID_ARG; + PMIX_DESTRUCT(&bkt); + goto error; + } + } + else { + ctype = (pmix_collect_t)byte; + have_ctype = true; + } + + /* unpack the enclosed blobs from the various peers */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + &bkt, &bo2, &cnt, PMIX_BYTE_OBJECT); + while (PMIX_SUCCESS == rc) { + /* unpack all the kval's from this peer and store them in + * our GDS. Note that PMIx by design holds all data at + * the server level until requested. If our GDS is a + * shared memory region, then the data may be available + * right away - but the client still has to be notified + * of its presence. */ + rc = cb_fn(cbdata, (struct pmix_namespace_t *)ns, cbs, &bo2); + if (PMIX_SUCCESS != rc) { + PMIX_DESTRUCT(&bkt); + goto error; + } + PMIX_BYTE_OBJECT_DESTRUCT(&bo2); + /* get the next blob */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + &bkt, &bo2, &cnt, PMIX_BYTE_OBJECT); + } + PMIX_DESTRUCT(&bkt); + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { + rc = PMIX_SUCCESS; + } else if (PMIX_SUCCESS != rc) { + goto error; + } + /* unpack and process the next blob */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, + buff, &bo, &cnt, PMIX_BYTE_OBJECT); + } + if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { + rc = PMIX_SUCCESS; + } + +error: + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am index ac62d8a9aad..dc799c892f8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2017 Mellanox Technologies, Inc. @@ -24,11 +24,24 @@ # headers = \ - gds_dstore.h + gds_ds12_base.h \ + gds_ds12_lock.h \ + gds_ds12_file.h sources = \ - gds_dstore.c \ - gds_dstore_component.c + gds_ds12_base.c \ + gds_ds12_lock.c \ + gds_ds12_component.c \ + gds_ds12_file.c \ + gds_ds20_file.c + +if HAVE_DSTORE_PTHREAD_LOCK +sources += gds_ds12_lock_pthread.c +else +if HAVE_DSTORE_FCNTL_LOCK +sources += gds_ds12_lock_fcntl.c +endif +endif # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la @@ -49,7 +62,8 @@ endif mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_gds_ds12_la_SOURCES = $(component_sources) -mca_gds_ds12_la_LDFLAGS = -module -avoid-version +mca_gds_ds12_la_LDFLAGS = -module -avoid-version \ + $(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la noinst_LTLIBRARIES = $(lib) libmca_gds_ds12_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c new file mode 100644 index 00000000000..cdfcb252709 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include +#include "src/include/pmix_globals.h" +#include "src/util/error.h" +#include "src/mca/gds/base/base.h" +#include "src/util/argv.h" + +#include "src/mca/common/dstore/dstore_common.h" +#include "gds_ds12_base.h" +#include "gds_ds12_lock.h" +#include "gds_ds12_file.h" +#include "src/mca/common/dstore/dstore_base.h" + +static pmix_common_dstore_ctx_t *ds12_ctx; + +static pmix_status_t ds12_init(pmix_info_t info[], size_t ninfo) +{ + pmix_status_t rc = PMIX_SUCCESS; + pmix_common_dstore_file_cbs_t *dstore_file_cbs = NULL; + + if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + dstore_file_cbs = &pmix_ds20_file_module; + } + ds12_ctx = pmix_common_dstor_init("ds12", info, ninfo, + &pmix_ds12_lock_module, + dstore_file_cbs); + if (NULL == ds12_ctx) { + rc = PMIX_ERR_INIT; + } + + return rc; +} + +static void ds12_finalize(void) +{ + pmix_common_dstor_finalize(ds12_ctx); +} + +static pmix_status_t ds12_assign_module(pmix_info_t *info, size_t ninfo, + int *priority) +{ + size_t n, m; + char **options; + + *priority = 20; + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) { + options = pmix_argv_split(info[n].value.data.string, ','); + for (m=0; NULL != options[m]; m++) { + if (0 == strcmp(options[m], "ds12")) { + /* they specifically asked for us */ + *priority = 100; + break; + } + if (0 == strcmp(options[m], "dstore")) { + /* they are asking for any dstore module - we + * take an intermediate priority in case another + * dstore is more modern than us */ + *priority = 50; + break; + } + } + pmix_argv_free(options); + break; + } + } + } + + return PMIX_SUCCESS; +} + +static pmix_status_t ds12_cache_job_info(struct pmix_namespace_t *ns, + pmix_info_t info[], size_t ninfo) +{ + return PMIX_SUCCESS; +} + +static pmix_status_t ds12_register_job_info(struct pmix_peer_t *pr, + pmix_buffer_t *reply) +{ + if (PMIX_PROC_IS_V1(pr)) { + ds12_ctx->file_cbs = &pmix_ds12_file_module; + } else { + ds12_ctx->file_cbs = &pmix_ds20_file_module; + } + return pmix_common_dstor_register_job_info(ds12_ctx, pr, reply); +} + +static pmix_status_t ds12_store_job_info(const char *nspace, pmix_buffer_t *buf) +{ + return pmix_common_dstor_store_job_info(ds12_ctx, nspace, buf); +} + +static pmix_status_t ds12_store(const pmix_proc_t *proc, + pmix_scope_t scope, + pmix_kval_t *kv) +{ + return pmix_common_dstor_store(ds12_ctx, proc, scope, kv); +} + +/* this function is only called by the PMIx server when its + * host has received data from some other peer. It therefore + * always contains data solely from remote procs, and we + * shall store it accordingly */ +static pmix_status_t ds12_store_modex(struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t *buf) +{ + return pmix_common_dstor_store_modex(ds12_ctx, nspace, cbs, buf); +} + +static pmix_status_t ds12_fetch(const pmix_proc_t *proc, + pmix_scope_t scope, bool copy, + const char *key, + pmix_info_t info[], size_t ninfo, + pmix_list_t *kvs) +{ + return pmix_common_dstor_fetch(ds12_ctx, proc, scope, copy, key, info, ninfo, kvs); +} + +static pmix_status_t ds12_setup_fork(const pmix_proc_t *peer, char ***env) +{ + return pmix_common_dstor_setup_fork(ds12_ctx, PMIX_DSTORE_ESH_BASE_PATH, peer, env); +} + +static pmix_status_t ds12_add_nspace(const char *nspace, + pmix_info_t info[], + size_t ninfo) +{ + return pmix_common_dstor_add_nspace(ds12_ctx, nspace, info, ninfo); +} + +static pmix_status_t ds12_del_nspace(const char* nspace) +{ + return pmix_common_dstor_del_nspace(ds12_ctx, nspace); +} + +pmix_gds_base_module_t pmix_ds12_module = { + .name = "ds12", + .is_tsafe = false, + .init = ds12_init, + .finalize = ds12_finalize, + .assign_module = ds12_assign_module, + .cache_job_info = ds12_cache_job_info, + .register_job_info = ds12_register_job_info, + .store_job_info = ds12_store_job_info, + .store = ds12_store, + .store_modex = ds12_store_modex, + .fetch = ds12_fetch, + .setup_fork = ds12_setup_fork, + .add_nspace = ds12_add_nspace, + .del_nspace = ds12_del_nspace, +}; + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.h new file mode 100644 index 00000000000..d208e2d154f --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef GDS_DSTORE_12_H +#define GDS_DSTORE_12_H + +#include "src/mca/gds/gds.h" + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_gds_base_component_t mca_gds_ds12_component; +extern pmix_gds_base_module_t pmix_ds12_module; + +#endif // GDS_DSTORE_12_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c similarity index 99% rename from opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore_component.c rename to opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c index 35d984e1b90..9f52d4fe996 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c @@ -33,7 +33,7 @@ #include "src/include/pmix_globals.h" #include "src/mca/gds/gds.h" -#include "gds_dstore.h" +#include "gds_ds12_base.h" static pmix_status_t component_open(void); static pmix_status_t component_close(void); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c new file mode 100644 index 00000000000..701578d83a6 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/base/base.h" + +#include "src/mca/common/dstore/dstore_file.h" +#include "gds_ds12_file.h" + +#define ESH_KEY_SIZE_V12(key, size) \ +__pmix_attribute_extension__ ({ \ + size_t len = strlen((char*)key) + 1 + sizeof(size_t) + size; \ + len; \ +}) + +/* in ext slot new offset will be stored in case if + * new data were added for the same process during + * next commit + */ +#define EXT_SLOT_SIZE_V12() \ + (ESH_KEY_SIZE_V12(ESH_REGION_EXTENSION, sizeof(size_t))) + +#define ESH_KV_SIZE_V12(addr) \ +__pmix_attribute_extension__ ({ \ + size_t sz; \ + memcpy(&sz, addr + \ + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)), \ + sizeof(size_t)); \ + sz += ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)) + \ + sizeof(size_t); \ + sz; \ +}) + +#define ESH_KNAME_PTR_V12(addr) \ +__pmix_attribute_extension__ ({ \ + char *name_ptr = (char*)addr; \ + name_ptr; \ +}) + +#define ESH_KNAME_LEN_V12(key) \ +__pmix_attribute_extension__ ({ \ + size_t len = strlen((char*)key) + 1; \ + len; \ +}) + +#define ESH_DATA_PTR_V12(addr) \ +__pmix_attribute_extension__ ({ \ + uint8_t *data_ptr = \ + addr + \ + sizeof(size_t) + \ + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)); \ + data_ptr; \ +}) + +#define ESH_DATA_SIZE_V12(addr) \ +__pmix_attribute_extension__ ({ \ + size_t data_size; \ + memcpy(&data_size, \ + addr + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)), \ + sizeof(size_t)); \ + data_size; \ +}) + +#define ESH_PUT_KEY_V12(addr, key, buffer, size) \ +__pmix_attribute_extension__ ({ \ + size_t sz = size; \ + memset(addr, 0, ESH_KNAME_LEN_V12(key)); \ + strncpy((char *)addr, key, ESH_KNAME_LEN_V12(key)); \ + memcpy(addr + ESH_KNAME_LEN_V12(key), &sz, \ + sizeof(size_t)); \ + memcpy(addr + ESH_KNAME_LEN_V12(key) + sizeof(size_t), \ + buffer, size); \ +}) + +static size_t pmix_ds12_kv_size(uint8_t *addr) +{ + size_t size; + + memcpy(&size, addr + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)), + sizeof(size_t)); + size += ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)) + sizeof(size_t); + return size; +} + +static char* pmix_ds12_key_name_ptr(uint8_t *addr) +{ + return ESH_KNAME_PTR_V12(addr); +} + +static size_t pmix_ds12_key_name_len(char *key) +{ + return ESH_KNAME_LEN_V12(key); +} + +static uint8_t* pmix_ds12_data_ptr(uint8_t *addr) +{ + return ESH_DATA_PTR_V12(addr); +} + +static size_t pmix_ds12_data_size(uint8_t *addr, uint8_t* data_ptr) +{ + return ESH_DATA_SIZE_V12(addr); +} + +static size_t pmix_ds12_key_size(char *addr, size_t data_size) +{ + return ESH_KEY_SIZE_V12(addr, data_size); +} + +static size_t pmix_ds12_ext_slot_size(void) +{ + return EXT_SLOT_SIZE_V12(); +} + +static int pmix_ds12_put_key(uint8_t *addr, char *key, void *buf, size_t size) +{ + ESH_PUT_KEY_V12(addr, key, buf, size); + return PMIX_SUCCESS; +} + +static bool pmix_ds12_is_invalid(uint8_t *addr) +{ + bool ret = (0 == strncmp(ESH_REGION_INVALIDATED, ESH_KNAME_PTR_V12(addr), + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)))); + return ret; +} + +static void pmix_ds12_set_invalid(uint8_t *addr) +{ + strncpy(ESH_KNAME_PTR_V12(addr), ESH_REGION_INVALIDATED, + ESH_KNAME_LEN_V12(ESH_REGION_INVALIDATED)); +} + +static bool pmix_ds12_is_ext_slot(uint8_t *addr) +{ + bool ret; + ret = (0 == strncmp(ESH_REGION_EXTENSION, ESH_KNAME_PTR_V12(addr), + ESH_KNAME_LEN_V12(ESH_KNAME_PTR_V12(addr)))); + return ret; +} + +static bool pmix_ds12_kname_match(uint8_t *addr, const char *key, size_t key_hash) +{ + bool ret = 0; + + ret = (0 == strncmp(ESH_KNAME_PTR_V12(addr), + key, ESH_KNAME_LEN_V12(key))); + return ret; +} + +pmix_common_dstore_file_cbs_t pmix_ds12_file_module = { + .name = "ds12", + .kval_size = pmix_ds12_kv_size, + .kname_ptr = pmix_ds12_key_name_ptr, + .kname_len = pmix_ds12_key_name_len, + .data_ptr = pmix_ds12_data_ptr, + .data_size = pmix_ds12_data_size, + .key_size = pmix_ds12_key_size, + .ext_slot_size = pmix_ds12_ext_slot_size, + .put_key = pmix_ds12_put_key, + .is_invalid = pmix_ds12_is_invalid, + .is_extslot = pmix_ds12_is_ext_slot, + .set_invalid = pmix_ds12_set_invalid, + .key_hash = NULL, + .key_match = pmix_ds12_kname_match +}; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h new file mode 100644 index 00000000000..33c8864743d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_file.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef GDS_DS12_FILE_H +#define GDS_DS12_FILE_H + +#include +#include + +extern pmix_common_dstore_file_cbs_t pmix_ds12_file_module; +extern pmix_common_dstore_file_cbs_t pmix_ds20_file_module; + +#endif // GDS_DS12_FILE_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c new file mode 100644 index 00000000000..9872dd7c4d1 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include + +#include "src/mca/common/dstore/dstore_common.h" + +#include "gds_ds12_lock.h" + +pmix_common_lock_callbacks_t pmix_ds12_lock_module = { + .init = pmix_gds_ds12_lock_init, + .finalize = pmix_ds12_lock_finalize, + .rd_lock = pmix_ds12_lock_rd_get, + .rd_unlock = pmix_ds12_lock_rw_rel, + .wr_lock = pmix_ds12_lock_wr_get, + .wr_unlock = pmix_ds12_lock_rw_rel +}; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h new file mode 100644 index 00000000000..9d9b91ad1ee --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef DS12_LOCK_H +#define DS12_LOCK_H + +#include +#include + +#include "src/mca/common/dstore/dstore_common.h" + +pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *lock_ctx, + const char *base_path, const char *name, + uint32_t local_size, uid_t uid, bool setuid); +void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx); +pmix_status_t pmix_ds12_lock_rd_get(pmix_common_dstor_lock_ctx_t lock_ctx); +pmix_status_t pmix_ds12_lock_wr_get(pmix_common_dstor_lock_ctx_t lock_ctx); +pmix_status_t pmix_ds12_lock_rw_rel(pmix_common_dstor_lock_ctx_t lock_ctx); + +extern pmix_common_lock_callbacks_t pmix_ds12_lock_module; + +#endif // DS12_LOCK_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c new file mode 100644 index 00000000000..477e91465fb --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif + +#include + +#include "src/mca/common/dstore/dstore_common.h" +#include "src/mca/gds/base/base.h" + +#include "src/util/error.h" +#include "src/util/output.h" + +#include "gds_ds12_lock.h" + +#define _ESH_12_FCNTL_LOCK(lockfd, operation) \ +__pmix_attribute_extension__ ({ \ + pmix_status_t ret = PMIX_SUCCESS; \ + int i; \ + struct flock fl = {0}; \ + fl.l_type = operation; \ + fl.l_whence = SEEK_SET; \ + for(i = 0; i < 10; i++) { \ + if( 0 > fcntl(lockfd, F_SETLKW, &fl) ) { \ + switch( errno ){ \ + case EINTR: \ + continue; \ + case ENOENT: \ + case EINVAL: \ + ret = PMIX_ERR_NOT_FOUND; \ + break; \ + case EBADF: \ + ret = PMIX_ERR_BAD_PARAM; \ + break; \ + case EDEADLK: \ + case EFAULT: \ + case ENOLCK: \ + ret = PMIX_ERR_RESOURCE_BUSY; \ + break; \ + default: \ + ret = PMIX_ERROR; \ + break; \ + } \ + } \ + break; \ + } \ + if (ret) { \ + pmix_output(0, "%s %d:%s lock failed: %s", \ + __FILE__, __LINE__, __func__, strerror(errno)); \ + } \ + ret; \ +}) + +typedef struct { + char *lockfile; + int lockfd; +} ds12_lock_fcntl_ctx_t; + +pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const char *base_path, + const char *name, uint32_t local_size, uid_t uid, bool setuid) +{ + pmix_status_t rc = PMIX_SUCCESS; + ds12_lock_fcntl_ctx_t *lock_ctx; + + if (*ctx != NULL) { + return PMIX_SUCCESS; + } + + lock_ctx = (ds12_lock_fcntl_ctx_t*)malloc(sizeof(ds12_lock_fcntl_ctx_t)); + if (NULL == lock_ctx) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + *ctx = lock_ctx; + memset(lock_ctx, 0, sizeof(ds12_lock_fcntl_ctx_t)); + lock_ctx->lockfd = -1; + + /* create a lock file to prevent clients from reading while server is writing + * to the shared memory. This situation is quite often, especially in case of + * direct modex when clients might ask for data simultaneously. */ + if(0 > asprintf(&lock_ctx->lockfile, "%s/dstore_sm.lock", base_path)) { + rc = PMIX_ERR_OUT_OF_RESOURCE; + PMIX_ERROR_LOG(rc); + goto error; + } + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, lock_ctx->lockfile)); + + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + lock_ctx->lockfd = open(lock_ctx->lockfile, O_CREAT | O_RDWR | O_EXCL, 0600); + + /* if previous launch was crashed, the lockfile might not be deleted and unlocked, + * so we delete it and create a new one. */ + if (lock_ctx->lockfd < 0) { + unlink(lock_ctx->lockfile); + lock_ctx->lockfd = open(lock_ctx->lockfile, O_CREAT | O_RDWR, 0600); + if (lock_ctx->lockfd < 0) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + } + if (0 != setuid) { + if (0 > chown(lock_ctx->lockfile, uid, (gid_t) -1)) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + if (0 > chmod(lock_ctx->lockfile, S_IRUSR | S_IWGRP | S_IRGRP)) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + } + } + else { + lock_ctx->lockfd = open(lock_ctx->lockfile, O_RDONLY); + if (0 > lock_ctx->lockfd) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + } + + return rc; + +error: + if (NULL != lock_ctx) { + if (NULL != lock_ctx->lockfile) { + free(lock_ctx->lockfile); + } + if (0 > lock_ctx->lockfd) { + close(lock_ctx->lockfd); + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + unlink(lock_ctx->lockfile); + } + } + free(lock_ctx); + lock_ctx = NULL; + } + *ctx = NULL; + + return rc; +} + +void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx) +{ + ds12_lock_fcntl_ctx_t *fcntl_lock = (ds12_lock_fcntl_ctx_t*)*lock_ctx; + + if (NULL == fcntl_lock) { + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + return; + } + + close(fcntl_lock->lockfd); + + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + unlink(fcntl_lock->lockfile); + } + free(fcntl_lock); + *lock_ctx = NULL; +} + +pmix_status_t pmix_ds12_lock_rd_get(pmix_common_dstor_lock_ctx_t lock_ctx) +{ ds12_lock_fcntl_ctx_t *fcntl_lock = (ds12_lock_fcntl_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == fcntl_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_FCNTL_LOCK(fcntl_lock->lockfd, F_RDLCK); + + return rc; + +} + +pmix_status_t pmix_ds12_lock_wr_get(pmix_common_dstor_lock_ctx_t lock_ctx) +{ ds12_lock_fcntl_ctx_t *fcntl_lock = (ds12_lock_fcntl_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == fcntl_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_FCNTL_LOCK(fcntl_lock->lockfd, F_WRLCK); + + return rc; + +} + +pmix_status_t pmix_ds12_lock_rw_rel(pmix_common_dstor_lock_ctx_t lock_ctx) +{ ds12_lock_fcntl_ctx_t *fcntl_lock = (ds12_lock_fcntl_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == fcntl_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_FCNTL_LOCK(fcntl_lock->lockfd, F_UNLCK); + + return rc; + +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c new file mode 100644 index 00000000000..163015856eb --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c @@ -0,0 +1,274 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#include + +#include "src/mca/common/dstore/dstore_common.h" +#include "src/mca/gds/base/base.h" +#include "src/mca/pshmem/pshmem.h" + +#include "src/util/error.h" +#include "src/util/output.h" + +#include "gds_ds12_lock.h" +#include "src/mca/common/dstore/dstore_segment.h" + +#define _ESH_12_PTHREAD_LOCK(rwlock, func) \ +__pmix_attribute_extension__ ({ \ + pmix_status_t ret = PMIX_SUCCESS; \ + int rc; \ + rc = pthread_rwlock_##func(rwlock); \ + if (0 != rc) { \ + switch (errno) { \ + case EINVAL: \ + ret = PMIX_ERR_INIT; \ + break; \ + case EPERM: \ + ret = PMIX_ERR_NO_PERMISSIONS; \ + break; \ + } \ + } \ + if (ret) { \ + pmix_output(0, "%s %d:%s lock failed: %s", \ + __FILE__, __LINE__, __func__, strerror(errno)); \ + } \ + ret; \ +}) + +typedef struct { + char *lockfile; + pmix_pshmem_seg_t *segment; + pthread_rwlock_t *rwlock; +} ds12_lock_pthread_ctx_t; + +pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const char *base_path, + const char * name, uint32_t local_size, uid_t uid, bool setuid) +{ + size_t size = pmix_common_dstor_getpagesize(); + pmix_status_t rc = PMIX_SUCCESS; + pthread_rwlockattr_t attr; + ds12_lock_pthread_ctx_t *lock_ctx = (ds12_lock_pthread_ctx_t*)ctx; + + if (*ctx != NULL) { + return PMIX_SUCCESS; + } + + lock_ctx = (ds12_lock_pthread_ctx_t*)malloc(sizeof(ds12_lock_pthread_ctx_t)); + if (NULL == lock_ctx) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + memset(lock_ctx, 0, sizeof(ds12_lock_pthread_ctx_t)); + *ctx = (pmix_common_dstor_lock_ctx_t*)lock_ctx; + + lock_ctx->segment = (pmix_pshmem_seg_t *)malloc(sizeof(pmix_pshmem_seg_t)); + if (NULL == lock_ctx->segment) { + rc = PMIX_ERR_OUT_OF_RESOURCE; + PMIX_ERROR_LOG(rc); + goto error; + } + + /* create a lock file to prevent clients from reading while server is writing + * to the shared memory. This situation is quite often, especially in case of + * direct modex when clients might ask for data simultaneously. */ + if(0 > asprintf(&lock_ctx->lockfile, "%s/dstore_sm.lock", base_path)) { + rc = PMIX_ERR_OUT_OF_RESOURCE; + PMIX_ERROR_LOG(rc); + goto error; + } + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, lock_ctx->lockfile)); + + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_create(lock_ctx->segment, + lock_ctx->lockfile, size))) { + PMIX_ERROR_LOG(rc); + goto error; + } + memset(lock_ctx->segment->seg_base_addr, 0, size); + if (0 != setuid) { + if (0 > chown(lock_ctx->lockfile, (uid_t) uid, (gid_t) -1)){ + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + /* set the mode as required */ + if (0 > chmod(lock_ctx->lockfile, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP )) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + } + lock_ctx->rwlock = (pthread_rwlock_t *)lock_ctx->segment->seg_base_addr; + + if (0 != pthread_rwlockattr_init(&attr)) { + rc = PMIX_ERROR; + PMIX_ERROR_LOG(rc); + goto error; + } + if (0 != pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) { + pthread_rwlockattr_destroy(&attr); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } +#ifdef HAVE_PTHREAD_SETKIND + if (0 != pthread_rwlockattr_setkind_np(&attr, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) { + pthread_rwlockattr_destroy(&attr); + PMIX_ERROR_LOG(PMIX_ERR_INIT); + goto error; + } +#endif + if (0 != pthread_rwlock_init(lock_ctx->rwlock, &attr)) { + pthread_rwlockattr_destroy(&attr); + PMIX_ERROR_LOG(PMIX_ERR_INIT); + goto error; + } + if (0 != pthread_rwlockattr_destroy(&attr)) { + PMIX_ERROR_LOG(PMIX_ERR_INIT); + goto error; + } + + } + else { + lock_ctx->segment->seg_size = size; + snprintf(lock_ctx->segment->seg_name, PMIX_PATH_MAX, "%s", lock_ctx->lockfile); + if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_attach(lock_ctx->segment, + PMIX_PSHMEM_RW))) { + PMIX_ERROR_LOG(rc); + goto error; + } + lock_ctx->rwlock = (pthread_rwlock_t *)lock_ctx->segment->seg_base_addr; + } + + return PMIX_SUCCESS; + +error: + if (NULL != lock_ctx) { + if (lock_ctx->segment) { + /* detach & unlink from current desc */ + if (lock_ctx->segment->seg_cpid == getpid()) { + pmix_pshmem.segment_unlink(lock_ctx->segment); + } + pmix_pshmem.segment_detach(lock_ctx->segment); + lock_ctx->rwlock = NULL; + } + if (NULL != lock_ctx->lockfile) { + free(lock_ctx->lockfile); + } + free(lock_ctx); + *ctx = (pmix_common_dstor_lock_ctx_t*)NULL; + } + + return rc; +} + +void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx) +{ + ds12_lock_pthread_ctx_t *pthread_lock = + (ds12_lock_pthread_ctx_t*)*lock_ctx; + + if (NULL == pthread_lock) { + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + return; + } + if (0 != pthread_rwlock_destroy(pthread_lock->rwlock)) { + PMIX_ERROR_LOG(PMIX_ERROR); + return; + } + + if (NULL == pthread_lock->segment) { + PMIX_ERROR_LOG(PMIX_ERROR); + return; + } + if (NULL == pthread_lock->lockfile) { + PMIX_ERROR_LOG(PMIX_ERROR); + return; + } + + /* detach & unlink from current desc */ + if (pthread_lock->segment->seg_cpid == getpid()) { + pmix_pshmem.segment_unlink(pthread_lock->segment); + } + pmix_pshmem.segment_detach(pthread_lock->segment); + + free(pthread_lock->segment); + pthread_lock->segment = NULL; + free(pthread_lock->lockfile); + pthread_lock->lockfile = NULL; + pthread_lock->rwlock = NULL; + free(pthread_lock); + *lock_ctx = NULL; +} + +pmix_status_t pmix_ds12_lock_rd_get(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + ds12_lock_pthread_ctx_t *pthread_lock = (ds12_lock_pthread_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == pthread_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_PTHREAD_LOCK(pthread_lock->rwlock, rdlock); + + return rc; +} + +pmix_status_t pmix_ds12_lock_wr_get(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + ds12_lock_pthread_ctx_t *pthread_lock = (ds12_lock_pthread_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == pthread_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_PTHREAD_LOCK(pthread_lock->rwlock, wrlock); + + return rc; +} + +pmix_status_t pmix_ds12_lock_rw_rel(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + ds12_lock_pthread_ctx_t *pthread_lock = (ds12_lock_pthread_ctx_t*)lock_ctx; + pmix_status_t rc; + + if (NULL == pthread_lock) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = _ESH_12_PTHREAD_LOCK(pthread_lock->rwlock, unlock); + + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c new file mode 100644 index 00000000000..d50cb8124c5 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds20_file.c @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/base/base.h" + +#include "src/mca/common/dstore/dstore_file.h" +#include "gds_ds12_file.h" + +#define ESH_KV_SIZE_V20(addr) \ +__pmix_attribute_extension__ ({ \ + size_t sz; \ + memcpy(&sz, addr, sizeof(size_t)); \ + sz; \ +}) + +#define ESH_KNAME_PTR_V20(addr) \ + ((char *)addr + sizeof(size_t)) + +#define ESH_KNAME_LEN_V20(key) \ +__pmix_attribute_extension__ ({ \ + size_t kname_len = strlen(key) + 1; \ + size_t len = (kname_len < ESH_MIN_KEY_LEN) ? \ + ESH_MIN_KEY_LEN : kname_len; \ + len; \ +}) + +#define ESH_DATA_PTR_V20(addr) \ +__pmix_attribute_extension__ ({ \ + size_t kname_len = \ + ESH_KNAME_LEN_V20(ESH_KNAME_PTR_V20(addr)); \ + uint8_t *data_ptr = addr + sizeof(size_t) + kname_len; \ + data_ptr; \ +}) + +#define ESH_DATA_SIZE_V20(addr, data_ptr) \ +__pmix_attribute_extension__ ({ \ + size_t __sz = ESH_KV_SIZE_V20(addr); \ + size_t data_size = __sz - (data_ptr - addr); \ + data_size; \ +}) + +#define ESH_KEY_SIZE_V20(key, size) \ + (sizeof(size_t) + ESH_KNAME_LEN_V20((char*)key) + size) + +/* in ext slot new offset will be stored in case if + * new data were added for the same process during + * next commit + */ +#define EXT_SLOT_SIZE_V20() \ + (ESH_KEY_SIZE_V20(ESH_REGION_EXTENSION, sizeof(size_t))) + + +#define ESH_PUT_KEY_V20(addr, key, buffer, size) \ +__pmix_attribute_extension__ ({ \ + size_t sz = ESH_KEY_SIZE_V20(key, size); \ + memcpy(addr, &sz, sizeof(size_t)); \ + memset(addr + sizeof(size_t), 0, \ + ESH_KNAME_LEN_V20(key)); \ + strncpy((char *)addr + sizeof(size_t), \ + key, ESH_KNAME_LEN_V20(key)); \ + memcpy(addr + sizeof(size_t) + ESH_KNAME_LEN_V20(key), \ + buffer, size); \ +}) + +static size_t pmix_ds20_kv_size(uint8_t *key) +{ + size_t size; + + memcpy(&size, key, sizeof(size_t)); + return size; +} + +static char* pmix_ds20_key_name_ptr(uint8_t *addr) +{ + return ESH_KNAME_PTR_V20(addr); +} + +static size_t pmix_ds20_key_name_len(char *key) +{ + return ESH_KNAME_LEN_V20(key); +} + +static uint8_t* pmix_ds20_data_ptr(uint8_t *addr) +{ + return ESH_DATA_PTR_V20(addr); +} + +static size_t pmix_ds20_data_size(uint8_t *addr, uint8_t* data_ptr) +{ + return ESH_DATA_SIZE_V20(addr, data_ptr); +} + +static size_t pmix_ds20_key_size(char *addr, size_t data_size) +{ + return ESH_KEY_SIZE_V20(addr, data_size); +} + +static size_t pmix_ds20_ext_slot_size(void) +{ + return EXT_SLOT_SIZE_V20(); +} + +static int pmix_ds20_put_key(uint8_t *addr, char *key, void *buf, size_t size) +{ + ESH_PUT_KEY_V20(addr, key, buf, size); + return PMIX_SUCCESS; +} + +static bool pmix_ds20_is_invalid(uint8_t *addr) +{ + bool ret = (0 == strncmp(ESH_REGION_INVALIDATED, ESH_KNAME_PTR_V20(addr), + ESH_KNAME_LEN_V20(ESH_KNAME_PTR_V20(addr)))); + return ret; +} + +static void pmix_ds20_set_invalid(uint8_t *addr) +{ + strncpy(ESH_KNAME_PTR_V20(addr), ESH_REGION_INVALIDATED, + ESH_KNAME_LEN_V20(ESH_REGION_INVALIDATED)); +} + +static bool pmix_ds20_is_ext_slot(uint8_t *addr) +{ + bool ret; + ret = (0 == strncmp(ESH_REGION_EXTENSION, ESH_KNAME_PTR_V20(addr), + ESH_KNAME_LEN_V20(ESH_KNAME_PTR_V20(addr)))); + return ret; +} + +static bool pmix_ds20_kname_match(uint8_t *addr, const char *key, size_t key_hash) +{ + bool ret = 0; + + ret = (0 == strncmp(ESH_KNAME_PTR_V20(addr), + key, ESH_KNAME_LEN_V20(key))); + return ret; +} + + +pmix_common_dstore_file_cbs_t pmix_ds20_file_module = { + .name = "ds20", + .kval_size = pmix_ds20_kv_size, + .kname_ptr = pmix_ds20_key_name_ptr, + .kname_len = pmix_ds20_key_name_len, + .data_ptr = pmix_ds20_data_ptr, + .data_size = pmix_ds20_data_size, + .key_size = pmix_ds20_key_size, + .ext_slot_size = pmix_ds20_ext_slot_size, + .put_key = pmix_ds20_put_key, + .is_invalid = pmix_ds20_is_invalid, + .is_extslot = pmix_ds20_is_ext_slot, + .set_invalid = pmix_ds20_set_invalid, + .key_hash = NULL, + .key_match = pmix_ds20_kname_match +}; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.h deleted file mode 100644 index abd4723ad25..00000000000 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_dstore.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Mellanox Technologies, Inc. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef PMIX_DS12_H -#define PMIX_DS12_H - -#include - - -#include "src/mca/gds/gds.h" -#include "src/mca/pshmem/pshmem.h" - -BEGIN_C_DECLS - -#include -#include "src/class/pmix_value_array.h" - -#define INITIAL_SEG_SIZE 4096 -#define NS_META_SEG_SIZE (1<<22) -#define NS_DATA_SEG_SIZE (1<<22) - -#define PMIX_DSTORE_ESH_BASE_PATH "PMIX_DSTORE_ESH_BASE_PATH" - -#ifdef HAVE_PTHREAD_SHARED -#define ESH_PTHREAD_LOCK -#elif defined HAVE_FCNTL_FLOCK -#define ESH_FCNTL_LOCK -#else -#error No locking mechanism was found -#endif - -/* this structs are used to store information about - * shared segments addresses locally at each process, - * so they are common for different types of segments - * and don't have a specific content (namespace's info, - * rank's meta info, ranks's data). */ - -typedef enum { - INITIAL_SEGMENT, - NS_META_SEGMENT, - NS_DATA_SEGMENT -} segment_type; - -typedef struct seg_desc_t seg_desc_t; -struct seg_desc_t { - segment_type type; - pmix_pshmem_seg_t seg_info; - uint32_t id; - seg_desc_t *next; -}; - -typedef struct ns_map_data_s ns_map_data_t; -typedef struct session_s session_t; -typedef struct ns_map_s ns_map_t; - -struct session_s { - int in_use; - uid_t jobuid; - char setjobuid; - char *nspace_path; - char *lockfile; -#ifdef ESH_PTHREAD_LOCK - pmix_pshmem_seg_t *rwlock_seg; - pthread_rwlock_t *rwlock; -#endif - int lockfd; - seg_desc_t *sm_seg_first; - seg_desc_t *sm_seg_last; -}; - -struct ns_map_data_s { - char name[PMIX_MAX_NSLEN+1]; - size_t tbl_idx; - int track_idx; -}; - -struct ns_map_s { - int in_use; - ns_map_data_t data; -}; - -/* initial segment format: - * size_t num_elems; - * size_t full; //indicate to client that it needs to attach to the next segment - * ns_seg_info_t ns_seg_info[max_ns_num]; - */ - -typedef struct { - ns_map_data_t ns_map; - size_t num_meta_seg;/* read by clients to attach to this number of segments. */ - size_t num_data_seg; -} ns_seg_info_t; - -/* meta segment format: - * size_t num_elems; - * rank_meta_info meta_info[max_meta_elems]; - */ - -typedef struct { - size_t rank; - size_t offset; - size_t count; -} rank_meta_info; - -typedef struct { - pmix_value_array_t super; - ns_map_data_t ns_map; - size_t num_meta_seg; - size_t num_data_seg; - seg_desc_t *meta_seg; - seg_desc_t *data_seg; - bool in_use; -} ns_track_elem_t; - -/* the component must be visible data for the linker to find it */ -PMIX_EXPORT extern pmix_gds_base_component_t mca_gds_ds12_component; -extern pmix_gds_base_module_t pmix_ds12_module; - -END_C_DECLS - -#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am new file mode 100644 index 00000000000..215275754d7 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am @@ -0,0 +1,62 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 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) 2012 Los Alamos National Security, Inc. All rights reserved. +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2018 Mellanox Technologies, Inc. +# All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +headers = \ + gds_ds21_base.h \ + gds_ds21_lock.h \ + gds_ds21_file.h + +sources = \ + gds_ds21_base.c \ + gds_ds21_lock.c \ + gds_ds21_lock_pthread.c \ + gds_ds21_component.c \ + gds_ds21_file.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_gds_ds21_DSO +lib = +lib_sources = +component = mca_gds_ds21.la +component_sources = $(headers) $(sources) +else +lib = libmca_gds_ds21.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_gds_ds21_la_SOURCES = $(component_sources) +mca_gds_ds21_la_LDFLAGS = -module -avoid-version \ + $(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la + +noinst_LTLIBRARIES = $(lib) +libmca_gds_ds21_la_SOURCES = $(lib_sources) +libmca_gds_ds21_la_LDFLAGS = -module -avoid-version diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c new file mode 100644 index 00000000000..a3f32c9c26e --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include +#include "src/include/pmix_globals.h" +#include "src/util/error.h" +#include "src/mca/gds/base/base.h" +#include "src/util/argv.h" + +#include "src/mca/common/dstore/dstore_common.h" +#include "gds_ds21_base.h" +#include "gds_ds21_lock.h" +#include "gds_ds21_file.h" +#include "src/mca/common/dstore/dstore_base.h" + +static pmix_common_dstore_ctx_t *ds21_ctx; + +static pmix_status_t ds21_init(pmix_info_t info[], size_t ninfo) +{ + pmix_status_t rc = PMIX_SUCCESS; + + ds21_ctx = pmix_common_dstor_init("ds21", info, ninfo, + &pmix_ds21_lock_module, + &pmix_ds21_file_module); + if (NULL == ds21_ctx) { + rc = PMIX_ERR_INIT; + } + + return rc; +} + +static void ds21_finalize(void) +{ + pmix_common_dstor_finalize(ds21_ctx); +} + +static pmix_status_t ds21_assign_module(pmix_info_t *info, size_t ninfo, + int *priority) +{ + size_t n, m; + char **options; + + *priority = 20; + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) { + options = pmix_argv_split(info[n].value.data.string, ','); + for (m=0; NULL != options[m]; m++) { + if (0 == strcmp(options[m], "ds21")) { + /* they specifically asked for us */ + *priority = 120; + break; + } + if (0 == strcmp(options[m], "dstore")) { + *priority = 60; + break; + } + } + pmix_argv_free(options); + break; + } + } + } + + return PMIX_SUCCESS; +} + +static pmix_status_t ds21_cache_job_info(struct pmix_namespace_t *ns, + pmix_info_t info[], size_t ninfo) +{ + return PMIX_SUCCESS; +} + +static pmix_status_t ds21_register_job_info(struct pmix_peer_t *pr, + pmix_buffer_t *reply) +{ + return pmix_common_dstor_register_job_info(ds21_ctx, pr, reply); +} + +static pmix_status_t ds21_store_job_info(const char *nspace, pmix_buffer_t *buf) +{ + return pmix_common_dstor_store_job_info(ds21_ctx, nspace, buf); +} + +static pmix_status_t ds21_store(const pmix_proc_t *proc, + pmix_scope_t scope, + pmix_kval_t *kv) +{ + return pmix_common_dstor_store(ds21_ctx, proc, scope, kv); +} + +/* this function is only called by the PMIx server when its + * host has received data from some other peer. It therefore + * always contains data solely from remote procs, and we + * shall store it accordingly */ +static pmix_status_t ds21_store_modex(struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_buffer_t *buf) +{ + return pmix_common_dstor_store_modex(ds21_ctx, nspace, cbs, buf); +} + +static pmix_status_t ds21_fetch(const pmix_proc_t *proc, + pmix_scope_t scope, bool copy, + const char *key, + pmix_info_t info[], size_t ninfo, + pmix_list_t *kvs) +{ + return pmix_common_dstor_fetch(ds21_ctx, proc, scope, copy, key, info, ninfo, kvs); +} + +static pmix_status_t ds21_setup_fork(const pmix_proc_t *peer, char ***env) +{ + pmix_status_t rc; + char *env_name = NULL; + int ds_ver = 0; + + sscanf(ds21_ctx->ds_name, "ds%d", &ds_ver); + if (0 == ds_ver) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + return rc; + } + if (0 > asprintf(&env_name, PMIX_DSTORE_VER_BASE_PATH_FMT, ds_ver)) { + rc = PMIX_ERR_NOMEM; + PMIX_ERROR_LOG(rc); + return rc; + } + rc = pmix_common_dstor_setup_fork(ds21_ctx, env_name, peer, env); + free(env_name); + + return rc; +} + +static pmix_status_t ds21_add_nspace(const char *nspace, + pmix_info_t info[], + size_t ninfo) +{ + return pmix_common_dstor_add_nspace(ds21_ctx, nspace, info, ninfo); +} + +static pmix_status_t ds21_del_nspace(const char* nspace) +{ + return pmix_common_dstor_del_nspace(ds21_ctx, nspace); +} + +pmix_gds_base_module_t pmix_ds21_module = { + .name = "ds21", + .is_tsafe = true, + .init = ds21_init, + .finalize = ds21_finalize, + .assign_module = ds21_assign_module, + .cache_job_info = ds21_cache_job_info, + .register_job_info = ds21_register_job_info, + .store_job_info = ds21_store_job_info, + .store = ds21_store, + .store_modex = ds21_store_modex, + .fetch = ds21_fetch, + .setup_fork = ds21_setup_fork, + .add_nspace = ds21_add_nspace, + .del_nspace = ds21_del_nspace, +}; + diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.h new file mode 100644 index 00000000000..c8fc4d43e54 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_base.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef GDS_DSTORE_21_H +#define GDS_DSTORE_21_H + +#include "src/mca/gds/gds.h" + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_gds_base_component_t mca_gds_ds21_component; +extern pmix_gds_base_module_t pmix_ds21_module; + +#endif // GDS_DSTORE_21_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c new file mode 100644 index 00000000000..c1f42944df8 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c @@ -0,0 +1,93 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2008 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) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * These symbols are in a file by themselves to provide nice linker + * semantics. Since linkers generally pull in symbols by object + * files, keeping these symbols as the only symbols in this file + * prevents utility programs such as "ompi_info" from having to import + * entire components just to query their version and parameters. + */ + +#include +#include "pmix_common.h" + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/gds.h" +#include "gds_ds21_base.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_gds_base_component_t mca_gds_ds21_component = { + .base = { + PMIX_GDS_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "ds21", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .data = { + /* The component is checkpoint ready */ + PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT + } +}; + + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + /* launchers cannot use the dstore */ + if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + *priority = 0; + *module = NULL; + return PMIX_ERROR; + } + + *priority = 30; + *module = (pmix_mca_base_module_t *)&pmix_ds21_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c new file mode 100644 index 00000000000..7a23edd2063 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.c @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include "src/include/pmix_globals.h" +#include "src/mca/gds/base/base.h" + +#include "src/mca/common/dstore/dstore_file.h" +#include "gds_ds21_file.h" + +#if 8 > SIZEOF_SIZE_T +#define ESH_REGION_EXTENSION_FLG 0x80000000 +#define ESH_REGION_INVALIDATED_FLG 0x40000000 +#define ESH_REGION_SIZE_MASK 0x3FFFFFFF +#else +#define ESH_REGION_EXTENSION_FLG 0x8000000000000000 +#define ESH_REGION_INVALIDATED_FLG 0x4000000000000000 +#define ESH_REGION_SIZE_MASK 0x3FFFFFFFFFFFFFFF +#endif + +#define ESH_KV_SIZE_V21(addr) \ +__pmix_attribute_extension__ ({ \ + size_t sz; \ + memcpy(&sz, addr, sizeof(size_t)); \ + /* drop flags in lsb's */ \ + (sz & ESH_REGION_SIZE_MASK); \ +}) + +#define ESH_KNAME_PTR_V21(addr) \ + ((char *)addr + 2 * sizeof(size_t)) + +#define ESH_KNAME_LEN_V21(key) \ + (strlen(key) + 1) + +#define ESH_DATA_PTR_V21(addr) \ +__pmix_attribute_extension__ ({ \ + char *key_ptr = ESH_KNAME_PTR_V21(addr); \ + size_t kname_len = ESH_KNAME_LEN_V21(key_ptr); \ + uint8_t *data_ptr = \ + addr + (key_ptr - (char*)addr) + kname_len; \ + data_ptr; \ +}) + +#define ESH_DATA_SIZE_V21(addr, data_ptr) \ +__pmix_attribute_extension__ ({ \ + size_t sz = ESH_KV_SIZE_V21(addr); \ + size_t data_size = sz - (data_ptr - addr); \ + data_size; \ +}) + +#define ESH_KEY_SIZE_V21(key, size) \ + (2 * sizeof(size_t) + ESH_KNAME_LEN_V21((char*)key) + size) + +/* in ext slot new offset will be stored in case if + * new data were added for the same process during + * next commit + */ +#define EXT_SLOT_SIZE_V21() \ + (ESH_KEY_SIZE_V21("", sizeof(size_t))) + +static bool pmix_ds21_is_invalid(uint8_t *addr) +{ + size_t sz; + memcpy(&sz, addr, sizeof(size_t)); + return !!(sz & ESH_REGION_INVALIDATED_FLG); +} + +static void pmix_ds21_set_invalid(uint8_t *addr) +{ + size_t sz; + memcpy(&sz, addr, sizeof(size_t)); + sz |= ESH_REGION_INVALIDATED_FLG; + memcpy(addr, &sz, sizeof(size_t)); +} + +static bool pmix_ds21_is_ext_slot(uint8_t *addr) +{ + size_t sz; + memcpy(&sz, addr, sizeof(size_t)); + return !!(sz & ESH_REGION_EXTENSION_FLG); +} + +static size_t pmix_ds21_key_hash(const char *key) +{ + size_t hash = 0; + int i; + for(i=0; key[i]; i++) { + hash += key[i]; + } + return hash; +} + +static bool pmix_ds21_kname_match(uint8_t *addr, const char *key, size_t key_hash) +{ + bool ret = 0; + size_t hash; + memcpy(&hash, (char*)addr + sizeof(size_t), sizeof(size_t)); + if( key_hash != hash ) { + return ret; + } + return (0 == strncmp(ESH_KNAME_PTR_V21(addr), key, ESH_KNAME_LEN_V21(key))); +} + +static size_t pmix_ds21_kval_size(uint8_t *key) +{ + return ESH_KV_SIZE_V21(key); ; +} + +static char* pmix_ds21_key_name_ptr(uint8_t *addr) +{ + return ESH_KNAME_PTR_V21(addr); +} + +static size_t pmix_ds21_key_name_len(char *key) +{ + return ESH_KNAME_LEN_V21(key); +} + +static uint8_t* pmix_ds21_data_ptr(uint8_t *addr) +{ + return ESH_DATA_PTR_V21(addr); +} + +static size_t pmix_ds21_data_size(uint8_t *addr, uint8_t* data_ptr) +{ + return ESH_DATA_SIZE_V21(addr, data_ptr); +} + +static size_t pmix_ds21_key_size(char *addr, size_t data_size) +{ + return ESH_KEY_SIZE_V21(addr, data_size); +} + +static size_t pmix_ds21_ext_slot_size(void) +{ + return EXT_SLOT_SIZE_V21(); +} + +static int pmix_ds21_put_key(uint8_t *addr, char *key, + void* buffer, size_t size) +{ + size_t flag = 0; + size_t hash = 0; + char *addr_ch = (char*)addr; + if( !strcmp(key, ESH_REGION_EXTENSION) ) { + /* we have a flag for this special key */ + key = ""; + flag |= ESH_REGION_EXTENSION_FLG; + } + size_t sz = ESH_KEY_SIZE_V21(key, size); + if( ESH_REGION_SIZE_MASK < sz ) { + return PMIX_ERROR; + } + sz |= flag; + memcpy(addr_ch, &sz, sizeof(size_t)); + hash = pmix_ds21_key_hash(key); + memcpy(addr_ch + sizeof(size_t), &hash, sizeof(size_t)); + strncpy(addr_ch + 2 * sizeof(size_t), key, ESH_KNAME_LEN_V21(key)); + memcpy(ESH_DATA_PTR_V21(addr), buffer, size); + return PMIX_SUCCESS; +} + +pmix_common_dstore_file_cbs_t pmix_ds21_file_module = { + .name = "ds21", + .kval_size = pmix_ds21_kval_size, + .kname_ptr = pmix_ds21_key_name_ptr, + .kname_len = pmix_ds21_key_name_len, + .data_ptr = pmix_ds21_data_ptr, + .data_size = pmix_ds21_data_size, + .key_size = pmix_ds21_key_size, + .ext_slot_size = pmix_ds21_ext_slot_size, + .put_key = pmix_ds21_put_key, + .is_invalid = pmix_ds21_is_invalid, + .is_extslot = pmix_ds21_is_ext_slot, + .set_invalid = pmix_ds21_set_invalid, + .key_hash = pmix_ds21_key_hash, + .key_match = pmix_ds21_kname_match +}; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h new file mode 100644 index 00000000000..ea75788ffe8 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_file.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef GDS_DS21_FILE_H +#define GDS_DS21_FILE_H + +#include +#include + +extern pmix_common_dstore_file_cbs_t pmix_ds21_file_module; + +#endif // GDS_DS21_FILE_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c new file mode 100644 index 00000000000..340343d8c8e --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include + +#include "src/mca/common/dstore/dstore_common.h" + +#include "gds_ds21_lock.h" + +pmix_common_lock_callbacks_t pmix_ds21_lock_module = { + .init = pmix_gds_ds21_lock_init, + .finalize = pmix_ds21_lock_finalize, + .rd_lock = pmix_ds21_lock_rd_get, + .rd_unlock = pmix_ds21_lock_rd_rel, + .wr_lock = pmix_ds21_lock_wr_get, + .wr_unlock = pmix_ds21_lock_wr_rel +}; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h new file mode 100644 index 00000000000..158e7cbf5ab --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef DS21_LOCK_H +#define DS21_LOCK_H + +#include +#include + +#include "src/mca/common/dstore/dstore_common.h" + +pmix_status_t pmix_gds_ds21_lock_init(pmix_common_dstor_lock_ctx_t *lock_ctx, + const char *base_path, const char *name, + uint32_t local_size, uid_t uid, bool setuid); +void pmix_ds21_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx); +pmix_status_t pmix_ds21_lock_rd_get(pmix_common_dstor_lock_ctx_t lock_ctx); +pmix_status_t pmix_ds21_lock_wr_get(pmix_common_dstor_lock_ctx_t lock_ctx); +pmix_status_t pmix_ds21_lock_rd_rel(pmix_common_dstor_lock_ctx_t lock_ctx); +pmix_status_t pmix_ds21_lock_wr_rel(pmix_common_dstor_lock_ctx_t lock_ctx); + +extern pmix_common_lock_callbacks_t pmix_ds21_lock_module; + +#endif // DS21_LOCK_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c new file mode 100644 index 00000000000..5e8b7be92b0 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c @@ -0,0 +1,438 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * + * Copyright (c) 2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include + +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#include "src/mca/common/dstore/dstore_common.h" +#include "src/mca/gds/base/base.h" +#include "src/mca/pshmem/pshmem.h" +#include "src/class/pmix_list.h" + +#include "src/util/error.h" +#include "src/util/output.h" + +#include "gds_ds21_lock.h" +#include "src/mca/common/dstore/dstore_segment.h" + +typedef struct { + pmix_list_item_t super; + + char *lockfile; + pmix_dstore_seg_desc_t *seg_desc; + pthread_mutex_t *mutex; + uint32_t num_locks; + uint32_t lock_idx; +} lock_item_t; + +typedef struct { + pmix_list_t lock_traker; +} lock_ctx_t; + +typedef pmix_list_t ds21_lock_pthread_ctx_t; + +/* + * Lock segment format: + * 1. Segment size sizeof(size_t) + * 2. local_size: sizeof(uint32_t) + * 3. Align size sizeof(size_t) + * 4. Offset of mutexes sizeof(size_t) + * 5. Array of in use indexes: sizeof(int32_t)*local_size + * 6. Double array of locks: sizeof(pthread_mutex_t)*local_size*2 + */ +typedef struct { + size_t seg_size; + uint32_t num_locks; + size_t align_size; + size_t mutex_offs; +} segment_hdr_t; + +#define _GET_IDX_ARR_PTR(seg_ptr) \ + ((pmix_atomic_int32_t*)((char*)seg_ptr + sizeof(segment_hdr_t))) + +#define _GET_MUTEX_ARR_PTR(seg_hdr) \ + ((pthread_mutex_t*)((char*)seg_hdr + seg_hdr->mutex_offs)) + +#define _GET_MUTEX_PTR(seg_hdr, idx) \ + ((pthread_mutex_t*)((char*)seg_hdr + seg_hdr->mutex_offs + seg_hdr->align_size * (idx))) + + +static void ncon(lock_item_t *p) { + p->lockfile = NULL; + p->lock_idx = 0; + p->mutex = NULL; + p->num_locks = 0; + p->seg_desc = NULL; +} + +static void ldes(lock_item_t *p) { + uint32_t i; + + if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + segment_hdr_t *seg_hdr = (segment_hdr_t *)p->seg_desc->seg_info.seg_base_addr; + if (p->lockfile) { + unlink(p->lockfile); + } + for(i = 0; i < p->num_locks * 2; i++) { + pthread_mutex_t *mutex = _GET_MUTEX_PTR(seg_hdr, i); + if (0 != pthread_mutex_destroy(mutex)) { + PMIX_ERROR_LOG(PMIX_ERROR); + } + } + } + if (p->lockfile) { + free(p->lockfile); + } + if (p->seg_desc) { + pmix_common_dstor_delete_sm_desc(p->seg_desc); + } +} + +PMIX_CLASS_INSTANCE(lock_item_t, + pmix_list_item_t, + ncon, ldes); + +pmix_status_t pmix_gds_ds21_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const char *base_path, const char * name, + uint32_t local_size, uid_t uid, bool setuid) +{ + pthread_mutexattr_t attr; + size_t size; + uint32_t i; + int page_size = pmix_common_dstor_getpagesize(); + segment_hdr_t *seg_hdr; + lock_item_t *lock_item = NULL; + lock_ctx_t *lock_ctx = (lock_ctx_t*)*ctx; + pmix_list_t *lock_tracker; + pmix_status_t rc = PMIX_SUCCESS; + + if (NULL == *ctx) { + lock_ctx = (lock_ctx_t*)malloc(sizeof(lock_ctx_t)); + if (NULL == lock_ctx) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + memset(lock_ctx, 0, sizeof(lock_ctx_t)); + PMIX_CONSTRUCT(&lock_ctx->lock_traker, pmix_list_t); + *ctx = lock_ctx; + } + + lock_tracker = &lock_ctx->lock_traker; + lock_item = PMIX_NEW(lock_item_t); + + if (NULL == lock_item) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + pmix_list_append(lock_tracker, &lock_item->super); + + PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, + "%s:%d:%s local_size %d", __FILE__, __LINE__, __func__, local_size)); + + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + size_t seg_align_size; + size_t seg_hdr_size; + + if (0 != (seg_align_size = pmix_common_dstor_getcacheblocksize())) { + seg_align_size = (sizeof(pthread_mutex_t) / seg_align_size + 1) + * seg_align_size; + } else { + seg_align_size = sizeof(pthread_mutex_t); + } + + seg_hdr_size = ((sizeof(segment_hdr_t) + + sizeof(int32_t) * local_size) + / seg_align_size + 1) * seg_align_size; + + size = ((seg_hdr_size + + 2 * local_size * seg_align_size) /* array of mutexes */ + / page_size + 1) * page_size; + + lock_item->seg_desc = pmix_common_dstor_create_new_lock_seg(base_path, + size, name, 0, uid, setuid); + if (NULL == lock_item->seg_desc) { + rc = PMIX_ERR_OUT_OF_RESOURCE; + PMIX_ERROR_LOG(rc); + goto error; + } + + if (0 != pthread_mutexattr_init(&attr)) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + if (0 != pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED)) { + pthread_mutexattr_destroy(&attr); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + + segment_hdr_t *seg_hdr = (segment_hdr_t*)lock_item->seg_desc->seg_info.seg_base_addr; + seg_hdr->num_locks = local_size; + seg_hdr->seg_size = size; + seg_hdr->align_size = seg_align_size; + seg_hdr->mutex_offs = seg_hdr_size; + + lock_item->lockfile = strdup(lock_item->seg_desc->seg_info.seg_name); + lock_item->num_locks = local_size; + lock_item->mutex = _GET_MUTEX_ARR_PTR(seg_hdr); + + for(i = 0; i < local_size * 2; i++) { + pthread_mutex_t *mutex = _GET_MUTEX_PTR(seg_hdr, i); + if (0 != pthread_mutex_init(mutex, &attr)) { + pthread_mutexattr_destroy(&attr); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); + goto error; + } + } + if (0 != pthread_mutexattr_destroy(&attr)) { + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(PMIX_ERR_INIT); + goto error; + } + } + else { + pmix_atomic_int32_t *lock_idx_ptr; + bool idx_found = false; + + size = pmix_common_dstor_getpagesize(); + lock_item->seg_desc = pmix_common_dstor_attach_new_lock_seg(base_path, size, name, 0); + if (NULL == lock_item->seg_desc) { + rc = PMIX_ERR_NOT_FOUND; + goto error; + } + seg_hdr = (segment_hdr_t*)lock_item->seg_desc->seg_info.seg_base_addr; + + if (seg_hdr->seg_size > size) { + size = seg_hdr->seg_size; + pmix_common_dstor_delete_sm_desc(lock_item->seg_desc); + lock_item->seg_desc = pmix_common_dstor_attach_new_lock_seg(base_path, size, name, 0); + if (NULL == lock_item->seg_desc) { + rc = PMIX_ERR_NOT_FOUND; + goto error; + } + } + + lock_item->num_locks = seg_hdr->num_locks; + lock_idx_ptr = _GET_IDX_ARR_PTR(seg_hdr); + lock_item->mutex = _GET_MUTEX_ARR_PTR(seg_hdr); + + for (i = 0; i < lock_item->num_locks; i++) { + int32_t expected = 0; + if (pmix_atomic_compare_exchange_strong_32(&lock_idx_ptr[i], &expected, 1)) { + lock_item->lock_idx = i; + lock_item->lockfile = strdup(lock_item->seg_desc->seg_info.seg_name); + idx_found = true; + break; + } + } + + if (false == idx_found) { + rc = PMIX_ERR_NOT_FOUND; + goto error; + } + } + + return rc; + +error: + if (NULL != lock_item) { + pmix_list_remove_item(lock_tracker, &lock_item->super); + PMIX_RELEASE(lock_item); + lock_item = NULL; + } + *ctx = NULL; + + return rc; +} + +void pmix_ds21_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx) +{ + lock_item_t *lock_item, *item_next; + pmix_list_t *lock_tracker = &((lock_ctx_t*)*lock_ctx)->lock_traker; + + if (NULL == lock_tracker) { + return; + } + + PMIX_LIST_FOREACH_SAFE(lock_item, item_next, lock_tracker, lock_item_t) { + pmix_list_remove_item(lock_tracker, &lock_item->super); + PMIX_RELEASE(lock_item); + } + if (pmix_list_is_empty(lock_tracker)) { + PMIX_LIST_DESTRUCT(lock_tracker); + free(lock_tracker); + lock_tracker = NULL; + } + *lock_ctx = NULL; +} + +pmix_status_t pmix_ds21_lock_wr_get(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + lock_item_t *lock_item; + pmix_list_t *lock_tracker = &((lock_ctx_t*)lock_ctx)->lock_traker; + uint32_t num_locks; + uint32_t i; + pmix_status_t rc; + segment_hdr_t *seg_hdr; + + if (NULL == lock_tracker) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + return rc; + } + + PMIX_LIST_FOREACH(lock_item, lock_tracker, lock_item_t) { + num_locks = lock_item->num_locks; + seg_hdr = (segment_hdr_t *)lock_item->seg_desc->seg_info.seg_base_addr; + + /* Lock the "signalling" lock first to let clients know that + * server is going to get a write lock. + * Clients do not hold this lock for a long time, + * so this loop should be relatively dast. + */ + for (i = 0; i < num_locks; i++) { + pthread_mutex_t *mutex = _GET_MUTEX_PTR(seg_hdr, 2*i); + if (0 != pthread_mutex_lock(mutex)) { + return PMIX_ERROR; + } + } + + /* Now we can go and grab the main locks + * New clients will be stopped at the previous + * "barrier" locks. + * We will wait here while all clients currently holding + * locks will be done + */ + for(i = 0; i < num_locks; i++) { + pthread_mutex_t *mutex = _GET_MUTEX_PTR(seg_hdr, 2*i + 1); + if (0 != pthread_mutex_lock(mutex)) { + return PMIX_ERROR; + } + } + } + return PMIX_SUCCESS; +} + +pmix_status_t pmix_ds21_lock_wr_rel(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + lock_item_t *lock_item; + pmix_list_t *lock_tracker = &((lock_ctx_t*)lock_ctx)->lock_traker; + uint32_t num_locks; + uint32_t i; + pmix_status_t rc; + segment_hdr_t *seg_hdr; + + if (NULL == lock_tracker) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + + PMIX_LIST_FOREACH(lock_item, lock_tracker, lock_item_t) { + seg_hdr = (segment_hdr_t *)lock_item->seg_desc->seg_info.seg_base_addr; + num_locks = lock_item->num_locks; + + /* Lock the second lock first to ensure that all procs will see + * that we are trying to grab the main one */ + for(i=0; ilock_traker; + uint32_t idx; + pmix_status_t rc; + segment_hdr_t *seg_hdr; + + if (NULL == lock_tracker) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + + lock_item = (lock_item_t*)pmix_list_get_first(lock_tracker); + idx = lock_item->lock_idx; + seg_hdr = (segment_hdr_t *)lock_item->seg_desc->seg_info.seg_base_addr; + + /* This mutex is only used to acquire the next one, + * this is a barrier that server is using to let clients + * know that it is going to grab the write lock + */ + + if (0 != pthread_mutex_lock(_GET_MUTEX_PTR(seg_hdr, 2*idx))) { + return PMIX_ERROR; + } + + /* Now grab the main lock */ + if (0 != pthread_mutex_lock(_GET_MUTEX_PTR(seg_hdr, 2*idx + 1))) { + return PMIX_ERROR; + } + + /* Once done - release signalling lock */ + if (0 != pthread_mutex_unlock(_GET_MUTEX_PTR(seg_hdr, 2*idx))) { + return PMIX_ERROR; + } + + return PMIX_SUCCESS; +} + +pmix_status_t pmix_ds21_lock_rd_rel(pmix_common_dstor_lock_ctx_t lock_ctx) +{ + lock_item_t *lock_item; + pmix_list_t *lock_tracker = &((lock_ctx_t*)lock_ctx)->lock_traker; + pmix_status_t rc; + uint32_t idx; + segment_hdr_t *seg_hdr; + + if (NULL == lock_tracker) { + rc = PMIX_ERR_NOT_FOUND; + PMIX_ERROR_LOG(rc); + return rc; + } + + lock_item = (lock_item_t*)pmix_list_get_first(lock_tracker); + seg_hdr = (segment_hdr_t *)lock_item->seg_desc->seg_info.seg_base_addr; + idx = lock_item->lock_idx; + + /* Release the main lock */ + if (0 != pthread_mutex_unlock(_GET_MUTEX_PTR(seg_hdr, 2*idx + 1))) { + return PMIX_SUCCESS; + } + + return PMIX_SUCCESS; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h index 9d90dbc565d..9ced4788aa7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/gds.h @@ -1,8 +1,9 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2016-2017 Mellanox Technologies, Inc. + * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +45,7 @@ BEGIN_C_DECLS /* forward declaration */ struct pmix_peer_t; -struct pmix_nspace_t; +struct pmix_namespace_t; /* backdoor to base verbosity */ PMIX_EXPORT extern int pmix_gds_base_output; @@ -117,7 +118,7 @@ typedef pmix_status_t (*pmix_gds_base_module_accept_kvs_resp_fn_t)(pmix_buffer_t * only we don't have packed data on the server side, and don't want * to incur the overhead of packing it just to unpack it in the function. */ -typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_nspace_t *ns, +typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo); /* define a convenience macro for caching job info */ @@ -127,7 +128,7 @@ typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_ns pmix_output_verbose(1, pmix_gds_base_output, \ "[%s:%d] GDS CACHE JOB INFO WITH %s", \ __FILE__, __LINE__, _g->name); \ - (s) = _g->cache_job_info((struct pmix_nspace_t*)(n), (i), (ni)); \ + (s) = _g->cache_job_info((struct pmix_namespace_t*)(n), (i), (ni)); \ } while(0) /* register job-level info - this is provided as a special function @@ -135,7 +136,7 @@ typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_ns * prepare the job-level info provided at PMIx_Register_nspace, because * we don't know the GDS component to use for that application until * a local client contacts us. Thus, the module is required to process - * the job-level info cached in the pmix_nspace_t for this job and + * the job-level info cached in the pmix_namespace_t for this job and * do whatever is necessary to support the client, packing any required * return message into the provided buffer. * @@ -155,7 +156,7 @@ typedef pmix_status_t (*pmix_gds_base_module_cache_job_info_fn_t)(struct pmix_ns * * The pmix_peer_t of the requesting client is provided here so that * the module can access the job-level info cached on the corresponding - * pmix_nspace_t pointed to by the pmix_peer_t + * pmix_namespace_t pointed to by the pmix_peer_t */ typedef pmix_status_t (*pmix_gds_base_module_register_job_info_fn_t)(struct pmix_peer_t *pr, pmix_buffer_t *reply); @@ -241,16 +242,16 @@ typedef pmix_status_t (*pmix_gds_base_module_store_fn_t)(const pmix_proc_t *proc * bo - pointer to the byte object containing the data * */ -typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_nspace_t *ns, +typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_namespace_t *ns, pmix_list_t *cbs, - pmix_byte_object_t *bo); + pmix_buffer_t *buff); /** * define a convenience macro for storing modex byte objects * * r - return status code * - * n - pointer to the pmix_nspace_t this blob is to be stored for + * n - pointer to the pmix_namespace_t this blob is to be stored for * * l - pointer to pmix_list_t containing pmix_server_caddy_t objects * of the local_cbs of the collective tracker @@ -262,7 +263,7 @@ typedef pmix_status_t (*pmix_gds_base_module_store_modex_fn_t)(struct pmix_nspac pmix_output_verbose(1, pmix_gds_base_output, \ "[%s:%d] GDS STORE MODEX WITH %s", \ __FILE__, __LINE__, (n)->compat.gds->name); \ - (r) = (n)->compat.gds->store_modex((struct pmix_nspace_t*)n, l, b); \ + (r) = (n)->compat.gds->store_modex((struct pmix_namespace_t*)n, l, b); \ } while (0) /** @@ -398,12 +399,26 @@ typedef pmix_status_t (*pmix_gds_base_module_del_nspace_fn_t)(const char* nspace } \ } while(0) +/* define a convenience macro for is_tsafe for fetch operation */ +#define PMIX_GDS_FETCH_IS_TSAFE(s, p) \ + do { \ + pmix_gds_base_module_t *_g = (p)->nptr->compat.gds; \ + pmix_output_verbose(1, pmix_gds_base_output, \ + "[%s:%d] GDS FETCH IS THREAD SAFE WITH %s", \ + __FILE__, __LINE__, _g->name); \ + if (true == _g->is_tsafe) { \ + (s) = PMIX_SUCCESS; \ + } else { \ + (s) = PMIX_ERR_NOT_SUPPORTED; \ + } \ +} while(0) /** * structure for gds modules */ typedef struct { const char *name; + const bool is_tsafe; pmix_gds_base_module_init_fn_t init; pmix_gds_base_module_fini_fn_t finalize; pmix_gds_base_assign_module_fn_t assign_module; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index da9608fb3e5..4b02d8faf21 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -1,8 +1,10 @@ /* * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. * * $COPYRIGHT$ * @@ -51,7 +53,7 @@ static void hash_finalize(void); static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, int *priority); -static pmix_status_t hash_cache_job_info(struct pmix_nspace_t *ns, +static pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo); static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, @@ -64,9 +66,14 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, pmix_scope_t scope, pmix_kval_t *kv); -static pmix_status_t hash_store_modex(struct pmix_nspace_t *ns, +static pmix_status_t hash_store_modex(struct pmix_namespace_t *ns, pmix_list_t *cbs, - pmix_byte_object_t *bo); + pmix_buffer_t *buff); + +static pmix_status_t _hash_store_modex(void * cbdata, + struct pmix_namespace_t *ns, + pmix_list_t *cbs, + pmix_byte_object_t *bo); static pmix_status_t hash_fetch(const pmix_proc_t *proc, pmix_scope_t scope, bool copy, @@ -91,6 +98,7 @@ static pmix_status_t accept_kvs_resp(pmix_buffer_t *buf); pmix_gds_base_module_t pmix_hash_module = { .name = "hash", + .is_tsafe = false, .init = hash_init, .finalize = hash_finalize, .assign_module = hash_assign_module, @@ -110,7 +118,7 @@ pmix_gds_base_module_t pmix_hash_module = { typedef struct { pmix_list_item_t super; char *ns; - pmix_nspace_t *nptr; + pmix_namespace_t *nptr; pmix_hash_table_t internal; pmix_hash_table_t remote; pmix_hash_table_t local; @@ -355,10 +363,10 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_SUCCESS; } -pmix_status_t hash_cache_job_info(struct pmix_nspace_t *ns, +pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo) { - pmix_nspace_t *nptr = (pmix_nspace_t*)ns; + pmix_namespace_t *nptr = (pmix_namespace_t*)ns; pmix_hash_trkr_t *trk, *t; pmix_hash_table_t *ht; pmix_kval_t *kp2, *kvptr; @@ -580,7 +588,7 @@ pmix_status_t hash_cache_job_info(struct pmix_nspace_t *ns, } static pmix_status_t register_info(pmix_peer_t *peer, - pmix_nspace_t *ns, + pmix_namespace_t *ns, pmix_buffer_t *reply) { pmix_hash_trkr_t *trk, *t; @@ -672,13 +680,13 @@ static pmix_status_t register_info(pmix_peer_t *peer, } /* the purpose of this function is to pack the job-level - * info stored in the pmix_nspace_t into a buffer and send + * info stored in the pmix_namespace_t into a buffer and send * it to the given client */ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, pmix_buffer_t *reply) { pmix_peer_t *peer = (pmix_peer_t*)pr; - pmix_nspace_t *ns = peer->nptr; + pmix_namespace_t *ns = peer->nptr; char *msg; pmix_status_t rc; pmix_hash_trkr_t *trk, *t2; @@ -1181,11 +1189,18 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, * host has received data from some other peer. It therefore * always contains data solely from remote procs, and we * shall store it accordingly */ -static pmix_status_t hash_store_modex(struct pmix_nspace_t *nspace, +static pmix_status_t hash_store_modex(struct pmix_namespace_t *nspace, pmix_list_t *cbs, - pmix_byte_object_t *bo) + pmix_buffer_t *buf) { + return pmix_gds_base_store_modex(nspace, cbs, buf, _hash_store_modex, NULL); +} + +static pmix_status_t _hash_store_modex(void * cbdata, + struct pmix_namespace_t *nspace, + pmix_list_t *cbs, + pmix_byte_object_t *bo) { - pmix_nspace_t *ns = (pmix_nspace_t*)nspace; + pmix_namespace_t *ns = (pmix_namespace_t*)nspace; pmix_hash_trkr_t *trk, *t; pmix_status_t rc = PMIX_SUCCESS; int32_t cnt; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c index 9157d546616..800923c34fc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,23 +36,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include @@ -173,7 +158,7 @@ static int if_bsdx_open(void) /* fill values into the pmix_pif_t */ memcpy(&a4, &(sin_addr->sin_addr), sizeof(struct in_addr)); - strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE); + pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list) + 1; ((struct sockaddr_in*) &intf->if_addr)->sin_addr = a4; ((struct sockaddr_in*) &intf->if_addr)->sin_family = AF_INET; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c index 2dac2550d37..5954f1580c5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,23 +36,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include @@ -198,7 +183,7 @@ static int if_bsdx_ipv6_open(void) return PMIX_ERR_OUT_OF_RESOURCE; } intf->af_family = AF_INET6; - strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE); + pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list) + 1; ((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6; ((struct sockaddr_in6*) &intf->if_addr)->sin6_family = AF_INET6; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c index 2f240f9d8a1..f0bb2db9f5e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,23 +36,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include @@ -142,7 +127,7 @@ static int if_linux_ipv6_open(void) } /* now construct the pmix_pif_t */ - strncpy(intf->if_name, ifname, IF_NAMESIZE); + pmix_strncpy(intf->if_name, ifname, IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list)+1; intf->if_kernel_index = (uint16_t) idx; ((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h index 29c75b869c7..e43de4707db 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h @@ -3,7 +3,7 @@ * Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -40,23 +40,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c index c338b4f86a1..095a3027e71 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/posix_ipv4/pif_posix.c @@ -39,23 +39,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include @@ -265,7 +249,7 @@ static int if_posix_open(void) /* copy entry over into our data structure */ memset(intf->if_name, 0, sizeof(intf->if_name)); - strncpy(intf->if_name, ifr->ifr_name, sizeof(intf->if_name) - 1); + pmix_strncpy(intf->if_name, ifr->ifr_name, sizeof(intf->if_name) - 1); intf->if_flags = ifr->ifr_flags; /* every new address gets its own internal if_index */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c index 7403cebf0e2..a7d94f79086 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c @@ -3,7 +3,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -146,8 +146,8 @@ static int if_solaris_ipv6_open(void) i += sizeof (*lifreq)) { lifreq = (struct lifreq *)((caddr_t)lifconf.lifc_buf + i); - strncpy (lifquery.lifr_name, lifreq->lifr_name, - sizeof (lifquery.lifr_name)); + pmix_strncpy (lifquery.lifr_name, lifreq->lifr_name, + sizeof (lifquery.lifr_name)-1); /* lookup kernel index */ error = ioctl (sd, SIOCGLIFINDEX, &lifquery); @@ -190,7 +190,7 @@ static int if_solaris_ipv6_open(void) } intf->af_family = AF_INET6; - strncpy (intf->if_name, lifreq->lifr_name, IF_NAMESIZE); + pmix_strncpy (intf->if_name, lifreq->lifr_name, IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list)+1; memcpy(&intf->if_addr, my_addr, sizeof (*my_addr)); intf->if_mask = 64; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/Makefile.am index d05743fb5f6..7a1f9c9c3de 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pinstalldirs/config/Makefile.am @@ -4,7 +4,7 @@ # Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2009 High Performance Computing Center Stuttgart, # University of Stuttgart. All rights reserved. -# Copyright (c) 2016 Intel, Inc. All rights reserved. +# Copyright (c) 2016-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,4 +19,4 @@ libmca_pinstalldirs_config_la_SOURCES = \ # This file is generated; we do not want to include it in the tarball nodist_libmca_pinstalldirs_config_la_SOURCES = \ - install_dirs.h + pinstall_dirs.h diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c index e6ed5a60ce3..619dc38f702 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c @@ -90,7 +90,7 @@ static pmix_status_t mylog(const pmix_proc_t *source, /* check to see if there are any relevant directives */ for (n=0; n < ndirs; n++) { if (0 == strncmp(directives[n].key, PMIX_LOG_TIMESTAMP, PMIX_MAX_KEYLEN)) { - flags.timestamp = data[n].value.data.time; + flags.timestamp = directives[n].value.data.time; } else if (0 == strncmp(directives[n].key, PMIX_LOG_XML_OUTPUT, PMIX_MAX_KEYLEN)) { flags.xml = PMIX_INFO_TRUE(&directives[n]); } else if (0 == strncmp(directives[n].key, PMIX_LOG_TAG_OUTPUT, PMIX_MAX_KEYLEN)) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h index 9b4f58fdaf1..d832bf5478e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/base.h @@ -119,7 +119,7 @@ PMIX_EXPORT pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, size_t ninfo); PMIX_EXPORT pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *peer, char ***env); PMIX_EXPORT void pmix_pnet_base_child_finalized(pmix_proc_t *peer); -PMIX_EXPORT void pmix_pnet_base_local_app_finalized(pmix_nspace_t *nptr); +PMIX_EXPORT void pmix_pnet_base_local_app_finalized(pmix_namespace_t *nptr); PMIX_EXPORT void pmix_pnet_base_deregister_nspace(char *nspace); PMIX_EXPORT void pmix_pnet_base_collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_inventory_cbfunc_t cbfunc, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index 22ea10829e3..c4869da529d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 Research Organization for Information Science @@ -39,10 +39,11 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, pmix_list_t *ilist) { pmix_pnet_base_active_module_t *active; - pmix_status_t rc; - pmix_nspace_t *nptr, *ns; + pmix_status_t rc = PMIX_SUCCESS; + pmix_namespace_t *nptr, *ns; size_t n; char *nregex, *pregex; + char *params[2] = {"PMIX_MCA_", NULL}; if (!pmix_pnet_globals.initialized) { return PMIX_ERR_INIT; @@ -59,7 +60,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, nptr = NULL; /* find this nspace - note that it may not have * been registered yet */ - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; @@ -67,7 +68,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, } if (NULL == nptr) { /* add it */ - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { return PMIX_ERR_NOMEM; } @@ -75,22 +76,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); } - /* if the info param is NULL, then we make one pass thru the actives - * in case someone specified an allocation or collection of envars - * via MCA param */ - if (NULL == info) { - PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { - if (NULL != active->module->allocate) { - if (PMIX_SUCCESS == (rc = active->module->allocate(nptr, NULL, ilist))) { - break; - } - if (PMIX_ERR_TAKE_NEXT_OPTION != rc) { - /* true error */ - return rc; - } - } - } - } else { + if (NULL != info) { /* check for description of the node and proc maps */ nregex = NULL; pregex = NULL; @@ -131,7 +117,10 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, } } - return PMIX_SUCCESS; + /* add any local PMIx MCA params */ + rc = pmix_pnet_base_harvest_envars(params, NULL, ilist); + + return rc; } /* can only be called by a server */ @@ -141,7 +130,7 @@ pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, { pmix_pnet_base_active_module_t *active; pmix_status_t rc; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; if (!pmix_pnet_globals.initialized) { return PMIX_ERR_INIT; @@ -157,7 +146,7 @@ pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, /* find this proc's nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; @@ -165,7 +154,7 @@ pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, } if (NULL == nptr) { /* add it */ - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { return PMIX_ERR_NOMEM; } @@ -189,7 +178,7 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) { pmix_pnet_base_active_module_t *active; pmix_status_t rc; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; if (!pmix_pnet_globals.initialized) { return PMIX_ERR_INIT; @@ -202,7 +191,7 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) /* find this proc's nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, proc->nspace)) { nptr = ns; break; @@ -210,7 +199,7 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) } if (NULL == nptr) { /* add it */ - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { return PMIX_ERR_NOMEM; } @@ -252,7 +241,7 @@ void pmix_pnet_base_child_finalized(pmix_proc_t *peer) return; } -void pmix_pnet_base_local_app_finalized(pmix_nspace_t *nptr) +void pmix_pnet_base_local_app_finalized(pmix_namespace_t *nptr) { pmix_pnet_base_active_module_t *active; @@ -277,7 +266,9 @@ void pmix_pnet_base_local_app_finalized(pmix_nspace_t *nptr) void pmix_pnet_base_deregister_nspace(char *nspace) { pmix_pnet_base_active_module_t *active; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; + pmix_pnet_job_t *job; + pmix_pnet_node_t *node; if (!pmix_pnet_globals.initialized) { return; @@ -290,7 +281,7 @@ void pmix_pnet_base_deregister_nspace(char *nspace) /* find this nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; @@ -307,7 +298,24 @@ void pmix_pnet_base_deregister_nspace(char *nspace) } } - return; + PMIX_LIST_FOREACH(job, &pmix_pnet_globals.jobs, pmix_pnet_job_t) { + if (0 == strcmp(nspace, job->nspace)) { + pmix_list_remove_item(&pmix_pnet_globals.jobs, &job->super); + PMIX_RELEASE(job); + break; + } + } + + PMIX_LIST_FOREACH(node, &pmix_pnet_globals.nodes, pmix_pnet_node_t) { + pmix_pnet_local_procs_t *lp; + PMIX_LIST_FOREACH(lp, &node->local_jobs, pmix_pnet_local_procs_t) { + if (0 == strcmp(nspace, lp->nspace)) { + pmix_list_remove_item(&node->local_jobs, &lp->super); + PMIX_RELEASE(lp); + break; + } + } + } } static void cicbfunc(pmix_status_t status, @@ -560,6 +568,8 @@ pmix_status_t pmix_pnet_base_harvest_envars(char **incvars, char **excvars, } *string_key = '\0'; ++string_key; + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "pnet: adding envar %s", cs_env); PMIX_ENVAR_LOAD(&kv->value->data.envar, cs_env, string_key, ':'); pmix_list_append(ilist, &kv->super); free(cs_env); @@ -576,6 +586,8 @@ pmix_status_t pmix_pnet_base_harvest_envars(char **incvars, char **excvars, } PMIX_LIST_FOREACH_SAFE(kv, next, ilist, pmix_kval_t) { if (0 == strncmp(kv->value->data.envar.envar, excvars[j], len)) { + pmix_output_verbose(5, pmix_pnet_base_framework.framework_output, + "pnet: excluding envar %s", kv->value->data.envar.envar); pmix_list_remove_item(ilist, &kv->super); PMIX_RELEASE(kv); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c index 2bddd22f18b..d795c8bc486 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * * $COPYRIGHT$ @@ -52,18 +52,18 @@ static pmix_status_t opa_init(void); static void opa_finalize(void); -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo); -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *proc, char ***env); static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_nspace_t *nptr); -static void deregister_nspace(pmix_nspace_t *nptr); +static void local_app_finalized(pmix_namespace_t *nptr); +static void deregister_nspace(pmix_namespace_t *nptr); static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_inventory_cbfunc_t cbfunc, void *cbdata); static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, @@ -229,7 +229,7 @@ static char* transports_print(uint64_t *unique_key) /* NOTE: if there is any binary data to be transferred, then * this function MUST pack it for transport as the host will * not know how to do so */ -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist) { @@ -251,16 +251,19 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, return PMIX_ERR_TAKE_NEXT_OPTION; } - if (0 == strncmp(info->key, PMIX_SETUP_APP_ENVARS, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ENVARS)) { envars = PMIX_INFO_TRUE(info); - } else if (0 == strncmp(info->key, PMIX_SETUP_APP_ALL, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ALL)) { envars = PMIX_INFO_TRUE(info); seckeys = PMIX_INFO_TRUE(info); - } else if (0 == strncmp(info->key, PMIX_SETUP_APP_NONENVARS, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_NONENVARS) || + PMIX_CHECK_KEY(info, PMIX_ALLOC_NETWORK_SEC_KEY)) { seckeys = PMIX_INFO_TRUE(info); } if (seckeys) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet: opa providing seckeys"); /* put the number here - or else create an appropriate string. this just needs to * eventually be a string variable */ @@ -311,6 +314,10 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, } if (envars) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet: opa harvesting envars %s excluding %s", + (NULL == mca_pnet_opa_component.incparms) ? "NONE" : mca_pnet_opa_component.incparms, + (NULL == mca_pnet_opa_component.excparms) ? "NONE" : mca_pnet_opa_component.excparms); /* harvest envars to pass along */ if (NULL != mca_pnet_opa_component.include) { rc = pmix_pnet_base_harvest_envars(mca_pnet_opa_component.include, @@ -327,7 +334,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, return PMIX_ERR_TAKE_NEXT_OPTION; } -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo) { @@ -335,6 +342,9 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, pmix_kval_t *kv; + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet: opa setup_local_network"); + if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strncmp(info[n].key, PMIX_PNET_OPA_BLOB, PMIX_MAX_KEYLEN)) { @@ -353,6 +363,14 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, return PMIX_ERR_NOMEM; } pmix_value_xfer(kv->value, &info[n].value); + if (PMIX_ENVAR == kv->value->type) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet:opa:setup_local_network adding %s=%s to environment", + kv->value->data.envar.envar, kv->value->data.envar.value); + } else { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet:opa:setup_local_network loading blob"); + } pmix_list_append(&nptr->setup_data, &kv->super); } } @@ -361,12 +379,15 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, return PMIX_SUCCESS; } -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *proc, char ***env) { pmix_kval_t *kv, *next; + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet: opa setup fork"); + /* if there are any cached nspace prep blobs, execute them, * ensuring that we only do so once per nspace - note that * we don't expect to find any envars here, though we could @@ -387,14 +408,14 @@ static void child_finalized(pmix_proc_t *peer) "pnet:opa child finalized"); } -static void local_app_finalized(pmix_nspace_t *nptr) +static void local_app_finalized(pmix_namespace_t *nptr) { pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet:opa app finalized"); } -static void deregister_nspace(pmix_nspace_t *nptr) +static void deregister_nspace(pmix_namespace_t *nptr) { pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet:opa deregister nspace"); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h index 75d50d4888f..6340d9f225d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -20,6 +20,8 @@ BEGIN_C_DECLS typedef struct { pmix_pnet_base_component_t super; + char *incparms; + char *excparms; char **include; char **exclude; } pmix_pnet_opa_component_t; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c index 9a726c3f4ed..5ef1572239b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -69,33 +69,30 @@ pmix_pnet_opa_component_t mca_pnet_opa_component = { .exclude = NULL }; -static char *includeparam; -static char *excludeparam; - static pmix_status_t component_register(void) { pmix_mca_base_component_t *component = &mca_pnet_opa_component.super.base; - includeparam = "HFI_*,PSM2_*"; + mca_pnet_opa_component.incparms = "HFI_*,PSM2_*"; (void)pmix_mca_base_component_var_register(component, "include_envars", "Comma-delimited list of envars to harvest (\'*\' and \'?\' supported)", PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, PMIX_INFO_LVL_2, PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &includeparam); - if (NULL != includeparam) { - mca_pnet_opa_component.include = pmix_argv_split(includeparam, ','); + &mca_pnet_opa_component.incparms); + if (NULL != mca_pnet_opa_component.incparms) { + mca_pnet_opa_component.include = pmix_argv_split(mca_pnet_opa_component.incparms, ','); } - excludeparam = NULL; + mca_pnet_opa_component.excparms = NULL; (void)pmix_mca_base_component_var_register(component, "exclude_envars", "Comma-delimited list of envars to exclude (\'*\' and \'?\' supported)", PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, PMIX_INFO_LVL_2, PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &excludeparam); - if (NULL != excludeparam) { - mca_pnet_opa_component.exclude = pmix_argv_split(excludeparam, ','); + &mca_pnet_opa_component.excparms); + if (NULL != mca_pnet_opa_component.excparms) { + mca_pnet_opa_component.exclude = pmix_argv_split(mca_pnet_opa_component.excparms, ','); } return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h index 3313ca67820..fb5cc7d3635 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/pnet.h @@ -60,7 +60,7 @@ typedef void (*pmix_pnet_base_module_fini_fn_t)(void); * each other, environmental variables picked up at the login node * for forwarding to compute nodes, or allocation of static endpts */ -typedef pmix_status_t (*pmix_pnet_base_module_allocate_fn_t)(pmix_nspace_t *nptr, +typedef pmix_status_t (*pmix_pnet_base_module_allocate_fn_t)(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist); @@ -68,7 +68,7 @@ typedef pmix_status_t (*pmix_pnet_base_module_allocate_fn_t)(pmix_nspace_t *nptr * Give the local network library an opportunity to setup address information * for the application by passing in the layout type and a regex describing * the layout */ -typedef pmix_status_t (*pmix_pnet_base_module_setup_local_net_fn_t)(pmix_nspace_t *nptr, +typedef pmix_status_t (*pmix_pnet_base_module_setup_local_net_fn_t)(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo); @@ -76,7 +76,7 @@ typedef pmix_status_t (*pmix_pnet_base_module_setup_local_net_fn_t)(pmix_nspace_ * Give the local network library an opportunity to add any envars to the * environment of a local application process prior to fork/exec */ -typedef pmix_status_t (*pmix_pnet_base_module_setup_fork_fn_t)(pmix_nspace_t *nptr, +typedef pmix_status_t (*pmix_pnet_base_module_setup_fork_fn_t)(pmix_namespace_t *nptr, const pmix_proc_t *proc, char ***env); @@ -90,13 +90,13 @@ typedef void (*pmix_pnet_base_module_child_finalized_fn_t)(pmix_proc_t *peer); * Provide an opportunity for the local network library to cleanup after * all local clients for a given application have terminated */ -typedef void (*pmix_pnet_base_module_local_app_finalized_fn_t)(pmix_nspace_t *nptr); +typedef void (*pmix_pnet_base_module_local_app_finalized_fn_t)(pmix_namespace_t *nptr); /** * Provide an opportunity for the fabric components to cleanup any * resource allocations (e.g., static ports) they may have assigned */ -typedef void (*pmix_pnet_base_module_dregister_nspace_fn_t)(pmix_nspace_t *nptr); +typedef void (*pmix_pnet_base_module_dregister_nspace_fn_t)(pmix_namespace_t *nptr); /** @@ -166,7 +166,7 @@ typedef struct { /* define a few API versions of the functions - main difference is the - * string nspace parameter instead of a pointer to pmix_nspace_t. This + * string nspace parameter instead of a pointer to pmix_namespace_t. This * is done as an optimization to avoid having every component look for * that pointer */ typedef pmix_status_t (*pmix_pnet_base_API_allocate_fn_t)(char *nspace, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c index 3f7a44868e1..fecec014243 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ * @@ -47,17 +49,17 @@ static pmix_status_t tcp_init(void); static void tcp_finalize(void); -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo); -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *peer, char ***env); static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_nspace_t *nptr); -static void deregister_nspace(pmix_nspace_t *nptr); +static void local_app_finalized(pmix_namespace_t *nptr); +static void deregister_nspace(pmix_namespace_t *nptr); static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_inventory_cbfunc_t cbfunc, void *cbdata); static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, @@ -102,7 +104,7 @@ typedef struct { } tcp_port_tracker_t; static pmix_list_t allocations, available; -static pmix_status_t process_request(pmix_nspace_t *nptr, +static pmix_status_t process_request(pmix_namespace_t *nptr, char *idkey, int ports_per_node, tcp_port_tracker_t *trk, pmix_list_t *ilist); @@ -295,7 +297,7 @@ static inline void generate_key(uint64_t* unique_key) { * NOTE: this implementation is offered as an example that can * undoubtedly be vastly improved/optimized */ -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist) { @@ -329,16 +331,20 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* check directives to see if a crypto key and/or * network resource allocations requested */ PMIX_CONSTRUCT(&mylist, pmix_list_t); - if (0 == strncmp(info->key, PMIX_SETUP_APP_ENVARS, PMIX_MAX_KEYLEN) || - 0 == strncmp(info->key, PMIX_SETUP_APP_ALL, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ENVARS) || + PMIX_CHECK_KEY(info, PMIX_SETUP_APP_ALL)) { if (NULL != mca_pnet_tcp_component.include) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet: tcp harvesting envars %s excluding %s", + (NULL == mca_pnet_tcp_component.incparms) ? "NONE" : mca_pnet_tcp_component.incparms, + (NULL == mca_pnet_tcp_component.excparms) ? "NONE" : mca_pnet_tcp_component.excparms); rc = pmix_pnet_base_harvest_envars(mca_pnet_tcp_component.include, mca_pnet_tcp_component.exclude, ilist); return rc; } return PMIX_SUCCESS; - } else if (0 != strncmp(info->key, PMIX_ALLOC_NETWORK, PMIX_MAX_KEYLEN)) { + } else if (!PMIX_CHECK_KEY(info, PMIX_ALLOC_NETWORK)) { /* not a network allocation request */ return PMIX_SUCCESS; } @@ -443,11 +449,13 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, } /* nope - they asked for something that we cannot do */ if (NULL == avail) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOT_AVAILABLE; } /* setup to track the assignment */ trk = PMIX_NEW(tcp_port_tracker_t); if (NULL == trk) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } trk->nspace = strdup(nptr->nspace); @@ -459,6 +467,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* return the allocated ports */ pmix_list_remove_item(&allocations, &trk->super); PMIX_RELEASE(trk); + PMIX_LIST_DESTRUCT(&mylist); return rc; } allocated = true; @@ -481,11 +490,13 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, } /* nope - they asked for something that we cannot do */ if (NULL == avail) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOT_AVAILABLE; } /* setup to track the assignment */ trk = PMIX_NEW(tcp_port_tracker_t); if (NULL == trk) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } trk->nspace = strdup(nptr->nspace); @@ -497,6 +508,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* return the allocated ports */ pmix_list_remove_item(&allocations, &trk->super); PMIX_RELEASE(trk); + PMIX_LIST_DESTRUCT(&mylist); return rc; } allocated = true; @@ -505,6 +517,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet:tcp:allocate unsupported type %s for nspace %s", type, nptr->nspace); + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_TAKE_NEXT_OPTION; } @@ -519,6 +532,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* setup to track the assignment */ trk = PMIX_NEW(tcp_port_tracker_t); if (NULL == trk) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } trk->nspace = strdup(nptr->nspace); @@ -530,6 +544,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* return the allocated ports */ pmix_list_remove_item(&allocations, &trk->super); PMIX_RELEASE(trk); + PMIX_LIST_DESTRUCT(&mylist); return rc; } allocated = true; @@ -583,6 +598,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, trk = PMIX_NEW(tcp_port_tracker_t); if (NULL == trk) { pmix_argv_free(reqs); + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } trk->nspace = strdup(nptr->nspace); @@ -594,6 +610,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* return the allocated ports */ pmix_list_remove_item(&allocations, &trk->super); PMIX_RELEASE(trk); + PMIX_LIST_DESTRUCT(&mylist); return rc; } allocated = true; @@ -604,6 +621,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, ports_per_node, nptr->nspace); if (0 == ports_per_node) { /* nothing to allocate */ + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_TAKE_NEXT_OPTION; } avail = (tcp_available_ports_t*)pmix_list_get_first(&available); @@ -611,6 +629,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* setup to track the assignment */ trk = PMIX_NEW(tcp_port_tracker_t); if (NULL == trk) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } trk->nspace = strdup(nptr->nspace); @@ -630,26 +649,32 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, } if (!allocated) { /* nope - we cannot help */ + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_TAKE_NEXT_OPTION; } } if (seckey) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet:tcp: generate seckey"); generate_key(unique_key); kv = PMIX_NEW(pmix_kval_t); if (NULL == kv) { + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } kv->key = strdup(PMIX_ALLOC_NETWORK_SEC_KEY); kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); if (NULL == kv->value) { PMIX_RELEASE(kv); + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } kv->value->type = PMIX_BYTE_OBJECT; kv->value->data.bo.bytes = (char*)malloc(2 * sizeof(uint64_t)); if (NULL == kv->value->data.bo.bytes) { PMIX_RELEASE(kv); + PMIX_LIST_DESTRUCT(&mylist); return PMIX_ERR_NOMEM; } memcpy(kv->value->data.bo.bytes, unique_key, 2 * sizeof(uint64_t)); @@ -696,7 +721,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, /* upon receipt of the launch message, each daemon adds the * static address assignments to the job-level info cache * for that job */ -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo) { @@ -724,7 +749,12 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &bkt, &nkvals, &cnt, PMIX_SIZE); /* setup the info array */ - PMIX_INFO_CREATE(jinfo, nkvals); + PMIX_INFO_CONSTRUCT(&stinfo); + pmix_strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); + stinfo.value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); + jinfo = (pmix_info_t*)stinfo.value.data.darray->array; + /* cycle thru the blob and extract the kvals */ kv = PMIX_NEW(pmix_kval_t); cnt = 1; @@ -736,7 +766,7 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, "recvd KEY %s %s", kv->key, (PMIX_STRING == kv->value->type) ? kv->value->data.string : "NON-STRING"); /* xfer the value to the info */ - (void)strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, &jinfo[m].value, kv->value); /* if this is the ID key, save it */ @@ -762,12 +792,6 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, PMIX_INFO_FREE(jinfo, nkvals); return PMIX_ERR_BAD_PARAM; } - /* the data gets stored as a pmix_data_array_t on the provided key */ - PMIX_INFO_CONSTRUCT(&stinfo); - (void)strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); - stinfo.value.type = PMIX_DATA_ARRAY; - PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); - stinfo.value.data.darray->array = jinfo; /* cache the info on the job */ PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, @@ -782,9 +806,11 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, return PMIX_SUCCESS; } -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *peer, char ***env) { + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet:tcp:setup_fork"); return PMIX_SUCCESS; } @@ -801,7 +827,7 @@ static void child_finalized(pmix_proc_t *peer) * provides an opportunity for the local network to cleanup * any resources consumed locally by the clients of that job. * We don't have anything we need to do */ -static void local_app_finalized(pmix_nspace_t *nptr) +static void local_app_finalized(pmix_namespace_t *nptr) { pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet:tcp app finalized"); @@ -811,7 +837,7 @@ static void local_app_finalized(pmix_nspace_t *nptr) * PMix function, which in turn calls my TCP component to release the * assignments for that job. The addresses are marked as "available" * for reuse on the next job. */ -static void deregister_nspace(pmix_nspace_t *nptr) +static void deregister_nspace(pmix_namespace_t *nptr) { tcp_port_tracker_t *trk; @@ -852,6 +878,9 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_byte_object_t pbo; pmix_kval_t *kv; + pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, + "pnet:tcp:collect_inventory"); + /* setup the bucket - we will pass the results as a blob */ PMIX_CONSTRUCT(&bucket, pmix_buffer_t); /* add our hostname */ @@ -949,7 +978,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, return PMIX_SUCCESS; } -static pmix_status_t process_request(pmix_nspace_t *nptr, +static pmix_status_t process_request(pmix_namespace_t *nptr, char *idkey, int ports_per_node, tcp_port_tracker_t *trk, pmix_list_t *ilist) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h index 63ffd878712..54e0fe0316f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -22,6 +22,8 @@ typedef struct { pmix_pnet_base_component_t super; char *static_ports; char *default_request; + char *incparms; + char *excparms; char **include; char **exclude; } pmix_pnet_tcp_component_t; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c index 64dc93c2409..b313ab36076 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp_component.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,9 +60,6 @@ pmix_pnet_tcp_component_t mca_pnet_tcp_component = { .exclude = NULL }; -static char *includeparam; -static char *excludeparam; - static pmix_status_t component_register(void) { pmix_mca_base_component_t *component = &mca_pnet_tcp_component.super.base; @@ -86,26 +83,26 @@ static pmix_status_t component_register(void) PMIX_MCA_BASE_VAR_SCOPE_READONLY, &mca_pnet_tcp_component.default_request); - includeparam = NULL; + mca_pnet_tcp_component.incparms = NULL; (void)pmix_mca_base_component_var_register(component, "include_envars", "Comma-delimited list of envars to harvest (\'*\' and \'?\' supported)", PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, PMIX_INFO_LVL_2, PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &includeparam); - if (NULL != includeparam) { - mca_pnet_tcp_component.include = pmix_argv_split(includeparam, ','); + &mca_pnet_tcp_component.incparms); + if (NULL != mca_pnet_tcp_component.incparms) { + mca_pnet_tcp_component.include = pmix_argv_split(mca_pnet_tcp_component.incparms, ','); } - excludeparam = NULL; + mca_pnet_tcp_component.excparms = NULL; (void)pmix_mca_base_component_var_register(component, "exclude_envars", "Comma-delimited list of envars to exclude (\'*\' and \'?\' supported)", PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, PMIX_INFO_LVL_2, PMIX_MCA_BASE_VAR_SCOPE_LOCAL, - &excludeparam); - if (NULL != excludeparam) { - mca_pnet_tcp_component.exclude = pmix_argv_split(excludeparam, ','); + &mca_pnet_tcp_component.excparms); + if (NULL != mca_pnet_tcp_component.excparms) { + mca_pnet_tcp_component.exclude = pmix_argv_split(mca_pnet_tcp_component.excparms, ','); } return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c index a8808b43e6e..830e0c02e59 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * * $COPYRIGHT$ @@ -46,18 +46,18 @@ static pmix_status_t test_init(void); static void test_finalize(void); -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist); -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo); -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *proc, char ***env); static void child_finalized(pmix_proc_t *peer); -static void local_app_finalized(pmix_nspace_t *nptr); -static void deregister_nspace(pmix_nspace_t *nptr); +static void local_app_finalized(pmix_namespace_t *nptr); +static void deregister_nspace(pmix_namespace_t *nptr); static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_inventory_cbfunc_t cbfunc, void *cbdata); static pmix_status_t deliver_inventory(pmix_info_t info[], size_t ninfo, @@ -94,7 +94,7 @@ static void test_finalize(void) /* NOTE: if there is any binary data to be transferred, then * this function MUST pack it for transport as the host will * not know how to do so */ -static pmix_status_t allocate(pmix_nspace_t *nptr, +static pmix_status_t allocate(pmix_namespace_t *nptr, pmix_info_t *info, pmix_list_t *ilist) { @@ -283,7 +283,7 @@ static pmix_status_t allocate(pmix_nspace_t *nptr, return PMIX_SUCCESS; } -static pmix_status_t setup_local_network(pmix_nspace_t *nptr, +static pmix_status_t setup_local_network(pmix_namespace_t *nptr, pmix_info_t info[], size_t ninfo) { @@ -345,8 +345,13 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, cnt = 1; PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &bkt, &nkvals, &cnt, PMIX_SIZE); - /* setup the info array */ - PMIX_INFO_CREATE(jinfo, nkvals); + /* the data gets stored as a pmix_data_array_t on the provided key */ + PMIX_INFO_CONSTRUCT(&stinfo); + pmix_strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); + stinfo.value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); + jinfo = (pmix_info_t*)stinfo.value.data.darray->array; + /* cycle thru the blob and extract the kvals */ kv = PMIX_NEW(pmix_kval_t); cnt = 1; @@ -358,7 +363,7 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, "recvd KEY %s %s", kv->key, (PMIX_STRING == kv->value->type) ? kv->value->data.string : "NON-STRING"); /* xfer the value to the info */ - (void)strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(jinfo[m].key, kv->key, PMIX_MAX_KEYLEN); PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, &jinfo[m].value, kv->value); /* if this is the ID key, save it */ @@ -384,14 +389,7 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, PMIX_INFO_FREE(jinfo, nkvals); return PMIX_ERR_BAD_PARAM; } - /* the data gets stored as a pmix_data_array_t on the provided key */ - PMIX_INFO_CONSTRUCT(&stinfo); - (void)strncpy(stinfo.key, idkey, PMIX_MAX_KEYLEN); - stinfo.value.type = PMIX_DATA_ARRAY; - PMIX_DATA_ARRAY_CREATE(stinfo.value.data.darray, nkvals, PMIX_INFO); - stinfo.value.data.darray->array = jinfo; - - /* cache the info on the job */ + /* cache the info on the job */ PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, &stinfo, 1); PMIX_INFO_DESTRUCT(&stinfo); @@ -404,7 +402,7 @@ static pmix_status_t setup_local_network(pmix_nspace_t *nptr, return PMIX_SUCCESS; } -static pmix_status_t setup_fork(pmix_nspace_t *nptr, +static pmix_status_t setup_fork(pmix_namespace_t *nptr, const pmix_proc_t *proc, char ***env) { @@ -457,12 +455,12 @@ static void child_finalized(pmix_proc_t *peer) peer->nspace, peer->rank); } -static void local_app_finalized(pmix_nspace_t *nptr) +static void local_app_finalized(pmix_namespace_t *nptr) { pmix_output(0, "pnet:test NSPACE %s LOCALLY FINALIZED", nptr->nspace); } -static void deregister_nspace(pmix_nspace_t *nptr) +static void deregister_nspace(pmix_namespace_t *nptr) { pmix_output(0, "pnet:test DEREGISTER NSPACE %s", nptr->nspace); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c index dbf551ea640..706c2bc8aae 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/base/preg_base_frame.c @@ -14,6 +14,7 @@ * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -98,6 +99,7 @@ static void rvcon(pmix_regex_value_t *p) p->prefix = NULL; p->suffix = NULL; p->num_digits = 0; + p->skip = false; PMIX_CONSTRUCT(&p->ranges, pmix_list_t); } static void rvdes(pmix_regex_value_t *p) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c index 1a98766f8e7..0d31f96435a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * @@ -152,9 +152,22 @@ static pmix_status_t generate_node_regex(const char *input, suffix = NULL; numdigits = (int)strlen(&vptr[startnum]); } + /* is this value already on our list? */ found = false; PMIX_LIST_FOREACH(vreg, &vids, pmix_regex_value_t) { + // The regex must preserve ordering of the values. + // If we disqualified this entry in a previous check then exclude it + // from future checks as well. This will prevent a later entry from + // being 'pulled forward' accidentally. For example, given: + // "a28n01,a99n02,a28n02" + // Without this 'skip' the loop would have 'a28n02' combine with + // 'a28n01' jumping over the 'a99n02' entry, and thus not preserving + // the order of the list when the regex is unpacked. + if( vreg->skip ) { + continue; + } + if (0 < strlen(prefix) && NULL == vreg->prefix) { continue; } @@ -163,6 +176,7 @@ static pmix_status_t generate_node_regex(const char *input, } if (0 < strlen(prefix) && NULL != vreg->prefix && 0 != strcmp(prefix, vreg->prefix)) { + vreg->skip = true; continue; } if (NULL == suffix && NULL != vreg->suffix) { @@ -173,9 +187,11 @@ static pmix_status_t generate_node_regex(const char *input, } if (NULL != suffix && NULL != vreg->suffix && 0 != strcmp(suffix, vreg->suffix)) { + vreg->skip = true; continue; } if (numdigits != vreg->num_digits) { + vreg->skip = true; continue; } /* found a match - flag it */ @@ -522,7 +538,7 @@ static pmix_status_t resolve_peers(const char *nodename, /* scope is irrelevant as the info we seek must be local */ cb.scope = PMIX_SCOPE_UNDEF; /* let the proc point to the nspace */ - (void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; cb.proc = &proc; @@ -565,7 +581,7 @@ static pmix_status_t resolve_peers(const char *nodename, goto complete; } for (j=0; j < np; j++) { - (void)strncpy(p[j].nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(p[j].nspace, nspace, PMIX_MAX_NSLEN); p[j].rank = strtoul(ptr[j], NULL, 10); } rc = PMIX_SUCCESS; @@ -619,7 +635,7 @@ static pmix_status_t resolve_nodes(const char *nspace, /* scope is irrelevant as the info we seek must be local */ cb.scope = PMIX_SCOPE_UNDEF; /* put the nspace in the proc field */ - (void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); /* the info will be associated with PMIX_RANK_WILDCARD */ proc.rank = PMIX_RANK_WILDCARD; cb.proc = &proc; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h index 9f1b8a8ae51..932d8e552c4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/preg_types.h @@ -13,6 +13,7 @@ * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,6 +52,7 @@ typedef struct { char *suffix; int num_digits; pmix_list_t ranges; + bool skip; } pmix_regex_value_t; PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_regex_value_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c index 914e895a40a..3a050823c2c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/psensor_file.c @@ -345,7 +345,7 @@ static void file_sample(int sd, short args, void *cbdata) /* stop monitoring this client */ pmix_list_remove_item(&mca_psensor_file_component.trackers, &ft->super); /* generate an event */ - (void)strncpy(source.nspace, ft->requestor->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(source.nspace, ft->requestor->info->pname.nspace, PMIX_MAX_NSLEN); source.rank = ft->requestor->info->pname.rank; rc = PMIx_Notify_event(PMIX_MONITOR_FILE_ALERT, &source, ft->range, ft->info, ft->ninfo, opcbfunc, ft); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c index f88ef0cdb69..81de240b659 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/psensor_heartbeat.c @@ -297,7 +297,7 @@ static void check_heartbeat(int fd, short dummy, void *cbdata) pmix_globals.myid.nspace, pmix_globals.myid.rank, ft->requestor->info->pname.nspace, ft->requestor->info->pname.rank)); /* generate an event */ - (void)strncpy(source.nspace, ft->requestor->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(source.nspace, ft->requestor->info->pname.nspace, PMIX_MAX_NSLEN); source.rank = ft->requestor->info->pname.rank; /* ensure the tracker remains throughout the process */ PMIX_RETAIN(ft); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c index 4c38005da67..30296755f65 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/base/pshmem_base_frame.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -60,6 +60,9 @@ static pmix_status_t pmix_pshmem_close(void) static pmix_status_t pmix_pshmem_open(pmix_mca_base_open_flag_t flags) { + if (initialized) { + return PMIX_SUCCESS; + } /* initialize globals */ initialized = true; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c index a004ac27316..09c377cd8bb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c @@ -3,7 +3,7 @@ * All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -121,7 +121,7 @@ static int _mmap_segment_create(pmix_pshmem_seg_t *sm_seg, const char *file_name sm_seg->seg_cpid = my_pid; sm_seg->seg_size = size; sm_seg->seg_base_addr = (unsigned char *)seg_addr; - (void)strncpy(sm_seg->seg_name, file_name, PMIX_PATH_MAX - 1); + pmix_strncpy(sm_seg->seg_name, file_name, PMIX_PATH_MAX); out: if (-1 != sm_seg->seg_id) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c index 2f1fd4f6a07..2e6a101752e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c @@ -198,9 +198,11 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_ptl_sr_t, static void pccon(pmix_pending_connection_t *p) { + p->need_id = false; memset(p->nspace, 0, PMIX_MAX_NSLEN+1); p->info = NULL; p->ninfo = 0; + p->peer = NULL; p->bfrops = NULL; p->psec = NULL; p->gds = NULL; @@ -258,6 +260,8 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_listener_t, static void qcon(pmix_ptl_queue_t *p) { p->peer = NULL; + p->buf = NULL; + p->tag = UINT32_MAX; } static void qdes(pmix_ptl_queue_t *p) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index b70da16a365..0b465340bee 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science @@ -55,16 +55,30 @@ static void _notify_complete(pmix_status_t status, void *cbdata) PMIX_RELEASE(chain); } +static void _timeout(int sd, short args, void *cbdata) +{ + pmix_server_trkr_t *trk = (pmix_server_trkr_t*)cbdata; + + PMIX_RELEASE(trk); +} + +static void lcfn(pmix_status_t status, void *cbdata) +{ + pmix_peer_t *peer = (pmix_peer_t*)cbdata; + PMIX_RELEASE(peer); +} + void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) { - pmix_server_trkr_t *trk; + pmix_server_trkr_t *trk, *tnxt; pmix_server_caddy_t *rinfo, *rnext; - pmix_regevents_info_t *reginfoptr, *regnext; - pmix_peer_events_info_t *pr, *pnext; pmix_rank_info_t *info, *pinfo; pmix_ptl_posted_recv_t *rcv; pmix_buffer_t buf; pmix_ptl_hdr_t hdr; + struct timeval tv = {1200, 0}; + pmix_proc_t proc; + pmix_status_t rc; /* stop all events */ if (peer->recv_ev_active) { @@ -82,20 +96,17 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) CLOSE_THE_SOCKET(peer->sd); if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + !PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { /* if I am a server, then we need to ensure that * we properly account for the loss of this client * from any local collectives in which it was * participating - note that the proc would not * have been added to any collective tracker until * after it successfully connected */ - PMIX_LIST_FOREACH(trk, &pmix_server_globals.collectives, pmix_server_trkr_t) { + PMIX_LIST_FOREACH_SAFE(trk, tnxt, &pmix_server_globals.collectives, pmix_server_trkr_t) { /* see if this proc is participating in this tracker */ PMIX_LIST_FOREACH_SAFE(rinfo, rnext, &trk->local_cbs, pmix_server_caddy_t) { - if (0 != strncmp(rinfo->peer->info->pname.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN)) { - continue; - } - if (rinfo->peer->info->pname.rank != peer->info->pname.rank) { + if (!PMIX_CHECK_PROCID(&rinfo->peer->info->pname, &peer->info->pname)) { continue; } /* it is - adjust the count */ @@ -103,24 +114,64 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) /* remove it from the list */ pmix_list_remove_item(&trk->local_cbs, &rinfo->super); PMIX_RELEASE(rinfo); - /* we need to let the other participants know that this - * proc has disappeared as otherwise the collective will never - * complete */ + trk->lost_connection = true; // mark that a peer's connection was lost + if (0 == pmix_list_get_size(&trk->local_cbs)) { + /* this tracker is complete, so release it - there + * is nobody waiting for a response */ + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + /* do NOT release the tracker here as the host may + * have a copy they will return later. However, they + * might never call back, so set a LONG timeout to + * we avoid a memory leak if they don't */ + pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, + _timeout, trk); + pmix_event_evtimer_add(&trk->ev, &tv); + trk->event_active = true; + break; + } + /* if there are other participants waiting for a response, + * we need to let them know that this proc has disappeared + * as otherwise the collective will never complete */ if (PMIX_FENCENB_CMD == trk->type) { if (NULL != trk->modexcbfunc) { + /* do NOT release the tracker here as the host may + * have a copy they will return later. However, they + * might never call back, so set a LONG timeout to + * we avoid a memory leak if they don't */ + pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, + _timeout, trk); + pmix_event_evtimer_add(&trk->ev, &tv); + trk->event_active = true; trk->modexcbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, NULL, 0, trk, NULL, NULL); } } else if (PMIX_CONNECTNB_CMD == trk->type) { if (NULL != trk->op_cbfunc) { + /* do NOT release the tracker here as the host may + * have a copy they will return later. However, they + * might never call back, so set a LONG timeout to + * we avoid a memory leak if they don't */ + pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, + _timeout, trk); + pmix_event_evtimer_add(&trk->ev, &tv); + trk->event_active = true; trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); } } else if (PMIX_DISCONNECTNB_CMD == trk->type) { if (NULL != trk->op_cbfunc) { + /* do NOT release the tracker here as the host may + * have a copy they will return later. However, they + * might never call back, so set a LONG timeout to + * we avoid a memory leak if they don't */ + pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, + _timeout, trk); + pmix_event_evtimer_add(&trk->ev, &tv); + trk->event_active = true; trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); } } } } + /* remove this proc from the list of ranks for this nspace if it is * still there - we must check for multiple copies as there will be * one for each "clone" of this peer */ @@ -130,38 +181,53 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) } } /* reduce the number of local procs */ - --peer->nptr->nlocalprocs; + if (0 < peer->nptr->nlocalprocs) { + --peer->nptr->nlocalprocs; + } /* remove this client from our array */ pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); - /* cleanup any remaining events they have registered for */ - PMIX_LIST_FOREACH_SAFE(reginfoptr, regnext, &pmix_server_globals.events, pmix_regevents_info_t) { - PMIX_LIST_FOREACH_SAFE(pr, pnext, ®infoptr->peers, pmix_peer_events_info_t) { - if (peer == pr->peer) { - pmix_list_remove_item(®infoptr->peers, &pr->super); - PMIX_RELEASE(pr); - if (0 == pmix_list_get_size(®infoptr->peers)) { - pmix_list_remove_item(&pmix_server_globals.events, ®infoptr->super); - PMIX_RELEASE(reginfoptr); - break; - } - } - } + + /* purge any notifications cached for this client */ + pmix_server_purge_events(peer, NULL); + + if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + /* only connection I can lose is to my server, so mark it */ + pmix_globals.connected = false; + } else { + /* cleanup any sensors that are monitoring them */ + pmix_psensor.stop(peer, NULL); } - /* cleanup any sensors that are monitoring them */ - pmix_psensor.stop(peer, NULL); - if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer)) { + if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer) && !pmix_globals.mypeer->finalized) { /* if this peer already called finalize, then * we are just seeing their connection go away * when they terminate - so do not generate * an event. If not, then we do */ - PMIX_REPORT_EVENT(err, peer, PMIX_RANGE_NAMESPACE, _notify_complete); + PMIX_REPORT_EVENT(err, peer, PMIX_RANGE_PROC_LOCAL, _notify_complete); } /* now decrease the refcount - might actually free the object */ PMIX_RELEASE(peer->info); + /* be sure to let the host know that the tool or client + * is gone - otherwise, it won't know to cleanup the + * resources it allocated to it */ + if (NULL != pmix_host_server.client_finalized && !peer->finalized) { + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + proc.rank = peer->info->pname.rank; + /* now tell the host server */ + rc = pmix_host_server.client_finalized(&proc, peer->info->server_object, + lcfn, peer); + if (PMIX_SUCCESS == rc) { + /* we will release the peer when the server calls us back */ + peer->finalized = true; + return; + } + } + /* mark the peer as "gone" since a release doesn't guarantee + * that the peer object doesn't persist */ + peer->finalized = true; /* Release peer info */ PMIX_RELEASE(peer); } else { @@ -191,7 +257,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) PMIX_DESTRUCT(&buf); /* if I called finalize, then don't generate an event */ if (!pmix_globals.mypeer->finalized) { - PMIX_REPORT_EVENT(err, pmix_client_globals.myserver, PMIX_RANGE_LOCAL, _notify_complete); + PMIX_REPORT_EVENT(err, pmix_client_globals.myserver, PMIX_RANGE_PROC_LOCAL, _notify_complete); } } } @@ -343,7 +409,9 @@ void pmix_ptl_base_send_handler(int sd, short flags, void *cbdata) if (NULL != msg) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:base:send_handler SENDING MSG"); + "ptl:base:send_handler SENDING MSG TO %s:%d TAG %u", + peer->info->pname.nspace, peer->info->pname.rank, + ntohl(msg->hdr.tag)); if (PMIX_SUCCESS == (rc = send_msg(peer->sd, msg))) { // message is complete pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, @@ -574,10 +642,10 @@ void pmix_ptl_base_send(int sd, short args, void *cbdata) if (NULL == queue->peer || queue->peer->sd < 0 || NULL == queue->peer->info || NULL == queue->peer->nptr) { /* this peer has lost connection */ + if (NULL != queue->buf) { + PMIX_RELEASE(queue->buf); + } PMIX_RELEASE(queue); - /* ensure we post the object before another thread - * picks it back up */ - PMIX_POST_OBJECT(queue); return; } @@ -587,6 +655,12 @@ void pmix_ptl_base_send(int sd, short args, void *cbdata) (queue->peer)->info->pname.nspace, (queue->peer)->info->pname.rank, (queue->tag)); + if (NULL == queue->buf) { + /* nothing to send? */ + PMIX_RELEASE(queue); + return; + } + snd = PMIX_NEW(pmix_ptl_send_t); snd->hdr.pindex = htonl(pmix_globals.pindex); snd->hdr.tag = htonl(queue->tag); @@ -623,12 +697,19 @@ void pmix_ptl_base_send_recv(int fd, short args, void *cbdata) /* acquire the object */ PMIX_ACQUIRE_OBJECT(ms); - if (ms->peer->sd < 0) { - /* this peer's socket has been closed */ + if (NULL == ms->peer || ms->peer->sd < 0 || + NULL == ms->peer->info || NULL == ms->peer->nptr) { + /* this peer has lost connection */ + if (NULL != ms->bfr) { + PMIX_RELEASE(ms->bfr); + } + PMIX_RELEASE(ms); + return; + } + + if (NULL == ms->bfr) { + /* nothing to send? */ PMIX_RELEASE(ms); - /* ensure we post the object before another thread - * picks it back up */ - PMIX_POST_OBJECT(NULL); return; } @@ -739,7 +820,9 @@ void pmix_ptl_base_process_msg(int fd, short flags, void *cbdata) /* if the tag in this message is above the dynamic marker, then * that is an error */ if (PMIX_PTL_TAG_DYNAMIC <= msg->hdr.tag) { - pmix_output(0, "UNEXPECTED MESSAGE tag = %d", msg->hdr.tag); + pmix_output(0, "UNEXPECTED MESSAGE tag = %d from source %s:%d", + msg->hdr.tag, msg->peer->info->pname.nspace, + msg->peer->info->pname.rank); PMIX_REPORT_EVENT(PMIX_ERROR, msg->peer, PMIX_RANGE_NAMESPACE, _notify_complete); PMIX_RELEASE(msg); return; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h index 01f849b8055..d413a210043 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl.h @@ -143,11 +143,23 @@ typedef struct pmix_ptl_module_t pmix_ptl_module_t; /***** MACROS FOR EXECUTING PTL FUNCTIONS *****/ -#define PMIX_PTL_SEND_RECV(r, p, b, c, d) \ - (r) = (p)->nptr->compat.ptl->send_recv((struct pmix_peer_t*)(p), b, c, d) - -#define PMIX_PTL_SEND_ONEWAY(r, p, b, t) \ - (r) = (p)->nptr->compat.ptl->send((struct pmix_peer_t*)(p), b, t) +#define PMIX_PTL_SEND_RECV(r, p, b, c, d) \ + do { \ + if ((p)->finalized) { \ + (r) = PMIX_ERR_UNREACH; \ + } else { \ + (r) = (p)->nptr->compat.ptl->send_recv((struct pmix_peer_t*)(p), b, c, d); \ + } \ + } while(0) + +#define PMIX_PTL_SEND_ONEWAY(r, p, b, t) \ + do { \ + if ((p)->finalized) { \ + (r) = PMIX_ERR_UNREACH; \ + } else { \ + (r) = (p)->nptr->compat.ptl->send((struct pmix_peer_t*)(p), b, t); \ + } \ + } while(0) #define PMIX_PTL_RECV(r, p, c, t) \ (r) = (p)->nptr->compat.ptl->recv((struct pmix_peer_t*)(p), c, t) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h index 0008bb48d39..0017c5b8134 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h @@ -63,15 +63,16 @@ struct pmix_ptl_module_t; /* define a process type */ typedef uint16_t pmix_proc_type_t; + #define PMIX_PROC_UNDEF 0x0000 -#define PMIX_PROC_CLIENT 0x0001 -#define PMIX_PROC_SERVER 0x0002 -#define PMIX_PROC_TOOL 0x0004 -#define PMIX_PROC_V1 0x0008 -#define PMIX_PROC_V20 0x0010 -#define PMIX_PROC_V21 0x0020 -#define PMIX_PROC_V3 0x0040 -#define PMIX_PROC_LAUNCHER_ACT 0x1000 +#define PMIX_PROC_CLIENT 0x0001 // simple client process +#define PMIX_PROC_SERVER 0x0002 // simple server process +#define PMIX_PROC_TOOL 0x0004 // simple tool +#define PMIX_PROC_V1 0x0008 // process is using PMIx v1 protocols +#define PMIX_PROC_V20 0x0010 // process is using PMIx v2.0 protocols +#define PMIX_PROC_V21 0x0020 // process is using PMIx v2.1 protocols +#define PMIX_PROC_V3 0x0040 // process is using PMIx v3 protocols +#define PMIX_PROC_LAUNCHER_ACT 0x1000 // process acting as launcher #define PMIX_PROC_LAUNCHER (PMIX_PROC_TOOL | PMIX_PROC_SERVER | PMIX_PROC_LAUNCHER_ACT) #define PMIX_PROC_CLIENT_TOOL_ACT 0x2000 #define PMIX_PROC_CLIENT_TOOL (PMIX_PROC_TOOL | PMIX_PROC_CLIENT | PMIX_PROC_CLIENT_TOOL_ACT) @@ -196,11 +197,14 @@ typedef struct { pmix_event_t ev; pmix_listener_protocol_t protocol; int sd; + bool need_id; + uint8_t flag; char nspace[PMIX_MAX_NSLEN+1]; pmix_info_t *info; size_t ninfo; pmix_status_t status; struct sockaddr_storage addr; + struct pmix_peer_t *peer; char *bfrops; char *psec; char *gds; @@ -236,9 +240,6 @@ PMIX_EXPORT extern int pmix_ptl_base_output; #define PMIX_ACTIVATE_POST_MSG(ms) \ do { \ - pmix_output_verbose(5, pmix_ptl_base_output, \ - "[%s:%d] post msg", \ - __FILE__, __LINE__); \ pmix_event_assign(&((ms)->ev), pmix_globals.evbase, -1, \ EV_WRITE, pmix_ptl_base_process_msg, (ms)); \ PMIX_POST_OBJECT(ms); \ @@ -259,37 +260,42 @@ PMIX_EXPORT extern int pmix_ptl_base_output; * t - tag to be sent to * b - buffer to be sent */ -#define PMIX_SERVER_QUEUE_REPLY(p, t, b) \ - do { \ - pmix_ptl_send_t *snd; \ - uint32_t nbytes; \ - pmix_output_verbose(5, pmix_ptl_base_output, \ +#define PMIX_SERVER_QUEUE_REPLY(r, p, t, b) \ + do { \ + pmix_ptl_send_t *snd; \ + uint32_t nbytes; \ + pmix_output_verbose(5, pmix_ptl_base_output, \ "[%s:%d] queue callback called: reply to %s:%d on tag %d size %d", \ - __FILE__, __LINE__, \ - (p)->info->pname.nspace, \ - (p)->info->pname.rank, (t), (int)(b)->bytes_used); \ - snd = PMIX_NEW(pmix_ptl_send_t); \ - snd->hdr.pindex = htonl(pmix_globals.pindex); \ - snd->hdr.tag = htonl(t); \ - nbytes = (b)->bytes_used; \ - snd->hdr.nbytes = htonl(nbytes); \ - snd->data = (b); \ - /* always start with the header */ \ - snd->sdptr = (char*)&snd->hdr; \ - snd->sdbytes = sizeof(pmix_ptl_hdr_t); \ - /* if there is no message on-deck, put this one there */ \ - if (NULL == (p)->send_msg) { \ - (p)->send_msg = snd; \ - } else { \ - /* add it to the queue */ \ - pmix_list_append(&(p)->send_queue, &snd->super); \ - } \ - /* ensure the send event is active */ \ - if (!(p)->send_ev_active && 0 <= (p)->sd) { \ - (p)->send_ev_active = true; \ - PMIX_POST_OBJECT(snd); \ - pmix_event_add(&(p)->send_event, 0); \ - } \ + __FILE__, __LINE__, \ + (p)->info->pname.nspace, \ + (p)->info->pname.rank, (t), (int)(b)->bytes_used); \ + if ((p)->finalized) { \ + (r) = PMIX_ERR_UNREACH; \ + } else { \ + snd = PMIX_NEW(pmix_ptl_send_t); \ + snd->hdr.pindex = htonl(pmix_globals.pindex); \ + snd->hdr.tag = htonl(t); \ + nbytes = (b)->bytes_used; \ + snd->hdr.nbytes = htonl(nbytes); \ + snd->data = (b); \ + /* always start with the header */ \ + snd->sdptr = (char*)&snd->hdr; \ + snd->sdbytes = sizeof(pmix_ptl_hdr_t); \ + /* if there is no message on-deck, put this one there */ \ + if (NULL == (p)->send_msg) { \ + (p)->send_msg = snd; \ + } else { \ + /* add it to the queue */ \ + pmix_list_append(&(p)->send_queue, &snd->super); \ + } \ + /* ensure the send event is active */ \ + if (!(p)->send_ev_active && 0 <= (p)->sd) { \ + (p)->send_ev_active = true; \ + PMIX_POST_OBJECT(snd); \ + pmix_event_add(&(p)->send_event, 0); \ + } \ + (r) = PMIX_SUCCESS; \ + } \ } while (0) #define CLOSE_THE_SOCKET(s) \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index 43fb426acb9..e921cd599c7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -13,7 +13,8 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,12 @@ #ifdef HAVE_SYS_STAT_H #include #endif +#ifdef HAVE_DIRENT_H #include +#endif +#ifdef HAVE_SYS_SYSCTL_H +#include +#endif #include "src/include/pmix_globals.h" #include "src/include/pmix_socket_errno.h" @@ -53,6 +59,7 @@ #include "src/util/os_path.h" #include "src/util/show_help.h" #include "src/mca/bfrops/base/base.h" +#include "src/mca/gds/gds.h" #include "src/mca/ptl/base/base.h" #include "ptl_tcp.h" @@ -77,8 +84,8 @@ pmix_ptl_module_t pmix_ptl_tcp_module = { .connect_to_peer = connect_to_peer }; -static pmix_status_t recv_connect_ack(int sd); -static pmix_status_t send_connect_ack(int sd); +static pmix_status_t recv_connect_ack(int sd, uint8_t myflag); +static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, pmix_info_t info[], size_t ninfo); static pmix_status_t init(void) @@ -109,10 +116,11 @@ static pmix_status_t parse_uri_file(char *filename, char **uri, char **nspace, pmix_rank_t *rank); -static pmix_status_t try_connect(char *uri, int *sd); +static pmix_status_t try_connect(char *uri, int *sd, pmix_info_t info[], size_t ninfo); static pmix_status_t df_search(char *dirname, char *prefix, + pmix_info_t info[], size_t ninfo, int *sd, char **nspace, - pmix_rank_t *rank); + pmix_rank_t *rank, char **uri); static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_info_t *info, size_t ninfo) @@ -120,14 +128,19 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, char *evar, **uri, *suri = NULL, *suri2 = NULL; char *filename, *nspace=NULL; pmix_rank_t rank = PMIX_RANK_WILDCARD; - char *p, *p2, *server_nspace = NULL; + char *p, *p2, *server_nspace = NULL, *rendfile = NULL; int sd, rc; size_t n; char myhost[PMIX_MAXHOSTNAMELEN]; bool system_level = false; bool system_level_only = false; bool reconnect = false; - pid_t pid = 0; + pid_t pid = 0, mypid; + pmix_list_t ilist; + pmix_info_caddy_t *kv; + pmix_info_t *iptr = NULL, mypidinfo, mycmdlineinfo, launcher; + size_t niptr = 0; + pmix_kval_t *urikv = NULL; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp: connecting to server"); @@ -200,14 +213,16 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, ++p2; nspace = strdup(p); rank = strtoull(p2, NULL, 10); + suri = strdup(uri[1]); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:client attempt connect to %s", uri[1]); /* go ahead and try to connect */ - if (PMIX_SUCCESS != (rc = try_connect(uri[1], &sd))) { + if (PMIX_SUCCESS != (rc = try_connect(uri[1], &sd, info, ninfo))) { free(nspace); pmix_argv_free(uri); + free(suri); return rc; } pmix_argv_free(uri); @@ -218,16 +233,17 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* get here if we are a tool - check any provided directives * to see where they want us to connect to */ suri = NULL; + PMIX_CONSTRUCT(&ilist, pmix_list_t); if (NULL != info) { for (n=0; n < ninfo; n++) { - if (0 == strcmp(info[n].key, PMIX_CONNECT_TO_SYSTEM)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_TO_SYSTEM)) { system_level_only = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strncmp(info[n].key, PMIX_CONNECT_SYSTEM_FIRST, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_SYSTEM_FIRST)) { /* try the system-level */ system_level = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strncmp(info[n].key, PMIX_SERVER_PIDINFO, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_PIDINFO)) { pid = info[n].value.data.pid; - } else if (0 == strncmp(info[n].key, PMIX_SERVER_NSPACE, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_NSPACE)) { if (NULL != server_nspace) { /* they included it more than once */ if (0 == strcmp(server_nspace, info[n].value.data.string)) { @@ -239,10 +255,13 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL != suri) { free(suri); } + if (NULL != rendfile) { + free(rendfile); + } return PMIX_ERR_BAD_PARAM; } server_nspace = strdup(info[n].value.data.string); - } else if (0 == strncmp(info[n].key, PMIX_SERVER_URI, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_URI)) { if (NULL != suri) { /* they included it more than once */ if (0 == strcmp(suri, info[n].value.data.string)) { @@ -254,18 +273,141 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL != server_nspace) { free(server_nspace); } + if (NULL != rendfile) { + free(rendfile); + } return PMIX_ERR_BAD_PARAM; } suri = strdup(info[n].value.data.string); - } else if (0 == strncmp(info[n].key, PMIX_CONNECT_RETRY_DELAY, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_RETRY_DELAY)) { mca_ptl_tcp_component.wait_to_connect = info[n].value.data.uint32; - } else if (0 == strncmp(info[n].key, PMIX_CONNECT_MAX_RETRIES, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_CONNECT_MAX_RETRIES)) { mca_ptl_tcp_component.max_retries = info[n].value.data.uint32; - } else if (0 == strncmp(info[n].key, PMIX_RECONNECT_SERVER, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_RECONNECT_SERVER)) { reconnect = true; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_LAUNCHER_RENDEZVOUS_FILE)) { + if (NULL != rendfile) { + free(rendfile); + } + rendfile = strdup(info[n].value.data.string); + } else { + /* need to pass this to server */ + kv = PMIX_NEW(pmix_info_caddy_t); + kv->info = &info[n]; + pmix_list_append(&ilist, &kv->super); } } } + /* add our pid to the array */ + kv = PMIX_NEW(pmix_info_caddy_t); + mypid = getpid(); + PMIX_INFO_LOAD(&mypidinfo, PMIX_PROC_PID, &mypid, PMIX_PID); + kv->info = &mypidinfo; + pmix_list_append(&ilist, &kv->super); + + /* if I am a launcher, tell them so */ + if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + kv = PMIX_NEW(pmix_info_caddy_t); + PMIX_INFO_LOAD(&launcher, PMIX_LAUNCHER, NULL, PMIX_BOOL); + kv->info = &launcher; + pmix_list_append(&ilist, &kv->super); + } + + /* add our cmd line to the array */ +#if PMIX_HAVE_APPLE + int mib[3], argmax, nargs, num; + size_t size; + char *procargs, *cp, *cptr; + char **stack = NULL; + + /* Get the maximum process arguments size. */ + mib[0] = CTL_KERN; + mib[1] = KERN_ARGMAX; + size = sizeof(argmax); + + if (sysctl(mib, 2, &argmax, &size, NULL, 0) == -1) { + fprintf(stderr, "sysctl() argmax failed\n"); + return -1; + } + + /* Allocate space for the arguments. */ + procargs = (char *)malloc(argmax); + if (procargs == NULL) + return -1; + + /* Make a sysctl() call to get the raw argument space of the process. */ + mib[0] = CTL_KERN; + mib[1] = KERN_PROCARGS2; + mib[2] = getpid(); + + size = (size_t)argmax; + + if (sysctl(mib, 3, procargs, &size, NULL, 0) == -1) { + fprintf(stderr, "Lacked permissions\n");; + return 0; + } + + memcpy(&nargs, procargs, sizeof(nargs)); + /* this points to the executable - skip over that to get the rest */ + cp = procargs + sizeof(nargs); + cp += strlen(cp); + /* this is the first argv */ + pmix_argv_append_nosize(&stack, cp); + /* skip any embedded NULLs */ + while (cp < &procargs[size] && '\0' == *cp) { + ++cp; + } + if (cp != &procargs[size]) { + /* from this point, we have the argv separated by NULLs - split them out */ + cptr = cp; + num = 0; + while (cp < &procargs[size] && num < nargs) { + if ('\0' == *cp) { + pmix_argv_append_nosize(&stack, cptr); + ++cp; // skip over the NULL + cptr = cp; + ++num; + } else { + ++cp; + } + } + } + p = pmix_argv_join(stack, ' '); + pmix_argv_free(stack); + free(procargs); +#else + char tmp[512]; + FILE *fp; + + /* open the pid's info file */ + snprintf(tmp, 512, "/proc/%lu/cmdline", (unsigned long)mypid); + fp = fopen(tmp, "r"); + if (NULL != fp) { + /* read the cmd line */ + fgets(tmp, 512, fp); + fclose(fp); + p = strdup(tmp); + } +#endif + /* pass it along */ + kv = PMIX_NEW(pmix_info_caddy_t); + PMIX_INFO_LOAD(&mycmdlineinfo, PMIX_CMD_LINE, p, PMIX_STRING); + kv->info = &mycmdlineinfo; + pmix_list_append(&ilist, &kv->super); + free(p); + + /* if we need to pass anything, setup an array */ + if (0 < (niptr = pmix_list_get_size(&ilist))) { + PMIX_INFO_CREATE(iptr, niptr); + n = 0; + while (NULL != (kv = (pmix_info_caddy_t*)pmix_list_remove_first(&ilist))) { + PMIX_INFO_XFER(&iptr[n], kv->info); + PMIX_RELEASE(kv); + ++n; + } + } + PMIX_LIST_DESTRUCT(&ilist); + if (NULL == suri && !reconnect && NULL != mca_ptl_tcp_component.super.uri) { suri = strdup(mca_ptl_tcp_component.super.uri); } @@ -288,6 +430,12 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, rc = parse_uri_file(&suri[5], &suri2, &nspace, &rank); if (PMIX_SUCCESS != rc) { free(suri); + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_UNREACH; } free(suri); @@ -297,6 +445,12 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, p = strchr(suri, ';'); if (NULL == p) { free(suri); + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_BAD_PARAM; } *p = '\0'; @@ -308,6 +462,12 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL == p) { free(suri2); free(suri); + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_BAD_PARAM; } *p = '\0'; @@ -321,18 +481,112 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp:tool attempt connect using given URI %s", suri); /* go ahead and try to connect */ - if (PMIX_SUCCESS != (rc = try_connect(suri, &sd))) { + if (PMIX_SUCCESS != (rc = try_connect(suri, &sd, iptr, niptr))) { if (NULL != nspace) { free(nspace); } free(suri); + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return rc; } + /* cleanup */ free(suri); suri = NULL; + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } goto complete; } + /* if they gave us a rendezvous file, use it */ + if (NULL != rendfile) { + /* try to read the file */ + rc = parse_uri_file(rendfile, &suri, &nspace, &rank); + free(rendfile); + rendfile = NULL; + if (PMIX_SUCCESS == rc) { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "ptl:tcp:tool attempt connect to system server at %s", suri); + /* go ahead and try to connect */ + if (PMIX_SUCCESS == try_connect(suri, &sd, iptr, niptr)) { + /* don't free nspace - we will use it below */ + if (NULL != rendfile) { + free(rendfile); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + goto complete; + } + } + /* cleanup */ + if (NULL != nspace) { + free(nspace); + } + if (NULL != suri) { + free(suri); + } + free(rendfile); + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + /* since they gave us a specific rendfile and we couldn't + * connect to it, return an error */ + return PMIX_ERR_UNREACH; + } + + /* if they asked for system-level first or only, we start there */ + if (system_level || system_level_only) { + if (0 > asprintf(&filename, "%s/pmix.sys.%s", mca_ptl_tcp_component.system_tmpdir, myhost)) { + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + return PMIX_ERR_NOMEM; + } + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "ptl:tcp:tool looking for system server at %s", + filename); + /* try to read the file */ + rc = parse_uri_file(filename, &suri, &nspace, &rank); + free(filename); + if (PMIX_SUCCESS == rc) { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "ptl:tcp:tool attempt connect to system server at %s", suri); + /* go ahead and try to connect */ + if (PMIX_SUCCESS == try_connect(suri, &sd, iptr, niptr)) { + /* don't free nspace - we will use it below */ + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + goto complete; + } + free(nspace); + } + } + + /* we get here if they either didn't ask for a system-level connection, + * or they asked for it and it didn't succeed. If they _only_ wanted + * a system-level connection, then we are done */ + if (system_level_only) { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "ptl:tcp: connecting to system failed"); + if (NULL != suri) { + free(suri); + } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } + return PMIX_ERR_UNREACH; + } + /* if they gave us a pid, then look for it */ if (0 != pid) { if (NULL != server_nspace) { @@ -340,6 +594,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, server_nspace = NULL; } if (0 > asprintf(&filename, "pmix.%s.tool.%d", myhost, pid)) { + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_NOMEM; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, @@ -347,14 +604,20 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, filename); nspace = NULL; rc = df_search(mca_ptl_tcp_component.system_tmpdir, - filename, &sd, &nspace, &rank); + filename, iptr, niptr, &sd, &nspace, &rank, &suri); free(filename); if (PMIX_SUCCESS == rc) { goto complete; } + if (NULL != suri) { + free(suri); + } if (NULL != nspace) { free(nspace); } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } /* since they gave us a specific pid and we couldn't * connect to it, return an error */ return PMIX_ERR_UNREACH; @@ -364,6 +627,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL != server_nspace) { if (0 > asprintf(&filename, "pmix.%s.tool.%s", myhost, server_nspace)) { free(server_nspace); + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_NOMEM; } free(server_nspace); @@ -373,54 +639,25 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, filename); nspace = NULL; rc = df_search(mca_ptl_tcp_component.system_tmpdir, - filename, &sd, &nspace, &rank); + filename, iptr, niptr, &sd, &nspace, &rank, &suri); free(filename); if (PMIX_SUCCESS == rc) { goto complete; } + if (NULL != suri) { + free(suri); + } if (NULL != nspace) { free(nspace); } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } /* since they gave us a specific nspace and we couldn't * connect to it, return an error */ return PMIX_ERR_UNREACH; } - /* if they asked for system-level, we start there */ - if (system_level || system_level_only) { - if (0 > asprintf(&filename, "%s/pmix.sys.%s", mca_ptl_tcp_component.system_tmpdir, myhost)) { - return PMIX_ERR_NOMEM; - } - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:tcp:tool looking for system server at %s", - filename); - /* try to read the file */ - rc = parse_uri_file(filename, &suri, &nspace, &rank); - free(filename); - if (PMIX_SUCCESS == rc) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:tcp:tool attempt connect to system server at %s", suri); - /* go ahead and try to connect */ - if (PMIX_SUCCESS == try_connect(suri, &sd)) { - /* don't free nspace - we will use it below */ - goto complete; - } - free(nspace); - } - } - - /* we get here if they either didn't ask for a system-level connection, - * or they asked for it and it didn't succeed. If they _only_ wanted - * a system-level connection, then we are done */ - if (system_level_only) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "ptl:tcp: connecting to system failed"); - if (NULL != suri) { - free(suri); - } - return PMIX_ERR_UNREACH; - } - /* they didn't give us a pid, so we will search to see what session-level * tools are available to this user. We will take the first connection * that succeeds - this is based on the likelihood that there is only @@ -430,6 +667,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL != suri) { free(suri); } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_NOMEM; } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, @@ -437,7 +677,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, filename); nspace = NULL; rc = df_search(mca_ptl_tcp_component.system_tmpdir, - filename, &sd, &nspace, &rank); + filename, iptr, niptr, &sd, &nspace, &rank, &suri); free(filename); if (PMIX_SUCCESS != rc) { if (NULL != nspace){ @@ -446,12 +686,18 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, if (NULL != suri) { free(suri); } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } return PMIX_ERR_UNREACH; } + if (NULL != iptr) { + PMIX_INFO_FREE(iptr, niptr); + } complete: pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "sock_peer_try_connect: Connection across to server succeeded"); + "tcp_peer_try_connect: Connection across to server succeeded"); /* do a final bozo check */ if (NULL == nspace || PMIX_RANK_WILDCARD == rank) { @@ -476,7 +722,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); } if (NULL == pmix_client_globals.myserver->nptr) { - pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t); + pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); } if (NULL != pmix_client_globals.myserver->nptr->nspace) { free(pmix_client_globals.myserver->nptr->nspace); @@ -489,6 +735,16 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_client_globals.myserver->info->pname.nspace = strdup(pmix_client_globals.myserver->nptr->nspace); pmix_client_globals.myserver->info->pname.rank = rank; } + /* store the URI for subsequent lookups */ + urikv = PMIX_NEW(pmix_kval_t); + urikv->key = strdup(PMIX_SERVER_URI); + PMIX_VALUE_CREATE(urikv->value, 1); + urikv->value->type = PMIX_STRING; + asprintf(&urikv->value->data.string, "%s.%u;%s", nspace, rank, suri); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, PMIX_INTERNAL, + urikv); + PMIX_RELEASE(urikv); // maintain accounting pmix_ptl_base_set_nonblocking(sd); @@ -680,14 +936,15 @@ static pmix_status_t parse_uri_file(char *filename, return PMIX_SUCCESS; } -static pmix_status_t try_connect(char *uri, int *sd) +static pmix_status_t try_connect(char *uri, int *sd, pmix_info_t iptr[], size_t niptr) { char *p, *p2, *host; struct sockaddr_in *in; struct sockaddr_in6 *in6; size_t len; pmix_status_t rc; - bool retried = false; + int retries = 0; + uint8_t myflag; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix:tcp try connect to %s", uri); @@ -771,29 +1028,28 @@ static pmix_status_t try_connect(char *uri, int *sd) } /* send our identity and any authentication credentials to the server */ - if (PMIX_SUCCESS != (rc = send_connect_ack(*sd))) { + if (PMIX_SUCCESS != (rc = send_connect_ack(*sd, &myflag, iptr, niptr))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(*sd); return rc; } /* do whatever handshake is required */ - if (PMIX_SUCCESS != (rc = recv_connect_ack(*sd))) { + if (PMIX_SUCCESS != (rc = recv_connect_ack(*sd, myflag))) { CLOSE_THE_SOCKET(*sd); if (PMIX_ERR_TEMP_UNAVAILABLE == rc) { - /* give it two tries */ - if (!retried) { - retried = true; + ++retries; + if( retries < mca_ptl_tcp_component.handshake_max_retries ) { goto retry; } } - PMIX_ERROR_LOG(rc); return rc; } return PMIX_SUCCESS; } -static pmix_status_t send_connect_ack(int sd) +static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, + pmix_info_t iptr[], size_t niptr) { char *msg; pmix_ptl_hdr_t hdr; @@ -806,7 +1062,7 @@ static pmix_status_t send_connect_ack(int sd) uid_t euid; gid_t egid; uint32_t u32; - bool self_defined = false; + pmix_buffer_t buf; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix:tcp SEND CONNECT ACK"); @@ -814,6 +1070,7 @@ static pmix_status_t send_connect_ack(int sd) /* if we are a server, then we shouldn't be here */ if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; } @@ -837,35 +1094,68 @@ static pmix_status_t send_connect_ack(int sd) /* allow space for a marker indicating client vs tool */ sdsize = 1; - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + /* Defined marker values: + * + * 0 => simple client process + * 1 => legacy tool - may or may not have an identifier + * 2 => legacy launcher - may or may not have an identifier + * ------------------------------------------ + * 3 => self-started tool process that needs an identifier + * 4 => self-started tool process that was given an identifier by caller + * 5 => tool that was started by a PMIx server - identifier specified by server + * 6 => self-started launcher that needs an identifier + * 7 => self-started launcher that was given an identifier by caller + * 8 => launcher that was started by a PMIx server - identifier specified by server + */ + if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + /* if we are both launcher and client, then we need + * to tell the server we are both */ + flag = 8; + /* add space for our uid/gid for ACL purposes */ + sdsize += 2*sizeof(uint32_t); + /* add space for our identifier */ + sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); + } else { + /* add space for our uid/gid for ACL purposes */ + sdsize += 2*sizeof(uint32_t); + /* if they gave us an identifier, we need to pass it */ + if (0 < strlen(pmix_globals.myid.nspace) && + PMIX_RANK_INVALID != pmix_globals.myid.rank) { + flag = 7; + sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); + } else { + flag = 6; + } + } + + } else if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer) && + !PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + /* we are a simple client */ flag = 0; /* reserve space for our nspace and rank info */ sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); - } else if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { - flag = 2; - /* add space for our uid/gid for ACL purposes */ - sdsize += 2*sizeof(uint32_t); - /* if we already have an identifier, we need to pass it */ - if (0 < strlen(pmix_globals.myid.nspace) && - PMIX_RANK_INVALID != pmix_globals.myid.rank) { - sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t) + 1; - self_defined = true; - } else { - ++sdsize; // need space for the flag indicating if have id - } - } else { // must be a simple tool - flag = 1; + + } else { // must be a tool of some sort /* add space for our uid/gid for ACL purposes */ sdsize += 2*sizeof(uint32_t); - /* if we self-defined an identifier, we need to pass it */ - if (0 < strlen(pmix_globals.myid.nspace) && + if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + /* if we are both tool and client, then we need + * to tell the server we are both */ + flag = 5; + /* add space for our identifier */ + sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); + } else if (0 < strlen(pmix_globals.myid.nspace) && PMIX_RANK_INVALID != pmix_globals.myid.rank) { - sdsize += 1 + strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); - self_defined = true; + /* we were given an identifier by the caller, pass it */ + sdsize += strlen(pmix_globals.myid.nspace) + 1 + sizeof(uint32_t); + flag = 4; } else { - ++sdsize; // need space for the flag indicating if have id + /* we are a self-started tool that needs an identifier */ + flag = 3; } } + *myflag = flag; /* add the name of our active sec module - we selected it * in pmix_client.c prior to entering here */ @@ -879,16 +1169,26 @@ static pmix_status_t send_connect_ack(int sd) /* add our active gds module for working with the server */ gds = (char*)pmix_client_globals.myserver->nptr->compat.gds->name; - /* set the number of bytes to be read beyond the header */ + /* if we were given info structs to pass to the server, pack them */ + PMIX_CONSTRUCT(&buf, pmix_buffer_t); + if (NULL != iptr) { + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &niptr, 1, PMIX_SIZE); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, iptr, niptr, PMIX_INFO); + } + + /* set the number of bytes to be read beyond the header - must + * NULL terminate the strings! */ hdr.nbytes = sdsize + strlen(PMIX_VERSION) + 1 + strlen(sec) + 1 \ + strlen(bfrops) + 1 + sizeof(bftype) \ - + strlen(gds) + 1 + sizeof(uint32_t) + cred.size; // must NULL terminate the strings! + + strlen(gds) + 1 + sizeof(uint32_t) + cred.size \ + + buf.bytes_used; /* create a space for our message */ sdsize = (sizeof(hdr) + hdr.nbytes); if (NULL == (msg = (char*)malloc(sdsize))) { PMIX_BYTE_OBJECT_DESTRUCT(&cred); free(sec); + PMIX_DESTRUCT(&buf); return PMIX_ERR_OUT_OF_RESOURCE; } memset(msg, 0, sdsize); @@ -920,7 +1220,7 @@ static pmix_status_t send_connect_ack(int sd) memcpy(msg+csize, &flag, 1); csize += 1; - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (0 == flag) { /* if we are a client, provide our nspace/rank */ memcpy(msg+csize, pmix_globals.myid.nspace, strlen(pmix_globals.myid.nspace)); csize += strlen(pmix_globals.myid.nspace)+1; @@ -928,9 +1228,8 @@ static pmix_status_t send_connect_ack(int sd) u32 = htonl((uint32_t)pmix_globals.myid.rank); memcpy(msg+csize, &u32, sizeof(uint32_t)); csize += sizeof(uint32_t); - } else { - /* if we are a tool, provide our uid/gid for ACL support - note - * that we have to convert so we can handle heterogeneity */ + } else if (3 == flag || 6 == flag) { + /* we are a tool or launcher that needs an identifier - add our ACLs */ euid = geteuid(); u32 = htonl(euid); memcpy(msg+csize, &u32, sizeof(uint32_t)); @@ -939,6 +1238,27 @@ static pmix_status_t send_connect_ack(int sd) u32 = htonl(egid); memcpy(msg+csize, &u32, sizeof(uint32_t)); csize += sizeof(uint32_t); + } else if (4 == flag || 5 == flag || 7 == flag || 8 == flag) { + /* we are a tool or launcher that has an identifier - start with our ACLs */ + euid = geteuid(); + u32 = htonl(euid); + memcpy(msg+csize, &u32, sizeof(uint32_t)); + csize += sizeof(uint32_t); + egid = getegid(); + u32 = htonl(egid); + memcpy(msg+csize, &u32, sizeof(uint32_t)); + csize += sizeof(uint32_t); + /* now add our identifier */ + memcpy(msg+csize, pmix_globals.myid.nspace, strlen(pmix_globals.myid.nspace)); + csize += strlen(pmix_globals.myid.nspace)+1; + /* again, need to convert */ + u32 = htonl((uint32_t)pmix_globals.myid.rank); + memcpy(msg+csize, &u32, sizeof(uint32_t)); + csize += sizeof(uint32_t); + } else { + /* not a valid flag */ + PMIX_DESTRUCT(&buf); + return PMIX_ERR_NOT_SUPPORTED; } /* provide our version */ @@ -957,46 +1277,33 @@ static pmix_status_t send_connect_ack(int sd) memcpy(msg+csize, gds, strlen(gds)); csize += strlen(gds)+1; - /* if we are not a client and self-defined an identifier, we need to pass it */ - if (!PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { - if (self_defined) { - flag = 1; - memcpy(msg+csize, &flag, 1); - ++csize; - memcpy(msg+csize, pmix_globals.myid.nspace, strlen(pmix_globals.myid.nspace)); - csize += strlen(pmix_globals.myid.nspace)+1; - /* again, need to convert */ - u32 = htonl((uint32_t)pmix_globals.myid.rank); - memcpy(msg+csize, &u32, sizeof(uint32_t)); - csize += sizeof(uint32_t); - } else { - flag = 0; - memcpy(msg+csize, &flag, 1); - ++csize; - } - } + /* provide the info struct bytes */ + memcpy(msg+csize, buf.base_ptr, buf.bytes_used); + csize += buf.bytes_used; /* send the entire message across */ if (PMIX_SUCCESS != pmix_ptl_base_send_blocking(sd, msg, sdsize)) { free(msg); + PMIX_DESTRUCT(&buf); return PMIX_ERR_UNREACH; } free(msg); + PMIX_DESTRUCT(&buf); return PMIX_SUCCESS; } /* we receive a connection acknowledgement from the server, * consisting of nothing more than a status report. If success, * then we initiate authentication method */ -static pmix_status_t recv_connect_ack(int sd) +static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) { pmix_status_t reply; pmix_status_t rc; struct timeval tv, save; pmix_socklen_t sz; bool sockopt = true; + pmix_nspace_t nspace; uint32_t u32; - char nspace[PMIX_MAX_NSLEN+1]; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix: RECV CONNECT ACK FROM SERVER"); @@ -1011,12 +1318,16 @@ static pmix_status_t recv_connect_ack(int sd) } } else { /* set a timeout on the blocking recv so we don't hang */ - tv.tv_sec = 2; + tv.tv_sec = mca_ptl_tcp_component.handshake_wait_time; tv.tv_usec = 0; if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "pmix: recv_connect_ack could not setsockopt SO_RCVTIMEO"); - return PMIX_ERR_UNREACH; + if (ENOPROTOOPT == errno || EOPNOTSUPP == errno) { + sockopt = false; + } else { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "pmix: recv_connect_ack could not setsockopt SO_RCVTIMEO"); + return PMIX_ERR_UNREACH; + } } } @@ -1033,7 +1344,7 @@ static pmix_status_t recv_connect_ack(int sd) } reply = ntohl(u32); - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (0 == myflag) { /* see if they want us to do the handshake */ if (PMIX_ERR_READY_FOR_HANDSHAKE == reply) { PMIX_PSEC_CLIENT_HANDSHAKE(rc, pmix_client_globals.myserver, sd); @@ -1055,26 +1366,23 @@ static pmix_status_t recv_connect_ack(int sd) } else { // we are a tool /* if the status indicates an error, then we are done */ if (PMIX_SUCCESS != reply) { - PMIX_ERROR_LOG(reply); return reply; } - /* recv our nspace */ - rc = pmix_ptl_base_recv_blocking(sd, nspace, PMIX_MAX_NSLEN+1); - if (PMIX_SUCCESS != rc) { - return rc; - } - /* if we already have our nspace, then just verify it matches */ - if (0 < strlen(pmix_globals.myid.nspace)) { - if (0 != strncmp(pmix_globals.myid.nspace, nspace, PMIX_MAX_NSLEN)) { - return PMIX_ERR_INIT; + /* if we needed an identifier, recv it */ + if (3 == myflag || 6 == myflag) { + /* first the nspace */ + rc = pmix_ptl_base_recv_blocking(sd, (char*)&nspace, PMIX_MAX_NSLEN+1); + if (PMIX_SUCCESS != rc) { + return rc; } - } else { - (void)strncpy(pmix_globals.myid.nspace, nspace, PMIX_MAX_NSLEN); - } - /* if we already have a rank, then leave it alone */ - if (PMIX_RANK_INVALID == pmix_globals.myid.rank) { - /* our rank is always zero */ - pmix_globals.myid.rank = 0; + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, nspace); + /* now the rank */ + rc = pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(uint32_t)); + if (PMIX_SUCCESS != rc) { + return rc; + } + /* convert and store */ + pmix_globals.myid.rank = htonl(u32); } /* get the server's nspace and rank so we can send to it */ @@ -1082,7 +1390,7 @@ static pmix_status_t recv_connect_ack(int sd) pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); } if (NULL == pmix_client_globals.myserver->nptr) { - pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t); + pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); } pmix_ptl_base_recv_blocking(sd, (char*)nspace, PMIX_MAX_NSLEN+1); if (NULL != pmix_client_globals.myserver->nptr->nspace) { @@ -1093,7 +1401,8 @@ static pmix_status_t recv_connect_ack(int sd) free(pmix_client_globals.myserver->info->pname.nspace); } pmix_client_globals.myserver->info->pname.nspace = strdup(nspace); - pmix_ptl_base_recv_blocking(sd, (char*)&(pmix_client_globals.myserver->info->pname.rank), sizeof(int)); + pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(uint32_t)); + pmix_client_globals.myserver->info->pname.rank = htonl(u32); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix: RECV CONNECT CONFIRMATION FOR TOOL %s:%d FROM SERVER %s:%d", @@ -1127,8 +1436,9 @@ static pmix_status_t recv_connect_ack(int sd) } static pmix_status_t df_search(char *dirname, char *prefix, + pmix_info_t info[], size_t ninfo, int *sd, char **nspace, - pmix_rank_t *rank) + pmix_rank_t *rank, char **uri) { char *suri, *nsp, *newdir; pmix_rank_t rk; @@ -1158,7 +1468,7 @@ static pmix_status_t df_search(char *dirname, char *prefix, } /* if it is a directory, down search */ if (S_ISDIR(buf.st_mode)) { - rc = df_search(newdir, prefix, sd, nspace, rank); + rc = df_search(newdir, prefix, info, ninfo, sd, nspace, rank, uri); free(newdir); if (PMIX_SUCCESS == rc) { closedir(cur_dirp); @@ -1178,11 +1488,11 @@ static pmix_status_t df_search(char *dirname, char *prefix, /* go ahead and try to connect */ pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "pmix:tcp: attempting to connect to %s", suri); - if (PMIX_SUCCESS == try_connect(suri, sd)) { + if (PMIX_SUCCESS == try_connect(suri, sd, info, ninfo)) { (*nspace) = nsp; *rank = rk; closedir(cur_dirp); - free(suri); + *uri = suri; free(newdir); return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h index dd92a893818..f5373f65069 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,10 +49,13 @@ typedef struct { char *session_filename; char *nspace_filename; char *system_filename; + char *rendezvous_filename; int wait_to_connect; int max_retries; char *report_uri; bool remote_connections; + int handshake_wait_time; + int handshake_max_retries; } pmix_ptl_tcp_component_t; extern pmix_ptl_tcp_component_t mca_ptl_tcp_component; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index a880faa9c8d..7f3138d52c6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -12,9 +12,10 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,6 +61,7 @@ #include "src/util/os_path.h" #include "src/util/parse_options.h" #include "src/util/pif.h" +#include "src/util/pmix_environ.h" #include "src/util/show_help.h" #include "src/util/strnlen.h" #include "src/common/pmix_iof.h" @@ -116,10 +118,13 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env); .session_filename = NULL, .nspace_filename = NULL, .system_filename = NULL, + .rendezvous_filename = NULL, .wait_to_connect = 4, .max_retries = 2, .report_uri = NULL, - .remote_connections = false + .remote_connections = false, + .handshake_wait_time = 4, + .handshake_max_retries = 2 }; static char **split_and_resolve(char **orig_str, char *name); @@ -148,7 +153,7 @@ static int component_register(void) (void)pmix_mca_base_component_var_register(component, "remote_connections", "Enable connections from remote tools", - PMIX_MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + PMIX_MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, PMIX_INFO_LVL_2, PMIX_MCA_BASE_VAR_SCOPE_LOCAL, &mca_ptl_tcp_component.remote_connections); @@ -220,6 +225,20 @@ static int component_register(void) PMIX_MCA_BASE_VAR_SCOPE_READONLY, &mca_ptl_tcp_component.max_retries); + (void)pmix_mca_base_component_var_register(component, "handshake_wait_time", + "Number of seconds to wait for the server reply to the handshake request", + PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + PMIX_INFO_LVL_4, + PMIX_MCA_BASE_VAR_SCOPE_READONLY, + &mca_ptl_tcp_component.handshake_wait_time); + + (void)pmix_mca_base_component_var_register(component, "handshake_max_retries", + "Number of times to retry the handshake request before giving up", + PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + PMIX_INFO_LVL_4, + PMIX_MCA_BASE_VAR_SCOPE_READONLY, + &mca_ptl_tcp_component.handshake_max_retries); + return PMIX_SUCCESS; } @@ -233,31 +252,28 @@ static pmix_status_t component_open(void) /* check for environ-based directives * on system tmpdir to use */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || + PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { mca_ptl_tcp_component.session_tmpdir = strdup(pmix_server_globals.tmpdir); } else { if (NULL != (tdir = getenv("PMIX_SERVER_TMPDIR"))) { mca_ptl_tcp_component.session_tmpdir = strdup(tdir); + } else { + mca_ptl_tcp_component.session_tmpdir = strdup(pmix_tmp_directory()); } } - if (NULL != (tdir = getenv("PMIX_SYSTEM_TMPDIR"))) { - mca_ptl_tcp_component.system_tmpdir = strdup(tdir); - } - - if (NULL == (tdir = getenv("TMPDIR"))) { - if (NULL == (tdir = getenv("TEMP"))) { - if (NULL == (tdir = getenv("TMP"))) { - tdir = "/tmp"; - } + if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || + PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + mca_ptl_tcp_component.system_tmpdir = strdup(pmix_server_globals.system_tmpdir); + } else { + if (NULL != (tdir = getenv("PMIX_SYSTEM_TMPDIR"))) { + mca_ptl_tcp_component.system_tmpdir = strdup(tdir); + } else { + mca_ptl_tcp_component.system_tmpdir = strdup(pmix_tmp_directory()); } } - if (NULL == mca_ptl_tcp_component.session_tmpdir) { - mca_ptl_tcp_component.session_tmpdir = strdup(tdir); - } - if (NULL == mca_ptl_tcp_component.system_tmpdir) { - mca_ptl_tcp_component.system_tmpdir = strdup(tdir); - } + if (NULL != mca_ptl_tcp_component.report_uri && 0 != strcmp(mca_ptl_tcp_component.report_uri, "-") && 0 != strcmp(mca_ptl_tcp_component.report_uri, "+")) { @@ -271,12 +287,19 @@ pmix_status_t component_close(void) { if (NULL != mca_ptl_tcp_component.system_filename) { unlink(mca_ptl_tcp_component.system_filename); + free(mca_ptl_tcp_component.system_filename); } if (NULL != mca_ptl_tcp_component.session_filename) { unlink(mca_ptl_tcp_component.session_filename); + free(mca_ptl_tcp_component.session_filename); } if (NULL != mca_ptl_tcp_component.nspace_filename) { unlink(mca_ptl_tcp_component.nspace_filename); + free(mca_ptl_tcp_component.nspace_filename); + } + if (NULL != mca_ptl_tcp_component.rendezvous_filename) { + unlink(mca_ptl_tcp_component.rendezvous_filename); + free(mca_ptl_tcp_component.rendezvous_filename); } if (NULL != urifile) { /* remove the file */ @@ -301,19 +324,8 @@ static int component_query(pmix_mca_base_module_t **module, int *priority) static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env) { - char *evar; - - if (0 > asprintf(&evar, "PMIX_SERVER_TMPDIR=%s", mca_ptl_tcp_component.session_tmpdir)) { - return PMIX_ERR_NOMEM; - } - pmix_argv_append_nosize(env, evar); - free(evar); - - if (0 > asprintf(&evar, "PMIX_SYSTEM_TMPDIR=%s", mca_ptl_tcp_component.system_tmpdir)) { - return PMIX_ERR_NOMEM; - } - pmix_argv_append_nosize(env, evar); - free(evar); + pmix_setenv("PMIX_SERVER_TMPDIR", mca_ptl_tcp_component.session_tmpdir, true, env); + pmix_setenv("PMIX_SYSTEM_TMPDIR", mca_ptl_tcp_component.system_tmpdir, true, env); return PMIX_SUCCESS; } @@ -345,6 +357,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, char *prefix, myhost[PMIX_MAXHOSTNAMELEN]; char myconnhost[PMIX_MAXHOSTNAMELEN]; int myport; + pmix_kval_t *urikv; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp setup_listener"); @@ -357,51 +370,54 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, /* scan the info keys and process any override instructions */ if (NULL != info) { for (n=0; n < ninfo; n++) { - if (0 == strcmp(info[n].key, PMIX_TCP_IF_INCLUDE)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_IF_INCLUDE)) { if (NULL != mca_ptl_tcp_component.if_include) { free(mca_ptl_tcp_component.if_include); } mca_ptl_tcp_component.if_include = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_TCP_IF_EXCLUDE)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_IF_EXCLUDE)) { if (NULL != mca_ptl_tcp_component.if_exclude) { free(mca_ptl_tcp_component.if_exclude); } mca_ptl_tcp_component.if_exclude = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_TCP_IPV4_PORT)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_IPV4_PORT)) { mca_ptl_tcp_component.ipv4_port = info[n].value.data.integer; - } else if (0 == strcmp(info[n].key, PMIX_TCP_IPV6_PORT)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_IPV6_PORT)) { mca_ptl_tcp_component.ipv6_port = info[n].value.data.integer; - } else if (0 == strcmp(info[n].key, PMIX_TCP_DISABLE_IPV4)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_DISABLE_IPV4)) { mca_ptl_tcp_component.disable_ipv4_family = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strcmp(info[n].key, PMIX_TCP_DISABLE_IPV6)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_DISABLE_IPV6)) { mca_ptl_tcp_component.disable_ipv6_family = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strcmp(info[n].key, PMIX_SERVER_REMOTE_CONNECTIONS)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_REMOTE_CONNECTIONS)) { mca_ptl_tcp_component.remote_connections = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strcmp(info[n].key, PMIX_TCP_URI)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_URI)) { if (NULL != mca_ptl_tcp_component.super.uri) { free(mca_ptl_tcp_component.super.uri); } mca_ptl_tcp_component.super.uri = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_TCP_REPORT_URI)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TCP_REPORT_URI)) { if (NULL != mca_ptl_tcp_component.report_uri) { free(mca_ptl_tcp_component.report_uri); } mca_ptl_tcp_component.report_uri = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_SERVER_TMPDIR)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_TMPDIR)) { if (NULL != mca_ptl_tcp_component.session_tmpdir) { free(mca_ptl_tcp_component.session_tmpdir); } mca_ptl_tcp_component.session_tmpdir = strdup(info[n].value.data.string); - } else if (0 == strcmp(info[n].key, PMIX_SYSTEM_TMPDIR)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SYSTEM_TMPDIR)) { if (NULL != mca_ptl_tcp_component.system_tmpdir) { free(mca_ptl_tcp_component.system_tmpdir); } mca_ptl_tcp_component.system_tmpdir = strdup(info[n].value.data.string); } else if (0 == strcmp(info[n].key, PMIX_SERVER_TOOL_SUPPORT)) { session_tool = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strcmp(info[n].key, PMIX_SERVER_SYSTEM_SUPPORT)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_SYSTEM_SUPPORT)) { system_tool = PMIX_INFO_TRUE(&info[n]); - } + } else if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer) && + PMIX_CHECK_KEY(&info[n], PMIX_LAUNCHER_RENDEZVOUS_FILE)) { + mca_ptl_tcp_component.rendezvous_filename = strdup(info[n].value.data.string); + } } } @@ -625,6 +641,16 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp URI %s", lt->uri); + /* save the URI internally so we can report it */ + urikv = PMIX_NEW(pmix_kval_t); + urikv->key = strdup(PMIX_SERVER_URI); + PMIX_VALUE_CREATE(urikv->value, 1); + PMIX_VALUE_LOAD(urikv->value, lt->uri, PMIX_STRING); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, PMIX_INTERNAL, + urikv); + PMIX_RELEASE(urikv); // maintain accounting + if (NULL != mca_ptl_tcp_component.report_uri) { /* if the string is a "-", then output to stdout */ if (0 == strcmp(mca_ptl_tcp_component.report_uri, "-")) { @@ -652,6 +678,38 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, } } + /* if we were given a rendezvous file, then drop it */ + if (NULL != mca_ptl_tcp_component.rendezvous_filename) { + FILE *fp; + + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "WRITING RENDEZVOUS FILE %s", + mca_ptl_tcp_component.rendezvous_filename); + fp = fopen(mca_ptl_tcp_component.rendezvous_filename, "w"); + if (NULL == fp) { + pmix_output(0, "Impossible to open the file %s in write mode\n", mca_ptl_tcp_component.rendezvous_filename); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.rendezvous_filename); + mca_ptl_tcp_component.rendezvous_filename = NULL; + goto sockerror; + } + + /* output my nspace and rank plus the URI */ + fprintf(fp, "%s\n", lt->uri); + /* add a flag that indicates we accept v3.0 protocols */ + fprintf(fp, "v%s\n", PMIX_VERSION); + fclose(fp); + /* set the file mode */ + if (0 != chmod(mca_ptl_tcp_component.rendezvous_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.rendezvous_filename); + mca_ptl_tcp_component.rendezvous_filename = NULL; + goto sockerror; + } + } + /* if we are going to support tools, then drop contact file(s) */ if (system_tool) { FILE *fp; @@ -906,14 +964,14 @@ static void connection_handler(int sd, short args, void *cbdata) char *nspace; uint32_t len, u32; size_t cnt, msglen, n; - uint8_t flag; - pmix_nspace_t *nptr, *tmp; + pmix_namespace_t *nptr, *tmp; bool found; pmix_rank_info_t *info; pmix_proc_t proc; pmix_info_t ginfo; pmix_proc_type_t proc_type; pmix_byte_object_t cred; + pmix_buffer_t buf; /* acquire the object */ PMIX_ACQUIRE_OBJECT(pnd); @@ -1008,7 +1066,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* get the process type of the connecting peer */ if (1 <= cnt) { - memcpy(&flag, mg, 1); + memcpy(&pnd->flag, mg, 1); ++mg; --cnt; } else { @@ -1018,7 +1076,7 @@ static void connection_handler(int sd, short args, void *cbdata) goto error; } - if (0 == flag) { + if (0 == pnd->flag) { /* they must be a client, so get their nspace/rank */ proc_type = PMIX_PROC_CLIENT; PMIX_STRNLEN(msglen, mg, cnt); @@ -1045,7 +1103,7 @@ static void connection_handler(int sd, short args, void *cbdata) rc = PMIX_ERR_BAD_PARAM; goto error; } - } else if (1 == flag) { + } else if (1 == pnd->flag) { /* they are a tool */ proc_type = PMIX_PROC_TOOL; /* extract the uid/gid */ @@ -1071,7 +1129,7 @@ static void connection_handler(int sd, short args, void *cbdata) rc = PMIX_ERR_BAD_PARAM; goto error; } - } else if (2 == flag) { + } else if (2 == pnd->flag) { /* they are a launcher */ proc_type = PMIX_PROC_LAUNCHER; /* extract the uid/gid */ @@ -1097,8 +1155,95 @@ static void connection_handler(int sd, short args, void *cbdata) rc = PMIX_ERR_BAD_PARAM; goto error; } + } else if (3 == pnd->flag || 6 == pnd->flag) { + /* they are a tool or launcher that needs an identifier */ + if (3 == pnd->flag) { + proc_type = PMIX_PROC_TOOL; + } else { + proc_type = PMIX_PROC_LAUNCHER; + } + /* extract the uid/gid */ + if (sizeof(uint32_t) <= cnt) { + memcpy(&u32, mg, sizeof(uint32_t)); + mg += sizeof(uint32_t); + cnt -= sizeof(uint32_t); + pnd->uid = ntohl(u32); + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } + if (sizeof(uint32_t) <= cnt) { + memcpy(&u32, mg, sizeof(uint32_t)); + mg += sizeof(uint32_t); + cnt -= sizeof(uint32_t); + pnd->gid = ntohl(u32); + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } + /* they need an id */ + pnd->need_id = true; + } else if (4 == pnd->flag || 5 == pnd->flag || 7 == pnd->flag || 8 == pnd->flag) { + /* they are a tool or launcher that has an identifier - start with our ACLs */ + if (4 == pnd->flag || 5 == pnd->flag) { + proc_type = PMIX_PROC_TOOL; + } else { + proc_type = PMIX_PROC_LAUNCHER; + } + /* extract the uid/gid */ + if (sizeof(uint32_t) <= cnt) { + memcpy(&u32, mg, sizeof(uint32_t)); + mg += sizeof(uint32_t); + cnt -= sizeof(uint32_t); + pnd->uid = ntohl(u32); + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } + if (sizeof(uint32_t) <= cnt) { + memcpy(&u32, mg, sizeof(uint32_t)); + mg += sizeof(uint32_t); + cnt -= sizeof(uint32_t); + pnd->gid = ntohl(u32); + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } + PMIX_STRNLEN(msglen, mg, cnt); + if (msglen < cnt) { + nspace = mg; + mg += strlen(nspace) + 1; + cnt -= strlen(nspace) + 1; + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } + + if (sizeof(pmix_rank_t) <= cnt) { + /* have to convert this to host order */ + memcpy(&u32, mg, sizeof(uint32_t)); + rank = ntohl(u32); + mg += sizeof(uint32_t); + cnt -= sizeof(uint32_t); + } else { + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_BAD_PARAM; + goto error; + } } else { /* we don't know what they are! */ + PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); rc = PMIX_ERR_NOT_SUPPORTED; free(msg); goto error; @@ -1123,7 +1268,7 @@ static void connection_handler(int sd, short args, void *cbdata) proc_type = proc_type | PMIX_PROC_V20; bfrops = "v20"; bftype = pmix_bfrops_globals.default_type; // we can't know any better - gds = NULL; + gds = "ds12,hash"; } else { int major; major = strtoul(version, NULL, 10); @@ -1133,6 +1278,7 @@ static void connection_handler(int sd, short args, void *cbdata) proc_type = proc_type | PMIX_PROC_V3; } else { free(msg); + PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); rc = PMIX_ERR_NOT_SUPPORTED; goto error; } @@ -1179,63 +1325,137 @@ static void connection_handler(int sd, short args, void *cbdata) } /* see if this is a tool connection request */ - if (0 != flag) { - /* does the server support tool connections? */ - if (NULL == pmix_host_server.tool_connected) { - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_SUPPORTED; - goto error; + if (0 != pnd->flag) { + peer = PMIX_NEW(pmix_peer_t); + if (NULL == peer) { + /* probably cannot send an error reply if we are out of memory */ + free(msg); + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd); + return; } - - if (PMIX_PROC_V3 & proc_type) { - /* the caller will have provided a flag indicating - * whether or not they have an assigned nspace/rank */ - if (cnt < 1) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + pnd->peer = peer; + /* if this is a tool we launched, then the host may + * have already registered it as a client - so check + * to see if we already have a peer for it */ + if (5 == pnd->flag || 8 == pnd->flag) { + /* registration only adds the nspace and a rank in that + * nspace - it doesn't add the peer object to our array + * of local clients. So let's start by searching for + * the nspace object */ + nptr = NULL; + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(tmp->nspace, nspace)) { + nptr = tmp; + break; + } + } + if (NULL == nptr) { + /* we don't know this namespace, reject it */ free(msg); /* send an error reply to the client */ - rc = PMIX_ERR_BAD_PARAM; + rc = PMIX_ERR_NOT_FOUND; goto error; } - memcpy(&flag, mg, 1); - ++mg; - --cnt; - if (flag) { - PMIX_STRNLEN(msglen, mg, cnt); - if (msglen < cnt) { - nspace = mg; - mg += strlen(nspace) + 1; - cnt -= strlen(nspace) + 1; - } else { - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_BAD_PARAM; - goto error; - } - if (sizeof(pmix_rank_t) <= cnt) { - /* have to convert this to host order */ - memcpy(&u32, mg, sizeof(uint32_t)); - rank = ntohl(u32); - mg += sizeof(uint32_t); - cnt -= sizeof(uint32_t); - } else { - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_BAD_PARAM; - goto error; + /* now look for the rank */ + info = NULL; + found = false; + PMIX_LIST_FOREACH(info, &nptr->ranks, pmix_rank_info_t) { + if (info->pname.rank == rank) { + found = true; + break; } + } + if (!found) { + /* rank unknown, reject it */ + free(msg); + /* send an error reply to the client */ + rc = PMIX_ERR_NOT_FOUND; + goto error; + } + PMIX_RETAIN(info); + peer->info = info; + PMIX_RETAIN(nptr); + } else { + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd); + PMIX_RELEASE(peer); + return; + } + } + peer->nptr = nptr; + /* select their bfrops compat module */ + peer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(bfrops); + if (NULL == peer->nptr->compat.bfrops) { + PMIX_RELEASE(peer); + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd); + return; + } + /* set the buffer type */ + peer->nptr->compat.type = bftype; + n = 0; + /* if info structs need to be passed along, then unpack them */ + if (0 < cnt) { + int32_t foo; + PMIX_CONSTRUCT(&buf, pmix_buffer_t); + PMIX_LOAD_BUFFER(peer, &buf, mg, cnt); + foo = 1; + PMIX_BFROPS_UNPACK(rc, peer, &buf, &pnd->ninfo, &foo, PMIX_SIZE); + foo = (int32_t)pnd->ninfo; + /* if we have an identifier, then we leave room to pass it */ + if (!pnd->need_id) { + pnd->ninfo += 5; + } else { + pnd->ninfo += 3; + } + PMIX_INFO_CREATE(pnd->info, pnd->ninfo); + PMIX_BFROPS_UNPACK(rc, peer, &buf, pnd->info, &foo, PMIX_INFO); + n = foo; + } else { + if (!pnd->need_id) { pnd->ninfo = 5; } else { pnd->ninfo = 3; } - } else { - pnd->ninfo = 3; + PMIX_INFO_CREATE(pnd->info, pnd->ninfo); + } + + /* pass along the proc_type */ + pnd->proc_type = proc_type; + /* pass along the bfrop, buffer_type, and sec fields so + * we can assign them once we create a peer object */ + pnd->psec = strdup(sec); + if (NULL != gds) { + pnd->gds = strdup(gds); + } + + /* does the server support tool connections? */ + if (NULL == pmix_host_server.tool_connected) { + if (pnd->need_id) { + /* we need someone to provide the tool with an + * identifier and they aren't available */ + /* send an error reply to the client */ + rc = PMIX_ERR_NOT_SUPPORTED; + PMIX_RELEASE(peer); + /* release the msg */ + free(msg); + goto error; + } else { + /* just process it locally */ + PMIX_LOAD_PROCID(&proc, nspace, rank); + cnct_cbfunc(PMIX_SUCCESS, &proc, (void*)pnd); + /* release the msg */ + free(msg); + return; + } } /* setup the info array to pass the relevant info * to the server */ - n = 0; - PMIX_INFO_CREATE(pnd->info, pnd->ninfo); /* provide the version */ PMIX_INFO_LOAD(&pnd->info[n], PMIX_VERSION_INFO, version, PMIX_STRING); ++n; @@ -1245,37 +1465,24 @@ static void connection_handler(int sd, short args, void *cbdata) /* and the group id */ PMIX_INFO_LOAD(&pnd->info[n], PMIX_GRPID, &pnd->gid, PMIX_UINT32); ++n; - /* if we have it, pass along our ID */ - if (flag) { + /* if we have it, pass along their ID */ + if (!pnd->need_id) { PMIX_INFO_LOAD(&pnd->info[n], PMIX_NSPACE, nspace, PMIX_STRING); ++n; PMIX_INFO_LOAD(&pnd->info[n], PMIX_RANK, &rank, PMIX_PROC_RANK); ++n; } - /* pass along the proc_type */ - pnd->proc_type = proc_type; - /* pass along the bfrop, buffer_type, and sec fields so - * we can assign them once we create a peer object */ - pnd->psec = strdup(sec); - if (NULL != bfrops) { - pnd->bfrops = strdup(bfrops); - } - pnd->buffer_type = bftype; - if (NULL != gds) { - pnd->gds = strdup(gds); - } /* release the msg */ free(msg); - /* request an nspace for this requestor - it will - * automatically be assigned rank=0 if the rank - * isn't already known */ + + /* pass it up for processing */ pmix_host_server.tool_connected(pnd->info, pnd->ninfo, cnct_cbfunc, pnd); return; } /* see if we know this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, nspace)) { nptr = tmp; break; @@ -1443,12 +1650,16 @@ static void connection_handler(int sd, short args, void *cbdata) /* let the host server know that this client has connected */ if (NULL != pmix_host_server.client_connected) { - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.client_connected(&proc, peer->info->server_object, NULL, NULL); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { PMIX_ERROR_LOG(rc); + info->proc_cnt--; + pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); + PMIX_RELEASE(peer); + goto error; } } @@ -1483,7 +1694,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_pending_connection_t *pnd = (pmix_pending_connection_t*)cd->cbdata; - pmix_nspace_t *nptr; + pmix_namespace_t *nptr; pmix_rank_info_t *info; pmix_peer_t *peer; int rc; @@ -1500,6 +1711,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd->peer); PMIX_RELEASE(pnd); PMIX_RELEASE(cd); return; @@ -1507,24 +1719,41 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* if the request failed, then we are done */ if (PMIX_SUCCESS != cd->status) { + PMIX_RELEASE(pnd->peer); PMIX_RELEASE(pnd); PMIX_RELEASE(cd); return; } - /* send the nspace back to the tool */ - if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, cd->proc.nspace, PMIX_MAX_NSLEN+1))) { - PMIX_ERROR_LOG(rc); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - PMIX_RELEASE(cd); - return; + /* if we got an identifier, send it back to the tool */ + if (pnd->need_id) { + /* start with the nspace */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, cd->proc.nspace, PMIX_MAX_NSLEN+1))) { + PMIX_ERROR_LOG(rc); + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd->peer); + PMIX_RELEASE(pnd); + PMIX_RELEASE(cd); + return; + } + + /* now the rank, suitably converted */ + u32 = ntohl(cd->proc.rank); + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { + PMIX_ERROR_LOG(rc); + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd->peer); + PMIX_RELEASE(pnd); + PMIX_RELEASE(cd); + return; + } } /* send my nspace back to the tool */ if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, pmix_globals.myid.nspace, PMIX_MAX_NSLEN+1))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd->peer); PMIX_RELEASE(pnd); PMIX_RELEASE(cd); return; @@ -1535,61 +1764,41 @@ static void process_cbfunc(int sd, short args, void *cbdata) if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { PMIX_ERROR_LOG(rc); CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd->peer); PMIX_RELEASE(pnd); PMIX_RELEASE(cd); return; } - /* add this nspace to our pool */ - nptr = PMIX_NEW(pmix_nspace_t); - if (NULL == nptr) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - PMIX_RELEASE(cd); - return; - } - nptr->nspace = strdup(cd->proc.nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); - /* add this tool rank to the nspace */ - info = PMIX_NEW(pmix_rank_info_t); - if (NULL == info) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - PMIX_RELEASE(cd); - return; - } - info->pname.nspace = strdup(cd->proc.nspace); - info->pname.rank = 0; - /* need to include the uid/gid for validation */ - info->uid = pnd->uid; - info->gid = pnd->gid; - pmix_list_append(&nptr->ranks, &info->super); + /* shortcuts */ + peer = (pmix_peer_t*)pnd->peer; + nptr = peer->nptr; - /* setup a peer object for this tool */ - peer = PMIX_NEW(pmix_peer_t); - if (NULL == peer) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - PMIX_RELEASE(cd); - return; + /* if this tool wasn't initially registered as a client, + * then add some required structures */ + if (5 != pnd->flag && 8 != pnd->flag) { + PMIX_RETAIN(nptr); + nptr->nspace = strdup(cd->proc.nspace); + pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + info = PMIX_NEW(pmix_rank_info_t); + info->pname.nspace = strdup(nptr->nspace); + info->pname.rank = cd->proc.rank; + info->uid = pnd->uid; + info->gid = pnd->gid; + pmix_list_append(&nptr->ranks, &info->super); + PMIX_RETAIN(info); + peer->info = info; } + /* mark the peer proc type */ peer->proc_type = pnd->proc_type; /* save the protocol */ peer->protocol = pnd->protocol; - /* add in the nspace pointer */ - PMIX_RETAIN(nptr); - peer->nptr = nptr; - PMIX_RETAIN(info); - peer->info = info; /* save the uid/gid */ - peer->epilog.uid = info->uid; - peer->epilog.gid = info->gid; - nptr->epilog.uid = info->uid; - nptr->epilog.gid = info->gid; + peer->epilog.uid = peer->info->uid; + peer->epilog.gid = peer->info->gid; + nptr->epilog.uid = peer->info->uid; + nptr->epilog.gid = peer->info->gid; peer->proc_cnt = 1; peer->sd = pnd->sd; @@ -1607,17 +1816,6 @@ static void process_cbfunc(int sd, short args, void *cbdata) * tool as we received this request via that channel, so simply * record it here for future use */ peer->nptr->compat.ptl = &pmix_ptl_tcp_module; - /* select their bfrops compat module */ - peer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(pnd->bfrops); - if (NULL == peer->nptr->compat.bfrops) { - PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); - PMIX_RELEASE(nptr); // will release the info object - CLOSE_THE_SOCKET(pnd->sd); - goto done; - } - /* set the buffer type */ - peer->nptr->compat.type = pnd->buffer_type; /* set the gds */ PMIX_INFO_LOAD(&ginfo, PMIX_GDS_MODULE, pnd->gds, PMIX_STRING); peer->nptr->compat.gds = pmix_gds_base_assign_module(&ginfo, 1); @@ -1718,7 +1916,8 @@ static void cnct_cbfunc(pmix_status_t status, return; } cd->status = status; - (void)strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + cd->proc.rank = proc->rank; cd->cbdata = cbdata; PMIX_THREADSHIFT(cd, process_cbfunc); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c index fcb15b01517..fc7b6da1c47 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -146,7 +146,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); } if (NULL == pmix_client_globals.myserver->nptr) { - pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t); + pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); } if (NULL == pmix_client_globals.myserver->nptr->nspace) { pmix_client_globals.myserver->nptr->nspace = strdup(uri[0]); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index b09e147ace0..7cb073db767 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -15,6 +15,7 @@ * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -341,7 +342,7 @@ static void connection_handler(int sd, short args, void *cbdata) pmix_status_t rc; unsigned int rank; pmix_usock_hdr_t hdr; - pmix_nspace_t *nptr, *tmp; + pmix_namespace_t *nptr, *tmp; pmix_rank_info_t *info; pmix_peer_t *psave = NULL; bool found; @@ -481,6 +482,10 @@ static void connection_handler(int sd, short args, void *cbdata) cred.bytes = ptr; ptr += cred.size; len -= cred.size; + } else { + /* set cred pointer to NULL to guard against validation + * methods that assume a zero length credential is NULL */ + cred.bytes = NULL; } } @@ -541,7 +546,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* see if we know this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, nspace)) { nptr = tmp; break; @@ -718,10 +723,10 @@ static void connection_handler(int sd, short args, void *cbdata) /* let the host server know that this client has connected */ if (NULL != pmix_host_server.client_connected) { - (void)strncpy(proc.nspace, psave->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, psave->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = psave->info->pname.rank; rc = pmix_host_server.client_connected(&proc, psave->info->server_object, NULL, NULL); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { PMIX_ERROR_LOG(rc); info->proc_cnt--; PMIX_RELEASE(info); diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c index bdfe4ebc416..87a1456f4d4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c @@ -52,6 +52,9 @@ extern bool pmix_init_called; void pmix_rte_finalize(void) { + int i; + pmix_notify_caddy_t *cd; + if( --pmix_initialized != 0 ) { if( pmix_initialized < 0 ) { fprintf(stderr, "PMIx Finalize called too many times\n"); @@ -104,9 +107,10 @@ void pmix_rte_finalize(void) PMIX_RELEASE(pmix_globals.mypeer); PMIX_DESTRUCT(&pmix_globals.events); PMIX_LIST_DESTRUCT(&pmix_globals.cached_events); - { - pmix_notify_caddy_t *cd; - while (NULL != (cd=(pmix_notify_caddy_t *)pmix_ring_buffer_pop(&pmix_globals.notifications))) { + /* clear any notifications */ + for (i=0; i < pmix_globals.max_events; i++) { + pmix_hotel_checkout_and_return_occupant(&pmix_globals.notifications, i, (void**)&cd); + if (NULL != cd) { PMIX_RELEASE(cd); } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c index 7a9fd4d872b..d1803de7046 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c @@ -15,7 +15,7 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -70,6 +70,8 @@ PMIX_EXPORT bool pmix_init_called = false; PMIX_EXPORT pmix_globals_t pmix_globals = { .init_cntr = 0, .mypeer = NULL, + .hostname = NULL, + .nodeid = UINT32_MAX, .pindex = 0, .evbase = NULL, .external_evbase = false, @@ -80,6 +82,15 @@ PMIX_EXPORT pmix_globals_t pmix_globals = { }; +static void _notification_eviction_cbfunc(struct pmix_hotel_t *hotel, + int room_num, + void *occupant) +{ + pmix_notify_caddy_t *cache = (pmix_notify_caddy_t*)occupant; + PMIX_RELEASE(cache); +} + + int pmix_rte_init(pmix_proc_type_t type, pmix_info_t info[], size_t ninfo, pmix_ptl_cbfunc_t cbfunc) @@ -87,6 +98,7 @@ int pmix_rte_init(pmix_proc_type_t type, int ret, debug_level; char *error = NULL, *evar; size_t n; + char hostname[PMIX_MAXHOSTNAMELEN]; if( ++pmix_initialized != 1 ) { if( pmix_initialized < 1 ) { @@ -147,6 +159,8 @@ int pmix_rte_init(pmix_proc_type_t type, } /* setup the globals structure */ + gethostname(hostname, PMIX_MAXHOSTNAMELEN); + pmix_globals.hostname = strdup(hostname); memset(&pmix_globals.myid.nspace, 0, PMIX_MAX_NSLEN+1); pmix_globals.myid.rank = PMIX_RANK_INVALID; PMIX_CONSTRUCT(&pmix_globals.events, pmix_events_t); @@ -154,8 +168,15 @@ int pmix_rte_init(pmix_proc_type_t type, pmix_globals.event_window.tv_usec = 0; PMIX_CONSTRUCT(&pmix_globals.cached_events, pmix_list_t); /* construct the global notification ring buffer */ - PMIX_CONSTRUCT(&pmix_globals.notifications, pmix_ring_buffer_t); - pmix_ring_buffer_init(&pmix_globals.notifications, 256); + PMIX_CONSTRUCT(&pmix_globals.notifications, pmix_hotel_t); + ret = pmix_hotel_init(&pmix_globals.notifications, pmix_globals.max_events, + pmix_globals.evbase, pmix_globals.event_eviction_time, + _notification_eviction_cbfunc); + if (PMIX_SUCCESS != ret) { + error = "notification hotel init"; + goto return_error; + } + /* and setup the iof request tracking list */ PMIX_CONSTRUCT(&pmix_globals.iof_requests, pmix_list_t); @@ -223,7 +244,7 @@ int pmix_rte_init(pmix_proc_type_t type, pmix_globals.mypeer->proc_type = type | PMIX_PROC_V3; /* create an nspace object for ourselves - we will * fill in the nspace name later */ - pmix_globals.mypeer->nptr = PMIX_NEW(pmix_nspace_t); + pmix_globals.mypeer->nptr = PMIX_NEW(pmix_namespace_t); if (NULL == pmix_globals.mypeer->nptr) { PMIX_RELEASE(pmix_globals.mypeer); ret = PMIX_ERR_NOMEM; @@ -233,9 +254,19 @@ int pmix_rte_init(pmix_proc_type_t type, /* scan incoming info for directives */ if (NULL != info) { for (n=0; n < ninfo; n++) { - if (0 == strcmp(PMIX_EVENT_BASE, info[n].key)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_BASE)) { pmix_globals.evbase = (pmix_event_base_t*)info[n].value.data.ptr; pmix_globals.external_evbase = true; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_HOSTNAME)) { + if (NULL != pmix_globals.hostname) { + free(pmix_globals.hostname); + } + pmix_globals.hostname = strdup(info[n].value.data.string); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODEID)) { + PMIX_VALUE_GET_NUMBER(ret, &info[n].value, pmix_globals.nodeid, uint32_t); + if (PMIX_SUCCESS != ret) { + goto return_error; + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c index 4524c216a94..8d49e8bdaad 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_params.c @@ -19,9 +19,9 @@ * Copyright (c) 2014 Hochschule Esslingen. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -242,6 +242,30 @@ pmix_status_t pmix_register_params(void) PMIX_INFO_LVL_9, PMIX_MCA_BASE_VAR_SCOPE_READONLY, &pmix_globals.timestamp_output); + /* max size of the notification hotel */ + pmix_globals.max_events = 512; + (void) pmix_mca_base_var_register ("pmix", "pmix", "max", "events", + "Maximum number of event notifications to cache", + PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + PMIX_INFO_LVL_1, PMIX_MCA_BASE_VAR_SCOPE_ALL, + &pmix_globals.max_events); + + /* how long to cache an event */ + pmix_globals.event_eviction_time = 120; + (void) pmix_mca_base_var_register ("pmix", "pmix", "event", "eviction_time", + "Maximum number of seconds to cache an event", + PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + PMIX_INFO_LVL_1, PMIX_MCA_BASE_VAR_SCOPE_ALL, + &pmix_globals.event_eviction_time); + + /* max number of IOF messages to cache */ + pmix_server_globals.max_iof_cache = 1024 * 1024; + (void) pmix_mca_base_var_register ("pmix", "pmix", "max", "iof_cache", + "Maximum number of IOF messages to cache", + PMIX_MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + PMIX_INFO_LVL_1, PMIX_MCA_BASE_VAR_SCOPE_ALL, + &pmix_server_globals.max_iof_cache); + return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index 075c877bc1f..38b85c0175c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -1,13 +1,14 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -86,18 +87,8 @@ static char *gds_mode = NULL; static pid_t mypid; // local functions for connection support -static void iof_eviction_cbfunc(struct pmix_hotel_t *hotel, - int room_num, - void *occupant) -{ - pmix_setup_caddy_t *cache = (pmix_setup_caddy_t*)occupant; - PMIX_RELEASE(cache); -} - pmix_status_t pmix_server_initialize(void) { - pmix_status_t rc; - /* setup the server-specific globals */ PMIX_CONSTRUCT(&pmix_server_globals.clients, pmix_pointer_array_t); pmix_pointer_array_init(&pmix_server_globals.clients, 1, INT_MAX, 1); @@ -107,15 +98,7 @@ pmix_status_t pmix_server_initialize(void) PMIX_CONSTRUCT(&pmix_server_globals.events, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.local_reqs, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.nspaces, pmix_list_t); - PMIX_CONSTRUCT(&pmix_server_globals.iof, pmix_hotel_t); - rc = pmix_hotel_init(&pmix_server_globals.iof, PMIX_IOF_HOTEL_SIZE, - pmix_globals.evbase, PMIX_IOF_MAX_STAY, - iof_eviction_cbfunc); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } + PMIX_CONSTRUCT(&pmix_server_globals.iof, pmix_list_t); pmix_output_verbose(2, pmix_server_globals.base_output, "pmix:server init called"); @@ -182,7 +165,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, size_t n, m; pmix_kval_t *kv; bool protect, nspace_given = false, rank_given = false; - bool topology_req = false; pmix_info_t ginfo; char *protected[] = { PMIX_USERID, @@ -213,6 +195,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, } } else if (0 == strncmp(info[n].key, PMIX_SERVER_TMPDIR, PMIX_MAX_KEYLEN)) { pmix_server_globals.tmpdir = strdup(info[n].value.data.string); + } else if (0 == strncmp(info[n].key, PMIX_SYSTEM_TMPDIR, PMIX_MAX_KEYLEN)) { + pmix_server_globals.system_tmpdir = strdup(info[n].value.data.string); } } } @@ -223,6 +207,13 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, pmix_server_globals.tmpdir = strdup(evar); } } + if (NULL == pmix_server_globals.system_tmpdir) { + if (NULL == (evar = getenv("PMIX_SYSTEM_TMPDIR"))) { + pmix_server_globals.system_tmpdir = strdup(pmix_tmp_directory()); + } else { + pmix_server_globals.system_tmpdir = strdup(evar); + } + } /* setup the runtime - this init's the globals, * opens and initializes the required frameworks */ @@ -299,17 +290,11 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strncmp(info[n].key, PMIX_SERVER_NSPACE, PMIX_MAX_KEYLEN)) { - (void)strncpy(pmix_globals.myid.nspace, info[n].value.data.string, PMIX_MAX_NSLEN); + pmix_strncpy(pmix_globals.myid.nspace, info[n].value.data.string, PMIX_MAX_NSLEN); nspace_given = true; } else if (0 == strncmp(info[n].key, PMIX_SERVER_RANK, PMIX_MAX_KEYLEN)) { pmix_globals.myid.rank = info[n].value.data.rank; rank_given = true; - } else if (0 == strncmp(info[n].key, PMIX_TOPOLOGY, PMIX_MAX_KEYLEN) || - 0 == strncmp(info[n].key, PMIX_TOPOLOGY_XML, PMIX_MAX_KEYLEN) || - 0 == strncmp(info[n].key, PMIX_TOPOLOGY_FILE, PMIX_MAX_KEYLEN) || - 0 == strncmp(info[n].key, PMIX_HWLOC_XML_V1, PMIX_MAX_KEYLEN) || - 0 == strncmp(info[n].key, PMIX_HWLOC_XML_V2, PMIX_MAX_KEYLEN)) { - topology_req = true; } else { /* check the list of protected keys */ protect = false; @@ -343,9 +328,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, /* look for our namespace, if one was given */ if (NULL == (evar = getenv("PMIX_SERVER_NAMESPACE"))) { /* use a fake namespace */ - (void)strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN); + pmix_strncpy(pmix_globals.myid.nspace, "pmix-server", PMIX_MAX_NSLEN); } else { - (void)strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN); + pmix_strncpy(pmix_globals.myid.nspace, evar, PMIX_MAX_NSLEN); } } if (!rank_given) { @@ -367,7 +352,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, rinfo = pmix_globals.mypeer->info; } if (NULL == pmix_globals.mypeer->nptr) { - pmix_globals.mypeer->nptr = PMIX_NEW(pmix_nspace_t); + pmix_globals.mypeer->nptr = PMIX_NEW(pmix_namespace_t); /* ensure our own nspace is first on the list */ PMIX_RETAIN(pmix_globals.mypeer->nptr); pmix_list_prepend(&pmix_server_globals.nspaces, &pmix_globals.mypeer->nptr->super); @@ -391,11 +376,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, } /* if requested, setup the topology */ - if (topology_req) { - if (PMIX_SUCCESS != (rc = pmix_hwloc_get_topology(info, ninfo))) { - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } + if (PMIX_SUCCESS != (rc = pmix_hwloc_get_topology(info, ninfo))) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; } /* open the psensor framework */ @@ -442,8 +425,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) { int i; pmix_peer_t *peer; - pmix_nspace_t *ns; - pmix_setup_caddy_t *cd; + pmix_namespace_t *ns; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -471,14 +453,6 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) pmix_ptl_base_stop_listening(); - /* cleanout any IOF */ - for (i=0; i < PMIX_IOF_HOTEL_SIZE; i++) { - pmix_hotel_checkout_and_return_occupant(&pmix_server_globals.iof, i, (void**)&cd); - if (NULL != cd) { - PMIX_RELEASE(cd); - } - } - PMIX_DESTRUCT(&pmix_server_globals.iof); for (i=0; i < pmix_server_globals.clients.size; i++) { if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) { /* ensure that we do the specified cleanup - if this is an @@ -494,13 +468,14 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) PMIX_LIST_DESTRUCT(&pmix_server_globals.local_reqs); PMIX_LIST_DESTRUCT(&pmix_server_globals.gdata); PMIX_LIST_DESTRUCT(&pmix_server_globals.events); - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { /* ensure that we do the specified cleanup - if this is an * abnormal termination, then the nspace object may not be * at zero refcount */ pmix_execute_epilog(&ns->epilog); } PMIX_LIST_DESTRUCT(&pmix_server_globals.nspaces); + PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); pmix_hwloc_cleanup(); @@ -548,7 +523,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) static void _register_nspace(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; - pmix_nspace_t *nptr, *tmp; + pmix_namespace_t *nptr, *tmp; pmix_status_t rc; size_t i; @@ -559,14 +534,14 @@ static void _register_nspace(int sd, short args, void *cbdata) /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->proc.nspace)) { nptr = tmp; break; } } if (NULL == nptr) { - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { rc = PMIX_ERR_NOMEM; goto release; @@ -611,7 +586,7 @@ static void _register_nspace(int sd, short args, void *cbdata) } /* setup the data for a job */ -PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int nlocalprocs, +PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace, int nlocalprocs, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { @@ -625,7 +600,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int n PMIX_RELEASE_THREAD(&pmix_global_lock); cd = PMIX_NEW(pmix_setup_caddy_t); - (void)strncpy(cd->proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->proc.nspace, nspace, PMIX_MAX_NSLEN); cd->nlocalprocs = nlocalprocs; cd->opcbfunc = cbfunc; cd->cbdata = cbdata; @@ -641,10 +616,106 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const char nspace[], int n return PMIX_SUCCESS; } +void pmix_server_purge_events(pmix_peer_t *peer, + pmix_proc_t *proc) +{ + pmix_regevents_info_t *reginfo, *regnext; + pmix_peer_events_info_t *prev, *pnext; + pmix_iof_req_t *req, *nxt; + int i; + pmix_notify_caddy_t *ncd; + size_t n, m, p, ntgs; + pmix_proc_t *tgs, *tgt; + pmix_dmdx_local_t *dlcd, *dnxt; + + /* since the client is finalizing, remove them from any event + * registrations they may still have on our list */ + PMIX_LIST_FOREACH_SAFE(reginfo, regnext, &pmix_server_globals.events, pmix_regevents_info_t) { + PMIX_LIST_FOREACH_SAFE(prev, pnext, ®info->peers, pmix_peer_events_info_t) { + if ((NULL != peer && prev->peer == peer) || + (NULL != proc && PMIX_CHECK_PROCID(proc, &prev->peer->info->pname))) { + pmix_list_remove_item(®info->peers, &prev->super); + PMIX_RELEASE(prev); + if (0 == pmix_list_get_size(®info->peers)) { + pmix_list_remove_item(&pmix_server_globals.events, ®info->super); + PMIX_RELEASE(reginfo); + break; + } + } + } + } + + /* since the client is finalizing, remove them from any IOF + * registrations they may still have on our list */ + PMIX_LIST_FOREACH_SAFE(req, nxt, &pmix_globals.iof_requests, pmix_iof_req_t) { + if ((NULL != peer && PMIX_CHECK_PROCID(&req->peer->info->pname, &peer->info->pname)) || + (NULL != proc && PMIX_CHECK_PROCID(&req->peer->info->pname, proc))) { + pmix_list_remove_item(&pmix_globals.iof_requests, &req->super); + PMIX_RELEASE(req); + } + } + + /* see if this proc is involved in any direct modex requests */ + PMIX_LIST_FOREACH_SAFE(dlcd, dnxt, &pmix_server_globals.local_reqs, pmix_dmdx_local_t) { + if ((NULL != peer && PMIX_CHECK_PROCID(&peer->info->pname, &dlcd->proc)) || + (NULL != proc && PMIX_CHECK_PROCID(proc, &dlcd->proc))) { + /* cleanup this request */ + pmix_list_remove_item(&pmix_server_globals.local_reqs, &dlcd->super); + /* we can release the dlcd item here because we are not + * releasing the tracker held by the host - we are only + * releasing one item on that tracker */ + PMIX_RELEASE(dlcd); + } + } + + /* purge this client from any cached notifications */ + for (i=0; i < pmix_globals.max_events; i++) { + pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&ncd); + if (NULL != ncd && NULL != ncd->targets && 0 < ncd->ntargets) { + tgt = NULL; + for (n=0; n < ncd->ntargets; n++) { + if ((NULL != peer && PMIX_CHECK_PROCID(&peer->info->pname, &ncd->targets[n])) || + (NULL != proc && PMIX_CHECK_PROCID(proc, &ncd->targets[n]))) { + tgt = &ncd->targets[n]; + break; + } + } + if (NULL != tgt) { + /* if this client was the only target, then just + * evict the notification */ + if (1 == ncd->ntargets) { + pmix_hotel_checkout(&pmix_globals.notifications, i); + PMIX_RELEASE(ncd); + } else if (PMIX_RANK_WILDCARD == tgt->rank && + NULL != proc && PMIX_RANK_WILDCARD == proc->rank) { + /* we have to remove this target, but leave the rest */ + ntgs = ncd->ntargets - 1; + PMIX_PROC_CREATE(tgs, ntgs); + p=0; + for (m=0; m < ncd->ntargets; m++) { + if (tgt != &ncd->targets[m]) { + memcpy(&tgs[p], &ncd->targets[n], sizeof(pmix_proc_t)); + ++p; + } + } + PMIX_PROC_FREE(ncd->targets, ncd->ntargets); + ncd->targets = tgs; + ncd->ntargets = ntgs; + } + } + } + } + + if (NULL != peer) { + /* ensure we honor any peer-level epilog requests */ + pmix_execute_epilog(&peer->epilog); + } +} + static void _deregister_nspace(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; - pmix_nspace_t *tmp; + pmix_namespace_t *tmp; pmix_status_t rc; PMIX_ACQUIRE_OBJECT(cd); @@ -653,15 +724,22 @@ static void _deregister_nspace(int sd, short args, void *cbdata) "pmix:server _deregister_nspace %s", cd->proc.nspace); - /* release any job-level messaging resources */ + /* release any job-level network resources */ pmix_pnet.deregister_nspace(cd->proc.nspace); /* let our local storage clean up */ PMIX_GDS_DEL_NSPACE(rc, cd->proc.nspace); + /* remove any event registrations, IOF registrations, and + * cached notifications targeting procs from this nspace */ + pmix_server_purge_events(NULL, &cd->proc); + /* release this nspace */ - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { - if (0 == strcmp(tmp->nspace, cd->proc.nspace)) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + if (PMIX_CHECK_NSPACE(tmp->nspace, cd->proc.nspace)) { + /* perform any nspace-level epilog */ + pmix_execute_epilog(&tmp->epilog); + /* remove and release it */ pmix_list_remove_item(&pmix_server_globals.nspaces, &tmp->super); PMIX_RELEASE(tmp); break; @@ -675,7 +753,7 @@ static void _deregister_nspace(int sd, short args, void *cbdata) PMIX_RELEASE(cd); } -PMIX_EXPORT void PMIx_server_deregister_nspace(const char nspace[], +PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, pmix_op_cbfunc_t cbfunc, void *cbdata) { @@ -695,8 +773,8 @@ PMIX_EXPORT void PMIx_server_deregister_nspace(const char nspace[], } PMIX_RELEASE_THREAD(&pmix_global_lock); - cd = PMIX_NEW(pmix_setup_caddy_t); - (void)strncpy(cd->proc.nspace, nspace, PMIX_MAX_NSLEN); + cd = PMIX_NEW(pmix_setup_caddy_t); + PMIX_LOAD_PROCID(&cd->proc, nspace, PMIX_RANK_WILDCARD); cd->opcbfunc = cbfunc; cd->cbdata = cbdata; @@ -786,7 +864,7 @@ void pmix_server_execute_collective(int sd, short args, void *cbdata) } if (trk->hybrid || first) { /* setup the nspace */ - (void)strncpy(proc.nspace, cd->peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, cd->peer->info->pname.nspace, PMIX_MAX_NSLEN); first = false; } proc.rank = cd->peer->info->pname.rank; @@ -863,7 +941,7 @@ static void _register_client(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_rank_info_t *info, *iptr; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; pmix_server_trkr_t *trk; pmix_trkr_caddy_t *tcd; bool all_def; @@ -873,19 +951,20 @@ static void _register_client(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(cd); pmix_output_verbose(2, pmix_server_globals.base_output, - "pmix:server _register_client for nspace %s rank %d", - cd->proc.nspace, cd->proc.rank); + "pmix:server _register_client for nspace %s rank %d %s object", + cd->proc.nspace, cd->proc.rank, + (NULL == cd->server_object) ? "NULL" : "NON-NULL"); /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, cd->proc.nspace)) { nptr = ns; break; } } if (NULL == nptr) { - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { rc = PMIX_ERR_NOMEM; goto cleanup; @@ -932,7 +1011,7 @@ static void _register_client(int sd, short args, void *cbdata) * if the nspaces are all defined */ if (all_def) { /* so far, they have all been defined - check this one */ - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 < ns->nlocalprocs && 0 == strcmp(trk->pcs[i].nspace, ns->nspace)) { all_def = ns->all_registered; @@ -1002,7 +1081,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, if (NULL == cd) { return PMIX_ERR_NOMEM; } - (void)strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); cd->proc.rank = proc->rank; cd->uid = uid; cd->gid = gid; @@ -1020,7 +1099,7 @@ static void _deregister_client(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_rank_info_t *info; - pmix_nspace_t *nptr, *tmp; + pmix_namespace_t *nptr, *tmp; pmix_peer_t *peer; PMIX_ACQUIRE_OBJECT(cd); @@ -1031,7 +1110,7 @@ static void _deregister_client(int sd, short args, void *cbdata) /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->proc.nspace)) { nptr = tmp; break; @@ -1073,6 +1152,12 @@ static void _deregister_client(int sd, short args, void *cbdata) pmix_pnet.child_finalized(&cd->proc); pmix_psensor.stop(peer, NULL); } + /* honor any registered epilogs */ + pmix_execute_epilog(&peer->epilog); + /* ensure we close the socket to this peer so we don't + * generate "connection lost" events should it be + * subsequently "killed" by the host */ + CLOSE_THE_SOCKET(peer->sd); } if (nptr->nlocalprocs == nptr->nfinalized) { pmix_pnet.local_app_finalized(nptr); @@ -1116,7 +1201,7 @@ PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, } return; } - (void)strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); cd->proc.rank = proc->rank; cd->opcbfunc = cbfunc; cd->cbdata = cbdata; @@ -1204,7 +1289,7 @@ static void _dmodex_req(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_rank_info_t *info, *iptr; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; char *data = NULL; size_t sz = 0; pmix_dmdx_remote_t *dcd; @@ -1224,7 +1309,7 @@ static void _dmodex_req(int sd, short args, void *cbdata) * been informed of it - so first check to see if we know * about this nspace yet */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, cd->proc.nspace)) { nptr = ns; break; @@ -1354,7 +1439,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc, proc->nspace, proc->rank); cd = PMIX_NEW(pmix_setup_caddy_t); - (void)strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); cd->proc.rank = proc->rank; cd->cbfunc = cbfunc; cd->cbdata = cbdata; @@ -1372,7 +1457,7 @@ static void _store_internal(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(cd); - (void)strncpy(proc.nspace, cd->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, cd->pname.nspace, PMIX_MAX_NSLEN); proc.rank = cd->pname.rank; PMIX_GDS_STORE_KV(cd->status, pmix_globals.mypeer, &proc, PMIX_INTERNAL, cd->kv); @@ -1382,7 +1467,7 @@ static void _store_internal(int sd, short args, void *cbdata) } PMIX_EXPORT pmix_status_t PMIx_Store_internal(const pmix_proc_t *proc, - const char *key, pmix_value_t *val) + const pmix_key_t key, pmix_value_t *val) { pmix_shift_caddy_t *cd; pmix_status_t rc; @@ -1496,7 +1581,7 @@ static void _setup_app(int sd, short args, void *cbdata) } n = 0; PMIX_LIST_FOREACH(kv, &ilist, pmix_kval_t) { - (void)strncpy(fcd->info[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(fcd->info[n].key, kv->key, PMIX_MAX_KEYLEN); pmix_value_xfer(&fcd->info[n].value, kv->value); ++n; } @@ -1520,7 +1605,7 @@ static void _setup_app(int sd, short args, void *cbdata) PMIX_RELEASE(cd); } -pmix_status_t PMIx_server_setup_application(const char nspace[], +pmix_status_t PMIx_server_setup_application(const pmix_nspace_t nspace, pmix_info_t info[], size_t ninfo, pmix_setup_application_cbfunc_t cbfunc, void *cbdata) { @@ -1571,7 +1656,7 @@ static void _setup_local_support(int sd, short args, void *cbdata) PMIX_RELEASE(cd); } -pmix_status_t PMIx_server_setup_local_support(const char nspace[], +pmix_status_t PMIx_server_setup_local_support(const pmix_nspace_t nspace, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { @@ -1609,7 +1694,7 @@ static void _iofdeliver(int sd, short args, void *cbdata) pmix_buffer_t *msg; bool found = false; bool cached = false; - int ignore; + pmix_iof_cache_t *iof; pmix_output_verbose(2, pmix_server_globals.iof_output, "PMIX:SERVER delivering IOF from %s on channel %0x", @@ -1623,17 +1708,16 @@ static void _iofdeliver(int sd, short args, void *cbdata) continue; } /* see if the source matches the request */ - if (0 != strncmp(cd->procs->nspace, req->pname.nspace, PMIX_MAX_NSLEN) || - (PMIX_RANK_WILDCARD != req->pname.rank && cd->procs->rank != req->pname.rank)) { + if (!PMIX_CHECK_PROCID(cd->procs, &req->pname)) { continue; } /* never forward back to the source! This can happen if the source - * is a launcher */ + * is a launcher - also, never forward to a peer that is no + * longer with us */ if (NULL == req->peer->info || req->peer->finalized) { continue; } - if (0 == strncmp(cd->procs->nspace, req->peer->info->pname.nspace, PMIX_MAX_NSLEN) && - cd->procs->rank == req->peer->info->pname.rank) { + if (PMIX_CHECK_PROCID(cd->procs, &req->peer->info->pname)) { continue; } found = true; @@ -1674,15 +1758,21 @@ static void _iofdeliver(int sd, short args, void *cbdata) /* if nobody has registered for this yet, then cache it */ if (!found) { - /* add this output to our hotel so it is cached until someone + pmix_output_verbose(2, pmix_server_globals.iof_output, + "PMIx:SERVER caching IOF"); + if (pmix_server_globals.max_iof_cache == pmix_list_get_size(&pmix_server_globals.iof)) { + /* remove the oldest cached message */ + iof = (pmix_iof_cache_t*)pmix_list_remove_first(&pmix_server_globals.iof); + PMIX_RELEASE(iof); + } + /* add this output to our cache so it is cached until someone * registers to receive it */ - if (PMIX_SUCCESS != (rc = pmix_hotel_checkin(&pmix_server_globals.iof, cd, &ignore))) { - /* we can't cache it for some reason */ - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(cd); - return; - } - cached = true; + iof = PMIX_NEW(pmix_iof_cache_t); + memcpy(&iof->source, cd->procs, sizeof(pmix_proc_t)); + iof->channel = cd->channels; + iof->bo = cd->bo; + cd->bo = NULL; // protect the data + pmix_list_append(&pmix_server_globals.iof, &iof->super); } @@ -1690,11 +1780,6 @@ static void _iofdeliver(int sd, short args, void *cbdata) cd->opcbfunc(rc, cd->cbdata); } if (!cached) { - if (NULL != cd->info) { - PMIX_INFO_FREE(cd->info, cd->ninfo); - } - PMIX_PROC_FREE(cd->procs, 1); - PMIX_BYTE_OBJECT_FREE(cd->bo, 1); PMIX_RELEASE(cd); } } @@ -1720,7 +1805,8 @@ pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, PMIX_RELEASE(cd); return PMIX_ERR_NOMEM; } - (void)strncpy(cd->procs[0].nspace, source->nspace, PMIX_MAX_NSLEN); + cd->nprocs = 1; + pmix_strncpy(cd->procs[0].nspace, source->nspace, PMIX_MAX_NSLEN); cd->procs[0].rank = source->rank; cd->channels = channel; PMIX_BYTE_OBJECT_CREATE(cd->bo, 1); @@ -1728,9 +1814,9 @@ pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, PMIX_RELEASE(cd); return PMIX_ERR_NOMEM; } + cd->nbo = 1; cd->bo[0].bytes = (char*)malloc(bo->size); if (NULL == cd->bo[0].bytes) { - PMIX_BYTE_OBJECT_FREE(cd->bo, 1); PMIX_RELEASE(cd); return PMIX_ERR_NOMEM; } @@ -1739,7 +1825,6 @@ pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, if (0 < ninfo) { PMIX_INFO_CREATE(cd->info, ninfo); if (NULL == cd->info) { - PMIX_BYTE_OBJECT_FREE(cd->bo, 1); PMIX_RELEASE(cd); return PMIX_ERR_NOMEM; } @@ -1803,7 +1888,7 @@ static void clct_complete(pmix_status_t status, /* transfer the results */ n=0; PMIX_LIST_FOREACH(kv, &cd->payload, pmix_kval_t) { - (void)strncpy(cd->info[n].key, kv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(cd->info[n].key, kv->key, PMIX_MAX_KEYLEN); rc = pmix_value_xfer(&cd->info[n].value, kv->value); if (PMIX_SUCCESS != rc) { PMIX_INFO_FREE(cd->info, cd->ninfo); @@ -1835,10 +1920,10 @@ static void clct_complete(pmix_status_t status, static void clct(int sd, short args, void *cbdata) { pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata; - pmix_status_t rc; #if PMIX_HAVE_HWLOC /* if we don't know our topology, we better get it now */ + pmix_status_t rc; if (NULL == pmix_hwloc_topology) { if (PMIX_SUCCESS != (rc = pmix_hwloc_get_topology(NULL, 0))) { PMIX_ERROR_LOG(rc); @@ -2003,6 +2088,10 @@ static void connection_cleanup(int sd, short args, void *cbdata) { pmix_server_caddy_t *cd = (pmix_server_caddy_t*)cbdata; + /* ensure that we know the peer has finalized else we + * will generate an event - yes, it should have been + * done, but it is REALLY important that it be set */ + cd->peer->finalized = true; pmix_ptl_base_lost_connection(cd->peer, PMIX_SUCCESS); /* cleanup the caddy */ PMIX_RELEASE(cd); @@ -2040,10 +2129,6 @@ static void op_cbfunc2(pmix_status_t status, void *cbdata) PMIX_RELEASE(reply); } - /* ensure that we know the peer has finalized else we - * will generate an event - yes, it should have been - * done, but it is REALLY important that it be set */ - cd->peer->finalized = true; /* cleanup any lingering references to this peer - note * that we cannot call the lost_connection function * directly as we need the connection to still @@ -2073,40 +2158,47 @@ static void _spcb(int sd, short args, void *cbdata) PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, &cd->status, 1, PMIX_STATUS); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + PMIX_RELEASE(reply); goto cleanup; } - if (PMIX_SUCCESS == cd->status) { - /* pass back the name of the nspace */ - PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, &cd->pname.nspace, 1, PMIX_STRING); - /* add the job-level info, if we have it */ - (void)strncpy(proc.nspace, cd->pname.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - /* this is going to a local client, so let the gds - * have the option of returning a copy of the data, - * or a pointer to local storage */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - cb.proc = &proc; - cb.scope = PMIX_SCOPE_UNDEF; - cb.copy = false; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS == rc) { - PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, kv, 1, PMIX_KVAL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(reply); - PMIX_DESTRUCT(&cb); - goto cleanup; - } + /* pass back the name of the nspace */ + PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, &cd->pname.nspace, 1, PMIX_STRING); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(reply); + goto cleanup; + } + /* add the job-level info, if we have it */ + pmix_strncpy(proc.nspace, cd->pname.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + /* this is going to a local client, so let the gds + * have the option of returning a copy of the data, + * or a pointer to local storage */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.proc = &proc; + cb.scope = PMIX_SCOPE_UNDEF; + cb.copy = false; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS == rc) { + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + PMIX_BFROPS_PACK(rc, cd->cd->peer, reply, kv, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(reply); + PMIX_DESTRUCT(&cb); + goto cleanup; } - PMIX_DESTRUCT(&cb); } + PMIX_DESTRUCT(&cb); } /* the function that created the server_caddy did a * retain on the peer, so we don't have to worry about * it still being present - tell the originator the result */ - PMIX_SERVER_QUEUE_REPLY(cd->cd->peer, cd->cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->cd->peer, cd->cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } cleanup: /* cleanup */ @@ -2166,7 +2258,10 @@ static void lookup_cbfunc(pmix_status_t status, pmix_pdata_t pdata[], size_t nda /* the function that created the server_caddy did a * retain on the peer, so we don't have to worry about * it still being present - tell the originator the result */ - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } /* cleanup */ PMIX_RELEASE(cd); } @@ -2180,19 +2275,33 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) { pmix_shift_caddy_t *scd = (pmix_shift_caddy_t*)cbdata; pmix_server_trkr_t *tracker = scd->tracker; - pmix_buffer_t xfer, *reply, bkt; - pmix_byte_object_t bo, bo2; - pmix_server_caddy_t *cd; + pmix_buffer_t xfer, *reply; + pmix_server_caddy_t *cd, *nxt; pmix_status_t rc = PMIX_SUCCESS, ret; pmix_nspace_caddy_t *nptr; pmix_list_t nslist; - int32_t cnt = 1; - char byte; bool found; - pmix_collect_t ctype; PMIX_ACQUIRE_OBJECT(scd); + if (NULL == tracker) { + /* give them a release if they want it - this should + * never happen, but protect against the possibility */ + if (NULL != scd->cbfunc.relfn) { + scd->cbfunc.relfn(scd->cbdata); + } + PMIX_RELEASE(scd); + return; + } + + /* if we get here, then there are processes waiting + * for a response */ + + /* if the timer is active, clear it */ + if (tracker->event_active) { + pmix_event_del(&tracker->ev); + } + /* pass the blobs being returned */ PMIX_CONSTRUCT(&xfer, pmix_buffer_t); PMIX_LOAD_BUFFER(pmix_globals.mypeer, &xfer, scd->data, scd->ndata); @@ -2214,7 +2323,7 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) goto finish_collective; } - // collect the pmix_nspace_t's of all local participants + // collect the pmix_namespace_t's of all local participants PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) { // see if we already have this nspace found = false; @@ -2233,74 +2342,17 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) } } - /* Loop over the enclosed byte object envelopes and - * store them in our GDS module */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &xfer, &bo, &cnt, PMIX_BYTE_OBJECT); - while (PMIX_SUCCESS == rc) { - PMIX_LOAD_BUFFER(pmix_globals.mypeer, &bkt, bo.bytes, bo.size); - /* unpack the data collection flag */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &byte, &cnt, PMIX_BYTE); - if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { - /* no data was returned, so we are done with this blob */ - break; - } + PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) { + PMIX_GDS_STORE_MODEX(rc, nptr->ns, &tracker->local_cbs, &xfer); if (PMIX_SUCCESS != rc) { - /* we have an error */ - break; - } - - // Check that this blob was accumulated with the same data collection setting - ctype = (pmix_collect_t)byte; - if (ctype != tracker->collect_type) { - rc = PMIX_ERR_INVALID_ARG; - break; - } - /* unpack the enclosed blobs from the various peers */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &bo2, &cnt, PMIX_BYTE_OBJECT); - while (PMIX_SUCCESS == rc) { - /* unpack all the kval's from this peer and store them in - * our GDS. Note that PMIx by design holds all data at - * the server level until requested. If our GDS is a - * shared memory region, then the data may be available - * right away - but the client still has to be notified - * of its presence. */ - PMIX_LIST_FOREACH(nptr, &nslist, pmix_nspace_caddy_t) { - PMIX_GDS_STORE_MODEX(rc, nptr->ns, &tracker->local_cbs, &bo2); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - break; - } - } - PMIX_BYTE_OBJECT_DESTRUCT(&bo2); - /* get the next blob */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &bkt, &bo2, &cnt, PMIX_BYTE_OBJECT); - } - if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { - rc = PMIX_SUCCESS; - } else if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto finish_collective; + break; } - /* unpack and process the next blob */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, - &xfer, &bo, &cnt, PMIX_BYTE_OBJECT); - } - if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER == rc) { - rc = PMIX_SUCCESS; } finish_collective: /* loop across all procs in the tracker, sending them the reply */ - PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) { + PMIX_LIST_FOREACH_SAFE(cd, nxt, &tracker->local_cbs, pmix_server_caddy_t) { reply = PMIX_NEW(pmix_buffer_t); if (NULL == reply) { rc = PMIX_ERR_NOMEM; @@ -2315,7 +2367,13 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) pmix_output_verbose(2, pmix_server_globals.base_output, "server:modex_cbfunc reply being sent to %s:%u", cd->peer->info->pname.nspace, cd->peer->info->pname.rank); - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + /* remove this entry */ + pmix_list_remove_item(&tracker->local_cbs, &cd->super); + PMIX_RELEASE(cd); } cleanup: @@ -2328,7 +2386,12 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) xfer.bytes_used = 0; PMIX_DESTRUCT(&xfer); - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + if (!tracker->lost_connection) { + /* if this tracker has gone thru the "lost_connection" procedure, + * then it has already been removed from the list - otherwise, + * remove it now */ + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + } PMIX_RELEASE(tracker); PMIX_LIST_DESTRUCT(&nslist); @@ -2348,15 +2411,6 @@ static void modex_cbfunc(pmix_status_t status, const char *data, size_t ndata, v pmix_output_verbose(2, pmix_server_globals.base_output, "server:modex_cbfunc called with %d bytes", (int)ndata); - if (NULL == tracker) { - /* nothing to do - but be sure to give them - * a release if they want it */ - if (NULL != relfn) { - relfn(relcbd); - } - return; - } - /* need to thread-shift this callback as it accesses global data */ scd = PMIX_NEW(pmix_shift_caddy_t); if (NULL == scd) { @@ -2385,7 +2439,10 @@ static void get_cbfunc(pmix_status_t status, const char *data, size_t ndata, voi pmix_output_verbose(2, pmix_server_globals.base_output, "server:get_cbfunc called with %d bytes", (int)ndata); - /* no need to thread-shift here as no global data is accessed */ + /* no need to thread-shift here as no global data is accessed + * and we are called from another internal function + * (see pmix_server_get.c:pmix_pending_resolve) that + * has already been thread-shifted */ if (NULL == cd) { /* nothing to do - but be sure to give them @@ -2421,7 +2478,10 @@ static void get_cbfunc(pmix_status_t status, const char *data, size_t ndata, voi pmix_output_hexdump(10, pmix_server_globals.base_output, reply->base_ptr, (reply->bytes_used < 256 ? reply->bytes_used : 256)); - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } cleanup: /* if someone wants a release, give it to them */ @@ -2448,6 +2508,19 @@ static void _cnct(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(scd); + if (NULL == tracker) { + /* nothing to do */ + return; + } + + /* if we get here, then there are processes waiting + * for a response */ + + /* if the timer is active, clear it */ + if (tracker->event_active) { + pmix_event_del(&tracker->ev); + } + /* find the unique nspaces that are participating */ PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) { if (NULL == nspaces) { @@ -2497,7 +2570,7 @@ static void _cnct(int sd, short args, void *cbdata) * local storage */ /* add the job-level info, if necessary */ proc.rank = PMIX_RANK_WILDCARD; - (void)strncpy(proc.nspace, nspaces[i], PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspaces[i], PMIX_MAX_NSLEN); PMIX_CONSTRUCT(&cb, pmix_cb_t); /* this is for a local client, so give the gds the * option of returning a complete copy of the data, @@ -2561,14 +2634,22 @@ static void _cnct(int sd, short args, void *cbdata) pmix_output_verbose(2, pmix_server_globals.base_output, "server:cnct_cbfunc reply being sent to %s:%u", cd->peer->info->pname.nspace, cd->peer->info->pname.rank); - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } } cleanup: if (NULL != nspaces) { pmix_argv_free(nspaces); } - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + if (!tracker->lost_connection) { + /* if this tracker has gone thru the "lost_connection" procedure, + * then it has already been removed from the list - otherwise, + * remove it now */ + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + } PMIX_RELEASE(tracker); /* we are done */ @@ -2583,11 +2664,6 @@ static void cnct_cbfunc(pmix_status_t status, void *cbdata) pmix_output_verbose(2, pmix_server_globals.base_output, "server:cnct_cbfunc called"); - if (NULL == tracker) { - /* nothing to do */ - return; - } - /* need to thread-shift this callback as it accesses global data */ scd = PMIX_NEW(pmix_shift_caddy_t); if (NULL == scd) { @@ -2609,6 +2685,19 @@ static void _discnct(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(scd); + if (NULL == tracker) { + /* nothing to do */ + return; + } + + /* if we get here, then there are processes waiting + * for a response */ + + /* if the timer is active, clear it */ + if (tracker->event_active) { + pmix_event_del(&tracker->ev); + } + /* loop across all local procs in the tracker, sending them the reply */ PMIX_LIST_FOREACH(cd, &tracker->local_cbs, pmix_server_caddy_t) { /* setup the reply */ @@ -2628,13 +2717,21 @@ static void _discnct(int sd, short args, void *cbdata) pmix_output_verbose(2, pmix_server_globals.base_output, "server:cnct_cbfunc reply being sent to %s:%u", cd->peer->info->pname.nspace, cd->peer->info->pname.rank); - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } } cleanup: /* cleanup the tracker -- the host RM is responsible for * telling us when to remove the nspace from our data */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + if (!tracker->lost_connection) { + /* if this tracker has gone thru the "lost_connection" procedure, + * then it has already been removed from the list - otherwise, + * remove it now */ + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); + } PMIX_RELEASE(tracker); /* we are done */ @@ -2650,11 +2747,6 @@ static void discnct_cbfunc(pmix_status_t status, void *cbdata) "server:discnct_cbfunc called on nspace %s", (NULL == tracker) ? "NULL" : tracker->pname.nspace); - if (NULL == tracker) { - /* nothing to do */ - return; - } - /* need to thread-shift this callback as it accesses global data */ scd = PMIX_NEW(pmix_shift_caddy_t); if (NULL == scd) { @@ -2687,7 +2779,10 @@ static void regevents_cbfunc(pmix_status_t status, void *cbdata) PMIX_ERROR_LOG(rc); } // send reply - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } PMIX_RELEASE(cd); } @@ -2711,10 +2806,71 @@ static void notifyerror_cbfunc (pmix_status_t status, void *cbdata) PMIX_ERROR_LOG(rc); } // send reply - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } PMIX_RELEASE(cd); } +static void alloc_cbfunc(pmix_status_t status, + pmix_info_t *info, size_t ninfo, + void *cbdata, + pmix_release_cbfunc_t release_fn, + void *release_cbdata) +{ + pmix_query_caddy_t *qcd = (pmix_query_caddy_t*)cbdata; + pmix_server_caddy_t *cd = (pmix_server_caddy_t*)qcd->cbdata; + pmix_buffer_t *reply; + pmix_status_t rc; + + pmix_output_verbose(2, pmix_server_globals.base_output, + "pmix:alloc callback with status %d", status); + + reply = PMIX_NEW(pmix_buffer_t); + if (NULL == reply) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_RELEASE(cd); + return; + } + PMIX_BFROPS_PACK(rc, cd->peer, reply, &status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + /* pack the returned data */ + PMIX_BFROPS_PACK(rc, cd->peer, reply, &ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (0 < ninfo) { + PMIX_BFROPS_PACK(rc, cd->peer, reply, info, ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + } + + complete: + // send reply + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + + // cleanup + if (NULL != qcd->queries) { + PMIX_QUERY_FREE(qcd->queries, qcd->nqueries); + } + if (NULL != qcd->info) { + PMIX_INFO_FREE(qcd->info, qcd->ninfo); + } + PMIX_RELEASE(qcd); + PMIX_RELEASE(cd); + if (NULL != release_fn) { + release_fn(release_cbdata); + } +} static void query_cbfunc(pmix_status_t status, pmix_info_t *info, size_t ninfo, @@ -2754,9 +2910,133 @@ static void query_cbfunc(pmix_status_t status, } } + /* cache the data for any future requests */ + + complete: + // send reply + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + + // cleanup + if (NULL != qcd->queries) { + PMIX_QUERY_FREE(qcd->queries, qcd->nqueries); + } + if (NULL != qcd->info) { + PMIX_INFO_FREE(qcd->info, qcd->ninfo); + } + PMIX_RELEASE(qcd); + PMIX_RELEASE(cd); + if (NULL != release_fn) { + release_fn(release_cbdata); + } +} + +static void jctrl_cbfunc(pmix_status_t status, + pmix_info_t *info, size_t ninfo, + void *cbdata, + pmix_release_cbfunc_t release_fn, + void *release_cbdata) +{ + pmix_query_caddy_t *qcd = (pmix_query_caddy_t*)cbdata; + pmix_server_caddy_t *cd = (pmix_server_caddy_t*)qcd->cbdata; + pmix_buffer_t *reply; + pmix_status_t rc; + + pmix_output_verbose(2, pmix_server_globals.base_output, + "pmix:jctrl callback with status %d", status); + + reply = PMIX_NEW(pmix_buffer_t); + if (NULL == reply) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_RELEASE(cd); + return; + } + PMIX_BFROPS_PACK(rc, cd->peer, reply, &status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + /* pack the returned data */ + PMIX_BFROPS_PACK(rc, cd->peer, reply, &ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (0 < ninfo) { + PMIX_BFROPS_PACK(rc, cd->peer, reply, info, ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + } + + complete: + // send reply + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + + // cleanup + if (NULL != qcd->queries) { + PMIX_QUERY_FREE(qcd->queries, qcd->nqueries); + } + if (NULL != qcd->info) { + PMIX_INFO_FREE(qcd->info, qcd->ninfo); + } + PMIX_RELEASE(qcd); + PMIX_RELEASE(cd); + if (NULL != release_fn) { + release_fn(release_cbdata); + } +} + +static void monitor_cbfunc(pmix_status_t status, + pmix_info_t *info, size_t ninfo, + void *cbdata, + pmix_release_cbfunc_t release_fn, + void *release_cbdata) +{ + pmix_query_caddy_t *qcd = (pmix_query_caddy_t*)cbdata; + pmix_server_caddy_t *cd = (pmix_server_caddy_t*)qcd->cbdata; + pmix_buffer_t *reply; + pmix_status_t rc; + + pmix_output_verbose(2, pmix_server_globals.base_output, + "pmix:monitor callback with status %d", status); + + reply = PMIX_NEW(pmix_buffer_t); + if (NULL == reply) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_RELEASE(cd); + return; + } + PMIX_BFROPS_PACK(rc, cd->peer, reply, &status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + /* pack the returned data */ + PMIX_BFROPS_PACK(rc, cd->peer, reply, &ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto complete; + } + if (0 < ninfo) { + PMIX_BFROPS_PACK(rc, cd->peer, reply, info, ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + } + } + complete: // send reply - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + // cleanup if (NULL != qcd->queries) { PMIX_QUERY_FREE(qcd->queries, qcd->nqueries); @@ -2766,6 +3046,9 @@ static void query_cbfunc(pmix_status_t status, } PMIX_RELEASE(qcd); PMIX_RELEASE(cd); + if (NULL != release_fn) { + release_fn(release_cbdata); + } } static void cred_cbfunc(pmix_status_t status, @@ -2819,7 +3102,11 @@ static void cred_cbfunc(pmix_status_t status, complete: // send reply - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } + // cleanup if (NULL != qcd->info) { PMIX_INFO_FREE(qcd->info, qcd->ninfo); @@ -2866,7 +3153,10 @@ static void validate_cbfunc(pmix_status_t status, complete: // send reply - PMIX_SERVER_QUEUE_REPLY(cd->peer, cd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, cd->peer, cd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } // cleanup if (NULL != qcd->info) { PMIX_INFO_FREE(qcd->info, qcd->ninfo); @@ -2908,7 +3198,10 @@ static void _iofreg(int sd, short args, void *cbdata) pmix_output_verbose(2, pmix_server_globals.iof_output, "server:_iofreg reply being sent to %s:%u", scd->peer->info->pname.nspace, scd->peer->info->pname.rank); - PMIX_SERVER_QUEUE_REPLY(scd->peer, scd->hdr.tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, scd->peer, scd->hdr.tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } cleanup: /* release the cached info */ @@ -2965,8 +3258,6 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, pmix_server_caddy_t *cd; pmix_proc_t proc; pmix_buffer_t *reply; - pmix_regevents_info_t *reginfo; - pmix_peer_events_info_t *prev; /* retrieve the cmd */ cnt = 1; @@ -2976,8 +3267,8 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, return rc; } pmix_output_verbose(2, pmix_server_globals.base_output, - "recvd pmix cmd %d from %s:%u", - cmd, peer->info->pname.nspace, peer->info->pname.rank); + "recvd pmix cmd %s from %s:%u", + pmix_command_string(cmd), peer->info->pname.nspace, peer->info->pname.rank); if (PMIX_REQ_CMD == cmd) { reply = PMIX_NEW(pmix_buffer_t); @@ -2990,7 +3281,10 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, PMIX_ERROR_LOG(rc); return rc; } - PMIX_SERVER_QUEUE_REPLY(peer, tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, peer, tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } peer->nptr->ndelivered++; return PMIX_SUCCESS; } @@ -3015,7 +3309,10 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } - PMIX_SERVER_QUEUE_REPLY(peer, tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, peer, tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } } return PMIX_SUCCESS; // don't reply twice } @@ -3039,20 +3336,9 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, if (PMIX_FINALIZE_CMD == cmd) { pmix_output_verbose(2, pmix_server_globals.base_output, "recvd FINALIZE"); - /* mark that this peer called finalize */ - peer->finalized = true; peer->nptr->nfinalized++; - /* since the client is finalizing, remove them from any event - * registrations they may still have on our list */ - PMIX_LIST_FOREACH(reginfo, &pmix_server_globals.events, pmix_regevents_info_t) { - PMIX_LIST_FOREACH(prev, ®info->peers, pmix_peer_events_info_t) { - if (prev->peer == peer) { - pmix_list_remove_item(®info->peers, &prev->super); - PMIX_RELEASE(prev); - break; - } - } - } + /* purge events */ + pmix_server_purge_events(peer, NULL); /* turn off the recv event - we shouldn't hear anything * more from this proc */ if (peer->recv_ev_active) { @@ -3062,14 +3348,18 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, PMIX_GDS_CADDY(cd, peer, tag); /* call the local server, if supported */ if (NULL != pmix_host_server.client_finalized) { - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* now tell the host server */ - if (PMIX_SUCCESS == (rc = pmix_host_server.client_finalized(&proc, peer->info->server_object, - op_cbfunc2, cd))) { + rc = pmix_host_server.client_finalized(&proc, peer->info->server_object, + op_cbfunc2, cd); + if (PMIX_SUCCESS == rc) { /* don't reply to them ourselves - we will do so when the host * server calls us back */ return rc; + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* they did it atomically */ + rc = PMIX_SUCCESS; } /* if the call doesn't succeed (e.g., they provided the stub * but return NOT_SUPPORTED), then the callback function @@ -3077,7 +3367,7 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, * any lingering references to this peer and answer * the client. Thus, we call the callback function ourselves * in this case */ - op_cbfunc2(PMIX_SUCCESS, cd); + op_cbfunc2(rc, cd); /* return SUCCESS as the cbfunc generated the return msg * and released the cd object */ return PMIX_SUCCESS; @@ -3134,14 +3424,18 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, if (PMIX_CONNECTNB_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); rc = pmix_server_connect(cd, buf, cnct_cbfunc); - PMIX_RELEASE(cd); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_DISCONNECTNB_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); rc = pmix_server_disconnect(cd, buf, discnct_cbfunc); - PMIX_RELEASE(cd); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(cd); + } return rc; } @@ -3160,61 +3454,81 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, if (PMIX_NOTIFY_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_event_recvd_from_client(peer, buf, notifyerror_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_event_recvd_from_client(peer, buf, notifyerror_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_QUERY_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_query(peer, buf, query_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_query(peer, buf, query_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_LOG_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_log(peer, buf, op_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_log(peer, buf, op_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_ALLOC_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_alloc(peer, buf, query_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_alloc(peer, buf, alloc_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_JOB_CONTROL_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_job_ctrl(peer, buf, query_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_job_ctrl(peer, buf, jctrl_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_MONITOR_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_monitor(peer, buf, query_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_monitor(peer, buf, monitor_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_GET_CREDENTIAL_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_get_credential(peer, buf, cred_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_get_credential(peer, buf, cred_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_VALIDATE_CRED_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_validate_credential(peer, buf, validate_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_validate_credential(peer, buf, validate_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_IOF_PULL_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_iofreg(peer, buf, iof_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_iofreg(peer, buf, iof_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } if (PMIX_IOF_PUSH_CMD == cmd) { PMIX_GDS_CADDY(cd, peer, tag); - rc = pmix_server_iofstdin(peer, buf, op_cbfunc, cd); + if (PMIX_SUCCESS != (rc = pmix_server_iofstdin(peer, buf, op_cbfunc, cd))) { + PMIX_RELEASE(cd); + } return rc; } @@ -3249,6 +3563,9 @@ void pmix_server_message_handler(struct pmix_peer_t *pr, if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); } - PMIX_SERVER_QUEUE_REPLY(peer, hdr->tag, reply); + PMIX_SERVER_QUEUE_REPLY(rc, peer, hdr->tag, reply); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(reply); + } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c index a0e474e596d..56c05308014 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c @@ -84,7 +84,7 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_reply_caddy_t, static void dmdx_cbfunc(pmix_status_t status, const char *data, size_t ndata, void *cbdata, pmix_release_cbfunc_t relfn, void *relcbdata); -static pmix_status_t _satisfy_request(pmix_nspace_t *ns, pmix_rank_t rank, +static pmix_status_t _satisfy_request(pmix_namespace_t *ns, pmix_rank_t rank, pmix_server_caddy_t *cd, pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *scope); static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, @@ -119,7 +119,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_rank_t rank; char *cptr; char nspace[PMIX_MAX_NSLEN+1]; - pmix_nspace_t *ns, *nptr; + pmix_namespace_t *ns, *nptr; pmix_info_t *info=NULL; size_t ninfo=0; pmix_dmdx_local_t *lcd; @@ -148,7 +148,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, PMIX_ERROR_LOG(rc); return rc; } - (void)strncpy(nspace, cptr, PMIX_MAX_NSLEN); + pmix_strncpy(nspace, cptr, PMIX_MAX_NSLEN); free(cptr); cnt = 1; PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &rank, &cnt, PMIX_PROC_RANK); @@ -191,7 +191,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* find the nspace object for this client */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(nspace, ns->nspace)) { nptr = ns; break; @@ -245,14 +245,22 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, if (PMIX_ERR_NOMEM == rc) { PMIX_INFO_FREE(info, ninfo); return rc; - } else if (PMIX_ERR_NOT_FOUND != rc) { - return rc; } - - /* do NOT create the nspace tracker here so any request - * by another local client that hits before the RM responds - * to our request will get added to the local tracker so - * they receive their data upon completion */ + if (PMIX_SUCCESS == rc) { + /* if they specified a timeout for this specific + * request, set it up now */ + if (0 < tv.tv_sec) { + pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, + get_timeout, req); + pmix_event_evtimer_add(&req->ev, &tv); + req->event_active = true; + } + /* we already asked for this info - no need to + * do it again */ + return PMIX_SUCCESS; + } + /* only other return code is NOT_FOUND, indicating that + * we created a new tracker */ /* Its possible there will be no local processes on this * host, so lets ask for this explicitly. There can @@ -260,16 +268,29 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * up on its own, but at worst the direct modex * will simply overwrite the info later */ if (NULL != pmix_host_server.direct_modex) { - pmix_host_server.direct_modex(&lcd->proc, info, ninfo, dmdx_cbfunc, lcd); + rc = pmix_host_server.direct_modex(&lcd->proc, info, ninfo, dmdx_cbfunc, lcd); + if (PMIX_SUCCESS != rc) { + PMIX_INFO_FREE(info, ninfo); + pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); + PMIX_RELEASE(lcd); + return rc; + } + /* if they specified a timeout for this specific + * request, set it up now */ + if (0 < tv.tv_sec) { + pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, + get_timeout, req); + pmix_event_evtimer_add(&req->ev, &tv); + req->event_active = true; + } + } else { + /* if we don't have direct modex feature, just respond with "not found" */ + PMIX_INFO_FREE(info, ninfo); + pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); + PMIX_RELEASE(lcd); + return PMIX_ERR_NOT_FOUND; } - /* if they specified a timeout, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } return PMIX_SUCCESS; } @@ -282,7 +303,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * for it, so there is no guarantee we have it */ data = NULL; sz = 0; - (void)strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; /* if we have local procs for this nspace, then we * can retrieve the info from that GDS. Otherwise, @@ -323,7 +344,11 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* unload the resulting payload */ PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); + /* call the internal callback function - it will + * release the cbdata */ cbfunc(PMIX_SUCCESS, data, sz, cbdata, relfn, data); + /* return success so the server doesn't duplicate + * the release of cbdata */ return PMIX_SUCCESS; } @@ -353,6 +378,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, cbfunc, cbdata, &lcd, &req); if (PMIX_ERR_NOMEM == rc) { PMIX_INFO_FREE(info, ninfo); + return rc; } pmix_output_verbose(2, pmix_server_globals.get_output, "%s:%d TRACKER CREATED - WAITING", @@ -365,15 +391,20 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_event_evtimer_add(&req->ev, &tv); req->event_active = true; } - return rc; + /* the peer object has been added to the new lcd tracker, + * so return success here */ + return PMIX_SUCCESS; } - /* see if we already have this data */ + /* if everyone has registered, see if we already have this data */ rc = _satisfy_request(nptr, rank, cd, cbfunc, cbdata, &local); if( PMIX_SUCCESS == rc ){ /* request was successfully satisfied */ PMIX_INFO_FREE(info, ninfo); - return rc; + /* return success as the satisfy_request function + * calls the cbfunc for us, and it will have + * released the cbdata object */ + return PMIX_SUCCESS; } pmix_output_verbose(2, pmix_server_globals.get_output, @@ -395,18 +426,24 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * we do, then we can just wait for it to arrive */ rc = create_local_tracker(nspace, rank, info, ninfo, cbfunc, cbdata, &lcd, &req); + if (PMIX_ERR_NOMEM == rc || NULL == lcd) { + /* we have a problem */ + PMIX_INFO_FREE(info, ninfo); + return PMIX_ERR_NOMEM; + } + /* if they specified a timeout, set it up now */ + if (0 < tv.tv_sec) { + pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, + get_timeout, req); + pmix_event_evtimer_add(&req->ev, &tv); + req->event_active = true; + } if (PMIX_SUCCESS == rc) { /* we are already waiting for the data - nothing more * for us to do as the function added the new request * to the tracker for us */ return PMIX_SUCCESS; } - if (PMIX_ERR_NOT_FOUND != rc || NULL == lcd) { - /* we have a problem - e.g., out of memory */ - cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, cbdata, NULL, NULL); - PMIX_INFO_FREE(info, ninfo); - return rc; - } /* Getting here means that we didn't already have a request for * for data pending, and so we created a new tracker for this @@ -414,13 +451,6 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * if this is one, then we have nothing further to do - we will * fulfill the request once the process commits its data */ if (local) { - /* if they specified a timeout, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; - } return PMIX_SUCCESS; } @@ -429,12 +459,11 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * whomever is hosting the target process */ if (NULL != pmix_host_server.direct_modex) { rc = pmix_host_server.direct_modex(&lcd->proc, info, ninfo, dmdx_cbfunc, lcd); - /* if they specified a timeout, set it up now */ - if (0 < tv.tv_sec) { - pmix_event_evtimer_set(pmix_globals.evbase, &req->ev, - get_timeout, req); - pmix_event_evtimer_add(&req->ev, &tv); - req->event_active = true; + if (PMIX_SUCCESS != rc) { + /* may have a function entry but not support the request */ + PMIX_INFO_FREE(info, ninfo); + pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); + PMIX_RELEASE(lcd); } } else { pmix_output_verbose(2, pmix_server_globals.get_output, @@ -442,7 +471,6 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_globals.myid.nspace, pmix_globals.myid.rank); /* if we don't have direct modex feature, just respond with "not found" */ - cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, cbdata, NULL, NULL); PMIX_INFO_FREE(info, ninfo); pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); PMIX_RELEASE(lcd); @@ -490,7 +518,7 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, if (NULL == lcd){ return PMIX_ERR_NOMEM; } - strncpy(lcd->proc.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(lcd->proc.nspace, nspace, PMIX_MAX_NSLEN); lcd->proc.rank = rank; lcd->info = info; lcd->ninfo = ninfo; @@ -515,9 +543,10 @@ static pmix_status_t create_local_tracker(char nspace[], pmix_rank_t rank, return rc; } -void pmix_pending_nspace_requests(pmix_nspace_t *nptr) +void pmix_pending_nspace_requests(pmix_namespace_t *nptr) { pmix_dmdx_local_t *cd, *cd_next; + pmix_status_t rc; /* Now that we know all local ranks, go along request list and ask for remote data * for the non-local ranks, and resolve all pending requests for local procs @@ -540,10 +569,12 @@ void pmix_pending_nspace_requests(pmix_nspace_t *nptr) /* if not found - this is remote process and we need to send * corresponding direct modex request */ - if( !found ){ - if( NULL != pmix_host_server.direct_modex ){ - pmix_host_server.direct_modex(&cd->proc, cd->info, cd->ninfo, dmdx_cbfunc, cd); - } else { + if (!found){ + rc = PMIX_ERR_NOT_SUPPORTED; + if (NULL != pmix_host_server.direct_modex){ + rc = pmix_host_server.direct_modex(&cd->proc, cd->info, cd->ninfo, dmdx_cbfunc, cd); + } + if (PMIX_SUCCESS != rc) { pmix_dmdx_request_t *req, *req_next; PMIX_LIST_FOREACH_SAFE(req, req_next, &cd->loc_reqs, pmix_dmdx_request_t) { req->cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, req->cbdata, NULL, NULL); @@ -557,7 +588,7 @@ void pmix_pending_nspace_requests(pmix_nspace_t *nptr) } } -static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank, +static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_server_caddy_t *cd, pmix_modex_cbfunc_t cbfunc, void *cbdata, bool *local) @@ -584,7 +615,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank, * a remote peer, or due to data from a local client * having been committed */ PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - (void)strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); /* if we have local clients of this nspace, then we use * the corresponding GDS to retrieve the data. Otherwise, @@ -771,7 +802,7 @@ static pmix_status_t _satisfy_request(pmix_nspace_t *nptr, pmix_rank_t rank, } /* Resolve pending requests to this namespace/rank */ -pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank, +pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_status_t status, pmix_dmdx_local_t *lcd) { pmix_dmdx_local_t *cd, *ptr; @@ -783,7 +814,7 @@ pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank, ptr = NULL; if (NULL != nptr) { PMIX_LIST_FOREACH(cd, &pmix_server_globals.local_reqs, pmix_dmdx_local_t) { - if (0 != strncmp(nptr->nspace, cd->proc.nspace, PMIX_MAX_NSLEN) || + if (!PMIX_CHECK_NSPACE(nptr->nspace, cd->proc.nspace) || rank != cd->proc.rank) { continue; } @@ -798,6 +829,13 @@ pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank, ptr = lcd; } + /* if there are no local reqs on this request (e.g., only + * one proc requested it and that proc has died), then + * just remove the request */ + if (0 == pmix_list_get_size(&ptr->loc_reqs)) { + goto cleanup; + } + /* somebody was interested in this rank */ if (PMIX_SUCCESS != status){ /* if we've got an error for this request - just forward it*/ @@ -822,8 +860,10 @@ pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank, } PMIX_RELEASE(scd); } + + cleanup: /* remove all requests to this rank and cleanup the corresponding structure */ - pmix_list_remove_item(&pmix_server_globals.local_reqs, (pmix_list_item_t*)ptr); + pmix_list_remove_item(&pmix_server_globals.local_reqs, &ptr->super); PMIX_RELEASE(ptr); return PMIX_SUCCESS; @@ -838,7 +878,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) pmix_rank_info_t *rinfo; int32_t cnt; pmix_kval_t *kv; - pmix_nspace_t *ns, *nptr; + pmix_namespace_t *ns, *nptr; pmix_status_t rc; pmix_list_t nspaces; pmix_nspace_caddy_t *nm; @@ -856,7 +896,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) /* find the nspace object for the proc whose data is being received */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(caddy->lcd->proc.nspace, ns->nspace)) { nptr = ns; break; @@ -867,7 +907,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) /* We may not have this namespace because there are no local * processes from it running on this host - so just record it * so we know we have the data for any future requests */ - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); nptr->nspace = strdup(caddy->lcd->proc.nspace); /* add to the list */ pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); @@ -931,7 +971,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) PMIX_DESTRUCT(&cb); goto complete; } - (void)strncpy(cb.proc->nspace, nm->ns->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(cb.proc->nspace, nm->ns->nspace, PMIX_MAX_NSLEN); cb.proc->rank = PMIX_RANK_WILDCARD; cb.scope = PMIX_INTERNAL; cb.copy = false; diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 7293c6e155f..5e239e0d03d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. @@ -46,6 +46,9 @@ #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef HAVE_TIME_H +#include +#endif #include PMIX_EVENT_HEADER #include "src/class/pmix_hotel.h" @@ -116,16 +119,12 @@ pmix_status_t pmix_server_abort(pmix_peer_t *peer, pmix_buffer_t *buf, /* let the local host's server execute it */ if (NULL != pmix_host_server.abort) { - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.abort(&proc, peer->info->server_object, status, msg, procs, nprocs, cbfunc, cbdata); } else { rc = PMIX_ERR_NOT_SUPPORTED; - /* release the caller */ - if (NULL != cbfunc) { - cbfunc(rc, cbdata); - } } PMIX_PROC_FREE(procs, nprocs); @@ -145,7 +144,7 @@ pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf) pmix_buffer_t b2, pbkt; pmix_kval_t *kp; pmix_scope_t scope; - pmix_nspace_t *nptr; + pmix_namespace_t *nptr; pmix_rank_info_t *info; pmix_proc_t proc; pmix_dmdx_remote_t *dcd, *dcdnext; @@ -156,7 +155,7 @@ pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf) /* shorthand */ info = peer->info; nptr = peer->nptr; - (void)strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); proc.rank = info->pname.rank; pmix_output_verbose(2, pmix_server_globals.base_output, @@ -293,7 +292,7 @@ pmix_status_t pmix_server_commit(pmix_peer_t *peer, pmix_buffer_t *buf) * regardless of location * nprocs - the number of procs in the array */ -static pmix_server_trkr_t* get_tracker(pmix_proc_t *procs, +static pmix_server_trkr_t* get_tracker(char *id, pmix_proc_t *procs, size_t nprocs, pmix_cmd_t type) { pmix_server_trkr_t *trk; @@ -304,7 +303,7 @@ static pmix_server_trkr_t* get_tracker(pmix_proc_t *procs, "get_tracker called with %d procs", (int)nprocs); /* bozo check - should never happen outside of programmer error */ - if (NULL == procs) { + if (NULL == procs && NULL == id) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return NULL; } @@ -317,28 +316,35 @@ static pmix_server_trkr_t* get_tracker(pmix_proc_t *procs, * shouldn't take long */ PMIX_LIST_FOREACH(trk, &pmix_server_globals.collectives, pmix_server_trkr_t) { /* Collective operation if unique identified by - * the set of participating processes and the type of collective + * the set of participating processes and the type of collective, + * or by the operation ID */ - if (nprocs != trk->npcs) { - continue; - } - if (type != trk->type) { - continue; - } - matches = 0; - for (i=0; i < nprocs; i++) { - /* the procs may be in different order, so we have - * to do an exhaustive search */ - for (j=0; j < trk->npcs; j++) { - if (0 == strcmp(procs[i].nspace, trk->pcs[j].nspace) && - procs[i].rank == trk->pcs[j].rank) { - ++matches; - break; + if (NULL != id) { + if (NULL != trk->id && 0 == strcmp(id, trk->id)) { + return trk; + } + } else { + if (nprocs != trk->npcs) { + continue; + } + if (type != trk->type) { + continue; + } + matches = 0; + for (i=0; i < nprocs; i++) { + /* the procs may be in different order, so we have + * to do an exhaustive search */ + for (j=0; j < trk->npcs; j++) { + if (0 == strcmp(procs[i].nspace, trk->pcs[j].nspace) && + procs[i].rank == trk->pcs[j].rank) { + ++matches; + break; + } } } - } - if (trk->npcs == matches) { - return trk; + if (trk->npcs == matches) { + return trk; + } } } /* No tracker was found */ @@ -361,13 +367,13 @@ static pmix_server_trkr_t* get_tracker(pmix_proc_t *procs, * regardless of location * nprocs - the number of procs in the array */ -static pmix_server_trkr_t* new_tracker(pmix_proc_t *procs, +static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, size_t nprocs, pmix_cmd_t type) { pmix_server_trkr_t *trk; size_t i; bool all_def; - pmix_nspace_t *nptr, *ns; + pmix_namespace_t *nptr, *ns; pmix_rank_info_t *info; pmix_output_verbose(5, pmix_server_globals.base_output, @@ -380,7 +386,8 @@ static pmix_server_trkr_t* new_tracker(pmix_proc_t *procs, } pmix_output_verbose(5, pmix_server_globals.base_output, - "adding new tracker with %d procs", (int)nprocs); + "adding new tracker %s with %d procs", + (NULL == id) ? "NO-ID" : id, (int)nprocs); /* this tracker is new - create it */ trk = PMIX_NEW(pmix_server_trkr_t); @@ -389,26 +396,35 @@ static pmix_server_trkr_t* new_tracker(pmix_proc_t *procs, return NULL; } - /* copy the procs */ - PMIX_PROC_CREATE(trk->pcs, nprocs); - if (NULL == trk->pcs) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - PMIX_RELEASE(trk); - return NULL; + if (NULL != id) { + trk->id = strdup(id); + } + + if (NULL != procs) { + /* copy the procs */ + PMIX_PROC_CREATE(trk->pcs, nprocs); + if (NULL == trk->pcs) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_RELEASE(trk); + return NULL; + } + memcpy(trk->pcs, procs, nprocs * sizeof(pmix_proc_t)); + trk->npcs = nprocs; } - trk->npcs = nprocs; trk->type = type; all_def = true; for (i=0; i < nprocs; i++) { - (void)strncpy(trk->pcs[i].nspace, procs[i].nspace, PMIX_MAX_NSLEN); - trk->pcs[i].rank = procs[i].rank; + if (NULL == id) { + pmix_strncpy(trk->pcs[i].nspace, procs[i].nspace, PMIX_MAX_NSLEN); + trk->pcs[i].rank = procs[i].rank; + } if (!all_def) { continue; } /* is this nspace known to us? */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(procs[i].nspace, ns->nspace)) { nptr = ns; break; @@ -560,9 +576,9 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, } /* find/create the local tracker for this operation */ - if (NULL == (trk = get_tracker(procs, nprocs, PMIX_FENCENB_CMD))) { + if (NULL == (trk = get_tracker(NULL, procs, nprocs, PMIX_FENCENB_CMD))) { /* If no tracker was found - create and initialize it once */ - if (NULL == (trk = new_tracker(procs, nprocs, PMIX_FENCENB_CMD))) { + if (NULL == (trk = new_tracker(NULL, procs, nprocs, PMIX_FENCENB_CMD))) { /* only if a bozo error occurs */ PMIX_ERROR_LOG(PMIX_ERROR); /* DO NOT HANG */ @@ -650,7 +666,7 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, PMIX_LIST_FOREACH(scd, &trk->local_cbs, pmix_server_caddy_t) { /* get any remote contribution - note that there * may not be a contribution */ - (void)strncpy(pcs.nspace, scd->peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(pcs.nspace, scd->peer->info->pname.nspace, PMIX_MAX_NSLEN); pcs.rank = scd->peer->info->pname.rank; PMIX_CONSTRUCT(&cb, pmix_cb_t); cb.proc = &pcs; @@ -709,9 +725,13 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, /* now unload the blob and pass it upstairs */ PMIX_UNLOAD_BUFFER(&bucket, data, sz); PMIX_DESTRUCT(&bucket); - pmix_host_server.fence_nb(trk->pcs, trk->npcs, - trk->info, trk->ninfo, - data, sz, trk->modexcbfunc, trk); + rc = pmix_host_server.fence_nb(trk->pcs, trk->npcs, + trk->info, trk->ninfo, + data, sz, trk->modexcbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } } cleanup: @@ -792,12 +812,12 @@ pmix_status_t pmix_server_publish(pmix_peer_t *peer, goto cleanup; } } - (void)strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); + pmix_strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); cd->info[cd->ninfo-1].value.type = PMIX_UINT32; cd->info[cd->ninfo-1].value.data.uint32 = uid; /* call the local server */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.publish(&proc, cd->info, cd->ninfo, opcbfunc, cd); @@ -906,12 +926,12 @@ pmix_status_t pmix_server_lookup(pmix_peer_t *peer, goto cleanup; } } - (void)strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); + pmix_strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); cd->info[cd->ninfo-1].value.type = PMIX_UINT32; cd->info[cd->ninfo-1].value.data.uint32 = uid; /* call the local server */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.lookup(&proc, cd->keys, cd->info, cd->ninfo, lkcbfunc, cd); @@ -1002,12 +1022,12 @@ pmix_status_t pmix_server_unpublish(pmix_peer_t *peer, goto cleanup; } } - (void)strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); + pmix_strncpy(cd->info[cd->ninfo-1].key, PMIX_USERID, PMIX_MAX_KEYLEN); cd->info[cd->ninfo-1].value.type = PMIX_UINT32; cd->info[cd->ninfo-1].value.data.uint32 = uid; /* call the local server */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.unpublish(&proc, cd->keys, cd->info, cd->ninfo, opcbfunc, cd); @@ -1029,88 +1049,90 @@ static void spcbfunc(pmix_status_t status, { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_iof_req_t *req; - pmix_setup_caddy_t *occupant; - int i; pmix_buffer_t *msg; pmix_status_t rc; + pmix_iof_cache_t *iof, *ionext; /* if it was successful, and there are IOF requests, then * register them now */ if (PMIX_SUCCESS == status && PMIX_FWD_NO_CHANNELS != cd->channels) { /* record the request */ req = PMIX_NEW(pmix_iof_req_t); - if (NULL != req) { - PMIX_RETAIN(cd->peer); - req->peer = cd->peer; - req->pname.nspace = strdup(nspace); - req->pname.rank = PMIX_RANK_WILDCARD; - req->channels = cd->channels; - pmix_list_append(&pmix_globals.iof_requests, &req->super); + if (NULL == req) { + status = PMIX_ERR_NOMEM; + goto cleanup; } + PMIX_RETAIN(cd->peer); + req->peer = cd->peer; + req->pname.nspace = strdup(nspace); + req->pname.rank = PMIX_RANK_WILDCARD; + req->channels = cd->channels; + pmix_list_append(&pmix_globals.iof_requests, &req->super); /* process any cached IO */ - for (i=0; i < PMIX_IOF_HOTEL_SIZE; i++) { - pmix_hotel_knock(&pmix_server_globals.iof, PMIX_IOF_HOTEL_SIZE-i-1, (void**)&occupant); - if (NULL != occupant) { - if (!(occupant->channels & req->channels)) { - continue; - } - /* if the source matches the request, then forward this along */ - if (0 != strncmp(occupant->procs->nspace, req->pname.nspace, PMIX_MAX_NSLEN) || - (PMIX_RANK_WILDCARD != req->pname.rank && occupant->procs->rank != req->pname.rank)) { - continue; - } - /* never forward back to the source! This can happen if the source - * is a launcher */ - if (0 == strncmp(occupant->procs->nspace, req->peer->info->pname.nspace, PMIX_MAX_NSLEN) && - occupant->procs->rank == req->peer->info->pname.rank) { - continue; - } - /* setup the msg */ - if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - rc = PMIX_ERR_OUT_OF_RESOURCE; - break; - } - /* provide the source */ - PMIX_BFROPS_PACK(rc, req->peer, msg, occupant->procs, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* provide the channel */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &occupant->channels, 1, PMIX_IOF_CHANNEL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* pack the data */ - PMIX_BFROPS_PACK(rc, req->peer, msg, occupant->bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* send it to the requestor */ - PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - } - /* remove it from the hotel since it has now been forwarded */ - pmix_hotel_checkout(&pmix_server_globals.iof, PMIX_IOF_HOTEL_SIZE-i-1); - PMIX_RELEASE(occupant); + PMIX_LIST_FOREACH_SAFE(iof, ionext, &pmix_server_globals.iof, pmix_iof_cache_t) { + /* if the channels don't match, then ignore it */ + if (!(iof->channel & req->channels)) { + continue; + } + /* if the source does not match the request, then ignore it */ + if (!PMIX_CHECK_PROCID(&iof->source, &req->pname)) { + continue; + } + /* never forward back to the source! This can happen if the source + * is a launcher */ + if (PMIX_CHECK_PROCID(&iof->source, &req->peer->info->pname)) { + continue; + } + pmix_output_verbose(2, pmix_server_globals.iof_output, + "PMIX:SERVER:SPAWN delivering cached IOF from %s:%d to %s:%d", + iof->source.nspace, iof->source.rank, + req->pname.nspace, req->pname.rank); + /* setup the msg */ + if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + rc = PMIX_ERR_OUT_OF_RESOURCE; + break; + } + /* provide the source */ + PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->source, 1, PMIX_PROC); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* provide the channel */ + PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->channel, 1, PMIX_IOF_CHANNEL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* pack the data */ + PMIX_BFROPS_PACK(rc, req->peer, msg, iof->bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* send it to the requestor */ + PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); } + /* remove it from the list since it has now been forwarded */ + pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); + PMIX_RELEASE(iof); } } + cleanup: /* cleanup the caddy */ if (NULL != cd->info) { PMIX_INFO_FREE(cd->info, cd->ninfo); } if (NULL != cd->apps) { - PMIX_APP_CREATE(cd->apps, cd->napps); + PMIX_APP_FREE(cd->apps, cd->napps); } if (NULL != cd->spcbfunc) { cd->spcbfunc(status, nspace, cd->cbdata); @@ -1134,7 +1156,6 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, "recvd SPAWN from %s:%d", peer->info->pname.nspace, peer->info->pname.rank); if (NULL == pmix_host_server.spawn) { - PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; } @@ -1200,7 +1221,8 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, } } } - /* we will construct any required iof request tracker upon completion of the spawn */ + /* we will construct any required iof request tracker upon completion of the spawn + * as we need the nspace of the spawned application! */ } /* add the directive to the end */ if (PMIX_PROC_IS_TOOL(peer)) { @@ -1242,7 +1264,7 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, } } /* call the local server */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; rc = pmix_host_server.spawn(&proc, cd->info, cd->ninfo, cd->apps, cd->napps, spcbfunc, cd); @@ -1326,15 +1348,11 @@ pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, } /* find/create the local tracker for this operation */ - if (NULL == (trk = get_tracker(procs, nprocs, PMIX_DISCONNECTNB_CMD))) { + if (NULL == (trk = get_tracker(NULL, procs, nprocs, PMIX_DISCONNECTNB_CMD))) { /* we don't have this tracker yet, so get a new one */ - if (NULL == (trk = new_tracker(procs, nprocs, PMIX_DISCONNECTNB_CMD))) { + if (NULL == (trk = new_tracker(NULL, procs, nprocs, PMIX_DISCONNECTNB_CMD))) { /* only if a bozo error occurs */ PMIX_ERROR_LOG(PMIX_ERROR); - /* DO NOT HANG */ - if (NULL != cbfunc) { - cbfunc(PMIX_ERROR, cd); - } rc = PMIX_ERROR; goto cleanup; } @@ -1352,7 +1370,6 @@ pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, /* add this contributor to the tracker so they get * notified when we are done */ - PMIX_RETAIN(cd); // prevent the caddy from being released when we return pmix_list_append(&trk->local_cbs, &cd->super); /* if all local contributions have been received, * let the local host's server know that we are at the @@ -1361,6 +1378,11 @@ pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { rc = pmix_host_server.disconnect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); + if (PMIX_SUCCESS != rc) { + /* remove this contributor from the list - they will be notified + * by the switchyard */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + } } else { rc = PMIX_SUCCESS; } @@ -1470,9 +1492,9 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, } /* find/create the local tracker for this operation */ - if (NULL == (trk = get_tracker(procs, nprocs, PMIX_CONNECTNB_CMD))) { + if (NULL == (trk = get_tracker(NULL, procs, nprocs, PMIX_CONNECTNB_CMD))) { /* we don't have this tracker yet, so get a new one */ - if (NULL == (trk = new_tracker(procs, nprocs, PMIX_CONNECTNB_CMD))) { + if (NULL == (trk = new_tracker(NULL, procs, nprocs, PMIX_CONNECTNB_CMD))) { /* only if a bozo error occurs */ PMIX_ERROR_LOG(PMIX_ERROR); /* DO NOT HANG */ @@ -1496,17 +1518,7 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, /* add this contributor to the tracker so they get * notified when we are done */ - PMIX_RETAIN(cd); // prevent the caddy from being released when we return pmix_list_append(&trk->local_cbs, &cd->super); - /* if a timeout was specified, set it */ - if (0 < tv.tv_sec) { - PMIX_RETAIN(trk); - cd->trk = trk; - pmix_event_evtimer_set(pmix_globals.evbase, &cd->ev, - connect_timeout, cd); - pmix_event_evtimer_add(&cd->ev, &tv); - cd->event_active = true; - } /* if all local contributions have been received, * let the local host's server know that we are at the @@ -1515,9 +1527,23 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { rc = pmix_host_server.connect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); + if (PMIX_SUCCESS != rc) { + /* remove this contributor from the list - they will be notified + * by the switchyard */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + } } else { rc = PMIX_SUCCESS; } + /* if a timeout was specified, set it */ + if (PMIX_SUCCESS == rc && 0 < tv.tv_sec) { + PMIX_RETAIN(trk); + cd->trk = trk; + pmix_event_evtimer_set(pmix_globals.evbase, &cd->ev, + connect_timeout, cd); + pmix_event_evtimer_add(&cd->ev, &tv); + cd->event_active = true; + } cleanup: if (NULL != procs) { @@ -1535,12 +1561,12 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, void *cbdata) { int32_t cnt; - pmix_status_t rc; + pmix_status_t rc, ret = PMIX_SUCCESS; pmix_status_t *codes = NULL; pmix_info_t *info = NULL; size_t ninfo=0, ncodes, n, k; pmix_regevents_info_t *reginfo; - pmix_peer_events_info_t *prev; + pmix_peer_events_info_t *prev = NULL; pmix_notify_caddy_t *cd; pmix_setup_caddy_t *scd; int i; @@ -1550,6 +1576,8 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, pmix_cmd_t cmd = PMIX_NOTIFY_CMD; pmix_proc_t *affected = NULL; size_t naffected = 0; + pmix_range_trkr_t rngtrk; + pmix_proc_t proc; pmix_output_verbose(2, pmix_server_globals.event_output, "recvd register events for peer %s:%d", @@ -1601,9 +1629,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, /* check the directives */ for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_EVENT_ENVIRO_LEVEL, PMIX_MAX_KEYLEN)) { - enviro_events = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strncmp(info[n].key, PMIX_EVENT_AFFECTED_PROC, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_AFFECTED_PROC)) { if (NULL != affected) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); rc = PMIX_ERR_BAD_PARAM; @@ -1612,7 +1638,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, naffected = 1; PMIX_PROC_CREATE(affected, naffected); memcpy(affected, info[n].value.data.proc, sizeof(pmix_proc_t)); - } else if (0 == strncmp(info[n].key, PMIX_EVENT_AFFECTED_PROCS, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_EVENT_AFFECTED_PROCS)) { if (NULL != affected) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); rc = PMIX_ERR_BAD_PARAM; @@ -1624,6 +1650,14 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, } } + /* check the codes for system events */ + for (n=0; n < ncodes; n++) { + if (PMIX_SYSTEM_EVENT(codes[n])) { + enviro_events = true; + break; + } + } + /* if they asked for enviro events, and our host doesn't support * register_events, then we cannot meet the request */ if (enviro_events && NULL == pmix_host_server.register_events) { @@ -1632,10 +1666,36 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, goto cleanup; } + /* if they didn't send us any codes, then they are registering a + * default event handler. In that case, check only for default + * handlers and add this request to it, if not already present */ + if (0 == ncodes) { + PMIX_LIST_FOREACH(reginfo, &pmix_server_globals.events, pmix_regevents_info_t) { + if (PMIX_MAX_ERR_CONSTANT == reginfo->code) { + /* both are default handlers */ + prev = PMIX_NEW(pmix_peer_events_info_t); + if (NULL == prev) { + rc = PMIX_ERR_NOMEM; + goto cleanup; + } + PMIX_RETAIN(peer); + prev->peer = peer; + if (NULL != affected) { + PMIX_PROC_CREATE(prev->affected, naffected); + prev->naffected = naffected; + memcpy(prev->affected, affected, naffected * sizeof(pmix_proc_t)); + } + pmix_list_append(®info->peers, &prev->super); + break; + } + } + rc = PMIX_OPERATION_SUCCEEDED; + goto cleanup; + } + /* store the event registration info so we can call the registered * client when the server notifies the event */ - k=0; - do { + for (n=0; n < ncodes; n++) { found = false; PMIX_LIST_FOREACH(reginfo, &pmix_server_globals.events, pmix_regevents_info_t) { if (NULL == codes) { @@ -1649,35 +1709,28 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, } else { if (PMIX_MAX_ERR_CONSTANT == reginfo->code) { continue; - } else if (codes[k] == reginfo->code) { + } else if (codes[n] == reginfo->code) { found = true; break; } } } if (found) { - /* found it - add this peer if we don't already have it */ - found = false; - PMIX_LIST_FOREACH(prev, ®info->peers, pmix_peer_events_info_t) { - if (prev->peer == peer) { - /* already have it */ - rc = PMIX_SUCCESS; - found = true; - break; - } + /* found it - add this request */ + prev = PMIX_NEW(pmix_peer_events_info_t); + if (NULL == prev) { + rc = PMIX_ERR_NOMEM; + goto cleanup; } - if (!found) { - /* get here if we don't already have this peer */ - prev = PMIX_NEW(pmix_peer_events_info_t); - if (NULL == prev) { - rc = PMIX_ERR_NOMEM; - goto cleanup; - } - PMIX_RETAIN(peer); - prev->peer = peer; - prev->enviro_events = enviro_events; - pmix_list_append(®info->peers, &prev->super); + PMIX_RETAIN(peer); + prev->peer = peer; + if (NULL != affected) { + PMIX_PROC_CREATE(prev->affected, naffected); + prev->naffected = naffected; + memcpy(prev->affected, affected, naffected * sizeof(pmix_proc_t)); } + prev->enviro_events = enviro_events; + pmix_list_append(®info->peers, &prev->super); } else { /* if we get here, then we didn't find an existing registration for this code */ reginfo = PMIX_NEW(pmix_regevents_info_t); @@ -1688,7 +1741,7 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, if (NULL == codes) { reginfo->code = PMIX_MAX_ERR_CONSTANT; } else { - reginfo->code = codes[k]; + reginfo->code = codes[n]; } pmix_list_append(&pmix_server_globals.events, ®info->super); prev = PMIX_NEW(pmix_peer_events_info_t); @@ -1698,14 +1751,23 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, } PMIX_RETAIN(peer); prev->peer = peer; + if (NULL != affected) { + PMIX_PROC_CREATE(prev->affected, naffected); + prev->naffected = naffected; + memcpy(prev->affected, affected, naffected * sizeof(pmix_proc_t)); + } prev->enviro_events = enviro_events; pmix_list_append(®info->peers, &prev->super); } - ++k; - } while (k < ncodes); + } /* if they asked for enviro events, call the local server */ if (enviro_events) { + /* if they don't support this, then we cannot do it */ + if (NULL == pmix_host_server.register_events) { + rc = PMIX_ERR_NOT_SUPPORTED; + goto cleanup; + } /* need to ensure the arrays don't go away until after the * host RM is done with them */ scd = PMIX_NEW(pmix_setup_caddy_t); @@ -1751,22 +1813,18 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, PMIX_INFO_FREE(scd->info, scd->ninfo); } PMIX_RELEASE(scd); - } else { - goto check; } + } else { + rc = PMIX_OPERATION_SUCCEEDED; } cleanup: pmix_output_verbose(2, pmix_server_globals.event_output, "server register events: ninfo =%lu rc =%d", ninfo, rc); - /* be sure to execute the callback */ - if (NULL != cbfunc) { - cbfunc(rc, cbdata); - } if (NULL != info) { PMIX_INFO_FREE(info, ninfo); } - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { if (NULL != codes) { free(codes); } @@ -1776,11 +1834,13 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, return rc; } - check: /* check if any matching notifications have been cached */ - for (i=0; i < pmix_globals.notifications.size; i++) { - if (NULL == (cd = (pmix_notify_caddy_t*)pmix_ring_buffer_poke(&pmix_globals.notifications, i))) { - break; + rngtrk.procs = NULL; + rngtrk.nprocs = 0; + for (i=0; i < pmix_globals.max_events; i++) { + pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd); + if (NULL == cd) { + continue; } found = false; if (NULL == codes) { @@ -1799,23 +1859,46 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, if (!found) { continue; } - /* if we were given specific targets, check if this is one */ + /* check if the affected procs (if given) match those they + * wanted to know about */ + if (!pmix_notify_check_affected(cd->affected, cd->naffected, + affected, naffected)) { + continue; + } + /* check the range */ + if (NULL == cd->targets) { + rngtrk.procs = &cd->source; + rngtrk.nprocs = 1; + } else { + rngtrk.procs = cd->targets; + rngtrk.nprocs = cd->ntargets; + } + rngtrk.range = cd->range; + PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank); + if (!pmix_notify_check_range(&rngtrk, &proc)) { + continue; + } + /* if we were given specific targets, check if this is one */ + found = false; if (NULL != cd->targets) { matched = false; for (n=0; n < cd->ntargets; n++) { - if (0 != strncmp(peer->info->pname.nspace, cd->targets[n].nspace, PMIX_MAX_NSLEN)) { - continue; - } /* if the source of the event is the same peer just registered, then ignore it * as the event notification system will have already locally * processed it */ - if (0 == strncmp(peer->info->pname.nspace, cd->source.nspace, PMIX_MAX_NSLEN) && - peer->info->pname.rank == cd->source.rank) { + if (PMIX_CHECK_PROCID(&cd->source, &peer->info->pname)) { continue; } - if (PMIX_RANK_WILDCARD == cd->targets[n].rank || - peer->info->pname.rank == cd->targets[n].rank) { + if (PMIX_CHECK_PROCID(&peer->info->pname, &cd->targets[n])) { matched = true; + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if this is the last one, then evict this event + * from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + found = true; // mark that we should release cd + } break; } } @@ -1824,58 +1907,61 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, continue; } } - /* if they specified affected proc(s) they wanted to know about, check */ - if (!pmix_notify_check_affected(cd->affected, cd->naffected, - affected, naffected)) { - continue; - } + /* all matches - notify */ relay = PMIX_NEW(pmix_buffer_t); if (NULL == relay) { /* nothing we can do */ PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - rc = PMIX_ERR_NOMEM; + ret = PMIX_ERR_NOMEM; break; } /* pack the info data stored in the event */ - PMIX_BFROPS_PACK(rc, peer, relay, &cmd, 1, PMIX_COMMAND); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); + PMIX_BFROPS_PACK(ret, peer, relay, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); break; } - PMIX_BFROPS_PACK(rc, peer, relay, &cd->status, 1, PMIX_STATUS); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); + PMIX_BFROPS_PACK(ret, peer, relay, &cd->status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); break; } - PMIX_BFROPS_PACK(rc, peer, relay, &cd->source, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); + PMIX_BFROPS_PACK(ret, peer, relay, &cd->source, 1, PMIX_PROC); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); break; } - PMIX_BFROPS_PACK(rc, peer, relay, &cd->ninfo, 1, PMIX_SIZE); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); + PMIX_BFROPS_PACK(ret, peer, relay, &cd->ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); break; } if (0 < cd->ninfo) { - PMIX_BFROPS_PACK(rc, peer, relay, cd->info, cd->ninfo, PMIX_INFO); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); + PMIX_BFROPS_PACK(ret, peer, relay, cd->info, cd->ninfo, PMIX_INFO); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); break; } } - PMIX_SERVER_QUEUE_REPLY(peer, 0, relay); - } - if (!enviro_events) { - if (NULL != codes) { - free(codes); + PMIX_SERVER_QUEUE_REPLY(ret, peer, 0, relay); + if (PMIX_SUCCESS != ret) { + PMIX_RELEASE(relay); + } + if (found) { + PMIX_RELEASE(cd); } } + + if (NULL != codes) { + free(codes); + } if (NULL != affected) { PMIX_PROC_FREE(affected, naffected); } - + if (PMIX_SUCCESS != ret) { + rc = ret; + } return rc; } @@ -1956,6 +2042,13 @@ static void intermed_step(pmix_status_t status, void *cbdata) goto complete; } + /* since our host is going to send this everywhere, it may well + * come back to us. We already processed it, so mark it here + * to ensure we don't do it again. We previously inserted the + * PMIX_SERVER_INTERNAL_NOTIFY key at the very end of the + * info array - just overwrite that position */ + PMIX_INFO_LOAD(&cd->info[cd->ninfo-1], PMIX_EVENT_PROXY, &pmix_globals.myid, PMIX_PROC); + /* pass it to our host RM for distribution */ rc = pmix_host_server.notify_event(cd->status, &cd->source, cd->range, cd->info, cd->ninfo, local_cbfunc, cd); @@ -1974,6 +2067,11 @@ static void intermed_step(pmix_status_t status, void *cbdata) PMIX_RELEASE(cd); } +/* Receive an event sent by the client library. Since it was sent + * to us by one client, we have to both process it locally to ensure + * we notify all relevant local clients AND (assuming a range other + * than LOCAL) deliver to our host, requesting that they send it + * to all peer servers in the current session */ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_op_cbfunc_t cbfunc, @@ -1982,11 +2080,12 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, int32_t cnt; pmix_status_t rc; pmix_notify_caddy_t *cd; - size_t ninfo; + size_t ninfo, n; pmix_output_verbose(2, pmix_server_globals.event_output, - "%s:%d recvd event notification from client", - pmix_globals.myid.nspace, pmix_globals.myid.rank); + "%s:%d recvd event notification from client %s:%d", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + peer->info->pname.nspace, peer->info->pname.rank); cd = PMIX_NEW(pmix_notify_caddy_t); if (NULL == cd) { @@ -1995,8 +2094,7 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, cd->cbfunc = cbfunc; cd->cbdata = cbdata; /* set the source */ - (void)strncpy(cd->source.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); - cd->source.rank = peer->info->pname.rank; + PMIX_LOAD_PROCID(&cd->source, peer->info->pname.nspace, peer->info->pname.rank); /* unpack status */ cnt = 1; @@ -2035,6 +2133,18 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, goto exit; } } + + /* check to see if we already processed this event - it is possible + * that a local client "echoed" it back to us and we want to avoid + * a potential infinite loop */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&cd->info[n], PMIX_SERVER_INTERNAL_NOTIFY)) { + /* yep, we did - so don't do it again! */ + rc = PMIX_OPERATION_SUCCEEDED; + goto exit; + } + } + /* add an info object to mark that we recvd this internally */ PMIX_INFO_LOAD(&cd->info[ninfo], PMIX_SERVER_INTERNAL_NOTIFY, NULL, PMIX_BOOL); /* process it */ @@ -2045,12 +2155,13 @@ pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, intermed_step, cd))) { goto exit; } - /* tell the switchyard we will handle it from here */ - return PMIX_SUCCESS; + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(cd); + } + return rc; exit: PMIX_RELEASE(cd); - cbfunc(rc, cbdata); return rc; } @@ -2063,14 +2174,14 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer, pmix_status_t rc; pmix_query_caddy_t *cd; pmix_proc_t proc; + pmix_cb_t cb; + size_t n, p; + pmix_list_t results; + pmix_kval_t *kv, *kvnxt; pmix_output_verbose(2, pmix_server_globals.base_output, "recvd query from client"); - if (NULL == pmix_host_server.query) { - return PMIX_ERR_NOT_SUPPORTED; - } - cd = PMIX_NEW(pmix_query_caddy_t); if (NULL == cd) { return PMIX_ERR_NOMEM; @@ -2081,36 +2192,136 @@ pmix_status_t pmix_server_query(pmix_peer_t *peer, PMIX_BFROPS_UNPACK(rc, peer, buf, &cd->nqueries, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto exit; + PMIX_RELEASE(cd); + return rc; } /* unpack the queries */ if (0 < cd->nqueries) { PMIX_QUERY_CREATE(cd->queries, cd->nqueries); if (NULL == cd->queries) { rc = PMIX_ERR_NOMEM; - goto exit; + PMIX_RELEASE(cd); + return rc; } cnt = cd->nqueries; PMIX_BFROPS_UNPACK(rc, peer, buf, cd->queries, &cnt, PMIX_QUERY); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - goto exit; + PMIX_RELEASE(cd); + return rc; } } + /* check the directives to see if they want us to refresh + * the local cached results - if we wanted to optimize this + * more, we would check each query and allow those that don't + * want to be refreshed to be executed locally, and those that + * did would be sent to the host. However, for now we simply + * determine that if we don't have it, then ask for everything */ + memset(proc.nspace, 0, PMIX_MAX_NSLEN+1); + proc.rank = PMIX_RANK_INVALID; + PMIX_CONSTRUCT(&results, pmix_list_t); + + for (n=0; n < cd->nqueries; n++) { + for (p=0; p < cd->queries[n].nqual; p++) { + if (PMIX_CHECK_KEY(&cd->queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) { + if (PMIX_INFO_TRUE(&cd->queries[n].qualifiers[p])) { + PMIX_LIST_DESTRUCT(&results); + goto query; + } + } else if (PMIX_CHECK_KEY(&cd->queries[n].qualifiers[p], PMIX_PROCID)) { + PMIX_LOAD_NSPACE(proc.nspace, cd->queries[n].qualifiers[p].value.data.proc->nspace); + proc.rank = cd->queries[n].qualifiers[p].value.data.proc->rank; + } else if (PMIX_CHECK_KEY(&cd->queries[n].qualifiers[p], PMIX_NSPACE)) { + PMIX_LOAD_NSPACE(proc.nspace, cd->queries[n].qualifiers[p].value.data.string); + } else if (PMIX_CHECK_KEY(&cd->queries[n].qualifiers[p], PMIX_RANK)) { + proc.rank = cd->queries[n].qualifiers[p].value.data.rank; + } else if (PMIX_CHECK_KEY(&cd->queries[n].qualifiers[p], PMIX_HOSTNAME)) { + if (0 != strcmp(cd->queries[n].qualifiers[p].value.data.string, pmix_globals.hostname)) { + /* asking about a different host, so ask for the info */ + PMIX_LIST_DESTRUCT(&results); + goto query; + } + } + } + /* we get here if a refresh isn't required - first try a local + * "get" on the data to see if we already have it */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + cb.copy = false; + /* set the proc */ + if (PMIX_RANK_INVALID == proc.rank && + 0 == strlen(proc.nspace)) { + /* use our id */ + cb.proc = &pmix_globals.myid; + } else { + if (0 == strlen(proc.nspace)) { + /* use our nspace */ + PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); + } + if (PMIX_RANK_INVALID == proc.rank) { + /* user the wildcard rank */ + proc.rank = PMIX_RANK_WILDCARD; + } + cb.proc = &proc; + } + for (p=0; NULL != cd->queries[n].keys[p]; p++) { + cb.key = cd->queries[n].keys[p]; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS != rc) { + /* needs to be passed to the host */ + PMIX_LIST_DESTRUCT(&results); + PMIX_DESTRUCT(&cb); + goto query; + } + /* need to retain this result */ + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &cb.kvs, pmix_kval_t) { + pmix_list_remove_item(&cb.kvs, &kv->super); + pmix_list_append(&results, &kv->super); + } + PMIX_DESTRUCT(&cb); + } + } + + /* if we get here, then all queries were completely locally + * resolved, so construct the results for return */ + rc = PMIX_ERR_NOT_FOUND; + if (0 < (cd->ninfo = pmix_list_get_size(&results))) { + PMIX_INFO_CREATE(cd->info, cd->ninfo); + n = 0; + PMIX_LIST_FOREACH_SAFE(kv, kvnxt, &results, pmix_kval_t) { + PMIX_LOAD_KEY(cd->info[n].key, kv->key); + rc = pmix_value_xfer(&cd->info[n].value, kv->value); + if (PMIX_SUCCESS != rc) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + cd->info = NULL; + cd->ninfo = 0; + break; + } + ++n; + } + } + /* done with the list of results */ + PMIX_LIST_DESTRUCT(&results); + /* we can just call the cbfunc here as we are already + * in an event - let our internal cbfunc do a threadshift + * if necessary */ + cbfunc(PMIX_SUCCESS, cd->info, cd->ninfo, cd, NULL, NULL); + return PMIX_SUCCESS; + + query: + if (NULL == pmix_host_server.query) { + PMIX_RELEASE(cd); + return PMIX_ERR_NOT_SUPPORTED; + } + /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); - proc.rank = peer->info->pname.rank; + PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank); /* ask the host for the info */ if (PMIX_SUCCESS != (rc = pmix_host_server.query(&proc, cd->queries, cd->nqueries, cbfunc, cd))) { - goto exit; + PMIX_RELEASE(cd); } - return PMIX_SUCCESS; - - exit: - PMIX_RELEASE(cd); return rc; } @@ -2142,7 +2353,7 @@ pmix_status_t pmix_server_log(pmix_peer_t *peer, * the request itself */ /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; cd = PMIX_NEW(pmix_shift_caddy_t); @@ -2270,7 +2481,7 @@ pmix_status_t pmix_server_alloc(pmix_peer_t *peer, } /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* ask the host to execute the request */ @@ -2302,7 +2513,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, int32_t cnt, m; pmix_status_t rc; pmix_query_caddy_t *cd; - pmix_nspace_t *nptr, *tmp; + pmix_namespace_t *nptr, *tmp; pmix_peer_t *pr; pmix_proc_t proc; size_t n; @@ -2325,6 +2536,8 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, } cd->cbdata = cbdata; + PMIX_CONSTRUCT(&epicache, pmix_list_t); + /* unpack the number of targets */ cnt = 1; PMIX_BFROPS_UNPACK(rc, peer, buf, &cd->ntargets, &cnt, PMIX_SIZE); @@ -2343,7 +2556,6 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, } /* check targets to find proper place to put any epilog requests */ - PMIX_CONSTRUCT(&epicache, pmix_list_t); if (NULL == cd->targets) { epicd = PMIX_NEW(pmix_srvr_epi_caddy_t); epicd->epi = &peer->nptr->epilog; @@ -2352,14 +2564,14 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, for (n=0; n < cd->ntargets; n++) { /* find the nspace of this proc */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_nspace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->targets[n].nspace)) { nptr = tmp; break; } } if (NULL == nptr) { - nptr = PMIX_NEW(pmix_nspace_t); + nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { rc = PMIX_ERR_NOMEM; goto exit; @@ -2523,7 +2735,6 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, rc = PMIX_ERR_CONFLICTING_CLEANUP_DIRECTIVES; PMIX_LIST_DESTRUCT(&cachedirs); PMIX_LIST_DESTRUCT(&cachefiles); - PMIX_LIST_DESTRUCT(&epicache); goto exit; } } @@ -2568,13 +2779,13 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, PMIX_LIST_DESTRUCT(&cachefiles); if (cnt == (int)cd->ninfo) { /* nothing more to do */ - rc = PMIX_SUCCESS; + rc = PMIX_OPERATION_SUCCEEDED; goto exit; } } /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* ask the host to execute the request */ @@ -2584,10 +2795,12 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, cbfunc, cd))) { goto exit; } + PMIX_LIST_DESTRUCT(&epicache); return PMIX_SUCCESS; exit: PMIX_RELEASE(cd); + PMIX_LIST_DESTRUCT(&epicache); return rc; } @@ -2666,7 +2879,7 @@ pmix_status_t pmix_server_monitor(pmix_peer_t *peer, } /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* ask the host to execute the request */ @@ -2725,7 +2938,7 @@ pmix_status_t pmix_server_get_credential(pmix_peer_t *peer, } /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* ask the host to execute the request */ @@ -2790,7 +3003,7 @@ pmix_status_t pmix_server_validate_credential(pmix_peer_t *peer, } /* setup the requesting peer name */ - (void)strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc.nspace, peer->info->pname.nspace, PMIX_MAX_NSLEN); proc.rank = peer->info->pname.rank; /* ask the host to execute the request */ @@ -2817,9 +3030,8 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, pmix_iof_req_t *req; bool notify, match; size_t n; - int i; - pmix_setup_caddy_t *occupant; pmix_buffer_t *msg; + pmix_iof_cache_t *iof, *ionext; pmix_output_verbose(2, pmix_server_globals.iof_output, "recvd IOF PULL request from client"); @@ -2916,54 +3128,60 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, pmix_list_append(&pmix_globals.iof_requests, &req->super); } /* process any cached IO */ - for (i=0; i < PMIX_IOF_HOTEL_SIZE; i++) { - pmix_hotel_knock(&pmix_server_globals.iof, PMIX_IOF_HOTEL_SIZE-i-1, (void**)&occupant); - if (NULL != occupant) { - if (!(occupant->channels & req->channels)) { - continue; - } - /* if the source matches the request, then forward this along */ - if (0 != strncmp(occupant->procs->nspace, req->pname.nspace, PMIX_MAX_NSLEN) || - (PMIX_RANK_WILDCARD != req->pname.rank && occupant->procs->rank != req->pname.rank)) { - continue; - } - /* setup the msg */ - if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - rc = PMIX_ERR_OUT_OF_RESOURCE; - break; - } - /* provide the source */ - PMIX_BFROPS_PACK(rc, req->peer, msg, occupant->procs, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* provide the channel */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &occupant->channels, 1, PMIX_IOF_CHANNEL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* pack the data */ - PMIX_BFROPS_PACK(rc, req->peer, msg, occupant->bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* send it to the requestor */ - PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - } - /* remove it from the hotel since it has now been forwarded */ - pmix_hotel_checkout(&pmix_server_globals.iof, PMIX_IOF_HOTEL_SIZE-i-1); - PMIX_RELEASE(occupant); + PMIX_LIST_FOREACH_SAFE(iof, ionext, &pmix_server_globals.iof, pmix_iof_cache_t) { + /* if the channels don't match, then ignore it */ + if (!(iof->channel & req->channels)) { + continue; + } + /* if the source does not match the request, then ignore it */ + if (!PMIX_CHECK_PROCID(&iof->source, &req->pname)) { + continue; + } + /* never forward back to the source! This can happen if the source + * is a launcher */ + if (PMIX_CHECK_PROCID(&iof->source, &req->peer->info->pname)) { + continue; + } + pmix_output_verbose(2, pmix_server_globals.iof_output, + "PMIX:SERVER:IOFREQ delivering cached IOF from %s:%d to %s:%d", + iof->source.nspace, iof->source.rank, + req->peer->info->pname.nspace, req->peer->info->pname.rank); + /* setup the msg */ + if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + rc = PMIX_ERR_OUT_OF_RESOURCE; + break; + } + /* provide the source */ + PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->source, 1, PMIX_PROC); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* provide the channel */ + PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->channel, 1, PMIX_IOF_CHANNEL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; + } + /* pack the data */ + PMIX_BFROPS_PACK(rc, req->peer, msg, iof->bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + break; } + /* send it to the requestor */ + PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + } + /* remove it from the list since it has now been forwarded */ + pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); + PMIX_RELEASE(iof); } } if (notify) { @@ -3082,7 +3300,7 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, } /* pass the data to the host */ - (void)strncpy(source.nspace, peer->nptr->nspace, PMIX_MAX_NSLEN); + pmix_strncpy(source.nspace, peer->nptr->nspace, PMIX_MAX_NSLEN); source.rank = peer->info->pname.rank; if (PMIX_SUCCESS != (rc = pmix_host_server.push_stdin(&source, cd->procs, cd->nprocs, cd->info, cd->ninfo, cd->bo, @@ -3099,6 +3317,9 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, /***** INSTANCE SERVER LIBRARY CLASSES *****/ static void tcon(pmix_server_trkr_t *t) { + t->event_active = false; + t->lost_connection = false; + t->id = NULL; memset(t->pname.nspace, 0, PMIX_MAX_NSLEN+1); t->pname.rank = PMIX_RANK_UNDEF; t->pcs = NULL; @@ -3118,6 +3339,9 @@ static void tcon(pmix_server_trkr_t *t) } static void tdes(pmix_server_trkr_t *t) { + if (NULL != t->id) { + free(t->id); + } PMIX_DESTRUCT_LOCK(&t->lock); if (NULL != t->pcs) { free(t->pcs); @@ -3165,6 +3389,8 @@ static void scadcon(pmix_setup_caddy_t *p) p->ncodes = 0; p->procs = NULL; p->nprocs = 0; + p->apps = NULL; + p->napps = 0; p->server_object = NULL; p->nlocalprocs = 0; p->info = NULL; @@ -3172,6 +3398,7 @@ static void scadcon(pmix_setup_caddy_t *p) p->keys = NULL; p->channels = PMIX_FWD_NO_CHANNELS; p->bo = NULL; + p->nbo = 0; p->cbfunc = NULL; p->opcbfunc = NULL; p->setupcbfunc = NULL; @@ -3184,6 +3411,13 @@ static void scaddes(pmix_setup_caddy_t *p) if (NULL != p->peer) { PMIX_RELEASE(p->peer); } + PMIX_PROC_FREE(p->procs, p->nprocs); + if (NULL != p->apps) { + PMIX_APP_FREE(p->apps, p->napps); + } + if (NULL != p->bo) { + PMIX_BYTE_OBJECT_FREE(p->bo, p->nbo); + } PMIX_DESTRUCT_LOCK(&p->lock); } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, @@ -3192,12 +3426,20 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, static void ncon(pmix_notify_caddy_t *p) { + struct timespec tp; + PMIX_CONSTRUCT_LOCK(&p->lock); + clock_gettime(CLOCK_MONOTONIC, &tp); + p->ts = tp.tv_sec; + p->room = -1; memset(p->source.nspace, 0, PMIX_MAX_NSLEN+1); p->source.rank = PMIX_RANK_UNDEF; p->range = PMIX_RANGE_UNDEF; p->targets = NULL; p->ntargets = 0; + p->nleft = SIZE_MAX; + p->affected = NULL; + p->naffected = 0; p->nondefault = false; p->info = NULL; p->ninfo = 0; @@ -3208,6 +3450,7 @@ static void ndes(pmix_notify_caddy_t *p) if (NULL != p->info) { PMIX_INFO_FREE(p->info, p->ninfo); } + PMIX_PROC_FREE(p->affected, p->naffected); if (NULL != p->targets) { free(p->targets); } @@ -3275,12 +3518,17 @@ PMIX_CLASS_INSTANCE(pmix_dmdx_local_t, static void prevcon(pmix_peer_events_info_t *p) { p->peer = NULL; + p->affected = NULL; + p->naffected = 0; } static void prevdes(pmix_peer_events_info_t *p) { if (NULL != p->peer) { PMIX_RELEASE(p->peer); } + if (NULL != p->affected) { + PMIX_PROC_FREE(p->affected, p->naffected); + } } PMIX_CLASS_INSTANCE(pmix_peer_events_info_t, pmix_list_item_t, @@ -3321,3 +3569,15 @@ static void ildes(pmix_inventory_rollup_t *p) PMIX_CLASS_INSTANCE(pmix_inventory_rollup_t, pmix_object_t, ilcon, ildes); + +static void iocon(pmix_iof_cache_t *p) +{ + p->bo = NULL; +} +static void iodes(pmix_iof_cache_t *p) +{ + PMIX_BYTE_OBJECT_FREE(p->bo, 1); // macro protects against NULL +} +PMIX_CLASS_INSTANCE(pmix_iof_cache_t, + pmix_list_item_t, + iocon, iodes); diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h index e90137c90cc..06fddc1fe96 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h @@ -1,19 +1,24 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. - * Copyright (c) 2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ */ #ifndef PMIX_SERVER_OPS_H #define PMIX_SERVER_OPS_H +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + #include #include "src/include/types.h" #include @@ -57,6 +62,12 @@ typedef struct { size_t napps; pmix_iof_channel_t channels; pmix_byte_object_t *bo; + size_t nbo; + /* timestamp receipt of the notification so we + * can evict the oldest one if we get overwhelmed */ + time_t ts; + /* what room of the hotel they are in */ + int room; pmix_op_cbfunc_t opcbfunc; pmix_dmodex_response_fn_t cbfunc; pmix_setup_application_cbfunc_t setupcbfunc; @@ -120,6 +131,8 @@ typedef struct { pmix_list_item_t super; pmix_peer_t *peer; bool enviro_events; + pmix_proc_t *affected; + size_t naffected; } pmix_peer_events_info_t; PMIX_CLASS_DECLARATION(pmix_peer_events_info_t); @@ -130,6 +143,14 @@ typedef struct { } pmix_regevents_info_t; PMIX_CLASS_DECLARATION(pmix_regevents_info_t); +typedef struct { + pmix_list_item_t super; + pmix_proc_t source; + pmix_iof_channel_t channel; + pmix_byte_object_t *bo; +} pmix_iof_cache_t; +PMIX_CLASS_DECLARATION(pmix_iof_cache_t); + typedef struct { pmix_list_t nspaces; // list of pmix_nspace_t for the nspaces we know about pmix_pointer_array_t clients; // array of pmix_peer_t local clients @@ -138,9 +159,11 @@ typedef struct { pmix_list_t local_reqs; // list of pmix_dmdx_local_t awaiting arrival of data from local neighbours pmix_list_t gdata; // cache of data given to me for passing to all clients pmix_list_t events; // list of pmix_regevents_info_t registered events - pmix_hotel_t iof; // IO to be forwarded to clients + pmix_list_t iof; // IO to be forwarded to clients + size_t max_iof_cache; // max number of IOF messages to cache bool tool_connections_allowed; char *tmpdir; // temporary directory for this server + char *system_tmpdir; // system tmpdir // verbosity for server get operations int get_output; int get_verbose; @@ -194,8 +217,8 @@ typedef struct { bool pmix_server_trk_update(pmix_server_trkr_t *trk); -void pmix_pending_nspace_requests(pmix_nspace_t *nptr); -pmix_status_t pmix_pending_resolve(pmix_nspace_t *nptr, pmix_rank_t rank, +void pmix_pending_nspace_requests(pmix_namespace_t *nptr); +pmix_status_t pmix_pending_resolve(pmix_namespace_t *nptr, pmix_rank_t rank, pmix_status_t status, pmix_dmdx_local_t *lcd); @@ -312,7 +335,11 @@ void pmix_server_message_handler(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, pmix_buffer_t *buf, void *cbdata); +void pmix_server_purge_events(pmix_peer_t *peer, + pmix_proc_t *proc); + PMIX_EXPORT extern pmix_server_module_t pmix_host_server; PMIX_EXPORT extern pmix_server_globals_t pmix_server_globals; + #endif // PMIX_SERVER_OPS_H diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h b/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h index f61d549923e..229be8f1772 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/mutex_unix.h @@ -77,14 +77,14 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_recursive_mutex_t); .m_lock_debug = 0, \ .m_lock_file = NULL, \ .m_lock_line = 0, \ - .m_lock_atomic = { .u = { .lock = PMIX_ATOMIC_LOCK_UNLOCKED } },\ + .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ } #else #define PMIX_MUTEX_STATIC_INIT \ { \ .super = PMIX_OBJ_STATIC_INIT(pmix_mutex_t), \ .m_lock_pthread = PTHREAD_MUTEX_INITIALIZER, \ - .m_lock_atomic = { .u = { .lock = PMIX_ATOMIC_LOCK_UNLOCKED } },\ + .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ } #endif @@ -98,14 +98,14 @@ PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_recursive_mutex_t); .m_lock_debug = 0, \ .m_lock_file = NULL, \ .m_lock_line = 0, \ - .m_lock_atomic = { .u = { .lock = PMIX_ATOMIC_LOCK_UNLOCKED } },\ + .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ } #else #define PMIX_RECURSIVE_MUTEX_STATIC_INIT \ { \ .super = PMIX_OBJ_STATIC_INIT(pmix_mutex_t), \ .m_lock_pthread = PMIX_PTHREAD_RECURSIVE_MUTEX_INITIALIZER, \ - .m_lock_atomic = { .u = { .lock = PMIX_ATOMIC_LOCK_UNLOCKED } },\ + .m_lock_atomic = {PMIX_ATOMIC_LOCK_UNLOCKED}, \ } #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h b/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h index 59825645c90..ff3e5041805 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/thread_usage.h @@ -33,31 +33,30 @@ /** - * Use an atomic operation for increment/decrement if pmix_using_threads() - * indicates that threads are in use by the application or library. + * Use an atomic operation for increment/decrement */ #define PMIX_THREAD_DEFINE_ATOMIC_OP(type, name, operator, suffix) \ -static inline type pmix_thread_ ## name ## _fetch_ ## suffix (volatile type *addr, type delta) \ +static inline type pmix_thread_ ## name ## _fetch_ ## suffix (pmix_atomic_ ## type *addr, type delta) \ { \ return pmix_atomic_ ## name ## _fetch_ ## suffix (addr, delta); \ } \ \ -static inline type pmix_thread_fetch_ ## name ## _ ## suffix (volatile type *addr, type delta) \ +static inline type pmix_thread_fetch_ ## name ## _ ## suffix (pmix_atomic_ ## type *addr, type delta) \ { \ return pmix_atomic_fetch_ ## name ## _ ## suffix (addr, delta); \ } #define PMIX_THREAD_DEFINE_ATOMIC_COMPARE_EXCHANGE(type, addr_type, suffix) \ -static inline bool pmix_thread_compare_exchange_strong_ ## suffix (volatile addr_type *addr, type *compare, type value) \ +static inline bool pmix_thread_compare_exchange_strong_ ## suffix (pmix_atomic_ ## addr_type *addr, type *compare, type value) \ { \ - return pmix_atomic_compare_exchange_strong_ ## suffix ((volatile type *) addr, compare, value); \ + return pmix_atomic_compare_exchange_strong_ ## suffix (addr, (addr_type *) compare, (addr_type) value); \ } #define PMIX_THREAD_DEFINE_ATOMIC_SWAP(type, addr_type, suffix) \ -static inline type pmix_thread_swap_ ## suffix (volatile addr_type *ptr, type newvalue) \ +static inline type pmix_thread_swap_ ## suffix (pmix_atomic_ ## addr_type *ptr, type newvalue) \ { \ - return pmix_atomic_swap_ ## suffix ((volatile type *) ptr, newvalue); \ + return (type) pmix_atomic_swap_ ## suffix (ptr, (addr_type) newvalue); \ } PMIX_THREAD_DEFINE_ATOMIC_OP(int32_t, add, +, 32) @@ -112,13 +111,13 @@ PMIX_THREAD_DEFINE_ATOMIC_SWAP(void *, intptr_t, ptr) #define PMIX_THREAD_COMPARE_EXCHANGE_STRONG_32 pmix_thread_compare_exchange_strong_32 #define PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_32 pmix_thread_compare_exchange_strong_32 -#define PMIX_THREAD_COMPARE_EXCHANGE_STRONG_PTR(x, y, z) pmix_thread_compare_exchange_strong_ptr ((volatile intptr_t *) x, (void *) y, (void *) z) +#define PMIX_THREAD_COMPARE_EXCHANGE_STRONG_PTR(x, y, z) pmix_thread_compare_exchange_strong_ptr ((pmix_atomic_intptr_t *) x, (intptr_t *) y, (intptr_t) z) #define PMIX_ATOMIC_COMPARE_EXCHANGE_STRONG_PTR PMIX_THREAD_COMPARE_EXCHANGE_STRONG_PTR #define PMIX_THREAD_SWAP_32 pmix_thread_swap_32 #define PMIX_ATOMIC_SWAP_32 pmix_thread_swap_32 -#define PMIX_THREAD_SWAP_PTR(x, y) pmix_thread_swap_ptr ((volatile intptr_t *) x, (void *) y) +#define PMIX_THREAD_SWAP_PTR(x, y) pmix_thread_swap_ptr ((pmix_atomic_intptr_t *) x, (intptr_t) y) #define PMIX_ATOMIC_SWAP_PTR PMIX_THREAD_SWAP_PTR /* define 64-bit macros is 64-bit atomic math is available */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/threads/wait_sync.h b/opal/mca/pmix/pmix3x/pmix/src/threads/wait_sync.h index 311ecbfe7f1..225c8f157b8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/threads/wait_sync.h +++ b/opal/mca/pmix/pmix3x/pmix/src/threads/wait_sync.h @@ -28,7 +28,7 @@ BEGIN_C_DECLS typedef struct pmix_wait_sync_t { - int32_t count; + pmix_atomic_int32_t count; int32_t status; pthread_cond_t condition; pthread_mutex_t lock; diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index 28d35d301d8..effa1190ff2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -63,6 +63,7 @@ #include "src/runtime/pmix_rte.h" #include "src/mca/bfrops/base/base.h" #include "src/mca/gds/base/base.h" +#include "src/mca/pnet/base/base.h" #include "src/mca/ptl/base/base.h" #include "src/mca/psec/psec.h" #include "src/include/pmix_globals.h" @@ -195,7 +196,7 @@ static void tool_iof_handler(struct pmix_peer_t *pr, pmix_status_t rc; pmix_output_verbose(2, pmix_client_globals.iof_output, - "recvd IOF"); + "recvd IOF with %d bytes", (int)buf->bytes_used); /* if the buffer is empty, they are simply closing the channel */ if (0 == buf->bytes_used) { @@ -290,7 +291,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, * rank should be known. So return them here if * requested */ if (NULL != proc) { - (void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); proc->rank = pmix_globals.myid.rank; } ++pmix_globals.init_cntr; @@ -327,10 +328,29 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* they want us to forward our stdin to someone */ fwd_stdin = true; } else if (0 == strncmp(info[n].key, PMIX_LAUNCHER, PMIX_MAX_KEYLEN)) { - ptype = PMIX_PROC_LAUNCHER; + ptype |= PMIX_PROC_LAUNCHER; + } else if (0 == strncmp(info[n].key, PMIX_SERVER_TMPDIR, PMIX_MAX_KEYLEN)) { + pmix_server_globals.tmpdir = strdup(info[n].value.data.string); + } else if (0 == strncmp(info[n].key, PMIX_SYSTEM_TMPDIR, PMIX_MAX_KEYLEN)) { + pmix_server_globals.system_tmpdir = strdup(info[n].value.data.string); } } } + if (NULL == pmix_server_globals.tmpdir) { + if (NULL == (evar = getenv("PMIX_SERVER_TMPDIR"))) { + pmix_server_globals.tmpdir = strdup(pmix_tmp_directory()); + } else { + pmix_server_globals.tmpdir = strdup(evar); + } + } + if (NULL == pmix_server_globals.system_tmpdir) { + if (NULL == (evar = getenv("PMIX_SYSTEM_TMPDIR"))) { + pmix_server_globals.system_tmpdir = strdup(pmix_tmp_directory()); + } else { + pmix_server_globals.system_tmpdir = strdup(evar); + } + } + if ((nspace_given && !rank_given) || (!nspace_given && rank_given)) { /* can't have one and not the other */ @@ -387,7 +407,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* if we are a launcher, then we also need to act as a server, * so setup the server-related structures here */ - if (PMIX_PROC_LAUNCHER == ptype) { + if (PMIX_PROC_LAUNCHER_ACT & ptype) { if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { PMIX_ERROR_LOG(rc); if (NULL != nspace) { @@ -401,14 +421,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } /* setup the function pointers */ memset(&pmix_host_server, 0, sizeof(pmix_server_module_t)); - /* setup our tmpdir */ - if (NULL == pmix_server_globals.tmpdir) { - if (NULL == (evar = getenv("PMIX_SERVER_TMPDIR"))) { - pmix_server_globals.tmpdir = strdup(pmix_tmp_directory()); - } else { - pmix_server_globals.tmpdir = strdup(evar); - } - } } /* setup the runtime - this init's the globals, @@ -427,7 +439,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } /* if we were given a name, then set it now */ if (nspace_given || nspace_in_enviro) { - (void)strncpy(pmix_globals.myid.nspace, nspace, PMIX_MAX_NSLEN); + pmix_strncpy(pmix_globals.myid.nspace, nspace, PMIX_MAX_NSLEN); free(nspace); pmix_globals.myid.rank = rank; } @@ -452,7 +464,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOMEM; } - pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_nspace_t); + pmix_client_globals.myserver->nptr = PMIX_NEW(pmix_namespace_t); if (NULL == pmix_client_globals.myserver->nptr) { PMIX_RELEASE(pmix_client_globals.myserver); if (gdsfound) { @@ -582,7 +594,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, } if (!nspace_given) { /* Success, so copy the nspace and rank to the proc struct they gave us */ - (void)strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); } if (!rank_given) { proc->rank = pmix_globals.myid.rank; @@ -600,36 +612,21 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_globals.mypeer->info->pname.nspace = strdup(pmix_globals.myid.nspace); pmix_globals.mypeer->info->pname.rank = pmix_globals.myid.rank; - /* if we are acting as a client, then send a request for our - * job info - we do this as a non-blocking - * transaction because some systems cannot handle very large - * blocking operations and error out if we try them. */ - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { - req = PMIX_NEW(pmix_buffer_t); - PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - req, &cmd, 1, PMIX_COMMAND); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(req); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* send to the server */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, - req, job_data, (void*)&cb); - if (PMIX_SUCCESS != rc) { - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* wait for the data to return */ - PMIX_WAIT_THREAD(&cb.lock); - rc = cb.status; - PMIX_DESTRUCT(&cb); - if (PMIX_SUCCESS != rc) { + /* if we are acting as a server, then start listening */ + if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + /* setup the wildcard recv for inbound messages from clients */ + rcv = PMIX_NEW(pmix_ptl_posted_recv_t); + rcv->tag = UINT32_MAX; + rcv->cbfunc = pmix_server_message_handler; + /* add it to the end of the list of recvs */ + pmix_list_append(&pmix_ptl_globals.posted_recvs, &rcv->super); + /* open the pnet framework so we can harvest envars */ + rc = pmix_mca_base_framework_open(&pmix_pnet_base_framework, 0); + if (PMIX_SUCCESS != rc){ PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } + /* note that we do not select active plugins as we don't need them */ } /* setup IOF */ @@ -678,7 +675,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, &stdinev.ev, fd, PMIX_EV_READ, pmix_iof_read_local_handler, &stdinev); - } \ + } /* check to see if we want the stdin read event to be * active - we will always at least define the event, * but may delay its activation @@ -711,12 +708,42 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* increment our init reference counter */ pmix_globals.init_cntr++; - if (!PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + /* if we are acting as a client, then send a request for our + * job info - we do this as a non-blocking + * transaction because some systems cannot handle very large + * blocking operations and error out if we try them. */ + if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + req = PMIX_NEW(pmix_buffer_t); + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + req, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(req); + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* send to the server */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + req, job_data, (void*)&cb); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* wait for the data to return */ + PMIX_WAIT_THREAD(&cb.lock); + rc = cb.status; + PMIX_DESTRUCT(&cb); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + } else { /* now finish the initialization by filling our local * datastore with typical job-related info. No point * in having the server generate these as we are * obviously a singleton, and so the values are well-known */ - (void)strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); wildcard.rank = pmix_globals.myid.rank; /* the jobid is just our nspace */ @@ -1024,13 +1051,6 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* if we are acting as a server, then start listening */ if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { - /* setup the wildcard recv for inbound messages from clients */ - rcv = PMIX_NEW(pmix_ptl_posted_recv_t); - rcv->tag = UINT32_MAX; - rcv->cbfunc = pmix_server_message_handler; - /* add it to the end of the list of recvs */ - pmix_list_append(&pmix_ptl_globals.posted_recvs, &rcv->super); - /* start listening for connections */ if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) { pmix_show_help("help-pmix-server.txt", "listener-thread-start", true); @@ -1073,8 +1093,8 @@ static void finwait_cbfunc(struct pmix_peer_t *pr, if (tev->active) { tev->active = false; pmix_event_del(&tev->ev); // stop the timer - PMIX_WAKEUP_THREAD(&tev->lock); } + PMIX_WAKEUP_THREAD(&tev->lock); } PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) @@ -1083,10 +1103,9 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) pmix_cmd_t cmd = PMIX_FINALIZE_CMD; pmix_status_t rc; pmix_tool_timeout_t tev; - struct timeval tv = {2, 0}; + struct timeval tv = {5, 0}; int n; pmix_peer_t *peer; - pmix_setup_caddy_t *cd; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (1 != pmix_globals.init_cntr) { @@ -1095,6 +1114,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) return PMIX_SUCCESS; } pmix_globals.init_cntr = 0; + pmix_globals.mypeer->finalized = true; PMIX_RELEASE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_globals.debug_output, @@ -1142,6 +1162,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) /* wait for the ack to return */ PMIX_WAIT_THREAD(&tev.lock); PMIX_DESTRUCT_LOCK(&tev.lock); + if (tev.active) { pmix_event_del(&tev.ev); } @@ -1158,7 +1179,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) (void)pmix_progress_thread_pause(NULL); } - PMIX_RELEASE(pmix_client_globals.myserver); +// PMIX_RELEASE(pmix_client_globals.myserver); PMIX_LIST_DESTRUCT(&pmix_client_globals.pending_requests); for (n=0; n < pmix_client_globals.peers.size; n++) { if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_client_globals.peers, n))) { @@ -1169,19 +1190,13 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { pmix_ptl_base_stop_listening(); - /* cleanout any IOF */ - for (n=0; n < PMIX_IOF_HOTEL_SIZE; n++) { - pmix_hotel_checkout_and_return_occupant(&pmix_server_globals.iof, n, (void**)&cd); - if (NULL != cd) { - PMIX_RELEASE(cd); - } - } - PMIX_DESTRUCT(&pmix_server_globals.iof); for (n=0; n < pmix_server_globals.clients.size; n++) { if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, n))) { PMIX_RELEASE(peer); } } + + (void)pmix_mca_base_framework_close(&pmix_pnet_base_framework); PMIX_DESTRUCT(&pmix_server_globals.clients); PMIX_LIST_DESTRUCT(&pmix_server_globals.collectives); PMIX_LIST_DESTRUCT(&pmix_server_globals.remote_pnd); @@ -1189,6 +1204,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) PMIX_LIST_DESTRUCT(&pmix_server_globals.gdata); PMIX_LIST_DESTRUCT(&pmix_server_globals.events); PMIX_LIST_DESTRUCT(&pmix_server_globals.nspaces); + PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); } /* shutdown services */ @@ -1199,6 +1215,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) /* finalize the class/object system */ pmix_class_finalize(); + return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/Makefile.am index 92fce9ac2de..10e2b321a9e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -29,4 +29,5 @@ endif # PMIX_INSTALL_BINARIES pevent_SOURCES = pevent.c pevent_LDADD = \ + $(PMIX_EXTRA_LTLIB) \ $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c index f472e78ed45..a5eccb86665 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pevent/pevent.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -23,7 +23,9 @@ * */ -#define _GNU_SOURCE +#include "pmix_config.h" +#include "pmix_common.h" + #include #include #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/Makefile.am index a273ea65d8d..bf7a64d5c45 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -29,4 +29,5 @@ endif # PMIX_INSTALL_BINARIES plookup_SOURCES = plookup.c plookup_LDADD = \ - $(top_builddir)/src/libpmix.la + $(PMIX_EXTRA_LTLIB) \ + $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c index 3c8cccac2b2..d206ace840b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/plookup/plookup.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -269,7 +269,7 @@ int main(int argc, char **argv) /* setup the keys */ PMIX_PDATA_CREATE(pdata, ndata); for (n=0; n < ndata; n++) { - (void)strncpy(pdata[n].key, keys[n], PMIX_MAX_KEYLEN); + pmix_strncpy(pdata[n].key, keys[n], PMIX_MAX_KEYLEN); } /* perform the lookup */ rc = PMIx_Lookup(pdata, ndata, info, ninfo); diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am index 8fe2640c7ae..343cfaa3b84 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am @@ -31,7 +31,6 @@ AM_CFLAGS = \ -DPMIX_BUILD_LDFLAGS="\"@LDFLAGS@\"" \ -DPMIX_BUILD_LIBS="\"@LIBS@\"" \ -DPMIX_CC_ABSOLUTE="\"@PMIX_CC_ABSOLUTE@\"" \ - -DPMIX_CONFIGURE_CLI="\"@PMIX_CONFIGURE_CLI@\"" \ -DPMIX_GREEK_VERSION="\"@PMIX_GREEK_VERSION@\"" \ -DPMIX_REPO_REV="\"@PMIX_REPO_REV@\"" \ -DPMIX_RELEASE_DATE="\"@PMIX_RELEASE_DATE@\"" @@ -51,4 +50,5 @@ pmix_info_SOURCES = \ support.c pmix_info_LDADD = \ - $(top_builddir)/src/libpmix.la + $(PMIX_EXTRA_LTLIB) \ + $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pps/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/tools/pps/Makefile.am index 930a4672e95..ac7bc9eb423 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pps/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pps/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -29,4 +29,5 @@ endif # PMIX_INSTALL_BINARIES pps_SOURCES = pps.c pps_LDADD = \ - $(top_builddir)/src/libpmix.la + $(PMIX_EXTRA_LTLIB) \ + $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/argv.c b/opal/mca/pmix/pmix3x/pmix/src/util/argv.c index f5c08f80a0c..8eb1e3f6dc3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/argv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/argv.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Voltaire. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. - * Copyright (c) 2014-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -221,7 +221,7 @@ static char **pmix_argv_split_inter(const char *src_string, int delimiter, if (NULL == argtemp) return NULL; - strncpy(argtemp, src_string, arglen); + pmix_strncpy(argtemp, src_string, arglen); argtemp[arglen] = '\0'; if (PMIX_SUCCESS != pmix_argv_append(&argc, &argv, argtemp)) { @@ -235,7 +235,7 @@ static char **pmix_argv_split_inter(const char *src_string, int delimiter, /* short argument, copy to buffer and add */ else { - strncpy(arg, src_string, arglen); + pmix_strncpy(arg, src_string, arglen); arg[arglen] = '\0'; if (PMIX_SUCCESS != pmix_argv_append(&argc, &argv, arg)) diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/basename.c b/opal/mca/pmix/pmix3x/pmix/src/util/basename.c index 64e5c27e7e9..aa2076d7eaa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/basename.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/basename.c @@ -12,7 +12,7 @@ * Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -123,11 +123,7 @@ char* pmix_dirname(const char* filename) } if( p != filename ) { char* ret = (char*)malloc( p - filename + 1 ); -#ifdef HAVE_STRNCPY_S - strncpy_s( ret, (p - filename + 1), filename, p - filename ); -#else - strncpy(ret, filename, p - filename); -#endif + pmix_strncpy(ret, filename, p - filename); ret[p - filename] = '\0'; return pmix_make_filename_os_friendly(ret); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/error.c b/opal/mca/pmix/pmix3x/pmix/src/util/error.c index fddf8e4b670..7930be1c339 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/error.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/error.c @@ -159,28 +159,24 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) return "LOST-PEER-CONNECTION"; case PMIX_ERR_LOST_CONNECTION_TO_CLIENT: return "LOST-CONNECTION-TO-CLIENT"; - - case PMIX_QUERY_PARTIAL_SUCCESS: return "QUERY-PARTIAL-SUCCESS"; - - case PMIX_NOTIFY_ALLOC_COMPLETE: return "PMIX ALLOC OPERATION COMPLETE"; - - case PMIX_JCTRL_CHECKPOINT: return "PMIX JOB CONTROL CHECKPOINT"; case PMIX_JCTRL_CHECKPOINT_COMPLETE: return "PMIX JOB CONTROL CHECKPOINT COMPLETE"; case PMIX_JCTRL_PREEMPT_ALERT: return "PMIX PRE-EMPTION ALERT"; - - case PMIX_MONITOR_HEARTBEAT_ALERT: return "PMIX HEARTBEAT ALERT"; case PMIX_MONITOR_FILE_ALERT: return "PMIX FILE MONITOR ALERT"; + case PMIX_PROC_TERMINATED: + return "PROC-TERMINATED"; + case PMIX_ERR_INVALID_TERMINATION: + return "INVALID-TERMINATION"; case PMIX_ERR_EVENT_REGISTRATION: return "EVENT-REGISTRATION"; @@ -196,20 +192,28 @@ PMIX_EXPORT const char* PMIx_Error_string(pmix_status_t errnum) return "PROC-HAS-CONNECTED"; case PMIX_CONNECT_REQUESTED: return "CONNECT-REQUESTED"; + case PMIX_OPENMP_PARALLEL_ENTERED: + return "OPENMP-PARALLEL-ENTERED"; + case PMIX_OPENMP_PARALLEL_EXITED: + return "OPENMP-PARALLEL-EXITED"; + case PMIX_LAUNCH_DIRECTIVE: return "LAUNCH-DIRECTIVE"; case PMIX_LAUNCHER_READY: return "LAUNCHER-READY"; case PMIX_OPERATION_IN_PROGRESS: return "OPERATION-IN-PROGRESS"; - case PMIX_PROC_TERMINATED: - return "PROC-TERMINATED"; + case PMIX_OPERATION_SUCCEEDED: + return "OPERATION-SUCCEEDED"; + case PMIX_ERR_INVALID_OPERATION: + return "INVALID-OPERATION"; case PMIX_ERR_NODE_DOWN: return "NODE-DOWN"; case PMIX_ERR_NODE_OFFLINE: return "NODE-OFFLINE"; - + case PMIX_ERR_SYS_OTHER: + return "UNDEFINED-SYSTEM-EVENT"; case PMIX_EVENT_NO_ACTION_TAKEN: return "EVENT-NO-ACTION-TAKEN"; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/hash.c b/opal/mca/pmix/pmix3x/pmix/src/util/hash.c index 1a0a95744ea..806781186b2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/hash.c @@ -6,7 +6,7 @@ * reserved. * Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -172,7 +172,7 @@ pmix_status_t pmix_hash_fetch(pmix_hash_table_t *table, pmix_rank_t rank, /* copy the list elements */ n=0; PMIX_LIST_FOREACH(hv, &proc_data->data, pmix_kval_t) { - (void)strncpy(info[n].key, hv->key, PMIX_MAX_KEYLEN); + pmix_strncpy(info[n].key, hv->key, PMIX_MAX_KEYLEN); pmix_value_xfer(&info[n].value, hv->value); ++n; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c index c07e65e6681..52c68fa50d3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/keyval_parse.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -136,7 +136,7 @@ static int parse_line(void) key_buffer = tmp; } - strncpy(key_buffer, pmix_util_keyval_yytext, key_buffer_len); + pmix_strncpy(key_buffer, pmix_util_keyval_yytext, key_buffer_len-1); /* The first thing we have to see is an "=" */ @@ -259,7 +259,7 @@ static int save_param_name (void) key_buffer = tmp; } - strncpy (key_buffer, pmix_util_keyval_yytext, key_buffer_len); + pmix_strncpy (key_buffer, pmix_util_keyval_yytext, key_buffer_len-1); return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/net.c b/opal/mca/pmix/pmix3x/pmix/src/util/net.c index 22baf7d5a42..34661df3f2d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/net.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/net.c @@ -50,23 +50,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c index 6abedaf8a30..3f94f9bb7dc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +34,7 @@ static const char *path_sep = PMIX_PATH_SEP; -char *pmix_os_path(bool relative, ...) +char *pmix_os_path(int relative, ...) { va_list ap; char *element, *path; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h index 9f3c71bfb57..3933d04630c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/os_path.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,8 +64,13 @@ BEGIN_C_DECLS * provided path elements, separated by the path separator character * appropriate to the local operating system. The path_name string has been malloc'd * and therefore the user is responsible for free'ing the field. + * + * Note that the "relative" argument is int instead of bool, because + * passing a parameter that undergoes default argument promotion to + * va_start() has undefined behavior (according to clang warnings on + * MacOS High Sierra). */ -PMIX_EXPORT char *pmix_os_path(bool relative, ...) __pmix_attribute_malloc__ __pmix_attribute_sentinel__ __pmix_attribute_warn_unused_result__; +PMIX_EXPORT char *pmix_os_path(int relative, ...) __pmix_attribute_malloc__ __pmix_attribute_sentinel__ __pmix_attribute_warn_unused_result__; /** * Convert the path to be OS friendly. On UNIX this function will diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.c b/opal/mca/pmix/pmix3x/pmix/src/util/output.c index 1d3d4148dcd..8648f1a0b72 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -694,7 +694,7 @@ static int open_file(int i) if (NULL == filename) { return PMIX_ERR_OUT_OF_RESOURCE; } - strncpy(filename, output_dir, PMIX_PATH_MAX); + pmix_strncpy(filename, output_dir, PMIX_PATH_MAX-1); strcat(filename, "/"); if (NULL != output_prefix) { strcat(filename, output_prefix); diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pif.c b/opal/mca/pmix/pmix3x/pmix/src/util/pif.c index 78ca9559ffc..9696502f4ba 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pif.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pif.c @@ -16,7 +16,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -51,23 +51,7 @@ #include #endif #ifdef HAVE_NET_IF_H -#if defined(__APPLE__) && defined(_LP64) -/* Apple engineering suggested using options align=power as a - workaround for a bug in OS X 10.4 (Tiger) that prevented ioctl(..., - SIOCGIFCONF, ...) from working properly in 64 bit mode on Power PC. - It turns out that the underlying issue is the size of struct - ifconf, which the kernel expects to be 12 and natural 64 bit - alignment would make 16. The same bug appears in 64 bit mode on - Intel macs, but align=power is a no-op there, so instead, use the - pack pragma to instruct the compiler to pack on 4 byte words, which - has the same effect as align=power for our needs and works on both - Intel and Power PC Macs. */ -#pragma pack(push,4) -#endif #include -#if defined(__APPLE__) && defined(_LP64) -#pragma pack(pop) -#endif #endif #ifdef HAVE_NETDB_H #include @@ -218,7 +202,7 @@ int pmix_ifaddrtoname(const char* if_addr, char* if_name, int length) memcpy (&ipv4, r->ai_addr, r->ai_addrlen); if (inaddr->sin_addr.s_addr == ipv4.sin_addr.s_addr) { - strncpy(if_name, intf->if_name, length); + pmix_strncpy(if_name, intf->if_name, length-1); freeaddrinfo (res); return PMIX_SUCCESS; } @@ -226,7 +210,7 @@ int pmix_ifaddrtoname(const char* if_addr, char* if_name, int length) else { if (IN6_ARE_ADDR_EQUAL(&((struct sockaddr_in6*) &intf->if_addr)->sin6_addr, &((struct sockaddr_in6*) r->ai_addr)->sin6_addr)) { - strncpy(if_name, intf->if_name, length); + pmix_strncpy(if_name, intf->if_name, length-1); freeaddrinfo (res); return PMIX_SUCCESS; } @@ -493,7 +477,7 @@ int pmix_ifindextoname(int if_index, char* if_name, int length) intf != (pmix_pif_t*)pmix_list_get_end(&pmix_if_list); intf = (pmix_pif_t*)pmix_list_get_next(intf)) { if (intf->if_index == if_index) { - strncpy(if_name, intf->if_name, length); + pmix_strncpy(if_name, intf->if_name, length-1); return PMIX_SUCCESS; } } @@ -514,7 +498,7 @@ int pmix_ifkindextoname(int if_kindex, char* if_name, int length) intf != (pmix_pif_t*)pmix_list_get_end(&pmix_if_list); intf = (pmix_pif_t*)pmix_list_get_next(intf)) { if (intf->if_kernel_index == if_kindex) { - strncpy(if_name, intf->if_name, length); + pmix_strncpy(if_name, intf->if_name, length-1); return PMIX_SUCCESS; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c index 1654d39ead3..ae95ac691b1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.c @@ -12,7 +12,7 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -49,9 +49,9 @@ static char **search_dirs = NULL; * Local functions */ static int pmix_show_vhelp_internal(const char *filename, const char *topic, - bool want_error_header, va_list arglist); + int want_error_header, va_list arglist); static int pmix_show_help_internal(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); pmix_show_help_fn_t pmix_show_help = pmix_show_help_internal; pmix_show_vhelp_fn_t pmix_show_vhelp = pmix_show_vhelp_internal; @@ -90,7 +90,7 @@ int pmix_show_help_finalize(void) * not optimization. :-) */ static int array2string(char **outstring, - bool want_error_header, char **lines) + int want_error_header, char **lines) { int i, count; size_t len; @@ -298,7 +298,7 @@ static int load_array(char ***array, const char *filename, const char *topic) } char *pmix_show_help_vstring(const char *filename, const char *topic, - bool want_error_header, va_list arglist) + int want_error_header, va_list arglist) { int rc; char *single_string, *output, **array = NULL; @@ -324,7 +324,7 @@ char *pmix_show_help_vstring(const char *filename, const char *topic, } char *pmix_show_help_string(const char *filename, const char *topic, - bool want_error_handler, ...) + int want_error_handler, ...) { char *output; va_list arglist; @@ -338,7 +338,7 @@ char *pmix_show_help_string(const char *filename, const char *topic, } static int pmix_show_vhelp_internal(const char *filename, const char *topic, - bool want_error_header, va_list arglist) + int want_error_header, va_list arglist) { char *output; @@ -356,7 +356,7 @@ static int pmix_show_vhelp_internal(const char *filename, const char *topic, } static int pmix_show_help_internal(const char *filename, const char *topic, - bool want_error_header, ...) + int want_error_header, ...) { va_list arglist; int rc; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h index 8c23887dc38..1129a762a71 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/show_help.h @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -129,9 +129,14 @@ PMIX_EXPORT int pmix_show_help_finalize(void); * (typically $prefix/share/pmix), and looks up the message * based on the topic, and displays it. If want_error_header is * true, a header and footer of asterisks are also displayed. + * + * Note that the "want_error_header" argument is int instead of bool, + * because passing a parameter that undergoes default argument + * promotion to va_start() has undefined behavior (according to clang + * warnings on MacOS High Sierra). */ typedef int (*pmix_show_help_fn_t)(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); PMIX_EXPORT extern pmix_show_help_fn_t pmix_show_help; /** @@ -139,7 +144,7 @@ PMIX_EXPORT extern pmix_show_help_fn_t pmix_show_help; * a va_list form of varargs. */ typedef int (*pmix_show_vhelp_fn_t)(const char *filename, const char *topic, - bool want_error_header, va_list ap); + int want_error_header, va_list ap); PMIX_EXPORT extern pmix_show_vhelp_fn_t pmix_show_vhelp; /** @@ -148,7 +153,7 @@ PMIX_EXPORT extern pmix_show_vhelp_fn_t pmix_show_vhelp; */ PMIX_EXPORT char* pmix_show_help_string(const char *filename, const char *topic, - bool want_error_header, ...); + int want_error_header, ...); /** * This function does the same thing as pmix_show_help_string(), but @@ -156,7 +161,7 @@ PMIX_EXPORT char* pmix_show_help_string(const char *filename, */ PMIX_EXPORT char* pmix_show_help_vstring(const char *filename, const char *topic, - bool want_error_header, va_list ap); + int want_error_header, va_list ap); /** * This function adds another search location for the files that diff --git a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am index 64ad119878f..3b4ee7214ca 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -29,7 +29,7 @@ endif headers = test_common.h cli_stages.h server_callbacks.h utils.h test_fence.h \ test_publish.h test_spawn.h test_cd.h test_resolve_peers.h test_error.h \ - test_replace.h test_internal.h + test_replace.h test_internal.h test_server.h AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api @@ -43,7 +43,7 @@ endif noinst_PROGRAMS += pmix_test pmix_client pmix_regex pmix_test_SOURCES = $(headers) \ - pmix_test.c test_common.c cli_stages.c server_callbacks.c utils.c + pmix_test.c test_common.c cli_stages.c server_callbacks.c test_server.c utils.c pmix_test_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pmix_test_LDADD = \ $(top_builddir)/src/libpmix.la @@ -70,7 +70,7 @@ pmix_client_LDADD = \ $(top_builddir)/src/libpmix.la pmix_regex_SOURCES = $(headers) \ - pmix_regex.c test_common.c cli_stages.c server_callbacks.c utils.c + pmix_regex.c test_common.c cli_stages.c server_callbacks.c test_server.c utils.c pmix_regex_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) pmix_regex_LDADD = \ $(top_builddir)/src/libpmix.la diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c index 04049ad9cc3..ecd41c2bd42 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c @@ -3,6 +3,8 @@ * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,18 +23,27 @@ int cli_rank(cli_info_t *cli) int i; for(i=0; i < cli_info_cnt; i++){ if( cli == &cli_info[i] ){ - return i; + return cli->rank; } } return -1; } -void cli_init(int nprocs, cli_state_t order[]) +void cli_init(int nprocs) { int n, i; + cli_state_t order[CLI_TERM+1]; + cli_info = malloc( sizeof(cli_info_t) * nprocs); cli_info_cnt = nprocs; + order[CLI_UNINIT] = CLI_FORKED; + order[CLI_FORKED] = CLI_FIN; + order[CLI_CONNECTED] = CLI_UNDEF; + order[CLI_FIN] = CLI_TERM; + order[CLI_DISCONN] = CLI_UNDEF; + order[CLI_TERM] = CLI_UNDEF; + for (n=0; n < nprocs; n++) { cli_info[n].sd = -1; cli_info[n].ev = NULL; @@ -198,8 +209,9 @@ void cli_wait_all(double timeout) TEST_VERBOSE(("waitpid = %d", pid)); for(i=0; i < cli_info_cnt; i++){ if( cli_info[i].pid == pid ){ - TEST_VERBOSE(("the child with pid = %d has rank = %d\n" - "\t\texited = %d, signalled = %d", pid, i, + TEST_VERBOSE(("the child with pid = %d has rank = %d, ns = %s\n" + "\t\texited = %d, signalled = %d", pid, + cli_info[i].rank, cli_info[i].ns, WIFEXITED(status), WIFSIGNALED(status) )); if( WIFEXITED(status) || WIFSIGNALED(status) ){ cli_cleanup(&cli_info[i]); @@ -211,6 +223,9 @@ void cli_wait_all(double timeout) if( errno == ECHILD ){ TEST_VERBOSE(("No more children to wait. Happens on the last cli_wait_all call " "which is used to ensure that all children terminated.\n")); + if (pmix_test_verbose) { + sleep(1); + } break; } else { TEST_ERROR(("waitpid(): %d : %s", errno, strerror(errno))); diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h index 343af2de043..b716480b0a9 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h @@ -3,6 +3,8 @@ * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -10,6 +12,9 @@ * $HEADER$ */ +#ifndef CLI_STAGES_H +#define CLI_STAGES_H + #include #include #include @@ -41,7 +46,7 @@ typedef struct { pmix_event_t *ev; cli_state_t state; cli_state_t next_state[CLI_TERM+1]; - int rank; + pmix_rank_t rank; char *ns; } cli_info_t; @@ -50,7 +55,7 @@ extern int cli_info_cnt; extern bool test_abort; int cli_rank(cli_info_t *cli); -void cli_init(int nprocs, cli_state_t order[]); +void cli_init(int nprocs); void cli_connect(cli_info_t *cli, int sd, struct event_base * ebase, event_callback_fn callback); void cli_finalize(cli_info_t *cli); void cli_disconnect(cli_info_t *cli); @@ -75,3 +80,5 @@ void op_callbk(pmix_status_t status, void errhandler_reg_callbk (pmix_status_t status, size_t errhandler_ref, void *cbdata); + +#endif // CLI_STAGES_H diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c index e00a44e22e2..3d1b46fcfac 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c @@ -13,8 +13,8 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2017 Mellanox Technologies, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,7 +78,7 @@ int main(int argc, char **argv) parse_cmd(argc, argv, ¶ms); // We don't know rank at this place! - TEST_VERBOSE(("Client ns %s rank %d: Start", params.nspace, params.rank)); + TEST_VERBOSE(("Client %s:%d started PID:%d", params.nspace, params.rank, getpid())); /* handle early-fail test case */ if (1 == params.early_fail && 0 == params.rank) { @@ -236,6 +236,7 @@ int main(int argc, char **argv) TEST_VERBOSE(("Client ns %s rank %d:PMIx_Finalize successfully completed", myproc.nspace, myproc.rank)); } + TEST_VERBOSE(("Client %s:%d finished PID:%d", params.nspace, params.rank, getpid())); TEST_OUTPUT_CLEAR(("OK\n")); TEST_CLOSE_FILE(); FREE_TEST_PARAMS(params); diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c index c1a8130b1a4..9ceeb72d539 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c @@ -13,11 +13,12 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. + * * $COPYRIGHT$ * * Additional copyrights may follow @@ -35,7 +36,8 @@ #include "server_callbacks.h" #include "utils.h" -#include "src/include/pmix_globals.h" +#include "test_server.h" +#include "test_common.h" bool spawn_wait = false; @@ -47,7 +49,6 @@ int main(int argc, char **argv) struct stat stat_buf; struct timeval tv; double test_start; - cli_state_t order[CLI_TERM+1]; test_params params; INIT_TEST_PARAMS(params); int test_fail = 0; @@ -68,6 +69,14 @@ int main(int argc, char **argv) parse_cmd(argc, argv, ¶ms); TEST_VERBOSE(("Start PMIx_lite smoke test (timeout is %d)", params.timeout)); + /* set common argv and env */ + client_env = pmix_argv_copy(environ); + set_client_argv(¶ms, &client_argv); + + tmp = pmix_argv_join(client_argv, ' '); + TEST_VERBOSE(("Executing test: %s", tmp)); + free(tmp); + /* verify executable */ if( 0 > ( rc = stat(params.binary, &stat_buf) ) ){ TEST_ERROR(("Cannot stat() executable \"%s\": %d: %s", params.binary, errno, strerror(errno))); @@ -83,48 +92,29 @@ int main(int argc, char **argv) return 0; } - /* setup the server library */ - pmix_info_t info[1]; - (void)strncpy(info[0].key, PMIX_SOCKET_MODE, PMIX_MAX_KEYLEN); - info[0].value.type = PMIX_UINT32; - info[0].value.data.uint32 = 0666; - - if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 1))) { - TEST_ERROR(("Init failed with error %d", rc)); + if (PMIX_SUCCESS != (rc = server_init(¶ms))) { FREE_TEST_PARAMS(params); return rc; } - /* register the errhandler */ - PMIx_Register_event_handler(NULL, 0, NULL, 0, - errhandler, errhandler_reg_callbk, NULL); - - order[CLI_UNINIT] = CLI_FORKED; - order[CLI_FORKED] = CLI_FIN; - order[CLI_CONNECTED] = CLI_UNDEF; - order[CLI_FIN] = CLI_TERM; - order[CLI_DISCONN] = CLI_UNDEF; - order[CLI_TERM] = CLI_UNDEF; - cli_init(params.nprocs, order); - /* set common argv and env */ - client_env = pmix_argv_copy(environ); - set_client_argv(¶ms, &client_argv); - - tmp = pmix_argv_join(client_argv, ' '); - TEST_VERBOSE(("Executing test: %s", tmp)); - free(tmp); + cli_init(params.lsize); int launched = 0; /* set namespaces and fork clients */ if (NULL == params.ns_dist) { + uint32_t i; + int base_rank = 0; + + /* compute my start counter */ + for(i = 0; i < (uint32_t)my_server_id; i++) { + base_rank += (params.nprocs % params.nservers) > (uint32_t)i ? + params.nprocs / params.nservers + 1 : + params.nprocs / params.nservers; + } /* we have a single namespace for all clients */ ns_nprocs = params.nprocs; - rc = launch_clients(ns_nprocs, params.binary, &client_env, &client_argv); - if (PMIX_SUCCESS != rc) { - FREE_TEST_PARAMS(params); - return rc; - } - launched += ns_nprocs; + launched += server_launch_clients(params.lsize, params.nprocs, base_rank, + ¶ms, &client_env, &client_argv); } else { char *pch; pch = strtok(params.ns_dist, ":"); @@ -136,17 +126,13 @@ int main(int argc, char **argv) return PMIX_ERROR; } if (0 < ns_nprocs) { - rc = launch_clients(ns_nprocs, params.binary, &client_env, &client_argv); - if (PMIX_SUCCESS != rc) { - FREE_TEST_PARAMS(params); - return rc; - } + launched += server_launch_clients(ns_nprocs, ns_nprocs, 0, ¶ms, + &client_env, &client_argv); } pch = strtok (NULL, ":"); - launched += ns_nprocs; } } - if (params.nprocs != (uint32_t)launched) { + if (params.lsize != (uint32_t)launched) { TEST_ERROR(("Total number of processes doesn't correspond number specified by ns_dist parameter.")); cli_kill_all(); test_fail = 1; @@ -185,24 +171,16 @@ int main(int argc, char **argv) PMIX_WAIT_FOR_COMPLETION(spawn_wait); } - pmix_argv_free(client_argv); - pmix_argv_free(client_env); - /* deregister the errhandler */ PMIx_Deregister_event_handler(0, op_callbk, NULL); cli_wait_all(1.0); - /* finalize the server library */ - if (PMIX_SUCCESS != (rc = PMIx_server_finalize())) { - TEST_ERROR(("Finalize failed with error %d", rc)); - } + test_fail += server_finalize(¶ms); FREE_TEST_PARAMS(params); - - if (0 == test_fail) { - TEST_OUTPUT(("Test finished OK!")); - } + pmix_argv_free(client_argv); + pmix_argv_free(client_env); return test_fail; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c b/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c index 783d45d6282..ae16129ecf2 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c +++ b/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c @@ -2,7 +2,7 @@ * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -17,6 +17,7 @@ #include #include "server_callbacks.h" #include "src/util/argv.h" +#include "test_server.h" extern bool spawn_wait; @@ -36,28 +37,6 @@ pmix_server_module_t mymodule = { .deregister_events = deregevents_fn }; -typedef struct { - pmix_list_item_t super; - pmix_modex_data_t data; -} pmix_test_data_t; - -static void pcon(pmix_test_data_t *p) -{ - p->data.blob = NULL; - p->data.size = 0; -} - -static void pdes(pmix_test_data_t *p) -{ - if (NULL != p->data.blob) { - free(p->data.blob); - } -} - -PMIX_CLASS_INSTANCE(pmix_test_data_t, - pmix_list_item_t, - pcon, pdes); - typedef struct { pmix_list_item_t super; pmix_info_t data; @@ -95,12 +74,25 @@ pmix_status_t connected(const pmix_proc_t *proc, void *server_object, pmix_status_t finalized(const pmix_proc_t *proc, void *server_object, pmix_op_cbfunc_t cbfunc, void *cbdata) { - if( CLI_TERM <= cli_info[proc->rank].state ){ + cli_info_t *cli = NULL; + int i; + for (i = 0; i < cli_info_cnt; i++) { + if((proc->rank == cli_info[i].rank) && + (0 == strcmp(proc->nspace, cli_info[i].ns))){ + cli = &cli_info[i]; + break; + } + } + if (NULL == cli) { + TEST_ERROR(("cannot found rank %d", proc->rank)); + return PMIX_SUCCESS; + } + if( CLI_TERM <= cli->state ){ TEST_ERROR(("double termination of rank %d", proc->rank)); return PMIX_SUCCESS; } - TEST_VERBOSE(("Rank %d terminated", proc->rank)); - cli_finalize(&cli_info[proc->rank]); + TEST_VERBOSE(("Rank %s:%d terminated", proc->nspace, proc->rank)); + cli_finalize(cli); finalized_count++; if (finalized_count == cli_info_cnt) { if (NULL != pmix_test_published_list) { @@ -135,16 +127,13 @@ pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs, TEST_VERBOSE(("Getting data for %s:%d", procs[0].nspace, procs[0].rank)); - /* In a perfect world, we should wait until - * the test servers from all involved procs - * respond. We don't have multi-server capability - * yet, so we'll just respond right away and - * return what we were given */ - - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL); + if ((pmix_list_get_size(server_list) == 1) && (my_server_id == 0)) { + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL); + } + return PMIX_SUCCESS; } - return PMIX_SUCCESS; + return server_fence_contrib(data, ndata, cbfunc, cbdata); } pmix_status_t dmodex_fn(const pmix_proc_t *proc, @@ -153,12 +142,12 @@ pmix_status_t dmodex_fn(const pmix_proc_t *proc, { TEST_VERBOSE(("Getting data for %s:%d", proc->nspace, proc->rank)); - /* In a perfect world, we should call another server - * to get the data for one of its clients. We don't - * have multi-server capability yet, so we'll just - * respond right away */ - - return PMIX_ERR_NOT_FOUND; + /* return not_found fot single server mode */ + if ((pmix_list_get_size(server_list) == 1) && (my_server_id == 0)) { + return PMIX_ERR_NOT_FOUND; + } + // TODO: add support tracker for dmodex requests + return server_dmdx_get(proc->nspace, proc->rank, cbfunc, cbdata); } pmix_status_t publish_fn(const pmix_proc_t *proc, @@ -199,6 +188,7 @@ pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, pmix_lookup_cbfunc_t cbfunc, void *cbdata) { size_t i, ndata, ret; + pmix_status_t rc = PMIX_SUCCESS; pmix_pdata_t *pdata; pmix_test_info_t *tinfo; if (NULL == pmix_test_published_list) { @@ -221,13 +211,15 @@ pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, } } if (ret != ndata) { - return PMIX_ERR_NOT_FOUND; + rc = PMIX_ERR_NOT_FOUND; + goto error; } if (NULL != cbfunc) { cbfunc(PMIX_SUCCESS, pdata, ndata, cbdata); } +error: PMIX_PDATA_FREE(pdata, ndata); - return PMIX_SUCCESS; + return rc; } pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys, diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c index ca277c5e28f..ae5b4ababc4 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c @@ -184,6 +184,7 @@ int main(int argc, char **argv) usleep(10); } + /* get our universe size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c index db62d7832c4..fd6a61eba4b 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -87,7 +87,9 @@ int main(int argc, char **argv) pmix_value_t *val = &value; pmix_proc_t proc; uint32_t nprocs; - + pmix_status_t code[5] = {PMIX_ERR_PROC_ABORTING, PMIX_ERR_PROC_ABORTED, + PMIX_ERR_PROC_REQUESTED_ABORT, PMIX_ERR_JOB_TERMINATED, + PMIX_ERR_UNREACH}; /* init us */ if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %d", myproc.nspace, myproc.rank, rc); @@ -108,7 +110,7 @@ int main(int argc, char **argv) completed = false; /* register our errhandler */ - PMIx_Register_event_handler(NULL, 0, NULL, 0, + PMIx_Register_event_handler(code, 5, NULL, 0, notification_fn, errhandler_reg_callbk, NULL); /* call fence to sync */ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c index b12afdb9b3c..c042f1948a8 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -144,7 +144,7 @@ int main(int argc, char **argv) (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank); value.type = PMIX_STRING; value.data.string = "1234"; - if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) { + if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_GLOBAL, tmp, &value))) { pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %d", myproc.nspace, myproc.rank, rc); goto done; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index fa7d3fb9337..e31f4211b9f 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -14,8 +14,8 @@ * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -343,7 +343,6 @@ int main(int argc, char **argv) pmix_info_t *info; size_t ninfo; bool cross_version = false; - bool usock = true; bool hwloc = false; #if PMIX_HAVE_HWLOC char *hwloc_file = NULL; @@ -357,8 +356,6 @@ int main(int argc, char **argv) exit(1); } - fprintf(stderr, "Testing version %s\n", PMIx_Get_version()); - /* see if we were passed the number of procs to run or * the executable to use */ for (n=1; n < argc; n++) { @@ -381,25 +378,6 @@ int main(int argc, char **argv) /* cross-version test - we will set one child to * run at a different version. Requires -n >= 2 */ cross_version = true; - usock = false; - } else if (0 == strcmp("-u", argv[n])) { - /* enable usock */ - usock = false; -#if PMIX_HAVE_HWLOC - } else if (0 == strcmp("-hwloc", argv[n]) || - 0 == strcmp("--hwloc", argv[n])) { - /* test hwloc support */ - hwloc = true; - } else if (0 == strcmp("-hwloc-file", argv[n]) || - 0 == strcmp("--hwloc-file", argv[n])) { - if (NULL == argv[n+1]) { - fprintf(stderr, "The --hwloc-file option requires an argument\n"); - exit(1); - } - hwloc_file = strdup(argv[n+1]); - hwloc = true; - ++n; -#endif } else if (0 == strcmp("-h", argv[n])) { /* print the options and exit */ fprintf(stderr, "usage: simptest \n"); @@ -427,34 +405,35 @@ int main(int argc, char **argv) } #endif + fprintf(stderr, "Testing version %s\n", PMIx_Get_version()); + /* setup the server library and tell it to support tool connections */ #if PMIX_HAVE_HWLOC if (hwloc) { #if HWLOC_API_VERSION < 0x20000 - ninfo = 4; + ninfo = 3; #else - ninfo = 5; + ninfo = 4; #endif } else { - ninfo = 3; + ninfo = 2; } #else - ninfo = 3; + ninfo = 2; #endif PMIX_INFO_CREATE(info, ninfo); PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TOOL_SUPPORT, NULL, PMIX_BOOL); - PMIX_INFO_LOAD(&info[1], PMIX_USOCK_DISABLE, &usock, PMIX_BOOL); - PMIX_INFO_LOAD(&info[2], PMIX_SERVER_GATEWAY, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&info[1], PMIX_SERVER_GATEWAY, NULL, PMIX_BOOL); #if PMIX_HAVE_HWLOC if (hwloc) { if (NULL != hwloc_file) { - PMIX_INFO_LOAD(&info[3], PMIX_TOPOLOGY_FILE, hwloc_file, PMIX_STRING); + PMIX_INFO_LOAD(&info[2], PMIX_TOPOLOGY_FILE, hwloc_file, PMIX_STRING); } else { - PMIX_INFO_LOAD(&info[3], PMIX_TOPOLOGY, NULL, PMIX_STRING); + PMIX_INFO_LOAD(&info[2], PMIX_TOPOLOGY, NULL, PMIX_STRING); } #if HWLOC_API_VERSION >= 0x20000 - PMIX_INFO_LOAD(&info[4], PMIX_HWLOC_SHARE_TOPO, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&info[3], PMIX_HWLOC_SHARE_TOPO, NULL, PMIX_BOOL); #endif } #endif @@ -560,9 +539,6 @@ int main(int argc, char **argv) } else { pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); } - } else if (!usock) { - /* don't disable usock => enable it on client */ - pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); } x = PMIX_NEW(myxfer_t); if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, @@ -599,7 +575,6 @@ int main(int argc, char **argv) pmix_list_append(&children, &child->super); } } - free(executable); pmix_argv_free(client_argv); pmix_argv_free(client_env); @@ -611,14 +586,21 @@ int main(int argc, char **argv) nanosleep(&ts, NULL); } - /* see if anyone exited with non-zero status */ - n=0; - PMIX_LIST_FOREACH(child, &children, wait_tracker_t) { - if (0 != child->exit_code) { - fprintf(stderr, "Child %d [%d] exited with status %d - test FAILED\n", n, child->pid, child->exit_code); - } - ++n; + /* see if anyone exited with non-zero status unless the test + * was expected to do so */ + if (NULL == strstr(executable, "simpdie")) { + n=0; + PMIX_LIST_FOREACH(child, &children, wait_tracker_t) { + if (0 != child->exit_code) { + fprintf(stderr, "Child %d [%d] exited with status %d - test FAILED\n", n, child->pid, child->exit_code); + } + ++n; + } + } else if (1 == exit_code) { + exit_code = 0; } + free(executable); + /* try notifying ourselves */ ninfo = 3; PMIX_INFO_CREATE(info, ninfo); @@ -729,21 +711,14 @@ static void errhandler_reg_callbk (pmix_status_t status, static pmix_status_t connected(const pmix_proc_t *proc, void *server_object, pmix_op_cbfunc_t cbfunc, void *cbdata) { - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_output(0, "SERVER: FINALIZED %s:%d WAKEUP %d", proc->nspace, proc->rank, wakeup); - /* ensure we call the cbfunc so the proc can exit! */ - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static void abcbfunc(pmix_status_t status, void *cbdata) @@ -801,17 +776,31 @@ static pmix_status_t abort_fn(const pmix_proc_t *proc, return PMIX_SUCCESS; } +static void fencbfn(int sd, short args, void *cbdata) +{ + pmix_shift_caddy_t *scd = (pmix_shift_caddy_t*)cbdata; + /* pass the provided data back to each participating proc */ + if (NULL != scd->cbfunc.modexcbfunc) { + scd->cbfunc.modexcbfunc(scd->status, scd->data, scd->ndata, scd->cbdata, NULL, NULL); + } + PMIX_RELEASE(scd); +} static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs, const pmix_info_t info[], size_t ninfo, char *data, size_t ndata, pmix_modex_cbfunc_t cbfunc, void *cbdata) { + pmix_shift_caddy_t *scd; + pmix_output(0, "SERVER: FENCENB"); - /* pass the provided data back to each participating proc */ - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, data, ndata, cbdata, NULL, NULL); - } + scd = PMIX_NEW(pmix_shift_caddy_t); + scd->status = PMIX_SUCCESS; + scd->data = data; + scd->ndata = ndata; + scd->cbfunc.modexcbfunc = cbfunc; + scd->cbdata = cbdata; + PMIX_THREADSHIFT(scd, fencbfn); return PMIX_SUCCESS; } @@ -820,6 +809,8 @@ static pmix_status_t dmodex_fn(const pmix_proc_t *proc, const pmix_info_t info[], size_t ninfo, pmix_modex_cbfunc_t cbfunc, void *cbdata) { + pmix_shift_caddy_t *scd; + pmix_output(0, "SERVER: DMODEX"); /* if this is a timeout test, then do nothing */ @@ -827,11 +818,12 @@ static pmix_status_t dmodex_fn(const pmix_proc_t *proc, return PMIX_SUCCESS; } - /* we don't have any data for remote procs as this - * test only runs one server - so report accordingly */ - if (NULL != cbfunc) { - cbfunc(PMIX_ERR_NOT_FOUND, NULL, 0, cbdata, NULL, NULL); - } + scd = PMIX_NEW(pmix_shift_caddy_t); + scd->status = PMIX_ERR_NOT_FOUND; + scd->cbfunc.modexcbfunc = cbfunc; + scd->cbdata = cbdata; + PMIX_THREADSHIFT(scd, fencbfn); + return PMIX_SUCCESS; } @@ -853,12 +845,26 @@ static pmix_status_t publish_fn(const pmix_proc_t *proc, pmix_value_xfer(&p->pdata.value, (pmix_value_t*)&info[n].value); pmix_list_append(&pubdata, &p->super); } - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - return PMIX_SUCCESS; + + return PMIX_OPERATION_SUCCEEDED; } +typedef struct { + pmix_event_t ev; + pmix_pdata_t *pd; + size_t n; + pmix_lookup_cbfunc_t cbfunc; + void *cbdata; +} lkobj_t; + +static void lkcbfn(int sd, short args, void *cbdata) +{ + lkobj_t *lk = (lkobj_t*)cbdata; + + lk->cbfunc(PMIX_SUCCESS, lk->pd, lk->n, lk->cbdata); + PMIX_PDATA_FREE(lk->pd, lk->n); + free(lk); +} static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, const pmix_info_t info[], size_t ninfo, @@ -869,6 +875,7 @@ static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, size_t i, n; pmix_pdata_t *pd = NULL; pmix_status_t ret = PMIX_ERR_NOT_FOUND; + lkobj_t *lk; pmix_output(0, "SERVER: LOOKUP"); @@ -901,13 +908,16 @@ static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, } } PMIX_LIST_DESTRUCT(&results); - if (NULL != cbfunc) { - cbfunc(ret, pd, n, cbdata); - } - if (0 < n) { - PMIX_PDATA_FREE(pd, n); + if (PMIX_SUCCESS == ret) { + lk = (lkobj_t*)malloc(sizeof(lkobj_t)); + lk->pd = pd; + lk->n = n; + lk->cbfunc = cbfunc; + lk->cbdata = cbdata; + PMIX_THREADSHIFT(lk, lkcbfn); } - return PMIX_SUCCESS; + + return ret; } @@ -929,10 +939,7 @@ static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys, } } } - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static void spcbfunc(pmix_status_t status, void *cbdata) @@ -996,11 +1003,7 @@ static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs, numconnects++; - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } @@ -1010,30 +1013,20 @@ static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs, { pmix_output(0, "SERVER: DISCONNECT"); - /* in practice, we would pass this request to the local - * resource manager for handling */ - - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static pmix_status_t register_event_fn(pmix_status_t *codes, size_t ncodes, const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static pmix_status_t deregister_events(pmix_status_t *codes, size_t ncodes, pmix_op_cbfunc_t cbfunc, void *cbdata) { - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static pmix_status_t notify_event(pmix_status_t code, @@ -1047,10 +1040,21 @@ static pmix_status_t notify_event(pmix_status_t code, } typedef struct query_data_t { + pmix_event_t ev; pmix_info_t *data; size_t ndata; + pmix_info_cbfunc_t cbfunc; + void *cbdata; } query_data_t; +static void qfn(int sd, short args, void *cbdata) +{ + query_data_t *qd = (query_data_t*)cbdata; + + qd->cbfunc(PMIX_SUCCESS, qd->data, qd->ndata, qd->cbdata, NULL, NULL); + PMIX_INFO_FREE(qd->data, qd->ndata); +} + static pmix_status_t query_fn(pmix_proc_t *proct, pmix_query_t *queries, size_t nqueries, pmix_info_cbfunc_t cbfunc, @@ -1058,6 +1062,7 @@ static pmix_status_t query_fn(pmix_proc_t *proct, { size_t n; pmix_info_t *info; + query_data_t qd; pmix_output(0, "SERVER: QUERY"); @@ -1074,7 +1079,11 @@ static pmix_status_t query_fn(pmix_proc_t *proct, return PMIX_ERROR; } } - cbfunc(PMIX_SUCCESS, info, nqueries, cbdata, NULL, NULL); + qd.data = info; + qd.ndata = nqueries; + qd.cbfunc = cbfunc; + qd.cbdata = cbdata; + PMIX_THREADSHIFT(&qd, qfn); return PMIX_SUCCESS; } @@ -1095,16 +1104,29 @@ static void tool_connect_fn(pmix_info_t *info, size_t ninfo, } } +typedef struct { + pmix_event_t ev; + pmix_op_cbfunc_t cbfunc; + void *cbdata; +} mylog_t; + +static void foobar(int sd, short args, void *cbdata) +{ + mylog_t *lg = (mylog_t*)cbdata; + lg->cbfunc(PMIX_SUCCESS, lg->cbdata); +} static void log_fn(const pmix_proc_t *client, const pmix_info_t data[], size_t ndata, const pmix_info_t directives[], size_t ndirs, pmix_op_cbfunc_t cbfunc, void *cbdata) { + mylog_t *lg = (mylog_t *)malloc(sizeof(mylog_t)); + pmix_output(0, "SERVER: LOG"); - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, cbdata); - } + lg->cbfunc = cbfunc; + lg->cbdata = cbdata; + PMIX_THREADSHIFT(lg, foobar); } static pmix_status_t alloc_fn(const pmix_proc_t *client, @@ -1112,7 +1134,7 @@ static pmix_status_t alloc_fn(const pmix_proc_t *client, const pmix_info_t data[], size_t ndata, pmix_info_cbfunc_t cbfunc, void *cbdata) { - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } static pmix_status_t jctrl_fn(const pmix_proc_t *requestor, @@ -1160,13 +1182,19 @@ static void wait_signal_callback(int fd, short event, void *arg) /* we are already in an event, so it is safe to access the list */ PMIX_LIST_FOREACH(t2, &children, wait_tracker_t) { if (pid == t2->pid) { - t2->exit_code = status; /* found it! */ - if (0 != status && 0 == exit_code) { - exit_code = status; + if (WIFEXITED(status)) { + t2->exit_code = WEXITSTATUS(status); + } else { + if (WIFSIGNALED(status)) { + t2->exit_code = WTERMSIG(status) + 128; + } + } + if (0 != t2->exit_code && 0 == exit_code) { + exit_code = t2->exit_code; } --wakeup; - return; + break; } } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c index 2af6f395ede..9e96d21ee7d 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptool.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -95,6 +95,7 @@ int main(int argc, char **argv) PMIX_QUERY_CREATE(query, nq); pmix_argv_append_nosize(&query[0].keys, "foobar"); pmix_argv_append_nosize(&query[1].keys, "spastic"); + pmix_argv_append_nosize(&query[1].keys, PMIX_SERVER_URI); active = true; if (PMIX_SUCCESS != (rc = PMIx_Query_info_nb(query, nq, cbfunc, (void*)&active))) { pmix_output(0, "Client ns %s rank %d: PMIx_Query_info failed: %d", myproc.nspace, myproc.rank, rc); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.c b/opal/mca/pmix/pmix3x/pmix/test/test_common.c index 9021e58ba21..7b9ac8701d1 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. - * Copyright (c) 2015-2017 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * @@ -87,6 +87,11 @@ void parse_cmd(int argc, char **argv, test_params *params) if (NULL != argv[i]) { params->binary = strdup(argv[i]); } + } else if (0 == strcmp(argv[i], "--nservers") || 0 == strcmp(argv[i], "-s")){ + i++; + if (NULL != argv[i]) { + params->nservers = atoi(argv[i]); + } } else if( 0 == strcmp(argv[i], "--verbose") || 0 == strcmp(argv[i],"-v") ){ TEST_VERBOSE_ON(); params->verbose = 1; @@ -600,7 +605,6 @@ int get_total_ns_number(test_params params) int get_all_ranks_from_namespace(test_params params, char *nspace, pmix_proc_t **ranks, size_t *nranks) { - int base_rank = 0; size_t num_ranks = 0; int num = -1; size_t j; @@ -616,7 +620,6 @@ int get_all_ranks_from_namespace(test_params params, char *nspace, pmix_proc_t * char *pch = tmp; int ns_id = (int)strtol(nspace + strlen(TEST_NAMESPACE) + 1, NULL, 10); while (NULL != pch && num != ns_id) { - base_rank += num_ranks; pch = strtok((-1 == num ) ? tmp : NULL, ":"); if (NULL == pch) { break; @@ -629,7 +632,7 @@ int get_all_ranks_from_namespace(test_params params, char *nspace, pmix_proc_t * PMIX_PROC_CREATE(*ranks, num_ranks); for (j = 0; j < num_ranks; j++) { (void)strncpy((*ranks)[j].nspace, nspace, PMIX_MAX_NSLEN); - (*ranks)[j].rank = base_rank+j; + (*ranks)[j].rank = j; } } else { free(tmp); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index acc49d1bcef..fd25f8bdf87 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2015-2017 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * @@ -51,7 +51,7 @@ extern FILE *file; #define STRIPPED_FILE_NAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) #define TEST_OUTPUT(x) { \ - fprintf(file,"%s:%s: %s\n",STRIPPED_FILE_NAME, __func__, \ + fprintf(file,"==%d== %s:%s: %s\n", getpid(), STRIPPED_FILE_NAME, __func__, \ pmix_test_output_prepare x ); \ fflush(file); \ } @@ -59,13 +59,13 @@ extern FILE *file; // Write output without adding anything to it. // Need for automate tests to receive "OK" string #define TEST_OUTPUT_CLEAR(x) { \ - fprintf(file, "%s", pmix_test_output_prepare x ); \ + fprintf(file, "==%d== %s", getpid(), pmix_test_output_prepare x ); \ fflush(file); \ } // Always write errors to the stderr #define TEST_ERROR(x) { \ - fprintf(stderr,"ERROR [%s:%d:%s]: %s\n", STRIPPED_FILE_NAME, __LINE__, __func__, \ + fprintf(stderr,"==%d== ERROR [%s:%d:%s]: %s\n", getpid(), STRIPPED_FILE_NAME, __LINE__, __func__, \ pmix_test_output_prepare x ); \ fflush(stderr); \ } @@ -129,6 +129,8 @@ typedef struct { char *key_replace; int test_internal; char *gds_mode; + int nservers; + uint32_t lsize; } test_params; #define INIT_TEST_PARAMS(params) do { \ @@ -160,6 +162,8 @@ typedef struct { params.key_replace = NULL; \ params.test_internal = 0; \ params.gds_mode = NULL; \ + params.nservers = 1; \ + params.lsize = 0; \ } while (0) #define FREE_TEST_PARAMS(params) do { \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.c b/opal/mca/pmix/pmix3x/pmix/test/test_server.c new file mode 100644 index 00000000000..3627dade912 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.c @@ -0,0 +1,978 @@ + /* + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2016 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include +#include +#include +#include +#include +#include + +#include "pmix_server.h" +#include "src/include/pmix_globals.h" + +#include "test_server.h" +#include "test_common.h" +#include "cli_stages.h" +#include "server_callbacks.h" + +int my_server_id = 0; + +server_info_t *my_server_info = NULL; +pmix_list_t *server_list = NULL; +pmix_list_t *server_nspace = NULL; + +static void sdes(server_info_t *s) +{ + close(s->rd_fd); + close(s->wr_fd); + if (s->evread) { + event_del(s->evread); + } + s->evread = NULL; +} + +static void scon(server_info_t *s) +{ + s->idx = 0; + s->pid = 0; + s->rd_fd = -1; + s->wr_fd = -1; + s->evread = NULL; + s->modex_cbfunc = NULL; + s->cbdata = NULL; +} + +PMIX_CLASS_INSTANCE(server_info_t, + pmix_list_item_t, + scon, sdes); + +static void nsdes(server_nspace_t *ns) +{ + if (ns->task_map) { + free(ns->task_map); + } +} + +static void nscon(server_nspace_t *ns) +{ + memset(ns->name, 0, PMIX_MAX_NSLEN); + ns->ntasks = 0; + ns->task_map = NULL; +} + +PMIX_CLASS_INSTANCE(server_nspace_t, + pmix_list_item_t, + nscon, nsdes); + +static int server_send_procs(void); +static void server_read_cb(evutil_socket_t fd, short event, void *arg); +static int srv_wait_all(double timeout); +static int server_fwd_msg(msg_hdr_t *msg_hdr, char *buf, size_t size); +static int server_send_msg(msg_hdr_t *msg_hdr, char *data, size_t size); +static void remove_server_item(server_info_t *server); +static void server_unpack_dmdx(char *buf, int *sender, pmix_proc_t *proc); +static int server_pack_dmdx(int sender_id, const char *nspace, int rank, + char **buf); +static void _dmdx_cb(int status, char *data, size_t sz, void *cbdata); + +static void release_cb(pmix_status_t status, void *cbdata) +{ + int *ptr = (int*)cbdata; + *ptr = 0; +} + +static void set_namespace(int local_size, int univ_size, char *ranks, char *name) +{ + size_t ninfo; + pmix_info_t *info; + ninfo = 8; + char *regex, *ppn; + + PMIX_INFO_CREATE(info, ninfo); + pmix_strncpy(info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + info[0].value.type = PMIX_UINT32; + info[0].value.data.uint32 = univ_size; + + pmix_strncpy(info[1].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); + info[1].value.type = PMIX_UINT32; + info[1].value.data.uint32 = 0; + + pmix_strncpy(info[2].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); + info[2].value.type = PMIX_UINT32; + info[2].value.data.uint32 = local_size; + + pmix_strncpy(info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); + info[3].value.type = PMIX_STRING; + info[3].value.data.string = strdup(ranks); + + PMIx_generate_regex(NODE_NAME, ®ex); + pmix_strncpy(info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); + info[4].value.type = PMIX_STRING; + info[4].value.data.string = regex; + + PMIx_generate_ppn(ranks, &ppn); + pmix_strncpy(info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); + info[5].value.type = PMIX_STRING; + info[5].value.data.string = ppn; + + pmix_strncpy(info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); + info[6].value.type = PMIX_UINT32; + info[6].value.data.uint32 = univ_size; + + pmix_strncpy(info[7].key, PMIX_APPNUM, PMIX_MAX_KEYLEN); + info[7].value.type = PMIX_UINT32; + info[7].value.data.uint32 = getpid (); + + int in_progress = 1, rc; + if (PMIX_SUCCESS == (rc = PMIx_server_register_nspace(name, local_size, + info, ninfo, release_cb, &in_progress))) { + PMIX_WAIT_FOR_COMPLETION(in_progress); + } + PMIX_INFO_FREE(info, ninfo); +} + +static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) +{ + uint32_t i; + int len = 0, max_ranks_len; + if (0 >= nprocs) { + return; + } + max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); + *ranks = (char*) malloc(max_ranks_len); + for (i = 0; i < nprocs; i++) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); + if (i != nprocs-1) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); + } + } + if (len >= max_ranks_len-1) { + free(*ranks); + *ranks = NULL; + TEST_ERROR(("Not enough allocated space for global ranks array.")); + } +} + +static void server_unpack_procs(char *buf, size_t size) +{ + char *ptr = buf; + size_t i; + size_t ns_count; + char *nspace; + + while ((size_t)(ptr - buf) < size) { + ns_count = (size_t)*ptr; + ptr += sizeof(size_t); + + for (i = 0; i < ns_count; i++) { + server_nspace_t *tmp, *ns_item = NULL; + size_t ltasks, ntasks; + int server_id; + + server_id = *ptr; + ptr += sizeof(int); + + nspace = ptr; + ptr += PMIX_MAX_NSLEN+1; + + ntasks = (size_t)*ptr; + ptr += sizeof(size_t); + + ltasks = (size_t)*ptr; + ptr += sizeof(size_t); + + PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { + if (0 == strcmp(nspace, tmp->name)) { + ns_item = tmp; + break; + } + } + if (NULL == ns_item) { + ns_item = PMIX_NEW(server_nspace_t); + memcpy(ns_item->name, nspace, PMIX_MAX_NSLEN); + pmix_list_append(server_nspace, &ns_item->super); + ns_item->ltasks = ltasks; + ns_item->ntasks = ntasks; + ns_item->task_map = (int*)malloc(sizeof(int) * ntasks); + memset(ns_item->task_map, -1, sizeof(int) * ntasks); + } else { + assert(ns_item->ntasks == ntasks); + } + size_t i; + for (i = 0; i < ltasks; i++) { + int rank = (int)*ptr; + ptr += sizeof(int); + if (ns_item->task_map[rank] >= 0) { + continue; + } + ns_item->task_map[rank] = server_id; + } + } + } +} + +static size_t server_pack_procs(int server_id, char **buf, size_t size) +{ + size_t ns_count = pmix_list_get_size(server_nspace); + size_t buf_size = sizeof(size_t) + (PMIX_MAX_NSLEN+1)*ns_count; + server_nspace_t *tmp; + char *ptr; + + if (0 == ns_count) { + return 0; + } + + buf_size += size; + /* compute size: server_id + total + local procs count + ranks */ + PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { + buf_size += sizeof(int) + sizeof(size_t) + sizeof(size_t) + + sizeof(int) * tmp->ltasks; + } + *buf = (char*)realloc(*buf, buf_size); + memset(*buf + size, 0, buf_size); + ptr = *buf + size; + /* pack ns count */ + memcpy(ptr, &ns_count, sizeof(size_t)); + ptr += sizeof(size_t); + + assert(server_nspace->pmix_list_length); + + PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { + size_t i; + /* pack server_id */ + memcpy(ptr, &server_id, sizeof(int)); + ptr += sizeof(int); + /* pack ns name */ + memcpy(ptr, tmp->name, PMIX_MAX_NSLEN+1); + ptr += PMIX_MAX_NSLEN+1; + /* pack ns total size */ + memcpy(ptr, &tmp->ntasks, sizeof(size_t)); + ptr += sizeof(size_t); + /* pack ns local size */ + memcpy(ptr, &tmp->ltasks, sizeof(size_t)); + ptr += sizeof(size_t); + /* pack ns ranks */ + for(i = 0; i < tmp->ntasks; i++) { + if (tmp->task_map[i] == server_id) { + int rank = (int)i; + memcpy(ptr, &rank, sizeof(int)); + ptr += sizeof(int); + } + } + } + assert((size_t)(ptr - *buf) == buf_size); + return buf_size; +} + +static void remove_server_item(server_info_t *server) +{ + pmix_list_remove_item(server_list, &server->super); + PMIX_DESTRUCT_LOCK(&server->lock); + PMIX_RELEASE(server); +} + +static int srv_wait_all(double timeout) +{ + server_info_t *server, *next; + pid_t pid; + int status; + struct timeval tv; + double start_time, cur_time; + int ret = 0; + + gettimeofday(&tv, NULL); + start_time = tv.tv_sec + 1E-6*tv.tv_usec; + cur_time = start_time; + + /* Remove this server from the list */ + PMIX_LIST_FOREACH_SAFE(server, next, server_list, server_info_t) { + if (server->pid == getpid()) { + /* remove himself */ + remove_server_item(server); + break; + } + } + + while (!pmix_list_is_empty(server_list) && + (timeout >= (cur_time - start_time))) { + pid = waitpid(-1, &status, 0); + if (pid >= 0) { + PMIX_LIST_FOREACH_SAFE(server, next, server_list, server_info_t) { + if (server->pid == pid) { + TEST_VERBOSE(("server %d finalize PID:%d with status %d", server->idx, + server->pid, WEXITSTATUS(status))); + ret += WEXITSTATUS(status); + remove_server_item(server); + } + } + } + // calculate current timestamp + gettimeofday(&tv, NULL); + cur_time = tv.tv_sec + 1E-6*tv.tv_usec; + } + + return ret; +} + +static int server_fwd_msg(msg_hdr_t *msg_hdr, char *buf, size_t size) +{ + server_info_t *tmp_server, *server = NULL; + int rc = PMIX_SUCCESS; + + PMIX_LIST_FOREACH(tmp_server, server_list, server_info_t) { + if (tmp_server->idx == msg_hdr->dst_id) { + server = tmp_server; + break; + } + } + if (NULL == server) { + return PMIX_ERROR; + } + rc = write(server->wr_fd, msg_hdr, sizeof(msg_hdr_t)); + if (rc != sizeof(msg_hdr_t)) { + return PMIX_ERROR; + } + rc = write(server->wr_fd, buf, size); + if (rc != (ssize_t)size) { + return PMIX_ERROR; + } + return PMIX_SUCCESS; +} + +static int server_send_msg(msg_hdr_t *msg_hdr, char *data, size_t size) +{ + size_t ret = 0; + server_info_t *server = NULL, *server_tmp; + if (0 == my_server_id) { + PMIX_LIST_FOREACH(server_tmp, server_list, server_info_t) { + if (server_tmp->idx == msg_hdr->dst_id) { + server = server_tmp; + break; + } + } + if (NULL == server) { + abort(); + } + } else { + server = (server_info_t *)pmix_list_get_first(server_list); + } + + ret += write(server->wr_fd, msg_hdr, sizeof(msg_hdr_t)); + ret += write(server->wr_fd, data, size); + if (ret != (sizeof(*msg_hdr) + size)) { + return PMIX_ERROR; + } + return PMIX_SUCCESS; +} + +static void _send_procs_cb(pmix_status_t status, const char *data, + size_t ndata, void *cbdata, + pmix_release_cbfunc_t relfn, void *relcbd) +{ + server_info_t *server = (server_info_t*)cbdata; + + server_unpack_procs((char*)data, ndata); + free((char*)data); + PMIX_WAKEUP_THREAD(&server->lock); +} + +static int server_send_procs(void) +{ + server_info_t *server; + msg_hdr_t msg_hdr; + int rc = PMIX_SUCCESS; + char *buf = NULL; + + if (0 == my_server_id) { + server = my_server_info; + } else { + server = (server_info_t *)pmix_list_get_first(server_list); + } + + msg_hdr.cmd = CMD_FENCE_CONTRIB; + msg_hdr.dst_id = 0; + msg_hdr.src_id = my_server_id; + msg_hdr.size = server_pack_procs(my_server_id, &buf, 0); + server->modex_cbfunc = _send_procs_cb; + server->cbdata = (void*)server; + + server->lock.active = true; + + if (PMIX_SUCCESS != (rc = server_send_msg(&msg_hdr, buf, msg_hdr.size))) { + if (buf) { + free(buf); + } + return PMIX_ERROR; + } + if (buf) { + free(buf); + } + + PMIX_WAIT_THREAD(&server->lock); + return PMIX_SUCCESS; +} + +int server_barrier(void) +{ + server_info_t *server; + msg_hdr_t msg_hdr; + int rc = PMIX_SUCCESS; + + if (0 == my_server_id) { + server = my_server_info; + } else { + server = (server_info_t *)pmix_list_get_first(server_list); + } + + msg_hdr.cmd = CMD_BARRIER_REQUEST; + msg_hdr.dst_id = 0; + msg_hdr.src_id = my_server_id; + msg_hdr.size = 0; + + server->lock.active = true; + + if (PMIX_SUCCESS != (rc = server_send_msg(&msg_hdr, NULL, 0))) { + return PMIX_ERROR; + } + PMIX_WAIT_THREAD(&server->lock); + + return PMIX_SUCCESS; +} + +static void _libpmix_cb(void *cbdata) +{ + char *ptr = (char*)cbdata; + if (ptr) { + free(ptr); + } +} + +static void server_read_cb(evutil_socket_t fd, short event, void *arg) +{ + server_info_t *server = (server_info_t*)arg; + msg_hdr_t msg_hdr; + char *msg_buf = NULL; + static char *fence_buf = NULL; + int rc; + static size_t barrier_cnt = 0; + static size_t contrib_cnt = 0; + static size_t fence_buf_offset = 0; + + rc = read(server->rd_fd, &msg_hdr, sizeof(msg_hdr_t)); + if (rc <= 0) { + return; + } + if (msg_hdr.size) { + msg_buf = (char*) malloc(sizeof(char) * msg_hdr.size); + rc += read(server->rd_fd, msg_buf, msg_hdr.size); + } + if (rc != (int)(sizeof(msg_hdr_t) + msg_hdr.size)) { + TEST_ERROR(("error read from %d", server->idx)); + } + + if (my_server_id != msg_hdr.dst_id) { + server_fwd_msg(&msg_hdr, msg_buf, msg_hdr.size); + free(msg_buf); + return; + } + + switch(msg_hdr.cmd) { + case CMD_BARRIER_REQUEST: + barrier_cnt++; + TEST_VERBOSE(("CMD_BARRIER_REQ req from %d cnt %d", msg_hdr.src_id, + barrier_cnt)); + if (pmix_list_get_size(server_list) == barrier_cnt) { + barrier_cnt = 0; /* reset barrier counter */ + server_info_t *tmp_server; + PMIX_LIST_FOREACH(tmp_server, server_list, server_info_t) { + msg_hdr_t resp_hdr; + resp_hdr.dst_id = tmp_server->idx; + resp_hdr.src_id = my_server_id; + resp_hdr.cmd = CMD_BARRIER_RESPONSE; + resp_hdr.size = 0; + server_send_msg(&resp_hdr, NULL, 0); + } + } + break; + case CMD_BARRIER_RESPONSE: + TEST_VERBOSE(("%d: CMD_BARRIER_RESP", my_server_id)); + PMIX_WAKEUP_THREAD(&server->lock); + break; + case CMD_FENCE_CONTRIB: + contrib_cnt++; + if (msg_hdr.size > 0) { + fence_buf = (char*)realloc((void*)fence_buf, + fence_buf_offset + msg_hdr.size); + memcpy(fence_buf + fence_buf_offset, msg_buf, msg_hdr.size); + fence_buf_offset += msg_hdr.size; + free(msg_buf); + msg_buf = NULL; + } + + TEST_VERBOSE(("CMD_FENCE_CONTRIB req from %d cnt %d size %d", + msg_hdr.src_id, contrib_cnt, msg_hdr.size)); + if (pmix_list_get_size(server_list) == contrib_cnt) { + server_info_t *tmp_server; + PMIX_LIST_FOREACH(tmp_server, server_list, server_info_t) { + msg_hdr_t resp_hdr; + resp_hdr.dst_id = tmp_server->idx; + resp_hdr.src_id = my_server_id; + resp_hdr.cmd = CMD_FENCE_COMPLETE; + resp_hdr.size = fence_buf_offset; + server_send_msg(&resp_hdr, fence_buf, fence_buf_offset); + } + TEST_VERBOSE(("CMD_FENCE_CONTRIB complete, size %d", + fence_buf_offset)); + if (fence_buf) { + free(fence_buf); + fence_buf = NULL; + fence_buf_offset = 0; + } + contrib_cnt = 0; + } + break; + case CMD_FENCE_COMPLETE: + TEST_VERBOSE(("%d: CMD_FENCE_COMPLETE size %d", my_server_id, + msg_hdr.size)); + server->modex_cbfunc(PMIX_SUCCESS, msg_buf, msg_hdr.size, + server->cbdata, _libpmix_cb, msg_buf); + msg_buf = NULL; + break; + case CMD_DMDX_REQUEST: { + int *sender_id; + pmix_proc_t proc; + if (NULL == msg_buf) { + abort(); + } + sender_id = (int*)malloc(sizeof(int)); + server_unpack_dmdx(msg_buf, sender_id, &proc); + TEST_VERBOSE(("%d: CMD_DMDX_REQUEST from %d: %s:%d", my_server_id, + *sender_id, proc.nspace, proc.rank)); + rc = PMIx_server_dmodex_request(&proc, _dmdx_cb, (void*)sender_id); + break; + } + case CMD_DMDX_RESPONSE: + TEST_VERBOSE(("%d: CMD_DMDX_RESPONSE", my_server_id)); + server->modex_cbfunc(PMIX_SUCCESS, msg_buf, msg_hdr.size, + server->cbdata, _libpmix_cb, msg_buf); + msg_buf = NULL; + break; + } + if (NULL != msg_buf) { + free(msg_buf); + } +} + +int server_fence_contrib(char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata) +{ + server_info_t *server; + msg_hdr_t msg_hdr; + int rc = PMIX_SUCCESS; + + if (0 == my_server_id) { + server = my_server_info; + } else { + server = (server_info_t *)pmix_list_get_first(server_list); + } + msg_hdr.cmd = CMD_FENCE_CONTRIB; + msg_hdr.dst_id = 0; + msg_hdr.src_id = my_server_id; + msg_hdr.size = ndata; + server->modex_cbfunc = cbfunc; + server->cbdata = cbdata; + + if (PMIX_SUCCESS != (rc = server_send_msg(&msg_hdr, data, ndata))) { + return PMIX_ERROR; + } + return rc; +} + +static int server_find_id(const char *nspace, int rank) +{ + server_nspace_t *tmp; + + PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { + if (0 == strcmp(tmp->name, nspace)) { + return tmp->task_map[rank]; + } + } + return -1; +} + +static int server_pack_dmdx(int sender_id, const char *nspace, int rank, + char **buf) +{ + size_t buf_size = sizeof(int) + PMIX_MAX_NSLEN +1 + sizeof(int); + char *ptr; + + *buf = (char*)malloc(buf_size); + ptr = *buf; + + memcpy(ptr, &sender_id, sizeof(int)); + ptr += sizeof(int); + + memcpy(ptr, nspace, PMIX_MAX_NSLEN+1); + ptr += PMIX_MAX_NSLEN +1; + + memcpy(ptr, &rank, sizeof(int)); + ptr += sizeof(int); + + return buf_size; +} + +static void server_unpack_dmdx(char *buf, int *sender, pmix_proc_t *proc) +{ + char *ptr = buf; + + *sender = (int)*ptr; + ptr += sizeof(int); + + memcpy(proc->nspace, ptr, PMIX_MAX_NSLEN +1); + ptr += PMIX_MAX_NSLEN +1; + + proc->rank = (int)*ptr; + ptr += sizeof(int); +} + + +static void _dmdx_cb(int status, char *data, size_t sz, void *cbdata) +{ + msg_hdr_t msg_hdr; + int *sender_id = (int*)cbdata; + + msg_hdr.cmd = CMD_DMDX_RESPONSE; + msg_hdr.src_id = my_server_id; + msg_hdr.size = sz; + msg_hdr.dst_id = *sender_id; + free(sender_id); + + server_send_msg(&msg_hdr, data, sz); +} + +int server_dmdx_get(const char *nspace, int rank, + pmix_modex_cbfunc_t cbfunc, void *cbdata) +{ + server_info_t *server = NULL, *tmp; + msg_hdr_t msg_hdr; + pmix_status_t rc = PMIX_SUCCESS; + char *buf = NULL; + + + if (0 > (msg_hdr.dst_id = server_find_id(nspace, rank))) { + TEST_ERROR(("%d: server cannot found for %s:%d", my_server_id, nspace, rank)); + goto error; + } + + if (0 == my_server_id) { + PMIX_LIST_FOREACH(tmp, server_list, server_info_t) { + if (tmp->idx == msg_hdr.dst_id) { + server = tmp; + break; + } + } + } else { + server = (server_info_t *)pmix_list_get_first(server_list); + } + + if (server == NULL) { + goto error; + } + + msg_hdr.cmd = CMD_DMDX_REQUEST; + msg_hdr.src_id = my_server_id; + msg_hdr.size = server_pack_dmdx(my_server_id, nspace, rank, &buf); + server->modex_cbfunc = cbfunc; + server->cbdata = cbdata; + + if (PMIX_SUCCESS != (rc = server_send_msg(&msg_hdr, buf, msg_hdr.size))) { + rc = PMIX_ERROR; + } + free(buf); + return rc; + +error: + cbfunc(PMIX_ERROR, NULL, 0, cbdata, NULL, 0); + return PMIX_ERROR; +} + +int server_init(test_params *params) +{ + pmix_info_t info[1]; + int rc = PMIX_SUCCESS; + + /* fork/init servers procs */ + if (params->nservers >= 1) { + int i; + server_info_t *server_info = NULL; + server_list = PMIX_NEW(pmix_list_t); + + TEST_VERBOSE(("pmix server %d started PID:%d", my_server_id, getpid())); + for (i = params->nservers - 1; i >= 0; i--) { + pid_t pid; + server_info = PMIX_NEW(server_info_t); + + int fd1[2]; + int fd2[2]; + + pipe(fd1); + pipe(fd2); + + if (0 != i) { + pid = fork(); + if (pid < 0) { + TEST_ERROR(("Fork failed")); + return pid; + } + if (pid == 0) { + server_list = PMIX_NEW(pmix_list_t); + my_server_id = i; + server_info->idx = 0; + server_info->pid = getppid(); + server_info->rd_fd = fd1[0]; + server_info->wr_fd = fd2[1]; + close(fd1[1]); + close(fd2[0]); + PMIX_CONSTRUCT_LOCK(&server_info->lock); + pmix_list_append(server_list, &server_info->super); + break; + } + server_info->idx = i; + server_info->pid = pid; + server_info->wr_fd = fd1[1]; + server_info->rd_fd = fd2[0]; + PMIX_CONSTRUCT_LOCK(&server_info->lock); + close(fd1[0]); + close(fd2[1]); + } else { + my_server_info = server_info; + server_info->pid = getpid(); + server_info->idx = 0; + server_info->rd_fd = fd1[0]; + server_info->wr_fd = fd1[1]; + PMIX_CONSTRUCT_LOCK(&server_info->lock); + close(fd2[0]); + close(fd2[1]); + } + TEST_VERBOSE(("%d: add server %d", my_server_id, server_info->idx)); + pmix_list_append(server_list, &server_info->super); + } + } + /* compute local proc size */ + params->lsize = (params->nprocs % params->nservers) > (uint32_t)my_server_id ? + params->nprocs / params->nservers + 1 : + params->nprocs / params->nservers; + /* setup the server library */ + (void)strncpy(info[0].key, PMIX_SOCKET_MODE, PMIX_MAX_KEYLEN); + info[0].value.type = PMIX_UINT32; + info[0].value.data.uint32 = 0666; + + server_nspace = PMIX_NEW(pmix_list_t); + + if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 1))) { + TEST_ERROR(("Init failed with error %d", rc)); + goto error; + } + + /* register test server read thread */ + if (params->nservers && pmix_list_get_size(server_list)) { + server_info_t *server; + PMIX_LIST_FOREACH(server, server_list, server_info_t) { + server->evread = event_new(pmix_globals.evbase, server->rd_fd, + EV_READ|EV_PERSIST, server_read_cb, server); + event_add(server->evread, NULL); + } + } + + /* register the errhandler */ + PMIx_Register_event_handler(NULL, 0, NULL, 0, + errhandler, errhandler_reg_callbk, NULL); + + if (0 != (rc = server_barrier())) { + goto error; + } + + return PMIX_SUCCESS; + +error: + PMIX_DESTRUCT(server_nspace); + return rc; +} + +int server_finalize(test_params *params) +{ + int rc = PMIX_SUCCESS; + int total_ret = 0; + + if (0 != (rc = server_barrier())) { + total_ret++; + goto exit; + } + + if (0 != my_server_id) { + server_info_t *server = (server_info_t*)pmix_list_get_first(server_list); + remove_server_item(server); + } + + if (params->nservers && 0 == my_server_id) { + int ret; + /* wait for all servers are finished */ + ret = srv_wait_all(10.0); + if (!pmix_list_is_empty(server_list)) { + total_ret += ret; + } + PMIX_LIST_RELEASE(server_list); + TEST_VERBOSE(("SERVER %d FINALIZE PID:%d with status %d", + my_server_id, getpid(), ret)); + if (0 == total_ret) { + TEST_OUTPUT(("Test finished OK!")); + } else { + rc = PMIX_ERROR; + } + } + PMIX_LIST_RELEASE(server_nspace); + + /* finalize the server library */ + if (PMIX_SUCCESS != (rc = PMIx_server_finalize())) { + TEST_ERROR(("Finalize failed with error %d", rc)); + total_ret += rc; + goto exit; + } + +exit: + return total_ret; +} + +int server_launch_clients(int local_size, int univ_size, int base_rank, + test_params *params, char *** client_env, char ***base_argv) +{ + int n; + uid_t myuid; + gid_t mygid; + char *ranks = NULL; + char digit[MAX_DIGIT_LEN]; + int rc; + static int cli_counter = 0; + static int num_ns = 0; + pmix_proc_t proc; + int rank_counter = 0; + server_nspace_t *nspace_item = PMIX_NEW(server_nspace_t); + + TEST_VERBOSE(("%d: lsize: %d, base rank %d, local_size %d, univ_size %d", + my_server_id, + params->lsize, + base_rank, + local_size, + univ_size)); + + TEST_VERBOSE(("Setting job info")); + fill_seq_ranks_array(local_size, base_rank, &ranks); + if (NULL == ranks) { + PMIx_server_finalize(); + TEST_ERROR(("fill_seq_ranks_array failed")); + return PMIX_ERROR; + } + (void)snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s-%d", TEST_NAMESPACE, num_ns); + set_namespace(local_size, univ_size, ranks, proc.nspace); + if (NULL != ranks) { + free(ranks); + } + /* add namespace entry */ + nspace_item->ntasks = univ_size; + nspace_item->ltasks = local_size; + nspace_item->task_map = (int*)malloc(sizeof(int) * univ_size); + memset(nspace_item->task_map, -1, sizeof(int)*univ_size); + strcpy(nspace_item->name, proc.nspace); + pmix_list_append(server_nspace, &nspace_item->super); + for (n = 0; n < local_size; n++) { + proc.rank = base_rank + n; + nspace_item->task_map[proc.rank] = my_server_id; + } + + server_send_procs(); + + myuid = getuid(); + mygid = getgid(); + + /* fork/exec the test */ + for (n = 0; n < local_size; n++) { + proc.rank = base_rank + rank_counter; + if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n + TEST_ERROR(("Server fork setup failed with error %d", rc)); + PMIx_server_finalize(); + cli_kill_all(); + return rc; + } + if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL))) {//n + TEST_ERROR(("Server fork setup failed with error %d", rc)); + PMIx_server_finalize(); + cli_kill_all(); + return 0; + } + + cli_info[cli_counter].pid = fork(); + if (cli_info[cli_counter].pid < 0) { + TEST_ERROR(("Fork failed")); + PMIx_server_finalize(); + cli_kill_all(); + return 0; + } + cli_info[cli_counter].rank = proc.rank;//n + cli_info[cli_counter].ns = strdup(proc.nspace); + + char **client_argv = pmix_argv_copy(*base_argv); + + /* add two last arguments: -r */ + sprintf(digit, "%d", proc.rank); + pmix_argv_append_nosize(&client_argv, "-r"); + pmix_argv_append_nosize(&client_argv, digit); + + pmix_argv_append_nosize(&client_argv, "-s"); + pmix_argv_append_nosize(&client_argv, proc.nspace); + + sprintf(digit, "%d", univ_size); + pmix_argv_append_nosize(&client_argv, "--ns-size"); + pmix_argv_append_nosize(&client_argv, digit); + + sprintf(digit, "%d", num_ns); + pmix_argv_append_nosize(&client_argv, "--ns-id"); + pmix_argv_append_nosize(&client_argv, digit); + + sprintf(digit, "%d", 0); + pmix_argv_append_nosize(&client_argv, "--base-rank"); + pmix_argv_append_nosize(&client_argv, digit); + + if (cli_info[cli_counter].pid == 0) { + if( !TEST_VERBOSE_GET() ){ + // Hide clients stdout + if (NULL == freopen("/dev/null","w", stdout)) { + return 0; + } + } + execve(params->binary, client_argv, *client_env); + /* Does not return */ + TEST_ERROR(("execve() failed")); + return 0; + } + cli_info[cli_counter].state = CLI_FORKED; + + pmix_argv_free(client_argv); + + cli_counter++; + rank_counter++; + } + num_ns++; + return rank_counter; +} diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.h b/opal/mca/pmix/pmix3x/pmix/test/test_server.h new file mode 100644 index 00000000000..09767ea56f4 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2018 Mellanox Technologies, Inc. + * All rights reserved. + * + * Copyright (c) 2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#ifndef TEST_SERVER_C +#define TEST_SERVER_C + +#include "pmix_server.h" +#include "test_common.h" + + +typedef enum { + CMD_BARRIER_REQUEST, + CMD_BARRIER_RESPONSE, + CMD_FENCE_CONTRIB, + CMD_FENCE_COMPLETE, + CMD_DMDX_REQUEST, + CMD_DMDX_RESPONSE +} server_cmd_t; + +typedef struct { + int dst_id; + int src_id; + int cmd; + size_t size; +} msg_hdr_t; + +struct server_info_t +{ + pmix_list_item_t super; + pid_t pid; + int idx; + int rd_fd; + int wr_fd; + pmix_event_t *evread; + pmix_lock_t lock; + pmix_modex_cbfunc_t modex_cbfunc; + void *cbdata; +}; +typedef struct server_info_t server_info_t; +PMIX_EXPORT PMIX_CLASS_DECLARATION(server_info_t); + +struct server_nspace_t +{ + pmix_list_item_t super; + char name[PMIX_MAX_NSLEN+1]; + size_t ntasks; /* total number of tasks in this namespace */ + size_t ltasks; /* local */ + int *task_map; +}; +typedef struct server_nspace_t server_nspace_t; +PMIX_EXPORT PMIX_CLASS_DECLARATION(server_nspace_t); + +extern int my_server_id; +extern pmix_list_t *server_list; +extern server_info_t *my_server_info; +extern pmix_list_t *server_nspace; + +int server_init(test_params *params); +int server_finalize(test_params *params); +int server_barrier(void); +int server_fence_contrib(char *data, size_t ndata, + pmix_modex_cbfunc_t cbfunc, void *cbdata); +int server_dmdx_get(const char *nspace, int rank, + pmix_modex_cbfunc_t cbfunc, void *cbdata); +int server_launch_clients(int local_size, int univ_size, int base_rank, + test_params *params, char *** client_env, char ***base_argv); + + +#endif // TEST_SERVER_C + diff --git a/opal/mca/pmix/pmix3x/pmix/test/utils.c b/opal/mca/pmix/pmix3x/pmix/test/utils.c index 5fb1a0e78b3..d6cd31b5415 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/utils.c +++ b/opal/mca/pmix/pmix3x/pmix/test/utils.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2017 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -16,83 +16,7 @@ #include "test_common.h" #include "pmix_server.h" #include "cli_stages.h" - -static void release_cb(pmix_status_t status, void *cbdata) -{ - int *ptr = (int*)cbdata; - *ptr = 0; -} - -static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) -{ - uint32_t i; - int len = 0, max_ranks_len; - if (0 >= nprocs) { - return; - } - max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); - *ranks = (char*) malloc(max_ranks_len); - for (i = 0; i < nprocs; i++) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); - if (i != nprocs-1) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); - } - } - if (len >= max_ranks_len-1) { - free(*ranks); - *ranks = NULL; - TEST_ERROR(("Not enough allocated space for global ranks array.")); - } -} - -static void set_namespace(int nprocs, char *ranks, char *name) -{ - size_t ninfo; - pmix_info_t *info; - ninfo = 8; - char *regex, *ppn; - - PMIX_INFO_CREATE(info, ninfo); - (void)strncpy(info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); - info[0].value.type = PMIX_UINT32; - info[0].value.data.uint32 = nprocs; - - (void)strncpy(info[1].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); - info[1].value.type = PMIX_UINT32; - info[1].value.data.uint32 = 0; - - (void)strncpy(info[2].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); - info[2].value.type = PMIX_UINT32; - info[2].value.data.uint32 = nprocs; - - (void)strncpy(info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); - info[3].value.type = PMIX_STRING; - info[3].value.data.string = strdup(ranks); - - PMIx_generate_regex(NODE_NAME, ®ex); - (void)strncpy(info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); - info[4].value.type = PMIX_STRING; - info[4].value.data.string = regex; - - PMIx_generate_ppn(ranks, &ppn); - (void)strncpy(info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); - info[5].value.type = PMIX_STRING; - info[5].value.data.string = ppn; - - (void)strncpy(info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); - info[6].value.type = PMIX_UINT32; - info[6].value.data.uint32 = nprocs; - - (void)strncpy(info[7].key, PMIX_APPNUM, PMIX_MAX_KEYLEN); - info[7].value.type = PMIX_UINT32; - info[7].value.data.uint32 = getpid (); - - int in_progress = 1, rc; - if (PMIX_SUCCESS == (rc = PMIx_server_register_nspace(name, nprocs, info, ninfo, release_cb, &in_progress))) { - PMIX_WAIT_FOR_COMPLETION(in_progress); - } - PMIX_INFO_FREE(info, ninfo); -} +#include "test_server.h" void set_client_argv(test_params *params, char ***argv) { @@ -170,100 +94,3 @@ void set_client_argv(test_params *params, char ***argv) pmix_argv_append_nosize(argv, params->gds_mode); } } - -int launch_clients(int num_procs, char *binary, char *** client_env, char ***base_argv) -{ - int n; - uid_t myuid; - gid_t mygid; - char *ranks = NULL; - char digit[MAX_DIGIT_LEN]; - int rc; - static int counter = 0; - static int num_ns = 0; - pmix_proc_t proc; - - TEST_VERBOSE(("Setting job info")); - fill_seq_ranks_array(num_procs, counter, &ranks); - if (NULL == ranks) { - PMIx_server_finalize(); - TEST_ERROR(("fill_seq_ranks_array failed")); - return PMIX_ERROR; - } - (void)snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s-%d", TEST_NAMESPACE, num_ns); - set_namespace(num_procs, ranks, proc.nspace); - if (NULL != ranks) { - free(ranks); - } - - myuid = getuid(); - mygid = getgid(); - - /* fork/exec the test */ - for (n = 0; n < num_procs; n++) { - proc.rank = counter; - if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n - TEST_ERROR(("Server fork setup failed with error %d", rc)); - PMIx_server_finalize(); - cli_kill_all(); - return rc; - } - if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL))) {//n - TEST_ERROR(("Server fork setup failed with error %d", rc)); - PMIx_server_finalize(); - cli_kill_all(); - return rc; - } - - cli_info[counter].pid = fork(); - if (cli_info[counter].pid < 0) { - TEST_ERROR(("Fork failed")); - PMIx_server_finalize(); - cli_kill_all(); - return -1; - } - cli_info[counter].rank = counter;//n - cli_info[counter].ns = strdup(proc.nspace); - - char **client_argv = pmix_argv_copy(*base_argv); - - /* add two last arguments: -r */ - sprintf(digit, "%d", counter);//n - pmix_argv_append_nosize(&client_argv, "-r"); - pmix_argv_append_nosize(&client_argv, digit); - - pmix_argv_append_nosize(&client_argv, "-s"); - pmix_argv_append_nosize(&client_argv, proc.nspace); - - sprintf(digit, "%d", num_procs); - pmix_argv_append_nosize(&client_argv, "--ns-size"); - pmix_argv_append_nosize(&client_argv, digit); - - sprintf(digit, "%d", num_ns); - pmix_argv_append_nosize(&client_argv, "--ns-id"); - pmix_argv_append_nosize(&client_argv, digit); - - sprintf(digit, "%d", (counter-n)); - pmix_argv_append_nosize(&client_argv, "--base-rank"); - pmix_argv_append_nosize(&client_argv, digit); - - if (cli_info[counter].pid == 0) { - if( !TEST_VERBOSE_GET() ){ - // Hide clients stdout - if (NULL == freopen("/dev/null","w", stdout)) { - exit(1); - } - } - execve(binary, client_argv, *client_env); - /* Does not return */ - exit(0); - } - cli_info[counter].state = CLI_FORKED; - - pmix_argv_free(client_argv); - - counter++; - } - num_ns++; - return PMIX_SUCCESS; -} diff --git a/opal/mca/pmix/pmix3x/pmix/test/utils.h b/opal/mca/pmix/pmix3x/pmix/test/utils.h index bbeebaa2f7a..d6856dd7a14 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/utils.h +++ b/opal/mca/pmix/pmix3x/pmix/test/utils.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Mellanox Technologies, Inc. + * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ * @@ -19,4 +19,3 @@ #include "test_common.h" void set_client_argv(test_params *params, char ***argv); -int launch_clients(int num_procs, char *binary, char *** client_env, char ***client_argv); From 3d8ddbc13642ef27f5ebfa6c53c5a44ccfd495c6 Mon Sep 17 00:00:00 2001 From: Jason Williams Date: Fri, 25 Jan 2019 09:27:33 -0500 Subject: [PATCH 229/674] Adding changes for issue #6303 for branch v4.0.x. Signed-off-by: Jason Williams (cherry picked from commit 98d81a5f7a619d5a19615297a6fe8a18d8e3781c) --- orte/mca/odls/alps/odls_alps_module.c | 12 +++++++++++- orte/mca/odls/default/odls_default_module.c | 12 +++++++++++- orte/mca/odls/pspawn/odls_pspawn.c | 10 +++++++++- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/orte/mca/odls/alps/odls_alps_module.c b/orte/mca/odls/alps/odls_alps_module.c index 8de9665c16a..8d25e798518 100644 --- a/orte/mca/odls/alps/odls_alps_module.c +++ b/orte/mca/odls/alps/odls_alps_module.c @@ -298,6 +298,15 @@ static int close_open_file_descriptors(int write_fd, return ORTE_ERR_FILE_OPEN_FAILURE; } struct dirent *files; + + /* grab the fd of the opendir above so we don't close in the + * middle of the scan. */ + int dir_scan_fd = dirfd(dir); + if(dir_scan_fd < 0 ) { + return ORTE_ERR_FILE_OPEN_FAILURE; + } + + while (NULL != (files = readdir(dir))) { if (!isdigit(files->d_name[0])) { continue; @@ -311,7 +320,8 @@ static int close_open_file_descriptors(int write_fd, #if OPAL_PMIX_V1 fd != opts.p_internal[1] && #endif - fd != write_fd) { + fd != write_fd && + fd != dir_scan_fd) { close(fd); } } diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index b9c6f665ce3..ab9d6e442f6 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -302,6 +302,15 @@ static int close_open_file_descriptors(int write_fd, return ORTE_ERR_FILE_OPEN_FAILURE; } struct dirent *files; + + /* grab the fd of the opendir above so we don't close in the + * middle of the scan. */ + int dir_scan_fd = dirfd(dir); + if(dir_scan_fd < 0 ) { + return ORTE_ERR_FILE_OPEN_FAILURE; + } + + while (NULL != (files = readdir(dir))) { if (!isdigit(files->d_name[0])) { continue; @@ -315,7 +324,8 @@ static int close_open_file_descriptors(int write_fd, #if OPAL_PMIX_V1 fd != opts.p_internal[1] && #endif - fd != write_fd) { + fd != write_fd && + fd != dir_scan_fd) { close(fd); } } diff --git a/orte/mca/odls/pspawn/odls_pspawn.c b/orte/mca/odls/pspawn/odls_pspawn.c index 537f1a70ea0..7909d210c6c 100644 --- a/orte/mca/odls/pspawn/odls_pspawn.c +++ b/orte/mca/odls/pspawn/odls_pspawn.c @@ -231,6 +231,14 @@ static int close_open_file_descriptors(posix_spawn_file_actions_t *factions) return ORTE_ERR_FILE_OPEN_FAILURE; } struct dirent *files; + + /* grab the fd of the opendir above so we don't close in the + * middle of the scan. */ + int dir_scan_fd = dirfd(dir); + if(dir_scan_fd < 0 ) { + return ORTE_ERR_FILE_OPEN_FAILURE; + } + while (NULL != (files = readdir(dir))) { if (!isdigit(files->d_name[0])) { continue; @@ -240,7 +248,7 @@ static int close_open_file_descriptors(posix_spawn_file_actions_t *factions) closedir(dir); return ORTE_ERR_TYPE_MISMATCH; } - if (fd >=3) { + if (fd >=3 && fd != dir_scan_fd) { posix_spawn_file_actions_addclose(factions, fd); } } From 18afb8e8a69a1a08d0c5b49fc98e00cf423bc5db Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 26 Sep 2018 10:00:09 -0700 Subject: [PATCH 230/674] Update mapping system Correctly transfer job-level mapping directives for dynamically spawned jobs to the mapping system. Signed-off-by: Ralph Castain (cherry picked from commit 45f23ca5c92633f3053569780bea5576eaa1f3a0) --- orte/mca/rmaps/base/base.h | 3 ++- orte/mca/rmaps/base/rmaps_base_frame.c | 17 +++++++++++++---- orte/orted/orted_submit.c | 2 +- orte/orted/pmix/pmix_server_dyn.c | 2 +- orte/orted/pmix/pmix_server_gen.c | 16 ++++++++-------- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/orte/mca/rmaps/base/base.h b/orte/mca/rmaps/base/base.h index b893581b13d..fa0915993e5 100644 --- a/orte/mca/rmaps/base/base.h +++ b/orte/mca/rmaps/base/base.h @@ -123,7 +123,8 @@ ORTE_DECLSPEC int orte_rmaps_base_filter_nodes(orte_app_context_t *app, opal_list_t *nodes, bool remove); -ORTE_DECLSPEC int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, +ORTE_DECLSPEC int orte_rmaps_base_set_mapping_policy(orte_job_t *jdata, + orte_mapping_policy_t *policy, char **device, char *spec); ORTE_DECLSPEC int orte_rmaps_base_set_ranking_policy(orte_ranking_policy_t *policy, orte_mapping_policy_t mapping, diff --git a/orte/mca/rmaps/base/rmaps_base_frame.c b/orte/mca/rmaps/base/rmaps_base_frame.c index 9300b338ddd..7f15e075bc9 100644 --- a/orte/mca/rmaps/base/rmaps_base_frame.c +++ b/orte/mca/rmaps/base/rmaps_base_frame.c @@ -296,7 +296,7 @@ static int orte_rmaps_base_open(mca_base_open_flag_t flags) "rmaps_base_cpus_per_proc", "rmaps_base_mapping_policy=:PE=N, default =NUMA"); } - if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(&orte_rmaps_base.mapping, + if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(NULL, &orte_rmaps_base.mapping, &orte_rmaps_base.device, rmaps_base_mapping_policy))) { return rc; @@ -593,7 +593,8 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp) return ORTE_ERR_TAKE_NEXT_OPTION; } -int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, +int orte_rmaps_base_set_mapping_policy(orte_job_t *jdata, + orte_mapping_policy_t *policy, char **device, char *inspec) { char *ck; @@ -681,7 +682,11 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, } } /* now save the pattern */ - orte_rmaps_base.ppr = strdup(ck); + if (NULL == jdata || NULL == jdata->map) { + orte_rmaps_base.ppr = strdup(ck); + } else { + jdata->map->ppr = strdup(ck); + } ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR); ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); free(spec); @@ -747,7 +752,11 @@ int orte_rmaps_base_set_mapping_policy(orte_mapping_policy_t *policy, } setpolicy: - *policy = tmp; + if (NULL == jdata || NULL == jdata->map) { + *policy = tmp; + } else { + jdata->map->mapping = tmp; + } return ORTE_SUCCESS; } diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index 92ba83988be..ccc089e51cb 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -876,7 +876,7 @@ int orte_submit_job(char *argv[], int *index, jdata->map = OBJ_NEW(orte_job_map_t); if (NULL != orte_cmd_options.mapping_policy) { - if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(&jdata->map->mapping, NULL, orte_cmd_options.mapping_policy))) { + if (ORTE_SUCCESS != (rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping, NULL, orte_cmd_options.mapping_policy))) { ORTE_ERROR_LOG(rc); return rc; } diff --git a/orte/orted/pmix/pmix_server_dyn.c b/orte/orted/pmix/pmix_server_dyn.c index 89b4303ba54..a2f18c4532c 100644 --- a/orte/orted/pmix/pmix_server_dyn.c +++ b/orte/orted/pmix/pmix_server_dyn.c @@ -308,7 +308,7 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor, orte_rmaps_base_print_mapping(orte_rmaps_base.mapping)); return ORTE_ERR_BAD_PARAM; } - rc = orte_rmaps_base_set_mapping_policy(&jdata->map->mapping, + rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping, NULL, info->data.string); if (ORTE_SUCCESS != rc) { return rc; diff --git a/orte/orted/pmix/pmix_server_gen.c b/orte/orted/pmix/pmix_server_gen.c index 25244c2a340..648d69557a7 100644 --- a/orte/orted/pmix/pmix_server_gen.c +++ b/orte/orted/pmix/pmix_server_gen.c @@ -489,7 +489,7 @@ static void _query(int sd, short args, void *cbdata) orte_job_t *jdata; orte_proc_t *proct; orte_app_context_t *app; - int rc, i, k, num_replies; + int rc = ORTE_SUCCESS, i, k, num_replies; opal_list_t *results, targets, *array; size_t n; uint32_t key; @@ -716,7 +716,7 @@ static void _query(int sd, short args, void *cbdata) } } if (ORTE_JOBID_INVALID == jobid) { - rc = ORTE_ERR_BAD_PARAM; + rc = ORTE_ERR_NOT_FOUND; goto done; } /* construct a list of values with opal_proc_info_t @@ -810,12 +810,12 @@ static void _query(int sd, short args, void *cbdata) } done: - if (0 == opal_list_get_size(results)) { - rc = ORTE_ERR_NOT_FOUND; - } else if (opal_list_get_size(results) < opal_list_get_size(cd->info)) { - rc = ORTE_ERR_PARTIAL_SUCCESS; - } else { - rc = ORTE_SUCCESS; + if (ORTE_SUCCESS == rc) { + if (0 == opal_list_get_size(results)) { + rc = ORTE_ERR_NOT_FOUND; + } else if (opal_list_get_size(results) < opal_list_get_size(cd->info)) { + rc = ORTE_ERR_PARTIAL_SUCCESS; + } } cd->infocbfunc(rc, results, cd->cbdata, qrel, results); } From dae71d3a75b540c625a2dc3f767e35d78418f544 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 2 Jan 2019 09:03:13 -0800 Subject: [PATCH 231/674] Correct parsing of ppr directives Needed to apply commit from PR #5778 to get this commit from PR #6238 to apply cleanly. Signed-off-by: Ralph Castain (cherry picked from commit b19e5edf769858859c96b62d9b2644b44bcc3b03) --- orte/mca/rmaps/base/rmaps_base_frame.c | 230 ++++++++++++------------- 1 file changed, 115 insertions(+), 115 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_frame.c b/orte/mca/rmaps/base/rmaps_base_frame.c index 7f15e075bc9..befb9fd5fe5 100644 --- a/orte/mca/rmaps/base/rmaps_base_frame.c +++ b/orte/mca/rmaps/base/rmaps_base_frame.c @@ -12,7 +12,7 @@ * Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -619,137 +619,137 @@ int orte_rmaps_base_set_mapping_policy(orte_job_t *jdata, if (NULL == inspec) { ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSOCKET); - } else { - spec = strdup(inspec); // protect the input string - /* see if a colon was included - if so, then we have a policy + modifier */ - ck = strchr(spec, ':'); - if (NULL != ck) { - /* if the colon is the first character of the string, then we - * just have modifiers on the default mapping policy */ - if (ck == spec) { - ck++; - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "%s rmaps:base only modifiers %s provided - assuming bysocket mapping", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ck); - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSOCKET); - if (ORTE_ERR_SILENT == (rc = check_modifiers(ck, &tmp)) && - ORTE_ERR_BAD_PARAM != rc) { - free(spec); - return ORTE_ERR_SILENT; - } + goto setpolicy; + } + + spec = strdup(inspec); // protect the input string + /* see if a colon was included - if so, then we have a policy + modifier */ + ck = strchr(spec, ':'); + if (NULL != ck) { + /* if the colon is the first character of the string, then we + * just have modifiers on the default mapping policy */ + if (ck == spec) { + ck++; // step over the colon + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "%s rmaps:base only modifiers %s provided - assuming bysocket mapping", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ck); + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSOCKET); + if (ORTE_ERR_SILENT == (rc = check_modifiers(ck, &tmp)) && + ORTE_ERR_BAD_PARAM != rc) { free(spec); - goto setpolicy; + return ORTE_ERR_SILENT; } - /* split the string */ - *ck = '\0'; - ck++; - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "%s rmaps:base policy %s modifiers %s provided", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), spec, ck); - /* if the policy is "dist", then we set the policy to that value - * and save the second argument as the device + free(spec); + goto setpolicy; + } + *ck = '\0'; // terminate spec where the colon was + ck++; // step past the colon + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "%s rmaps:base policy %s modifiers %s provided", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), spec, ck); + + if (0 == strncasecmp(spec, "ppr", strlen(spec))) { + /* at this point, ck points to a string that contains at least + * two fields (specifying the #procs/obj and the object we are + * to map by). we have to allow additional modifiers here - e.g., + * specifying #pe's/proc or oversubscribe - so check for modifiers. if + * they are present, ck will look like "N:obj:mod1,mod2,mod3" */ - if (0 == strncasecmp(spec, "ppr", strlen(spec))) { - /* we have to allow additional modifiers here - e.g., specifying - * #pe's/proc or oversubscribe - so check for modifiers + if (NULL == (ptr = strchr(ck, ':'))) { + /* this is an error - there had to be at least one + * colon to delimit the number from the object type */ - if (NULL == (ptr = strrchr(ck, ':'))) { - /* this is an error - there had to be at least one - * colon to delimit the number from the object type - */ - orte_show_help("help-orte-rmaps-base.txt", "invalid-pattern", true, inspec); + orte_show_help("help-orte-rmaps-base.txt", "invalid-pattern", true, inspec); + free(spec); + return ORTE_ERR_SILENT; + } + ptr++; // move past the colon + /* at this point, ptr is pointing to the beginning of the string that describes + * the object plus any modifiers (i.e., "obj:mod1,mod2". We first check to see if there + * is another colon indicating that there are modifiers to the request */ + if (NULL != (cptr = strchr(ptr, ':'))) { + /* there are modifiers, so we terminate the object string + * at the location of the colon */ + *cptr = '\0'; + /* step over that colon */ + cptr++; + /* now check for modifiers - may be none, so + * don't emit an error message if the modifier + * isn't recognized */ + if (ORTE_ERR_SILENT == (rc = check_modifiers(cptr, &tmp)) && + ORTE_ERR_BAD_PARAM != rc) { free(spec); return ORTE_ERR_SILENT; } - ptr++; // move past the colon - /* at this point, ck is pointing to the number of procs/object - * and ptr is pointing to the beginning of the string that describes - * the object plus any modifiers. We first check to see if there - * is a comma indicating that there are modifiers to the request */ - if (NULL != (cptr = strchr(ptr, ','))) { - /* there are modifiers, so we terminate the object string - * at the location of the first comma */ - *cptr = '\0'; - /* step over that comma */ - cptr++; - /* now check for modifiers - may be none, so - * don't emit an error message if the modifier - * isn't recognized */ - if (ORTE_ERR_SILENT == (rc = check_modifiers(cptr, &tmp)) && - ORTE_ERR_BAD_PARAM != rc) { - free(spec); - return ORTE_ERR_SILENT; - } - } - /* now save the pattern */ - if (NULL == jdata || NULL == jdata->map) { - orte_rmaps_base.ppr = strdup(ck); - } else { - jdata->map->ppr = strdup(ck); - } - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR); - ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); - free(spec); - goto setpolicy; } - if (ORTE_SUCCESS != (rc = check_modifiers(ck, &tmp)) && - ORTE_ERR_TAKE_NEXT_OPTION != rc) { - if (ORTE_ERR_BAD_PARAM == rc) { - orte_show_help("help-orte-rmaps-base.txt", "unrecognized-modifier", true, inspec); - } - free(spec); - return rc; + /* now save the pattern */ + if (NULL == jdata || NULL == jdata->map) { + orte_rmaps_base.ppr = strdup(ck); + } else { + jdata->map->ppr = strdup(ck); } + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_PPR); + ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); + free(spec); + goto setpolicy; } - len = strlen(spec); - if (0 == strncasecmp(spec, "slot", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSLOT); - } else if (0 == strncasecmp(spec, "node", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYNODE); - } else if (0 == strncasecmp(spec, "seq", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_SEQ); - } else if (0 == strncasecmp(spec, "core", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYCORE); - } else if (0 == strncasecmp(spec, "l1cache", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL1CACHE); - } else if (0 == strncasecmp(spec, "l2cache", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL2CACHE); - } else if (0 == strncasecmp(spec, "l3cache", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL3CACHE); - } else if (0 == strncasecmp(spec, "socket", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSOCKET); - } else if (0 == strncasecmp(spec, "numa", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYNUMA); - } else if (0 == strncasecmp(spec, "board", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYBOARD); - } else if (0 == strncasecmp(spec, "hwthread", len)) { - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYHWTHREAD); - /* if we are mapping processes to individual hwthreads, then - * we need to treat those hwthreads as separate cpus - */ - opal_hwloc_use_hwthreads_as_cpus = true; - } else if (0 == strncasecmp(spec, "dist", len)) { - if (NULL != rmaps_dist_device) { - if (NULL != (pch = strchr(rmaps_dist_device, ':'))) { - *pch = '\0'; - } - if (NULL != device) { - *device = strdup(rmaps_dist_device); - } - ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYDIST); - } else { - orte_show_help("help-orte-rmaps-base.txt", "device-not-specified", true); - free(spec); - return ORTE_ERR_SILENT; + if (ORTE_SUCCESS != (rc = check_modifiers(ck, &tmp)) && + ORTE_ERR_TAKE_NEXT_OPTION != rc) { + if (ORTE_ERR_BAD_PARAM == rc) { + orte_show_help("help-orte-rmaps-base.txt", "unrecognized-modifier", true, inspec); + } + free(spec); + return rc; + } + } + len = strlen(spec); + if (0 == strncasecmp(spec, "slot", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSLOT); + } else if (0 == strncasecmp(spec, "node", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYNODE); + } else if (0 == strncasecmp(spec, "seq", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_SEQ); + } else if (0 == strncasecmp(spec, "core", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYCORE); + } else if (0 == strncasecmp(spec, "l1cache", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL1CACHE); + } else if (0 == strncasecmp(spec, "l2cache", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL2CACHE); + } else if (0 == strncasecmp(spec, "l3cache", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYL3CACHE); + } else if (0 == strncasecmp(spec, "socket", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYSOCKET); + } else if (0 == strncasecmp(spec, "numa", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYNUMA); + } else if (0 == strncasecmp(spec, "board", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYBOARD); + } else if (0 == strncasecmp(spec, "hwthread", len)) { + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYHWTHREAD); + /* if we are mapping processes to individual hwthreads, then + * we need to treat those hwthreads as separate cpus + */ + opal_hwloc_use_hwthreads_as_cpus = true; + } else if (0 == strncasecmp(spec, "dist", len)) { + if (NULL != rmaps_dist_device) { + if (NULL != (pch = strchr(rmaps_dist_device, ':'))) { + *pch = '\0'; + } + if (NULL != device) { + *device = strdup(rmaps_dist_device); } + ORTE_SET_MAPPING_POLICY(tmp, ORTE_MAPPING_BYDIST); } else { - orte_show_help("help-orte-rmaps-base.txt", "unrecognized-policy", true, "mapping", spec); + orte_show_help("help-orte-rmaps-base.txt", "device-not-specified", true); free(spec); return ORTE_ERR_SILENT; } + } else { + orte_show_help("help-orte-rmaps-base.txt", "unrecognized-policy", true, "mapping", spec); free(spec); - ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); + return ORTE_ERR_SILENT; } + free(spec); + ORTE_SET_MAPPING_DIRECTIVE(tmp, ORTE_MAPPING_GIVEN); setpolicy: if (NULL == jdata || NULL == jdata->map) { From f76c81a758102c637925aa6d5180ab59e966809c Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 29 Jan 2019 09:30:53 +0900 Subject: [PATCH 232/674] ompi/op: fix support of non predefined datatypes with predefined operators ACCUMULATE, unlike REDUCE, can use with derived datatypes with predefinied operations, with some restrictions outlined in MPI-3:11.3.4. The derived datatype must be composed entierly from one predefined datatype (so you can do all the construction you want, but at the bottom, you can only use one datatype, say, MPI_INT). Refs. open-mpi/ompi#6275 Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@bc1cab549883f199d54b302f44da18e430234eeb) --- ompi/op/op.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ompi/op/op.h b/ompi/op/op.h index aa52688cb27..7e1fe3399c8 100644 --- a/ompi/op/op.h +++ b/ompi/op/op.h @@ -15,6 +15,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -569,9 +571,16 @@ static inline void ompi_op_reduce(ompi_op_t * op, void *source, /* For intrinsics, we also pass the corresponding op module */ if (0 != (op->o_flags & OMPI_OP_FLAGS_INTRINSIC)) { - op->o_func.intrinsic.fns[ompi_op_ddt_map[dtype->id]](source, target, - &count, &dtype, - op->o_func.intrinsic.modules[ompi_op_ddt_map[dtype->id]]); + int dtype_id; + if (!ompi_datatype_is_predefined(dtype)) { + ompi_datatype_t *dt = ompi_datatype_get_single_predefined_type_from_args(dtype); + dtype_id = ompi_op_ddt_map[dt->id]; + } else { + dtype_id = ompi_op_ddt_map[dtype->id]; + } + op->o_func.intrinsic.fns[dtype_id](source, target, + &count, &dtype, + op->o_func.intrinsic.modules[dtype_id]); return; } From fd157a960a6be83ac58b024234fa610e56be9544 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 28 Jan 2019 15:24:55 +0900 Subject: [PATCH 233/674] ompi/datatype: fix how we compute the space needed for the args Refs. open-mpi/ompi#6275 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@45fb69b2b9e5e06f0ff4f7c97e33110265fc54dc) --- ompi/datatype/ompi_datatype_args.c | 6 ++-- test/datatype/ddt_pack.c | 49 +++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/ompi/datatype/ompi_datatype_args.c b/ompi/datatype/ompi_datatype_args.c index 737d3e51827..cc50bc968e1 100644 --- a/ompi/datatype/ompi_datatype_args.c +++ b/ompi/datatype/ompi_datatype_args.c @@ -13,8 +13,8 @@ * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2017 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -237,6 +237,8 @@ int32_t ompi_datatype_set_args( ompi_datatype_t* pData, */ OBJ_RETAIN( d[pos] ); pArgs->total_pack_size += ((ompi_datatype_args_t*)d[pos]->args)->total_pack_size; + } else { + pArgs->total_pack_size += sizeof(int); /* _NAMED */ } pArgs->total_pack_size += sizeof(int); /* each data has an ID */ } diff --git a/test/datatype/ddt_pack.c b/test/datatype/ddt_pack.c index 1164e6feca8..423574efebd 100644 --- a/test/datatype/ddt_pack.c +++ b/test/datatype/ddt_pack.c @@ -51,7 +51,7 @@ main(int argc, char* argv[]) int ret = 0; int blen[4]; ptrdiff_t disp[4]; - ompi_datatype_t *newType, *types[4], *struct_type, *vec_type; + ompi_datatype_t *newType, *types[4], *struct_type, *vec_type, *dup_type; ptrdiff_t old_lb, old_extent, old_true_lb, old_true_extent; ptrdiff_t lb, extent, true_lb, true_extent; @@ -394,6 +394,53 @@ main(int argc, char* argv[]) ret = ompi_datatype_destroy(&unpacked_dt); if (ret != 0) goto cleanup; + /** + * + * TEST 7 + * + */ + printf("---> Basic test with dup'ed MPI_INT\n"); + + ret = get_extents(&ompi_mpi_int.dt, &old_lb, &old_extent, &old_true_lb, &old_true_extent); + if (ret != 0) goto cleanup; + ret = ompi_datatype_duplicate(&ompi_mpi_int.dt, &dup_type); + if (ret != 0) goto cleanup; + ompi_datatype_t * type = &ompi_mpi_int.dt; + ret = ompi_datatype_set_args(dup_type, 0, NULL, 0, NULL, 1, &type, MPI_COMBINER_DUP); + if (ret != 0) goto cleanup; + packed_ddt_len = ompi_datatype_pack_description_length(dup_type); + ptr = payload = malloc(packed_ddt_len); + ret = ompi_datatype_get_pack_description(dup_type, &packed_ddt); + if (ret != 0) goto cleanup; + + memcpy(payload, packed_ddt, packed_ddt_len); + unpacked_dt = ompi_datatype_create_from_packed_description(&payload, + ompi_proc_local()); + free(ptr); + if (unpacked_dt == NULL) { + printf("\tFAILED: could not unpack datatype\n"); + ret = 1; + goto cleanup; + } else { + ret = get_extents(unpacked_dt, &lb, &extent, &true_lb, &true_extent); + if (ret != 0) goto cleanup; + + if (old_lb != lb || old_extent != extent || + old_true_lb != true_lb || old_true_extent != extent) { + printf("\tFAILED: datatypes don't match\n"); + ret = 1; + goto cleanup; + } + printf("\tPASSED\n"); + } + if (unpacked_dt == &ompi_mpi_int32_t.dt) { + printf("\tPASSED\n"); + } else { + printf("\tFAILED: datatypes don't match\n"); + ret = 1; + goto cleanup; + } + ompi_datatype_destroy(&dup_type); cleanup: ompi_datatype_finalize(); From 788c92b1ce11ed93c9a79542456be7b2330fcf5d Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 29 Jan 2019 07:36:01 -0800 Subject: [PATCH 234/674] hwloc/external.h: fix a clash with external HWLOC_VERSION[*] Some macros defined by the embedded hwloc ends up in opal_config.h because hwloc configury m4 files are slurped into Open MPI. These macros are not required here, and they might conflict with an external hwloc install, so simply #undef them in hwloc/external/external.h after including but before including the external . Signed-off-by: Gilles Gouaillardet Signed-off-by: Jeff Squyres (cherry picked from commit f22b7d4f46b03554add3ff2254d1c893359aff84) --- opal/mca/hwloc/external/external.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/external/external.h b/opal/mca/hwloc/external/external.h index 1428459755e..8a1a32068ba 100644 --- a/opal/mca/hwloc/external/external.h +++ b/opal/mca/hwloc/external/external.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2016 Research Organization for Information Science + * Copyright (c) 2011-2019 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2016-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. @@ -21,6 +21,23 @@ BEGIN_C_DECLS #include + +/* Top-level configure will always configure the embedded hwloc + * component, even if we already know that we'll be using an external + * hwloc (because of complicated reasons). A side-effect of this is + * that the embedded hwloc will AC_DEFINE HWLOC_VERSION (and friends) + * in opal_config.h. If the external hwloc defines a different value + * of HWLOC_VERSION (etc.), we'll get zillions of warnings about the + * two HWLOC_VERSION values not matching. Hence, we undefined all of + * them here (so that the external can define them to + * whatever it wants). */ + +#undef HWLOC_VERSION +#undef HWLOC_VERSION_MAJOR +#undef HWLOC_VERSION_MINOR +#undef HWLOC_VERSION_RELEASE +#undef HWLOC_VERSION_GREEK + #include MCA_hwloc_external_header /* If the including file requested it, also include the hwloc verbs From f79f14ad93da4e4348ec6ab41d54f3c35c96f3c5 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 29 Jan 2019 07:36:15 -0800 Subject: [PATCH 235/674] hwloc/base: fix some off-by-one errors Signed-off-by: Gilles Gouaillardet (cherry picked from commit 73d104f6959c95f676a779826f511826e0b17f6a) --- opal/mca/hwloc/base/hwloc_base_dt.c | 2 +- opal/mca/hwloc/base/hwloc_base_util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_dt.c b/opal/mca/hwloc/base/hwloc_base_dt.c index 0840ee13f11..c0e24d44de3 100644 --- a/opal/mca/hwloc/base/hwloc_base_dt.c +++ b/opal/mca/hwloc/base/hwloc_base_dt.c @@ -96,7 +96,7 @@ int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest, free(xmlbuffer); goto cleanup; } - if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer))) { + if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer)+1)) { rc = OPAL_ERROR; free(xmlbuffer); hwloc_topology_destroy(t); diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 287c4cb50a7..f606f4d08f1 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -364,7 +364,7 @@ int opal_hwloc_base_get_topology(void) free(val); return OPAL_ERROR; } - if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val))) { + if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val)+1)) { free(val); hwloc_topology_destroy(opal_hwloc_topology); return OPAL_ERROR; From c85fd35f27349ed78c32f109bb8f8d7f713b1d1f Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Dec 2018 14:18:02 +0900 Subject: [PATCH 236/674] opal: remove unnecessary #include file opal_config_bottom.h can only be #include'd in opal_config.h, so there is no need to #include "opal_config.h" inside. Signed-off-by: Gilles Gouaillardet (cherry picked from commit c8790d29de5ef399fd805f27366af6c2dc87ce9e) --- opal/include/opal_config_bottom.h | 1 - 1 file changed, 1 deletion(-) diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index 58823471774..da4086df01f 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -260,7 +260,6 @@ including stdint.h */ #define __STDC_LIMIT_MACROS #endif -#include "opal_config.h" #include "opal_stdint.h" /*********************************************************************** From a24729227524a98ff190d0546b81adf9f869509d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 30 Jan 2019 13:31:44 +0900 Subject: [PATCH 237/674] topo/treematch: silence a hwloc related warning treematch/km_partitioning.c #include "config.h", but there is no such file when the embedded treematch is used. In order to prevent the embedded treematch from incorrectly using the config.h from the embedded hwloc, generate a dummy config.h. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 0aeb27f77650d3ee97e17e770c9e5aa487d5e1f5) --- ompi/mca/topo/treematch/Makefile.am | 4 ++++ ompi/mca/topo/treematch/configure.m4 | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ompi/mca/topo/treematch/Makefile.am b/ompi/mca/topo/treematch/Makefile.am index 27d07bc64fe..79cda832658 100644 --- a/ompi/mca/topo/treematch/Makefile.am +++ b/ompi/mca/topo/treematch/Makefile.am @@ -5,6 +5,8 @@ # Copyright (c) 2011-2015 INRIA. All rights reserved. # Copyright (c) 2011-2015 Université Bordeaux 1 # Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -67,3 +69,5 @@ noinst_LTLIBRARIES = $(lib) libmca_topo_treematch_la_SOURCES = $(lib_sources) libmca_topo_treematch_la_LDFLAGS = -module -avoid-version +distclean-local: + rm -f config.h diff --git a/ompi/mca/topo/treematch/configure.m4 b/ompi/mca/topo/treematch/configure.m4 index c937df36114..81a5ad56e4e 100644 --- a/ompi/mca/topo/treematch/configure.m4 +++ b/ompi/mca/topo/treematch/configure.m4 @@ -6,7 +6,9 @@ # Copyright (c) 2011-2015 INRIA. All rights reserved. # Copyright (c) 2011-2015 Universite Bordeaux 1 # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -77,7 +79,21 @@ AC_DEFUN([MCA_ompi_topo_treematch_CONFIG], [ [ompi_topo_treematch_happy=1])])]) AS_IF([test $ompi_topo_treematch_happy -eq 1], - [$1], + [AS_IF([test "x$treematch_files_local" = "xyes"], + [AS_IF([! test -d $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch], + [mkdir -p $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch]) + cat > $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch/config.h << EOF +/* + * This file is automatically generated by configure. Edits will be lost + * + * This is an dummy config.h in order to prevent the embedded treematch from using + * the config.h from the embedded hwloc + * + * see https://github.com/open-mpi/ompi/pull/6185#issuecomment-458807930 + */ +EOF + ]) + $1], [AS_IF([test ! -z "$with_treematch" && test "$with_treematch" != "no"], [AC_MSG_ERROR([TreeMatch support requested but not found. Aborting])]) $2]) From d1e8779fe3b9d1325ccee3b12d31d5c84d1a0797 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 17 Jan 2019 11:09:41 -0600 Subject: [PATCH 238/674] common/ompio: fix a floating point division problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes a problem reported on the mailing list with individual writes larger than 512 MB. The culprit is a floating point division of two large, close values. Changing the datatypes from float to double (which is what is being used in the fcoll components) fixes the problem. See issue #6285 and https://forum.hdfgroup.org/t/cannot-write-more-than-512-mb-in-1d/5118 Thanks for Axel Huebl and René Widera for reporting the issue. Signed-off-by: Edgar Gabriel (cherry picked from commit c0f8ce0fff4684b670135043dd150abc9d83d988) --- ompi/mca/common/ompio/common_ompio_file_read.c | 8 ++++---- ompi/mca/common/ompio/common_ompio_file_write.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c index 3203e2a697f..452683605a8 100644 --- a/ompi/mca/common/ompio/common_ompio_file_read.c +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2018 University of Houston. All rights reserved. + * Copyright (c) 2008-2019 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -33,8 +33,8 @@ #include "common_ompio.h" #include "common_ompio_request.h" -#include "math.h" #include +#include #if OPAL_CUDA_SUPPORT #include "common_ompio_cuda.h" @@ -132,8 +132,8 @@ int mca_common_ompio_file_read (ompio_file_t *fh, else { bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size); } - cycles = ceil((float)max_data/bytes_per_cycle); - + cycles = ceil((double)max_data/bytes_per_cycle); + #if 0 printf ("Bytes per Cycle: %d Cycles: %d max_data:%d \n",bytes_per_cycle, cycles, max_data); #endif diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index e53a1d080b0..adb9c844d7c 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2018 University of Houston. All rights reserved. + * Copyright (c) 2008-2019 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -31,8 +31,8 @@ #include "common_ompio.h" #include "common_ompio_request.h" -#include "math.h" #include +#include #if OPAL_CUDA_SUPPORT #include "common_ompio_cuda.h" @@ -116,7 +116,7 @@ int mca_common_ompio_file_write (ompio_file_t *fh, else { bytes_per_cycle = OMPIO_MCA_GET(fh, cycle_buffer_size); } - cycles = ceil((float)max_data/bytes_per_cycle); + cycles = ceil((double)max_data/bytes_per_cycle); #if 0 printf ("Bytes per Cycle: %d Cycles: %d\n", bytes_per_cycle, cycles); @@ -409,7 +409,7 @@ int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp, /**************************************************************/ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles, - size_t bytes_per_cycle, int max_data, uint32_t iov_count, + size_t bytes_per_cycle, int max_data, uint32_t iov_count, struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw, size_t *spc) { From e30e5b95c628a762ac1488cf31e3b98b26fd0dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Fri, 18 Jan 2019 13:55:51 +0100 Subject: [PATCH 239/674] common/ompio: possible rounding issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Similar to #6286 rounding number of bytes into a single precision floating point value to round up the result of a division is a potential risk due to rounding errors. - remove floating point operations for `round up` - removes floating point conversion for round down (native behavior of integer division) Signed-off-by: René Widera (cherry picked from commit a91fab80a1e55e1df15f649e18d247e5d4654eb9) --- ompi/mca/common/ompio/common_ompio_aggregators.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_aggregators.c b/ompi/mca/common/ompio/common_ompio_aggregators.c index aa751cd4a1d..b1da09d77b5 100644 --- a/ompi/mca/common/ompio/common_ompio_aggregators.c +++ b/ompi/mca/common/ompio/common_ompio_aggregators.c @@ -896,11 +896,14 @@ int mca_common_ompio_split_initial_groups(ompio_file_t *fh, int size_smallest_group = 0; int num_groups = 0; int ret = OMPI_SUCCESS; + OMPI_MPI_COUNT_TYPE bytes_per_agg_group = 0; OMPI_MPI_OFFSET_TYPE max_cci = 0; OMPI_MPI_OFFSET_TYPE min_cci = 0; - size_new_group = ceil ((float)OMPIO_MCA_GET(fh, bytes_per_agg) * fh->f_init_procs_per_group/ bytes_per_group); + bytes_per_agg_group = (OMPI_MPI_COUNT_TYPE)OMPIO_MCA_GET(fh, bytes_per_agg); + // integer round up + size_new_group = (int)(bytes_per_agg_group / bytes_per_group + (bytes_per_agg_group % bytes_per_group ? 1u : 0u)); size_old_group = fh->f_init_procs_per_group; ret = mca_common_ompio_split_a_group(fh, @@ -948,7 +951,7 @@ int mca_common_ompio_split_initial_groups(ompio_file_t *fh, if((max_cci < OMPIO_CONTG_THRESHOLD) && (size_new_group < size_old_group)){ - size_new_group = floor( (float) (size_new_group + size_old_group ) / 2 ); + size_new_group = (size_new_group + size_old_group ) / 2; ret = mca_common_ompio_split_a_group(fh, start_offsets_lens, end_offsets, @@ -976,7 +979,9 @@ int mca_common_ompio_split_initial_groups(ompio_file_t *fh, (size_new_group < size_old_group)){ //can be a better condition //monitor the previous iteration //break if it has not changed. - size_new_group = ceil( (float) (size_new_group + size_old_group ) / 2 ); + size_new_group = size_new_group + size_old_group; + // integer round up + size_new_group = size_new_group / 2 + (size_new_group % 2 ? 1 : 0); ret = mca_common_ompio_split_a_group(fh, start_offsets_lens, end_offsets, From 90a9c12fdbff270c9d1f375da2075d5fd9ba6ab1 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 22 Jan 2019 10:57:57 +0900 Subject: [PATCH 240/674] opal/datatype: plug a memory leak in opal_datatype_t destructor correctly free ptypes if the datatype is not pre-defined. Thanks Axel Huebl for reporting this. Refs. open-mpi/ompi#6291 Signed-off-by: Gilles Gouaillardet (cherry picked from commit 7c938f070fa8c906918507dbc78fdadcde324610) --- opal/datatype/opal_datatype_create.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/datatype/opal_datatype_create.c b/opal/datatype/opal_datatype_create.c index 0e6d49b9bd7..122521989b8 100644 --- a/opal/datatype/opal_datatype_create.c +++ b/opal/datatype/opal_datatype_create.c @@ -11,6 +11,8 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,7 +79,7 @@ static void opal_datatype_destruct( opal_datatype_t* datatype ) } } /* dont free the ptypes of predefined types (it was not dynamically allocated) */ - if( (NULL != datatype->ptypes) && (datatype->id >= OPAL_DATATYPE_MAX_PREDEFINED) ) { + if( (NULL != datatype->ptypes) && (!opal_datatype_is_predefined(datatype)) ) { free(datatype->ptypes); datatype->ptypes = NULL; } From c39426ec91e07aaa9b57d575c9e53a75ed1eab04 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 30 Jan 2019 04:49:17 -0800 Subject: [PATCH 241/674] mpi.h.in: use C++ static_cast<> where appropriate When compiling mpi.h with a modern C++ compiler and a high degree of pickyness (e.g., -Wold-style-cast), casting using (void*) in the OMPI_PREDEFINED_GLOBAL and MPI_STATUS*_IGNORE macros will emit warnings. So if we're compiling with a C++ compiler, use C++'s static_cast<> instead of (void*). Thanks to @shadow-fax for identifying the issue. Signed-off-by: Jeff Squyres (cherry picked from commit 30afdcead915c9c5a62305b93460e2ba8cc6f801) --- ompi/include/mpi.h.in | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 4168e6fcb79..49167493feb 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2007-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. @@ -325,7 +325,11 @@ * when building OMPI). */ #if !OMPI_BUILDING +#if defined(c_plusplus) || defined(__cplusplus) +#define OMPI_PREDEFINED_GLOBAL(type, global) (static_cast (static_cast (&(global)))) +#else #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) ((void *) &(global))) +#endif #else #define OMPI_PREDEFINED_GLOBAL(type, global) ((type) &(global)) #endif @@ -765,8 +769,13 @@ enum { */ #define MPI_INFO_ENV OMPI_PREDEFINED_GLOBAL(MPI_Info, ompi_mpi_info_env) +#if defined(c_plusplus) || defined(__cplusplus) +#define MPI_STATUS_IGNORE (static_cast (0)) +#define MPI_STATUSES_IGNORE (static_cast (0)) +#else #define MPI_STATUS_IGNORE ((MPI_Status *) 0) #define MPI_STATUSES_IGNORE ((MPI_Status *) 0) +#endif /* * Special MPI_T handles From f7327735a0ca87ae9f96945f0152feb20d035da5 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 23 Jan 2019 14:52:21 +0900 Subject: [PATCH 242/674] opal/datatype: fix opal_convertor_raw correctly handle the case in which iovec is full and the last accessed element of the datatype is the beginning of a loop Refs. open-mpi/ompi#6285 Thanks Axel Huebl for reporting this Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@0832ab5acc2419e670b44ff3857c8c3d21c78e09) --- opal/datatype/opal_convertor_raw.c | 21 +- test/datatype/Makefile.am | 12 +- test/datatype/ddt_raw2.c | 329 +++++++++++++++++++++++++++++ 3 files changed, 353 insertions(+), 9 deletions(-) create mode 100644 test/datatype/ddt_raw2.c diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 09019388127..777fbc74eeb 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -5,8 +5,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -170,9 +170,18 @@ opal_convertor_raw( opal_convertor_t* pConvertor, ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items); if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - uint32_t i; - source_base += end_loop->first_elem_disp; - for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { + ptrdiff_t offset = end_loop->first_elem_disp; + source_base += offset; + for(uint32_t i = count_desc; i > 0; i--, index++ ) { + if (index >= *iov_count) { + dt_elem_desc_t* nElem = pElem + 1; + while (nElem->elem.common.type == OPAL_DATATYPE_LOOP) { + nElem++; + } + assert(OPAL_DATATYPE_END_LOOP != nElem->elem.common.type); + offset = nElem->elem.disp; + break; + } OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; @@ -181,7 +190,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, raw_data += end_loop->size; count_desc--; } - source_base -= end_loop->first_elem_disp; + source_base -= offset; if( 0 == count_desc ) { /* completed */ pos_desc += pElem->loop.items + 1; goto update_loop_description; diff --git a/test/datatype/Makefile.am b/test/datatype/Makefile.am index cd867134a4f..8efd0344ecc 100644 --- a/test/datatype/Makefile.am +++ b/test/datatype/Makefile.am @@ -4,8 +4,8 @@ # reserved. # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -# Copyright (c) 2014-2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2014-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -15,7 +15,7 @@ # if PROJECT_OMPI - MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw unpack_ooo ddt_pack external32 + MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32 MPI_CHECKS = to_self endif TESTS = opal_datatype_test unpack_hetero $(MPI_TESTS) @@ -40,6 +40,12 @@ ddt_raw_LDADD = \ $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la +ddt_raw2_SOURCES = ddt_raw2.c ddt_lib.c ddt_lib.h +ddt_raw2_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) +ddt_raw2_LDADD = \ + $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la + ddt_pack_SOURCES = ddt_pack.c ddt_pack_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) ddt_pack_LDADD = \ diff --git a/test/datatype/ddt_raw2.c b/test/datatype/ddt_raw2.c new file mode 100644 index 00000000000..1c132b4d55b --- /dev/null +++ b/test/datatype/ddt_raw2.c @@ -0,0 +1,329 @@ +#include "ompi_config.h" +#include "ddt_lib.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" +#include "opal/runtime/opal.h" + +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include + + +int mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, + int count, + struct iovec **iov, + uint32_t *iovec_count, + int increment) +{ + + + + opal_convertor_t *convertor; + size_t remaining_length = 0; + uint32_t i; + uint32_t temp_count; + struct iovec *temp_iov=NULL; + size_t temp_data; + + + convertor = opal_convertor_create( opal_local_arch, 0 ); + + if (OMPI_SUCCESS != opal_convertor_prepare_for_send (convertor, + &(datatype->super), + count, + NULL)) { + opal_output (1, "Cannot attach the datatype to a convertor\n"); + return OMPI_ERROR; + } + + if ( 0 == datatype->super.size ) { + *iovec_count = 0; + *iov = NULL; + return OMPI_SUCCESS; + } + + remaining_length = count * datatype->super.size; + + temp_count = increment; + temp_iov = (struct iovec*)malloc(temp_count * sizeof(struct iovec)); + if (NULL == temp_iov) { + opal_output (1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + + while (0 == opal_convertor_raw(convertor, + temp_iov, + &temp_count, + &temp_data)) { + *iovec_count = *iovec_count + temp_count; + *iov = (struct iovec *) realloc (*iov, *iovec_count * sizeof(struct iovec)); + if (NULL == *iov) { + opal_output(1, "OUT OF MEMORY\n"); + free(temp_iov); + return OMPI_ERR_OUT_OF_RESOURCE; + } + for (i=0 ; i 0 ) { + *iov = (struct iovec *) realloc (*iov, *iovec_count * sizeof(struct iovec)); + if (NULL == *iov) { + opal_output(1, "OUT OF MEMORY\n"); + free(temp_iov); + return OMPI_ERR_OUT_OF_RESOURCE; + } + } + for (i=0 ; isuper.flags = 3332; + datatype->super.id = 0; + datatype->super.bdt_used = 512; + datatype->super.size = 31684; + datatype->super.true_lb = 4; + datatype->super.true_ub = 218288; + datatype->super.lb = 0; + datatype->super.ub = 218344; + datatype->super.nbElems = 31684; + datatype->super.align = 1; + datatype->super.loops = 1146; + datatype->super.desc.length = 3351; + datatype->super.desc.used = 184; + datatype->super.desc.desc = descs; + datatype->super.opt_desc.length = 3351; + datatype->super.opt_desc.used = 184; + datatype->super.opt_desc.desc = descs; + + uint32_t iovec_count = 0; + struct iovec * iov = NULL; + mca_common_ompio_decode_datatype ( datatype, 1, &iov, &iovec_count, 300); + uint32_t iovec_count2 = 0; + struct iovec * iov2 = NULL; + mca_common_ompio_decode_datatype ( datatype, 1, &iov2, &iovec_count2, 100); + + assert(iovec_count == iovec_count2); + // assert(iov[100].iov_base == iov2[100].iov_base); + // assert(iov[100].iov_len == iov2[100].iov_len); + for (int i=0; i Date: Tue, 29 Jan 2019 19:44:05 -0500 Subject: [PATCH 243/674] Provide a better fix for #6285. The issue was a little complicated due to the internal stack used in the convertor. The main issue was that in the case where we run out of iov space to save the raw description of the data while hanbdling a repetition (loop), instead of saving the current position and bailing out directly we reading of the next predefined type element. It worked in most cases, except the one identified by the HDF5 test. However, the biggest issue here was the drop in performance for all ensuing calls to the convertor pack/unpack, as instead of handling contiguous loops as a whole (and minimizing the number of memory copies) we copied data description by data description. Signed-off-by: George Bosilca (back-ported from commit open-mpi/ompi@5a82c4fd0769ed007de774ef9115bde73b75de32) --- opal/datatype/opal_convertor_raw.c | 22 +++++------ test/datatype/ddt_raw2.c | 60 ++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 777fbc74eeb..fa7f1adf0c7 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -102,7 +102,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, /* now here we have a basic datatype */ OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); - DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %lu}\n", + DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n", index, (void*)source_base, (unsigned long)blength ); ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = blength; @@ -115,7 +115,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); - DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %lu}\n", + DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", index, (void*)source_base, (unsigned long)blength ); ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = blength; @@ -172,16 +172,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { ptrdiff_t offset = end_loop->first_elem_disp; source_base += offset; - for(uint32_t i = count_desc; i > 0; i--, index++ ) { - if (index >= *iov_count) { - dt_elem_desc_t* nElem = pElem + 1; - while (nElem->elem.common.type == OPAL_DATATYPE_LOOP) { - nElem++; - } - assert(OPAL_DATATYPE_END_LOOP != nElem->elem.common.type); - offset = nElem->elem.disp; - break; - } + for(uint32_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; @@ -189,6 +180,10 @@ opal_convertor_raw( opal_convertor_t* pConvertor, source_base += pElem->loop.extent; raw_data += end_loop->size; count_desc--; + DO_DEBUG( opal_output( 0, "raw contig loop generate iov[%d] = {base %p, length %" PRIsize_t "}" + "space %lu [pos_desc %d]\n", + index, iov[index].iov_base, iov[index].iov_len, + (unsigned long)raw_data, pos_desc ); ); } source_base -= offset; if( 0 == count_desc ) { /* completed */ @@ -196,6 +191,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, goto update_loop_description; } } + if( index == *iov_count ) { /* all iov have been filled, we need to bail out */ + goto complete_loop; + } local_disp = (ptrdiff_t)source_base - local_disp; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); diff --git a/test/datatype/ddt_raw2.c b/test/datatype/ddt_raw2.c index 1c132b4d55b..cc78e23006a 100644 --- a/test/datatype/ddt_raw2.c +++ b/test/datatype/ddt_raw2.c @@ -1,3 +1,17 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + #include "ompi_config.h" #include "ddt_lib.h" #include "opal/datatype/opal_convertor.h" @@ -12,11 +26,12 @@ #include -int mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, - int count, - struct iovec **iov, - uint32_t *iovec_count, - int increment) +static int +mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, + int count, + struct iovec **iov, + uint32_t *iovec_count, + int increment) { @@ -310,20 +325,35 @@ int main (int argc, char *argv[]) { datatype->super.opt_desc.used = 184; datatype->super.opt_desc.desc = descs; - uint32_t iovec_count = 0; - struct iovec * iov = NULL; - mca_common_ompio_decode_datatype ( datatype, 1, &iov, &iovec_count, 300); - uint32_t iovec_count2 = 0; - struct iovec * iov2 = NULL; - mca_common_ompio_decode_datatype ( datatype, 1, &iov2, &iovec_count2, 100); + /* Get the entire raw description of the datatype in a single call */ + uint32_t iovec_count_300 = 0; + struct iovec * iov_300 = NULL; + mca_common_ompio_decode_datatype ( datatype, 1, &iov_300, &iovec_count_300, 300); + /* Get the raw description of the datatype 10 elements at the time. This stresses some + * of the execution paths in the convertor raw. + */ + uint32_t iovec_count_10 = 0; + struct iovec * iov_10 = NULL; + mca_common_ompio_decode_datatype ( datatype, 1, &iov_10, &iovec_count_10, 10); + /* Get the raw description of the datatype one element at the time. This stresses all + * execution paths in the convertor raw. + */ + uint32_t iovec_count_1 = 0; + struct iovec * iov_1 = NULL; + mca_common_ompio_decode_datatype ( datatype, 1, &iov_1, &iovec_count_1, 1); + - assert(iovec_count == iovec_count2); + assert(iovec_count_300 == iovec_count_10); + assert(iovec_count_300 == iovec_count_1); // assert(iov[100].iov_base == iov2[100].iov_base); // assert(iov[100].iov_len == iov2[100].iov_len); - for (int i=0; i Date: Fri, 1 Feb 2019 11:20:13 +0900 Subject: [PATCH 244/674] opal/datatype: reset ptypes in opal_datatype_clone() Reset ptypes when cloning a datatype in order to prevent a double free() in the opal_datatype_t destructor. This fixes a bug introduced in open-mpi/ompi@7c938f070fa8c906918507dbc78fdadcde324610 Fixes open-mpi/ompi#6346 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b395342c9fbdc28f59e01d393d34a6b0c651180e) --- opal/datatype/opal_datatype_clone.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opal/datatype/opal_datatype_clone.c b/opal/datatype/opal_datatype_clone.c index fa4479982d0..59e82bb40cf 100644 --- a/opal/datatype/opal_datatype_clone.c +++ b/opal/datatype/opal_datatype_clone.c @@ -12,6 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,6 +43,7 @@ int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * sizeof(opal_datatype_t)-sizeof(opal_object_t) ); dest_type->flags &= (~OPAL_DATATYPE_FLAG_PREDEFINED); + dest_type->ptypes = NULL; dest_type->desc.desc = temp; /** From 9ad871fc38e2b68299953f39822592da1480aacf Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 29 Jan 2019 13:10:26 +0900 Subject: [PATCH 245/674] ofi: revamp OPAL_CHECK_OFI configury Update the OPAL_CHECK_OFI configury macro: - Make it safe to call the macro multiple times: - The checks only execute the first time it is invoked - Subsequent invocations, it just emits a friendly "checking..." message so that configure output is sensible/logical - With the goal of ultimately removing opal/mca/common/ofi, rename the output variables from OPAL_CHECK_OFI to be opal_ofi_{happy|CPPFLAGS|LDFLAGS|LIBS}. - Update btl/usnic and mtl/ofi for these new conventions. - Also, don't use AC_REQUIRE to invoke OPAL_CHECK_OFI because that causes the macro to be invoked at a fairly random time, which makes configure stdout confusing / hard to grok. - Remove a little left-over kruft in OPAL_CHECK_OFI, too (which resulted in an indenting change, making the change to opal_check_ofi.m4 look larger than it really is). Thanks Alastair McKinstry for the report and initial fix. Thanks Rashika Kheria for the reminder. Updated from master cherry pick: the OFI BTL does not exist on the v4.0.x branch. Therefore, did not include the OFI BTL changes on master in this cherry pick. Signed-off-by: Jeff Squyres (cherry picked from commit f5e1a672ccd5db127e85e1e8f6bcfeb8a8b04527) --- config/opal_check_ofi.m4 | 198 +++++++++++++++++--------------- ompi/mca/mtl/ofi/Makefile.am | 15 +-- ompi/mca/mtl/ofi/configure.m4 | 8 +- opal/mca/btl/usnic/Makefile.am | 13 ++- opal/mca/btl/usnic/configure.m4 | 16 +-- 5 files changed, 133 insertions(+), 117 deletions(-) diff --git a/config/opal_check_ofi.m4 b/config/opal_check_ofi.m4 index f57cfae4e62..339039c0e16 100644 --- a/config/opal_check_ofi.m4 +++ b/config/opal_check_ofi.m4 @@ -1,6 +1,6 @@ dnl -*- shell-script -*- dnl -dnl Copyright (c) 2015-2016 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2015-2019 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl $COPYRIGHT$ @@ -10,102 +10,116 @@ dnl dnl $HEADER$ dnl - -# OPAL_CHECK_OFI(prefix, [action-if-found], [action-if-not-found] -# -------------------------------------------------------- -# Check if libfabric support can be found. -# -# Sets prefix_{CPPFLAGS, LDFLAGs, LIBS} as needed and runs -# action-if-found if there is support; otherwise executes -# action-if-not-found. -# -AC_DEFUN([OPAL_CHECK_OFI],[ - if test -z "$opal_check_libfabric_happy" ; then - OPAL_VAR_SCOPE_PUSH([opal_check_libfabric_$1_save_CPPFLAGS opal_check_libfabric_$1_save_LDFLAGS opal_check_libfabric_$1_save_LIBS]) - - # Add --with options - AC_ARG_WITH([libfabric], - [AC_HELP_STRING([--with-libfabric=DIR], - [Deprecated synonym for --with-ofi])]) - AC_ARG_WITH([libfabric-libdir], - [AC_HELP_STRING([--with-libfabric-libdir=DIR], - [Deprecated synonym for --with-ofi-libdir])]) - - AC_ARG_WITH([ofi], - [AC_HELP_STRING([--with-ofi=DIR], - [Specify location of OFI libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])]) - - AC_ARG_WITH([ofi-libdir], - [AC_HELP_STRING([--with-ofi-libdir=DIR], - [Search for OFI libfabric libraries in DIR])]) - - if test "$with_ofi" = ""; then - with_ofi=$with_libfabric - fi - - if test "$with_ofi_libdir" = ""; then - with_ofi_libdir=$with_libfabric_libdir - fi - - # Sanity check the --with values - OPAL_CHECK_WITHDIR([ofi], [$with_ofi], - [include/rdma/fabric.h]) - OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir], - [libfabric.*]) - - opal_check_ofi_$1_save_CPPFLAGS=$CPPFLAGS - opal_check_ofi_$1_save_LDFLAGS=$LDFLAGS - opal_check_ofi_$1_save_LIBS=$LIBS - - opal_check_ofi_happy=yes - AS_IF([test "$with_ofi" = "no"], - [opal_check_ofi_happy=no]) - - AS_IF([test $opal_check_ofi_happy = yes], - [AC_MSG_CHECKING([looking for OFI libfabric in]) - AS_IF([test "$with_ofi" != "yes"], - [opal_ofi_dir=$with_ofi - AC_MSG_RESULT([($opal_ofi_dir)])], - [AC_MSG_RESULT([(default search paths)])]) - AS_IF([test ! -z "$with_ofi_libdir" && \ - test "$with_ofi_libdir" != "yes"], - [opal_ofi_libdir=$with_ofi_libdir]) - ]) - - AS_IF([test $opal_check_ofi_happy = yes], - [OPAL_CHECK_PACKAGE([opal_check_ofi], - [rdma/fabric.h], - [fabric], - [fi_getinfo], - [], - [$opal_ofi_dir], - [$opal_ofi_libdir], - [], - [opal_check_ofi_happy=no])]) - - CPPFLAGS=$opal_check_ofi_$1_save_CPPFLAGS - LDFLAGS=$opal_check_ofi_$1_save_LDFLAGS - LIBS=$opal_check_ofi_$1_save_LIBS - - OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics Libfabric]],[$1],[$opal_check_ofi_happy]) - - OPAL_VAR_SCOPE_POP +dnl +dnl _OPAL_CHECK_OFI +dnl -------------------------------------------------------- +dnl Do the real work of checking for OFI libfabric. +dnl Upon return: +dnl +dnl - opal_ofi_happy: will be "yes" or "no" +dnl - opal_ofi_{CPPFLAGS|LDFLAGS|LIBS} will be loaded (if relevant) +dnl +AC_DEFUN([_OPAL_CHECK_OFI],[ + # Add --with options + AC_ARG_WITH([libfabric], + [AC_HELP_STRING([--with-libfabric=DIR], + [Deprecated synonym for --with-ofi])]) + AC_ARG_WITH([libfabric-libdir], + [AC_HELP_STRING([--with-libfabric-libdir=DIR], + [Deprecated synonym for --with-ofi-libdir])]) + + AC_ARG_WITH([ofi], + [AC_HELP_STRING([--with-ofi=DIR], + [Specify location of OFI libfabric installation, adding DIR/include to the default search location for libfabric headers, and DIR/lib or DIR/lib64 to the default search location for libfabric libraries. Error if libfabric support cannot be found.])]) + + AC_ARG_WITH([ofi-libdir], + [AC_HELP_STRING([--with-ofi-libdir=DIR], + [Search for OFI libfabric libraries in DIR])]) + + if test "$with_ofi" = ""; then + with_ofi=$with_libfabric fi - if test $opal_check_ofi_happy = yes ; then - $1_CPPFLAGS="[$]$1_CPPFLAGS $opal_check_ofi_CPPFLAGS" - $1_LIBS="[$]$1_LIBS $opal_check_ofi_LIBS" - $1_LDFLAGS="[$]$1_LDFLAGS $opal_check_ofi_LDFLAGS" - - AC_SUBST($1_CPPFLAGS) - AC_SUBST($1_LDFLAGS) - AC_SUBST($1_LIBS) + if test "$with_ofi_libdir" = ""; then + with_ofi_libdir=$with_libfabric_libdir fi - AS_IF([test $opal_check_ofi_happy = yes], - [$2], + # Sanity check the --with values + OPAL_CHECK_WITHDIR([ofi], [$with_ofi], + [include/rdma/fabric.h]) + OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir], + [libfabric.*]) + + OPAL_VAR_SCOPE_PUSH([opal_check_ofi_save_CPPFLAGS opal_check_ofi_save_LDFLAGS opal_check_ofi_save_LIBS]) + opal_check_ofi_save_CPPFLAGS=$CPPFLAGS + opal_check_ofi_save_LDFLAGS=$LDFLAGS + opal_check_ofi_save_LIBS=$LIBS + + opal_ofi_happy=yes + AS_IF([test "$with_ofi" = "no"], + [opal_ofi_happy=no]) + + AS_IF([test $opal_ofi_happy = yes], + [AC_MSG_CHECKING([looking for OFI libfabric in]) + AS_IF([test "$with_ofi" != "yes"], + [opal_ofi_dir=$with_ofi + AC_MSG_RESULT([($opal_ofi_dir)])], + [AC_MSG_RESULT([(default search paths)])]) + AS_IF([test ! -z "$with_ofi_libdir" && \ + test "$with_ofi_libdir" != "yes"], + [opal_ofi_libdir=$with_ofi_libdir]) + ]) + + AS_IF([test $opal_ofi_happy = yes], + [OPAL_CHECK_PACKAGE([opal_ofi], + [rdma/fabric.h], + [fabric], + [fi_getinfo], + [], + [$opal_ofi_dir], + [$opal_ofi_libdir], + [], + [opal_ofi_happy=no])]) + + CPPFLAGS=$opal_check_ofi_save_CPPFLAGS + LDFLAGS=$opal_check_ofi_save_LDFLAGS + LIBS=$opal_check_ofi_save_LIBS + + AC_SUBST([opal_ofi_CPPFLAGS]) + AC_SUBST([opal_ofi_LDFLAGS]) + AC_SUBST([opal_ofi_LIBS]) + + OPAL_SUMMARY_ADD([[Transports]],[[OpenFabrics OFI Libfabric]],[],[$opal_ofi_happy]) + + OPAL_VAR_SCOPE_POP + + AS_IF([test $opal_ofi_happy = no], [AS_IF([test -n "$with_ofi" && test "$with_ofi" != "no"], [AC_MSG_WARN([OFI libfabric support requested (via --with-ofi or --with-libfabric), but not found.]) AC_MSG_ERROR([Cannot continue.])]) - $3]) + ]) ])dnl + + +dnl +dnl OPAL_CHECK_OFI +dnl -------------------------------------------------------- +dnl Check to see if OFI libfabric is available. +dnl +dnl This is a simple wrapper around _OPAL_CHECK_OFI that just +dnl ensures to only run the checks once. We do not use AC_REQUIRE +dnl because that re-orders the texts and makes ordering in stdout +dnl quite confusing / difficult to grok. +dnl +AC_DEFUN([OPAL_CHECK_OFI],[ + # Check for OFI libfabric. Note that $opal_ofi_happy is used in + # other configure.m4's to know if OFI/libfabric configured + # successfully. We only need to run the back-end checks once, but + # at least emit a "checking..." statement each subsequent time + # this macro is invoked so that configure's stdout has + # sensible/logical output. + AS_IF([test -z "$opal_ofi_happy"], + [_OPAL_CHECK_OFI], + [AC_MSG_CHECKING([if OFI libfabric is available]) + AC_MSG_RESULT([$opal_ofi_happy])]) +]) diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 3fbb0fd52bf..985f6ad4599 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -1,10 +1,12 @@ # # Copyright (c) 2013-2015 Intel, Inc. All rights reserved # -# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -14,7 +16,7 @@ EXTRA_DIST = post_configure.sh -AM_CPPFLAGS = $(ompi_mtl_ofi_CPPFLAGS) $(opal_common_ofi_CPPFLAGS) +AM_CPPFLAGS = $(opal_ofi_CPPFLAGS) dist_ompidata_DATA = help-mtl-ofi.txt @@ -44,15 +46,14 @@ mcacomponentdir = $(ompilibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_mtl_ofi_la_SOURCES = $(mtl_ofi_sources) mca_mtl_ofi_la_LDFLAGS = \ - $(ompi_mtl_ofi_LDFLAGS) \ + $(opal_ofi_LDFLAGS) \ -module -avoid-version mca_mtl_ofi_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ - $(ompi_mtl_ofi_LIBS) \ - $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la + $(opal_ofi_LIBS) noinst_LTLIBRARIES = $(component_noinst) libmca_mtl_ofi_la_SOURCES = $(mtl_ofi_sources) libmca_mtl_ofi_la_LDFLAGS = \ - $(ompi_mtl_ofi_LDFLAGS) \ + $(opal_ofi_LDFLAGS) \ -module -avoid-version -libmca_mtl_ofi_la_LIBADD = $(ompi_mtl_ofi_LIBS) +libmca_mtl_ofi_la_LIBADD = $(opal_ofi_LIBS) diff --git a/ompi/mca/mtl/ofi/configure.m4 b/ompi/mca/mtl/ofi/configure.m4 index 772cd75cfa4..7bf981dba9b 100644 --- a/ompi/mca/mtl/ofi/configure.m4 +++ b/ompi/mca/mtl/ofi/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2013-2014 Intel, Inc. All rights reserved # -# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. # $COPYRIGHT$ @@ -25,10 +25,10 @@ AC_DEFUN([MCA_ompi_mtl_ofi_POST_CONFIG], [ AC_DEFUN([MCA_ompi_mtl_ofi_CONFIG],[ AC_CONFIG_FILES([ompi/mca/mtl/ofi/Makefile]) - # ensure we already ran the common OFI/libfabric config - AC_REQUIRE([MCA_opal_common_ofi_CONFIG]) + # Check for OFI + OPAL_CHECK_OFI - AS_IF([test "$opal_common_ofi_happy" = "yes"], + AS_IF([test "$opal_ofi_happy" = "yes"], [$1], [$2]) ])dnl diff --git a/opal/mca/btl/usnic/Makefile.am b/opal/mca/btl/usnic/Makefile.am index ecd3099dc67..9a270c043b0 100644 --- a/opal/mca/btl/usnic/Makefile.am +++ b/opal/mca/btl/usnic/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006 Sandia National Laboratories. All rights # reserved. -# Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2015 Intel, Inc. All rights reserved. # Copyright (c) 2016-2017 IBM Corporation. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights @@ -23,7 +23,7 @@ # $HEADER$ # -AM_CPPFLAGS = -DBTL_IN_OPAL=1 $(opal_common_ofi_CPPFLAGS) -DOMPI_LIBMPI_NAME=\"$(OMPI_LIBMPI_NAME)\" +AM_CPPFLAGS = -DBTL_IN_OPAL=1 $(opal_ofi_CPPFLAGS) -DOMPI_LIBMPI_NAME=\"$(OMPI_LIBMPI_NAME)\" EXTRA_DIST = README.txt README.test @@ -88,13 +88,18 @@ mcacomponent_LTLIBRARIES = $(component) mca_btl_usnic_la_SOURCES = $(component_sources) mca_btl_usnic_la_LDFLAGS = \ $(opal_btl_usnic_LDFLAGS) \ + $(opal_ofi_LDFLAGS) \ -module -avoid-version mca_btl_usnic_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la + $(opal_ofi_LIBS) noinst_LTLIBRARIES = $(lib) libmca_btl_usnic_la_SOURCES = $(lib_sources) -libmca_btl_usnic_la_LDFLAGS = -module -avoid-version $(opal_btl_usnic_LDFLAGS) +libmca_btl_usnic_la_LDFLAGS = \ + $(opal_btl_usnic_LDFLAGS) \ + $(opal_ofi_LDFLAGS) \ + -module -avoid-version +libmca_btl_usnic_la_LIBADD = $(opal_ofi_LIBS) if OPAL_BTL_USNIC_BUILD_UNIT_TESTS usnic_btl_run_tests_CPPFLAGS = \ diff --git a/opal/mca/btl/usnic/configure.m4 b/opal/mca/btl/usnic/configure.m4 index 33d5dacdb75..0e75e625a14 100644 --- a/opal/mca/btl/usnic/configure.m4 +++ b/opal/mca/btl/usnic/configure.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2006 Sandia National Laboratories. All rights # reserved. -# Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2010-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. # $COPYRIGHT$ @@ -95,21 +95,17 @@ AC_DEFUN([_OPAL_BTL_USNIC_DO_CONFIG],[ AC_MSG_RESULT([$opal_btl_usnic_happy]) ]) - # The usnic BTL requires OFI libfabric support. AS_IF([test "$opal_btl_usnic_happy" = "yes"], - [AC_MSG_CHECKING([whether OFI libfabric support is available]) - AS_IF([test "$opal_common_ofi_happy" = "yes"], - [opal_btl_usnic_happy=yes], - [opal_btl_usnic_happy=no]) - AC_MSG_RESULT([$opal_btl_usnic_happy]) - ]) + [ # The usnic BTL requires OFI libfabric support + OPAL_CHECK_OFI + opal_btl_usnic_happy=$opal_ofi_happy]) # The usnic BTL requires at least OFI libfabric v1.1 (there was a # critical bug in libfabric v1.0). AS_IF([test "$opal_btl_usnic_happy" = "yes"], [AC_MSG_CHECKING([whether OFI libfabric is >= v1.1]) opal_btl_usnic_CPPFLAGS_save=$CPPFLAGS - CPPFLAGS="$opal_common_ofi_CPPFLAGS $CPPFLAGS" + CPPFLAGS="$opal_ofi_CPPFLAGS $CPPFLAGS" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[ #if !defined(FI_MAJOR_VERSION) @@ -127,7 +123,7 @@ AC_DEFUN([_OPAL_BTL_USNIC_DO_CONFIG],[ # Make sure we can find the OFI libfabric usnic extensions header AS_IF([test "$opal_btl_usnic_happy" = "yes" ], [opal_btl_usnic_CPPFLAGS_save=$CPPFLAGS - CPPFLAGS="$opal_common_ofi_CPPFLAGS $CPPFLAGS" + CPPFLAGS="$opal_ofi_CPPFLAGS $CPPFLAGS" AC_CHECK_HEADER([rdma/fi_ext_usnic.h], [], [opal_btl_usnic_happy=no]) From 7fd62cf74500865ced1f3ffc8a69f7de5d4af979 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 6 Feb 2019 04:53:14 -0800 Subject: [PATCH 246/674] Remove opal/mca/common/ofi. It never lived up to its purpose (and has caused amorphous indirect errors such as https://github.com/open-mpi/ompi/issues/2519), so delete it. Signed-off-by: Jeff Squyres (cherry picked from commit dd20174532928e0c9cdbe7b206868e6e4bea9d0b) --- VERSION | 3 +- configure.ac | 3 +- opal/mca/common/ofi/Makefile.am | 105 ------------------------------- opal/mca/common/ofi/common_ofi.c | 23 ------- opal/mca/common/ofi/common_ofi.h | 18 ------ opal/mca/common/ofi/configure.m4 | 32 ---------- opal/mca/common/ofi/owner.txt | 7 --- 7 files changed, 2 insertions(+), 189 deletions(-) delete mode 100644 opal/mca/common/ofi/Makefile.am delete mode 100644 opal/mca/common/ofi/common_ofi.c delete mode 100644 opal/mca/common/ofi/common_ofi.h delete mode 100644 opal/mca/common/ofi/configure.m4 delete mode 100644 opal/mca/common/ofi/owner.txt diff --git a/VERSION b/VERSION index bf34f81c217..33ed79a7e07 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. -# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011 NVIDIA Corporation. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. @@ -112,7 +112,6 @@ libmca_orte_common_alps_so_version=60:0:20 # OPAL layer libmca_opal_common_cuda_so_version=60:0:20 -libmca_opal_common_ofi_so_version=60:0:20 libmca_opal_common_sm_so_version=60:0:20 libmca_opal_common_ucx_so_version=60:0:20 libmca_opal_common_ugni_so_version=60:0:20 diff --git a/configure.ac b/configure.ac index 9baa43d003e..d70c780deb4 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights # reserved. @@ -154,7 +154,6 @@ AC_SUBST(libopen_pal_so_version) # transparently by adding some intelligence in autogen.pl # and/or opal_mca.m4, but I don't have the cycles to do this # right now. -AC_SUBST(libmca_opal_common_ofi_so_version) AC_SUBST(libmca_opal_common_cuda_so_version) AC_SUBST(libmca_opal_common_sm_so_version) AC_SUBST(libmca_opal_common_ugni_so_version) diff --git a/opal/mca/common/ofi/Makefile.am b/opal/mca/common/ofi/Makefile.am deleted file mode 100644 index 658e1a703f2..00000000000 --- a/opal/mca/common/ofi/Makefile.am +++ /dev/null @@ -1,105 +0,0 @@ -# -# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana -# University Research and Technology -# Corporation. All rights reserved. -# Copyright (c) 2004-2013 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2004-2009 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) 2011-2013 NVIDIA Corporation. All rights reserved. -# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -# A word of explanation... -# -# This library is linked against various MCA components because the -# support for ofis is needed in various places. -# -# Note that building this common component statically and linking -# against other dynamic components is *not* supported! - -AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) - -# Header files - -headers = \ - common_ofi.h - -# Source files - -sources = \ - common_ofi.c - -# As per above, we'll either have an installable or noinst result. -# The installable one should follow the same MCA prefix naming rules -# (i.e., libmca__.la). The noinst one can be named -# whatever it wants, although libmca___noinst.la is -# recommended. - -# To simplify components that link to this library, we will *always* -# have an output libtool library named libmca__.la -- even -# for case 2) described above (i.e., so there's no conditional logic -# necessary in component Makefile.am's that link to this library). -# Hence, if we're creating a noinst version of this library (i.e., -# case 2), we sym link it to the libmca__.la name -# (libtool will do the Right Things under the covers). See the -# all-local and clean-local rules, below, for how this is effected. - -lib_LTLIBRARIES = -noinst_LTLIBRARIES = -comp_inst = lib@OPAL_LIB_PREFIX@mca_common_ofi.la -comp_noinst = lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst.la - - -if MCA_BUILD_opal_common_ofi_DSO -lib_LTLIBRARIES += $(comp_inst) -else -noinst_LTLIBRARIES += $(comp_noinst) -endif - -lib@OPAL_LIB_PREFIX@mca_common_ofi_la_SOURCES = $(headers) $(sources) -lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LDFLAGS = \ - $(opal_common_ofi_LDFLAGS) \ - -version-info $(libmca_opal_common_ofi_so_version) -lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LIBADD = $(opal_common_ofi_LIBS) - -lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_SOURCES = $(headers) $(sources) -lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LDFLAGS = $(opal_common_ofi_LDFLAGS) -lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LIBADD = $(opal_common_ofi_LIBS) - -# Conditionally install the header files - -if WANT_INSTALL_HEADERS -opaldir = $(opalincludedir)/$(subdir) -opal_HEADERS = $(headers) -endif - -# These two rules will sym link the "noinst" libtool library filename -# to the installable libtool library filename in the case where we are -# compiling this component statically (case 2), described above). - -V=0 -OMPI_V_LN_SCOMP = $(ompi__v_LN_SCOMP_$V) -ompi__v_LN_SCOMP_ = $(ompi__v_LN_SCOMP_$AM_DEFAULT_VERBOSITY) -ompi__v_LN_SCOMP_0 = @echo " LN_S " `basename $(comp_inst)`; - -all-local: - $(OMPI_V_LN_SCOMP) if test -z "$(lib_LTLIBRARIES)"; then \ - rm -f "$(comp_inst)"; \ - $(LN_S) "$(comp_noinst)" "$(comp_inst)"; \ - fi - -clean-local: - if test -z "$(lib_LTLIBRARIES)"; then \ - rm -f "$(comp_inst)"; \ - fi diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c deleted file mode 100644 index c2d02be50bb..00000000000 --- a/opal/mca/common/ofi/common_ofi.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "opal_config.h" -#include "opal/constants.h" - -#include -#include - -#include "common_ofi.h" - -int mca_common_ofi_register_mca_variables(void) -{ - return OPAL_SUCCESS; -} diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h deleted file mode 100644 index bb5a04f35a8..00000000000 --- a/opal/mca/common/ofi/common_ofi.h +++ /dev/null @@ -1,18 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef OPAL_MCA_COMMON_OFI_H -#define OPAL_MCA_COMMON_OFI_H - -OPAL_DECLSPEC int mca_common_ofi_register_mca_variables(void); - -#endif /* OPAL_MCA_COMMON_OFI_H */ diff --git a/opal/mca/common/ofi/configure.m4 b/opal/mca/common/ofi/configure.m4 deleted file mode 100644 index 4e47ad278dd..00000000000 --- a/opal/mca/common/ofi/configure.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. -# Copyright (c) 2013 The University of Tennessee and The University -# of Tennessee Research Foundation. All rights -# reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. -# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AC_DEFUN([MCA_opal_common_ofi_CONFIG],[ - AC_CONFIG_FILES([opal/mca/common/ofi/Makefile]) - - # Check for ofi. Note that $opal_common_ofi_happy is - # used in other configure.m4's to know if ofi configured - # successfully. - OPAL_CHECK_OFI([opal_common_ofi], - [opal_common_ofi_happy=yes - common_ofi_WRAPPER_EXTRA_LDFLAGS=$opal_common_ofi_LDFLAGS - common_ofi_WRAPPER_EXTRA_LIBS=$opal_common_ofi_LIBS - $1], - [opal_common_ofi_happy=no - $2]) - -])dnl diff --git a/opal/mca/common/ofi/owner.txt b/opal/mca/common/ofi/owner.txt deleted file mode 100644 index 5fe87e2d40c..00000000000 --- a/opal/mca/common/ofi/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: Intel -status:active From c154631879e24f38760fead1371d4cd7dcbba84c Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Wed, 30 Jan 2019 09:22:17 +0600 Subject: [PATCH 247/674] regx/test: update regex test Signed-off-by: Boris Karasev (cherry picked from commit d1ad90f47e93436d0e1b49e5946da9f6b33aacdf) --- orte/test/system/regex.c | 49 ++++++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/orte/test/system/regex.c b/orte/test/system/regex.c index 1fb3496f3b7..335f0a53aa4 100644 --- a/orte/test/system/regex.c +++ b/orte/test/system/regex.c @@ -13,16 +13,19 @@ #include "opal/util/argv.h" #include "orte/util/proc_info.h" -#include "orte/util/regex.h" #include "orte/mca/errmgr/errmgr.h" #include "orte/runtime/runtime.h" +#include "orte/mca/regx/regx.h" +#include "orte/mca/regx/base/base.h" int main(int argc, char **argv) { int rc; - char *regex, *save; + char *regex, **nodelist; char **nodes=NULL; int i; + opal_pointer_array_t *node_pool; + orte_node_t *nptr; if (argc < 1 || NULL == argv[1]) { fprintf(stderr, "usage: regex \n"); @@ -31,10 +34,19 @@ int main(int argc, char **argv) orte_init(&argc, &argv, ORTE_PROC_NON_MPI); + if (ORTE_SUCCESS != (rc = mca_base_framework_open(&orte_regx_base_framework, 0))) { + ORTE_ERROR_LOG(rc); + return rc; + } + if (ORTE_SUCCESS != (rc = orte_regx_base_select())) { + ORTE_ERROR_LOG(rc); + return rc; + } + if (NULL != strchr(argv[1], '[')) { /* given a regex to analyze */ fprintf(stderr, "ANALYZING REGEX: %s\n", argv[1]); - if (ORTE_SUCCESS != (rc = orte_regex_extract_node_names(argv[1], &nodes))) { + if (ORTE_SUCCESS != (rc = orte_regx.extract_node_names(argv[1], &nodes))) { ORTE_ERROR_LOG(rc); } for (i=0; NULL != nodes[i]; i++) { @@ -45,12 +57,30 @@ int main(int argc, char **argv) return 0; } - save = strdup(argv[1]); - if (ORTE_SUCCESS != (rc = orte_regex_create(save, ®ex))) { + node_pool = OBJ_NEW(opal_pointer_array_t); + nodelist = opal_argv_split(argv[1], ','); + for (i=0; NULL != nodelist[i]; i++) { + orte_proc_t *daemon = NULL; + + nptr = OBJ_NEW(orte_node_t); + nptr->name = strdup(nodelist[i]); + daemon = OBJ_NEW(orte_proc_t); + daemon->name.jobid = 123; + daemon->name.vpid = i; + nptr->daemon = daemon; + + nptr->index = opal_pointer_array_add(node_pool, nptr); + } + opal_argv_free(nodelist); + + + if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(node_pool, ®ex))) { ORTE_ERROR_LOG(rc); } else { + char *vpids = strchr(regex, '@'); + vpids[0] = '\0'; fprintf(stderr, "REGEX: %s\n", regex); - if (ORTE_SUCCESS != (rc = orte_regex_extract_node_names(regex, &nodes))) { + if (ORTE_SUCCESS != (rc = orte_regx.extract_node_names(regex, &nodes))) { ORTE_ERROR_LOG(rc); } free(regex); @@ -63,5 +93,10 @@ int main(int argc, char **argv) } free(regex); } - free(save); + + for (i=0; (nptr = opal_pointer_array_get_item(node_pool, i)) != NULL; i++) { + free(nptr->name); + OBJ_RELEASE(nptr->daemon); + } + OBJ_RELEASE(node_pool); } From 62044da5d9b1dc4bb95f546a8ba7cd37270f296a Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Wed, 30 Jan 2019 09:22:55 +0600 Subject: [PATCH 248/674] regx/reverse: fixed adding an empty range for no numerical hostnames Example: For the nodelist `jjss,jjss0000001,jjss0000003,jjss0000002` a regular expression was `jjss[0:0],jjss[7:1,3,2]` that led to incorrect unpacking the first host as `jjs0`. This commit fixes an adding empty range for not numeric hostnames. Here is the fixed regex for this exapmle: `jjss,jjss[7:1,3,2]` Signed-off-by: Boris Karasev (cherry picked from commit 1967e41a71dbfd892513bb02a98fe6bb418777a4) --- orte/mca/regx/reverse/regx_reverse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/orte/mca/regx/reverse/regx_reverse.c b/orte/mca/regx/reverse/regx_reverse.c index b94a9be353f..fd12a5bd3c0 100644 --- a/orte/mca/regx/reverse/regx_reverse.c +++ b/orte/mca/regx/reverse/regx_reverse.c @@ -142,7 +142,9 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) for( j = 0; j <= i; ++j) { prefix[j] = node[j]; } - startnum = j; + if (numdigits) { + startnum = j; + } break; } } From 87c90866cb5c0bb5abc75039e9c2a70e3fc7e308 Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Wed, 30 Jan 2019 09:23:36 +0600 Subject: [PATCH 249/674] regx: fixed the order of hosts for ranges with different prefixes Example: For the list of hosts `a01,b00,a00` a regex is generated: `a[2:1.0],b[2:0]`, where `a`-hosts prefixes moved to the begining, it breaks the hosts ordering. This commit fixes regex for that case to `a[2:1],b[2:0],a[2:0]` Signed-off-by: Boris Karasev (cherry picked from commit 46e38b9193f5554b7a26aa830e98b10d6836acb2) --- orte/mca/regx/fwd/regx_fwd.c | 63 ++++++++++------------------ orte/mca/regx/reverse/regx_reverse.c | 60 ++++++++++---------------- orte/test/system/regex.c | 21 ++++++++-- 3 files changed, 64 insertions(+), 80 deletions(-) diff --git a/orte/mca/regx/fwd/regx_fwd.c b/orte/mca/regx/fwd/regx_fwd.c index 893b96e0ae8..c5c4d5d9030 100644 --- a/orte/mca/regx/fwd/regx_fwd.c +++ b/orte/mca/regx/fwd/regx_fwd.c @@ -154,38 +154,25 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) } /* is this node name already on our list? */ found = false; - for (item = opal_list_get_first(&nodenms); - !found && item != opal_list_get_end(&nodenms); - item = opal_list_get_next(item)) { - ndreg = (orte_regex_node_t*)item; - if (0 < strlen(prefix) && NULL == ndreg->prefix) { - continue; - } - if (0 == strlen(prefix) && NULL != ndreg->prefix) { - continue; - } - if (0 < strlen(prefix) && NULL != ndreg->prefix - && 0 != strcmp(prefix, ndreg->prefix)) { - continue; - } - if (NULL == suffix && NULL != ndreg->suffix) { - continue; - } - if (NULL != suffix && NULL == ndreg->suffix) { - continue; - } - if (NULL != suffix && NULL != ndreg->suffix && - 0 != strcmp(suffix, ndreg->suffix)) { - continue; - } - if (numdigits != ndreg->num_digits) { - continue; + if (0 != opal_list_get_size(&nodenms)) { + ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms); + + if ((0 < strlen(prefix) && NULL == ndreg->prefix) || + (0 == strlen(prefix) && NULL != ndreg->prefix) || + (0 < strlen(prefix) && NULL != ndreg->prefix && + 0 != strcmp(prefix, ndreg->prefix)) || + (NULL == suffix && NULL != ndreg->suffix) || + (NULL != suffix && NULL == ndreg->suffix) || + (NULL != suffix && NULL != ndreg->suffix && + 0 != strcmp(suffix, ndreg->suffix)) || + (numdigits != ndreg->num_digits)) { + found = false; + } else { + /* found a match - flag it */ + found = true; } - /* found a match - flag it */ - found = true; - /* get the last range on this nodeid - we do this - * to preserve order - */ + } + if (found) { range = (orte_regex_range_t*)opal_list_get_last(&ndreg->ranges); if (NULL == range) { /* first range for this nodeid */ @@ -193,22 +180,18 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) range->vpid = nodenum; range->cnt = 1; opal_list_append(&ndreg->ranges, &range->super); - break; - } /* see if the node number is out of sequence */ - if (nodenum != (range->vpid + range->cnt)) { + } else if (nodenum != (range->vpid + range->cnt)) { /* start a new range */ range = OBJ_NEW(orte_regex_range_t); range->vpid = nodenum; range->cnt = 1; opal_list_append(&ndreg->ranges, &range->super); - break; + } else { + /* everything matches - just increment the cnt */ + range->cnt++; } - /* everything matches - just increment the cnt */ - range->cnt++; - break; - } - if (!found) { + } else { /* need to add it */ ndreg = OBJ_NEW(orte_regex_node_t); if (0 < strlen(prefix)) { diff --git a/orte/mca/regx/reverse/regx_reverse.c b/orte/mca/regx/reverse/regx_reverse.c index fd12a5bd3c0..b6c3ba187a0 100644 --- a/orte/mca/regx/reverse/regx_reverse.c +++ b/orte/mca/regx/reverse/regx_reverse.c @@ -170,35 +170,25 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) } /* is this node name already on our list? */ found = false; - for (item = opal_list_get_first(&nodenms); - !found && item != opal_list_get_end(&nodenms); - item = opal_list_get_next(item)) { - ndreg = (orte_regex_node_t*)item; - if (0 < strlen(prefix) && NULL == ndreg->prefix) { - continue; - } - if (0 == strlen(prefix) && NULL != ndreg->prefix) { - continue; - } - if (0 < strlen(prefix) && NULL != ndreg->prefix - && 0 != strcmp(prefix, ndreg->prefix)) { - continue; - } - if (NULL == suffix && NULL != ndreg->suffix) { - continue; - } - if (NULL != suffix && NULL == ndreg->suffix) { - continue; - } - if (NULL != suffix && NULL != ndreg->suffix && - 0 != strcmp(suffix, ndreg->suffix)) { - continue; - } - if (numdigits != ndreg->num_digits) { - continue; + if (0 != opal_list_get_size(&nodenms)) { + ndreg = (orte_regex_node_t*)opal_list_get_last(&nodenms); + + if ((0 < strlen(prefix) && NULL == ndreg->prefix) || + (0 == strlen(prefix) && NULL != ndreg->prefix) || + (0 < strlen(prefix) && NULL != ndreg->prefix && + 0 != strcmp(prefix, ndreg->prefix)) || + (NULL == suffix && NULL != ndreg->suffix) || + (NULL != suffix && NULL == ndreg->suffix) || + (NULL != suffix && NULL != ndreg->suffix && + 0 != strcmp(suffix, ndreg->suffix)) || + (numdigits != ndreg->num_digits)) { + found = false; + } else { + /* found a match - flag it */ + found = true; } - /* found a match - flag it */ - found = true; + } + if (found) { /* get the last range on this nodeid - we do this * to preserve order */ @@ -209,22 +199,18 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) range->vpid = nodenum; range->cnt = 1; opal_list_append(&ndreg->ranges, &range->super); - break; - } /* see if the node number is out of sequence */ - if (nodenum != (range->vpid + range->cnt)) { + } else if (nodenum != (range->vpid + range->cnt)) { /* start a new range */ range = OBJ_NEW(orte_regex_range_t); range->vpid = nodenum; range->cnt = 1; opal_list_append(&ndreg->ranges, &range->super); - break; + } else { + /* everything matches - just increment the cnt */ + range->cnt++; } - /* everything matches - just increment the cnt */ - range->cnt++; - break; - } - if (!found) { + } else { /* need to add it */ ndreg = OBJ_NEW(orte_regex_node_t); if (0 < strlen(prefix)) { diff --git a/orte/test/system/regex.c b/orte/test/system/regex.c index 335f0a53aa4..45d1c140efd 100644 --- a/orte/test/system/regex.c +++ b/orte/test/system/regex.c @@ -21,7 +21,7 @@ int main(int argc, char **argv) { int rc; - char *regex, **nodelist; + char *regex = NULL, **nodelist; char **nodes=NULL; int i; opal_pointer_array_t *node_pool; @@ -71,7 +71,7 @@ int main(int argc, char **argv) nptr->index = opal_pointer_array_add(node_pool, nptr); } - opal_argv_free(nodelist); + if (ORTE_SUCCESS != (rc = orte_regx.nidmap_create(node_pool, ®ex))) { @@ -85,14 +85,29 @@ int main(int argc, char **argv) } free(regex); regex = opal_argv_join(nodes, ','); - opal_argv_free(nodes); if (0 == strcmp(regex, argv[1])) { fprintf(stderr, "EXACT MATCH\n"); } else { fprintf(stderr, "ERROR: %s\n", regex); + if (opal_argv_count(nodes) != opal_argv_count(nodelist)) { + fprintf(stderr, "ERROR: number of nodes %d, expected %d\n", + opal_argv_count(nodes), opal_argv_count(nodelist)); + goto exit; + } + for (i=0; NULL != nodelist[i]; i++) { + if (0 == strcmp(nodelist[i], nodes[i])) { + fprintf(stderr, "%s OK\n", nodelist[i]); + } + fprintf(stderr, "%s ERROR, expect %s\n", nodes[i], nodelist[i]); + } } free(regex); + regex = NULL; } +exit: + opal_argv_free(nodelist); + opal_argv_free(nodes); + for (i=0; (nptr = opal_pointer_array_get_item(node_pool, i)) != NULL; i++) { free(nptr->name); From dd750795eeed38eda94a919c12a505d7d37d6292 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 6 Dec 2018 14:44:39 +0900 Subject: [PATCH 250/674] oob/tcp: add cross version compatibility support Since we intend to provide cross version compatibility between versions with the same major and minor, use MAJOR.MINOR.0 instead of orte_version_string (e.g. MAJOR.MINOR.RELEASEGREEK). Open MPI 4.0.0 has already been released, so in order to make it compatible with future 4.0.x releases, we have to use 4.0.0 as the version string, that is why we use MAJOR.MINOR.0 instead of MAJOR.MINOR Signed-off-by: Gilles Gouaillardet --- orte/mca/oob/tcp/oob_tcp_connection.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/orte/mca/oob/tcp/oob_tcp_connection.c b/orte/mca/oob/tcp/oob_tcp_connection.c index ff06ec8a97d..9e387b1b0d6 100644 --- a/orte/mca/oob/tcp/oob_tcp_connection.c +++ b/orte/mca/oob/tcp/oob_tcp_connection.c @@ -14,8 +14,8 @@ * Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. * $COPYRIGHT$ * @@ -83,6 +83,11 @@ #include "oob_tcp_common.h" #include "oob_tcp_connection.h" +#define OOB_TCP_STR_EXPAND(tok) #tok +#define OOB_TCP_STR(tok) OOB_TCP_STR_EXPAND(tok) + +static char * oob_tcp_version_string = OOB_TCP_STR(ORTE_MAJOR_VERSION) "." OOB_TCP_STR(ORTE_MINOR_VERSION) ".0"; + static void tcp_peer_event_init(mca_oob_tcp_peer_t* peer); static int tcp_peer_send_connect_ack(mca_oob_tcp_peer_t* peer); static int tcp_peer_send_connect_nack(int sd, orte_process_name_t name); @@ -417,7 +422,7 @@ static int tcp_peer_send_connect_ack(mca_oob_tcp_peer_t* peer) memset(hdr.routed, 0, ORTE_MAX_RTD_SIZE+1); /* payload size */ - sdsize = sizeof(ack_flag) + strlen(orte_version_string) + 1; + sdsize = sizeof(ack_flag) + strlen(oob_tcp_version_string) + 1; hdr.nbytes = sdsize; MCA_OOB_TCP_HDR_HTON(&hdr); @@ -433,8 +438,8 @@ static int tcp_peer_send_connect_ack(mca_oob_tcp_peer_t* peer) offset += sizeof(hdr); memcpy(msg + offset, &ack_flag, sizeof(ack_flag)); offset += sizeof(ack_flag); - memcpy(msg + offset, orte_version_string, strlen(orte_version_string)); - offset += strlen(orte_version_string)+1; + memcpy(msg + offset, oob_tcp_version_string, strlen(oob_tcp_version_string)); + offset += strlen(oob_tcp_version_string)+1; /* send it */ if (ORTE_SUCCESS != tcp_peer_send_blocking(peer->sd, msg, sdsize)) { @@ -905,12 +910,12 @@ int mca_oob_tcp_peer_recv_connect_ack(mca_oob_tcp_peer_t* pr, /* check that this is from a matching version */ version = (char*)((char*)msg + offset); offset += strlen(version) + 1; - if (0 != strcmp(version, orte_version_string)) { + if (0 != strcmp(version, oob_tcp_version_string)) { opal_show_help("help-oob-tcp.txt", "version mismatch", true, opal_process_info.nodename, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_version_string, + oob_tcp_version_string, opal_fd_get_peer_name(peer->sd), ORTE_NAME_PRINT(&(peer->name)), version); From de1dd1c2b0355b300f0f145c6188e37bd1edff8f Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 13 Feb 2019 12:52:11 -0700 Subject: [PATCH 251/674] oob/tcp: hardwire oob_tcp version string to 4.0.0 Signed-off-by: Howard Pritchard --- orte/mca/oob/tcp/oob_tcp_connection.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/orte/mca/oob/tcp/oob_tcp_connection.c b/orte/mca/oob/tcp/oob_tcp_connection.c index 9e387b1b0d6..402d41c16ab 100644 --- a/orte/mca/oob/tcp/oob_tcp_connection.c +++ b/orte/mca/oob/tcp/oob_tcp_connection.c @@ -86,7 +86,10 @@ #define OOB_TCP_STR_EXPAND(tok) #tok #define OOB_TCP_STR(tok) OOB_TCP_STR_EXPAND(tok) -static char * oob_tcp_version_string = OOB_TCP_STR(ORTE_MAJOR_VERSION) "." OOB_TCP_STR(ORTE_MINOR_VERSION) ".0"; +/* + * See discussion at https://github.com/open-mpi/ompi/pull/6157 + */ +static char * oob_tcp_version_string = "4.0.0"; static void tcp_peer_event_init(mca_oob_tcp_peer_t* peer); static int tcp_peer_send_connect_ack(mca_oob_tcp_peer_t* peer); From 4b2c62d6fdf01004fa67a22eb03be4913b6d41c2 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 15 Feb 2019 13:43:05 -0700 Subject: [PATCH 252/674] NEWS: update for 4.0.1 release Signed-off-by: Howard Pritchard --- NEWS | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/NEWS b/NEWS index 4fd2fbb7968..13ecf33c1d0 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ Copyright (c) 2013 NVIDIA Corporation. All rights reserved. Copyright (c) 2013-2018 Intel, Inc. All rights reserved. Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. +Copyright (c) 2019 Triad National Security, LLC. All rights + reserved. $COPYRIGHT$ Additional copyrights may follow @@ -55,6 +57,43 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. +4.0.1 -- February, 2019 +------------------------ + +- Update embedded PMIx to 3.1.2. +- Fix an issue of excessive compiler warning messages from mpi.h + when using newer C++ compilers. Thanks to @Shadow-fax for + reporting. +- Fix a problem when building Open MPI using clang 5.0. +- Fix a problem with MPI_WIN_CREATE when using UCX. Thanks + to Adam Simpson for reporting. +- Fix a memory leak encountered for certain MPI datatype + destructor operations. Thanks to Axel Huebl for reporting. +- Fix several problems with MPI RMA accumulate operations. + Thanks to Jeff Hammond for reporting. +- Fix possible race condition in closing some file descriptors + during job launch using mpirun. Thanks to Jason Williams + for reporting and providing a fix. +- Fix a problem in OMPIO for large individual write operations. + Thanks to Axel Huebl for reporting. +- Fix a problem with parsing of map-by ppr options to mpirun. + Thanks to David Rich for reporting. +- Fix a problem observed when using the mpool hugepage component. Thanks + to Hunter Easterday for reporting and fixing. +- Fix valgrind warning generated when invoking certain MPI Fortran + data type creation functions. Thanks to @rtoijala for reporting. +- Fix a problem when trying to build with a PMIX 3.1 or newer + release. Thanks to Alastair McKinstry for reporting. +- Fix a problem encountered with building MPI F08 module files. + Thanks to Igor Andriyash and Axel Huebl for reporting. +- Fix two memory leaks encountered for certain MPI-RMA usage patterns. + Thanks to Joseph Schuchart for reporting and fixing. +- Fix a problem with the ORTE rmaps_base_oversubscribe MCA paramater. + Thanks to @iassiour for reporting. +- Fix a problem with UCX PML default error handler for MPI communicators. + Thanks to Marcin Krotkiewski for reporting. +- Fix various issues with OMPIO uncovered by the testmpio test suite. + 4.0.0 -- September, 2018 ------------------------ From 55915c388558028f6be1c04cc6f4b4573f2aff73 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 19 Feb 2019 10:27:47 -0700 Subject: [PATCH 253/674] rml/ofi: remove per discussion at the 2/19/19 devel-core meeting, remove rml/ofi from 4.0.x Signed-off-by: Howard Pritchard --- orte/mca/rml/ofi/Makefile.am | 53 -- orte/mca/rml/ofi/configure.m4 | 31 - orte/mca/rml/ofi/rml_ofi.h | 213 ----- orte/mca/rml/ofi/rml_ofi_component.c | 1191 -------------------------- orte/mca/rml/ofi/rml_ofi_request.h | 137 --- orte/mca/rml/ofi/rml_ofi_send.c | 1052 ----------------------- 6 files changed, 2677 deletions(-) delete mode 100644 orte/mca/rml/ofi/Makefile.am delete mode 100644 orte/mca/rml/ofi/configure.m4 delete mode 100644 orte/mca/rml/ofi/rml_ofi.h delete mode 100644 orte/mca/rml/ofi/rml_ofi_component.c delete mode 100644 orte/mca/rml/ofi/rml_ofi_request.h delete mode 100644 orte/mca/rml/ofi/rml_ofi_send.c diff --git a/orte/mca/rml/ofi/Makefile.am b/orte/mca/rml/ofi/Makefile.am deleted file mode 100644 index a6a4f90f0ae..00000000000 --- a/orte/mca/rml/ofi/Makefile.am +++ /dev/null @@ -1,53 +0,0 @@ -# -# Copyright (c) 2004-2005 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-2009 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 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Los Alamos National Security, LLC. All rights -# reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) - -sources = \ - rml_ofi.h \ - rml_ofi_request.h \ - rml_ofi_component.c \ - rml_ofi_send.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_rml_ofi_DSO -component_noinst = -component_install = mca_rml_ofi.la -else -component_noinst = libmca_rml_ofi.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_rml_ofi_la_SOURCES = $(sources) -mca_rml_ofi_la_LDFLAGS = -module -avoid-version -mca_rml_ofi_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_rml_ofi_la_SOURCES = $(sources) -libmca_rml_ofi_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/rml/ofi/configure.m4 b/orte/mca/rml/ofi/configure.m4 deleted file mode 100644 index 35327c29d47..00000000000 --- a/orte/mca/rml/ofi/configure.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2013-2014 Intel, Inc. All rights reserved -# -# Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Los Alamos National Security, LLC. All rights -# reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_orte_rml_ofi_POST_CONFIG(will_build) -# ---------------------------------------- -# Only require the tag if we're actually going to be built - -# MCA_mtl_ofi_CONFIG([action-if-can-compile], -# [action-if-cant-compile]) -# ------------------------------------------------ -AC_DEFUN([MCA_orte_rml_ofi_CONFIG],[ - AC_CONFIG_FILES([orte/mca/rml/ofi/Makefile]) - - # ensure we already ran the common OFI libfabric config - AC_REQUIRE([MCA_opal_common_ofi_CONFIG]) - - AS_IF([test "$opal_common_ofi_happy" = "yes"], - [$1], - [$2]) -])dnl diff --git a/orte/mca/rml/ofi/rml_ofi.h b/orte/mca/rml/ofi/rml_ofi.h deleted file mode 100644 index 465d28c4841..00000000000 --- a/orte/mca/rml/ofi/rml_ofi.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_RML_OFI_RML_OFI_H -#define MCA_RML_OFI_RML_OFI_H - -#include "orte_config.h" - -#include "opal/dss/dss_types.h" -#include "opal/mca/event/event.h" -#include "opal/mca/pmix/pmix.h" -#include "orte/mca/rml/base/base.h" - -#include -#include -#include -#include -#include -#include - -#include "rml_ofi_request.h" - -/** the maximum open OFI ofi_prov - assuming system will have no more than 20 transports*/ -#define MAX_OFI_PROVIDERS 40 -#define RML_OFI_PROV_ID_INVALID 0xFF - -/** RML/OFI key values **/ -/* (char*) ofi socket address (type IN) of the node process is running on */ -#define OPAL_RML_OFI_FI_SOCKADDR_IN "rml.ofi.fisockaddrin" -/* (char*) ofi socket address (type PSM) of the node process is running on */ -#define OPAL_RML_OFI_FI_ADDR_PSMX "rml.ofi.fiaddrpsmx" - -// MULTI_BUF_SIZE_FACTOR defines how large the multi recv buffer will be. -// In order to use FI_MULTI_RECV feature efficiently, we need to have a -// large recv buffer so that we don't need to repost the buffer often to -// get the remaining data when the buffer is full -#define MULTI_BUF_SIZE_FACTOR 128 -#define MIN_MULTI_BUF_SIZE (1024 * 1024) - -#define OFIADDR "ofiaddr" - -#define CLOSE_FID(fd) \ - do { \ - int _ret = 0; \ - if (0 != (fd)) { \ - _ret = fi_close(&(fd)->fid); \ - fd = NULL; \ - if (0 != _ret) { \ - opal_output_verbose(10,orte_rml_base_framework.framework_output, \ - " %s - fi_close failed with error- %d", \ - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ret); \ - } \ - } \ - } while (0); - - -#define RML_OFI_RETRY_UNTIL_DONE(FUNC) \ - do { \ - do { \ - ret = FUNC; \ - if(OPAL_LIKELY(0 == ret)) {break;} \ - } while(-FI_EAGAIN == ret); \ - } while(0); - -BEGIN_C_DECLS - -struct orte_rml_ofi_module_t; - -/** This structure will hold the ep and all ofi objects for each transport -and also the corresponding fi_info -**/ -typedef struct { - - /** ofi provider ID **/ - uint8_t ofi_prov_id; - - /** fi_info for this transport */ - struct fi_info *fabric_info; - - /** Fabric Domain handle */ - struct fid_fabric *fabric; - - /** Access Domain handle */ - struct fid_domain *domain; - - /** Address vector handle */ - struct fid_av *av; - - /** Completion queue handle */ - struct fid_cq *cq; - - /** Endpoint to communicate on */ - struct fid_ep *ep; - - /** Endpoint name */ - char ep_name[FI_NAME_MAX]; - - /** Endpoint name length */ - size_t epnamelen; - - /** OFI memory region */ - struct fid_mr *mr_multi_recv; - - /** buffer for tx and rx */ - void *rxbuf; - - uint64_t rxbuf_size; - - /* event,fd associated with the cq */ - int fd; - - /*event associated with progress fn */ - opal_event_t progress_event; - bool progress_ev_active; - - struct fi_context rx_ctx1; - -} ofi_transport_ofi_prov_t; - - - struct orte_rml_ofi_module_t { - orte_rml_base_module_t api; - - /** current ofi transport id the component is using, this will be initialised - ** in the open_ofi_prov() call **/ - int cur_transport_id; - - /** Fabric info structure of all supported transports in system **/ - struct fi_info *fi_info_list; - - /** OFI ep and corr fi_info for all the transports (ofi_providers) **/ - ofi_transport_ofi_prov_t ofi_prov[MAX_OFI_PROVIDERS]; - - size_t min_ofi_recv_buf_sz; - - /** "Any source" address */ - fi_addr_t any_addr; - - /** number of ofi providers currently opened **/ - uint8_t ofi_prov_open_num; - - /** Unique message id for every message that is fragmented to be sent over OFI **/ - uint32_t cur_msgid; - - /* hashtable stores the peer addresses */ - opal_hash_table_t peers; - - opal_list_t recv_msg_queue_list; - opal_list_t queued_routing_messages; - opal_event_t *timer_event; - struct timeval timeout; -} ; -typedef struct orte_rml_ofi_module_t orte_rml_ofi_module_t; - -/* For every first send initiated to new peer - * select the peer provider, peer ep-addr, - * local provider and populate in orte_rml_ofi_peer_t instance. - * Insert this in hash table. - * */ -typedef struct { - opal_object_t super; - char* ofi_prov_name; /* peer (dest) provider chosen */ - void* ofi_ep; /* peer (dest) ep chosen */ - size_t ofi_ep_len; /* peer (dest) ep length */ - uint8_t src_prov_id; /* index of the local (src) provider used for this peer */ -} orte_rml_ofi_peer_t; -OBJ_CLASS_DECLARATION(orte_rml_ofi_peer_t); - -ORTE_MODULE_DECLSPEC extern orte_rml_component_t mca_rml_ofi_component; -extern orte_rml_ofi_module_t orte_rml_ofi; - -int orte_rml_ofi_send_buffer_nb(struct orte_rml_base_module_t *mod, - orte_process_name_t* peer, - struct opal_buffer_t* buffer, - orte_rml_tag_t tag, - orte_rml_buffer_callback_fn_t cbfunc, - void* cbdata); -int orte_rml_ofi_send_nb(struct orte_rml_base_module_t *mod, - orte_process_name_t* peer, - struct iovec* iov, - int count, - orte_rml_tag_t tag, - orte_rml_callback_fn_t cbfunc, - void* cbdata); - -/****************** INTERNAL OFI Functions*************/ -void free_ofi_prov_resources( int ofi_prov_id); -void print_provider_list_info (struct fi_info *fi ); -void print_provider_info (struct fi_info *cur_fi ); -int cq_progress_handler(int sd, short flags, void *cbdata); -int get_ofi_prov_id( opal_list_t *attributes); - -/** Send callback */ -int orte_rml_ofi_send_callback(struct fi_cq_data_entry *wc, - orte_rml_ofi_request_t*); - -/** Error callback */ -int orte_rml_ofi_error_callback(struct fi_cq_err_entry *error, - orte_rml_ofi_request_t*); - -/* OFI Recv handler */ -int orte_rml_ofi_recv_handler(struct fi_cq_data_entry *wc, uint8_t ofi_prov_id); - -bool user_override(void); -END_C_DECLS - -#endif diff --git a/orte/mca/rml/ofi/rml_ofi_component.c b/orte/mca/rml/ofi/rml_ofi_component.c deleted file mode 100644 index b0cc89b3e14..00000000000 --- a/orte/mca/rml/ofi/rml_ofi_component.c +++ /dev/null @@ -1,1191 +0,0 @@ -/* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include "opal/mca/base/base.h" -#include "opal/util/argv.h" -#include "opal/util/net.h" -#include "opal/util/output.h" -#include "opal/mca/backtrace/backtrace.h" -#include "opal/mca/event/event.h" - -#if OPAL_ENABLE_FT_CR == 1 -#include "orte/mca/rml/rml.h" -#include "orte/mca/state/state.h" -#endif -#include "orte/mca/rml/base/base.h" -#include "orte/mca/rml/rml_types.h" -#include "orte/mca/routed/routed.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/util/name_fns.h" -#include "orte/runtime/orte_globals.h" - -#include "rml_ofi.h" - - -static int rml_ofi_component_open(void); -static int rml_ofi_component_close(void); -static int rml_ofi_component_register(void); - -static int rml_ofi_component_init(void); -static orte_rml_base_module_t* open_conduit(opal_list_t *attributes); -static orte_rml_pathway_t* query_transports(void); - -/** - * component definition - */ -orte_rml_component_t mca_rml_ofi_component = { - /* First, the mca_base_component_t struct containing meta - information about the component itself */ - - .base = { - ORTE_RML_BASE_VERSION_3_0_0, - - .mca_component_name = "ofi", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - .mca_open_component = rml_ofi_component_open, - .mca_close_component = rml_ofi_component_close, - .mca_register_component_params = rml_ofi_component_register - }, - .data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - .priority = 10, - .open_conduit = open_conduit, - .query_transports = query_transports, - .close_conduit = NULL -}; - -/* Local variables */ -orte_rml_ofi_module_t orte_rml_ofi = { - .api = { - .component = (struct orte_rml_component_t*)&mca_rml_ofi_component, - .ping = NULL, - .send_nb = orte_rml_ofi_send_nb, - .send_buffer_nb = orte_rml_ofi_send_buffer_nb, - .purge = NULL - } -}; - -/* Local variables */ -static bool init_done = false; -static char *ofi_transports_supported = NULL; -static char *initial_ofi_transports_supported = NULL; -static bool ofi_desired = false; -static bool routing_desired = false; - -/* return true if user override for choice of ofi provider */ -bool user_override(void) -{ - if( 0 == strcmp(initial_ofi_transports_supported, ofi_transports_supported ) ) - return false; - else - return true; -} - -static int -rml_ofi_component_open(void) -{ - /* Initialise endpoint and all queues */ - - orte_rml_ofi.fi_info_list = NULL; - orte_rml_ofi.min_ofi_recv_buf_sz = MIN_MULTI_BUF_SIZE; - orte_rml_ofi.cur_msgid = 1; - orte_rml_ofi.cur_transport_id = RML_OFI_PROV_ID_INVALID; - orte_rml_ofi.ofi_prov_open_num = 0; - OBJ_CONSTRUCT(&orte_rml_ofi.peers, opal_hash_table_t); - opal_hash_table_init(&orte_rml_ofi.peers, 128); - OBJ_CONSTRUCT(&orte_rml_ofi.recv_msg_queue_list, opal_list_t); - - for( uint8_t ofi_prov_id=0; ofi_prov_id < MAX_OFI_PROVIDERS ; ofi_prov_id++) { - orte_rml_ofi.ofi_prov[ofi_prov_id].fabric = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].domain = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].av = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].cq = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].ep = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].ep_name[0] = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].epnamelen = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].mr_multi_recv = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf_size = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].progress_ev_active = false; - orte_rml_ofi.ofi_prov[ofi_prov_id].ofi_prov_id = RML_OFI_PROV_ID_INVALID; - } - - opal_output_verbose(10,orte_rml_base_framework.framework_output," from %s:%d rml_ofi_component_open()",__FILE__,__LINE__); - - if (!ORTE_PROC_IS_HNP && !ORTE_PROC_IS_DAEMON) { - return ORTE_ERROR; - } - if (!ofi_desired) { - return ORTE_ERROR; - } - return ORTE_SUCCESS; -} - - -void free_ofi_prov_resources( int ofi_prov_id) -{ - - int ret=0; - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - free_ofi_prov_resources() begin. OFI ofi_prov_id- %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ofi_prov_id); - if (orte_rml_ofi.ofi_prov[ofi_prov_id].ep) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - close ep",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - CLOSE_FID(orte_rml_ofi.ofi_prov[ofi_prov_id].ep); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].mr_multi_recv) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - close mr_multi_recv",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - CLOSE_FID(orte_rml_ofi.ofi_prov[ofi_prov_id].mr_multi_recv); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].cq) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - close cq",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - CLOSE_FID(orte_rml_ofi.ofi_prov[ofi_prov_id].cq); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].av) { - CLOSE_FID(orte_rml_ofi.ofi_prov[ofi_prov_id].av); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].domain) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - close domain",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - CLOSE_FID(orte_rml_ofi.ofi_prov[ofi_prov_id].domain); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].fabric) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - close fabric",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - fi_close((fid_t)orte_rml_ofi.ofi_prov[ofi_prov_id].fabric); - } - if (orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf) { - free(orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf); - } - - orte_rml_ofi.ofi_prov[ofi_prov_id].fabric = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].domain = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].av = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].cq = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].ep = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].ep_name[0] = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].epnamelen = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].rxbuf_size = 0; - orte_rml_ofi.ofi_prov[ofi_prov_id].fabric_info = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].mr_multi_recv = NULL; - orte_rml_ofi.ofi_prov[ofi_prov_id].ofi_prov_id = RML_OFI_PROV_ID_INVALID; - - - if( orte_rml_ofi.ofi_prov[ofi_prov_id].progress_ev_active) { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - deleting progress event", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - opal_event_del( &orte_rml_ofi.ofi_prov[ofi_prov_id].progress_event); - } - - return; -} - - -static int -rml_ofi_component_close(void) -{ - - int rc; - opal_object_t *value; - uint64_t key; - void *node; - uint8_t ofi_prov_id; - - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - rml_ofi_component_close() -begin, total open OFI providers = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),orte_rml_ofi.ofi_prov_open_num); - - if (orte_rml_ofi.fi_info_list) { - (void) fi_freeinfo(orte_rml_ofi.fi_info_list); - } - - /* Close endpoint and all queues */ - for (ofi_prov_id=0; ofi_prov_id < orte_rml_ofi.ofi_prov_open_num; ofi_prov_id++) { - free_ofi_prov_resources(ofi_prov_id); - } - - /* release all peers from the hash table */ - rc = opal_hash_table_get_first_key_uint64(&orte_rml_ofi.peers, &key, - (void **)&value, &node); - while (OPAL_SUCCESS == rc) { - if (NULL != value) { - OBJ_RELEASE(value); - } - rc = opal_hash_table_get_next_key_uint64 (&orte_rml_ofi.peers, &key, - (void **) &value, node, &node); - } - OBJ_DESTRUCT(&orte_rml_ofi.peers); - OPAL_LIST_DESTRUCT(&orte_rml_ofi.recv_msg_queue_list); - - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - rml_ofi_component_close() end",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - return ORTE_SUCCESS; -} - -static int rml_ofi_component_register(void) -{ - mca_base_component_t *component = &mca_rml_ofi_component.base; - - initial_ofi_transports_supported = "fabric,ethernet"; - ofi_transports_supported = strdup(initial_ofi_transports_supported); - mca_base_component_var_register(component, "transports", - "Comma-delimited list of transports to support (default=\"fabric,ethernet\"", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_2, - MCA_BASE_VAR_SCOPE_LOCAL, - &ofi_transports_supported); - - - ofi_desired = false; - mca_base_component_var_register(component, "desired", - "Use OFI for coll conduit", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_2, - MCA_BASE_VAR_SCOPE_LOCAL, - &ofi_desired); - - routing_desired = false; - mca_base_component_var_register(component, "routing", - "Route OFI messages", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_2, - MCA_BASE_VAR_SCOPE_LOCAL, - &routing_desired); - - return ORTE_SUCCESS; -} - -void print_provider_info (struct fi_info *cur_fi ) -{ - //Display all the details in the fi_info structure - opal_output_verbose(1,orte_rml_base_framework.framework_output, - " %s - Print_provider_info() ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " Provider name : %s",cur_fi->fabric_attr->prov_name); - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " Protocol : %s",fi_tostr(&cur_fi->ep_attr->protocol,FI_TYPE_PROTOCOL)); - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " EP Type : %s",fi_tostr(&cur_fi->ep_attr->type,FI_TYPE_EP_TYPE)); - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " address_format : %s",fi_tostr(&cur_fi->addr_format,FI_TYPE_ADDR_FORMAT)); -} - -void print_provider_list_info (struct fi_info *fi ) -{ - struct fi_info *cur_fi = fi; - int fi_count = 0; - //Display all the details in the fi_info structure - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %s - Print_provider_list_info() ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - while( NULL != cur_fi ) { - fi_count++; - opal_output_verbose(10,orte_rml_base_framework.framework_output, - " %d.\n",fi_count); - print_provider_info( cur_fi); - cur_fi = cur_fi->next; - } - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "Total # of providers supported is %d\n",fi_count); -} - -/* - * This returns all the supported transports in the system that support endpoint type RDM (reliable datagram) - * The providers returned is a list of type opal_valut_t holding opal_list_t - */ -static orte_rml_pathway_t* query_transports(void) -{ - - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s:%d OFI Query Interface not implemented",__FILE__,__LINE__); - return NULL; -} - - -/** - ofi_prov [in]: the ofi ofi_prov_id that triggered the progress fn - **/ -static int orte_rml_ofi_progress(ofi_transport_ofi_prov_t* prov) -{ - ssize_t ret; - int count=0; /* number of messages read and processed */ - struct fi_cq_data_entry wc = { 0 }; - struct fi_cq_err_entry error = { 0 }; - orte_rml_ofi_request_t *ofi_req; - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s orte_rml_ofi_progress called for OFI ofi_provid %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - /** - * Read the work completions from the CQ. - * From the completion's op_context, we get the associated OFI request. - * Call the request's callback. - */ - while (true) { - /* Read the cq - that triggered the libevent to call this progress fn. */ - ret = fi_cq_read(prov->cq, (void *)&wc, 1); - if (0 < ret) { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s cq read for OFI ofi_provid %d - wc.flags = %llx", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id, (long long unsigned int)wc.flags); - count++; - // check the flags to see if this is a send-completion or receive - if ( wc.flags & FI_SEND ) - { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Send completion received on OFI provider id %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - if (NULL != wc.op_context) { - /* get the context from the wc and call the message handler */ - ofi_req = TO_OFI_REQ(wc.op_context); - assert(ofi_req); - ret = orte_rml_ofi_send_callback(&wc, ofi_req); - if (ORTE_SUCCESS != ret) { - opal_output(orte_rml_base_framework.framework_output, - "Error returned by OFI send callback handler when a send completion was received on OFI prov: %zd", - ret); - } - } - } else if ( (wc.flags & FI_RECV) && (wc.flags & FI_MULTI_RECV) ) { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Received message on OFI ofi_prov_id %d - but buffer is consumed, need to repost", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - // reposting buffer - ret = fi_recv(orte_rml_ofi.ofi_prov[prov->ofi_prov_id].ep, - orte_rml_ofi.ofi_prov[prov->ofi_prov_id].rxbuf, - orte_rml_ofi.ofi_prov[prov->ofi_prov_id].rxbuf_size, - fi_mr_desc(orte_rml_ofi.ofi_prov[prov->ofi_prov_id].mr_multi_recv), - 0,&(prov->rx_ctx1)); - // call the receive message handler that will call the rml_base - ret = orte_rml_ofi_recv_handler(&wc, prov->ofi_prov_id); - if (ORTE_SUCCESS != ret) { - opal_output(orte_rml_base_framework.framework_output, - "Error returned by OFI Recv handler when handling the received message on the prov: %zd", - ret); - } - } else if ( wc.flags & FI_RECV ) { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Received message on OFI provider id %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - // call the receive message handler that will call the rml_base - ret = orte_rml_ofi_recv_handler(&wc, prov->ofi_prov_id); - if (ORTE_SUCCESS != ret) { - opal_output(orte_rml_base_framework.framework_output, - "Error returned by OFI Recv handler when handling the received message on the OFI prov: %zd", - ret); - } - } else if ( wc.flags & FI_MULTI_RECV ) { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Received buffer overrun message on OFI provider id %d - need to repost", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - // reposting buffer - ret = fi_recv(orte_rml_ofi.ofi_prov[prov->ofi_prov_id].ep, - orte_rml_ofi.ofi_prov[prov->ofi_prov_id].rxbuf, - orte_rml_ofi.ofi_prov[prov->ofi_prov_id].rxbuf_size, - fi_mr_desc(orte_rml_ofi.ofi_prov[prov->ofi_prov_id].mr_multi_recv), - 0,&(prov->rx_ctx1)); - if (ORTE_SUCCESS != ret) { - opal_output(orte_rml_base_framework.framework_output, - "Error returned by OFI when reposting buffer on the OFI prov: %zd", - ret); - } - }else { - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "CQ has unhandled completion event with FLAG wc.flags = 0x%llx", - (long long unsigned int)wc.flags); - } - } else if (ret == -FI_EAVAIL) { - /** - * An error occured and is being reported via the CQ. - * Read the error and forward it to the upper layer. - */ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s cq_read for OFI provider id %d returned error 0x%zx <%s>", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id, ret, - fi_strerror((int) -ret) ); - ret = fi_cq_readerr(prov->cq,&error,0); - if (0 > ret) { - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "Error returned from fi_cq_readerr: %zd", ret); - } - assert(error.op_context); - /* get the context from wc and call the error handler */ - ofi_req = TO_OFI_REQ(error.op_context); - assert(ofi_req); - ret = orte_rml_ofi_error_callback(&error, ofi_req); - if (ORTE_SUCCESS != ret) { - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "Error returned by request error callback: %zd", - ret); - } - break; - } else if (ret == -FI_EAGAIN){ - /** - * The CQ is empty. Return. - */ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s Empty cq for OFI provider id %d,exiting from ofi_progress()", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id ); - break; - } else { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s cq_read for OFI provider id %d returned error 0x%zx <%s>", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id, ret, - fi_strerror((int) -ret) ); - break; - } - } - return count; -} - - -/* - * call the ofi_progress() fn to read the cq - * - */ -int cq_progress_handler(int sd, short flags, void *cbdata) -{ - ofi_transport_ofi_prov_t* prov = (ofi_transport_ofi_prov_t*)cbdata; - int count; - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s cq_progress_handler called for OFI Provider id %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - prov->ofi_prov_id); - - /* call the progress fn to read the cq and process the message - * for the ofi provider */ - count = orte_rml_ofi_progress(prov); - return count; -} - - -/* - * Returns the number of ofi-providers available - */ -static int rml_ofi_component_init(void) -{ - int ret, fi_version; - struct fi_info *hints, *fabric_info; - struct fi_cq_attr cq_attr = {0}; - struct fi_av_attr av_attr = {0}; - uint8_t cur_ofi_prov; - opal_buffer_t modex, entry, *eptr; - - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s - Entering rml_ofi_component_init()",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - - if (init_done) { - return orte_rml_ofi.ofi_prov_open_num; - } - - - /** - * Hints to filter providers - * See man fi_getinfo for a list of all filters - * mode: Select capabilities MTL is prepared to support. - * In this case, MTL will pass in context into communication calls - * ep_type: reliable datagram operation - * caps: Capabilities required from the provider. - * Tag matching is specified to implement MPI semantics. - * msg_order: Guarantee that messages with same tag are ordered. - */ - - hints = fi_allocinfo(); - if (!hints) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: Could not allocate fi_info\n", - __FILE__, __LINE__); - return orte_rml_ofi.ofi_prov_open_num; - } - - /** - * Refine filter for additional capabilities - * endpoint type : Reliable datagram - * threading: Disable locking - * control_progress: enable async progress - */ - hints->mode = FI_CONTEXT; - hints->ep_attr->type = FI_EP_RDM; /* Reliable datagram */ - - hints->domain_attr->threading = FI_THREAD_UNSPEC; - hints->domain_attr->control_progress = FI_PROGRESS_AUTO; - hints->domain_attr->data_progress = FI_PROGRESS_AUTO; - hints->domain_attr->av_type = FI_AV_MAP; - - /** - * FI_VERSION provides binary backward and forward compatibility support - * Specify the version of OFI is coded to, the provider will select struct - * layouts that are compatible with this version. - */ - fi_version = FI_VERSION(1, 3); - - /** - * fi_getinfo: returns information about fabric services for reaching a - * remote node or service. this does not necessarily allocate resources. - * Pass NULL for name/service because we want a list of providers supported. - */ - ret = fi_getinfo(fi_version, /* OFI version requested */ - NULL, /* Optional name or fabric to resolve */ - NULL, /* Optional service name or port to request */ - 0ULL, /* Optional flag */ - hints, /* In: Hints to filter providers */ - &orte_rml_ofi.fi_info_list); /* Out: List of matching providers */ - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_getinfo failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - fi_freeinfo(hints); - return ORTE_ERROR; - } - - /* added for debug purpose - Print the provider info - print_transports_query(); - print_provider_list_info(orte_rml_ofi.fi_info_list); - */ - - /* create a buffer for constructing our modex blob */ - OBJ_CONSTRUCT(&modex, opal_buffer_t); - - /** create the OFI objects for each transport in the system - * (fi_info_list) and store it in the ofi_prov array **/ - orte_rml_ofi.ofi_prov_open_num = 0; // start the ofi_prov_id from 0 - for(fabric_info = orte_rml_ofi.fi_info_list; - NULL != fabric_info && orte_rml_ofi.ofi_prov_open_num < MAX_OFI_PROVIDERS; - fabric_info = fabric_info->next) - { - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s:%d beginning to add endpoint for OFI_provider_id=%d ",__FILE__,__LINE__, - orte_rml_ofi.ofi_prov_open_num); - print_provider_info(fabric_info); - cur_ofi_prov = orte_rml_ofi.ofi_prov_open_num; - orte_rml_ofi.ofi_prov[cur_ofi_prov].ofi_prov_id = orte_rml_ofi.ofi_prov_open_num ; - orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric_info = fabric_info; - - // set FI_MULTI_RECV flag for all recv operations - fabric_info->rx_attr->op_flags = FI_MULTI_RECV; - /** - * Open fabric - * The getinfo struct returns a fabric attribute struct that can be used to - * instantiate the virtual or physical network. This opens a "fabric - * provider". See man fi_fabric for details. - */ - - ret = fi_fabric(fabric_info->fabric_attr, /* In: Fabric attributes */ - &orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric, /* Out: Fabric handle */ - NULL); /* Optional context for fabric events */ - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_fabric failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric = NULL; - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - - /** - * Create the access domain, which is the physical or virtual network or - * hardware port/collection of ports. Returns a domain object that can be - * used to create endpoints. See man fi_domain for details. - */ - ret = fi_domain(orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric, /* In: Fabric object */ - fabric_info, /* In: Provider */ - &orte_rml_ofi.ofi_prov[cur_ofi_prov].domain, /* Out: Domain oject */ - NULL); /* Optional context for domain events */ - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_domain failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - orte_rml_ofi.ofi_prov[cur_ofi_prov].domain = NULL; - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /** - * Create a transport level communication endpoint. To use the endpoint, - * it must be bound to completion counters or event queues and enabled, - * and the resources consumed by it, such as address vectors, counters, - * completion queues, etc. - * see man fi_endpoint for more details. - */ - ret = fi_endpoint(orte_rml_ofi.ofi_prov[cur_ofi_prov].domain, /* In: Domain object */ - fabric_info, /* In: Provider */ - &orte_rml_ofi.ofi_prov[cur_ofi_prov].ep, /* Out: Endpoint object */ - NULL); /* Optional context */ - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_endpoint failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /** - * Save the maximum inject size. - */ - //orte_rml_ofi.max_inject_size = prov->tx_attr->inject_size; - - /** - * Create the objects that will be bound to the endpoint. - * The objects include: - * - completion queue for events - * - address vector of other endpoint addresses - * - dynamic memory-spanning memory region - */ - cq_attr.format = FI_CQ_FORMAT_DATA; - cq_attr.wait_obj = FI_WAIT_FD; - cq_attr.wait_cond = FI_CQ_COND_NONE; - ret = fi_cq_open(orte_rml_ofi.ofi_prov[cur_ofi_prov].domain, - &cq_attr, &orte_rml_ofi.ofi_prov[cur_ofi_prov].cq, NULL); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_cq_open failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /** - * The remote fi_addr will be stored in the ofi_endpoint struct. - * So, we use the AV in "map" mode. - */ - av_attr.type = FI_AV_MAP; - ret = fi_av_open(orte_rml_ofi.ofi_prov[cur_ofi_prov].domain, - &av_attr, &orte_rml_ofi.ofi_prov[cur_ofi_prov].av, NULL); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_av_open failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /** - * Bind the CQ and AV to the endpoint object. - */ - ret = fi_ep_bind(orte_rml_ofi.ofi_prov[cur_ofi_prov].ep, - (fid_t)orte_rml_ofi.ofi_prov[cur_ofi_prov].cq, - FI_SEND | FI_RECV); - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_bind CQ-EP failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - ret = fi_ep_bind(orte_rml_ofi.ofi_prov[cur_ofi_prov].ep, - (fid_t)orte_rml_ofi.ofi_prov[cur_ofi_prov].av, - 0); - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_bind AV-EP failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /** - * Enable the endpoint for communication - * This commits the bind operations. - */ - ret = fi_enable(orte_rml_ofi.ofi_prov[cur_ofi_prov].ep); - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_enable failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s:%d ep enabled for ofi_prov_id - %d ",__FILE__,__LINE__, - orte_rml_ofi.ofi_prov[cur_ofi_prov].ofi_prov_id); - - - /** - * Get our address and publish it with modex. - **/ - orte_rml_ofi.ofi_prov[cur_ofi_prov].epnamelen = sizeof (orte_rml_ofi.ofi_prov[cur_ofi_prov].ep_name); - ret = fi_getname((fid_t)orte_rml_ofi.ofi_prov[cur_ofi_prov].ep, - &orte_rml_ofi.ofi_prov[cur_ofi_prov].ep_name[0], - &orte_rml_ofi.ofi_prov[cur_ofi_prov].epnamelen); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_getname failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /* create the modex entry for this provider */ - OBJ_CONSTRUCT(&entry, opal_buffer_t); - /* pack the provider's name */ - if (OPAL_SUCCESS != (ret = opal_dss.pack(&entry, &(orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric_info->fabric_attr->prov_name), 1, OPAL_STRING))) { - OBJ_DESTRUCT(&entry); - free_ofi_prov_resources(cur_ofi_prov); - continue; - } - /* pack the provider's local index */ - if (OPAL_SUCCESS != (ret = opal_dss.pack(&entry, &cur_ofi_prov, 1, OPAL_UINT8))) { - OBJ_DESTRUCT(&entry); - free_ofi_prov_resources(cur_ofi_prov); - continue; - } - /* pack the size of the provider's connection blob */ - if (OPAL_SUCCESS != (ret = opal_dss.pack(&entry, &orte_rml_ofi.ofi_prov[cur_ofi_prov].epnamelen, 1, OPAL_SIZE))) { - OBJ_DESTRUCT(&entry); - free_ofi_prov_resources(cur_ofi_prov); - continue; - } - /* pack the blob itself */ - if (OPAL_SUCCESS != (ret = opal_dss.pack(&entry, orte_rml_ofi.ofi_prov[cur_ofi_prov].ep_name, - orte_rml_ofi.ofi_prov[cur_ofi_prov].epnamelen, OPAL_BYTE))) { - OBJ_DESTRUCT(&entry); - free_ofi_prov_resources(cur_ofi_prov); - continue; - } - /* add this entry to the overall modex object */ - eptr = &entry; - if (OPAL_SUCCESS != (ret = opal_dss.pack(&modex, &eptr, 1, OPAL_BUFFER))) { - OBJ_DESTRUCT(&entry); - free_ofi_prov_resources(cur_ofi_prov); - continue; - } - OBJ_DESTRUCT(&entry); - - /*print debug information on opal_modex_string */ - switch ( orte_rml_ofi.ofi_prov[cur_ofi_prov].fabric_info->addr_format) { - case FI_SOCKADDR_IN : - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s:%d In FI_SOCKADDR_IN. ",__FILE__,__LINE__); - /* Address is of type sockaddr_in (IPv4) */ - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s sending Opal modex string for ofi prov_id %d, epnamelen = %lu ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - cur_ofi_prov, orte_rml_ofi.ofi_prov[cur_ofi_prov].epnamelen); - /*[debug] - print the sockaddr - port and s_addr */ - struct sockaddr_in* ep_sockaddr = (struct sockaddr_in*)orte_rml_ofi.ofi_prov[cur_ofi_prov].ep_name; - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s port = 0x%x, InternetAddr = 0x%s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ntohs(ep_sockaddr->sin_port), inet_ntoa(ep_sockaddr->sin_addr)); - break; - } - - /** - * Set the ANY_SRC address. - */ - orte_rml_ofi.any_addr = FI_ADDR_UNSPEC; - - /** - * Allocate tx,rx buffers and Post a multi-RECV buffer for each endpoint - **/ - //[TODO later] For now not considering ep_attr prefix_size (add this later) - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf_size = MIN_MULTI_BUF_SIZE * MULTI_BUF_SIZE_FACTOR; - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf = malloc(orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf_size); - - ret = fi_mr_reg(orte_rml_ofi.ofi_prov[cur_ofi_prov].domain, - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf, - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf_size, - FI_RECV, 0, 0, 0, &orte_rml_ofi.ofi_prov[cur_ofi_prov].mr_multi_recv, - &orte_rml_ofi.ofi_prov[cur_ofi_prov].rx_ctx1); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_mr_reg failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - ret = fi_setopt(&orte_rml_ofi.ofi_prov[cur_ofi_prov].ep->fid, FI_OPT_ENDPOINT, FI_OPT_MIN_MULTI_RECV, - &orte_rml_ofi.min_ofi_recv_buf_sz, sizeof(orte_rml_ofi.min_ofi_recv_buf_sz) ); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_setopt failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - ret = fi_recv(orte_rml_ofi.ofi_prov[cur_ofi_prov].ep, - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf, - orte_rml_ofi.ofi_prov[cur_ofi_prov].rxbuf_size, - fi_mr_desc(orte_rml_ofi.ofi_prov[cur_ofi_prov].mr_multi_recv), - 0,&orte_rml_ofi.ofi_prov[cur_ofi_prov].rx_ctx1); - if (ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_recv failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - /** - * get the fd and register the progress fn - **/ - ret = fi_control(&orte_rml_ofi.ofi_prov[cur_ofi_prov].cq->fid, FI_GETWAIT, - (void *) &orte_rml_ofi.ofi_prov[cur_ofi_prov].fd); - if (0 != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s:%d: fi_control failed to get fd: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - free_ofi_prov_resources(cur_ofi_prov); - /* abort this current transport, but check if next transport can be opened */ - continue; - } - - /* - create the event that will wait on the fd*/ - /* use the opal_event_set to do a libevent set on the fd - * so when something is available to read, the cq_porgress_handler - * will be called */ - opal_event_set(orte_event_base, - &orte_rml_ofi.ofi_prov[cur_ofi_prov].progress_event, - orte_rml_ofi.ofi_prov[cur_ofi_prov].fd, - OPAL_EV_READ|OPAL_EV_PERSIST, - cq_progress_handler, - &orte_rml_ofi.ofi_prov[cur_ofi_prov]); - opal_event_add(&orte_rml_ofi.ofi_prov[cur_ofi_prov].progress_event, 0); - orte_rml_ofi.ofi_prov[cur_ofi_prov].progress_ev_active = true; - - /** update the number of ofi_provs in the ofi_prov[] array **/ - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s:%d ofi_prov id - %d created ",__FILE__,__LINE__,orte_rml_ofi.ofi_prov_open_num); - orte_rml_ofi.ofi_prov_open_num++; - } - if (fabric_info != NULL && orte_rml_ofi.ofi_prov_open_num >= MAX_OFI_PROVIDERS ) { - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s:%d fi_getinfo list not fully parsed as MAX_OFI_PROVIDERS - %d reached ",__FILE__,__LINE__,orte_rml_ofi.ofi_prov_open_num); - } - - /** - * Free providers info since it's not needed anymore. - */ - fi_freeinfo(hints); - hints = NULL; - /* check if at least one ofi_prov was successfully opened */ - if (0 < orte_rml_ofi.ofi_prov_open_num) { - uint8_t *data; - int32_t sz; - - opal_output_verbose(10,orte_rml_base_framework.framework_output, - "%s:%d ofi providers openened=%d returning orte_rml_ofi.api", - __FILE__,__LINE__,orte_rml_ofi.ofi_prov_open_num); - - OBJ_CONSTRUCT(&orte_rml_ofi.recv_msg_queue_list,opal_list_t); - /* post the modex object */ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s calling OPAL_MODEX_SEND_STRING for RML/OFI ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ret = opal_dss.unload(&modex, (void**)(&data), &sz); - OBJ_DESTRUCT(&modex); - if (OPAL_SUCCESS != ret) { - ORTE_ERROR_LOG(ret); - return ret; - } - OPAL_MODEX_SEND_STRING(ret, OPAL_PMIX_GLOBAL, - "rml.ofi", data, sz); - free(data); - if (OPAL_SUCCESS != ret) { - ORTE_ERROR_LOG(ret); - return ret; - } - } else { - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s:%d Failed to open any OFI Providers",__FILE__,__LINE__); - } - - return orte_rml_ofi.ofi_prov_open_num; -} - -/* return : the ofi_prov_id that corresponds to the transport requested by the attributes - if transport is not found RML_OFI_PROV_ID_INVALID is returned. - @[in]attributes : the attributes passed in to open_conduit reg the transport requested -*/ -int get_ofi_prov_id(opal_list_t *attributes) -{ - int ofi_prov_id = RML_OFI_PROV_ID_INVALID, prov_num=0; - char **providers = NULL, *provider; - struct fi_info *cur_fi; - char *comp_attrib = NULL; - char **comps; - int i; - bool choose_fabric= false; - - /* check the list of attributes in below order - * Attribute should have ORTE_RML_TRANSPORT_ATTRIB key - * with values "ethernet" or "fabric". "fabric" is higher priority. - * (or) ORTE_RML_OFI_PROV_NAME key with values "socket" or "OPA" - * if both above attributes are missing return failure - */ - //if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_ATTRIB, (void**)&transport, OPAL_STRING) ) { - - if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_TYPE, (void**)&comp_attrib, OPAL_STRING) && - NULL != comp_attrib) { - comps = opal_argv_split(comp_attrib, ','); - for (i=0; NULL != comps[i]; i++) { - if (NULL != strstr(ofi_transports_supported, comps[i])) { - if (0 == strcmp(comps[i], "ethernet")) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - user requested opening conduit using OFI ethernet/sockets provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - opal_argv_append_nosize(&providers, "sockets"); - } else if (0 == strcmp(comps[i], "fabric")) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - user requested opening conduit using OFI fabric provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - opal_argv_prepend_nosize(&providers, "fabric"); /* fabric is higher priority so prepend it */ - } - } - } - } - /* if from the transport we don't know which provider we want, then check for the ORTE_RML_OFI_PROV_NAME_ATTRIB */ - if (NULL == providers) { - if (orte_get_attribute(attributes, ORTE_RML_PROVIDER_ATTRIB, (void**)&provider, OPAL_STRING)) { - opal_argv_append_nosize(&providers, provider); - } else { - ofi_prov_id = RML_OFI_PROV_ID_INVALID; - } - } - if (NULL != providers) { - /* go down the list of preferences in order */ - for (i=0; NULL != providers[i] && RML_OFI_PROV_ID_INVALID == ofi_prov_id; i++) { - // if generic transport "fabric" is requested then choose first available non-socket provider - if (0 == strcmp(providers[i],"fabric")) - choose_fabric=true; - else - choose_fabric=false; - // loop the orte_rml_ofi.ofi_provs[] and see if someone matches - for (prov_num = 0; prov_num < orte_rml_ofi.ofi_prov_open_num; prov_num++ ) { - cur_fi = orte_rml_ofi.ofi_prov[prov_num].fabric_info; - if (choose_fabric) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - get_ofi_prov_id() -> comparing sockets != %s to choose first available fabric provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - cur_fi->fabric_attr->prov_name); - if (0 != strcmp("sockets", cur_fi->fabric_attr->prov_name)) { - ofi_prov_id = prov_num; - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - Choosing provider %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - cur_fi->fabric_attr->prov_name); - break; - } - } else { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - get_ofi_prov_id() -> comparing %s = %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - providers[i], cur_fi->fabric_attr->prov_name); - if (0 == strcmp(providers[i], cur_fi->fabric_attr->prov_name)) { - ofi_prov_id = prov_num; - opal_output_verbose(20,orte_rml_base_framework.framework_output, "%s - Choosing provider %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - cur_fi->fabric_attr->prov_name); - break; - } - } - } - } - } - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - get_ofi_prov_id(), returning ofi_prov_id=%d ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ofi_prov_id); - return ofi_prov_id; -} - -/* - * Allocate a new module and initialise ofi_prov information - * for the requested provider and return the module * - */ -static orte_rml_base_module_t* make_module( int ofi_prov_id) -{ - orte_rml_ofi_module_t *mod = NULL; - - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - rml_ofi make_module() begin ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - if (RML_OFI_PROV_ID_INVALID == ofi_prov_id) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - open_conduit did not select any ofi provider, returning NULL ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - return NULL; - } - - - /* create a new module */ - mod = (orte_rml_ofi_module_t*)calloc(1,sizeof(orte_rml_ofi_module_t)); - if (NULL == mod) { - ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); - return NULL; - } - /* copy the APIs over to it and the OFI provider information */ - memcpy(mod, &orte_rml_ofi, sizeof(orte_rml_ofi_module_t)); - /* setup the remaining data locations in mod, associate conduit with ofi provider selected*/ - mod->cur_transport_id = ofi_prov_id; - /* set the routed module */ - if (routing_desired) { - mod->api.routed = orte_routed.assign_module(NULL); - } else { - mod->api.routed = orte_routed.assign_module("direct"); - } - if (NULL == mod->api.routed) { - /* we can't work */ - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s - Failed to get%srouted support, disqualifying ourselves", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - routing_desired ? " " : " direct "); - free(mod); - return NULL; - } - return (orte_rml_base_module_t*)mod; -} - - -/* Order of attributes honoring * -* ORTE_RML_INCLUDE_COMP_ATTRIB * -* ORTE_RML_EXCLUDE_COMP_ATTRIB * -* ORTE_RML_TRANSPORT_ATTRIB * -* ORTE_RML_PROVIDER_ATTRIB */ -static orte_rml_base_module_t* open_conduit(opal_list_t *attributes) -{ - char *comp_attrib = NULL; - char **comps; - int i; - orte_attribute_t *attr; - - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - Entering rml_ofi_open_conduit()", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - /* Open all ofi endpoints */ - if (!init_done) { - rml_ofi_component_init(); - init_done = true; - } - - /* check if atleast 1 ofi provider is initialised */ - if ( 0 >= orte_rml_ofi.ofi_prov_open_num) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - Init did not open any Ofi endpoints, returning NULL", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - return NULL; - } - - /* someone may require this specific component, so look for "ofi" */ - if (orte_get_attribute(attributes, ORTE_RML_INCLUDE_COMP_ATTRIB, (void**)&comp_attrib, OPAL_STRING) && - NULL != comp_attrib) { - /* they specified specific components - could be multiple */ - comps = opal_argv_split(comp_attrib, ','); - for (i=0; NULL != comps[i]; i++) { - if (0 == strcmp(comps[i], "ofi")) { - /* we are a candidate, */ - opal_argv_free(comps); - return make_module(get_ofi_prov_id(attributes)); - } - } - /* we are not a candidate */ - opal_argv_free(comps); - return NULL; - } else if (orte_get_attribute(attributes, ORTE_RML_EXCLUDE_COMP_ATTRIB, (void**)&comp_attrib, OPAL_STRING) && - NULL != comp_attrib) { - /* see if we are on the list */ - comps = opal_argv_split(comp_attrib, ','); - for (i=0; NULL != comps[i]; i++) { - if (0 == strcmp(comps[i], "ofi")) { - /* we cannot be a candidate */ - opal_argv_free(comps); - return NULL; - } - } - } - - if (orte_get_attribute(attributes, ORTE_RML_TRANSPORT_TYPE, (void**)&comp_attrib, OPAL_STRING) && - NULL != comp_attrib) { - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - ORTE_RML_TRANSPORT_TYPE = %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), comp_attrib); - comps = opal_argv_split(comp_attrib, ','); - for (i=0; NULL != comps[i]; i++) { - if (NULL != strstr(ofi_transports_supported, comps[i])) { - /* we are a candidate, */ - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - Opening conduit using OFI.. ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - opal_argv_free(comps); - return make_module(get_ofi_prov_id(attributes)); - } - } - opal_argv_free(comps); - } - - /* Alternatively, check the attributes to see if we qualify - we only handle - * "pt2pt" */ - OPAL_LIST_FOREACH(attr, attributes, orte_attribute_t) { - /* [TODO] add any additional attributes check here */ - - } - opal_output_verbose(20,orte_rml_base_framework.framework_output, - "%s - ofi is not a candidate as per attributes, returning NULL", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - /* if we get here, we cannot handle it */ - return NULL; -} - -static void pr_cons(orte_rml_ofi_peer_t *ptr) -{ - ptr->ofi_prov_name = NULL; - ptr->ofi_ep = NULL; - ptr->ofi_ep_len = 0; - ptr->src_prov_id = RML_OFI_PROV_ID_INVALID; -} - -static void pr_des(orte_rml_ofi_peer_t *ptr) -{ - if ( NULL != ptr->ofi_prov_name) - free(ptr->ofi_prov_name); - if ( 0 < ptr->ofi_ep_len) - free( ptr->ofi_ep); -} - -OBJ_CLASS_INSTANCE(orte_rml_ofi_peer_t, - opal_object_t, - pr_cons, pr_des); diff --git a/orte/mca/rml/ofi/rml_ofi_request.h b/orte/mca/rml/ofi/rml_ofi_request.h deleted file mode 100644 index 54b8203ae84..00000000000 --- a/orte/mca/rml/ofi/rml_ofi_request.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2015 Intel, Inc. All rights reserved - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef ORTE_RML_OFI_REQUEST_H -#define ORTE_RML_OFI_REQUEST_H - - -#define TO_OFI_REQ(_ptr_ctx) \ - container_of((_ptr_ctx), orte_rml_ofi_request_t, ctx) - -typedef enum { - ORTE_RML_OFI_SEND, - ORTE_RML_OFI_RECV, - ORTE_RML_OFI_ACK, - ORTE_RML_OFI_PROBE -} orte_rml_ofi_request_type_t; -/* orte_rml_ofi_msg_header_t contains the header information for the message being sent. -The header and data is passed on to the destination. The destination will re-construct the -orte_rml_sent_t struct once it receives this header and data.This header has the required information -to construct the orte_rml_sent_t struct and also if the message is split into packets, -then the packet information - total number of packets and the current packet number. -*/ -struct orte_rml_ofi_msg_header_t{ - opal_process_name_t origin; // originator process id from the send message - opal_process_name_t dst; // Destination process id from the send message - uint32_t seq_num; // seq_num from the send message - orte_rml_tag_t tag; // tag from the send message - uint32_t msgid; // unique msgid added by ofi plugin to keep track of fragmented msgs - uint32_t tot_pkts; // total packets this msg will be fragmented into by ofi plugin - uint32_t cur_pkt_num; // current packet number - }; -typedef struct orte_rml_ofi_msg_header_t orte_rml_ofi_msg_header_t; - -/* -orte_rml_ofi_pkts_t defines the packets in the message. Each packet contains header information -and the data. Create a list of packets to hold the entire message. -*/ -typedef struct { - //list_item_t - opal_list_item_t super; - /* header + data size */ - size_t pkt_size; - //header + data - void *data; -}orte_rml_ofi_send_pkt_t; -OBJ_CLASS_DECLARATION(orte_rml_ofi_send_pkt_t); - -/* -orte_rml_ofi_recv_pkt_t defines the packets in the receiving end of message. -Each packet contains the packet number and the data. -Create a list of packets to hold the entire message. -*/ -typedef struct { - //list_item_t - opal_list_item_t super; - /* current packet number */ - uint32_t cur_pkt_num; - /*data size */ - size_t pkt_size; - //data - void *data; -}orte_rml_ofi_recv_pkt_t; -OBJ_CLASS_DECLARATION(orte_rml_ofi_recv_pkt_t); - -/* -orte_rml_ofi_request_t holds the send request (orte_rml_send_t) -*/ -typedef struct { - opal_object_t super; - - /** OFI context */ - struct fi_context ctx; - - orte_rml_send_t *send; - - /** OFI provider_id the request will use - this is - * the reference to element into the orte_rml_ofi.ofi_prov[] **/ - uint8_t ofi_prov_id; - - /** OFI Request type */ - orte_rml_ofi_request_type_t type; - - /** Completion count used by blocking and/or synchronous operations */ - volatile int completion_count; - - /** Reference to the RML used to lookup */ - /* source of an ANY_SOURCE Recv */ - struct orte_rml_base_module_t* rml; - - /** header being sent **/ - orte_rml_ofi_msg_header_t hdr; - - /** Pack buffer */ - void *data_blob; - - /** Pack buffer size */ - size_t length; - - /** Header and data in a list of Packets orte_rml_ofi_send_pkt_t */ - opal_list_t pkt_list; - -} orte_rml_ofi_request_t; -OBJ_CLASS_DECLARATION(orte_rml_ofi_request_t); - - -/* This will hold all the pckts received at the destination. -Each entry will be indexed by [sender,msgid] and will have -all the packets for that msgid and sender. -*/ -typedef struct { - - opal_list_item_t super; //list_item_t - uint32_t msgid; // unique msgid added by ofi plugin to keep track of fragmented msgs - opal_process_name_t sender; // originator process id from the send message - uint32_t tot_pkts; // total packets this msg will be fragmented into by ofi plugin - uint32_t pkt_recd; // current packet number - opal_list_t pkt_list; // list holding Packets in this msg of type orte_rml_ofi_recv_pkt_t -} ofi_recv_msg_queue_t; -OBJ_CLASS_DECLARATION( ofi_recv_msg_queue_t); - -/* define an object for transferring send requests to the event lib */ -typedef struct { - opal_object_t super; - opal_event_t ev; - orte_rml_send_t send; - /* ofi provider id */ - int ofi_prov_id; -} ofi_send_request_t; -OBJ_CLASS_DECLARATION(ofi_send_request_t); - -#endif diff --git a/orte/mca/rml/ofi/rml_ofi_send.c b/orte/mca/rml/ofi/rml_ofi_send.c deleted file mode 100644 index 99a143c925d..00000000000 --- a/orte/mca/rml/ofi/rml_ofi_send.c +++ /dev/null @@ -1,1052 +0,0 @@ -/* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2017 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include "opal/dss/dss_types.h" -#include "opal/util/net.h" -#include "opal/util/output.h" -#include "opal/mca/event/event.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/rml/base/base.h" -#include "orte/mca/rml/rml_types.h" - -#include -#include -#include -#include -#include -#include - -#include "rml_ofi.h" - -static void ofi_req_cons(orte_rml_ofi_request_t *ptr) -{ - OBJ_CONSTRUCT(&ptr->pkt_list, opal_list_t); -} -static void ofi_req_des(orte_rml_ofi_request_t *ptr) -{ - OPAL_LIST_DESTRUCT(&ptr->pkt_list); -} -OBJ_CLASS_INSTANCE(orte_rml_ofi_request_t, - opal_object_t, - ofi_req_cons, ofi_req_des); - - -static void ofi_send_req_cons(ofi_send_request_t *ptr) -{ - OBJ_CONSTRUCT(&ptr->send, orte_rml_send_t); -} -OBJ_CLASS_INSTANCE(ofi_send_request_t, - opal_object_t, - ofi_send_req_cons, NULL); - -OBJ_CLASS_INSTANCE(orte_rml_ofi_send_pkt_t, - opal_list_item_t, - NULL, NULL); - -OBJ_CLASS_INSTANCE(orte_rml_ofi_recv_pkt_t, - opal_list_item_t, - NULL, NULL); - - -static void ofi_recv_msg_queue_cons(ofi_recv_msg_queue_t *ptr) -{ - ptr->msgid = 0; - ptr->tot_pkts = 1; - ptr->pkt_recd = 0; - OBJ_CONSTRUCT(&ptr->pkt_list, opal_list_t); -} -static void ofi_recv_msg_queue_des(ofi_recv_msg_queue_t *ptr) -{ - OPAL_LIST_DESTRUCT(&ptr->pkt_list); -} -OBJ_CLASS_INSTANCE(ofi_recv_msg_queue_t, - opal_list_item_t, - ofi_recv_msg_queue_cons, ofi_recv_msg_queue_des); - -static void send_self_exe(int fd, short args, void* data) -{ - orte_self_send_xfer_t *xfer = (orte_self_send_xfer_t*)data; - - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml_send_to_self ofi callback executing for tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), xfer->tag); - - /* execute the send callback function - note that - * send-to-self always returns a SUCCESS status - */ - if (NULL != xfer->iov) { - if (NULL != xfer->cbfunc.iov) { - /* non-blocking iovec send */ - xfer->cbfunc.iov(ORTE_SUCCESS, ORTE_PROC_MY_NAME, xfer->iov, xfer->count, - xfer->tag, xfer->cbdata); - } - } else if (NULL != xfer->buffer) { - if (NULL != xfer->cbfunc.buffer) { - /* non-blocking buffer send */ - xfer->cbfunc.buffer(ORTE_SUCCESS, ORTE_PROC_MY_NAME, xfer->buffer, - xfer->tag, xfer->cbdata); - } - } else { - /* should never happen */ - abort(); - } - - /* cleanup the memory */ - OBJ_RELEASE(xfer); -} - -/** Send callback */ -/* [Desc] This is called from the progress fn when a send completion -** is received in the cq -** wc [in] : the completion queue data entry -** ofi_send_req [in]: ofi send request with the send msg and callback -*/ -int orte_rml_ofi_send_callback(struct fi_cq_data_entry *wc, - orte_rml_ofi_request_t* ofi_req) -{ - orte_rml_ofi_send_pkt_t *ofi_send_pkt, *next; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s orte_rml_ofi_send_callback called, completion count = %d, msgid = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_req->completion_count, ofi_req->hdr.msgid); - assert(ofi_req->completion_count > 0); - ofi_req->completion_count--; - if ( 0 == ofi_req->completion_count ) { - // call the callback fn of the sender - ofi_req->send->status = ORTE_SUCCESS; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s calling ORTE_RML_SEND_COMPLETE macro for msgid = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_req->hdr.msgid); - ORTE_RML_SEND_COMPLETE(ofi_req->send); - OPAL_LIST_FOREACH_SAFE(ofi_send_pkt, next, &ofi_req->pkt_list, orte_rml_ofi_send_pkt_t) { - free( ofi_send_pkt->data); - ofi_send_pkt->pkt_size=0; - opal_list_remove_item(&ofi_req->pkt_list, &ofi_send_pkt->super); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Removed pkt from list ",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - OBJ_RELEASE(ofi_send_pkt); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Released packet ",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - } - free(ofi_req->data_blob); - OBJ_RELEASE(ofi_req); - } - - // [TODO] need to check for error before returning success - return ORTE_SUCCESS; -} - -/** Error callback */ -/* [Desc] This is called from the progress fn when a send completion -** is received in the cq -** wc [in] : the completion queue data entry -** ofi_send_req [in]: ofi send request with the send msg and callback -*/ -int orte_rml_ofi_error_callback(struct fi_cq_err_entry *error, - orte_rml_ofi_request_t* ofi_req) -{ - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s orte_rml_ofi_error_callback called ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - switch(error->err) { - default: - /* call the send-callback fn with error and return, also return failure status */ - ofi_req->send->status = ORTE_ERR_CONDUIT_SEND_FAIL; - ORTE_RML_SEND_COMPLETE(ofi_req->send); - } - return ORTE_SUCCESS; -} - -/** Recv handler */ -/* [Desc] This is called from the progress fn when a recv completion -** is received in the cq -** wc [in] : the completion queue data entry */ -int orte_rml_ofi_recv_handler(struct fi_cq_data_entry *wc, uint8_t ofi_prov_id) -{ - orte_rml_ofi_msg_header_t msg_hdr; - uint32_t msglen, datalen = 0; - char *data, *totdata, *nextpkt; - ofi_recv_msg_queue_t *recv_msg_queue, *new_msg; - orte_rml_ofi_recv_pkt_t *ofi_recv_pkt, *new_pkt, *next; - bool msg_in_queue = false; - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s orte_rml_ofi_recv_handler called ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - /*copy the header and data from buffer and pass it on - ** since this is the ofi_prov recv buffer don't want it to be released as - ** considering re-using it, so for now copying to newly allocated *data - ** the *data will be released by orte_rml_base functions */ - - memcpy(&msg_hdr,wc->buf,sizeof(orte_rml_ofi_msg_header_t)); - msglen = wc->len - sizeof(orte_rml_ofi_msg_header_t); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Received packet -> msg id = %d wc->len = %lu, msglen = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.msgid, wc->len, msglen ); - data = (char *)malloc(msglen); - memcpy(data,((char *)wc->buf+sizeof(orte_rml_ofi_msg_header_t)),msglen); - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s header info of received packet -> cur_pkt_num = %d, tot_pkts = %d ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.cur_pkt_num, msg_hdr.tot_pkts ); - /* To accomodate message bigger than recv buffer size, - check if current message is in multiple blocks and append them before sending it to RML */ - if ( msg_hdr.tot_pkts == 1) { - /* Since OFI is point-to-point, no need to check if the intended destination is me - send to RML */ - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Posting Recv for msgid %d, from peer - %s , Tag = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.msgid, ORTE_NAME_PRINT(&msg_hdr.origin),msg_hdr.tag ); - ORTE_RML_POST_MESSAGE(&msg_hdr.origin, msg_hdr.tag, msg_hdr.seq_num,data,msglen); - } else { - msg_in_queue = false; - new_pkt = OBJ_NEW(orte_rml_ofi_recv_pkt_t); - new_pkt->cur_pkt_num = msg_hdr.cur_pkt_num; - new_pkt->pkt_size = msglen; - new_pkt->data = data; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Just beofe checking if this message-pkt is already in queue. msgid-%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.msgid ); - /* check if the queue has the [msgid,sender] entry */ - OPAL_LIST_FOREACH(recv_msg_queue, &orte_rml_ofi.recv_msg_queue_list, ofi_recv_msg_queue_t) { - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Checking msgid-%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid ); - if( (recv_msg_queue->msgid == msg_hdr.msgid) && (recv_msg_queue->sender.jobid == msg_hdr.origin.jobid) - && (recv_msg_queue->sender.vpid == msg_hdr.origin.vpid) ) { - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Found Msg entry in queue for msgid %d, sender jobid=%d, sender vpid=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, recv_msg_queue->sender.jobid, recv_msg_queue->sender.vpid); - msg_in_queue = true; - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s msgid %d, tot_pkts=%d, opal_list_get_size()=%lu,total pkt_recd=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, recv_msg_queue->tot_pkts, - opal_list_get_size(&recv_msg_queue->pkt_list), recv_msg_queue->pkt_recd ); - if( recv_msg_queue->tot_pkts == (recv_msg_queue->pkt_recd +1) ) { - /* all packets received for this message - post message to rml and remove this from queue */ - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s All packets recd for msgid %d, tot_pkts=%d, opal_list_get_size()=%lu,total pkt_recd=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, recv_msg_queue->tot_pkts, - opal_list_get_size(&recv_msg_queue->pkt_list), recv_msg_queue->pkt_recd ); - totdata = NULL; - datalen = 0; - OPAL_LIST_FOREACH(ofi_recv_pkt, &recv_msg_queue->pkt_list, orte_rml_ofi_recv_pkt_t) { - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Adding data for packet %d, pktlength = %lu, cumulative datalen so far = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_recv_pkt->cur_pkt_num, ofi_recv_pkt->pkt_size, datalen ); - if (0 == datalen) { - if (NULL != totdata) { - free(totdata); - } - totdata = (char *)malloc(ofi_recv_pkt->pkt_size); - if( totdata == NULL) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s Error: malloc failed for msgid %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),recv_msg_queue->msgid ); - return 1; //[TODO: error-handling needs to be implemented - } - memcpy(totdata,ofi_recv_pkt->data,ofi_recv_pkt->pkt_size); - - } else { - totdata = realloc(totdata,datalen+ofi_recv_pkt->pkt_size); - if (NULL != totdata ) { - memcpy((totdata+datalen),ofi_recv_pkt->data,ofi_recv_pkt->pkt_size); - } else { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s Error: realloc failed for msgid %d, from sender jobid=%d, sender vpid=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, recv_msg_queue->sender.jobid, - recv_msg_queue->sender.vpid); - return 1; //[TODO: error-handling needs to be implemented - } - } - datalen += ofi_recv_pkt->pkt_size; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s packet %d done, datalen = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_recv_pkt->cur_pkt_num,datalen); - } - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Adding leftover data recd, datalen = %d, new_pkt->pkt_size = %lu", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), datalen, new_pkt->pkt_size); - //add the last packet - totdata =realloc(totdata,datalen+new_pkt->pkt_size); - if( NULL != totdata ) { - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Realloc completed for leftover data recd, datalen = %d, new->pkt->pkt_size = %lu", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), datalen, new_pkt->pkt_size); - nextpkt = totdata+datalen; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s totdata = %p,nextpkt = %p ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (void *)totdata, (void *)nextpkt); - memcpy(nextpkt,new_pkt->data,new_pkt->pkt_size); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s memcpy completed for leftover data recd, datalen = %d, new->pkt->pkt_size = %lu", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), datalen, new_pkt->pkt_size); - datalen += new_pkt->pkt_size; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Posting Recv for msgid %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.msgid ); - ORTE_RML_POST_MESSAGE(&msg_hdr.origin, msg_hdr.tag, msg_hdr.seq_num,totdata,datalen);\ - - // free the pkts - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s msgid %d - posting recv completed, freeing packets", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), msg_hdr.msgid ); - OPAL_LIST_FOREACH_SAFE(ofi_recv_pkt, next, &recv_msg_queue->pkt_list, orte_rml_ofi_recv_pkt_t) { - free( ofi_recv_pkt->data); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s freed data for packet %d",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_recv_pkt->cur_pkt_num ); - ofi_recv_pkt->pkt_size=0; - opal_list_remove_item(&recv_msg_queue->pkt_list, &ofi_recv_pkt->super); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Removed pkt from list ",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - OBJ_RELEASE(ofi_recv_pkt); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Released packet ",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - } - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s freeing packets completed",ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - //free the msg from the queue-list - opal_list_remove_item(&orte_rml_ofi.recv_msg_queue_list,&recv_msg_queue->super); - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Successfully removed msg from queue", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - OBJ_RELEASE(recv_msg_queue); - } else { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s Error: realloc failed for msgid %d, from sender jobid=%d, sender vpid=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, recv_msg_queue->sender.jobid, - recv_msg_queue->sender.vpid); - return 1; //[TODO: error-handling needs to be implemented - } - } else { - /* add this packet to the msg in the queue ordered by cur_pkt_num */ - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Adding packet to list, msgid %d, pkt - %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), recv_msg_queue->msgid, msg_hdr.cur_pkt_num ); - - bool pkt_added = false; - OPAL_LIST_FOREACH(ofi_recv_pkt, &recv_msg_queue->pkt_list, orte_rml_ofi_recv_pkt_t) { - if( msg_hdr.cur_pkt_num < ofi_recv_pkt->cur_pkt_num ) { - opal_list_insert_pos(&recv_msg_queue->pkt_list, (opal_list_item_t*)ofi_recv_pkt, &new_pkt->super); - recv_msg_queue->pkt_recd++; - pkt_added = true; - break; - } - } - if (!pkt_added) { - opal_list_append(&recv_msg_queue->pkt_list,&new_pkt->super); - recv_msg_queue->pkt_recd++; - } - } - } - break; //we found the msg or added it so exit out of the msg_queue loop - } - if( !msg_in_queue ) { - /*add to the queue as this is the first packet for [msgid,sender] */ - new_msg = OBJ_NEW(ofi_recv_msg_queue_t); - new_msg->msgid = msg_hdr.msgid; - new_msg->sender = msg_hdr.origin; - new_msg->tot_pkts = msg_hdr.tot_pkts; - new_msg->pkt_recd = 1; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Adding first Msg entry in queue for msgid %d, sender jobid=%d, sender vpid=%d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), new_msg->msgid, new_msg->sender.jobid, new_msg->sender.vpid); - opal_list_append(&new_msg->pkt_list, &new_pkt->super); - opal_list_append(&orte_rml_ofi.recv_msg_queue_list, &new_msg->super); - - } - } - return ORTE_SUCCESS; -} - -/* populate_peer_ofi_addr - * [Desc] This fn does a PMIx Modex recv on "rml.ofi" key - * to get the ofi address blob of all providers on the peer. - * Then it populates the array parameter peer_ofi_addr[] - * with providername, ofi_ep_name and ofi_ep_namelen - * [in] peer -> peer address - * [out] peer_ofi_addr[] -> array to hold the provider details on the peer - * [Return value] -> total providers on success. OPAL_ERROR if fails to load array. - */ -static int populate_peer_ofi_addr(orte_process_name_t *peer, orte_rml_ofi_peer_t *peer_ofi_addr ) -{ - - uint8_t *data; - int32_t sz, cnt; - opal_buffer_t modex, *entry; - char *prov_name; - uint8_t prov_num; - size_t entrysize; - uint8_t *bytes; - uint8_t tot_prov=0,cur_prov; - int ret = OPAL_ERROR; - - OPAL_MODEX_RECV_STRING(ret, "rml.ofi", peer, (void**)&data, &sz); - if (OPAL_SUCCESS != ret) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::populate_peer_ofi_addr() Modex_Recv Failed for peer %s. ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(peer)); - return OPAL_ERROR; - } - - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::populate_peer_ofi_addr() Modex_Recv Succeeded. ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - /* load the data into a buffer for unpacking */ - OBJ_CONSTRUCT(&modex, opal_buffer_t); - opal_dss.load(&modex, data, sz); - cnt = 1; - /* cycle thru the returned providers and see which one we want to use */ - for(cur_prov=0;OPAL_SUCCESS == (ret = opal_dss.unpack(&modex, &entry, &cnt, OPAL_BUFFER));cur_prov++) { - /* unpack the provider name */ - cnt = 1; - if (OPAL_SUCCESS != (ret = opal_dss.unpack(entry, &prov_name, &cnt, OPAL_STRING))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(entry); - break; - } - /* unpack the provider's index on the remote peer - note that there - * is no guarantee that the same provider has the same local index! */ - cnt = 1; - if (OPAL_SUCCESS != (ret = opal_dss.unpack(entry, &prov_num, &cnt, OPAL_UINT8))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(entry); - break; - } - /* unpack the size of their connection blob */ - cnt = 1; - if (OPAL_SUCCESS != (ret = opal_dss.unpack(entry, &entrysize, &cnt, OPAL_SIZE))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(entry); - break; - } - /* create the necessary space */ - bytes = (uint8_t*)malloc(entrysize); - /* unpack the connection blob */ - cnt = entrysize; - if (OPAL_SUCCESS != (ret = opal_dss.unpack(entry, bytes, &cnt, OPAL_BYTE))) { - ORTE_ERROR_LOG(ret); - OBJ_RELEASE(entry); - break; - } - /* done with the buffer */ - OBJ_RELEASE(entry); - peer_ofi_addr[cur_prov].ofi_prov_name = prov_name; - peer_ofi_addr[cur_prov].ofi_ep = bytes; - peer_ofi_addr[cur_prov].ofi_ep_len = entrysize; - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:populate_peer_ofi_addr() Unpacked peer provider %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),peer_ofi_addr[cur_prov].ofi_prov_name); - } - OBJ_DESTRUCT(&modex); // releases the data returned by the modex_recv - tot_prov=cur_prov; - return tot_prov; -} - - -/* check_provider_in_peer(prov_name, peer_ofi_addr) - * [Desc] This fn checks for a match of prov_name in the peer_ofi_addr array - * and returns the index of the match or OPAL_ERROR if not found. - * The peer_ofi_addr array has all the ofi providers in peer. - * [in] prov_name -> The provider name we want to use to send this message to peer. - * [in] tot_prov -> total provider entries in array - * [in] peer_ofi_addr[] -> array of provider details on the peer - * [in] local_ofi_prov_idx -> the index of local provider we are comparing with - * (index into orte_rml_ofi.ofi_prov[] array. - * [Return value] -> index that matches provider on success. OPAL_ERROR if no match found. - */ -static int check_provider_in_peer( char *prov_name, int tot_prov, orte_rml_ofi_peer_t *peer_ofi_addr, int local_ofi_prov_idx ) -{ - int idx; - int ret = OPAL_ERROR; - - for( idx=0; idx < tot_prov; idx++) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:check_provider_in_peer() checking peer provider %s to match %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),peer_ofi_addr[idx].ofi_prov_name,prov_name); - if ( 0 == strcmp(prov_name, peer_ofi_addr[idx].ofi_prov_name) ) { - /* we found a matching provider on peer */ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:check_provider_in_peer() matched provider %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),peer_ofi_addr[idx].ofi_prov_name); - if ( 0 == strcmp(prov_name, "sockets") ) { - /* check if the address is reachable */ - struct sockaddr_in *ep_sockaddr, *ep_sockaddr2; - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:check_provider_in_peer() checking if sockets provider is reachable ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ep_sockaddr = (struct sockaddr_in*)peer_ofi_addr[idx].ofi_ep; - ep_sockaddr2 = (struct sockaddr_in*)orte_rml_ofi.ofi_prov[local_ofi_prov_idx].ep_name; - if (opal_net_samenetwork((struct sockaddr*)ep_sockaddr, (struct sockaddr*)ep_sockaddr2, 24)) { - /* we found same ofi provider reachable via ethernet on peer so return this idx*/ - ret = idx; - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:check_provider_in_peer() sockets provider is reachable ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - break; - } - } else { - ret = idx; - break; - } - } - } - return ret; -} - -static void send_msg(int fd, short args, void *cbdata) -{ - ofi_send_request_t *req = (ofi_send_request_t*)cbdata; - orte_process_name_t *peer = &(req->send.dst); - orte_rml_tag_t tag = req->send.tag; - char *dest_ep_name; - size_t dest_ep_namelen = 0; - int ret = OPAL_ERROR, rc; - uint32_t total_packets; - fi_addr_t dest_fi_addr; - orte_rml_send_t *snd; - orte_rml_ofi_request_t* ofi_send_req = OBJ_NEW( orte_rml_ofi_request_t ); - uint8_t ofi_prov_id = req->ofi_prov_id; - orte_rml_ofi_send_pkt_t* ofi_msg_pkt; - size_t datalen_per_pkt, hdrsize, data_in_pkt; // the length of data in per packet excluding the header size - orte_rml_ofi_peer_t* pr; - uint64_t ui64; - struct sockaddr_in* ep_sockaddr; - - snd = OBJ_NEW(orte_rml_send_t); - snd->dst = *peer; - snd->origin = *ORTE_PROC_MY_NAME; - snd->tag = tag; - if (NULL != req->send.iov) { - snd->iov = req->send.iov; - snd->count = req->send.count; - snd->cbfunc.iov = req->send.cbfunc.iov; - } else { - snd->buffer = req->send.buffer; - snd->cbfunc.buffer = req->send.cbfunc.buffer; - } - snd->cbdata = req->send.cbdata; - - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s send_msg_transport to peer %s at tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer), tag); - - /* get the peer address from our internal hash table */ - memcpy(&ui64, (char*)peer, sizeof(uint64_t)); - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s getting contact info for DAEMON peer %s from internal hash table", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(peer)); - if (OPAL_SUCCESS != (ret = opal_hash_table_get_value_uint64(&orte_rml_ofi.peers, - ui64, (void**)&pr) || NULL == pr)) { - orte_rml_ofi_peer_t peer_ofi_addr[MAX_OFI_PROVIDERS]; - int tot_peer_prov=0, peer_prov_id=ofi_prov_id; - bool peer_match_found=false; - - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi:Send peer OFI contact info not found in internal hash - checking modex", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - /* Do Modex_recv and populate the peer's providers and ofi ep address in peer_ofi_addr[] array */ - if( OPAL_ERROR == ( tot_peer_prov = populate_peer_ofi_addr( peer, peer_ofi_addr ))) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Error when Populating peer ofi_addr array ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - snd->status = ORTE_ERR_ADDRESSEE_UNKNOWN; - ORTE_RML_SEND_COMPLETE(snd); - //OBJ_RELEASE( ofi_send_req); - return ; - } - /* decide the provider we want to use from the list of providers in peer as per below order. - * 1. if the user specified the transport for this conduit (even giving us a prioritized list of candidates), - * then the one we selected is the _only_ one we will use. If the remote peer has a matching endpoint, - * then we use it - otherwise, we error out - * 2. if the user did not specify a transport, then we look for matches against _all_ of - * our available transports, starting with fabric and then going to Ethernet, taking the first one that matches. - * 3. if we cannot find any match, then we error out - */ - if ( true == user_override() ) { - /*case 1. User has specified the provider, find a match in peer for the current selected provider or error out*/ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Case1. looking for a match for current provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - if( OPAL_ERROR == ( peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[ofi_prov_id].fabric_info->fabric_attr->prov_name, - tot_peer_prov, peer_ofi_addr, ofi_prov_id ) )) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Peer is Unreachable - no common ofi provider ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - snd->status = ORTE_ERR_ADDRESSEE_UNKNOWN; - ORTE_RML_SEND_COMPLETE(snd); - //OBJ_RELEASE( ofi_send_req); - return ; - } - peer_match_found = true; - } else { - /* case 2. look for any matching fabric (other than ethernet) provider */ - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Case 2 - looking for any match for fabric provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - for(int cur_prov_id=0; cur_prov_id < orte_rml_ofi.ofi_prov_open_num && !peer_match_found ; cur_prov_id++) { - if( 0 != strcmp( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, "sockets" ) ) { - peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, - tot_peer_prov, peer_ofi_addr, cur_prov_id ); - if (OPAL_ERROR != peer_prov_id) { - peer_match_found = true; - ofi_prov_id = cur_prov_id; - } - } - } - /* if we haven't found a common provider for local node and peer to send message yet, check for ethernet */ - if(!peer_match_found) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Case 2 - common fabric to peer not found,looking for ethernet provider", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - } - for(int cur_prov_id=0; cur_prov_id < orte_rml_ofi.ofi_prov_open_num && !peer_match_found ; cur_prov_id++) { - if( 0 == strcmp( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, "sockets" ) ) { - peer_prov_id = check_provider_in_peer( orte_rml_ofi.ofi_prov[cur_prov_id].fabric_info->fabric_attr->prov_name, - tot_peer_prov, peer_ofi_addr, cur_prov_id ); - if (OPAL_ERROR != peer_prov_id) { - peer_match_found = true; - ofi_prov_id = cur_prov_id; - } - } - } - /* if we haven't found a common provider yet, then error out - case 3 */ - if ( !peer_match_found ) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi::send_msg() Peer is Unreachable - no common ofi provider ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - snd->status = ORTE_ERR_ADDRESSEE_UNKNOWN; - ORTE_RML_SEND_COMPLETE(snd); - //OBJ_RELEASE( ofi_send_req); - return ; - } - } - /* creating a copy of the chosen provider to put it in hashtable - * as the ofi_peer_addr array is local */ - pr = OBJ_NEW(orte_rml_ofi_peer_t); - pr->ofi_ep_len = peer_ofi_addr[peer_prov_id].ofi_ep_len; - pr->ofi_ep = malloc(pr->ofi_ep_len); - memcpy(pr->ofi_ep,peer_ofi_addr[peer_prov_id].ofi_ep,pr->ofi_ep_len); - pr->ofi_prov_name = strdup(peer_ofi_addr[peer_prov_id].ofi_prov_name); - pr->src_prov_id = ofi_prov_id; - if(OPAL_SUCCESS != - (rc = opal_hash_table_set_value_uint64(&orte_rml_ofi.peers, ui64, (void*)pr))) { - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s: ofi address insertion into hash table failed for peer %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer)); - ORTE_ERROR_LOG(rc); - } - dest_ep_name = pr->ofi_ep; - dest_ep_namelen = pr->ofi_ep_len; - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi: Peer ofi provider details added to hash table. Sending to provider %s on peer %s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),pr->ofi_prov_name,ORTE_NAME_PRINT(peer)); - } else { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s rml:ofi: OFI peer contact info got from hash table", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - dest_ep_name = pr->ofi_ep; - dest_ep_namelen = pr->ofi_ep_len; - ofi_prov_id = pr->src_prov_id; - } - - //[Debug] printing additional info of IP - switch ( orte_rml_ofi.ofi_prov[ofi_prov_id].fabric_info->addr_format) - { - case FI_SOCKADDR_IN : - /* Address is of type sockaddr_in (IPv4) */ - /*[debug] - print the sockaddr - port and s_addr */ - ep_sockaddr = (struct sockaddr_in*)dest_ep_name; - opal_output_verbose(1,orte_rml_base_framework.framework_output, - "%s peer %s epnamelen is %lu, port = %d (or) 0x%x, InternetAddr = 0x%s ", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ORTE_NAME_PRINT(peer), - (unsigned long)orte_rml_ofi.ofi_prov[ofi_prov_id].epnamelen,ntohs(ep_sockaddr->sin_port), - ntohs(ep_sockaddr->sin_port),inet_ntoa(ep_sockaddr->sin_addr)); - /*[end debug]*/ - break; - } - //[Debug] end debug - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s peer ep name obtained for %s. length=%lu", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer), dest_ep_namelen); - ret = fi_av_insert(orte_rml_ofi.ofi_prov[ofi_prov_id].av, dest_ep_name,1,&dest_fi_addr,0,NULL); - if( ret != 1) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s fi_av_insert failed in send_msg() returned %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),ret ); - /* call the send-callback fn with error and return, also return failure status */ - snd->status = ORTE_ERR_ADDRESSEE_UNKNOWN; - - ORTE_RML_SEND_COMPLETE(snd); - - return; - } - ofi_send_req->send = snd; - ofi_send_req->completion_count = 1; - - /* [DESC] we want to send the pid,seqnum,tag in addition to the data - * copy all of this to header of message from the ofi_send_t* send - */ - ofi_send_req->hdr.dst = ofi_send_req->send->dst; - ofi_send_req->hdr.origin = ofi_send_req->send->origin; - ofi_send_req->hdr.seq_num = ofi_send_req->send->seq_num; - ofi_send_req->hdr.tag = ofi_send_req->send->tag; - - /* - * also insert ofi plugin specific header details - - * the unique msgid, for now initalise total_packets to 1 - */ - ofi_send_req->hdr.msgid = orte_rml_ofi.cur_msgid; - orte_rml_ofi.cur_msgid += 1; - total_packets = 1; - - /* copy the buffer/iov/data to the ofi_send_req->datablob and update ofi_send_req->length*/ - ofi_send_req->length = 0; - if( NULL != ofi_send_req->send->buffer) { - ofi_send_req->length = ofi_send_req->send->buffer->bytes_used; - ofi_send_req->data_blob = (char *)malloc(ofi_send_req->length); - memcpy(ofi_send_req->data_blob , - ofi_send_req->send->buffer->base_ptr, - ofi_send_req->send->buffer->bytes_used); - } else if ( NULL != ofi_send_req->send->iov) { - for (int i=0; i < ofi_send_req->send->count; i++) { - ofi_send_req->length += ofi_send_req->send->iov[i].iov_len; - } - ofi_send_req->data_blob = (char *)malloc(ofi_send_req->length); - int iovlen=0; - for (int i=0; i < ofi_send_req->send->count; i++) { - memcpy(((char *)ofi_send_req->data_blob + iovlen ), - ofi_send_req->send->iov[i].iov_base, - ofi_send_req->send->iov[i].iov_len); - iovlen += ofi_send_req->send->iov[i].iov_len; - } - } else { - //just send the data - ofi_send_req->length = ofi_send_req->send->count; - ofi_send_req->data_blob = (char *)malloc(ofi_send_req->length); - memcpy(ofi_send_req->data_blob , - ofi_send_req->send->data, - ofi_send_req->send->count); - } - - - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Completed copying all data into ofi_send_req->data_blob, total data - %lu bytes", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_send_req->length ); - - /* Each packet will have header information, so the data length in each packet is datalen_per_packet. - * check if the ofi_send_req->send->buffer->bytes_used is greater than the data per packet datalen_per_packet(recv buffer) - * if so fragment and add info to header and send it in a loop back-to-back */ - hdrsize = sizeof(orte_rml_ofi_msg_header_t); - datalen_per_pkt = MIN_MULTI_BUF_SIZE - hdrsize; - if (ofi_send_req->length > datalen_per_pkt ) - { - total_packets = ( ofi_send_req->length / datalen_per_pkt ) + 1 ; - } - ofi_send_req->hdr.tot_pkts = total_packets; - - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s datalen_per_pkt = %lu, ofi_send_req->length= %lu, total packets = %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), datalen_per_pkt, ofi_send_req->length, total_packets ); - - /* in a loop send create and send the packets */ - for(size_t pkt_num=1,sent_data=0; sent_data < ofi_send_req->length; pkt_num++) { - ofi_send_req->hdr.cur_pkt_num = pkt_num; - /* create the packet */ - ofi_msg_pkt = OBJ_NEW(orte_rml_ofi_send_pkt_t); - data_in_pkt = ((ofi_send_req->length - sent_data) >= datalen_per_pkt) ? - datalen_per_pkt : (ofi_send_req->length - sent_data); - ofi_msg_pkt->pkt_size = hdrsize + data_in_pkt; - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Packet %lu -> data_in_pkt= %lu, header_size= %lu, pkt_size=%lu", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), pkt_num,data_in_pkt,hdrsize,ofi_msg_pkt->pkt_size ); - /* copy the header and data for this pkt */ - ofi_msg_pkt->data = malloc( ofi_msg_pkt->pkt_size); - memcpy(ofi_msg_pkt->data, &ofi_send_req->hdr, hdrsize ); - memcpy( ( (char *)ofi_msg_pkt->data + hdrsize ), - ((char*)ofi_send_req->data_blob + sent_data), - data_in_pkt); - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s Copying header, data into packets completed", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME) ); - /* add it to list */ - opal_list_append(&(ofi_send_req->pkt_list), &ofi_msg_pkt->super); - opal_output_verbose(15, orte_rml_base_framework.framework_output, - "%s adding packet %lu to list done successful", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME),pkt_num ); - sent_data += data_in_pkt; - } - - if( ofi_send_req->hdr.tot_pkts != ofi_send_req->hdr.cur_pkt_num ) { - opal_output_verbose(1, orte_rml_base_framework.framework_output, - "%s Error: Total packets calculated [%d] does not match total created-%d pkts to peer %s with tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ofi_send_req->hdr.tot_pkts, ofi_send_req->hdr.cur_pkt_num, - ORTE_NAME_PRINT(peer), tag); - } - /* do the fi_send() for all the pkts */ - ofi_send_req->completion_count= ofi_send_req->hdr.tot_pkts; - OPAL_LIST_FOREACH(ofi_msg_pkt, &ofi_send_req->pkt_list, orte_rml_ofi_send_pkt_t) { - /* debug purpose - copying the header from packet to verify if it is correct */ - struct orte_rml_ofi_msg_header_t *cur_hdr; - cur_hdr = (struct orte_rml_ofi_msg_header_t* ) ofi_msg_pkt->data; - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s Sending Pkt[%d] of total %d pkts for msgid:%d to peer %s with tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), cur_hdr->cur_pkt_num, ofi_send_req->completion_count, - cur_hdr->msgid, ORTE_NAME_PRINT(peer), tag); - /* end debug*/ - - RML_OFI_RETRY_UNTIL_DONE(fi_send(orte_rml_ofi.ofi_prov[ofi_prov_id].ep, - ofi_msg_pkt->data, - ofi_msg_pkt->pkt_size, - fi_mr_desc(orte_rml_ofi.ofi_prov[ofi_prov_id].mr_multi_recv), - dest_fi_addr, - (void *)&ofi_send_req->ctx)); - - } - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s End of send_msg_transport. fi_send completed to peer %s with tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer), tag); - OBJ_RELEASE(req); -} - -int orte_rml_ofi_send_nb(struct orte_rml_base_module_t* mod, - orte_process_name_t* peer, - struct iovec* iov, - int count, - orte_rml_tag_t tag, - orte_rml_callback_fn_t cbfunc, - void* cbdata) -{ - orte_rml_recv_t *rcv; - int bytes; - orte_self_send_xfer_t *xfer; - int i; - char* ptr; - ofi_send_request_t *req; - orte_rml_ofi_module_t *ofi_mod = (orte_rml_ofi_module_t*)mod; - int ofi_prov_id = ofi_mod->cur_transport_id; - - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s rml_ofi_send_transport to peer %s at tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer), tag); - - - if( (0 > ofi_prov_id) || ( ofi_prov_id >= orte_rml_ofi.ofi_prov_open_num ) ) { - /* Invalid ofi_prov ID provided */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - if (ORTE_RML_TAG_INVALID == tag) { - /* cannot send to an invalid tag */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - if (NULL == peer || - OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ORTE_NAME_INVALID, peer)) { - /* cannot send to an invalid peer */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - - /* if this is a message to myself, then just post the message - * for receipt - no need to dive into the ofi send_msg() - */ - if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, peer, ORTE_PROC_MY_NAME)) { /* local delivery */ - OPAL_OUTPUT_VERBOSE((1, orte_rml_base_framework.framework_output, - "%s rml_send_iovec_to_self at tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), tag)); - /* send to self is a tad tricky - we really don't want - * to track the send callback function throughout the recv - * process and execute it upon receipt as this would provide - * very different timing from a non-self message. Specifically, - * if we just retain a pointer to the incoming data - * and then execute the send callback prior to the receive, - * then the caller will think we are done with the data and - * can release it. So we have to copy the data in order to - * execute the send callback prior to receiving the message. - * - * In truth, this really is a better mimic of the non-self - * message behavior. If we actually pushed the message out - * on the wire and had it loop back, then we would receive - * a new block of data anyway. - */ - - /* setup the send callback */ - xfer = OBJ_NEW(orte_self_send_xfer_t); - xfer->iov = iov; - xfer->count = count; - xfer->cbfunc.iov = cbfunc; - xfer->tag = tag; - xfer->cbdata = cbdata; - /* setup the event for the send callback */ - opal_event_set(orte_event_base, &xfer->ev, -1, OPAL_EV_WRITE, send_self_exe, xfer); - opal_event_set_priority(&xfer->ev, ORTE_MSG_PRI); - opal_event_active(&xfer->ev, OPAL_EV_WRITE, 1); - - /* copy the message for the recv */ - rcv = OBJ_NEW(orte_rml_recv_t); - rcv->sender = *peer; - rcv->tag = tag; - /* get the total number of bytes in the iovec array */ - bytes = 0; - for (i = 0 ; i < count ; ++i) { - bytes += iov[i].iov_len; - } - /* get the required memory allocation */ - if (0 < bytes) { - rcv->iov.iov_base = (IOVBASE_TYPE*)malloc(bytes); - rcv->iov.iov_len = bytes; - /* transfer the bytes */ - ptr = (char*)rcv->iov.iov_base; - for (i = 0 ; i < count ; ++i) { - memcpy(ptr, iov[i].iov_base, iov[i].iov_len); - ptr += iov[i].iov_len; - } - } - /* post the message for receipt - since the send callback was posted - * first and has the same priority, it will execute first - */ - ORTE_RML_ACTIVATE_MESSAGE(rcv); - return ORTE_SUCCESS; - } - - /* get ourselves into an event to protect against - * race conditions and threads - */ - req = OBJ_NEW(ofi_send_request_t); - req->ofi_prov_id = ofi_prov_id; - req->send.dst = *peer; - req->send.iov = iov; - req->send.count = count; - req->send.tag = tag; - req->send.cbfunc.iov = cbfunc; - req->send.cbdata = cbdata; - - /* setup the event for the send callback */ - opal_event_set(orte_event_base, &req->ev, -1, OPAL_EV_WRITE, send_msg, req); - opal_event_set_priority(&req->ev, ORTE_MSG_PRI); - opal_event_active(&req->ev, OPAL_EV_WRITE, 1); - - return ORTE_SUCCESS; -} - - -int orte_rml_ofi_send_buffer_nb(struct orte_rml_base_module_t *mod, - orte_process_name_t* peer, - struct opal_buffer_t* buffer, - orte_rml_tag_t tag, - orte_rml_buffer_callback_fn_t cbfunc, - void* cbdata) -{ - orte_rml_recv_t *rcv; - orte_self_send_xfer_t *xfer; - ofi_send_request_t *req; - orte_rml_ofi_module_t *ofi_mod = (orte_rml_ofi_module_t*)mod; - int ofi_prov_id = ofi_mod->cur_transport_id; - - opal_output_verbose(10, orte_rml_base_framework.framework_output, - "%s rml_ofi_send_buffer_transport to peer %s at tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(peer), tag); - - - if( (0 > ofi_prov_id) || ( ofi_prov_id >= orte_rml_ofi.ofi_prov_open_num ) ) { - /* Invalid ofi_prov ID provided */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - if (ORTE_RML_TAG_INVALID == tag) { - /* cannot send to an invalid tag */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - if (NULL == peer || - OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ORTE_NAME_INVALID, peer)) { - /* cannot send to an invalid peer */ - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - return ORTE_ERR_BAD_PARAM; - } - /* if this is a message to myself, then just post the message - * for receipt - no need to dive into the oob - */ - if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, peer, ORTE_PROC_MY_NAME)) { /* local delivery */ - OPAL_OUTPUT_VERBOSE((1, orte_rml_base_framework.framework_output, - "%s rml_send_iovec_to_self at tag %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), tag)); - /* send to self is a tad tricky - we really don't want - * to track the send callback function throughout the recv - * process and execute it upon receipt as this would provide - * very different timing from a non-self message. Specifically, - * if we just retain a pointer to the incoming data - * and then execute the send callback prior to the receive, - * then the caller will think we are done with the data and - * can release it. So we have to copy the data in order to - * execute the send callback prior to receiving the message. - * - * In truth, this really is a better mimic of the non-self - * message behavior. If we actually pushed the message out - * on the wire and had it loop back, then we would receive - * a new block of data anyway. - */ - - /* setup the send callback */ - xfer = OBJ_NEW(orte_self_send_xfer_t); - xfer->buffer = buffer; - xfer->cbfunc.buffer = cbfunc; - xfer->tag = tag; - xfer->cbdata = cbdata; - /* setup the event for the send callback */ - opal_event_set(orte_event_base, &xfer->ev, -1, OPAL_EV_WRITE, send_self_exe, xfer); - opal_event_set_priority(&xfer->ev, ORTE_MSG_PRI); - opal_event_active(&xfer->ev, OPAL_EV_WRITE, 1); - - /* copy the message for the recv */ - rcv = OBJ_NEW(orte_rml_recv_t); - rcv->sender = *peer; - rcv->tag = tag; - rcv->iov.iov_base = (IOVBASE_TYPE*)malloc(buffer->bytes_used); - memcpy(rcv->iov.iov_base, buffer->base_ptr, buffer->bytes_used); - rcv->iov.iov_len = buffer->bytes_used; - /* post the message for receipt - since the send callback was posted - * first and has the same priority, it will execute first - */ - ORTE_RML_ACTIVATE_MESSAGE(rcv); - return ORTE_SUCCESS; - } - - /* get ourselves into an event to protect against - * race conditions and threads - */ - req = OBJ_NEW(ofi_send_request_t); - req->ofi_prov_id = ofi_prov_id; - req->send.dst = *peer; - req->send.buffer = buffer; - req->send.tag = tag; - req->send.cbfunc.buffer = cbfunc; - req->send.cbdata = cbdata; - - /* setup the event for the send callback */ - opal_event_set(orte_event_base, &req->ev, -1, OPAL_EV_WRITE, send_msg, req); - opal_event_set_priority(&req->ev, ORTE_MSG_PRI); - opal_event_active(&req->ev, OPAL_EV_WRITE, 1); - - return ORTE_SUCCESS; -} From 749f51845b27242055daebcf10a5dca90764fd5f Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 20 Feb 2019 09:49:37 +0900 Subject: [PATCH 254/674] osc/rdma: correctly handle communications to self mark the "self" peer OMPI_OSC_RDMA_PEER_LOCAL_BASE when the window is dynamically created and use_cpu_atomics is set in order to correctly handle communications to self. Thanks Bart Janssens for reporting this issue. Refs. open-mpi/ompi#6394 Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@fe05fcc11a5f94fdde9a97423428f9ad779c296c) --- ompi/mca/osc/rdma/osc_rdma_component.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index ee57b94c659..a39c83273a3 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -18,6 +18,8 @@ * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -720,7 +722,13 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s ompi_osc_module_add_peer (module, peer); - if (MPI_WIN_FLAVOR_DYNAMIC == module->flavor || 0 == temp[i].size) { + if (MPI_WIN_FLAVOR_DYNAMIC == module->flavor) { + if (module->use_cpu_atomics && peer_rank == my_rank) { + peer->flags |= OMPI_OSC_RDMA_PEER_LOCAL_BASE; + } + /* nothing more to do */ + continue; + } else if (0 == temp[i].size) { /* nothing more to do */ continue; } From 3ab227df3098897c8860a2f1c2de2bc4e2f91c9b Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 20 Feb 2019 11:09:09 +0900 Subject: [PATCH 255/674] man: fix typos in MPI_Win_{attach,detach} man pages no code change [skip ci] bot:notest Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@7c0596819b4dd1a4f98d6b92d00f9b568d634438) --- ompi/mpi/man/man3/MPI_Win_attach.3in | 8 ++++---- ompi/mpi/man/man3/MPI_Win_detach.3in | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ompi/mpi/man/man3/MPI_Win_attach.3in b/ompi/mpi/man/man3/MPI_Win_attach.3in index d461e746d43..7b7a3fa561f 100644 --- a/ompi/mpi/man/man3/MPI_Win_attach.3in +++ b/ompi/mpi/man/man3/MPI_Win_attach.3in @@ -1,6 +1,6 @@ .\" -*- nroff -*- -.\" Copyright (c) 2015 Research Organization for Information Science -.\" and Technology (RIST). All rights reserved. +.\" Copyright (c) 2015-2019 Research Organization for Information Science +.\" and Technology (RIST). All rights reserved. .\" $COPYRIGHT$ .TH MPI_Win_attach 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" .SH NAME @@ -11,9 +11,9 @@ .SH C Syntax .nf #include -MPI_Win_attach(MPI_Win *\fIwin\fP, void *\fIbase\fP, MPI_Aint \fIsize\fP) +MPI_Win_attach(MPI_Win \fIwin\fP, void *\fIbase\fP, MPI_Aint \fIsize\fP) -MPI_Win_detach(MPI_Win *\fIwin\fP, void *\fIbase\fP) +MPI_Win_detach(MPI_Win \fIwin\fP, void *\fIbase\fP) .fi .SH Fortran Syntax .nf diff --git a/ompi/mpi/man/man3/MPI_Win_detach.3in b/ompi/mpi/man/man3/MPI_Win_detach.3in index ff60c711116..42a7c2b2dfb 100644 --- a/ompi/mpi/man/man3/MPI_Win_detach.3in +++ b/ompi/mpi/man/man3/MPI_Win_detach.3in @@ -1 +1 @@ -.so man3/MPI_Win_attach +.so man3/MPI_Win_attach.3 From 7b71369632a326fbe329756cd54a536e5481d2ee Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Wed, 20 Feb 2019 11:22:38 +0900 Subject: [PATCH 256/674] man: fix more typos in MPI_Win_attach man page Signed-off-by: KAWASHIMA Takahiro [skip ci] bot:notest (cherry picked from commit open-mpi/ompi@7095ad10a5de1980c1f252f5be1cb72f28f0493b) --- ompi/mpi/man/man3/MPI_Win_attach.3in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ompi/mpi/man/man3/MPI_Win_attach.3in b/ompi/mpi/man/man3/MPI_Win_attach.3in index 7b7a3fa561f..183141f7531 100644 --- a/ompi/mpi/man/man3/MPI_Win_attach.3in +++ b/ompi/mpi/man/man3/MPI_Win_attach.3in @@ -1,10 +1,11 @@ .\" -*- nroff -*- .\" Copyright (c) 2015-2019 Research Organization for Information Science .\" and Technology (RIST). All rights reserved. +.\" Copyright (c) 2019 FUJITSU LIMITED. All rights reserved. .\" $COPYRIGHT$ .TH MPI_Win_attach 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#" .SH NAME -\fBMPI_Win_create, MPI_Win_detach\fP \- One-sided MPI call that attach / detach a window object for RMA operations. +\fBMPI_Win_attach, MPI_Win_detach\fP \- One-sided MPI call that attach / detach a window object for RMA operations. .SH SYNTAX .ft R @@ -62,7 +63,7 @@ Fortran only: Error status (integer). .ft R MPI_Win_attach is a one-sided MPI communication collective call executed by all processes in the group of \fIcomm\fP. It returns a window object that can be used by these processes to perform RMA operations. Each process specifies a window of existing memory that it exposes to RMA accesses by the processes in the group of \fIcomm\fP. The window consists of \fIsize\fP bytes, starting at address \fIbase\fP. A process may elect to expose no memory by specifying \fIsize\fP = 0. .sp -If the \fIbase\fP value used by MPI_Win_create was allocated by MPI_Alloc_mem, the size of the window can be no larger than the value set by the MPI_ALLOC_MEM function. +If the \fIbase\fP value used by MPI_Win_attach was allocated by MPI_Alloc_mem, the size of the window can be no larger than the value set by the MPI_ALLOC_MEM function. .sp .SH NOTES From 35e3c071dc6c15815d52d55495ffbff87693b76b Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 20 Feb 2019 09:55:07 -0700 Subject: [PATCH 257/674] update NEWS with a new fix Signed-off-by: Howard Pritchard --- NEWS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS b/NEWS index 13ecf33c1d0..04501abb536 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,8 @@ included in the vX.Y.Z section and be denoted as: ------------------------ - Update embedded PMIx to 3.1.2. +- Fix an issue with MPI_WIN_CREATE_DYNAMIC and MPI_GET from self. + thanks to Bart Janssens for reporting. - Fix an issue of excessive compiler warning messages from mpi.h when using newer C++ compilers. Thanks to @Shadow-fax for reporting. From 1c514948f64e532bbf6734d7ce020ed7f20fe9e8 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Wed, 13 Feb 2019 16:23:09 +0200 Subject: [PATCH 258/674] PML/UCX: Use net worker address for remote peers For remote node peers pack smaller worker address, which contains network device addresses only. This would reduce amount of OOB traffic during startup. Signed-off-by: Mikhail Brinskii (cherry picked from commit 751d88192d05edb7e1912bab4e48643c6f9e1574) --- config/ompi_check_ucx.m4 | 4 +++ ompi/mca/pml/ucx/pml_ucx.c | 65 +++++++++++++++++++++++++++++++++++--- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 8a8a6d469c3..668b0ff1478 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -120,6 +120,10 @@ AC_DEFUN([OMPI_CHECK_UCX],[ UCP_ATOMIC_FETCH_OP_FXOR], [], [], [#include ]) + AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS], + [AC_DEFINE([HAVE_UCP_WORKER_ADDRESS_FLAGS], [1], + [have worker address attribute])], [], + [#include ]) CPPFLAGS=$old_CPPFLAGS OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])])]) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index bcb689e1de8..00a95644c22 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -82,11 +82,46 @@ mca_pml_ucx_module_t ompi_pml_ucx = { #define PML_UCX_REQ_ALLOCA() \ ((char *)alloca(ompi_pml_ucx.request_size) + ompi_pml_ucx.request_size); +#if HAVE_UCP_WORKER_ADDRESS_FLAGS +static int mca_pml_ucx_send_worker_address_type(int addr_flags, int modex_scope) +{ + ucs_status_t status; + ucp_worker_attr_t attrs; + int rc; + + attrs.field_mask = UCP_WORKER_ATTR_FIELD_ADDRESS | + UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS; + attrs.address_flags = addr_flags; + + status = ucp_worker_query(ompi_pml_ucx.ucp_worker, &attrs); + if (UCS_OK != status) { + PML_UCX_ERROR("Failed to query UCP worker address"); + return OMPI_ERROR; + } + + OPAL_MODEX_SEND(rc, modex_scope, &mca_pml_ucx_component.pmlm_version, + (void*)attrs.address, attrs.address_length); + + ucp_worker_release_address(ompi_pml_ucx.ucp_worker, attrs.address); + + if (OMPI_SUCCESS != rc) { + return OMPI_ERROR; + } + + PML_UCX_VERBOSE(2, "Pack %s worker address, size %ld", + (modex_scope == OPAL_PMIX_LOCAL) ? "local" : "remote", + attrs.address_length); + + return OMPI_SUCCESS; +} +#endif static int mca_pml_ucx_send_worker_address(void) { - ucp_address_t *address; ucs_status_t status; + +#if !HAVE_UCP_WORKER_ADDRESS_FLAGS + ucp_address_t *address; size_t addrlen; int rc; @@ -96,16 +131,35 @@ static int mca_pml_ucx_send_worker_address(void) return OMPI_ERROR; } + PML_UCX_VERBOSE(2, "Pack worker address, size %ld", addrlen); + OPAL_MODEX_SEND(rc, OPAL_PMIX_GLOBAL, &mca_pml_ucx_component.pmlm_version, (void*)address, addrlen); + + ucp_worker_release_address(ompi_pml_ucx.ucp_worker, address); + if (OMPI_SUCCESS != rc) { - PML_UCX_ERROR("Open MPI couldn't distribute EP connection details"); - return OMPI_ERROR; + goto err; + } +#else + /* Pack just network device addresses for remote node peers */ + status = mca_pml_ucx_send_worker_address_type(UCP_WORKER_ADDRESS_FLAG_NET_ONLY, + OPAL_PMIX_REMOTE); + if (UCS_OK != status) { + goto err; } - ucp_worker_release_address(ompi_pml_ucx.ucp_worker, address); + status = mca_pml_ucx_send_worker_address_type(0, OPAL_PMIX_LOCAL); + if (UCS_OK != status) { + goto err; + } +#endif return OMPI_SUCCESS; + +err: + PML_UCX_ERROR("Open MPI couldn't distribute EP connection details"); + return OMPI_ERROR; } static int mca_pml_ucx_recv_worker_address(ompi_proc_t *proc, @@ -121,6 +175,9 @@ static int mca_pml_ucx_recv_worker_address(ompi_proc_t *proc, PML_UCX_ERROR("Failed to receive UCX worker address: %s (%d)", opal_strerror(ret), ret); } + + PML_UCX_VERBOSE(2, "Got proc %d address, size %ld", + proc->super.proc_name.vpid, *addrlen_p); return ret; } From 6596277ee89b6850d06c856fa3d7a4a200496448 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 19 Feb 2019 17:39:49 -0700 Subject: [PATCH 259/674] fortran:use mpif08 fix for PGI linking commit c6070fd2e broke building fortran bindings with PGI compilers. Turns out PGI compilers need to link in the *.o from a module file whether or not there are module subroutines defined or not in the module file. Related to #6411 Signed-off-by: Howard Pritchard (cherry picked from commit 266bc3aced5ff9019f01faef1ed01dd463fafd41) --- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index dc9de8e379c..dc04a83cf93 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -11,6 +11,8 @@ # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +# Copyright (c) 2019 Triad National Security, LLC. All rights +# reserved. # # $COPYRIGHT$ # @@ -39,7 +41,8 @@ CLEANFILES += *.i90 lib_LTLIBRARIES = lib@OMPI_LIBMPI_NAME@_usempif08.la module_sentinel_file = \ - mod/libforce_usempif08_internal_modules_to_be_built.la + mod/libforce_usempif08_internal_modules_to_be_built.la \ + bindings/libforce_usempif08_internal_bindings_to_be_built.la mpi-f08.lo: $(module_sentinel_file) mpi-f08.lo: mpi-f08.F90 From f38eebbbfb4676aafdc12c9d385f4bee3c8a9fc8 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 22 Feb 2019 12:02:18 -0700 Subject: [PATCH 260/674] LICENSE: for v4.0.1 [skip ci] Signed-off-by: Howard Pritchard --- LICENSE | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/LICENSE b/LICENSE index be9aead45de..29b02918cee 100644 --- a/LICENSE +++ b/LICENSE @@ -8,24 +8,24 @@ corresponding files. Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana University Research and Technology Corporation. All rights reserved. -Copyright (c) 2004-2018 The University of Tennessee and The University +Copyright (c) 2004-2019 The University of Tennessee and The University of Tennessee Research Foundation. All rights reserved. -Copyright (c) 2004-2010 High Performance Computing Center Stuttgart, +Copyright (c) 2004-2019 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2008 The Regents of the University of California. All rights reserved. Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights reserved. -Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved. Copyright (c) 2006-2018 Sandia National Laboratories. All rights reserved. Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. -Copyright (c) 2006-2018 The University of Houston. All rights reserved. +Copyright (c) 2006-2019 The University of Houston. All rights reserved. Copyright (c) 2006-2009 Myricom, Inc. All rights reserved. Copyright (c) 2007-2018 UT-Battelle, LLC. All rights reserved. -Copyright (c) 2007-2018 IBM Corporation. All rights reserved. +Copyright (c) 2007-2019 IBM Corporation. All rights reserved. Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing Centre, Federal Republic of Germany Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany @@ -35,7 +35,7 @@ Copyright (c) 2008-2009 Institut National de Recherche en Informatique. All rights reserved. Copyright (c) 2007 Lawrence Livermore National Security, LLC. All rights reserved. -Copyright (c) 2007-2018 Mellanox Technologies. All rights reserved. +Copyright (c) 2007-2019 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2010 QLogic Corporation. All rights reserved. Copyright (c) 2008-2017 Oak Ridge National Labs. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. @@ -45,16 +45,18 @@ Copyright (c) 2016 ARM, Inc. All rights reserved. Copyright (c) 2010-2011 Alex Brick . All rights reserved. Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. -Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +Copyright (c) 2013-2019 Intel, Inc. All rights reserved. Copyright (c) 2011-2017 NVIDIA Corporation. All rights reserved. Copyright (c) 2016 Broadcom Limited. All rights reserved. -Copyright (c) 2011-2018 Fujitsu Limited. All rights reserved. +Copyright (c) 2011-2019 Fujitsu Limited. All rights reserved. Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All rights reserved. -Copyright (c) 2013-2018 Research Organization for Information Science (RIST). +Copyright (c) 2013-2019 Research Organization for Information Science (RIST). All rights reserved. Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights reserved. +Copyright (c) 2019 Triad National Security, LLC. All rights + reserved. $COPYRIGHT$ From 8db349f64a07d513795882d61d91962ad352177d Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 22 Feb 2019 12:58:04 -0700 Subject: [PATCH 261/674] VERSION: update for v4.0.1rc1 release Signed-off-by: Howard Pritchard --- VERSION | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 33ed79a7e07..b80fa45cf04 100644 --- a/VERSION +++ b/VERSION @@ -28,7 +28,7 @@ release=1 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=a1 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -86,16 +86,16 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=60:0:20 +libmpi_so_version=60:1:20 libmpi_cxx_so_version=60:0:20 -libmpi_mpifh_so_version=60:0:20 +libmpi_mpifh_so_version=60:1:20 libmpi_usempi_tkr_so_version=60:0:20 libmpi_usempi_ignore_tkr_so_version=60:0:20 libmpi_usempif08_so_version=60:0:20 -libopen_rte_so_version=60:0:20 -libopen_pal_so_version=60:0:20 +libopen_rte_so_version=60:1:20 +libopen_pal_so_version=60:1:20 libmpi_java_so_version=60:0:20 -liboshmem_so_version=60:0:20 +liboshmem_so_version=61:0:21 libompitrace_so_version=60:0:20 # "Common" components install standalone libraries that are run-time @@ -104,7 +104,7 @@ libompitrace_so_version=60:0:20 # components-don't-affect-the-build-system abstraction. # OMPI layer -libmca_ompi_common_ompio_so_version=60:0:19 +libmca_ompi_common_ompio_so_version=60:1:19 libmca_ompi_common_monitoring_so_version=60:0:10 # ORTE layer From d6e8d51d5f31283257062858186d6c6caf96d8ee Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Thu, 21 Feb 2019 11:40:22 -0500 Subject: [PATCH 262/674] Cart/Graph create would not run the next_cid algorithm and create disjoint communicator with inconsistent cid. Signed-off-by: Aurelien Bouteiller --- ompi/communicator/comm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index 228abae7ab7..f0ad19e4f8d 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -1884,6 +1884,10 @@ int ompi_comm_enable(ompi_communicator_t *old_comm, { int ret = OMPI_SUCCESS; + /* set the rank information before calling nextcid */ + new_comm->c_local_group->grp_my_rank = new_rank; + new_comm->c_my_rank = new_rank; + /* Determine context id. It is identical to f_2_c_handle */ ret = ompi_comm_nextcid (new_comm, old_comm, NULL, NULL, NULL, false, OMPI_COMM_CID_INTRA); From 6a8dba3952d36b170ec10ab809c309e490d3f751 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Mon, 25 Feb 2019 13:25:39 -0700 Subject: [PATCH 263/674] README: updates for v4.0.1 release fixes #6425 Signed-off-by: Howard Pritchard --- README | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README b/README index 72d55ca1d44..685ee9c6923 100644 --- a/README +++ b/README @@ -21,6 +21,8 @@ Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights reserved. Copyright (c) 2017 Research Organization for Information Science and Technology (RIST). All rights reserved. +Copyright (c) 2019 Triad National Security, LLC. All rights + reserved. $COPYRIGHT$ @@ -64,7 +66,7 @@ Much, much more information is also available in the Open MPI FAQ: =========================================================================== The following abbreviated list of release notes applies to this code -base as of this writing (March 2017): +base as of this writing (February 2019): General notes ------------- @@ -508,8 +510,9 @@ MPI Functionality and Features - MPI_Handler_function (replaced by MPI_Comm_errhandler_function) Although these symbols are no longer prototyped in mpi.h, they - are still present in the MPI library in Open MPI v4.0.x. This - enables legacy MPI applications to link and run successfully with + are still present in the MPI library in Open MPI v4.0.1 and later + releases of the v4.0.x release stream. This enables legacy MPI + applications to link and run successfully with Open MPI v4.0.x, even though they will fail to compile. *** Future releases of Open MPI beyond the v4.0.x series may @@ -608,7 +611,7 @@ MPI Functionality and Features OpenSHMEM Functionality and Features ------------------------------------ -- All OpenSHMEM-1.4 functionality is supported. +- All OpenSHMEM-1.4 functionality is supported starting in release v4.0.1. MPI Collectives From 8bf3a86cb0d0d906b89a0b231cb25a3c0f4fd614 Mon Sep 17 00:00:00 2001 From: Ben Menadue Date: Mon, 25 Feb 2019 16:58:11 +1100 Subject: [PATCH 264/674] Hold off running hwloc:external feature tests until after we decide if we're using the internal or external component. This fixes #6430. Signed-off-by: Ben Menadue (cherry picked from commit 17dcc7041ac272c65eb727f45c5628459cbb6055) --- opal/mca/hwloc/external/configure.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 index 24721f514c9..dd7bce346c4 100644 --- a/opal/mca/hwloc/external/configure.m4 +++ b/opal/mca/hwloc/external/configure.m4 @@ -133,8 +133,6 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ [CPPFLAGS="$CPPFLAGS $opal_hwloc_external_CPPFLAGS" LDFLAGS="$LDFLAGS $opal_hwloc_external_LDFLAGS" LIBS="$LIBS $opal_hwloc_external_LIBS" - AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [#include ]) - AC_CHECK_FUNCS([hwloc_topology_dup]) AC_MSG_CHECKING([if external hwloc version is 1.5 or greater]) AC_COMPILE_IFELSE( @@ -172,6 +170,9 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[ [external], [Version of hwloc]) + AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [#include ]) + AC_CHECK_FUNCS([hwloc_topology_dup]) + # See if the external hwloc supports XML AC_MSG_CHECKING([if external hwloc supports XML]) AS_IF([test "$opal_hwloc_dir" != ""], From 8449a00a748a91a712b0edca2b70664e4c5a2e0c Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 27 Feb 2019 08:01:01 -0700 Subject: [PATCH 265/674] NEWS: another update for 4.0.1 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 04501abb536..6b18743bccf 100644 --- a/NEWS +++ b/NEWS @@ -57,10 +57,13 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. -4.0.1 -- February, 2019 ------------------------- +4.0.1 -- March, 2019 +-------------------- - Update embedded PMIx to 3.1.2. +- Fix an issue when using --enable-visibility configure option + and older versions of hwloc. Thanks to Ben Menadue for reporting + and providing a fix. - Fix an issue with MPI_WIN_CREATE_DYNAMIC and MPI_GET from self. thanks to Bart Janssens for reporting. - Fix an issue of excessive compiler warning messages from mpi.h From 6df6a3f4bc89b18020c6d8450b72f7e6a01cb8f8 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Fri, 15 Feb 2019 14:19:07 -0600 Subject: [PATCH 266/674] mpi.h.in: Revamp MPI-1 removed function warnings Refs https://github.com/open-mpi/ompi/issues/6278. This commit is intended to be cherry-picked to v4.0.x and the following commit will ammend to this functionality for master's removal. Changes the prototypes for MPI removed functions in the following ways: There are 4 cases: 1) User wants MPI-1 compatibility (--enable-mpi1-compatibility) MPI_Address (and friends) are declared in mpi.h with deprecation notice 2) User does not want MPI-1 compatibility, and has a C11-capable compiler Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using _Static_assert C11 feature 3) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, but the compiler supports error function attributes. Declare an MPI_Address (etc.) macro in mpi.h, which will cause a compile-time error using error function attribute. 4) User does not want MPI-1 compatibility, and does not have a C11-capable compiler, or a compiler that supports error function attributes. Do not declare MPI_Address (etc.) in mpi.h at all. Unless the user is compiling with something like -Werror, this will allow the user's code to compile. We are choosing this because it seems like a losing battle to make some kind of compile time error that is friendly to the user (and doesn't make it look like mpi.h itself is broken). On v4.0.x, this will allow the user code to both compile (albeit with a warning) and link (because the MPI_Address will be in the MPI library because we are preserving ABI back to 3.0.x). On master/v5.0.x, this will allow the user code to compile, but it will fail to link (because the MPI_Address symbol will not be in the MPI library). Signed-off-by: Geoffrey Paulsen (cherry-picked from 3136a1706cdacb3f7530937da1dcfe15d2febc79) --- ompi/include/mpi.h.in | 140 +++++++++++++++++++++++++-------- ompi/mpi/c/address.c | 12 +-- ompi/mpi/c/errhandler_create.c | 13 ++- ompi/mpi/c/errhandler_get.c | 13 ++- ompi/mpi/c/errhandler_set.c | 13 ++- ompi/mpi/c/type_extent.c | 13 ++- ompi/mpi/c/type_hindexed.c | 13 ++- ompi/mpi/c/type_hvector.c | 13 ++- ompi/mpi/c/type_lb.c | 13 ++- ompi/mpi/c/type_struct.c | 13 ++- ompi/mpi/c/type_ub.c | 13 ++- 11 files changed, 202 insertions(+), 67 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 49167493feb..27feae4ad8c 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -19,7 +19,8 @@ * 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) 2017-2018 IBM Corporation. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -279,10 +280,50 @@ # define __mpi_interface_deprecated__(msg) __attribute__((__deprecated__)) # endif # endif -# if (OMPI_ENABLE_MPI1_COMPAT && !OMPI_BUILDING) -# define __mpi_interface_removed__(msg) __mpi_interface_deprecated__(msg) -# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 -# endif +# endif + + /* For MPI removed APIs, there is no generally portable way to cause + * the C compiler to error with a nice message, on the _usage_ of + * one of these symbols. We've gone with tiered appraoch: + * + * If the user configured with --enable-mpi1-compatibility, + * just emit a compiletime warning (via the deprecation function + * attribute) that they're using an MPI1 removed function. + * + * Otherwise, we'd like to issue a fatal error directing the user + * that they've used an MPI1 removed function. If the user's + * compiler supports C11 _Static_assert feature, we #define + * the MPI routines to instead be a call to _Static_assert + * with an appropreate message suggesting the new MPI3 equivalent. + * + * Otherwise, if the user's compiler supports the error function + * attribute, define the MPI routines with that error attribute. + * This is supported by most modern GNU compilers. + * + * Finally if the compiler doesn't support any of those, just + * Don't declare those MPI routines at all in mpi.h + * + * Don't do MACRO magic for building Profiling library as it + * interferes with the above. + */ +# if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) +# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 +# define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...") +# elif (__STDC_VERSION__ >= 201112L) +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 +# define OMPI_REMOVED_USE_STATIC_ASSERT 1 +// This macro definition may show up in compiler output. So we both +// outdent it back to column 0 and give it a user-friendly name to +// help users grok what we are trying to tell them here. +#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") +# elif OPAL_HAVE_ATTRIBUTE_ERROR +# define OMPI_OMIT_MPI1_COMPAT_DECLS 0 +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 +# define __mpi_interface_removed__(func, newfunc) __attribute__((__error__(#func " was removed in MPI-3.0. Use " #newfunc " instead."))) +# else +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 # endif # endif #endif @@ -297,7 +338,15 @@ #endif #if !defined(__mpi_interface_removed__) -# define __mpi_interface_removed__(msg) +# define __mpi_interface_removed__(A,B) +#endif + +#if !defined(THIS_SYMBOL_WAS_REMOVED_IN_MPI30) +# define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) +#endif + +#if !defined(OMPI_REMOVED_USE_STATIC_ASSERT) +# define OMPI_REMOVED_USE_STATIC_ASSERT 0 #endif #if !defined(OMPI_OMIT_MPI1_COMPAT_DECLS) @@ -1010,7 +1059,6 @@ OMPI_DECLSPEC extern struct ompi_predefined_info_t ompi_mpi_info_env; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUS_IGNORE; OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; -#if (!OMPI_OMIT_MPI1_COMPAT_DECLS || OMPI_BUILDING) /* * Removed datatypes. These datatypes are only available if Open MPI * was configured with --enable-mpi1-compatibility. @@ -1018,14 +1066,25 @@ OMPI_DECLSPEC extern MPI_Fint *MPI_F_STATUSES_IGNORE; * These datatypes were formally removed from the MPI specification * and should no longer be used in MPI applications. */ -#define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) -#define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) +# define MPI_UB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_ub) +# define MPI_LB OMPI_PREDEFINED_GLOBAL(MPI_Datatype, ompi_mpi_lb) + +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb; +OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub; + +#else +/* If not building or configured --enable-mpi1-compatibility, then + * we don't want these datatypes, instead we define MPI_UB and + * MPI_LB to our Static Assert message if the compiler supports + * that staticly assert with a nice message. + */ +# if (OMPI_REMOVED_USE_STATIC_ASSERT) +# define MPI_UB THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_UB, MPI_Type_create_resized); +# define MPI_LB THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_LB, MPI_Type_create_resized); +# endif /* OMPI_REMOVED_USE_STATIC_ASSERT */ +#endif /* Removed datatypes */ -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_lb - __mpi_interface_removed__("MPI_LB was removed in MPI-3.0; use MPI_Type_create_resized instead."); -OMPI_DECLSPEC extern struct ompi_predefined_datatype_t ompi_mpi_ub - __mpi_interface_removed__("MPI_UB was removed in MPI-3.0; use MPI_Type_create_resized instead."); -#endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ /* * MPI predefined handles @@ -2695,61 +2754,74 @@ typedef void (MPI_Handler_function)(MPI_Comm *, int *, ...); * and should no longer be used in MPI applications. */ OMPI_DECLSPEC int MPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("MPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); + __mpi_interface_removed__(MPI_Address, MPI_Get_address); OMPI_DECLSPEC int PMPI_Address(void *location, MPI_Aint *address) - __mpi_interface_removed__("PMPI_Address was removed in MPI-3.0; use MPI_Get_address instead."); + __mpi_interface_removed__(PMPI_Address, PMPI_Get_address); OMPI_DECLSPEC int MPI_Errhandler_create(MPI_Handler_function *function, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_create was removed in MPI-3.0; use MPI_Comm_create_errhandler instead."); + __mpi_interface_removed__(MPI_Errhandler_create, MPI_Comm_create_errhandler); OMPI_DECLSPEC int PMPI_Errhandler_create(MPI_Handler_function *function, MPI_Errhandler *errhandler) - __mpi_interface_removed__("PMPI_Errhandler_create was removed in MPI-3.0; use PMPI_Comm_create_errhandler instead."); + __mpi_interface_removed__(PMPI_Errhandler_create, PMPI_Comm_create_errhandler); OMPI_DECLSPEC int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("MPI_Errhandler_get was removed in MPI-3.0; use MPI_Comm_get_errhandler instead."); + __mpi_interface_removed__(MPI_Errhandler_get, MPI_Comm_get_errhandler); OMPI_DECLSPEC int PMPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler) - __mpi_interface_removed__("PMPI_Errhandler_get was removed in MPI-3.0; use PMPI_Comm_get_errhandler instead."); + __mpi_interface_removed__(PMPI_Errhandler_get, PMPI_Comm_get_errhandler); OMPI_DECLSPEC int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("MPI_Errhandler_set was removed in MPI-3.0; use MPI_Comm_set_errhandler instead."); + __mpi_interface_removed__(MPI_Errhandler_set, MPI_Comm_set_errhandler); OMPI_DECLSPEC int PMPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) - __mpi_interface_removed__("PMPI_Errhandler_set was removed in MPI-3.0; use PMPI_Comm_set_errhandler instead."); + __mpi_interface_removed__(PMPI_Errhandler_set, PMPI_Comm_set_errhandler); OMPI_DECLSPEC int MPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("MPI_Type_extent was removed in MPI-3.0; use MPI_Type_get_extent instead."); + __mpi_interface_removed__(MPI_Type_extent, MPI_Type_get_extent); OMPI_DECLSPEC int PMPI_Type_extent(MPI_Datatype type, MPI_Aint *extent) - __mpi_interface_removed__("PMPI_Type_extent was removed in MPI-3.0; use PMPI_Type_get_extent instead."); + __mpi_interface_removed__(PMPI_Type_extent, PMPI_Type_get_extent); OMPI_DECLSPEC int MPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hindexed was removed in MPI-3.0; use MPI_Type_create_hindexed instead."); + __mpi_interface_removed__(MPI_Type_hindexed, MPI_Type_create_hindexed); OMPI_DECLSPEC int PMPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_hindexed was removed in MPI-3.0; use PMPI_Type_create_hindexed instead."); + __mpi_interface_removed__(PMPI_Type_hindexed, PMPI_Type_create_hindexed); OMPI_DECLSPEC int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_hvector was removed in MPI-3.0; use MPI_Type_create_hvector instead."); + __mpi_interface_removed__(MPI_Type_hvector, MPI_Type_create_hvector); OMPI_DECLSPEC int PMPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_hvector was removed in MPI-3.0; use PMPI_Type_create_hvector instead."); + __mpi_interface_removed__(PMPI_Type_hvector, PMPI_Type_create_hvector); OMPI_DECLSPEC int MPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("MPI_Type_lb has been removed in MPI-3.0; use MPI_Type_get_extent instead."); + __mpi_interface_removed__(MPI_Type_lb, MPI_Type_get_extent); OMPI_DECLSPEC int PMPI_Type_lb(MPI_Datatype type, MPI_Aint *lb) - __mpi_interface_removed__("PMPI_Type_lb has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); + __mpi_interface_removed__(PMPI_Type_lb, PMPI_Type_get_extent); OMPI_DECLSPEC int MPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype array_of_types[], MPI_Datatype *newtype) - __mpi_interface_removed__("MPI_Type_struct was removed in MPI-3.0; use MPI_Type_create_struct instead."); + __mpi_interface_removed__(MPI_Type_struct, MPI_Type_create_struct); OMPI_DECLSPEC int PMPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype array_of_types[], MPI_Datatype *newtype) - __mpi_interface_removed__("PMPI_Type_struct was removed in MPI-3.0; use PMPI_Type_create_struct instead."); + __mpi_interface_removed__(PMPI_Type_struct, PMPI_Type_create_struct); OMPI_DECLSPEC int MPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("MPI_Type_ub has been removed in MPI-3.0; use MPI_Type_get_extent instead."); + __mpi_interface_removed__(MPI_Type_ub, MPI_Type_get_extent); OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) - __mpi_interface_removed__("PMPI_Type_ub has been removed in MPI-3.0; use PMPI_Type_get_extent instead."); + __mpi_interface_removed__(PMPI_Type_ub, PMPI_Type_get_extent); #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ +#if OMPI_REMOVED_USE_STATIC_ASSERT +#define MPI_Address(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Address, MPI_Get_address) +#define MPI_Errhandler_create(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_create, MPI_Comm_create_errhandler) +#define MPI_Errhandler_get(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_get, MPI_Comm_get_errhandler) +#define MPI_Errhandler_set(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_set, MPI_Comm_set_errhandler) +#define MPI_Type_extent(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_extent, MPI_Type_get_extent) +#define MPI_Type_hindexed(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hindexed, MPI_Type_create_hindexed) +#define MPI_Type_hvector(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hvector, MPI_Type_create_hvector) +#define MPI_Type_lb(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_lb, MPI_Type_get_extent) +#define MPI_Type_struct(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_struct, MPI_Type_create_struct) +#define MPI_Type_ub(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) +#endif + #if defined(c_plusplus) || defined(__cplusplus) } #endif diff --git a/ompi/mpi/c/address.c b/ompi/mpi/c/address.c index bb864a6b2ab..0eead1faae8 100644 --- a/ompi/mpi/c/address.c +++ b/ompi/mpi/c/address.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -21,16 +22,11 @@ #include "ompi_config.h" #include -/* This implementation has been removed from the MPI 3.1 standard. +/* This implementation has been removed from the MPI 3.0 standard. * Open MPI v4.0.x is keeping the implementation in the library, but * removing the prototypes from the headers, unless the user configures * with --enable-mpi1-compatibility. - * - * To prevent having to port these implementations of removed functions - * to the newer MPI calls, we are defining ENABLE_MPI1_COMPAT to 1 - * before including the c bindings. */ -#define ENABLE_MPI1_COMPAT 1 #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -41,6 +37,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Address = PMPI_Address #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Address #define MPI_Address PMPI_Address #endif diff --git a/ompi/mpi/c/errhandler_create.c b/ompi/mpi/c/errhandler_create.c index 3af43d57446..1edf3f64fe4 100644 --- a/ompi/mpi/c/errhandler_create.c +++ b/ompi/mpi/c/errhandler_create.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/communicator/communicator.h" @@ -32,6 +35,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Errhandler_create = PMPI_Errhandler_create #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Errhandler_create #define MPI_Errhandler_create PMPI_Errhandler_create #endif diff --git a/ompi/mpi/c/errhandler_get.c b/ompi/mpi/c/errhandler_get.c index e5caf07c3bb..a8f0ed69495 100644 --- a/ompi/mpi/c/errhandler_get.c +++ b/ompi/mpi/c/errhandler_get.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -34,6 +37,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Errhandler_get = PMPI_Errhandler_get #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Errhandler_get #define MPI_Errhandler_get PMPI_Errhandler_get #endif diff --git a/ompi/mpi/c/errhandler_set.c b/ompi/mpi/c/errhandler_set.c index 686f97f1648..71501fc1238 100644 --- a/ompi/mpi/c/errhandler_set.c +++ b/ompi/mpi/c/errhandler_set.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -34,6 +37,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Errhandler_set = PMPI_Errhandler_set #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Errhandler_set #define MPI_Errhandler_set PMPI_Errhandler_set #endif diff --git a/ompi/mpi/c/type_extent.c b/ompi/mpi/c/type_extent.c index 8984b467bb4..ecf86f14175 100644 --- a/ompi/mpi/c/type_extent.c +++ b/ompi/mpi/c/type_extent.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -35,6 +38,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_extent = PMPI_Type_extent #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_extent #define MPI_Type_extent PMPI_Type_extent #endif diff --git a/ompi/mpi/c/type_hindexed.c b/ompi/mpi/c/type_hindexed.c index ad071fd5a15..ca12f4bb329 100644 --- a/ompi/mpi/c/type_hindexed.c +++ b/ompi/mpi/c/type_hindexed.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -34,6 +37,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_hindexed = PMPI_Type_hindexed #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_hindexed #define MPI_Type_hindexed PMPI_Type_hindexed #endif diff --git a/ompi/mpi/c/type_hvector.c b/ompi/mpi/c/type_hvector.c index 469aba75d55..4117a64cc75 100644 --- a/ompi/mpi/c/type_hvector.c +++ b/ompi/mpi/c/type_hvector.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -34,6 +37,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_hvector = PMPI_Type_hvector #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_hvector #define MPI_Type_hvector PMPI_Type_hvector #endif diff --git a/ompi/mpi/c/type_lb.c b/ompi/mpi/c/type_lb.c index b8ba200c874..07b8385d0dd 100644 --- a/ompi/mpi/c/type_lb.c +++ b/ompi/mpi/c/type_lb.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -35,6 +38,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_lb = PMPI_Type_lb #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_lb #define MPI_Type_lb PMPI_Type_lb #endif diff --git a/ompi/mpi/c/type_struct.c b/ompi/mpi/c/type_struct.c index 13572552ce0..0151b99ac49 100644 --- a/ompi/mpi/c/type_struct.c +++ b/ompi/mpi/c/type_struct.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" @@ -30,6 +33,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_struct = PMPI_Type_struct #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_struct #define MPI_Type_struct PMPI_Type_struct #endif diff --git a/ompi/mpi/c/type_ub.c b/ompi/mpi/c/type_ub.c index 1544116a6f9..90755774d93 100644 --- a/ompi/mpi/c/type_ub.c +++ b/ompi/mpi/c/type_ub.c @@ -11,6 +11,7 @@ * All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,9 +21,11 @@ #include "ompi_config.h" -/* defining ENABLE_MPI1_COMPAT to 1 for removed implementations here. - * see comments in address.c for more information. */ -#define ENABLE_MPI1_COMPAT 1 +/* This implementation has been removed from the MPI 3.0 standard. + * Open MPI v4.0.x is keeping the implementation in the library, but + * removing the prototypes from the headers, unless the user configures + * with --enable-mpi1-compatibility. + */ #include "ompi/mpi/c/bindings.h" #include "ompi/runtime/params.h" @@ -35,6 +38,10 @@ #if OPAL_HAVE_WEAK_SYMBOLS #pragma weak MPI_Type_ub = PMPI_Type_ub #endif +/* undef before defining, to prevent possible redefinition when + * using _Static_assert to error on usage of removed functions. + */ +#undef MPI_Type_ub #define MPI_Type_ub PMPI_Type_ub #endif From 0322ad028da3e586b22d771e08cf4d4230ff5507 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 21 Feb 2019 11:33:35 -0800 Subject: [PATCH 267/674] Update slurm pmi configury to account for pmix When Slurm is built against PMIx, some installations place a copy of the PMIx library that Slurm is linking against in the Slurm PMI location. Current configury ignores that location. The desired behavior is to look for a PMIx lib in that location when --with-pmi is given. If the user also specifies --with-pmix and gives a different location, then override anything previously found and look for it where the user directed. Signed-off-by: Ralph Castain (cherry picked from commit cd1b5641beca7f158360983cd31f7297548b0a3c) --- config/opal_check_pmi.m4 | 400 +++++++++++++++++++++++++++++++--- configure.ac | 3 +- opal/mca/pmix/s1/configure.m4 | 3 +- opal/mca/pmix/s2/configure.m4 | 3 +- 4 files changed, 379 insertions(+), 30 deletions(-) diff --git a/config/opal_check_pmi.m4 b/config/opal_check_pmi.m4 index 042bdcc6969..3c4d84f906b 100644 --- a/config/opal_check_pmi.m4 +++ b/config/opal_check_pmi.m4 @@ -13,7 +13,7 @@ # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # Copyright (c) 2014-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -152,6 +152,7 @@ AC_DEFUN([OPAL_CHECK_PMI],[ check_pmi_lib_dir= default_pmi_libloc= slurm_pmi_found= + opal_enable_pmix=no AC_MSG_CHECKING([if user requested PMI support]) AS_IF([test "$with_pmi" = "no"], @@ -208,17 +209,24 @@ AC_DEFUN([OPAL_CHECK_PMI],[ opal_pmi2_rpath="$pmi2_rpath" AC_SUBST(opal_pmi2_rpath)])]) + # check for pmix lib installed by slurm */ + slurm_pmix_found=no + OPAL_CHECK_PMIX_LIB([$check_pmi_install_dir], + [$check_pmi_lib_dir], + [opal_enable_pmix=yes], + [opal_enable_pmix=no]) + # since support was explicitly requested, then we should error out # if we didn't find the required support AC_MSG_CHECKING([can PMI support be built]) - AS_IF([test "$opal_enable_pmi1" != "yes" && test "$opal_enable_pmi2" != "yes"], + AS_IF([test "$opal_enable_pmi1" != "yes" && test "$opal_enable_pmi2" != "yes" && test "$opal_enable_pmix" != "yes"], [AC_MSG_RESULT([no]) - AC_MSG_WARN([PMI support requested (via --with-pmi) but neither pmi.h]) - AC_MSG_WARN([nor pmi2.h were found under locations:]) + AC_MSG_WARN([PMI support requested (via --with-pmi) but neither pmi.h,]) + AC_MSG_WARN([pmi2.h or pmix.h were found under locations:]) AC_MSG_WARN([ $check_pmi_install_dir]) AC_MSG_WARN([ $check_pmi_install_dir/slurm]) AC_MSG_WARN([Specified path: $with_pmi]) - AC_MSG_WARN([OR neither libpmi nor libpmi2 were found under:]) + AC_MSG_WARN([OR neither libpmi, libpmi2, or libpmix were found under:]) AC_MSG_WARN([ $check_pmi_lib_dir/lib]) AC_MSG_WARN([ $check_pmi_lib_dir/lib64]) AC_MSG_WARN([Specified path: $with_pmi_libdir]) @@ -229,6 +237,158 @@ AC_DEFUN([OPAL_CHECK_PMI],[ OPAL_VAR_SCOPE_POP ]) +# define an internal function for checking the existence +# and validity of an external PMIx library +# +# OPAL_CHECK_PMIX_LIB(installdir, libdir, [action-if-valid], [action-if-not-valid]) +AC_DEFUN([OPAL_CHECK_PMIX_LIB],[ + + opal_external_pmix_happy=no + + # Make sure we have the headers and libs in the correct location + AC_MSG_CHECKING([for pmix.h in $1]) + files=`ls $1/pmix.h 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + opal_external_pmix_header_happy=yes], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([for pmix.h in $1/include]) + files=`ls $1/include/pmix.h 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + opal_external_pmix_header_happy=yes], + [AC_MSG_RESULT([not found]) + opal_external_pmix_header_happy=no])]) + + AS_IF([test "$opal_external_pmix_header_happy" = "yes"], + [AS_IF([test -n "$2"], + [AC_MSG_CHECKING([libpmix.* in $2]) + files=`ls $2/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$2], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $2/lib64]) + files=`ls $2/lib64/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$2/lib64], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $2/lib]) + files=`ls $2/lib/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$2/lib], + [AC_MSG_RESULT([not found]) + AC_MSG_ERROR([Cannot continue])])])])], + [# check for presence of lib64 directory - if found, see if the + # desired library is present and matches our build requirements + AC_MSG_CHECKING([libpmix.* in $1/lib64]) + files=`ls $1/lib64/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$1/lib64], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $1/lib]) + files=`ls $1/lib/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$1/lib], + [AC_MSG_RESULT([not found]) + AC_MSG_ERROR([Cannot continue])])])]) + + # check the version + opal_external_pmix_save_CPPFLAGS=$CPPFLAGS + opal_external_pmix_save_LDFLAGS=$LDFLAGS + opal_external_pmix_save_LIBS=$LIBS + + # if the pmix_version.h file does not exist, then + # this must be from a pre-1.1.5 version OMPI does + # NOT support anything older than v1.2.5 + AC_MSG_CHECKING([PMIx version]) + CPPFLAGS="-I$1/include $CPPFLAGS" + AS_IF([test "x`ls $1/include/pmix_version.h 2> /dev/null`" = "x"], + [AC_MSG_RESULT([version file not found - assuming v1.1.4]) + opal_external_pmix_version_found=1 + opal_external_pmix_happy=no + opal_external_pmix_version=internal], + [AC_MSG_RESULT([version file found]) + opal_external_pmix_version_found=0]) + + # if it does exist, then we need to parse it to find + # the actual release series + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 4x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR < 4L) + #error "not version 4 or above" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=4x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 3x or above]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 3L) + #error "not version 3" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=3x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 2x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 2L) + #error "not version 2" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=2x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 1x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 1L && PMIX_VERSION_MINOR != 2L) + #error "not version 1.2.x" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=1x + opal_external_pmix_version_found=1 + opal_external_have_pmix1=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "x$opal_external_pmix_version" = "x"], + [AC_MSG_WARN([External PMIx support detected, but version]) + AC_MSG_WARN([information of the external lib could not]) + AC_MSG_WARN([be detected]) + opal_external_pmix_happy=no]) + + CPPFLAGS=$opal_external_pmix_save_CPPFLAGS + LDFLAGS=$opal_external_pmix_save_LDFLAGS + LIBS=$opal_external_pmix_save_LIBS + ]) + AS_IF([test "$opal_external_pmix_happy" = "yes"], + [$3], [$4]) +]) + + AC_DEFUN([OPAL_CHECK_PMIX],[ OPAL_VAR_SCOPE_PUSH([opal_external_pmix_save_CPPFLAGS opal_external_pmix_save_LDFLAGS opal_external_pmix_save_LIBS]) @@ -247,13 +407,11 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AC_MSG_WARN([an external copy that you supply.]) AC_MSG_ERROR([Cannot continue])]) - AC_MSG_CHECKING([if user requested internal PMIx support($with_pmix)]) - opal_external_pmix_happy=no opal_external_have_pmix1=0 - - AS_IF([test "$with_pmix" = "internal"], - [AC_MSG_RESULT([yes]) + AS_IF([test "$opal_enable_pmix" = "no"], + [AC_MSG_CHECKING([if user requested internal PMIx support($with_pmix)]) opal_external_pmix_happy=no +<<<<<<< HEAD opal_external_pmix_version=internal], [AC_MSG_RESULT([no]) @@ -398,24 +556,216 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AC_MSG_WARN([of the external lib was not supported or the required]) AC_MSG_WARN([header/library files were not found]) AC_MSG_ERROR([Cannot continue])]) +||||||| parent of cd1b5641be... Update slurm pmi configury to account for pmix + opal_external_pmix_version=internal], + + [AC_MSG_RESULT([no]) + # check for external pmix lib */ + AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "external"], + [pmix_ext_install_dir=/usr], + [pmix_ext_install_dir=$with_pmix]) - # Final check - if they didn't point us explicitly at an external version - # but we found one anyway, use the internal version if it is higher - AS_IF([test "$opal_external_pmix_version" != "internal" && (test -z "$with_pmix" || test "$with_pmix" = "yes")], - [AS_IF([test "$opal_external_pmix_version" != "3x"], - [AC_MSG_WARN([discovered external PMIx version is less than internal version 3.x]) - AC_MSG_WARN([using internal PMIx]) + # Make sure we have the headers and libs in the correct location + AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir]) + files=`ls $pmix_ext_install_dir/pmix.h 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + opal_external_pmix_header_happy=yes], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir/include]) + files=`ls $pmix_ext_install_dir/include/pmix.h 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + opal_external_pmix_header_happy=yes], + [AC_MSG_RESULT([not found]) + opal_external_pmix_header_happy=no + opal_external_pmix_version=internal])]) + + AS_IF([test "$opal_external_pmix_header_happy" = "yes"], + [AS_IF([test -n "$with_pmix_libdir"], + [AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir]) + files=`ls $with_pmix_libdir/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$with_pmix_libdir], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib64]) + files=`ls $with_pmix_libdir/lib64/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$with_pmix_libdir/lib64], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib]) + files=`ls $with_pmix_libdir/lib/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$with_pmix_libdir/lib], + [AC_MSG_RESULT([not found]) + AC_MSG_ERROR([Cannot continue])])])])], + [# check for presence of lib64 directory - if found, see if the + # desired library is present and matches our build requirements + AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib64]) + files=`ls $pmix_ext_install_dir/lib64/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$pmix_ext_install_dir/lib64], + [AC_MSG_RESULT([not found]) + AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib]) + files=`ls $pmix_ext_install_dir/lib/libpmix.* 2> /dev/null | wc -l` + AS_IF([test "$files" -gt 0], + [AC_MSG_RESULT([found]) + pmix_ext_install_libdir=$pmix_ext_install_dir/lib], + [AC_MSG_RESULT([not found]) + AC_MSG_ERROR([Cannot continue])])])]) + + # check the version + opal_external_pmix_save_CPPFLAGS=$CPPFLAGS + opal_external_pmix_save_LDFLAGS=$LDFLAGS + opal_external_pmix_save_LIBS=$LIBS + + # if the pmix_version.h file does not exist, then + # this must be from a pre-1.1.5 version OMPI does + # NOT support anything older than v1.2.5 + AC_MSG_CHECKING([PMIx version]) + CPPFLAGS="-I$pmix_ext_install_dir/include $CPPFLAGS" + AS_IF([test "x`ls $pmix_ext_install_dir/include/pmix_version.h 2> /dev/null`" = "x"], + [AC_MSG_RESULT([version file not found - assuming v1.1.4]) + opal_external_pmix_version_found=1 + opal_external_pmix_happy=no + opal_external_pmix_version=internal], + [AC_MSG_RESULT([version file found]) + opal_external_pmix_version_found=0]) + + # if it does exist, then we need to parse it to find + # the actual release series + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 4x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR < 4L) + #error "not version 4 or above" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=4x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 3x or above]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 3L) + #error "not version 3" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=3x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 2x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 2L) + #error "not version 2" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=2x + opal_external_pmix_version_found=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "$opal_external_pmix_version_found" = "0"], + [AC_MSG_CHECKING([version 1x]) + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ + #include + #if (PMIX_VERSION_MAJOR != 1L && PMIX_VERSION_MINOR != 2L) + #error "not version 1.2.x" + #endif + ], [])], + [AC_MSG_RESULT([found]) + opal_external_pmix_version=1x + opal_external_pmix_version_found=1 + opal_external_have_pmix1=1 + opal_external_pmix_happy=yes], + [AC_MSG_RESULT([not found])])]) + + AS_IF([test "x$opal_external_pmix_version" = "x"], + [AC_MSG_WARN([External PMIx support detected, but version]) + AC_MSG_WARN([information of the external lib could not]) + AC_MSG_WARN([be detected]) + AC_MSG_WARN([Internal version will be used]) + opal_external_pmix_happy=no]) + + CPPFLAGS=$opal_external_pmix_save_CPPFLAGS + LDFLAGS=$opal_external_pmix_save_LDFLAGS + LIBS=$opal_external_pmix_save_LIBS + ]) + ]) + + # Final check - if they explicitly pointed us at an external + # installation that wasn't acceptable, then error out + AS_IF([test -n "$with_pmix" && test "$with_pmix" != "yes" && test "$with_pmix" != "external" && test "$with_pmix" != "internal" && test "$opal_external_pmix_happy" = "no"], + [AC_MSG_WARN([External PMIx support requested, but either the version]) + AC_MSG_WARN([of the external lib was not supported or the required]) + AC_MSG_WARN([header/library files were not found]) + AC_MSG_ERROR([Cannot continue])]) +======= + pmix_ext_install_libdir= + pmix_ext_install_dir= +>>>>>>> cd1b5641be... Update slurm pmi configury to account for pmix + + AS_IF([test "$with_pmix" = "internal"], + [AC_MSG_RESULT([yes]) + opal_external_pmix_happy=no opal_external_pmix_version=internal - opal_external_pmix_happy=no])]) + opal_enable_pmix=yes], - AC_MSG_CHECKING([PMIx version to be used]) - AS_IF([test "$opal_external_pmix_happy" = "yes"], - [AC_MSG_RESULT([external($opal_external_pmix_version)]) - AS_IF([test "$pmix_ext_install_dir" != "/usr"], - [opal_external_pmix_CPPFLAGS="-I$pmix_ext_install_dir/include" - opal_external_pmix_LDFLAGS=-L$pmix_ext_install_libdir]) - opal_external_pmix_LIBS=-lpmix], - [AC_MSG_RESULT([internal])]) + [AC_MSG_RESULT([no]) + # check for external pmix lib */ + AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "external"], + [pmix_ext_install_dir=/usr], + [pmix_ext_install_dir=$with_pmix]) + AS_IF([test -n "$with_pmix_libdir"], + [pmix_ext_install_libdir=$with_pmix_libdir]) + OPAL_CHECK_PMIX_LIB([$pmix_ext_install_dir], + [$pmix_ext_install_libdir], + [opal_external_pmix_happy=yes + opal_enable_pmix=yes], + [opal_external_pmix_happy=no])]) + + # Final check - if they explicitly pointed us at an external + # installation that wasn't acceptable, then error out + AS_IF([test -n "$with_pmix" && test "$with_pmix" != "yes" && test "$with_pmix" != "external" && test "$with_pmix" != "internal" && test "$opal_external_pmix_happy" = "no"], + [AC_MSG_WARN([External PMIx support requested, but either the version]) + AC_MSG_WARN([of the external lib was not supported or the required]) + AC_MSG_WARN([header/library files were not found]) + AC_MSG_ERROR([Cannot continue])]) + + # Final check - if they didn't point us explicitly at an external version + # but we found one anyway, use the internal version if it is higher + AS_IF([test "$opal_external_pmix_version" != "internal" && (test -z "$with_pmix" || test "$with_pmix" = "yes")], + [AS_IF([test "$opal_external_pmix_version" != "3x"], + [AC_MSG_WARN([discovered external PMIx version is less than internal version 3.x]) + AC_MSG_WARN([using internal PMIx]) + opal_external_pmix_version=internal + opal_external_pmix_happy=no])]) + ]) + + AS_IF([test "$opal_enable_pmix" = "yes"], + [AC_MSG_CHECKING([PMIx version to be used]) + AS_IF([test "$opal_external_pmix_happy" = "yes"], + [AC_MSG_RESULT([external($opal_external_pmix_version)]) + AS_IF([test "$pmix_ext_install_dir" != "/usr"], + [opal_external_pmix_CPPFLAGS="-I$pmix_ext_install_dir/include" + opal_external_pmix_LDFLAGS=-L$pmix_ext_install_libdir]) + opal_external_pmix_LIBS=-lpmix], + [AC_MSG_RESULT([internal])])]) AC_DEFINE_UNQUOTED([OPAL_PMIX_V1],[$opal_external_have_pmix1], [Whether the external PMIx library is v1]) diff --git a/configure.ac b/configure.ac index d70c780deb4..e696df3f7c0 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ # Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2014-2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -260,6 +260,7 @@ m4_ifdef([project_oshmem], OPAL_CONFIGURE_OPTIONS OPAL_CHECK_OS_FLAVORS OPAL_CHECK_CUDA +OPAL_CHECK_PMI OPAL_CHECK_PMIX m4_ifdef([project_orte], [ORTE_CONFIGURE_OPTIONS]) m4_ifdef([project_ompi], [OMPI_CONFIGURE_OPTIONS]) diff --git a/opal/mca/pmix/s1/configure.m4 b/opal/mca/pmix/s1/configure.m4 index 974107be5e5..78acca50058 100644 --- a/opal/mca/pmix/s1/configure.m4 +++ b/opal/mca/pmix/s1/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2014 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -14,7 +14,6 @@ AC_DEFUN([MCA_opal_pmix_s1_CONFIG], [ AC_CONFIG_FILES([opal/mca/pmix/s1/Makefile]) AC_REQUIRE([OPAL_CHECK_UGNI]) - AC_REQUIRE([OPAL_CHECK_PMI]) # Evaluate succeed / fail AS_IF([test "$opal_enable_pmi1" = "yes" && test "$opal_check_ugni_happy" = "no"], diff --git a/opal/mca/pmix/s2/configure.m4 b/opal/mca/pmix/s2/configure.m4 index 5e3a7c4a31c..b3c8b06e78e 100644 --- a/opal/mca/pmix/s2/configure.m4 +++ b/opal/mca/pmix/s2/configure.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2014 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -14,7 +14,6 @@ AC_DEFUN([MCA_opal_pmix_s2_CONFIG], [ AC_CONFIG_FILES([opal/mca/pmix/s2/Makefile]) AC_REQUIRE([OPAL_CHECK_UGNI]) - AC_REQUIRE([OPAL_CHECK_PMI]) # Evaluate succeed / fail AS_IF([test "$opal_enable_pmi2" = "yes" && test "$opal_check_ugni_happy" = "no"], From 1675b8ee6514d23f89f0291d108dd5dff7782197 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 21 Feb 2019 13:28:10 -0800 Subject: [PATCH 268/674] Ensure we push/pop local AC vars in the right place Signed-off-by: Ralph Castain (cherry picked from commit c054d4d1cc063fd22c7111d15d8b14707506bfb7) --- config/opal_check_pmi.m4 | 313 +-------------------------------------- 1 file changed, 3 insertions(+), 310 deletions(-) diff --git a/config/opal_check_pmi.m4 b/config/opal_check_pmi.m4 index 3c4d84f906b..19f6f8a4595 100644 --- a/config/opal_check_pmi.m4 +++ b/config/opal_check_pmi.m4 @@ -243,6 +243,7 @@ AC_DEFUN([OPAL_CHECK_PMI],[ # OPAL_CHECK_PMIX_LIB(installdir, libdir, [action-if-valid], [action-if-not-valid]) AC_DEFUN([OPAL_CHECK_PMIX_LIB],[ + OPAL_VAR_SCOPE_PUSH([opal_external_pmix_save_CPPFLAGS opal_external_pmix_save_LDFLAGS opal_external_pmix_save_LIBS]) opal_external_pmix_happy=no # Make sure we have the headers and libs in the correct location @@ -386,13 +387,13 @@ AC_DEFUN([OPAL_CHECK_PMIX_LIB],[ ]) AS_IF([test "$opal_external_pmix_happy" = "yes"], [$3], [$4]) + + OPAL_VAR_SCOPE_POP ]) AC_DEFUN([OPAL_CHECK_PMIX],[ - OPAL_VAR_SCOPE_PUSH([opal_external_pmix_save_CPPFLAGS opal_external_pmix_save_LDFLAGS opal_external_pmix_save_LIBS]) - AC_ARG_WITH([pmix], [AC_HELP_STRING([--with-pmix(=DIR)], [Build PMIx support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of PMIx. "external" forces Open MPI to use an external installation of PMIx. Supplying a valid directory name also forces Open MPI to use an external installation of PMIx, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries. Note that Open MPI does not support --without-pmix.])]) @@ -411,314 +412,8 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ AS_IF([test "$opal_enable_pmix" = "no"], [AC_MSG_CHECKING([if user requested internal PMIx support($with_pmix)]) opal_external_pmix_happy=no -<<<<<<< HEAD - opal_external_pmix_version=internal], - - [AC_MSG_RESULT([no]) - # check for external pmix lib */ - AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "external"], - [pmix_ext_install_dir=/usr], - [pmix_ext_install_dir=$with_pmix]) - - # Make sure we have the headers and libs in the correct location - AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir]) - files=`ls $pmix_ext_install_dir/pmix.h 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - opal_external_pmix_header_happy=yes], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir/include]) - files=`ls $pmix_ext_install_dir/include/pmix.h 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - opal_external_pmix_header_happy=yes], - [AC_MSG_RESULT([not found]) - opal_external_pmix_header_happy=no - opal_external_pmix_version=internal])]) - - AS_IF([test "$opal_external_pmix_header_happy" = "yes"], - [AS_IF([test -n "$with_pmix_libdir"], - [AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir]) - files=`ls $with_pmix_libdir/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib64]) - files=`ls $with_pmix_libdir/lib64/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir/lib64], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib]) - files=`ls $with_pmix_libdir/lib/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir/lib], - [AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Cannot continue])])])])], - [# check for presence of lib64 directory - if found, see if the - # desired library is present and matches our build requirements - AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib64]) - files=`ls $pmix_ext_install_dir/lib64/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$pmix_ext_install_dir/lib64], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib]) - files=`ls $pmix_ext_install_dir/lib/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$pmix_ext_install_dir/lib], - [AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Cannot continue])])])]) - - # check the version - opal_external_pmix_save_CPPFLAGS=$CPPFLAGS - opal_external_pmix_save_LDFLAGS=$LDFLAGS - opal_external_pmix_save_LIBS=$LIBS - - # if the pmix_version.h file does not exist, then - # this must be from a pre-1.1.5 version OMPI does - # NOT support anything older than v1.2.5 - AC_MSG_CHECKING([PMIx version]) - CPPFLAGS="-I$pmix_ext_install_dir/include $CPPFLAGS" - AS_IF([test "x`ls $pmix_ext_install_dir/include/pmix_version.h 2> /dev/null`" = "x"], - [AC_MSG_RESULT([version file not found - assuming v1.1.4]) - opal_external_pmix_version_found=1 - opal_external_pmix_happy=no - opal_external_pmix_version=internal], - [AC_MSG_RESULT([version file found]) - opal_external_pmix_version_found=0]) - - # if it does exist, then we need to parse it to find - # the actual release series - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 3x or above]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR < 3L) - #error "not version 3 or above" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=3x - opal_external_pmix_version_found=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 2x]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR != 2L) - #error "not version 2" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=2x - opal_external_pmix_version_found=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 1x]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR != 1L && PMIX_VERSION_MINOR != 2L) - #error "not version 1.2.x" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=1x - opal_external_pmix_version_found=1 - opal_external_have_pmix1=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "x$opal_external_pmix_version" = "x"], - [AC_MSG_WARN([External PMIx support detected, but version]) - AC_MSG_WARN([information of the external lib could not]) - AC_MSG_WARN([be detected]) - AC_MSG_WARN([Internal version will be used]) - opal_external_pmix_happy=no]) - - CPPFLAGS=$opal_external_pmix_save_CPPFLAGS - LDFLAGS=$opal_external_pmix_save_LDFLAGS - LIBS=$opal_external_pmix_save_LIBS - ]) - ]) - - # Final check - if they explicitly pointed us at an external - # installation that wasn't acceptable, then error out - AS_IF([test -n "$with_pmix" && test "$with_pmix" != "yes" && test "$with_pmix" != "external" && test "$with_pmix" != "internal" && test "$opal_external_pmix_happy" = "no"], - [AC_MSG_WARN([External PMIx support requested, but either the version]) - AC_MSG_WARN([of the external lib was not supported or the required]) - AC_MSG_WARN([header/library files were not found]) - AC_MSG_ERROR([Cannot continue])]) -||||||| parent of cd1b5641be... Update slurm pmi configury to account for pmix - opal_external_pmix_version=internal], - - [AC_MSG_RESULT([no]) - # check for external pmix lib */ - AS_IF([test -z "$with_pmix" || test "$with_pmix" = "yes" || test "$with_pmix" = "external"], - [pmix_ext_install_dir=/usr], - [pmix_ext_install_dir=$with_pmix]) - - # Make sure we have the headers and libs in the correct location - AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir]) - files=`ls $pmix_ext_install_dir/pmix.h 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - opal_external_pmix_header_happy=yes], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([for pmix.h in $pmix_ext_install_dir/include]) - files=`ls $pmix_ext_install_dir/include/pmix.h 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - opal_external_pmix_header_happy=yes], - [AC_MSG_RESULT([not found]) - opal_external_pmix_header_happy=no - opal_external_pmix_version=internal])]) - - AS_IF([test "$opal_external_pmix_header_happy" = "yes"], - [AS_IF([test -n "$with_pmix_libdir"], - [AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir]) - files=`ls $with_pmix_libdir/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib64]) - files=`ls $with_pmix_libdir/lib64/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir/lib64], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $with_pmix_libdir/lib]) - files=`ls $with_pmix_libdir/lib/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$with_pmix_libdir/lib], - [AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Cannot continue])])])])], - [# check for presence of lib64 directory - if found, see if the - # desired library is present and matches our build requirements - AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib64]) - files=`ls $pmix_ext_install_dir/lib64/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$pmix_ext_install_dir/lib64], - [AC_MSG_RESULT([not found]) - AC_MSG_CHECKING([libpmix.* in $pmix_ext_install_dir/lib]) - files=`ls $pmix_ext_install_dir/lib/libpmix.* 2> /dev/null | wc -l` - AS_IF([test "$files" -gt 0], - [AC_MSG_RESULT([found]) - pmix_ext_install_libdir=$pmix_ext_install_dir/lib], - [AC_MSG_RESULT([not found]) - AC_MSG_ERROR([Cannot continue])])])]) - - # check the version - opal_external_pmix_save_CPPFLAGS=$CPPFLAGS - opal_external_pmix_save_LDFLAGS=$LDFLAGS - opal_external_pmix_save_LIBS=$LIBS - - # if the pmix_version.h file does not exist, then - # this must be from a pre-1.1.5 version OMPI does - # NOT support anything older than v1.2.5 - AC_MSG_CHECKING([PMIx version]) - CPPFLAGS="-I$pmix_ext_install_dir/include $CPPFLAGS" - AS_IF([test "x`ls $pmix_ext_install_dir/include/pmix_version.h 2> /dev/null`" = "x"], - [AC_MSG_RESULT([version file not found - assuming v1.1.4]) - opal_external_pmix_version_found=1 - opal_external_pmix_happy=no - opal_external_pmix_version=internal], - [AC_MSG_RESULT([version file found]) - opal_external_pmix_version_found=0]) - - # if it does exist, then we need to parse it to find - # the actual release series - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 4x]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR < 4L) - #error "not version 4 or above" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=4x - opal_external_pmix_version_found=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 3x or above]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR != 3L) - #error "not version 3" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=3x - opal_external_pmix_version_found=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 2x]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR != 2L) - #error "not version 2" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=2x - opal_external_pmix_version_found=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "$opal_external_pmix_version_found" = "0"], - [AC_MSG_CHECKING([version 1x]) - AC_PREPROC_IFELSE([AC_LANG_PROGRAM([ - #include - #if (PMIX_VERSION_MAJOR != 1L && PMIX_VERSION_MINOR != 2L) - #error "not version 1.2.x" - #endif - ], [])], - [AC_MSG_RESULT([found]) - opal_external_pmix_version=1x - opal_external_pmix_version_found=1 - opal_external_have_pmix1=1 - opal_external_pmix_happy=yes], - [AC_MSG_RESULT([not found])])]) - - AS_IF([test "x$opal_external_pmix_version" = "x"], - [AC_MSG_WARN([External PMIx support detected, but version]) - AC_MSG_WARN([information of the external lib could not]) - AC_MSG_WARN([be detected]) - AC_MSG_WARN([Internal version will be used]) - opal_external_pmix_happy=no]) - - CPPFLAGS=$opal_external_pmix_save_CPPFLAGS - LDFLAGS=$opal_external_pmix_save_LDFLAGS - LIBS=$opal_external_pmix_save_LIBS - ]) - ]) - - # Final check - if they explicitly pointed us at an external - # installation that wasn't acceptable, then error out - AS_IF([test -n "$with_pmix" && test "$with_pmix" != "yes" && test "$with_pmix" != "external" && test "$with_pmix" != "internal" && test "$opal_external_pmix_happy" = "no"], - [AC_MSG_WARN([External PMIx support requested, but either the version]) - AC_MSG_WARN([of the external lib was not supported or the required]) - AC_MSG_WARN([header/library files were not found]) - AC_MSG_ERROR([Cannot continue])]) -======= pmix_ext_install_libdir= pmix_ext_install_dir= ->>>>>>> cd1b5641be... Update slurm pmi configury to account for pmix AS_IF([test "$with_pmix" = "internal"], [AC_MSG_RESULT([yes]) @@ -775,6 +470,4 @@ AC_DEFUN([OPAL_CHECK_PMIX],[ [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [External (1.2.5) WARNING - DYNAMIC OPS NOT SUPPORTED])], [OPAL_SUMMARY_ADD([[Miscellaneous]],[[PMIx support]], [opal_pmix], [External ($opal_external_pmix_version)])])], [OPAL_SUMMARY_ADD([[Miscellaneous]], [[PMIx support]], [opal_pmix], [Internal])]) - - OPAL_VAR_SCOPE_POP ]) From b5d46494cd8614775a8e0c39445b9136e8fc2249 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 26 Feb 2019 17:08:48 -0800 Subject: [PATCH 269/674] Fix cross-mpirun connect/accept operations Ensure we publish all the info required to be returned to the other mpirun when executing this operation. We need to know the daemon (and its URI) that is hosting each of the other procs so we can do a direct modex operation and retrieve their connection info. Signed-off-by: Ralph Castain (cherry picked from commit 60961ceb41cde6fbdc84694748696e90ddcfb345) --- orte/mca/state/base/state_base_fns.c | 5 +- orte/orted/pmix/pmix_server_dyn.c | 108 ++++++++++++++++++++- orte/orted/pmix/pmix_server_fence.c | 4 +- orte/orted/pmix/pmix_server_register_fns.c | 44 ++++++++- 4 files changed, 151 insertions(+), 10 deletions(-) diff --git a/orte/mca/state/base/state_base_fns.c b/orte/mca/state/base/state_base_fns.c index e3c5682cfd2..16f35c88680 100644 --- a/orte/mca/state/base/state_base_fns.c +++ b/orte/mca/state/base/state_base_fns.c @@ -953,8 +953,9 @@ void orte_state_base_check_all_complete(int fd, short args, void *cbdata) one_still_alive = false; j = opal_hash_table_get_first_key_uint32(orte_job_data, &u32, (void **)&job, &nptr); while (OPAL_SUCCESS == j) { - /* skip the daemon job */ - if (job->jobid == ORTE_PROC_MY_NAME->jobid) { + /* skip the daemon job and all jobs from other families */ + if (job->jobid == ORTE_PROC_MY_NAME->jobid || + ORTE_JOB_FAMILY(job->jobid) != ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid)) { goto next; } /* if this is the job we are checking AND it normally terminated, diff --git a/orte/orted/pmix/pmix_server_dyn.c b/orte/orted/pmix/pmix_server_dyn.c index a2f18c4532c..4a8bf3ee8d2 100644 --- a/orte/orted/pmix/pmix_server_dyn.c +++ b/orte/orted/pmix/pmix_server_dyn.c @@ -42,6 +42,7 @@ #include "orte/mca/errmgr/errmgr.h" #include "orte/mca/rmaps/base/base.h" +#include "orte/mca/rml/base/rml_contact.h" #include "orte/mca/state/state.h" #include "orte/util/name_fns.h" #include "orte/util/show_help.h" @@ -537,7 +538,14 @@ static void _cnlk(int status, opal_list_t *data, void *cbdata) int rc, cnt; opal_pmix_pdata_t *pdat; orte_job_t *jdata; - opal_buffer_t buf; + orte_node_t *node; + orte_proc_t *proc; + opal_buffer_t buf, bucket; + opal_byte_object_t *bo; + orte_process_name_t dmn, pname; + char *uri; + opal_value_t val; + opal_list_t nodes; ORTE_ACQUIRE_OBJECT(cd); @@ -554,6 +562,7 @@ static void _cnlk(int status, opal_list_t *data, void *cbdata) pdat = (opal_pmix_pdata_t*)opal_list_get_first(data); if (OPAL_BYTE_OBJECT != pdat->value.type) { rc = ORTE_ERR_BAD_PARAM; + ORTE_ERROR_LOG(rc); goto release; } /* the data will consist of a packed buffer with the job data in it */ @@ -563,15 +572,107 @@ static void _cnlk(int status, opal_list_t *data, void *cbdata) pdat->value.data.bo.size = 0; cnt = 1; if (OPAL_SUCCESS != (rc = opal_dss.unpack(&buf, &jdata, &cnt, ORTE_JOB))) { + ORTE_ERROR_LOG(rc); + OBJ_DESTRUCT(&buf); + goto release; + } + + /* unpack the byte object containing the daemon uri's */ + cnt=1; + if (ORTE_SUCCESS != (rc = opal_dss.unpack(&buf, &bo, &cnt, OPAL_BYTE_OBJECT))) { + ORTE_ERROR_LOG(rc); OBJ_DESTRUCT(&buf); goto release; } + /* load it into a buffer */ + OBJ_CONSTRUCT(&bucket, opal_buffer_t); + opal_dss.load(&bucket, bo->bytes, bo->size); + bo->bytes = NULL; + free(bo); + /* prep a list to save the nodes */ + OBJ_CONSTRUCT(&nodes, opal_list_t); + /* unpack and store the URI's */ + cnt = 1; + while (OPAL_SUCCESS == (rc = opal_dss.unpack(&bucket, &uri, &cnt, OPAL_STRING))) { + rc = orte_rml_base_parse_uris(uri, &dmn, NULL); + if (ORTE_SUCCESS != rc) { + OBJ_DESTRUCT(&buf); + OBJ_DESTRUCT(&bucket); + goto release; + } + /* save a node object for this daemon */ + node = OBJ_NEW(orte_node_t); + node->daemon = OBJ_NEW(orte_proc_t); + memcpy(&node->daemon->name, &dmn, sizeof(orte_process_name_t)); + opal_list_append(&nodes, &node->super); + /* register the URI */ + OBJ_CONSTRUCT(&val, opal_value_t); + val.key = OPAL_PMIX_PROC_URI; + val.type = OPAL_STRING; + val.data.string = uri; + if (OPAL_SUCCESS != (rc = opal_pmix.store_local(&dmn, &val))) { + ORTE_ERROR_LOG(rc); + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + OBJ_DESTRUCT(&buf); + OBJ_DESTRUCT(&bucket); + goto release; + } + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + cnt = 1; + } + OBJ_DESTRUCT(&bucket); + + /* unpack the proc-to-daemon map */ + cnt=1; + if (ORTE_SUCCESS != (rc = opal_dss.unpack(&buf, &bo, &cnt, OPAL_BYTE_OBJECT))) { + ORTE_ERROR_LOG(rc); + OBJ_DESTRUCT(&buf); + goto release; + } + /* load it into a buffer */ + OBJ_CONSTRUCT(&bucket, opal_buffer_t); + opal_dss.load(&bucket, bo->bytes, bo->size); + bo->bytes = NULL; + free(bo); + /* unpack and store the map */ + cnt = 1; + while (OPAL_SUCCESS == (rc = opal_dss.unpack(&bucket, &pname, &cnt, ORTE_NAME))) { + /* get the name of the daemon hosting it */ + if (OPAL_SUCCESS != (rc = opal_dss.unpack(&bucket, &dmn, &cnt, ORTE_NAME))) { + OBJ_DESTRUCT(&buf); + OBJ_DESTRUCT(&bucket); + goto release; + } + /* create the proc object */ + proc = OBJ_NEW(orte_proc_t); + memcpy(&proc->name, &pname, sizeof(orte_process_name_t)); + opal_pointer_array_set_item(jdata->procs, pname.vpid, proc); + /* find the daemon */ + OPAL_LIST_FOREACH(node, &nodes, orte_node_t) { + if (node->daemon->name.vpid == dmn.vpid) { + OBJ_RETAIN(node); + proc->node = node; + break; + } + } + } + OBJ_DESTRUCT(&bucket); + OPAL_LIST_DESTRUCT(&nodes); OBJ_DESTRUCT(&buf); + + /* register the nspace */ if (ORTE_SUCCESS != (rc = orte_pmix_server_register_nspace(jdata, true))) { + ORTE_ERROR_LOG(rc); OBJ_RELEASE(jdata); goto release; } - OBJ_RELEASE(jdata); // no reason to keep this around + + /* save the job object so we don't endlessly cycle */ + opal_hash_table_set_value_uint32(orte_job_data, jdata->jobid, jdata); /* restart the cnct processor */ ORTE_PMIX_OPERATION(cd->procs, cd->info, _cnct, cd->cbfunc, cd->cbdata); @@ -617,6 +718,7 @@ static void _cnct(int sd, short args, void *cbdata) * out about it, and all we can do is return an error */ if (orte_pmix_server_globals.server.jobid == ORTE_PROC_MY_HNP->jobid && orte_pmix_server_globals.server.vpid == ORTE_PROC_MY_HNP->vpid) { + ORTE_ERROR_LOG(ORTE_ERR_NOT_SUPPORTED); rc = ORTE_ERR_NOT_SUPPORTED; goto release; } @@ -632,6 +734,7 @@ static void _cnct(int sd, short args, void *cbdata) kv->data.uint32 = geteuid(); opal_list_append(cd->info, &kv->super); if (ORTE_SUCCESS != (rc = pmix_server_lookup_fn(&nm->name, keys, cd->info, _cnlk, cd))) { + ORTE_ERROR_LOG(rc); opal_argv_free(keys); goto release; } @@ -645,6 +748,7 @@ static void _cnct(int sd, short args, void *cbdata) if (!orte_get_attribute(&jdata->attributes, ORTE_JOB_NSPACE_REGISTERED, NULL, OPAL_BOOL)) { /* it hasn't been registered yet, so register it now */ if (ORTE_SUCCESS != (rc = orte_pmix_server_register_nspace(jdata, true))) { + ORTE_ERROR_LOG(rc); goto release; } } diff --git a/orte/orted/pmix/pmix_server_fence.c b/orte/orted/pmix/pmix_server_fence.c index fe0f942cd10..e5a1dab4bab 100644 --- a/orte/orted/pmix/pmix_server_fence.c +++ b/orte/orted/pmix/pmix_server_fence.c @@ -227,6 +227,7 @@ static void dmodex_req(int sd, short args, void *cbdata) rc = ORTE_ERR_NOT_FOUND; goto callback; } + /* point the request to the daemon that is hosting the * target process */ req->proxy.vpid = dmn->name.vpid; @@ -240,7 +241,8 @@ static void dmodex_req(int sd, short args, void *cbdata) /* if we are the host daemon, then this is a local request, so * just wait for the data to come in */ - if (ORTE_PROC_MY_NAME->vpid == dmn->name.vpid) { + if (ORTE_PROC_MY_NAME->jobid == dmn->name.jobid && + ORTE_PROC_MY_NAME->vpid == dmn->name.vpid) { return; } diff --git a/orte/orted/pmix/pmix_server_register_fns.c b/orte/orted/pmix/pmix_server_register_fns.c index 395d89e07fa..0a0a54d764a 100644 --- a/orte/orted/pmix/pmix_server_register_fns.c +++ b/orte/orted/pmix/pmix_server_register_fns.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science @@ -71,6 +71,9 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata, bool force) gid_t gid; opal_list_t *cache; hwloc_obj_t machine; + opal_buffer_t buf, bucket; + opal_byte_object_t bo, *boptr; + orte_proc_t *proc; opal_output_verbose(2, orte_pmix_server_globals.output, "%s register nspace for %s", @@ -472,21 +475,52 @@ int orte_pmix_server_register_nspace(orte_job_t *jdata, bool force) jdata->num_local_procs, info, NULL, NULL); OPAL_LIST_RELEASE(info); + if (OPAL_SUCCESS != rc) { + return rc; + } - /* if the user has connected us to an external server, then we must - * assume there is going to be some cross-mpirun exchange, and so + /* if I am the HNP and this job is a member of my family, then we must + * assume there could be some cross-mpirun exchange, and so * we protect against that situation by publishing the job info * for this job - this allows any subsequent "connect" to retrieve * the job info */ - if (NULL != orte_data_server_uri) { - opal_buffer_t buf; + if (ORTE_PROC_IS_HNP && ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid) == ORTE_JOB_FAMILY(jdata->jobid)) { + /* pack the job - note that this doesn't include the procs + * or their locations */ OBJ_CONSTRUCT(&buf, opal_buffer_t); if (OPAL_SUCCESS != (rc = opal_dss.pack(&buf, &jdata, 1, ORTE_JOB))) { ORTE_ERROR_LOG(rc); OBJ_DESTRUCT(&buf); return rc; } + + /* pack the hostname, daemon vpid and contact URI for each involved node */ + map = jdata->map; + OBJ_CONSTRUCT(&bucket, opal_buffer_t); + for (i=0; i < map->nodes->size; i++) { + if (NULL == (node = (orte_node_t*)opal_pointer_array_get_item(map->nodes, i))) { + continue; + } + opal_dss.pack(&bucket, &node->daemon->rml_uri, 1, OPAL_STRING); + } + opal_dss.unload(&bucket, (void**)&bo.bytes, &bo.size); + boptr = &bo; + opal_dss.pack(&buf, &boptr, 1, OPAL_BYTE_OBJECT); + + /* pack the proc name and daemon vpid for each proc */ + OBJ_CONSTRUCT(&bucket, opal_buffer_t); + for (i=0; i < jdata->procs->size; i++) { + if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, i))) { + continue; + } + opal_dss.pack(&bucket, &proc->name, 1, ORTE_NAME); + opal_dss.pack(&bucket, &proc->node->daemon->name, 1, ORTE_NAME); + } + opal_dss.unload(&bucket, (void**)&bo.bytes, &bo.size); + boptr = &bo; + opal_dss.pack(&buf, &boptr, 1, OPAL_BYTE_OBJECT); + info = OBJ_NEW(opal_list_t); /* create a key-value with the key being the string jobid * and the value being the byte object */ From a9ba07b04ed22c6de188e159d84dcda5dec27f66 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 5 Mar 2019 09:47:38 +0900 Subject: [PATCH 270/674] btl/usnic: fix usnic_btl_run_tests CPPFLAGS do define the OMPI_LIBMPI_NAME macro via the CPPFLAGS. The issue occurs when Open MPI is configured with --enable-opal-btl-usnic-unit-tests Thanks George Marselis for reporting this issue Refs. open-mpi/ompi#6441 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b4097626ab256d2ace27a99b7fd174cd2709533e) --- opal/mca/btl/usnic/Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/usnic/Makefile.am b/opal/mca/btl/usnic/Makefile.am index 9a270c043b0..59f80df8b72 100644 --- a/opal/mca/btl/usnic/Makefile.am +++ b/opal/mca/btl/usnic/Makefile.am @@ -16,6 +16,8 @@ # Copyright (c) 2016-2017 IBM Corporation. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -103,7 +105,8 @@ libmca_btl_usnic_la_LIBADD = $(opal_ofi_LIBS) if OPAL_BTL_USNIC_BUILD_UNIT_TESTS usnic_btl_run_tests_CPPFLAGS = \ - -DBTL_USNIC_RUN_TESTS_SYMBOL=\"opal_btl_usnic_run_tests\" + -DBTL_USNIC_RUN_TESTS_SYMBOL=\"opal_btl_usnic_run_tests\" \ + -DOMPI_LIBMPI_NAME=\"$(OMPI_LIBMPI_NAME)\" usnic_btl_run_tests_SOURCES = test/usnic_btl_run_tests.c usnic_btl_run_tests_LDADD = -ldl bin_PROGRAMS = usnic_btl_run_tests From 8c4c98227136273d8a1d5bb43db482c7c1f6a23e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 5 Mar 2019 09:30:21 -0800 Subject: [PATCH 271/674] btl/usnic: amend Makefile.am fix from b4097626ab Use $(AM_CPPFLAGS) in $(usnic_btl_run_tests_CPPFLAGS) so that we don't have to replicate hard-coded values. Signed-off-by: Jeff Squyres (cherry picked from commit 14563770a1d64c465ee1f205c9981de39970bb33) --- opal/mca/btl/usnic/Makefile.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/opal/mca/btl/usnic/Makefile.am b/opal/mca/btl/usnic/Makefile.am index 59f80df8b72..17d62cc429e 100644 --- a/opal/mca/btl/usnic/Makefile.am +++ b/opal/mca/btl/usnic/Makefile.am @@ -104,9 +104,8 @@ libmca_btl_usnic_la_LDFLAGS = \ libmca_btl_usnic_la_LIBADD = $(opal_ofi_LIBS) if OPAL_BTL_USNIC_BUILD_UNIT_TESTS -usnic_btl_run_tests_CPPFLAGS = \ - -DBTL_USNIC_RUN_TESTS_SYMBOL=\"opal_btl_usnic_run_tests\" \ - -DOMPI_LIBMPI_NAME=\"$(OMPI_LIBMPI_NAME)\" +usnic_btl_run_tests_CPPFLAGS = $(AM_CPPFLAGS) \ + -DBTL_USNIC_RUN_TESTS_SYMBOL=\"opal_btl_usnic_run_tests\" usnic_btl_run_tests_SOURCES = test/usnic_btl_run_tests.c usnic_btl_run_tests_LDADD = -ldl bin_PROGRAMS = usnic_btl_run_tests From d174e46dc11d2cca9789ef3151dab8ebd81291dc Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Wed, 28 Nov 2018 21:19:44 +0100 Subject: [PATCH 272/674] OSHMEM: Let `pshmem.h` include `shmem.h` to be stand-alone again See #6093 Signed-off-by: Bert Wesarg (cherry picked from commit f46130cd20914a3c60b19c3b2ed7c4b380319ee9) --- oshmem/include/pshmem.h | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 428705e014e..053799b0b7e 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -14,32 +14,7 @@ #ifndef PSHMEM_SHMEM_H #define PSHMEM_SHMEM_H - -#include /* include for ptrdiff_t */ -#include /* include for fixed width types */ -#if defined(c_plusplus) || defined(__cplusplus) -# include -# define OSHMEM_COMPLEX_TYPE(type) std::complex -#else -# include -# define OSHMEM_COMPLEX_TYPE(type) type complex -#endif - - -#ifndef OSHMEM_DECLSPEC -# if defined(OPAL_C_HAVE_VISIBILITY) && (OPAL_C_HAVE_VISIBILITY == 1) -# define OSHMEM_DECLSPEC __attribute__((visibility("default"))) -# else -# define OSHMEM_DECLSPEC -# endif -#endif - -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) -#define OSHMEMP_HAVE_C11 1 -#else -#define OSHMEMP_HAVE_C11 0 -#endif - +#include #include #if defined(c_plusplus) || defined(__cplusplus) From 9c5d4bb3b9946eedbf0df459230eedfde3a73ba2 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Dec 2018 14:03:16 +0900 Subject: [PATCH 273/674] oshmem: fix macro usage in pshmem.h pshmem.h now includes shmem.h (since open-mpi/ompi@f46130cd20914a3c60b19c3b2ed7c4b380319ee9) and some macros were removed at that time. Use the OSHMEM_HAVE_C11 macro (defined in shmem.h) instead of the previous OSHMEMP_HAVE_C11 macrso previously defined in pshmem.h Signed-off-by: Gilles Gouaillardet (cherry picked from commit 5ea939aa542605503b7926a44df10e23a344d063) --- oshmem/include/pshmem.h | 68 ++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/oshmem/include/pshmem.h b/oshmem/include/pshmem.h index 053799b0b7e..0c72bcf5330 100644 --- a/oshmem/include/pshmem.h +++ b/oshmem/include/pshmem.h @@ -2,8 +2,8 @@ * Copyright (c) 2014-2017 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved - * Copyright (c) 2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2016-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -122,7 +122,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_p(uint32_t* addr, uint32_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint64_p(uint64_t* addr, uint64_t value, int pe); OSHMEM_DECLSPEC void pshmem_size_p(size_t* addr, size_t value, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_p(ptrdiff_t* addr, ptrdiff_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_p(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -209,7 +209,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_put(uint32_t *target, const uint32_t *source OSHMEM_DECLSPEC void pshmem_uint64_put(uint64_t *target, const uint64_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_put(size_t *target, const size_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_put(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_put(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ @@ -310,7 +310,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_iput(uint32_t* target, const uint32_t* source OSHMEM_DECLSPEC void pshmem_uint64_iput(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_iput(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_iput(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst,size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_iput(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -409,7 +409,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_put_nbi(uint32_t *target, const uint32_t *so OSHMEM_DECLSPEC void pshmem_uint64_put_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_put_nbi(size_t *target, const size_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_put_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_put_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic(&*(__OSHMEM_VAR_ARG2(__VA_ARGS__)),\ @@ -510,7 +510,7 @@ OSHMEM_DECLSPEC uint32_t pshmem_uint32_g(const uint32_t* addr, int pe); OSHMEM_DECLSPEC uint64_t pshmem_uint64_g(const uint64_t* addr, int pe); OSHMEM_DECLSPEC size_t pshmem_size_g(const size_t* addr, int pe); OSHMEM_DECLSPEC ptrdiff_t pshmem_ptrdiff_g(const ptrdiff_t* addr, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_g(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -597,7 +597,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_get(uint32_t *target, const uint32_t *source OSHMEM_DECLSPEC void pshmem_uint64_get(uint64_t *target, const uint64_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_get(size_t *target, const size_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_get(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_get(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -698,7 +698,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_iget(uint32_t* target, const uint32_t* source OSHMEM_DECLSPEC void pshmem_uint64_iget(uint64_t* target, const uint64_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_iget(size_t* target, const size_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_iget(ptrdiff_t* target, const ptrdiff_t* source, ptrdiff_t tst, ptrdiff_t sst, size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_iget(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -798,7 +798,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_get_nbi(uint32_t *target, const uint32_t *so OSHMEM_DECLSPEC void pshmem_uint64_get_nbi(uint64_t *target, const uint64_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_size_get_nbi(size_t *target, const size_t *source, size_t len, int pe); OSHMEM_DECLSPEC void pshmem_ptrdiff_get_nbi(ptrdiff_t *target, const ptrdiff_t *source, size_t len, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_get_nbi(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -867,7 +867,7 @@ OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_swap(unsigned long *target, un OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_swap(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC float pshmem_float_atomic_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_swap(double *target, double value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_swap(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -895,7 +895,7 @@ OSHMEM_DECLSPEC long pshmem_long_swap(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_swap(long long*target, long long value, int pe); OSHMEM_DECLSPEC float pshmem_float_swap(float *target, float value, int pe); OSHMEM_DECLSPEC double pshmem_double_swap(double *target, double value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_swap(dst, val, pe) \ _Generic(&*(dst), \ int*: pshmem_int_swap, \ @@ -923,7 +923,7 @@ OSHMEM_DECLSPEC void pshmem_ulong_atomic_set(unsigned long *target, unsigned lon OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_set(unsigned long long *target, unsigned long long value, int pe); OSHMEM_DECLSPEC void pshmem_float_atomic_set(float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_atomic_set(double *target, double value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_set(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -951,7 +951,7 @@ OSHMEM_DECLSPEC void pshmem_long_set(long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_set(long long *target, long long value, int pe); OSHMEM_DECLSPEC void pshmem_float_set(float *target, float value, int pe); OSHMEM_DECLSPEC void pshmem_double_set(double *target, double value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_set(dst, val, pe) \ _Generic(&*(dst), \ int*: pshmem_int_set, \ @@ -976,7 +976,7 @@ OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_compare_swap(unsigned int *targe OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_compare_swap(unsigned long *target, unsigned long cond, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_compare_swap(unsigned long long *target, unsigned long long cond, unsigned long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_compare_swap(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -998,7 +998,7 @@ OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_compare_swap(unsigned OSHMEM_DECLSPEC int pshmem_int_cswap(int *target, int cond, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_cswap(long *target, long cond, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_cswap(long long *target, long long cond, long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_cswap(dst, cond, val, pe) \ _Generic(&*(dst), \ int*: pshmem_int_cswap, \ @@ -1020,7 +1020,7 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_add(long long *target, lo OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_add(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_add(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_add(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch_add(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1042,7 +1042,7 @@ OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_add(unsigned lo OSHMEM_DECLSPEC int pshmem_int_fadd(int *target, int value, int pe); OSHMEM_DECLSPEC long pshmem_long_fadd(long *target, long value, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_fadd(long long *target, long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_fadd(dst, val, pe) \ _Generic(&*(dst), \ int*: pshmem_int_fadd, \ @@ -1072,7 +1072,7 @@ OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_and(int32_t *target, int32_t v OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_and(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_and(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_and(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1121,7 +1121,7 @@ OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_or(int32_t *target, int32_t va OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_or(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_or(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_or(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1170,7 +1170,7 @@ OSHMEM_DECLSPEC int32_t pshmem_int32_atomic_fetch_xor(int32_t *target, int32_t v OSHMEM_DECLSPEC int64_t pshmem_int64_atomic_fetch_xor(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC uint32_t pshmem_uint32_atomic_fetch_xor(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC uint64_t pshmem_uint64_atomic_fetch_xor(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1215,7 +1215,7 @@ OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch(const unsigned long *tar OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch(const unsigned long long *target, int pe); OSHMEM_DECLSPEC float pshmem_float_atomic_fetch(const float *target, int pe); OSHMEM_DECLSPEC double pshmem_double_atomic_fetch(const double *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1243,7 +1243,7 @@ OSHMEM_DECLSPEC long pshmem_long_fetch(const long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_fetch(const long long *target, int pe); OSHMEM_DECLSPEC float pshmem_float_fetch(const float *target, int pe); OSHMEM_DECLSPEC double pshmem_double_fetch(const double *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_fetch(dst, pe) \ _Generic(&*(dst), \ int*: pshmem_int_fetch, \ @@ -1267,7 +1267,7 @@ OSHMEM_DECLSPEC long long pshmem_longlong_atomic_fetch_inc(long long *target, in OSHMEM_DECLSPEC unsigned int pshmem_uint_atomic_fetch_inc(unsigned int *target, int pe); OSHMEM_DECLSPEC unsigned long pshmem_ulong_atomic_fetch_inc(unsigned long *target, int pe); OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_inc(unsigned long long *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_fetch_inc(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1289,7 +1289,7 @@ OSHMEM_DECLSPEC unsigned long long pshmem_ulonglong_atomic_fetch_inc(unsigned lo OSHMEM_DECLSPEC int pshmem_int_finc(int *target, int pe); OSHMEM_DECLSPEC long pshmem_long_finc(long *target, int pe); OSHMEM_DECLSPEC long long pshmem_longlong_finc(long long *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_finc(dst, pe) \ _Generic(&*(dst), \ int*: pshmem_int_finc, \ @@ -1311,7 +1311,7 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_add(long long *target, long long val OSHMEM_DECLSPEC void pshmem_uint_atomic_add(unsigned int *target, unsigned int value, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_add(unsigned long *target, unsigned long value, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_add(unsigned long long *target, unsigned long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_add(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1333,7 +1333,7 @@ OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_add(unsigned long long *target, uns OSHMEM_DECLSPEC void pshmem_int_add(int *target, int value, int pe); OSHMEM_DECLSPEC void pshmem_long_add(long *target, long value, int pe); OSHMEM_DECLSPEC void pshmem_longlong_add(long long *target, long long value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_add(dst, val, pe) \ _Generic(&*(dst), \ int*: pshmem_int_add, \ @@ -1363,7 +1363,7 @@ OSHMEM_DECLSPEC void pshmem_int32_atomic_and(int32_t *target, int32_t value, int OSHMEM_DECLSPEC void pshmem_int64_atomic_and(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint32_atomic_and(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint64_atomic_and(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_and(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1404,7 +1404,7 @@ OSHMEM_DECLSPEC void pshmem_int32_atomic_or(int32_t *target, int32_t value, int OSHMEM_DECLSPEC void pshmem_int64_atomic_or(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint32_atomic_or(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint64_atomic_or(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_or(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1445,7 +1445,7 @@ OSHMEM_DECLSPEC void pshmem_int32_atomic_xor(int32_t *target, int32_t value, int OSHMEM_DECLSPEC void pshmem_int64_atomic_xor(int64_t *target, int64_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint32_atomic_xor(uint32_t *target, uint32_t value, int pe); OSHMEM_DECLSPEC void pshmem_uint64_atomic_xor(uint64_t *target, uint64_t value, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_xor(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1478,7 +1478,7 @@ OSHMEM_DECLSPEC void pshmem_longlong_atomic_inc(long long *target, int pe); OSHMEM_DECLSPEC void pshmem_uint_atomic_inc(unsigned int *target, int pe); OSHMEM_DECLSPEC void pshmem_ulong_atomic_inc(unsigned long *target, int pe); OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_inc(unsigned long long *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_atomic_inc(...) \ _Generic(&*(__OSHMEM_VAR_ARG1(__VA_ARGS__)), \ shmem_ctx_t: _Generic((__OSHMEM_VAR_ARG2(__VA_ARGS__)), \ @@ -1500,7 +1500,7 @@ OSHMEM_DECLSPEC void pshmem_ulonglong_atomic_inc(unsigned long long *target, int OSHMEM_DECLSPEC void pshmem_int_inc(int *target, int pe); OSHMEM_DECLSPEC void pshmem_long_inc(long *target, int pe); OSHMEM_DECLSPEC void pshmem_longlong_inc(long long *target, int pe); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_inc(dst, pe) \ _Generic(&*(dst), \ int*: pshmem_int_inc, \ @@ -1538,7 +1538,7 @@ OSHMEM_DECLSPEC void pshmem_uint32_wait_until(volatile uint32_t *addr, int cmp, OSHMEM_DECLSPEC void pshmem_uint64_wait_until(volatile uint64_t *addr, int cmp, uint64_t value); OSHMEM_DECLSPEC void pshmem_size_wait_until(volatile size_t *addr, int cmp, size_t value); OSHMEM_DECLSPEC void pshmem_ptrdiff_wait_until(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_wait_until(addr, cmp, value) \ _Generic(&*(addr), \ short*: pshmem_short_wait_until, \ @@ -1565,7 +1565,7 @@ OSHMEM_DECLSPEC int pshmem_uint32_test(volatile uint32_t *addr, int cmp, uint32 OSHMEM_DECLSPEC int pshmem_uint64_test(volatile uint64_t *addr, int cmp, uint64_t value); OSHMEM_DECLSPEC int pshmem_size_test(volatile size_t *addr, int cmp, size_t value); OSHMEM_DECLSPEC int pshmem_ptrdiff_test(volatile ptrdiff_t *addr, int cmp, ptrdiff_t value); -#if OSHMEMP_HAVE_C11 +#if OSHMEM_HAVE_C11 #define pshmem_test(addr, cmp, value) \ _Generic(&*(addr), \ short*: pshmem_short_test, \ From 320a839be950fa9a09243daa4ac46da53c462665 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sun, 21 Oct 2018 06:50:51 +0900 Subject: [PATCH 274/674] opal/datatype: correctly handle large datatypes Always use size_t (instead of converting to an uint32_t) in order to correctly support large datatypes. Thanks Ben Menadue for the initial bug report Refs open-mpi/ompi#6016 Signed-off-by: Gilles Gouaillardet --- opal/datatype/opal_convertor.c | 24 +++--- opal/datatype/opal_convertor.h | 24 +++--- opal/datatype/opal_convertor_raw.c | 28 +++---- opal/datatype/opal_copy_functions.c | 30 ++++--- .../opal_copy_functions_heterogeneous.c | 35 ++++---- opal/datatype/opal_datatype.h | 2 +- opal/datatype/opal_datatype_copy.h | 34 ++++---- opal/datatype/opal_datatype_dump.c | 12 +-- opal/datatype/opal_datatype_fake_stack.c | 8 +- opal/datatype/opal_datatype_optimize.c | 6 +- opal/datatype/opal_datatype_pack.c | 73 ++++++++-------- opal/datatype/opal_datatype_pack.h | 22 +++-- opal/datatype/opal_datatype_position.c | 58 ++++++------- opal/datatype/opal_datatype_unpack.c | 83 +++++++++---------- opal/datatype/opal_datatype_unpack.h | 22 +++-- 15 files changed, 226 insertions(+), 235 deletions(-) diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 63b4d714084..ce889f7e959 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2013-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2013-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 Intel, Inc. All rights reserved * $COPYRIGHT$ * @@ -330,7 +330,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* dt_stack_t* pStack; /* pointer to the position on the stack */ const opal_datatype_t* pData = pConvertor->pDesc; dt_elem_desc_t* pElems; - uint32_t count; + size_t count; ptrdiff_t extent; pStack = pConvertor->pStack; @@ -340,7 +340,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* */ pElems = pConvertor->use_desc->desc; - count = (uint32_t)(starting_point / pData->size); + count = starting_point / pData->size; extent = pData->ub - pData->lb; pStack[0].type = OPAL_DATATYPE_LOOP; /* the first one is always the loop */ @@ -349,7 +349,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pStack[0].disp = count * extent; /* now compute the number of pending bytes */ - count = (uint32_t)(starting_point - count * pData->size); + count = starting_point - count * pData->size; /** * We save the current displacement starting from the begining * of this data. @@ -563,7 +563,7 @@ size_t opal_convertor_compute_remote_size( opal_convertor_t* pConvertor ) int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf ) { /* Here I should check that the data is not overlapping */ @@ -605,7 +605,7 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf ) { convertor->flags |= CONVERTOR_SEND; @@ -699,11 +699,11 @@ int opal_convertor_clone( const opal_convertor_t* source, void opal_convertor_dump( opal_convertor_t* convertor ) { - opal_output( 0, "Convertor %p count %d stack position %d bConverted %ld\n" - "\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %d\n" + opal_output( 0, "Convertor %p count %" PRIsize_t" stack position %d bConverted %" PRIsize_t "\n" + "\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %" PRIsize_t "\n" "\tremote_arch %u local_arch %u\n", (void*)convertor, - convertor->count, convertor->stack_pos, (unsigned long)convertor->bConverted, + convertor->count, convertor->stack_pos, convertor->bConverted, (unsigned long)convertor->local_size, (unsigned long)convertor->remote_size, convertor->flags, convertor->stack_size, convertor->partial_length, convertor->remoteArch, opal_local_arch ); @@ -734,8 +734,8 @@ void opal_datatype_dump_stack( const dt_stack_t* pStack, int stack_pos, { opal_output( 0, "\nStack %p stack_pos %d name %s\n", (void*)pStack, stack_pos, name ); for( ; stack_pos >= 0; stack_pos-- ) { - opal_output( 0, "%d: pos %d count %d disp %ld ", stack_pos, pStack[stack_pos].index, - (int)pStack[stack_pos].count, (long)pStack[stack_pos].disp ); + opal_output( 0, "%d: pos %d count %" PRIsize_t " disp %ld ", stack_pos, pStack[stack_pos].index, + pStack[stack_pos].count, pStack[stack_pos].disp ); if( pStack->index != -1 ) opal_output( 0, "\t[desc count %lu disp %ld extent %ld]\n", (unsigned long)pDesc[pStack[stack_pos].index].elem.count, diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h index 22a2bb1de3f..50bc572675c 100644 --- a/opal/datatype/opal_convertor.h +++ b/opal/datatype/opal_convertor.h @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 Intel, Inc. All rights reserved * $COPYRIGHT$ * @@ -74,6 +74,7 @@ struct opal_convertor_master_t; struct dt_stack_t { int32_t index; /**< index in the element description */ int16_t type; /**< the type used for the last pack/unpack (original or OPAL_DATATYPE_UINT1) */ + int16_t padding; size_t count; /**< number of times we still have to do it */ ptrdiff_t disp; /**< actual displacement depending on the count field */ }; @@ -94,7 +95,8 @@ struct opal_convertor_t { const dt_type_desc_t* use_desc; /**< the version used by the convertor (normal or optimized) */ opal_datatype_count_t count; /**< the total number of full datatype elements */ uint32_t stack_size; /**< size of the allocated stack */ - /* --- cacheline 1 boundary (64 bytes) --- */ + + /* --- cacheline boundary (64 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */ unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */ dt_stack_t* pStack; /**< the local stack for the actual conversion */ convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */ @@ -102,21 +104,19 @@ struct opal_convertor_t { /* All others fields get modified for every call to pack/unpack functions */ uint32_t stack_pos; /**< the actual position on the stack */ - uint32_t partial_length; /**< amount of data left over from the last unpack */ + size_t partial_length; /**< amount of data left over from the last unpack */ size_t bConverted; /**< # of bytes already converted */ uint32_t checksum; /**< checksum computed by pack/unpack operation */ uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */ size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */ - /* --- cacheline 2 boundary (128 bytes) --- */ + + /* --- fields are no more aligned on cacheline --- */ dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack for small datatypes */ - /* --- cacheline 3 boundary (192 bytes) was 56 bytes ago --- */ #if OPAL_CUDA_SUPPORT memcpy_fct_t cbmemcpy; /**< memcpy or cuMemcpy */ void * stream; /**< CUstream for async copy */ #endif - /* size: 248, cachelines: 4, members: 20 */ - /* last cacheline: 56 bytes */ }; OPAL_DECLSPEC OBJ_CLASS_DECLARATION( opal_convertor_t ); @@ -251,12 +251,12 @@ static inline void opal_convertor_get_offset_pointer( const opal_convertor_t* pC */ OPAL_DECLSPEC int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf); static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_convertor_t* pSrcConv, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf, int32_t flags, opal_convertor_t* convertor ) @@ -273,11 +273,11 @@ static inline int32_t opal_convertor_copy_and_prepare_for_send( const opal_conve */ OPAL_DECLSPEC int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf ); static inline int32_t opal_convertor_copy_and_prepare_for_recv( const opal_convertor_t* pSrcConv, const struct opal_datatype_t* datatype, - int32_t count, + size_t count, const void* pUserBuf, int32_t flags, opal_convertor_t* convertor ) diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index fa7f1adf0c7..28022809679 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -43,11 +43,11 @@ opal_convertor_raw( opal_convertor_t* pConvertor, const opal_datatype_t *pData = pConvertor->pDesc; dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ dt_elem_desc_t* description, *pElem; unsigned char *source_base; /* origin of the data */ size_t raw_data = 0; /* sum of raw data lengths in the iov_len fields */ - uint32_t index = 0, i; /* the iov index and a simple counter */ + uint32_t index = 0; /* the iov index and a simple counter */ assert( (*iov_count) > 0 ); if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_COMPLETED) ) { @@ -83,15 +83,15 @@ opal_convertor_raw( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; source_base = pConvertor->pBaseBuf + pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); source_base += pStack->disp; - DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %d disp %ld\n" - "stack_pos %d pos_desc %d count_desc %d disp %ld\n", + DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); while( 1 ) { while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { size_t blength = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; @@ -112,7 +112,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, count_desc = 0; } } else { - for( i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { + for(size_t i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", @@ -134,9 +134,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "raw end_loop count %d stack_pos %d" + DO_DEBUG( opal_output( 0, "raw end_loop count %" PRIsize_t " stack_pos %d" " pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, + pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( pConvertor->stack_pos == 0 ) { @@ -160,9 +160,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, } source_base = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "raw new_loop count %d stack_pos %d " + DO_DEBUG( opal_output( 0, "raw new_loop count %" PRIsize_t " stack_pos %d " "pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, + pStack->count, pConvertor->stack_pos, pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { @@ -172,7 +172,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { ptrdiff_t offset = end_loop->first_elem_disp; source_base += offset; - for(uint32_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) { + for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; @@ -216,7 +216,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, /* I complete an element, next step I should go to the next one */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc, source_base - pStack->disp - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", + pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); return 0; } diff --git a/opal/datatype/opal_copy_functions.c b/opal/datatype/opal_copy_functions.c index 221d07a920c..1b96c78a6c3 100644 --- a/opal/datatype/opal_copy_functions.c +++ b/opal/datatype/opal_copy_functions.c @@ -4,8 +4,8 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -39,18 +39,17 @@ * Return value: Number of elements of type TYPE copied */ #define COPY_TYPE( TYPENAME, TYPE, COUNT ) \ -static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, ptrdiff_t from_extent, \ - char* to, size_t to_len, ptrdiff_t to_extent, \ - ptrdiff_t *advance) \ +static int copy_##TYPENAME( opal_convertor_t *pConvertor, size_t count, \ + char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_len, ptrdiff_t to_extent, \ + ptrdiff_t *advance) \ { \ - uint32_t i; \ size_t remote_TYPE_size = sizeof(TYPE) * (COUNT); /* TODO */ \ size_t local_TYPE_size = (COUNT) * sizeof(TYPE); \ \ /* make sure the remote buffer is large enough to hold the data */ \ if( (remote_TYPE_size * count) > from_len ) { \ - count = (uint32_t)(from_len / remote_TYPE_size); \ + count = from_len / remote_TYPE_size; \ if( (count * remote_TYPE_size) != from_len ) { \ DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ from_len - (count * remote_TYPE_size) ); \ @@ -67,7 +66,7 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, MEMCPY( to, from, count * local_TYPE_size ); \ } else { \ /* source or destination are non-contigous */ \ - for( i = 0; i < count; i++ ) { \ + for(size_t i = 0; i < count; i++ ) { \ MEMCPY( to, from, local_TYPE_size ); \ to += to_extent; \ from += from_extent; \ @@ -92,17 +91,16 @@ static int copy_##TYPENAME( opal_convertor_t *pConvertor, uint32_t count, * Return value: Number of elements of type TYPE copied */ #define COPY_CONTIGUOUS_BYTES( TYPENAME, COUNT ) \ -static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t count, \ - char* from, size_t from_len, ptrdiff_t from_extent, \ - char* to, size_t to_len, ptrdiff_t to_extent, \ - ptrdiff_t *advance ) \ +static size_t copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, size_t count, \ + char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_len, ptrdiff_t to_extent, \ + ptrdiff_t *advance ) \ { \ - uint32_t i; \ size_t remote_TYPE_size = (size_t)(COUNT); /* TODO */ \ size_t local_TYPE_size = (size_t)(COUNT); \ \ if( (remote_TYPE_size * count) > from_len ) { \ - count = (uint32_t)(from_len / remote_TYPE_size); \ + count = from_len / remote_TYPE_size; \ if( (count * remote_TYPE_size) != from_len ) { \ DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", \ from_len - (count * remote_TYPE_size) ); \ @@ -117,7 +115,7 @@ static int copy_##TYPENAME##_##COUNT( opal_convertor_t *pConvertor, uint32_t cou (to_extent == (ptrdiff_t)remote_TYPE_size) ) { \ MEMCPY( to, from, count * local_TYPE_size ); \ } else { \ - for( i = 0; i < count; i++ ) { \ + for(size_t i = 0; i < count; i++ ) { \ MEMCPY( to, from, local_TYPE_size ); \ to += to_extent; \ from += from_extent; \ diff --git a/opal/datatype/opal_copy_functions_heterogeneous.c b/opal/datatype/opal_copy_functions_heterogeneous.c index a46e87b4dde..83a3966008c 100644 --- a/opal/datatype/opal_copy_functions_heterogeneous.c +++ b/opal/datatype/opal_copy_functions_heterogeneous.c @@ -4,9 +4,8 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -140,12 +139,12 @@ opal_dt_swap_long_double(void *to_p, const void *from_p, const size_t size, size #define COPY_TYPE_HETEROGENEOUS_INTERNAL( TYPENAME, TYPE, LONG_DOUBLE ) \ static int32_t \ -copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ +copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \ const char* from, size_t from_len, ptrdiff_t from_extent, \ char* to, size_t to_length, ptrdiff_t to_extent, \ ptrdiff_t *advance) \ { \ - uint32_t i; \ + size_t i; \ \ datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \ from, from_len, from_extent, \ @@ -188,12 +187,12 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, #define COPY_2SAMETYPE_HETEROGENEOUS_INTERNAL( TYPENAME, TYPE, LONG_DOUBLE) \ static int32_t \ -copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ +copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \ const char* from, size_t from_len, ptrdiff_t from_extent, \ char* to, size_t to_length, ptrdiff_t to_extent, \ ptrdiff_t *advance) \ { \ - uint32_t i; \ + size_t i; \ \ datatype_check( #TYPE, sizeof(TYPE), sizeof(TYPE), &count, \ from, from_len, from_extent, \ @@ -233,12 +232,12 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, #define COPY_2TYPE_HETEROGENEOUS( TYPENAME, TYPE1, TYPE2 ) \ static int32_t \ -copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ - const char* from, uint32_t from_len, ptrdiff_t from_extent, \ - char* to, uint32_t to_length, ptrdiff_t to_extent, \ +copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, size_t count, \ + const char* from, size_t from_len, ptrdiff_t from_extent, \ + char* to, size_t to_length, ptrdiff_t to_extent, \ ptrdiff_t *advance) \ { \ - uint32_t i; \ + size_t i; \ \ datatype_check( #TYPENAME, sizeof(TYPE1) + sizeof(TYPE2), \ sizeof(TYPE1) + sizeof(TYPE2), &count, \ @@ -276,13 +275,13 @@ copy_##TYPENAME##_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, \ static inline void -datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *count, +datatype_check(char *type, size_t local_size, size_t remote_size, size_t *count, const char* from, size_t from_len, ptrdiff_t from_extent, char* to, size_t to_len, ptrdiff_t to_extent) { /* make sure the remote buffer is large enough to hold the data */ if( (remote_size * *count) > from_len ) { - *count = (uint32_t)(from_len / remote_size); + *count = from_len / remote_size; if( (*count * remote_size) != from_len ) { DUMP( "oops should I keep this data somewhere (excedent %d bytes)?\n", from_len - (*count * remote_size) ); @@ -296,20 +295,18 @@ datatype_check(char *type, size_t local_size, size_t remote_size, uint32_t *coun } #define CXX_BOOL_COPY_LOOP(TYPE) \ - for( i = 0; i < count; i++ ) { \ + for(size_t i = 0; i < count; i++ ) { \ bool *to_real = (bool*) to; \ *to_real = *((TYPE*) from) == 0 ? false : true; \ to += to_extent; \ from += from_extent; \ } static int32_t -copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, uint32_t count, - const char* from, uint32_t from_len, ptrdiff_t from_extent, - char* to, uint32_t to_length, ptrdiff_t to_extent, +copy_cxx_bool_heterogeneous(opal_convertor_t *pConvertor, size_t count, + const char* from, size_t from_len, ptrdiff_t from_extent, + char* to, size_t to_length, ptrdiff_t to_extent, ptrdiff_t *advance) { - uint32_t i; - /* fix up the from extent */ if ((pConvertor->remoteArch & OPAL_ARCH_BOOLISxx) != (opal_local_arch & OPAL_ARCH_BOOLISxx)) { diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h index 3605660fa1f..f234e8c157e 100644 --- a/opal/datatype/opal_datatype.h +++ b/opal/datatype/opal_datatype.h @@ -86,7 +86,7 @@ BEGIN_C_DECLS * associated type. */ #define MAX_DT_COMPONENT_COUNT UINT_MAX -typedef uint32_t opal_datatype_count_t; +typedef size_t opal_datatype_count_t; typedef union dt_elem_desc dt_elem_desc_t; diff --git a/opal/datatype/opal_datatype_copy.h b/opal/datatype/opal_datatype_copy.h index 5dcfe2ec5d3..7aeac8e63ec 100644 --- a/opal/datatype/opal_datatype_copy.h +++ b/opal/datatype/opal_datatype_copy.h @@ -4,8 +4,8 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,12 +43,12 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM, const opal_datatype_t* DATATYPE, unsigned char* SOURCE_BASE, size_t TOTAL_COUNT, - uint32_t COUNT, + size_t COUNT, unsigned char* SOURCE, unsigned char* DESTINATION, size_t* SPACE ) { - uint32_t _copy_count = (COUNT); + size_t _copy_count = (COUNT); size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (SOURCE) + _elem->disp; @@ -56,19 +56,18 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM, _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; - if( _copy_blength == (uint32_t)_elem->extent ) { + if( _copy_blength == (size_t)_elem->extent ) { _copy_blength *= _copy_count; OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); /* the extent and the size of the basic datatype are equals */ - DO_DEBUG( opal_output( 0, "copy 1. %s( %p, %p, %lu ) => space %lu\n", - STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); ); + DO_DEBUG( opal_output( 0, "copy 1. %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", + STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, _copy_blength, *(SPACE) ); ); MEM_OP( _destination, _source, _copy_blength ); _source += _copy_blength; _destination += _copy_blength; } else { - uint32_t _i; - for( _i = 0; _i < _copy_count; _i++ ) { + for(size_t _i = 0; _i < _copy_count; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); DO_DEBUG( opal_output( 0, "copy 2. %s( %p, %p, %lu ) => space %lu\n", @@ -86,7 +85,7 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, const opal_datatype_t* DATATYPE, unsigned char* SOURCE_BASE, size_t TOTAL_COUNT, - uint32_t COUNT, + size_t COUNT, unsigned char* SOURCE, unsigned char* DESTINATION, size_t* SPACE ) @@ -96,7 +95,6 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, unsigned char* _source = (SOURCE) + _end_loop->first_elem_disp; unsigned char* _destination = (DESTINATION) + _end_loop->first_elem_disp; size_t _copy_loops = (COUNT); - uint32_t _i; if( _loop->extent == (ptrdiff_t)_end_loop->size ) { /* the loop is contiguous */ _copy_loops *= _end_loop->size; @@ -104,11 +102,11 @@ static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, (DATATYPE), (TOTAL_COUNT) ); MEM_OP( _destination, _source, _copy_loops ); } else { - for( _i = 0; _i < _copy_loops; _i++ ) { + for(size_t _i = 0; _i < _copy_loops; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (SOURCE_BASE), (DATATYPE), (TOTAL_COUNT) ); - DO_DEBUG( opal_output( 0, "copy 3. %s( %p, %p, %lu ) => space %lu\n", - STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); + DO_DEBUG( opal_output( 0, "copy 3. %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", + STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, _end_loop->size, *(SPACE) - _i * _end_loop->size ); ); MEM_OP( _destination, _source, _end_loop->size ); _source += _loop->extent; _destination += _loop->extent; @@ -207,8 +205,8 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "copy end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "copy end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, stack_pos, pos_desc, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( stack_pos == 0 ) { assert( iov_len_local == 0 ); @@ -229,8 +227,8 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i source = (unsigned char*)source_base + pStack->disp; destination = (unsigned char*)destination_base + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "copy new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, stack_pos, pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "copy new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, stack_pos, pos_desc, pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)source; diff --git a/opal/datatype/opal_datatype_dump.c b/opal/datatype/opal_datatype_dump.c index d469f8291dc..4c26292b8be 100644 --- a/opal/datatype/opal_datatype_dump.c +++ b/opal/datatype/opal_datatype_dump.c @@ -13,6 +13,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -96,9 +98,9 @@ int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, (int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp, (int)pDesc->end_loop.size ); else - index += snprintf( ptr + index, length - index, "count %d disp 0x%lx (%ld) blen %d extent %d (size %ld)\n", - (int)pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen, - (int)pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); + index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%lx (%ld) blen %d extent %ld (size %ld)\n", + pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen, + pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); pDesc++; if( length <= (size_t)index ) break; @@ -118,11 +120,11 @@ void opal_datatype_dump( const opal_datatype_t* pData ) buffer = (char*)malloc( length ); index += snprintf( buffer, length - index, "Datatype %p[%s] size %ld align %d id %d length %d used %d\n" "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" - "nbElems %d loops %d flags %X (", + "nbElems %" PRIsize_t " loops %d flags %X (", (void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, (long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), (long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), - (int)pData->nbElems, (int)pData->loops, (int)pData->flags ); + pData->nbElems, (int)pData->loops, (int)pData->flags ); /* dump the flags */ if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED ) index += snprintf( buffer + index, length - index, "predefined " ); diff --git a/opal/datatype/opal_datatype_fake_stack.c b/opal/datatype/opal_datatype_fake_stack.c index 1cc05fe8860..bd1d919e374 100644 --- a/opal/datatype/opal_datatype_fake_stack.c +++ b/opal/datatype/opal_datatype_fake_stack.c @@ -11,8 +11,8 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -47,7 +47,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, size_t loop_length, *remoteLength, remote_size; size_t resting_place = starting_point; dt_elem_desc_t* pElems; - uint32_t count; + size_t count; assert( 0 != starting_point ); assert( pConvertor->bConverted != starting_point ); @@ -93,7 +93,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, /* remove from the main loop all the complete datatypes */ assert (! (pConvertor->flags & CONVERTOR_SEND)); remote_size = opal_convertor_compute_remote_size( pConvertor ); - count = (int32_t)(starting_point / remote_size); + count = starting_point / remote_size; resting_place -= (remote_size * count); pStack->count = pConvertor->count - count; pStack->index = -1; diff --git a/opal/datatype/opal_datatype_optimize.c b/opal/datatype/opal_datatype_optimize.c index 882e3a8d979..efbfb9c08b5 100644 --- a/opal/datatype/opal_datatype_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +42,7 @@ static int32_t opal_datatype_optimize_short( opal_datatype_t* pData, - int32_t count, + size_t count, dt_type_desc_t* pTypeDesc ) { dt_elem_desc_t* pElemDesc; diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index 9af53f4dd58..55889fcaa55 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -114,7 +114,8 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, const opal_datatype_t* pData = pConv->pDesc; dt_stack_t* stack = pConv->pStack; unsigned char *user_memory, *packed_buffer; - uint32_t i, index, iov_count; + uint32_t iov_count, index; + size_t i; size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; ptrdiff_t extent= pData->ub - pData->lb; ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; @@ -134,20 +135,20 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, /* Limit the amount of packed data to the data left over on this convertor */ remaining = pConv->local_size - pConv->bConverted; if( 0 == remaining ) break; /* we're done this time */ - if( remaining > (uint32_t)iov[iov_count].iov_len ) + if( remaining > iov[iov_count].iov_len ) remaining = iov[iov_count].iov_len; packed_buffer = (unsigned char *)iov[iov_count].iov_base; bConverted = remaining; /* how much will get unpacked this time */ user_memory = pConv->pBaseBuf + initial_displ + stack[0].disp + stack[1].disp; i = pConv->count - stack[0].count; /* how many we already packed */ - assert(i == ((uint32_t)(pConv->bConverted / pData->size))); + assert(i == (pConv->bConverted / pData->size)); if( packed_buffer == NULL ) { /* special case for small data. We avoid allocating memory if we * can fill the iovec directly with the address of the remaining * data. */ - if( (uint32_t)stack->count < ((*out_size) - iov_count) ) { + if( stack->count < (size_t)((*out_size) - iov_count) ) { stack[1].count = pData->size - (pConv->bConverted % pData->size); for( index = iov_count; i < pConv->count; i++, index++ ) { iov[index].iov_base = (IOVBASE_TYPE *) user_memory; @@ -278,7 +279,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ size_t total_packed = 0; /* total amount packed this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; @@ -300,15 +301,15 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; conv_ptr = pConvertor->pBaseBuf + pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %d disp %ld\n" - "stack_pos %d pos_desc %d count_desc %d disp %ld\n", + DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); ); for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; @@ -327,10 +328,10 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d" + DO_DEBUG( opal_output( 0, "pack end_loop count %" PRIsize_t " stack_pos %d" " pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, - pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + pStack->count, pConvertor->stack_pos, + pos_desc, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { /* we're done. Force the exit of the main for loop (around iovec) */ @@ -351,9 +352,9 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, } conv_ptr = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d count_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "pack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + count_desc, pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; @@ -390,8 +391,8 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, /* Save the global position for the next round */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc, conv_ptr - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", + pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); ); return 0; } @@ -411,7 +412,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, static inline void pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** SOURCE, unsigned char** DESTINATION, size_t* SPACE ) @@ -420,12 +421,12 @@ pack_predefined_heterogeneous( opal_convertor_t* CONVERTOR, const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (*SOURCE) + _elem->disp; ptrdiff_t advance; - uint32_t _count = *(COUNT); + size_t _count = *(COUNT); size_t _r_blength; _r_blength = master->remote_sizes[_elem->common.type]; if( (_count * _r_blength) > *(SPACE) ) { - _count = (uint32_t)(*(SPACE) / _r_blength); + _count = (*(SPACE) / _r_blength); if( 0 == _count ) return; /* nothing to do */ } @@ -454,7 +455,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor, { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ size_t total_packed = 0; /* total amount packed this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; @@ -476,15 +477,15 @@ opal_pack_general_function( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; conv_ptr = pConvertor->pBaseBuf + pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %d disp %ld\n" - "stack_pos %d pos_desc %d count_desc %d disp %ld\n", + DO_DEBUG( opal_output( 0, "pack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); ); for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; @@ -492,7 +493,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor, while( 1 ) { while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - DO_DEBUG( opal_output( 0, "pack (%p:%ld, %d, %ld) -> (%p, %ld) type %s\n", + DO_DEBUG( opal_output( 0, "pack (%p:%ld, %" PRIsize_t ", %ld) -> (%p, %ld) type %s\n", (void*)pConvertor->pBaseBuf, conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf, count_desc, description[pos_desc].elem.extent, (void*)iov_ptr, iov_len_local, @@ -513,10 +514,10 @@ opal_pack_general_function( opal_convertor_t* pConvertor, goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "pack end_loop count %d stack_pos %d" + DO_DEBUG( opal_output( 0, "pack end_loop count %" PRIsize_t " stack_pos %d" " pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, - pos_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + pStack->count, pConvertor->stack_pos, + pos_desc, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { /* we lie about the size of the next element in order to @@ -539,9 +540,9 @@ opal_pack_general_function( opal_convertor_t* pConvertor, } conv_ptr = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "pack new_loop count %d stack_pos %d pos_desc %d count_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - count_desc, (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "pack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + count_desc, pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; @@ -583,7 +584,7 @@ opal_pack_general_function( opal_convertor_t* pConvertor, /* Save the global position for the next round */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc, conv_ptr - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "pack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t" disp %ld\n", + pConvertor->stack_pos, pStack->index, pStack->count, pStack->disp ); ); return 0; } diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 2176e53e897..f952cabc3c0 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -5,8 +5,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,19 +30,19 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** SOURCE, unsigned char** DESTINATION, size_t* SPACE ) { - uint32_t _copy_count = *(COUNT); + size_t _copy_count = *(COUNT); size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (*SOURCE) + _elem->disp; _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = (uint32_t)(*(SPACE) / _copy_blength); + _copy_count = (*(SPACE) / _copy_blength); if( 0 == _copy_count ) return; /* nothing to do */ } @@ -57,8 +57,7 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, _source += _copy_blength; *(DESTINATION) += _copy_blength; } else { - uint32_t _i; - for( _i = 0; _i < _copy_count; _i++ ) { + for(size_t _i = 0; _i < _copy_count; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", @@ -76,7 +75,7 @@ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** SOURCE, unsigned char** DESTINATION, size_t* SPACE ) @@ -84,12 +83,11 @@ static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items); unsigned char* _source = (*SOURCE) + _end_loop->first_elem_disp; - uint32_t _copy_loops = *(COUNT); - uint32_t _i; + size_t _copy_loops = *(COUNT); if( (_copy_loops * _end_loop->size) > *(SPACE) ) - _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); - for( _i = 0; _i < _copy_loops; _i++ ) { + _copy_loops = (*(SPACE) / _end_loop->size); + for(size_t _i = 0; _i < _copy_loops; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu\n", diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index a4a088ffbdb..3b8eaec69c6 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science + * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -57,17 +57,17 @@ static inline void position_predefined_data( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** POINTER, size_t* SPACE ) { - uint32_t _copy_count = *(COUNT); + size_t _copy_count = *(COUNT); size_t _copy_blength; ddt_elem_desc_t* _elem = &((ELEM)->elem); _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = (uint32_t)(*(SPACE) / _copy_blength); + _copy_count = *(SPACE) / _copy_blength; if( 0 == _copy_count ) return; /* nothing to do */ } _copy_blength *= _copy_count; @@ -87,16 +87,16 @@ position_predefined_data( opal_convertor_t* CONVERTOR, static inline void position_contiguous_loop( opal_convertor_t* CONVERTOR, dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** POINTER, size_t* SPACE ) { ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items); - uint32_t _copy_loops = *(COUNT); + size_t _copy_loops = *(COUNT); if( (_copy_loops * _end_loop->size) > *(SPACE) ) - _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); + _copy_loops = *(SPACE) / _end_loop->size; OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp, (_copy_loops - 1) * _loop->extent + _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); @@ -116,7 +116,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ dt_elem_desc_t* description = pConvertor->use_desc->desc; dt_elem_desc_t* pElem; /* current position */ unsigned char *base_pointer = pConvertor->pBaseBuf; @@ -134,9 +134,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, iov_len_local = *position - pConvertor->bConverted; if( iov_len_local > pConvertor->pDesc->size ) { pStack = pConvertor->pStack; /* we're working with the full stack */ - count_desc = (uint32_t)(iov_len_local / pConvertor->pDesc->size); + count_desc = iov_len_local / pConvertor->pDesc->size; DO_DEBUG( opal_output( 0, "position before %lu asked %lu data size %lu" - " iov_len_local %lu count_desc %d\n", + " iov_len_local %lu count_desc %" PRIsize_t "\n", (unsigned long)pConvertor->bConverted, (unsigned long)*position, (unsigned long)pConvertor->pDesc->size, (unsigned long)iov_len_local, count_desc ); ); /* Update all the stack including the last one */ @@ -152,15 +152,15 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; base_pointer += pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - DO_DEBUG( opal_output( 0, "position start pos_desc %d count_desc %d disp %llx\n" - "stack_pos %d pos_desc %d count_desc %d disp %llx\n", + DO_DEBUG( opal_output( 0, "position start pos_desc %d count_desc %" PRIsize_t " disp %llx\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %llx\n", pos_desc, count_desc, (unsigned long long)(base_pointer - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); ); + pConvertor->stack_pos, pStack->index, pStack->count, (unsigned long long)pStack->disp ); ); /* Last data has been only partially converted. Compute the relative position */ if( 0 != pConvertor->partial_length ) { size_t element_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; @@ -179,9 +179,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } while( 1 ) { if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "position end_loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "position end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( pConvertor->stack_pos == 0 ) { pConvertor->flags |= CONVERTOR_COMPLETED; @@ -202,9 +202,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } base_pointer = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "position new_loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "position new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)base_pointer; @@ -225,9 +225,9 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, base_pointer = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" ); - DO_DEBUG( opal_output( 0, "position set loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "position set loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); continue; } while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { @@ -235,15 +235,15 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, POSITION_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, base_pointer, iov_len_local ); if( 0 != count_desc ) { /* completed */ - pConvertor->partial_length = (uint32_t)iov_len_local; + pConvertor->partial_length = iov_len_local; goto complete_loop; } base_pointer = pConvertor->pBaseBuf + pStack->disp; pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "position set loop count %d stack_pos %d pos_desc %d disp %llx space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (unsigned long long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "position set loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); } } complete_loop: @@ -253,8 +253,8 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, /* I complete an element, next step I should go to the next one */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc, base_pointer - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %d disp %llx\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (unsigned long long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "position save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %llx\n", + pConvertor->stack_pos, pStack->index, pStack->count, (unsigned long long)pStack->disp ); ); return 0; } return 1; diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index b43a5c8f83e..3edb9161923 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -13,8 +13,8 @@ * Copyright (c) 2008-2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -85,7 +85,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { remaining = pConv->local_size - pConv->bConverted; if( 0 == remaining ) break; /* we're done this time */ - if( remaining > (uint32_t)iov[iov_count].iov_len ) + if( remaining > iov[iov_count].iov_len ) remaining = iov[iov_count].iov_len; packed_buffer = (unsigned char*)iov[iov_count].iov_base; bConverted = remaining; /* how much will get unpacked this time */ @@ -176,7 +176,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, * change the content of the data (as in all conversions that require changing the size * of the exponent or mantissa). */ -static inline uint32_t +static inline void opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem, unsigned char* partial_data, ptrdiff_t start_position, ptrdiff_t length, @@ -185,17 +185,17 @@ opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pEle char unused_byte = 0x7F, saved_data[16]; unsigned char temporary[16], *temporary_buffer = temporary; unsigned char* user_data = *user_buffer + pElem->elem.disp; - uint32_t i, count_desc = 1; + size_t count_desc = 1; size_t data_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; DO_DEBUG( opal_output( 0, "unpack partial data start %lu end %lu data_length %lu user %p\n" - "\tbConverted %lu total_length %lu count %d\n", + "\tbConverted %lu total_length %lu count %ld\n", (unsigned long)start_position, (unsigned long)start_position + length, (unsigned long)data_length, (void*)*user_buffer, (unsigned long)pConvertor->bConverted, (unsigned long)pConvertor->local_size, pConvertor->count ); ); /* Find a byte that is not used in the partial buffer */ find_unused_byte: - for( i = 0; i < length; i++ ) { + for(ptrdiff_t i = 0; i < length; i++ ) { if( unused_byte == partial_data[i] ) { unused_byte--; goto find_unused_byte; @@ -234,18 +234,17 @@ opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pEle { char resaved_data[16]; pConvertor->cbmemcpy(resaved_data, user_data, data_length, pConvertor ); - for( i = 0; i < data_length; i++ ) { + for(size_t i = 0; i < data_length; i++ ) { if( unused_byte == resaved_data[i] ) pConvertor->cbmemcpy(&user_data[i], &saved_data[i], 1, pConvertor); } } #else - for( i = 0; i < data_length; i++ ) { + for(size_t i = 0; i < data_length; i++ ) { if( unused_byte == user_data[i] ) user_data[i] = saved_data[i]; } #endif - return 0; } /* The pack/unpack functions need a cleanup. I have to create a proper interface to access @@ -265,7 +264,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ size_t total_unpacked = 0; /* total size unpacked this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; @@ -286,15 +285,15 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; conv_ptr = pConvertor->pBaseBuf + pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n" - "stack_pos %d pos_desc %d count_desc %d disp %ld\n", + DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)(pStack->disp) ); ); + pConvertor->stack_pos, pStack->index, pStack->count, (long)(pStack->disp) ); ); for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; @@ -343,15 +342,15 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, iov_ptr, 0, iov_len_local, &temp ); - pConvertor->partial_length = (uint32_t)iov_len_local; + pConvertor->partial_length = iov_len_local; iov_len_local = 0; } goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "unpack end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { /* Do the same thing as when the loop is completed */ @@ -374,9 +373,9 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, } conv_ptr = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "unpack new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "unpack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)conv_ptr; @@ -415,8 +414,8 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, /* Save the global position for the next round */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc, conv_ptr - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", + pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); return 0; } @@ -439,21 +438,21 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ - uint32_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t count_desc; /* the number of items already done in the actual pos_desc */ uint16_t type = OPAL_DATATYPE_MAX_PREDEFINED; /* type at current position */ size_t total_unpacked = 0; /* total size unpacked this time */ dt_elem_desc_t* description; dt_elem_desc_t* pElem; const opal_datatype_t *pData = pConvertor->pDesc; unsigned char *conv_ptr, *iov_ptr; - size_t iov_len_local; uint32_t iov_count; + size_t iov_len_local; const opal_convertor_master_t* master = pConvertor->master; ptrdiff_t advance; /* number of bytes that we should advance the buffer */ - int32_t rc; + size_t rc; - DO_DEBUG( opal_output( 0, "opal_convertor_general_unpack( %p, {%p, %lu}, %u )\n", + DO_DEBUG( opal_output( 0, "opal_convertor_general_unpack( %p, {%p, %lu}, %d )\n", (void*)pConvertor, (void*)iov[0].iov_base, (unsigned long)iov[0].iov_len, *out_size ); ); description = pConvertor->use_desc->desc; @@ -465,15 +464,15 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; conv_ptr = pConvertor->pBaseBuf + pStack->disp; - count_desc = (uint32_t)pStack->count; + count_desc = pStack->count; pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %d disp %ld\n" - "stack_pos %d pos_desc %d count_desc %d disp %ld\n", + DO_DEBUG( opal_output( 0, "unpack start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" + "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(conv_ptr - pConvertor->pBaseBuf), - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)(pStack->disp) ); ); + pConvertor->stack_pos, pStack->index, pStack->count, (long)(pStack->disp) ); ); for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; @@ -485,7 +484,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, type = description[pos_desc].elem.common.type; OPAL_DATATYPE_SAFEGUARD_POINTER( conv_ptr + pElem->elem.disp, pData->size, pConvertor->pBaseBuf, pData, pConvertor->count ); - DO_DEBUG( opal_output( 0, "unpack (%p, %ld) -> (%p:%ld, %d, %ld) type %s\n", + DO_DEBUG( opal_output( 0, "unpack (%p, %ld) -> (%p:%ld, %" PRIsize_t ", %ld) type %s\n", (void*)iov_ptr, iov_len_local, (void*)pConvertor->pBaseBuf, conv_ptr + pElem->elem.disp - pConvertor->pBaseBuf, count_desc, description[pos_desc].elem.extent, @@ -520,15 +519,15 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, iov_ptr, 0, iov_len_local, &temp ); - pConvertor->partial_length = (uint32_t)iov_len_local; + pConvertor->partial_length = iov_len_local; iov_len_local = 0; } goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ - DO_DEBUG( opal_output( 0, "unpack end_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "unpack end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { /* Do the same thing as when the loop is completed */ @@ -551,9 +550,9 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, } conv_ptr = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - DO_DEBUG( opal_output( 0, "unpack new_loop count %d stack_pos %d pos_desc %d disp %ld space %lu\n", - (int)pStack->count, pConvertor->stack_pos, pos_desc, - (long)pStack->disp, (unsigned long)iov_len_local ); ); + DO_DEBUG( opal_output( 0, "unpack new_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", + pStack->count, pConvertor->stack_pos, pos_desc, + pStack->disp, (unsigned long)iov_len_local ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, @@ -580,7 +579,7 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, /* Save the global position for the next round */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, pElem->elem.common.type, count_desc, conv_ptr - pConvertor->pBaseBuf ); - DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %d disp %ld\n", - pConvertor->stack_pos, pStack->index, (int)pStack->count, (long)pStack->disp ); ); + DO_DEBUG( opal_output( 0, "unpack save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t" disp %ld\n", + pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); return 0; } diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index 44f7505a58c..d837aad5ab7 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -5,8 +5,8 @@ * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,19 +29,19 @@ static inline void unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ const dt_elem_desc_t* ELEM, /* the element description */ - uint32_t* COUNT, /* the number of elements */ + size_t* COUNT, /* the number of elements */ unsigned char** SOURCE, /* the source pointer */ unsigned char** DESTINATION, /* the destination pointer */ size_t* SPACE ) /* the space in the destination buffer */ { - uint32_t _copy_count = *(COUNT); + size_t _copy_count = *(COUNT); size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _destination = (*DESTINATION) + _elem->disp; _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = (uint32_t)(*(SPACE) / _copy_blength); + _copy_count = (*(SPACE) / _copy_blength); if( 0 == _copy_count ) return; /* nothing to do */ } @@ -56,8 +56,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ *(SOURCE) += _copy_blength; _destination += _copy_blength; } else { - uint32_t _i; - for( _i = 0; _i < _copy_count; _i++ ) { + for(size_t _i = 0; _i < _copy_count; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", @@ -75,7 +74,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, - uint32_t* COUNT, + size_t* COUNT, unsigned char** SOURCE, unsigned char** DESTINATION, size_t* SPACE ) @@ -83,12 +82,11 @@ static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items); unsigned char* _destination = (*DESTINATION) + _end_loop->first_elem_disp; - uint32_t _copy_loops = *(COUNT); - uint32_t _i; + size_t _copy_loops = *(COUNT); if( (_copy_loops * _end_loop->size) > *(SPACE) ) - _copy_loops = (uint32_t)(*(SPACE) / _end_loop->size); - for( _i = 0; _i < _copy_loops; _i++ ) { + _copy_loops = (*(SPACE) / _end_loop->size); + for(size_t _i = 0; _i < _copy_loops; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 3. memcpy( %p, %p, %lu ) => space %lu\n", From e4aae6b5c82cddd0184f71a8dd5d75206c32ab46 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 4 Dec 2018 23:48:40 -0500 Subject: [PATCH 275/674] Add a test for very large data. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor.h | 6 ++- opal/datatype/opal_datatype.h | 1 - test/datatype/Makefile.am | 8 ++- test/datatype/large_data.c | 93 ++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 3 deletions(-) create mode 100644 test/datatype/large_data.c diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h index 50bc572675c..875c111b1f1 100644 --- a/opal/datatype/opal_convertor.h +++ b/opal/datatype/opal_convertor.h @@ -94,18 +94,22 @@ struct opal_convertor_t { const opal_datatype_t* pDesc; /**< the datatype description associated with the convertor */ const dt_type_desc_t* use_desc; /**< the version used by the convertor (normal or optimized) */ opal_datatype_count_t count; /**< the total number of full datatype elements */ - uint32_t stack_size; /**< size of the allocated stack */ /* --- cacheline boundary (64 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */ + uint32_t stack_size; /**< size of the allocated stack */ unsigned char* pBaseBuf; /**< initial buffer as supplied by the user */ dt_stack_t* pStack; /**< the local stack for the actual conversion */ convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */ + + /* --- cacheline boundary (96 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */ struct opal_convertor_master_t* master; /**< the master convertor */ /* All others fields get modified for every call to pack/unpack functions */ uint32_t stack_pos; /**< the actual position on the stack */ size_t partial_length; /**< amount of data left over from the last unpack */ size_t bConverted; /**< # of bytes already converted */ + + /* --- cacheline boundary (128 bytes - if 64bits arch and !OPAL_ENABLE_DEBUG) --- */ uint32_t checksum; /**< checksum computed by pack/unpack operation */ uint32_t csum_ui1; /**< partial checksum computed by pack/unpack operation */ size_t csum_ui2; /**< partial checksum computed by pack/unpack operation */ diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h index f234e8c157e..a836a5aae03 100644 --- a/opal/datatype/opal_datatype.h +++ b/opal/datatype/opal_datatype.h @@ -119,7 +119,6 @@ struct opal_datatype_t { /* Attribute fields */ char name[OPAL_MAX_OBJECT_NAME]; /**< name of the datatype */ - /* --- cacheline 2 boundary (128 bytes) was 8-12 bytes ago --- */ dt_type_desc_t desc; /**< the data description */ dt_type_desc_t opt_desc; /**< short description of the data used when conversion is useless or in the send case (without conversion) */ diff --git a/test/datatype/Makefile.am b/test/datatype/Makefile.am index 8efd0344ecc..4366724a523 100644 --- a/test/datatype/Makefile.am +++ b/test/datatype/Makefile.am @@ -15,7 +15,7 @@ # if PROJECT_OMPI - MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32 + MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32 large_data MPI_CHECKS = to_self endif TESTS = opal_datatype_test unpack_hetero $(MPI_TESTS) @@ -74,6 +74,12 @@ to_self_SOURCES = to_self.c to_self_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) to_self_LDADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la +large_data_SOURCES = large_data.c +large_data_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) +large_data_LDADD = \ + $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la + opal_datatype_test_SOURCES = opal_datatype_test.c opal_ddt_lib.c opal_ddt_lib.h opal_datatype_test_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) opal_datatype_test_LDADD = \ diff --git a/test/datatype/large_data.c b/test/datatype/large_data.c new file mode 100644 index 00000000000..8209bd94c83 --- /dev/null +++ b/test/datatype/large_data.c @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include + +#include "ompi_config.h" +#include "ompi/datatype/ompi_datatype.h" +#include "opal/runtime/opal.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/datatype/opal_datatype_internal.h" + +#define MAX_IOVEC 10 +#define MAX_CHUNK (1024*1024*1024) /* 1GB */ + +static size_t +count_length_via_convertor_raw(MPI_Datatype dtype, int count) +{ + opal_convertor_t* pconv; + struct iovec iov[MAX_IOVEC]; + uint32_t iov_count = MAX_IOVEC, i; + size_t length = MAX_CHUNK, packed_iovec = 0, packed = 0; + + pconv = opal_convertor_create( opal_local_arch, 0 ); + opal_convertor_prepare_for_send(pconv, (const struct opal_datatype_t *)dtype, 1, NULL); + while( 0 == opal_convertor_raw(pconv, iov, &iov_count, &length) ) { + printf("iov_count = %d packed_iovec = %"PRIsize_t"\n", iov_count, packed_iovec); + packed += length; + for( i = 0; i < iov_count; i++ ) { + packed_iovec += iov[i].iov_len; + } + if( packed != packed_iovec ) { + printf( "Packed send amount diverges %"PRIsize_t" != %"PRIsize_t"\n", packed, packed_iovec); + exit(-1); + } + iov_count = MAX_IOVEC; /* number of available iov */ + length = MAX_CHUNK; + } + packed += length; + for( i = 0; i < iov_count; i++ ) { + packed_iovec += iov[i].iov_len; + } + if( packed != packed_iovec ) { + printf( "Packed send amount diverges %"PRIsize_t" != %"PRIsize_t"\n", packed, packed_iovec); + exit(-1); + } + return packed_iovec; +} + +int main(int argc, char * argv[]) +{ + + int const per_process = 192; + int const per_type = 20000000; + + int scounts[2] = {per_process, per_process}; + int sdispls[2] = {3*per_process, 0*per_process}; + int rcounts[2] = {per_process, per_process}; + int rdispls[2] = {1*per_process, 2*per_process}; + + MPI_Datatype ddt, stype, rtype; + + opal_init_util(&argc, &argv); + ompi_datatype_init(); + + ompi_datatype_create_contiguous( per_type, MPI_FLOAT, &ddt); + ompi_datatype_create_indexed(2, scounts, sdispls, ddt, &stype); + ompi_datatype_commit(&stype); + ompi_datatype_create_indexed(2, rcounts, rdispls, ddt, &rtype); + ompi_datatype_commit(&rtype); + + size_t packed = count_length_via_convertor_raw(stype, 1); + size_t length; + opal_datatype_type_size(&stype->super, &length); + if( length != packed ) { + printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", + packed, length); + exit(-2); + } + + packed = count_length_via_convertor_raw(rtype, 1); + opal_datatype_type_size(&rtype->super, &length); + if( length != packed ) { + printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", + packed, length); + exit(-2); + } + + ompi_datatype_destroy(&stype); + ompi_datatype_destroy(&rtype); + + return 0; +} From 9aff3a9a5413904170fcd4af9f1f0368d30b0310 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 5 Dec 2018 14:05:47 -0500 Subject: [PATCH 276/674] Add more details about what is going on. Signed-off-by: George Bosilca --- test/datatype/large_data.c | 103 +++++++++++++++++++++++++++++++++---- 1 file changed, 92 insertions(+), 11 deletions(-) diff --git a/test/datatype/large_data.c b/test/datatype/large_data.c index 8209bd94c83..1c031b36629 100644 --- a/test/datatype/large_data.c +++ b/test/datatype/large_data.c @@ -1,3 +1,20 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** + * This test check the correct OMPI datatype description for + * extremely large types (over 4GB). + */ + #include #include #include @@ -13,8 +30,11 @@ #define MAX_IOVEC 10 #define MAX_CHUNK (1024*1024*1024) /* 1GB */ +static int verbose = 0; + static size_t -count_length_via_convertor_raw(MPI_Datatype dtype, int count) +count_length_via_convertor_raw(char* msg, + MPI_Datatype dtype, int count) { opal_convertor_t* pconv; struct iovec iov[MAX_IOVEC]; @@ -24,24 +44,41 @@ count_length_via_convertor_raw(MPI_Datatype dtype, int count) pconv = opal_convertor_create( opal_local_arch, 0 ); opal_convertor_prepare_for_send(pconv, (const struct opal_datatype_t *)dtype, 1, NULL); while( 0 == opal_convertor_raw(pconv, iov, &iov_count, &length) ) { - printf("iov_count = %d packed_iovec = %"PRIsize_t"\n", iov_count, packed_iovec); + if( verbose ) { + printf("iov_count = %d packed_iovec = %"PRIsize_t" length = %"PRIsize_t"\n", + iov_count, packed_iovec, length); + } packed += length; for( i = 0; i < iov_count; i++ ) { packed_iovec += iov[i].iov_len; + if( verbose ) { + printf("[%s] add %"PRIsize_t" bytes -> so far %"PRIsize_t" bytes\n", + msg, iov[i].iov_len, packed_iovec); + } } if( packed != packed_iovec ) { - printf( "Packed send amount diverges %"PRIsize_t" != %"PRIsize_t"\n", packed, packed_iovec); + printf( "[%s] Raw data amount diverges %"PRIsize_t" != %"PRIsize_t"\n", + msg, packed, packed_iovec); exit(-1); } iov_count = MAX_IOVEC; /* number of available iov */ length = MAX_CHUNK; } + if( verbose ) { + printf("iov_count = %d packed_iovec = %"PRIsize_t" length = %"PRIsize_t"\n", + iov_count, packed_iovec, length); + } packed += length; for( i = 0; i < iov_count; i++ ) { packed_iovec += iov[i].iov_len; + if( verbose ) { + printf("[%s] add %"PRIsize_t" bytes -> so far %"PRIsize_t" bytes\n", + msg, iov[i].iov_len, packed_iovec); + } } if( packed != packed_iovec ) { - printf( "Packed send amount diverges %"PRIsize_t" != %"PRIsize_t"\n", packed, packed_iovec); + printf( "[%s] Raw data amount diverges %"PRIsize_t" != %"PRIsize_t"\n", + msg, packed, packed_iovec); exit(-1); } return packed_iovec; @@ -52,6 +89,7 @@ int main(int argc, char * argv[]) int const per_process = 192; int const per_type = 20000000; + int blocklen, stride, count; int scounts[2] = {per_process, per_process}; int sdispls[2] = {3*per_process, 0*per_process}; @@ -59,35 +97,78 @@ int main(int argc, char * argv[]) int rdispls[2] = {1*per_process, 2*per_process}; MPI_Datatype ddt, stype, rtype; + size_t length, packed; opal_init_util(&argc, &argv); ompi_datatype_init(); ompi_datatype_create_contiguous( per_type, MPI_FLOAT, &ddt); + + /* + * Large sparse datatype: indexed contiguous + */ ompi_datatype_create_indexed(2, scounts, sdispls, ddt, &stype); ompi_datatype_commit(&stype); - ompi_datatype_create_indexed(2, rcounts, rdispls, ddt, &rtype); - ompi_datatype_commit(&rtype); - size_t packed = count_length_via_convertor_raw(stype, 1); - size_t length; + packed = count_length_via_convertor_raw("1. INDEX", stype, 1); opal_datatype_type_size(&stype->super, &length); if( length != packed ) { printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", packed, length); exit(-2); } + ompi_datatype_destroy(&stype); - packed = count_length_via_convertor_raw(rtype, 1); + /* + * Large contiguous datatype: indexed contiguous + */ + ompi_datatype_create_indexed(2, rcounts, rdispls, ddt, &rtype); + ompi_datatype_commit(&rtype); + + packed = count_length_via_convertor_raw("2. INDEX", rtype, 1); opal_datatype_type_size(&rtype->super, &length); if( length != packed ) { printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", packed, length); exit(-2); } - - ompi_datatype_destroy(&stype); ompi_datatype_destroy(&rtype); + ompi_datatype_destroy(&ddt); + + /* + * Large sparse datatype: vector + */ + count = INT_MAX / 2; + blocklen = stride = 4; + ompi_datatype_create_vector(count, blocklen, stride, MPI_FLOAT, &ddt); + ompi_datatype_commit(&ddt); + + packed = count_length_via_convertor_raw("3. VECTOR", ddt, 1); + opal_datatype_type_size(&ddt->super, &length); + if( length != packed ) { + printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", + packed, length); + exit(-2); + } + ompi_datatype_destroy(&ddt); + + /* + * Large sparse datatype: contiguous + */ + MPI_Datatype tmp; + ompi_datatype_create_contiguous(stride, MPI_FLOAT, &tmp); + ompi_datatype_create_contiguous(count, tmp, &ddt); + ompi_datatype_commit(&ddt); + + packed = count_length_via_convertor_raw("4. CONTIG", ddt, 1); + opal_datatype_type_size(&ddt->super, &length); + if( length != packed ) { + printf("Mismatched length of packed data to datatype size (%"PRIsize_t" != %"PRIsize_t")\n", + packed, length); + exit(-2); + } + ompi_datatype_destroy(&ddt); + ompi_datatype_destroy(&tmp); return 0; } From 73134ab9e7f3c7128a494d8681e2beb1fe18621f Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 7 Mar 2019 09:53:21 +0100 Subject: [PATCH 277/674] v4.0.x: Allow user to overwrite `OMPI_ENABLE_MPI1_COMPAT` Follow-up to #6120. As mentioned in [1], it may be desirable to nevertheless get the hidden MPI 1 prototypes, for users who know what they are doing, i.e., the tools guys. @ggouaillardet mentioned in [2], that `-DOMPI_OMIT_MPI1_COMPAT_DECLS=0` should work, but it does not, as than we only get redefinition warnings. See [3]. This topic does not relate to master, as we can remove the actual symbols there, but here in v4.0.x land, the symbols are always there. [1] https://github.com/open-mpi/ompi/pull/6120#issuecomment-443104700 [2] https://github.com/open-mpi/ompi/pull/6120#issuecomment-443117892 [3] https://github.com/open-mpi/ompi/pull/6120#issuecomment-468962596 Signed-off-by: Bert Wesarg --- ompi/include/mpi.h.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 27feae4ad8c..046a39b320e 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -306,7 +306,9 @@ * Don't do MACRO magic for building Profiling library as it * interferes with the above. */ -# if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) +# if defined(OMPI_OMIT_MPI1_COMPAT_DECLS) + /* The user set OMPI_OMIT_MPI1_COMPAT_DECLS, do what he commands */ +# elif (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 # define OMPI_REMOVED_USE_STATIC_ASSERT 0 # define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...") From cf34de33eb851a01f791280801ac36233e559059 Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Thu, 25 Oct 2018 15:22:48 -0400 Subject: [PATCH 278/674] Avoid a double lock interlock when calling pmix_finalize Signed-off-by: Aurelien Bouteiller --- opal/mca/pmix/ext2x/ext2x_client.c | 16 ++++++++++++++-- opal/mca/pmix/ext2x/ext2x_server_south.c | 17 ++++++++++++++--- opal/mca/pmix/pmix3x/pmix3x_client.c | 16 ++++++++++++++-- opal/mca/pmix/pmix3x/pmix3x_server_south.c | 16 ++++++++++++++-- 4 files changed, 56 insertions(+), 9 deletions(-) diff --git a/opal/mca/pmix/ext2x/ext2x_client.c b/opal/mca/pmix/ext2x/ext2x_client.c index 43c711f5848..9cffb66a538 100644 --- a/opal/mca/pmix/ext2x/ext2x_client.c +++ b/opal/mca/pmix/ext2x/ext2x_client.c @@ -8,6 +8,9 @@ * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -165,6 +168,8 @@ int ext2x_client_finalize(void) { pmix_status_t rc; opal_ext2x_event_t *event, *ev2; + opal_list_t evlist; + OBJ_CONSTRUCT(&evlist, opal_list_t); opal_output_verbose(1, opal_pmix_base_framework.framework_output, "PMIx_client finalize"); @@ -178,12 +183,19 @@ int ext2x_client_finalize(void) OPAL_PMIX_DESTRUCT_LOCK(&event->lock); OPAL_PMIX_CONSTRUCT_LOCK(&event->lock); PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event); - OPAL_PMIX_WAIT_THREAD(&event->lock); opal_list_remove_item(&mca_pmix_ext2x_component.events, &event->super); - OBJ_RELEASE(event); + /* wait and release outside the loop to avoid double mutex + * interlock */ + opal_list_append(&evlist, &event->super); } } OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); + OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_ext2x_event_t) { + OPAL_PMIX_WAIT_THREAD(&event->lock); + opal_list_remove_item(&evlist, &event->super); + OBJ_RELEASE(event); + } + OBJ_DESTRUCT(&evlist); rc = PMIx_Finalize(NULL, 0); return ext2x_convert_rc(rc); diff --git a/opal/mca/pmix/ext2x/ext2x_server_south.c b/opal/mca/pmix/ext2x/ext2x_server_south.c index 34317130115..f9e15344e97 100644 --- a/opal/mca/pmix/ext2x/ext2x_server_south.c +++ b/opal/mca/pmix/ext2x/ext2x_server_south.c @@ -9,6 +9,9 @@ * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -180,6 +183,8 @@ int ext2x_server_finalize(void) { pmix_status_t rc; opal_ext2x_event_t *event, *ev2; + opal_list_t evlist; + OBJ_CONSTRUCT(&evlist, opal_list_t); OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock); --opal_pmix_base.initialized; @@ -190,13 +195,19 @@ int ext2x_server_finalize(void) OPAL_PMIX_DESTRUCT_LOCK(&event->lock); OPAL_PMIX_CONSTRUCT_LOCK(&event->lock); PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event); - OPAL_PMIX_WAIT_THREAD(&event->lock); opal_list_remove_item(&mca_pmix_ext2x_component.events, &event->super); - OBJ_RELEASE(event); + /* wait and release outside the loop to avoid double mutex + * interlock */ + opal_list_append(&evlist, &event->super); } } OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); - + OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_ext2x_event_t) { + OPAL_PMIX_WAIT_THREAD(&event->lock); + opal_list_remove_item(&evlist, &event->super); + OBJ_RELEASE(event); + } + OBJ_DESTRUCT(&evlist); rc = PMIx_server_finalize(); return ext2x_convert_rc(rc); } diff --git a/opal/mca/pmix/pmix3x/pmix3x_client.c b/opal/mca/pmix/pmix3x/pmix3x_client.c index 678f5e98057..f24e2c3c198 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_client.c +++ b/opal/mca/pmix/pmix3x/pmix3x_client.c @@ -8,6 +8,9 @@ * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017-2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -169,6 +172,8 @@ int pmix3x_client_finalize(void) { pmix_status_t rc; opal_pmix3x_event_t *event, *ev2; + opal_list_t evlist; + OBJ_CONSTRUCT(&evlist, opal_list_t); opal_output_verbose(1, opal_pmix_base_framework.framework_output, "PMIx_client finalize"); @@ -182,12 +187,19 @@ int pmix3x_client_finalize(void) OPAL_PMIX_DESTRUCT_LOCK(&event->lock); OPAL_PMIX_CONSTRUCT_LOCK(&event->lock); PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event); - OPAL_PMIX_WAIT_THREAD(&event->lock); opal_list_remove_item(&mca_pmix_pmix3x_component.events, &event->super); - OBJ_RELEASE(event); + /* wait and release outside the loop to avoid double mutex + * interlock */ + opal_list_append(&evlist, &event->super); } } OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); + OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_pmix3x_event_t) { + OPAL_PMIX_WAIT_THREAD(&event->lock); + opal_list_remove_item(&evlist, &event->super); + OBJ_RELEASE(event); + } + OBJ_DESTRUCT(&evlist); rc = PMIx_Finalize(NULL, 0); return pmix3x_convert_rc(rc); diff --git a/opal/mca/pmix/pmix3x/pmix3x_server_south.c b/opal/mca/pmix/pmix3x/pmix3x_server_south.c index 203ddefaed5..ac36b69877f 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_server_south.c +++ b/opal/mca/pmix/pmix3x/pmix3x_server_south.c @@ -9,6 +9,9 @@ * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2017-2018 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -186,6 +189,8 @@ int pmix3x_server_finalize(void) { pmix_status_t rc; opal_pmix3x_event_t *event, *ev2; + opal_list_t evlist; + OBJ_CONSTRUCT(&evlist, opal_list_t); OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock); --opal_pmix_base.initialized; @@ -196,12 +201,19 @@ int pmix3x_server_finalize(void) OPAL_PMIX_DESTRUCT_LOCK(&event->lock); OPAL_PMIX_CONSTRUCT_LOCK(&event->lock); PMIx_Deregister_event_handler(event->index, dereg_cbfunc, (void*)event); - OPAL_PMIX_WAIT_THREAD(&event->lock); opal_list_remove_item(&mca_pmix_pmix3x_component.events, &event->super); - OBJ_RELEASE(event); + /* wait and release outside the loop to avoid double mutex + * interlock */ + opal_list_append(&evlist, &event->super); } } OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); + OPAL_LIST_FOREACH_SAFE(event, ev2, &evlist, opal_pmix3x_event_t) { + OPAL_PMIX_WAIT_THREAD(&event->lock); + opal_list_remove_item(&evlist, &event->super); + OBJ_RELEASE(event); + } + OBJ_DESTRUCT(&evlist); rc = PMIx_server_finalize(); return pmix3x_convert_rc(rc); } From 5f7454a22449c9ce6d7251438af28521a427d7e1 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 7 Mar 2019 08:26:44 -0700 Subject: [PATCH 279/674] ompi_info: report whether MPI1 compat is enabled Its so easy to misspell compatability (sic) that we need to have ompi_info help us out. Related to #6470 Signed-off-by: Howard Pritchard (cherry picked from commit a5ba48c21839e0aab4c96afa97466a10f8bdc721) --- ompi/tools/ompi_info/param.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ompi/tools/ompi_info/param.c b/ompi/tools/ompi_info/param.c index 17e2cc42e28..a2fb0d4487b 100644 --- a/ompi/tools/ompi_info/param.c +++ b/ompi/tools/ompi_info/param.c @@ -14,6 +14,9 @@ * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Copyright (c) 2019 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -132,6 +135,7 @@ void ompi_info_do_config(bool want_all) char *crdebug_support; char *topology_support; char *ipv6_support; + char *mpi1_compat_support; /* Do a little preprocessor trickery here to figure opal_info_out the * tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or @@ -285,6 +289,7 @@ void ompi_info_do_config(bool want_all) symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no"; topology_support = "yes"; ipv6_support = OPAL_ENABLE_IPV6 ? "yes" : "no"; + mpi1_compat_support = OMPI_ENABLE_MPI1_COMPAT ? "yes" : "no"; /* setup strings that require allocation */ if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) { @@ -643,6 +648,8 @@ void ompi_info_do_config(bool want_all) opal_info_out("Host topology support", "options:host-topology", topology_support); opal_info_out("IPv6 support", "options:ipv6", ipv6_support); + opal_info_out("MPI1 compatibility", "options:mpi1-compatibility", + mpi1_compat_support); opal_info_out("MPI extensions", "options:mpi_ext", OMPI_MPIEXT_COMPONENTS); From 8138cdbb495534b08dbc5cf54b269c7c240dd0a5 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Wed, 13 Mar 2019 09:15:27 -0400 Subject: [PATCH 280/674] Fix integer overflows with indexed datatype creation. The types of count, disp, and extent passed into ompi_datatype_add() should be size_t, ptrdiff_t and ptrdiff_t, respectively. This prevents integer overflows and errors in computing the size of large indexed datatypes. Signed-off-by: Austen Lauria (cherry picked from commit b61e6242d3aa494d2b25c9ebaea9ed980b02aa9b) Signed-off-by: Austen Lauria --- ompi/datatype/ompi_datatype_create_indexed.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ompi/datatype/ompi_datatype_create_indexed.c b/ompi/datatype/ompi_datatype_create_indexed.c index 50c521b7bf9..457efb1e6ff 100644 --- a/ompi/datatype/ompi_datatype_create_indexed.c +++ b/ompi/datatype/ompi_datatype_create_indexed.c @@ -15,6 +15,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,8 +35,9 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; - int i, dLength, endat, disp; - ptrdiff_t extent; + int i; + ptrdiff_t extent, disp, endat; + size_t dLength; if( 0 == count ) { return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); @@ -70,8 +72,9 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; - int i, dLength; + int i; ptrdiff_t extent, disp, endat; + size_t dLength; if( 0 == count ) { *newType = ompi_datatype_create( 0 ); @@ -108,8 +111,9 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; - int i, dLength, endat, disp; - ptrdiff_t extent; + int i; + ptrdiff_t extent, disp, endat; + size_t dLength; ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { @@ -147,8 +151,9 @@ int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdi const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t* pdt; - int i, dLength; + int i; ptrdiff_t extent, disp, endat; + size_t dLength; ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { From 14c271f993a292d74b64f48ef48870cbaccf7fd6 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 12 Mar 2019 21:14:27 +0200 Subject: [PATCH 281/674] PML/SPML/UCX: added evaluation of mmap events - there was a set of UCX related issues reported which caused by mmap API hooks conflicts. We added diagnostic of such problems to simplify bug-resolving pipeline Signed-off-by: Sergey Oblomov (cherry picked from commit d8e3562bae700d84873c1d5ca9c45c846d7387ed) --- config/ompi_check_ucx.m4 | 3 +++ ompi/mca/pml/ucx/pml_ucx.c | 1 + opal/mca/common/ucx/common_ucx.c | 22 ++++++++++++++++++++++ opal/mca/common/ucx/common_ucx.h | 6 ++++++ oshmem/mca/spml/ucx/spml_ucx.c | 2 ++ 5 files changed, 34 insertions(+) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 668b0ff1478..044b599dc3b 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -112,6 +112,9 @@ AC_DEFUN([OMPI_CHECK_UCX],[ ucp_request_check_status, ucp_put_nb, ucp_get_nb], [], [], [#include ]) + AC_CHECK_DECLS([ucm_test_events], + [], [], + [#include ]) AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND, UCP_ATOMIC_POST_OP_OR, UCP_ATOMIC_POST_OP_XOR, diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 00a95644c22..e2a614e242b 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -422,6 +422,7 @@ int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs) } } + opal_common_ucx_mca_proc_added(); return OMPI_SUCCESS; } diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 2213f118eb2..254ac3a032a 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -132,6 +132,28 @@ static void opal_common_ucx_mca_fence_complete_cb(int status, void *fenced) *(int*)fenced = 1; } +void opal_common_ucx_mca_proc_added(void) +{ +#if HAVE_DECL_UCM_TEST_EVENTS + static int warned = 0; + static char *mem_hooks_suggestion = "Try to add command line agrument " + "'--mca opal_common_ucx_opal_mem_hooks 1' to resolve " + "this issue."; + ucs_status_t status; + + if (!warned) { + status = ucm_test_events(UCM_EVENT_VM_UNMAPPED); + if (status != UCS_OK) { + MCA_COMMON_UCX_WARN("UCX is unable to handle VM_UNMAP event. " + "This may cause performance degradation or data " + "corruption. %s", + opal_common_ucx.opal_mem_hooks ? "" : mem_hooks_suggestion); + warned = 1; + } + } +#endif +} + OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker) { volatile int fenced = 0; diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 0cf46e5c28a..0bd33f9cfa8 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -44,6 +44,11 @@ BEGIN_C_DECLS __FILE__ ":" MCA_COMMON_UCX_QUOTE(__LINE__) \ " Error: " __VA_ARGS__) +#define MCA_COMMON_UCX_WARN(...) \ + opal_output_verbose(0, opal_common_ucx.output, \ + __FILE__ ":" MCA_COMMON_UCX_QUOTE(__LINE__) \ + " Warning: " __VA_ARGS__) + #define MCA_COMMON_UCX_VERBOSE(_level, ... ) \ if (((_level) <= MCA_COMMON_UCX_MAX_VERBOSE) && \ ((_level) <= opal_common_ucx.verbose)) { \ @@ -96,6 +101,7 @@ extern opal_common_ucx_module_t opal_common_ucx; OPAL_DECLSPEC void opal_common_ucx_mca_register(void); OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void); +OPAL_DECLSPEC void opal_common_ucx_mca_proc_added(void); OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status); OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component); diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 67bfc7ceabe..d20bfd95838 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -138,6 +138,8 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) mca_spml_ucx_ctx_default.ucp_peers = NULL; + opal_common_ucx_mca_proc_added(); + return ret; } From bed814108880d5efdb23cc0a66cf3c9e2e421705 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 14 Mar 2019 11:00:57 +0200 Subject: [PATCH 282/674] COMMON/UCX: rewording of hooks suggestion - also updated output macro Signed-off-by: Sergey Oblomov (cherry picked from commit c319cf9adefb69c78a73eb4a83a40dee5b697a53) --- opal/mca/common/ucx/common_ucx.c | 5 ++--- opal/mca/common/ucx/common_ucx.h | 14 +++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 254ac3a032a..69f8b0c4678 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -136,9 +136,8 @@ void opal_common_ucx_mca_proc_added(void) { #if HAVE_DECL_UCM_TEST_EVENTS static int warned = 0; - static char *mem_hooks_suggestion = "Try to add command line agrument " - "'--mca opal_common_ucx_opal_mem_hooks 1' to resolve " - "this issue."; + static char *mem_hooks_suggestion = "Pls try adding --mca opal_common_ucx_opal_mem_hooks 1 " + "to mpirun/oshrun command line to resolve this issue."; ucs_status_t status; if (!warned) { diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 0bd33f9cfa8..7db964447e9 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -39,15 +39,11 @@ BEGIN_C_DECLS #define MCA_COMMON_UCX_QUOTE(_x) \ _MCA_COMMON_UCX_QUOTE(_x) -#define MCA_COMMON_UCX_ERROR(...) \ - opal_output_verbose(0, opal_common_ucx.output, \ - __FILE__ ":" MCA_COMMON_UCX_QUOTE(__LINE__) \ - " Error: " __VA_ARGS__) - -#define MCA_COMMON_UCX_WARN(...) \ - opal_output_verbose(0, opal_common_ucx.output, \ - __FILE__ ":" MCA_COMMON_UCX_QUOTE(__LINE__) \ - " Warning: " __VA_ARGS__) +#define MCA_COMMON_UCX_ERROR(...) \ + MCA_COMMON_UCX_VERBOSE(0, " Error: " __VA_ARGS__) + +#define MCA_COMMON_UCX_WARN(...) \ + MCA_COMMON_UCX_VERBOSE(0, " Warning: " __VA_ARGS__) #define MCA_COMMON_UCX_VERBOSE(_level, ... ) \ if (((_level) <= MCA_COMMON_UCX_MAX_VERBOSE) && \ From fcf53becc3e63e9ca8b8c968fdab261ba17e46c4 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 11 Mar 2019 14:03:02 -0400 Subject: [PATCH 283/674] opal_hwloc_base_cset2str() off-by-1 in its strncat() I think the strncat() calls here need to be of the form strncat(str, new_str_to_add, len - strlen(new_str_to_addstr) - 1); since in the OMPI calls len is being used as total number of bytes in str. strncat(dest,src,n) on the other hand is documented as writing up to n chars from the incoming string plus 1 for the null, for n+1 total bytes it can write. Signed-off-by: Mark Allen (cherry picked from commit 30d60994d258f5f0b7c432efd284d1b6b8333faf) Conflicts: opal/mca/hwloc/base/hwloc_base_util.c --- opal/mca/hwloc/base/hwloc_base_util.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index f606f4d08f1..ba26ba0ac6d 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -18,6 +18,8 @@ * and Technology (RIST). All rights reserved. * Copyright (C) 2018 Mellanox Technologies, Ltd. * All rights reserved. + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -1721,14 +1723,14 @@ int opal_hwloc_base_cset2str(char *str, int len, for (core_index = 0; core_index < num_cores; ++core_index) { if (map[socket_index][core_index] > 0) { if (!first) { - strncat(str, ", ", len - strlen(str)); + strncat(str, ", ", len - strlen(str) - 1); } first = false; snprintf(tmp, stmp, "socket %d[core %d[hwt %s]]", socket_index, core_index, bitmap2rangestr(map[socket_index][core_index])); - strncat(str, tmp, len - strlen(str)); + strncat(str, tmp, len - strlen(str) - 1); } } } @@ -1784,7 +1786,7 @@ int opal_hwloc_base_cset2mapstr(char *str, int len, for (socket = hwloc_get_obj_by_type(topo, HWLOC_OBJ_SOCKET, 0); NULL != socket; socket = socket->next_cousin) { - strncat(str, "[", len - strlen(str)); + strncat(str, "[", len - strlen(str) - 1); /* Iterate over all existing cores in this socket */ core_index = 0; @@ -1796,7 +1798,7 @@ int opal_hwloc_base_cset2mapstr(char *str, int len, socket->cpuset, HWLOC_OBJ_CORE, ++core_index)) { if (core_index > 0) { - strncat(str, "/", len - strlen(str)); + strncat(str, "/", len - strlen(str) - 1); } /* Iterate over all existing PUs in this core */ @@ -1811,13 +1813,13 @@ int opal_hwloc_base_cset2mapstr(char *str, int len, /* Is this PU in the cpuset? */ if (hwloc_bitmap_isset(cpuset, pu->os_index)) { - strncat(str, "B", len - strlen(str)); + strncat(str, "B", len - strlen(str) - 1); } else { - strncat(str, ".", len - strlen(str)); + strncat(str, ".", len - strlen(str) - 1); } } } - strncat(str, "]", len - strlen(str)); + strncat(str, "]", len - strlen(str) - 1); } return OPAL_SUCCESS; From bac6024b5ab24c99873fb91b10f661dff04c945c Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 14 Jan 2019 15:48:46 -0700 Subject: [PATCH 284/674] mpool: add new base module type "basic" This commit adds a new mpool base module type: basic. This module can be used with an opal_free_list_t to allocate space from a pre-allocated block (such as a shared memory region). The new module only supports allocation and is not meant for more dynamic use cases at this time. Signed-off-by: Nathan Hjelm --- opal/mca/mpool/base/Makefile.am | 3 +- opal/mca/mpool/base/base.h | 2 + opal/mca/mpool/base/mpool_base_basic.c | 109 +++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 opal/mca/mpool/base/mpool_base_basic.c diff --git a/opal/mca/mpool/base/Makefile.am b/opal/mca/mpool/base/Makefile.am index 646444e231d..dd85a97fb6b 100644 --- a/opal/mca/mpool/base/Makefile.am +++ b/opal/mca/mpool/base/Makefile.am @@ -28,7 +28,8 @@ libmca_mpool_la_SOURCES += \ base/mpool_base_lookup.c \ base/mpool_base_alloc.c \ base/mpool_base_tree.c \ - base/mpool_base_default.c + base/mpool_base_default.c \ + base/mpool_base_basic.c dist_opaldata_DATA += \ base/help-mpool-base.txt diff --git a/opal/mca/mpool/base/base.h b/opal/mca/mpool/base/base.h index 88a99cad01a..6d95665bff7 100644 --- a/opal/mca/mpool/base/base.h +++ b/opal/mca/mpool/base/base.h @@ -53,6 +53,8 @@ OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_mpool_base_selected_module_t); OPAL_DECLSPEC mca_mpool_base_component_t* mca_mpool_base_component_lookup(const char* name); OPAL_DECLSPEC mca_mpool_base_module_t* mca_mpool_base_module_lookup(const char* name); +OPAL_DECLSPEC mca_mpool_base_module_t *mca_mpool_basic_create (void *base, size_t size, unsigned min_align); + /* * Globals */ diff --git a/opal/mca/mpool/base/mpool_base_basic.c b/opal/mca/mpool/base/mpool_base_basic.c new file mode 100644 index 00000000000..fba7e6fed7b --- /dev/null +++ b/opal/mca/mpool/base/mpool_base_basic.c @@ -0,0 +1,109 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyrigth (c) 2018 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/align.h" + +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#include "opal/mca/mca.h" +#include "opal/mca/base/base.h" +#include "opal/mca/mpool/base/base.h" +#include "opal/constants.h" +#include "opal/util/sys_limits.h" + +struct mca_mpool_base_basic_module_t { + mca_mpool_base_module_t super; + opal_mutex_t lock; + uintptr_t ptr; + size_t size; + size_t avail; + unsigned min_align; +}; +typedef struct mca_mpool_base_basic_module_t mca_mpool_base_basic_module_t; + +static void *mca_mpool_base_basic_alloc (mca_mpool_base_module_t *mpool, size_t size, + size_t align, uint32_t flags) +{ + mca_mpool_base_basic_module_t *basic_module = (mca_mpool_base_basic_module_t *) mpool; + uintptr_t next_ptr; + void *ptr; + + opal_mutex_lock (&basic_module->lock); + + align = align > basic_module->min_align ? align : basic_module->min_align; + + next_ptr = OPAL_ALIGN(basic_module->ptr, align, uintptr_t); + + size = OPAL_ALIGN(size, 8, size_t) + next_ptr - basic_module->ptr; + + if (size > basic_module->avail) { + opal_mutex_unlock (&basic_module->lock); + return NULL; + } + + ptr = (void *) next_ptr; + basic_module->avail -= size; + basic_module->ptr += size; + + opal_mutex_unlock (&basic_module->lock); + return ptr; +} + +/** + * free function + */ +static void mca_mpool_base_basic_free (mca_mpool_base_module_t *mpool, void *addr) +{ + /* nothing to do for now */ +} + +static void mca_mpool_base_basic_finalize (struct mca_mpool_base_module_t *mpool) +{ + mca_mpool_base_basic_module_t *basic_module = (mca_mpool_base_basic_module_t *) mpool; + + OBJ_DESTRUCT(&basic_module->lock); + free (mpool); +} + +static mca_mpool_base_module_t mca_mpool_basic_template = { + .mpool_alloc = mca_mpool_base_basic_alloc, + .mpool_free = mca_mpool_base_basic_free, + .mpool_finalize = mca_mpool_base_basic_finalize, + .flags = MCA_MPOOL_FLAGS_MPI_ALLOC_MEM, +}; + +mca_mpool_base_module_t *mca_mpool_basic_create (void *base, size_t size, unsigned min_align) +{ + mca_mpool_base_basic_module_t *basic_module = calloc (1, sizeof (*basic_module)); + + if (OPAL_UNLIKELY(NULL == basic_module)) { + return NULL; + } + + memcpy (&basic_module->super, &mca_mpool_basic_template, sizeof (mca_mpool_basic_template)); + + OBJ_CONSTRUCT(&basic_module->lock, opal_mutex_t); + + basic_module->super.mpool_base = base; + basic_module->ptr = (uintptr_t) base; + basic_module->size = basic_module->avail = size; + basic_module->min_align = min_align; + + return &basic_module->super; +} From 20017d345e49b644316af476ec0345ac3f68316a Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Mon, 14 Jan 2019 15:54:16 -0700 Subject: [PATCH 285/674] btl/vader: use basic mpool type to handle frag/fbox allocation This commit updates btl/vader to use an mpool for handling all shared memory allocations (frags, fboxes). Signed-off-by: Nathan Hjelm --- opal/mca/btl/vader/btl_vader.h | 7 ++-- opal/mca/btl/vader/btl_vader_component.c | 8 +++-- opal/mca/btl/vader/btl_vader_endpoint.h | 8 ++++- opal/mca/btl/vader/btl_vader_fbox.h | 17 +++++----- opal/mca/btl/vader/btl_vader_frag.c | 35 +++---------------- opal/mca/btl/vader/btl_vader_module.c | 43 ++++++++++++++++++------ 6 files changed, 62 insertions(+), 56 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader.h b/opal/mca/btl/vader/btl_vader.h index 7e1afad24c6..028c7a38167 100644 --- a/opal/mca/btl/vader/btl_vader.h +++ b/opal/mca/btl/vader/btl_vader.h @@ -15,6 +15,8 @@ * Copyright (c) 2010-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * * $COPYRIGHT$ * @@ -53,6 +55,7 @@ #include "opal/mca/rcache/rcache.h" #include "opal/mca/rcache/base/base.h" #include "opal/mca/btl/base/btl_base_error.h" +#include "opal/mca/mpool/base/base.h" #include "opal/util/proc.h" #include "btl_vader_endpoint.h" @@ -112,16 +115,15 @@ struct mca_btl_vader_component_t { opal_mutex_t lock; /**< lock to protect concurrent updates to this structure's members */ char *my_segment; /**< this rank's base pointer */ size_t segment_size; /**< size of my_segment */ - size_t segment_offset; /**< start of unused portion of my_segment */ int32_t num_smp_procs; /**< current number of smp procs on this host */ opal_free_list_t vader_frags_eager; /**< free list of vader send frags */ opal_free_list_t vader_frags_max_send; /**< free list of vader max send frags (large fragments) */ opal_free_list_t vader_frags_user; /**< free list of small inline frags */ + opal_free_list_t vader_fboxes; /**< free list of available fast-boxes */ unsigned int fbox_threshold; /**< number of sends required before we setup a send fast box for a peer */ unsigned int fbox_max; /**< maximum number of send fast boxes to allocate */ unsigned int fbox_size; /**< size of each peer fast box allocation */ - unsigned int fbox_count; /**< number of send fast boxes allocated */ int single_copy_mechanism; /**< single copy mechanism to use */ @@ -143,6 +145,7 @@ struct mca_btl_vader_component_t { #if OPAL_BTL_VADER_HAVE_KNEM unsigned int knem_dma_min; /**< minimum size to enable DMA for knem transfers (0 disables) */ #endif + mca_mpool_base_module_t *mpool; }; typedef struct mca_btl_vader_component_t mca_btl_vader_component_t; OPAL_MODULE_DECLSPEC extern mca_btl_vader_component_t mca_btl_vader_component; diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 3fc35c6a46e..11197259973 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -18,6 +18,9 @@ * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -301,6 +304,7 @@ static int mca_btl_vader_component_open(void) OBJ_CONSTRUCT(&mca_btl_vader_component.vader_frags_eager, opal_free_list_t); OBJ_CONSTRUCT(&mca_btl_vader_component.vader_frags_user, opal_free_list_t); OBJ_CONSTRUCT(&mca_btl_vader_component.vader_frags_max_send, opal_free_list_t); + OBJ_CONSTRUCT(&mca_btl_vader_component.vader_fboxes, opal_free_list_t); OBJ_CONSTRUCT(&mca_btl_vader_component.lock, opal_mutex_t); OBJ_CONSTRUCT(&mca_btl_vader_component.pending_endpoints, opal_list_t); OBJ_CONSTRUCT(&mca_btl_vader_component.pending_fragments, opal_list_t); @@ -321,6 +325,7 @@ static int mca_btl_vader_component_close(void) OBJ_DESTRUCT(&mca_btl_vader_component.vader_frags_eager); OBJ_DESTRUCT(&mca_btl_vader_component.vader_frags_user); OBJ_DESTRUCT(&mca_btl_vader_component.vader_frags_max_send); + OBJ_DESTRUCT(&mca_btl_vader_component.vader_fboxes); OBJ_DESTRUCT(&mca_btl_vader_component.lock); OBJ_DESTRUCT(&mca_btl_vader_component.pending_endpoints); OBJ_DESTRUCT(&mca_btl_vader_component.pending_fragments); @@ -517,7 +522,6 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls, /* no fast boxes allocated initially */ component->num_fbox_in_endpoints = 0; - component->fbox_count = 0; mca_btl_vader_check_single_copy (); @@ -559,8 +563,6 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls, } } - component->segment_offset = 0; - /* initialize my fifo */ vader_fifo_init ((struct vader_fifo_t *) component->my_segment); diff --git a/opal/mca/btl/vader/btl_vader_endpoint.h b/opal/mca/btl/vader/btl_vader_endpoint.h index d3a39e08f24..e9409b90c11 100644 --- a/opal/mca/btl/vader/btl_vader_endpoint.h +++ b/opal/mca/btl/vader/btl_vader_endpoint.h @@ -13,6 +13,8 @@ * Copyright (c) 2006-2007 Voltaire. All rights reserved. * Copyright (c) 2012-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -58,6 +60,7 @@ typedef struct mca_btl_base_endpoint_t { uint32_t *startp; /**< pointer to location storing start offset */ unsigned int start, end; uint16_t seq; + opal_free_list_item_t *fbox; /**< fast-box free list item */ } fbox_out; int32_t peer_smp_rank; /**< my peer's SMP process rank. Used for accessing @@ -101,13 +104,16 @@ static inline void mca_btl_vader_endpoint_setup_fbox_recv (struct mca_btl_base_e endpoint->fbox_in.buffer = base; } -static inline void mca_btl_vader_endpoint_setup_fbox_send (struct mca_btl_base_endpoint_t *endpoint, void *base) +static inline void mca_btl_vader_endpoint_setup_fbox_send (struct mca_btl_base_endpoint_t *endpoint, opal_free_list_item_t *fbox) { + void *base = fbox->ptr; + endpoint->fbox_out.start = MCA_BTL_VADER_FBOX_ALIGNMENT; endpoint->fbox_out.end = MCA_BTL_VADER_FBOX_ALIGNMENT; endpoint->fbox_out.startp = (uint32_t *) base; endpoint->fbox_out.startp[0] = MCA_BTL_VADER_FBOX_ALIGNMENT; endpoint->fbox_out.seq = 0; + endpoint->fbox_out.fbox = fbox; /* zero out the first header in the fast box */ memset ((char *) base + MCA_BTL_VADER_FBOX_ALIGNMENT, 0, MCA_BTL_VADER_FBOX_ALIGNMENT); diff --git a/opal/mca/btl/vader/btl_vader_fbox.h b/opal/mca/btl/vader/btl_vader_fbox.h index 25f99c2c985..3762c62010d 100644 --- a/opal/mca/btl/vader/btl_vader_fbox.h +++ b/opal/mca/btl/vader/btl_vader_fbox.h @@ -2,6 +2,8 @@ /* * Copyright (c) 2011-2018 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -259,20 +261,17 @@ static inline void mca_btl_vader_try_fbox_setup (mca_btl_base_endpoint_t *ep, mc /* protect access to mca_btl_vader_component.segment_offset */ OPAL_THREAD_LOCK(&mca_btl_vader_component.lock); - if (mca_btl_vader_component.segment_size >= mca_btl_vader_component.segment_offset + mca_btl_vader_component.fbox_size && - mca_btl_vader_component.fbox_max > mca_btl_vader_component.fbox_count) { - /* verify the remote side will accept another fbox */ - if (0 <= opal_atomic_add_fetch_32 (&ep->fifo->fbox_available, -1)) { - void *fbox_base = mca_btl_vader_component.my_segment + mca_btl_vader_component.segment_offset; - mca_btl_vader_component.segment_offset += mca_btl_vader_component.fbox_size; + /* verify the remote side will accept another fbox */ + if (0 <= opal_atomic_add_fetch_32 (&ep->fifo->fbox_available, -1)) { + opal_free_list_item_t *fbox = opal_free_list_get (&mca_btl_vader_component.vader_fboxes); + if (NULL != fbox) { /* zero out the fast box */ - memset (fbox_base, 0, mca_btl_vader_component.fbox_size); - mca_btl_vader_endpoint_setup_fbox_send (ep, fbox_base); + memset (fbox->ptr, 0, mca_btl_vader_component.fbox_size); + mca_btl_vader_endpoint_setup_fbox_send (ep, fbox); hdr->flags |= MCA_BTL_VADER_FLAG_SETUP_FBOX; hdr->fbox_base = virtual2relative((char *) ep->fbox_out.buffer); - ++mca_btl_vader_component.fbox_count; } else { opal_atomic_add_fetch_32 (&ep->fifo->fbox_available, 1); } diff --git a/opal/mca/btl/vader/btl_vader_frag.c b/opal/mca/btl/vader/btl_vader_frag.c index a132ea3d725..3635af99a43 100644 --- a/opal/mca/btl/vader/btl_vader_frag.c +++ b/opal/mca/btl/vader/btl_vader_frag.c @@ -13,6 +13,8 @@ * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,38 +43,9 @@ static inline void mca_btl_vader_frag_constructor (mca_btl_vader_frag_t *frag) int mca_btl_vader_frag_init (opal_free_list_item_t *item, void *ctx) { mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) item; - unsigned int data_size = (unsigned int)(uintptr_t) ctx; - unsigned int frag_size = data_size + sizeof (mca_btl_vader_hdr_t); - - /* ensure next fragment is aligned on a cache line */ - frag_size = (frag_size + 63) & ~63; - - OPAL_THREAD_LOCK(&mca_btl_vader_component.lock); - - if (data_size && mca_btl_vader_component.segment_size < mca_btl_vader_component.segment_offset + frag_size) { - OPAL_THREAD_UNLOCK(&mca_btl_vader_component.lock); - return OPAL_ERR_OUT_OF_RESOURCE; - } - - /* Set the list element here so we don't have to set it on the critical path. This only - * works if each free list has its own unique fragment size and ALL free lists are initialized - * with opal_free_list_init. */ - if (mca_btl_vader_component.max_inline_send == data_size) { - frag->my_list = &mca_btl_vader_component.vader_frags_user; - } else if (mca_btl_vader.super.btl_eager_limit == data_size) { - frag->my_list = &mca_btl_vader_component.vader_frags_eager; - } else if (mca_btl_vader.super.btl_max_send_size == data_size) { - frag->my_list = &mca_btl_vader_component.vader_frags_max_send; - } - - if (data_size) { - item->ptr = mca_btl_vader_component.my_segment + mca_btl_vader_component.segment_offset; - mca_btl_vader_component.segment_offset += frag_size; - } - - OPAL_THREAD_UNLOCK(&mca_btl_vader_component.lock); - mca_btl_vader_frag_constructor ((mca_btl_vader_frag_t *) item); + /* Set the list element here so we don't have to set it on the critical path */ + frag->my_list = (opal_free_list_t *) ctx; return OPAL_SUCCESS; } diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index bcc25f0f00b..1dbd2defba2 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -97,19 +97,32 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) return OPAL_ERR_OUT_OF_RESOURCE; } - component->segment_offset = MCA_BTL_VADER_FIFO_SIZE; + component->mpool = mca_mpool_basic_create ((void *) (component->my_segment + MCA_BTL_VADER_FIFO_SIZE), + (unsigned long) (mca_btl_vader_component.segment_size - MCA_BTL_VADER_FIFO_SIZE), 64); + if (NULL == component->mpool) { + free (component->endpoints); + return OPAL_ERR_OUT_OF_RESOURCE; + } + + rc = opal_free_list_init (&component->vader_fboxes, sizeof (opal_free_list_item_t), 8, + OBJ_CLASS(opal_free_list_item_t), mca_btl_vader_component.fbox_size, + opal_cache_line_size, 0, mca_btl_vader_component.fbox_max, 4, + component->mpool, 0, NULL, NULL, NULL); + if (OPAL_SUCCESS != rc) { + return rc; + } /* initialize fragment descriptor free lists */ /* initialize free list for small send and inline fragments */ rc = opal_free_list_init (&component->vader_frags_user, sizeof(mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - 0, opal_cache_line_size, + mca_btl_vader_component.max_inline_send, opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, - NULL, 0, NULL, mca_btl_vader_frag_init, - (void *)(intptr_t) mca_btl_vader_component.max_inline_send); + component->mpool, 0, NULL, mca_btl_vader_frag_init, + &component->vader_frags_user); if (OPAL_SUCCESS != rc) { return rc; } @@ -118,12 +131,12 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) rc = opal_free_list_init (&component->vader_frags_eager, sizeof (mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - 0, opal_cache_line_size, + mca_btl_vader.super.btl_eager_limit, opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, - NULL, 0, NULL, mca_btl_vader_frag_init, - (void *)(intptr_t) mca_btl_vader.super.btl_eager_limit); + component->mpool, 0, NULL, mca_btl_vader_frag_init, + &component->vader_frags_eager); if (OPAL_SUCCESS != rc) { return rc; } @@ -133,12 +146,12 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) rc = opal_free_list_init (&component->vader_frags_max_send, sizeof (mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - 0, opal_cache_line_size, + mca_btl_vader.super.btl_max_send_size, opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, - NULL, 0, NULL, mca_btl_vader_frag_init, - (void *)(intptr_t) mca_btl_vader.super.btl_max_send_size); + component->mpool, 0, NULL, mca_btl_vader_frag_init, + &component->vader_frags_max_send); if (OPAL_SUCCESS != rc) { return rc; } @@ -367,6 +380,11 @@ static int vader_finalize(struct mca_btl_base_module_t *btl) } #endif + if (component->mpool) { + component->mpool->mpool_finalize (component->mpool); + component->mpool = NULL; + } + return OPAL_SUCCESS; } @@ -536,6 +554,7 @@ static void mca_btl_vader_endpoint_constructor (mca_btl_vader_endpoint_t *ep) OBJ_CONSTRUCT(&ep->pending_frags, opal_list_t); OBJ_CONSTRUCT(&ep->pending_frags_lock, opal_mutex_t); ep->fifo = NULL; + ep->fbox_out.fbox = NULL; } #if OPAL_BTL_VADER_HAVE_XPMEM @@ -564,8 +583,12 @@ static void mca_btl_vader_endpoint_destructor (mca_btl_vader_endpoint_t *ep) /* disconnect from the peer's segment */ opal_shmem_segment_detach (&seg_ds); } + if (ep->fbox_out.fbox) { + opal_free_list_return (&mca_btl_vader_component.vader_fboxes, ep->fbox_out.fbox); + } ep->fbox_in.buffer = ep->fbox_out.buffer = NULL; + ep->fbox_out.fbox = NULL; ep->segment_base = NULL; ep->fifo = NULL; } From 3df8ed9cc049976402884838ad4ec9c409dd15bd Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 30 Jan 2019 12:31:34 -0700 Subject: [PATCH 286/674] btl/vader: fix fragment sizes used by free lists This commit fixes a bug introduced in f62d26ddbc8cda4d985cceee531a2ec32406d1f6. That commit changed how vader allocates fragment memory from the shared memory segment. Unfortunately, the values used for the fragment sizes did not include space for the fragment header. This can cause an overrun of data from one fragment to the header of the next fragment. Signed-off-by: Nathan Hjelm --- opal/mca/btl/vader/btl_vader_module.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index 1dbd2defba2..36ec1f00610 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -17,7 +17,7 @@ * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Triad National Security, LLC. All rights + * Copyright (c) 2018-2019 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ * @@ -117,8 +117,8 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) rc = opal_free_list_init (&component->vader_frags_user, sizeof(mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - mca_btl_vader_component.max_inline_send, opal_cache_line_size, - component->vader_free_list_num, + mca_btl_vader_component.max_inline_send + sizeof (mca_btl_vader_frag_t), + opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, component->mpool, 0, NULL, mca_btl_vader_frag_init, @@ -131,8 +131,8 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) rc = opal_free_list_init (&component->vader_frags_eager, sizeof (mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - mca_btl_vader.super.btl_eager_limit, opal_cache_line_size, - component->vader_free_list_num, + mca_btl_vader.super.btl_eager_limit + sizeof (mca_btl_vader_frag_t), + opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, component->mpool, 0, NULL, mca_btl_vader_frag_init, @@ -146,8 +146,8 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) rc = opal_free_list_init (&component->vader_frags_max_send, sizeof (mca_btl_vader_frag_t), opal_cache_line_size, OBJ_CLASS(mca_btl_vader_frag_t), - mca_btl_vader.super.btl_max_send_size, opal_cache_line_size, - component->vader_free_list_num, + mca_btl_vader.super.btl_max_send_size + sizeof (mca_btl_vader_frag_t), + opal_cache_line_size, component->vader_free_list_num, component->vader_free_list_max, component->vader_free_list_inc, component->mpool, 0, NULL, mca_btl_vader_frag_init, From 2ae9a8a3d68c58dff5cfcacbdc6b79b746a3a270 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 18 Mar 2019 16:29:35 -0500 Subject: [PATCH 287/674] Reving to v4.0.1rc2 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b80fa45cf04..7b3f884af6f 100644 --- a/VERSION +++ b/VERSION @@ -28,7 +28,7 @@ release=1 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc1 +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From d7053a306a74d71b8bc5a05782f3125727d20f6c Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 29 Nov 2018 11:38:07 +0900 Subject: [PATCH 288/674] btl/openib: delay UCX warning to add_procs() If UCX is available, then pml/ucx will be used instead of pml/ob1 + btl/openib, so there is no need to warn about btl/openib not supporting Infiniband. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@0a2ce580405ae86788e5f0e7d5264fce162e73c8) --- opal/mca/btl/openib/btl_openib.c | 130 +++++++++-------- opal/mca/btl/openib/btl_openib.h | 9 +- opal/mca/btl/openib/btl_openib_component.c | 154 ++++++++++++--------- opal/mca/btl/openib/btl_openib_proc.c | 5 +- 4 files changed, 171 insertions(+), 127 deletions(-) diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index dc279df8347..a3bc12190e7 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -19,8 +19,8 @@ * Copyright (c) 2009 IBM Corporation. All rights reserved. * Copyright (c) 2013-2015 Intel, Inc. All rights reserved * Copyright (c) 2013-2015 NVIDIA Corporation. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved * $COPYRIGHT$ * @@ -1040,6 +1040,14 @@ int mca_btl_openib_add_procs( int btl_rank = 0; volatile mca_btl_base_endpoint_t* endpoint; + + if (! openib_btl->allowed) { + opal_bitmap_clear_all_bits(reachable); + opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", + true, opal_process_info.nodename, + ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); + } + btl_rank = get_openib_btl_params(openib_btl, &lcl_subnet_id_port_cnt); if( 0 > btl_rank ){ return OPAL_ERR_NOT_FOUND; @@ -1639,75 +1647,77 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl) return OPAL_SUCCESS; } - /* Release all QPs */ - if (NULL != openib_btl->device->endpoints) { - for (ep_index=0; - ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); - ep_index++) { - endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, + if (openib_btl->allowed) { + /* Release all QPs */ + if (NULL != openib_btl->device->endpoints) { + for (ep_index=0; + ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); + ep_index++) { + endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, ep_index); - if(!endpoint) { - BTL_VERBOSE(("In finalize, got another null endpoint")); - continue; - } - if(endpoint->endpoint_btl != openib_btl) { - continue; - } - for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { - if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { - openib_btl->device->eager_rdma_buffers[i] = NULL; - OBJ_RELEASE(endpoint); + if(!endpoint) { + BTL_VERBOSE(("In finalize, got another null endpoint")); + continue; } + if(endpoint->endpoint_btl != openib_btl) { + continue; + } + for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { + if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { + openib_btl->device->eager_rdma_buffers[i] = NULL; + OBJ_RELEASE(endpoint); + } + } + opal_pointer_array_set_item(openib_btl->device->endpoints, + ep_index, NULL); + assert(((opal_object_t*)endpoint)->obj_reference_count == 1); + OBJ_RELEASE(endpoint); } - opal_pointer_array_set_item(openib_btl->device->endpoints, - ep_index, NULL); - assert(((opal_object_t*)endpoint)->obj_reference_count == 1); - OBJ_RELEASE(endpoint); } - } - - /* Release SRQ resources */ - for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { - if(!BTL_OPENIB_QP_TYPE_PP(qp)) { - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( - &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( - &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); - if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { - opal_mutex_t *lock = - &mca_btl_openib_component.srq_manager.lock; - opal_hash_table_t *srq_addr_table = - &mca_btl_openib_component.srq_manager.srq_addr_table; - - opal_mutex_lock(lock); - if (OPAL_SUCCESS != - opal_hash_table_remove_value_ptr(srq_addr_table, - &openib_btl->qps[qp].u.srq_qp.srq, - sizeof(struct ibv_srq *))) { - BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); - rc = OPAL_ERROR; - } - opal_mutex_unlock(lock); - if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { - BTL_VERBOSE(("Failed to close SRQ %d", qp)); - rc = OPAL_ERROR; + /* Release SRQ resources */ + for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { + if(!BTL_OPENIB_QP_TYPE_PP(qp)) { + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( + &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( + &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); + if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { + opal_mutex_t *lock = + &mca_btl_openib_component.srq_manager.lock; + + opal_hash_table_t *srq_addr_table = + &mca_btl_openib_component.srq_manager.srq_addr_table; + + opal_mutex_lock(lock); + if (OPAL_SUCCESS != + opal_hash_table_remove_value_ptr(srq_addr_table, + &openib_btl->qps[qp].u.srq_qp.srq, + sizeof(struct ibv_srq *))) { + BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); + rc = OPAL_ERROR; + } + opal_mutex_unlock(lock); + if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { + BTL_VERBOSE(("Failed to close SRQ %d", qp)); + rc = OPAL_ERROR; + } } - } - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); + } } - } - /* Finalize the CPC modules on this openib module */ - for (i = 0; i < openib_btl->num_cpcs; ++i) { - if (NULL != openib_btl->cpcs[i]->cbm_finalize) { - openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); + /* Finalize the CPC modules on this openib module */ + for (i = 0; i < openib_btl->num_cpcs; ++i) { + if (NULL != openib_btl->cpcs[i]->cbm_finalize) { + openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); + } + free(openib_btl->cpcs[i]); } - free(openib_btl->cpcs[i]); + free(openib_btl->cpcs); } - free(openib_btl->cpcs); /* Release device if there are no more users */ if(!(--openib_btl->device->btls)) { diff --git a/opal/mca/btl/openib/btl_openib.h b/opal/mca/btl/openib/btl_openib.h index 6b4dd0466bf..a5817a8daee 100644 --- a/opal/mca/btl/openib/btl_openib.h +++ b/opal/mca/btl/openib/btl_openib.h @@ -18,8 +18,8 @@ * Copyright (c) 2009-2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013-2014 NVIDIA Corporation. All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -164,6 +164,9 @@ struct mca_btl_openib_component_t { int ib_num_btls; /**< number of devices available to the openib component */ + int ib_allowed_btls; + /**< number of devices allowed to the openib component */ + struct mca_btl_openib_module_t **openib_btls; /**< array of available BTLs */ @@ -501,6 +504,8 @@ struct mca_btl_openib_module_t { int local_procs; /** number of local procs */ bool atomic_ops_be; /** atomic result is big endian */ + + bool allowed; /** is this port allowed */ }; typedef struct mca_btl_openib_module_t mca_btl_openib_module_t; diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index 5c7cce7b57b..4a714b4d1b3 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -19,8 +19,8 @@ * Copyright (c) 2011-2015 NVIDIA Corporation. All rights reserved. * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved. * $COPYRIGHT$ * @@ -269,7 +269,7 @@ static int btl_openib_modex_send(void) /* uint8_t for number of modules in the message */ 1 + /* For each module: */ - mca_btl_openib_component.ib_num_btls * + mca_btl_openib_component.ib_allowed_btls * ( /* Common module data */ modex_message_size + @@ -278,6 +278,9 @@ static int btl_openib_modex_send(void) ); /* For each module, add in the size of the per-CPC data */ for (i = 0; i < mca_btl_openib_component.ib_num_btls; i++) { + if (! mca_btl_openib_component.openib_btls[i]->allowed) { + continue; + } for (j = 0; j < mca_btl_openib_component.openib_btls[i]->num_cpcs; ++j) { @@ -300,12 +303,15 @@ static int btl_openib_modex_send(void) /* Pack the number of modules */ offset = message; - pack8(&offset, mca_btl_openib_component.ib_num_btls); - opal_output(-1, "modex sending %d btls (packed: %d, offset now at %d)", mca_btl_openib_component.ib_num_btls, *((uint8_t*) message), (int) (offset - message)); + pack8(&offset, mca_btl_openib_component.ib_allowed_btls); + opal_output(-1, "modex sending %d btls (packed: %d, offset now at %d)", mca_btl_openib_component.ib_allowed_btls, *((uint8_t*) message), (int) (offset - message)); /* Pack each of the modules */ for (i = 0; i < mca_btl_openib_component.ib_num_btls; i++) { + if (! mca_btl_openib_component.openib_btls[i]->allowed) { + continue; + } /* Pack the modex common message struct. */ size = modex_message_size; @@ -628,22 +634,35 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, * policy. For ancient OFED, only allow if user has set * the MCA parameter. */ + if (! mca_btl_openib_component.allow_ib #if HAVE_DECL_IBV_LINK_LAYER_ETHERNET - if ((IBV_LINK_LAYER_INFINIBAND == ib_port_attr->link_layer) && - (false == mca_btl_openib_component.allow_ib)) { - opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", - true, opal_process_info.nodename, - ibv_get_device_name(device->ib_dev), port_num); - return OPAL_ERR_NOT_FOUND; - } -#else - if (false == mca_btl_openib_component.allow_ib) { - opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", - true, opal_process_info.nodename, - ibv_get_device_name(device->ib_dev), port_num); - return OPAL_ERR_NOT_FOUND; - } + && IBV_LINK_LAYER_INFINIBAND == ib_port_attr->link_layer #endif + ) { + openib_btl = (mca_btl_openib_module_t *) calloc(1, sizeof(mca_btl_openib_module_t)); + if(NULL == openib_btl) { + BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__)); + return OPAL_ERR_OUT_OF_RESOURCE; + } + memcpy(openib_btl, &mca_btl_openib_module, + sizeof(mca_btl_openib_module)); + ib_selected = OBJ_NEW(mca_btl_base_selected_module_t); + ib_selected->btl_module = (mca_btl_base_module_t*) openib_btl; + openib_btl->device = device; + openib_btl->port_num = (uint8_t) port_num; + openib_btl->allowed = false; + OBJ_CONSTRUCT(&openib_btl->ib_lock, opal_mutex_t); + opal_list_append(btl_list, (opal_list_item_t*) ib_selected); + opal_pointer_array_add(device->device_btls, (void*) openib_btl); + ++device->btls; + ++mca_btl_openib_component.ib_num_btls; + if (-1 != mca_btl_openib_component.ib_max_btls && + mca_btl_openib_component.ib_num_btls >= + mca_btl_openib_component.ib_max_btls) { + return OPAL_ERR_VALUE_OUT_OF_BOUNDS; + } + return OPAL_SUCCESS; + } /* Ensure that the requested GID index (via the @@ -880,10 +899,13 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, } } + openib_btl->allowed = true; + opal_list_append(btl_list, (opal_list_item_t*) ib_selected); opal_pointer_array_add(device->device_btls, (void*) openib_btl); ++device->btls; ++mca_btl_openib_component.ib_num_btls; + ++mca_btl_openib_component.ib_allowed_btls; if (-1 != mca_btl_openib_component.ib_max_btls && mca_btl_openib_component.ib_num_btls >= mca_btl_openib_component.ib_max_btls) { @@ -2912,36 +2934,38 @@ btl_openib_component_init(int *num_btl_modules, goto no_btls; } - /* Now that we know we have devices and ports that we want to use, - init CPC components */ - if (OPAL_SUCCESS != (ret = opal_btl_openib_connect_base_init())) { - goto no_btls; - } + if (0 < mca_btl_openib_component.ib_allowed_btls) { + /* Now that we know we have devices and ports that we want to use, + init CPC components */ + if (OPAL_SUCCESS != (ret = opal_btl_openib_connect_base_init())) { + goto no_btls; + } - /* Setup the BSRQ QP's based on the final value of - mca_btl_openib_component.receive_queues. */ - if (OPAL_SUCCESS != setup_qps()) { - goto no_btls; - } - if (mca_btl_openib_component.num_srq_qps > 0 || - mca_btl_openib_component.num_xrc_qps > 0) { - opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table; - if(OPAL_SUCCESS != opal_hash_table_init( - srq_addr_table, (mca_btl_openib_component.num_srq_qps + - mca_btl_openib_component.num_xrc_qps) * - mca_btl_openib_component.ib_num_btls)) { - BTL_ERROR(("SRQ internal error. Failed to allocate SRQ addr hash table")); + /* Setup the BSRQ QP's based on the final value of + mca_btl_openib_component.receive_queues. */ + if (OPAL_SUCCESS != setup_qps()) { goto no_btls; } - } + if (mca_btl_openib_component.num_srq_qps > 0 || + mca_btl_openib_component.num_xrc_qps > 0) { + opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table; + if(OPAL_SUCCESS != opal_hash_table_init( + srq_addr_table, (mca_btl_openib_component.num_srq_qps + + mca_btl_openib_component.num_xrc_qps) * + mca_btl_openib_component.ib_num_btls)) { + BTL_ERROR(("SRQ internal error. Failed to allocate SRQ addr hash table")); + goto no_btls; + } + } - /* For XRC: - * from this point we know if MCA_BTL_XRC_ENABLED it true or false */ + /* For XRC: + * from this point we know if MCA_BTL_XRC_ENABLED it true or false */ - /* Init XRC IB Addr hash table */ - if (MCA_BTL_XRC_ENABLED) { - OBJ_CONSTRUCT(&mca_btl_openib_component.ib_addr_table, - opal_hash_table_t); + /* Init XRC IB Addr hash table */ + if (MCA_BTL_XRC_ENABLED) { + OBJ_CONSTRUCT(&mca_btl_openib_component.ib_addr_table, + opal_hash_table_t); + } } /* Allocate space for btl modules */ @@ -2967,31 +2991,34 @@ btl_openib_component_init(int *num_btl_modules, ib_selected = (mca_btl_base_selected_module_t*)item; openib_btl = (mca_btl_openib_module_t*)ib_selected->btl_module; - /* Search for a CPC that can handle this port */ - ret = opal_btl_openib_connect_base_select_for_local_port(openib_btl); - /* If we get NOT_SUPPORTED, then no CPC was found for this - port. But that's not a fatal error -- just keep going; - let's see if we find any usable openib modules or not. */ - if (OPAL_ERR_NOT_SUPPORTED == ret) { - continue; - } else if (OPAL_SUCCESS != ret) { - /* All others *are* fatal. Note that we already did a - show_help in the lower layer */ - goto no_btls; - } + if (openib_btl->allowed) { + /* Search for a CPC that can handle this port */ + ret = opal_btl_openib_connect_base_select_for_local_port(openib_btl); + /* If we get NOT_SUPPORTED, then no CPC was found for this + port. But that's not a fatal error -- just keep going; + let's see if we find any usable openib modules or not. */ + if (OPAL_ERR_NOT_SUPPORTED == ret) { + continue; + } else if (OPAL_SUCCESS != ret) { + /* All others *are* fatal. Note that we already did a + show_help in the lower layer */ + goto no_btls; + } - if (mca_btl_openib_component.max_hw_msg_size > 0 && - (uint32_t)mca_btl_openib_component.max_hw_msg_size > openib_btl->ib_port_attr.max_msg_sz) { - BTL_ERROR(("max_hw_msg_size (%" PRIu32 ") is larger than hw max message size (%" PRIu32 ")", - mca_btl_openib_component.max_hw_msg_size, openib_btl->ib_port_attr.max_msg_sz)); + if (mca_btl_openib_component.max_hw_msg_size > 0 && + (uint32_t)mca_btl_openib_component.max_hw_msg_size > openib_btl->ib_port_attr.max_msg_sz) { + BTL_ERROR(("max_hw_msg_size (%" PRIu32 ") is larger than hw max message size (%" PRIu32 ")", + mca_btl_openib_component.max_hw_msg_size, openib_btl->ib_port_attr.max_msg_sz)); + } + + if (finish_btl_init(openib_btl) != OPAL_SUCCESS) { + goto no_btls; + } } mca_btl_openib_component.openib_btls[i] = openib_btl; OBJ_RELEASE(ib_selected); btls[i] = &openib_btl->super; - if (finish_btl_init(openib_btl) != OPAL_SUCCESS) { - goto no_btls; - } ++i; } /* If we got nothing, then error out */ @@ -3039,6 +3066,7 @@ btl_openib_component_init(int *num_btl_modules, there are no openib BTL's in this process and return NULL. */ mca_btl_openib_component.ib_num_btls = 0; + mca_btl_openib_component.ib_allowed_btls = 0; btl_openib_modex_send(); if (NULL != btls) { free(btls); diff --git a/opal/mca/btl/openib/btl_openib_proc.c b/opal/mca/btl/openib/btl_openib_proc.c index a4b77fa6436..9e891fb55cb 100644 --- a/opal/mca/btl/openib/btl_openib_proc.c +++ b/opal/mca/btl/openib/btl_openib_proc.c @@ -13,8 +13,8 @@ * Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2007 Voltaire All rights reserved. * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2015-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights * reserved. @@ -277,6 +277,7 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_get_locked(opal_proc_t* proc) if (0 == ib_proc->proc_port_count) { ib_proc->proc_endpoints = NULL; + goto no_err_exit; } else { ib_proc->proc_endpoints = (volatile mca_btl_base_endpoint_t**) malloc(ib_proc->proc_port_count * From c58c7749815488af1128bbd29e930be9f51ebbfa Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 11 Dec 2018 09:07:22 +0900 Subject: [PATCH 289/674] btl/openib: have add_proc() return immediately when the port is disabled. Fixes an issue introduced in open-mpi/ompi@0a2ce580405ae86788e5f0e7d5264fce162e73c8 This is a one-off commit for the v4.0.x branch since btl/openib has been removed from master. Refs. open-mpi/ompi#6137 Signed-off-by: Gilles Gouaillardet --- opal/mca/btl/openib/btl_openib.c | 1 + opal/mca/btl/openib/btl_openib_proc.c | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index a3bc12190e7..3bd5fe965da 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -1046,6 +1046,7 @@ int mca_btl_openib_add_procs( opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", true, opal_process_info.nodename, ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); + return OPAL_SUCCESS; } btl_rank = get_openib_btl_params(openib_btl, &lcl_subnet_id_port_cnt); diff --git a/opal/mca/btl/openib/btl_openib_proc.c b/opal/mca/btl/openib/btl_openib_proc.c index 9e891fb55cb..8f41b9696ad 100644 --- a/opal/mca/btl/openib/btl_openib_proc.c +++ b/opal/mca/btl/openib/btl_openib_proc.c @@ -277,7 +277,6 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_get_locked(opal_proc_t* proc) if (0 == ib_proc->proc_port_count) { ib_proc->proc_endpoints = NULL; - goto no_err_exit; } else { ib_proc->proc_endpoints = (volatile mca_btl_base_endpoint_t**) malloc(ib_proc->proc_port_count * From 8da460558997c42f5c32ee14bd24c4a33e52c40e Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Dec 2018 14:53:11 +0900 Subject: [PATCH 290/674] btl/openib: immediately release the device when no port is allowed Many thanks to Sergey Oblomov for reporting this issue and the countless traces provided when troubleshooting it. This is a one-off commit for the v4.0.x branch since btl/openib has been removed from master. Refs. open-mpi/ompi#6137 Signed-off-by: Gilles Gouaillardet --- opal/mca/btl/openib/btl_openib.c | 10 +++++----- opal/mca/btl/openib/btl_openib.h | 2 ++ opal/mca/btl/openib/btl_openib_component.c | 14 +++++++++++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index 3bd5fe965da..c2686a0676a 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -1045,7 +1045,7 @@ int mca_btl_openib_add_procs( opal_bitmap_clear_all_bits(reachable); opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", true, opal_process_info.nodename, - ibv_get_device_name(openib_btl->device->ib_dev), openib_btl->port_num); + openib_btl->device_name, openib_btl->port_num); return OPAL_SUCCESS; } @@ -1718,11 +1718,11 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl) free(openib_btl->cpcs[i]); } free(openib_btl->cpcs); - } - /* Release device if there are no more users */ - if(!(--openib_btl->device->btls)) { - OBJ_RELEASE(openib_btl->device); + /* Release device if there are no more users */ + if(!(--openib_btl->device->allowed_btls)) { + OBJ_RELEASE(openib_btl->device); + } } if (NULL != openib_btl->qps) { diff --git a/opal/mca/btl/openib/btl_openib.h b/opal/mca/btl/openib/btl_openib.h index a5817a8daee..0b85bfb5662 100644 --- a/opal/mca/btl/openib/btl_openib.h +++ b/opal/mca/btl/openib/btl_openib.h @@ -392,6 +392,7 @@ typedef struct mca_btl_openib_device_t { /* Whether this device supports eager RDMA */ uint8_t use_eager_rdma; uint8_t btls; /** < number of btls using this device */ + uint8_t allowed_btls; /** < number of allowed btls using this device */ opal_pointer_array_t *endpoints; opal_pointer_array_t *device_btls; uint16_t hp_cq_polls; @@ -483,6 +484,7 @@ struct mca_btl_openib_module_t { uint8_t num_cpcs; mca_btl_openib_device_t *device; + char * device_name; uint8_t port_num; /**< ID of the PORT */ uint16_t pkey_index; struct ibv_port_attr ib_port_attr; diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index 4a714b4d1b3..fcc0ac56973 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -648,9 +648,10 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, sizeof(mca_btl_openib_module)); ib_selected = OBJ_NEW(mca_btl_base_selected_module_t); ib_selected->btl_module = (mca_btl_base_module_t*) openib_btl; - openib_btl->device = device; openib_btl->port_num = (uint8_t) port_num; openib_btl->allowed = false; + openib_btl->device = NULL; + openib_btl->device_name = strdup(ibv_get_device_name(device->ib_dev)); OBJ_CONSTRUCT(&openib_btl->ib_lock, opal_mutex_t); opal_list_append(btl_list, (opal_list_item_t*) ib_selected); opal_pointer_array_add(device->device_btls, (void*) openib_btl); @@ -784,6 +785,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, ib_selected = OBJ_NEW(mca_btl_base_selected_module_t); ib_selected->btl_module = (mca_btl_base_module_t*) openib_btl; openib_btl->device = device; + openib_btl->device_name = NULL; openib_btl->port_num = (uint8_t) port_num; openib_btl->pkey_index = pkey_index; openib_btl->lid = lid; @@ -904,6 +906,7 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, opal_list_append(btl_list, (opal_list_item_t*) ib_selected); opal_pointer_array_add(device->device_btls, (void*) openib_btl); ++device->btls; + ++device->allowed_btls; ++mca_btl_openib_component.ib_num_btls; ++mca_btl_openib_component.ib_allowed_btls; if (-1 != mca_btl_openib_component.ib_max_btls && @@ -1933,7 +1936,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev) if (ib_port_attr.active_mtu < device->mtu){ device->mtu = ib_port_attr.active_mtu; } - if (mca_btl_openib_component.apm_ports && device->btls > 0) { + if (mca_btl_openib_component.apm_ports && device->allowed_btls > 0) { init_apm_port(device, i, ib_port_attr.lid); break; } @@ -1969,7 +1972,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev) /* If we made a BTL, check APM status and return. Otherwise, fall through and destroy everything */ - if (device->btls > 0) { + if (device->allowed_btls > 0) { /* if apm was enabled it should be > 1 */ if (1 == mca_btl_openib_component.apm_ports) { opal_show_help("help-mpi-btl-openib.txt", @@ -2290,6 +2293,11 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev) good: mca_btl_openib_component.devices_count++; return OPAL_SUCCESS; + } else if (device->btls > 0) { + /* no port is allowed to be used by btl/openib, + * so release the device right away */ + OBJ_RELEASE(device); + return OPAL_SUCCESS; } error: From ce013130cbf8b246c9beaf46d58d8998f0af8bd4 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 19 Mar 2019 04:13:32 -0600 Subject: [PATCH 291/674] NEWS: add a few news items for 4.0.1rc2 a little late, but a couple of bullets for the 4.0.1rc2 NEWS. [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 6b18743bccf..c32cf266cd2 100644 --- a/NEWS +++ b/NEWS @@ -61,6 +61,10 @@ included in the vX.Y.Z section and be denoted as: -------------------- - Update embedded PMIx to 3.1.2. +- Fix an issue with Vader (shared-memory) transport on OS-X. Thanks + to Daniel Vollmer for reporting. +- Fix a problem with the usNIC BTL Makefile. Thanks to George Marselis + for reporting. - Fix an issue when using --enable-visibility configure option and older versions of hwloc. Thanks to Ben Menadue for reporting and providing a fix. From 1329cef21336e16c7b7ba7e02879662ef4b97501 Mon Sep 17 00:00:00 2001 From: "Nysal Jan K.A" Date: Tue, 19 Mar 2019 16:27:03 +0530 Subject: [PATCH 292/674] opal/atomics: Add acquire semantics back for spinlocks This was introduced in commit 9d0b3fe9 Signed-off-by: Nysal Jan K.A (cherry picked from commit 00f27a80fc63053db1aeb42140148d7a3d1379b3) --- opal/include/opal/sys/atomic_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/include/opal/sys/atomic_impl.h b/opal/include/opal/sys/atomic_impl.h index 027b771162a..919482f902d 100644 --- a/opal/include/opal/sys/atomic_impl.h +++ b/opal/include/opal/sys/atomic_impl.h @@ -495,7 +495,7 @@ static inline int opal_atomic_trylock(opal_atomic_lock_t *lock) { int32_t unlocked = OPAL_ATOMIC_LOCK_UNLOCKED; - bool ret = opal_atomic_compare_exchange_strong_32 (&lock->u.lock, &unlocked, OPAL_ATOMIC_LOCK_LOCKED); + bool ret = opal_atomic_compare_exchange_strong_acq_32 (&lock->u.lock, &unlocked, OPAL_ATOMIC_LOCK_LOCKED); return (ret == false) ? 1 : 0; } From 45526fadee4117f3ff69e668c01be21a0361267a Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Tue, 19 Mar 2019 10:51:42 -0500 Subject: [PATCH 293/674] Do not force 'hash' gds on direct modex * Forcing the 'hash' gds component should not be necessary any more. Port of PR #6498 (component names changed so a cherry-pick would not work) Signed-off-by: Joshua Hursey --- opal/mca/pmix/pmix3x/pmix3x_client.c | 6 +----- opal/mca/pmix/pmix3x/pmix3x_server_south.c | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix3x_client.c b/opal/mca/pmix/pmix3x/pmix3x_client.c index f24e2c3c198..caf1a409f4a 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_client.c +++ b/opal/mca/pmix/pmix3x/pmix3x_client.c @@ -11,6 +11,7 @@ * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -101,11 +102,6 @@ int pmix3x_client_init(opal_list_t *ilist) ninfo = 0; } - /* check for direct modex use-case */ - if (opal_pmix_base_async_modex && !opal_pmix_collect_all_data) { - opal_setenv("PMIX_MCA_gds", "hash", true, &environ); - } - OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); rc = PMIx_Init(&mca_pmix_pmix3x_component.myproc, pinfo, ninfo); if (NULL != pinfo) { diff --git a/opal/mca/pmix/pmix3x/pmix3x_server_south.c b/opal/mca/pmix/pmix3x/pmix3x_server_south.c index ac36b69877f..c50f6d8d0ec 100644 --- a/opal/mca/pmix/pmix3x/pmix3x_server_south.c +++ b/opal/mca/pmix/pmix3x/pmix3x_server_south.c @@ -12,6 +12,7 @@ * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -132,11 +133,6 @@ int pmix3x_server_init(opal_pmix_server_module_t *module, } } - /* check for direct modex use-case */ - if (opal_pmix_base_async_modex && !opal_pmix_collect_all_data) { - opal_setenv("PMIX_MCA_gds", "hash", true, &environ); - } - /* insert ourselves into our list of jobids - it will be the * first, and so we'll check it first */ job = OBJ_NEW(opal_pmix3x_jobid_trkr_t); From f666d75322a452bbb346738255f74bf6aed4f75f Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Tue, 5 Mar 2019 06:08:11 +0200 Subject: [PATCH 294/674] ompi/oshmem/spml/ucx: fix eps destroy in shmem_ctx_destroy(). Signed-off-by: Tomislav Janjusic (cherry picked from commit 79ba7526677bd1641239bb77559a2999c8cd3a4a) --- oshmem/mca/spml/ucx/spml_ucx.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index d20bfd95838..e7374c351e2 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -607,6 +607,8 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) MCA_SPML_CALL(quiet(ctx)); + oshmem_shmem_barrier(); + SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); /* delete context object from list */ @@ -614,10 +616,22 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) mca_spml_ucx_ctx_list_item_t) { if ((shmem_ctx_t)(&ctx_item->ctx) == ctx) { opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); - for (i = 0; i < nprocs; i++) { - ucp_ep_destroy(ctx_item->ctx.ucp_peers[i].ucp_conn); + + opal_common_ucx_del_proc_t *del_procs; + del_procs = malloc(sizeof(*del_procs) * nprocs); + + for (i = 0; i < nprocs; ++i) { + del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; + del_procs[i].vpid = i; + ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; } + + opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), + mca_spml_ucx.num_disconnect, + ctx_item->ctx.ucp_worker); + free(del_procs); free(ctx_item->ctx.ucp_peers); + ucp_worker_destroy(ctx_item->ctx.ucp_worker); OBJ_RELEASE(ctx_item); break; From 91793484ed3be2c6f61bdb69aa5ed23437fbd3b5 Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Thu, 3 Jan 2019 18:20:30 -0800 Subject: [PATCH 295/674] OMPI/OSHMEM: bug-fix: store mkeys for each oshmem ctx. Signed-off-by: Xin Zhao Signed-off-by: Tomislav Janjusic (cherry picked from commit 289595e45dc3ebfe5ae1a9dc6f347b1b2d569c4a) --- oshmem/mca/atomic/ucx/atomic_ucx_cswap.c | 2 +- oshmem/mca/atomic/ucx/atomic_ucx_module.c | 4 +- oshmem/mca/memheap/base/base.h | 8 +- oshmem/mca/memheap/base/memheap_base_mkey.c | 21 ++-- oshmem/mca/spml/base/base.h | 5 +- oshmem/mca/spml/base/spml_base.c | 4 +- oshmem/mca/spml/spml.h | 4 +- oshmem/mca/spml/ucx/spml_ucx.c | 124 +++++++++++++------- oshmem/mca/spml/ucx/spml_ucx.h | 16 ++- oshmem/mca/spml/ucx/spml_ucx_component.c | 7 ++ oshmem/mca/sshmem/sshmem_types.h | 1 - oshmem/shmem/c/shmem_addr_accessible.c | 3 +- oshmem/shmem/c/shmem_ptr.c | 3 +- 13 files changed, 133 insertions(+), 69 deletions(-) diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c index 25fe9926882..51b07629471 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c @@ -40,7 +40,7 @@ int mca_atomic_ucx_cswap(shmem_ctx_t ctx, assert(NULL != prev); *prev = value; - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, pe, target, (void *)&rva, mca_spml_self); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, pe, target, (void *)&rva, mca_spml_self); status_ptr = ucp_atomic_fetch_nb(ucx_ctx->ucp_peers[pe].ucp_conn, UCP_ATOMIC_FETCH_OP_CSWAP, cond, prev, size, rva, ucx_mkey->rkey, diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_module.c b/oshmem/mca/atomic/ucx/atomic_ucx_module.c index 4d269065cb4..91d4551e457 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_module.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_module.c @@ -47,7 +47,7 @@ int mca_atomic_ucx_op(shmem_ctx_t ctx, assert((8 == size) || (4 == size)); - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, pe, target, (void *)&rva, mca_spml_self); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, pe, target, (void *)&rva, mca_spml_self); status = ucp_atomic_post(ucx_ctx->ucp_peers[pe].ucp_conn, op, value, size, rva, ucx_mkey->rkey); @@ -70,7 +70,7 @@ int mca_atomic_ucx_fop(shmem_ctx_t ctx, assert((8 == size) || (4 == size)); - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, pe, target, (void *)&rva, mca_spml_self); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, pe, target, (void *)&rva, mca_spml_self); status_ptr = ucp_atomic_fetch_nb(ucx_ctx->ucp_peers[pe].ucp_conn, op, value, prev, size, rva, ucx_mkey->rkey, diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index 6b4a79fb9ed..7178685f0a7 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -69,7 +69,8 @@ void memheap_oob_destruct(void); OSHMEM_DECLSPEC int mca_memheap_base_is_symmetric_addr(const void* va); OSHMEM_DECLSPEC sshmem_mkey_t *mca_memheap_base_get_mkey(void* va, int tr_id); -OSHMEM_DECLSPEC sshmem_mkey_t * mca_memheap_base_get_cached_mkey_slow(map_segment_t *s, +OSHMEM_DECLSPEC sshmem_mkey_t * mca_memheap_base_get_cached_mkey_slow(shmem_ctx_t ctx, + map_segment_t *s, int pe, void* va, int btl_id, @@ -243,7 +244,8 @@ static inline map_segment_t *memheap_find_va(void* va) return s; } -static inline sshmem_mkey_t *mca_memheap_base_get_cached_mkey(int pe, +static inline sshmem_mkey_t *mca_memheap_base_get_cached_mkey(shmem_ctx_t ctx, + int pe, void* va, int btl_id, void** rva) @@ -273,7 +275,7 @@ static inline sshmem_mkey_t *mca_memheap_base_get_cached_mkey(int pe, return mkey; } - return mca_memheap_base_get_cached_mkey_slow(s, pe, va, btl_id, rva); + return mca_memheap_base_get_cached_mkey_slow(ctx, s, pe, va, btl_id, rva); } static inline int mca_memheap_base_num_transports(void) diff --git a/oshmem/mca/memheap/base/memheap_base_mkey.c b/oshmem/mca/memheap/base/memheap_base_mkey.c index a2e21f1a5be..2d8b79d5f62 100644 --- a/oshmem/mca/memheap/base/memheap_base_mkey.c +++ b/oshmem/mca/memheap/base/memheap_base_mkey.c @@ -55,6 +55,7 @@ struct oob_comm { oob_comm_request_t req_pool[MEMHEAP_RECV_REQS_MAX]; opal_list_t req_list; int is_inited; + shmem_ctx_t ctx; }; mca_memheap_map_t* memheap_map = NULL; @@ -66,7 +67,7 @@ static int send_buffer(int pe, opal_buffer_t *msg); static int oshmem_mkey_recv_cb(void); /* pickup list of rkeys and remote va */ -static int memheap_oob_get_mkeys(int pe, +static int memheap_oob_get_mkeys(shmem_ctx_t ctx, int pe, uint32_t va_seg_num, sshmem_mkey_t *mkey); @@ -142,7 +143,7 @@ static void memheap_attach_segment(sshmem_mkey_t *mkey, int tr_id) } -static void unpack_remote_mkeys(opal_buffer_t *msg, int remote_pe) +static void unpack_remote_mkeys(shmem_ctx_t ctx, opal_buffer_t *msg, int remote_pe) { int32_t cnt; int32_t n; @@ -182,7 +183,7 @@ static void unpack_remote_mkeys(opal_buffer_t *msg, int remote_pe) } else { memheap_oob.mkeys[tr_id].u.key = MAP_SEGMENT_SHM_INVALID; } - MCA_SPML_CALL(rmkey_unpack(&memheap_oob.mkeys[tr_id], memheap_oob.segno, remote_pe, tr_id)); + MCA_SPML_CALL(rmkey_unpack(ctx, &memheap_oob.mkeys[tr_id], memheap_oob.segno, remote_pe, tr_id)); } MEMHEAP_VERBOSE(5, @@ -242,7 +243,7 @@ static void do_recv(int source_pe, opal_buffer_t* buffer) case MEMHEAP_RKEY_RESP: MEMHEAP_VERBOSE(5, "*** RKEY RESP"); OPAL_THREAD_LOCK(&memheap_oob.lck); - unpack_remote_mkeys(buffer, source_pe); + unpack_remote_mkeys(memheap_oob.ctx, buffer, source_pe); memheap_oob.mkeys_rcvd = MEMHEAP_RKEY_RESP; opal_condition_broadcast(&memheap_oob.cond); OPAL_THREAD_UNLOCK(&memheap_oob.lck); @@ -455,14 +456,14 @@ static int send_buffer(int pe, opal_buffer_t *msg) return rc; } -static int memheap_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys) +static int memheap_oob_get_mkeys(shmem_ctx_t ctx, int pe, uint32_t seg, sshmem_mkey_t *mkeys) { opal_buffer_t *msg; uint8_t cmd; int i; int rc; - if (OSHMEM_SUCCESS == MCA_SPML_CALL(oob_get_mkeys(pe, seg, mkeys))) { + if (OSHMEM_SUCCESS == MCA_SPML_CALL(oob_get_mkeys(ctx, pe, seg, mkeys))) { for (i = 0; i < memheap_map->num_transports; i++) { MEMHEAP_VERBOSE(5, "MKEY CALCULATED BY LOCAL SPML: pe: %d tr_id: %d %s", @@ -478,6 +479,7 @@ static int memheap_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys) memheap_oob.mkeys = mkeys; memheap_oob.segno = seg; memheap_oob.mkeys_rcvd = 0; + memheap_oob.ctx = ctx; msg = OBJ_NEW(opal_buffer_t); if (!msg) { @@ -645,7 +647,7 @@ void mca_memheap_modex_recv_all(void) } memheap_oob.mkeys = s->mkeys_cache[i]; memheap_oob.segno = j; - unpack_remote_mkeys(msg, i); + unpack_remote_mkeys(oshmem_ctx_default, msg, i); } } @@ -674,7 +676,8 @@ void mca_memheap_modex_recv_all(void) } } -sshmem_mkey_t * mca_memheap_base_get_cached_mkey_slow(map_segment_t *s, +sshmem_mkey_t * mca_memheap_base_get_cached_mkey_slow(shmem_ctx_t ctx, + map_segment_t *s, int pe, void* va, int btl_id, @@ -692,7 +695,7 @@ sshmem_mkey_t * mca_memheap_base_get_cached_mkey_slow(map_segment_t *s, if (!s->mkeys_cache[pe]) return NULL ; - rc = memheap_oob_get_mkeys(pe, + rc = memheap_oob_get_mkeys(ctx, pe, s - memheap_map->mem_segs, s->mkeys_cache[pe]); if (OSHMEM_SUCCESS != rc) diff --git a/oshmem/mca/spml/base/base.h b/oshmem/mca/spml/base/base.h index 4aeff7d760a..e3ec1b68552 100644 --- a/oshmem/mca/spml/base/base.h +++ b/oshmem/mca/spml/base/base.h @@ -72,11 +72,12 @@ OSHMEM_DECLSPEC int mca_spml_base_test(void* addr, void* value, int datatype, int *out_value); -OSHMEM_DECLSPEC int mca_spml_base_oob_get_mkeys(int pe, +OSHMEM_DECLSPEC int mca_spml_base_oob_get_mkeys(shmem_ctx_t ctx, + int pe, uint32_t seg, sshmem_mkey_t *mkeys); -OSHMEM_DECLSPEC void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, uint32_t seg, int pe, int tr_id); +OSHMEM_DECLSPEC void mca_spml_base_rmkey_unpack(shmem_ctx_t ctx, sshmem_mkey_t *mkey, uint32_t seg, int pe, int tr_id); OSHMEM_DECLSPEC void mca_spml_base_rmkey_free(sshmem_mkey_t *mkey); OSHMEM_DECLSPEC void *mca_spml_base_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe); diff --git a/oshmem/mca/spml/base/spml_base.c b/oshmem/mca/spml/base/spml_base.c index 86d544e88e2..8ef3894e98d 100644 --- a/oshmem/mca/spml/base/spml_base.c +++ b/oshmem/mca/spml/base/spml_base.c @@ -247,12 +247,12 @@ int mca_spml_base_wait_nb(void* handle) return OSHMEM_SUCCESS; } -int mca_spml_base_oob_get_mkeys(int pe, uint32_t segno, sshmem_mkey_t *mkeys) +int mca_spml_base_oob_get_mkeys(shmem_ctx_t ctx, int pe, uint32_t segno, sshmem_mkey_t *mkeys) { return OSHMEM_ERROR; } -void mca_spml_base_rmkey_unpack(sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id) +void mca_spml_base_rmkey_unpack(shmem_ctx_t ctx, sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id) { } diff --git a/oshmem/mca/spml/spml.h b/oshmem/mca/spml/spml.h index c78ed6cbddb..fa992db91ca 100644 --- a/oshmem/mca/spml/spml.h +++ b/oshmem/mca/spml/spml.h @@ -132,7 +132,7 @@ typedef int (*mca_spml_base_module_test_fn_t)(void* addr, * * @param mkey remote mkey */ -typedef void (*mca_spml_base_module_mkey_unpack_fn_t)(sshmem_mkey_t *, uint32_t segno, int remote_pe, int tr_id); +typedef void (*mca_spml_base_module_mkey_unpack_fn_t)(shmem_ctx_t ctx, sshmem_mkey_t *, uint32_t segno, int remote_pe, int tr_id); /** * If possible, get a pointer to the remote memory described by the mkey @@ -180,7 +180,7 @@ typedef int (*mca_spml_base_module_deregister_fn_t)(sshmem_mkey_t *mkeys); * * @return OSHMEM_SUCCSESS if keys are found */ -typedef int (*mca_spml_base_module_oob_get_mkeys_fn_t)(int pe, +typedef int (*mca_spml_base_module_oob_get_mkeys_fn_t)(shmem_ctx_t ctx, int pe, uint32_t seg, sshmem_mkey_t *mkeys); diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index e7374c351e2..93b5bfcf8a6 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -45,7 +45,7 @@ #endif static -spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva); +spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva); mca_spml_ucx_t mca_spml_ucx = { .super = { @@ -106,7 +106,7 @@ int mca_spml_ucx_enable(bool enable) int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) { opal_common_ucx_del_proc_t *del_procs; - size_t i; + size_t i, j; int ret; oshmem_shmem_barrier(); @@ -121,6 +121,12 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) } for (i = 0; i < nprocs; ++i) { + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + if (mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey != NULL) { + ucp_rkey_destroy(mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey); + } + } + del_procs[i].ep = mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn; del_procs[i].vpid = i; @@ -220,7 +226,7 @@ static char spml_ucx_transport_ids[1] = { 0 }; int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) { - size_t i, n; + size_t i, j, n; int rc = OSHMEM_ERROR; int my_rank = oshmem_my_proc_id(); ucs_status_t err; @@ -273,6 +279,10 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) OSHMEM_PROC_DATA(procs[i])->num_transports = 1; OSHMEM_PROC_DATA(procs[i])->transport_ids = spml_ucx_transport_ids; + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey = NULL; + } + mca_spml_ucx.remote_addrs_tbl[i] = (char *)malloc(wk_rsizes[i]); memcpy(mca_spml_ucx.remote_addrs_tbl[i], (char *)(wk_raddrs + wk_roffs[i]), wk_rsizes[i]); @@ -311,37 +321,47 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) static -spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(int pe, void *va, void **rva) +spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva) { sshmem_mkey_t *r_mkey; + spml_ucx_mkey_t *ucx_mkey; + uint32_t segno; + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + ucs_status_t err; - r_mkey = mca_memheap_base_get_cached_mkey(pe, va, 0, rva); + r_mkey = mca_memheap_base_get_cached_mkey(ctx, pe, va, 0, rva); if (OPAL_UNLIKELY(!r_mkey)) { SPML_UCX_ERROR("pe=%d: %p is not address of symmetric variable", pe, va); oshmem_shmem_abort(-1); return NULL; } - return (spml_ucx_mkey_t *)(r_mkey->spml_context); + + segno = memheap_find_segnum(va); + ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key; + + if (ucx_mkey->rkey == NULL) { + err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[pe].ucp_conn, + r_mkey->u.data, + &ucx_mkey->rkey); + mca_spml_ucx_cache_mkey(ucx_ctx, r_mkey, segno, pe); /* make sure it is properly cached */ + } + + return ucx_mkey; } void mca_spml_ucx_rmkey_free(sshmem_mkey_t *mkey) { - spml_ucx_mkey_t *ucx_mkey; - - if (!mkey->spml_context) { - return; - } - ucx_mkey = (spml_ucx_mkey_t *)(mkey->spml_context); - ucp_rkey_destroy(ucx_mkey->rkey); } -void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe) +void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *key, int pe) { #if (((UCP_API_MAJOR >= 1) && (UCP_API_MINOR >= 3)) || (UCP_API_MAJOR >= 2)) void *rva; ucs_status_t err; - spml_ucx_mkey_t *ucx_mkey = (spml_ucx_mkey_t *)(mkey->spml_context); + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)&mca_spml_ucx_ctx_default; + uint32_t segno = memheap_find_segnum((void*)dst_addr); + spml_ucx_mkey_t *ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key; err = ucp_rkey_ptr(ucx_mkey->rkey, (uint64_t)dst_addr, &rva); if (UCS_OK != err) { @@ -353,31 +373,23 @@ void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe) #endif } -static void mca_spml_ucx_cache_mkey(mca_spml_ucx_ctx_t *ucx_ctx, sshmem_mkey_t *mkey, uint32_t segno, int dst_pe) -{ - ucp_peer_t *peer; - - peer = &(ucx_ctx->ucp_peers[dst_pe]); - mkey_segment_init(&peer->mkeys[segno].super, mkey, segno); -} - -void mca_spml_ucx_rmkey_unpack(sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id) +void mca_spml_ucx_rmkey_unpack(shmem_ctx_t ctx, sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id) { spml_ucx_mkey_t *ucx_mkey; + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; ucs_status_t err; - ucx_mkey = &mca_spml_ucx_ctx_default.ucp_peers[pe].mkeys[segno].key; + ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key; - err = ucp_ep_rkey_unpack(mca_spml_ucx_ctx_default.ucp_peers[pe].ucp_conn, - mkey->u.data, + err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[pe].ucp_conn, + mkey->u.data, &ucx_mkey->rkey); if (UCS_OK != err) { SPML_UCX_ERROR("failed to unpack rkey: %s", ucs_status_string(err)); goto error_fatal; } - mkey->spml_context = ucx_mkey; - mca_spml_ucx_cache_mkey(&mca_spml_ucx_ctx_default, mkey, segno, pe); + mca_spml_ucx_cache_mkey(ucx_ctx, mkey, segno, pe); return; error_fatal: @@ -439,7 +451,6 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr, mem_seg = memheap_find_seg(segno); ucx_mkey = &mca_spml_ucx_ctx_default.ucp_peers[my_pe].mkeys[segno].key; - mkeys[0].spml_context = ucx_mkey; /* if possible use mem handle already created by ucx allocator */ if (MAP_SEGMENT_ALLOC_UCX != mem_seg->type) { @@ -502,16 +513,16 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) { spml_ucx_mkey_t *ucx_mkey; map_segment_t *mem_seg; + int segno; + int my_pe = oshmem_my_proc_id(); MCA_SPML_CALL(quiet(oshmem_ctx_default)); - if (!mkeys) - return OSHMEM_SUCCESS; - - if (!mkeys[0].spml_context) + if (!mkeys || !mkeys[0].va_base) return OSHMEM_SUCCESS; mem_seg = memheap_find_va(mkeys[0].va_base); - ucx_mkey = (spml_ucx_mkey_t*)mkeys[0].spml_context; + segno = memheap_find_segnum(mkeys[0].va_base); + ucx_mkey = &mca_spml_ucx_ctx_default.ucp_peers[my_pe].mkeys[segno].key; if (OPAL_UNLIKELY(NULL == mem_seg)) { return OSHMEM_ERROR; @@ -521,11 +532,14 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) ucp_mem_unmap(mca_spml_ucx.ucp_context, ucx_mkey->mem_h); } ucp_rkey_destroy(ucx_mkey->rkey); + ucx_mkey->rkey = NULL; if (0 < mkeys[0].len) { ucp_rkey_buffer_release(mkeys[0].u.data); } + free(mkeys); + return OSHMEM_SUCCESS; } @@ -534,8 +548,12 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) mca_spml_ucx_ctx_list_item_t *ctx_item; ucp_worker_params_t params; ucp_ep_params_t ep_params; - size_t i, nprocs = oshmem_num_procs(); + size_t i, j, nprocs = oshmem_num_procs(); ucs_status_t err; + int my_pe = oshmem_my_proc_id(); + size_t len; + spml_ucx_mkey_t *ucx_mkey; + sshmem_mkey_t *mkey; int rc = OSHMEM_ERROR; ctx_item = OBJ_NEW(mca_spml_ucx_ctx_list_item_t); @@ -570,6 +588,24 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) ucs_status_string(err)); goto error2; } + + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey = NULL; + } + } + + for (i = 0; i < MCA_MEMHEAP_SEG_COUNT; i++) { + mkey = &memheap_map->mem_segs[i].mkeys_cache[my_pe][0]; + ucx_mkey = &ctx_item->ctx.ucp_peers[my_pe].mkeys[i].key; + err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[my_pe].ucp_conn, + mkey->u.data, + &ucx_mkey->rkey); + if (UCS_OK != err) { + SPML_UCX_ERROR("failed to unpack rkey"); + goto error2; + } + + mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, i, my_pe); } SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); @@ -603,7 +639,7 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) { mca_spml_ucx_ctx_list_item_t *ctx_item, *next; - size_t i, nprocs = oshmem_num_procs(); + size_t i, j, nprocs = oshmem_num_procs(); MCA_SPML_CALL(quiet(ctx)); @@ -621,6 +657,12 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) del_procs = malloc(sizeof(*del_procs) * nprocs); for (i = 0; i < nprocs; ++i) { + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { + ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); + } + } + del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; del_procs[i].vpid = i; ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; @@ -652,7 +694,7 @@ int mca_spml_ucx_get(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_add ucs_status_t status; #endif - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, src, src_addr, &rva, &mca_spml_ucx); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, src, src_addr, &rva, &mca_spml_ucx); #if HAVE_DECL_UCP_GET_NB request = ucp_get_nb(ucx_ctx->ucp_peers[src].ucp_conn, dst_addr, size, (uint64_t)rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); @@ -671,7 +713,7 @@ int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_ spml_ucx_mkey_t *ucx_mkey; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, src, src_addr, &rva, &mca_spml_ucx); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, src, src_addr, &rva, &mca_spml_ucx); status = ucp_get_nbi(ucx_ctx->ucp_peers[src].ucp_conn, dst_addr, size, (uint64_t)rva, ucx_mkey->rkey); @@ -689,7 +731,7 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add ucs_status_t status; #endif - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, dst, dst_addr, &rva, &mca_spml_ucx); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, dst, dst_addr, &rva, &mca_spml_ucx); #if HAVE_DECL_UCP_PUT_NB request = ucp_put_nb(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); @@ -708,7 +750,7 @@ int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_ spml_ucx_mkey_t *ucx_mkey; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; - ucx_mkey = mca_spml_ucx_get_mkey(ucx_ctx, dst, dst_addr, &rva, &mca_spml_ucx); + ucx_mkey = mca_spml_ucx_get_mkey(ctx, dst, dst_addr, &rva, &mca_spml_ucx); status = ucp_put_nbi(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey); diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 1b2f0b58d81..68496d8c79d 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -81,7 +81,7 @@ struct mca_spml_ucx_ctx_list_item { }; typedef struct mca_spml_ucx_ctx_list_item mca_spml_ucx_ctx_list_item_t; -typedef spml_ucx_mkey_t * (*mca_spml_ucx_get_mkey_slow_fn_t)(int pe, void *va, void **rva); +typedef spml_ucx_mkey_t * (*mca_spml_ucx_get_mkey_slow_fn_t)(shmem_ctx_t ctx, int pe, void *va, void **rva); struct mca_spml_ucx { mca_spml_base_module_t super; @@ -143,7 +143,7 @@ extern int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys); extern void mca_spml_ucx_memuse_hook(void *addr, size_t length); -extern void mca_spml_ucx_rmkey_unpack(sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id); +extern void mca_spml_ucx_rmkey_unpack(shmem_ctx_t ctx, sshmem_mkey_t *mkey, uint32_t segno, int pe, int tr_id); extern void mca_spml_ucx_rmkey_free(sshmem_mkey_t *mkey); extern void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *, int pe); @@ -153,17 +153,25 @@ extern int mca_spml_ucx_fence(shmem_ctx_t ctx); extern int mca_spml_ucx_quiet(shmem_ctx_t ctx); extern int spml_ucx_progress(void); +static void mca_spml_ucx_cache_mkey(mca_spml_ucx_ctx_t *ucx_ctx, sshmem_mkey_t *mkey, uint32_t segno, int dst_pe) +{ + ucp_peer_t *peer; + + peer = &(ucx_ctx->ucp_peers[dst_pe]); + mkey_segment_init(&peer->mkeys[segno].super, mkey, segno); +} static inline spml_ucx_mkey_t * -mca_spml_ucx_get_mkey(mca_spml_ucx_ctx_t *ucx_ctx, int pe, void *va, void **rva, mca_spml_ucx_t* module) +mca_spml_ucx_get_mkey(shmem_ctx_t ctx, int pe, void *va, void **rva, mca_spml_ucx_t* module) { spml_ucx_cached_mkey_t *mkey; + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; mkey = ucx_ctx->ucp_peers[pe].mkeys; mkey = (spml_ucx_cached_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va); if (OPAL_UNLIKELY(NULL == mkey)) { assert(module->get_mkey_slow); - return module->get_mkey_slow(pe, va, rva); + return module->get_mkey_slow(ctx, pe, va, rva); } *rva = map_segment_va2rva(&mkey->super, va); return &mkey->key; diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 9f4d28b5d4c..3cbd406a35a 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -111,7 +111,14 @@ static int mca_spml_ucx_component_register(void) int spml_ucx_progress(void) { + mca_spml_ucx_ctx_list_item_t *ctx_item, *next; ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); + SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + mca_spml_ucx_ctx_list_item_t) { + ucp_worker_progress(ctx_item->ctx.ucp_worker); + } + SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); return 1; } diff --git a/oshmem/mca/sshmem/sshmem_types.h b/oshmem/mca/sshmem/sshmem_types.h index ccdf8995b5f..88520d3d20d 100644 --- a/oshmem/mca/sshmem/sshmem_types.h +++ b/oshmem/mca/sshmem/sshmem_types.h @@ -94,7 +94,6 @@ typedef struct sshmem_mkey { void *data; uint64_t key; } u; - void *spml_context; /* spml module can attach internal structures here */ } sshmem_mkey_t; typedef struct map_base_segment { diff --git a/oshmem/shmem/c/shmem_addr_accessible.c b/oshmem/shmem/c/shmem_addr_accessible.c index 8d44ff41818..724318a894f 100644 --- a/oshmem/shmem/c/shmem_addr_accessible.c +++ b/oshmem/shmem/c/shmem_addr_accessible.c @@ -31,7 +31,8 @@ int shmem_addr_accessible(const void *addr, int pe) RUNTIME_CHECK_INIT(); for (i = 0; i < mca_memheap_base_num_transports(); i++) { - mkey = mca_memheap_base_get_cached_mkey(pe, (void *)addr, i, &rva); + /* TODO: iterate on all ctxs, try to get cached mkey */ + mkey = mca_memheap_base_get_cached_mkey(oshmem_ctx_default, pe, (void *)addr, i, &rva); if (mkey) { return 1; } diff --git a/oshmem/shmem/c/shmem_ptr.c b/oshmem/shmem/c/shmem_ptr.c index 35a324c2212..afceb9f6222 100644 --- a/oshmem/shmem/c/shmem_ptr.c +++ b/oshmem/shmem/c/shmem_ptr.c @@ -52,7 +52,8 @@ void *shmem_ptr(const void *dst_addr, int pe) } for (i = 0; i < mca_memheap_base_num_transports(); i++) { - mkey = mca_memheap_base_get_cached_mkey(pe, (void *)dst_addr, i, &rva); + /* TODO: iterate on all ctxs, try to get cached mkeys */ + mkey = mca_memheap_base_get_cached_mkey(oshmem_ctx_default, pe, (void *)dst_addr, i, &rva); if (!mkey) { continue; } From 06183a7bec1191ea904dde101c71b98f6d4f5e5b Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Thu, 7 Mar 2019 04:15:08 +0200 Subject: [PATCH 296/674] ompi/oshmem/spml/ucx: let shmem_finalize to clean up any ctx left Signed-off-by: Tomislav Janjusic (cherry picked from commit 9a060009622e9220d6332d9b63f6a1a7328418a0) --- oshmem/mca/spml/ucx/spml_ucx_component.c | 40 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 3cbd406a35a..56ca16e42d5 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -226,13 +226,47 @@ mca_spml_ucx_component_init(int* priority, static int mca_spml_ucx_component_fini(void) { + mca_spml_ucx_ctx_list_item_t *ctx_item, *next; + size_t i, j, nprocs = oshmem_num_procs(); + opal_progress_unregister(spml_ucx_progress); - + + if(!mca_spml_ucx.enabled) + return OSHMEM_SUCCESS; /* never selected.. return success.. */ + + /* delete context objects from list */ + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + mca_spml_ucx_ctx_list_item_t) { + opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); + + opal_common_ucx_del_proc_t *del_procs; + del_procs = malloc(sizeof(*del_procs) * nprocs); + + for (i = 0; i < nprocs; ++i) { + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { + ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); + } + } + + del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; + del_procs[i].vpid = i; + ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; + } + + opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), + mca_spml_ucx.num_disconnect, + ctx_item->ctx.ucp_worker); + free(del_procs); + free(ctx_item->ctx.ucp_peers); + + ucp_worker_destroy(ctx_item->ctx.ucp_worker); + OBJ_RELEASE(ctx_item); + } + if (mca_spml_ucx_ctx_default.ucp_worker) { ucp_worker_destroy(mca_spml_ucx_ctx_default.ucp_worker); } - if(!mca_spml_ucx.enabled) - return OSHMEM_SUCCESS; /* never selected.. return success.. */ mca_spml_ucx.enabled = false; /* not anymore */ From ce54b63b9041b64a634b53e32e1f7bbdac0a337c Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Thu, 7 Mar 2019 22:23:07 +0200 Subject: [PATCH 297/674] ompi/oshmem: add spml_context back to sshmem_type in memheap, to keep track of ucx_ctx_default's rkeys Signed-off-by: Tomislav Janjusic (cherry picked from commit 48033ac1f43159c053241b65e74a39777e5e31e4) --- oshmem/mca/spml/ucx/spml_ucx.c | 33 ++++++++++++++++++-------------- oshmem/mca/sshmem/sshmem_types.h | 1 + 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 93b5bfcf8a6..5ae829ee86e 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -106,7 +106,7 @@ int mca_spml_ucx_enable(bool enable) int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) { opal_common_ucx_del_proc_t *del_procs; - size_t i, j; + size_t i; int ret; oshmem_shmem_barrier(); @@ -121,12 +121,6 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) } for (i = 0; i < nprocs; ++i) { - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { - if (mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey != NULL) { - ucp_rkey_destroy(mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey); - } - } - del_procs[i].ep = mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn; del_procs[i].vpid = i; @@ -352,16 +346,21 @@ spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void mca_spml_ucx_rmkey_free(sshmem_mkey_t *mkey) { + spml_ucx_mkey_t *ucx_mkey; + + if (!mkey->spml_context) { + return; + } + ucx_mkey = (spml_ucx_mkey_t *)(mkey->spml_context); + ucp_rkey_destroy(ucx_mkey->rkey); } -void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *key, int pe) +void *mca_spml_ucx_rmkey_ptr(const void *dst_addr, sshmem_mkey_t *mkey, int pe) { #if (((UCP_API_MAJOR >= 1) && (UCP_API_MINOR >= 3)) || (UCP_API_MAJOR >= 2)) void *rva; ucs_status_t err; - mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)&mca_spml_ucx_ctx_default; - uint32_t segno = memheap_find_segnum((void*)dst_addr); - spml_ucx_mkey_t *ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key; + spml_ucx_mkey_t *ucx_mkey = (spml_ucx_mkey_t *)(mkey->spml_context); err = ucp_rkey_ptr(ucx_mkey->rkey, (uint64_t)dst_addr, &rva); if (UCS_OK != err) { @@ -389,6 +388,9 @@ void mca_spml_ucx_rmkey_unpack(shmem_ctx_t ctx, sshmem_mkey_t *mkey, uint32_t se goto error_fatal; } + if (ucx_ctx == &mca_spml_ucx_ctx_default) { + mkey->spml_context = ucx_mkey; + } mca_spml_ucx_cache_mkey(ucx_ctx, mkey, segno, pe); return; @@ -451,6 +453,7 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr, mem_seg = memheap_find_seg(segno); ucx_mkey = &mca_spml_ucx_ctx_default.ucp_peers[my_pe].mkeys[segno].key; + mkeys[0].spml_context = ucx_mkey; /* if possible use mem handle already created by ucx allocator */ if (MAP_SEGMENT_ALLOC_UCX != mem_seg->type) { @@ -517,12 +520,14 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) int my_pe = oshmem_my_proc_id(); MCA_SPML_CALL(quiet(oshmem_ctx_default)); - if (!mkeys || !mkeys[0].va_base) + if (!mkeys) + return OSHMEM_SUCCESS; + + if (!mkeys[0].spml_context) return OSHMEM_SUCCESS; mem_seg = memheap_find_va(mkeys[0].va_base); - segno = memheap_find_segnum(mkeys[0].va_base); - ucx_mkey = &mca_spml_ucx_ctx_default.ucp_peers[my_pe].mkeys[segno].key; + ucx_mkey = (spml_ucx_mkey_t*)mkeys[0].spml_context; if (OPAL_UNLIKELY(NULL == mem_seg)) { return OSHMEM_ERROR; diff --git a/oshmem/mca/sshmem/sshmem_types.h b/oshmem/mca/sshmem/sshmem_types.h index 88520d3d20d..ccdf8995b5f 100644 --- a/oshmem/mca/sshmem/sshmem_types.h +++ b/oshmem/mca/sshmem/sshmem_types.h @@ -94,6 +94,7 @@ typedef struct sshmem_mkey { void *data; uint64_t key; } u; + void *spml_context; /* spml module can attach internal structures here */ } sshmem_mkey_t; typedef struct map_base_segment { From 8e04fb363350bea6632641fd8d8c9a621e783a89 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 21 Mar 2019 16:38:51 -0400 Subject: [PATCH 298/674] Update VERSION to v4.0.1rc3 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7b3f884af6f..48b770187e4 100644 --- a/VERSION +++ b/VERSION @@ -28,7 +28,7 @@ release=1 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc2 +greek=rc3 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 596997c194ca0bdd319480d5196f902eb85c0ffe Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Fri, 8 Mar 2019 06:19:39 +0200 Subject: [PATCH 299/674] ompi/oshmem/spml/ucx: defer clean up shmem_ctx to shmem_finalize Signed-off-by: Tomislav Janjusic (cherry picked from commit e1c1ab020227fc18d145379ab29ea86a3cdb66b1) --- opal/mca/common/ucx/common_ucx.c | 19 ++++-- opal/mca/common/ucx/common_ucx.h | 5 +- oshmem/mca/spml/ucx/spml_ucx.c | 25 +------- oshmem/mca/spml/ucx/spml_ucx.h | 1 + oshmem/mca/spml/ucx/spml_ucx_component.c | 81 ++++++++++++++++++------ 5 files changed, 81 insertions(+), 50 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 69f8b0c4678..086c2dd6d90 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -151,6 +151,10 @@ void opal_common_ucx_mca_proc_added(void) } } #endif + +OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced) +{ + return opal_pmix.fence_nb(NULL, 0, opal_common_ucx_mca_fence_complete_cb, (void *)fenced); } OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker) @@ -181,9 +185,8 @@ static void opal_common_ucx_wait_all_requests(void **reqs, int count, ucp_worker } } -OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count, - size_t my_rank, size_t max_disconnect, ucp_worker_h worker) -{ +OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count, + size_t my_rank, size_t max_disconnect, ucp_worker_h worker) { size_t num_reqs; size_t max_reqs; void *dreq, **dreqs; @@ -230,7 +233,13 @@ OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, s opal_common_ucx_wait_all_requests(dreqs, num_reqs, worker); free(dreqs); - opal_common_ucx_mca_pmix_fence(worker); - return OPAL_SUCCESS; } + +OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count, + size_t my_rank, size_t max_disconnect, ucp_worker_h worker) +{ + opal_common_ucx_del_procs_nofence(procs, count, my_rank, max_disconnect, worker); + + return opal_common_ucx_mca_pmix_fence(worker); +} diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 7db964447e9..7ea91ab7291 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -100,9 +100,12 @@ OPAL_DECLSPEC void opal_common_ucx_mca_deregister(void); OPAL_DECLSPEC void opal_common_ucx_mca_proc_added(void); OPAL_DECLSPEC void opal_common_ucx_empty_complete_cb(void *request, ucs_status_t status); OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence(ucp_worker_h worker); -OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component); +OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced); OPAL_DECLSPEC int opal_common_ucx_del_procs(opal_common_ucx_del_proc_t *procs, size_t count, size_t my_rank, size_t max_disconnect, ucp_worker_h worker); +OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count, + size_t my_rank, size_t max_disconnect, ucp_worker_h worker); +OPAL_DECLSPEC void opal_common_ucx_mca_var_register(const mca_base_component_t *component); static inline ucs_status_t opal_common_ucx_request_status(ucs_status_ptr_t request) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 5ae829ee86e..a8f5dc01ab8 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -657,30 +657,7 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) mca_spml_ucx_ctx_list_item_t) { if ((shmem_ctx_t)(&ctx_item->ctx) == ctx) { opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); - - opal_common_ucx_del_proc_t *del_procs; - del_procs = malloc(sizeof(*del_procs) * nprocs); - - for (i = 0; i < nprocs; ++i) { - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { - if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { - ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); - } - } - - del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; - del_procs[i].vpid = i; - ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; - } - - opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), - mca_spml_ucx.num_disconnect, - ctx_item->ctx.ucp_worker); - free(del_procs); - free(ctx_item->ctx.ucp_peers); - - ucp_worker_destroy(ctx_item->ctx.ucp_worker); - OBJ_RELEASE(ctx_item); + opal_list_append(&(mca_spml_ucx.idle_ctx_list), &ctx_item->super); break; } } diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 68496d8c79d..29da8538fd9 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -92,6 +92,7 @@ struct mca_spml_ucx { mca_spml_ucx_get_mkey_slow_fn_t get_mkey_slow; char **remote_addrs_tbl; opal_list_t ctx_list; + opal_list_t idle_ctx_list; int priority; /* component priority */ shmem_internal_mutex_t internal_mutex; }; diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 56ca16e42d5..009a00dbf82 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -176,6 +176,7 @@ static int spml_ucx_init(void) } OBJ_CONSTRUCT(&(mca_spml_ucx.ctx_list), opal_list_t); + OBJ_CONSTRUCT(&(mca_spml_ucx.idle_ctx_list), opal_list_t); SHMEM_MUTEX_INIT(mca_spml_ucx.internal_mutex); wkr_params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; @@ -224,10 +225,37 @@ mca_spml_ucx_component_init(int* priority, return &mca_spml_ucx.super; } +static void _ctx_cleanup(mca_spml_ucx_ctx_list_item_t *ctx_item) +{ + int i, j, nprocs = oshmem_num_procs(); + opal_common_ucx_del_proc_t *del_procs; + + del_procs = malloc(sizeof(*del_procs) * nprocs); + + for (i = 0; i < nprocs; ++i) { + for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { + ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); + } + } + + del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; + del_procs[i].vpid = i; + ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; + } + + opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), + mca_spml_ucx.num_disconnect, + ctx_item->ctx.ucp_worker); + free(del_procs); + free(ctx_item->ctx.ucp_peers); +} + static int mca_spml_ucx_component_fini(void) { mca_spml_ucx_ctx_list_item_t *ctx_item, *next; - size_t i, j, nprocs = oshmem_num_procs(); + int fenced = 0; + int ret = OSHMEM_SUCCESS; opal_progress_unregister(spml_ucx_progress); @@ -235,31 +263,43 @@ static int mca_spml_ucx_component_fini(void) return OSHMEM_SUCCESS; /* never selected.. return success.. */ /* delete context objects from list */ - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), mca_spml_ucx_ctx_list_item_t) { - opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); + _ctx_cleanup(ctx_item); + } - opal_common_ucx_del_proc_t *del_procs; - del_procs = malloc(sizeof(*del_procs) * nprocs); + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + mca_spml_ucx_ctx_list_item_t) { + _ctx_cleanup(ctx_item); + } - for (i = 0; i < nprocs; ++i) { - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { - if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { - ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); - } - } + ret = opal_common_ucx_mca_pmix_fence_nb(&fenced); + if (OPAL_SUCCESS != ret) { + return ret; + } - del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; - del_procs[i].vpid = i; - ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; + while (!fenced) { + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + mca_spml_ucx_ctx_list_item_t) { + ucp_worker_progress(ctx_item->ctx.ucp_worker); } + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), + mca_spml_ucx_ctx_list_item_t) { + ucp_worker_progress(ctx_item->ctx.ucp_worker); + } + ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); + } - opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), - mca_spml_ucx.num_disconnect, - ctx_item->ctx.ucp_worker); - free(del_procs); - free(ctx_item->ctx.ucp_peers); - + /* delete all workers */ + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), + mca_spml_ucx_ctx_list_item_t) { + opal_list_remove_item(&(mca_spml_ucx.idle_ctx_list), &ctx_item->super); + ucp_worker_destroy(ctx_item->ctx.ucp_worker); + OBJ_RELEASE(ctx_item); + } + OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), + mca_spml_ucx_ctx_list_item_t) { + opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); ucp_worker_destroy(ctx_item->ctx.ucp_worker); OBJ_RELEASE(ctx_item); } @@ -271,6 +311,7 @@ static int mca_spml_ucx_component_fini(void) mca_spml_ucx.enabled = false; /* not anymore */ OBJ_DESTRUCT(&(mca_spml_ucx.ctx_list)); + OBJ_DESTRUCT(&(mca_spml_ucx.idle_ctx_list)); SHMEM_MUTEX_DESTROY(mca_spml_ucx.internal_mutex); if (mca_spml_ucx.ucp_context) { From 580b584179b2c5c0d66e38f703a55efe5f751628 Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Fri, 8 Mar 2019 07:29:48 +0200 Subject: [PATCH 300/674] ompi/oshmem/spml/ucx:delete oob path of getting rkeys in spml ucx Signed-off-by: Tomislav Janjusic (cherry picked from commit e0414006b0c0a8e9918a4cf8ac4bb819b977ec91) --- oshmem/mca/spml/ucx/spml_ucx.c | 61 ++++++---------------------------- oshmem/mca/spml/ucx/spml_ucx.h | 5 +-- 2 files changed, 12 insertions(+), 54 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index a8f5dc01ab8..eb1f50da275 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -44,9 +44,6 @@ #define SPML_UCX_PUT_DEBUG 0 #endif -static -spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva); - mca_spml_ucx_t mca_spml_ucx = { .super = { /* Init mca_spml_base_module_t */ @@ -80,7 +77,7 @@ mca_spml_ucx_t mca_spml_ucx = { .num_disconnect = 1, .heap_reg_nb = 0, .enabled = 0, - .get_mkey_slow = mca_spml_ucx_get_mkey_slow + .get_mkey_slow = NULL }; OBJ_CLASS_INSTANCE(mca_spml_ucx_ctx_list_item_t, opal_list_item_t, NULL, NULL); @@ -313,37 +310,6 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) } - -static -spml_ucx_mkey_t * mca_spml_ucx_get_mkey_slow(shmem_ctx_t ctx, int pe, void *va, void **rva) -{ - sshmem_mkey_t *r_mkey; - spml_ucx_mkey_t *ucx_mkey; - uint32_t segno; - mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; - ucs_status_t err; - - r_mkey = mca_memheap_base_get_cached_mkey(ctx, pe, va, 0, rva); - if (OPAL_UNLIKELY(!r_mkey)) { - SPML_UCX_ERROR("pe=%d: %p is not address of symmetric variable", - pe, va); - oshmem_shmem_abort(-1); - return NULL; - } - - segno = memheap_find_segnum(va); - ucx_mkey = &ucx_ctx->ucp_peers[pe].mkeys[segno].key; - - if (ucx_mkey->rkey == NULL) { - err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[pe].ucp_conn, - r_mkey->u.data, - &ucx_mkey->rkey); - mca_spml_ucx_cache_mkey(ucx_ctx, r_mkey, segno, pe); /* make sure it is properly cached */ - } - - return ucx_mkey; -} - void mca_spml_ucx_rmkey_free(sshmem_mkey_t *mkey) { spml_ucx_mkey_t *ucx_mkey; @@ -595,24 +561,19 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) } for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { - ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey = NULL; + mkey = &memheap_map->mem_segs[j].mkeys_cache[i][0]; + ucx_mkey = &ctx_item->ctx.ucp_peers[i].mkeys[j].key; + err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[i].ucp_conn, + mkey->u.data, + &ucx_mkey->rkey); + if (UCS_OK != err) { + SPML_UCX_ERROR("failed to unpack rkey"); + goto error2; + } + mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, j, i); } } - for (i = 0; i < MCA_MEMHEAP_SEG_COUNT; i++) { - mkey = &memheap_map->mem_segs[i].mkeys_cache[my_pe][0]; - ucx_mkey = &ctx_item->ctx.ucp_peers[my_pe].mkeys[i].key; - err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[my_pe].ucp_conn, - mkey->u.data, - &ucx_mkey->rkey); - if (UCS_OK != err) { - SPML_UCX_ERROR("failed to unpack rkey"); - goto error2; - } - - mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, i, my_pe); - } - SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); opal_list_append(&(mca_spml_ucx.ctx_list), &ctx_item->super); diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 29da8538fd9..cf9c50c030c 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -170,10 +170,7 @@ mca_spml_ucx_get_mkey(shmem_ctx_t ctx, int pe, void *va, void **rva, mca_spml_uc mkey = ucx_ctx->ucp_peers[pe].mkeys; mkey = (spml_ucx_cached_mkey_t *)map_segment_find_va(&mkey->super.super, sizeof(*mkey), va); - if (OPAL_UNLIKELY(NULL == mkey)) { - assert(module->get_mkey_slow); - return module->get_mkey_slow(ctx, pe, va, rva); - } + assert(mkey != NULL); *rva = map_segment_va2rva(&mkey->super, va); return &mkey->key; } From 69a80fce9f0eb551e982d19c1cf8668851c55b95 Mon Sep 17 00:00:00 2001 From: Xin Zhao Date: Wed, 13 Mar 2019 04:39:26 +0200 Subject: [PATCH 301/674] ompi/oshmem/spml/ucx: use lockfree array to optimize spml_ucx_progress/delete oshmem_barrier in shmem_ctx_destroy ompi/oshmem/spml/ucx: optimize spml ucx progress Signed-off-by: Tomislav Janjusic (cherry picked from commit 9c3d00b144641d2929f830279dcc9d163c38e9e1) --- opal/mca/common/ucx/common_ucx.c | 1 + oshmem/mca/spml/ucx/spml_ucx.c | 107 ++++++++++++++--------- oshmem/mca/spml/ucx/spml_ucx.h | 22 +++-- oshmem/mca/spml/ucx/spml_ucx_component.c | 93 ++++++++++---------- 4 files changed, 129 insertions(+), 94 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 086c2dd6d90..7ccde24bc60 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -151,6 +151,7 @@ void opal_common_ucx_mca_proc_added(void) } } #endif +} OPAL_DECLSPEC int opal_common_ucx_mca_pmix_fence_nb(int *fenced) { diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index eb1f50da275..0522ba09663 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -80,8 +80,6 @@ mca_spml_ucx_t mca_spml_ucx = { .get_mkey_slow = NULL }; -OBJ_CLASS_INSTANCE(mca_spml_ucx_ctx_list_item_t, opal_list_item_t, NULL, NULL); - mca_spml_ucx_ctx_t mca_spml_ucx_ctx_default = { .ucp_worker = NULL, .ucp_peers = NULL, @@ -246,7 +244,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) goto error; } - opal_progress_register(spml_ucx_progress); + opal_progress_register(spml_ucx_default_progress); mca_spml_ucx.remote_addrs_tbl = (char **)calloc(nprocs, sizeof(char *)); memset(mca_spml_ucx.remote_addrs_tbl, 0, nprocs * sizeof(char *)); @@ -514,9 +512,45 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) return OSHMEM_SUCCESS; } +static inline void _ctx_add(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t *ctx) +{ + int i; + + if (array->ctxs_count < array->ctxs_num) { + array->ctxs[array->ctxs_count] = ctx; + } else { + array->ctxs = realloc(array->ctxs, (array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC) * sizeof(mca_spml_ucx_ctx_t *)); + opal_atomic_wmb (); + for (i = array->ctxs_num; i < array->ctxs_num + MCA_SPML_UCX_CTXS_ARRAY_INC; i++) { + array->ctxs[i] = NULL; + } + array->ctxs[array->ctxs_num] = ctx; + array->ctxs_num += MCA_SPML_UCX_CTXS_ARRAY_INC; + } + + opal_atomic_wmb (); + array->ctxs_count++; +} + +static inline void _ctx_remove(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t *ctx) +{ + int i; + + for (i = 0; i < array->ctxs_count; i++) { + if (array->ctxs[i] == ctx) { + array->ctxs[i] = array->ctxs[array->ctxs_count-1]; + array->ctxs[array->ctxs_count-1] = NULL; + break; + } + } + + array->ctxs_count--; + opal_atomic_wmb (); +} + int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) { - mca_spml_ucx_ctx_list_item_t *ctx_item; + mca_spml_ucx_ctx_t *ucx_ctx; ucp_worker_params_t params; ucp_ep_params_t ep_params; size_t i, j, nprocs = oshmem_num_procs(); @@ -527,8 +561,8 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) sshmem_mkey_t *mkey; int rc = OSHMEM_ERROR; - ctx_item = OBJ_NEW(mca_spml_ucx_ctx_list_item_t); - ctx_item->ctx.options = options; + ucx_ctx = malloc(sizeof(mca_spml_ucx_ctx_t)); + ucx_ctx->options = options; params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; if (oshmem_mpi_thread_provided == SHMEM_THREAD_SINGLE || options & SHMEM_CTX_PRIVATE || options & SHMEM_CTX_SERIALIZED) { @@ -538,22 +572,26 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) } err = ucp_worker_create(mca_spml_ucx.ucp_context, ¶ms, - &ctx_item->ctx.ucp_worker); + &ucx_ctx->ucp_worker); if (UCS_OK != err) { - OBJ_RELEASE(ctx_item); + free(ucx_ctx); return OSHMEM_ERROR; } - ctx_item->ctx.ucp_peers = (ucp_peer_t *) calloc(nprocs, sizeof(*(ctx_item->ctx.ucp_peers))); - if (NULL == ctx_item->ctx.ucp_peers) { + ucx_ctx->ucp_peers = (ucp_peer_t *) calloc(nprocs, sizeof(*(ucx_ctx->ucp_peers))); + if (NULL == ucx_ctx->ucp_peers) { goto error; } + if (mca_spml_ucx.active_array.ctxs_count == 0) { + opal_progress_register(spml_ucx_ctx_progress); + } + for (i = 0; i < nprocs; i++) { ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS; ep_params.address = (ucp_address_t *)(mca_spml_ucx.remote_addrs_tbl[i]); - err = ucp_ep_create(ctx_item->ctx.ucp_worker, &ep_params, - &ctx_item->ctx.ucp_peers[i].ucp_conn); + err = ucp_ep_create(ucx_ctx->ucp_worker, &ep_params, + &ucx_ctx->ucp_peers[i].ucp_conn); if (UCS_OK != err) { SPML_ERROR("ucp_ep_create(proc=%d/%d) failed: %s", i, nprocs, ucs_status_string(err)); @@ -562,41 +600,38 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { mkey = &memheap_map->mem_segs[j].mkeys_cache[i][0]; - ucx_mkey = &ctx_item->ctx.ucp_peers[i].mkeys[j].key; - err = ucp_ep_rkey_unpack(ctx_item->ctx.ucp_peers[i].ucp_conn, + ucx_mkey = &ucx_ctx->ucp_peers[i].mkeys[j].key; + err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[i].ucp_conn, mkey->u.data, &ucx_mkey->rkey); if (UCS_OK != err) { SPML_UCX_ERROR("failed to unpack rkey"); goto error2; } - mca_spml_ucx_cache_mkey(&ctx_item->ctx, mkey, j, i); + mca_spml_ucx_cache_mkey(ucx_ctx, mkey, j, i); } } SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); - - opal_list_append(&(mca_spml_ucx.ctx_list), &ctx_item->super); - + _ctx_add(&mca_spml_ucx.active_array, ucx_ctx); SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); - (*ctx) = (shmem_ctx_t)(&ctx_item->ctx); - + (*ctx) = (shmem_ctx_t)ucx_ctx; return OSHMEM_SUCCESS; error2: for (i = 0; i < nprocs; i++) { - if (ctx_item->ctx.ucp_peers[i].ucp_conn) { - ucp_ep_destroy(ctx_item->ctx.ucp_peers[i].ucp_conn); + if (ucx_ctx->ucp_peers[i].ucp_conn) { + ucp_ep_destroy(ucx_ctx->ucp_peers[i].ucp_conn); } } - if (ctx_item->ctx.ucp_peers) - free(ctx_item->ctx.ucp_peers); + if (ucx_ctx->ucp_peers) + free(ucx_ctx->ucp_peers); error: - ucp_worker_destroy(ctx_item->ctx.ucp_worker); - OBJ_RELEASE(ctx_item); + ucp_worker_destroy(ucx_ctx->ucp_worker); + free(ucx_ctx); rc = OSHMEM_ERR_OUT_OF_RESOURCE; SPML_ERROR("ctx create FAILED rc=%d", rc); return rc; @@ -604,26 +639,16 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) { - mca_spml_ucx_ctx_list_item_t *ctx_item, *next; - size_t i, j, nprocs = oshmem_num_procs(); - MCA_SPML_CALL(quiet(ctx)); - oshmem_shmem_barrier(); - SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); + _ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx); + _ctx_add(&mca_spml_ucx.idle_array, (mca_spml_ucx_ctx_t *)ctx); + SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); - /* delete context object from list */ - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), - mca_spml_ucx_ctx_list_item_t) { - if ((shmem_ctx_t)(&ctx_item->ctx) == ctx) { - opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); - opal_list_append(&(mca_spml_ucx.idle_ctx_list), &ctx_item->super); - break; - } + if (!mca_spml_ucx.active_array.ctxs_count) { + opal_progress_unregister(spml_ucx_ctx_progress); } - - SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); } int mca_spml_ucx_get(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_addr, int src) diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index cf9c50c030c..6c2424ba766 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -75,14 +75,14 @@ typedef struct mca_spml_ucx_ctx mca_spml_ucx_ctx_t; extern mca_spml_ucx_ctx_t mca_spml_ucx_ctx_default; -struct mca_spml_ucx_ctx_list_item { - opal_list_item_t super; - mca_spml_ucx_ctx_t ctx; -}; -typedef struct mca_spml_ucx_ctx_list_item mca_spml_ucx_ctx_list_item_t; - typedef spml_ucx_mkey_t * (*mca_spml_ucx_get_mkey_slow_fn_t)(shmem_ctx_t ctx, int pe, void *va, void **rva); +typedef struct mca_spml_ucx_ctx_array { + int ctxs_count; + int ctxs_num; + mca_spml_ucx_ctx_t **ctxs; +} mca_spml_ucx_ctx_array_t; + struct mca_spml_ucx { mca_spml_base_module_t super; ucp_context_h ucp_context; @@ -91,8 +91,8 @@ struct mca_spml_ucx { bool enabled; mca_spml_ucx_get_mkey_slow_fn_t get_mkey_slow; char **remote_addrs_tbl; - opal_list_t ctx_list; - opal_list_t idle_ctx_list; + mca_spml_ucx_ctx_array_t active_array; + mca_spml_ucx_ctx_array_t idle_array; int priority; /* component priority */ shmem_internal_mutex_t internal_mutex; }; @@ -152,7 +152,8 @@ extern int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs); extern int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs); extern int mca_spml_ucx_fence(shmem_ctx_t ctx); extern int mca_spml_ucx_quiet(shmem_ctx_t ctx); -extern int spml_ucx_progress(void); +extern int spml_ucx_default_progress(void); +extern int spml_ucx_ctx_progress(void); static void mca_spml_ucx_cache_mkey(mca_spml_ucx_ctx_t *ucx_ctx, sshmem_mkey_t *mkey, uint32_t segno, int dst_pe) { @@ -193,6 +194,9 @@ static inline int ucx_status_to_oshmem_nb(ucs_status_t status) #endif } +#define MCA_SPML_UCX_CTXS_ARRAY_SIZE 64 +#define MCA_SPML_UCX_CTXS_ARRAY_INC 64 + END_C_DECLS #endif diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 009a00dbf82..720dbf88f67 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -109,16 +109,18 @@ static int mca_spml_ucx_component_register(void) return OSHMEM_SUCCESS; } -int spml_ucx_progress(void) +int spml_ucx_ctx_progress(void) { - mca_spml_ucx_ctx_list_item_t *ctx_item, *next; - ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); - SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), - mca_spml_ucx_ctx_list_item_t) { - ucp_worker_progress(ctx_item->ctx.ucp_worker); + int i; + for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { + ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); } - SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); + return 1; +} + +int spml_ucx_default_progress(void) +{ + ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); return 1; } @@ -175,8 +177,13 @@ static int spml_ucx_init(void) oshmem_mpi_thread_provided = SHMEM_THREAD_SINGLE; } - OBJ_CONSTRUCT(&(mca_spml_ucx.ctx_list), opal_list_t); - OBJ_CONSTRUCT(&(mca_spml_ucx.idle_ctx_list), opal_list_t); + mca_spml_ucx.active_array.ctxs_count = mca_spml_ucx.idle_array.ctxs_count = 0; + mca_spml_ucx.active_array.ctxs_num = mca_spml_ucx.idle_array.ctxs_num = MCA_SPML_UCX_CTXS_ARRAY_SIZE; + mca_spml_ucx.active_array.ctxs = calloc(mca_spml_ucx.active_array.ctxs_num, + sizeof(mca_spml_ucx_ctx_t *)); + mca_spml_ucx.idle_array.ctxs = calloc(mca_spml_ucx.idle_array.ctxs_num, + sizeof(mca_spml_ucx_ctx_t *)); + SHMEM_MUTEX_INIT(mca_spml_ucx.internal_mutex); wkr_params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; @@ -225,7 +232,7 @@ mca_spml_ucx_component_init(int* priority, return &mca_spml_ucx.super; } -static void _ctx_cleanup(mca_spml_ucx_ctx_list_item_t *ctx_item) +static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx) { int i, j, nprocs = oshmem_num_procs(); opal_common_ucx_del_proc_t *del_procs; @@ -234,43 +241,43 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_list_item_t *ctx_item) for (i = 0; i < nprocs; ++i) { for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { - if (ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey != NULL) { - ucp_rkey_destroy(ctx_item->ctx.ucp_peers[i].mkeys[j].key.rkey); + if (ctx->ucp_peers[i].mkeys[j].key.rkey != NULL) { + ucp_rkey_destroy(ctx->ucp_peers[i].mkeys[j].key.rkey); } } - del_procs[i].ep = ctx_item->ctx.ucp_peers[i].ucp_conn; + del_procs[i].ep = ctx->ucp_peers[i].ucp_conn; del_procs[i].vpid = i; - ctx_item->ctx.ucp_peers[i].ucp_conn = NULL; + ctx->ucp_peers[i].ucp_conn = NULL; } opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), mca_spml_ucx.num_disconnect, - ctx_item->ctx.ucp_worker); + ctx->ucp_worker); free(del_procs); - free(ctx_item->ctx.ucp_peers); + free(ctx->ucp_peers); } static int mca_spml_ucx_component_fini(void) { - mca_spml_ucx_ctx_list_item_t *ctx_item, *next; - int fenced = 0; + int fenced = 0, i; int ret = OSHMEM_SUCCESS; - opal_progress_unregister(spml_ucx_progress); + opal_progress_unregister(spml_ucx_default_progress); + if (mca_spml_ucx.active_array.ctxs_count) { + opal_progress_unregister(spml_ucx_ctx_progress); + } if(!mca_spml_ucx.enabled) return OSHMEM_SUCCESS; /* never selected.. return success.. */ /* delete context objects from list */ - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), - mca_spml_ucx_ctx_list_item_t) { - _ctx_cleanup(ctx_item); + for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { + _ctx_cleanup(mca_spml_ucx.active_array.ctxs[i]); } - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), - mca_spml_ucx_ctx_list_item_t) { - _ctx_cleanup(ctx_item); + for (i = 0; i < mca_spml_ucx.idle_array.ctxs_count; i++) { + _ctx_cleanup(mca_spml_ucx.idle_array.ctxs[i]); } ret = opal_common_ucx_mca_pmix_fence_nb(&fenced); @@ -279,29 +286,26 @@ static int mca_spml_ucx_component_fini(void) } while (!fenced) { - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), - mca_spml_ucx_ctx_list_item_t) { - ucp_worker_progress(ctx_item->ctx.ucp_worker); + for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { + ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); } - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), - mca_spml_ucx_ctx_list_item_t) { - ucp_worker_progress(ctx_item->ctx.ucp_worker); + + for (i = 0; i < mca_spml_ucx.idle_array.ctxs_count; i++) { + ucp_worker_progress(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker); } + ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); } /* delete all workers */ - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.idle_ctx_list), - mca_spml_ucx_ctx_list_item_t) { - opal_list_remove_item(&(mca_spml_ucx.idle_ctx_list), &ctx_item->super); - ucp_worker_destroy(ctx_item->ctx.ucp_worker); - OBJ_RELEASE(ctx_item); + for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { + ucp_worker_destroy(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); + free(mca_spml_ucx.active_array.ctxs[i]); } - OPAL_LIST_FOREACH_SAFE(ctx_item, next, &(mca_spml_ucx.ctx_list), - mca_spml_ucx_ctx_list_item_t) { - opal_list_remove_item(&(mca_spml_ucx.ctx_list), &ctx_item->super); - ucp_worker_destroy(ctx_item->ctx.ucp_worker); - OBJ_RELEASE(ctx_item); + + for (i = 0; i < mca_spml_ucx.idle_array.ctxs_count; i++) { + ucp_worker_destroy(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker); + free(mca_spml_ucx.idle_array.ctxs[i]); } if (mca_spml_ucx_ctx_default.ucp_worker) { @@ -310,8 +314,9 @@ static int mca_spml_ucx_component_fini(void) mca_spml_ucx.enabled = false; /* not anymore */ - OBJ_DESTRUCT(&(mca_spml_ucx.ctx_list)); - OBJ_DESTRUCT(&(mca_spml_ucx.idle_ctx_list)); + free(mca_spml_ucx.active_array.ctxs); + free(mca_spml_ucx.idle_array.ctxs); + SHMEM_MUTEX_DESTROY(mca_spml_ucx.internal_mutex); if (mca_spml_ucx.ucp_context) { From 5f4f5d45b32e311260b4d30908bfac26a64d6a35 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Wed, 20 Mar 2019 21:35:53 -0400 Subject: [PATCH 302/674] shmem/fortran: Fix invalid datatype size in call to atomic cswap Signed-off-by: Scott Miller (cherry picked from commit 6b294e064150d26dfc68ec307cf4cd2e40891a1b) --- oshmem/shmem/fortran/shmem_int4_cswap_f.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oshmem/shmem/fortran/shmem_int4_cswap_f.c b/oshmem/shmem/fortran/shmem_int4_cswap_f.c index 460cc7c4dca..a1e5fbfe924 100644 --- a/oshmem/shmem/fortran/shmem_int4_cswap_f.c +++ b/oshmem/shmem/fortran/shmem_int4_cswap_f.c @@ -4,6 +4,7 @@ * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -42,7 +43,7 @@ ompi_fortran_integer4_t shmem_int4_cswap_f(FORTRAN_POINTER_T target, MPI_Fint *c (void *)&out_value, FPTR_2_INT(cond, sizeof(ompi_fortran_integer4_t)), FPTR_2_INT(value, sizeof(ompi_fortran_integer4_t)), - sizeof(out_value), + sizeof(ompi_fortran_integer4_t), OMPI_FINT_2_INT(*pe))); return out_value; From 176356249cde411dab236b9973494dc97b35b9b7 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 25 Mar 2019 15:38:39 -0400 Subject: [PATCH 303/674] README: Describes the now fixed Issue 6114 Signed-off-by: Geoffrey Paulsen --- README | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/README b/README index 685ee9c6923..e6b8018f940 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007 Myricom, Inc. All rights reserved. -Copyright (c) 2008-2018 IBM Corporation. All rights reserved. +Copyright (c) 2008-2019 IBM Corporation. All rights reserved. Copyright (c) 2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2011 University of Houston. All rights reserved. Copyright (c) 2013-2017 Intel, Inc. All rights reserved. @@ -523,15 +523,21 @@ MPI Functionality and Features deprecated over 20 years ago, and finally removed from the MPI specification in MPI-3.0 (in 2012). - *** The Open MPI FAQ (https://www.open-mpi.org/faq/) contains - examples of how to update legacy MPI applications using these - deleted symbols to use the "new" symbols. + *** The Open MPI FAQ (https://www.open-mpi.org/faq/?category=mpi-removed) + contains examples of how to update legacy MPI applications using + these deleted symbols to use the "new" symbols. All that being said, if you are unable to immediately update your application to stop using these legacy MPI-1 symbols, you can re-enable them in mpi.h by configuring Open MPI with the --enable-mpi1-compatibility flag. + NOTE: Open MPI v4.0.0 had an error where these symbols were not + included in the library if configured without --enable-mpi1-compatibility + (see https://github.com/open-mpi/ompi/issues/6114). + This is fixed in v4.0.1, where --enable-mpi1-compatibility + flag only controls what declarations are present in the MPI header. + - Rank reordering support is available using the TreeMatch library. It is activated for the graph and dist_graph topologies. From 812fd4aa2bd4d939960848f0f60f75743cf701f1 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 27 Mar 2019 11:16:57 -0600 Subject: [PATCH 304/674] NEWS: minor typo fix [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c32cf266cd2..c7fcd83b079 100644 --- a/NEWS +++ b/NEWS @@ -69,7 +69,7 @@ included in the vX.Y.Z section and be denoted as: and older versions of hwloc. Thanks to Ben Menadue for reporting and providing a fix. - Fix an issue with MPI_WIN_CREATE_DYNAMIC and MPI_GET from self. - thanks to Bart Janssens for reporting. + Thanks to Bart Janssens for reporting. - Fix an issue of excessive compiler warning messages from mpi.h when using newer C++ compilers. Thanks to @Shadow-fax for reporting. From 9e73e3e520123c350b6cbae15a098145da3d69ee Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 27 Mar 2019 11:20:05 -0600 Subject: [PATCH 305/674] VERSION: roll to v4.0.2a1 Signed-off-by: Howard Pritchard --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 48b770187e4..ea6b0bc3c1c 100644 --- a/VERSION +++ b/VERSION @@ -19,7 +19,7 @@ major=4 minor=0 -release=1 +release=2 # greek is generally used for alpha or beta release tags. If it is # non-empty, it will be appended to the version number. It does not @@ -28,7 +28,7 @@ release=1 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc3 +greek=a1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 7f65e5b72061431369c6bd247a160ebfecf30df7 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Fri, 30 Nov 2018 12:44:42 +0100 Subject: [PATCH 306/674] Fix use of bitwise operation in CPP condition Signed-off-by: Bert Wesarg (cherry picked from commit 18525ce39be78ea695ce51c64a6eb443a2dbd899) --- ompi/mpi/cxx/mpicxx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mpi/cxx/mpicxx.h b/ompi/mpi/cxx/mpicxx.h index 551e823b6a7..5d193d3d7ff 100644 --- a/ompi/mpi/cxx/mpicxx.h +++ b/ompi/mpi/cxx/mpicxx.h @@ -44,7 +44,7 @@ #include -#if !defined(OMPI_IGNORE_CXX_SEEK) & OMPI_WANT_MPI_CXX_SEEK +#if !defined(OMPI_IGNORE_CXX_SEEK) && OMPI_WANT_MPI_CXX_SEEK // We need to include the header files that define SEEK_* or use them // in ways that require them to be #defines so that if the user // includes them later, the double inclusion logic in the headers will From 861016c3b2c2513bf8f07ec8bc0c168a78ed6c7e Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 3 Oct 2018 08:33:50 -0700 Subject: [PATCH 307/674] Cleanup race condition in finalize See https://github.com/open-mpi/ompi/issues/5798#issuecomment-426545893 for a lengthy explanation Signed-off-by: Ralph Castain (cherry picked from commit 57f6b94fa53166bc4d513be4507382e832a3a8c7) --- orte/mca/ess/base/Makefile.am | 3 +- orte/mca/ess/base/base.h | 4 - orte/mca/ess/base/ess_base_std_app.c | 407 ------------------ orte/mca/ess/lsf/ess_lsf_module.c | 17 - orte/mca/ess/pmi/ess_pmi_module.c | 179 +++++++- orte/mca/ess/singleton/ess_singleton_module.c | 215 ++++++++- orte/mca/ess/slurm/ess_slurm_module.c | 8 - orte/mca/ess/tm/ess_tm_module.c | 8 - 8 files changed, 368 insertions(+), 473 deletions(-) delete mode 100644 orte/mca/ess/base/ess_base_std_app.c diff --git a/orte/mca/ess/base/Makefile.am b/orte/mca/ess/base/Makefile.am index db1903699cf..70528b9d8ab 100644 --- a/orte/mca/ess/base/Makefile.am +++ b/orte/mca/ess/base/Makefile.am @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2015-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -28,7 +28,6 @@ libmca_ess_la_SOURCES += \ base/ess_base_select.c \ base/ess_base_get.c \ base/ess_base_std_tool.c \ - base/ess_base_std_app.c \ base/ess_base_std_orted.c \ base/ess_base_std_prolog.c \ base/ess_base_fns.c diff --git a/orte/mca/ess/base/base.h b/orte/mca/ess/base/base.h index 679bac4b199..65896a4e43e 100644 --- a/orte/mca/ess/base/base.h +++ b/orte/mca/ess/base/base.h @@ -61,10 +61,6 @@ ORTE_DECLSPEC int orte_ess_env_get(void); ORTE_DECLSPEC int orte_ess_base_std_prolog(void); -ORTE_DECLSPEC int orte_ess_base_app_setup(bool db_restrict_local); -ORTE_DECLSPEC int orte_ess_base_app_finalize(void); -ORTE_DECLSPEC void orte_ess_base_app_abort(int status, bool report); - ORTE_DECLSPEC int orte_ess_base_tool_setup(opal_list_t *flags); ORTE_DECLSPEC int orte_ess_base_tool_finalize(void); diff --git a/orte/mca/ess/base/ess_base_std_app.c b/orte/mca/ess/base/ess_base_std_app.c deleted file mode 100644 index a02711f5f43..00000000000 --- a/orte/mca/ess/base/ess_base_std_app.c +++ /dev/null @@ -1,407 +0,0 @@ -/* - * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2011 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 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2016 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2018 Mellanox Technologies, Inc. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif - -#include "opal/mca/event/event.h" -#include "opal/mca/pmix/base/base.h" -#include "opal/util/arch.h" -#include "opal/util/os_path.h" -#include "opal/util/output.h" -#include "opal/util/proc.h" -#include "opal/runtime/opal.h" - -#include "orte/mca/rml/base/base.h" -#include "orte/mca/routed/base/base.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/dfs/base/base.h" -#include "orte/mca/grpcomm/base/base.h" -#include "orte/mca/oob/base/base.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/rml/base/rml_contact.h" -#include "orte/mca/odls/odls_types.h" -#include "orte/mca/filem/base/base.h" -#include "orte/mca/errmgr/base/base.h" -#include "orte/mca/state/base/base.h" -#include "orte/util/proc_info.h" -#include "orte/util/session_dir.h" -#include "orte/util/name_fns.h" -#include "orte/util/show_help.h" -#include "opal/util/timings.h" - -#include "orte/runtime/orte_globals.h" -#include "orte/runtime/orte_wait.h" - -#include "orte/mca/ess/base/base.h" - -int orte_ess_base_app_setup(bool db_restrict_local) -{ - int ret; - char *error = NULL; - opal_list_t transports; - - OPAL_TIMING_ENV_INIT(ess_base_setup); - /* - * stdout/stderr buffering - * If the user requested to override the default setting then do - * as they wish. - */ - if( orte_ess_base_std_buffering > -1 ) { - if( 0 == orte_ess_base_std_buffering ) { - setvbuf(stdout, NULL, _IONBF, 0); - setvbuf(stderr, NULL, _IONBF, 0); - } - else if( 1 == orte_ess_base_std_buffering ) { - setvbuf(stdout, NULL, _IOLBF, 0); - setvbuf(stderr, NULL, _IOLBF, 0); - } - else if( 2 == orte_ess_base_std_buffering ) { - setvbuf(stdout, NULL, _IOFBF, 0); - setvbuf(stderr, NULL, _IOFBF, 0); - } - } - - /* if I am an MPI app, we will let the MPI layer define and - * control the opal_proc_t structure. Otherwise, we need to - * do so here */ - if (ORTE_PROC_NON_MPI) { - orte_process_info.super.proc_name = *(opal_process_name_t*)ORTE_PROC_MY_NAME; - orte_process_info.super.proc_hostname = orte_process_info.nodename; - orte_process_info.super.proc_flags = OPAL_PROC_ALL_LOCAL; - orte_process_info.super.proc_arch = opal_local_arch; - opal_proc_local_set(&orte_process_info.super); - } - - /* open and setup the state machine */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_state_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_state_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_state_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_state_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "state_framework_open"); - - /* open the errmgr */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_errmgr_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_errmgr_base_open"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_framework_open"); - - /* setup my session directory */ - if (orte_create_session_dirs) { - OPAL_OUTPUT_VERBOSE((2, orte_ess_base_framework.framework_output, - "%s setting up session dir with\n\ttmpdir: %s\n\thost %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (NULL == orte_process_info.tmpdir_base) ? "UNDEF" : orte_process_info.tmpdir_base, - orte_process_info.nodename)); - if (ORTE_SUCCESS != (ret = orte_session_dir(true, ORTE_PROC_MY_NAME))) { - ORTE_ERROR_LOG(ret); - error = "orte_session_dir"; - goto error; - } - /* Once the session directory location has been established, set - the opal_output env file location to be in the - proc-specific session directory. */ - opal_output_set_output_file_info(orte_process_info.proc_session_dir, - "output-", NULL, NULL); - /* register the directory for cleanup */ - if (NULL != opal_pmix.register_cleanup) { - if (orte_standalone_operation) { - if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.top_session_dir, true, false, true))) { - ORTE_ERROR_LOG(ret); - error = "register cleanup"; - goto error; - } - } else { - if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.job_session_dir, true, false, false))) { - ORTE_ERROR_LOG(ret); - error = "register cleanup"; - goto error; - } - } - } - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "create_session_dirs"); - - /* Setup the communication infrastructure */ - /* Routed system */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_routed_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_routed_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_routed_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_routed_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "routed_framework_open"); - - /* - * OOB Layer - */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_oob_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_oob_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_oob_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_oob_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "oob_framework_open"); - - /* Runtime Messaging Layer */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_rml_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_rml_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_rml_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_rml_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "rml_framework_open"); - - /* if we have info on the HNP and local daemon, process it */ - if (NULL != orte_process_info.my_hnp_uri) { - /* we have to set the HNP's name, even though we won't route messages directly - * to it. This is required to ensure that we -do- send messages to the correct - * HNP name - */ - if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_hnp_uri, - ORTE_PROC_MY_HNP, NULL))) { - ORTE_ERROR_LOG(ret); - error = "orte_rml_parse_HNP"; - goto error; - } - } - if (NULL != orte_process_info.my_daemon_uri) { - opal_value_t val; - - /* extract the daemon's name so we can update the routing table */ - if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_daemon_uri, - ORTE_PROC_MY_DAEMON, NULL))) { - ORTE_ERROR_LOG(ret); - error = "orte_rml_parse_daemon"; - goto error; - } - /* Set the contact info in the database - this won't actually establish - * the connection, but just tells us how to reach the daemon - * if/when we attempt to send to it - */ - OBJ_CONSTRUCT(&val, opal_value_t); - val.key = OPAL_PMIX_PROC_URI; - val.type = OPAL_STRING; - val.data.string = orte_process_info.my_daemon_uri; - if (OPAL_SUCCESS != (ret = opal_pmix.store_local(ORTE_PROC_MY_DAEMON, &val))) { - ORTE_ERROR_LOG(ret); - val.key = NULL; - val.data.string = NULL; - OBJ_DESTRUCT(&val); - error = "store DAEMON URI"; - goto error; - } - val.key = NULL; - val.data.string = NULL; - OBJ_DESTRUCT(&val); - } - - /* setup the errmgr */ - if (ORTE_SUCCESS != (ret = orte_errmgr_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_errmgr_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_select"); - - /* get a conduit for our use - we never route IO over fabric */ - OBJ_CONSTRUCT(&transports, opal_list_t); - orte_set_attribute(&transports, ORTE_RML_TRANSPORT_TYPE, - ORTE_ATTR_LOCAL, orte_mgmt_transport, OPAL_STRING); - if (ORTE_RML_CONDUIT_INVALID == (orte_mgmt_conduit = orte_rml.open_conduit(&transports))) { - ret = ORTE_ERR_OPEN_CONDUIT_FAIL; - error = "orte_rml_open_mgmt_conduit"; - goto error; - } - OPAL_LIST_DESTRUCT(&transports); - - OBJ_CONSTRUCT(&transports, opal_list_t); - orte_set_attribute(&transports, ORTE_RML_TRANSPORT_TYPE, - ORTE_ATTR_LOCAL, orte_coll_transport, OPAL_STRING); - if (ORTE_RML_CONDUIT_INVALID == (orte_coll_conduit = orte_rml.open_conduit(&transports))) { - ret = ORTE_ERR_OPEN_CONDUIT_FAIL; - error = "orte_rml_open_coll_conduit"; - goto error; - } - OPAL_LIST_DESTRUCT(&transports); - OPAL_TIMING_ENV_NEXT(ess_base_setup, "rml_open_conduit"); - - /* - * Group communications - */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_grpcomm_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_grpcomm_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_grpcomm_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_grpcomm_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "grpcomm_framework_open"); - - /* open the distributed file system */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_dfs_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_dfs_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_base_select"; - goto error; - } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "dfs_framework_open"); - - return ORTE_SUCCESS; - error: - orte_show_help("help-orte-runtime.txt", - "orte_init:startup:internal-failure", - true, error, ORTE_ERROR_NAME(ret), ret); - return ret; -} - -int orte_ess_base_app_finalize(void) -{ - /* release the conduits */ - orte_rml.close_conduit(orte_mgmt_conduit); - orte_rml.close_conduit(orte_coll_conduit); - - /* close frameworks */ - (void) mca_base_framework_close(&orte_filem_base_framework); - (void) mca_base_framework_close(&orte_errmgr_base_framework); - - /* now can close the rml and its friendly group comm */ - (void) mca_base_framework_close(&orte_grpcomm_base_framework); - (void) mca_base_framework_close(&orte_dfs_base_framework); - (void) mca_base_framework_close(&orte_routed_base_framework); - - (void) mca_base_framework_close(&orte_rml_base_framework); - if (NULL != opal_pmix.finalize) { - opal_pmix.finalize(); - (void) mca_base_framework_close(&opal_pmix_base_framework); - } - (void) mca_base_framework_close(&orte_oob_base_framework); - (void) mca_base_framework_close(&orte_state_base_framework); - - if (NULL == opal_pmix.register_cleanup) { - orte_session_dir_finalize(ORTE_PROC_MY_NAME); - } - /* cleanup the process info */ - orte_proc_info_finalize(); - - return ORTE_SUCCESS; -} - -/* - * We do NOT call the regular C-library "abort" function, even - * though that would have alerted us to the fact that this is - * an abnormal termination, because it would automatically cause - * a core file to be generated. On large systems, that can be - * overwhelming (imagine a few thousand Gbyte-sized files hitting - * a shared file system simultaneously...ouch!). - * - * However, this causes a problem for OpenRTE as the system truly - * needs to know that this actually IS an abnormal termination. - * To get around the problem, we drop a marker in the proc-level - * session dir. If session dir's were not allowed, then we just - * ignore this question. - * - * In some cases, however, we DON'T want to create that alert. For - * example, if an orted detects that the HNP has died, then there - * is truly nobody to alert! In these cases, we pass report=false - * to indicate that we don't want the marker dropped. - */ -void orte_ess_base_app_abort(int status, bool report) -{ - int fd; - char *myfile; - struct timespec tp = {0, 100000}; - - /* Exit - do NOT do a normal finalize as this will very likely - * hang the process. We are aborting due to an abnormal condition - * that precludes normal cleanup - * - * We do need to do the following bits to make sure we leave a - * clean environment. Taken from orte_finalize(): - * - Assume errmgr cleans up child processes before we exit. - */ - - /* If we were asked to report this termination, do so. - * Since singletons don't start an HNP unless necessary, and - * direct-launched procs don't have daemons at all, only send - * the message if routing is enabled as this indicates we - * have someone to send to - */ - if (report && orte_routing_is_enabled && orte_create_session_dirs) { - myfile = opal_os_path(false, orte_process_info.proc_session_dir, "aborted", NULL); - fd = open(myfile, O_CREAT, S_IRUSR); - close(fd); - /* now introduce a short delay to allow any pending - * messages (e.g., from a call to "show_help") to - * have a chance to be sent */ - nanosleep(&tp, NULL); - } - /* - Clean out the global structures - * (not really necessary, but good practice) */ - orte_proc_info_finalize(); - /* Now Exit */ - _exit(status); -} diff --git a/orte/mca/ess/lsf/ess_lsf_module.c b/orte/mca/ess/lsf/ess_lsf_module.c index 18d3ddc5546..c2e5b4a004c 100644 --- a/orte/mca/ess/lsf/ess_lsf_module.c +++ b/orte/mca/ess/lsf/ess_lsf_module.c @@ -100,15 +100,6 @@ static int rte_init(void) } - /* otherwise, I must be an application process - use - * the default procedure to finish my setup - */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_setup(false))) { - ORTE_ERROR_LOG(ret); - error = "orte_ess_base_app_setup"; - goto error; - } - return ORTE_SUCCESS; error: @@ -137,14 +128,6 @@ static int rte_finalize(void) ORTE_ERROR_LOG(ret); } return ret; - } else { - /* otherwise, I must be an application process - * use the default procedure to finish - */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { - ORTE_ERROR_LOG(ret); - return ret; - } } return ORTE_SUCCESS;; diff --git a/orte/mca/ess/pmi/ess_pmi_module.c b/orte/mca/ess/pmi/ess_pmi_module.c index 1515ae98885..39518749ab1 100644 --- a/orte/mca/ess/pmi/ess_pmi_module.c +++ b/orte/mca/ess/pmi/ess_pmi_module.c @@ -45,6 +45,7 @@ #include "opal/util/opal_environ.h" #include "opal/util/output.h" +#include "opal/util/arch.h" #include "opal/util/argv.h" #include "opal/runtime/opal_progress_threads.h" #include "opal/class/opal_pointer_array.h" @@ -55,11 +56,15 @@ #include "opal/mca/pmix/base/base.h" #include "opal/util/timings.h" -#include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/errmgr/base/base.h" +#include "orte/mca/filem/base/base.h" #include "orte/mca/grpcomm/grpcomm.h" #include "orte/mca/rml/rml.h" +#include "orte/mca/rml/base/rml_contact.h" #include "orte/mca/schizo/schizo.h" +#include "orte/mca/state/base/base.h" #include "orte/util/proc_info.h" +#include "orte/util/session_dir.h" #include "orte/util/show_help.h" #include "orte/util/name_fns.h" #include "orte/util/pre_condition_transports.h" @@ -85,6 +90,7 @@ static bool added_transport_keys=false; static bool added_num_procs = false; static bool added_app_ctx = false; static bool progress_thread_running = false; +static bool direct_launched = false; /**** MODULE FUNCTIONS ****/ @@ -135,13 +141,17 @@ static int rte_init(void) opal_pmix_base_set_evbase(orte_event_base); OPAL_TIMING_ENV_NEXT(rte_init, "pmix_framework_open"); + /* see if we were direct launched */ + if (ORTE_SCHIZO_DIRECT_LAUNCHED == orte_schizo.check_launch_environment()) { + direct_launched = true; + } + /* initialize the selected module */ if (!opal_pmix.initialized() && (OPAL_SUCCESS != (ret = opal_pmix.init(NULL)))) { /* we cannot run - this could be due to being direct launched * without the required PMI support being built. Try to detect * that scenario and warn the user */ - if (ORTE_SCHIZO_DIRECT_LAUNCHED == orte_schizo.check_launch_environment() && - NULL != (envar = getenv("ORTE_SCHIZO_DETECTION"))) { + if (direct_launched && NULL != (envar = getenv("ORTE_SCHIZO_DETECTION"))) { if (0 == strcmp(envar, "SLURM")) { /* yes to both - so emit a hopefully helpful * error message and abort */ @@ -176,7 +186,7 @@ static int rte_init(void) pname.vpid = 0; OPAL_TIMING_ENV_NEXT(rte_init, "pmix_init"); - + /* get our local rank from PMI */ OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCAL_RANK, ORTE_PROC_MY_NAME, &u16ptr, OPAL_UINT16); @@ -412,12 +422,145 @@ static int rte_init(void) OPAL_TIMING_ENV_NEXT(rte_init, "pmix_set_locality"); /* now that we have all required info, complete the setup */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_setup(false))) { + /* + * stdout/stderr buffering + * If the user requested to override the default setting then do + * as they wish. + */ + if( orte_ess_base_std_buffering > -1 ) { + if( 0 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + } + else if( 1 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stderr, NULL, _IOLBF, 0); + } + else if( 2 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IOFBF, 0); + setvbuf(stderr, NULL, _IOFBF, 0); + } + } + + /* if I am an MPI app, we will let the MPI layer define and + * control the opal_proc_t structure. Otherwise, we need to + * do so here */ + if (ORTE_PROC_NON_MPI) { + orte_process_info.super.proc_name = *(opal_process_name_t*)ORTE_PROC_MY_NAME; + orte_process_info.super.proc_hostname = orte_process_info.nodename; + orte_process_info.super.proc_flags = OPAL_PROC_ALL_LOCAL; + orte_process_info.super.proc_arch = opal_local_arch; + opal_proc_local_set(&orte_process_info.super); + } + + /* open and setup the state machine */ + if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_state_base_framework, 0))) { ORTE_ERROR_LOG(ret); - error = "orte_ess_base_app_setup"; + error = "orte_state_base_open"; goto error; } - OPAL_TIMING_ENV_NEXT(rte_init, "ess_base_app_setup"); + if (ORTE_SUCCESS != (ret = orte_state_base_select())) { + ORTE_ERROR_LOG(ret); + error = "orte_state_base_select"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "state_framework_open"); + + /* open the errmgr */ + if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_errmgr_base_framework, 0))) { + ORTE_ERROR_LOG(ret); + error = "orte_errmgr_base_open"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_framework_open"); + + /* setup my session directory */ + if (orte_create_session_dirs) { + OPAL_OUTPUT_VERBOSE((2, orte_ess_base_framework.framework_output, + "%s setting up session dir with\n\ttmpdir: %s\n\thost %s", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + (NULL == orte_process_info.tmpdir_base) ? "UNDEF" : orte_process_info.tmpdir_base, + orte_process_info.nodename)); + if (ORTE_SUCCESS != (ret = orte_session_dir(true, ORTE_PROC_MY_NAME))) { + ORTE_ERROR_LOG(ret); + error = "orte_session_dir"; + goto error; + } + /* Once the session directory location has been established, set + the opal_output env file location to be in the + proc-specific session directory. */ + opal_output_set_output_file_info(orte_process_info.proc_session_dir, + "output-", NULL, NULL); + /* register the directory for cleanup */ + if (NULL != opal_pmix.register_cleanup) { + if (orte_standalone_operation) { + if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.top_session_dir, true, false, true))) { + ORTE_ERROR_LOG(ret); + error = "register cleanup"; + goto error; + } + } else { + if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.job_session_dir, true, false, false))) { + ORTE_ERROR_LOG(ret); + error = "register cleanup"; + goto error; + } + } + } + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "create_session_dirs"); + + /* if we have info on the HNP and local daemon, process it */ + if (NULL != orte_process_info.my_hnp_uri) { + /* we have to set the HNP's name, even though we won't route messages directly + * to it. This is required to ensure that we -do- send messages to the correct + * HNP name + */ + if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_hnp_uri, + ORTE_PROC_MY_HNP, NULL))) { + ORTE_ERROR_LOG(ret); + error = "orte_rml_parse_HNP"; + goto error; + } + } + if (NULL != orte_process_info.my_daemon_uri) { + opal_value_t val; + + /* extract the daemon's name so we can update the routing table */ + if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_daemon_uri, + ORTE_PROC_MY_DAEMON, NULL))) { + ORTE_ERROR_LOG(ret); + error = "orte_rml_parse_daemon"; + goto error; + } + /* Set the contact info in the database - this won't actually establish + * the connection, but just tells us how to reach the daemon + * if/when we attempt to send to it + */ + OBJ_CONSTRUCT(&val, opal_value_t); + val.key = OPAL_PMIX_PROC_URI; + val.type = OPAL_STRING; + val.data.string = orte_process_info.my_daemon_uri; + if (OPAL_SUCCESS != (ret = opal_pmix.store_local(ORTE_PROC_MY_DAEMON, &val))) { + ORTE_ERROR_LOG(ret); + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + error = "store DAEMON URI"; + goto error; + } + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + } + + /* setup the errmgr */ + if (ORTE_SUCCESS != (ret = orte_errmgr_base_select())) { + ORTE_ERROR_LOG(ret); + error = "orte_errmgr_base_select"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_select"); /* setup process binding */ if (ORTE_SUCCESS != (ret = orte_ess_base_proc_binding())) { @@ -464,7 +607,7 @@ static int rte_init(void) } } OPAL_TIMING_ENV_NEXT(rte_init, "rte_init_done"); - + return ORTE_SUCCESS; error: @@ -484,8 +627,6 @@ static int rte_init(void) static int rte_finalize(void) { - int ret; - /* remove the envars that we pushed into environ * so we leave that structure intact */ @@ -499,11 +640,21 @@ static int rte_finalize(void) unsetenv("OMPI_APP_CTX_NUM_PROCS"); } - /* use the default app procedure to finish */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { - ORTE_ERROR_LOG(ret); - return ret; + /* close frameworks */ + (void) mca_base_framework_close(&orte_filem_base_framework); + (void) mca_base_framework_close(&orte_errmgr_base_framework); + + if (NULL != opal_pmix.finalize) { + opal_pmix.finalize(); + (void) mca_base_framework_close(&opal_pmix_base_framework); + } + (void) mca_base_framework_close(&orte_state_base_framework); + + if (direct_launched) { + orte_session_dir_finalize(ORTE_PROC_MY_NAME); } + /* cleanup the process info */ + orte_proc_info_finalize(); /* release the event base */ if (progress_thread_running) { diff --git a/orte/mca/ess/singleton/ess_singleton_module.c b/orte/mca/ess/singleton/ess_singleton_module.c index 7729b9bc0fd..5ad506d28c6 100644 --- a/orte/mca/ess/singleton/ess_singleton_module.c +++ b/orte/mca/ess/singleton/ess_singleton_module.c @@ -39,9 +39,11 @@ #include #include "opal/hash_string.h" +#include "opal/util/arch.h" #include "opal/util/argv.h" #include "opal/util/opal_environ.h" #include "opal/util/path.h" +#include "opal/util/timings.h" #include "opal/runtime/opal_progress_threads.h" #include "opal/mca/installdirs/installdirs.h" #include "opal/mca/pmix/base/base.h" @@ -49,8 +51,11 @@ #include "orte/util/show_help.h" #include "orte/util/proc_info.h" -#include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/errmgr/base/base.h" +#include "orte/mca/filem/base/base.h" #include "orte/mca/plm/base/base.h" +#include "orte/mca/rml/base/rml_contact.h" +#include "orte/mca/state/base/base.h" #include "orte/util/name_fns.h" #include "orte/runtime/orte_globals.h" #include "orte/util/session_dir.h" @@ -272,15 +277,196 @@ static int rte_init(void) } } - /* use the std app init to complete the procedure */ - if (ORTE_SUCCESS != (rc = orte_ess_base_app_setup(true))) { - ORTE_ERROR_LOG(rc); - return rc; + /* now that we have all required info, complete the setup */ + /* + * stdout/stderr buffering + * If the user requested to override the default setting then do + * as they wish. + */ + if( orte_ess_base_std_buffering > -1 ) { + if( 0 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IONBF, 0); + setvbuf(stderr, NULL, _IONBF, 0); + } + else if( 1 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IOLBF, 0); + setvbuf(stderr, NULL, _IOLBF, 0); + } + else if( 2 == orte_ess_base_std_buffering ) { + setvbuf(stdout, NULL, _IOFBF, 0); + setvbuf(stderr, NULL, _IOFBF, 0); + } + } + + /* if I am an MPI app, we will let the MPI layer define and + * control the opal_proc_t structure. Otherwise, we need to + * do so here */ + if (ORTE_PROC_NON_MPI) { + orte_process_info.super.proc_name = *(opal_process_name_t*)ORTE_PROC_MY_NAME; + orte_process_info.super.proc_hostname = orte_process_info.nodename; + orte_process_info.super.proc_flags = OPAL_PROC_ALL_LOCAL; + orte_process_info.super.proc_arch = opal_local_arch; + opal_proc_local_set(&orte_process_info.super); + } + + /* open and setup the state machine */ + if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_state_base_framework, 0))) { + ORTE_ERROR_LOG(ret); + error = "orte_state_base_open"; + goto error; + } + if (ORTE_SUCCESS != (ret = orte_state_base_select())) { + ORTE_ERROR_LOG(ret); + error = "orte_state_base_select"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "state_framework_open"); + + /* open the errmgr */ + if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_errmgr_base_framework, 0))) { + ORTE_ERROR_LOG(ret); + error = "orte_errmgr_base_open"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_framework_open"); + + /* setup my session directory */ + if (orte_create_session_dirs) { + OPAL_OUTPUT_VERBOSE((2, orte_ess_base_framework.framework_output, + "%s setting up session dir with\n\ttmpdir: %s\n\thost %s", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + (NULL == orte_process_info.tmpdir_base) ? "UNDEF" : orte_process_info.tmpdir_base, + orte_process_info.nodename)); + if (ORTE_SUCCESS != (ret = orte_session_dir(true, ORTE_PROC_MY_NAME))) { + ORTE_ERROR_LOG(ret); + error = "orte_session_dir"; + goto error; + } + /* Once the session directory location has been established, set + the opal_output env file location to be in the + proc-specific session directory. */ + opal_output_set_output_file_info(orte_process_info.proc_session_dir, + "output-", NULL, NULL); + /* register the directory for cleanup */ + if (NULL != opal_pmix.register_cleanup) { + if (orte_standalone_operation) { + if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.top_session_dir, true, false, true))) { + ORTE_ERROR_LOG(ret); + error = "register cleanup"; + goto error; + } + } else { + if (OPAL_SUCCESS != (ret = opal_pmix.register_cleanup(orte_process_info.job_session_dir, true, false, false))) { + ORTE_ERROR_LOG(ret); + error = "register cleanup"; + goto error; + } + } + } + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "create_session_dirs"); + + /* if we have info on the HNP and local daemon, process it */ + if (NULL != orte_process_info.my_hnp_uri) { + /* we have to set the HNP's name, even though we won't route messages directly + * to it. This is required to ensure that we -do- send messages to the correct + * HNP name + */ + if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_hnp_uri, + ORTE_PROC_MY_HNP, NULL))) { + ORTE_ERROR_LOG(ret); + error = "orte_rml_parse_HNP"; + goto error; + } + } + if (NULL != orte_process_info.my_daemon_uri) { + opal_value_t val; + + /* extract the daemon's name so we can update the routing table */ + if (ORTE_SUCCESS != (ret = orte_rml_base_parse_uris(orte_process_info.my_daemon_uri, + ORTE_PROC_MY_DAEMON, NULL))) { + ORTE_ERROR_LOG(ret); + error = "orte_rml_parse_daemon"; + goto error; + } + /* Set the contact info in the database - this won't actually establish + * the connection, but just tells us how to reach the daemon + * if/when we attempt to send to it + */ + OBJ_CONSTRUCT(&val, opal_value_t); + val.key = OPAL_PMIX_PROC_URI; + val.type = OPAL_STRING; + val.data.string = orte_process_info.my_daemon_uri; + if (OPAL_SUCCESS != (ret = opal_pmix.store_local(ORTE_PROC_MY_DAEMON, &val))) { + ORTE_ERROR_LOG(ret); + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + error = "store DAEMON URI"; + goto error; + } + val.key = NULL; + val.data.string = NULL; + OBJ_DESTRUCT(&val); + } + + /* setup the errmgr */ + if (ORTE_SUCCESS != (ret = orte_errmgr_base_select())) { + ORTE_ERROR_LOG(ret); + error = "orte_errmgr_base_select"; + goto error; + } + OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_select"); + + /* setup process binding */ + if (ORTE_SUCCESS != (ret = orte_ess_base_proc_binding())) { + error = "proc_binding"; + goto error; + } + OPAL_TIMING_ENV_NEXT(rte_init, "ess_base_proc_binding"); + + /* this needs to be set to enable debugger use when direct launched */ + if (NULL == orte_process_info.my_daemon_uri) { + orte_standalone_operation = true; + } + + /* set max procs */ + if (orte_process_info.max_procs < orte_process_info.num_procs) { + orte_process_info.max_procs = orte_process_info.num_procs; } + /* push our hostname so others can find us, if they need to - the + * native PMIx component will ignore this request as the hostname + * is provided by the system */ + OPAL_MODEX_SEND_VALUE(ret, OPAL_PMIX_GLOBAL, OPAL_PMIX_HOSTNAME, orte_process_info.nodename, OPAL_STRING); + if (ORTE_SUCCESS != ret) { + error = "db store hostname"; + goto error; + } + + /* if we are an ORTE app - and not an MPI app - then + * we need to exchange our connection info here. + * MPI_Init has its own modex, so we don't need to do + * two of them. However, if we don't do a modex at all, + * then processes have no way to communicate + * + * NOTE: only do this when the process originally launches. + * Cannot do this on a restart as the rest of the processes + * in the job won't be executing this step, so we would hang + */ + if (ORTE_PROC_IS_NON_MPI && !orte_do_not_barrier) { + /* need to commit the data before we fence */ + opal_pmix.commit(); + if (ORTE_SUCCESS != (ret = opal_pmix.fence(NULL, 0))) { + error = "opal_pmix.fence() failed"; + goto error; + } + } + OPAL_TIMING_ENV_NEXT(rte_init, "rte_init_done"); + return ORTE_SUCCESS; - error: + error: if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) { orte_show_help("help-orte-runtime.txt", "orte_init:startup:internal-failure", @@ -291,8 +477,6 @@ static int rte_init(void) static int rte_finalize(void) { - int ret; - /* remove the envars that we pushed into environ * so we leave that structure intact */ @@ -311,10 +495,9 @@ static int rte_finalize(void) unsetenv("PMIX_SERVER_URI"); unsetenv("PMIX_SECURITY_MODE"); } - /* use the default procedure to finish */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { - ORTE_ERROR_LOG(ret); - } + /* close frameworks */ + (void) mca_base_framework_close(&orte_filem_base_framework); + (void) mca_base_framework_close(&orte_errmgr_base_framework); /* mark us as finalized */ if (NULL != opal_pmix.finalize) { @@ -322,12 +505,18 @@ static int rte_finalize(void) (void) mca_base_framework_close(&opal_pmix_base_framework); } + (void) mca_base_framework_close(&orte_state_base_framework); + orte_session_dir_finalize(ORTE_PROC_MY_NAME); + + /* cleanup the process info */ + orte_proc_info_finalize(); + /* release the event base */ if (progress_thread_running) { opal_progress_thread_finalize(NULL); progress_thread_running = false; } - return ret; + return ORTE_SUCCESS; } #define ORTE_URI_MSG_LGTH 256 diff --git a/orte/mca/ess/slurm/ess_slurm_module.c b/orte/mca/ess/slurm/ess_slurm_module.c index 47dddbed492..97621c80372 100644 --- a/orte/mca/ess/slurm/ess_slurm_module.c +++ b/orte/mca/ess/slurm/ess_slurm_module.c @@ -125,14 +125,6 @@ static int rte_finalize(void) ORTE_ERROR_LOG(ret); } return ret; - } else { - /* otherwise, I must be an application process - * use the default procedure to finish - */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { - ORTE_ERROR_LOG(ret); - return ret; - } } return ORTE_SUCCESS; diff --git a/orte/mca/ess/tm/ess_tm_module.c b/orte/mca/ess/tm/ess_tm_module.c index 20373798c42..431280c74aa 100644 --- a/orte/mca/ess/tm/ess_tm_module.c +++ b/orte/mca/ess/tm/ess_tm_module.c @@ -129,14 +129,6 @@ static int rte_finalize(void) ORTE_ERROR_LOG(ret); } return ret; - } else { - /* otherwise, I must be an application process - * use the default procedure to finish - */ - if (ORTE_SUCCESS != (ret = orte_ess_base_app_finalize())) { - ORTE_ERROR_LOG(ret); - return ret; - } } return ORTE_SUCCESS; From 2536b4f8697ca4a0c12b483415a9bcc63b55d031 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 2 Oct 2018 11:54:57 -0700 Subject: [PATCH 308/674] Remove stale ORTE code Functionality moved to PMIx Signed-off-by: Ralph Castain (cherry picked from commit cfdd08d309d9ebc48229f0ca68ceec64a7e6389f) --- orte/mca/dfs/Makefile.am | 27 - orte/mca/dfs/app/Makefile.am | 36 - orte/mca/dfs/app/dfs_app.c | 1315 --------- orte/mca/dfs/app/dfs_app.h | 35 - orte/mca/dfs/app/dfs_app_component.c | 85 - orte/mca/dfs/app/owner.txt | 7 - orte/mca/dfs/base/Makefile.am | 15 - orte/mca/dfs/base/base.h | 82 - orte/mca/dfs/base/dfs_base_frame.c | 163 -- orte/mca/dfs/base/dfs_base_select.c | 56 - orte/mca/dfs/base/owner.txt | 7 - orte/mca/dfs/dfs.h | 184 -- orte/mca/dfs/dfs_types.h | 76 - orte/mca/dfs/orted/Makefile.am | 36 - orte/mca/dfs/orted/dfs_orted.c | 2388 ----------------- orte/mca/dfs/orted/dfs_orted.h | 38 - orte/mca/dfs/orted/dfs_orted_component.c | 101 - orte/mca/dfs/orted/owner.txt | 7 - orte/mca/dfs/test/Makefile.am | 36 - orte/mca/dfs/test/dfs_test.c | 1149 -------- orte/mca/dfs/test/dfs_test.h | 35 - orte/mca/dfs/test/dfs_test_component.c | 100 - orte/mca/ess/alps/ess_alps_module.c | 2 +- orte/mca/ess/base/base.h | 2 +- orte/mca/ess/base/ess_base_std_orted.c | 15 - orte/mca/ess/env/ess_env_module.c | 2 +- orte/mca/ess/hnp/ess_hnp_module.c | 14 - orte/mca/ess/lsf/ess_lsf_module.c | 2 +- orte/mca/ess/singleton/ess_singleton_module.c | 27 +- orte/mca/ess/slurm/ess_slurm_module.c | 2 +- orte/mca/ess/tm/ess_tm_module.c | 2 +- orte/mca/notifier/Makefile.am | 39 - orte/mca/notifier/base/Makefile.am | 27 - orte/mca/notifier/base/base.h | 87 - orte/mca/notifier/base/notifier_base_fns.c | 200 -- orte/mca/notifier/base/notifier_base_frame.c | 266 -- orte/mca/notifier/base/notifier_base_select.c | 127 - orte/mca/notifier/notifier.h | 234 -- orte/mca/notifier/smtp/.opal_ignore | 0 orte/mca/notifier/smtp/Makefile.am | 54 - orte/mca/notifier/smtp/configure.m4 | 39 - .../notifier/smtp/help-orte-notifier-smtp.txt | 33 - orte/mca/notifier/smtp/notifier_smtp.h | 68 - .../notifier/smtp/notifier_smtp_component.c | 197 -- orte/mca/notifier/smtp/notifier_smtp_module.c | 316 --- orte/mca/notifier/syslog/Makefile.am | 47 - orte/mca/notifier/syslog/configure.m4 | 31 - orte/mca/notifier/syslog/notifier_syslog.h | 40 - .../syslog/notifier_syslog_component.c | 60 - .../notifier/syslog/notifier_syslog_module.c | 132 - orte/mca/odls/base/odls_base_default_fns.c | 17 - orte/tools/orterun/orterun.c | 3 +- orte/util/attr.c | 2 - orte/util/attr.h | 1 - 54 files changed, 32 insertions(+), 8034 deletions(-) delete mode 100644 orte/mca/dfs/Makefile.am delete mode 100644 orte/mca/dfs/app/Makefile.am delete mode 100644 orte/mca/dfs/app/dfs_app.c delete mode 100644 orte/mca/dfs/app/dfs_app.h delete mode 100644 orte/mca/dfs/app/dfs_app_component.c delete mode 100644 orte/mca/dfs/app/owner.txt delete mode 100644 orte/mca/dfs/base/Makefile.am delete mode 100644 orte/mca/dfs/base/base.h delete mode 100644 orte/mca/dfs/base/dfs_base_frame.c delete mode 100644 orte/mca/dfs/base/dfs_base_select.c delete mode 100644 orte/mca/dfs/base/owner.txt delete mode 100644 orte/mca/dfs/dfs.h delete mode 100644 orte/mca/dfs/dfs_types.h delete mode 100644 orte/mca/dfs/orted/Makefile.am delete mode 100644 orte/mca/dfs/orted/dfs_orted.c delete mode 100644 orte/mca/dfs/orted/dfs_orted.h delete mode 100644 orte/mca/dfs/orted/dfs_orted_component.c delete mode 100644 orte/mca/dfs/orted/owner.txt delete mode 100644 orte/mca/dfs/test/Makefile.am delete mode 100644 orte/mca/dfs/test/dfs_test.c delete mode 100644 orte/mca/dfs/test/dfs_test.h delete mode 100644 orte/mca/dfs/test/dfs_test_component.c delete mode 100644 orte/mca/notifier/Makefile.am delete mode 100644 orte/mca/notifier/base/Makefile.am delete mode 100644 orte/mca/notifier/base/base.h delete mode 100644 orte/mca/notifier/base/notifier_base_fns.c delete mode 100644 orte/mca/notifier/base/notifier_base_frame.c delete mode 100644 orte/mca/notifier/base/notifier_base_select.c delete mode 100644 orte/mca/notifier/notifier.h delete mode 100644 orte/mca/notifier/smtp/.opal_ignore delete mode 100644 orte/mca/notifier/smtp/Makefile.am delete mode 100644 orte/mca/notifier/smtp/configure.m4 delete mode 100644 orte/mca/notifier/smtp/help-orte-notifier-smtp.txt delete mode 100644 orte/mca/notifier/smtp/notifier_smtp.h delete mode 100644 orte/mca/notifier/smtp/notifier_smtp_component.c delete mode 100644 orte/mca/notifier/smtp/notifier_smtp_module.c delete mode 100644 orte/mca/notifier/syslog/Makefile.am delete mode 100644 orte/mca/notifier/syslog/configure.m4 delete mode 100644 orte/mca/notifier/syslog/notifier_syslog.h delete mode 100644 orte/mca/notifier/syslog/notifier_syslog_component.c delete mode 100644 orte/mca/notifier/syslog/notifier_syslog_module.c diff --git a/orte/mca/dfs/Makefile.am b/orte/mca/dfs/Makefile.am deleted file mode 100644 index c374dfcff8a..00000000000 --- a/orte/mca/dfs/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# main library setup -noinst_LTLIBRARIES = libmca_dfs.la -libmca_dfs_la_SOURCES = - -# local files -headers = dfs.h dfs_types.h -libmca_dfs_la_SOURCES += $(headers) - -# Conditionally install the header files -if WANT_INSTALL_HEADERS -ortedir = $(orteincludedir)/$(subdir) -nobase_orte_HEADERS = $(headers) -endif - -include base/Makefile.am - -distclean-local: - rm -f base/static-components.h diff --git a/orte/mca/dfs/app/Makefile.am b/orte/mca/dfs/app/Makefile.am deleted file mode 100644 index 7c86273e46b..00000000000 --- a/orte/mca/dfs/app/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - dfs_app.h \ - dfs_app_component.c \ - dfs_app.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_dfs_app_DSO -component_noinst = -component_install = mca_dfs_app.la -else -component_noinst = libmca_dfs_app.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_dfs_app_la_SOURCES = $(sources) -mca_dfs_app_la_LDFLAGS = -module -avoid-version -mca_dfs_app_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_dfs_app_la_SOURCES =$(sources) -libmca_dfs_app_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/dfs/app/dfs_app.c b/orte/mca/dfs/app/dfs_app.c deleted file mode 100644 index 33676f5095a..00000000000 --- a/orte/mca/dfs/app/dfs_app.c +++ /dev/null @@ -1,1315 +0,0 @@ -/* - * Copyright (c) 2012-2013 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#include "opal/util/if.h" -#include "opal/util/output.h" -#include "opal/util/uri.h" -#include "opal/dss/dss.h" -#include "opal/mca/pmix/pmix.h" - -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" -#include "orte/util/proc_info.h" -#include "orte/util/show_help.h" -#include "orte/util/threads.h" -#include "orte/runtime/orte_globals.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/rml/rml.h" - -#include "orte/mca/dfs/base/base.h" -#include "dfs_app.h" - -/* - * Module functions: Global - */ -static int init(void); -static int finalize(void); - -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata); -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata); -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata); -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata); -static void dfs_post_file_map(opal_buffer_t *bo, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata); -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *bo, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata); -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata); - -/****************** - * APP module - ******************/ -orte_dfs_base_module_t orte_dfs_app_module = { - init, - finalize, - dfs_open, - dfs_close, - dfs_get_file_size, - dfs_seek, - dfs_read, - dfs_post_file_map, - dfs_get_file_map, - dfs_load_file_maps, - dfs_purge_file_maps -}; - -static opal_list_t requests, active_files; -static int local_fd = 0; -static uint64_t req_id = 0; -static void recv_dfs(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata); - -static int init(void) -{ - OBJ_CONSTRUCT(&requests, opal_list_t); - OBJ_CONSTRUCT(&active_files, opal_list_t); - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, - ORTE_RML_TAG_DFS_DATA, - ORTE_RML_PERSISTENT, - recv_dfs, - NULL); - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - opal_list_item_t *item; - - orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DFS_DATA); - while (NULL != (item = opal_list_remove_first(&requests))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&requests); - while (NULL != (item = opal_list_remove_first(&active_files))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&active_files); - return ORTE_SUCCESS; -} - -/* receives take place in an event, so we are free to process - * the request list without fear of getting things out-of-order - */ -static void recv_dfs(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata) -{ - orte_dfs_cmd_t cmd; - int32_t cnt; - orte_dfs_request_t *dfs, *dptr; - opal_list_item_t *item; - int remote_fd, rc; - int64_t i64; - uint64_t rid; - orte_dfs_tracker_t *trk; - - /* unpack the command this message is responding to */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &cmd, &cnt, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd cmd %d from sender %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int)cmd, - ORTE_NAME_PRINT(sender)); - - switch (cmd) { - case ORTE_DFS_OPEN_CMD: - /* unpack the request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the remote fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &remote_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* as the request has been fulfilled, remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - - /* if the remote_fd < 0, then we had an error, so return - * the error value to the caller - */ - if (remote_fd < 0) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file response error file %s [error: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(remote_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - return; - } - /* otherwise, create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = ORTE_PROC_MY_NAME->jobid; - trk->requestor.vpid = ORTE_PROC_MY_NAME->vpid; - trk->host_daemon.jobid = sender->jobid; - trk->host_daemon.vpid = sender->vpid; - trk->uri = strdup(dfs->uri); - /* break the uri down into scheme and filename */ - trk->scheme = opal_uri_get_scheme(dfs->uri); - trk->filename = opal_filename_from_uri(dfs->uri, NULL); - /* define the local fd */ - trk->local_fd = local_fd++; - /* record the remote file descriptor */ - trk->remote_fd = remote_fd; - /* add it to our list of active files */ - opal_list_append(&active_files, &trk->super); - /* return the local_fd to the caller for - * subsequent operations - */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file completed for file %s [local fd: %d remote fd: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, trk->local_fd, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(trk->local_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_SIZE_CMD: - /* unpack the request id for this request */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd size - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the size */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - /* pass it back to the original caller */ - if (NULL != dfs->size_cbfunc) { - dfs->size_cbfunc(i64, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_SEEK_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd seek - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the returned offset/status */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - /* pass it back to the original caller */ - if (NULL != dfs->seek_cbfunc) { - dfs->seek_cbfunc(i64, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_READ_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd read - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the bytes read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - if (0 < i64) { - cnt = i64; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, dfs->read_buffer, &cnt, OPAL_UINT8))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - } - /* pass them back to the original caller */ - if (NULL != dfs->read_cbfunc) { - dfs->read_cbfunc(i64, dfs->read_buffer, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_POST_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd post - no corresponding request found", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - if (NULL != dfs->post_cbfunc) { - dfs->post_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_GETFM_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd getfm - no corresponding request found", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* return it to caller */ - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(buffer, dfs->cbdata); - } - OBJ_RELEASE(dfs); - break; - - default: - opal_output(0, "APP:DFS:RECV WTF"); - break; - } -} - -static void open_local_file(orte_dfs_request_t *dfs) -{ - char *filename; - orte_dfs_tracker_t *trk; - - /* extract the filename from the uri */ - if (NULL == (filename = opal_filename_from_uri(dfs->uri, NULL))) { - /* something wrong - error was reported, so just get out */ - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(-1, dfs->cbdata); - } - OBJ_RELEASE(dfs); - return; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening local file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - /* attempt to open the file */ - if (0 > (dfs->remote_fd = open(filename, O_RDONLY))) { - ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(dfs->remote_fd, dfs->cbdata); - } - return; - } - /* otherwise, create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = ORTE_PROC_MY_NAME->jobid; - trk->requestor.vpid = ORTE_PROC_MY_NAME->vpid; - trk->uri = strdup(dfs->uri); - /* break the uri down into scheme and filename */ - trk->scheme = opal_uri_get_scheme(dfs->uri); - trk->filename = strdup(filename); - /* define the local fd */ - trk->local_fd = local_fd++; - /* record the remote file descriptor */ - trk->remote_fd = dfs->remote_fd; - /* add it to our list of active files */ - opal_list_append(&active_files, &trk->super); - /* the file is locally hosted */ - trk->host_daemon.jobid = ORTE_PROC_MY_DAEMON->jobid; - trk->host_daemon.vpid = ORTE_PROC_MY_DAEMON->vpid; - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local file %s mapped localfd %d to remotefd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename, trk->local_fd, trk->remote_fd); - /* let the caller know */ - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(trk->local_fd, dfs->cbdata); - } - /* request will be released by the calling routing */ -} - -static void process_opens(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - int rc; - opal_buffer_t *buffer; - char *scheme, *host, *filename; - orte_process_name_t daemon; - opal_list_t lt; - opal_namelist_t *nm; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* get the scheme to determine if we can process locally or not */ - if (NULL == (scheme = opal_uri_get_scheme(dfs->uri))) { - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - goto complete; - } - - if (0 == strcmp(scheme, "nfs")) { - open_local_file(dfs); - /* the callback was done in the above function */ - OBJ_RELEASE(dfs); - return; - } - - if (0 != strcmp(scheme, "file")) { - /* not yet supported */ - orte_show_help("orte_dfs_help.txt", "unsupported-filesystem", - true, dfs->uri); - goto complete; - } - - /* dissect the uri to extract host and filename/path */ - if (NULL == (filename = opal_filename_from_uri(dfs->uri, &host))) { - goto complete; - } - if (NULL == host) { - host = strdup(orte_process_info.nodename); - } - - /* if the host is our own, then treat it as a local file */ - if (orte_ifislocal(host)) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s file %s on local host", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - open_local_file(dfs); - /* the callback was done in the above function */ - OBJ_RELEASE(dfs); - return; - } - - /* ident the daemon on that host */ - daemon.jobid = ORTE_PROC_MY_DAEMON->jobid; - /* fetch the daemon for this hostname */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s looking for daemon on host %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), host); - OBJ_CONSTRUCT(<, opal_list_t); - if (ORTE_SUCCESS != (rc = opal_pmix.resolve_peers(host, daemon.jobid, <))) { - ORTE_ERROR_LOG(rc); - OBJ_DESTRUCT(<); - goto complete; - } - nm = (opal_namelist_t*)opal_list_get_first(<); - daemon.vpid = nm->name.vpid; - OPAL_LIST_DESTRUCT(<); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s file %s on host %s daemon %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename, host, ORTE_NAME_PRINT(&daemon)); - - /* double-check: if it is our local daemon, then we - * treat this as local - */ - if (daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local file %s on same daemon", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - open_local_file(dfs); - /* the callback was done in the above function */ - OBJ_RELEASE(dfs); - return; - } - - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* setup a message for the daemon telling - * them what file we want to access - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &filename, 1, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending open file request to %s file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&daemon), - filename); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* don't release it */ - return; - - complete: - /* we get here if an error occurred - execute any - * pending callback so the proc doesn't hang - */ - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(-1, dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - - -/* in order to handle the possible opening/reading of files by - * multiple threads, we have to ensure that all operations are - * carried out in events - so the "open" cmd simply posts an - * event containing the required info, and then returns - */ -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), uri); - - /* setup the request */ - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_OPEN_CMD; - dfs->uri = strdup(uri); - dfs->open_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_opens, ORTE_SYS_PRI); -} - -static void process_close(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *close_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(close_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s closing fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - close_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == close_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); - return; - } - - /* if the file is local, close it */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - close(trk->remote_fd); - goto complete; - } - - /* setup a message for the daemon telling - * them what file to close - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &close_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending close file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - - complete: - opal_list_remove_item(&active_files, &trk->super); - OBJ_RELEASE(trk); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); -} - -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s close called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_CLOSE_CMD; - dfs->local_fd = fd; - dfs->close_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_close, ORTE_SYS_PRI); -} - -static void process_sizes(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *size_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - struct stat buf; - - ORTE_ACQUIRE_OBJECT(size_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing get_size on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - size_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == size_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(size_dfs); - return; - } - - /* if the file is local, execute the seek on it - we - * stuck the "whence" value in the remote_fd - */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - /* stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(-1, size_dfs->cbdata); - } - } else { - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(buf.st_size, size_dfs->cbdata); - } - } - goto complete; - } - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - size_dfs->id = req_id++; - opal_list_append(&requests, &size_dfs->super); - - /* setup a message for the daemon telling - * them what file we want to access - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &size_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &size_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending get_size request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &size_dfs->super); - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(-1, size_dfs->cbdata); - } - goto complete; - } - /* leave the request there */ - return; - - complete: - OBJ_RELEASE(size_dfs); -} - -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s get_size called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SIZE_CMD; - dfs->local_fd = fd; - dfs->size_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_sizes, ORTE_SYS_PRI); -} - - -static void process_seeks(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *seek_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - struct stat buf; - - ORTE_ACQUIRE_OBJECT(seek_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing seek on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - seek_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == seek_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(seek_dfs); - return; - } - - /* if the file is local, execute the seek on it - we - * stuck the "whence" value in the remote_fd - */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local seek on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - seek_dfs->local_fd); - /* stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else if (buf.st_size < seek_dfs->read_length && - SEEK_SET == seek_dfs->remote_fd) { - /* seek would take us past EOF */ - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else if (buf.st_size < (off_t)(trk->location + seek_dfs->read_length) && - SEEK_CUR == seek_dfs->remote_fd) { - /* seek would take us past EOF */ - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else { - lseek(trk->remote_fd, seek_dfs->read_length, seek_dfs->remote_fd); - if (SEEK_SET == seek_dfs->remote_fd) { - trk->location = seek_dfs->read_length; - } else { - trk->location += seek_dfs->read_length; - } - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(seek_dfs->read_length, seek_dfs->cbdata); - } - } - goto complete; - } - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - seek_dfs->id = req_id++; - opal_list_append(&requests, &seek_dfs->super); - - /* setup a message for the daemon telling - * them what file to seek - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &seek_dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)seek_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending seek file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - /* leave the request */ - return; - - complete: - OBJ_RELEASE(seek_dfs); -} - - -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SEEK_CMD; - dfs->local_fd = fd; - dfs->read_length = offset; - dfs->remote_fd = whence; - dfs->seek_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_seeks, ORTE_SYS_PRI); -} - -static void process_reads(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *read_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - long nbytes; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - - ORTE_ACQUIRE_OBJECT(read_dfs); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == read_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(read_dfs); - return; - } - - /* if the file is local, read the desired bytes */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - nbytes = read(trk->remote_fd, read_dfs->read_buffer, read_dfs->read_length); - if (0 < nbytes) { - /* update our location */ - trk->location += nbytes; - } - /* pass them back to the caller */ - if (NULL != read_dfs->read_cbfunc) { - read_dfs->read_cbfunc(nbytes, read_dfs->read_buffer, read_dfs->cbdata); - } - /* request is complete */ - OBJ_RELEASE(read_dfs); - return; - } - /* add this request to our pending list */ - read_dfs->id = req_id++; - opal_list_append(&requests, &read_dfs->super); - - /* setup a message for the daemon telling - * them what file to read - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)read_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending read file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - } - /* don't release the request */ - return; - - complete: - /* don't need to hang on to this request */ - opal_list_remove_item(&requests, &read_dfs->super); - OBJ_RELEASE(read_dfs); -} - -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_READ_CMD; - dfs->local_fd = fd; - dfs->read_buffer = buffer; - dfs->read_length = length; - dfs->read_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_reads, ORTE_SYS_PRI); -} - -static void process_posts(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* we will get confirmation in our receive function, so - * add this request to our list */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* Send the buffer's contents to our local daemon for storage */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* add my name */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* pack the payload */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->bptr, 1, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - ORTE_PROC_MY_DAEMON, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - goto error; - } - return; - - error: - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - if (NULL != dfs->post_cbfunc) { - dfs->post_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_post_file_map(opal_buffer_t *bo, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_POST_CMD; - dfs->bptr = bo; - dfs->post_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_posts, ORTE_SYS_PRI); -} - -static void process_getfm(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* we will get confirmation in our receive function, so - * add this request to our list */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* Send the request to our local daemon */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* and the target */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->target, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - ORTE_PROC_MY_DAEMON, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - goto error; - } - return; - - error: - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(NULL, dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_GETFM_CMD; - dfs->target.jobid = target->jobid; - dfs->target.vpid = target->vpid; - dfs->fm_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_getfm, ORTE_SYS_PRI); -} - -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *bo, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata) -{ - /* apps don't store file maps */ - if (NULL != cbfunc) { - cbfunc(cbdata); - } -} - -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata) -{ - /* apps don't store file maps */ - if (NULL != cbfunc) { - cbfunc(cbdata); - } -} diff --git a/orte/mca/dfs/app/dfs_app.h b/orte/mca/dfs/app/dfs_app.h deleted file mode 100644 index fef69fdf582..00000000000 --- a/orte/mca/dfs/app/dfs_app.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - */ - -#ifndef MCA_dfs_app_EXPORT_H -#define MCA_dfs_app_EXPORT_H - -#include "orte_config.h" - -#include "orte/mca/dfs/dfs.h" - -BEGIN_C_DECLS - -/* - * Local Component structures - */ - -ORTE_MODULE_DECLSPEC extern orte_dfs_base_component_t mca_dfs_app_component; - -ORTE_DECLSPEC extern orte_dfs_base_module_t orte_dfs_app_module; - -END_C_DECLS - -#endif /* MCA_dfs_app_EXPORT_H */ diff --git a/orte/mca/dfs/app/dfs_app_component.c b/orte/mca/dfs/app/dfs_app_component.c deleted file mode 100644 index 1479007ac0e..00000000000 --- a/orte/mca/dfs/app/dfs_app_component.c +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * Copyright (c) 2016 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "opal/util/output.h" - -#include "orte/runtime/orte_globals.h" - -#include "orte/mca/dfs/dfs.h" -#include "orte/mca/dfs/base/base.h" -#include "dfs_app.h" - -/* - * Public string for version number - */ -const char *orte_dfs_app_component_version_string = - "ORTE DFS app MCA component version " ORTE_VERSION; - -/* - * Local functionality - */ -static int dfs_app_open(void); -static int dfs_app_close(void); -static int dfs_app_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -orte_dfs_base_component_t mca_dfs_app_component = -{ - /* Handle the general mca_component_t struct containing - * meta information about the component - */ - .base_version = { - ORTE_DFS_BASE_VERSION_1_0_0, - /* Component name and version */ - .mca_component_name = "app", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = dfs_app_open, - .mca_close_component = dfs_app_close, - .mca_query_component = dfs_app_component_query, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int dfs_app_open(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_app_close(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_app_component_query(mca_base_module_t **module, int *priority) -{ - if (ORTE_PROC_IS_APP) { - /* set our priority high as we are the default for apps */ - *priority = 1000; - *module = (mca_base_module_t *)&orte_dfs_app_module; - return ORTE_SUCCESS; - } - - *priority = -1; - *module = NULL; - return ORTE_ERROR; -} diff --git a/orte/mca/dfs/app/owner.txt b/orte/mca/dfs/app/owner.txt deleted file mode 100644 index 4ad6f408ca3..00000000000 --- a/orte/mca/dfs/app/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: INTEL -status: maintenance diff --git a/orte/mca/dfs/base/Makefile.am b/orte/mca/dfs/base/Makefile.am deleted file mode 100644 index eb036387189..00000000000 --- a/orte/mca/dfs/base/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -# -# Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -headers += \ - base/base.h - -libmca_dfs_la_SOURCES += \ - base/dfs_base_select.c \ - base/dfs_base_frame.c diff --git a/orte/mca/dfs/base/base.h b/orte/mca/dfs/base/base.h deleted file mode 100644 index 8356b488cd7..00000000000 --- a/orte/mca/dfs/base/base.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** @file: - */ - -#ifndef ORTE_MCA_DFS_BASE_H -#define ORTE_MCA_DFS_BASE_H - -/* - * includes - */ -#include "orte_config.h" -#include "orte/types.h" -#include "orte/constants.h" - -#include "opal/class/opal_list.h" -#include "opal/mca/event/event.h" - -#include "orte/mca/mca.h" -#include "orte/mca/dfs/dfs.h" - - -BEGIN_C_DECLS - -/* - * MCA Framework - */ -ORTE_DECLSPEC extern mca_base_framework_t orte_dfs_base_framework; -/* select a component */ -ORTE_DECLSPEC int orte_dfs_base_select(void); - -/* tracker for active files */ -typedef struct { - opal_list_item_t super; - orte_process_name_t requestor; - orte_process_name_t host_daemon; - char *uri; - char *scheme; - char *filename; - int local_fd; - int remote_fd; - size_t location; -} orte_dfs_tracker_t; -OBJ_CLASS_DECLARATION(orte_dfs_tracker_t); - -/* requests */ -typedef struct { - opal_list_item_t super; - opal_event_t ev; - uint64_t id; - orte_dfs_cmd_t cmd; - orte_process_name_t target; - char *uri; - int local_fd; - int remote_fd; - uint8_t *read_buffer; - long read_length; - opal_buffer_t *bptr; - opal_buffer_t bucket; - orte_dfs_open_callback_fn_t open_cbfunc; - orte_dfs_close_callback_fn_t close_cbfunc; - orte_dfs_size_callback_fn_t size_cbfunc; - orte_dfs_seek_callback_fn_t seek_cbfunc; - orte_dfs_read_callback_fn_t read_cbfunc; - orte_dfs_post_callback_fn_t post_cbfunc; - orte_dfs_fm_callback_fn_t fm_cbfunc; - orte_dfs_load_callback_fn_t load_cbfunc; - orte_dfs_purge_callback_fn_t purge_cbfunc; - void *cbdata; -} orte_dfs_request_t; -OBJ_CLASS_DECLARATION(orte_dfs_request_t); - -END_C_DECLS - -#endif diff --git a/orte/mca/dfs/base/dfs_base_frame.c b/orte/mca/dfs/base/dfs_base_frame.c deleted file mode 100644 index 77ce6171423..00000000000 --- a/orte/mca/dfs/base/dfs_base_frame.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2013 Intel, Inc. All rights reserved - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#include "orte/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "opal/util/opal_environ.h" -#include "opal/util/output.h" - -#include "orte/util/show_help.h" -#include "orte/mca/dfs/base/base.h" - -#include "orte/mca/dfs/base/static-components.h" - -/* - * Globals - */ -orte_dfs_base_module_t orte_dfs = { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -static int orte_dfs_base_close(void) -{ - /* Close selected component */ - if (NULL != orte_dfs.finalize) { - orte_dfs.finalize(); - } - - return mca_base_framework_components_close(&orte_dfs_base_framework, NULL); -} - -/** - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -static int orte_dfs_base_open(mca_base_open_flag_t flags) -{ - /* Open up all available components */ - return mca_base_framework_components_open(&orte_dfs_base_framework, flags); -} - -MCA_BASE_FRAMEWORK_DECLARE(orte, dfs, "ORTE Distributed File System", - NULL, orte_dfs_base_open, orte_dfs_base_close, - mca_dfs_base_static_components, 0); - - -/* instantiate classes */ -static void trk_con(orte_dfs_tracker_t *trk) -{ - trk->host_daemon.jobid = ORTE_JOBID_INVALID; - trk->host_daemon.vpid = ORTE_VPID_INVALID; - trk->uri = NULL; - trk->scheme = NULL; - trk->filename = NULL; - trk->location = 0; -} -static void trk_des(orte_dfs_tracker_t *trk) -{ - if (NULL != trk->uri) { - free(trk->uri); - } - if (NULL != trk->scheme) { - free(trk->scheme); - } - if (NULL != trk->filename) { - free(trk->filename); - } -} -OBJ_CLASS_INSTANCE(orte_dfs_tracker_t, - opal_list_item_t, - trk_con, trk_des); -static void req_const(orte_dfs_request_t *dfs) -{ - dfs->id = 0; - dfs->uri = NULL; - dfs->local_fd = -1; - dfs->remote_fd = -1; - dfs->read_length = -1; - dfs->bptr = NULL; - OBJ_CONSTRUCT(&dfs->bucket, opal_buffer_t); - dfs->read_buffer = NULL; - dfs->open_cbfunc = NULL; - dfs->close_cbfunc = NULL; - dfs->size_cbfunc = NULL; - dfs->seek_cbfunc = NULL; - dfs->read_cbfunc = NULL; - dfs->post_cbfunc = NULL; - dfs->fm_cbfunc = NULL; - dfs->load_cbfunc = NULL; - dfs->purge_cbfunc = NULL; - dfs->cbdata = NULL; -} -static void req_dest(orte_dfs_request_t *dfs) -{ - if (NULL != dfs->uri) { - free(dfs->uri); - } - OBJ_DESTRUCT(&dfs->bucket); -} -OBJ_CLASS_INSTANCE(orte_dfs_request_t, - opal_list_item_t, - req_const, req_dest); - -static void jobfm_const(orte_dfs_jobfm_t *fm) -{ - OBJ_CONSTRUCT(&fm->maps, opal_list_t); -} -static void jobfm_dest(orte_dfs_jobfm_t *fm) -{ - opal_list_item_t *item; - - while (NULL != (item = opal_list_remove_first(&fm->maps))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&fm->maps); -} -OBJ_CLASS_INSTANCE(orte_dfs_jobfm_t, - opal_list_item_t, - jobfm_const, jobfm_dest); - -static void vpidfm_const(orte_dfs_vpidfm_t *fm) -{ - OBJ_CONSTRUCT(&fm->data, opal_buffer_t); - fm->num_entries = 0; -} -static void vpidfm_dest(orte_dfs_vpidfm_t *fm) -{ - OBJ_DESTRUCT(&fm->data); -} -OBJ_CLASS_INSTANCE(orte_dfs_vpidfm_t, - opal_list_item_t, - vpidfm_const, vpidfm_dest); diff --git a/orte/mca/dfs/base/dfs_base_select.c b/orte/mca/dfs/base/dfs_base_select.c deleted file mode 100644 index bf0a7c2d678..00000000000 --- a/orte/mca/dfs/base/dfs_base_select.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2012-2015 Los Alamos National Security, Inc. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "orte_config.h" -#include "orte/constants.h" - -#include - -#include "orte/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/util/output.h" - -#include "orte/mca/dfs/base/base.h" - -int orte_dfs_base_select(void) -{ - int exit_status = ORTE_SUCCESS; - orte_dfs_base_component_t *best_component = NULL; - orte_dfs_base_module_t *best_module = NULL; - - /* - * Select the best component - */ - if (OPAL_SUCCESS != mca_base_select("dfs", orte_dfs_base_framework.framework_output, - &orte_dfs_base_framework.framework_components, - (mca_base_module_t **) &best_module, - (mca_base_component_t **) &best_component, NULL)) { - /* This will only happen if no component was selected, which - * is okay - we don't have to select anything - */ - return ORTE_SUCCESS; - } - - /* Save the winner */ - orte_dfs = *best_module; - - /* Initialize the winner */ - if (NULL != best_module && NULL != orte_dfs.init) { - if (ORTE_SUCCESS != orte_dfs.init()) { - exit_status = ORTE_ERROR; - goto cleanup; - } - } - - cleanup: - return exit_status; -} diff --git a/orte/mca/dfs/base/owner.txt b/orte/mca/dfs/base/owner.txt deleted file mode 100644 index 4ad6f408ca3..00000000000 --- a/orte/mca/dfs/base/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: INTEL -status: maintenance diff --git a/orte/mca/dfs/dfs.h b/orte/mca/dfs/dfs.h deleted file mode 100644 index 136c0d76b67..00000000000 --- a/orte/mca/dfs/dfs.h +++ /dev/null @@ -1,184 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef ORTE_MCA_DFS_H -#define ORTE_MCA_DFS_H - -#include "orte_config.h" -#include "orte/types.h" - -#ifdef HAVE_FCNTL_H -#include -#endif - -#include "orte/mca/mca.h" -#include "opal/mca/base/base.h" - -#include "orte/mca/dfs/dfs_types.h" - -BEGIN_C_DECLS - -/* - * Framework Interfaces - */ -/** - * Module initialization function. - * - * @retval ORTE_SUCCESS The operation completed successfully - * @retval ORTE_ERROR An unspecifed error occurred - */ -typedef int (*orte_dfs_base_module_init_fn_t)(void); - -/** - * Module finalization function. - * - * @retval ORTE_SUCCESS The operation completed successfully - * @retval ORTE_ERROR An unspecifed error occurred - */ -typedef int (*orte_dfs_base_module_finalize_fn_t)(void); - -/* Open a file - * - * Open a possibly remote file for reading. The uri can include file - * system descriptions (e.g., file:///, nfs:///, or hdfs:///). Note - * that this is a full uri - i.e., it may include a hostname to - * indicate where the file is located - * - * The file descriptor will be returned in the cbfunc. It - * represents the number by which the file can be referenced, - * and will be an ORTE error code upon failure - */ -typedef void (*orte_dfs_base_module_open_fn_t)(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata); - -/* Close a file - * - * Closes and invalidates the file descriptor - */ -typedef void (*orte_dfs_base_module_close_fn_t)(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata); - -/* Get the size of a file - * - */ -typedef void (*orte_dfs_base_module_get_file_size_fn_t)(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata); - -/* Position a file - * - * Move the read position in the file to the specified byte number - * relative to the location specified by whence: - * SEEK_SET => from beginning of file - * SEEK_CUR => from current location - * - * The callback will return the offset, or a negative value if - * the requested seek would take the pointer past the end of the - * file. This is contrary to standard lseek behavior, but is consistent - * with the read-only nature of this framework - */ -typedef void (*orte_dfs_base_module_seek_fn_t)(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata); - -/* Read bytes from a possibly remote file - * - * Read the specified number of bytes from the given file, using the - * specified offset (in bytes). The status returned in cbfunc is the actual number - * of bytes read, which should match the request unless the requested - * length/offset would read past the end of file. An ORTE error code - * will be returned upon error - * - * Note: the caller is responsible for ensuring the buffer is at least - * length bytes in size - */ -typedef void (*orte_dfs_base_module_read_fn_t)(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata); - - -/* Post a file map so others may access it */ -typedef void (*orte_dfs_base_module_post_file_map_fn_t)(opal_buffer_t *buf, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata); - -/* Get the file map for a process - * - * Returns the file map associated with the specified process name. If - * NULL is provided, then all known process maps will be returned in the - * byte object. It is the responsibility of the caller to unpack it, so - * applications are free to specify whatever constitutes a "file map" that - * suits their purposes - */ -typedef void (*orte_dfs_base_module_get_file_map_fn_t)(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata); - - -/* Load file maps for a job - */ -typedef void (*orte_dfs_base_module_load_file_maps_fn_t)(orte_jobid_t jobid, - opal_buffer_t *buf, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata); - -/* Purge file maps for a job */ -typedef void (*orte_dfs_base_module_purge_file_maps_fn_t)(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata); - -/* - * Module Structure - */ -struct orte_dfs_base_module_1_0_0_t { - /** Initialization Function */ - orte_dfs_base_module_init_fn_t init; - /** Finalization Function */ - orte_dfs_base_module_finalize_fn_t finalize; - - orte_dfs_base_module_open_fn_t open; - orte_dfs_base_module_close_fn_t close; - orte_dfs_base_module_get_file_size_fn_t get_file_size; - orte_dfs_base_module_seek_fn_t seek; - orte_dfs_base_module_read_fn_t read; - orte_dfs_base_module_post_file_map_fn_t post_file_map; - orte_dfs_base_module_get_file_map_fn_t get_file_map; - orte_dfs_base_module_load_file_maps_fn_t load_file_maps; - orte_dfs_base_module_purge_file_maps_fn_t purge_file_maps; -}; -typedef struct orte_dfs_base_module_1_0_0_t orte_dfs_base_module_1_0_0_t; -typedef orte_dfs_base_module_1_0_0_t orte_dfs_base_module_t; -ORTE_DECLSPEC extern orte_dfs_base_module_t orte_dfs; - -/* - * DFS Component - */ -struct orte_dfs_base_component_1_0_0_t { - /** MCA base component */ - mca_base_component_t base_version; - /** MCA base data */ - mca_base_component_data_t base_data; -}; -typedef struct orte_dfs_base_component_1_0_0_t orte_dfs_base_component_1_0_0_t; -typedef orte_dfs_base_component_1_0_0_t orte_dfs_base_component_t; - -/* - * Macro for use in components that are of type errmgr - */ -#define ORTE_DFS_BASE_VERSION_1_0_0 \ - ORTE_MCA_BASE_VERSION_2_1_0("dfs", 1, 0, 0) - -END_C_DECLS - -#endif diff --git a/orte/mca/dfs/dfs_types.h b/orte/mca/dfs/dfs_types.h deleted file mode 100644 index 1f3e088e1d8..00000000000 --- a/orte/mca/dfs/dfs_types.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef ORTE_MCA_DFS_TYPES_H -#define ORTE_MCA_DFS_TYPES_H - -#include "orte_config.h" - -#include "opal/class/opal_list.h" -#include "opal/dss/dss_types.h" -#include "opal/util/proc.h" - -BEGIN_C_DECLS - -typedef uint8_t orte_dfs_cmd_t; -#define ORTE_DFS_CMD_T OPAL_UINT8 - -#define ORTE_DFS_OPEN_CMD 1 -#define ORTE_DFS_CLOSE_CMD 2 -#define ORTE_DFS_SIZE_CMD 3 -#define ORTE_DFS_SEEK_CMD 4 -#define ORTE_DFS_READ_CMD 5 -#define ORTE_DFS_POST_CMD 6 -#define ORTE_DFS_GETFM_CMD 7 -#define ORTE_DFS_LOAD_CMD 8 -#define ORTE_DFS_PURGE_CMD 9 -#define ORTE_DFS_RELAY_POSTS_CMD 10 - -/* file maps */ -typedef struct { - opal_list_item_t super; - orte_jobid_t jobid; - opal_list_t maps; -} orte_dfs_jobfm_t; -ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_dfs_jobfm_t); - -typedef struct { - opal_list_item_t super; - orte_vpid_t vpid; - int num_entries; - opal_buffer_t data; -} orte_dfs_vpidfm_t; -ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_dfs_vpidfm_t); - -typedef void (*orte_dfs_open_callback_fn_t)(int fd, void *cbdata); - -typedef void (*orte_dfs_close_callback_fn_t)(int fd, void *cbdata); - -typedef void (*orte_dfs_size_callback_fn_t)(long size, void *cbdata); - -typedef void (*orte_dfs_seek_callback_fn_t)(long offset, void *cbdata); - -typedef void (*orte_dfs_read_callback_fn_t)(long status, - uint8_t *buffer, - void *cbdata); - -typedef void (*orte_dfs_post_callback_fn_t)(void *cbdata); - -typedef void (*orte_dfs_fm_callback_fn_t)(opal_buffer_t *fmaps, void *cbdata); - -typedef void (*orte_dfs_load_callback_fn_t)(void *cbdata); - -typedef void (*orte_dfs_purge_callback_fn_t)(void *cbdata); - -END_C_DECLS - -#endif diff --git a/orte/mca/dfs/orted/Makefile.am b/orte/mca/dfs/orted/Makefile.am deleted file mode 100644 index 90946f6f4c6..00000000000 --- a/orte/mca/dfs/orted/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - dfs_orted.h \ - dfs_orted_component.c \ - dfs_orted.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_dfs_orted_DSO -component_noinst = -component_install = mca_dfs_orted.la -else -component_noinst = libmca_dfs_orted.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_dfs_orted_la_SOURCES = $(sources) -mca_dfs_orted_la_LDFLAGS = -module -avoid-version -mca_dfs_orted_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_dfs_orted_la_SOURCES =$(sources) -libmca_dfs_orted_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/dfs/orted/dfs_orted.c b/orte/mca/dfs/orted/dfs_orted.c deleted file mode 100644 index ee3c9d5a338..00000000000 --- a/orte/mca/dfs/orted/dfs_orted.c +++ /dev/null @@ -1,2388 +0,0 @@ -/* - * Copyright (c) 2012-2013 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#include "opal/util/if.h" -#include "opal/util/output.h" -#include "opal/util/uri.h" -#include "opal/dss/dss.h" - -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" -#include "orte/util/proc_info.h" -#include "orte/util/session_dir.h" -#include "orte/util/show_help.h" -#include "orte/util/threads.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/state/state.h" - -#include "orte/runtime/orte_quit.h" -#include "orte/runtime/orte_globals.h" - -#include "orte/mca/dfs/dfs.h" -#include "orte/mca/dfs/base/base.h" -#include "dfs_orted.h" - -/* - * Module functions: Global - */ -static int init(void); -static int finalize(void); - -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata); -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata); -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata); -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata); -static void dfs_post_file_map(opal_buffer_t *bo, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata); -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *bo, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata); -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata); -/****************** - * Daemon/HNP module - ******************/ -orte_dfs_base_module_t orte_dfs_orted_module = { - init, - finalize, - dfs_open, - dfs_close, - dfs_get_file_size, - dfs_seek, - dfs_read, - dfs_post_file_map, - dfs_get_file_map, - dfs_load_file_maps, - dfs_purge_file_maps -}; - -static void* worker_thread_engine(opal_object_t *obj); - -typedef struct { - opal_object_t super; - int idx; - opal_event_base_t *event_base; - bool active; - opal_thread_t thread; -} worker_thread_t; -static void wt_const(worker_thread_t *ptr) -{ - /* create an event base for this thread */ - ptr->event_base = opal_event_base_create(); - /* construct the thread object */ - OBJ_CONSTRUCT(&ptr->thread, opal_thread_t); - /* fork off a thread to progress it */ - ptr->active = true; - ptr->thread.t_run = worker_thread_engine; - ptr->thread.t_arg = ptr; - opal_thread_start(&ptr->thread); -} -static void wt_dest(worker_thread_t *ptr) -{ - /* stop the thread */ - ptr->active = false; - /* break the loop */ - opal_event_base_loopbreak(ptr->event_base); - /* wait for thread to exit */ - opal_thread_join(&ptr->thread, NULL); - OBJ_DESTRUCT(&ptr->thread); - /* release the event base */ - opal_event_base_free(ptr->event_base); -} -OBJ_CLASS_INSTANCE(worker_thread_t, - opal_object_t, - wt_const, wt_dest); - -typedef struct { - opal_object_t super; - opal_event_t ev; - uint64_t rid; - orte_dfs_tracker_t *trk; - int64_t nbytes; - int whence; -} worker_req_t; -OBJ_CLASS_INSTANCE(worker_req_t, - opal_object_t, - NULL, NULL); -#define ORTE_DFS_POST_WORKER(r, cb) \ - do { \ - worker_thread_t *wt; \ - wt = (worker_thread_t*)opal_pointer_array_get_item(&worker_threads, wt_cntr); \ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, \ - "%s assigning req to worker thread %d", \ - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \ - wt->idx); \ - opal_event_set(wt->event_base, &((r)->ev), \ - -1, OPAL_EV_WRITE, (cb), (r)); \ - opal_event_active(&((r)->ev), OPAL_EV_WRITE, 1); \ - /* move to the next thread */ \ - wt_cntr++; \ - if (wt_cntr == orte_dfs_orted_num_worker_threads) { \ - wt_cntr = 0; \ - } \ - } while(0); - -static opal_list_t requests, active_files, file_maps; -static opal_pointer_array_t worker_threads; -static int wt_cntr = 0; -static int local_fd = 0; -static uint64_t req_id = 0; -static void recv_dfs_cmd(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata); -static void recv_dfs_data(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata); -static void remote_read(int fd, short args, void *cbata); -static void remote_open(int fd, short args, void *cbdata); -static void remote_size(int fd, short args, void *cbdata); -static void remote_seek(int fd, short args, void *cbdata); - -static int init(void) -{ - int i; - worker_thread_t *wt; - - OBJ_CONSTRUCT(&requests, opal_list_t); - OBJ_CONSTRUCT(&active_files, opal_list_t); - OBJ_CONSTRUCT(&file_maps, opal_list_t); - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, - ORTE_RML_TAG_DFS_CMD, - ORTE_RML_PERSISTENT, - recv_dfs_cmd, - NULL); - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, - ORTE_RML_TAG_DFS_DATA, - ORTE_RML_PERSISTENT, - recv_dfs_data, - NULL); - OBJ_CONSTRUCT(&worker_threads, opal_pointer_array_t); - opal_pointer_array_init(&worker_threads, 1, INT_MAX, 1); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s starting %d worker threads", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_dfs_orted_num_worker_threads); - for (i=0; i < orte_dfs_orted_num_worker_threads; i++) { - wt = OBJ_NEW(worker_thread_t); - wt->idx = i; - opal_pointer_array_add(&worker_threads, wt); - } - - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - opal_list_item_t *item; - int i; - worker_thread_t *wt; - - orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DFS_CMD); - orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DFS_DATA); - while (NULL != (item = opal_list_remove_first(&requests))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&requests); - while (NULL != (item = opal_list_remove_first(&active_files))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&active_files); - while (NULL != (item = opal_list_remove_first(&file_maps))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&file_maps); - for (i=0; i < worker_threads.size; i++) { - if (NULL != (wt = (worker_thread_t*)opal_pointer_array_get_item(&worker_threads, i))) { - OBJ_RELEASE(wt); - } - } - OBJ_DESTRUCT(&worker_threads); - - return ORTE_SUCCESS; -} - -static void open_local_file(orte_dfs_request_t *dfs) -{ - char *filename; - orte_dfs_tracker_t *trk; - - /* extract the filename from the uri */ - if (NULL == (filename = opal_filename_from_uri(dfs->uri, NULL))) { - /* something wrong - error was reported, so just get out */ - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(-1, dfs->cbdata); - } - return; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening local file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - /* attempt to open the file */ - if (0 > (dfs->remote_fd = open(filename, O_RDONLY))) { - ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(dfs->remote_fd, dfs->cbdata); - } - return; - } - /* otherwise, create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = ORTE_PROC_MY_NAME->jobid; - trk->requestor.vpid = ORTE_PROC_MY_NAME->vpid; - trk->filename = strdup(dfs->uri); - /* define the local fd */ - trk->local_fd = local_fd++; - /* record the remote file descriptor */ - trk->remote_fd = dfs->remote_fd; - /* add it to our list of active files */ - opal_list_append(&active_files, &trk->super); - /* the file is locally hosted */ - trk->host_daemon.jobid = ORTE_PROC_MY_DAEMON->jobid; - trk->host_daemon.vpid = ORTE_PROC_MY_DAEMON->vpid; - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local file %s mapped localfd %d to remotefd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename, trk->local_fd, trk->remote_fd); - /* let the caller know */ - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(trk->local_fd, dfs->cbdata); - } - /* request will be released by the calling routing */ -} - -static void process_opens(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - int rc; - opal_buffer_t *buffer = NULL; - char *scheme = NULL, *host = NULL, *filename = NULL; - int v; - orte_node_t *node, *nptr; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* get the scheme to determine if we can process locally or not */ - if (NULL == (scheme = opal_uri_get_scheme(dfs->uri))) { - OBJ_RELEASE(dfs); - return; - } - - if (0 == strcmp(scheme, "nfs")) { - open_local_file(dfs); - goto complete; - } - - if (0 != strcmp(scheme, "file")) { - /* not yet supported */ - orte_show_help("orte_dfs_help.txt", "unsupported-filesystem", - true, dfs->uri); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(-1, dfs->cbdata); - } - goto complete; - } - - free(scheme); - scheme = NULL; - - /* dissect the uri to extract host and filename/path */ - if (NULL == (filename = opal_filename_from_uri(dfs->uri, &host))) { - goto complete; - } - /* if the host is our own, then treat it as a local file */ - if (NULL == host || orte_ifislocal(host)) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s file %s on local host", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - open_local_file(dfs); - goto complete; - } - - /* ident the daemon on that host */ - node = NULL; - for (v=0; v < orte_node_pool->size; v++) { - if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(orte_node_pool, v))) { - continue; - } - if (NULL == nptr->daemon) { - continue; - } - if (0 == strcmp(host, nptr->name)) { - node = nptr; - break; - } - } - if (NULL == node) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - goto complete; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s file %s on host %s daemon %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename, host, ORTE_NAME_PRINT(&node->daemon->name)); - - free(host); - host = NULL; - /* double-check: if it is our local daemon, then we - * treat this as local - */ - if (node->daemon->name.vpid == ORTE_PROC_MY_DAEMON->vpid) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local file %s on same daemon", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - open_local_file(dfs); - goto complete; - } - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* setup a message for the daemon telling - * them what file we want to access - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &filename, 1, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending open file request to %s file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&node->daemon->name), - filename); - - free(filename); - filename = NULL; - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &node->daemon->name, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* don't release it */ - return; - - complete: - if (NULL != buffer) { - OBJ_RELEASE(buffer); - } - if (NULL != scheme) { - free(scheme); - } - if (NULL != host) { - free(host); - } - if (NULL != filename) { - free(filename); - } - OBJ_RELEASE(dfs); -} - - -/* in order to handle the possible opening/reading of files by - * multiple threads, we have to ensure that all operations are - * carried out in events - so the "open" cmd simply posts an - * event containing the required info, and then returns - */ -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), uri); - - /* setup the request */ - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_OPEN_CMD; - dfs->uri = strdup(uri); - dfs->open_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_opens, ORTE_SYS_PRI); -} - -static void process_close(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *close_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(close_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s closing fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - close_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == close_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); - return; - } - - /* if the file is local, close it */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - close(trk->remote_fd); - goto complete; - } - - /* setup a message for the daemon telling - * them what file to close - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &close_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending close file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - - complete: - opal_list_remove_item(&active_files, &trk->super); - OBJ_RELEASE(trk); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); -} - -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s close called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_CLOSE_CMD; - dfs->local_fd = fd; - dfs->close_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_close, ORTE_SYS_PRI); -} - -static void process_sizes(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *size_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - struct stat buf; - - ORTE_ACQUIRE_OBJECT(size_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing get_size on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - size_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == size_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(size_dfs); - return; - } - - /* if the file is local, execute the seek on it - we - * stuck the "whence" value in the remote_fd - */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - /* stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(-1, size_dfs->cbdata); - } - } - goto complete; - } - - /* setup a message for the daemon telling - * them what file to get the size of - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &size_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending get_size request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(-1, size_dfs->cbdata); - } - goto complete; - } - - complete: - OBJ_RELEASE(size_dfs); -} - -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s get_size called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SIZE_CMD; - dfs->local_fd = fd; - dfs->size_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_sizes, ORTE_SYS_PRI); -} - - -static void process_seeks(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *seek_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - struct stat buf; - - ORTE_ACQUIRE_OBJECT(seek_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing seek on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - seek_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == seek_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(seek_dfs); - return; - } - - /* if the file is local, execute the seek on it - we - * stuck the "whence" value in the remote_fd - */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s local seek on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - seek_dfs->local_fd); - /* stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else if (buf.st_size < seek_dfs->read_length && - SEEK_SET == seek_dfs->remote_fd) { - /* seek would take us past EOF */ - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else if (buf.st_size < (off_t)(trk->location + seek_dfs->read_length) && - SEEK_CUR == seek_dfs->remote_fd) { - /* seek would take us past EOF */ - if (NULL != seek_dfs->seek_cbfunc) { - seek_dfs->seek_cbfunc(-1, seek_dfs->cbdata); - } - } else { - lseek(trk->remote_fd, seek_dfs->read_length, seek_dfs->remote_fd); - if (SEEK_SET == seek_dfs->remote_fd) { - trk->location = seek_dfs->read_length; - } else { - trk->location += seek_dfs->read_length; - } - } - goto complete; - } - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - seek_dfs->id = req_id++; - opal_list_append(&requests, &seek_dfs->super); - - /* setup a message for the daemon telling - * them what file to seek - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &seek_dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)seek_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending seek file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - - complete: - OBJ_RELEASE(seek_dfs); -} - - -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SEEK_CMD; - dfs->local_fd = fd; - dfs->read_length = offset; - dfs->remote_fd = whence; - dfs->seek_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_seeks, ORTE_SYS_PRI); -} - -static void process_reads(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *read_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - long nbytes; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - - ORTE_ACQUIRE_OBJECT(read_dfs); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == read_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(read_dfs); - return; - } - - /* if the file is local, read the desired bytes */ - if (trk->host_daemon.vpid == ORTE_PROC_MY_DAEMON->vpid) { - nbytes = read(trk->remote_fd, read_dfs->read_buffer, read_dfs->read_length); - if (0 < nbytes) { - /* update our location */ - trk->location += nbytes; - } - /* pass them back to the caller */ - if (NULL != read_dfs->read_cbfunc) { - read_dfs->read_cbfunc(nbytes, read_dfs->read_buffer, read_dfs->cbdata); - } - /* request is complete */ - OBJ_RELEASE(read_dfs); - return; - } - /* add this request to our pending list */ - read_dfs->id = req_id++; - opal_list_append(&requests, &read_dfs->super); - - /* setup a message for the daemon telling - * them what file to read - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)read_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending read file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - } - /* don't release the request */ - return; - - complete: - /* don't need to hang on to this request */ - opal_list_remove_item(&requests, &read_dfs->super); - OBJ_RELEASE(read_dfs); -} - -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_READ_CMD; - dfs->local_fd = fd; - dfs->read_buffer = buffer; - dfs->read_length = length; - dfs->read_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_reads, ORTE_SYS_PRI); -} - -static void process_posts(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_jobfm_t *jptr, *jfm; - orte_dfs_vpidfm_t *vptr, *vfm; - opal_list_item_t *item; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s posting file map containing %d bytes for target %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (int)dfs->bptr->bytes_used, ORTE_NAME_PRINT(&dfs->target)); - - /* lookup the job map */ - jfm = NULL; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jptr = (orte_dfs_jobfm_t*)item; - if (jptr->jobid == dfs->target.jobid) { - jfm = jptr; - break; - } - } - if (NULL == jfm) { - /* add it */ - jfm = OBJ_NEW(orte_dfs_jobfm_t); - jfm->jobid = dfs->target.jobid; - opal_list_append(&file_maps, &jfm->super); - } - /* see if we already have an entry for this source */ - vfm = NULL; - for (item = opal_list_get_first(&jfm->maps); - item != opal_list_get_end(&jfm->maps); - item = opal_list_get_next(item)) { - vptr = (orte_dfs_vpidfm_t*)item; - if (vptr->vpid == dfs->target.vpid) { - vfm = vptr; - break; - } - } - if (NULL == vfm) { - /* add it */ - vfm = OBJ_NEW(orte_dfs_vpidfm_t); - vfm->vpid = dfs->target.vpid; - opal_list_append(&jfm->maps, &vfm->super); - } - - /* add this entry to our collection */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(&vfm->data, &dfs->bptr, 1, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto cleanup; - } - vfm->num_entries++; - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s target %s now has %d entries", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&dfs->target), - vfm->num_entries); - - cleanup: - if (NULL != dfs->post_cbfunc) { - dfs->post_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_post_file_map(opal_buffer_t *buffer, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_POST_CMD; - dfs->target.jobid = ORTE_PROC_MY_NAME->jobid; - dfs->target.vpid = ORTE_PROC_MY_NAME->vpid; - dfs->bptr = buffer; - dfs->post_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_posts, ORTE_SYS_PRI); -} - -static int get_job_maps(orte_dfs_jobfm_t *jfm, - orte_vpid_t vpid, - opal_buffer_t *buf) -{ - orte_dfs_vpidfm_t *vfm; - opal_list_item_t *item; - int rc; - int entries=0; - - /* if the target vpid is WILDCARD, then process - * data for all vpids - else, find the one - */ - for (item = opal_list_get_first(&jfm->maps); - item != opal_list_get_end(&jfm->maps); - item = opal_list_get_next(item)) { - vfm = (orte_dfs_vpidfm_t*)item; - if (ORTE_VPID_WILDCARD == vpid || - vfm->vpid == vpid) { - entries++; - /* indicate data from this vpid */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, &vfm->vpid, 1, ORTE_VPID))) { - ORTE_ERROR_LOG(rc); - return -1; - } - /* pack the number of posts we received from it */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buf, &vfm->num_entries, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - return -1; - } - /* copy the data across */ - opal_dss.copy_payload(buf, &vfm->data); - } - } - return entries; -} - -static void process_getfm(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_jobfm_t *jfm; - opal_list_item_t *item; - opal_buffer_t xfer; - int32_t n, ntotal; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* if the target job is WILDCARD, then process - * data for all jobids - else, find the one - */ - ntotal = 0; - n = -1; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jfm = (orte_dfs_jobfm_t*)item; - if (ORTE_JOBID_WILDCARD == dfs->target.jobid || - jfm->jobid == dfs->target.jobid) { - n = get_job_maps(jfm, dfs->target.vpid, &dfs->bucket); - if (n < 0) { - break; - } - ntotal += n; - } - } - - if (n < 0) { - /* indicates an error */ - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(NULL, dfs->cbdata); - } - } else { - OBJ_CONSTRUCT(&xfer, opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(&xfer, &ntotal, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - OBJ_DESTRUCT(&xfer); - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(NULL, dfs->cbdata); - } - return; - } - opal_dss.copy_payload(&xfer, &dfs->bucket); - /* pass it back to caller */ - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(&xfer, dfs->cbdata); - } - OBJ_DESTRUCT(&xfer); - } - OBJ_RELEASE(dfs); -} - -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s get file map for %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(target)); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_GETFM_CMD; - dfs->target.jobid = target->jobid; - dfs->target.vpid = target->vpid; - dfs->fm_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_getfm, ORTE_SYS_PRI); -} - -static void process_load(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_list_item_t *item; - orte_dfs_jobfm_t *jfm, *jptr; - orte_dfs_vpidfm_t *vfm; - orte_vpid_t vpid; - int32_t entries, nvpids; - int cnt, i, j; - int rc; - opal_buffer_t *xfer; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* see if we already have a tracker for this job */ - jfm = NULL; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jptr = (orte_dfs_jobfm_t*)item; - if (jptr->jobid == dfs->target.jobid) { - jfm = jptr; - break; - } - } - if (NULL != jfm) { - /* need to purge it first */ - while (NULL != (item = opal_list_remove_first(&jfm->maps))) { - OBJ_RELEASE(item); - } - } else { - jfm = OBJ_NEW(orte_dfs_jobfm_t); - jfm->jobid = dfs->target.jobid; - opal_list_append(&file_maps, &jfm->super); - } - - /* retrieve the number of vpids in the map */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(dfs->bptr, &nvpids, &cnt, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s loading file maps from %d vpids", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), nvpids); - - /* unpack the buffer */ - for (i=0; i < nvpids; i++) { - /* unpack this vpid */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(dfs->bptr, &vpid, &cnt, ORTE_VPID))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* unpack the number of file maps in this entry */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(dfs->bptr, &entries, &cnt, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s loading %d entries in file map for vpid %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - entries, ORTE_VPID_PRINT(vpid)); - /* create the entry */ - vfm = OBJ_NEW(orte_dfs_vpidfm_t); - vfm->vpid = vpid; - vfm->num_entries = entries; - /* copy the data */ - for (j=0; j < entries; j++) { - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(dfs->bptr, &xfer, &cnt, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(&vfm->data, &xfer, 1, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - OBJ_RELEASE(xfer); - } - opal_list_append(&jfm->maps, &vfm->super); - } - - complete: - if (NULL != dfs->load_cbfunc) { - dfs->load_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *buf, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s loading file maps for %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_JOBID_PRINT(jobid)); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_LOAD_CMD; - dfs->target.jobid = jobid; - dfs->bptr = buf; - dfs->load_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_load, ORTE_SYS_PRI); -} - -static void process_purge(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_list_item_t *item; - orte_dfs_jobfm_t *jfm, *jptr; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* find the job tracker */ - jfm = NULL; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jptr = (orte_dfs_jobfm_t*)item; - if (jptr->jobid == dfs->target.jobid) { - jfm = jptr; - break; - } - } - if (NULL == jfm) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - } else { - /* remove it from the list */ - opal_list_remove_item(&file_maps, &jfm->super); - /* the destructor will release the list of maps - * in the jobfm object - */ - OBJ_RELEASE(jfm); - } - - if (NULL != dfs->purge_cbfunc) { - dfs->purge_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s purging file maps for job %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_JOBID_PRINT(jobid)); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_PURGE_CMD; - dfs->target.jobid = jobid; - dfs->purge_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_purge, ORTE_SYS_PRI); -} - - -/* receives take place in an event, so we are free to process - * the request list without fear of getting things out-of-order - */ -static void recv_dfs_cmd(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata) -{ - orte_dfs_cmd_t cmd; - int32_t cnt; - opal_list_item_t *item; - int my_fd; - int32_t rc, nmaps; - char *filename; - orte_dfs_tracker_t *trk; - int64_t i64, bytes_read; - uint8_t *read_buf; - uint64_t rid; - int whence; - struct stat buf; - orte_process_name_t source; - opal_buffer_t *bptr, *xfer; - orte_dfs_request_t *dfs; - orte_dfs_jobfm_t *jfm, *jptr; - orte_dfs_vpidfm_t *vfm, *vptr; - opal_buffer_t *answer, bucket; - int i, j; - orte_vpid_t vpid; - int32_t nentries, ncontributors; - worker_req_t *wrkr; - - /* unpack the command */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &cmd, &cnt, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s received command %d from %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int)cmd, - ORTE_NAME_PRINT(sender)); - - switch (cmd) { - case ORTE_DFS_OPEN_CMD: - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the filename */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &filename, &cnt, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - return; - } - /* create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = sender->jobid; - trk->requestor.vpid = sender->vpid; - trk->host_daemon.jobid = ORTE_PROC_MY_NAME->jobid; - trk->host_daemon.vpid = ORTE_PROC_MY_NAME->vpid; - trk->filename = strdup(filename); - opal_list_append(&active_files, &trk->super); - /* process the request */ - if (0 < orte_dfs_orted_num_worker_threads) { - wrkr = OBJ_NEW(worker_req_t); - wrkr->trk = trk; - wrkr->rid = rid; - ORTE_DFS_POST_WORKER(wrkr, remote_open); - return; - } - /* no worker threads, so attempt to open the file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename); - if (0 > (my_fd = open(filename, O_RDONLY))) { - ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE); - goto answer_open; - } - trk->local_fd = my_fd; - answer_open: - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &my_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - return; - } - break; - - case ORTE_DFS_CLOSE_CMD: - /* unpack our fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &my_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* find the corresponding tracker */ - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - trk = (orte_dfs_tracker_t*)item; - if (my_fd == trk->local_fd) { - /* remove it */ - opal_list_remove_item(&active_files, item); - OBJ_RELEASE(item); - /* close the file */ - close(my_fd); - break; - } - } - break; - - case ORTE_DFS_SIZE_CMD: - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack our fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &my_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* find the corresponding tracker */ - i64 = -1; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - trk = (orte_dfs_tracker_t*)item; - if (my_fd == trk->local_fd) { - /* process the request */ - if (0 < orte_dfs_orted_num_worker_threads) { - wrkr = OBJ_NEW(worker_req_t); - wrkr->trk = trk; - wrkr->rid = rid; - ORTE_DFS_POST_WORKER(wrkr, remote_size); - return; - } - /* no worker threads, so stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - } else { - i64 = buf.st_size; - } - break; - } - } - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - return; - } - break; - - case ORTE_DFS_SEEK_CMD: - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack our fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &my_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the offset */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the whence */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &whence, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* set default error */ - bytes_read = -1; - /* find the corresponding tracker - we do this to ensure - * that the local fd we were sent is actually open - */ - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - trk = (orte_dfs_tracker_t*)item; - if (my_fd == trk->local_fd) { - /* process the request */ - if (0 < orte_dfs_orted_num_worker_threads) { - wrkr = OBJ_NEW(worker_req_t); - wrkr->trk = trk; - wrkr->rid = rid; - wrkr->nbytes = i64; - wrkr->whence = whence; - ORTE_DFS_POST_WORKER(wrkr, remote_seek); - return; - } - /* no worker threads, so stat the file and get its size */ - if (0 > stat(trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - } else if (buf.st_size < i64 && SEEK_SET == whence) { - /* seek would take us past EOF */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek SET past EOF on file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - bytes_read = -2; - } else if (buf.st_size < (off_t)(trk->location + i64) && - SEEK_CUR == whence) { - /* seek would take us past EOF */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek CUR past EOF on file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - trk->filename); - bytes_read = -3; - } else { - lseek(my_fd, i64, whence); - if (SEEK_SET == whence) { - trk->location = i64; - } else { - trk->location += i64; - } - bytes_read = i64; - } - break; - } - } - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* return the offset/status */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &bytes_read, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending %ld offset back to %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (long)bytes_read, - ORTE_NAME_PRINT(sender)); - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - return; - } - break; - - case ORTE_DFS_READ_CMD: - /* set default error */ - my_fd = -1; - bytes_read = -1; - read_buf = NULL; - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack our fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &my_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto answer_read; - } - /* unpack the number of bytes to read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto answer_read; - } - /* find the corresponding tracker - we do this to ensure - * that the local fd we were sent is actually open - */ - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - trk = (orte_dfs_tracker_t*)item; - if (my_fd == trk->local_fd) { - if (0 < orte_dfs_orted_num_worker_threads) { - wrkr = OBJ_NEW(worker_req_t); - wrkr->rid = rid; - wrkr->trk = trk; - wrkr->nbytes = i64; - /* dispatch to the currently indexed thread */ - ORTE_DFS_POST_WORKER(wrkr, remote_read); - return; - } else { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s reading %ld bytes from local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (long)i64, my_fd); - /* do the read */ - read_buf = (uint8_t*)malloc(i64); - if (NULL == read_buf) { - ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); - goto answer_read; - } - bytes_read = read(my_fd, read_buf, (long)i64); - if (0 < bytes_read) { - /* update our location */ - trk->location += bytes_read; - } - } - break; - } - } - answer_read: - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - if (NULL != read_buf) { - free(read_buf); - } - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - if (NULL != read_buf) { - free(read_buf); - } - return; - } - /* include the number of bytes read */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &bytes_read, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - if (NULL != read_buf) { - free(read_buf); - } - return; - } - /* include the bytes read */ - if (0 < bytes_read) { - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, read_buf, bytes_read, OPAL_UINT8))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - free(read_buf); - return; - } - } - if (NULL != read_buf) { - free(read_buf); - } - /* send it */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending %ld bytes back to %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (long)bytes_read, - ORTE_NAME_PRINT(sender)); - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - return; - } - break; - - case ORTE_DFS_POST_CMD: - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s received post command from %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(sender)); - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto answer_post; - } - /* unpack the name of the source of this data */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &source, &cnt, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - goto answer_post; - } - /* unpack their buffer object */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &bptr, &cnt, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto answer_post; - } - /* add the contents to the storage for this process */ - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->target.jobid = source.jobid; - dfs->target.vpid = source.vpid; - dfs->bptr = bptr; - dfs->post_cbfunc = NULL; - process_posts(0, 0, (void*)dfs); - OBJ_RELEASE(bptr); - answer_post: - if (UINT64_MAX != rid) { - /* return an ack */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - } - } - break; - - case ORTE_DFS_RELAY_POSTS_CMD: - /* unpack the name of the source of this data */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &source, &cnt, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - return; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s received relayed posts from sender %s for source %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(sender), - ORTE_NAME_PRINT(&source)); - /* lookup the job map */ - jfm = NULL; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jptr = (orte_dfs_jobfm_t*)item; - if (jptr->jobid == source.jobid) { - jfm = jptr; - break; - } - } - if (NULL == jfm) { - /* add it */ - jfm = OBJ_NEW(orte_dfs_jobfm_t); - jfm->jobid = source.jobid; - opal_list_append(&file_maps, &jfm->super); - } - /* see if we already have an entry for this source */ - vfm = NULL; - for (item = opal_list_get_first(&jfm->maps); - item != opal_list_get_end(&jfm->maps); - item = opal_list_get_next(item)) { - vptr = (orte_dfs_vpidfm_t*)item; - if (vptr->vpid == source.vpid) { - vfm = vptr; - break; - } - } - if (NULL == vfm) { - /* add it */ - vfm = OBJ_NEW(orte_dfs_vpidfm_t); - vfm->vpid = source.vpid; - opal_list_append(&jfm->maps, &vfm->super); - } - /* unpack their buffer object */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &bptr, &cnt, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - return; - } - /* the buffer object came from a call to get_file_maps, so it isn't quite - * the same as when someone posts directly to us. So process it here by - * starting with getting the number of vpids that contributed. This - * should always be one, but leave it open for flexibility - */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(bptr, &ncontributors, &cnt, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - return; - } - /* loop thru the number of contributors */ - for (i=0; i < ncontributors; i++) { - /* unpack the vpid of the contributor */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(bptr, &vpid, &cnt, ORTE_VPID))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the number of entries */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(bptr, &nentries, &cnt, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - return; - } - for (j=0; j < nentries; j++) { - /* get the entry */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(bptr, &xfer, &cnt, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - return; - } - /* store it */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(&vfm->data, &xfer, 1, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - return; - } - OBJ_RELEASE(xfer); - vfm->num_entries++; - } - } - OBJ_RELEASE(bptr); - /* no reply required */ - break; - - case ORTE_DFS_GETFM_CMD: - /* unpack their request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the target */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &source, &cnt, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - return; - } - /* construct the response */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our data tree for matches, assembling them - * into a byte object - */ - /* if the target job is WILDCARD, then process - * data for all jobids - else, find the one - */ - OBJ_CONSTRUCT(&bucket, opal_buffer_t); - nmaps = 0; - for (item = opal_list_get_first(&file_maps); - item != opal_list_get_end(&file_maps); - item = opal_list_get_next(item)) { - jfm = (orte_dfs_jobfm_t*)item; - if (ORTE_JOBID_WILDCARD == source.jobid || - jfm->jobid == source.jobid) { - rc = get_job_maps(jfm, source.vpid, &bucket); - if (rc < 0) { - break; - } else { - nmaps += rc; - } - } - } - if (rc < 0) { - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &rc, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - return; - } - } else { - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &nmaps, 1, OPAL_INT32))) { - ORTE_ERROR_LOG(rc); - return; - } - if (0 < nmaps) { - opal_dss.copy_payload(answer, &bucket); - } - } - OBJ_DESTRUCT(&bucket); - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s getf-cmd: returning %d maps with %d bytes to sender %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), nmaps, - (int)answer->bytes_used, ORTE_NAME_PRINT(sender)); - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - sender, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - } - break; - - default: - opal_output(0, "ORTED:DFS:RECV_DFS WTF"); - break; - } -} - -static void recv_dfs_data(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata) -{ - orte_dfs_cmd_t cmd; - int32_t cnt; - orte_dfs_request_t *dfs, *dptr; - opal_list_item_t *item; - int remote_fd, rc; - int64_t i64; - uint64_t rid; - orte_dfs_tracker_t *trk; - - /* unpack the command this message is responding to */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &cmd, &cnt, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data cmd %d from sender %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int)cmd, - ORTE_NAME_PRINT(sender)); - - switch (cmd) { - case ORTE_DFS_OPEN_CMD: - /* unpack the request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the remote fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &remote_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* as the request has been fulfilled, remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data open file - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - - /* if the remote_fd < 0, then we had an error, so return - * the error value to the caller - */ - if (remote_fd < 0) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data open file response error file %s [error: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(remote_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - return; - } - /* otherwise, create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = ORTE_PROC_MY_NAME->jobid; - trk->requestor.vpid = ORTE_PROC_MY_NAME->vpid; - trk->host_daemon.jobid = sender->jobid; - trk->host_daemon.vpid = sender->vpid; - trk->filename = strdup(dfs->uri); - /* define the local fd */ - trk->local_fd = local_fd++; - /* record the remote file descriptor */ - trk->remote_fd = remote_fd; - /* add it to our list of active files */ - opal_list_append(&active_files, &trk->super); - /* return the local_fd to the caller for - * subsequent operations - */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data open file completed for file %s [local fd: %d remote fd: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, trk->local_fd, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(trk->local_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_SIZE_CMD: - /* unpack the request id for this request */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data size - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the size */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - /* pass them back to the original caller */ - if (NULL != dfs->read_cbfunc) { - dfs->size_cbfunc(i64, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_READ_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd:data read - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the bytes read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - if (0 < i64) { - cnt = i64; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, dfs->read_buffer, &cnt, OPAL_UINT8))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - } - /* pass them back to the original caller */ - if (NULL != dfs->read_cbfunc) { - dfs->read_cbfunc(i64, dfs->read_buffer, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - default: - opal_output(0, "ORTED:DFS:RECV:DATA WTF"); - break; - } -} - -static void* worker_thread_engine(opal_object_t *obj) -{ - opal_thread_t *thread = (opal_thread_t*)obj; - worker_thread_t *ptr = (worker_thread_t*)thread->t_arg; - - while (ptr->active) { - opal_event_loop(ptr->event_base, OPAL_EVLOOP_ONCE); - } - return OPAL_THREAD_CANCELLED; -} - -static void remote_open(int fd, short args, void *cbdata) -{ - worker_req_t *req = (worker_req_t*)cbdata; - opal_buffer_t *answer; - orte_dfs_cmd_t cmd = ORTE_DFS_OPEN_CMD; - int rc; - - /* attempt to open the file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - req->trk->filename); - if (0 > (req->trk->local_fd = open(req->trk->filename, O_RDONLY))) { - ORTE_ERROR_LOG(ORTE_ERR_FILE_OPEN_FAILURE); - } - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &req->rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &req->trk->local_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &req->trk->requestor, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - } -} - -static void remote_size(int fd, short args, void *cbdata) -{ - worker_req_t *req = (worker_req_t*)cbdata; - int rc; - struct stat buf; - int64_t i64; - opal_buffer_t *answer; - orte_dfs_cmd_t cmd = ORTE_DFS_SIZE_CMD; - - if (0 > stat(req->trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - req->trk->filename); - } else { - i64 = buf.st_size; - } - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &req->rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &req->trk->requestor, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - } -} - -static void remote_seek(int fd, short args, void *cbdata) -{ - worker_req_t *req = (worker_req_t*)cbdata; - opal_buffer_t *answer; - orte_dfs_cmd_t cmd = ORTE_DFS_SEEK_CMD; - int rc; - struct stat buf; - int64_t i64; - - /* stat the file and get its size */ - if (0 > stat(req->trk->filename, &buf)) { - /* cannot stat file */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek could not stat %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - req->trk->filename); - } else if (buf.st_size < req->nbytes && SEEK_SET == req->whence) { - /* seek would take us past EOF */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek SET past EOF on file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - req->trk->filename); - i64 = -2; - } else if (buf.st_size < (off_t)(req->trk->location + req->nbytes) && - SEEK_CUR == req->whence) { - /* seek would take us past EOF */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek CUR past EOF on file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - req->trk->filename); - i64 = -3; - } else { - lseek(req->trk->local_fd, req->nbytes, req->whence); - if (SEEK_SET == req->whence) { - req->trk->location = req->nbytes; - } else { - req->trk->location += req->nbytes; - } - i64 = req->nbytes; - } - - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &req->rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &req->trk->requestor, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - } -} - -static void remote_read(int fd, short args, void *cbdata) -{ - worker_req_t *req = (worker_req_t*)cbdata; - uint8_t *read_buf; - opal_buffer_t *answer; - orte_dfs_cmd_t cmd = ORTE_DFS_READ_CMD; - int64_t bytes_read; - int rc; - - /* do the read */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s issuing read", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - read_buf = (uint8_t*)malloc(req->nbytes); - if (NULL == read_buf) { - ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE); - return; - } - bytes_read = read(req->trk->local_fd, read_buf, (long)req->nbytes); - if (0 < bytes_read) { - /* update our location */ - req->trk->location += bytes_read; - } - /* construct the return message */ - answer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - free(read_buf); - return; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &req->rid, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - free(read_buf); - OBJ_RELEASE(answer); - return; - } - /* include the number of bytes read */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, &bytes_read, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - free(read_buf); - OBJ_RELEASE(answer); - return; - } - /* include the bytes read */ - if (0 < bytes_read) { - if (OPAL_SUCCESS != (rc = opal_dss.pack(answer, read_buf, bytes_read, OPAL_UINT8))) { - ORTE_ERROR_LOG(rc); - free(read_buf); - OBJ_RELEASE(answer); - return; - } - } - free(read_buf); - /* send it */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending %ld bytes back to %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - (long)bytes_read, - ORTE_NAME_PRINT(&req->trk->requestor)); - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &req->trk->requestor, answer, - ORTE_RML_TAG_DFS_DATA, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(answer); - return; - } - OBJ_RELEASE(req); -} diff --git a/orte/mca/dfs/orted/dfs_orted.h b/orte/mca/dfs/orted/dfs_orted.h deleted file mode 100644 index b2b2f440964..00000000000 --- a/orte/mca/dfs/orted/dfs_orted.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. - * All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - */ - -#ifndef MCA_dfs_orted_EXPORT_H -#define MCA_dfs_orted_EXPORT_H - -#include "orte_config.h" - -#include "orte/mca/dfs/dfs.h" - -BEGIN_C_DECLS - -/* - * Local Component structures - */ - -ORTE_MODULE_DECLSPEC extern orte_dfs_base_component_t mca_dfs_orted_component; - -ORTE_DECLSPEC extern orte_dfs_base_module_t orte_dfs_orted_module; - -extern int orte_dfs_orted_num_worker_threads; - -END_C_DECLS - -#endif /* MCA_dfs_orted_EXPORT_H */ diff --git a/orte/mca/dfs/orted/dfs_orted_component.c b/orte/mca/dfs/orted/dfs_orted_component.c deleted file mode 100644 index f102b898b15..00000000000 --- a/orte/mca/dfs/orted/dfs_orted_component.c +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "opal/util/output.h" - -#include "orte/runtime/orte_globals.h" - -#include "orte/mca/dfs/dfs.h" -#include "orte/mca/dfs/base/base.h" -#include "dfs_orted.h" - -/* - * Public string for version number - */ -const char *orte_dfs_orted_component_version_string = - "ORTE DFS orted MCA component version " ORTE_VERSION; - -int orte_dfs_orted_num_worker_threads = 0; - -/* - * Local functionality - */ -static int dfs_orted_register(void); -static int dfs_orted_open(void); -static int dfs_orted_close(void); -static int dfs_orted_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -orte_dfs_base_component_t mca_dfs_orted_component = -{ - /* Handle the general mca_component_t struct containing - * meta information about the component itdefault_orted - */ - .base_version = { - ORTE_DFS_BASE_VERSION_1_0_0, - /* Component name and version */ - .mca_component_name = "orted", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = dfs_orted_open, - .mca_close_component = dfs_orted_close, - .mca_query_component = dfs_orted_component_query, - .mca_register_component_params = dfs_orted_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int dfs_orted_register(void) -{ - orte_dfs_orted_num_worker_threads = 0; - (void) mca_base_component_var_register(&mca_dfs_orted_component.base_version, "num_worker_threads", - "Number of worker threads to use for processing file requests", - MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, - OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_LOCAL, - &orte_dfs_orted_num_worker_threads); - - return ORTE_SUCCESS; -} - -static int dfs_orted_open(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_orted_close(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_orted_component_query(mca_base_module_t **module, int *priority) -{ - if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { - /* we are the default component for daemons and HNP */ - *priority = 1000; - *module = (mca_base_module_t *)&orte_dfs_orted_module; - return ORTE_SUCCESS; - } - - *priority = -1; - *module = NULL; - return ORTE_ERROR; -} - diff --git a/orte/mca/dfs/orted/owner.txt b/orte/mca/dfs/orted/owner.txt deleted file mode 100644 index 4ad6f408ca3..00000000000 --- a/orte/mca/dfs/orted/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: INTEL -status: maintenance diff --git a/orte/mca/dfs/test/Makefile.am b/orte/mca/dfs/test/Makefile.am deleted file mode 100644 index 1abd1f6dbc8..00000000000 --- a/orte/mca/dfs/test/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - dfs_test.h \ - dfs_test_component.c \ - dfs_test.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_dfs_test_DSO -component_noinst = -component_install = mca_dfs_test.la -else -component_noinst = libmca_dfs_test.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_dfs_test_la_SOURCES = $(sources) -mca_dfs_test_la_LDFLAGS = -module -avoid-version -mca_dfs_test_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_dfs_test_la_SOURCES =$(sources) -libmca_dfs_test_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/dfs/test/dfs_test.c b/orte/mca/dfs/test/dfs_test.c deleted file mode 100644 index 24392e013dc..00000000000 --- a/orte/mca/dfs/test/dfs_test.c +++ /dev/null @@ -1,1149 +0,0 @@ -/* - * Copyright (c) 2012-2013 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" - -#include -#ifdef HAVE_UNISTD_H -#include -#endif /* HAVE_UNISTD_H */ -#include -#ifdef HAVE_FCNTL_H -#include -#endif -#include - -#include "opal/util/if.h" -#include "opal/util/output.h" -#include "opal/util/uri.h" -#include "opal/dss/dss.h" -#include "opal/mca/pmix/pmix.h" - -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" -#include "orte/util/show_help.h" -#include "orte/util/threads.h" -#include "orte/runtime/orte_globals.h" -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/rml/rml.h" - -#include "orte/mca/dfs/base/base.h" -#include "dfs_test.h" - -/* - * Module functions: Global - */ -static int init(void); -static int finalize(void); - -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata); -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata); -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata); -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata); -static void dfs_post_file_map(opal_buffer_t *bo, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata); -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata); -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *bo, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata); -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata); - -/****************** - * TEST module - ******************/ -orte_dfs_base_module_t orte_dfs_test_module = { - init, - finalize, - dfs_open, - dfs_close, - dfs_get_file_size, - dfs_seek, - dfs_read, - dfs_post_file_map, - dfs_get_file_map, - dfs_load_file_maps, - dfs_purge_file_maps -}; - -static opal_list_t requests, active_files; -static int local_fd = 0; -static uint64_t req_id = 0; -static void recv_dfs(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata); - -static int init(void) -{ - OBJ_CONSTRUCT(&requests, opal_list_t); - OBJ_CONSTRUCT(&active_files, opal_list_t); - orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, - ORTE_RML_TAG_DFS_DATA, - ORTE_RML_PERSISTENT, - recv_dfs, - NULL); - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - opal_list_item_t *item; - - orte_rml.recv_cancel(ORTE_NAME_WILDCARD, ORTE_RML_TAG_DFS_DATA); - while (NULL != (item = opal_list_remove_first(&requests))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&requests); - while (NULL != (item = opal_list_remove_first(&active_files))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&active_files); - return ORTE_SUCCESS; -} - -/* receives take place in an event, so we are free to process - * the request list without fear of getting things out-of-order - */ -static void recv_dfs(int status, orte_process_name_t* sender, - opal_buffer_t* buffer, orte_rml_tag_t tag, - void* cbdata) -{ - orte_dfs_cmd_t cmd; - int32_t cnt; - orte_dfs_request_t *dfs, *dptr; - opal_list_item_t *item; - int remote_fd, rc; - int64_t i64; - uint64_t rid; - orte_dfs_tracker_t *trk; - - /* unpack the command this message is responding to */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &cmd, &cnt, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - return; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd cmd %d from sender %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), (int)cmd, - ORTE_NAME_PRINT(sender)); - - switch (cmd) { - case ORTE_DFS_OPEN_CMD: - /* unpack the request id */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* unpack the remote fd */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &remote_fd, &cnt, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* as the request has been fulfilled, remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - - /* if the remote_fd < 0, then we had an error, so return - * the error value to the caller - */ - if (remote_fd < 0) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file response error file %s [error: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(remote_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - return; - } - /* otherwise, create a tracker for this file */ - trk = OBJ_NEW(orte_dfs_tracker_t); - trk->requestor.jobid = ORTE_PROC_MY_NAME->jobid; - trk->requestor.vpid = ORTE_PROC_MY_NAME->vpid; - trk->host_daemon.jobid = sender->jobid; - trk->host_daemon.vpid = sender->vpid; - trk->filename = strdup(dfs->uri); - /* define the local fd */ - trk->local_fd = local_fd++; - /* record the remote file descriptor */ - trk->remote_fd = remote_fd; - /* add it to our list of active files */ - opal_list_append(&active_files, &trk->super); - /* return the local_fd to the caller for - * subsequent operations - */ - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd open file completed for file %s [local fd: %d remote fd: %d]", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - dfs->uri, trk->local_fd, remote_fd); - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(trk->local_fd, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_SIZE_CMD: - /* unpack the request id for this request */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd size - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the size */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - /* pass it back to the original caller */ - if (NULL != dfs->size_cbfunc) { - dfs->size_cbfunc(i64, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_SEEK_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd seek - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the returned offset/status */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - /* pass it back to the original caller */ - if (NULL != dfs->seek_cbfunc) { - dfs->seek_cbfunc(i64, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_READ_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd read - no corresponding request found for local fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), local_fd); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* get the bytes read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &i64, &cnt, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - if (0 < i64) { - cnt = i64; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, dfs->read_buffer, &cnt, OPAL_UINT8))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(dfs); - return; - } - } - /* pass them back to the original caller */ - if (NULL != dfs->read_cbfunc) { - dfs->read_cbfunc(i64, dfs->read_buffer, dfs->cbdata); - } - /* release the request */ - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_POST_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd post - no corresponding request found", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - if (NULL != dfs->post_cbfunc) { - dfs->post_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); - break; - - case ORTE_DFS_GETFM_CMD: - /* unpack the request id for this read */ - cnt = 1; - if (OPAL_SUCCESS != (rc = opal_dss.unpack(buffer, &rid, &cnt, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - return; - } - /* search our list of requests to find the matching one */ - dfs = NULL; - for (item = opal_list_get_first(&requests); - item != opal_list_get_end(&requests); - item = opal_list_get_next(item)) { - dptr = (orte_dfs_request_t*)item; - if (dptr->id == rid) { - /* request was fulfilled, so remove it */ - opal_list_remove_item(&requests, item); - dfs = dptr; - break; - } - } - if (NULL == dfs) { - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s recvd getfm - no corresponding request found", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - return; - } - /* return it to caller */ - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(buffer, dfs->cbdata); - } - OBJ_RELEASE(dfs); - break; - - default: - opal_output(0, "TEST:DFS:RECV WTF"); - break; - } -} - -static void process_opens(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - int rc; - opal_buffer_t *buffer; - char *scheme, *host=NULL, *filename=NULL; - orte_process_name_t daemon; - opal_list_t lt; - opal_namelist_t *nm; - - ORTE_ACQUIRE_OBJECT(dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s PROCESSING OPEN", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - /* get the scheme to determine if we can process locally or not */ - if (NULL == (scheme = opal_uri_get_scheme(dfs->uri))) { - ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM); - goto complete; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s GOT SCHEME", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - - if (0 != strcmp(scheme, "file")) { - /* not yet supported */ - orte_show_help("orte_dfs_help.txt", "unsupported-filesystem", - true, dfs->uri); - free(scheme); - goto complete; - } - free(scheme); - - /* dissect the uri to extract host and filename/path */ - if (NULL == (filename = opal_filename_from_uri(dfs->uri, &host))) { - goto complete; - } - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s GOT FILENAME %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), filename); - if (NULL == host) { - host = strdup(orte_process_info.nodename); - } - - /* ident the daemon on that host */ - daemon.jobid = ORTE_PROC_MY_DAEMON->jobid; - OBJ_CONSTRUCT(<, opal_list_t); - if (ORTE_SUCCESS != (rc = opal_pmix.resolve_peers(host, daemon.jobid, <))) { - ORTE_ERROR_LOG(rc); - OBJ_DESTRUCT(<); - goto complete; - } - nm = (opal_namelist_t*)opal_list_get_first(<); - daemon.vpid = nm->name.vpid; - OPAL_LIST_DESTRUCT(<); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s file %s on host %s daemon %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - filename, host, ORTE_NAME_PRINT(&daemon)); - - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* setup a message for the daemon telling - * them what file we want to access - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &filename, 1, OPAL_STRING))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending open file request to %s file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&daemon), - filename); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - goto complete; - } - /* don't release it */ - free(host); - free(filename); - return; - - complete: - /* we get here if an error occurred - execute any - * pending callback so the proc doesn't hang - */ - if (NULL != host) { - free(host); - } - if (NULL != filename) { - free(filename); - } - if (NULL != dfs->open_cbfunc) { - dfs->open_cbfunc(-1, dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - - -/* in order to handle the possible opening/reading of files by - * multiple threads, we have to ensure that all operations are - * carried out in events - so the "open" cmd simply posts an - * event containing the required info, and then returns - */ -static void dfs_open(char *uri, - orte_dfs_open_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s opening file %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), uri); - - /* setup the request */ - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_OPEN_CMD; - dfs->uri = strdup(uri); - dfs->open_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_opens, ORTE_SYS_PRI); -} - -static void process_close(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *close_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(close_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s closing fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - close_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == close_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); - return; - } - - /* setup a message for the daemon telling - * them what file to close - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &close_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending close file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - - complete: - opal_list_remove_item(&active_files, &trk->super); - OBJ_RELEASE(trk); - if (NULL != close_dfs->close_cbfunc) { - close_dfs->close_cbfunc(close_dfs->local_fd, close_dfs->cbdata); - } - OBJ_RELEASE(close_dfs); -} - -static void dfs_close(int fd, - orte_dfs_close_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s close called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_CLOSE_CMD; - dfs->local_fd = fd; - dfs->close_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_close, ORTE_SYS_PRI); -} - -static void process_sizes(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *size_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(size_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing get_size on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - size_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == size_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(size_dfs); - return; - } - - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - size_dfs->id = req_id++; - opal_list_append(&requests, &size_dfs->super); - - /* setup a message for the daemon telling - * them what file we want to access - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &size_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &size_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &size_dfs->super); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending get_size request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &size_dfs->super); - if (NULL != size_dfs->size_cbfunc) { - size_dfs->size_cbfunc(-1, size_dfs->cbdata); - } - goto complete; - } - /* leave the request there */ - return; - - complete: - OBJ_RELEASE(size_dfs); -} - -static void dfs_get_file_size(int fd, - orte_dfs_size_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s get_size called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SIZE_CMD; - dfs->local_fd = fd; - dfs->size_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_sizes, ORTE_SYS_PRI); -} - - -static void process_seeks(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *seek_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - - ORTE_ACQUIRE_OBJECT(seek_dfs); - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s processing seek on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - seek_dfs->local_fd); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == seek_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(seek_dfs); - return; - } - - /* add this request to our local list so we can - * match it with the returned response when it comes - */ - seek_dfs->id = req_id++; - opal_list_append(&requests, &seek_dfs->super); - - /* setup a message for the daemon telling - * them what file to seek - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* pass the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - opal_list_remove_item(&requests, &seek_dfs->super); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)seek_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &seek_dfs->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending seek file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - goto complete; - } - /* leave the request */ - return; - - complete: - OBJ_RELEASE(seek_dfs); -} - - -static void dfs_seek(int fd, long offset, int whence, - orte_dfs_seek_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s seek called on fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), fd); - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_SEEK_CMD; - dfs->local_fd = fd; - dfs->read_length = offset; - dfs->remote_fd = whence; - dfs->seek_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_seeks, ORTE_SYS_PRI); -} - -static void process_reads(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *read_dfs = (orte_dfs_request_t*)cbdata; - orte_dfs_tracker_t *tptr, *trk; - opal_list_item_t *item; - opal_buffer_t *buffer; - int64_t i64; - int rc; - - ORTE_ACQUIRE_OBJECT(read_dfs); - - /* look in our local records for this fd */ - trk = NULL; - for (item = opal_list_get_first(&active_files); - item != opal_list_get_end(&active_files); - item = opal_list_get_next(item)) { - tptr = (orte_dfs_tracker_t*)item; - if (tptr->local_fd == read_dfs->local_fd) { - trk = tptr; - break; - } - } - if (NULL == trk) { - ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); - OBJ_RELEASE(read_dfs); - return; - } - - /* add this request to our pending list */ - read_dfs->id = req_id++; - opal_list_append(&requests, &read_dfs->super); - - /* setup a message for the daemon telling - * them what file to read - */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &read_dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &trk->remote_fd, 1, OPAL_INT))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - i64 = (int64_t)read_dfs->read_length; - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &i64, 1, OPAL_INT64))) { - ORTE_ERROR_LOG(rc); - goto complete; - } - - opal_output_verbose(1, orte_dfs_base_framework.framework_output, - "%s sending read file request to %s for fd %d", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(&trk->host_daemon), - trk->local_fd); - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - &trk->host_daemon, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - OBJ_RELEASE(buffer); - } - /* don't release the request */ - return; - - complete: - /* don't need to hang on to this request */ - opal_list_remove_item(&requests, &read_dfs->super); - OBJ_RELEASE(read_dfs); -} - -static void dfs_read(int fd, uint8_t *buffer, - long length, - orte_dfs_read_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_READ_CMD; - dfs->local_fd = fd; - dfs->read_buffer = buffer; - dfs->read_length = length; - dfs->read_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_reads, ORTE_SYS_PRI); -} - -static void process_posts(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* we will get confirmation in our receive function, so - * add this request to our list */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* Send the buffer's contents to our local daemon for storage */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* add my name */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* pack the payload */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->bptr, 1, OPAL_BUFFER))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - ORTE_PROC_MY_DAEMON, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - goto error; - } - return; - - error: - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - if (NULL != dfs->post_cbfunc) { - dfs->post_cbfunc(dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_post_file_map(opal_buffer_t *bo, - orte_dfs_post_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_POST_CMD; - dfs->bptr = bo; - dfs->post_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_posts, ORTE_SYS_PRI); -} - -static void process_getfm(int fd, short args, void *cbdata) -{ - orte_dfs_request_t *dfs = (orte_dfs_request_t*)cbdata; - opal_buffer_t *buffer; - int rc; - - ORTE_ACQUIRE_OBJECT(dfs); - - /* we will get confirmation in our receive function, so - * add this request to our list */ - dfs->id = req_id++; - opal_list_append(&requests, &dfs->super); - - /* Send the request to our local daemon */ - buffer = OBJ_NEW(opal_buffer_t); - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->cmd, 1, ORTE_DFS_CMD_T))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* include the request id */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->id, 1, OPAL_UINT64))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* and the target */ - if (OPAL_SUCCESS != (rc = opal_dss.pack(buffer, &dfs->target, 1, ORTE_NAME))) { - ORTE_ERROR_LOG(rc); - goto error; - } - /* send it */ - if (0 > (rc = orte_rml.send_buffer_nb(orte_mgmt_conduit, - ORTE_PROC_MY_DAEMON, buffer, - ORTE_RML_TAG_DFS_CMD, - orte_rml_send_callback, NULL))) { - ORTE_ERROR_LOG(rc); - goto error; - } - return; - - error: - OBJ_RELEASE(buffer); - opal_list_remove_item(&requests, &dfs->super); - if (NULL != dfs->fm_cbfunc) { - dfs->fm_cbfunc(NULL, dfs->cbdata); - } - OBJ_RELEASE(dfs); -} - -static void dfs_get_file_map(orte_process_name_t *target, - orte_dfs_fm_callback_fn_t cbfunc, - void *cbdata) -{ - orte_dfs_request_t *dfs; - - dfs = OBJ_NEW(orte_dfs_request_t); - dfs->cmd = ORTE_DFS_GETFM_CMD; - dfs->target.jobid = target->jobid; - dfs->target.vpid = target->vpid; - dfs->fm_cbfunc = cbfunc; - dfs->cbdata = cbdata; - - /* post it for processing */ - ORTE_THREADSHIFT(dfs, orte_event_base, process_getfm, ORTE_SYS_PRI); -} - -static void dfs_load_file_maps(orte_jobid_t jobid, - opal_buffer_t *bo, - orte_dfs_load_callback_fn_t cbfunc, - void *cbdata) -{ - /* apps don't store file maps */ - if (NULL != cbfunc) { - cbfunc(cbdata); - } -} - -static void dfs_purge_file_maps(orte_jobid_t jobid, - orte_dfs_purge_callback_fn_t cbfunc, - void *cbdata) -{ - /* apps don't store file maps */ - if (NULL != cbfunc) { - cbfunc(cbdata); - } -} diff --git a/orte/mca/dfs/test/dfs_test.h b/orte/mca/dfs/test/dfs_test.h deleted file mode 100644 index d9ef7b301bb..00000000000 --- a/orte/mca/dfs/test/dfs_test.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/** - * @file - * - */ - -#ifndef MCA_dfs_test_EXPORT_H -#define MCA_dfs_test_EXPORT_H - -#include "orte_config.h" - -#include "orte/mca/dfs/dfs.h" - -BEGIN_C_DECLS - -/* - * Local Component structures - */ - -ORTE_MODULE_DECLSPEC extern orte_dfs_base_component_t mca_dfs_test_component; - -ORTE_DECLSPEC extern orte_dfs_base_module_t orte_dfs_test_module; - -END_C_DECLS - -#endif /* MCA_dfs_test_EXPORT_H */ diff --git a/orte/mca/dfs/test/dfs_test_component.c b/orte/mca/dfs/test/dfs_test_component.c deleted file mode 100644 index 11ec09ced4e..00000000000 --- a/orte/mca/dfs/test/dfs_test_component.c +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights - * reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "opal/util/output.h" - -#include "orte/runtime/orte_globals.h" - -#include "orte/mca/dfs/dfs.h" -#include "orte/mca/dfs/base/base.h" -#include "dfs_test.h" - -/* - * Public string for version number - */ -const char *orte_dfs_test_component_version_string = - "ORTE DFS test MCA component version " ORTE_VERSION; - -/* - * Local functionality - */ -static int dfs_test_register(void); -static int dfs_test_open(void); -static int dfs_test_close(void); -static int dfs_test_component_query(mca_base_module_t **module, int *priority); - -/* - * Instantiate the public struct with all of our public information - * and pointer to our public functions in it - */ -orte_dfs_base_component_t mca_dfs_test_component = -{ - /* Handle the general mca_component_t struct containing - * meta information about the component - */ - .base_version = { - ORTE_DFS_BASE_VERSION_1_0_0, - /* Component name and version */ - .mca_component_name = "test", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - - /* Component open and close functions */ - .mca_open_component = dfs_test_open, - .mca_close_component = dfs_test_close, - .mca_query_component = dfs_test_component_query, - .mca_register_component_params = dfs_test_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static bool select_me = false; - -static int dfs_test_register(void) -{ - select_me = false; - (void) mca_base_component_var_register(&mca_dfs_test_component.base_version, "select", - "Apps select the test plug-in for the DFS framework", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_ALL_EQ, &select_me); - - return ORTE_SUCCESS; -} - -static int dfs_test_open(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_test_close(void) -{ - return ORTE_SUCCESS; -} - -static int dfs_test_component_query(mca_base_module_t **module, int *priority) -{ - if (ORTE_PROC_IS_APP && select_me) { - /* set our priority high so apps use us */ - *priority = 10000; - *module = (mca_base_module_t *)&orte_dfs_test_module; - return ORTE_SUCCESS; - } - - *priority = -1; - *module = NULL; - return ORTE_ERROR; -} diff --git a/orte/mca/ess/alps/ess_alps_module.c b/orte/mca/ess/alps/ess_alps_module.c index 533a054e8b8..bfbbc3d9f62 100644 --- a/orte/mca/ess/alps/ess_alps_module.c +++ b/orte/mca/ess/alps/ess_alps_module.c @@ -45,7 +45,7 @@ static int rte_finalize(void); orte_ess_base_module_t orte_ess_alps_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + NULL, NULL /* ft_event */ }; diff --git a/orte/mca/ess/base/base.h b/orte/mca/ess/base/base.h index 65896a4e43e..139a6cff469 100644 --- a/orte/mca/ess/base/base.h +++ b/orte/mca/ess/base/base.h @@ -12,7 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/orte/mca/ess/base/ess_base_std_orted.c b/orte/mca/ess/base/ess_base_std_orted.c index 7f505338800..9711bd64fdd 100644 --- a/orte/mca/ess/base/ess_base_std_orted.c +++ b/orte/mca/ess/base/ess_base_std_orted.c @@ -52,7 +52,6 @@ #include "orte/mca/routed/base/base.h" #include "orte/mca/routed/routed.h" #include "orte/mca/oob/base/base.h" -#include "orte/mca/dfs/base/base.h" #include "orte/mca/grpcomm/grpcomm.h" #include "orte/mca/grpcomm/base/base.h" #include "orte/mca/iof/base/base.h" @@ -621,18 +620,6 @@ int orte_ess_base_orted_setup(void) goto error; } - /* setup the DFS framework */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_dfs_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_dfs_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_select"; - goto error; - } - return ORTE_SUCCESS; error: @@ -684,8 +671,6 @@ int orte_ess_base_orted_finalize(void) (void) mca_base_framework_close(&orte_iof_base_framework); (void) mca_base_framework_close(&orte_errmgr_base_framework); (void) mca_base_framework_close(&orte_plm_base_framework); - /* close the dfs so its threads can exit */ - (void) mca_base_framework_close(&orte_dfs_base_framework); /* make sure our local procs are dead */ orte_odls.kill_local_procs(NULL); (void) mca_base_framework_close(&orte_rtc_base_framework); diff --git a/orte/mca/ess/env/ess_env_module.c b/orte/mca/ess/env/ess_env_module.c index df55650e4a8..ac107d08b1f 100644 --- a/orte/mca/ess/env/ess_env_module.c +++ b/orte/mca/ess/env/ess_env_module.c @@ -77,7 +77,7 @@ static int rte_finalize(void); orte_ess_base_module_t orte_ess_env_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + NULL, NULL }; diff --git a/orte/mca/ess/hnp/ess_hnp_module.c b/orte/mca/ess/hnp/ess_hnp_module.c index 70f79e67bff..e8e811645e8 100644 --- a/orte/mca/ess/hnp/ess_hnp_module.c +++ b/orte/mca/ess/hnp/ess_hnp_module.c @@ -62,7 +62,6 @@ #include "orte/mca/routed/base/base.h" #include "orte/mca/routed/routed.h" #include "orte/mca/rtc/base/base.h" -#include "orte/mca/dfs/base/base.h" #include "orte/mca/errmgr/base/base.h" #include "orte/mca/grpcomm/base/base.h" #include "orte/mca/iof/base/base.h" @@ -699,18 +698,6 @@ static int rte_init(void) goto error; } - /* setup the dfs framework */ - if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_dfs_base_framework, 0))) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_base_open"; - goto error; - } - if (ORTE_SUCCESS != (ret = orte_dfs_base_select())) { - ORTE_ERROR_LOG(ret); - error = "orte_dfs_select"; - goto error; - } - /* setup to support debugging */ orte_state.add_job_state(ORTE_JOB_STATE_READY_FOR_DEBUGGERS, orte_debugger_init_after_spawn, @@ -795,7 +782,6 @@ static int rte_finalize(void) /* shutdown the pmix server */ pmix_server_finalize(); (void) mca_base_framework_close(&opal_pmix_base_framework); - (void) mca_base_framework_close(&orte_dfs_base_framework); (void) mca_base_framework_close(&orte_filem_base_framework); /* output any lingering stdout/err data */ fflush(stdout); diff --git a/orte/mca/ess/lsf/ess_lsf_module.c b/orte/mca/ess/lsf/ess_lsf_module.c index c2e5b4a004c..32247aeeec8 100644 --- a/orte/mca/ess/lsf/ess_lsf_module.c +++ b/orte/mca/ess/lsf/ess_lsf_module.c @@ -53,7 +53,7 @@ static int rte_finalize(void); orte_ess_base_module_t orte_ess_lsf_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + NULL, NULL /* ft_event */ }; diff --git a/orte/mca/ess/singleton/ess_singleton_module.c b/orte/mca/ess/singleton/ess_singleton_module.c index 5ad506d28c6..c35909484b8 100644 --- a/orte/mca/ess/singleton/ess_singleton_module.c +++ b/orte/mca/ess/singleton/ess_singleton_module.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science @@ -68,11 +68,12 @@ static int rte_init(void); static int rte_finalize(void); +static void rte_abort(int status, bool report); orte_ess_base_module_t orte_ess_singleton_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + rte_abort, NULL /* ft_event */ }; @@ -773,3 +774,25 @@ static int fork_hnp(void) return ORTE_SUCCESS; } } + +static void rte_abort(int status, bool report) +{ + struct timespec tp = {0, 100000}; + + OPAL_OUTPUT_VERBOSE((1, orte_ess_base_framework.framework_output, + "%s ess:singleton:abort: abort with status %d", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + status)); + + /* PMI doesn't like NULL messages, but our interface + * doesn't provide one - so rig one up here + */ + opal_pmix.abort(status, "N/A", NULL); + + /* provide a little delay for the PMIx thread to + * get the info out */ + nanosleep(&tp, NULL); + + /* Now Exit */ + _exit(status); +} diff --git a/orte/mca/ess/slurm/ess_slurm_module.c b/orte/mca/ess/slurm/ess_slurm_module.c index 97621c80372..d400de30853 100644 --- a/orte/mca/ess/slurm/ess_slurm_module.c +++ b/orte/mca/ess/slurm/ess_slurm_module.c @@ -54,7 +54,7 @@ static int rte_finalize(void); orte_ess_base_module_t orte_ess_slurm_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + NULL, NULL /* ft_event */ }; diff --git a/orte/mca/ess/tm/ess_tm_module.c b/orte/mca/ess/tm/ess_tm_module.c index 431280c74aa..646caced773 100644 --- a/orte/mca/ess/tm/ess_tm_module.c +++ b/orte/mca/ess/tm/ess_tm_module.c @@ -53,7 +53,7 @@ static int rte_finalize(void); orte_ess_base_module_t orte_ess_tm_module = { rte_init, rte_finalize, - orte_ess_base_app_abort, + NULL, NULL /* ft_event */ }; diff --git a/orte/mca/notifier/Makefile.am b/orte/mca/notifier/Makefile.am deleted file mode 100644 index 52444ea1251..00000000000 --- a/orte/mca/notifier/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# main library setup -noinst_LTLIBRARIES = libmca_notifier.la -libmca_notifier_la_SOURCES = - -# local files -headers = notifier.h - -libmca_notifier_la_SOURCES += $(headers) - -# Conditionally install the header files -if WANT_INSTALL_HEADERS -ortedir = $(includedir)/openmpi/$(subdir) -nobase_orte_HEADERS = $(headers) -endif - -include base/Makefile.am - -distclean-local: - rm -f base/static-components.h diff --git a/orte/mca/notifier/base/Makefile.am b/orte/mca/notifier/base/Makefile.am deleted file mode 100644 index 89171605f59..00000000000 --- a/orte/mca/notifier/base/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2004-2005 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) 2009 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014-2015 Intel, Inc. All rights reserved. -# -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -headers += \ - base/base.h - -libmca_notifier_la_SOURCES += \ - base/notifier_base_frame.c \ - base/notifier_base_select.c \ - base/notifier_base_fns.c diff --git a/orte/mca/notifier/base/base.h b/orte/mca/notifier/base/base.h deleted file mode 100644 index 2f944dfd9d8..00000000000 --- a/orte/mca/notifier/base/base.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004-2005 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) 2009 Cisco Systems, Inc. All rights reserved. - * - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. - * - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** @file: - */ - -#ifndef MCA_NOTIFIER_BASE_H -#define MCA_NOTIFIER_BASE_H - -/* - * includes - */ -#include "orte_config.h" - -#include "opal/class/opal_list.h" -#include "opal/mca/base/base.h" -#include "opal/mca/event/event.h" - -#include "orte/mca/notifier/notifier.h" - -BEGIN_C_DECLS - -/* - * MCA Framework - */ -ORTE_DECLSPEC extern mca_base_framework_t orte_notifier_base_framework; - -typedef struct { - opal_event_base_t *ev_base; - bool ev_base_active; - opal_list_t modules; - orte_notifier_severity_t severity_level; - char *default_actions; - char *emerg_actions; - char *alert_actions; - char *crit_actions; - char *warn_actions; - char *notice_actions; - char *info_actions; - char *debug_actions; - char *error_actions; -} orte_notifier_base_t; - -/* - * Type for holding selected module / component pairs - */ -typedef struct { - opal_list_item_t super; - /* Component */ - orte_notifier_base_component_t *component; - /* Module */ - orte_notifier_base_module_t *module; -} orte_notifier_active_module_t; -OBJ_CLASS_DECLARATION(orte_notifier_active_module_t); - -ORTE_DECLSPEC extern orte_notifier_base_t orte_notifier_base; - -/* select a component */ -ORTE_DECLSPEC int orte_notifier_base_select(void); - -/* base functions */ -ORTE_DECLSPEC void orte_notifier_base_log(int sd, short args, void *cbdata); -ORTE_DECLSPEC void orte_notifier_base_event(int sd, short args, void *cbdata); -ORTE_DECLSPEC void orte_notifier_base_report(int sd, short args, void *cbdata); - -/* severity to string */ -ORTE_DECLSPEC const char* orte_notifier_base_sev2str(orte_notifier_severity_t severity); -END_C_DECLS -#endif diff --git a/orte/mca/notifier/base/notifier_base_fns.c b/orte/mca/notifier/base/notifier_base_fns.c deleted file mode 100644 index 1a6751a2085..00000000000 --- a/orte/mca/notifier/base/notifier_base_fns.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2004-2005 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) 2008-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "orte_config.h" -#include "orte/constants.h" - -#include "opal/util/argv.h" - -#include "orte/util/attr.h" -#include "orte/util/threads.h" -#include "orte/mca/notifier/base/base.h" - - -static void orte_notifier_base_identify_modules(char ***modules, - orte_notifier_request_t *req); - -void orte_notifier_base_log(int sd, short args, void *cbdata) -{ - orte_notifier_request_t *req = (orte_notifier_request_t*)cbdata; - char **modules = NULL; - orte_notifier_active_module_t *imod; - int i; - - ORTE_ACQUIRE_OBJECT(req); - - /* if no modules are active, then there is nothing to do */ - if (0 == opal_list_get_size(&orte_notifier_base.modules)) { - return; - } - - /* check if the severity is >= severity level set for - * reporting - note that the severity enum value goes up - * as severity goes down */ - if (orte_notifier_base.severity_level < req->severity ) { - return; - } - - orte_notifier_base_identify_modules(&modules, req); - - /* no modules selected then nothing to do */ - if (NULL == modules) { - return; - } - - for (i=0; NULL != modules[i]; i++) { - OPAL_LIST_FOREACH(imod, &orte_notifier_base.modules, orte_notifier_active_module_t) { - if (NULL != imod->module->log && - 0 == strcmp(imod->component->base_version.mca_component_name, modules[i])) - imod->module->log(req); - } - } - opal_argv_free(modules); -} - -void orte_notifier_base_event(int sd, short args, void *cbdata) -{ - orte_notifier_request_t *req = (orte_notifier_request_t*)cbdata; - char **modules = NULL; - orte_notifier_active_module_t *imod; - int i; - - ORTE_ACQUIRE_OBJECT(req); - - /* if no modules are active, then there is nothing to do */ - if (0 == opal_list_get_size(&orte_notifier_base.modules)) { - return; - } - - /* check if the severity is >= severity level set for - * reporting - note that the severity enum value goes up - * as severity goes down */ - if (orte_notifier_base.severity_level < req->severity ) { - return; - } - - orte_notifier_base_identify_modules(&modules, req); - - /* no modules selected then nothing to do */ - if (NULL == modules) { - return; - } - - for (i=0; NULL != modules[i]; i++) { - OPAL_LIST_FOREACH(imod, &orte_notifier_base.modules, orte_notifier_active_module_t) { - if (NULL != imod->module->log && - 0 == strcmp(imod->component->base_version.mca_component_name, modules[i])) - imod->module->event(req); - } - } - opal_argv_free(modules); -} - -void orte_notifier_base_report(int sd, short args, void *cbdata) -{ - orte_notifier_request_t *req = (orte_notifier_request_t*)cbdata; - char **modules = NULL; - orte_notifier_active_module_t *imod; - int i; - - ORTE_ACQUIRE_OBJECT(req); - - /* if no modules are active, then there is nothing to do */ - if (0 == opal_list_get_size(&orte_notifier_base.modules)) { - return; - } - - /* see if the job requested any notifications */ - if (!orte_get_attribute(&req->jdata->attributes, ORTE_JOB_NOTIFICATIONS, (void**)modules, OPAL_STRING)) { - return; - } - - /* need to process the notification string to get the names of the modules */ - if (NULL == modules) { - orte_notifier_base_identify_modules(&modules, req); - - /* no modules selected then nothing to do */ - if (NULL == modules) { - return; - } - } - - for (i=0; NULL != modules[i]; i++) { - OPAL_LIST_FOREACH(imod, &orte_notifier_base.modules, orte_notifier_active_module_t) { - if (NULL != imod->module->log && - 0 == strcmp(imod->component->base_version.mca_component_name, modules[i])) - imod->module->report(req); - } - } - opal_argv_free(modules); -} - -const char* orte_notifier_base_sev2str(orte_notifier_severity_t severity) -{ - switch (severity) { - case ORTE_NOTIFIER_EMERG: return "EMERGENCY"; break; - case ORTE_NOTIFIER_ALERT: return "ALERT"; break; - case ORTE_NOTIFIER_CRIT: return "CRITICAL"; break; - case ORTE_NOTIFIER_ERROR: return "ERROR"; break; - case ORTE_NOTIFIER_WARN: return "WARNING"; break; - case ORTE_NOTIFIER_NOTICE: return "NOTICE"; break; - case ORTE_NOTIFIER_INFO: return "INFO"; break; - case ORTE_NOTIFIER_DEBUG: return "DEBUG"; break; - default: return "UNKNOWN"; break; - } -} - -static void orte_notifier_base_identify_modules(char ***modules, - orte_notifier_request_t *req) -{ - if (NULL != req->action) { - *modules = opal_argv_split(req->action, ','); - } else { - if (ORTE_NOTIFIER_EMERG == req->severity && - (NULL != orte_notifier_base.emerg_actions)) { - *modules = opal_argv_split(orte_notifier_base.emerg_actions, ','); - } else if (ORTE_NOTIFIER_ALERT == req->severity && - (NULL != orte_notifier_base.alert_actions)) { - *modules = opal_argv_split(orte_notifier_base.alert_actions, ','); - } else if (ORTE_NOTIFIER_CRIT == req->severity && - (NULL != orte_notifier_base.crit_actions)) { - *modules = opal_argv_split(orte_notifier_base.crit_actions, ','); - } else if (ORTE_NOTIFIER_WARN == req->severity && - (NULL != orte_notifier_base.warn_actions)) { - *modules = opal_argv_split(orte_notifier_base.warn_actions, ','); - } else if (ORTE_NOTIFIER_NOTICE == req->severity && - (NULL != orte_notifier_base.notice_actions)) { - *modules = opal_argv_split(orte_notifier_base.notice_actions, ','); - } else if (ORTE_NOTIFIER_INFO == req->severity && - (NULL != orte_notifier_base.info_actions)) { - *modules = opal_argv_split(orte_notifier_base.info_actions, ','); - } else if (ORTE_NOTIFIER_DEBUG == req->severity && - (NULL != orte_notifier_base.debug_actions)) { - *modules = opal_argv_split(orte_notifier_base.debug_actions, ','); - } else if (ORTE_NOTIFIER_ERROR == req->severity && - (NULL != orte_notifier_base.error_actions)) { - *modules = opal_argv_split(orte_notifier_base.error_actions, ','); - } else if (NULL != orte_notifier_base.default_actions) { - *modules = opal_argv_split(orte_notifier_base.default_actions, ','); - } - } - return; -} diff --git a/orte/mca/notifier/base/notifier_base_frame.c b/orte/mca/notifier/base/notifier_base_frame.c deleted file mode 100644 index 207998c4738..00000000000 --- a/orte/mca/notifier/base/notifier_base_frame.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2004-2005 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) 2008-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "orte_config.h" -#include "orte/constants.h" - -#include - -#include "orte/mca/mca.h" -#include "opal/util/argv.h" -#include "opal/util/fd.h" -#include "opal/util/output.h" -#include "opal/mca/base/base.h" -#include "opal/class/opal_pointer_array.h" -#include "opal/runtime/opal_progress_threads.h" -#include "orte/mca/notifier/base/base.h" - -/* default module to use for logging*/ -#define ORTE_NOTIFIER_DEFAULT_MODULE "syslog" - -/* - * The following file was created by configure. It contains extern - * statements and the definition of an array of pointers to each - * component's public mca_base_component_t struct. - */ - -#include "orte/mca/notifier/base/static-components.h" - -/* - * Global variables - */ -opal_list_t orte_notifier_base_components_available = {{0}}; -int orte_notifier_debug_output = -1; - -orte_notifier_base_t orte_notifier_base = {0}; - -static char *notifier_severity = NULL; -static bool use_progress_thread = false; - -/** - * Function for selecting a set of components from all those that are - * available. - * - * Examples: - * 1) - * -mca notifier syslog,smtp - * --> syslog and smtp are selected for the loging - */ -static int orte_notifier_base_register(mca_base_register_flag_t flags) -{ - (void) mca_base_var_register("orte", "notifier", "base", "use_progress_thread", - "Use a dedicated progress thread for notifications [default: false]", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &use_progress_thread); - - /* let the user define a base level of severity to report */ - (void) mca_base_var_register("orte", "notifier", "base", "severity_level", - "Report all events at or above this severity [default: error]", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - ¬ifier_severity); - if (NULL == notifier_severity) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_ERROR; - } else if (0 == strncasecmp(notifier_severity, "emerg", strlen("emerg"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_EMERG; - } else if (0 == strncasecmp(notifier_severity, "alert", strlen("alert"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_ALERT; - } else if (0 == strncasecmp(notifier_severity, "crit", strlen("crit"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_CRIT; - } else if (0 == strncasecmp(notifier_severity, "warn", strlen("warn"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_WARN; - } else if (0 == strncasecmp(notifier_severity, "notice", strlen("notice"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_NOTICE; - } else if (0 == strncasecmp(notifier_severity, "info", strlen("info"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_INFO; - } else if (0 == strncasecmp(notifier_severity, "debug", strlen("debug"))) { - orte_notifier_base.severity_level = ORTE_NOTIFIER_DEBUG; - } else { - orte_notifier_base.severity_level = ORTE_NOTIFIER_ERROR; - } - - /* let the user define a base default actions */ - orte_notifier_base.default_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "default_actions", - "Report all events to the default actions:NONE,syslog,smtp", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.default_actions); - - if (NULL == orte_notifier_base.default_actions) { - orte_notifier_base.default_actions = strdup(ORTE_NOTIFIER_DEFAULT_MODULE); - } - /* let the user define a action for emergency events */ - orte_notifier_base.emerg_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "emerg_event_actions", - "Report emergency events to the specified actions: example 'smtp'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.emerg_actions); - - /* let the user define a action for alert events */ - orte_notifier_base.alert_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "alert_event_actions", - "Report alert events to the specified actions: example 'smtp'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.alert_actions); - - /* let the user define a action for critical events */ - orte_notifier_base.crit_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "crit_event_actions", - "Report critical events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.crit_actions); - - /* let the user define a action for warning events */ - orte_notifier_base.warn_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "warn_event_actions", - "Report warning events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.warn_actions); - - /* let the user define a action for notice events */ - orte_notifier_base.notice_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "notice_event_actions", - "Report notice events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.notice_actions); - - /* let the user define a action for info events */ - orte_notifier_base.info_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "info_event_actions", - "Report info events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.info_actions); - - /* let the user define a action for debug events */ - orte_notifier_base.debug_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "debug_event_actions", - "Report debug events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.debug_actions); - - /* let the user define a action for error events */ - orte_notifier_base.error_actions = NULL; - (void) mca_base_var_register("orte", "notifier", "base", "error_event_actions", - "Report error events to the specified actions: example 'syslog'", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_notifier_base.error_actions); - - return ORTE_SUCCESS; -} - -static int orte_notifier_base_close(void) -{ - orte_notifier_active_module_t *i_module; - - if (orte_notifier_base.ev_base_active) { - orte_notifier_base.ev_base_active = false; - opal_progress_thread_finalize("notifier"); - } - - OPAL_LIST_FOREACH(i_module, &orte_notifier_base.modules, orte_notifier_active_module_t) { - if (NULL != i_module->module->finalize) { - i_module->module->finalize(); - } - } - OPAL_LIST_DESTRUCT(&orte_notifier_base.modules); - - /* close all remaining available components */ - return mca_base_framework_components_close(&orte_notifier_base_framework, NULL); -} - -/** - * Function for finding and opening either all MCA components, or the one - * that was specifically requested via a MCA parameter. - */ -static int orte_notifier_base_open(mca_base_open_flag_t flags) -{ - int rc; - - /* construct the array of modules */ - OBJ_CONSTRUCT(&orte_notifier_base.modules, opal_list_t); - - /* if requested, create our own event base */ - if (use_progress_thread) { - orte_notifier_base.ev_base_active = true; - if (NULL == (orte_notifier_base.ev_base = - opal_progress_thread_init("notifier"))) { - orte_notifier_base.ev_base_active = false; - return ORTE_ERROR; - } - } else { - orte_notifier_base.ev_base = orte_event_base; - } - - /* Open up all available components */ - rc = mca_base_framework_components_open(&orte_notifier_base_framework, - flags); - orte_notifier_debug_output = orte_notifier_base_framework.framework_output; - return rc; -} - -MCA_BASE_FRAMEWORK_DECLARE(orte, notifier, "ORTE Notifier Framework", - orte_notifier_base_register, - orte_notifier_base_open, orte_notifier_base_close, - mca_notifier_base_static_components, 0); - - -OBJ_CLASS_INSTANCE (orte_notifier_active_module_t, - opal_list_item_t, - NULL, NULL); - -static void req_cons (orte_notifier_request_t *r) -{ - r->jdata = NULL; - r->msg = NULL; - r->t = 0; -} -static void req_des(orte_notifier_request_t *r) -{ - if (NULL != r->jdata) { - OBJ_RELEASE(r->jdata); - } -} -OBJ_CLASS_INSTANCE (orte_notifier_request_t, - opal_object_t, - req_cons, req_des); diff --git a/orte/mca/notifier/base/notifier_base_select.c b/orte/mca/notifier/base/notifier_base_select.c deleted file mode 100644 index cdd9142ff2e..00000000000 --- a/orte/mca/notifier/base/notifier_base_select.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004-2008 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) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - - -#include "orte_config.h" - -#include - -#include "orte/mca/mca.h" -#include "opal/mca/base/base.h" -#include "opal/util/argv.h" -#include "opal/util/output.h" -#include "opal/class/opal_pointer_array.h" - -#include "orte/mca/notifier/base/base.h" - -/* Global variables */ -/* - * orte_notifier_base_selected is set to true if at least 1 module has - * been selected for the notifier log API interface. - */ -static bool orte_notifier_base_selected = false; - -/** - * Function for weeding out notifier components that don't want to run. - * - * Call the init function on all available compoenent to find out if - * they want to run. Select all components that don't fail. Failing - * Components will be closed and unloaded. The selected modules will - * be returned to the called in a opal_list_t. - */ - -int orte_notifier_base_select(void) -{ - mca_base_component_list_item_t *cli = NULL; - orte_notifier_base_component_t *component = NULL; - mca_base_module_t *module = NULL; - int priority; - orte_notifier_active_module_t *tmp_module; - orte_notifier_base_module_t *bmod; - - if (orte_notifier_base_selected) { - return ORTE_SUCCESS; - } - orte_notifier_base_selected = true; - - opal_output_verbose(10, orte_notifier_base_framework.framework_output, - "notifier:base:select: Auto-selecting components"); - - /* - * Traverse the list of available components. - * For each call their 'query' functions to see if they are available. - */ - OPAL_LIST_FOREACH(cli, &orte_notifier_base_framework.framework_components, mca_base_component_list_item_t) { - component = (orte_notifier_base_component_t *) cli->cli_component; - - /* - * If there is a query function then use it. - */ - if (NULL == component->base_version.mca_query_component) { - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:base:select Skipping component [%s]. It does not implement a query function", - component->base_version.mca_component_name ); - continue; - } - - /* - * Query this component for the module and priority - */ - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:base:select Querying component [%s]", - component->base_version.mca_component_name); - - component->base_version.mca_query_component(&module, &priority); - - /* - * If no module was returned or negative priority, then skip component - */ - if (NULL == module || priority < 0) { - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:base:select Skipping component [%s]. Query failed to return a module", - component->base_version.mca_component_name ); - continue; - } - bmod = (orte_notifier_base_module_t*)module; - - /* see if it can be init'd */ - if (NULL != bmod->init) { - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:base:init module called with priority [%s] %d", - component->base_version.mca_component_name, priority); - if (ORTE_SUCCESS != bmod->init()) { - continue; - } - } - /* - * Append them to the list - */ - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:base:select adding component [%s]", - component->base_version.mca_component_name); - tmp_module = OBJ_NEW(orte_notifier_active_module_t); - tmp_module->component = component; - tmp_module->module = (orte_notifier_base_module_t*)module; - - opal_list_append(&orte_notifier_base.modules, (void*)tmp_module); - } - - return ORTE_SUCCESS; -} diff --git a/orte/mca/notifier/notifier.h b/orte/mca/notifier/notifier.h deleted file mode 100644 index 8c7eb8529d4..00000000000 --- a/orte/mca/notifier/notifier.h +++ /dev/null @@ -1,234 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 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 - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All Rights Reserved. - * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights - * reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ -/** @file: - * - * The OpenRTE Notifier Framework - * - * The OpenRTE Notifier framework provides a mechanism for notifying - * system administrators or other fault monitoring systems that a - * problem with the underlying cluster has been detected - e.g., a - * failed connection in a network fabric - */ - -#ifndef MCA_NOTIFIER_H -#define MCA_NOTIFIER_H - -/* - * includes - */ - -#include "orte_config.h" - -#include -#include -#ifdef HAVE_SYSLOG_H -#include -#endif - -#include "orte/mca/mca.h" - -#include "orte/constants.h" -#include "orte/types.h" - -#include "orte/runtime/orte_globals.h" -#include "orte/util/threads.h" - -BEGIN_C_DECLS - -/* make the verbose channel visible here so everyone - * doesn't have to include notifier/base/base.h */ -ORTE_DECLSPEC extern int orte_notifier_debug_output; - -/* The maximum size of any on-stack buffers used in the notifier - * so we can try to avoid calling malloc in OUT_OF_RESOURCES conditions. - * The code has NOT been auditied for use of malloc, so this still - * may fail to get the "OUT_OF_RESOURCE" message out. Oh Well. - */ -#define ORTE_NOTIFIER_MAX_BUF 512 - -/* Severities */ -typedef enum { -#ifdef HAVE_SYSLOG_H - ORTE_NOTIFIER_EMERG = LOG_EMERG, - ORTE_NOTIFIER_ALERT = LOG_ALERT, - ORTE_NOTIFIER_CRIT = LOG_CRIT, - ORTE_NOTIFIER_ERROR = LOG_ERR, - ORTE_NOTIFIER_WARN = LOG_WARNING, - ORTE_NOTIFIER_NOTICE = LOG_NOTICE, - ORTE_NOTIFIER_INFO = LOG_INFO, - ORTE_NOTIFIER_DEBUG = LOG_DEBUG -#else - ORTE_NOTIFIER_EMERG, - ORTE_NOTIFIER_ALERT, - ORTE_NOTIFIER_CRIT, - ORTE_NOTIFIER_ERROR, - ORTE_NOTIFIER_WARN, - ORTE_NOTIFIER_NOTICE, - ORTE_NOTIFIER_INFO, - ORTE_NOTIFIER_DEBUG -#endif -} orte_notifier_severity_t; - -typedef struct { - opal_object_t super; - opal_event_t ev; - orte_job_t *jdata; - orte_job_state_t state; - orte_notifier_severity_t severity; - int errcode; - const char *msg; - const char *action; - time_t t; -} orte_notifier_request_t; -OBJ_CLASS_DECLARATION(orte_notifier_request_t); - -/* - * Component functions - all MUST be provided! - */ - -/* initialize the selected module */ -typedef int (*orte_notifier_base_module_init_fn_t)(void); - -/* finalize the selected module */ -typedef void (*orte_notifier_base_module_finalize_fn_t)(void); - -/* Log an internal error - this will include the job that caused the - * error to occur */ -typedef void (*orte_notifier_base_module_log_fn_t)(orte_notifier_request_t *req); - -/* Report a system event - e.g., a temperature out-of-bound */ -typedef void (*orte_notifier_base_module_event_fn_t)(orte_notifier_request_t *req); - -/* Report a job state */ -typedef void (*orte_notifier_base_module_report_fn_t)(orte_notifier_request_t *req); - - -#define ORTE_NOTIFIER_INTERNAL_ERROR(j, st, s, e, m) \ - do { \ - orte_notifier_request_t *_n; \ - opal_output_verbose(2, orte_notifier_debug_output, \ - "%s notifier:internal:error[%s:%d] " \ - "job %s error %s severity %s", \ - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \ - __FILE__, __LINE__, \ - ORTE_JOBID_PRINT((NULL == (j)) ? \ - ORTE_JOBID_INVALID : \ - (j)->jobid), \ - ORTE_ERROR_NAME((e)), \ - orte_notifier_base_sev2str(s)); \ - _n = OBJ_NEW(orte_notifier_request_t); \ - _n->jdata = (j); \ - _n->state = (st); \ - _n->severity = (s); \ - _n->errcode = (e); \ - _n->msg = (m); \ - _n->t = time(NULL); \ - _n->action = (NULL); \ - /* add the event */ \ - opal_event_set(orte_notifier_base.ev_base, &(_n)->ev, -1, \ - OPAL_EV_WRITE, orte_notifier_base_log, (_n)); \ - opal_event_set_priority(&(_n)->ev, ORTE_ERROR_PRI); \ - ORTE_POST_OBJECT(_n); \ - opal_event_active(&(_n)->ev, OPAL_EV_WRITE, 1); \ - } while(0); - -#define ORTE_NOTIFIER_JOB_STATE(j, st, m) \ - do { \ - orte_notifier_request_t *_n; \ - opal_output_verbose(2, orte_notifier_debug_output, \ - "%s notifier[%s:%d] job %s state %s", \ - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \ - __FILE__, __LINE__, \ - ORTE_JOBID_PRINT((NULL == (j)) ? \ - ORTE_JOBID_INVALID : \ - (j)->jobid), \ - orte_job_state_to_str(st)); \ - _n = OBJ_NEW(orte_notifier_request_t); \ - _n->jdata = (j); \ - _n->state = (st); \ - _n->msg = (m); \ - _n->t = time(NULL); \ - _n->action = (NULL); \ - /* add the event */ \ - opal_event_set(orte_notifier_base.ev_base, &(_n)->ev, -1, \ - OPAL_EV_WRITE, orte_notifier_base_report, (_n)); \ - opal_event_set_priority(&(_n)->ev, ORTE_ERROR_PRI); \ - ORTE_POST_OBJECT(_n); \ - opal_event_active(&(_n)->ev, OPAL_EV_WRITE, 1); \ - } while(0); - -#define ORTE_NOTIFIER_SYSTEM_EVENT(s, m, a) \ - do { \ - orte_notifier_request_t *_n; \ - opal_output_verbose(2, orte_notifier_debug_output, \ - "%s notifier:sys:event[%s:%d] event %s", \ - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), \ - __FILE__, __LINE__, \ - orte_notifier_base_sev2str(s)); \ - _n = OBJ_NEW(orte_notifier_request_t); \ - _n->jdata = (NULL); \ - _n->state = (NULL); \ - _n->jdata = NULL; \ - _n->msg = (m); \ - _n->t = time(NULL); \ - _n->severity = (s); \ - _n->action = (a); \ - /* add the event */ \ - opal_event_set(orte_notifier_base.ev_base, &(_n)->ev, -1, \ - OPAL_EV_WRITE, orte_notifier_base_event, (_n)); \ - opal_event_set_priority(&(_n)->ev, ORTE_ERROR_PRI); \ - ORTE_POST_OBJECT(_n); \ - opal_event_active(&(_n)->ev, OPAL_EV_WRITE, 1); \ - } while(0); - -/* - * Ver 1.0 - */ -typedef struct { - orte_notifier_base_module_init_fn_t init; - orte_notifier_base_module_finalize_fn_t finalize; - orte_notifier_base_module_log_fn_t log; - orte_notifier_base_module_event_fn_t event; - orte_notifier_base_module_report_fn_t report; -} orte_notifier_base_module_t; - - -/* - * the standard component data structure - */ -typedef struct { - mca_base_component_t base_version; - mca_base_component_data_t base_data; -} orte_notifier_base_component_t; - - -/* - * Macro for use in components that are of type notifier v1.0.0 - */ -#define ORTE_NOTIFIER_BASE_VERSION_1_0_0 \ - /* notifier v1.0 is chained to MCA v2.0 */ \ - ORTE_MCA_BASE_VERSION_2_1_0("notifier", 1, 0, 0) - -END_C_DECLS - -#endif /* MCA_NOTIFIER_H */ diff --git a/orte/mca/notifier/smtp/.opal_ignore b/orte/mca/notifier/smtp/.opal_ignore deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/orte/mca/notifier/smtp/Makefile.am b/orte/mca/notifier/smtp/Makefile.am deleted file mode 100644 index 87e978e534c..00000000000 --- a/orte/mca/notifier/smtp/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -# -# Copyright (c) 2004-2005 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) 2009-2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Intel, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -AM_CPPFLAGS = $(notifier_smtp_CPPFLAGS) - -dist_ortedata_DATA = \ - help-orte-notifier-smtp.txt - -sources = \ - notifier_smtp.h \ - notifier_smtp_module.c \ - notifier_smtp_component.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_notifier_smtp_DSO -component_noinst = -component_install = mca_notifier_smtp.la -else -component_noinst = libmca_notifier_smtp.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_notifier_smtp_la_SOURCES = $(sources) -mca_notifier_smtp_la_LDFLAGS = -module -avoid-version $(notifier_smtp_LDFLAGS) -mca_notifier_smtp_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la \ - $(notifier_smtp_LIBS) - -noinst_LTLIBRARIES = $(component_noinst) -libmca_notifier_smtp_la_SOURCES =$(sources) -libmca_notifier_smtp_la_LDFLAGS = -module -avoid-version $(notifier_smtp_LDFLAGS) -libmca_notifier_smtp_la_LIBADD = $(notifier_smtp_LIBS) diff --git a/orte/mca/notifier/smtp/configure.m4 b/orte/mca/notifier/smtp/configure.m4 deleted file mode 100644 index a4a4771050a..00000000000 --- a/orte/mca/notifier/smtp/configure.m4 +++ /dev/null @@ -1,39 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2004-2005 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) 2009-2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Intel, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_notifier_smtp_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_orte_notifier_smtp_CONFIG], [ - AC_CONFIG_FILES([orte/mca/notifier/smtp/Makefile]) - - AC_CHECK_TYPES( [include/libesmtp.h], - [libesmtp*], - [libesmtp.h], - [esmtp], - [smtp_create_session], - [], - [orte_notifier_want_smtp=1], - [orte_notifier_want_smtp=0]) - - AS_IF([test "$orte_notifier_want_smtp" = 1], - [$1], - [$2]) -])dnl diff --git a/orte/mca/notifier/smtp/help-orte-notifier-smtp.txt b/orte/mca/notifier/smtp/help-orte-notifier-smtp.txt deleted file mode 100644 index 58b06bc81bb..00000000000 --- a/orte/mca/notifier/smtp/help-orte-notifier-smtp.txt +++ /dev/null @@ -1,33 +0,0 @@ -# -*- text -*- -# -# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# -# This is the US/English help file for Open MPI's SMTP notifier support -# -[to/from not specified] -Error: the Open MPI SMTP notifier component had no "to" and/or "from" -email addresses specified. -# -[server not specified] -Error: the Open MPI SMTP notifier component had no SMTP server name or -IP address specified. -# -[unable to resolve server] -Sorry, Open MPI's SMTP notifier component was unable to resolve the IP -address of the server provided. - - Server: %s -# -[send_email failed] -Oops! Open MPI's SMTP notifier failed to send an email. - - Reason: %s - libESMTP function: %s - libESMTP message: %s - Message: %s -# diff --git a/orte/mca/notifier/smtp/notifier_smtp.h b/orte/mca/notifier/smtp/notifier_smtp.h deleted file mode 100644 index 56732541864..00000000000 --- a/orte/mca/notifier/smtp/notifier_smtp.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- C -*- - * - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ -#ifndef NOTIFIER_SMTP_H -#define NOTIFIER_SMTP_H - -#include "orte_config.h" - -#include - -#include "libesmtp.h" - -#include "orte/mca/notifier/notifier.h" - -BEGIN_C_DECLS - -typedef struct { - orte_notifier_base_component_t super; - - /* libesmtp version */ - char *version; - - /* SMTP server name and port */ - char *server; - int port; - - /* To, From, Subject */ - char *to, **to_argv, *from_name, *from_addr, *subject; - - /* Mail body prefix and suffix */ - char *body_prefix, *body_suffix; - - /* struct hostent from resolved SMTP server name */ - struct hostent *server_hostent; - - /* Priority of this component */ - int priority; -} orte_notifier_smtp_component_t; - - -/* - * Notifier interfaces - */ -ORTE_MODULE_DECLSPEC extern orte_notifier_smtp_component_t - mca_notifier_smtp_component; -extern orte_notifier_base_module_t orte_notifier_smtp_module; - -END_C_DECLS - -#endif diff --git a/orte/mca/notifier/smtp/notifier_smtp_component.c b/orte/mca/notifier/smtp/notifier_smtp_component.c deleted file mode 100644 index ee37eda593a..00000000000 --- a/orte/mca/notifier/smtp/notifier_smtp_component.c +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 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) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ -*/ - -/* - * Simple smtp notifier (using libesmtp) - */ - -#include "orte_config.h" - -#include "opal/mca/base/mca_base_var.h" - -#include "orte/constants.h" -#include "orte/util/show_help.h" - -#include "notifier_smtp.h" - -static int smtp_component_query(mca_base_module_t **module, int *priority); -static int smtp_close(void); -static int smtp_register(void); - -/* - * Struct of function pointers that need to be initialized - */ -orte_notifier_smtp_component_t mca_notifier_smtp_component = { - { - .base_version = { - ORTE_NOTIFIER_BASE_VERSION_1_0_0, - - .mca_component_name = "smtp", - - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - .mca_close_component = smtp_close, - .mca_query_component = smtp_component_query, - .mca_register_component_params = smtp_register, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, - }, -}; - -static int smtp_register(void) -{ - char version[256]; - - /* Server stuff */ - mca_notifier_smtp_component.server = strdup("localhost"); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "server", - "SMTP server name or IP address", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.server); - - mca_notifier_smtp_component.port = 25; - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "port", - "SMTP server port", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.port); - - /* Email stuff */ - mca_notifier_smtp_component.to = NULL; - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "to", - "Comma-delimited list of email addresses to send to", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.to); - mca_notifier_smtp_component.from_addr = NULL; - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "from_addr", - "Email address that messages will be from", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.from_addr); - mca_notifier_smtp_component.from_name = strdup("ORTE Notifier"); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "from_name", - "Email name that messages will be from", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.from_name); - mca_notifier_smtp_component.subject = strdup("ORTE Notifier"); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "subject", - "Email subject", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.subject); - - /* Mail body prefix and suffix */ - mca_notifier_smtp_component.body_prefix = strdup("The ORTE SMTP notifier wishes to inform you of the following message:\n\n"); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "body_prefix", - "Text to put at the beginning of the mail message", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.body_prefix); - mca_notifier_smtp_component.body_suffix = strdup("\n\nSincerely,\nOscar the ORTE Owl"); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "body_prefix", - "Text to put at the end of the mail message", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.body_suffix); - - /* Priority */ - mca_notifier_smtp_component.priority = 10; - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "priority", - "Priority of this component", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.priority); - /* Libesmtp version */ - smtp_version(version, sizeof(version), 0); - version[sizeof(version) - 1] = '\0'; - mca_notifier_smtp_component.version = strdup(version); - (void) mca_base_component_var_register(&mca_notifier_smtp_component.super.base_version, "libesmtp_version", - "Version of libesmtp that this component is linked against", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &mca_notifier_smtp_component.version); - - return ORTE_SUCCESS; -} - -static int smtp_close(void) -{ - return ORTE_SUCCESS; -} - -static int smtp_component_query(mca_base_module_t **module, - int *priority) -{ - *priority = 0; - *module = NULL; - - /* If there's no to or from, there's no love */ - if (NULL == mca_notifier_smtp_component.to || - '\0' == mca_notifier_smtp_component.to[0] || - NULL == mca_notifier_smtp_component.from_addr || - '\0' == mca_notifier_smtp_component.from_addr[0]) { - orte_show_help("help-orte-notifier-smtp.txt", - "to/from not specified", true); - return ORTE_ERR_NOT_FOUND; - } - - /* Sanity checks */ - if (NULL == mca_notifier_smtp_component.server || - '\0' == mca_notifier_smtp_component.server[0]) { - orte_show_help("help-orte-notifier-smtp.txt", - "server not specified", true); - return ORTE_ERR_NOT_FOUND; - } - - /* Since we have to open a socket later, try to resolve the IP - address of the server now. Save the result, or abort if we - can't resolve it. */ - mca_notifier_smtp_component.server_hostent = - gethostbyname(mca_notifier_smtp_component.server); - if (NULL == mca_notifier_smtp_component.server_hostent) { - orte_show_help("help-orte-notifier-smtp.txt", - "unable to resolve server", - true, mca_notifier_smtp_component.server); - return ORTE_ERR_NOT_FOUND; - } - - *priority = 10; - *module = (mca_base_module_t *)&orte_notifier_smtp_module; - return ORTE_SUCCESS; -} diff --git a/orte/mca/notifier/smtp/notifier_smtp_module.c b/orte/mca/notifier/smtp/notifier_smtp_module.c deleted file mode 100644 index 666fd080281..00000000000 --- a/orte/mca/notifier/smtp/notifier_smtp_module.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright (c) 2004-2005 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) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -/* - * Send an email upon notifier events. - */ - -#include "orte_config.h" - -#include -#include -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#include - -#include "opal/util/show_help.h" -#include "opal/util/argv.h" - -#include "orte/constants.h" -#include "orte/mca/ess/ess.h" -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" -#include "orte/util/show_help.h" -#include "orte/runtime/orte_globals.h" -#include "orte/mca/notifier/base/base.h" - -#include "notifier_smtp.h" - - -/* Static API's */ -static void mylog(orte_notifier_base_severity_t severity, int errcode, - const char *msg, va_list ap); - -/* Module */ -orte_notifier_base_module_t orte_notifier_smtp_module = { - .log = mylog -}; - -typedef enum { - SENT_NONE, - SENT_HEADER, - SENT_BODY_PREFIX, - SENT_BODY, - SENT_BODY_SUFFIX, - SENT_ALL -} sent_flag_t; - -typedef struct { - sent_flag_t sent_flag; - char *msg; - char *prev_string; -} message_status_t; - -/* - * Convert lone \n's to \r\n - */ -static char *crnl(char *orig) -{ - int i, j, max, count; - char *str; - return strdup(orig); - - /* Count how much space we need */ - count = max = strlen(orig); - for (i = 0; i < max; ++i) { - if (orig[i] == '\n' && i > 0 && orig[i - 1] != '\r') { - ++count; - } - } - - /* Copy, changing \n to \r\n */ - str = malloc(count + 1); - for (j = i = 0; i < max; ++i) { - if (orig[i] == '\n' && i > 0 && orig[i - 1] != '\r') { - str[j++] = '\n'; - } - str[j++] = orig[i]; - } - str[j] = '\0'; - return str; -} - -/* - * Callback function invoked via smtp_start_session() - */ -static const char *message_cb(void **buf, int *len, void *arg) -{ - message_status_t *ms = (message_status_t*) arg; - - if (NULL == *buf) { - *buf = malloc(8192); - } - if (NULL == len) { - ms->sent_flag = SENT_NONE; - return NULL; - } - - /* Free the previous string */ - if (NULL != ms->prev_string) { - free(ms->prev_string); - ms->prev_string = NULL; - } - - switch (ms->sent_flag) { - case SENT_NONE: - /* Send a blank line to signify the end of the header */ - ms->sent_flag = SENT_HEADER; - ms->prev_string = NULL; - *len = 2; - return "\r\n"; - - case SENT_HEADER: - if (NULL != mca_notifier_smtp_component.body_prefix) { - ms->sent_flag = SENT_BODY_PREFIX; - ms->prev_string = crnl(mca_notifier_smtp_component.body_prefix); - *len = strlen(ms->prev_string); - return ms->prev_string; - } - - case SENT_BODY_PREFIX: - ms->sent_flag = SENT_BODY; - ms->prev_string = crnl(ms->msg); - *len = strlen(ms->prev_string); - return ms->prev_string; - - case SENT_BODY: - if (NULL != mca_notifier_smtp_component.body_suffix) { - ms->sent_flag = SENT_BODY_SUFFIX; - ms->prev_string = crnl(mca_notifier_smtp_component.body_suffix); - *len = strlen(ms->prev_string); - return ms->prev_string; - } - - case SENT_BODY_SUFFIX: - case SENT_ALL: - default: - ms->sent_flag = SENT_ALL; - *len = 0; - return NULL; - } -} - -/* - * Back-end function to actually send the email - */ -static int send_email(char *msg) -{ - int i, err = ORTE_SUCCESS; - char *str = NULL; - char *errmsg = NULL; - struct sigaction sig, oldsig; - bool set_oldsig = false; - smtp_session_t session = NULL; - smtp_message_t message = NULL; - message_status_t ms; - orte_notifier_smtp_component_t *c = &mca_notifier_smtp_component; - - if (NULL == c->to_argv) { - c->to_argv = opal_argv_split(c->to, ','); - if (NULL == c->to_argv || - NULL == c->to_argv[0]) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - } - - ms.sent_flag = SENT_NONE; - ms.prev_string = NULL; - ms.msg = msg; - - /* Temporarily disable SIGPIPE so that if remote servers timeout - or hang up on us, it doesn't kill this application. We'll - restore the original SIGPIPE handler when we're done. */ - sig.sa_handler = SIG_IGN; - sigemptyset(&sig.sa_mask); - sig.sa_flags = 0; - sigaction(SIGPIPE, &sig, &oldsig); - set_oldsig = true; - - /* Try to get a libesmtp session. If so, assume that libesmtp is - happy and proceeed */ - session = smtp_create_session(); - if (NULL == session) { - err = ORTE_ERR_NOT_SUPPORTED; - errmsg = "stmp_create_session"; - goto error; - } - - /* Create the message */ - message = smtp_add_message(session); - if (NULL == message) { - err = ORTE_ERROR; - errmsg = "stmp_add_message"; - goto error; - } - - /* Set the SMTP server (yes, it's a weird return status!) */ - asprintf(&str, "%s:%d", c->server, c->port); - if (0 == smtp_set_server(session, str)) { - err = ORTE_ERROR; - errmsg = "stmp_set_server"; - goto error; - } - free(str); - str = NULL; - - /* Add the sender */ - if (0 == smtp_set_reverse_path(message, c->from_addr)) { - err = ORTE_ERROR; - errmsg = "stmp_set_reverse_path"; - goto error; - } - - /* Set the subject and some headers */ - asprintf(&str, "Open MPI SMTP Notifier v%d.%d.%d", - c->super.base_version.mca_component_major_version, - c->super.base_version.mca_component_minor_version, - c->super.base_version.mca_component_release_version); - if (0 == smtp_set_header(message, "Subject", c->subject) || - 0 == smtp_set_header_option(message, "Subject", Hdr_OVERRIDE, 1) || - 0 == smtp_set_header(message, "To", NULL, NULL) || - 0 == smtp_set_header(message, "From", - (NULL != c->from_name ? - c->from_name : c->from_addr), - c->from_addr) || - 0 == smtp_set_header(message, "X-Mailer", str) || - 0 == smtp_set_header_option(message, "Subject", Hdr_OVERRIDE, 1)) { - err = ORTE_ERROR; - errmsg = "smtp_set_header"; - goto error; - } - free(str); - str = NULL; - - /* Add the recipients */ - for (i = 0; NULL != c->to_argv[i]; ++i) { - if (NULL == smtp_add_recipient(message, c->to_argv[i])) { - err = ORTE_ERR_OUT_OF_RESOURCE; - errmsg = "stmp_add_recipient"; - goto error; - } - } - - /* Set the callback to get the message */ - if (0 == smtp_set_messagecb(message, message_cb, &ms)) { - err = ORTE_ERROR; - errmsg = "smtp_set_messagecb"; - goto error; - } - - /* Send it! */ - if (0 == smtp_start_session(session)) { - err = ORTE_ERROR; - errmsg = "smtp_start_session"; - goto error; - } - - /* Fall through */ - - error: - if (NULL != str) { - free(str); - } - if (NULL != session) { - smtp_destroy_session(session); - } - /* Restore the SIGPIPE handler */ - if (set_oldsig) { - sigaction(SIGPIPE, &oldsig, NULL); - } - if (ORTE_SUCCESS != err) { - int e; - char em[256]; - - e = smtp_errno(); - smtp_strerror(e, em, sizeof(em)); - orte_show_help("help-orte-notifier-smtp.txt", - "send_email failed", - true, "libesmtp library call failed", - errmsg, em, e, msg); - } - return err; -} - -static void mylog(orte_notifier_base_severity_t severity, int errcode, - const char *msg, va_list ap) -{ - char *output; - - /* If there was a message, output it */ - vasprintf(&output, msg, ap); - - if (NULL != output) { - send_email(output); - free(output); - } -} diff --git a/orte/mca/notifier/syslog/Makefile.am b/orte/mca/notifier/syslog/Makefile.am deleted file mode 100644 index b4f57089f71..00000000000 --- a/orte/mca/notifier/syslog/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Intel, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - notifier_syslog.h \ - notifier_syslog_module.c \ - notifier_syslog_component.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_notifier_syslog_DSO -component_noinst = -component_install = mca_notifier_syslog.la -else -component_noinst = libmca_notifier_syslog.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_notifier_syslog_la_SOURCES = $(sources) -mca_notifier_syslog_la_LDFLAGS = -module -avoid-version -mca_notifier_syslog_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_notifier_syslog_la_SOURCES =$(sources) -libmca_notifier_syslog_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/notifier/syslog/configure.m4 b/orte/mca/notifier/syslog/configure.m4 deleted file mode 100644 index d9e54bb9425..00000000000 --- a/orte/mca/notifier/syslog/configure.m4 +++ /dev/null @@ -1,31 +0,0 @@ -# -*- shell-script -*- -# -# Copyright (c) 2017 Cisco Systems, Inc. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -# MCA_notifier_syslog_CONFIG([action-if-found], [action-if-not-found]) -# ----------------------------------------------------------- -AC_DEFUN([MCA_orte_notifier_syslog_CONFIG], [ - AC_CONFIG_FILES([orte/mca/notifier/syslog/Makefile]) - - OPAL_VAR_SCOPE_PUSH([orte_notifier_syslog_happy]) - - # Per https://github.com/open-mpi/ompi/issues/4373 and - # https://github.com/open-mpi/ompi/pull/4374, we need to check - # that syslog.h is compilable. If syslog.h is not compilable, - # disable this component. - AC_CHECK_HEADER([syslog.h], - [orte_notifier_syslog_happy=1], - [orte_notifier_syslog_happy=0]) - - AS_IF([test $orte_notifier_syslog_happy -eq 1], - [$1], - [$2]) - - OPAL_VAR_SCOPE_POP -])dnl diff --git a/orte/mca/notifier/syslog/notifier_syslog.h b/orte/mca/notifier/syslog/notifier_syslog.h deleted file mode 100644 index a78bb915b78..00000000000 --- a/orte/mca/notifier/syslog/notifier_syslog.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- C -*- - * - * Copyright (c) 2004-2008 The Trustees of Indiana University and Indiana - * University Research and Technology - * Corporation. All rights reserved. - * Copyright (c) 2004-2006 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, - * University of Stuttgart. All rights reserved. - * Copyright (c) 2004-2005 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - * - */ -#ifndef NOTIFIER_SYSLOG_H -#define NOTIFIER_SYSLOG_H - -#include "orte_config.h" - -#include "orte/mca/notifier/notifier.h" - -BEGIN_C_DECLS - -/* - * Notifier interfaces - */ - -ORTE_MODULE_DECLSPEC extern orte_notifier_base_component_t mca_notifier_syslog_component; -extern orte_notifier_base_module_t orte_notifier_syslog_module; - -END_C_DECLS - -#endif diff --git a/orte/mca/notifier/syslog/notifier_syslog_component.c b/orte/mca/notifier/syslog/notifier_syslog_component.c deleted file mode 100644 index 99085338166..00000000000 --- a/orte/mca/notifier/syslog/notifier_syslog_component.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2004-2008 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) 2009 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Los Alamos National Security, LLC. All rights - * reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ -*/ - -/* - * includes - */ -#include "orte_config.h" -#include "orte/constants.h" - -#include "notifier_syslog.h" - - -static int orte_notifier_syslog_component_query(mca_base_module_t **module, - int *priority); - -/* - * Struct of function pointers that need to be initialized - */ -orte_notifier_base_component_t mca_notifier_syslog_component = { - .base_version = { - ORTE_NOTIFIER_BASE_VERSION_1_0_0, - - .mca_component_name = "syslog", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - .mca_query_component = orte_notifier_syslog_component_query, - }, - .base_data = { - /* The component is checkpoint ready */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int orte_notifier_syslog_component_query(mca_base_module_t **module, - int *priority) -{ - *priority = 1; - *module = (mca_base_module_t *)&orte_notifier_syslog_module; - return ORTE_SUCCESS; -} diff --git a/orte/mca/notifier/syslog/notifier_syslog_module.c b/orte/mca/notifier/syslog/notifier_syslog_module.c deleted file mode 100644 index d488ca392f0..00000000000 --- a/orte/mca/notifier/syslog/notifier_syslog_module.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2004-2005 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) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include -#ifdef HAVE_SYS_TIME_H -#include -#endif /* HAVE_SYS_TIME_H */ -#ifdef HAVE_SYSLOG_H -#include -#endif -#include - -#include "opal/util/show_help.h" - -#include "orte/util/error_strings.h" -#include "orte/util/name_fns.h" - -#include "orte/mca/notifier/base/base.h" -#include "notifier_syslog.h" - - -/* Static API's */ -static int init(void); -static void finalize(void); -static void mylog(orte_notifier_request_t *req); -static void myevent(orte_notifier_request_t *req); -static void myreport(orte_notifier_request_t *req); - -/* Module def */ -orte_notifier_base_module_t orte_notifier_syslog_module = { - .init = init, - .finalize = finalize, - .log = mylog, - .event = myevent, - .report = myreport -}; - - -static int init(void) -{ - int opts; - - opts = LOG_CONS | LOG_PID; - openlog("OpenRTE Error Report:", opts, LOG_USER); - - return ORTE_SUCCESS; -} - -static void finalize(void) -{ - closelog(); -} - -static void mylog(orte_notifier_request_t *req) -{ - char tod[48]; - - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:syslog:mylog function called with severity %d errcode %d and messg %s", - (int)req->severity, req->errcode, req->msg); - /* If there was a message, output it */ - (void)ctime_r(&req->t, tod); - /* trim the newline */ - tod[strlen(tod)] = '\0'; - - syslog(req->severity, "[%s]%s %s: JOBID %s REPORTS ERROR %s: %s", tod, - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_notifier_base_sev2str(req->severity), - ORTE_JOBID_PRINT((NULL == req->jdata) ? - ORTE_JOBID_INVALID : req->jdata->jobid), - orte_job_state_to_str(req->state), - (NULL == req->msg) ? "" : req->msg); -} - -static void myevent(orte_notifier_request_t *req) -{ - char tod[48]; - - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:syslog:myevent function called with severity %d and messg %s", - (int)req->severity, req->msg); - /* If there was a message, output it */ - (void)ctime_r(&req->t, tod); - /* trim the newline */ - tod[strlen(tod)] = '\0'; - - syslog(req->severity, "[%s]%s %s SYSTEM EVENT : %s", tod, - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_notifier_base_sev2str(req->severity), - (NULL == req->msg) ? "" : req->msg); -} - -static void myreport(orte_notifier_request_t *req) -{ - char tod[48]; - - opal_output_verbose(5, orte_notifier_base_framework.framework_output, - "notifier:syslog:myreport function called with severity %d state %s and messg %s", - (int)req->severity, orte_job_state_to_str(req->state), - req->msg); - /* If there was a message, output it */ - (void)ctime_r(&req->t, tod); - /* trim the newline */ - tod[strlen(tod)] = '\0'; - - syslog(req->severity, "[%s]%s JOBID %s REPORTS STATE %s: %s", tod, - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_JOBID_PRINT((NULL == req->jdata) ? - ORTE_JOBID_INVALID : req->jdata->jobid), - orte_job_state_to_str(req->state), - (NULL == req->msg) ? "" : req->msg); -} diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index 34b6268f603..a9282dd4bbd 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -75,7 +75,6 @@ #include "orte/mca/schizo/schizo.h" #include "orte/mca/state/state.h" #include "orte/mca/filem/filem.h" -#include "orte/mca/dfs/dfs.h" #include "orte/util/context_fns.h" #include "orte/util/name_fns.h" @@ -446,13 +445,6 @@ int orte_odls_base_default_get_add_procs_data(opal_buffer_t *buffer, return ORTE_SUCCESS; } -static void fm_release(void *cbdata) -{ - opal_buffer_t *bptr = (opal_buffer_t*)cbdata; - - OBJ_RELEASE(bptr); -} - static void ls_cbunc(int status, void *cbdata) { opal_pmix_lock_t *lock = (opal_pmix_lock_t*)cbdata; @@ -809,15 +801,6 @@ int orte_odls_base_default_construct_child_list(opal_buffer_t *buffer, lock.active = false; // we won't get a callback } - /* if we have a file map, then we need to load it */ - if (orte_get_attribute(&jdata->attributes, ORTE_JOB_FILE_MAPS, (void**)&bptr, OPAL_BUFFER)) { - if (NULL != orte_dfs.load_file_maps) { - orte_dfs.load_file_maps(jdata->jobid, bptr, fm_release, bptr); - } else { - OBJ_RELEASE(bptr); - } - } - /* load any controls into the job */ orte_rtc.assign(jdata); diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index 85aba0a0f33..7f80b147aed 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -14,7 +14,7 @@ * Copyright (c) 2007-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2007-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -81,7 +81,6 @@ #include "opal/class/opal_pointer_array.h" #include "opal/dss/dss.h" -#include "orte/mca/dfs/dfs.h" #include "orte/mca/odls/odls.h" #include "orte/mca/rml/rml.h" #include "orte/mca/state/state.h" diff --git a/orte/util/attr.c b/orte/util/attr.c index 9e8716f0928..87047db7f5a 100644 --- a/orte/util/attr.c +++ b/orte/util/attr.c @@ -269,8 +269,6 @@ const char *orte_attr_key_to_str(orte_attribute_key_t key) return "JOB-LAUNCH-MSG-RECVD"; case ORTE_JOB_MAX_LAUNCH_MSG_RECVD: return "JOB-MAX-LAUNCH-MSG-RECVD"; - case ORTE_JOB_FILE_MAPS: - return "JOB-FILE-MAPS"; case ORTE_JOB_CKPT_STATE: return "JOB-CKPT-STATE"; case ORTE_JOB_SNAPSHOT_REF: diff --git a/orte/util/attr.h b/orte/util/attr.h index 73bb21192aa..621b577f04c 100644 --- a/orte/util/attr.h +++ b/orte/util/attr.h @@ -101,7 +101,6 @@ typedef uint16_t orte_job_flags_t; #define ORTE_JOB_LAUNCH_MSG_SENT (ORTE_JOB_START_KEY + 1) // timeval - time launch message was sent #define ORTE_JOB_LAUNCH_MSG_RECVD (ORTE_JOB_START_KEY + 2) // timeval - time launch message was recvd #define ORTE_JOB_MAX_LAUNCH_MSG_RECVD (ORTE_JOB_START_KEY + 3) // timeval - max time for launch msg to be received -#define ORTE_JOB_FILE_MAPS (ORTE_JOB_START_KEY + 4) // opal_buffer_t - file maps associates with this job #define ORTE_JOB_CKPT_STATE (ORTE_JOB_START_KEY + 5) // size_t - ckpt state #define ORTE_JOB_SNAPSHOT_REF (ORTE_JOB_START_KEY + 6) // string - snapshot reference #define ORTE_JOB_SNAPSHOT_LOC (ORTE_JOB_START_KEY + 7) // string - snapshot location From d8dc69feb580f11c0db4780e4cde7b54e186130b Mon Sep 17 00:00:00 2001 From: James Clark Date: Fri, 15 Feb 2019 15:20:15 +0000 Subject: [PATCH 309/674] Add a compilation flag that adds unwind info to all files that are present in the stack starting from MPI_Init. This is so when a debugger attaches using MPIR, it can step out of this stack back into main. This cannot be done with certain aggressive optimisations and missing debug information. Signed-off-by: James Clark Signed-off-by: Jeff Squyres Co-authored-by: Jeff Squyres (cherry-picked from 20f5840) --- config/orte_setup_debugger_flags.m4 | 42 ++++++++++++++++++++++++++++- ompi/runtime/Makefile.am | 11 +++++++- orte/mca/ess/Makefile.am | 4 +++ orte/mca/ess/pmi/Makefile.am | 6 +++++ orte/runtime/Makefile.am | 10 ++++++- 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/config/orte_setup_debugger_flags.m4 b/config/orte_setup_debugger_flags.m4 index 39ac77defef..5bd970bf7d8 100644 --- a/config/orte_setup_debugger_flags.m4 +++ b/config/orte_setup_debugger_flags.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, 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) 2006-2009 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights dnl reserved. @@ -24,6 +24,28 @@ dnl dnl $HEADER$ dnl +dnl Check to see if specific CFLAGS work +dnl $1: compiler flags to check +dnl $2: Action if the flags work +dnl $3: Action if the flags do not work +AC_DEFUN([_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS],[ + OPAL_VAR_SCOPE_PUSH([ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save]) + + ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save=$CFLAGS + AC_MSG_CHECKING([if $1 compiler flag works]) + CFLAGS="$CFLAGS $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[int i = 3;])], + [ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=yes], + [ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=no]) + AC_MSG_RESULT([$ORTE_SETUP_DEBUGGER_FLAGS_HAPPY]) + CFLAGS=$ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save + + OPAL_VAR_SCOPE_POP + + AS_IF([test $ORTE_SETUP_DEBUGGER_FLAGS_HAPPY = yes], + [$2], [$3]) +]) + AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[ # # Do a final process of the CFLAGS to make a WITHOUT_OPTFLAGS @@ -53,4 +75,22 @@ AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[ AC_SUBST(CFLAGS_WITHOUT_OPTFLAGS) AC_SUBST(DEBUGGER_CFLAGS) + + # Check for compiler specific flag to add in unwind information. + # This is needed when attaching using MPIR to unwind back to the + # user's main function. Certain optimisations can prevent GDB from + # producing a stack when explicit unwind information is unavailable. + # This is implied by -g, but we want to save space and don't need + # full debug symbols. + _ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-fasynchronous-unwind-tables], + [MPIR_UNWIND_CFLAGS="-fasynchronous-unwind-tables"], + [_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-Meh_frame -Mframe], + [MPIR_UNWIND_CFLAGS="-Meh_frame -Mframe"], + [MPIR_UNWIND_CFLAGS=-g]) + ]) + + AC_MSG_CHECKING([for final compiler unwind flags]) + AC_MSG_RESULT([$MPIR_UNWIND_CFLAGS]) + + AC_SUBST(MPIR_UNWIND_CFLAGS) ]) diff --git a/ompi/runtime/Makefile.am b/ompi/runtime/Makefile.am index 98cc400a83a..71b32e2139a 100644 --- a/ompi/runtime/Makefile.am +++ b/ompi/runtime/Makefile.am @@ -33,10 +33,19 @@ headers += \ lib@OMPI_LIBMPI_NAME@_la_SOURCES += \ runtime/ompi_mpi_abort.c \ runtime/ompi_mpi_dynamics.c \ - runtime/ompi_mpi_init.c \ runtime/ompi_mpi_finalize.c \ runtime/ompi_mpi_params.c \ runtime/ompi_mpi_preconnect.c \ runtime/ompi_cr.c \ runtime/ompi_info_support.c \ runtime/ompi_spc.c + +# The MPIR portion of the library must be built with flags to +# enable stepping out of MPI_INIT into main. +# Use an intermediate library to isolate the debug object. +noinst_LTLIBRARIES += libompi_mpir.la +libompi_mpir_la_SOURCES = \ + runtime/ompi_mpi_init.c +libompi_mpir_la_CFLAGS = $(MPIR_UNWIND_CFLAGS) + +lib@OMPI_LIBMPI_NAME@_la_LIBADD += libompi_mpir.la diff --git a/orte/mca/ess/Makefile.am b/orte/mca/ess/Makefile.am index 21354432311..3edc397d321 100644 --- a/orte/mca/ess/Makefile.am +++ b/orte/mca/ess/Makefile.am @@ -19,6 +19,10 @@ AM_CPPFLAGS = $(LTDLINCL) +# Add unwind flags because files in this tree are +# involved in startup. +AM_CFLAGS = $(MPIR_UNWIND_CFLAGS) + # main library setup noinst_LTLIBRARIES = libmca_ess.la libmca_ess_la_SOURCES = diff --git a/orte/mca/ess/pmi/Makefile.am b/orte/mca/ess/pmi/Makefile.am index 3d532702859..15d38a0817e 100644 --- a/orte/mca/ess/pmi/Makefile.am +++ b/orte/mca/ess/pmi/Makefile.am @@ -11,6 +11,12 @@ # $HEADER$ # +# Add MPIR unwind flags because files in this tree are +# involved in startup. This is not needed in the other +# subdirs in orte/mca/ess because the other components are +# solely used by daemons and thus are not accessible by the debugger. +AM_CFLAGS = $(MPIR_UNWIND_CFLAGS) + AM_CPPFLAGS = $(ess_pmi_CPPFLAGS) sources = \ diff --git a/orte/runtime/Makefile.am b/orte/runtime/Makefile.am index 4081e269233..a8defbf8eb7 100644 --- a/orte/runtime/Makefile.am +++ b/orte/runtime/Makefile.am @@ -38,7 +38,6 @@ headers += \ lib@ORTE_LIB_PREFIX@open_rte_la_SOURCES += \ runtime/orte_finalize.c \ - runtime/orte_init.c \ runtime/orte_locks.c \ runtime/orte_globals.c \ runtime/orte_quit.c \ @@ -52,3 +51,12 @@ lib@ORTE_LIB_PREFIX@open_rte_la_SOURCES += \ runtime/orte_cr.c \ runtime/orte_data_server.c \ runtime/orte_info_support.c + +# The MPIR portion of the library must be built with flags to +# enable stepping out of MPI_INIT into main. +# Use an intermediate library to isolate the debug object. +noinst_LTLIBRARIES += libruntime_mpir.la +libruntime_mpir_la_SOURCES = \ + runtime/orte_init.c +libruntime_mpir_la_CFLAGS = $(MPIR_UNWIND_CFLAGS) +lib@ORTE_LIB_PREFIX@open_rte_la_LIBADD += libruntime_mpir.la From 001fa5b6ce6b575d7169b1cde8810a74f00450ae Mon Sep 17 00:00:00 2001 From: Ben Menadue Date: Wed, 3 Apr 2019 14:01:41 +1100 Subject: [PATCH 310/674] Add missing nlong_type parameter to call to original broadcast in scoll/fca broadcast. Signed-off-by: Ben Menadue --- oshmem/mca/scoll/fca/scoll_fca_ops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/oshmem/mca/scoll/fca/scoll_fca_ops.c b/oshmem/mca/scoll/fca/scoll_fca_ops.c index f5f6edf1679..887f98796b2 100644 --- a/oshmem/mca/scoll/fca/scoll_fca_ops.c +++ b/oshmem/mca/scoll/fca/scoll_fca_ops.c @@ -88,6 +88,7 @@ int mca_scoll_fca_broadcast(struct oshmem_group_t *group, source, nlong, pSync, + nlong_type, SCOLL_DEFAULT_ALG); return rc; } From 173192a6f4ee6f5ebe99a3bc8936b77cc83a5a3b Mon Sep 17 00:00:00 2001 From: Ben Menadue Date: Wed, 3 Apr 2019 15:58:13 +1100 Subject: [PATCH 311/674] Add missing #include to oshmem/shmem/c/shmem_context.c. Signed-off-by: Ben Menadue (cherry picked from commit 063596b82837cf0b07926e2c696cd8f48a59143d) --- oshmem/shmem/c/shmem_context.c | 1 + 1 file changed, 1 insertion(+) diff --git a/oshmem/shmem/c/shmem_context.c b/oshmem/shmem/c/shmem_context.c index 44367bb6b04..a5a094e6056 100644 --- a/oshmem/shmem/c/shmem_context.c +++ b/oshmem/shmem/c/shmem_context.c @@ -19,6 +19,7 @@ #include "oshmem/constants.h" #include "oshmem/include/shmem.h" +#include "oshmem/mca/spml/spml.h" #include "oshmem/runtime/params.h" #include "oshmem/runtime/runtime.h" #include "oshmem/shmem/shmem_api_logger.h" From 36583df68945af4ab718294fdf6fa063e6996199 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Mon, 4 Mar 2019 17:57:53 -0500 Subject: [PATCH 312/674] in-place conversion macro writes into INPUT argument In fint_2_int.h there are some conversion macros for logicals. It has one path for OMPI_SIZEOF_FORTRAN_LOGICAL != SIZEOF_INT where a new array would be allocated and the conversions then might expand to c_array[i] = (array[i] == 0 ? 0 : 1) and another path for OMPI_SIZEOF_FORTRAN_LOGICAL == SIZEOF_INT where it does things "in place", so the same conversion there would just be array[i] = (array[i] == 0 ? 0 : 1) The problem is some of the logical arrays being converted are INPUT arguments. And it's possible for some compilers to even put the argument in read-only memory so the above "in place" conversion SEGV's. A testcase I have used call MPI_CART_SUB(oldcomm, (/.true.,.false./), newcomm, ierr) and gfortran put the second arg in read-only mem. In cart_sub_f.c you can trace the ompi_fortran_logical_t *remain_dims arg. remain_dims[] is for input only, but the file uses OMPI_LOGICAL_ARRAY_NAME_DECL(remain_dims); OMPI_ARRAY_LOGICAL_2_INT(remain_dims, ndims); PMPI_Cart_sub(..., OMPI_LOGICAL_ARRAY_NAME_CONVERT(remain_dims), ...); OMPI_ARRAY_INT_2_LOGICAL(remain_dims, ndims); to convert it to c-ints make a C call then restore it to Fortran logicals before returning. It's not always wrong to convert purely in-place, eg cart_get_f.c has a periods[] that's exclusively for OUTPUT and it would be fine with the macros as they were. But I still say the macros are invalid because they don't distinguish whether they're being used on INPUT or OUTPUT args and thus they can't be used in a way that's legal for both cases. It might be possible to fix the macros by adding more of them so that cart_create_f.c and cart_get_f.c would use different macros that give more context. But my fix here is just to turn off the first block and make all paths run as if OMPI_SIZEOF_FORTRAN_LOGICAL != SIZEOF_INT. The main macros that get enlarged by this change are define OMPI_ARRAY_LOGICAL_2_INT_ALLOC : mallocs now define OMPI_ARRAY_LOGICAL_2_INT : also mallocs now But these are only used in 4 places, three of which are the purpose of this checkin, to avoid the former in-place expansion of an INPUT arg: cart_create_f.c cart_map_f.c cart_sub_f.c and one of which is an OUPUT arg that was fine and that gets unnecessarily expanded into a separate array by this checkin. cart_get_f.c So I think an unnecessary malloc in cart_get_f.c is the only downside to this change, where the logicals array argument could have been used and converted in place. Signed-off-by: Mark Allen Update provided by Gilles Gouaillardet to keep the in-place option if OMPI_FORTRAN_VALUE_TRUE == 1 where no conversion is needed. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 0a7f1e3cc58dabe536df00ae9c97f7e9d27103ad) --- ompi/mpi/fortran/base/fint_2_int.h | 59 +++++++++++-------------- ompi/mpi/fortran/mpif-h/cart_create_f.c | 3 +- ompi/mpi/fortran/mpif-h/cart_map_f.c | 3 +- ompi/mpi/fortran/mpif-h/cart_sub_f.c | 3 +- 4 files changed, 32 insertions(+), 36 deletions(-) diff --git a/ompi/mpi/fortran/base/fint_2_int.h b/ompi/mpi/fortran/base/fint_2_int.h index 5971694eb9b..44ce1289567 100644 --- a/ompi/mpi/fortran/base/fint_2_int.h +++ b/ompi/mpi/fortran/base/fint_2_int.h @@ -11,8 +11,8 @@ * All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -161,9 +161,24 @@ /* * Define MACROS to take account of different size of logical from int + * + * There used to be an in-place option for the below conversions of + * logical arrays. So if mpi_cart_create(..., periods, ...) took an + * input array of Fortran logicals, it would walk the array converting + * the elements to C-logical values, then at the end it would restore + * the values back to Fortran logicals. + * + * The problem with that is periods is an INPUT argument and some + * Fortran compilers even put it in read-only memory because of that. + * So writing to it wasn't generally okay, even though we were restoring it + * before returning. + * + * The in-place option is hence only valid if no conversion is ever needed + * (e.g. Fortran logical and C int have the same size *and** Fortran logical + * .TRUE. value is 1 in C. */ -#if OMPI_SIZEOF_FORTRAN_LOGICAL == SIZEOF_INT +#if (OMPI_SIZEOF_FORTRAN_LOGICAL == SIZEOF_INT) && (OMPI_FORTRAN_VALUE_TRUE == 1) # define OMPI_LOGICAL_NAME_DECL(in) /* Not needed for int==logical */ # define OMPI_LOGICAL_NAME_CONVERT(in) in /* Not needed for int==logical */ # define OMPI_LOGICAL_SINGLE_NAME_CONVERT(in) in /* Not needed for int==logical */ @@ -172,37 +187,15 @@ # define OMPI_ARRAY_LOGICAL_2_INT_ALLOC(in,n) /* Not needed for int==logical */ # define OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(in) /* Not needed for int==logical */ -# if OMPI_FORTRAN_VALUE_TRUE == 1 -# define OMPI_FORTRAN_MUST_CONVERT_LOGICAL_2_INT 0 -# define OMPI_LOGICAL_2_INT(a) a -# define OMPI_INT_2_LOGICAL(a) a -# define OMPI_ARRAY_LOGICAL_2_INT(in, n) -# define OMPI_ARRAY_INT_2_LOGICAL(in, n) -# define OMPI_SINGLE_INT_2_LOGICAL(a) /* Single-OUT variable -- Not needed for int==logical, true=1 */ -# else -# define OMPI_FORTRAN_MUST_CONVERT_LOGICAL_2_INT 1 -# define OMPI_LOGICAL_2_INT(a) ((a)==0? 0 : 1) -# define OMPI_INT_2_LOGICAL(a) ((a)==0? 0 : OMPI_FORTRAN_VALUE_TRUE) -# define OMPI_SINGLE_INT_2_LOGICAL(a) *a=OMPI_INT_2_LOGICAL(OMPI_LOGICAL_NAME_CONVERT(*a)) -# define OMPI_ARRAY_LOGICAL_2_INT(in, n) do { \ - int converted_n = (int)(n); \ - OMPI_ARRAY_LOGICAL_2_INT_ALLOC(in, converted_n + 1); \ - while (--converted_n >= 0) { \ - OMPI_LOGICAL_ARRAY_NAME_CONVERT(in)[converted_n]=OMPI_LOGICAL_2_INT(in[converted_n]); \ - } \ - } while (0) -# define OMPI_ARRAY_INT_2_LOGICAL(in, n) do { \ - int converted_n = (int)(n); \ - while (--converted_n >= 0) { \ - in[converted_n]=OMPI_INT_2_LOGICAL(OMPI_LOGICAL_ARRAY_NAME_CONVERT(in)[converted_n]); \ - } \ - OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(in); \ - } while (0) - -# endif +# define OMPI_FORTRAN_MUST_CONVERT_LOGICAL_2_INT 0 +# define OMPI_LOGICAL_2_INT(a) a +# define OMPI_INT_2_LOGICAL(a) a +# define OMPI_ARRAY_LOGICAL_2_INT(in, n) +# define OMPI_ARRAY_INT_2_LOGICAL(in, n) +# define OMPI_SINGLE_INT_2_LOGICAL(a) /* Single-OUT variable -- Not needed for int==logical, true=1 */ #else /* - * For anything other than Fortran-logical == C-int, we have to convert + * For anything other than Fortran-logical == C-int or some .TRUE. is not 1 in C, we have to convert */ # define OMPI_FORTRAN_MUST_CONVERT_LOGICAL_2_INT 1 # define OMPI_LOGICAL_NAME_DECL(in) int c_##in @@ -238,7 +231,7 @@ } \ OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(in); \ } while (0) -#endif /* OMPI_SIZEOF_FORTRAN_LOGICAL */ +#endif /* OMPI_SIZEOF_FORTRAN_LOGICAL && OMPI_FORTRAN_VALUE_TRUE */ #endif /* OMPI_FORTRAN_BASE_FINT_2_INT_H */ diff --git a/ompi/mpi/fortran/mpif-h/cart_create_f.c b/ompi/mpi/fortran/mpif-h/cart_create_f.c index d1bafcc0b62..a617ef0c2e4 100644 --- a/ompi/mpi/fortran/mpif-h/cart_create_f.c +++ b/ompi/mpi/fortran/mpif-h/cart_create_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -96,5 +97,5 @@ void ompi_cart_create_f(MPI_Fint *old_comm, MPI_Fint *ndims, MPI_Fint *dims, * Need to convert back into Fortran, to not surprise the user */ OMPI_ARRAY_FINT_2_INT_CLEANUP(dims); - OMPI_ARRAY_INT_2_LOGICAL(periods, size); + OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(periods); } diff --git a/ompi/mpi/fortran/mpif-h/cart_map_f.c b/ompi/mpi/fortran/mpif-h/cart_map_f.c index 3ad10c341e8..6557c89191e 100644 --- a/ompi/mpi/fortran/mpif-h/cart_map_f.c +++ b/ompi/mpi/fortran/mpif-h/cart_map_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -89,6 +90,6 @@ void ompi_cart_map_f(MPI_Fint *comm, MPI_Fint *ndims, MPI_Fint *dims, if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); OMPI_ARRAY_FINT_2_INT_CLEANUP(dims); - OMPI_ARRAY_INT_2_LOGICAL(periods, size); + OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(periods); OMPI_SINGLE_INT_2_FINT(newrank); } diff --git a/ompi/mpi/fortran/mpif-h/cart_sub_f.c b/ompi/mpi/fortran/mpif-h/cart_sub_f.c index be51488e30e..463c96df10e 100644 --- a/ompi/mpi/fortran/mpif-h/cart_sub_f.c +++ b/ompi/mpi/fortran/mpif-h/cart_sub_f.c @@ -12,6 +12,7 @@ * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -101,5 +102,5 @@ void ompi_cart_sub_f(MPI_Fint *comm, ompi_fortran_logical_t *remain_dims, *new_comm = PMPI_Comm_c2f(c_new_comm); } - OMPI_ARRAY_INT_2_LOGICAL(remain_dims, ndims); + OMPI_ARRAY_LOGICAL_2_INT_CLEANUP(remain_dims); } From 5999fdad5a2890d6ae6e3c94978baaffb1f789bb Mon Sep 17 00:00:00 2001 From: Thananon Patinyasakdikul Date: Tue, 29 Jan 2019 13:08:15 -0500 Subject: [PATCH 313/674] pml/ob1: fix deadlock with communicator flag ALLOW_OVERTAKE. We missed an assert to check if ALLOW_OVERTAKE is set or not before validating the sequence number and this will cause deadlock. Signed-off-by: Thananon Patinyasakdikul (cherry picked from commit 0263456cf4e99efc67d38acd100cf948e0399d63) --- ompi/mca/pml/ob1/pml_ob1_recvfrag.c | 30 +++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c index 5e62cea1b51..c960ac3e10d 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c @@ -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-2018 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart, @@ -929,19 +929,21 @@ static int mca_pml_ob1_recv_frag_match( mca_btl_base_module_t *btl, frag_msg_seq = hdr->hdr_seq; next_msg_seq_expected = (uint16_t)proc->expected_sequence; - /* If the sequence number is wrong, queue it up for later. */ - if(OPAL_UNLIKELY(frag_msg_seq != next_msg_seq_expected)) { - mca_pml_ob1_recv_frag_t* frag; - MCA_PML_OB1_RECV_FRAG_ALLOC(frag); - MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl); - append_frag_to_ordered_list(&proc->frags_cant_match, frag, next_msg_seq_expected); + if (!OMPI_COMM_CHECK_ASSERT_ALLOW_OVERTAKE(comm_ptr)) { + /* If the sequence number is wrong, queue it up for later. */ + if(OPAL_UNLIKELY(frag_msg_seq != next_msg_seq_expected)) { + mca_pml_ob1_recv_frag_t* frag; + MCA_PML_OB1_RECV_FRAG_ALLOC(frag); + MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segments, num_segments, btl); + append_frag_to_ordered_list(&proc->frags_cant_match, frag, next_msg_seq_expected); - SPC_RECORD(OMPI_SPC_OUT_OF_SEQUENCE, 1); - SPC_RECORD(OMPI_SPC_OOS_IN_QUEUE, 1); - SPC_UPDATE_WATERMARK(OMPI_SPC_MAX_OOS_IN_QUEUE, OMPI_SPC_OOS_IN_QUEUE); + SPC_RECORD(OMPI_SPC_OUT_OF_SEQUENCE, 1); + SPC_RECORD(OMPI_SPC_OOS_IN_QUEUE, 1); + SPC_UPDATE_WATERMARK(OMPI_SPC_MAX_OOS_IN_QUEUE, OMPI_SPC_OOS_IN_QUEUE); - OB1_MATCHING_UNLOCK(&comm->matching_lock); - return OMPI_SUCCESS; + OB1_MATCHING_UNLOCK(&comm->matching_lock); + return OMPI_SUCCESS; + } } /* mca_pml_ob1_recv_frag_match_proc() will release the lock. */ @@ -977,6 +979,10 @@ mca_pml_ob1_recv_frag_match_proc( mca_btl_base_module_t *btl, match_this_frag: /* We're now expecting the next sequence number. */ + /* NOTE: We should have checked for ALLOW_OVERTAKE comm flag here + * but adding a branch in this critical path is not ideal for performance. + * We decided to let it run the sequence number even we are not doing + * anything with it. */ proc->expected_sequence++; /* We generate the SEARCH_POSTED_QUEUE only when the message is From 281f78c6e49316ed67d6a10e0c5ce566a4d61772 Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Mon, 8 Apr 2019 13:19:11 +0300 Subject: [PATCH 314/674] Fixes the O(N^2) loop in the mca_scoll_mpi_comm_query The new proc group is created from the "world_group" based on the ranks mapping which can be directly taken from proc_name->vpid. Signed-off-by: Valentin Petrov --- oshmem/mca/scoll/mpi/scoll_mpi_module.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_module.c b/oshmem/mca/scoll/mpi/scoll_mpi_module.c index 1228cf8a3a2..ca487caa696 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_module.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_module.c @@ -110,7 +110,7 @@ mca_scoll_mpi_comm_query(oshmem_group_t *osh_group, int *priority) mca_scoll_mpi_module_t *mpi_module; int err, i; int tag; - ompi_group_t* parent_group, *new_group; + ompi_group_t* world_group, *new_group; ompi_communicator_t* newcomm = NULL; *priority = 0; mca_scoll_mpi_component_t *cm; @@ -129,7 +129,7 @@ mca_scoll_mpi_comm_query(oshmem_group_t *osh_group, int *priority) osh_group->ompi_comm = &(ompi_mpi_comm_world.comm); OPAL_TIMING_ENV_NEXT(comm_query, "ompi_mpi_comm_world"); } else { - err = ompi_comm_group(&(ompi_mpi_comm_world.comm), &parent_group); + err = ompi_comm_group(&(ompi_mpi_comm_world.comm), &world_group); if (OPAL_UNLIKELY(OMPI_SUCCESS != err)) { return NULL; } @@ -143,20 +143,14 @@ mca_scoll_mpi_comm_query(oshmem_group_t *osh_group, int *priority) OPAL_TIMING_ENV_NEXT(comm_query, "malloc"); + /* Fill the map "group_rank-to-world_rank" in order to create a new proc group */ for (i = 0; i < osh_group->proc_count; i++) { - ompi_proc_t* ompi_proc; - for( int j = 0; j < ompi_group_size(parent_group); j++ ) { - ompi_proc = ompi_group_peer_lookup(parent_group, j); - if( 0 == opal_compare_proc(ompi_proc->super.proc_name, osh_group->proc_array[i]->super.proc_name)) { - ranks[i] = j; - break; - } - } + ranks[i] = osh_group->proc_array[i]->super.proc_name.vpid; } OPAL_TIMING_ENV_NEXT(comm_query, "build_ranks"); - err = ompi_group_incl(parent_group, osh_group->proc_count, ranks, &new_group); + err = ompi_group_incl(world_group, osh_group->proc_count, ranks, &new_group); if (OPAL_UNLIKELY(OMPI_SUCCESS != err)) { free(ranks); return NULL; From 68c88e86f2c8ff515a4c54927077143de13516b9 Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Tue, 16 Apr 2019 14:04:11 +0300 Subject: [PATCH 315/674] OSC/UCX: use correct rkey for atomic_fadd in rget/rput Signed-off-by: Valentin Petrov --- ompi/mca/osc/ucx/osc_ucx_comm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index ec760d4fda3..bc3b7f5e7ed 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -881,7 +881,7 @@ int ompi_osc_ucx_rput(const void *origin_addr, int origin_count, CHECK_VALID_RKEY(module, target, target_count); - rkey = (module->win_info_array[target]).rkey; + rkey = (module->state_info_array[target]).rkey; OMPI_OSC_UCX_REQUEST_ALLOC(win, ucx_req); assert(NULL != ucx_req); @@ -942,7 +942,7 @@ int ompi_osc_ucx_rget(void *origin_addr, int origin_count, CHECK_VALID_RKEY(module, target, target_count); - rkey = (module->win_info_array[target]).rkey; + rkey = (module->state_info_array[target]).rkey; OMPI_OSC_UCX_REQUEST_ALLOC(win, ucx_req); assert(NULL != ucx_req); From 2947ab2dbc01e474db7d3f4e3d8ae143ba7475cf Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Wed, 17 Apr 2019 09:59:19 +0300 Subject: [PATCH 316/674] OSC/UCX: correctly handle NULL origin addr and MPI_NO_OP Signed-off-by: Valentin Petrov --- ompi/mca/osc/ucx/osc_ucx_comm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index ec760d4fda3..a2ccf207df7 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -673,7 +673,7 @@ int ompi_osc_ucx_fetch_and_op(const void *origin_addr, void *result_addr, ucp_ep_h ep = OSC_UCX_GET_EP(module->comm, target); uint64_t remote_addr = (module->win_info_array[target]).addr + target_disp * OSC_UCX_GET_DISP(module, target); ucp_rkey_h rkey; - uint64_t value = *(uint64_t *)origin_addr; + uint64_t value = origin_addr ? *(uint64_t *)origin_addr : 0; ucp_atomic_fetch_op_t opcode; size_t dt_bytes; ompi_osc_ucx_internal_request_t *req = NULL; From 2a4bc0cb58bef6314fba15aacf86779c514f28ee Mon Sep 17 00:00:00 2001 From: Brelle Emmanuel Date: Mon, 1 Apr 2019 18:07:20 +0200 Subject: [PATCH 317/674] pml/ob1: fixed exit from get_frag_fail when falling back on btl_put In the case the btl_get fails Ob1 tries to fallback on btl_put first but the return code was ignored. So the code fell back on both btl_put and btl_send. Signed-off-by: Brelle Emmanuel (cherry picked from commit 9c689f2225d29aa152627f39bab841afead254af) --- ompi/mca/pml/ob1/pml_ob1_recvreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index 06b8e84f6cb..1c95445ab46 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -330,7 +330,9 @@ static int mca_pml_ob1_recv_request_get_frag_failed (mca_pml_ob1_rdma_frag_t *fr if (OMPI_ERR_NOT_AVAILABLE == rc) { /* get isn't supported for this transfer. tell peer to fallback on put */ rc = mca_pml_ob1_recv_request_put_frag (frag); - if (OMPI_ERR_OUT_OF_RESOURCE == rc) { + if (OMPI_SUCCESS == rc){ + return OMPI_SUCCESS; + } else if (OMPI_ERR_OUT_OF_RESOURCE == rc) { OPAL_THREAD_LOCK(&mca_pml_ob1.lock); opal_list_append (&mca_pml_ob1.rdma_pending, (opal_list_item_t*)frag); OPAL_THREAD_UNLOCK(&mca_pml_ob1.lock); From c0817574622f2f58968353992ce13d4d67fc1c64 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Tue, 23 Apr 2019 15:44:16 -0400 Subject: [PATCH 318/674] fixing an unsafe usage of integer disps[] (romio321 gpfs) There are a couple MPI_Alltoallv calls in ad_gpfs_aggrs.c where the send/recv data comes from places like req[r].lens, and the send buffer and send displacements for example were being calculated as sbuf = pick one of the reqs: req[bottom].lens sdisps[r] = req[r].lens - req[bottom].lens which might be okay if the .lens was data inside of req[] so they'd all be close to each other. But each .lens field is just a pointer that's malloced, so those addresses can be all over the place, so the integer-sized sdisps[] isn't safe. I changed it to have a new extra array sbuf and rbuf for those two Alltoallv calls, and copied the data into the sbuf from the same locations it used to be setting up the sdisps[] at, and after the Alltoallv I copy the data out of the new rbuf into the same locations it used to be setting up the rdisps[] at. For what it's worth I was able to get this to fail -np 2 on a GPFS filesystem with hints romio_cb_write enable. I didn't whittle the test down to something small, but it was failing in an MPI_File_write_all call. Signed-off-by: Mark Allen (cherry picked from commit d85cac8f1a11495415b67ecab69d2ae1cd19d155) --- .../romio/adio/ad_gpfs/ad_gpfs_aggrs.c | 123 +++++++----------- 1 file changed, 47 insertions(+), 76 deletions(-) diff --git a/ompi/mca/io/romio321/romio/adio/ad_gpfs/ad_gpfs_aggrs.c b/ompi/mca/io/romio321/romio/adio/ad_gpfs/ad_gpfs_aggrs.c index 3eb3d84969a..f6df24748f0 100644 --- a/ompi/mca/io/romio321/romio/adio/ad_gpfs/ad_gpfs_aggrs.c +++ b/ompi/mca/io/romio321/romio/adio/ad_gpfs/ad_gpfs_aggrs.c @@ -1,5 +1,5 @@ /* ---------------------------------------------------------------- */ -/* (C)Copyright IBM Corp. 2007, 2008 */ +/* (C)Copyright IBM Corp. 2007, 2008, 2019 */ /* ---------------------------------------------------------------- */ /** * \file ad_gpfs_aggrs.c @@ -663,16 +663,6 @@ void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, /* Parameters for MPI_Alltoallv */ int *scounts, *sdispls, *rcounts, *rdispls; - /* Parameters for MPI_Alltoallv. These are the buffers, which - * are later computed to be the lowest address of all buffers - * to be sent/received for offsets and lengths. Initialize to - * the highest possible address which is the current minimum. - */ - void *sendBufForOffsets=(void*)0xFFFFFFFFFFFFFFFF, - *sendBufForLens =(void*)0xFFFFFFFFFFFFFFFF, - *recvBufForOffsets=(void*)0xFFFFFFFFFFFFFFFF, - *recvBufForLens =(void*)0xFFFFFFFFFFFFFFFF; - /* first find out how much to send/recv and from/to whom */ #ifdef AGGREGATION_PROFILE MPE_Log_event (5026, 0, NULL); @@ -719,11 +709,6 @@ void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, others_req[i].lens = ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(ADIO_Offset)); - if ( (MPIU_Upint)others_req[i].offsets < (MPIU_Upint)recvBufForOffsets ) - recvBufForOffsets = others_req[i].offsets; - if ( (MPIU_Upint)others_req[i].lens < (MPIU_Upint)recvBufForLens ) - recvBufForLens = others_req[i].lens; - others_req[i].mem_ptrs = (MPI_Aint *) ADIOI_Malloc(count_others_req_per_proc[i]*sizeof(MPI_Aint)); @@ -736,9 +721,6 @@ void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, others_req[i].lens = NULL; } } - /* If no recv buffer was allocated in the loop above, make it NULL */ - if ( recvBufForOffsets == (void*)0xFFFFFFFFFFFFFFFF) recvBufForOffsets = NULL; - if ( recvBufForLens == (void*)0xFFFFFFFFFFFFFFFF) recvBufForLens = NULL; /* Now send the calculated offsets and lengths to respective processes */ @@ -746,56 +728,53 @@ void ADIOI_GPFS_Calc_others_req(ADIO_File fd, int count_my_req_procs, /* Exchange the offsets */ /************************/ - /* Determine the lowest sendBufForOffsets/Lens */ - for (i=0; icomm); + for (i=0; icomm); + for (i=0; i Date: Fri, 26 Apr 2019 11:30:50 -0400 Subject: [PATCH 319/674] make-authors.pl script not compatible with being a submodule. make-authors.pl checks that .git exists and is a directory before getting the git log - but when a repo is checked out as a submodule of a larger repository, .git is not a directory, it's just a text file. This can cause make-authors.pl to terminate inappropriately. Author: Michael Heinz Signed-off-by: Michael Heinz (cherry picked from commit 0a8fa5439c626c01a68fd9cebda8f00597500f51) --- contrib/dist/make-authors.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/dist/make-authors.pl b/contrib/dist/make-authors.pl index 92df0a4b230..fc9f7c161d5 100755 --- a/contrib/dist/make-authors.pl +++ b/contrib/dist/make-authors.pl @@ -29,7 +29,7 @@ # directory and make life easier. chdir($srcdir); -if (! -d ".git") { +if (! -e ".git") { if ($skip_ok == 0) { print STDERR "I don't seem to be in a git repo :(\n"; exit(1); From e2638dbbf2190c0cc42803e17d5e00f4c7e4a04d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 30 Apr 2019 14:23:53 +0900 Subject: [PATCH 320/674] mpi: mark MPI_COMBINER_{HVECTOR,HINDEXED,STRUCT}_INTEGER removed unless configure'd with --enable-mpi1-compatibility This is a one-off commit for the v4.0.x branch since these symbols were simply removed from master. Thanks Lisandro Dalcin for reporting this. Signed-off-by: Gilles Gouaillardet --- ompi/include/mpi.h.in | 30 ++++++++++++++++++++++++++++-- ompi/mpi/cxx/constants.h | 12 ++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 046a39b320e..9a8c4877f63 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-2019 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$ @@ -702,13 +702,25 @@ enum { MPI_COMBINER_DUP, MPI_COMBINER_CONTIGUOUS, MPI_COMBINER_VECTOR, +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) MPI_COMBINER_HVECTOR_INTEGER, +#else + OMPI_WAS_MPI_COMBINER_HVECTOR_INTEGER, /* preserve ABI compatibility */ +#endif MPI_COMBINER_HVECTOR, MPI_COMBINER_INDEXED, +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) MPI_COMBINER_HINDEXED_INTEGER, +#else + OMPI_WAS_MPI_COMBINER_HINDEXED_INTEGER, /* preserve ABI compatibility */ +#endif MPI_COMBINER_HINDEXED, MPI_COMBINER_INDEXED_BLOCK, +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) MPI_COMBINER_STRUCT_INTEGER, +#else + OMPI_WAS_MPI_COMBINER_STRUCT_INTEGER, /* preserve ABI compatibility */ +#endif MPI_COMBINER_STRUCT, MPI_COMBINER_SUBARRAY, MPI_COMBINER_DARRAY, @@ -719,6 +731,20 @@ enum { MPI_COMBINER_HINDEXED_BLOCK }; +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) +#else +/* If not building or configured --enable-mpi1-compatibility, then + * we don't want these datatypes, instead we define MPI_COMBINER_*_INTEGER + * to our Static Assert message if the compiler supports + * that staticly assert with a nice message. + */ +# if (OMPI_REMOVED_USE_STATIC_ASSERT) +# define MPI_COMBINER_HVECTOR_INTEGER THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_COMBINER_HVECTOR_INTEGER, MPI_COMBINER_HVECTOR); +# define MPI_COMBINER_HINDEXED_INTEGER THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_COMBINER_HINDEXED_INTEGER, MPI_COMBINER_HINDEXED); +# define MPI_COMBINER_STRUCT_INTEGER THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_COMBINER_STRUCT_INTEGER, MPI_COMBINER_STRUCT); +# endif /* OMPI_REMOVED_USE_STATIC_ASSERT */ +#endif /* Removed datatypes */ + /* * Communicator split type constants. * Do not change the order of these without also modifying mpif.h.in diff --git a/ompi/mpi/cxx/constants.h b/ompi/mpi/cxx/constants.h index 255853e7d28..f841ddc71e9 100644 --- a/ompi/mpi/cxx/constants.h +++ b/ompi/mpi/cxx/constants.h @@ -180,13 +180,25 @@ static const int COMBINER_NAMED = MPI_COMBINER_NAMED; static const int COMBINER_DUP = MPI_COMBINER_DUP; static const int COMBINER_CONTIGUOUS = MPI_COMBINER_CONTIGUOUS; static const int COMBINER_VECTOR = MPI_COMBINER_VECTOR; +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) static const int COMBINER_HVECTOR_INTEGER = MPI_COMBINER_HVECTOR_INTEGER; +#else +static const int COMBINER_HVECTOR_INTEGER = OMPI_WAS_MPI_COMBINER_HVECTOR_INTEGER; +#endif static const int COMBINER_HVECTOR = MPI_COMBINER_HVECTOR; static const int COMBINER_INDEXED = MPI_COMBINER_INDEXED; +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) static const int COMBINER_HINDEXED_INTEGER = MPI_COMBINER_HINDEXED_INTEGER; +#else +static const int COMBINER_HINDEXED_INTEGER = OMPI_WAS_MPI_COMBINER_HINDEXED_INTEGER; +#endif static const int COMBINER_HINDEXED = MPI_COMBINER_HINDEXED; static const int COMBINER_INDEXED_BLOCK = MPI_COMBINER_INDEXED_BLOCK; +#if (OMPI_ENABLE_MPI1_COMPAT || OMPI_BUILDING) static const int COMBINER_STRUCT_INTEGER = MPI_COMBINER_STRUCT_INTEGER; +#else +static const int COMBINER_STRUCT_INTEGER = OMPI_WAS_MPI_COMBINER_STRUCT_INTEGER; +#endif static const int COMBINER_STRUCT = MPI_COMBINER_STRUCT; static const int COMBINER_SUBARRAY = MPI_COMBINER_SUBARRAY; static const int COMBINER_DARRAY = MPI_COMBINER_DARRAY; From e4ee56d1f34722ea5601ef8769392958c2e5db1c Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Wed, 10 Apr 2019 18:03:18 +0300 Subject: [PATCH 321/674] SPML/UCX: Add shmemx_alltoall_global_nb routine to shmemx.h The new routine transfers the data asynchronously from the source PE to all PEs in the OpenSHMEM job. The routine returns immediately. The source and target buffers are reusable only after the completion of the routine. After the data is transferred to the target buffers, the counter object is updated atomically. The counter object can be read either using atomic operations such as shmem_atomic_fetch or can use point-to-point synchronization routines such as shmem_wait_until and shmem_test. Signed-off-by: Mikhail Brinskii (cherry picked from commit 2ef5bd8b3671f1e10caf00d06d66d120eac9c5be) --- ompi/mca/osc/ucx/osc_ucx_component.c | 2 - opal/mca/common/ucx/common_ucx.h | 2 + oshmem/include/shmemx.h | 3 + oshmem/mca/spml/base/base.h | 4 + oshmem/mca/spml/base/spml_base.c | 6 + oshmem/mca/spml/ikrit/spml_ikrit.c | 1 + oshmem/mca/spml/spml.h | 30 +++++ oshmem/mca/spml/ucx/spml_ucx.c | 157 ++++++++++++++++++++--- oshmem/mca/spml/ucx/spml_ucx.h | 53 ++++++-- oshmem/mca/spml/ucx/spml_ucx_component.c | 98 +++++++++++++- oshmem/shmem/c/shmem_put_nb.c | 9 ++ 11 files changed, 329 insertions(+), 36 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index 8014ac6f23a..a5b392568b3 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -17,8 +17,6 @@ #include "osc_ucx.h" #include "osc_ucx_request.h" -#define UCX_VERSION(_major, _minor, _build) (((_major) * 100) + (_minor)) - #define memcpy_off(_dst, _src, _len, _off) \ memcpy(((char*)(_dst)) + (_off), _src, _len); \ (_off) += (_len); diff --git a/opal/mca/common/ucx/common_ucx.h b/opal/mca/common/ucx/common_ucx.h index 7ea91ab7291..202131ac890 100644 --- a/opal/mca/common/ucx/common_ucx.h +++ b/opal/mca/common/ucx/common_ucx.h @@ -34,6 +34,8 @@ BEGIN_C_DECLS # define MCA_COMMON_UCX_ASSERT(_x) #endif +#define UCX_VERSION(_major, _minor, _build) (((_major) * 100) + (_minor)) + #define _MCA_COMMON_UCX_QUOTE(_x) \ # _x #define MCA_COMMON_UCX_QUOTE(_x) \ diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index b3b55cb7dd1..75e226b4f91 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -168,6 +168,9 @@ OSHMEM_DECLSPEC void shmemx_int16_prod_to_all(int16_t *target, const int16_t *so OSHMEM_DECLSPEC void shmemx_int32_prod_to_all(int32_t *target, const int32_t *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int32_t *pWrk, long *pSync); OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int64_t *pWrk, long *pSync); +/* Alltoall put with atomic counter increase */ +OSHMEM_DECLSPEC void shmemx_put_with_long_inc_all(void *target, const void *source, size_t size, long *counter); + /* * Backward compatibility section */ diff --git a/oshmem/mca/spml/base/base.h b/oshmem/mca/spml/base/base.h index e3ec1b68552..75a4eaec18d 100644 --- a/oshmem/mca/spml/base/base.h +++ b/oshmem/mca/spml/base/base.h @@ -93,6 +93,10 @@ OSHMEM_DECLSPEC int mca_spml_base_get_nb(void *dst_addr, void **handle); OSHMEM_DECLSPEC void mca_spml_base_memuse_hook(void *addr, size_t length); + +OSHMEM_DECLSPEC int mca_spml_base_put_all_nb(void *target, const void *source, + size_t size, long *counter); + /* * MCA framework */ diff --git a/oshmem/mca/spml/base/spml_base.c b/oshmem/mca/spml/base/spml_base.c index 8ef3894e98d..52ca7b4d618 100644 --- a/oshmem/mca/spml/base/spml_base.c +++ b/oshmem/mca/spml/base/spml_base.c @@ -280,3 +280,9 @@ int mca_spml_base_get_nb(void *dst_addr, size_t size, void mca_spml_base_memuse_hook(void *addr, size_t length) { } + +int mca_spml_base_put_all_nb(void *target, const void *source, + size_t size, long *counter) +{ + return OSHMEM_ERR_NOT_IMPLEMENTED; +} diff --git a/oshmem/mca/spml/ikrit/spml_ikrit.c b/oshmem/mca/spml/ikrit/spml_ikrit.c index 523baf77633..1cff194b4ad 100644 --- a/oshmem/mca/spml/ikrit/spml_ikrit.c +++ b/oshmem/mca/spml/ikrit/spml_ikrit.c @@ -181,6 +181,7 @@ mca_spml_ikrit_t mca_spml_ikrit = { mca_spml_base_rmkey_free, mca_spml_base_rmkey_ptr, mca_spml_base_memuse_hook, + mca_spml_base_put_all_nb, (void*)&mca_spml_ikrit }, diff --git a/oshmem/mca/spml/spml.h b/oshmem/mca/spml/spml.h index fa992db91ca..b4a3024ecff 100644 --- a/oshmem/mca/spml/spml.h +++ b/oshmem/mca/spml/spml.h @@ -314,6 +314,35 @@ typedef int (*mca_spml_base_module_send_fn_t)(void *buf, int dst, mca_spml_base_put_mode_t mode); +/** + * The routine transfers the data asynchronously from the source PE to all + * PEs in the OpenSHMEM job. The routine returns immediately. The source and + * target buffers are reusable only after the completion of the routine. + * After the data is transferred to the target buffers, the counter object + * is updated atomically. The counter object can be read either using atomic + * operations such as shmem_atomic_fetch or can use point-to-point synchronization + * routines such as shmem_wait_until and shmem_test. + * + * Shmem_quiet may be used for completing the operation, but not required for + * progress or completion. In a multithreaded OpenSHMEM program, the user + * (the OpenSHMEM program) should ensure the correct ordering of + * shmemx_alltoall_global calls. + * + * @param dest A symmetric data object that is large enough to receive + * “size†bytes of data. + * @param source A symmetric data object that contains “size†bytes of data + * for each PE in the OpenSHMEM job. + * @param size The number of bytes to be sent to each PE in the job. + * @param counter A symmetric data object to be atomically incremented after + * the target buffer is updated. + * + * @return OSHMEM_SUCCESS or failure status. + */ +typedef int (*mca_spml_base_module_put_all_nb_fn_t)(void *dest, + const void *source, + size_t size, + long *counter); + /** * Assures ordering of delivery of put() requests * @@ -381,6 +410,7 @@ struct mca_spml_base_module_1_0_0_t { mca_spml_base_module_mkey_ptr_fn_t spml_rmkey_ptr; mca_spml_base_module_memuse_hook_fn_t spml_memuse_hook; + mca_spml_base_module_put_all_nb_fn_t spml_put_all_nb; void *self; }; diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 0522ba09663..63d705ad7f9 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -34,6 +34,7 @@ #include "oshmem/proc/proc.h" #include "oshmem/mca/spml/base/base.h" #include "oshmem/mca/spml/base/spml_base_putreq.h" +#include "oshmem/mca/atomic/atomic.h" #include "oshmem/runtime/runtime.h" #include "orte/util/show_help.h" @@ -70,6 +71,7 @@ mca_spml_ucx_t mca_spml_ucx = { .spml_rmkey_free = mca_spml_ucx_rmkey_free, .spml_rmkey_ptr = mca_spml_ucx_rmkey_ptr, .spml_memuse_hook = mca_spml_ucx_memuse_hook, + .spml_put_all_nb = mca_spml_ucx_put_all_nb, .self = (void*)&mca_spml_ucx }, @@ -442,8 +444,8 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr, ucx_mkey->mem_h = (ucp_mem_h)mem_seg->context; } - status = ucp_rkey_pack(mca_spml_ucx.ucp_context, ucx_mkey->mem_h, - &mkeys[0].u.data, &len); + status = ucp_rkey_pack(mca_spml_ucx.ucp_context, ucx_mkey->mem_h, + &mkeys[0].u.data, &len); if (UCS_OK != status) { goto error_unmap; } @@ -480,8 +482,6 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) { spml_ucx_mkey_t *ucx_mkey; map_segment_t *mem_seg; - int segno; - int my_pe = oshmem_my_proc_id(); MCA_SPML_CALL(quiet(oshmem_ctx_default)); if (!mkeys) @@ -496,7 +496,7 @@ int mca_spml_ucx_deregister(sshmem_mkey_t *mkeys) if (OPAL_UNLIKELY(NULL == mem_seg)) { return OSHMEM_ERROR; } - + if (MAP_SEGMENT_ALLOC_UCX != mem_seg->type) { ucp_mem_unmap(mca_spml_ucx.ucp_context, ucx_mkey->mem_h); } @@ -548,17 +548,15 @@ static inline void _ctx_remove(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx opal_atomic_wmb (); } -int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) +static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx_ctx_p) { - mca_spml_ucx_ctx_t *ucx_ctx; ucp_worker_params_t params; ucp_ep_params_t ep_params; size_t i, j, nprocs = oshmem_num_procs(); ucs_status_t err; - int my_pe = oshmem_my_proc_id(); - size_t len; spml_ucx_mkey_t *ucx_mkey; sshmem_mkey_t *mkey; + mca_spml_ucx_ctx_t *ucx_ctx; int rc = OSHMEM_ERROR; ucx_ctx = malloc(sizeof(mca_spml_ucx_ctx_t)); @@ -583,10 +581,6 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) goto error; } - if (mca_spml_ucx.active_array.ctxs_count == 0) { - opal_progress_register(spml_ucx_ctx_progress); - } - for (i = 0; i < nprocs; i++) { ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS; ep_params.address = (ucp_address_t *)(mca_spml_ucx.remote_addrs_tbl[i]); @@ -612,11 +606,8 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) } } - SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); - _ctx_add(&mca_spml_ucx.active_array, ucx_ctx); - SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); + *ucx_ctx_p = ucx_ctx; - (*ctx) = (shmem_ctx_t)ucx_ctx; return OSHMEM_SUCCESS; error2: @@ -637,6 +628,33 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) return rc; } +int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) +{ + mca_spml_ucx_ctx_t *ucx_ctx; + int rc; + + /* Take a lock controlling aux context. AUX context may set specific + * UCX parameters affecting worker creation, which are not needed for + * regular contexts. */ + mca_spml_ucx_aux_lock(); + rc = mca_spml_ucx_ctx_create_common(options, &ucx_ctx); + mca_spml_ucx_aux_unlock(); + if (rc != OSHMEM_SUCCESS) { + return rc; + } + + if (mca_spml_ucx.active_array.ctxs_count == 0) { + opal_progress_register(spml_ucx_ctx_progress); + } + + SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); + _ctx_add(&mca_spml_ucx.active_array, ucx_ctx); + SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); + + (*ctx) = (shmem_ctx_t)ucx_ctx; + return OSHMEM_SUCCESS; +} + void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) { MCA_SPML_CALL(quiet(ctx)); @@ -751,6 +769,15 @@ int mca_spml_ucx_quiet(shmem_ctx_t ctx) oshmem_shmem_abort(-1); return ret; } + + /* If put_all_nb op/s is/are being executed asynchronously, need to wait its + * completion as well. */ + if (ctx == oshmem_ctx_default) { + while (mca_spml_ucx.aux_refcnt) { + opal_progress(); + } + } + return OSHMEM_SUCCESS; } @@ -788,3 +815,99 @@ int mca_spml_ucx_send(void* buf, return rc; } + +static void mca_spml_ucx_put_all_complete_cb(void *request, ucs_status_t status) +{ + if (mca_spml_ucx.async_progress && (--mca_spml_ucx.aux_refcnt == 0)) { + opal_event_evtimer_del(mca_spml_ucx.tick_event); + opal_progress_unregister(spml_ucx_progress_aux_ctx); + } + + if (request != NULL) { + ucp_request_free(request); + } +} + +/* Should be called with AUX lock taken */ +static int mca_spml_ucx_create_aux_ctx(void) +{ + unsigned major = 0; + unsigned minor = 0; + unsigned rel_number = 0; + int rc; + bool rand_dci_supp; + + ucp_get_version(&major, &minor, &rel_number); + rand_dci_supp = UCX_VERSION(major, minor, rel_number) >= UCX_VERSION(1, 6, 0); + + if (rand_dci_supp) { + opal_setenv("UCX_DC_TX_POLICY", "rand", 1, &environ); + opal_setenv("UCX_DC_MLX5_TX_POLICY", "rand", 1, &environ); + } + + rc = mca_spml_ucx_ctx_create_common(SHMEM_CTX_PRIVATE, &mca_spml_ucx.aux_ctx); + + if (rand_dci_supp) { + opal_unsetenv("UCX_DC_TX_POLICY", &environ); + opal_unsetenv("UCX_DC_MLX5_TX_POLICY", &environ); + } + + return rc; +} + +int mca_spml_ucx_put_all_nb(void *dest, const void *source, size_t size, long *counter) +{ + int my_pe = oshmem_my_proc_id(); + long val = 1; + int peer, dst_pe, rc; + shmem_ctx_t ctx; + struct timeval tv; + void *request; + + mca_spml_ucx_aux_lock(); + if (mca_spml_ucx.async_progress) { + if (mca_spml_ucx.aux_ctx == NULL) { + rc = mca_spml_ucx_create_aux_ctx(); + if (rc != OMPI_SUCCESS) { + mca_spml_ucx_aux_unlock(); + oshmem_shmem_abort(-1); + } + } + + if (!mca_spml_ucx.aux_refcnt) { + tv.tv_sec = 0; + tv.tv_usec = mca_spml_ucx.async_tick; + opal_event_evtimer_add(mca_spml_ucx.tick_event, &tv); + opal_progress_register(spml_ucx_progress_aux_ctx); + } + ctx = (shmem_ctx_t)mca_spml_ucx.aux_ctx; + ++mca_spml_ucx.aux_refcnt; + } else { + ctx = oshmem_ctx_default; + } + + for (peer = 0; peer < oshmem_num_procs(); peer++) { + dst_pe = (peer + my_pe) % oshmem_group_all->proc_count; + rc = mca_spml_ucx_put_nb(ctx, + (void*)((uintptr_t)dest + my_pe * size), + size, + (void*)((uintptr_t)source + dst_pe * size), + dst_pe, NULL); + RUNTIME_CHECK_RC(rc); + + mca_spml_ucx_fence(ctx); + + rc = MCA_ATOMIC_CALL(add(ctx, (void*)counter, val, sizeof(val), dst_pe)); + RUNTIME_CHECK_RC(rc); + } + + request = ucp_worker_flush_nb(((mca_spml_ucx_ctx_t*)ctx)->ucp_worker, 0, + mca_spml_ucx_put_all_complete_cb); + if (!UCS_PTR_IS_PTR(request)) { + mca_spml_ucx_put_all_complete_cb(NULL, UCS_PTR_STATUS(request)); + } + + mca_spml_ucx_aux_unlock(); + + return OSHMEM_SUCCESS; +} diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 6c2424ba766..b1be6e9d3c5 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -95,10 +95,18 @@ struct mca_spml_ucx { mca_spml_ucx_ctx_array_t idle_array; int priority; /* component priority */ shmem_internal_mutex_t internal_mutex; + /* Fields controlling aux context for put_all_nb SPML routine */ + bool async_progress; + int async_tick; + opal_event_base_t *async_event_base; + opal_event_t *tick_event; + mca_spml_ucx_ctx_t *aux_ctx; + pthread_spinlock_t async_lock; + int aux_refcnt; + }; typedef struct mca_spml_ucx mca_spml_ucx_t; - extern mca_spml_ucx_t mca_spml_ucx; extern int mca_spml_ucx_enable(bool enable); @@ -118,23 +126,28 @@ extern int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void **handle); extern int mca_spml_ucx_put(shmem_ctx_t ctx, - void* dst_addr, - size_t size, - void* src_addr, - int dst); + void* dst_addr, + size_t size, + void* src_addr, + int dst); extern int mca_spml_ucx_put_nb(shmem_ctx_t ctx, - void* dst_addr, - size_t size, - void* src_addr, - int dst, - void **handle); + void* dst_addr, + size_t size, + void* src_addr, + int dst, + void **handle); extern int mca_spml_ucx_recv(void* buf, size_t size, int src); extern int mca_spml_ucx_send(void* buf, - size_t size, - int dst, - mca_spml_base_put_mode_t mode); + size_t size, + int dst, + mca_spml_base_put_mode_t mode); + +extern int mca_spml_ucx_put_all_nb(void *target, + const void *source, + size_t size, + long *counter); extern sshmem_mkey_t *mca_spml_ucx_register(void* addr, size_t size, @@ -154,6 +167,20 @@ extern int mca_spml_ucx_fence(shmem_ctx_t ctx); extern int mca_spml_ucx_quiet(shmem_ctx_t ctx); extern int spml_ucx_default_progress(void); extern int spml_ucx_ctx_progress(void); +extern int spml_ucx_progress_aux_ctx(void); +void mca_spml_ucx_async_cb(int fd, short event, void *cbdata); + +static inline int mca_spml_ucx_aux_lock(void) +{ + return mca_spml_ucx.async_progress ? + pthread_spin_lock(&mca_spml_ucx.async_lock) : 0; +} + +static inline int mca_spml_ucx_aux_unlock(void) +{ + return mca_spml_ucx.async_progress ? + pthread_spin_unlock(&mca_spml_ucx.async_lock) : 0; +} static void mca_spml_ucx_cache_mkey(mca_spml_ucx_ctx_t *ucx_ctx, sshmem_mkey_t *mkey, uint32_t segno, int dst_pe) { diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 720dbf88f67..6b729535405 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -24,6 +24,7 @@ #include "orte/util/show_help.h" #include "opal/util/opal_environ.h" +#include "opal/runtime/opal_progress_threads.h" static int mca_spml_ucx_component_register(void); static int mca_spml_ucx_component_open(void); @@ -90,11 +91,26 @@ static inline void mca_spml_ucx_param_register_string(const char* param_name, storage); } +static inline void mca_spml_ucx_param_register_bool(const char* param_name, + bool default_value, + const char *help_msg, + bool *storage) +{ + *storage = default_value; + (void) mca_base_component_var_register(&mca_spml_ucx_component.spmlm_version, + param_name, + help_msg, + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + storage); +} + static int mca_spml_ucx_component_register(void) { mca_spml_ucx_param_register_int("priority", 21, - "[integer] ucx priority", - &mca_spml_ucx.priority); + "[integer] ucx priority", + &mca_spml_ucx.priority); mca_spml_ucx_param_register_int("num_disconnect", 1, "How may disconnects go in parallel", @@ -104,6 +120,14 @@ static int mca_spml_ucx_component_register(void) "Use non-blocking memory registration for shared heap", &mca_spml_ucx.heap_reg_nb); + mca_spml_ucx_param_register_bool("async_progress", 0, + "Enable asynchronous progress thread", + &mca_spml_ucx.async_progress); + + mca_spml_ucx_param_register_int("async_tick_usec", 3000, + "Asynchronous progress tick granularity (in usec)", + &mca_spml_ucx.async_tick); + opal_common_ucx_mca_var_register(&mca_spml_ucx_component.spmlm_version); return OSHMEM_SUCCESS; @@ -124,6 +148,37 @@ int spml_ucx_default_progress(void) return 1; } +int spml_ucx_progress_aux_ctx(void) +{ + if (OPAL_UNLIKELY(!mca_spml_ucx.aux_ctx)) { + return 1; + } + + if (pthread_spin_trylock(&mca_spml_ucx.async_lock)) { + return 1; + } + + ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + pthread_spin_unlock(&mca_spml_ucx.async_lock); + + return 1; +} + +void mca_spml_ucx_async_cb(int fd, short event, void *cbdata) +{ + int count = 0; + + if (pthread_spin_trylock(&mca_spml_ucx.async_lock)) { + return; + } + + do { + count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + } while(count); + + pthread_spin_unlock(&mca_spml_ucx.async_lock); +} + static int mca_spml_ucx_component_open(void) { return OSHMEM_SUCCESS; @@ -207,6 +262,21 @@ static int spml_ucx_init(void) oshmem_mpi_thread_provided = SHMEM_THREAD_SINGLE; } + if (mca_spml_ucx.async_progress) { + pthread_spin_init(&mca_spml_ucx.async_lock, 0); + mca_spml_ucx.async_event_base = opal_progress_thread_init(NULL); + if (NULL == mca_spml_ucx.async_event_base) { + SPML_UCX_ERROR("failed to init async progress thread"); + return OSHMEM_ERROR; + } + + mca_spml_ucx.tick_event = opal_event_alloc(); + opal_event_set(mca_spml_ucx.async_event_base, mca_spml_ucx.tick_event, + -1, EV_PERSIST, mca_spml_ucx_async_cb, NULL); + } + mca_spml_ucx.aux_ctx = NULL; + mca_spml_ucx.aux_refcnt = 0; + oshmem_ctx_default = (shmem_ctx_t) &mca_spml_ucx_ctx_default; return OSHMEM_SUCCESS; @@ -252,8 +322,8 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx) } opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), - mca_spml_ucx.num_disconnect, - ctx->ucp_worker); + mca_spml_ucx.num_disconnect, + ctx->ucp_worker); free(del_procs); free(ctx->ucp_peers); } @@ -271,6 +341,16 @@ static int mca_spml_ucx_component_fini(void) if(!mca_spml_ucx.enabled) return OSHMEM_SUCCESS; /* never selected.. return success.. */ + if (mca_spml_ucx.async_progress) { + opal_event_evtimer_del(mca_spml_ucx.tick_event); + opal_progress_thread_finalize(NULL); + if (mca_spml_ucx.aux_ctx != NULL) { + _ctx_cleanup(mca_spml_ucx.aux_ctx); + } + opal_progress_unregister(spml_ucx_progress_aux_ctx); + pthread_spin_destroy(&mca_spml_ucx.async_lock); + } + /* delete context objects from list */ for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { _ctx_cleanup(mca_spml_ucx.active_array.ctxs[i]); @@ -280,6 +360,7 @@ static int mca_spml_ucx_component_fini(void) _ctx_cleanup(mca_spml_ucx.idle_array.ctxs[i]); } + ret = opal_common_ucx_mca_pmix_fence_nb(&fenced); if (OPAL_SUCCESS != ret) { return ret; @@ -295,6 +376,10 @@ static int mca_spml_ucx_component_fini(void) } ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); + + if (mca_spml_ucx.aux_ctx != NULL) { + ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + } } /* delete all workers */ @@ -312,10 +397,15 @@ static int mca_spml_ucx_component_fini(void) ucp_worker_destroy(mca_spml_ucx_ctx_default.ucp_worker); } + if (mca_spml_ucx.aux_ctx != NULL) { + ucp_worker_destroy(mca_spml_ucx.aux_ctx->ucp_worker); + } + mca_spml_ucx.enabled = false; /* not anymore */ free(mca_spml_ucx.active_array.ctxs); free(mca_spml_ucx.idle_array.ctxs); + free(mca_spml_ucx.aux_ctx); SHMEM_MUTEX_DESTROY(mca_spml_ucx.internal_mutex); diff --git a/oshmem/shmem/c/shmem_put_nb.c b/oshmem/shmem/c/shmem_put_nb.c index 0ec88120e54..bf63130e236 100644 --- a/oshmem/shmem/c/shmem_put_nb.c +++ b/oshmem/shmem/c/shmem_put_nb.c @@ -226,3 +226,12 @@ SHMEM_TYPE_PUTMEM_NB(_put32, 4, shmem) SHMEM_TYPE_PUTMEM_NB(_put64, 8, shmem) SHMEM_TYPE_PUTMEM_NB(_put128, 16, shmem) SHMEM_TYPE_PUTMEM_NB(_putmem, 1, shmem) + +void shmemx_alltoall_global_nb(void *dest, + const void *source, + size_t size, + long *counter) +{ + int rc = MCA_SPML_CALL(put_all_nb(dest, source, size, counter)); + RUNTIME_CHECK_RC(rc); +} From 1c56f49a44f0fde8403852057d8275f69827d017 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Tue, 30 Apr 2019 14:46:43 +0300 Subject: [PATCH 322/674] SPML/UCX: CR comments p1 Signed-off-by: Mikhail Brinskii (cherry picked from commit c4c99457db6577f85b5b1c4c6849b5a04c226a84) --- oshmem/include/shmemx.h | 16 ++++++++++++++-- oshmem/mca/spml/ucx/spml_ucx.c | 14 +++++++------- oshmem/mca/spml/ucx/spml_ucx.h | 15 +++++++++------ oshmem/mca/spml/ucx/spml_ucx_component.c | 17 +++++++++++------ 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index 75e226b4f91..18e6edb7aea 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -168,8 +168,20 @@ OSHMEM_DECLSPEC void shmemx_int16_prod_to_all(int16_t *target, const int16_t *so OSHMEM_DECLSPEC void shmemx_int32_prod_to_all(int32_t *target, const int32_t *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int32_t *pWrk, long *pSync); OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int64_t *pWrk, long *pSync); -/* Alltoall put with atomic counter increase */ -OSHMEM_DECLSPEC void shmemx_put_with_long_inc_all(void *target, const void *source, size_t size, long *counter); +/* shmemx_alltoall_global_nb is a nonblocking collective routine, where each PE + * exchanges “size†bytes of data with all other PEs in the OpenSHMEM job. + + * @param dest A symmetric data object that is large enough to receive + * “size†bytes of data. + * @param source A symmetric data object that contains “size†bytes of data + * for each PE in the OpenSHMEM job. + * @param size The number of bytes to be sent to each PE in the job. + * @param counter A symmetric data object to be atomically incremented after + * the target buffer is updated. + * + * @return OSHMEM_SUCCESS or failure status. + */ +OSHMEM_DECLSPEC void shmemx_alltoall_global_nb(void *dest, const void *source, size_t size, long *counter); /* * Backward compatibility section diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 63d705ad7f9..431831e41b6 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -633,12 +633,12 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) mca_spml_ucx_ctx_t *ucx_ctx; int rc; - /* Take a lock controlling aux context. AUX context may set specific + /* Take a lock controlling context creation. AUX context may set specific * UCX parameters affecting worker creation, which are not needed for * regular contexts. */ - mca_spml_ucx_aux_lock(); + pthread_mutex_lock(&mca_spml_ucx.ctx_create_mutex); rc = mca_spml_ucx_ctx_create_common(options, &ucx_ctx); - mca_spml_ucx_aux_unlock(); + pthread_mutex_unlock(&mca_spml_ucx.ctx_create_mutex); if (rc != OSHMEM_SUCCESS) { return rc; } @@ -816,6 +816,7 @@ int mca_spml_ucx_send(void* buf, return rc; } +/* this can be called with request==NULL in case of immediate completion */ static void mca_spml_ucx_put_all_complete_cb(void *request, ucs_status_t status) { if (mca_spml_ucx.async_progress && (--mca_spml_ucx.aux_refcnt == 0)) { @@ -841,14 +842,14 @@ static int mca_spml_ucx_create_aux_ctx(void) rand_dci_supp = UCX_VERSION(major, minor, rel_number) >= UCX_VERSION(1, 6, 0); if (rand_dci_supp) { - opal_setenv("UCX_DC_TX_POLICY", "rand", 1, &environ); + pthread_mutex_lock(&mca_spml_ucx.ctx_create_mutex); opal_setenv("UCX_DC_MLX5_TX_POLICY", "rand", 1, &environ); } rc = mca_spml_ucx_ctx_create_common(SHMEM_CTX_PRIVATE, &mca_spml_ucx.aux_ctx); if (rand_dci_supp) { - opal_unsetenv("UCX_DC_TX_POLICY", &environ); + pthread_mutex_unlock(&mca_spml_ucx.ctx_create_mutex); opal_unsetenv("UCX_DC_MLX5_TX_POLICY", &environ); } @@ -874,14 +875,13 @@ int mca_spml_ucx_put_all_nb(void *dest, const void *source, size_t size, long *c } } - if (!mca_spml_ucx.aux_refcnt) { + if (mca_spml_ucx.aux_refcnt++ == 0) { tv.tv_sec = 0; tv.tv_usec = mca_spml_ucx.async_tick; opal_event_evtimer_add(mca_spml_ucx.tick_event, &tv); opal_progress_register(spml_ucx_progress_aux_ctx); } ctx = (shmem_ctx_t)mca_spml_ucx.aux_ctx; - ++mca_spml_ucx.aux_refcnt; } else { ctx = oshmem_ctx_default; } diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index b1be6e9d3c5..7c9c7689bde 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -95,6 +95,7 @@ struct mca_spml_ucx { mca_spml_ucx_ctx_array_t idle_array; int priority; /* component priority */ shmem_internal_mutex_t internal_mutex; + pthread_mutex_t ctx_create_mutex; /* Fields controlling aux context for put_all_nb SPML routine */ bool async_progress; int async_tick; @@ -170,16 +171,18 @@ extern int spml_ucx_ctx_progress(void); extern int spml_ucx_progress_aux_ctx(void); void mca_spml_ucx_async_cb(int fd, short event, void *cbdata); -static inline int mca_spml_ucx_aux_lock(void) +static inline void mca_spml_ucx_aux_lock(void) { - return mca_spml_ucx.async_progress ? - pthread_spin_lock(&mca_spml_ucx.async_lock) : 0; + if (mca_spml_ucx.async_progress) { + pthread_spin_lock(&mca_spml_ucx.async_lock); + } } -static inline int mca_spml_ucx_aux_unlock(void) +static inline void mca_spml_ucx_aux_unlock(void) { - return mca_spml_ucx.async_progress ? - pthread_spin_unlock(&mca_spml_ucx.async_lock) : 0; + if (mca_spml_ucx.async_progress) { + pthread_spin_unlock(&mca_spml_ucx.async_lock); + } } static void mca_spml_ucx_cache_mkey(mca_spml_ucx_ctx_t *ucx_ctx, sshmem_mkey_t *mkey, uint32_t segno, int dst_pe) diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 6b729535405..3bd7244448b 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -150,18 +150,20 @@ int spml_ucx_default_progress(void) int spml_ucx_progress_aux_ctx(void) { + unsigned count; + if (OPAL_UNLIKELY(!mca_spml_ucx.aux_ctx)) { - return 1; + return 0; } if (pthread_spin_trylock(&mca_spml_ucx.async_lock)) { - return 1; + return 0; } - ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); pthread_spin_unlock(&mca_spml_ucx.async_lock); - return 1; + return count; } void mca_spml_ucx_async_cb(int fd, short event, void *cbdata) @@ -240,6 +242,7 @@ static int spml_ucx_init(void) sizeof(mca_spml_ucx_ctx_t *)); SHMEM_MUTEX_INIT(mca_spml_ucx.internal_mutex); + pthread_mutex_init(&mca_spml_ucx.ctx_create_mutex, NULL); wkr_params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; if (oshmem_mpi_thread_requested == SHMEM_THREAD_MULTIPLE) { @@ -265,7 +268,7 @@ static int spml_ucx_init(void) if (mca_spml_ucx.async_progress) { pthread_spin_init(&mca_spml_ucx.async_lock, 0); mca_spml_ucx.async_event_base = opal_progress_thread_init(NULL); - if (NULL == mca_spml_ucx.async_event_base) { + if (NULL == mca_spml_ucx.async_event_base) { SPML_UCX_ERROR("failed to init async progress thread"); return OSHMEM_ERROR; } @@ -274,6 +277,7 @@ static int spml_ucx_init(void) opal_event_set(mca_spml_ucx.async_event_base, mca_spml_ucx.tick_event, -1, EV_PERSIST, mca_spml_ucx_async_cb, NULL); } + mca_spml_ucx.aux_ctx = NULL; mca_spml_ucx.aux_refcnt = 0; @@ -342,8 +346,8 @@ static int mca_spml_ucx_component_fini(void) return OSHMEM_SUCCESS; /* never selected.. return success.. */ if (mca_spml_ucx.async_progress) { - opal_event_evtimer_del(mca_spml_ucx.tick_event); opal_progress_thread_finalize(NULL); + opal_event_evtimer_del(mca_spml_ucx.tick_event); if (mca_spml_ucx.aux_ctx != NULL) { _ctx_cleanup(mca_spml_ucx.aux_ctx); } @@ -408,6 +412,7 @@ static int mca_spml_ucx_component_fini(void) free(mca_spml_ucx.aux_ctx); SHMEM_MUTEX_DESTROY(mca_spml_ucx.internal_mutex); + pthread_mutex_destroy(&mca_spml_ucx.ctx_create_mutex); if (mca_spml_ucx.ucp_context) { ucp_cleanup(mca_spml_ucx.ucp_context); From 6861a68de6b48219a2a1563792859a8e286f5e97 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Tue, 30 Apr 2019 16:49:11 +0300 Subject: [PATCH 323/674] SPML/UCS: CR comments p2 Signed-off-by: Mikhail Brinskii (cherry picked from commit d4843b165172a9cffbdc967ec92ec1d60d053903) --- oshmem/include/shmemx.h | 4 ++-- oshmem/mca/spml/spml.h | 2 +- oshmem/mca/spml/ucx/spml_ucx.c | 4 ++-- oshmem/mca/spml/ucx/spml_ucx_component.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index 18e6edb7aea..d99ca11533f 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -169,10 +169,10 @@ OSHMEM_DECLSPEC void shmemx_int32_prod_to_all(int32_t *target, const int32_t *so OSHMEM_DECLSPEC void shmemx_int64_prod_to_all(int64_t *target, const int64_t *source, int nreduce, int PE_start, int logPE_stride, int PE_size, int64_t *pWrk, long *pSync); /* shmemx_alltoall_global_nb is a nonblocking collective routine, where each PE - * exchanges “size†bytes of data with all other PEs in the OpenSHMEM job. + * exchanges “size†bytes of data with all other PEs in the OpenSHMEM job. * @param dest A symmetric data object that is large enough to receive - * “size†bytes of data. + * “size†bytes of data from each PE in the OpenSHMEM job. * @param source A symmetric data object that contains “size†bytes of data * for each PE in the OpenSHMEM job. * @param size The number of bytes to be sent to each PE in the job. diff --git a/oshmem/mca/spml/spml.h b/oshmem/mca/spml/spml.h index b4a3024ecff..ca62b5f0bd4 100644 --- a/oshmem/mca/spml/spml.h +++ b/oshmem/mca/spml/spml.h @@ -329,7 +329,7 @@ typedef int (*mca_spml_base_module_send_fn_t)(void *buf, * shmemx_alltoall_global calls. * * @param dest A symmetric data object that is large enough to receive - * “size†bytes of data. + * “size†bytes of data from each PE in the OpenSHMEM job. * @param source A symmetric data object that contains “size†bytes of data * for each PE in the OpenSHMEM job. * @param size The number of bytes to be sent to each PE in the job. diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 431831e41b6..bd43baf3810 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -843,14 +843,14 @@ static int mca_spml_ucx_create_aux_ctx(void) if (rand_dci_supp) { pthread_mutex_lock(&mca_spml_ucx.ctx_create_mutex); - opal_setenv("UCX_DC_MLX5_TX_POLICY", "rand", 1, &environ); + opal_setenv("UCX_DC_MLX5_TX_POLICY", "rand", 0, &environ); } rc = mca_spml_ucx_ctx_create_common(SHMEM_CTX_PRIVATE, &mca_spml_ucx.aux_ctx); if (rand_dci_supp) { - pthread_mutex_unlock(&mca_spml_ucx.ctx_create_mutex); opal_unsetenv("UCX_DC_MLX5_TX_POLICY", &environ); + pthread_mutex_unlock(&mca_spml_ucx.ctx_create_mutex); } return rc; diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 3bd7244448b..9a4a73ef121 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -176,7 +176,7 @@ void mca_spml_ucx_async_cb(int fd, short event, void *cbdata) do { count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); - } while(count); + } while (count); pthread_spin_unlock(&mca_spml_ucx.async_lock); } From c44821aef5cb7b8d287961aae8e65e00318c9460 Mon Sep 17 00:00:00 2001 From: Brelle Emmanuel Date: Mon, 1 Apr 2019 18:45:05 +0200 Subject: [PATCH 324/674] pml/ob1: fixed local handle sent during PUT control message In case of using a btl_put in ob1, the handle of the locally registered memory is sent with a PUT control message. In the current master code the sent handle is necessary the handle in the frag but if the handle has been successfully registered in the request, the frag structure does not have any valid handle and all fragments use the request one. I suggest to check if the handle in the fragment is valid and if not to send the handle from the request. Signed-off-by: Brelle Emmanuel (cherry picked from commit e630046a4b82bc01379fb055af4c0e414c2a8e8f) --- ompi/mca/pml/ob1/pml_ob1_recvreq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index 1c95445ab46..02d2a58479a 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -402,6 +402,7 @@ static int mca_pml_ob1_recv_request_put_frag (mca_pml_ob1_rdma_frag_t *frag) #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT ompi_proc_t* proc = (ompi_proc_t*)recvreq->req_recv.req_base.req_proc; #endif + mca_btl_base_registration_handle_t *local_handle = NULL; mca_bml_base_btl_t *bml_btl = frag->rdma_bml; mca_btl_base_descriptor_t *ctl; mca_pml_ob1_rdma_hdr_t *hdr; @@ -410,6 +411,12 @@ static int mca_pml_ob1_recv_request_put_frag (mca_pml_ob1_rdma_frag_t *frag) reg_size = bml_btl->btl->btl_registration_handle_size; + if (frag->local_handle) { + local_handle = frag->local_handle; + } else if (recvreq->local_handle) { + local_handle = recvreq->local_handle; + } + /* prepare a descriptor for rdma control message */ mca_bml_base_alloc (bml_btl, &ctl, MCA_BTL_NO_ORDER, sizeof (mca_pml_ob1_rdma_hdr_t) + reg_size, MCA_BTL_DES_FLAGS_PRIORITY | MCA_BTL_DES_FLAGS_BTL_OWNERSHIP | @@ -423,7 +430,7 @@ static int mca_pml_ob1_recv_request_put_frag (mca_pml_ob1_rdma_frag_t *frag) hdr = (mca_pml_ob1_rdma_hdr_t *) ctl->des_segments->seg_addr.pval; mca_pml_ob1_rdma_hdr_prepare (hdr, (!recvreq->req_ack_sent) ? MCA_PML_OB1_HDR_TYPE_ACK : 0, recvreq->remote_req_send.lval, frag, recvreq, frag->rdma_offset, - frag->local_address, frag->rdma_length, frag->local_handle, + frag->local_address, frag->rdma_length, local_handle, reg_size); ob1_hdr_hton(hdr, MCA_PML_OB1_HDR_TYPE_PUT, proc); From 48f824327c7cb2172498618a43d2518f1b650fb6 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 26 Apr 2019 19:44:18 -0400 Subject: [PATCH 325/674] Fix the leak of fragments for persistent sends. The rdma_frag attached to the send request was not correctly released upon request completion, leaking until MPI_Finalize. A quick solution would have been to add RDMA_FRAG_RETURN at different locations on the send request completion, but it would have unnecessarily made the sendreq completion path more complex. Instead, I added the length to the RDMA fragment so that it can be completed during the remote ack. Be more explicit on the comment. The rdma_frag can only be freed once when the peer forced a protocol change (from RDMA GET to send/recv). Otherwise the fragment will be returned once all data pertaining to it has been trasnferred. NOTE: Had to add a typedef for "opal_atomic_size_t" from master into opal/threads/thread_usage.h into this cherry pick (it is in opal/include/opal_stdatomic.h on master, but that file does not exist here on the v4.0.x branch). Signed-off-by: George Bosilca (cherry picked from commit a16cf0e4dd6df4dea820fecedd5920df632935b8) Signed-off-by: Jeff Squyres --- ompi/mca/pml/ob1/pml_ob1_rdmafrag.h | 6 +++--- ompi/mca/pml/ob1/pml_ob1_recvfrag.c | 4 ---- ompi/mca/pml/ob1/pml_ob1_recvreq.c | 10 +++++++--- ompi/mca/pml/ob1/pml_ob1_sendreq.c | 19 ++++++++++++------- ompi/mca/pml/ob1/pml_ob1_sendreq.h | 5 +---- opal/threads/thread_usage.h | 4 ++++ 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h b/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h index 70a390d8073..176c830974c 100644 --- a/ompi/mca/pml/ob1/pml_ob1_rdmafrag.h +++ b/ompi/mca/pml/ob1/pml_ob1_rdmafrag.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-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -46,7 +46,8 @@ struct mca_pml_ob1_rdma_frag_t { mca_bml_base_btl_t *rdma_bml; mca_pml_ob1_hdr_t rdma_hdr; mca_pml_ob1_rdma_state_t rdma_state; - size_t rdma_length; + size_t rdma_length; /* how much the fragment will transfer */ + opal_atomic_size_t rdma_bytes_remaining; /* how much is left to be transferred */ void *rdma_req; uint32_t retries; mca_pml_ob1_rdma_frag_callback_t cbfunc; @@ -71,7 +72,6 @@ OBJ_CLASS_DECLARATION(mca_pml_ob1_rdma_frag_t); #define MCA_PML_OB1_RDMA_FRAG_RETURN(frag) \ do { \ - /* return fragment */ \ if (frag->local_handle) { \ mca_bml_base_deregister_mem (frag->rdma_bml, frag->local_handle); \ frag->local_handle = NULL; \ diff --git a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c index c960ac3e10d..66482b4bc62 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvfrag.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvfrag.c @@ -558,10 +558,6 @@ void mca_pml_ob1_recv_frag_callback_ack(mca_btl_base_module_t* btl, * then throttle sends */ if(hdr->hdr_common.hdr_flags & MCA_PML_OB1_HDR_FLAGS_NORDMA) { if (NULL != sendreq->rdma_frag) { - if (NULL != sendreq->rdma_frag->local_handle) { - mca_bml_base_deregister_mem (sendreq->req_rdma[0].bml_btl, sendreq->rdma_frag->local_handle); - sendreq->rdma_frag->local_handle = NULL; - } MCA_PML_OB1_RDMA_FRAG_RETURN(sendreq->rdma_frag); sendreq->rdma_frag = NULL; } diff --git a/ompi/mca/pml/ob1/pml_ob1_recvreq.c b/ompi/mca/pml/ob1/pml_ob1_recvreq.c index 02d2a58479a..70969415c49 100644 --- a/ompi/mca/pml/ob1/pml_ob1_recvreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_recvreq.c @@ -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-2018 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -313,7 +313,12 @@ static int mca_pml_ob1_recv_request_ack( return OMPI_SUCCESS; } - /* let know to shedule function there is no need to put ACK flag */ + /* let know to shedule function there is no need to put ACK flag. If not all message went over + * RDMA then we cancel the GET protocol in order to switch back to send/recv. In this case send + * back the remote send request, the peer kept a poointer to the frag locally. In the future we + * might want to cancel the fragment itself, in which case we will have to send back the remote + * fragment instead of the remote request. + */ recvreq->req_ack_sent = true; return mca_pml_ob1_recv_request_ack_send(proc, hdr->hdr_src_req.lval, recvreq, recvreq->req_send_offset, 0, @@ -652,7 +657,6 @@ void mca_pml_ob1_recv_request_progress_rget( mca_pml_ob1_recv_request_t* recvreq int rc; prev_sent = offset = 0; - bytes_remaining = hdr->hdr_rndv.hdr_msg_length; recvreq->req_recv.req_bytes_packed = hdr->hdr_rndv.hdr_msg_length; recvreq->req_send_offset = 0; recvreq->req_rdma_offset = 0; diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.c b/ompi/mca/pml/ob1/pml_ob1_sendreq.c index 1626e13e353..2474374572d 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.c +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.c @@ -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-2018 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -41,7 +41,6 @@ #include "ompi/mca/bml/base/base.h" #include "ompi/memchecker.h" - OBJ_CLASS_INSTANCE(mca_pml_ob1_send_range_t, opal_free_list_item_t, NULL, NULL); @@ -148,10 +147,7 @@ static void mca_pml_ob1_send_request_destruct(mca_pml_ob1_send_request_t* req) { OBJ_DESTRUCT(&req->req_send_ranges); OBJ_DESTRUCT(&req->req_send_range_lock); - if (req->rdma_frag) { - MCA_PML_OB1_RDMA_FRAG_RETURN(req->rdma_frag); - req->rdma_frag = NULL; - } + assert( NULL == req->rdma_frag ); } OBJ_CLASS_INSTANCE( mca_pml_ob1_send_request_t, @@ -262,12 +258,20 @@ mca_pml_ob1_rget_completion (mca_pml_ob1_rdma_frag_t *frag, int64_t rdma_length) { mca_pml_ob1_send_request_t *sendreq = (mca_pml_ob1_send_request_t *) frag->rdma_req; mca_bml_base_btl_t *bml_btl = frag->rdma_bml; + size_t frag_remaining; /* count bytes of user data actually delivered and check for request completion */ if (OPAL_LIKELY(0 < rdma_length)) { - OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, (size_t) rdma_length); + frag_remaining = OPAL_THREAD_SUB_FETCH_SIZE_T(&frag->rdma_bytes_remaining, (size_t)rdma_length); SPC_USER_OR_MPI(sendreq->req_send.req_base.req_ompi.req_status.MPI_TAG, (ompi_spc_value_t)rdma_length, OMPI_SPC_BYTES_SENT_USER, OMPI_SPC_BYTES_SENT_MPI); + + if( 0 == frag_remaining ) { /* this frag is now completed. Update the request and be done */ + OPAL_THREAD_ADD_FETCH_SIZE_T(&sendreq->req_bytes_delivered, frag->rdma_length); + if( sendreq->rdma_frag == frag ) + sendreq->rdma_frag = NULL; + MCA_PML_OB1_RDMA_FRAG_RETURN(frag); + } } send_request_pml_complete_check(sendreq); @@ -701,6 +705,7 @@ int mca_pml_ob1_send_request_start_rdma( mca_pml_ob1_send_request_t* sendreq, frag->rdma_req = sendreq; frag->rdma_bml = bml_btl; frag->rdma_length = size; + frag->rdma_bytes_remaining = size; frag->cbfunc = mca_pml_ob1_rget_completion; /* do not store the local handle in the fragment. it will be released by mca_pml_ob1_free_rdma_resources */ diff --git a/ompi/mca/pml/ob1/pml_ob1_sendreq.h b/ompi/mca/pml/ob1/pml_ob1_sendreq.h index 06e4abb4672..ae8f5afe2c5 100644 --- a/ompi/mca/pml/ob1/pml_ob1_sendreq.h +++ b/ompi/mca/pml/ob1/pml_ob1_sendreq.h @@ -216,10 +216,7 @@ static inline void mca_pml_ob1_send_request_fini (mca_pml_ob1_send_request_t *se { /* Let the base handle the reference counts */ MCA_PML_BASE_SEND_REQUEST_FINI((&(sendreq)->req_send)); - if (sendreq->rdma_frag) { - MCA_PML_OB1_RDMA_FRAG_RETURN (sendreq->rdma_frag); - sendreq->rdma_frag = NULL; - } + assert( NULL == sendreq->rdma_frag ); } /* diff --git a/opal/threads/thread_usage.h b/opal/threads/thread_usage.h index 178c8ceaab6..434c69e88df 100644 --- a/opal/threads/thread_usage.h +++ b/opal/threads/thread_usage.h @@ -88,6 +88,10 @@ static inline bool opal_set_using_threads(bool have) } +// Back-ported from master (2019-05-04) as part of +// a16cf0e4dd6df4dea820fecedd5920df632935b8 +typedef volatile size_t opal_atomic_size_t; + /** * Use an atomic operation for increment/decrement if opal_using_threads() * indicates that threads are in use by the application or library. From 94e842bb3478d72f21bc1f908bc8f7fe896b353f Mon Sep 17 00:00:00 2001 From: Michael Heinz Date: Wed, 1 May 2019 15:20:41 -0400 Subject: [PATCH 326/674] buildrpm.sh no longer respects the value of rpmtopdir In OMPI 2.1.2, buildrpm.sh could work with a value of rpmtopdir that was set in the environment. In newer versions this is no longer true, causing such values to be ignored. This patch adds a new argument to buildrpm.sh, -R, which allows the user to specify where to build the RPMs. Signed-off-by: Michael Heinz (cherry picked from commit 687a5603a122af332bb939bba13aec78beb206cd) --- contrib/dist/linux/README | 3 +++ contrib/dist/linux/buildrpm.sh | 25 ++++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/contrib/dist/linux/README b/contrib/dist/linux/README index 045b3734b7f..f9a3aa8841c 100644 --- a/contrib/dist/linux/README +++ b/contrib/dist/linux/README @@ -86,6 +86,9 @@ Please, do NOT set the same settings with parameters and config vars. file from the tarball specified on the command line. By default, the script will look for the specfile in the current directory. +-R directory + Specifies the top level RPM build direcotry. + -h Prints script usage information. diff --git a/contrib/dist/linux/buildrpm.sh b/contrib/dist/linux/buildrpm.sh index b4f2f18f744..d19df828bce 100755 --- a/contrib/dist/linux/buildrpm.sh +++ b/contrib/dist/linux/buildrpm.sh @@ -58,6 +58,9 @@ # file from the tarball specified on the command line. By default, # the script will look for the specfile in the current directory. # +# -R directory +# Specifies the top level RPM build direcotry. +# # -h # Prints script usage information. # @@ -107,7 +110,7 @@ orig_param="$@" # # usage information # -usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location] tarball +usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_location][-R directory] tarball -b build all-in-one binary RPM only (required for all other flags to work) @@ -146,6 +149,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo -r parameter add custom RPM build parameter + -R directory + Specifies the top level RPM build direcotry. + -h print this message and exit tarball path to Open MPI source tarball @@ -155,8 +161,9 @@ usage="Usage: $0 [-b][-o][-m][-d][-u][-s][-h] [-n name][-f lf_location][-t tm_lo # parse args # libfabric_path="" +rpmtopdir= -while getopts bn:omif:t:dc:r:sh flag; do +while getopts bn:omif:t:dc:r:sR:h flag; do case "$flag" in b) build_srpm="no" build_single="yes" @@ -180,6 +187,8 @@ while getopts bn:omif:t:dc:r:sh flag; do ;; r) configure_options="$rpmbuild_options $OPTARG" ;; + R) rpmtopdir="$OPTARG" + ;; s) unpack_spec="1" ;; h) echo "$usage" 1>&2 @@ -267,10 +276,16 @@ fi # Find where the top RPM-building directory is # -file=~/.rpmmacros -if test -r $file; then - rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"} +# if the user did not specify an $rpmtopdir, check for an .rpmmacros file. +if test "$rpmtopdir" == ""; then + file=~/.rpmmacros + if test -r $file; then + rpmtopdir=${rpmtopdir:-"`grep %_topdir $file | awk '{ print $2 }'`"} + fi fi + +# If needed, initialize the $rpmtopdir directory. If no $rpmtopdir was +# specified, try various system-level defaults. if test "$rpmtopdir" != ""; then rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'" if test ! -d "$rpmtopdir"; then From 77caeb9bfaa250a5980c0fb1b3f10332a543f3b0 Mon Sep 17 00:00:00 2001 From: Michael Heinz Date: Wed, 1 May 2019 15:22:03 -0400 Subject: [PATCH 327/674] Corrects some whitespace issues with buildrpm.sh Signed-off-by: Michael Heinz (cherry picked from commit 8562211623cd7501c13b1d3976f7fe0a3d27c91d) --- contrib/dist/linux/buildrpm.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/dist/linux/buildrpm.sh b/contrib/dist/linux/buildrpm.sh index d19df828bce..3b609ee574c 100755 --- a/contrib/dist/linux/buildrpm.sh +++ b/contrib/dist/linux/buildrpm.sh @@ -287,19 +287,19 @@ fi # If needed, initialize the $rpmtopdir directory. If no $rpmtopdir was # specified, try various system-level defaults. if test "$rpmtopdir" != ""; then - rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'" + rpmbuild_options="$rpmbuild_options --define '_topdir $rpmtopdir'" if test ! -d "$rpmtopdir"; then - mkdir -p "$rpmtopdir" - mkdir -p "$rpmtopdir/BUILD" - mkdir -p "$rpmtopdir/RPMS" - mkdir -p "$rpmtopdir/RPMS/i386" - mkdir -p "$rpmtopdir/RPMS/i586" - mkdir -p "$rpmtopdir/RPMS/i686" - mkdir -p "$rpmtopdir/RPMS/noarch" - mkdir -p "$rpmtopdir/RPMS/athlon" - mkdir -p "$rpmtopdir/SOURCES" - mkdir -p "$rpmtopdir/SPECS" - mkdir -p "$rpmtopdir/SRPMS" + mkdir -p "$rpmtopdir" + mkdir -p "$rpmtopdir/BUILD" + mkdir -p "$rpmtopdir/RPMS" + mkdir -p "$rpmtopdir/RPMS/i386" + mkdir -p "$rpmtopdir/RPMS/i586" + mkdir -p "$rpmtopdir/RPMS/i686" + mkdir -p "$rpmtopdir/RPMS/noarch" + mkdir -p "$rpmtopdir/RPMS/athlon" + mkdir -p "$rpmtopdir/SOURCES" + mkdir -p "$rpmtopdir/SPECS" + mkdir -p "$rpmtopdir/SRPMS" fi need_root=0 elif test -d /usr/src/RPM; then From 70a864fce39d6e69a301bb324a69e80b41011c57 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 27 Mar 2019 11:55:27 +0900 Subject: [PATCH 328/674] btl/vader: fix finalize sequence free the component mpool in mca_btl_vader_component_close() and after freeing soem objects that depend on it such as mca_btl_vader_component.vader_frags_user Thanks Christoph Niethammer for reporting this. Refs. open-mpi/ompi#6524 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@77060cad0781926a83f635c3660c743320ce0264) --- opal/mca/btl/vader/btl_vader_component.c | 9 +++++++-- opal/mca/btl/vader/btl_vader_module.c | 9 ++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 11197259973..892e6a1452d 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -16,8 +16,8 @@ * All rights reserved. * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. @@ -341,6 +341,11 @@ static int mca_btl_vader_component_close(void) mca_btl_vader_knem_fini (); #endif + if (mca_btl_vader_component.mpool) { + mca_btl_vader_component.mpool->mpool_finalize (mca_btl_vader_component.mpool); + mca_btl_vader_component.mpool = NULL; + } + return OPAL_SUCCESS; } diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index 36ec1f00610..a1cd167e222 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -15,8 +15,8 @@ * Copyright (c) 2010-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2018-2019 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ @@ -380,11 +380,6 @@ static int vader_finalize(struct mca_btl_base_module_t *btl) } #endif - if (component->mpool) { - component->mpool->mpool_finalize (component->mpool); - component->mpool = NULL; - } - return OPAL_SUCCESS; } From 4946570b242634a09e1464c6025267907193f53b Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 3 Aug 2018 15:39:01 -0400 Subject: [PATCH 329/674] Remove few warnings identified by @rhc in #5514. Signed-off-by: George Bosilca (cherry picked from commit open-mpi/ompi@6d11a45f44b91babcdf0ce864afe8530521d0eb2) --- ompi/mca/coll/libnbc/nbc.c | 2 -- ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c | 2 +- ompi/mca/topo/treematch/treematch/tm_topology.c | 7 +++++++ ompi/mca/topo/treematch/treematch/tm_tree.c | 6 ++---- opal/mca/btl/vader/btl_vader_component.c | 5 ++++- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc.c b/ompi/mca/coll/libnbc/nbc.c index 5b48d6b9315..039e6d4c9b0 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -319,8 +319,6 @@ int NBC_Progress(NBC_Handle *handle) { bool flag; unsigned long size = 0; char *delim; - int i; - ompi_status_public_t status; if (handle->nbc_complete) { return NBC_OK; diff --git a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c index 891a5b041be..a2b53be0667 100644 --- a/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c +++ b/ompi/mca/topo/treematch/topo_treematch_dist_graph_create.c @@ -135,7 +135,7 @@ int mca_topo_treematch_dist_graph_create(mca_topo_base_module_t* topo_module, int *lindex_to_grank = NULL; int *nodes_roots = NULL, *k = NULL; int *localrank_to_objnum = NULL; - int depth, effective_depth = 0, obj_rank = -1; + int depth = 0, effective_depth = 0, obj_rank = -1; int num_objs_in_node = 0, num_pus_in_node = 0; int numlevels = 0, num_nodes = 0, num_procs_in_node = 0; int rank, size, newrank = -1, hwloc_err, i, j, idx; diff --git a/ompi/mca/topo/treematch/treematch/tm_topology.c b/ompi/mca/topo/treematch/treematch/tm_topology.c index 4445b45634c..1ecf51657b8 100644 --- a/ompi/mca/topo/treematch/treematch/tm_topology.c +++ b/ompi/mca/topo/treematch/treematch/tm_topology.c @@ -141,7 +141,14 @@ double ** topology_to_arch(hwloc_topology_t topology) double **arch = NULL; nb_proc = hwloc_get_nbobjs_by_type(topology, HWLOC_OBJ_PU); + if( nb_proc <= 0 ) { /* if multiple levels with PUs */ + return NULL; + } arch = (double**)MALLOC(sizeof(double*)*nb_proc); + if( NULL == arch ) { + return NULL; + } + for( i = 0 ; i < nb_proc ; i++ ){ obj_proc1 = hwloc_get_obj_by_type(topology,HWLOC_OBJ_PU,i); arch[obj_proc1->os_index] = (double*)MALLOC(sizeof(double)*nb_proc); diff --git a/ompi/mca/topo/treematch/treematch/tm_tree.c b/ompi/mca/topo/treematch/treematch/tm_tree.c index ffac4e7615b..35fc2aa2fef 100644 --- a/ompi/mca/topo/treematch/treematch/tm_tree.c +++ b/ompi/mca/topo/treematch/treematch/tm_tree.c @@ -918,7 +918,7 @@ static void partial_exhaustive_search(int nb_args, void **args, int thread_id){ work_unit_t *work = (work_unit_t *) args[7]; pthread_mutex_t *lock = (pthread_mutex_t *) args[8]; int *tab_i; - int id, id1, id2; + int id = 0, id1, id2; int total_work = work->nb_work; int cur_work = 0; @@ -1750,7 +1750,6 @@ void group_nodes(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new int mat_order = aff_mat -> order; tm_tree_t **cur_group = NULL; int j, l; - unsigned long int list_size; unsigned long int i; group_list_t list, **best_selection = NULL, **tab_group = NULL; double best_val, last_best; @@ -1810,8 +1809,7 @@ void group_nodes(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new best_selection = (group_list_t **)MALLOC(sizeof(group_list_t*)*solution_size); list_all_possible_groups(cost_mat, tab_node, 0, arity, 0, cur_group, &list); - list_size = (int)list.val; - assert( list_size == nb_groups); + assert( nb_groups == (unsigned long int)list.val ); tab_group = (group_list_t**)MALLOC(sizeof(group_list_t*)*nb_groups); list_to_tab(list.next, tab_group, nb_groups); if(verbose_level>=INFO) diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 892e6a1452d..5a163f637ab 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -375,6 +375,7 @@ static int mca_btl_base_vader_modex_send (void) return rc; } +#if OPAL_BTL_VADER_HAVE_XPMEM || OPAL_BTL_VADER_HAVE_CMA || OPAL_BTL_VADER_HAVE_KNEM static void mca_btl_vader_select_next_single_copy_mechanism (void) { for (int i = 0 ; single_copy_mechanisms[i].value != MCA_BTL_VADER_NONE ; ++i) { @@ -384,10 +385,13 @@ static void mca_btl_vader_select_next_single_copy_mechanism (void) } } } +#endif static void mca_btl_vader_check_single_copy (void) { +#if OPAL_BTL_VADER_HAVE_XPMEM || OPAL_BTL_VADER_HAVE_CMA || OPAL_BTL_VADER_HAVE_KNEM int initial_mechanism = mca_btl_vader_component.single_copy_mechanism; +#endif /* single-copy emulation is always used to support AMO's right now */ mca_btl_vader_sc_emu_init (); @@ -531,7 +535,6 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls, mca_btl_vader_check_single_copy (); if (MCA_BTL_VADER_XPMEM != mca_btl_vader_component.single_copy_mechanism) { - const char *base_dir = opal_process_info.proc_session_dir; char *sm_file; rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%x.%d", mca_btl_vader_component.backing_directory, From fc41c161344ed699240cca466151254f6d46769a Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Tue, 7 May 2019 22:14:41 +0300 Subject: [PATCH 330/674] OSHMEM: Add support for shmemx_malloc_with_hint() - added multiple segments processing - added shmemx_malloc_with_hint call + set of hints (picked from master 94b5e91) Signed-off-by: Sergey Oblomov Signed-off-by: Yossi Itigin --- oshmem/include/pshmemx.h | 5 + oshmem/include/shmemx.h | 18 ++ oshmem/mca/memheap/base/base.h | 64 +++-- oshmem/mca/memheap/base/memheap_base_alloc.c | 42 ++- oshmem/mca/memheap/base/memheap_base_frame.c | 6 + oshmem/mca/memheap/base/memheap_base_mkey.c | 2 +- oshmem/mca/memheap/base/memheap_base_select.c | 22 +- oshmem/mca/memheap/base/memheap_base_static.c | 2 +- oshmem/mca/memheap/memheap.h | 2 + oshmem/mca/spml/ucx/spml_ucx.c | 28 +- oshmem/mca/spml/ucx/spml_ucx.h | 2 +- oshmem/mca/spml/ucx/spml_ucx_component.c | 2 +- oshmem/mca/sshmem/base/base.h | 2 +- oshmem/mca/sshmem/base/sshmem_base_wrappers.c | 4 +- oshmem/mca/sshmem/mmap/sshmem_mmap_module.c | 4 +- oshmem/mca/sshmem/sshmem.h | 7 +- oshmem/mca/sshmem/sshmem_types.h | 9 + oshmem/mca/sshmem/sysv/sshmem_sysv_module.c | 4 +- oshmem/mca/sshmem/ucx/Makefile.am | 3 +- oshmem/mca/sshmem/ucx/configure.m4 | 34 +++ oshmem/mca/sshmem/ucx/sshmem_ucx.h | 19 ++ oshmem/mca/sshmem/ucx/sshmem_ucx_module.c | 244 ++++++++++++++++-- oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c | 127 +++++++++ oshmem/shmem/c/profile/defines.h | 2 + oshmem/shmem/c/shmem_alloc.c | 39 ++- oshmem/shmem/c/shmem_free.c | 14 +- oshmem/shmem/c/shmem_realloc.c | 14 +- 27 files changed, 635 insertions(+), 86 deletions(-) create mode 100644 oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c diff --git a/oshmem/include/pshmemx.h b/oshmem/include/pshmemx.h index 5a0f7f5a95c..0b4ffcbd202 100644 --- a/oshmem/include/pshmemx.h +++ b/oshmem/include/pshmemx.h @@ -16,6 +16,11 @@ extern "C" { #endif +/* + * Symmetric heap routines + */ +OSHMEM_DECLSPEC void* pshmemx_malloc_with_hint(size_t size, long hint); + /* * Legacy API diff --git a/oshmem/include/shmemx.h b/oshmem/include/shmemx.h index d99ca11533f..f7e7de68295 100644 --- a/oshmem/include/shmemx.h +++ b/oshmem/include/shmemx.h @@ -18,11 +18,29 @@ extern "C" { #endif +enum { + SHMEM_HINT_NONE = 0, + SHMEM_HINT_LOW_LAT_MEM = 1 << 0, + SHMEM_HINT_HIGH_BW_MEM = 1 << 1, + SHMEM_HINT_NEAR_NIC_MEM = 1 << 2, + SHMEM_HINT_DEVICE_GPU_MEM = 1 << 3, + SHMEM_HINT_DEVICE_NIC_MEM = 1 << 4, + + SHMEM_HINT_PSYNC = 1 << 16, + SHMEM_HINT_PWORK = 1 << 17, + SHMEM_HINT_ATOMICS = 1 << 18 +}; + /* * All OpenSHMEM extension APIs that are not part of this specification must be defined in the shmemx.h include * file. These extensions shall use the shmemx_ prefix for all routine, variable, and constant names. */ +/* + * Symmetric heap routines + */ +OSHMEM_DECLSPEC void* shmemx_malloc_with_hint(size_t size, long hint); + /* * Elemental put routines */ diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index 7178685f0a7..a91a03ae0c1 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -41,14 +41,17 @@ OSHMEM_DECLSPEC int mca_memheap_base_select(void); extern int mca_memheap_base_already_opened; extern int mca_memheap_base_key_exchange; -#define MCA_MEMHEAP_MAX_SEGMENTS 4 -#define HEAP_SEG_INDEX 0 -#define SYMB_SEG_INDEX 1 -#define MCA_MEMHEAP_SEG_COUNT (SYMB_SEG_INDEX+1) +#define MCA_MEMHEAP_MAX_SEGMENTS 8 +#define HEAP_SEG_INDEX 0 #define MEMHEAP_SEG_INVALID 0xFFFF +typedef struct mca_memheap_base_config { + long device_nic_mem_seg_size; /* Used for SHMEM_HINT_DEVICE_NIC_MEM */ +} mca_memheap_base_config_t; + + typedef struct mca_memheap_map { map_segment_t mem_segs[MCA_MEMHEAP_MAX_SEGMENTS]; /* TODO: change into pointer array */ int n_segments; @@ -56,8 +59,9 @@ typedef struct mca_memheap_map { } mca_memheap_map_t; extern mca_memheap_map_t mca_memheap_base_map; +extern mca_memheap_base_config_t mca_memheap_base_config; -int mca_memheap_base_alloc_init(mca_memheap_map_t *, size_t); +int mca_memheap_base_alloc_init(mca_memheap_map_t *, size_t, long); void mca_memheap_base_alloc_exit(mca_memheap_map_t *); int mca_memheap_base_static_init(mca_memheap_map_t *); void mca_memheap_base_static_exit(mca_memheap_map_t *); @@ -173,10 +177,12 @@ static inline int memheap_is_va_in_segment(void *va, int segno) static inline int memheap_find_segnum(void *va) { - if (OPAL_LIKELY(memheap_is_va_in_segment(va, SYMB_SEG_INDEX))) { - return SYMB_SEG_INDEX; - } else if (memheap_is_va_in_segment(va, HEAP_SEG_INDEX)) { - return HEAP_SEG_INDEX; + int i; + + for (i = 0; i < mca_memheap_base_map.n_segments; i++) { + if (memheap_is_va_in_segment(va, i)) { + return i; + } } return MEMHEAP_SEG_INVALID; } @@ -193,18 +199,17 @@ static inline void *map_segment_va2rva(mkey_segment_t *seg, void *va) return memheap_va2rva(va, seg->super.va_base, seg->rva_base); } -static inline map_base_segment_t *map_segment_find_va(map_base_segment_t *segs, size_t elem_size, void *va) +static inline map_base_segment_t *map_segment_find_va(map_base_segment_t *segs, + size_t elem_size, void *va) { map_base_segment_t *rseg; + int i; - rseg = (map_base_segment_t *)((char *)segs + elem_size * HEAP_SEG_INDEX); - if (OPAL_LIKELY(map_segment_is_va_in(rseg, va))) { - return rseg; - } - - rseg = (map_base_segment_t *)((char *)segs + elem_size * SYMB_SEG_INDEX); - if (OPAL_LIKELY(map_segment_is_va_in(rseg, va))) { - return rseg; + for (i = 0; i < MCA_MEMHEAP_MAX_SEGMENTS; i++) { + rseg = (map_base_segment_t *)((char *)segs + elem_size * i); + if (OPAL_LIKELY(map_segment_is_va_in(rseg, va))) { + return rseg; + } } return NULL; @@ -214,21 +219,14 @@ void mkey_segment_init(mkey_segment_t *seg, sshmem_mkey_t *mkey, uint32_t segno) static inline map_segment_t *memheap_find_va(void* va) { - map_segment_t *s; - - /* most probably there will be only two segments: heap and global data */ - if (OPAL_LIKELY(memheap_is_va_in_segment(va, SYMB_SEG_INDEX))) { - s = &memheap_map->mem_segs[SYMB_SEG_INDEX]; - } else if (memheap_is_va_in_segment(va, HEAP_SEG_INDEX)) { - s = &memheap_map->mem_segs[HEAP_SEG_INDEX]; - } else if (memheap_map->n_segments - 2 > 0) { - s = bsearch(va, - &memheap_map->mem_segs[SYMB_SEG_INDEX+1], - memheap_map->n_segments - 2, - sizeof(*s), - mca_memheap_seg_cmp); - } else { - s = NULL; + map_segment_t *s = NULL; + int i; + + for (i = 0; i < memheap_map->n_segments; i++) { + if (memheap_is_va_in_segment(va, i)) { + s = &memheap_map->mem_segs[i]; + break; + } } #if MEMHEAP_BASE_DEBUG == 1 diff --git a/oshmem/mca/memheap/base/memheap_base_alloc.c b/oshmem/mca/memheap/base/memheap_base_alloc.c index 341eec97a96..b83499f250c 100644 --- a/oshmem/mca/memheap/base/memheap_base_alloc.c +++ b/oshmem/mca/memheap/base/memheap_base_alloc.c @@ -19,17 +19,21 @@ #include "oshmem/mca/memheap/base/base.h" -int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size) +int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size, long hint) { int ret = OSHMEM_SUCCESS; char * seg_filename = NULL; assert(map); - assert(HEAP_SEG_INDEX == map->n_segments); + if (hint == 0) { + assert(HEAP_SEG_INDEX == map->n_segments); + } else { + assert(HEAP_SEG_INDEX < map->n_segments); + } map_segment_t *s = &map->mem_segs[map->n_segments]; seg_filename = oshmem_get_unique_file_name(oshmem_my_proc_id()); - ret = mca_sshmem_segment_create(s, seg_filename, size); + ret = mca_sshmem_segment_create(s, seg_filename, size, hint); if (OSHMEM_SUCCESS == ret) { map->n_segments++; @@ -45,12 +49,34 @@ int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size) void mca_memheap_base_alloc_exit(mca_memheap_map_t *map) { - if (map) { - map_segment_t *s = &map->mem_segs[HEAP_SEG_INDEX]; + int i; + + if (!map) { + return; + } + + for (i = 0; i < map->n_segments; ++i) { + map_segment_t *s = &map->mem_segs[i]; + if (s->type != MAP_SEGMENT_STATIC) { + mca_sshmem_segment_detach(s, NULL); + mca_sshmem_unlink(s); + } + } +} - assert(s); +int mca_memheap_alloc_with_hint(size_t size, long hint, void** ptr) +{ + int i; - mca_sshmem_segment_detach(s, NULL); - mca_sshmem_unlink(s); + for (i = 0; i < mca_memheap_base_map.n_segments; i++) { + map_segment_t *s = &mca_memheap_base_map.mem_segs[i]; + if (s->allocator && (hint && s->alloc_hints)) { + /* Do not fall back to default allocator since it will break the + * symmetry between PEs + */ + return s->allocator->realloc(s, size, NULL, ptr); + } } + + return MCA_MEMHEAP_CALL(alloc(size, ptr)); } diff --git a/oshmem/mca/memheap/base/memheap_base_frame.c b/oshmem/mca/memheap/base/memheap_base_frame.c index 6f4d3c75b28..23ebf0860db 100644 --- a/oshmem/mca/memheap/base/memheap_base_frame.c +++ b/oshmem/mca/memheap/base/memheap_base_frame.c @@ -52,6 +52,12 @@ static int mca_memheap_base_register(mca_base_register_flag_t flags) MCA_BASE_VAR_SCOPE_READONLY, &mca_memheap_base_key_exchange); + mca_base_var_register("oshmem", "memheap", "base", "device_nic_mem_seg_size", + "Size of memory block used for allocations with hint SHMEM_HINT_DEVICE_NIC_MEM", + MCA_BASE_VAR_TYPE_LONG, NULL, 0, + MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, + &mca_memheap_base_config.device_nic_mem_seg_size); return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/memheap/base/memheap_base_mkey.c b/oshmem/mca/memheap/base/memheap_base_mkey.c index 2d8b79d5f62..a4c24744aab 100644 --- a/oshmem/mca/memheap/base/memheap_base_mkey.c +++ b/oshmem/mca/memheap/base/memheap_base_mkey.c @@ -749,7 +749,7 @@ void mkey_segment_init(mkey_segment_t *seg, sshmem_mkey_t *mkey, uint32_t segno) { map_segment_t *s; - if (segno >= MCA_MEMHEAP_SEG_COUNT) { + if (segno >= MCA_MEMHEAP_MAX_SEGMENTS) { return; } diff --git a/oshmem/mca/memheap/base/memheap_base_select.c b/oshmem/mca/memheap/base/memheap_base_select.c index 54676a7e326..9b856c76972 100644 --- a/oshmem/mca/memheap/base/memheap_base_select.c +++ b/oshmem/mca/memheap/base/memheap_base_select.c @@ -22,6 +22,13 @@ #include "oshmem/mca/memheap/memheap.h" #include "oshmem/mca/memheap/base/base.h" #include "orte/mca/errmgr/errmgr.h" +#include "oshmem/include/shmemx.h" +#include "oshmem/mca/sshmem/base/base.h" + + +mca_memheap_base_config_t mca_memheap_base_config = { + .device_nic_mem_seg_size = 0 +}; mca_memheap_base_module_t mca_memheap = {0}; @@ -95,7 +102,7 @@ static memheap_context_t* _memheap_create(void) { int rc = OSHMEM_SUCCESS; static memheap_context_t context; - size_t user_size; + size_t user_size, size; user_size = _memheap_size(); if (user_size < MEMHEAP_BASE_MIN_SIZE) { @@ -106,7 +113,18 @@ static memheap_context_t* _memheap_create(void) /* Inititialize symmetric area */ if (OSHMEM_SUCCESS == rc) { rc = mca_memheap_base_alloc_init(&mca_memheap_base_map, - user_size + MEMHEAP_BASE_PRIVATE_SIZE); + user_size + MEMHEAP_BASE_PRIVATE_SIZE, 0); + } + + /* Initialize atomic symmetric area */ + size = mca_memheap_base_config.device_nic_mem_seg_size; + if ((OSHMEM_SUCCESS == rc) && (size > 0)) { + rc = mca_memheap_base_alloc_init(&mca_memheap_base_map, size, + SHMEM_HINT_DEVICE_NIC_MEM); + if (rc == OSHMEM_ERR_NOT_IMPLEMENTED) { + /* do not treat NOT_IMPLEMENTED as error */ + rc = OSHMEM_SUCCESS; + } } /* Inititialize static/global variables area */ diff --git a/oshmem/mca/memheap/base/memheap_base_static.c b/oshmem/mca/memheap/base/memheap_base_static.c index edbb11aa310..4e97253a9ee 100644 --- a/oshmem/mca/memheap/base/memheap_base_static.c +++ b/oshmem/mca/memheap/base/memheap_base_static.c @@ -49,7 +49,7 @@ int mca_memheap_base_static_init(mca_memheap_map_t *map) int ret = OSHMEM_SUCCESS; assert(map); - assert(SYMB_SEG_INDEX <= map->n_segments); + assert(HEAP_SEG_INDEX < map->n_segments); ret = _load_segments(); diff --git a/oshmem/mca/memheap/memheap.h b/oshmem/mca/memheap/memheap.h index 7cad1e9e3f3..07c4e2f2f05 100644 --- a/oshmem/mca/memheap/memheap.h +++ b/oshmem/mca/memheap/memheap.h @@ -138,6 +138,8 @@ typedef struct mca_memheap_base_module_t mca_memheap_base_module_t; OSHMEM_DECLSPEC extern mca_memheap_base_module_t mca_memheap; +int mca_memheap_alloc_with_hint(size_t size, long hint, void**); + static inline int mca_memheap_base_mkey_is_shm(sshmem_mkey_t *mkey) { return (0 == mkey->len) && (MAP_SEGMENT_SHM_INVALID != (int)mkey->u.key); diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index bd43baf3810..7066129a4d5 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -39,6 +39,7 @@ #include "orte/util/show_help.h" #include "oshmem/mca/spml/ucx/spml_ucx_component.h" +#include "oshmem/mca/sshmem/ucx/sshmem_ucx.h" /* Turn ON/OFF debug output from build (default 0) */ #ifndef SPML_UCX_PUT_DEBUG @@ -270,7 +271,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) OSHMEM_PROC_DATA(procs[i])->num_transports = 1; OSHMEM_PROC_DATA(procs[i])->transport_ids = spml_ucx_transport_ids; - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + for (j = 0; j < MCA_MEMHEAP_MAX_SEGMENTS; j++) { mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey = NULL; } @@ -441,7 +442,8 @@ sshmem_mkey_t *mca_spml_ucx_register(void* addr, } } else { - ucx_mkey->mem_h = (ucp_mem_h)mem_seg->context; + mca_sshmem_ucx_segment_context_t *ctx = mem_seg->context; + ucx_mkey->mem_h = ctx->ucp_memh; } status = ucp_rkey_pack(mca_spml_ucx.ucp_context, ucx_mkey->mem_h, @@ -592,17 +594,19 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx goto error2; } - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + for (j = 0; j < memheap_map->n_segments; j++) { mkey = &memheap_map->mem_segs[j].mkeys_cache[i][0]; ucx_mkey = &ucx_ctx->ucp_peers[i].mkeys[j].key; - err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[i].ucp_conn, - mkey->u.data, - &ucx_mkey->rkey); - if (UCS_OK != err) { - SPML_UCX_ERROR("failed to unpack rkey"); - goto error2; + if (mkey->u.data) { + err = ucp_ep_rkey_unpack(ucx_ctx->ucp_peers[i].ucp_conn, + mkey->u.data, + &ucx_mkey->rkey); + if (UCS_OK != err) { + SPML_UCX_ERROR("failed to unpack rkey"); + goto error2; + } + mca_spml_ucx_cache_mkey(ucx_ctx, mkey, j, i); } - mca_spml_ucx_cache_mkey(ucx_ctx, mkey, j, i); } } @@ -750,6 +754,8 @@ int mca_spml_ucx_fence(shmem_ctx_t ctx) ucs_status_t err; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + opal_atomic_wmb(); + err = ucp_worker_fence(ucx_ctx->ucp_worker); if (UCS_OK != err) { SPML_UCX_ERROR("fence failed: %s", ucs_status_string(err)); @@ -764,6 +770,8 @@ int mca_spml_ucx_quiet(shmem_ctx_t ctx) int ret; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + opal_atomic_wmb(); + ret = opal_common_ucx_worker_flush(ucx_ctx->ucp_worker); if (OMPI_SUCCESS != ret) { oshmem_shmem_abort(-1); diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 7c9c7689bde..f697f3564b6 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -62,7 +62,7 @@ typedef struct spml_ucx_cached_mkey spml_ucx_cached_mkey_t; struct ucp_peer { ucp_ep_h ucp_conn; - spml_ucx_cached_mkey_t mkeys[MCA_MEMHEAP_SEG_COUNT]; + spml_ucx_cached_mkey_t mkeys[MCA_MEMHEAP_MAX_SEGMENTS]; }; typedef struct ucp_peer ucp_peer_t; diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 9a4a73ef121..900349f9e6f 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -314,7 +314,7 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx) del_procs = malloc(sizeof(*del_procs) * nprocs); for (i = 0; i < nprocs; ++i) { - for (j = 0; j < MCA_MEMHEAP_SEG_COUNT; j++) { + for (j = 0; j < memheap_map->n_segments; j++) { if (ctx->ucp_peers[i].mkeys[j].key.rkey != NULL) { ucp_rkey_destroy(ctx->ucp_peers[i].mkeys[j].key.rkey); } diff --git a/oshmem/mca/sshmem/base/base.h b/oshmem/mca/sshmem/base/base.h index ea44ff50964..9db5b06916a 100644 --- a/oshmem/mca/sshmem/base/base.h +++ b/oshmem/mca/sshmem/base/base.h @@ -31,7 +31,7 @@ extern char* mca_sshmem_base_backing_file_dir; OSHMEM_DECLSPEC int mca_sshmem_segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size); + size_t size, long hint); OSHMEM_DECLSPEC void * mca_sshmem_segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey); diff --git a/oshmem/mca/sshmem/base/sshmem_base_wrappers.c b/oshmem/mca/sshmem/base/sshmem_base_wrappers.c index d70490cb4e1..23802cad457 100644 --- a/oshmem/mca/sshmem/base/sshmem_base_wrappers.c +++ b/oshmem/mca/sshmem/base/sshmem_base_wrappers.c @@ -18,13 +18,13 @@ int mca_sshmem_segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size) + size_t size, long hint) { if (!mca_sshmem_base_selected) { return OSHMEM_ERROR; } - return mca_sshmem_base_module->segment_create(ds_buf, file_name, size); + return mca_sshmem_base_module->segment_create(ds_buf, file_name, size, hint); } void * diff --git a/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c b/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c index 9a303221075..5df7a269f1e 100644 --- a/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c +++ b/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c @@ -62,7 +62,7 @@ module_init(void); static int segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size); + size_t size, long hint); static void * segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey); @@ -111,7 +111,7 @@ module_finalize(void) static int segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size) + size_t size, long hint) { int rc = OSHMEM_SUCCESS; void *addr = NULL; diff --git a/oshmem/mca/sshmem/sshmem.h b/oshmem/mca/sshmem/sshmem.h index a2b570aab8f..8ba10574928 100644 --- a/oshmem/mca/sshmem/sshmem.h +++ b/oshmem/mca/sshmem/sshmem.h @@ -83,14 +83,19 @@ typedef int * @param file_name file_name unique string identifier that must be a valid, * writable path (IN). * + * @param address address to attach the segment at, or 0 allocate + * any available address in the process. + * * @param size size of the shared memory segment. * + * @param hint hint of the shared memory segment. + * * @return OSHMEM_SUCCESS on success. */ typedef int (*mca_sshmem_base_module_segment_create_fn_t)(map_segment_t *ds_buf, const char *file_name, - size_t size); + size_t size, long hint); /** * attach to an existing shared memory segment initialized by segment_create. diff --git a/oshmem/mca/sshmem/sshmem_types.h b/oshmem/mca/sshmem/sshmem_types.h index ccdf8995b5f..4e1d937901a 100644 --- a/oshmem/mca/sshmem/sshmem_types.h +++ b/oshmem/mca/sshmem/sshmem_types.h @@ -107,6 +107,8 @@ typedef struct mkey_segment { void *rva_base; /* base va on remote pe */ } mkey_segment_t; +typedef struct segment_allocator segment_allocator_t; + typedef struct map_segment { map_base_segment_t super; sshmem_mkey_t **mkeys_cache; /* includes remote segment bases in va_base */ @@ -115,10 +117,17 @@ typedef struct map_segment { int seg_id; size_t seg_size; /* length of the segment */ segment_type_t type; /* type of the segment */ + long alloc_hints; /* allocation hints this segment supports */ void *context; /* allocator can use this field to store its own private data */ + segment_allocator_t *allocator; /* segment-specific allocator */ } map_segment_t; +struct segment_allocator { + int (*realloc)(map_segment_t*, size_t newsize, void *, void **); + int (*free)(map_segment_t*, void*); +}; + END_C_DECLS #endif /* MCA_SSHMEM_TYPES_H */ diff --git a/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c b/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c index a1d112da7d9..b1d4d3c61ca 100644 --- a/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c +++ b/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c @@ -60,7 +60,7 @@ module_init(void); static int segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size); + size_t size, long hint); static void * segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey); @@ -109,7 +109,7 @@ module_finalize(void) static int segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size) + size_t size, long hint) { int rc = OSHMEM_SUCCESS; void *addr = NULL; diff --git a/oshmem/mca/sshmem/ucx/Makefile.am b/oshmem/mca/sshmem/ucx/Makefile.am index bf3a08b547a..ce37cd0e906 100644 --- a/oshmem/mca/sshmem/ucx/Makefile.am +++ b/oshmem/mca/sshmem/ucx/Makefile.am @@ -15,7 +15,8 @@ AM_CPPFLAGS = $(sshmem_ucx_CPPFLAGS) sources = \ sshmem_ucx.h \ sshmem_ucx_component.c \ - sshmem_ucx_module.c + sshmem_ucx_module.c \ + sshmem_ucx_shadow.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la diff --git a/oshmem/mca/sshmem/ucx/configure.m4 b/oshmem/mca/sshmem/ucx/configure.m4 index aafa4f4e029..7448b2dadf4 100644 --- a/oshmem/mca/sshmem/ucx/configure.m4 +++ b/oshmem/mca/sshmem/ucx/configure.m4 @@ -22,6 +22,40 @@ AC_DEFUN([MCA_oshmem_sshmem_ucx_CONFIG],[ [$1], [$2]) + # Check for UCX device memory allocation support + save_LDFLAGS="$LDFLAGS" + save_LIBS="$LIBS" + save_CPPFLAGS="$CPPFLAGS" + + alloc_dm_LDFLAGS=" -L$ompi_check_ucx_libdir/ucx" + alloc_dm_LIBS=" -luct_ib" + CPPFLAGS+=" $sshmem_ucx_CPPFLAGS" + LDFLAGS+=" $sshmem_ucx_LDFLAGS $alloc_dm_LDFLAGS" + LIBS+=" $sshmem_ucx_LIBS $alloc_dm_LIBS" + + AC_LANG_PUSH([C]) + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[ + #include + #include + ]], + [[ + uct_md_h md = ucp_context_find_tl_md((ucp_context_h)NULL, ""); + (void)uct_ib_md_alloc_device_mem(md, NULL, NULL, 0, "", NULL); + uct_ib_md_release_device_mem(NULL); + ]])], + [ + AC_MSG_NOTICE([UCX device memory allocation is supported]) + AC_DEFINE([HAVE_UCX_DEVICE_MEM], [1], [Support for device memory allocation]) + sshmem_ucx_LIBS+=" $alloc_dm_LIBS" + sshmem_ucx_LDFLAGS+=" $alloc_dm_LDFLAGS" + ], + [AC_MSG_NOTICE([UCX device memory allocation is not supported])]) + AC_LANG_POP([C]) + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" # substitute in the things needed to build ucx AC_SUBST([sshmem_ucx_CFLAGS]) diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx.h b/oshmem/mca/sshmem/ucx/sshmem_ucx.h index 0b625fcc469..f171fe641b8 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx.h +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx.h @@ -15,8 +15,12 @@ #include "oshmem/mca/sshmem/sshmem.h" +#include + BEGIN_C_DECLS +typedef struct sshmem_ucx_shadow_allocator sshmem_ucx_shadow_allocator_t; + /** * globally exported variable to hold the ucx component. */ @@ -30,11 +34,26 @@ typedef struct mca_sshmem_ucx_component_t { OSHMEM_MODULE_DECLSPEC extern mca_sshmem_ucx_component_t mca_sshmem_ucx_component; +typedef struct mca_sshmem_ucx_segment_context { + void *dev_mem; + sshmem_ucx_shadow_allocator_t *shadow_allocator; + ucp_mem_h ucp_memh; +} mca_sshmem_ucx_segment_context_t; + typedef struct mca_sshmem_ucx_module_t { mca_sshmem_base_module_t super; } mca_sshmem_ucx_module_t; extern mca_sshmem_ucx_module_t mca_sshmem_ucx_module; +sshmem_ucx_shadow_allocator_t *sshmem_ucx_shadow_create(unsigned count); +void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator); +int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator, + unsigned count, unsigned *index); +int sshmem_ucx_shadow_free(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index); +size_t sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index); + END_C_DECLS #endif /* MCA_SHMEM_UCX_EXPORT_H */ diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c index 44f73743316..047343e9c10 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c @@ -18,12 +18,24 @@ #include "oshmem/proc/proc.h" #include "oshmem/mca/sshmem/sshmem.h" +#include "oshmem/include/shmemx.h" #include "oshmem/mca/sshmem/base/base.h" #include "oshmem/util/oshmem_util.h" #include "oshmem/mca/spml/ucx/spml_ucx.h" #include "sshmem_ucx.h" +//#include + +#if HAVE_UCX_DEVICE_MEM +#include +#include +#endif + +#define ALLOC_ELEM_SIZE sizeof(uint64_t) +#define min(a,b) ((a) < (b) ? (a) : (b)) +#define max(a,b) ((a) > (b) ? (a) : (b)) + /* ////////////////////////////////////////////////////////////////////////// */ /*local functions */ /* local functions */ @@ -33,7 +45,7 @@ module_init(void); static int segment_create(map_segment_t *ds_buf, const char *file_name, - size_t size); + size_t size, long hint); static void * segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey); @@ -47,6 +59,11 @@ segment_unlink(map_segment_t *ds_buf); static int module_finalize(void); +static int sshmem_ucx_memheap_realloc(map_segment_t *s, size_t size, + void* old_ptr, void** new_ptr); + +static int sshmem_ucx_memheap_free(map_segment_t *s, void* ptr); + /* * ucx shmem module */ @@ -79,13 +96,18 @@ module_finalize(void) /* ////////////////////////////////////////////////////////////////////////// */ +static segment_allocator_t sshmem_ucx_allocator = { + .realloc = sshmem_ucx_memheap_realloc, + .free = sshmem_ucx_memheap_free +}; + static int -segment_create(map_segment_t *ds_buf, - const char *file_name, - size_t size) +segment_create_internal(map_segment_t *ds_buf, void *address, size_t size, + unsigned flags, long hint, void *dev_mem) { + mca_sshmem_ucx_segment_context_t *ctx; int rc = OSHMEM_SUCCESS; - mca_spml_ucx_t *spml = (mca_spml_ucx_t *)mca_spml.self; + mca_spml_ucx_t *spml = (mca_spml_ucx_t*)mca_spml.self; ucp_mem_map_params_t mem_map_params; ucp_mem_h mem_h; ucs_status_t status; @@ -99,25 +121,51 @@ segment_create(map_segment_t *ds_buf, UCP_MEM_MAP_PARAM_FIELD_LENGTH | UCP_MEM_MAP_PARAM_FIELD_FLAGS; - mem_map_params.address = (void *)mca_sshmem_base_start_address; + mem_map_params.address = address; mem_map_params.length = size; - mem_map_params.flags = UCP_MEM_MAP_ALLOCATE|UCP_MEM_MAP_FIXED; - - if (spml->heap_reg_nb) { - mem_map_params.flags |= UCP_MEM_MAP_NONBLOCK; - } + mem_map_params.flags = flags; status = ucp_mem_map(spml->ucp_context, &mem_map_params, &mem_h); if (UCS_OK != status) { + SSHMEM_ERROR("ucp_mem_map() failed: %s\n", ucs_status_string(status)); rc = OSHMEM_ERROR; goto out; } - ds_buf->super.va_base = mem_map_params.address; + if (!(flags & UCP_MEM_MAP_FIXED)) { + /* Memory was allocated at an arbitrary address; obtain it */ + ucp_mem_attr_t mem_attr; + mem_attr.field_mask = UCP_MEM_ATTR_FIELD_ADDRESS; + status = ucp_mem_query(mem_h, &mem_attr); + if (status != UCS_OK) { + SSHMEM_ERROR("ucp_mem_query() failed: %s\n", ucs_status_string(status)); + ucp_mem_unmap(spml->ucp_context, mem_h); + rc = OSHMEM_ERROR; + goto out; + } + + ds_buf->super.va_base = mem_attr.address; + } else { + ds_buf->super.va_base = mem_map_params.address; + } + + ctx = calloc(1, sizeof(*ctx)); + if (!ctx) { + ucp_mem_unmap(spml->ucp_context, mem_h); + rc = OSHMEM_ERR_OUT_OF_RESOURCE; + goto out; + } + ds_buf->seg_size = size; ds_buf->super.va_end = (void*)((uintptr_t)ds_buf->super.va_base + ds_buf->seg_size); - ds_buf->context = mem_h; + ds_buf->context = ctx; ds_buf->type = MAP_SEGMENT_ALLOC_UCX; + ds_buf->alloc_hints = hint; + ctx->ucp_memh = mem_h; + ctx->dev_mem = dev_mem; + if (hint) { + ds_buf->allocator = &sshmem_ucx_allocator; + } out: OPAL_OUTPUT_VERBOSE( @@ -132,6 +180,84 @@ segment_create(map_segment_t *ds_buf, return rc; } +#if HAVE_UCX_DEVICE_MEM +static uct_ib_device_mem_h alloc_device_mem(mca_spml_ucx_t *spml, size_t size, + void **address_p) +{ + uct_ib_device_mem_h dev_mem = NULL; + ucs_status_t status; + uct_md_h uct_md; + void *address; + size_t length; + int ret; + + uct_md = ucp_context_find_tl_md(spml->ucp_context, "mlx5"); + if (uct_md == NULL) { + SSHMEM_VERBOSE(1, "ucp_context_find_tl_md() returned NULL\n"); + return NULL; + } + + /* If found a matching memory domain, allocate device memory on it */ + length = size; + address = NULL; + status = uct_ib_md_alloc_device_mem(uct_md, &length, &address, + UCT_MD_MEM_ACCESS_ALL, "sshmem_seg", + &dev_mem); + if (status != UCS_OK) { + /* If could not allocate device memory - fallback to mmap (since some + * PEs in the job may succeed and while others failed */ + SSHMEM_VERBOSE(1, "uct_ib_md_alloc_dm() failed: %s\n", + ucs_status_string(status)); + return NULL; + } + + SSHMEM_VERBOSE(3, "uct_ib_md_alloc_dm() returned address %p\n", address); + *address_p = address; + return dev_mem; +} +#endif + +static int +segment_create(map_segment_t *ds_buf, + const char *file_name, + size_t size, long hint) +{ + mca_spml_ucx_t *spml = (mca_spml_ucx_t*)mca_spml.self; + unsigned flags; + int ret; + +#if HAVE_UCX_DEVICE_MEM + if (hint & SHMEM_HINT_DEVICE_NIC_MEM) { + if (size > UINT_MAX) { + return OSHMEM_ERR_BAD_PARAM; + } + + void *dev_mem_address; + uct_ib_device_mem_h dev_mem = alloc_device_mem(spml, size, + &dev_mem_address); + if (dev_mem != NULL) { + ret = segment_create_internal(ds_buf, dev_mem_address, size, 0, + hint, dev_mem); + if (ret == OSHMEM_SUCCESS) { + return OSHMEM_SUCCESS; + } else if (dev_mem != NULL) { + uct_ib_md_release_device_mem(dev_mem); + /* fallback to regular allocation */ + } + } + } +#endif + + flags = UCP_MEM_MAP_ALLOCATE | (spml->heap_reg_nb ? UCP_MEM_MAP_NONBLOCK : 0); + if (hint) { + return segment_create_internal(ds_buf, NULL, size, flags, hint, NULL); + } else { + return segment_create_internal(ds_buf, mca_sshmem_base_start_address, + size, flags | UCP_MEM_MAP_FIXED, hint, + NULL); + } +} + static void * segment_attach(map_segment_t *ds_buf, sshmem_mkey_t *mkey) { @@ -168,10 +294,22 @@ static int segment_unlink(map_segment_t *ds_buf) { mca_spml_ucx_t *spml = (mca_spml_ucx_t *)mca_spml.self; + mca_sshmem_ucx_segment_context_t *ctx = ds_buf->context; - assert(ds_buf); + if (ctx->shadow_allocator) { + sshmem_ucx_shadow_destroy(ctx->shadow_allocator); + } + + ucp_mem_unmap(spml->ucp_context, ctx->ucp_memh); - ucp_mem_unmap(spml->ucp_context, (ucp_mem_h)ds_buf->context); +#if HAVE_UCX_DEVICE_MEM + if (ctx->dev_mem) { + uct_ib_md_release_device_mem(ctx->dev_mem); + } +#endif + + ds_buf->context = NULL; + free(ctx); OPAL_OUTPUT_VERBOSE( (70, oshmem_sshmem_base_framework.framework_output, @@ -188,3 +326,79 @@ segment_unlink(map_segment_t *ds_buf) return OSHMEM_SUCCESS; } +static void *sshmem_ucx_memheap_index2ptr(map_segment_t *s, unsigned index) +{ + return (char*)s->super.va_base + (index * ALLOC_ELEM_SIZE); +} + +static unsigned sshmem_ucx_memheap_ptr2index(map_segment_t *s, void *ptr) +{ + return ((char*)ptr - (char*)s->super.va_base) / ALLOC_ELEM_SIZE; +} + +void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size) +{ + const size_t count = (size + sizeof(uint64_t) - 1) / sizeof(uint64_t); + uint64_t *dst64 = (uint64_t*)dst; + uint64_t *src64 = (uint64_t*)src; + size_t i; + + for (i = 0; i < count; ++i) { + *(dst64++) = *(src64++); + } + opal_atomic_wmb(); +} + +static int sshmem_ucx_memheap_realloc(map_segment_t *s, size_t size, + void* old_ptr, void** new_ptr) +{ + mca_sshmem_ucx_segment_context_t *ctx = s->context; + unsigned alloc_count, index; + int res; + + if (size > s->seg_size) { + return OSHMEM_ERR_OUT_OF_RESOURCE; + } + + /* create allocator on demand */ + if (!ctx->shadow_allocator) { + ctx->shadow_allocator = sshmem_ucx_shadow_create(s->seg_size); + if (!ctx->shadow_allocator) { + return OSHMEM_ERR_OUT_OF_RESOURCE; + } + } + + /* Allocate new element. Zero-size allocation should still return a unique + * pointer, so allocate 1 byte */ + alloc_count = max((size + ALLOC_ELEM_SIZE - 1) / ALLOC_ELEM_SIZE, 1); + res = sshmem_ucx_shadow_alloc(ctx->shadow_allocator, alloc_count, &index); + if (res != OSHMEM_SUCCESS) { + return res; + } + + *new_ptr = sshmem_ucx_memheap_index2ptr(s, index); + + /* Copy to new segment and release old*/ + if (old_ptr) { + unsigned old_index = sshmem_ucx_memheap_ptr2index(s, old_ptr); + unsigned old_alloc_count = sshmem_ucx_shadow_size(ctx->shadow_allocator, + old_index); + sshmem_ucx_memheap_wordcopy(*new_ptr, old_ptr, + min(size, old_alloc_count * ALLOC_ELEM_SIZE)); + sshmem_ucx_shadow_free(ctx->shadow_allocator, old_index); + } + + return OSHMEM_SUCCESS; +} + +static int sshmem_ucx_memheap_free(map_segment_t *s, void* ptr) +{ + mca_sshmem_ucx_segment_context_t *ctx = s->context; + + if (!ptr) { + return OSHMEM_SUCCESS; + } + + return sshmem_ucx_shadow_free(ctx->shadow_allocator, + sshmem_ucx_memheap_ptr2index(s, ptr)); +} diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c new file mode 100644 index 00000000000..92fa2bb0cfc --- /dev/null +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "oshmem_config.h" + +#include "oshmem/mca/sshmem/sshmem.h" +#include "oshmem/include/shmemx.h" +#include "oshmem/mca/sshmem/base/base.h" + +#include "sshmem_ucx.h" + +#define SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE 0x1 + +typedef struct sshmem_ucx_shadow_alloc_elem { + unsigned flags; + unsigned block_size; +} sshmem_ucx_shadow_alloc_elem_t; + +struct sshmem_ucx_shadow_allocator { + size_t num_elems; + sshmem_ucx_shadow_alloc_elem_t elems[]; +}; + +static int sshmem_ucx_shadow_is_free(sshmem_ucx_shadow_alloc_elem_t *elem) +{ + return elem->flags & SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE; +} + +static void sshmem_ucx_shadow_set_elem(sshmem_ucx_shadow_alloc_elem_t *elem, + unsigned flags, unsigned block_size) +{ + elem->flags = flags; + elem->block_size = block_size; +} + +sshmem_ucx_shadow_allocator_t *sshmem_ucx_shadow_create(unsigned count) +{ + sshmem_ucx_shadow_allocator_t *allocator; + + allocator = calloc(1, sizeof(*allocator) + + count * sizeof(*allocator->elems)); + if (allocator) { + /* initialization: set initial element to the whole buffer */ + sshmem_ucx_shadow_set_elem(&allocator->elems[0], + SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE, count); + allocator->num_elems = count; + } + + return allocator; +} + +void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator) +{ + free(allocator); /* no leak check. TODO add leak warnings/debug */ +} + +int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator, + unsigned count, unsigned *index) +{ + sshmem_ucx_shadow_alloc_elem_t *end = &allocator->elems[allocator->num_elems]; + sshmem_ucx_shadow_alloc_elem_t *elem; + + assert(count > 0); + + for (elem = &allocator->elems[0]; elem < end; elem += elem->block_size) { + if (sshmem_ucx_shadow_is_free(elem) && (elem->block_size >= count)) { + /* found suitable free element */ + if (elem->block_size > count) { + /* create new 'free' element for tail of current buffer */ + sshmem_ucx_shadow_set_elem(elem + count, + SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE, + elem->block_size - count); + } + + /* set the size and flags of the allocated element */ + sshmem_ucx_shadow_set_elem(elem, 0, count); + *index = elem - &allocator->elems[0]; + return OSHMEM_SUCCESS; + } + } + + return OSHMEM_ERR_OUT_OF_RESOURCE; +} + +static void sshmem_ucx_shadow_merge_blocks(sshmem_ucx_shadow_allocator_t *allocator) +{ + sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[0]; + sshmem_ucx_shadow_alloc_elem_t *end = &allocator->elems[allocator->num_elems]; + sshmem_ucx_shadow_alloc_elem_t *next_elem; + + while ( (next_elem = (elem + elem->block_size)) < end) { + if (sshmem_ucx_shadow_is_free(elem) && sshmem_ucx_shadow_is_free(next_elem)) { + /* current & next elements are free, should be merged */ + elem->block_size += next_elem->block_size; + /* clean element which is merged */ + sshmem_ucx_shadow_set_elem(next_elem, 0, 0); + } else { + elem = next_elem; + } + } +} + +int sshmem_ucx_shadow_free(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index) +{ + sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[index]; + + elem->flags |= SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE; + sshmem_ucx_shadow_merge_blocks(allocator); + return OSHMEM_SUCCESS; +} + +size_t sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index) +{ + sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[index]; + + assert(!sshmem_ucx_shadow_is_free(elem)); + return elem->block_size; +} diff --git a/oshmem/shmem/c/profile/defines.h b/oshmem/shmem/c/profile/defines.h index 22936efcfa5..fa30d783778 100644 --- a/oshmem/shmem/c/profile/defines.h +++ b/oshmem/shmem/c/profile/defines.h @@ -58,6 +58,8 @@ #define shrealloc pshrealloc /* shmem-compat.h */ #define shfree pshfree /* shmem-compat.h */ +#define shmemx_malloc_with_hint pshmemx_malloc_with_hint + /* * Remote pointer operations */ diff --git a/oshmem/shmem/c/shmem_alloc.c b/oshmem/shmem/c/shmem_alloc.c index 3f7a579a20c..92592ce8ca3 100644 --- a/oshmem/shmem/c/shmem_alloc.c +++ b/oshmem/shmem/c/shmem_alloc.c @@ -11,6 +11,7 @@ #include "oshmem/constants.h" #include "oshmem/include/shmem.h" +#include "oshmem/include/shmemx.h" #include "oshmem/shmem/shmem_api_logger.h" @@ -19,9 +20,11 @@ #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" -#pragma weak shmem_malloc = pshmem_malloc -#pragma weak shmem_calloc = pshmem_calloc -#pragma weak shmalloc = pshmalloc +#include "oshmem/include/pshmemx.h" +#pragma weak shmem_malloc = pshmem_malloc +#pragma weak shmem_calloc = pshmem_calloc +#pragma weak shmalloc = pshmalloc +#pragma weak shmemx_malloc_with_hint = pshmemx_malloc_with_hint #include "oshmem/shmem/c/profile/defines.h" #endif @@ -72,3 +75,33 @@ static inline void* _shmalloc(size_t size) #endif return pBuff; } + +void* shmemx_malloc_with_hint(size_t size, long hint) +{ + int rc; + void* pBuff = NULL; + + if (!hint) { + return _shmalloc(size); + } + + RUNTIME_CHECK_INIT(); + RUNTIME_CHECK_WITH_MEMHEAP_SIZE(size); + + SHMEM_MUTEX_LOCK(shmem_internal_mutex_alloc); + + rc = mca_memheap_alloc_with_hint(size, hint, &pBuff); + + SHMEM_MUTEX_UNLOCK(shmem_internal_mutex_alloc); + + if (OSHMEM_SUCCESS != rc) { + SHMEM_API_VERBOSE(10, + "Allocation with shmalloc(size=%lu) failed.", + (unsigned long)size); + return NULL ; + } +#if OSHMEM_SPEC_COMPAT == 1 + shmem_barrier_all(); +#endif + return pBuff; +} diff --git a/oshmem/shmem/c/shmem_free.c b/oshmem/shmem/c/shmem_free.c index f5c5ce0caec..91619a72248 100644 --- a/oshmem/shmem/c/shmem_free.c +++ b/oshmem/shmem/c/shmem_free.c @@ -18,6 +18,7 @@ #include "oshmem/runtime/runtime.h" #include "oshmem/mca/memheap/memheap.h" +#include "oshmem/mca/memheap/base/base.h" #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" @@ -41,6 +42,7 @@ void shfree(void* ptr) static inline void _shfree(void* ptr) { int rc; + map_segment_t *s; RUNTIME_CHECK_INIT(); if (NULL == ptr) { @@ -55,7 +57,17 @@ static inline void _shfree(void* ptr) SHMEM_MUTEX_LOCK(shmem_internal_mutex_alloc); - rc = MCA_MEMHEAP_CALL(free(ptr)); + if (ptr) { + s = memheap_find_va(ptr); + } else { + s = NULL; + } + + if (s && s->allocator) { + rc = s->allocator->free(s, ptr); + } else { + rc = MCA_MEMHEAP_CALL(free(ptr)); + } SHMEM_MUTEX_UNLOCK(shmem_internal_mutex_alloc); diff --git a/oshmem/shmem/c/shmem_realloc.c b/oshmem/shmem/c/shmem_realloc.c index 0a45cf9fe3f..7aab27735f5 100644 --- a/oshmem/shmem/c/shmem_realloc.c +++ b/oshmem/shmem/c/shmem_realloc.c @@ -18,6 +18,7 @@ #include "oshmem/shmem/shmem_api_logger.h" #include "oshmem/mca/memheap/memheap.h" +#include "oshmem/mca/memheap/base/base.h" #if OSHMEM_PROFILING #include "oshmem/include/pshmem.h" @@ -42,12 +43,23 @@ static inline void* _shrealloc(void *ptr, size_t size) { int rc; void* pBuff = NULL; + map_segment_t *s; RUNTIME_CHECK_INIT(); SHMEM_MUTEX_LOCK(shmem_internal_mutex_alloc); - rc = MCA_MEMHEAP_CALL(realloc(size, ptr, &pBuff)); + if (ptr) { + s = memheap_find_va(ptr); + } else { + s = NULL; + } + + if (s && s->allocator) { + rc = s->allocator->realloc(s, size, ptr, &pBuff); + } else { + rc = MCA_MEMHEAP_CALL(realloc(size, ptr, &pBuff)); + } SHMEM_MUTEX_UNLOCK(shmem_internal_mutex_alloc); From e6cb5b02e835d0af67768b6667a7105392299925 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 13 May 2019 11:59:02 +0300 Subject: [PATCH 331/674] OSHMEM/free: suppressed coverity issue - removed dead code (cherry picked from master 4df8c1b) Signed-off-by: Sergey Oblomov Signed-off-by: Yossi Itigin --- oshmem/shmem/c/shmem_free.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/oshmem/shmem/c/shmem_free.c b/oshmem/shmem/c/shmem_free.c index 91619a72248..eebdd537ab1 100644 --- a/oshmem/shmem/c/shmem_free.c +++ b/oshmem/shmem/c/shmem_free.c @@ -59,8 +59,6 @@ static inline void _shfree(void* ptr) if (ptr) { s = memheap_find_va(ptr); - } else { - s = NULL; } if (s && s->allocator) { From ff9ecc183f310eaf705b1ff6826b71d84b0e838f Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Tue, 14 May 2019 22:34:01 +0300 Subject: [PATCH 332/674] SPML/UCX: Fix coverity error Signed-off-by: Mikhail Brinskii (cherry picked from commit d81dc533f6f7ebba0b00c1652190975f0aca9e06) --- oshmem/mca/spml/ucx/spml_ucx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index bd43baf3810..b15f5d84db3 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -886,8 +886,10 @@ int mca_spml_ucx_put_all_nb(void *dest, const void *source, size_t size, long *c ctx = oshmem_ctx_default; } + assert(ctx != NULL); /* make coverity happy */ + for (peer = 0; peer < oshmem_num_procs(); peer++) { - dst_pe = (peer + my_pe) % oshmem_group_all->proc_count; + dst_pe = (peer + my_pe) % oshmem_num_procs(); rc = mca_spml_ucx_put_nb(ctx, (void*)((uintptr_t)dest + my_pe * size), size, From 84b3536f61f5046db870026678b3e89d99cb3e10 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 14 May 2019 16:28:09 -0700 Subject: [PATCH 333/674] openmpi.spec: make sure grep failure doesn't abort Thanks to Daniel Letai for bringing this to our attention. Signed-off-by: Jeff Squyres (cherry picked from commit 013f5b03f5c7a621955b3647e5031f7e904fedbd) --- contrib/dist/linux/openmpi.spec | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/dist/linux/openmpi.spec b/contrib/dist/linux/openmpi.spec index 2a80af296b8..01a7b1b4d0f 100644 --- a/contrib/dist/linux/openmpi.spec +++ b/contrib/dist/linux/openmpi.spec @@ -600,18 +600,18 @@ grep -v -f devel.files remaining.files > docs.files # runtime sub package %if !%{sysconfdir_in_prefix} -grep -v %{_sysconfdir} runtime.files > tmp.files +grep -v %{_sysconfdir} runtime.files > tmp.files | /bin/true mv tmp.files runtime.files %endif -grep -v %{_pkgdatadir} runtime.files > tmp.files +grep -v %{_pkgdatadir} runtime.files > tmp.files | /bin/true mv tmp.files runtime.files # devel sub package -grep -v %{_includedir} devel.files > tmp.files +grep -v %{_includedir} devel.files > tmp.files | /bin/true mv tmp.files devel.files # docs sub package -grep -v %{_mandir} docs.files > tmp.files +grep -v %{_mandir} docs.files > tmp.files | /bin/true mv tmp.files docs.files %endif From fbd6798bf8964e44c55ab9fc61a1cf7e5b45f079 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Wed, 15 May 2019 15:07:42 +0300 Subject: [PATCH 334/674] OSHMEM/MMAP/SYSV: Return ERR_NOT_IMPLEMENTED if segment hint != 0 (picked from master f708674) Signed-off-by: Yossi Itigin --- oshmem/mca/sshmem/mmap/sshmem_mmap_module.c | 4 ++++ oshmem/mca/sshmem/sysv/sshmem_sysv_module.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c b/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c index 5df7a269f1e..dab1e2d1bc8 100644 --- a/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c +++ b/oshmem/mca/sshmem/mmap/sshmem_mmap_module.c @@ -118,6 +118,10 @@ segment_create(map_segment_t *ds_buf, assert(ds_buf); + if (hint) { + return OSHMEM_ERR_NOT_IMPLEMENTED; + } + /* init the contents of map_segment_t */ shmem_ds_reset(ds_buf); diff --git a/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c b/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c index b1d4d3c61ca..fe939df35d1 100644 --- a/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c +++ b/oshmem/mca/sshmem/sysv/sshmem_sysv_module.c @@ -119,6 +119,10 @@ segment_create(map_segment_t *ds_buf, assert(ds_buf); + if (hint) { + return OSHMEM_ERR_NOT_IMPLEMENTED; + } + /* init the contents of map_segment_t */ shmem_ds_reset(ds_buf); From e00d0abe56b2163c9aedbecf0e973c9609804c61 Mon Sep 17 00:00:00 2001 From: Jordan Hayes Date: Mon, 13 May 2019 13:19:29 -0700 Subject: [PATCH 335/674] plm_slurm_module: adjust for new SLURM CLI options SLURM 19 discontinued the use of --cpu_bind (and changed it to --cpu-bind). There's no easy way to test at run time which one is accepted, so set the environment variable SLURM_CPU_BIND to "none", which should do the same thing as the srun CLI parameter. Signed-off-by: Jordan Hayes Signed-off-by: Jeff Squyres (cherry picked from commit 7dad74032e30259506da7fa582dd8c4351e6e0a1) --- orte/mca/plm/slurm/plm_slurm_module.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/orte/mca/plm/slurm/plm_slurm_module.c b/orte/mca/plm/slurm/plm_slurm_module.c index 568d2c40262..f8de6509e95 100644 --- a/orte/mca/plm/slurm/plm_slurm_module.c +++ b/orte/mca/plm/slurm/plm_slurm_module.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2007-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. @@ -272,14 +272,6 @@ static void launch_daemons(int fd, short args, void *cbdata) opal_argv_append(&argc, &argv, "--kill-on-bad-exit"); } - /* ensure the orteds are not bound to a single processor, - * just in case the TaskAffinity option is set by default. - * This will *not* release the orteds from any cpu-set - * constraint, but will ensure it doesn't get - * bound to only one processor - */ - opal_argv_append(&argc, &argv, "--cpu_bind=none"); - #if SLURM_CRAY_ENV /* * If in a SLURM/Cray env. make sure that Cray PMI is not pulled in, @@ -420,6 +412,23 @@ static void launch_daemons(int fd, short args, void *cbdata) /* setup environment */ env = opal_argv_copy(orte_launch_environ); + /* ensure the orteds are not bound to a single processor, + * just in case the TaskAffinity option is set by default. + * This will *not* release the orteds from any cpu-set + * constraint, but will ensure it doesn't get + * bound to only one processor + * + * NOTE: We used to pass --cpu_bind=none on the command line. But + * SLURM 19 changed this to --cpu-bind. There is no easy way to + * test at run time which of these two parameters is used (see + * https://github.com/open-mpi/ompi/pull/6654). There was + * discussion of using --test-only to see which one works, but + * --test-only is only effective if you're not already inside a + * SLURM allocation. Instead, set the env var SLURM_CPU_BIND to + * "none", which should do the same thing as --cpu*bind=none. + */ + opal_setenv("SLURM_CPU_BIND", "none", true, &env); + if (0 < opal_output_get_verbosity(orte_plm_base_framework.framework_output)) { param = opal_argv_join(argv, ' '); opal_output(orte_plm_base_framework.framework_output, From fa0a0b1597c5b65d58e57d00a33ad87baaa1f823 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 16 May 2019 20:13:16 +0300 Subject: [PATCH 336/674] COMMON/UCX: init memhooks infra on external hooks only - initialize memory hooks infrastructure only in case if external memory hooks are requested Signed-off-by: Sergey Oblomov (cherry picked from commit a0a93060668cd11a783cc94c753efb3129df9dde) --- opal/mca/common/ucx/common_ucx.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index 7ccde24bc60..e8debc4c7f7 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -16,6 +16,7 @@ #include "opal/memoryhooks/memory.h" #include +#include /***********************************************************************/ @@ -91,23 +92,22 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void) opal_common_ucx.output = opal_output_open(NULL); opal_output_set_verbosity(opal_common_ucx.output, opal_common_ucx.verbose); - ret = mca_base_framework_open(&opal_memory_base_framework, 0); - if (OPAL_SUCCESS != ret) { - /* failed to initialize memory framework - just exit */ - MCA_COMMON_UCX_VERBOSE(1, "failed to initialize memory base framework: %d, " - "memory hooks will not be used", ret); - return; - } - /* Set memory hooks */ - if (opal_common_ucx.opal_mem_hooks && - (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == - ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & - opal_mem_hooks_support_level())) - { - MCA_COMMON_UCX_VERBOSE(1, "%s", "using OPAL memory hooks as external events"); - ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); - opal_mem_hooks_register_release(opal_common_ucx_mem_release_cb, NULL); + if (opal_common_ucx.opal_mem_hooks) { + ret = mca_base_framework_open(&opal_memory_base_framework, 0); + if (OPAL_SUCCESS != ret) { + /* failed to initialize memory framework - just exit */ + MCA_COMMON_UCX_VERBOSE(1, "failed to initialize memory base framework: %d, " + "memory hooks will not be used", ret); + return; + } + + if (ucs_test_all_flags(opal_mem_hooks_support_level(), + OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)) { + MCA_COMMON_UCX_VERBOSE(1, "%s", "using OPAL memory hooks as external events"); + ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); + opal_mem_hooks_register_release(opal_common_ucx_mem_release_cb, NULL); + } } } From 1944295da385b500dc1cbb31df76f4c0dea59381 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 16 May 2019 20:45:53 +0300 Subject: [PATCH 337/674] COMMON/UCX: removed ucs stuff Signed-off-by: Sergey Oblomov (cherry picked from commit ebc457baf5ded5dd46cd73918a2f69555f408c54) --- opal/mca/common/ucx/common_ucx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index e8debc4c7f7..a3a12a8fa88 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -16,7 +16,6 @@ #include "opal/memoryhooks/memory.h" #include -#include /***********************************************************************/ @@ -102,8 +101,9 @@ OPAL_DECLSPEC void opal_common_ucx_mca_register(void) return; } - if (ucs_test_all_flags(opal_mem_hooks_support_level(), - OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT)) { + if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == + ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & + opal_mem_hooks_support_level())) { MCA_COMMON_UCX_VERBOSE(1, "%s", "using OPAL memory hooks as external events"); ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); opal_mem_hooks_register_release(opal_common_ucx_mem_release_cb, NULL); From 4f9fb3e9ce1fc3d1bb3c980e2d82b31b96e56312 Mon Sep 17 00:00:00 2001 From: Yossi Itigin Date: Sun, 19 May 2019 19:08:11 +0300 Subject: [PATCH 338/674] OSC/UCX: Fix deadlock with atomic lock Atomic lock must progress local worker while obtaining the remote lock, otherwise an active message which actually releases the lock might not be processed while polling on local memory location. (picked from master 9d1994b) Signed-off-by: Yossi Itigin --- ompi/mca/osc/ucx/osc_ucx_active_target.c | 1 + ompi/mca/osc/ucx/osc_ucx_comm.c | 8 ++++++-- ompi/mca/osc/ucx/osc_ucx_passive_target.c | 10 +++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_active_target.c b/ompi/mca/osc/ucx/osc_ucx_active_target.c index 3c0a1488eec..3ee2ba6896d 100644 --- a/ompi/mca/osc/ucx/osc_ucx_active_target.c +++ b/ompi/mca/osc/ucx/osc_ucx_active_target.c @@ -276,6 +276,7 @@ int ompi_osc_ucx_post(struct ompi_group_t *group, int assert, struct ompi_win_t ompi_osc_ucx_handle_incoming_post(module, &(module->state.post_state[j]), NULL, 0); } + ucp_worker_progress(mca_osc_ucx_component.ucp_worker); usleep(100); } while (1); } diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index 40d68bd80bf..55af123fbb4 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -281,7 +281,7 @@ static inline int start_atomicity(ompi_osc_ucx_module_t *module, ucp_ep_h ep, in uint64_t remote_addr = (module->state_info_array)[target].addr + OSC_UCX_STATE_ACC_LOCK_OFFSET; ucs_status_t status; - while (result_value != TARGET_LOCK_UNLOCKED) { + for (;;) { status = opal_common_ucx_atomic_cswap(ep, TARGET_LOCK_UNLOCKED, TARGET_LOCK_EXCLUSIVE, &result_value, sizeof(result_value), remote_addr, rkey, @@ -290,9 +290,13 @@ static inline int start_atomicity(ompi_osc_ucx_module_t *module, ucp_ep_h ep, in OSC_UCX_VERBOSE(1, "ucp_atomic_cswap64 failed: %d", status); return OMPI_ERROR; } + if (result_value == TARGET_LOCK_UNLOCKED) { + return OMPI_SUCCESS; + } + + ucp_worker_progress(mca_osc_ucx_component.ucp_worker); } - return OMPI_SUCCESS; } static inline int end_atomicity(ompi_osc_ucx_module_t *module, ucp_ep_h ep, int target) { diff --git a/ompi/mca/osc/ucx/osc_ucx_passive_target.c b/ompi/mca/osc/ucx/osc_ucx_passive_target.c index 3a7ad3e9e24..38a7dccb273 100644 --- a/ompi/mca/osc/ucx/osc_ucx_passive_target.c +++ b/ompi/mca/osc/ucx/osc_ucx_passive_target.c @@ -44,6 +44,7 @@ static inline int start_shared(ompi_osc_ucx_module_t *module, int target) { } else { break; } + ucp_worker_progress(mca_osc_ucx_component.ucp_worker); } return OMPI_SUCCESS; @@ -72,7 +73,7 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) { uint64_t remote_addr = (module->state_info_array)[target].addr + OSC_UCX_STATE_LOCK_OFFSET; ucs_status_t status; - while (result_value != TARGET_LOCK_UNLOCKED) { + for (;;) { status = opal_common_ucx_atomic_cswap(ep, TARGET_LOCK_UNLOCKED, TARGET_LOCK_EXCLUSIVE, &result_value, sizeof(result_value), remote_addr, rkey, @@ -80,9 +81,12 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) { if (status != UCS_OK) { return OMPI_ERROR; } - } + if (result_value == TARGET_LOCK_UNLOCKED) { + return OMPI_SUCCESS; + } - return OMPI_SUCCESS; + ucp_worker_progress(mca_osc_ucx_component.ucp_worker); + } } static inline int end_exclusive(ompi_osc_ucx_module_t *module, int target) { From 1edd36638bda97aa383e0bb9de8e67a28d280f42 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 17 May 2019 11:25:23 +0300 Subject: [PATCH 339/674] PML/UCX: disable PML UCX if MT is requested but not supported - in case if multithreading requested but not supported disable PML UCX Signed-off-by: Sergey Oblomov (cherry picked from commit a3578d9ece2b40a349529e7b223df50b0aac64aa) --- ompi/mca/pml/ucx/pml_ucx.c | 10 +++++----- ompi/mca/pml/ucx/pml_ucx.h | 2 +- ompi/mca/pml/ucx/pml_ucx_component.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index e2a614e242b..348dae8e1a6 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -245,7 +245,7 @@ int mca_pml_ucx_close(void) return OMPI_SUCCESS; } -int mca_pml_ucx_init(void) +int mca_pml_ucx_init(int enable_mpi_threads) { ucp_worker_params_t params; ucp_worker_attr_t attr; @@ -256,8 +256,7 @@ int mca_pml_ucx_init(void) /* TODO check MPI thread mode */ params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; - params.thread_mode = UCS_THREAD_MODE_SINGLE; - if (ompi_mpi_thread_multiple) { + if (enable_mpi_threads) { params.thread_mode = UCS_THREAD_MODE_MULTI; } else { params.thread_mode = UCS_THREAD_MODE_SINGLE; @@ -279,10 +278,11 @@ int mca_pml_ucx_init(void) goto err_destroy_worker; } - if (ompi_mpi_thread_multiple && (attr.thread_mode != UCS_THREAD_MODE_MULTI)) { + if (enable_mpi_threads && (attr.thread_mode != UCS_THREAD_MODE_MULTI)) { /* UCX does not support multithreading, disqualify current PML for now */ /* TODO: we should let OMPI to fallback to THREAD_SINGLE mode */ - PML_UCX_ERROR("UCP worker does not support MPI_THREAD_MULTIPLE"); + PML_UCX_VERBOSE(1, "UCP worker does not support MPI_THREAD_MULTIPLE. " + "PML UCX could not be selected"); rc = OMPI_ERR_NOT_SUPPORTED; goto err_destroy_worker; } diff --git a/ompi/mca/pml/ucx/pml_ucx.h b/ompi/mca/pml/ucx/pml_ucx.h index 484ad5ebe1c..f073b56a549 100644 --- a/ompi/mca/pml/ucx/pml_ucx.h +++ b/ompi/mca/pml/ucx/pml_ucx.h @@ -64,7 +64,7 @@ extern mca_pml_ucx_module_t ompi_pml_ucx; int mca_pml_ucx_open(void); int mca_pml_ucx_close(void); -int mca_pml_ucx_init(void); +int mca_pml_ucx_init(int enable_mpi_threads); int mca_pml_ucx_cleanup(void); int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs); diff --git a/ompi/mca/pml/ucx/pml_ucx_component.c b/ompi/mca/pml/ucx/pml_ucx_component.c index e427eab32cd..28b00fee4f1 100644 --- a/ompi/mca/pml/ucx/pml_ucx_component.c +++ b/ompi/mca/pml/ucx/pml_ucx_component.c @@ -90,11 +90,11 @@ static int mca_pml_ucx_component_close(void) static mca_pml_base_module_t* mca_pml_ucx_component_init(int* priority, bool enable_progress_threads, - bool enable_mpi_threads) + bool enable_mpi_threads) { int ret; - if ( (ret = mca_pml_ucx_init()) != 0) { + if ( (ret = mca_pml_ucx_init(enable_mpi_threads)) != 0) { return NULL; } From 8f82c899bcc0dc86c5347f438ac3fb94c65a64cf Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Mon, 20 May 2019 11:17:44 +0300 Subject: [PATCH 340/674] Coll/hcoll: don't init opal memhooks unless explicitely requested by user If user sets HCOLL_EXTERNAL_UCM_EVENTS=1 then we try init opal memory framework and register a mem release cb. Otherwise, rely on ucx. Signed-off-by: Valentin Petrov --- ompi/mca/coll/hcoll/coll_hcoll_component.c | 19 ------------------- ompi/mca/coll/hcoll/coll_hcoll_module.c | 21 ++++++++++++++++----- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/ompi/mca/coll/hcoll/coll_hcoll_component.c b/ompi/mca/coll/hcoll/coll_hcoll_component.c index 29ea5689c73..a7a79286a3f 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_component.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_component.c @@ -209,29 +209,10 @@ static int hcoll_open(void) { mca_coll_hcoll_component_t *cm; cm = &mca_coll_hcoll_component; - mca_coll_hcoll_output = opal_output_open(NULL); opal_output_set_verbosity(mca_coll_hcoll_output, cm->hcoll_verbose); - hcoll_rte_fns_setup(); - cm->libhcoll_initialized = false; - - (void)mca_base_framework_open(&opal_memory_base_framework, 0); - - /* Register memory hooks */ - if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == - ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & - opal_mem_hooks_support_level())) - { - setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0); - HCOL_VERBOSE(1, "Enabling on-demand memory mapping"); - cm->using_mem_hooks = 1; - } else { - HCOL_VERBOSE(1, "Disabling on-demand memory mapping"); - cm->using_mem_hooks = 0; - } - return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/hcoll/coll_hcoll_module.c b/ompi/mca/coll/hcoll/coll_hcoll_module.c index 6e2fbdda310..aa262c98492 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_module.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_module.c @@ -301,17 +301,28 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority) HCOL_ERROR("Hcol library init failed"); return NULL; } - #if HCOLL_API >= HCOLL_VERSION(3,2) - if (cm->using_mem_hooks && cm->init_opts->mem_hook_needed) { + if (cm->init_opts->mem_hook_needed) { #else - if (cm->using_mem_hooks && hcoll_check_mem_release_cb_needed()) { + if (hcoll_check_mem_release_cb_needed()) { #endif - opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL); + rc = mca_base_framework_open(&opal_memory_base_framework, 0); + if (OPAL_SUCCESS != rc) { + HCOL_VERBOSE(1, "failed to initialize memory base framework: %d, " + "memory hooks will not be used", rc); + } else { + if ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == + ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & + opal_mem_hooks_support_level())) { + HCOL_VERBOSE(1, "using OPAL memory hooks as external events"); + cm->using_mem_hooks = 1; + opal_mem_hooks_register_release(mca_coll_hcoll_mem_release_cb, NULL); + setenv("MXM_HCOLL_MEM_ON_DEMAND_MAP", "y", 0); + } + } } else { cm->using_mem_hooks = 0; } - copy_fn.attr_communicator_copy_fn = (MPI_Comm_internal_copy_attr_function*) MPI_COMM_NULL_COPY_FN; del_fn.attr_communicator_delete_fn = hcoll_comm_attr_del_fn; err = ompi_attr_create_keyval(COMM_ATTR, copy_fn, del_fn, &hcoll_comm_attr_keyval, NULL ,0, NULL); From 11cb0f24a51cc971db13ce12578c1f6ff4932281 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 15 May 2019 12:24:22 -0600 Subject: [PATCH 341/674] btl/uct: check for support before disabling UCX memory hooks Signed-off-by: Nathan Hjelm (cherry picked from commit 3e1dd362411f1da5564d3402f65e9b3b74f50759) --- opal/mca/btl/uct/btl_uct_component.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index c8bc9e93775..f968cb9c31c 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -17,6 +17,7 @@ * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -127,7 +128,10 @@ static int mca_btl_uct_component_open(void) mca_btl_uct_component.num_contexts_per_module = MCA_BTL_UCT_MAX_WORKERS; } - if (mca_btl_uct_component.disable_ucx_memory_hooks) { + if (mca_btl_uct_component.disable_ucx_memory_hooks && + ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) == + ((OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT) & + opal_mem_hooks_support_level()))) { ucm_set_external_event(UCM_EVENT_VM_UNMAPPED); opal_mem_hooks_register_release(mca_btl_uct_mem_release_cb, NULL); } From c14260556662243a739fa6604091925f221e1daf Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Tue, 21 May 2019 11:42:10 +0300 Subject: [PATCH 342/674] SSHMEM/COLL: added sshmem/mpi implementation for shmem_collect call - added MPI based implementation of shmem_collect call Signed-off-by: Sergey Oblomov (cherry picked from commit 7d8cb75b2e344f867021cffd4e656ff08d3945d8) --- oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 63 ++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 13 deletions(-) diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index eb03dfec2df..2aa87a0222d 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -107,16 +107,18 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, bool nlong_type, int alg) { + ompi_datatype_t* stype = &ompi_mpi_char.dt; + ompi_datatype_t* rtype = &ompi_mpi_char.dt; mca_scoll_mpi_module_t *mpi_module; - ompi_datatype_t* stype; - ompi_datatype_t* rtype; int rc; + int len; + int i; void *sbuf, *rbuf; + int *disps, *recvcounts; MPI_COLL_VERBOSE(20,"RUNNING MPI ALLGATHER"); mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_collect_module; if (nlong_type == true) { - /* Do nothing on zero-length request */ if (OPAL_UNLIKELY(!nlong)) { return OSHMEM_SUCCESS; @@ -124,8 +126,6 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, sbuf = (void *) source; rbuf = target; - stype = &ompi_mpi_char.dt; - rtype = &ompi_mpi_char.dt; /* Open SHMEM specification has the following constrains (page 85): * "If using C/C++, nelems must be of type integer. If you are using Fortran, it must be a * default integer value". And also fortran signature says "INTEGER". @@ -159,15 +159,52 @@ int mca_scoll_mpi_collect(struct oshmem_group_t *group, SCOLL_DEFAULT_ALG); } } else { - MPI_COLL_VERBOSE(20,"RUNNING FALLBACK COLLECT"); - PREVIOUS_SCOLL_FN(mpi_module, collect, group, - target, - source, - nlong, - pSync, - nlong_type, - SCOLL_DEFAULT_ALG); + if (INT_MAX < nlong) { + MPI_COLL_VERBOSE(20,"RUNNING FALLBACK COLLECT"); + PREVIOUS_SCOLL_FN(mpi_module, collect, group, + target, + source, + nlong, + pSync, + nlong_type, + SCOLL_DEFAULT_ALG); + return rc; + } + + len = nlong; + disps = malloc(group->proc_count * sizeof(*disps)); + if (disps == NULL) { + rc = OSHMEM_ERR_OUT_OF_RESOURCE; + goto complete; + } + + recvcounts = malloc(group->proc_count * sizeof(*recvcounts)); + if (recvcounts == NULL) { + rc = OSHMEM_ERR_OUT_OF_RESOURCE; + goto failed_mem; + } + + rc = mpi_module->comm->c_coll->coll_allgather(&len, sizeof(len), stype, recvcounts, + sizeof(len), rtype, mpi_module->comm, + mpi_module->comm->c_coll->coll_allgather_module); + if (rc != OSHMEM_SUCCESS) { + goto failed_allgather; + } + + disps[0] = 0; + for (i = 1; i < group->proc_count; i++) { + disps[i] = disps[i - 1] + recvcounts[i - 1]; + } + + rc = mpi_module->comm->c_coll->coll_allgatherv(source, nlong, stype, target, recvcounts, + disps, rtype, mpi_module->comm, + mpi_module->comm->c_coll->coll_allgatherv_module); +failed_allgather: + free(recvcounts); +failed_mem: + free(disps); } +complete: return rc; } From c7250cd11d960c38a3497adfc841247496adbb38 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 23 May 2019 13:48:57 -0500 Subject: [PATCH 343/674] common/ompio: fix division by zero problem with empty fview When using an empty fileview, a division by zero bug can occur in ompio. Not entirely sure why the problem did not show up previously, but some recent changes trigger that bug in one of our tests. This pr is part of a fix applied in commit f6b3a0a Fixes Issue #6703 Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio_file_open.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index a626c55c222..cf701d3e63a 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2018 University of Houston. All rights reserved. + * Copyright (c) 2008-2019 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -384,6 +384,13 @@ int mca_common_ompio_file_get_position (ompio_file_t *fh, { OMPI_MPI_OFFSET_TYPE off; + if ( 0 == fh->f_view_extent || + 0 == fh->f_view_size || + 0 == fh->f_etype_size ) { + *offset = 0; + return OMPI_SUCCESS; + } + /* No. of copies of the entire file view */ off = (fh->f_offset - fh->f_disp)/fh->f_view_extent; From f75d46faa9f436a2c2c4a1e71ac15d67156af064 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 15 May 2019 19:33:36 +0300 Subject: [PATCH 344/674] ALLOC_WITH_HINT: added implace realloc - in some cases realloc operation may be completed without allocation of new buffer (and without additional data copy) - added logic to reallocate buffer inplace if possible Signed-off-by: Sergey Oblomov (cherry picked from commit 277c2a9e5c7711098be826e6c154253747fdad9a) --- oshmem/mca/spml/ucx/spml_ucx.c | 3 +- oshmem/mca/sshmem/ucx/sshmem_ucx.h | 13 ++++- oshmem/mca/sshmem/ucx/sshmem_ucx_module.c | 20 ++++--- oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c | 64 ++++++++++++++++++++++- 4 files changed, 88 insertions(+), 12 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index a4d81b13182..fa79adafb44 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -554,7 +554,8 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx { ucp_worker_params_t params; ucp_ep_params_t ep_params; - size_t i, j, nprocs = oshmem_num_procs(); + size_t i, nprocs = oshmem_num_procs(); + int j; ucs_status_t err; spml_ucx_mkey_t *ucx_mkey; sshmem_mkey_t *mkey; diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx.h b/oshmem/mca/sshmem/ucx/sshmem_ucx.h index f171fe641b8..3d6bba7018a 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx.h +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx.h @@ -49,10 +49,19 @@ sshmem_ucx_shadow_allocator_t *sshmem_ucx_shadow_create(unsigned count); void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator); int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator, unsigned count, unsigned *index); + +/* reallocate existing allocated buffer. if possible - used inplace + * reallocation. + * parameter 'inplace' - out, in case if zero - new buffer was allocated + * (inplace is not possible), user should remove original buffer after data + * is copied, else (if inplace == 0) - no additional action required */ +int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, + unsigned count, unsigned old_index, unsigned *index, + int *inplace); int sshmem_ucx_shadow_free(sshmem_ucx_shadow_allocator_t *allocator, unsigned index); -size_t sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, - unsigned index); +unsigned sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index); END_C_DECLS diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c index 047343e9c10..d6895875b44 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c @@ -189,7 +189,6 @@ static uct_ib_device_mem_h alloc_device_mem(mca_spml_ucx_t *spml, size_t size, uct_md_h uct_md; void *address; size_t length; - int ret; uct_md = ucp_context_find_tl_md(spml->ucp_context, "mlx5"); if (uct_md == NULL) { @@ -353,8 +352,9 @@ static int sshmem_ucx_memheap_realloc(map_segment_t *s, size_t size, void* old_ptr, void** new_ptr) { mca_sshmem_ucx_segment_context_t *ctx = s->context; - unsigned alloc_count, index; + unsigned alloc_count, index, old_index, old_alloc_count; int res; + int inplace; if (size > s->seg_size) { return OSHMEM_ERR_OUT_OF_RESOURCE; @@ -371,7 +371,15 @@ static int sshmem_ucx_memheap_realloc(map_segment_t *s, size_t size, /* Allocate new element. Zero-size allocation should still return a unique * pointer, so allocate 1 byte */ alloc_count = max((size + ALLOC_ELEM_SIZE - 1) / ALLOC_ELEM_SIZE, 1); - res = sshmem_ucx_shadow_alloc(ctx->shadow_allocator, alloc_count, &index); + + if (!old_ptr) { + res = sshmem_ucx_shadow_alloc(ctx->shadow_allocator, alloc_count, &index); + } else { + old_index = sshmem_ucx_memheap_ptr2index(s, old_ptr); + res = sshmem_ucx_shadow_realloc(ctx->shadow_allocator, alloc_count, + old_index, &index, &inplace); + } + if (res != OSHMEM_SUCCESS) { return res; } @@ -379,10 +387,8 @@ static int sshmem_ucx_memheap_realloc(map_segment_t *s, size_t size, *new_ptr = sshmem_ucx_memheap_index2ptr(s, index); /* Copy to new segment and release old*/ - if (old_ptr) { - unsigned old_index = sshmem_ucx_memheap_ptr2index(s, old_ptr); - unsigned old_alloc_count = sshmem_ucx_shadow_size(ctx->shadow_allocator, - old_index); + if (old_ptr && !inplace) { + old_alloc_count = sshmem_ucx_shadow_size(ctx->shadow_allocator, old_index); sshmem_ucx_memheap_wordcopy(*new_ptr, old_ptr, min(size, old_alloc_count * ALLOC_ELEM_SIZE)); sshmem_ucx_shadow_free(ctx->shadow_allocator, old_index); diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c index 92fa2bb0cfc..d5a25eaf154 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c @@ -107,6 +107,66 @@ static void sshmem_ucx_shadow_merge_blocks(sshmem_ucx_shadow_allocator_t *alloca } } + + +int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, + unsigned count, unsigned old_index, unsigned *index, + int *inplace) +{ + sshmem_ucx_shadow_alloc_elem_t *end = &allocator->elems[allocator->num_elems]; + sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[old_index]; + sshmem_ucx_shadow_alloc_elem_t *next = &elem[elem->block_size]; + unsigned old_count = elem->block_size; + + assert(count > 0); + assert(!sshmem_ucx_shadow_is_free(elem)); + + *inplace = 1; + + if (count == old_count) { + *index = old_index; + return OSHMEM_SUCCESS; + } + + if (count < elem->block_size) { + /* requested block is shorter than allocated block + * then just cut current buffer */ + sshmem_ucx_shadow_set_elem(elem + count, + SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE, + elem->block_size - count); + elem->block_size = count; + *index = old_index; + sshmem_ucx_shadow_merge_blocks(allocator); + return OSHMEM_SUCCESS; + } + + assert(count > old_count); + + /* try to check if next element is free & has enough length */ + if ((next < end) && /* non-last element? */ + sshmem_ucx_shadow_is_free(next) && /* next is free */ + (old_count + next->block_size >= count)) + { + assert(elem < next); + assert(elem + count > next); + assert(elem + count <= end); + assert(next + next->block_size <= end); + + if (old_count + next->block_size > count) { + sshmem_ucx_shadow_set_elem(elem + count, SSHMEM_UCX_SHADOW_ELEM_FLAG_FREE, + old_count + next->block_size - count); + } + + sshmem_ucx_shadow_set_elem(next, 0, 0); + elem->block_size = count; + *index = old_index; + return OSHMEM_SUCCESS; + } + + *inplace = 0; + return sshmem_ucx_shadow_alloc(allocator, count, index); +} + int sshmem_ucx_shadow_free(sshmem_ucx_shadow_allocator_t *allocator, unsigned index) { @@ -117,8 +177,8 @@ int sshmem_ucx_shadow_free(sshmem_ucx_shadow_allocator_t *allocator, return OSHMEM_SUCCESS; } -size_t sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, - unsigned index) +unsigned sshmem_ucx_shadow_size(sshmem_ucx_shadow_allocator_t *allocator, + unsigned index) { sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[index]; From 748a5f5e73b6a00ea60d64a7cf8e8b4f9a202126 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 16 May 2019 09:38:01 +0300 Subject: [PATCH 345/674] SHADOW ALLOCATOR: minor code optimization Signed-off-by: Sergey Oblomov (cherry picked from commit a51badd627c5cdd3212cd6bedd3daa236cd6c8db) --- oshmem/mca/sshmem/ucx/sshmem_ucx.h | 4 ++-- oshmem/mca/sshmem/ucx/sshmem_ucx_module.c | 2 +- oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx.h b/oshmem/mca/sshmem/ucx/sshmem_ucx.h index 3d6bba7018a..fa264b40f42 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx.h +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx.h @@ -50,9 +50,9 @@ void sshmem_ucx_shadow_destroy(sshmem_ucx_shadow_allocator_t *allocator); int sshmem_ucx_shadow_alloc(sshmem_ucx_shadow_allocator_t *allocator, unsigned count, unsigned *index); -/* reallocate existing allocated buffer. if possible - used inplace +/* Reallocate existing allocated buffer. If possible - used inplace * reallocation. - * parameter 'inplace' - out, in case if zero - new buffer was allocated + * Parameter 'inplace' - out, in case if zero - new buffer was allocated * (inplace is not possible), user should remove original buffer after data * is copied, else (if inplace == 0) - no additional action required */ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c index d6895875b44..52b4d560626 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c @@ -335,7 +335,7 @@ static unsigned sshmem_ucx_memheap_ptr2index(map_segment_t *s, void *ptr) return ((char*)ptr - (char*)s->super.va_base) / ALLOC_ELEM_SIZE; } -void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size) +static void sshmem_ucx_memheap_wordcopy(void *dst, void *src, size_t size) { const size_t count = (size + sizeof(uint64_t) - 1) / sizeof(uint64_t); uint64_t *dst64 = (uint64_t*)dst; diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c index d5a25eaf154..9aaf77772f8 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c @@ -128,7 +128,7 @@ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, return OSHMEM_SUCCESS; } - if (count < elem->block_size) { + if (count < old_count) { /* requested block is shorter than allocated block * then just cut current buffer */ sshmem_ucx_shadow_set_elem(elem + count, From 456c5b90aea606838ce06a2496081807f92eca40 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 24 May 2019 09:16:56 +0300 Subject: [PATCH 346/674] OSHMEM: minor optimization of realloc in shadow allocator Signed-off-by: Sergey Oblomov (cherry picked from commit d6a09120244be36d870e791146b5baed93659754) --- oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c index 9aaf77772f8..06922c3e1b7 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_shadow.c @@ -113,10 +113,10 @@ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, unsigned count, unsigned old_index, unsigned *index, int *inplace) { - sshmem_ucx_shadow_alloc_elem_t *end = &allocator->elems[allocator->num_elems]; sshmem_ucx_shadow_alloc_elem_t *elem = &allocator->elems[old_index]; - sshmem_ucx_shadow_alloc_elem_t *next = &elem[elem->block_size]; unsigned old_count = elem->block_size; + sshmem_ucx_shadow_alloc_elem_t *end; + sshmem_ucx_shadow_alloc_elem_t *next; assert(count > 0); assert(!sshmem_ucx_shadow_is_free(elem)); @@ -142,8 +142,10 @@ int sshmem_ucx_shadow_realloc(sshmem_ucx_shadow_allocator_t *allocator, assert(count > old_count); + end = &allocator->elems[allocator->num_elems]; + next = &elem[old_count]; /* try to check if next element is free & has enough length */ - if ((next < end) && /* non-last element? */ + if ((next < end) && /* non-last element? */ sshmem_ucx_shadow_is_free(next) && /* next is free */ (old_count + next->block_size >= count)) { From 69923e78c71febad0a8dd64230742b77c6f6ec35 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 20 May 2019 15:17:30 +0300 Subject: [PATCH 347/674] SPML/UCX: added synchronized flush on quiet - added synchronized flush operation on quiet call. - flush is implemented using get operation Signed-off-by: Sergey Oblomov (cherry picked from commit 0b108411f89727a68cd622f3b04c783efa359b8e) --- oshmem/mca/atomic/ucx/atomic_ucx_cswap.c | 5 ++ oshmem/mca/atomic/ucx/atomic_ucx_module.c | 5 ++ oshmem/mca/spml/ucx/spml_ucx.c | 85 ++++++++++++++++++++++- oshmem/mca/spml/ucx/spml_ucx.h | 19 ++++- oshmem/mca/spml/ucx/spml_ucx_component.c | 5 ++ 5 files changed, 115 insertions(+), 4 deletions(-) diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c index 51b07629471..8c5fa1d1a64 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c @@ -45,6 +45,11 @@ int mca_atomic_ucx_cswap(shmem_ctx_t ctx, UCP_ATOMIC_FETCH_OP_CSWAP, cond, prev, size, rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); + + if (OPAL_LIKELY(!UCS_PTR_IS_ERR(status_ptr))) { + mca_spml_ucx_remote_op_posted(ucx_ctx, pe); + } + return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker, "ucp_atomic_fetch_nb"); } diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_module.c b/oshmem/mca/atomic/ucx/atomic_ucx_module.c index 91d4551e457..882b83f6520 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_module.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_module.c @@ -51,6 +51,11 @@ int mca_atomic_ucx_op(shmem_ctx_t ctx, status = ucp_atomic_post(ucx_ctx->ucp_peers[pe].ucp_conn, op, value, size, rva, ucx_mkey->rkey); + + if (OPAL_LIKELY(UCS_OK == status)) { + mca_spml_ucx_remote_op_posted(ucx_ctx, pe); + } + return ucx_status_to_oshmem(status); } diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index a4d81b13182..9ed672524a6 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -80,7 +80,8 @@ mca_spml_ucx_t mca_spml_ucx = { .num_disconnect = 1, .heap_reg_nb = 0, .enabled = 0, - .get_mkey_slow = NULL + .get_mkey_slow = NULL, + .synchronized_quiet = false }; mca_spml_ucx_ctx_t mca_spml_ucx_ctx_default = { @@ -216,6 +217,40 @@ static void dump_address(int pe, char *addr, size_t len) static char spml_ucx_transport_ids[1] = { 0 }; +int mca_spml_ucx_init_put_op_mask(mca_spml_ucx_ctx_t *ctx, size_t nprocs) +{ + int res; + + if (mca_spml_ucx.synchronized_quiet) { + ctx->put_proc_indexes = malloc(nprocs * sizeof(*ctx->put_proc_indexes)); + if (NULL == ctx->put_proc_indexes) { + return OSHMEM_ERR_OUT_OF_RESOURCE; + } + + OBJ_CONSTRUCT(&ctx->put_op_bitmap, opal_bitmap_t); + res = opal_bitmap_init(&ctx->put_op_bitmap, nprocs); + if (OPAL_SUCCESS != res) { + free(ctx->put_proc_indexes); + ctx->put_proc_indexes = NULL; + return res; + } + + ctx->put_proc_count = 0; + } + + return OSHMEM_SUCCESS; +} + +int mca_spml_ucx_clear_put_op_mask(mca_spml_ucx_ctx_t *ctx) +{ + if (mca_spml_ucx.synchronized_quiet && ctx->put_proc_indexes) { + OBJ_DESTRUCT(&ctx->put_op_bitmap); + free(ctx->put_proc_indexes); + } + + return OSHMEM_SUCCESS; +} + int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) { size_t i, j, n; @@ -235,6 +270,11 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) goto error; } + rc = mca_spml_ucx_init_put_op_mask(&mca_spml_ucx_ctx_default, nprocs); + if (OSHMEM_SUCCESS != rc) { + goto error; + } + err = ucp_worker_get_address(mca_spml_ucx_ctx_default.ucp_worker, &wk_local_addr, &wk_addr_len); if (err != UCS_OK) { goto error; @@ -297,6 +337,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) free(mca_spml_ucx.remote_addrs_tbl[i]); } } + + mca_spml_ucx_clear_put_op_mask(&mca_spml_ucx_ctx_default); if (mca_spml_ucx_ctx_default.ucp_peers) free(mca_spml_ucx_ctx_default.ucp_peers); if (mca_spml_ucx.remote_addrs_tbl) @@ -583,6 +625,11 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx goto error; } + rc = mca_spml_ucx_init_put_op_mask(ucx_ctx, nprocs); + if (OSHMEM_SUCCESS != rc) { + goto error2; + } + for (i = 0; i < nprocs; i++) { ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS; ep_params.address = (ucp_address_t *)(mca_spml_ucx.remote_addrs_tbl[i]); @@ -621,6 +668,8 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx } } + mca_spml_ucx_clear_put_op_mask(ucx_ctx); + if (ucx_ctx->ucp_peers) free(ucx_ctx->ucp_peers); @@ -715,6 +764,7 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add void *rva; spml_ucx_mkey_t *ucx_mkey; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + int res; #if HAVE_DECL_UCP_PUT_NB ucs_status_ptr_t request; #else @@ -725,12 +775,18 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add #if HAVE_DECL_UCP_PUT_NB request = ucp_put_nb(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); - return opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker, "ucp_put_nb"); + res = opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker, "ucp_put_nb"); #else status = ucp_put(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey); - return ucx_status_to_oshmem(status); + res = ucx_status_to_oshmem(status); #endif + + if (OPAL_LIKELY(OSHMEM_SUCCESS == res)) { + mca_spml_ucx_remote_op_posted(ucx_ctx, dst); + } + + return res; } int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_addr, int dst, void **handle) @@ -744,6 +800,10 @@ int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_ status = ucp_put_nbi(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey); + if (OPAL_LIKELY(status >= 0)) { + mca_spml_ucx_remote_op_posted(ucx_ctx, dst); + } + return ucx_status_to_oshmem_nb(status); } @@ -767,9 +827,28 @@ int mca_spml_ucx_fence(shmem_ctx_t ctx) int mca_spml_ucx_quiet(shmem_ctx_t ctx) { + int flush_get_data; int ret; + unsigned i; + int idx; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + if (mca_spml_ucx.synchronized_quiet) { + for (i = 0; i < ucx_ctx->put_proc_count; i++) { + idx = ucx_ctx->put_proc_indexes[i]; + ret = mca_spml_ucx_get_nb(ctx, + ucx_ctx->ucp_peers[idx].mkeys->super.super.va_base, + sizeof(flush_get_data), &flush_get_data, idx, NULL); + if (OMPI_SUCCESS != ret) { + oshmem_shmem_abort(-1); + return ret; + } + + opal_bitmap_clear_bit(&ucx_ctx->put_op_bitmap, idx); + } + ucx_ctx->put_proc_count = 0; + } + opal_atomic_wmb(); ret = opal_common_ucx_worker_flush(ucx_ctx->ucp_worker); diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index f697f3564b6..95c56622351 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -33,6 +33,7 @@ #include "opal/class/opal_free_list.h" #include "opal/class/opal_list.h" +#include "opal/class/opal_bitmap.h" #include "orte/runtime/orte_globals.h" #include "opal/mca/common/ucx/common_ucx.h" @@ -70,6 +71,9 @@ struct mca_spml_ucx_ctx { ucp_worker_h ucp_worker; ucp_peer_t *ucp_peers; long options; + opal_bitmap_t put_op_bitmap; + int *put_proc_indexes; + unsigned put_proc_count; }; typedef struct mca_spml_ucx_ctx mca_spml_ucx_ctx_t; @@ -104,7 +108,7 @@ struct mca_spml_ucx { mca_spml_ucx_ctx_t *aux_ctx; pthread_spinlock_t async_lock; int aux_refcnt; - + bool synchronized_quiet; }; typedef struct mca_spml_ucx mca_spml_ucx_t; @@ -171,6 +175,9 @@ extern int spml_ucx_ctx_progress(void); extern int spml_ucx_progress_aux_ctx(void); void mca_spml_ucx_async_cb(int fd, short event, void *cbdata); +int mca_spml_ucx_init_put_op_mask(mca_spml_ucx_ctx_t *ctx, size_t nprocs); +int mca_spml_ucx_clear_put_op_mask(mca_spml_ucx_ctx_t *ctx); + static inline void mca_spml_ucx_aux_lock(void) { if (mca_spml_ucx.async_progress) { @@ -224,6 +231,16 @@ static inline int ucx_status_to_oshmem_nb(ucs_status_t status) #endif } +static inline void mca_spml_ucx_remote_op_posted(mca_spml_ucx_ctx_t *ctx, int dst) +{ + if (OPAL_UNLIKELY(mca_spml_ucx.synchronized_quiet)) { + if (!opal_bitmap_is_set_bit(&ctx->put_op_bitmap, dst)) { + ctx->put_proc_indexes[ctx->put_proc_count++] = dst; + opal_bitmap_set_bit(&ctx->put_op_bitmap, dst); + } + } +} + #define MCA_SPML_UCX_CTXS_ARRAY_SIZE 64 #define MCA_SPML_UCX_CTXS_ARRAY_INC 64 diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 900349f9e6f..0f0ce2a15a3 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -128,6 +128,10 @@ static int mca_spml_ucx_component_register(void) "Asynchronous progress tick granularity (in usec)", &mca_spml_ucx.async_tick); + mca_spml_ucx_param_register_bool("synchronized_quiet", 0, + "Use synchronized quiet on shmem_quiet or shmem_barrier_all operations", + &mca_spml_ucx.synchronized_quiet); + opal_common_ucx_mca_var_register(&mca_spml_ucx_component.spmlm_version); return OSHMEM_SUCCESS; @@ -329,6 +333,7 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx) mca_spml_ucx.num_disconnect, ctx->ucp_worker); free(del_procs); + mca_spml_ucx_clear_put_op_mask(ctx); free(ctx->ucp_peers); } From 5f79dfaa0ae90b7a285b9d8f81b1355168206c87 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Wed, 27 Mar 2019 14:12:20 -0400 Subject: [PATCH 348/674] shmat/shmdt additions for patcher This is mostly based off recent UCX additions to their patcher: https://github.com/openucx/ucx/pull/2703 They added triggers for * mmap when (flags & MAP_FIXED) && (addr != NULL) * shmat when (shmflg & SHM_REMAP) && (shmaddr != NULL) Beyond that I noticed they already had a trigger for * madvise when (advice == MADV_FREE) that we didn't so I added that. And the other main thing is we didn't really have shmat/shmdt active for some systems because we only had a path for syscall(SYS_shmdt, ) but we needed to also have a path for syscall(SYS_ipc, IPCOP_shmdt, ) and same for shmat. Signed-off-by: Mark Allen (cherry picked from commit eb888118e83f56c131aff900b03eab34c92b7805) --- .../memory/patcher/memory_patcher_component.c | 122 ++++++++++++++---- 1 file changed, 98 insertions(+), 24 deletions(-) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index bf676dbdca9..5db3a6016f8 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * * $COPYRIGHT$ * @@ -48,6 +48,9 @@ #if defined(HAVE_LINUX_MMAN_H) #include #endif +#if defined(HAVE_SYS_IPC_H) +#include +#endif #include "memory_patcher.h" #undef opal_memory_changed @@ -104,15 +107,7 @@ opal_memory_patcher_component_t mca_memory_patcher_component = { * data. If this can be resolved the two levels can be joined. */ -/* - * The following block of code is #if 0'ed out because we do not need - * to intercept mmap() any more (mmap() only deals with memory - * protection; it does not invalidate any rcache entries for a given - * region). But if we do someday, this is the code that we'll need. - * It's a little non-trivial, so we might as well keep it (and #if 0 - * it out). - */ -#if 0 +#if defined (SYS_mmap) #if defined(HAVE___MMAP) && !HAVE_DECL___MMAP /* prototype for Apple's internal mmap function */ @@ -121,12 +116,11 @@ void *__mmap (void *start, size_t length, int prot, int flags, int fd, off_t off static void *(*original_mmap)(void *, size_t, int, int, int, off_t); -static void *intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) +static void *_intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { - OPAL_PATCHER_BEGIN; void *result = 0; - if (prot == PROT_NONE) { + if ((flags & MAP_FIXED) && (start != NULL)) { opal_mem_hooks_release_hook (start, length, true); } @@ -137,19 +131,20 @@ static void *intercept_mmap(void *start, size_t length, int prot, int flags, int #else result = (void*)(intptr_t) memory_patcher_syscall(SYS_mmap, start, length, prot, flags, fd, offset); #endif - - // I thought we had some issue in the past with the above line for IA32, - // like maybe syscall() wouldn't handle that many arguments. But just now - // I used gcc -m32 and it worked on a recent system. But there's a possibility - // that older ia32 systems may need some other code to make the above syscall. } else { result = original_mmap (start, length, prot, flags, fd, offset); } - OPAL_PATCHER_END; return result; } +static void *intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) +{ + OPAL_PATCHER_BEGIN; + void *result = _intercept_mmap (start, length, prot, flags, fd, offset); + OPAL_PATCHER_END; + return result; +} #endif #if defined (SYS_munmap) @@ -256,6 +251,9 @@ static int _intercept_madvise (void *start, size_t length, int advice) int result = 0; if (advice == MADV_DONTNEED || +#ifdef MADV_FREE + advice == MADV_FREE || +#endif #ifdef MADV_REMOVE advice == MADV_REMOVE || #endif @@ -341,7 +339,12 @@ static int intercept_brk (void *addr) #endif -#if defined(SYS_shmdt) && defined(__linux__) +#define HAS_SHMDT (defined(SYS_shmdt) || \ + (defined(IPCOP_shmdt) && defined(SYS_ipc))) +#define HAS_SHMAT (defined(SYS_shmat) || \ + (defined(IPCOP_shmat) && defined(SYS_ipc))) + +#if (HAS_SHMDT || HAS_SHMAT) && defined(__linux__) #include #include @@ -404,6 +407,68 @@ static size_t memory_patcher_get_shm_seg_size (const void *shmaddr) return seg_size; } +static size_t get_shm_size(int shmid) +{ + struct shmid_ds ds; + int ret; + + ret = shmctl(shmid, IPC_STAT, &ds); + if (ret < 0) { + return 0; + } + + return ds.shm_segsz; +} +#endif + +#if HAS_SHMAT && defined(__linux__) +static void *(*original_shmat)(int shmid, const void *shmaddr, int shmflg); + +static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) +{ + void *result = 0; + + size_t size = get_shm_size(shmid); + + if ((shmflg & SHM_REMAP) && (shmaddr != NULL)) { +// I don't really know what REMAP combined with SHM_RND does, so I'll just +// guess it remaps all the way down to the lower attach_addr, and all the +// way up to the original shmaddr+size + uintptr_t attach_addr = (uintptr_t)shmaddr; + + if (shmflg & SHM_RND) { + attach_addr -= ((uintptr_t)shmaddr) % SHMLBA; + size += ((uintptr_t)shmaddr) % SHMLBA; + } + opal_mem_hooks_release_hook ((void*)attach_addr, size, false); + } + + if (!original_shmat) { +#if defined(SYS_shmat) + result = memory_patcher_syscall(SYS_shmat, shmid, shmaddr, shmflg); +#else // IPCOP_shmat + unsigned long ret; + ret = memory_patcher_syscall(SYS_ipc, IPCOP_shmat, + shmid, shmflg, &shmaddr, shmaddr); + result = (ret > -(unsigned long)SHMLBA) ? (void *)ret : (void *)shmaddr; +#endif + } else { + result = original_shmat (shmid, shmaddr, shmflg); + } + + return result; +} + +static void* intercept_shmat (int shmid, const void * shmaddr, int shmflg) +{ + OPAL_PATCHER_BEGIN; + void *result = _intercept_shmat (shmid, shmaddr, shmflg); + OPAL_PATCHER_END; + return result; +} +#endif + +#if HAS_SHMDT && defined(__linux__) static int (*original_shmdt) (const void *); static int _intercept_shmdt (const void *shmaddr) @@ -417,7 +482,11 @@ static int _intercept_shmdt (const void *shmaddr) if (original_shmdt) { result = original_shmdt (shmaddr); } else { +#if defined(SYS_shmdt) result = memory_patcher_syscall (SYS_shmdt, shmaddr); +#else // IPCOP_shmdt + result = memory_patcher_syscall(SYS_ipc, IPCOP_shmdt, 0, 0, 0, shmaddr); +#endif } return result; @@ -478,9 +547,7 @@ static int patcher_open (void) /* set memory hooks support level */ opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT); -#if 0 - /* See above block to see why mmap() functionality is #if 0'ed - out */ +#if defined (SYS_mmap) rc = opal_patcher->patch_symbol ("mmap", (uintptr_t) intercept_mmap, (uintptr_t *) &original_mmap); if (OPAL_SUCCESS != rc) { return rc; @@ -508,7 +575,14 @@ static int patcher_open (void) } #endif -#if defined(SYS_shmdt) && defined(__linux__) +#if HAS_SHMAT && defined(__linux__) + rc = opal_patcher->patch_symbol ("shmat", (uintptr_t) intercept_shmat, (uintptr_t *) &original_shmat); + if (OPAL_SUCCESS != rc) { + return rc; + } +#endif + +#if HAS_SHMDT && defined(__linux__) rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt); if (OPAL_SUCCESS != rc) { return rc; From cadf315ca9fe9bb12485fcb17359e050289cc784 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 17 May 2019 15:10:06 -0400 Subject: [PATCH 349/674] Fixed SPC/MPI_T initialization error. Signed-off-by: Yong Qin --- ompi/runtime/ompi_spc.c | 61 +++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/ompi/runtime/ompi_spc.c b/ompi/runtime/ompi_spc.c index caee2cda6f2..15ca42aa791 100644 --- a/ompi/runtime/ompi_spc.c +++ b/ompi/runtime/ompi_spc.c @@ -276,7 +276,7 @@ void ompi_spc_events_init(void) */ void ompi_spc_init(void) { - int i, j, ret, found = 0, all_on = 0; + int i, j, ret, found = 0, all_on = 0, matched = 0; /* Initialize the clock frequency variable as the CPU's frequency in MHz */ sys_clock_freq_mhz = opal_timer_base_get_freq() / 1000000; @@ -287,6 +287,14 @@ void ompi_spc_init(void) char **arg_strings = opal_argv_split(ompi_mpi_spc_attach_string, ','); int num_args = opal_argv_count(arg_strings); + /* Reset all timer-based counters */ + for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) { + CLEAR_SPC_BIT(ompi_spc_timer_event, i); + } + + /* If this is a timer event, set the corresponding timer_event entry */ + SET_SPC_BIT(ompi_spc_timer_event, OMPI_SPC_MATCH_TIME); + /* If there is only one argument and it is 'all', then all counters * should be turned on. If the size is 0, then no counters will be enabled. */ @@ -299,49 +307,44 @@ void ompi_spc_init(void) /* Turn on only the counters that were specified in the MCA parameter */ for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) { if(all_on) { - SET_SPC_BIT(ompi_spc_attached_event, i); - mpi_t_enabled = true; found++; } else { + matched = 0; /* Note: If no arguments were given, this will be skipped */ for(j = 0; j < num_args; j++) { if( 0 == strcmp(ompi_spc_events_names[i].counter_name, arg_strings[j]) ) { - SET_SPC_BIT(ompi_spc_attached_event, i); - mpi_t_enabled = true; found++; + matched = 1; break; } } } - /* ######################################################################## - * ################## Add Timer-Based Counter Enums Here ################## - * ######################################################################## - */ - CLEAR_SPC_BIT(ompi_spc_timer_event, i); - - /* Registers the current counter as an MPI_T pvar regardless of whether it's been turned on or not */ - ret = mca_base_pvar_register("ompi", "runtime", "spc", ompi_spc_events_names[i].counter_name, ompi_spc_events_names[i].counter_description, - OPAL_INFO_LVL_4, MPI_T_PVAR_CLASS_SIZE, - MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, MPI_T_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - ompi_spc_get_count, NULL, ompi_spc_notify, NULL); + if (all_on || matched) { + SET_SPC_BIT(ompi_spc_attached_event, i); + mpi_t_enabled = true; - /* Check to make sure that ret is a valid index and not an error code. - */ - if( ret >= 0 ) { - if( mpi_t_offset == -1 ) { - mpi_t_offset = ret; + /* Registers the current counter as an MPI_T pvar regardless of whether it's been turned on or not */ + ret = mca_base_pvar_register("ompi", "runtime", "spc", ompi_spc_events_names[i].counter_name, ompi_spc_events_names[i].counter_description, + OPAL_INFO_LVL_4, MPI_T_PVAR_CLASS_SIZE, + MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, MPI_T_BIND_NO_OBJECT, + MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, + ompi_spc_get_count, NULL, ompi_spc_notify, NULL); + + /* Check to make sure that ret is a valid index and not an error code */ + if( ret >= 0 ) { + if( mpi_t_offset == -1 ) { + mpi_t_offset = ret; + } + } + if( (ret < 0) || (ret != (mpi_t_offset + found - 1)) ) { + mpi_t_enabled = false; + opal_show_help("help-mpi-runtime.txt", "spc: MPI_T disabled", true); + break; } - } - if( (ret < 0) || (ret != (mpi_t_offset + found - 1)) ) { - mpi_t_enabled = false; - opal_show_help("help-mpi-runtime.txt", "spc: MPI_T disabled", true); - break; } } - /* If this is a timer event, sent the corresponding timer_event entry to 1 */ - SET_SPC_BIT(ompi_spc_timer_event, OMPI_SPC_MATCH_TIME); + opal_argv_free(arg_strings); } From dbf89404d768046b4c79c403fa07d8ae8b28ab8d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 17 May 2019 15:32:17 -0400 Subject: [PATCH 350/674] Fix the SPC initialization. Use the PVAR ctx to save the SPC index, so that no lookup nor restriction on the SPC vars position is imposed. Make sure the PVAR are always registered. Signed-off-by: George Bosilca --- ompi/runtime/ompi_spc.c | 90 +++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 52 deletions(-) diff --git a/ompi/runtime/ompi_spc.c b/ompi/runtime/ompi_spc.c index 15ca42aa791..d88f290aaaf 100644 --- a/ompi/runtime/ompi_spc.c +++ b/ompi/runtime/ompi_spc.c @@ -1,11 +1,13 @@ /* - * Copyright (c) 2018 The University of Tennessee and The University + * Copyright (c) 2018-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,10 +22,8 @@ opal_timer_t sys_clock_freq_mhz = 0; static void ompi_spc_dump(void); /* Array for converting from SPC indices to MPI_T indices */ -OMPI_DECLSPEC int mpi_t_offset = -1; -OMPI_DECLSPEC bool mpi_t_enabled = false; - -OPAL_DECLSPEC ompi_communicator_t *comm = NULL; +static bool mpi_t_enabled = false; +static ompi_communicator_t *ompi_spc_comm = NULL; typedef struct ompi_spc_event_t { const char* counter_name; @@ -185,6 +185,8 @@ static int ompi_spc_notify(mca_base_pvar_t *pvar, mca_base_pvar_event_t event, v return MPI_SUCCESS; } + index = (int)(uintptr_t)pvar->ctx; /* Convert from MPI_T pvar index to SPC index */ + /* For this event, we need to set count to the number of long long type * values for this counter. All SPC counters are one long long, so we * always set count to 1. @@ -194,14 +196,10 @@ static int ompi_spc_notify(mca_base_pvar_t *pvar, mca_base_pvar_event_t event, v } /* For this event, we need to turn on the counter */ else if(MCA_BASE_PVAR_HANDLE_START == event) { - /* Convert from MPI_T pvar index to SPC index */ - index = pvar->pvar_index - mpi_t_offset; SET_SPC_BIT(ompi_spc_attached_event, index); } /* For this event, we need to turn off the counter */ else if(MCA_BASE_PVAR_HANDLE_STOP == event) { - /* Convert from MPI_T pvar index to SPC index */ - index = pvar->pvar_index - mpi_t_offset; CLEAR_SPC_BIT(ompi_spc_attached_event, index); } @@ -231,7 +229,7 @@ static int ompi_spc_get_count(const struct mca_base_pvar_t *pvar, void *value, v } /* Convert from MPI_T pvar index to SPC index */ - int index = pvar->pvar_index - mpi_t_offset; + int index = (int)(uintptr_t)pvar->ctx; /* Set the counter value to the current SPC value */ *counter_value = (long long)ompi_spc_events[index].value; /* If this is a timer-based counter, convert from cycles to microseconds */ @@ -268,7 +266,7 @@ void ompi_spc_events_init(void) ompi_spc_events[i].value = 0; } - ompi_comm_dup(&ompi_mpi_comm_world.comm, &comm); + ompi_comm_dup(&ompi_mpi_comm_world.comm, &ompi_spc_comm); } /* Initializes the SPC data structures and registers all counters as MPI_T pvars. @@ -287,14 +285,6 @@ void ompi_spc_init(void) char **arg_strings = opal_argv_split(ompi_mpi_spc_attach_string, ','); int num_args = opal_argv_count(arg_strings); - /* Reset all timer-based counters */ - for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) { - CLEAR_SPC_BIT(ompi_spc_timer_event, i); - } - - /* If this is a timer event, set the corresponding timer_event entry */ - SET_SPC_BIT(ompi_spc_timer_event, OMPI_SPC_MATCH_TIME); - /* If there is only one argument and it is 'all', then all counters * should be turned on. If the size is 0, then no counters will be enabled. */ @@ -304,47 +294,43 @@ void ompi_spc_init(void) } } - /* Turn on only the counters that were specified in the MCA parameter */ for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) { - if(all_on) { - found++; - } else { - matched = 0; - /* Note: If no arguments were given, this will be skipped */ + /* Reset all timer-based counters */ + CLEAR_SPC_BIT(ompi_spc_timer_event, i); + matched = all_on; + + if( !matched ) { + /* Turn on only the counters that were specified in the MCA parameter */ for(j = 0; j < num_args; j++) { if( 0 == strcmp(ompi_spc_events_names[i].counter_name, arg_strings[j]) ) { - found++; matched = 1; break; } } } - if (all_on || matched) { + if (matched) { SET_SPC_BIT(ompi_spc_attached_event, i); mpi_t_enabled = true; + found++; + } - /* Registers the current counter as an MPI_T pvar regardless of whether it's been turned on or not */ - ret = mca_base_pvar_register("ompi", "runtime", "spc", ompi_spc_events_names[i].counter_name, ompi_spc_events_names[i].counter_description, - OPAL_INFO_LVL_4, MPI_T_PVAR_CLASS_SIZE, - MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, MPI_T_BIND_NO_OBJECT, - MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, - ompi_spc_get_count, NULL, ompi_spc_notify, NULL); - - /* Check to make sure that ret is a valid index and not an error code */ - if( ret >= 0 ) { - if( mpi_t_offset == -1 ) { - mpi_t_offset = ret; - } - } - if( (ret < 0) || (ret != (mpi_t_offset + found - 1)) ) { - mpi_t_enabled = false; - opal_show_help("help-mpi-runtime.txt", "spc: MPI_T disabled", true); - break; - } + /* Registers the current counter as an MPI_T pvar regardless of whether it's been turned on or not */ + ret = mca_base_pvar_register("ompi", "runtime", "spc", ompi_spc_events_names[i].counter_name, ompi_spc_events_names[i].counter_description, + OPAL_INFO_LVL_4, MPI_T_PVAR_CLASS_SIZE, + MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG, NULL, MPI_T_BIND_NO_OBJECT, + MCA_BASE_PVAR_FLAG_READONLY | MCA_BASE_PVAR_FLAG_CONTINUOUS, + ompi_spc_get_count, NULL, ompi_spc_notify, (void*)(uintptr_t)i); + if( ret < 0 ) { + mpi_t_enabled = false; + opal_show_help("help-mpi-runtime.txt", "spc: MPI_T disabled", true); + break; } } + /* If this is a timer event, set the corresponding timer_event entry */ + SET_SPC_BIT(ompi_spc_timer_event, OMPI_SPC_MATCH_TIME); + opal_argv_free(arg_strings); } @@ -356,8 +342,8 @@ static void ompi_spc_dump(void) int i, j, world_size, offset; long long *recv_buffer = NULL, *send_buffer; - int rank = ompi_comm_rank(comm); - world_size = ompi_comm_size(comm); + int rank = ompi_comm_rank(ompi_spc_comm); + world_size = ompi_comm_size(ompi_spc_comm); /* Convert from cycles to usecs before sending */ for(i = 0; i < OMPI_SPC_NUM_COUNTERS; i++) { @@ -384,10 +370,10 @@ static void ompi_spc_dump(void) return; } } - (void)comm->c_coll->coll_gather(send_buffer, OMPI_SPC_NUM_COUNTERS, MPI_LONG_LONG, + (void)ompi_spc_comm->c_coll->coll_gather(send_buffer, OMPI_SPC_NUM_COUNTERS, MPI_LONG_LONG, recv_buffer, OMPI_SPC_NUM_COUNTERS, MPI_LONG_LONG, - 0, comm, - comm->c_coll->coll_gather_module); + 0, ompi_spc_comm, + ompi_spc_comm->c_coll->coll_gather_module); /* Once rank 0 has all of the information, print the aggregated counter values for each rank in order */ if(rank == 0) { @@ -413,7 +399,7 @@ static void ompi_spc_dump(void) } free(send_buffer); - comm->c_coll->coll_barrier(comm, comm->c_coll->coll_barrier_module); + ompi_spc_comm->c_coll->coll_barrier(ompi_spc_comm, ompi_spc_comm->c_coll->coll_barrier_module); } /* Frees any dynamically alocated OMPI SPC data structures */ @@ -424,7 +410,7 @@ void ompi_spc_fini(void) } free(ompi_spc_events); ompi_spc_events = NULL; - ompi_comm_free(&comm); + ompi_comm_free(&ompi_spc_comm); } /* Records an update to a counter using an atomic add operation. */ From a8d5da67db5db6e955de7b1c9974d6ba9291e27d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 29 May 2019 00:19:52 -0400 Subject: [PATCH 351/674] Fix the man pages for some of the MPI_T_* functions. Signed-off-by: George Bosilca --- ompi/mpi/man/man3/MPI_T_cvar_handle_alloc.3in | 1 + ompi/mpi/man/man3/MPI_T_finalize.3in | 1 + ompi/mpi/man/man3/MPI_T_pvar_handle_alloc.3in | 24 ++++++++++++++----- .../man/man3/MPI_T_pvar_session_create.3in | 1 + ompi/mpi/man/man3/MPI_T_pvar_start.3in | 1 + ompi/mpi/man/man3/MPI_T_pvar_write.3in | 2 +- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ompi/mpi/man/man3/MPI_T_cvar_handle_alloc.3in b/ompi/mpi/man/man3/MPI_T_cvar_handle_alloc.3in index 87e5f9f2efe..fa393b5cf66 100644 --- a/ompi/mpi/man/man3/MPI_T_cvar_handle_alloc.3in +++ b/ompi/mpi/man/man3/MPI_T_cvar_handle_alloc.3in @@ -20,6 +20,7 @@ int MPI_T_cvar_handle_alloc(int \fIcvar_index\fP, void *\fIobj_handle\fP, int MPI_T_cvar_handle_free(MPI_T_cvar_handle *\fIhandle\fP) +.fi .SH DESCRIPTION .ft R MPI_T_cvar_handle_alloc binds the control variable specified in \fIcvar_index\fP to the MPI diff --git a/ompi/mpi/man/man3/MPI_T_finalize.3in b/ompi/mpi/man/man3/MPI_T_finalize.3in index ef7ec71824c..7cb2b7dce2c 100644 --- a/ompi/mpi/man/man3/MPI_T_finalize.3in +++ b/ompi/mpi/man/man3/MPI_T_finalize.3in @@ -15,6 +15,7 @@ #include int MPI_T_finalize(void) +.fi .SH DESCRIPTION .ft R MPI_T_finalize() finalizes the MPI tool information interface and must be called the same diff --git a/ompi/mpi/man/man3/MPI_T_pvar_handle_alloc.3in b/ompi/mpi/man/man3/MPI_T_pvar_handle_alloc.3in index 1c9c844f148..dfcd4d19f55 100644 --- a/ompi/mpi/man/man3/MPI_T_pvar_handle_alloc.3in +++ b/ompi/mpi/man/man3/MPI_T_pvar_handle_alloc.3in @@ -15,17 +15,28 @@ .SH C Syntax .nf #include -int MPI_T_pvar_handle_alloc(int \fIpvar_index\fP, void *\fIobj_handle\fP, +int MPI_T_pvar_handle_alloc(int \fIsession\fP, int \fIpvar_index\fP, void *\fIobj_handle\fP, MPI_T_pvar_handle *\fIhandle\fP, int *\fIcount\fP) -int MPI_T_pvar_handle_free(MPI_T_pvar_handle *\fIhandle\fP) +int MPI_T_pvar_handle_free(int \fIsession\fP, MPI_T_pvar_handle *\fIhandle\fP) .SH DESCRIPTION .ft R MPI_T_pvar_handle_alloc binds the performance variable specified in \fIpvar_index\fP to the MPI -object specified in \fIobj_handle\fP. If MPI_T_pvar_get_info returns MPI_T_BIND_NO_OBJECT -as the binding for the variable the \fIobj_handle\fP argument is ignored. The number of -values represented by this performance variable is returned in the \fIcount\fP parameter. +object specified in \fIobj_handle\fP in the session identified by the parameter +\fIsession\fP. The object is passed in the argument \fIobj_handle\fP as an +address to a local variable that stores the object’s handle. If +MPI_T_pvar_get_info returns MPI_T_BIND_NO_OBJECT as the binding +for the variable the \fIobj_handle\fP argument is ignored. The handle +allocated to reference the variable is returned in the argument \fIhandle\fP. Upon successful +return, \fIcount\fP contains the number of elements (of the datatype returned by a previous +MPI_T_PVAR_GET_INFO call) used to represent this variable. + +The value of \fIpvar_index\fP should be in the range 0 to \fInum_pvar - 1\fP, +where \fInum_pvar\fP is the number of available performance variables as +determined from a prior call to \fIMPI_T_PVAR_GET_NUM\fP. The type of the +MPI object it references must be consistent with the type returned in the +bind argument in a prior call to \fIMPI_T_PVAR_GET_INFO\fP. MPI_T_pvar_handle_free frees a handle allocated by MPI_T_pvar_handle_alloc and sets the \fIhandle\fP argument to MPI_T_PVAR_HANDLE_NULL. @@ -50,11 +61,12 @@ MPI_T_pvar_handle_free() will fail if: The MPI Tools interface not initialized .TP 1i [MPI_T_ERR_INVALID_HANDLE] -The handle is invalid +The handle is invalid or the handle argument passed in is not associated with the session argument .SH SEE ALSO .ft R .nf MPI_T_pvar_get_info +MPI_T_pvar_get_num diff --git a/ompi/mpi/man/man3/MPI_T_pvar_session_create.3in b/ompi/mpi/man/man3/MPI_T_pvar_session_create.3in index 52a91c6617e..dd46817f314 100644 --- a/ompi/mpi/man/man3/MPI_T_pvar_session_create.3in +++ b/ompi/mpi/man/man3/MPI_T_pvar_session_create.3in @@ -19,6 +19,7 @@ int MPI_T_pvar_session_create(MPI_T_pvar_session *\fIsession\fP) int MPI_T_pvar_session_free(MPI_T_pvar_session *\fIsession\fP) +.fi .SH DESCRIPTION .ft R MPI_T_pvar_session_create creates a session for accessing performance variables. The diff --git a/ompi/mpi/man/man3/MPI_T_pvar_start.3in b/ompi/mpi/man/man3/MPI_T_pvar_start.3in index 450638149aa..2b1c9830d9b 100644 --- a/ompi/mpi/man/man3/MPI_T_pvar_start.3in +++ b/ompi/mpi/man/man3/MPI_T_pvar_start.3in @@ -19,6 +19,7 @@ int MPI_T_pvar_start(MPI_T_pvar_session \fIsession\fP, MPI_T_pvar_handle \fIhand int MPI_T_pvar_stop(MPI_T_pvar_session \fIsession\fP, MPI_T_pvar_handle \fIhandle\fP) +.fi .SH INPUT PARAMETERS .ft R .TP 1i diff --git a/ompi/mpi/man/man3/MPI_T_pvar_write.3in b/ompi/mpi/man/man3/MPI_T_pvar_write.3in index daaf28c0ac8..944a93c8e2f 100644 --- a/ompi/mpi/man/man3/MPI_T_pvar_write.3in +++ b/ompi/mpi/man/man3/MPI_T_pvar_write.3in @@ -33,7 +33,7 @@ Initial address of storage location for variable value. .SH DESCRIPTION .ft R MPI_T_pvar_write attempts to set the value of the performance variable identified by -the handle specified in \fIhandle\fP in the session specified in \fPsession\fI. The +the handle specified in \fIhandle\fP in the session specified in \fIsession\fP. The value to be written is specified in \fIbuf\fP. The caller must ensure that the buffer specified in \fIbuf\fP is large enough to hold the entire value of the performance variable. From 4083800c1842ed7ef5c14f2df682d4f9c204b619 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 29 May 2019 00:54:56 -0400 Subject: [PATCH 352/674] Use the correct counter name in the example. Signed-off-by: George Bosilca --- test/spc/spc_test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spc/spc_test.c b/test/spc/spc_test.c index a15d87dc95a..65dc744435f 100644 --- a/test/spc/spc_test.c +++ b/test/spc/spc_test.c @@ -44,8 +44,8 @@ int main(int argc, char **argv) char name[256], description[256]; /* Counter names to be read by ranks 0 and 1 */ - char *counter_names[] = { "runtime_spc_OMPI_BYTES_SENT_USER", - "runtime_spc_OMPI_BYTES_RECEIVED_USER" }; + char *counter_names[] = { "runtime_spc_OMPI_SPC_BYTES_SENT_USER", + "runtime_spc_OMPI_SPC_BYTES_RECEIVED_USER" }; MPI_Init(NULL, NULL); MPI_result = MPI_T_init_thread(MPI_THREAD_SINGLE, &provided); From 6c2cd10d684ec5a3a0d77cc5767d491dc9786e6f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 4 Jun 2019 09:49:01 -0700 Subject: [PATCH 353/674] Fix tree spawn at scale Remove the debruijn component as it changes the daemon's parent process ID, thus breaking the other routed components Signed-off-by: Ralph Castain --- orte/mca/routed/debruijn/Makefile.am | 41 -- orte/mca/routed/debruijn/owner.txt | 7 - orte/mca/routed/debruijn/routed_debruijn.c | 481 ------------------ orte/mca/routed/debruijn/routed_debruijn.h | 27 - .../debruijn/routed_debruijn_component.c | 55 -- 5 files changed, 611 deletions(-) delete mode 100644 orte/mca/routed/debruijn/Makefile.am delete mode 100644 orte/mca/routed/debruijn/owner.txt delete mode 100644 orte/mca/routed/debruijn/routed_debruijn.c delete mode 100644 orte/mca/routed/debruijn/routed_debruijn.h delete mode 100644 orte/mca/routed/debruijn/routed_debruijn_component.c diff --git a/orte/mca/routed/debruijn/Makefile.am b/orte/mca/routed/debruijn/Makefile.am deleted file mode 100644 index 2a90f6989b7..00000000000 --- a/orte/mca/routed/debruijn/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 2007-2012 Los Alamos National Security, LLC. -# All rights reserved. -# Copyright (c) 2009 High Performance Computing Center Stuttgart, -# University of Stuttgart. All rights reserved. -# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 IBM Corporation. All rights reserved. -# $COPYRIGHT$ -# -# Additional copyrights may follow -# -# $HEADER$ -# - -sources = \ - routed_debruijn.h \ - routed_debruijn.c \ - routed_debruijn_component.c - -# Make the output library in this directory, and name it either -# mca__.la (for DSO builds) or libmca__.la -# (for static builds). - -if MCA_BUILD_orte_routed_debruijn_DSO -component_noinst = -component_install = mca_routed_debruijn.la -else -component_noinst = libmca_routed_debruijn.la -component_install = -endif - -mcacomponentdir = $(ortelibdir) -mcacomponent_LTLIBRARIES = $(component_install) -mca_routed_debruijn_la_SOURCES = $(sources) -mca_routed_debruijn_la_LDFLAGS = -module -avoid-version -mca_routed_debruijn_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la - -noinst_LTLIBRARIES = $(component_noinst) -libmca_routed_debruijn_la_SOURCES = $(sources) -libmca_routed_debruijn_la_LDFLAGS = -module -avoid-version - diff --git a/orte/mca/routed/debruijn/owner.txt b/orte/mca/routed/debruijn/owner.txt deleted file mode 100644 index b4ba3c21f5e..00000000000 --- a/orte/mca/routed/debruijn/owner.txt +++ /dev/null @@ -1,7 +0,0 @@ -# -# owner/status file -# owner: institution that is responsible for this package -# status: e.g. active, maintenance, unmaintained -# -owner: LANL? -status: unmaintained diff --git a/orte/mca/routed/debruijn/routed_debruijn.c b/orte/mca/routed/debruijn/routed_debruijn.c deleted file mode 100644 index 4545fcae779..00000000000 --- a/orte/mca/routed/debruijn/routed_debruijn.c +++ /dev/null @@ -1,481 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2007-2012 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2004-2011 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * Copyright (c) 2013-2016 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include - -#include "opal/dss/dss.h" -#include "opal/class/opal_hash_table.h" -#include "opal/class/opal_bitmap.h" -#include "opal/util/output.h" - -#include "orte/mca/errmgr/errmgr.h" -#include "orte/mca/ess/ess.h" -#include "orte/mca/rml/rml.h" -#include "orte/mca/rml/rml_types.h" -#include "orte/util/name_fns.h" -#include "orte/runtime/orte_globals.h" -#include "orte/runtime/orte_wait.h" -#include "orte/runtime/runtime.h" -#include "orte/runtime/data_type_support/orte_dt_support.h" - -#include "orte/mca/rml/base/rml_contact.h" - -#include "orte/mca/routed/base/base.h" -#include "routed_debruijn.h" - - -static int init(void); -static int finalize(void); -static int delete_route(orte_process_name_t *proc); -static int update_route(orte_process_name_t *target, - orte_process_name_t *route); -static orte_process_name_t get_route(orte_process_name_t *target); -static int route_lost(const orte_process_name_t *route); -static bool route_is_defined(const orte_process_name_t *target); -static void update_routing_plan(void); -static void get_routing_list(opal_list_t *coll); -static int set_lifeline(orte_process_name_t *proc); -static size_t num_routes(void); - -#if OPAL_ENABLE_FT_CR == 1 -static int debruijn_ft_event(int state); -#endif - -orte_routed_module_t orte_routed_debruijn_module = { - .initialize = init, - .finalize = finalize, - .delete_route = delete_route, - .update_route = update_route, - .get_route = get_route, - .route_lost = route_lost, - .route_is_defined = route_is_defined, - .set_lifeline = set_lifeline, - .update_routing_plan = update_routing_plan, - .get_routing_list = get_routing_list, - .num_routes = num_routes, -#if OPAL_ENABLE_FT_CR == 1 - .ft_event = debruijn_ft_event -#else - NULL -#endif -}; - -/* local globals */ -static orte_process_name_t *lifeline=NULL; -static orte_process_name_t local_lifeline; -static opal_list_t my_children; -static bool hnp_direct=true; -static int log_nranks; -static int log_npeers; -static unsigned int rank_mask; - -static int init(void) -{ - lifeline = NULL; - - if (ORTE_PROC_IS_DAEMON) { - /* if we are using static ports, set my lifeline to point at my parent */ - if (orte_static_ports) { - lifeline = ORTE_PROC_MY_PARENT; - } else { - /* set our lifeline to the HNP - we will abort if that connection is lost */ - lifeline = ORTE_PROC_MY_HNP; - } - ORTE_PROC_MY_PARENT->jobid = ORTE_PROC_MY_NAME->jobid; - } else if (ORTE_PROC_IS_APP) { - /* if we don't have a designated daemon, just - * disqualify ourselves */ - if (NULL == orte_process_info.my_daemon_uri) { - return ORTE_ERR_TAKE_NEXT_OPTION; - } - /* set our lifeline to the local daemon - we will abort if this connection is lost */ - lifeline = ORTE_PROC_MY_DAEMON; - orte_routing_is_enabled = true; - } - - /* setup the list of children */ - OBJ_CONSTRUCT(&my_children, opal_list_t); - - return ORTE_SUCCESS; -} - -static int finalize(void) -{ - opal_list_item_t *item; - - lifeline = NULL; - - /* deconstruct the list of children */ - while (NULL != (item = opal_list_remove_first(&my_children))) { - OBJ_RELEASE(item); - } - OBJ_DESTRUCT(&my_children); - - return ORTE_SUCCESS; -} - -static int delete_route(orte_process_name_t *proc) -{ - if (proc->jobid == ORTE_JOBID_INVALID || - proc->vpid == ORTE_VPID_INVALID) { - return ORTE_ERR_BAD_PARAM; - } - - /* if I am an application process, I don't have any routes - * so there is nothing for me to do - */ - if (!ORTE_PROC_IS_HNP && !ORTE_PROC_IS_DAEMON && - !ORTE_PROC_IS_TOOL) { - return ORTE_SUCCESS; - } - - OPAL_OUTPUT_VERBOSE((1, orte_routed_base_framework.framework_output, - "%s routed_debruijn_delete_route for %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(proc))); - - /* THIS CAME FROM OUR OWN JOB FAMILY...there is nothing - * to do here. The routes will be redefined when we update - * the routing tree - */ - - return ORTE_SUCCESS; -} - -static int update_route(orte_process_name_t *target, - orte_process_name_t *route) -{ - if (target->jobid == ORTE_JOBID_INVALID || - target->vpid == ORTE_VPID_INVALID) { - return ORTE_ERR_BAD_PARAM; - } - - /* if I am an application process, we don't update the route since - * we automatically route everything through the local daemon - */ - if (ORTE_PROC_IS_APP) { - return ORTE_SUCCESS; - } - - OPAL_OUTPUT_VERBOSE((1, orte_routed_base_framework.framework_output, - "%s routed_debruijn_update: %s --> %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(target), - ORTE_NAME_PRINT(route))); - - - /* if I am a daemon and the target is my HNP, then check - * the route - if it isn't direct, then we just flag that - * we have a route to the HNP - */ - if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ORTE_PROC_MY_HNP, target) && - OPAL_EQUAL != orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ORTE_PROC_MY_HNP, route)) { - hnp_direct = false; - return ORTE_SUCCESS; - } - - return ORTE_SUCCESS; -} - -static inline unsigned int debruijn_next_hop (int target) -{ - const int my_id = ORTE_PROC_MY_NAME->vpid; - uint64_t route, mask = rank_mask; - unsigned int i, next_hop; - - if (target == my_id) { - return my_id; - } - - i = -log_npeers; - do { - i += log_npeers; - mask = (mask >> i) << i; - route = (my_id << i) | target; - } while ((route & mask) != (((my_id << i) & target) & mask)); - - next_hop = (int)((route >> (i - log_npeers)) & rank_mask); - - /* if the next hop does not exist route to the lowest proc with the same lower routing bits */ - return (next_hop < orte_process_info.num_procs) ? next_hop : (next_hop & (rank_mask >> log_npeers)); -} - -static orte_process_name_t get_route(orte_process_name_t *target) -{ - orte_process_name_t ret; - - /* initialize */ - - do { - ret = *ORTE_NAME_INVALID; - - if (ORTE_JOBID_INVALID == target->jobid || - ORTE_VPID_INVALID == target->vpid) { - break; - } - - /* if it is me, then the route is just direct */ - if (OPAL_EQUAL == opal_dss.compare(ORTE_PROC_MY_NAME, target, ORTE_NAME)) { - ret = *target; - break; - } - - /* if I am an application process, always route via my local daemon */ - if (ORTE_PROC_IS_APP) { - ret = *ORTE_PROC_MY_DAEMON; - break; - } - - /* if I am a tool, the route is direct if target is in - * my own job family, and to the target's HNP if not - */ - if (ORTE_PROC_IS_TOOL) { - if (ORTE_JOB_FAMILY(target->jobid) == ORTE_JOB_FAMILY(ORTE_PROC_MY_NAME->jobid)) { - ret = *target; - } else { - ORTE_HNP_NAME_FROM_JOB(&ret, target->jobid); - } - - break; - } - - /****** HNP AND DAEMONS ONLY ******/ - - if (OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, ORTE_PROC_MY_HNP, target)) { - if (!hnp_direct || orte_static_ports) { - OPAL_OUTPUT_VERBOSE((2, orte_routed_base_framework.framework_output, - "%s routing to the HNP through my parent %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(ORTE_PROC_MY_PARENT))); - ret = *ORTE_PROC_MY_PARENT; - } else { - OPAL_OUTPUT_VERBOSE((2, orte_routed_base_framework.framework_output, - "%s routing direct to the HNP", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); - ret = *ORTE_PROC_MY_HNP; - } - - break; - } - - ret.jobid = ORTE_PROC_MY_NAME->jobid; - /* find out what daemon hosts this proc */ - if (ORTE_VPID_INVALID == (ret.vpid = orte_get_proc_daemon_vpid(target))) { - /* we don't yet know about this daemon. just route this to the "parent" */ - ret = *ORTE_PROC_MY_PARENT; - break; - } - - /* if the daemon is me, then send direct to the target! */ - if (ORTE_PROC_MY_NAME->vpid == ret.vpid) { - ret = *target; - break; - } - - /* find next hop */ - ret.vpid = debruijn_next_hop (ret.vpid); - } while (0); - - OPAL_OUTPUT_VERBOSE((1, orte_routed_base_framework.framework_output, - "%s routed_debruijn_get(%s) --> %s", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(target), - ORTE_NAME_PRINT(&ret))); - - return ret; -} - -static int route_lost(const orte_process_name_t *route) -{ - opal_list_item_t *item; - orte_routed_tree_t *child; - - OPAL_OUTPUT_VERBOSE((2, orte_routed_base_framework.framework_output, - "%s route to %s lost", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(route))); - - /* if we lose the connection to the lifeline and we are NOT already, - * in finalize, tell the OOB to abort. - * NOTE: we cannot call abort from here as the OOB needs to first - * release a thread-lock - otherwise, we will hang!! - */ - if (!orte_finalizing && - NULL != lifeline && - OPAL_EQUAL == orte_util_compare_name_fields(ORTE_NS_CMP_ALL, route, lifeline)) { - OPAL_OUTPUT_VERBOSE((2, orte_routed_base_framework.framework_output, - "%s routed:debruijn: Connection to lifeline %s lost", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - ORTE_NAME_PRINT(lifeline))); - return ORTE_ERR_FATAL; - } - - /* if we are the HNP or daemon, and the route is a daemon, - * see if it is one of our children - if so, remove it - */ - if ((ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) && - route->jobid == ORTE_PROC_MY_NAME->jobid) { - for (item = opal_list_get_first(&my_children); - item != opal_list_get_end(&my_children); - item = opal_list_get_next(item)) { - child = (orte_routed_tree_t*)item; - if (child->vpid == route->vpid) { - opal_list_remove_item(&my_children, item); - OBJ_RELEASE(item); - return ORTE_SUCCESS; - } - } - } - - /* we don't care about this one, so return success */ - return ORTE_SUCCESS; -} - -static bool route_is_defined(const orte_process_name_t *target) -{ - /* find out what daemon hosts this proc */ - if (ORTE_VPID_INVALID == orte_get_proc_daemon_vpid((orte_process_name_t*)target)) { - return false; - } - - return true; -} - -static int set_lifeline(orte_process_name_t *proc) -{ - /* we have to copy the proc data because there is no - * guarantee that it will be preserved - */ - local_lifeline.jobid = proc->jobid; - local_lifeline.vpid = proc->vpid; - lifeline = &local_lifeline; - - return ORTE_SUCCESS; -} - -static unsigned int ilog2 (unsigned int v) -{ - const unsigned int b[] = {0x2, 0xC, 0xF0, 0xFF00, 0xFFFF0000}; - const unsigned int S[] = {1, 2, 4, 8, 16}; - int i; - - register unsigned int r = 0; - for (i = 4; i >= 0; i--) { - if (v & b[i]) { - v >>= S[i]; - r |= S[i]; - } - } - - return r; -} - -static void update_routing_plan(void) -{ - orte_routed_tree_t *child; - opal_list_item_t *item; - int my_vpid = ORTE_PROC_MY_NAME->vpid; - int i; - - /* if I am anything other than a daemon or the HNP, this - * is a meaningless command as I am not allowed to route - */ - if (!ORTE_PROC_IS_DAEMON && !ORTE_PROC_IS_HNP) { - return; - } - - /* clear the list of children if any are already present */ - while (NULL != (item = opal_list_remove_first(&my_children))) { - OBJ_RELEASE(item); - } - - log_nranks = (int) ilog2 ((unsigned int)orte_process_info.num_procs) ; - assert(log_nranks < 31); - - if (log_nranks < 3) { - log_npeers = 1; - } else if (log_nranks < 7) { - log_npeers = 2; - } else { - log_npeers = 4; - } - - /* round log_nranks to a multiple of log_npeers */ - log_nranks = ((log_nranks + log_npeers) & ~(log_npeers - 1)) - 1; - - rank_mask = (1 << (log_nranks + 1)) - 1; - - /* compute my parent */ - ORTE_PROC_MY_PARENT->vpid = my_vpid ? my_vpid >> log_npeers : -1; - - /* only add peers to the routing tree if this rank is the smallest rank that will send to - the any peer */ - if ((my_vpid >> (log_nranks + 1 - log_npeers)) == 0) { - for (i = (1 << log_npeers) - 1 ; i >= 0 ; --i) { - int next = ((my_vpid << log_npeers) | i) & rank_mask; - - /* add a peer to the routing tree only if its vpid is smaller than this rank */ - if (next > my_vpid && next < (int)orte_process_info.num_procs) { - child = OBJ_NEW(orte_routed_tree_t); - child->vpid = next; - opal_list_append (&my_children, &child->super); - } - } - } -} - -static void get_routing_list(opal_list_t *coll) -{ - /* if I am anything other than a daemon or the HNP, this - * is a meaningless command as I am not allowed to route - */ - if (!ORTE_PROC_IS_DAEMON && !ORTE_PROC_IS_HNP) { - return; - } - - orte_routed_base_xcast_routing(coll, &my_children); -} - -static size_t num_routes(void) -{ - return opal_list_get_size(&my_children); -} - -#if OPAL_ENABLE_FT_CR == 1 -static int debruijn_ft_event(int state) -{ - int ret, exit_status = ORTE_SUCCESS; - - /******** Checkpoint Prep ********/ - if(OPAL_CRS_CHECKPOINT == state) { - } - /******** Continue Recovery ********/ - else if (OPAL_CRS_CONTINUE == state ) { - } - else if (OPAL_CRS_TERM == state ) { - /* Nothing */ - } - else { - /* Error state = Nothing */ - } - - cleanup: - return exit_status; -} -#endif - diff --git a/orte/mca/routed/debruijn/routed_debruijn.h b/orte/mca/routed/debruijn/routed_debruijn.h deleted file mode 100644 index 303b1fa9b1f..00000000000 --- a/orte/mca/routed/debruijn/routed_debruijn.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2007-2012 Los Alamos National Security, LLC. - * All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#ifndef MCA_ROUTED_DEBRUIJN_H -#define MCA_ROUTED_DEBRUIJN_H - -#include "orte_config.h" - -#include "orte/mca/routed/routed.h" - -BEGIN_C_DECLS - -ORTE_MODULE_DECLSPEC extern orte_routed_component_t mca_routed_debruijn_component; - -extern orte_routed_module_t orte_routed_debruijn_module; - -END_C_DECLS - -#endif diff --git a/orte/mca/routed/debruijn/routed_debruijn_component.c b/orte/mca/routed/debruijn/routed_debruijn_component.c deleted file mode 100644 index c16d014c23c..00000000000 --- a/orte/mca/routed/debruijn/routed_debruijn_component.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ -/* - * Copyright (c) 2007-2015 Los Alamos National Security, LLC. - * All rights reserved. - * Copyright (c) 2004-2008 The Trustees of Indiana University. - * All rights reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. - * $COPYRIGHT$ - * - * Additional copyrights may follow - * - * $HEADER$ - */ - -#include "orte_config.h" -#include "orte/constants.h" - -#include "opal/mca/base/base.h" - -#include "orte/mca/routed/base/base.h" -#include "routed_debruijn.h" - -static int orte_routed_debruijn_component_query(mca_base_module_t **module, int *priority); - -/** - * component definition - */ -orte_routed_component_t mca_routed_debruijn_component = { - /* First, the mca_base_component_t struct containing meta - information about the component itself */ - - .base_version = { - ORTE_ROUTED_BASE_VERSION_3_0_0, - - .mca_component_name = "debruijn", - MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, - ORTE_RELEASE_VERSION), - .mca_query_component = orte_routed_debruijn_component_query - }, - .base_data = { - /* This component can be checkpointed */ - MCA_BASE_METADATA_PARAM_CHECKPOINT - }, -}; - -static int orte_routed_debruijn_component_query(mca_base_module_t **module, int *priority) -{ - /* Debruijn shall be our default, especially for large systems. For smaller - * systems, we will allow other options that have even fewer hops to - * support wireup - */ - *priority = 10; - *module = (mca_base_module_t *) &orte_routed_debruijn_module; - return ORTE_SUCCESS; -} From e07f1275764797a2b8920efbc819d651d157327a Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 4 Jun 2019 09:50:46 -0700 Subject: [PATCH 354/674] Ignore generated file Signed-off-by: Ralph Castain --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d40aac1e60f..50cddfeacb7 100644 --- a/.gitignore +++ b/.gitignore @@ -199,6 +199,8 @@ ompi/mca/rte/orte/mpirun.1 ompi/mca/sharedfp/addproc/mca_sharedfp_addproc_control +ompi/mca/topo/treematch/config.h + ompi/mpi/c/profile/p*.c ompi/mpi/fortran/configure-fortran-output.h From e6e09c6cbac3a051e28865c206e1190ab241c202 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Thu, 30 May 2019 17:20:30 -0400 Subject: [PATCH 355/674] shmem/c: Fix shmem type for calls to shmem_test and shmem_wait_until with [u]int32_t and [u]int64_t Signed-off-by: Scott Miller (cherry picked from commit ca59cabc679ebdf1decdcf75f3da0766b35a34f7) --- oshmem/shmem/c/shmem_wait.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/oshmem/shmem/c/shmem_wait.c b/oshmem/shmem/c/shmem_wait.c index 1c94dd2c106..32d0f53c4ba 100644 --- a/oshmem/shmem/c/shmem_wait.c +++ b/oshmem/shmem/c/shmem_wait.c @@ -1,6 +1,7 @@ /* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -117,10 +118,10 @@ SHMEM_TYPE_WAIT_UNTIL(_ushort, volatile unsigned short, SHMEM_SHORT, shmem) SHMEM_TYPE_WAIT_UNTIL(_uint, volatile unsigned int, SHMEM_INT, shmem) SHMEM_TYPE_WAIT_UNTIL(_ulong, volatile unsigned long, SHMEM_LONG, shmem) SHMEM_TYPE_WAIT_UNTIL(_ulonglong, volatile unsigned long long, SHMEM_LLONG, shmem) -SHMEM_TYPE_WAIT_UNTIL(_int32, volatile int32_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_WAIT_UNTIL(_int64, volatile int64_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_WAIT_UNTIL(_uint32, volatile uint32_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_WAIT_UNTIL(_uint64, volatile uint64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_WAIT_UNTIL(_int32, volatile int32_t, SHMEM_INT32_T, shmem) +SHMEM_TYPE_WAIT_UNTIL(_int64, volatile int64_t, SHMEM_INT64_T, shmem) +SHMEM_TYPE_WAIT_UNTIL(_uint32, volatile uint32_t, SHMEM_INT32_T, shmem) +SHMEM_TYPE_WAIT_UNTIL(_uint64, volatile uint64_t, SHMEM_INT64_T, shmem) SHMEM_TYPE_WAIT_UNTIL(_size, volatile size_t, SHMEM_LLONG, shmem) SHMEM_TYPE_WAIT_UNTIL(_ptrdiff, volatile ptrdiff_t, SHMEM_LLONG, shmem) @@ -153,9 +154,9 @@ SHMEM_TYPE_TEST(_ushort, volatile unsigned short, SHMEM_SHORT, shmem) SHMEM_TYPE_TEST(_uint, volatile unsigned int, SHMEM_INT, shmem) SHMEM_TYPE_TEST(_ulong, volatile unsigned long, SHMEM_LONG, shmem) SHMEM_TYPE_TEST(_ulonglong, volatile unsigned long long, SHMEM_LLONG, shmem) -SHMEM_TYPE_TEST(_int32, volatile int32_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_TEST(_int64, volatile int64_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_TEST(_uint32, volatile uint32_t, SHMEM_LLONG, shmem) -SHMEM_TYPE_TEST(_uint64, volatile uint64_t, SHMEM_LLONG, shmem) +SHMEM_TYPE_TEST(_int32, volatile int32_t, SHMEM_INT32_T, shmem) +SHMEM_TYPE_TEST(_int64, volatile int64_t, SHMEM_INT64_T, shmem) +SHMEM_TYPE_TEST(_uint32, volatile uint32_t, SHMEM_INT32_T, shmem) +SHMEM_TYPE_TEST(_uint64, volatile uint64_t, SHMEM_INT64_T, shmem) SHMEM_TYPE_TEST(_size, volatile size_t, SHMEM_LLONG, shmem) SHMEM_TYPE_TEST(_ptrdiff, volatile ptrdiff_t, SHMEM_LLONG, shmem) From 5acaf006ae54db3c492812acc788a56ec1c0dc99 Mon Sep 17 00:00:00 2001 From: perrynzhou Date: Wed, 5 Jun 2019 14:51:57 +0900 Subject: [PATCH 356/674] regx/base: fix an integer overflow use strtol() instead of atoi() in order to handle hostnames containing a large number. This is a one-off commit for the release branches since the regx framework has already been removed from master. Refs. open-mpi/ompi#6729 Signed-off-by: perrynzhou --- orte/mca/regx/base/regx_base_default_fns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orte/mca/regx/base/regx_base_default_fns.c b/orte/mca/regx/base/regx_base_default_fns.c index 6b70f78cad0..4e1645d16b5 100644 --- a/orte/mca/regx/base/regx_base_default_fns.c +++ b/orte/mca/regx/base/regx_base_default_fns.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science + * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -1056,7 +1056,7 @@ static int regex_parse_node_range(char *base, char *range, int num_digits, char for (found = false, i = 0; i < len; ++i) { if (isdigit((int) range[i])) { if (!found) { - start = atoi(range + i); + start = strtol(range + i, NULL, 10); found = true; break; } From 5dd8830dcabce1094ff40d8e4d54d8397bf0b935 Mon Sep 17 00:00:00 2001 From: Tsubasa Yanagibashi Date: Fri, 31 May 2019 13:45:02 +0900 Subject: [PATCH 357/674] mpiext/pcollreq: Add `_f08` to procedure names The procedure names don't contain "_f08" of Fortran 2008 bindings of Persistent Collective Operations(mpiext/pcollreq/use-mpi-f08). This fix adds "_f08" to the procedure names of pcollreq/use-mpi-f08, same as other Fortran 2008 routines in `ompi/mpi/fortran/use-mpi-f08/mod`. Signed-off-by: Tsubasa Yanagibashi (cherry picked from commit 3148b0cfaa04843e7219acb8c7e04f43f6d219fe) --- .../use-mpi-f08/mpiext_pcollreq_usempif08.h | 340 +++++++++--------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h b/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h index 9377c441262..33e3556cce7 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h +++ b/ompi/mpiext/pcollreq/use-mpi-f08/mpiext_pcollreq_usempif08.h @@ -22,9 +22,9 @@ ! replicated here. interface mpix_allgather_init - subroutine mpix_allgather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine mpix_allgather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -40,13 +40,13 @@ interface mpix_allgather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_allgather_init + end subroutine mpix_allgather_init_f08 end interface mpix_allgather_init interface mpix_allgatherv_init - subroutine mpix_allgatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, & - comm, info, request, ierror) + subroutine mpix_allgatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -63,13 +63,13 @@ interface mpix_allgatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_allgatherv_init + end subroutine mpix_allgatherv_init_f08 end interface mpix_allgatherv_init interface mpix_allreduce_init - subroutine mpix_allreduce_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine mpix_allreduce_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -86,13 +86,13 @@ interface mpix_allreduce_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_allreduce_init + end subroutine mpix_allreduce_init_f08 end interface mpix_allreduce_init interface mpix_alltoall_init - subroutine mpix_alltoall_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine mpix_alltoall_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -108,13 +108,13 @@ interface mpix_alltoall_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_alltoall_init + end subroutine mpix_alltoall_init_f08 end interface mpix_alltoall_init interface mpix_alltoallv_init - subroutine mpix_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, & - recvbuf, recvcounts, rdispls, recvtype, & - comm, info, request, ierror) + subroutine mpix_alltoallv_init_f08(sendbuf, sendcounts, sdispls, sendtype, & + recvbuf, recvcounts, rdispls, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -130,13 +130,13 @@ interface mpix_alltoallv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_alltoallv_init + end subroutine mpix_alltoallv_init_f08 end interface mpix_alltoallv_init interface mpix_alltoallw_init - subroutine mpix_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, & - recvbuf, recvcounts, rdispls, recvtypes, & - comm, info, request, ierror) + subroutine mpix_alltoallw_init_f08(sendbuf, sendcounts, sdispls, sendtypes, & + recvbuf, recvcounts, rdispls, recvtypes, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -152,23 +152,23 @@ interface mpix_alltoallw_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_alltoallw_init + end subroutine mpix_alltoallw_init_f08 end interface mpix_alltoallw_init interface mpix_barrier_init - subroutine mpix_barrier_init(comm, info, request, ierror) + subroutine mpix_barrier_init_f08(comm, info, request, ierror) use :: mpi_f08_types, only : mpi_comm, mpi_info, mpi_request implicit none type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_barrier_init + end subroutine mpix_barrier_init_f08 end interface mpix_barrier_init interface mpix_bcast_init - subroutine mpix_bcast_init(buffer, count, datatype, root, & - comm, info, request, ierror) + subroutine mpix_bcast_init_f08(buffer, count, datatype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: buffer @@ -183,13 +183,13 @@ interface mpix_bcast_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_bcast_init + end subroutine mpix_bcast_init_f08 end interface mpix_bcast_init interface mpix_exscan_init - subroutine mpix_exscan_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine mpix_exscan_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -206,13 +206,13 @@ interface mpix_exscan_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_exscan_init + end subroutine mpix_exscan_init_f08 end interface mpix_exscan_init interface mpix_gather_init - subroutine mpix_gather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine mpix_gather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -228,13 +228,13 @@ interface mpix_gather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_gather_init + end subroutine mpix_gather_init_f08 end interface mpix_gather_init interface mpix_gatherv_init - subroutine mpix_gatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, root, & - comm, info, request, ierror) + subroutine mpix_gatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -251,13 +251,13 @@ interface mpix_gatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_gatherv_init + end subroutine mpix_gatherv_init_f08 end interface mpix_gatherv_init interface mpix_reduce_init - subroutine mpix_reduce_init(sendbuf, recvbuf, count, & - datatype, op, root, & - comm, info, request, ierror) + subroutine mpix_reduce_init_f08(sendbuf, recvbuf, count, & + datatype, op, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -274,13 +274,13 @@ interface mpix_reduce_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_reduce_init + end subroutine mpix_reduce_init_f08 end interface mpix_reduce_init interface mpix_reduce_scatter_init - subroutine mpix_reduce_scatter_init(sendbuf, recvbuf, recvcounts, & - datatype, op, & - comm, info, request, ierror) + subroutine mpix_reduce_scatter_init_f08(sendbuf, recvbuf, recvcounts, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -297,13 +297,13 @@ interface mpix_reduce_scatter_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_reduce_scatter_init + end subroutine mpix_reduce_scatter_init_f08 end interface mpix_reduce_scatter_init interface mpix_reduce_scatter_block_init - subroutine mpix_reduce_scatter_block_init(sendbuf, recvbuf, recvcount, & - datatype, op, & - comm, info, request, ierror) + subroutine mpix_reduce_scatter_block_init_f08(sendbuf, recvbuf, recvcount, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -320,13 +320,13 @@ interface mpix_reduce_scatter_block_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_reduce_scatter_block_init + end subroutine mpix_reduce_scatter_block_init_f08 end interface mpix_reduce_scatter_block_init interface mpix_scan_init - subroutine mpix_scan_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine mpix_scan_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -343,13 +343,13 @@ interface mpix_scan_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_scan_init + end subroutine mpix_scan_init_f08 end interface mpix_scan_init interface mpix_scatter_init - subroutine mpix_scatter_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine mpix_scatter_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -365,13 +365,13 @@ interface mpix_scatter_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_scatter_init + end subroutine mpix_scatter_init_f08 end interface mpix_scatter_init interface mpix_scatterv_init - subroutine mpix_scatterv_init(sendbuf, sendcounts, displs, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine mpix_scatterv_init_f08(sendbuf, sendcounts, displs, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -388,13 +388,13 @@ interface mpix_scatterv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_scatterv_init + end subroutine mpix_scatterv_init_f08 end interface mpix_scatterv_init interface mpix_neighbor_allgather_init - subroutine mpix_neighbor_allgather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine mpix_neighbor_allgather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -410,13 +410,13 @@ interface mpix_neighbor_allgather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_neighbor_allgather_init + end subroutine mpix_neighbor_allgather_init_f08 end interface mpix_neighbor_allgather_init interface mpix_neighbor_allgatherv_init - subroutine mpix_neighbor_allgatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, & - comm, info, request, ierror) + subroutine mpix_neighbor_allgatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -433,13 +433,13 @@ interface mpix_neighbor_allgatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_neighbor_allgatherv_init + end subroutine mpix_neighbor_allgatherv_init_f08 end interface mpix_neighbor_allgatherv_init interface mpix_neighbor_alltoall_init - subroutine mpix_neighbor_alltoall_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine mpix_neighbor_alltoall_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -455,13 +455,13 @@ interface mpix_neighbor_alltoall_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_neighbor_alltoall_init + end subroutine mpix_neighbor_alltoall_init_f08 end interface mpix_neighbor_alltoall_init interface mpix_neighbor_alltoallv_init - subroutine mpix_neighbor_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, & - recvbuf, recvcounts, rdispls, recvtype, & - comm, info, request, ierror) + subroutine mpix_neighbor_alltoallv_init_f08(sendbuf, sendcounts, sdispls, sendtype, & + recvbuf, recvcounts, rdispls, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -477,13 +477,13 @@ interface mpix_neighbor_alltoallv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_neighbor_alltoallv_init + end subroutine mpix_neighbor_alltoallv_init_f08 end interface mpix_neighbor_alltoallv_init interface mpix_neighbor_alltoallw_init - subroutine mpix_neighbor_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, & - recvbuf, recvcounts, rdispls, recvtypes, & - comm, info, request, ierror) + subroutine mpix_neighbor_alltoallw_init_f08(sendbuf, sendcounts, sdispls, sendtypes, & + recvbuf, recvcounts, rdispls, recvtypes, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_address_kind, mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -500,13 +500,13 @@ interface mpix_neighbor_alltoallw_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine mpix_neighbor_alltoallw_init + end subroutine mpix_neighbor_alltoallw_init_f08 end interface mpix_neighbor_alltoallw_init interface pmpix_allgather_init - subroutine pmpix_allgather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine pmpix_allgather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -522,13 +522,13 @@ interface pmpix_allgather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_allgather_init + end subroutine pmpix_allgather_init_f08 end interface pmpix_allgather_init interface pmpix_allgatherv_init - subroutine pmpix_allgatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, & - comm, info, request, ierror) + subroutine pmpix_allgatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -545,13 +545,13 @@ interface pmpix_allgatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_allgatherv_init + end subroutine pmpix_allgatherv_init_f08 end interface pmpix_allgatherv_init interface pmpix_allreduce_init - subroutine pmpix_allreduce_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine pmpix_allreduce_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -568,13 +568,13 @@ interface pmpix_allreduce_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_allreduce_init + end subroutine pmpix_allreduce_init_f08 end interface pmpix_allreduce_init interface pmpix_alltoall_init - subroutine pmpix_alltoall_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine pmpix_alltoall_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -590,13 +590,13 @@ interface pmpix_alltoall_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_alltoall_init + end subroutine pmpix_alltoall_init_f08 end interface pmpix_alltoall_init interface pmpix_alltoallv_init - subroutine pmpix_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, & - recvbuf, recvcounts, rdispls, recvtype, & - comm, info, request, ierror) + subroutine pmpix_alltoallv_init_f08(sendbuf, sendcounts, sdispls, sendtype, & + recvbuf, recvcounts, rdispls, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -612,13 +612,13 @@ interface pmpix_alltoallv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_alltoallv_init + end subroutine pmpix_alltoallv_init_f08 end interface pmpix_alltoallv_init interface pmpix_alltoallw_init - subroutine pmpix_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, & - recvbuf, recvcounts, rdispls, recvtypes, & - comm, info, request, ierror) + subroutine pmpix_alltoallw_init_f08(sendbuf, sendcounts, sdispls, sendtypes, & + recvbuf, recvcounts, rdispls, recvtypes, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -634,23 +634,23 @@ interface pmpix_alltoallw_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_alltoallw_init + end subroutine pmpix_alltoallw_init_f08 end interface pmpix_alltoallw_init interface pmpix_barrier_init - subroutine pmpix_barrier_init(comm, info, request, ierror) + subroutine pmpix_barrier_init_f08(comm, info, request, ierror) use :: mpi_f08_types, only : mpi_comm, mpi_info, mpi_request implicit none type(mpi_comm), intent(in) :: comm type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_barrier_init + end subroutine pmpix_barrier_init_f08 end interface pmpix_barrier_init interface pmpix_bcast_init - subroutine pmpix_bcast_init(buffer, count, datatype, root, & - comm, info, request, ierror) + subroutine pmpix_bcast_init_f08(buffer, count, datatype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: buffer @@ -665,13 +665,13 @@ interface pmpix_bcast_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_bcast_init + end subroutine pmpix_bcast_init_f08 end interface pmpix_bcast_init interface pmpix_exscan_init - subroutine pmpix_exscan_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine pmpix_exscan_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -688,13 +688,13 @@ interface pmpix_exscan_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_exscan_init + end subroutine pmpix_exscan_init_f08 end interface pmpix_exscan_init interface pmpix_gather_init - subroutine pmpix_gather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine pmpix_gather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -710,13 +710,13 @@ interface pmpix_gather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_gather_init + end subroutine pmpix_gather_init_f08 end interface pmpix_gather_init interface pmpix_gatherv_init - subroutine pmpix_gatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, root, & - comm, info, request, ierror) + subroutine pmpix_gatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -733,13 +733,13 @@ interface pmpix_gatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_gatherv_init + end subroutine pmpix_gatherv_init_f08 end interface pmpix_gatherv_init interface pmpix_reduce_init - subroutine pmpix_reduce_init(sendbuf, recvbuf, count, & - datatype, op, root, & - comm, info, request, ierror) + subroutine pmpix_reduce_init_f08(sendbuf, recvbuf, count, & + datatype, op, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -756,13 +756,13 @@ interface pmpix_reduce_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_reduce_init + end subroutine pmpix_reduce_init_f08 end interface pmpix_reduce_init interface pmpix_reduce_scatter_init - subroutine pmpix_reduce_scatter_init(sendbuf, recvbuf, recvcounts, & - datatype, op, & - comm, info, request, ierror) + subroutine pmpix_reduce_scatter_init_f08(sendbuf, recvbuf, recvcounts, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -779,13 +779,13 @@ interface pmpix_reduce_scatter_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_reduce_scatter_init + end subroutine pmpix_reduce_scatter_init_f08 end interface pmpix_reduce_scatter_init interface pmpix_reduce_scatter_block_init - subroutine pmpix_reduce_scatter_block_init(sendbuf, recvbuf, recvcount, & - datatype, op, & - comm, info, request, ierror) + subroutine pmpix_reduce_scatter_block_init_f08(sendbuf, recvbuf, recvcount, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -802,13 +802,13 @@ interface pmpix_reduce_scatter_block_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_reduce_scatter_block_init + end subroutine pmpix_reduce_scatter_block_init_f08 end interface pmpix_reduce_scatter_block_init interface pmpix_scan_init - subroutine pmpix_scan_init(sendbuf, recvbuf, count, & - datatype, op, & - comm, info, request, ierror) + subroutine pmpix_scan_init_f08(sendbuf, recvbuf, count, & + datatype, op, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_op, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -825,13 +825,13 @@ interface pmpix_scan_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_scan_init + end subroutine pmpix_scan_init_f08 end interface pmpix_scan_init interface pmpix_scatter_init - subroutine pmpix_scatter_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine pmpix_scatter_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -847,13 +847,13 @@ interface pmpix_scatter_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_scatter_init + end subroutine pmpix_scatter_init_f08 end interface pmpix_scatter_init interface pmpix_scatterv_init - subroutine pmpix_scatterv_init(sendbuf, sendcounts, displs, sendtype, & - recvbuf, recvcount, recvtype, root, & - comm, info, request, ierror) + subroutine pmpix_scatterv_init_f08(sendbuf, sendcounts, displs, sendtype, & + recvbuf, recvcount, recvtype, root, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -870,13 +870,13 @@ interface pmpix_scatterv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_scatterv_init + end subroutine pmpix_scatterv_init_f08 end interface pmpix_scatterv_init interface pmpix_neighbor_allgather_init - subroutine pmpix_neighbor_allgather_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine pmpix_neighbor_allgather_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -892,13 +892,13 @@ interface pmpix_neighbor_allgather_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_neighbor_allgather_init + end subroutine pmpix_neighbor_allgather_init_f08 end interface pmpix_neighbor_allgather_init interface pmpix_neighbor_allgatherv_init - subroutine pmpix_neighbor_allgatherv_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcounts, displs, recvtype, & - comm, info, request, ierror) + subroutine pmpix_neighbor_allgatherv_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcounts, displs, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -915,13 +915,13 @@ interface pmpix_neighbor_allgatherv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_neighbor_allgatherv_init + end subroutine pmpix_neighbor_allgatherv_init_f08 end interface pmpix_neighbor_allgatherv_init interface pmpix_neighbor_alltoall_init - subroutine pmpix_neighbor_alltoall_init(sendbuf, sendcount, sendtype, & - recvbuf, recvcount, recvtype, & - comm, info, request, ierror) + subroutine pmpix_neighbor_alltoall_init_f08(sendbuf, sendcount, sendtype, & + recvbuf, recvcount, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -937,13 +937,13 @@ interface pmpix_neighbor_alltoall_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_neighbor_alltoall_init + end subroutine pmpix_neighbor_alltoall_init_f08 end interface pmpix_neighbor_alltoall_init interface pmpix_neighbor_alltoallv_init - subroutine pmpix_neighbor_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, & - recvbuf, recvcounts, rdispls, recvtype, & - comm, info, request, ierror) + subroutine pmpix_neighbor_alltoallv_init_f08(sendbuf, sendcounts, sdispls, sendtype, & + recvbuf, recvcounts, rdispls, recvtype, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -959,13 +959,13 @@ interface pmpix_neighbor_alltoallv_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_neighbor_alltoallv_init + end subroutine pmpix_neighbor_alltoallv_init_f08 end interface pmpix_neighbor_alltoallv_init interface pmpix_neighbor_alltoallw_init - subroutine pmpix_neighbor_alltoallw_init(sendbuf, sendcounts, sdispls, sendtypes, & - recvbuf, recvcounts, rdispls, recvtypes, & - comm, info, request, ierror) + subroutine pmpix_neighbor_alltoallw_init_f08(sendbuf, sendcounts, sdispls, sendtypes, & + recvbuf, recvcounts, rdispls, recvtypes, & + comm, info, request, ierror) use :: mpi_f08_types, only : mpi_address_kind, mpi_datatype, mpi_comm, mpi_info, mpi_request implicit none !DEC$ ATTRIBUTES NO_ARG_CHECK :: sendbuf, recvbuf @@ -982,5 +982,5 @@ interface pmpix_neighbor_alltoallw_init type(mpi_info), intent(in) :: info type(mpi_request), intent(out) :: request integer, optional, intent(out) :: ierror - end subroutine pmpix_neighbor_alltoallw_init + end subroutine pmpix_neighbor_alltoallw_init_f08 end interface pmpix_neighbor_alltoallw_init From 900f0fa21fd37f17c2592ba2f3303fae496c2aa4 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Fri, 10 May 2019 14:32:27 +0200 Subject: [PATCH 358/674] OSC rdma: make sure accumulating in shared memory is safe Signed-off-by: Joseph Schuchart (cherry picked from commit c67e2291937a09947c421dc84c6b3a8d07bec07f) --- ompi/mca/osc/rdma/osc_rdma.h | 3 +++ ompi/mca/osc/rdma/osc_rdma_accumulate.c | 13 +++++++++++-- ompi/mca/osc/rdma/osc_rdma_component.c | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma.h b/ompi/mca/osc/rdma/osc_rdma.h index b3743f261ec..6aed111ddf0 100644 --- a/ompi/mca/osc/rdma/osc_rdma.h +++ b/ompi/mca/osc/rdma/osc_rdma.h @@ -145,6 +145,9 @@ struct ompi_osc_rdma_module_t { bool acc_use_amo; + /** whether the group is located on a single node */ + bool single_node; + /** flavor of this window */ int flavor; diff --git a/ompi/mca/osc/rdma/osc_rdma_accumulate.c b/ompi/mca/osc/rdma/osc_rdma_accumulate.c index 31c3fc29bef..7fa896e96c6 100644 --- a/ompi/mca/osc/rdma/osc_rdma_accumulate.c +++ b/ompi/mca/osc/rdma/osc_rdma_accumulate.c @@ -889,10 +889,19 @@ int ompi_osc_rdma_rget_accumulate_internal (ompi_osc_rdma_sync_t *sync, const vo (void) ompi_osc_rdma_lock_acquire_exclusive (module, peer, offsetof (ompi_osc_rdma_state_t, accumulate_lock)); } + /* accumulate in (shared) memory if there is only a single node + * OR if we have an exclusive lock + * OR if other processes won't try to use the network either */ + bool use_shared_mem = module->single_node || + (ompi_osc_rdma_peer_local_base (peer) && + (ompi_osc_rdma_peer_is_exclusive (peer) || + !module->acc_single_intrinsic)); + /* if the datatype is small enough (and the count is 1) then try to directly use the hardware to execute * the atomic operation. this should be safe in all cases as either 1) the user has assured us they will - * never use atomics with count > 1, 2) we have the accumulate lock, or 3) we have an exclusive lock */ - if (origin_extent <= 8 && 1 == origin_count && !ompi_osc_rdma_peer_local_base (peer)) { + * never use atomics with count > 1, 2) we have the accumulate lock, or 3) we have an exclusive lock. + * avoid using the NIC if the operation can be done directly in shared memory. */ + if (origin_extent <= 8 && 1 == origin_count && !use_shared_mem) { if (module->acc_use_amo && ompi_datatype_is_predefined (origin_datatype)) { if (NULL == result_addr) { ret = ompi_osc_rdma_acc_single_atomic (sync, origin_addr, origin_datatype, origin_extent, peer, target_address, diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index a39c83273a3..3dea0f94c1d 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -543,7 +543,8 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s local_size = ompi_comm_size (shared_comm); /* CPU atomics can be used if every process is on the same node or the NIC allows mixing CPU and NIC atomics */ - module->use_cpu_atomics = local_size == global_size || (module->selected_btl->btl_flags & MCA_BTL_ATOMIC_SUPPORTS_GLOB); + module->single_node = local_size == global_size; + module->use_cpu_atomics = module->single_node || (module->selected_btl->btl_flags & MCA_BTL_ATOMIC_SUPPORTS_GLOB); if (1 == local_size) { /* no point using a shared segment if there are no other processes on this node */ From b5428aaf719446a0c046113aaa1bf827e9eff867 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Wed, 15 May 2019 20:17:29 -0700 Subject: [PATCH 359/674] btl/uct: add support for UCX 1.6.x This commit updates the uct btl to support the v1.6.x release of UCX. This release breaks API. Signed-off-by: Nathan Hjelm (cherry picked from commit b78066720c3e3299bd76f2e22d2c0e415db572fc) Signed-off-by: Geoffrey Paulsen --- opal/mca/btl/uct/btl_uct_endpoint.c | 34 ++++++++++++++++++++++++----- opal/mca/btl/uct/btl_uct_tl.c | 10 +++++++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct_endpoint.c b/opal/mca/btl/uct/btl_uct_endpoint.c index 40349673e27..ccdbd4511a2 100644 --- a/opal/mca/btl/uct/btl_uct_endpoint.c +++ b/opal/mca/btl/uct/btl_uct_endpoint.c @@ -4,6 +4,7 @@ * reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -101,6 +102,28 @@ static void mca_btl_uct_process_modex (mca_btl_uct_module_t *uct_btl, unsigned c } } +static inline ucs_status_t mca_btl_uct_ep_create_connected_compat (uct_iface_h iface, uct_device_addr_t *device_addr, + uct_iface_addr_t *iface_addr, uct_ep_h *uct_ep) +{ +#if UCT_API >= UCT_VERSION(1, 6) + uct_ep_params_t ep_params = {.field_mask = UCT_EP_PARAM_FIELD_IFACE | UCT_EP_PARAM_FIELD_DEV_ADDR | UCT_EP_PARAM_FIELD_IFACE_ADDR, + .iface = iface, .dev_addr = device_addr, .iface_addr = iface_addr}; + return uct_ep_create (&ep_params, uct_ep); +#else + return uct_ep_create_connected (iface, device_addr, iface_addr, uct_ep); +#endif +} + +static inline ucs_status_t mca_btl_uct_ep_create_compat (uct_iface_h iface, uct_ep_h *uct_ep) +{ +#if UCT_API >= UCT_VERSION(1, 6) + uct_ep_params_t ep_params = {.field_mask = UCT_EP_PARAM_FIELD_IFACE, .iface = iface}; + return uct_ep_create (&ep_params, uct_ep); +#else + return uct_ep_create (iface, uct_ep); +#endif +} + static int mca_btl_uct_endpoint_connect_iface (mca_btl_uct_module_t *uct_btl, mca_btl_uct_tl_t *tl, mca_btl_uct_device_context_t *tl_context, mca_btl_uct_tl_endpoint_t *tl_endpoint, uint8_t *tl_data) @@ -116,7 +139,7 @@ static int mca_btl_uct_endpoint_connect_iface (mca_btl_uct_module_t *uct_btl, mc BTL_VERBOSE(("connecting endpoint to interface")); mca_btl_uct_context_lock (tl_context); - ucs_status = uct_ep_create_connected (tl_context->uct_iface, device_addr, iface_addr, &tl_endpoint->uct_ep); + ucs_status = mca_btl_uct_ep_create_connected_compat (tl_context->uct_iface, device_addr, iface_addr, &tl_endpoint->uct_ep); tl_endpoint->flags = MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY; mca_btl_uct_context_unlock (tl_context); @@ -240,8 +263,8 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, /* create a temporary endpoint for setting up the rdma endpoint */ MCA_BTL_UCT_CONTEXT_SERIALIZE(conn_tl_context, { - ucs_status = uct_ep_create_connected (conn_tl_context->uct_iface, device_addr, iface_addr, - &conn_ep->uct_ep); + ucs_status = mca_btl_uct_ep_create_connected_compat (conn_tl_context->uct_iface, device_addr, iface_addr, + &conn_ep->uct_ep); }); if (UCS_OK != ucs_status) { BTL_VERBOSE(("could not create an endpoint for forming connection to remote peer. code = %d", @@ -263,7 +286,7 @@ static int mca_btl_uct_endpoint_connect_endpoint (mca_btl_uct_module_t *uct_btl, opal_process_name_print (endpoint->ep_proc->proc_name))); MCA_BTL_UCT_CONTEXT_SERIALIZE(tl_context, { - ucs_status = uct_ep_create (tl_context->uct_iface, &tl_endpoint->uct_ep); + ucs_status = mca_btl_uct_ep_create_compat (tl_context->uct_iface, &tl_endpoint->uct_ep); }); if (UCS_OK != ucs_status) { OBJ_RELEASE(endpoint->conn_ep); @@ -309,7 +332,8 @@ int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t *uct_btl, mca_btl_uct_end void *ep_addr, int tl_index) { mca_btl_uct_tl_endpoint_t *tl_endpoint = endpoint->uct_eps[context_id] + tl_index; - mca_btl_uct_tl_t *tl = (tl_index == uct_btl->rdma_tl->tl_index) ? uct_btl->rdma_tl : uct_btl->am_tl; + mca_btl_uct_tl_t *tl = (uct_btl->rdma_tl && tl_index == uct_btl->rdma_tl->tl_index) ? + uct_btl->rdma_tl : uct_btl->am_tl; mca_btl_uct_device_context_t *tl_context = mca_btl_uct_module_get_tl_context_specific (uct_btl, tl, context_id); uint8_t *rdma_tl_data = NULL, *conn_tl_data = NULL, *am_tl_data = NULL, *tl_data; mca_btl_uct_connection_ep_t *conn_ep = NULL; diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index be70af6ec8b..a711a41ce99 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -6,6 +6,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -270,10 +271,18 @@ static void mca_btl_uct_context_enable_progress (mca_btl_uct_device_context_t *c mca_btl_uct_device_context_t *mca_btl_uct_context_create (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl, int context_id, bool enable_progress) { +#if UCT_API >= UCT_VERSION(1, 6) + uct_iface_params_t iface_params = {.field_mask = UCT_IFACE_PARAM_FIELD_OPEN_MODE | + UCT_IFACE_PARAM_FIELD_DEVICE, + .open_mode = UCT_IFACE_OPEN_MODE_DEVICE, + .mode = {.device = {.tl_name = tl->uct_tl_name, + .dev_name = tl->uct_dev_name}}}; +#else uct_iface_params_t iface_params = {.rndv_cb = NULL, .eager_cb = NULL, .stats_root = NULL, .rx_headroom = 0, .open_mode = UCT_IFACE_OPEN_MODE_DEVICE, .mode = {.device = {.tl_name = tl->uct_tl_name, .dev_name = tl->uct_dev_name}}}; +#endif mca_btl_uct_device_context_t *context; ucs_status_t ucs_status; int rc; @@ -610,6 +619,7 @@ int mca_btl_uct_query_tls (mca_btl_uct_module_t *module, mca_btl_uct_md_t *md, u /* no rdma tls */ BTL_VERBOSE(("no rdma tl matched supplied filter. disabling RDMA support")); + module->super.btl_flags &= ~MCA_BTL_FLAGS_RDMA; module->super.btl_put = NULL; module->super.btl_get = NULL; module->super.btl_atomic_fop = NULL; From adba7f55f78575d0f8f1fbb38b6d0b22e32b7335 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Thu, 6 Jun 2019 19:22:00 +0300 Subject: [PATCH 360/674] COLL/BASE: Fix linear sync all2all Signed-off-by: Mikhail Brinskii (cherry picked from commit 79006f4e5a578d32bfa08de7b98e747ae18706f6) --- ompi/mca/coll/base/coll_base_alltoall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_alltoall.c b/ompi/mca/coll/base/coll_base_alltoall.c index 3509ed36414..3f1bdc5fb58 100644 --- a/ompi/mca/coll/base/coll_base_alltoall.c +++ b/ompi/mca/coll/base/coll_base_alltoall.c @@ -398,22 +398,22 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount, prcv = (char *) rbuf; psnd = (char *) sbuf; - /* Post first batch or ireceive and isend requests */ + /* Post first batch of irecv and isend requests */ for (nreqs = 0, nrreqs = 0, ri = (rank + 1) % size; nreqs < total_reqs; ri = (ri + 1) % size, ++nrreqs) { - nreqs++; error = MCA_PML_CALL(irecv (prcv + (ptrdiff_t)ri * rext, rcount, rdtype, ri, MCA_COLL_BASE_TAG_ALLTOALL, comm, &reqs[nreqs])); + nreqs++; if (MPI_SUCCESS != error) { line = __LINE__; goto error_hndl; } } for (nsreqs = 0, si = (rank + size - 1) % size; nreqs < 2 * total_reqs; - si = (si + size - 1) % size, ++nsreqs) { - nreqs++; + si = (si + size - 1) % size, ++nsreqs) { error = MCA_PML_CALL(isend (psnd + (ptrdiff_t)si * sext, scount, sdtype, si, MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, &reqs[nreqs])); + nreqs++; if (MPI_SUCCESS != error) { line = __LINE__; goto error_hndl; } } From 05fa5845bc26b1aa7b214a172080c00095092e7a Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 18 Jun 2019 21:14:04 -0700 Subject: [PATCH 361/674] Fix finalize of flux component Per patches from @SteVwonder and @garlick Signed-off-by: Ralph Castain (cherry picked from commit d4070d5f58f0c65aef89eea5910b202b8402e48b) --- opal/mca/pmix/flux/pmix_flux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opal/mca/pmix/flux/pmix_flux.c b/opal/mca/pmix/flux/pmix_flux.c index 187108bcc7d..3233524e0fe 100644 --- a/opal/mca/pmix/flux/pmix_flux.c +++ b/opal/mca/pmix/flux/pmix_flux.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -373,6 +373,7 @@ static int flux_init(opal_list_t *ilist) char *str; if (0 < pmix_init_count) { + pmix_init_count++; return OPAL_SUCCESS; } @@ -585,11 +586,10 @@ static int flux_fini(void) { if (0 == --pmix_init_count) { PMI_Finalize (); + // teardown hash table + opal_pmix_base_hash_finalize(); } - // teardown hash table - opal_pmix_base_hash_finalize(); - return OPAL_SUCCESS; } From c5cf3432b987fe51a4b906f8c0edb0ac9ef59a90 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Wed, 5 Jun 2019 14:18:38 +0200 Subject: [PATCH 362/674] OSC rdma win allocate: synchronize error codes across shared memory group Signed-off-by: Joseph Schuchart (cherry picked from commit 8f27cc26d9845b5b207979b2a4621ef1089d1afb) --- ompi/mca/osc/rdma/osc_rdma_component.c | 91 +++++++++++++++----------- 1 file changed, 52 insertions(+), 39 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 3dea0f94c1d..d1e99b98dd1 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -524,6 +524,19 @@ struct _local_data { size_t size; }; +static int synchronize_errorcode(int errorcode, ompi_communicator_t *comm) +{ + int ret; + int err = errorcode; + /* This assumes that error codes are negative integers */ + ret = comm->c_coll->coll_allreduce (MPI_IN_PLACE, &err, 1, MPI_INT, MPI_MIN, + comm, comm->c_coll->coll_allreduce_module); + if (OPAL_UNLIKELY (OMPI_SUCCESS != ret)) { + err = ret; + } + return err; +} + static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, size_t size) { ompi_communicator_t *shared_comm; @@ -595,21 +608,24 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm)); if (0 > ret) { ret = OMPI_ERR_OUT_OF_RESOURCE; - break; + } else { + /* allocate enough space for the state + data for all local ranks */ + ret = opal_shmem_segment_create (&module->seg_ds, data_file, total_size); + free (data_file); + if (OPAL_SUCCESS != ret) { + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_ERROR, "failed to create shared memory segment"); + } } + } - /* allocate enough space for the state + data for all local ranks */ - ret = opal_shmem_segment_create (&module->seg_ds, data_file, total_size); - free (data_file); - if (OPAL_SUCCESS != ret) { - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_ERROR, "failed to create shared memory segment"); - break; - } + ret = synchronize_errorcode(ret, shared_comm); + if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { + break; } - ret = module->comm->c_coll->coll_bcast (&module->seg_ds, sizeof (module->seg_ds), MPI_BYTE, 0, + ret = shared_comm->c_coll->coll_bcast (&module->seg_ds, sizeof (module->seg_ds), MPI_BYTE, 0, shared_comm, shared_comm->c_coll->coll_bcast_module); - if (OMPI_SUCCESS != ret) { + if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { break; } @@ -617,6 +633,10 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s if (NULL == module->segment_base) { OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_ERROR, "failed to attach to the shared memory segment"); ret = OPAL_ERROR; + } + + ret = synchronize_errorcode(ret, shared_comm); + if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { break; } @@ -636,35 +656,28 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s memset (module->state, 0, module->state_size); if (0 == local_rank) { + /* unlink the shared memory backing file */ + opal_shmem_unlink (&module->seg_ds); /* just go ahead and register the whole segment */ ret = ompi_osc_rdma_register (module, MCA_BTL_ENDPOINT_ANY, module->segment_base, total_size, MCA_BTL_REG_FLAG_ACCESS_ANY, &module->state_handle); - if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { - break; + if (OPAL_LIKELY(OMPI_SUCCESS == ret)) { + state_region->base = (intptr_t) module->segment_base; + if (module->state_handle) { + memcpy (state_region->btl_handle_data, module->state_handle, module->selected_btl->btl_registration_handle_size); + } } + } - state_region->base = (intptr_t) module->segment_base; - if (module->state_handle) { - memcpy (state_region->btl_handle_data, module->state_handle, module->selected_btl->btl_registration_handle_size); - } + /* synchronization to make sure memory is registered */ + ret = synchronize_errorcode(ret, shared_comm); + if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { + break; } if (MPI_WIN_FLAVOR_CREATE == module->flavor) { ret = ompi_osc_rdma_initialize_region (module, base, size); - if (OMPI_SUCCESS != ret) { - break; - } - } - - /* barrier to make sure all ranks have attached */ - shared_comm->c_coll->coll_barrier(shared_comm, shared_comm->c_coll->coll_barrier_module); - - /* unlink the shared memory backing file */ - if (0 == local_rank) { - opal_shmem_unlink (&module->seg_ds); - } - - if (MPI_WIN_FLAVOR_ALLOCATE == module->flavor) { + } else if (MPI_WIN_FLAVOR_ALLOCATE == module->flavor) { ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *) module->state->regions; module->state->disp_unit = module->disp_unit; module->state->region_count = 1; @@ -675,8 +688,11 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s } } - /* barrier to make sure all ranks have set up their region data */ - shared_comm->c_coll->coll_barrier(shared_comm, shared_comm->c_coll->coll_barrier_module); + /* synchronization to make sure all ranks have set up their region data */ + ret = synchronize_errorcode(ret, shared_comm); + if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { + break; + } offset = data_base; for (int i = 0 ; i < local_size ; ++i) { @@ -995,13 +1011,7 @@ static int ompi_osc_rdma_share_data (ompi_osc_rdma_module_t *module) free (temp); } while (0); - - ret = module->comm->c_coll->coll_allreduce (&ret, &global_result, 1, MPI_INT, MPI_MIN, module->comm, - module->comm->c_coll->coll_allreduce_module); - - if (OMPI_SUCCESS != ret) { - global_result = ret; - } + global_result = synchronize_errorcode(ret, module->comm); /* none of these communicators are needed anymore so free them now*/ if (MPI_COMM_NULL != module->local_leaders) { @@ -1236,6 +1246,9 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, /* fill in our part */ ret = allocate_state_shared (module, base, size); + + /* notify all others if something went wrong */ + ret = synchronize_errorcode(ret, module->comm); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_ERROR, "failed to allocate internal state"); ompi_osc_rdma_free (win); From 16e1d74c8fb9307882010fe3680f1ff603d31f1a Mon Sep 17 00:00:00 2001 From: Harald Klimach Date: Thu, 13 Jun 2019 15:49:04 +0200 Subject: [PATCH 363/674] Suggestion to fix division by zero in file view. In common_ompi_aggregators calc_cost routine: do not cast the real division to an int intermediately. This patch removes the obsolete int variable c and assigns the result of the P_a/P_x division directly to n_as. With the intermediate int c variable, n_as gets 0 if P_a < P_x, resulting in a division by 0 when computing n_s. Signed-off-by: Harald Klimach (cherry picked from commit e222a04ae57e5d09b8559f3c111de1f10a47246a) --- ompi/mca/common/ompio/common_ompio_aggregators.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_aggregators.c b/ompi/mca/common/ompio/common_ompio_aggregators.c index b1da09d77b5..5a570d8e005 100644 --- a/ompi/mca/common/ompio/common_ompio_aggregators.c +++ b/ompi/mca/common/ompio/common_ompio_aggregators.c @@ -1491,13 +1491,12 @@ static double cost_calc (int P, int P_a, size_t d_p, size_t b_c, int dim ) } case DIM2: { - int P_x, P_y, c; + int P_x, P_y; P_x = P_y = (int) sqrt(P); - c = (float) P_a / (float)P_x; + n_as = (float) P_a / (float)P_x; n_ar = (float) P_y; - n_as = (float) c; if ( d_p > (P_a*b_c/P )) { m_s = fmin(b_c / P_y, d_p); } From b35363957334c0b2011218e6019044c343247495 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 25 Jun 2019 13:27:17 -0700 Subject: [PATCH 364/674] Update to PMIx v3.1.3rc4 Will provide PR to update VERSION to final release once passes MTT Signed-off-by: Ralph Castain --- .gitignore | 18 + opal/mca/pmix/pmix3x/pmix/LICENSE | 2 + opal/mca/pmix/pmix3x/pmix/Makefile.am | 5 +- opal/mca/pmix/pmix3x/pmix/NEWS | 47 +- opal/mca/pmix/pmix3x/pmix/VERSION | 10 +- opal/mca/pmix/pmix3x/pmix/autogen.pl | 17 +- opal/mca/pmix/pmix3x/pmix/config/Makefile.am | 5 +- .../mca/pmix/pmix3x/pmix/config/distscript.sh | 8 +- opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 97 ++- .../pmix/config/pmix_config_pthreads.m4 | 353 +--------- .../pmix3x/pmix/config/pmix_config_threads.m4 | 5 +- .../pmix3x/pmix/config/pmix_search_libs.m4 | 37 +- .../pmix3x/pmix/config/pmix_setup_hwloc.m4 | 6 +- .../pmix3x/pmix/config/pmix_setup_libevent.m4 | 6 +- opal/mca/pmix/pmix3x/pmix/configure.ac | 3 + .../pmix3x/pmix/contrib/make_dist_tarball | 14 +- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 43 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 152 +++-- .../pmix/pmix3x/pmix/include/pmix_rename.h.in | 2 +- .../pmix3x/pmix/include/pmix_version.h.in | 4 +- .../pmix3x/pmix/src/atomics/sys/atomic_impl.h | 4 +- .../pmix3x/pmix/src/atomics/sys/atomic_stdc.h | 9 +- .../pmix/src/atomics/sys/powerpc/atomic.h | 26 +- .../pmix/src/event/pmix_event_notification.c | 23 +- .../pmix/src/event/pmix_event_registration.c | 8 +- .../pmix3x/pmix/src/include/pmix_globals.h | 5 +- .../pmix/src/mca/base/help-pmix-mca-base.txt | 13 +- .../base/pmix_mca_base_component_repository.c | 14 +- .../pmix/src/mca/bfrops/v12/Makefile.am | 5 +- .../pmix/src/mca/bfrops/v20/Makefile.am | 5 +- .../pmix/src/mca/bfrops/v21/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/bfrops/v3/Makefile.am | 5 +- .../pmix/src/mca/gds/base/gds_base_fns.c | 5 +- .../pmix3x/pmix/src/mca/gds/ds12/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/gds/ds21/Makefile.am | 5 +- .../src/mca/gds/ds21/gds_ds21_lock_pthread.c | 3 +- .../pmix3x/pmix/src/mca/gds/hash/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.c | 209 ++++-- .../pmix/pmix3x/pmix/src/mca/pdl/configure.m4 | 8 +- .../pmix/src/mca/plog/default/Makefile.am | 5 +- .../pmix/src/mca/plog/stdfd/Makefile.am | 5 +- .../pmix/src/mca/plog/syslog/Makefile.am | 5 +- .../pmix/src/mca/pnet/base/pnet_base_fns.c | 3 +- .../pmix3x/pmix/src/mca/pnet/opa/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/pnet/tcp/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/pnet/test/Makefile.am | 5 +- .../pmix/src/mca/preg/native/Makefile.am | 5 +- .../pmix/src/mca/preg/native/preg_native.c | 4 +- .../src/mca/psec/dummy_handshake/Makefile.am | 59 ++ .../dummy_handshake/psec_dummy_handshake.c | 170 +++++ .../dummy_handshake/psec_dummy_handshake.h | 29 + .../psec_dummy_handshake_component.c | 73 ++ .../pmix/src/mca/psec/munge/Makefile.am | 5 +- .../pmix/src/mca/psec/native/Makefile.am | 5 +- .../pmix/src/mca/psec/native/psec_native.c | 22 +- .../pmix3x/pmix/src/mca/psec/none/Makefile.am | 5 +- opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h | 33 +- .../pmix/src/mca/psensor/file/Makefile.am | 5 +- .../src/mca/psensor/heartbeat/Makefile.am | 5 +- .../pmix/src/mca/pshmem/mmap/Makefile.am | 4 + .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 113 ++-- .../pmix3x/pmix/src/mca/ptl/tcp/Makefile.am | 5 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 13 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h | 3 +- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 140 +++- .../pmix3x/pmix/src/mca/ptl/usock/Makefile.am | 5 +- .../src/mca/ptl/usock/ptl_usock_component.c | 40 +- .../pmix/src/runtime/pmix_progress_threads.c | 6 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 114 +++- .../pmix3x/pmix/src/server/pmix_server_ops.c | 558 ++++++++++------ .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 626 +++++++++--------- opal/mca/pmix/pmix3x/pmix/src/util/output.c | 13 +- opal/mca/pmix/pmix3x/pmix/src/util/output.h | 13 +- opal/mca/pmix/pmix3x/pmix/test/Makefile.am | 56 +- .../pmix/pmix3x/pmix/test/run_tests00.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests01.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests02.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests03.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests04.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests05.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests06.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests07.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests08.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests09.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests10.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests11.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests12.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests13.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests14.pl.in | 73 ++ .../pmix/pmix3x/pmix/test/run_tests15.pl.in | 73 ++ opal/mca/pmix/pmix3x/pmix/test/test_common.h | 4 +- opal/mca/pmix/pmix3x/pmix/test/test_fence.c | 11 +- opal/mca/pmix/pmix3x/pmix/test/test_server.c | 85 +-- 93 files changed, 3333 insertions(+), 1293 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in create mode 100755 opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in diff --git a/.gitignore b/.gitignore index 50cddfeacb7..d9de74cae8f 100644 --- a/.gitignore +++ b/.gitignore @@ -401,6 +401,24 @@ opal/mca/pmix/ext3x/ext3x_client.c opal/mca/pmix/ext3x/ext3x_component.c opal/mca/pmix/ext3x/ext3x_server_north.c opal/mca/pmix/ext3x/ext3x_server_south.c +opal/mca/pmix/pmix3x/pmix/config/mca_library_paths.txt +opal/mca/pmix/pmix3x/pmix/config/test-driver +opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl +opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl opal/tools/opal-checkpoint/opal-checkpoint opal/tools/opal-checkpoint/opal-checkpoint.1 diff --git a/opal/mca/pmix/pmix3x/pmix/LICENSE b/opal/mca/pmix/pmix3x/pmix/LICENSE index 3eb0a094e01..9f9a1b943ba 100644 --- a/opal/mca/pmix/pmix3x/pmix/LICENSE +++ b/opal/mca/pmix/pmix3x/pmix/LICENSE @@ -47,6 +47,8 @@ Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights reserved. Copyright (c) 2013-2019 Intel, Inc. All rights reserved. Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. +Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights + reserved. $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.am b/opal/mca/pmix/pmix3x/pmix/Makefile.am index 78fdedaafce..47e21332730 100644 --- a/opal/mca/pmix/pmix3x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.am @@ -11,7 +11,9 @@ # All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -25,6 +27,7 @@ ACLOCAL_AMFLAGS = -I ./config SUBDIRS = config contrib include src etc +AM_DISTCHECK_CONFIGURE_FLAGS = --disable-dlopen headers = sources = diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index abc79780523..dd478a9a87e 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -1,5 +1,5 @@ Copyright (c) 2015-2019 Intel, Inc. All rights reserved. -Copyright (c) 2017 IBM Corporation. All rights reserved. +Copyright (c) 2017-2019 IBM Corporation. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -21,6 +21,51 @@ example, a bug might be fixed in the master, and then moved to multiple release branches. +3.1.3 -- TBD +---------------------- +- PR #1096: Restore PMIX_NUM_SLOTS for backward compatibility +- PR #1106: Automatically generate PMIX_NUMERIC_VERSION +- PR #1143: Fix tool connection handshake for tools that are registered + clients +- PR #1163: Fix a compiler warning in atomics on POWER arch +- PR #1162: Fix race condition when clients fail while in a PMIx + collective operation +- PR #1166: Fix a regression in spinlock atomics +- PR #1159: Fix missing pointer update when shared memory segment + was re-attached +- PR #1180: Remove dependency on C++ compiler for thread detection +- PR #1180: Add detection for Flex when building in non-tarball situations +- PR #1165: Add dependency on libevent-devel to rpm spec file +- PR #1188: Link libpmix.so to MCA component libraries +- PR #1194: Ensure any cached notifications arrive after registration completes +- PR #1205: Add "make check" support +- PR #1209: Update configure logic for clock_gettime +- PR #1213/#1217/#1221: Add configure option "--enable-nonglobal-dlopen" + If the MCA component libraries should link back to libpmix.so +- PR #1231: SPEC: Allow splitting PMIx in pmix and pmix-libpmi packages +- PR #1222: Fix case of multiple launcher calls in job script +- PR #1237: Avoid double-free of collective tracker +- PR #1237: Ensure all participants are notified of fence complete +- PR #1237: Ensure all participants are notified of connect and disconnect complete +- PR #1250: Fix PMIx_server_finalize hang (rare) +- PR #1271: PTL/usock doesn't support tools +- PR #1280: Fix the PTL connection establishment protocol +- PR #1280: Fix tool connection in psec/handshake mode +- PR #1289: Avoid output_verbose overhead when it won't print +- PR #1296: Allow setup_fork to proceed even if gdds and pnet don't contribute +- PR #1296: Allow servers to pass NULL module +- PR #1297: Provide internal blocking ability to the register/deregister fns +- PR #1298: Add dummy handshake component to psec framework for testing +- PR #1303: Allow jobs to not specify proc-level info +- PR #1304: Provide proc data in cases where host does not +- PR #1305: Add some more values that can be computed +- PR #1308: Add missing tool rendezvous file +- PR #1309: Fix potential integer overflow in regex +- PR #1311: Work around memory bug in older gcc compilers +- PR #1321: Provide memory op hooks in user-facing macros +- PR #1329: Add -fPIC to static builds + + 3.1.2 -- 24 Jan 2019 ---------------------- - Fix a bug in macro identifying system events diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index a81e5274f87..98c143b2677 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -15,7 +15,7 @@ major=3 minor=1 -release=2 +release=3 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -23,14 +23,14 @@ release=2 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek= +greek=rc4 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git0f7075f7 +repo_rev=git5e6ec324 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Jan 24, 2019" +date="Jun 25, 2019" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,7 +75,7 @@ date="Jan 24, 2019" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:22:2 +libpmix_so_version=4:23:2 libpmi_so_version=1:0:0 libpmi2_so_version=1:0:0 diff --git a/opal/mca/pmix/pmix3x/pmix/autogen.pl b/opal/mca/pmix/pmix3x/pmix/autogen.pl index 40b533d2142..9d365783c8e 100755 --- a/opal/mca/pmix/pmix3x/pmix/autogen.pl +++ b/opal/mca/pmix/pmix3x/pmix/autogen.pl @@ -4,7 +4,7 @@ # Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2015 IBM Corporation. All rights reserved. @@ -37,6 +37,9 @@ # Sanity check file my $topdir_file = "include/pmix.h"; my $dnl_line = "dnl ---------------------------------------------------------------------------"; +# The text file we'll write at the end that will contain +# all the mca component directory paths +my $mca_library_paths_file = "config/mca_library_paths.txt"; # Data structures to fill up with all the stuff we find my $mca_found; @@ -137,6 +140,9 @@ sub mca_process_component { push(@{$mca_found->{$framework}->{"components"}}, $found_component); + # save the directory for later to create the paths + # to all the component libraries + push(@subdirs, $cdir); } ############################################################################## @@ -723,6 +729,15 @@ sub in_tarball { print M4 $m4; close(M4); +# Remove the old library path file and write the new one +verbose "==> Writing txt file with all the mca component paths\n"; +unlink($mca_library_paths_file); +open(M4, ">$mca_library_paths_file") || + my_die "Cannot open $mca_library_paths_file"; +my $paths = join(":", @subdirs); +print M4 $paths; +close(M4); + # Run autoreconf verbose "==> Running autoreconf\n"; my $cmd = "autoreconf -ivf --warnings=all,no-obsolete,no-override -I config"; diff --git a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am index 3793162404c..ebc3af9d96a 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. @@ -44,7 +44,8 @@ EXTRA_DIST = \ pmix_setup_cc.m4 \ pmix_setup_zlib.m4 \ pmix_setup_libevent.m4 \ - pmix_mca_priority_sort.pl + pmix_mca_priority_sort.pl \ + mca_library_paths.txt maintainer-clean-local: diff --git a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh index de41d2ba7b6..e5c948f15f1 100755 --- a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh +++ b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh @@ -11,11 +11,11 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2015-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -42,7 +42,7 @@ fi # Otherwise, use what configure told us, at the cost of allowing one # or two corner cases in (but otherwise VPATH builds won't work). repo_rev=$PMIX_REPO_REV -if test -d .git ; then +if test -e .git ; then repo_rev=$(config/pmix_get_version.sh VERSION --repo-rev) fi diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index 5d1660649f5..a90e23b9795 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -18,8 +18,8 @@ dnl reserved. dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -dnl Copyright (c) 2015-2017 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 Mellanox Technologies, Inc. dnl All rights reserved. dnl @@ -120,9 +120,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ pmixmajor=${PMIX_MAJOR_VERSION}L pmixminor=${PMIX_MINOR_VERSION}L pmixrelease=${PMIX_RELEASE_VERSION}L + pmixnumeric=$(printf 0x%4.4x%2.2x%2.2x $PMIX_MAJOR_VERSION $PMIX_MINOR_VERSION $PMIX_RELEASE_VERSION) AC_SUBST(pmixmajor) AC_SUBST(pmixminor) AC_SUBST(pmixrelease) + AC_SUBST(pmixnumeric) AC_CONFIG_FILES(pmix_config_prefix[include/pmix_version.h]) PMIX_GREEK_VERSION="`$PMIX_top_srcdir/config/pmix_get_version.sh $PMIX_top_srcdir/VERSION --greek`" @@ -645,6 +647,11 @@ AC_DEFUN([PMIX_SETUP_CORE],[ pmix_show_title "Library and Function tests" + # Darwin doesn't need -lutil, as it's something other than this -lutil. + PMIX_SEARCH_LIBS_CORE([openpty], [util]) + + PMIX_SEARCH_LIBS_CORE([gethostbyname], [nsl]) + PMIX_SEARCH_LIBS_CORE([socket], [socket]) # IRIX and CentOS have dirname in -lgen, usually in libc @@ -653,6 +660,9 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # Darwin doesn't need -lm, as it's a symlink to libSystem.dylib PMIX_SEARCH_LIBS_CORE([ceil], [m]) + # -lrt might be needed for clock_gettime + PMIX_SEARCH_LIBS_CORE([clock_gettime], [rt]) + AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp]) # On some hosts, htonl is a define, so the AC_CHECK_FUNC will get @@ -715,8 +725,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[ CFLAGS="$CFLAGS $THREAD_CFLAGS" CPPFLAGS="$CPPFLAGS $THREAD_CPPFLAGS" - CXXFLAGS="$CXXFLAGS $THREAD_CXXFLAGS" - CXXCPPFLAGS="$CXXCPPFLAGS $THREAD_CXXCPPFLAGS" LDFLAGS="$LDFLAGS $THREAD_LDFLAGS" LIBS="$LIBS $THREAD_LIBS" @@ -726,10 +734,10 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_PROG_LN_S + # Check for some common system programs that we need AC_PROG_GREP AC_PROG_EGREP - ################################## # Visibility ################################## @@ -844,6 +852,32 @@ AC_DEFUN([PMIX_SETUP_CORE],[ AC_SUBST(pmixlibdir) AC_SUBST(pmixincludedir) + ############################################################################ + # setup "make check" + ############################################################################ + PMIX_BUILT_TEST_PREFIX=$PMIX_top_builddir + AC_SUBST(PMIX_BUILT_TEST_PREFIX) + # expose the mca component library paths in the build system + pathfile=$PMIX_top_srcdir/config/mca_library_paths.txt + PMIX_COMPONENT_LIBRARY_PATHS=`cat $pathfile` + AC_SUBST(PMIX_COMPONENT_LIBRARY_PATHS) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests00.pl], [chmod +x test/run_tests00.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests01.pl], [chmod +x test/run_tests01.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests02.pl], [chmod +x test/run_tests02.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests03.pl], [chmod +x test/run_tests03.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests04.pl], [chmod +x test/run_tests04.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests05.pl], [chmod +x test/run_tests05.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests06.pl], [chmod +x test/run_tests06.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests07.pl], [chmod +x test/run_tests07.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests08.pl], [chmod +x test/run_tests08.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests09.pl], [chmod +x test/run_tests09.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests10.pl], [chmod +x test/run_tests10.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests11.pl], [chmod +x test/run_tests11.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests12.pl], [chmod +x test/run_tests12.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests13.pl], [chmod +x test/run_tests13.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests14.pl], [chmod +x test/run_tests14.pl]) + AC_CONFIG_FILES(pmix_config_prefix[test/run_tests15.pl], [chmod +x test/run_tests15.pl]) + ############################################################################ # final output ############################################################################ @@ -883,6 +917,10 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[ [Whether build should attempt to use dlopen (or similar) to dynamically load components. (default: enabled)])]) + AS_IF([test "$enable_dlopen" = "unknown"], + [AC_MSG_WARN([enable_dlopen variable has been overwritten by configure]) + AC_MSG_WARN([This is an internal error that should be reported to PMIx developers]) + AC_MSG_ERROR([Cannot continue])]) AS_IF([test "$enable_dlopen" = "no"], [enable_mca_dso="no" enable_mca_static="yes" @@ -898,7 +936,7 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[ AC_ARG_ENABLE([embedded-mode], [AC_HELP_STRING([--enable-embedded-mode], [Using --enable-embedded-mode causes PMIx to skip a few configure checks and install nothing. It should only be used when building PMIx within the scope of a larger package.])]) - AS_IF([test ! -z "$enable_embedded_mode" && test "$enable_embedded_mode" = "yes"], + AS_IF([test "$enable_embedded_mode" = "yes"], [pmix_mode=embedded pmix_install_primary_headers=no AC_MSG_RESULT([yes])], @@ -910,8 +948,16 @@ AC_DEFUN([PMIX_DEFINE_ARGS],[ # Is this a developer copy? # -if test -d .git; then +if test -e $PMIX_TOP_SRCDIR/.git; then PMIX_DEVEL=1 + # check for Flex + AC_PROG_LEX + if test "x$LEX" != xflex; then + AC_MSG_WARN([PMIx requires Flex to build from non-tarball sources,]) + AC_MSG_WARN([but Flex was not found. Please install Flex into]) + AC_MSG_WARN([your path and try again]) + AC_MSG_ERROR([Cannot continue]) + fi else PMIX_DEVEL=0 fi @@ -962,7 +1008,6 @@ fi #################### Early development override #################### if test "$WANT_DEBUG" = "0"; then CFLAGS="-DNDEBUG $CFLAGS" - CXXFLAGS="-DNDEBUG $CXXFLAGS" fi AC_DEFINE_UNQUOTED(PMIX_ENABLE_DEBUG, $WANT_DEBUG, [Whether we want developer-level debugging code or not]) @@ -1133,6 +1178,41 @@ fi AM_CONDITIONAL([PMIX_INSTALL_BINARIES], [test $WANT_PMIX_BINARIES -eq 1]) + +# see if they want to disable non-RTLD_GLOBAL dlopen +AC_MSG_CHECKING([if want to support dlopen of non-global namespaces]) +AC_ARG_ENABLE([nonglobal-dlopen], + AC_HELP_STRING([--enable-nonglobal-dlopen], + [enable non-global dlopen (default: enabled)])) +if test "$enable_nonglobal_dlopen" == "no"; then + AC_MSG_RESULT([no]) + pmix_need_libpmix=0 +else + AC_MSG_RESULT([yes]) + pmix_need_libpmix=1 +fi + +# if someone enables embedded mode but doesn't want to install the +# devel headers, then default nonglobal-dlopen to false +AS_IF([test -z "$enable_nonglobal_dlopen" && test "x$pmix_mode" = "xembedded" && test $WANT_INSTALL_HEADERS -eq 0 && test $pmix_need_libpmix -eq 1], + [pmix_need_libpmix=0]) + +# +# psec/dummy_handshake +# + +AC_MSG_CHECKING([if want build psec/dummy_handshake]) +AC_ARG_ENABLE(dummy-handshake, + AC_HELP_STRING([--enable-dummy-handshake], + [Enables psec dummy component intended to check the PTL handshake scenario (default: disabled)])) +if test "$enable_dummy_handshake" != "yes"; then + AC_MSG_RESULT([no]) + eval "DISABLE_psec_dummy_handshake=1" +else + AC_MSG_RESULT([yes]) + eval "DISABLE_psec_dummy_handshake=0" +fi +AM_CONDITIONAL(MCA_BUILD_PSEC_DUMMY_HANDSHAKE, test "$DISABLE_psec_dummy_handshake" = "0") ])dnl # This must be a standalone routine so that it can be called both by @@ -1148,6 +1228,7 @@ AC_DEFUN([PMIX_DO_AM_CONDITIONALS],[ AM_CONDITIONAL([WANT_PRIMARY_HEADERS], [test "x$pmix_install_primary_headers" = "xyes"]) AM_CONDITIONAL(WANT_INSTALL_HEADERS, test "$WANT_INSTALL_HEADERS" = 1) AM_CONDITIONAL(WANT_PMI_BACKWARD, test "$WANT_PMI_BACKWARD" = 1) + AM_CONDITIONAL(NEED_LIBPMIX, [test "$pmix_need_libpmix" = "1"]) ]) pmix_did_am_conditionals=yes ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 index 2e2f1fd8f97..b23f66ebb01 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 @@ -10,7 +10,7 @@ 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) 2012 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. dnl Copyright (c) 2014-2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ @@ -71,104 +71,6 @@ int main(int argc, char* argv[]) # END: PMIX_INTL_PTHREAD_TRY_LINK ])dnl - -AC_DEFUN([PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN], [ -# BEGIN: PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN -# -# Make sure that we can run a small application in Fortran, with -# pthreads living in a C object file - -# Fortran module -cat > conftestf.f < conftest.c < -#include -#include -$pmix_conftest_h - -#ifdef __cplusplus -extern "C" { -#endif -int i = 3; -pthread_t me, newthread; - -void cleanup_routine(void *foo); -void *thread_main(void *foo); -void pthreadtest_f(void); - -void cleanup_routine(void *foo) { i = 4; } -void *thread_main(void *foo) { i = 2; return (void*) &i; } - -void pthreadtest_f(void) -{ - pthread_attr_t attr; - - me = pthread_self(); - pthread_atfork(NULL, NULL, NULL); - pthread_attr_init(&attr); - pthread_cleanup_push(cleanup_routine, 0); - pthread_create(&newthread, &attr, thread_main, 0); - pthread_join(newthread, 0); - pthread_cleanup_pop(0); -} - -void pthreadtest(void) -{ pthreadtest_f(); } - -void pthreadtest_(void) -{ pthreadtest_f(); } - -void pthreadtest__(void) -{ pthreadtest_f(); } - -void PTHREADTEST(void) -{ pthreadtest_f(); } - -#ifdef __cplusplus -} -#endif -EOF - -# Try the compile -PMIX_LOG_COMMAND( - [$CC $CFLAGS -I. -c conftest.c], - PMIX_LOG_COMMAND( - [$FC $FCFLAGS conftestf.f conftest.o -o conftest $LDFLAGS $LIBS], - [HAPPY=1], - [HAPPY=0]), - [HAPPY=0]) - -if test "$HAPPY" = "1"; then - $1 -else - PMIX_LOG_MSG([here is the C program:], 1) - PMIX_LOG_FILE([conftest.c]) - if test -f conftest.h; then - PMIX_LOG_MSG([here is contest.h:], 1) - PMIX_LOG_FILE([conftest.h]) - fi - PMIX_LOG_MSG([here is the fortran program:], 1) - PMIX_LOG_FILE([conftestf.f]) - $2 -fi - -unset HAPPY pmix_conftest_h -rm -rf conftest* -# END: PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN -])dnl - - # ******************************************************************** # # Try to compile thread support without any special flags @@ -194,48 +96,6 @@ fi ])dnl -AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN_CXX], [ -# -# C++ compiler -# -if test "$pmix_pthread_cxx_success" = "0"; then - AC_MSG_CHECKING([if C++ compiler and POSIX threads work as is]) - - AC_LANG_PUSH(C++) - PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1, - pmix_pthread_cxx_success=0) - AC_LANG_POP(C++) - if test "$pmix_pthread_cxx_success" = "1"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi -fi -])dnl - - -AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN_FC], [ -# -# Fortran compiler -# -if test "$pmix_pthread_fortran_success" = "0" && \ - test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \ - test $ompi_fortran_happy -eq 1; then - AC_MSG_CHECKING([if Fortran compiler and POSIX threads work as is]) - - AC_LANG_PUSH(C) - PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1, - pmix_pthread_fortran_success=0) - AC_LANG_POP(C) - if test "$pmix_pthread_fortran_success" = "1"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi -fi -])dnl - - AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN], [ # BEGIN: PMIX_INTL_POSIX_THREADS_PLAIN # @@ -246,19 +106,10 @@ AC_DEFUN([PMIX_INTL_POSIX_THREADS_PLAIN], [ # why take chances? # -# Only run C++ and Fortran if those compilers already configured AC_PROVIDE_IFELSE([AC_PROG_CC], [PMIX_INTL_POSIX_THREADS_PLAIN_C], [pmix_pthread_c_success=1]) -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [PMIX_INTL_POSIX_THREADS_PLAIN_CXX], - [pmix_pthread_cxx_success=1]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [PMIX_INTL_POSIX_THREADS_PLAIN_FC], - [pmix_pthread_fortran_success=1]) - # End: PMIX_INTL_POSIX_THREADS_PLAIN ])dnl @@ -294,60 +145,6 @@ fi ]) -AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX], [ -# -# C++ compiler -# -if test "$pmix_pthread_cxx_success" = "0"; then - for pf in $pflags; do - AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pf]) - CXXFLAGS="$orig_CXXFLAGS $pf" - AC_LANG_PUSH(C++) - PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1, - pmix_pthread_cxx_success=0) - AC_LANG_POP(C++) - if test "$pmix_pthread_cxx_success" = "1"; then - PTHREAD_CXXFLAGS="$pf" - AC_MSG_RESULT([yes]) - break - else - PTHREAD_CXXFLAGS= - CXXFLAGS="$orig_CXXFLAGS" - AC_MSG_RESULT([no]) - fi - done -fi -]) - - -AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC], [ -# -# Fortran compiler -# -if test "$pmix_pthread_fortran_success" = "0" && \ - test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \ - test $ompi_fortran_happy -eq 1; then - for pf in $pflags; do - AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $pf]) - FCFLAGS="$orig_FCFLAGS $pf" - AC_LANG_PUSH(C) - PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1, - pmix_pthread_fortran_success=0) - AC_LANG_POP(C) - if test "$pmix_pthread_fortran_success" = "1"; then - PTHREAD_FCFLAGS="$pf" - AC_MSG_RESULT([yes]) - break - else - PTHREAD_FCFLAGS= - FCFLAGS="$orig_FCFLAGS" - AC_MSG_RESULT([no]) - fi - done -fi -]) - - AC_DEFUN([PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS],[ # Begin: PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS # @@ -374,19 +171,10 @@ case "${host_cpu}-${host_os}" in ;; esac -# Only run C++ and Fortran if those compilers already configured AC_PROVIDE_IFELSE([AC_PROG_CC], [PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_C], [pmix_pthread_c_success=1]) -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_CXX], - [pmix_pthread_cxx_success=1]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS_FC], - [pmix_pthread_fortran_success=1]) - # End: PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS ])dnl @@ -435,121 +223,6 @@ if test "$pmix_pthread_c_success" = "0"; then fi ])dnl - -AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS_CXX],[ -# -# C++ compiler -# -if test "$pmix_pthread_cxx_success" = "0"; then - if test ! "$pmix_pthread_c_success" = "0" && test ! "$PTHREAD_LIBS" = "" ; then - AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $PTHREAD_LIBS]) - case "${host_cpu}-${host-_os}" in - *-aix* | *-freebsd*) - if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then - PTHREAD_CXXCPPFLAGS="-D_THREAD_SAFE" - CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" - fi - ;; - *) - if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then - PTHREAD_CXXCPPFLAGS="-D_REENTRANT" - CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" - fi - ;; - esac - LIBS="$orig_LIBS $PTHREAD_LIBS" - AC_LANG_PUSH(C++) - PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1, - pmix_pthread_cxx_success=0) - AC_LANG_POP(C++) - if test "$pmix_pthread_cxx_success" = "1"; then - AC_MSG_RESULT([yes]) - else - CXXCPPFLAGS="$orig_CXXCPPFLAGS" - LIBS="$orig_LIBS" - AC_MSG_RESULT([no]) - AC_MSG_ERROR([Can not find working threads configuration. aborting]) - fi - else - for pl in $plibs; do - AC_MSG_CHECKING([if C++ compiler and POSIX threads work with $pl]) - case "${host_cpu}-${host-_os}" in - *-aix* | *-freebsd*) - if test "`echo $CXXCPPFLAGS | $GREP 'D_THREAD_SAFE'`" = ""; then - PTHREAD_CXXCPPFLAGS="-D_THREAD_SAFE" - CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" - fi - ;; - *) - if test "`echo $CXXCPPFLAGS | $GREP 'D_REENTRANT'`" = ""; then - PTHREAD_CXXCPPFLAGS="-D_REENTRANT" - CXXCPPFLAGS="$CXXCPPFLAGS $PTHREAD_CXXCPPFLAGS" - fi - ;; - esac - LIBS="$orig_LIBS $pl" - AC_LANG_PUSH(C++) - PMIX_INTL_PTHREAD_TRY_LINK(pmix_pthread_cxx_success=1, - pmix_pthread_cxx_success=0) - AC_LANG_POP(C++) - if test "$pmix_pthread_cxx_success" = "1"; then - PTHREAD_LIBS="$pl" - AC_MSG_RESULT([yes]) - else - PTHREAD_CXXCPPFLAGS= - CXXCPPFLAGS="$orig_CXXCPPFLAGS" - LIBS="$orig_LIBS" - AC_MSG_RESULT([no]) - fi - done - fi -fi -])dnl - - -AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS_FC],[ -# -# Fortran compiler -# -if test "$pmix_pthread_fortran_success" = "0" && \ - test "$OMPI_TRY_FORTRAN_BINDINGS" -gt "$OMPI_FORTRAN_NO_BINDINGS" && \ - test $ompi_fortran_happy -eq 1; then - if test ! "$pmix_pthread_c_success" = "0" && test ! "$PTHREAD_LIBS" = "" ; then - AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $PTHREAD_LIBS]) - LIBS="$orig_LIBS $PTHREAD_LIBS" - AC_LANG_PUSH(C) - PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1, - pmix_pthread_fortran_success=0) - AC_LANG_POP(C) - if test "$pmix_pthread_fortran_success" = "1"; then - AC_MSG_RESULT([yes]) - else - LIBS="$orig_LIBS" - AC_MSG_RESULT([no]) - AC_MSG_ERROR([Can not find working threads configuration. aborting]) - fi - else - for pl in $plibs; do - AC_MSG_CHECKING([if Fortran compiler and POSIX threads work with $pl]) - LIBS="$orig_LIBS $pl" - AC_LANG_PUSH(C) - PMIX_INTL_PTHREAD_TRY_LINK_FORTRAN(pmix_pthread_fortran_success=1, - pmix_pthread_fortran_success=0) - AC_LANG_POP(C) - if test "$pmix_pthread_fortran_success" = "1"; then - PTHREAD_LIBS="$pl" - AC_MSG_RESULT([yes]) - break - else - LIBS="$orig_LIBS" - AC_MSG_RESULT([no]) - fi - done - fi -fi -])dnl - - AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS],[ # Begin: PMIX_INTL_POSIX_THREADS_LIBS # @@ -563,19 +236,10 @@ AC_DEFUN([PMIX_INTL_POSIX_THREADS_LIBS],[ # libpthread: The usual place (like we can define usual!) plibs="-lpthreads -llthread -lpthread" -# Only run C++ and Fortran if those compilers already configured AC_PROVIDE_IFELSE([AC_PROG_CC], [PMIX_INTL_POSIX_THREADS_LIBS_C], [pmix_pthread_c_success=1]) -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [PMIX_INTL_POSIX_THREADS_LIBS_CXX], - [pmix_pthread_cxx_success=1]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [PMIX_INTL_POSIX_THREADS_LIBS_FC], - [pmix_pthread_fortran_success=1]) - # End: PMIX_INTL_POSIX_THREADS_LIBS] )dnl @@ -589,21 +253,14 @@ AC_DEFUN([PMIX_CONFIG_POSIX_THREADS],[ AC_REQUIRE([AC_PROG_GREP]) pmix_pthread_c_success=0 -pmix_pthread_cxx_success=0 orig_CFLAGS="$CFLAGS" -orig_FCFLAGS="$FCFLAGS" -orig_CXXFLAGS="$CXXFLAGS" orig_CPPFLAGS="$CPPFLAGS" -orig_CXXCPPFLAGS="$CXXCPPFLAGS" orig_LDFLAGS="$LDFLAGS" orig_LIBS="$LIBS" PTHREAD_CFLAGS= -PTHREAD_FCFLAGS= -PTHREAD_CXXFLAGS= PTHREAD_CPPFLAGS= -PTHREAD_CXXCPPFLAGS= PTHREAD_LDFLAGS= PTHREAD_LIBS= @@ -648,15 +305,11 @@ AC_DEFINE_UNQUOTED([PMIX_HAVE_PTHREAD_MUTEX_ERRORCHECK], [$defval], [If PTHREADS implementation supports PTHREAD_MUTEX_ERRORCHECK]) CFLAGS="$orig_CFLAGS" -FCFLAGS="$orig_FCFLAGS" -CXXFLAGS="$orig_CXXFLAGS" CPPFLAGS="$orig_CPPFLAGS" -CXXCPPFLAGS="$orig_CXXCPPFLAGS" LDFLAGS="$orig_LDFLAGS" LIBS="$orig_LIBS" -if test "$pmix_pthread_c_success" = "1" && \ - test "$pmix_pthread_cxx_success" = "1"; then +if test "$pmix_pthread_c_success" = "1"; then internal_useless=1 $1 else @@ -664,6 +317,6 @@ else $2 fi -unset pmix_pthread_c_success pmix_pthread_fortran_success pmix_pthread_cxx_success +unset pmix_pthread_c_success unset internal_useless ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 index 541e63f726c..050f8735577 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_threads.m4 @@ -11,7 +11,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ @@ -56,10 +56,7 @@ if test "$HAVE_POSIX_THREADS" = "0"; then fi THREAD_CFLAGS="$PTHREAD_CFLAGS" -THREAD_FCFLAGS="$PTHREAD_FCFLAGS" -THREAD_CXXFLAGS="$PTHREAD_CXXFLAGS" THREAD_CPPFLAGS="$PTHREAD_CPPFLAGS" -THREAD_CXXCPPFLAGS="$PTHREAD_CXXCPPFLAGS" THREAD_LDFLAGS="$PTHREAD_LDFLAGS" THREAD_LIBS="$PTHREAD_LIBS" diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 index 9d7a8af9a74..d900c8a93b4 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_search_libs.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -21,7 +21,13 @@ dnl # PMIX_SEARCH_LIBS_COMPONENT. The reason why is because this macro # calls PMIX_WRAPPER_FLAGS_ADD -- see big comment in # pmix_setup_wrappers.m4 for an explanation of why this is bad). +# NOTE: PMIx doesn't have wrapper compilers, so this is not an issue +# here - we leave the note just for downstream compatibility AC_DEFUN([PMIX_SEARCH_LIBS_CORE],[ + + PMIX_VAR_SCOPE_PUSH([LIBS_save add]) + LIBS_save=$LIBS + AC_SEARCH_LIBS([$1], [$2], [pmix_have_$1=1 $3], @@ -31,4 +37,33 @@ AC_DEFUN([PMIX_SEARCH_LIBS_CORE],[ AC_DEFINE_UNQUOTED([PMIX_HAVE_]m4_toupper($1), [$pmix_have_$1], [whether $1 is found and available]) + PMIX_VAR_SCOPE_POP +])dnl + +# PMIX SEARCH_LIBS_COMPONENT(prefix, func, list-of-libraries, +# action-if-found, action-if-not-found, +# other-libraries) +# +# Same as PMIX SEARCH_LIBS_CORE, above, except that we don't call PMIX +# WRAPPER_FLAGS_ADD. Instead, we add it to the ${prefix}_LIBS +# variable (i.e., $prefix is usually "framework_component", such as +# "fbtl_posix"). +AC_DEFUN([PMIX_SEARCH_LIBS_COMPONENT],[ + + PMIX_VAR_SCOPE_PUSH([LIBS_save add]) + LIBS_save=$LIBS + + AC_SEARCH_LIBS([$2], [$3], + [ # Found it! See if anything was added to LIBS + add=`printf '%s\n' "$LIBS" | sed -e "s/$LIBS_save$//"` + AS_IF([test -n "$add"], + [PMIX_FLAGS_APPEND_UNIQ($1_LIBS, [$add])]) + $1_have_$2=1 + $4], + [$1_have_$2=0 + $5], [$6]) + + AC_DEFINE_UNQUOTED([PMIX_HAVE_]m4_toupper($1), [$$1_have_$2], + [whether $1 is found and available]) + PMIX_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 index 8f6ed75176d..a17313259a2 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_hwloc.m4 @@ -17,11 +17,7 @@ AC_DEFUN([PMIX_HWLOC_CONFIG],[ [AC_HELP_STRING([--with-hwloc-header=HEADER], [The value that should be included in C files to include hwloc.h])]) - AC_ARG_ENABLE([embedded-hwloc], - [AC_HELP_STRING([--enable-embedded-hwloc], - [Enable use of locally embedded hwloc])]) - - AS_IF([test "$enable_embedded_hwloc" = "yes"], + AS_IF([test "$pmix_mode" = "embedded"], [_PMIX_HWLOC_EMBEDDED_MODE], [_PMIX_HWLOC_EXTERNAL]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 index 2348a87aacb..949af1cfd58 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 @@ -19,11 +19,7 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[ [AC_HELP_STRING([--with-libevent-header=HEADER], [The value that should be included in C files to include event.h])]) - AC_ARG_ENABLE([embedded-libevent], - [AC_HELP_STRING([--enable-embedded-libevent], - [Enable use of locally embedded libevent])]) - - AS_IF([test "$enable_embedded_libevent" = "yes"], + AS_IF([test "$pmix_mode" = "embedded"], [_PMIX_LIBEVENT_EMBEDDED_MODE], [_PMIX_LIBEVENT_EXTERNAL]) diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index 08f6981b8d5..dcea50ac001 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -157,6 +157,9 @@ LT_PREREQ([2.2.6]) pmix_enable_shared="$enable_shared" pmix_enable_static="$enable_static" +AS_IF([test ! -z "$enable_static" && test "$enable_static" == "yes"], + [CFLAGS="$CFLAGS -fPIC"]) + AM_ENABLE_SHARED AM_DISABLE_STATIC diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball index c9a6d19c646..f3fc22b5e49 100755 --- a/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball +++ b/opal/mca/pmix/pmix3x/pmix/contrib/make_dist_tarball @@ -10,8 +10,10 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2013 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -108,14 +110,6 @@ if test "$LIBEVENT" != ""; then config_args="--with-libevent=$LIBEVENT $config_args" fi -# if config_args isn't empty, then add that to the distcheck_flags -# (because we'll assumedly need those to run configure under "make -# distcheck"). -if test "$config_args" != ""; then - echo "*** Adding to distcheck_flags: $config_args" - distcheck_flags="$distcheck_flags AM_DISTCHECK_CONFIGURE_FLAGS=\"$config_args\"" -fi - export DISTCHECK_CONFIGURE_FLAGS=$config_args # diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index ba7ec977ba5..44b3810a926 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -12,7 +12,7 @@ # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.2 +Version: 3.1.3rc4 Release: 1%{?dist} License: BSD Group: Development/Libraries @@ -204,6 +204,7 @@ Prefix: %{_prefix} Provides: pmix Provides: pmix = %{version} BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root +BuildRequires: libevent-devel %if %{disable_auto_requires} AutoReq: no %endif @@ -230,6 +231,22 @@ scalability. This RPM contains all the tools necessary to compile and link against PMIx. +# if build_all_in_one_rpm = 0, build split packages +%if !%{build_all_in_one_rpm} +%package libpmi +Summary: PMI-1 and PMI-2 compatibility libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Conflicts: slurm-libpmi + +%description libpmi +The %{name}-libpmi package contains libpmi and libpmi2 libraries that provide +the respective APIs and a copy of the PMIx library – each API is translated +into its PMIx equivalent. This is especially targeted at apps/libs that are +hardcoded to dlopen “libpmi†or “libpmi2â€. +This package conflicts sith slurm-libpmi, which provides its own, incompatible +versions of libpmi.so and libpmi2.so. +%endif + ############################################################################# # # Prepatory Section @@ -346,6 +363,10 @@ export CFLAGS CXXFLAGS FCFLAGS # We don't need that in an RPM. find $RPM_BUILD_ROOT -name config.log -exec rm -f {} \; +# If we build separate RPMs, then move the libpmi.* and libpmi2.* compat libs +# out of the way +find $RPM_BUILD_ROOT -name 'libpmi.' | xargs rm -f + # First, the [optional] modulefile %if %{install_modulefile} @@ -490,6 +511,19 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %endif %doc README INSTALL LICENSE +# if building separate RPMs, split the compatibility libs +%if !%{build_all_in_one_rpm} +%exclude %{_libdir}/libpmi.* +%exclude %{_libdir}/libpmi2.* +%exclude %{_includedir}/pmi.* +%exclude %{_includedir}/pmi2.* + +%files libpmi +%{_libdir}/libpmi.* +%{_libdir}/libpmi2.* +%{_includedir}/pmi.* +%{_includedir}/pmi2.* +%endif ############################################################################# # @@ -497,6 +531,11 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT # ############################################################################# %changelog +* Tue Apr 30 2019 Kilian Cavalotti +- Enable multiple RPMs build to allow backward compatibility PMI-1 and PMI-2 + libs to be built separate. "rpmbuild --define 'build_all_in_one_rpm 0' ..." + will build separate pmix and pmix-libpmi RPMs. + * Tue Oct 17 2017 Ralph Castain - Add PMIx bin directory diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index 35aecfabbc2..a3039ff6748 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -272,6 +272,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_LOCAL_SIZE "pmix.local.size" // (uint32_t) #procs in this job on this node #define PMIX_NODE_SIZE "pmix.node.size" // (uint32_t) #procs across all jobs on this node #define PMIX_MAX_PROCS "pmix.max.size" // (uint32_t) max #procs for this job +#define PMIX_NUM_SLOTS "pmix.num.slots" // (uint32_t) #slots allocated #define PMIX_NUM_NODES "pmix.num.nodes" // (uint32_t) #nodes in this nspace @@ -989,6 +990,23 @@ typedef uint16_t pmix_iof_channel_t; #define PMIX_FWD_STDDIAG_CHANNEL 0x0008 #define PMIX_FWD_ALL_CHANNELS 0x00ff +/* define some "hooks" external libraries can use to + * intercept memory allocation/release operations */ +static inline void* pmix_malloc(size_t n) +{ + return malloc(n); +} + +static inline void pmix_free(void *m) +{ + free(m); +} + +static inline void* pmix_calloc(size_t n, size_t m) +{ + return calloc(n, m); +} + /* declare a convenience macro for checking keys */ #define PMIX_CHECK_KEY(a, b) \ (0 == strncmp((a)->key, (b), PMIX_MAX_KEYLEN)) @@ -1030,7 +1048,7 @@ typedef struct pmix_byte_object { #define PMIX_BYTE_OBJECT_CREATE(m, n) \ do { \ - (m) = (pmix_byte_object_t*)malloc((n) * sizeof(pmix_byte_object_t)); \ + (m) = (pmix_byte_object_t*)pmix_malloc((n) * sizeof(pmix_byte_object_t)); \ if (NULL != (m)) { \ memset((m), 0, (n)*sizeof(pmix_byte_object_t)); \ } \ @@ -1045,7 +1063,7 @@ typedef struct pmix_byte_object { #define PMIX_BYTE_OBJECT_DESTRUCT(m) \ do { \ if (NULL != (m)->bytes) { \ - free((m)->bytes); \ + pmix_free((m)->bytes); \ } \ } while(0) @@ -1055,10 +1073,10 @@ typedef struct pmix_byte_object { if (NULL != (m)) { \ for (_bon=0; _bon < n; _bon++) { \ if (NULL != (m)[_bon].bytes) { \ - free((m)[_bon].bytes); \ + pmix_free((m)[_bon].bytes); \ } \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while(0) @@ -1089,7 +1107,7 @@ typedef struct { #define PMIX_ENVAR_CREATE(m, n) \ do { \ - (m) = (pmix_envar_t*)calloc((n) , sizeof(pmix_envar_t)); \ + (m) = (pmix_envar_t*)pmix_calloc((n) , sizeof(pmix_envar_t)); \ } while (0) #define PMIX_ENVAR_FREE(m, n) \ do { \ @@ -1098,7 +1116,7 @@ typedef struct { for (_ek=0; _ek < (n); _ek++) { \ PMIX_ENVAR_DESTRUCT(&(m)[_ek]); \ } \ - free((m)); \ + pmix_free((m)); \ } \ } while (0) #define PMIX_ENVAR_CONSTRUCT(m) \ @@ -1110,11 +1128,11 @@ typedef struct { #define PMIX_ENVAR_DESTRUCT(m) \ do { \ if (NULL != (m)->envar) { \ - free((m)->envar); \ + pmix_free((m)->envar); \ (m)->envar = NULL; \ } \ if (NULL != (m)->value) { \ - free((m)->value); \ + pmix_free((m)->value); \ (m)->value = NULL; \ } \ } while(0) @@ -1148,14 +1166,14 @@ typedef struct pmix_data_buffer { } pmix_data_buffer_t; #define PMIX_DATA_BUFFER_CREATE(m) \ do { \ - (m) = (pmix_data_buffer_t*)calloc(1, sizeof(pmix_data_buffer_t)); \ + (m) = (pmix_data_buffer_t*)pmix_calloc(1, sizeof(pmix_data_buffer_t)); \ } while (0) #define PMIX_DATA_BUFFER_RELEASE(m) \ do { \ if (NULL != (m)->base_ptr) { \ - free((m)->base_ptr); \ + pmix_free((m)->base_ptr); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) #define PMIX_DATA_BUFFER_CONSTRUCT(m) \ @@ -1163,7 +1181,7 @@ typedef struct pmix_data_buffer { #define PMIX_DATA_BUFFER_DESTRUCT(m) \ do { \ if (NULL != (m)->base_ptr) { \ - free((m)->base_ptr); \ + pmix_free((m)->base_ptr); \ (m)->base_ptr = NULL; \ } \ (m)->pack_ptr = NULL; \ @@ -1194,12 +1212,12 @@ typedef struct pmix_proc { } pmix_proc_t; #define PMIX_PROC_CREATE(m, n) \ do { \ - (m) = (pmix_proc_t*)calloc((n) , sizeof(pmix_proc_t)); \ + (m) = (pmix_proc_t*)pmix_calloc((n) , sizeof(pmix_proc_t)); \ } while (0) #define PMIX_PROC_RELEASE(m) \ do { \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1213,7 +1231,7 @@ typedef struct pmix_proc { #define PMIX_PROC_FREE(m, n) \ do { \ if (NULL != (m)) { \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1263,7 +1281,7 @@ typedef struct pmix_proc_info { } pmix_proc_info_t; #define PMIX_PROC_INFO_CREATE(m, n) \ do { \ - (m) = (pmix_proc_info_t*)calloc((n) , sizeof(pmix_proc_info_t)); \ + (m) = (pmix_proc_info_t*)pmix_calloc((n) , sizeof(pmix_proc_info_t)); \ } while (0) #define PMIX_PROC_INFO_RELEASE(m) \ @@ -1279,11 +1297,11 @@ typedef struct pmix_proc_info { #define PMIX_PROC_INFO_DESTRUCT(m) \ do { \ if (NULL != (m)->hostname) { \ - free((m)->hostname); \ + pmix_free((m)->hostname); \ (m)->hostname = NULL; \ } \ if (NULL != (m)->executable_name) { \ - free((m)->executable_name); \ + pmix_free((m)->executable_name); \ (m)->executable_name = NULL; \ } \ } while(0) @@ -1295,7 +1313,7 @@ typedef struct pmix_proc_info { for (_k=0; _k < (n); _k++) { \ PMIX_PROC_INFO_DESTRUCT(&(m)[_k]); \ } \ - free((m)); \ + pmix_free((m)); \ } \ } while (0) @@ -1362,7 +1380,7 @@ typedef struct pmix_value { do { \ int _ii; \ pmix_value_t *_v; \ - (m) = (pmix_value_t*)calloc((n), sizeof(pmix_value_t)); \ + (m) = (pmix_value_t*)pmix_calloc((n), sizeof(pmix_value_t)); \ _v = (pmix_value_t*)(m); \ if (NULL != (m)) { \ for (_ii=0; _ii < (int)(n); _ii++) { \ @@ -1375,7 +1393,7 @@ typedef struct pmix_value { #define PMIX_VALUE_RELEASE(m) \ do { \ PMIX_VALUE_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1396,7 +1414,7 @@ typedef struct pmix_value { for (_vv=0; _vv < (n); _vv++) { \ PMIX_VALUE_DESTRUCT(&((m)[_vv])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1410,7 +1428,7 @@ typedef struct pmix_value { #define PMIX_VALUE_XFER(r, v, s) \ do { \ if (NULL == (v)) { \ - (v) = (pmix_value_t*)malloc(sizeof(pmix_value_t)); \ + (v) = (pmix_value_t*)pmix_malloc(sizeof(pmix_value_t)); \ if (NULL == (v)) { \ (r) = PMIX_ERR_NOMEM; \ } else { \ @@ -1488,9 +1506,11 @@ typedef struct pmix_info { #define PMIX_INFO_CREATE(m, n) \ do { \ pmix_info_t *_i; \ - (m) = (pmix_info_t*)calloc((n), sizeof(pmix_info_t)); \ - _i = (pmix_info_t*)(m); \ - _i[(n)-1].flags = PMIX_INFO_ARRAY_END; \ + (m) = (pmix_info_t*)pmix_calloc((n), sizeof(pmix_info_t)); \ + if (NULL != (m)) { \ + _i = (pmix_info_t*)(m); \ + _i[(n)-1].flags = PMIX_INFO_ARRAY_END; \ + } \ } while (0) #define PMIX_INFO_CONSTRUCT(m) \ @@ -1511,7 +1531,7 @@ typedef struct pmix_info { for (_is=0; _is < (n); _is++) { \ PMIX_INFO_DESTRUCT(&((m)[_is])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1570,13 +1590,13 @@ typedef struct pmix_pdata { /* utility macros for working with pmix_pdata_t structs */ #define PMIX_PDATA_CREATE(m, n) \ do { \ - (m) = (pmix_pdata_t*)calloc((n), sizeof(pmix_pdata_t)); \ + (m) = (pmix_pdata_t*)pmix_calloc((n), sizeof(pmix_pdata_t)); \ } while (0) #define PMIX_PDATA_RELEASE(m) \ do { \ PMIX_VALUE_DESTRUCT(&(m)->value); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1599,7 +1619,7 @@ typedef struct pmix_pdata { for (_ps=0; _ps < (n); _ps++) { \ PMIX_PDATA_DESTRUCT(&(_pdf[_ps])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1640,7 +1660,7 @@ typedef struct pmix_app { /* utility macros for working with pmix_app_t structs */ #define PMIX_APP_CREATE(m, n) \ do { \ - (m) = (pmix_app_t*)calloc((n), sizeof(pmix_app_t)); \ + (m) = (pmix_app_t*)pmix_calloc((n), sizeof(pmix_app_t)); \ } while (0) #define PMIX_APP_INFO_CREATE(m, n) \ @@ -1652,7 +1672,7 @@ typedef struct pmix_app { #define PMIX_APP_RELEASE(m) \ do { \ PMIX_APP_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1665,25 +1685,25 @@ typedef struct pmix_app { do { \ size_t _aii; \ if (NULL != (m)->cmd) { \ - free((m)->cmd); \ + pmix_free((m)->cmd); \ (m)->cmd = NULL; \ } \ if (NULL != (m)->argv) { \ for (_aii=0; NULL != (m)->argv[_aii]; _aii++) { \ - free((m)->argv[_aii]); \ + pmix_free((m)->argv[_aii]); \ } \ - free((m)->argv); \ + pmix_free((m)->argv); \ (m)->argv = NULL; \ } \ if (NULL != (m)->env) { \ for (_aii=0; NULL != (m)->env[_aii]; _aii++) { \ - free((m)->env[_aii]); \ + pmix_free((m)->env[_aii]); \ } \ - free((m)->env); \ + pmix_free((m)->env); \ (m)->env = NULL; \ } \ if (NULL != (m)->cwd) { \ - free((m)->cwd); \ + pmix_free((m)->cwd); \ (m)->cwd = NULL; \ } \ if (NULL != (m)->info) { \ @@ -1700,7 +1720,7 @@ typedef struct pmix_app { for (_as=0; _as < (n); _as++) { \ PMIX_APP_DESTRUCT(&((m)[_as])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -1715,7 +1735,7 @@ typedef struct pmix_query { /* utility macros for working with pmix_query_t structs */ #define PMIX_QUERY_CREATE(m, n) \ do { \ - (m) = (pmix_query_t*)calloc((n) , sizeof(pmix_query_t)); \ + (m) = (pmix_query_t*)pmix_calloc((n) , sizeof(pmix_query_t)); \ } while (0) #define PMIX_QUERY_QUALIFIERS_CREATE(m, n) \ @@ -1727,7 +1747,7 @@ typedef struct pmix_query { #define PMIX_QUERY_RELEASE(m) \ do { \ PMIX_QUERY_DESTRUCT((m)); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } while (0) @@ -1741,9 +1761,9 @@ typedef struct pmix_query { size_t _qi; \ if (NULL != (m)->keys) { \ for (_qi=0; NULL != (m)->keys[_qi]; _qi++) { \ - free((m)->keys[_qi]); \ + pmix_free((m)->keys[_qi]); \ } \ - free((m)->keys); \ + pmix_free((m)->keys); \ (m)->keys = NULL; \ } \ if (NULL != (m)->qualifiers) { \ @@ -1760,7 +1780,7 @@ typedef struct pmix_query { for (_qs=0; _qs < (n); _qs++) { \ PMIX_QUERY_DESTRUCT(&((m)[_qs])); \ } \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while (0) @@ -2431,7 +2451,7 @@ PMIX_EXPORT pmix_status_t PMIx_Data_pack(const pmix_proc_t *target, * status_code = PMIx_Data_unpack(buffer, (void*)&dest, &num_values, PMIX_INT32); * * num_values = 5; - * string_array = malloc(num_values*sizeof(char *)); + * string_array = pmix_malloc(num_values*sizeof(char *)); * status_code = PMIx_Data_unpack(buffer, (void*)(string_array), &num_values, PMIX_STRING); * * @endcode @@ -2500,20 +2520,20 @@ static inline void pmix_value_destruct(pmix_value_t * m) { if (PMIX_STRING == (m)->type) { if (NULL != (m)->data.string) { - free((m)->data.string); + pmix_free((m)->data.string); (m)->data.string = NULL; } } else if ((PMIX_BYTE_OBJECT == (m)->type) || (PMIX_COMPRESSED_STRING == (m)->type)) { if (NULL != (m)->data.bo.bytes) { - free((m)->data.bo.bytes); + pmix_free((m)->data.bo.bytes); (m)->data.bo.bytes = NULL; (m)->data.bo.size = 0; } } else if (PMIX_DATA_ARRAY == (m)->type) { if (NULL != (m)->data.darray) { pmix_darray_destruct((m)->data.darray); - free((m)->data.darray); + pmix_free((m)->data.darray); (m)->data.darray = NULL; } } else if (PMIX_ENVAR == (m)->type) { @@ -2557,12 +2577,12 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) char **_s = (char**)m->array; size_t _si; for (_si=0; _si < m->size; _si++) { - free(_s[_si]); + pmix_free(_s[_si]); } - free(m->array); + pmix_free(m->array); m->array = NULL; } else { - free(m->array); + pmix_free(m->array); } } } @@ -2598,38 +2618,40 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) PMIX_BYTE == (t) || \ PMIX_INT8 == (t) || \ PMIX_UINT8 == (t)) { \ - (m)->array = calloc((n), sizeof(int8_t)); \ + (m)->array = pmix_calloc((n), sizeof(int8_t)); \ + } else if (PMIX_POINTER == (t)) { \ + (m)->array = pmix_calloc((n), sizeof(void*)); \ } else if (PMIX_STRING == (t)) { \ - (m)->array = calloc((n), sizeof(char*)); \ + (m)->array = pmix_calloc((n), sizeof(char*)); \ } else if (PMIX_SIZE == (t)) { \ - (m)->array = calloc((n), sizeof(size_t)); \ + (m)->array = pmix_calloc((n), sizeof(size_t)); \ } else if (PMIX_PID == (t)) { \ - (m)->array = calloc((n), sizeof(pid_t)); \ + (m)->array = pmix_calloc((n), sizeof(pid_t)); \ } else if (PMIX_INT == (t) || \ PMIX_UINT == (t) || \ PMIX_STATUS == (t)) { \ - (m)->array = calloc((n), sizeof(int)); \ + (m)->array = pmix_calloc((n), sizeof(int)); \ } else if (PMIX_IOF_CHANNEL == (t) || \ PMIX_DATA_TYPE == (t) || \ PMIX_INT16 == (t) || \ PMIX_UINT16 == (t)) { \ - (m)->array = calloc((n), sizeof(int16_t)); \ + (m)->array = pmix_calloc((n), sizeof(int16_t)); \ } else if (PMIX_PROC_RANK == (t) || \ PMIX_INFO_DIRECTIVES == (t) || \ PMIX_INT32 == (t) || \ PMIX_UINT32 == (t)) { \ - (m)->array = calloc((n), sizeof(int32_t)); \ + (m)->array = pmix_calloc((n), sizeof(int32_t)); \ } else if (PMIX_INT64 == (t) || \ PMIX_UINT64 == (t)) { \ - (m)->array = calloc((n), sizeof(int64_t)); \ + (m)->array = pmix_calloc((n), sizeof(int64_t)); \ } else if (PMIX_FLOAT == (t)) { \ - (m)->array = calloc((n), sizeof(float)); \ + (m)->array = pmix_calloc((n), sizeof(float)); \ } else if (PMIX_DOUBLE == (t)) { \ - (m)->array = calloc((n), sizeof(double)); \ + (m)->array = pmix_calloc((n), sizeof(double)); \ } else if (PMIX_TIMEVAL == (t)) { \ - (m)->array = calloc((n), sizeof(struct timeval)); \ + (m)->array = pmix_calloc((n), sizeof(struct timeval)); \ } else if (PMIX_TIME == (t)) { \ - (m)->array = calloc((n), sizeof(time_t)); \ + (m)->array = pmix_calloc((n), sizeof(time_t)); \ } \ } else { \ (m)->array = NULL; \ @@ -2637,7 +2659,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) } while(0) #define PMIX_DATA_ARRAY_CREATE(m, n, t) \ do { \ - (m) = (pmix_data_array_t*)calloc(1, sizeof(pmix_data_array_t)); \ + (m) = (pmix_data_array_t*)pmix_calloc(1, sizeof(pmix_data_array_t)); \ PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ } while(0) @@ -2647,7 +2669,7 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) do { \ if (NULL != (m)) { \ PMIX_DATA_ARRAY_DESTRUCT(m); \ - free((m)); \ + pmix_free((m)); \ (m) = NULL; \ } \ } while(0) diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in index e5a74b5c2e3..a06bbfdfde7 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_rename.h.in @@ -444,6 +444,7 @@ #define pmix_output_close @PMIX_RENAME@pmix_output_close #define pmix_output_finalize @PMIX_RENAME@pmix_output_finalize #define pmix_output_get_verbosity @PMIX_RENAME@pmix_output_get_verbosity +#define pmix_output_check_verbosity @PMIX_RENAME@pmix_output_check_verbosity #define pmix_output_hexdump @PMIX_RENAME@pmix_output_hexdump #define pmix_output_init @PMIX_RENAME@pmix_output_init #define pmix_output_open @PMIX_RENAME@pmix_output_open @@ -452,7 +453,6 @@ #define pmix_output_set_output_file_info @PMIX_RENAME@pmix_output_set_output_file_info #define pmix_output_set_verbosity @PMIX_RENAME@pmix_output_set_verbosity #define pmix_output_switch @PMIX_RENAME@pmix_output_switch -#define pmix_output_verbose @PMIX_RENAME@pmix_output_verbose #define pmix_output_vverbose @PMIX_RENAME@pmix_output_vverbose #define pmix_path_access @PMIX_RENAME@pmix_path_access #define pmix_path_df @PMIX_RENAME@pmix_path_df diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in index 44987a65929..af4a00cd5df 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_version.h.in @@ -3,6 +3,8 @@ * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,5 +21,5 @@ #define PMIX_VERSION_MINOR @pmixminor@ #define PMIX_VERSION_RELEASE @pmixrelease@ -#define PMIX_NUMERIC_VERSION 0x00030100 +#define PMIX_NUMERIC_VERSION @pmixnumeric@ #endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h index ee605ca8cf1..d03f83de283 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_impl.h @@ -13,7 +13,7 @@ * Copyright (c) 2010-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -496,7 +496,7 @@ static inline int pmix_atomic_trylock(pmix_atomic_lock_t *lock) { int32_t unlocked = PMIX_ATOMIC_LOCK_UNLOCKED; - bool ret = pmix_atomic_compare_exchange_strong_32 (&lock->u.lock, &unlocked, PMIX_ATOMIC_LOCK_LOCKED); + bool ret = pmix_atomic_compare_exchange_strong_acq_32 (&lock->u.lock, &unlocked, PMIX_ATOMIC_LOCK_LOCKED); return (ret == false) ? 1 : 0; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h index 7c4a6089090..5fc5b0a1326 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/atomic_stdc.h @@ -2,7 +2,7 @@ /* * Copyright (c) 2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -72,7 +72,14 @@ static inline void pmix_atomic_wmb (void) static inline void pmix_atomic_rmb (void) { +#if PMIX_ASSEMBLY_ARCH == PMIX_X86_64 + /* work around a bug in older gcc versions (observed in gcc 6.x) + * where acquire seems to get treated as a no-op instead of being + * equivalent to __asm__ __volatile__("": : :"memory") on x86_64 */ + pmix_atomic_mb (); +#else atomic_thread_fence (memory_order_acquire); +#endif } #define pmix_atomic_compare_exchange_strong_32(addr, compare, value) atomic_compare_exchange_strong_explicit (addr, compare, value, memory_order_relaxed, memory_order_relaxed) diff --git a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h index cfb46eb5194..17134e11c16 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h +++ b/opal/mca/pmix/pmix3x/pmix/src/atomics/sys/powerpc/atomic.h @@ -13,7 +13,7 @@ * Copyright (c) 2010-2017 IBM Corporation. All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -99,27 +99,7 @@ void pmix_atomic_isync(void) ISYNC(); } -#elif PMIX_XLC_INLINE_ASSEMBLY /* end PMIX_GCC_INLINE_ASSEMBLY */ - -/* Yeah, I don't know who thought this was a reasonable syntax for - * inline assembly. Do these because they are used so often and they - * are fairly simple (aka: there is a tech pub on IBM's web site - * containing the right hex for the instructions). - */ - -#undef PMIX_HAVE_INLINE_ATOMIC_MEM_BARRIER -#define PMIX_HAVE_INLINE_ATOMIC_MEM_BARRIER 0 - -#pragma mc_func pmix_atomic_mb { "7c0004ac" } /* sync */ -#pragma reg_killed_by pmix_atomic_mb /* none */ - -#pragma mc_func pmix_atomic_rmb { "7c2004ac" } /* lwsync */ -#pragma reg_killed_by pmix_atomic_rmb /* none */ - -#pragma mc_func pmix_atomic_wmb { "7c2004ac" } /* lwsync */ -#pragma reg_killed_by pmix_atomic_wmb /* none */ - -#endif +#endif /* end PMIX_GCC_INLINE_ASSEMBLY */ /********************************************************************** * @@ -297,7 +277,7 @@ static inline bool pmix_atomic_compare_exchange_strong_64 (pmix_atomic_int64_t * #define pmix_atomic_sc_64(addr, value, ret) \ do { \ pmix_atomic_int64_t *_addr = (addr); \ - int64_t _foo, _newval = (int64_t) value; \ + int64_t _newval = (int64_t) value; \ int32_t _ret; \ \ __asm__ __volatile__ (" stdcx. %2, 0, %1 \n\t" \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index c2585ea84ae..574607ec4b0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -293,7 +293,7 @@ static pmix_status_t notify_server_of_event(pmix_status_t status, PMIX_RELEASE(cb); goto cleanup; } - } else { + } else if (NULL != cbfunc) { cbfunc(PMIX_SUCCESS, cbdata); } @@ -977,16 +977,6 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (!pmix_notify_check_range(&rngtrk, &proc)) { continue; } - if (NULL != cd->targets) { - /* track the number of targets we have left to notify */ - --cd->nleft; - /* if the event was cached and this is the last one, - * then evict this event from the cache */ - if (0 == cd->nleft) { - pmix_hotel_checkout(&pmix_globals.notifications, cd->room); - PMIX_RELEASE(cd); - } - } pmix_output_verbose(2, pmix_server_globals.event_output, "pmix_server: notifying client %s:%u on status %s", pr->peer->info->pname.nspace, pr->peer->info->pname.rank, @@ -1044,6 +1034,17 @@ static void _notify_client_event(int sd, short args, void *cbdata) if (PMIX_SUCCESS != rc) { PMIX_RELEASE(bfr); } + if (NULL != cd->targets && 0 < cd->nleft) { + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if the event was cached and this is the last one, + * then evict this event from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + holdcd = false; + break; + } + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c index 2607d6b101d..be2346048d8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c @@ -78,6 +78,8 @@ PMIX_CLASS_INSTANCE(pmix_rshift_caddy_t, static void check_cached_events(pmix_rshift_caddy_t *cd); +/* catch the event registration response message from the + * server and process it */ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, pmix_buffer_t *buf, void *cbdata) { @@ -100,7 +102,9 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, } else { PMIX_ERROR_LOG(ret); } - /* remove the err handler and call the error handler reg completion callback fn.*/ + /* remove the err handler and call the error handler + * reg completion callback fn so the requestor + * doesn't hang */ if (NULL == rb->list) { if (NULL != rb->hdlr) { PMIX_RELEASE(rb->hdlr); @@ -834,7 +838,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata) cd->evregcbfn(rc, index, cd->cbdata); } - /* check if any matching notifications have been cached */ + /* check if any matching notifications have been locally cached */ check_cached_events(cd); if (NULL != cd->codes) { free(cd->codes); diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 212b5b51014..202679cc4ee 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -110,6 +110,9 @@ typedef uint8_t pmix_cmd_t; /* provide a "pretty-print" function for cmds */ const char* pmix_command_string(pmix_cmd_t cmd); +/* provide a hook to init tool data */ +PMIX_EXPORT extern pmix_status_t pmix_tool_init_info(void); + /* define a set of flags to direct collection * of data during operations */ typedef enum { @@ -280,7 +283,7 @@ typedef struct { pmix_list_item_t super; pmix_event_t ev; bool event_active; - bool lost_connection; // tracker went thru lost connection procedure + bool host_called; // tracker has been passed up to host bool local; // operation is strictly local char *id; // string identifier for the collective pmix_cmd_t type; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt index 7a96e7ace8f..3c8a67f1990 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt @@ -10,8 +10,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2018 Intel, Inc. All rights reserved. +# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2018-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -60,3 +60,12 @@ all components *except* a and b", while "c,d" specifies the inclusive behavior and means "use *only* components c and d." You cannot mix inclusive and exclusive behavior. +# +[failed to add component dir] +The pmix_mca_base_component_path MCA variable was used to add paths to +search for PMIX components. At least one directory failed to add +properly: + + %s + +Check to make sure that this directory exists, is readable, etc. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c index eb7dda21b56..062b1cb75d6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_repository.c @@ -10,12 +10,12 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,6 +43,7 @@ #include "pmix_common.h" #include "src/class/pmix_hash_table.h" #include "src/util/basename.h" +#include "src/util/show_help.h" #if PMIX_HAVE_PDL_SUPPORT @@ -220,8 +221,13 @@ int pmix_mca_base_component_repository_add (const char *path) dir = pmix_mca_base_system_default_path; } - if (0 != pmix_pdl_foreachfile(dir, process_repository_item, NULL)) { - break; + if (0 != pmix_pdl_foreachfile(dir, process_repository_item, NULL) && + !(0 == strcmp(dir, pmix_mca_base_system_default_path) || 0 == strcmp(dir, pmix_mca_base_user_default_path))) { + // It is not an error if a directory fails to add (e.g., + // if it doesn't exist). But we should warn about it as + // it is something related to "show_load_errors" + pmix_show_help("help-pmix-mca-base.txt", + "failed to add component dir", true, dir); } } while (NULL != (dir = strtok_r (NULL, sep, &ctx))); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am index db788f3a7c8..5855a6aeae3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -51,6 +51,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v12_la_SOURCES = $(component_sources) mca_bfrops_v12_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v12_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v12_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am index ffe16123206..42eb14940aa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -51,6 +51,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v20_la_SOURCES = $(component_sources) mca_bfrops_v20_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v20_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v20_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am index d4da3258b44..1658de9d1db 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v21/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v21_la_SOURCES = $(component_sources) mca_bfrops_v21_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v21_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v21_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am index 14438eac7f1..d14a13258ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v3/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_bfrops_v3_la_SOURCES = $(component_sources) mca_bfrops_v3_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_bfrops_v3_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_bfrops_v3_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c index b9f8533c0ef..abec7a744da 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. @@ -79,7 +79,8 @@ pmix_status_t pmix_gds_base_setup_fork(const pmix_proc_t *proc, if (NULL == active->module->setup_fork) { continue; } - if (PMIX_SUCCESS != (rc = active->module->setup_fork(proc, env))) { + rc = active->module->setup_fork(proc, env); + if (PMIX_SUCCESS != rc && PMIX_ERR_NOT_AVAILABLE != rc) { return rc; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am index dc799c892f8..eae7ef34abc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2017 Mellanox Technologies, Inc. @@ -64,6 +64,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_gds_ds12_la_SOURCES = $(component_sources) mca_gds_ds12_la_LDFLAGS = -module -avoid-version \ $(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la +if NEED_LIBPMIX +mca_gds_ds12_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_ds12_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am index 215275754d7..06e1dd13a90 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2017-2018 Mellanox Technologies, Inc. @@ -56,6 +56,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_gds_ds21_la_SOURCES = $(component_sources) mca_gds_ds21_la_LDFLAGS = -module -avoid-version \ $(PMIX_TOP_BUILDDIR)/src/mca/common/dstore/libmca_common_dstore.la +if NEED_LIBPMIX +mca_gds_ds21_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_ds21_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c index 5e8b7be92b0..99713f5651e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c @@ -2,7 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -234,6 +234,7 @@ pmix_status_t pmix_gds_ds21_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c rc = PMIX_ERR_NOT_FOUND; goto error; } + seg_hdr = (segment_hdr_t*)lock_item->seg_desc->seg_info.seg_base_addr; } lock_item->num_locks = seg_hdr->num_locks; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am index 7d9da0189e2..4067145ff28 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_gds_hash_la_SOURCES = $(component_sources) mca_gds_hash_la_LIBADD = $(gds_hash_LIBS) mca_gds_hash_la_LDFLAGS = -module -avoid-version $(gds_hash_LDFLAGS) +if NEED_LIBPMIX +mca_gds_hash_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_gds_hash_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index 4b02d8faf21..4e092fc5a68 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -201,8 +201,16 @@ static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, return PMIX_SUCCESS; } +/* Define a bitmask to track what information may not have + * been provided but is computable from other info */ +#define PMIX_HASH_PROC_DATA 0x00000001 +#define PMIX_HASH_JOB_SIZE 0x00000002 +#define PMIX_HASH_MAX_PROCS 0x00000004 +#define PMIX_HASH_NUM_NODES 0x00000008 + static pmix_status_t store_map(pmix_hash_table_t *ht, - char **nodes, char **ppn) + char **nodes, char **ppn, + uint32_t flags) { pmix_status_t rc; pmix_value_t *val; @@ -212,6 +220,8 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, bool updated; pmix_kval_t *kp2; char **procs; + uint32_t totalprocs=0; + bool localldr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_map", @@ -223,6 +233,22 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_BAD_PARAM; } + /* if they didn't provide the number of nodes, then + * compute it from the list of nodes */ + if (!(PMIX_HASH_NUM_NODES & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NUM_NODES); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = pmix_argv_count(nodes); + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + for (n=0; NULL != nodes[n]; n++) { /* check and see if we already have data for this node */ val = NULL; @@ -240,18 +266,22 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, } iptr = (pmix_info_t*)val->data.darray->array; updated = false; + localldr = false; for (m=0; m < val->data.darray->size; m++) { - if (0 == strncmp(iptr[m].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCAL_PEERS)) { /* we will update this entry */ if (NULL != iptr[m].value.data.string) { free(iptr[m].value.data.string); } iptr[m].value.data.string = strdup(ppn[n]); - updated = true; - break; + updated = true; // no need to add the local_peers to the array + } else if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCALLDR)) { + rank = strtoul(ppn[n], NULL, 10); + iptr[m].value.data.rank = rank; + localldr = true; // no need to add localldr to the array } } - if (!updated) { + if (!updated || !localldr) { /* append this entry to the current data */ kp2 = PMIX_NEW(pmix_kval_t); if (NULL == kp2) { @@ -270,7 +300,18 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_NOMEM; } kp2->value->data.darray->type = PMIX_INFO; - kp2->value->data.darray->size = val->data.darray->size + 1; + /* if we didn't update the local leader, then we will + * add it here */ + m = 0; + if (!localldr) { + kp2->value->data.darray->size = val->data.darray->size + 1; + ++m; + } + /* if they didn't update the local peers, then we add it here */ + if (!updated) { + kp2->value->data.darray->size = val->data.darray->size + 1; + ++m; + } PMIX_INFO_CREATE(info, kp2->value->data.darray->size); if (NULL == info) { PMIX_RELEASE(kp2); @@ -280,7 +321,15 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, for (m=0; m < val->data.darray->size; m++) { PMIX_INFO_XFER(&info[m], &iptr[m]); } - PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-1], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + if (!updated) { + PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + --m; + } + if (!localldr) { + rank = strtoul(ppn[n], NULL, 10); + PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); + --m; + } kp2->value->data.darray->array = info; if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); @@ -308,14 +357,16 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return PMIX_ERR_NOMEM; } kp2->value->data.darray->type = PMIX_INFO; - PMIX_INFO_CREATE(info, 1); + PMIX_INFO_CREATE(info, 2); if (NULL == info) { PMIX_RELEASE(kp2); return PMIX_ERR_NOMEM; } PMIX_INFO_LOAD(&info[0], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); + rank = strtoul(ppn[n], NULL, 10); + PMIX_INFO_LOAD(&info[1], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); kp2->value->data.darray->array = info; - kp2->value->data.darray->size = 1; + kp2->value->data.darray->size = 2; if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -326,6 +377,7 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, /* split the list of procs so we can store their * individual location data */ procs = pmix_argv_split(ppn[n], ','); + totalprocs += pmix_argv_count(procs); for (m=0; NULL != procs[m]; m++) { /* store the hostname for each proc */ kp2 = PMIX_NEW(pmix_kval_t); @@ -341,6 +393,48 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return rc; } PMIX_RELEASE(kp2); // maintain acctg + if (!(PMIX_HASH_PROC_DATA & flags)) { + /* add an entry for the nodeid */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NODEID); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = n; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + /* add an entry for the local rank */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_LOCAL_RANK); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT16; + kp2->value->data.uint16 = m; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + /* add an entry for the node rank - for now, we assume + * only the one job is running */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NODE_RANK); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT16; + kp2->value->data.uint16 = m; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + pmix_argv_free(procs); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } } pmix_argv_free(procs); } @@ -360,6 +454,41 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, } PMIX_RELEASE(kp2); // maintain acctg + /* if they didn't provide the job size, compute it as + * being the number of provided procs (i.e., size of + * ppn list) */ + if (!(PMIX_HASH_JOB_SIZE & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_JOB_SIZE); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = totalprocs; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + + /* if they didn't provide a value for max procs, just + * assume it is the same as the number of procs in the + * job and store it */ + if (!(PMIX_HASH_MAX_PROCS & flags)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_MAX_PROCS); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = totalprocs; + if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + } + + return PMIX_SUCCESS; } @@ -376,6 +505,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_rank_t rank; pmix_status_t rc=PMIX_SUCCESS; size_t n, j, size, len; + uint32_t flags = 0; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:cache_job_info for nspace %s", @@ -431,29 +561,14 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, PMIX_ERROR_LOG(rc); goto release; } - /* if we have already found the proc map, then parse - * and store the detailed map */ - if (NULL != procs) { - if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs))) { - PMIX_ERROR_LOG(rc); - goto release; - } - } } else if (0 == strcmp(info[n].key, PMIX_PROC_MAP)) { /* parse the regex to get the argv array containing proc ranks on each node */ if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.string, &procs))) { PMIX_ERROR_LOG(rc); goto release; } - /* if we have already recv'd the node map, then parse - * and store the detailed map */ - if (NULL != nodes) { - if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs))) { - PMIX_ERROR_LOG(rc); - goto release; - } - } } else if (0 == strcmp(info[n].key, PMIX_PROC_DATA)) { + flags |= PMIX_HASH_PROC_DATA; /* an array of data pertaining to a specific proc */ if (PMIX_DATA_ARRAY != info[n].value.type) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); @@ -543,9 +658,15 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, goto release; } PMIX_RELEASE(kp2); // maintain acctg - /* if this is the job size, then store it */ - if (0 == strncmp(info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN)) { + /* if this is the job size, then store it in + * the nptr tracker and flag that we were given it */ + if (PMIX_CHECK_KEY(&info[n], PMIX_JOB_SIZE)) { nptr->nprocs = info[n].value.data.uint32; + flags |= PMIX_HASH_JOB_SIZE; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NUM_NODES)) { + flags |= PMIX_HASH_NUM_NODES; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_MAX_PROCS)) { + flags |= PMIX_HASH_MAX_PROCS; } } } @@ -577,6 +698,17 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, trk->gdata_added = true; } + /* we must have the proc AND node maps */ + if (NULL == procs || NULL == nodes) { + rc = PMIX_ERR_NOT_FOUND; + goto release; + } + + if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs, flags))) { + PMIX_ERROR_LOG(rc); + goto release; + } + release: if (NULL != nodes) { pmix_argv_free(nodes); @@ -644,25 +776,24 @@ static pmix_status_t register_info(pmix_peer_t *peer, for (rank=0; rank < ns->nprocs; rank++) { val = NULL; rc = pmix_hash_fetch(ht, rank, NULL, &val); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc && PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) { PMIX_ERROR_LOG(rc); if (NULL != val) { PMIX_VALUE_RELEASE(val); } return rc; } - if (NULL == val) { - return PMIX_ERR_NOT_FOUND; - } PMIX_CONSTRUCT(&buf, pmix_buffer_t); PMIX_BFROPS_PACK(rc, peer, &buf, &rank, 1, PMIX_PROC_RANK); - info = (pmix_info_t*)val->data.darray->array; - ninfo = val->data.darray->size; - for (n=0; n < ninfo; n++) { - kv.key = info[n].key; - kv.value = &info[n].value; - PMIX_BFROPS_PACK(rc, peer, &buf, &kv, 1, PMIX_KVAL); + if (NULL != val) { + info = (pmix_info_t*)val->data.darray->array; + ninfo = val->data.darray->size; + for (n=0; n < ninfo; n++) { + kv.key = info[n].key; + kv.value = &info[n].value; + PMIX_BFROPS_PACK(rc, peer, &buf, &kv, 1, PMIX_KVAL); + } } kv.key = PMIX_PROC_BLOB; kv.value = &blob; @@ -1327,7 +1458,6 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, val = NULL; rc = pmix_hash_fetch(ht, PMIX_RANK_WILDCARD, NULL, &val); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); if (NULL != val) { PMIX_VALUE_RELEASE(val); } @@ -1341,7 +1471,6 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, if (PMIX_DATA_ARRAY != val->type || NULL == val->data.darray || PMIX_INFO != val->data.darray->type) { - PMIX_ERROR_LOG(PMIX_ERR_INVALID_VAL); PMIX_VALUE_RELEASE(val); return PMIX_ERR_INVALID_VAL; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 index c5082065b23..1e749df5b2d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 @@ -1,8 +1,8 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2016-2017 Intel, Inc. All rights reserved. -dnl Copyright (c) 2016 Research Organization for Information Science +dnl Copyright (c) 2016-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2016-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl @@ -27,7 +27,7 @@ AC_DEFUN([MCA_pmix_pdl_CONFIG],[ # (we still need to configure them all so that things like "make # dist" work", but we just want the MCA system to (artificially) # conclude that it can't build any of the components. - AS_IF([test "$enable_dlopen" = "no"], + AS_IF([test $PMIX_ENABLE_DLOPEN_SUPPORT -eq 0], [want_pdl=0], [want_pdl=1]) MCA_CONFIGURE_FRAMEWORK([pdl], [$want_pdl]) @@ -35,7 +35,7 @@ AC_DEFUN([MCA_pmix_pdl_CONFIG],[ # If we found no suitable static pdl component and dlopen support # was not specifically disabled, this is an error. AS_IF([test "$MCA_pmix_pdl_STATIC_COMPONENTS" = "" && \ - test "$enable_dlopen" != "no"], + test $PMIX_ENABLE_DLOPEN_SUPPORT -eq 1], [AC_MSG_WARN([Did not find a suitable static pmix pdl component]) AC_MSG_WARN([You might need to install libltld (and its headers) or]) AC_MSG_WARN([specify --disable-dlopen to configure.]) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am index aa141f9d8ff..369a06269f3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/default/Makefile.am @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -40,6 +40,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_default_la_SOURCES = $(sources) mca_plog_default_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_default_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_default_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am index 497dfaaf1a7..0cdd43d60cb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/Makefile.am @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -40,6 +40,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_stdfd_la_SOURCES = $(sources) mca_plog_stdfd_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_stdfd_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_stdfd_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am index 7a09d28fac1..ba79c07fe73 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/Makefile.am @@ -10,7 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # $COPYRIGHT$ # @@ -40,6 +40,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_plog_syslog_la_SOURCES = $(sources) mca_plog_syslog_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_plog_syslog_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_plog_syslog_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index c4869da529d..d62268dbd52 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -209,7 +209,8 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { if (NULL != active->module->setup_fork) { - if (PMIX_SUCCESS != (rc = active->module->setup_fork(nptr, proc, env))) { + rc = active->module->setup_fork(nptr, proc, env); + if (PMIX_SUCCESS != rc && PMIX_ERR_NOT_AVAILABLE != rc) { return rc; } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am index 1223b43eca4..fe01cde836e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_pnet_opa_la_SOURCES = $(component_sources) mca_pnet_opa_la_LIBADD = $(pnet_opa_LIBS) mca_pnet_opa_la_LDFLAGS = -module -avoid-version $(pnet_opa_LDFLAGS) +if NEED_LIBPMIX +mca_pnet_opa_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_opa_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am index 946d81c8fba..048f34b0b63 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -49,6 +49,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_pnet_tcp_la_SOURCES = $(component_sources) mca_pnet_tcp_la_LIBADD = $(pnet_tcp_LIBS) mca_pnet_tcp_la_LDFLAGS = -module -avoid-version $(pnet_tcp_LDFLAGS) +if NEED_LIBPMIX +mca_pnet_tcp_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_tcp_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am index 3faf68a32c2..b71000ef555 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -46,6 +46,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_pnet_test_la_SOURCES = $(component_sources) mca_pnet_test_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_pnet_test_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pnet_test_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am index fa51393622f..607dcdb0c96 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_preg_native_la_SOURCES = $(component_sources) mca_preg_native_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_preg_native_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_preg_native_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c index 0d31f96435a..0c9d6188a0d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -893,7 +893,7 @@ static pmix_status_t regex_parse_value_range(char *base, char *range, for (found = false, i = 0; i < len; ++i) { if (isdigit((int) range[i])) { if (!found) { - start = atoi(range + i); + start = strtol(range + i, NULL, 10); found = true; break; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am new file mode 100644 index 00000000000..1dd3853eb2d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/Makefile.am @@ -0,0 +1,59 @@ +# -*- makefile -*- +# +# Copyright (c) 2004-2005 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) 2012 Los Alamos National Security, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Mellanox Technologies, Inc. +# All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +if MCA_BUILD_PSEC_DUMMY_HANDSHAKE + +headers = psec_dummy_handshake.h +sources = \ + psec_dummy_handshake_component.c \ + psec_dummy_handshake.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_pmix_psec_dummy_handshake_DSO +lib = +lib_sources = +component = mca_psec_dummy_handshake.la +component_sources = $(headers) $(sources) +else +lib = libmca_psec_dummy_handshake.la +lib_sources = $(headers) $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(pmixlibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_psec_dummy_handshake_la_SOURCES = $(component_sources) +mca_psec_dummy_handshake_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_dummy_handshake_la_LIBADD = $(top_builddir)/src/libpmix.la +endif + +noinst_LTLIBRARIES = $(lib) +libmca_psec_dummy_handshake_la_SOURCES = $(lib_sources) +libmca_psec_dummy_handshake_la_LDFLAGS = -module -avoid-version + +endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c new file mode 100644 index 00000000000..ae1f9b62e59 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c @@ -0,0 +1,170 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include + +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#include + +#include "src/include/pmix_globals.h" +#include "src/util/error.h" +#include "src/util/output.h" + +#include "src/mca/psec/base/base.h" +#include "psec_dummy_handshake.h" + +#include "src/mca/ptl/base/base.h" + +#define PMIX_PSEC_DUMMY_HNDSHK_STR "PMIX_PSEC_DUMMY_HANDSHAKE_STRING" + +static pmix_status_t simple_init(void); +static void simple_finalize(void); +static pmix_status_t create_cred(struct pmix_peer_t *peer, + const pmix_info_t directives[], size_t ndirs, + pmix_info_t **info, size_t *ninfo, + pmix_byte_object_t *cred); +static pmix_status_t client_hndshk(int sd); +static pmix_status_t server_hndshk(int sd); + +pmix_psec_module_t pmix_dummy_handshake_module = { + .name = "dummy_handshake", + /** init/finalize */ + .init = simple_init, + .finalize = simple_finalize, + /** Client-side */ + .create_cred = create_cred, + .client_handshake = client_hndshk, + /** Server-side */ + .validate_cred = NULL, + .server_handshake = server_hndshk +}; + +static pmix_status_t simple_init(void) +{ + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple init"); + return PMIX_SUCCESS; +} + +static void simple_finalize(void) +{ + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple finalize"); +} + +static pmix_status_t create_cred(struct pmix_peer_t *peer, + const pmix_info_t directives[], size_t ndirs, + pmix_info_t **info, size_t *ninfo, + pmix_byte_object_t *cred) +{ + char mycred[] = "dymmy_cred"; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple create_cred"); + + /* ensure initialization */ + PMIX_BYTE_OBJECT_CONSTRUCT(cred); + + cred->bytes = strdup(mycred); + cred->size = strlen(mycred) + 1; + + return PMIX_SUCCESS; +} + +static pmix_status_t server_hndshk(int sd) +{ + pmix_status_t rc, status = PMIX_SUCCESS; + char *hndshk_msg = NULL; + size_t size; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple server_hndshk"); + + asprintf(&hndshk_msg, "%s", PMIX_PSEC_DUMMY_HNDSHK_STR); + size = strlen(hndshk_msg); + + /* send size of handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, (char*)&size, + sizeof(size)))) { + goto exit; + } + /* send handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, hndshk_msg, + size))) { + goto exit; + } + /* recv hadshake status from client */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)&status, + sizeof(status)))) { + goto exit; + } + rc = status; + pmix_output(0, "[%s:%d] psec handshake status %d recv from client", + __FILE__, __LINE__, status); + +exit: + if (NULL != hndshk_msg) { + free(hndshk_msg); + } + + return rc; +} + +static pmix_status_t client_hndshk(int sd) +{ + char *hndshk_msg = NULL; + size_t size; + pmix_status_t rc, status = PMIX_SUCCESS; + + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, + "psec: simple client_hndshk"); + + /* recv size of handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)&size, + sizeof(size_t)))) { + return rc; + } + hndshk_msg = (char*)malloc(size); + /* recv handshake message */ + if (PMIX_SUCCESS != (rc = pmix_ptl_base_recv_blocking(sd, (char*)hndshk_msg, + size))) { + free(hndshk_msg); + return rc; + } + /* verifying handshake data */ + if (size != strlen(PMIX_PSEC_DUMMY_HNDSHK_STR)) { + rc = PMIX_ERR_HANDSHAKE_FAILED; + goto exit; + } + if (0 != strncmp(hndshk_msg, PMIX_PSEC_DUMMY_HNDSHK_STR, size)) { + rc = PMIX_ERR_HANDSHAKE_FAILED; + goto exit; + } + + /* send hadshake status to the server */ + status = PMIX_SUCCESS; + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(sd, (char*)&status, + sizeof(status)))) { + goto exit; + } + pmix_output(0, "[%s:%d] psec handshake status %d sent to server", + __FILE__, __LINE__, status); +exit: + if (NULL != hndshk_msg) { + free(hndshk_msg); + } + return rc; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h new file mode 100644 index 00000000000..74cc3632213 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h @@ -0,0 +1,29 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef PMIX_SIMPLE_H +#define PMIX_SIMPLE_H + +#include + + +#include "src/mca/psec/psec.h" + +BEGIN_C_DECLS + +/* the component must be visible data for the linker to find it */ +PMIX_EXPORT extern pmix_psec_base_component_t mca_psec_dummy_handshake_component; +extern pmix_psec_module_t pmix_dummy_handshake_module; + +END_C_DECLS + +#endif diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c new file mode 100644 index 00000000000..53fb13b6fed --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c @@ -0,0 +1,73 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. + * Copyright (c) 2019 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include "pmix_common.h" + +#include "src/mca/base/pmix_mca_base_var.h" +#include "src/mca/psec/psec.h" +#include "psec_dummy_handshake.h" + +static pmix_status_t component_open(void); +static pmix_status_t component_close(void); +static pmix_status_t component_query(pmix_mca_base_module_t **module, int *priority); +static pmix_psec_module_t* assign_module(void); + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +pmix_psec_base_component_t mca_psec_dummy_handshake_component = { + .base = { + PMIX_PSEC_BASE_VERSION_1_0_0, + + /* Component name and version */ + .pmix_mca_component_name = "dummy_handshake", + PMIX_MCA_BASE_MAKE_VERSION(component, + PMIX_MAJOR_VERSION, + PMIX_MINOR_VERSION, + PMIX_RELEASE_VERSION), + + /* Component open and close functions */ + .pmix_mca_open_component = component_open, + .pmix_mca_close_component = component_close, + .pmix_mca_query_component = component_query, + }, + .data = { + /* The component is checkpoint ready */ + PMIX_MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + .assign_module = assign_module +}; + +static int component_open(void) +{ + return PMIX_SUCCESS; +} + +static int component_query(pmix_mca_base_module_t **module, int *priority) +{ + *priority = 100; + *module = (pmix_mca_base_module_t *)&pmix_dummy_handshake_module; + return PMIX_SUCCESS; +} + + +static int component_close(void) +{ + return PMIX_SUCCESS; +} + +static pmix_psec_module_t* assign_module(void) +{ + return &pmix_dummy_handshake_module; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am index 5f01461190c..79756320d6a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/munge/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -47,6 +47,9 @@ mcacomponent_LTLIBRARIES = $(component) mca_psec_munge_la_SOURCES = $(component_sources) mca_psec_munge_la_LDFLAGS = -module -avoid-version $(psec_munge_LDFLAGS) mca_psec_munge_la_LIBADD = $(psec_munge_LIBS) +if NEED_LIBPMIX +mca_psec_munge_la_LIBADD += $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_munge_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am index 9381d8ad60f..b1086a2aac2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_psec_native_la_SOURCES = $(component_sources) mca_psec_native_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_native_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_native_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c index 1af787399a5..60af0f7af1a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/native/psec_native.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -25,7 +25,7 @@ #include "src/util/error.h" #include "src/util/output.h" -#include "src/mca/psec/psec.h" +#include "src/mca/psec/base/base.h" #include "psec_native.h" static pmix_status_t native_init(void); @@ -49,14 +49,14 @@ pmix_psec_module_t pmix_native_module = { static pmix_status_t native_init(void) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native init"); return PMIX_SUCCESS; } static void native_finalize(void) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native finalize"); } @@ -167,7 +167,7 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, size_t n, m; uint32_t u32; - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: native validate_cred %s", (NULL == cred) ? "NULL" : "NON-NULL"); @@ -175,10 +175,10 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, /* usock protocol - get the remote side's uid/gid */ #if defined(SO_PEERCRED) && (defined(HAVE_STRUCT_UCRED_UID) || defined(HAVE_STRUCT_UCRED_CR_UID)) /* Ignore received 'cred' and validate ucred for socket instead. */ - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec:native checking getsockopt on socket %d for peer credentials", pr->sd); if (getsockopt(pr->sd, SOL_SOCKET, SO_PEERCRED, &ucred, &crlen) < 0) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: getsockopt SO_PEERCRED failed: %s", strerror (pmix_socket_errno)); return PMIX_ERR_INVALID_CRED; @@ -192,10 +192,10 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, #endif #elif defined(HAVE_GETPEEREID) - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec:native checking getpeereid on socket %d for peer credentials", pr->sd); if (0 != getpeereid(pr->sd, &euid, &egid)) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: getsockopt getpeereid failed: %s", strerror (pmix_socket_errno)); return PMIX_ERR_INVALID_CRED; @@ -255,14 +255,14 @@ static pmix_status_t validate_cred(struct pmix_peer_t *peer, /* check uid */ if (euid != pr->info->uid) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: socket cred contains invalid uid %u", euid); return PMIX_ERR_INVALID_CRED; } /* check gid */ if (egid != pr->info->gid) { - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_psec_base_framework.framework_output, "psec: socket cred contains invalid gid %u", egid); return PMIX_ERR_INVALID_CRED; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am index 74236996375..cde03ba502f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/none/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_psec_none_la_SOURCES = $(component_sources) mca_psec_none_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psec_none_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_psec_none_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h index 4057681f6f6..10c31e9bfa3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h @@ -1,10 +1,11 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -155,23 +156,12 @@ PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options pmix_output_verbose(2, pmix_globals.debug_output, \ "credential validated"); \ } \ - /* send them the result */ \ - if (PMIX_SUCCESS != (_r = pmix_ptl_base_send_blocking((p)->sd, (char*)&(_r), sizeof(int)))) { \ - PMIX_ERROR_LOG(_r); \ - } \ (r) = _r; \ } else if (NULL != (p)->nptr->compat.psec->server_handshake) { \ - /* execute the handshake if the security mode calls for it */ \ + /* request the handshake if the security mode calls for it */ \ pmix_output_verbose(2, pmix_globals.debug_output, \ - "executing handshake"); \ + "requesting handshake"); \ _r = PMIX_ERR_READY_FOR_HANDSHAKE; \ - if (PMIX_SUCCESS != (_r = pmix_ptl_base_send_blocking((p)->sd, (char*)&(_r), sizeof(int)))) { \ - PMIX_ERROR_LOG(_r); \ - } else { \ - if (PMIX_SUCCESS != (_r = p->nptr->compat.psec->server_handshake((p)->sd))) { \ - PMIX_ERROR_LOG(_r); \ - } \ - } \ (r) = _r; \ } else { \ /* this is not allowed */ \ @@ -179,6 +169,21 @@ PMIX_EXPORT pmix_psec_module_t* pmix_psec_base_assign_module(const char *options } \ } while(0) + +#define PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(r, p, d, nd, in, nin, c) \ + if(PMIX_ERR_READY_FOR_HANDSHAKE == r) { \ + int _r; \ + /* execute the handshake if the security mode calls for it */ \ + pmix_output_verbose(2, pmix_globals.debug_output, \ + "executing handshake"); \ + if (PMIX_SUCCESS != (_r = p->nptr->compat.psec->server_handshake((p)->sd))) { \ + PMIX_ERROR_LOG(_r); \ + } \ + /* Update the reply status */ \ + (r) = _r; \ + } + + /**** COMPONENT STRUCTURE DEFINITION ****/ /* define a component-level API for initializing the component */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am index 30dce46e38e..638fcd6a32a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/file/Makefile.am @@ -1,6 +1,6 @@ # # Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -31,6 +31,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_psensor_file_la_SOURCES = $(sources) mca_psensor_file_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psensor_file_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_psensor_file_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am index df4fe0466a7..95b978415d3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psensor/heartbeat/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. # -# Copyright (c) 2017 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -32,6 +32,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component_install) mca_psensor_heartbeat_la_SOURCES = $(sources) mca_psensor_heartbeat_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_psensor_heartbeat_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(component_noinst) libmca_psensor_heartbeat_la_SOURCES =$(sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am index 68ba424b719..1483ae5de01 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/Makefile.am @@ -2,6 +2,7 @@ # # Copyright (c) 2017 Mellanox Technologies, Inc. # All rights reserved. +# Copyright (c) 2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -36,6 +37,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_pshmem_mmap_la_SOURCES = $(component_sources) mca_pshmem_mmap_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_pshmem_mmap_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_pshmem_mmap_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 0b465340bee..043a68e1388 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -55,13 +55,6 @@ static void _notify_complete(pmix_status_t status, void *cbdata) PMIX_RELEASE(chain); } -static void _timeout(int sd, short args, void *cbdata) -{ - pmix_server_trkr_t *trk = (pmix_server_trkr_t*)cbdata; - - PMIX_RELEASE(trk); -} - static void lcfn(pmix_status_t status, void *cbdata) { pmix_peer_t *peer = (pmix_peer_t*)cbdata; @@ -76,7 +69,6 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) pmix_ptl_posted_recv_t *rcv; pmix_buffer_t buf; pmix_ptl_hdr_t hdr; - struct timeval tv = {1200, 0}; pmix_proc_t proc; pmix_status_t rc; @@ -114,59 +106,60 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) /* remove it from the list */ pmix_list_remove_item(&trk->local_cbs, &rinfo->super); PMIX_RELEASE(rinfo); - trk->lost_connection = true; // mark that a peer's connection was lost - if (0 == pmix_list_get_size(&trk->local_cbs)) { - /* this tracker is complete, so release it - there - * is nobody waiting for a response */ - pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - break; + /* if the host has already been called for this tracker, + * then do nothing here - just wait for the host to return + * from the operation */ + if (trk->host_called) { + continue; } - /* if there are other participants waiting for a response, - * we need to let them know that this proc has disappeared - * as otherwise the collective will never complete */ - if (PMIX_FENCENB_CMD == trk->type) { - if (NULL != trk->modexcbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->modexcbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, NULL, 0, trk, NULL, NULL); - } - } else if (PMIX_CONNECTNB_CMD == trk->type) { - if (NULL != trk->op_cbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); - } - } else if (PMIX_DISCONNECTNB_CMD == trk->type) { - if (NULL != trk->op_cbfunc) { - /* do NOT release the tracker here as the host may - * have a copy they will return later. However, they - * might never call back, so set a LONG timeout to - * we avoid a memory leak if they don't */ - pmix_event_evtimer_set(pmix_globals.evbase, &trk->ev, - _timeout, trk); - pmix_event_evtimer_add(&trk->ev, &tv); - trk->event_active = true; - trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + if (trk->def_complete && trk->nlocal == pmix_list_get_size(&trk->local_cbs)) { + /* if this is a local-only collective, then resolve it now */ + if (trk->local) { + /* everyone else has called in - we need to let them know + * that this proc has disappeared + * as otherwise the collective will never complete */ + if (PMIX_FENCENB_CMD == trk->type) { + if (NULL != trk->modexcbfunc) { + trk->modexcbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, NULL, 0, trk, NULL, NULL); + } + } else if (PMIX_CONNECTNB_CMD == trk->type) { + if (NULL != trk->op_cbfunc) { + trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + } + } else if (PMIX_DISCONNECTNB_CMD == trk->type) { + if (NULL != trk->op_cbfunc) { + trk->op_cbfunc(PMIX_ERR_LOST_CONNECTION_TO_CLIENT, trk); + } + } + } else { + /* if the host has not been called, then we need to see if + * the collective is locally complete without this lost + * participant. If so, then we need to pass the call + * up to the host as otherwise the global collective will hang */ + if (PMIX_FENCENB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.fence_nb(trk->pcs, trk->npcs, + trk->info, trk->ninfo, + NULL, 0, trk->modexcbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } else if (PMIX_CONNECTNB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.connect(trk->pcs, trk->npcs, trk->info, trk->ninfo, trk->op_cbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } else if (PMIX_DISCONNECTNB_CMD == trk->type) { + trk->host_called = true; + rc = pmix_host_server.disconnect(trk->pcs, trk->npcs, trk->info, trk->ninfo, trk->op_cbfunc, trk); + if (PMIX_SUCCESS != rc) { + pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); + PMIX_RELEASE(trk); + } + } } } } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am index 6788aba19c4..0a5b86bfdac 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_ptl_tcp_la_SOURCES = $(component_sources) mca_ptl_tcp_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_ptl_tcp_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_ptl_tcp_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index e921cd599c7..0252eed51c2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -1411,7 +1411,18 @@ static pmix_status_t recv_connect_ack(int sd, uint8_t myflag) pmix_client_globals.myserver->info->pname.rank); /* get the returned status from the security handshake */ - pmix_ptl_base_recv_blocking(sd, (char*)&reply, sizeof(pmix_status_t)); + rc = pmix_ptl_base_recv_blocking(sd, (char*)&u32, sizeof(pmix_status_t)); + if (PMIX_SUCCESS != rc) { + if (sockopt) { + /* return the socket to normal */ + if (0 != setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &save, sz)) { + return PMIX_ERR_UNREACH; + } + } + return rc; + } + + reply = ntohl(u32); if (PMIX_SUCCESS != reply) { /* see if they want us to do the handshake */ if (PMIX_ERR_READY_FOR_HANDSHAKE == reply) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h index f5373f65069..5813bc7085c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -48,6 +48,7 @@ typedef struct { struct sockaddr_storage connection; char *session_filename; char *nspace_filename; + char *pid_filename; char *system_filename; char *rendezvous_filename; int wait_to_connect; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index 7f3138d52c6..61eb18ec305 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -15,7 +15,8 @@ * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -117,6 +118,7 @@ static pmix_status_t setup_fork(const pmix_proc_t *proc, char ***env); .disable_ipv6_family = true, .session_filename = NULL, .nspace_filename = NULL, + .pid_filename = NULL, .system_filename = NULL, .rendezvous_filename = NULL, .wait_to_connect = 4, @@ -297,6 +299,10 @@ pmix_status_t component_close(void) unlink(mca_ptl_tcp_component.nspace_filename); free(mca_ptl_tcp_component.nspace_filename); } + if (NULL != mca_ptl_tcp_component.pid_filename) { + unlink(mca_ptl_tcp_component.pid_filename); + free(mca_ptl_tcp_component.pid_filename); + } if (NULL != mca_ptl_tcp_component.rendezvous_filename) { unlink(mca_ptl_tcp_component.rendezvous_filename); free(mca_ptl_tcp_component.rendezvous_filename); @@ -750,10 +756,10 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, FILE *fp; pid_t mypid; - /* first output to a file based on pid */ + /* first output to a std file */ mypid = getpid(); - if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool.%d", - mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) { + if (0 > asprintf(&mca_ptl_tcp_component.session_filename, "%s/pmix.%s.tool", + mca_ptl_tcp_component.session_tmpdir, myhost)) { CLOSE_THE_SOCKET(lt->socket); goto sockerror; } @@ -784,6 +790,40 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, goto sockerror; } + /* now output to a file based on pid */ + mypid = getpid(); + if (0 > asprintf(&mca_ptl_tcp_component.pid_filename, "%s/pmix.%s.tool.%d", + mca_ptl_tcp_component.session_tmpdir, myhost, mypid)) { + CLOSE_THE_SOCKET(lt->socket); + goto sockerror; + } + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "WRITING TOOL FILE %s", + mca_ptl_tcp_component.pid_filename); + fp = fopen(mca_ptl_tcp_component.pid_filename, "w"); + if (NULL == fp) { + pmix_output(0, "Impossible to open the file %s in write mode\n", mca_ptl_tcp_component.pid_filename); + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.pid_filename); + mca_ptl_tcp_component.pid_filename = NULL; + goto sockerror; + } + + /* output my URI */ + fprintf(fp, "%s\n", lt->uri); + /* add a flag that indicates we accept v2.1 protocols */ + fprintf(fp, "%s\n", PMIX_VERSION); + fclose(fp); + /* set the file mode */ + if (0 != chmod(mca_ptl_tcp_component.pid_filename, S_IRUSR | S_IWUSR | S_IRGRP)) { + PMIX_ERROR_LOG(PMIX_ERR_FILE_OPEN_FAILURE); + CLOSE_THE_SOCKET(lt->socket); + free(mca_ptl_tcp_component.pid_filename); + mca_ptl_tcp_component.pid_filename = NULL; + goto sockerror; + } + /* now output it into a file based on my nspace */ if (0 > asprintf(&mca_ptl_tcp_component.nspace_filename, "%s/pmix.%s.tool.%s", @@ -957,7 +997,7 @@ static void connection_handler(int sd, short args, void *cbdata) pmix_ptl_hdr_t hdr; pmix_peer_t *peer; pmix_rank_t rank=0; - pmix_status_t rc; + pmix_status_t rc, reply; char *msg, *mg, *version; char *sec, *bfrops, *gds; pmix_bfrop_buffer_type_t bftype; @@ -1351,11 +1391,21 @@ static void connection_handler(int sd, short args, void *cbdata) } } if (NULL == nptr) { - /* we don't know this namespace, reject it */ - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_FOUND; - goto error; + /* it is possible that this is a tool inside of + * a job-script as part of a multi-spawn operation. + * Since each tool invocation may have finalized and + * terminated, the tool will appear to "terminate", thus + * causing us to cleanup all references to it, and then + * reappear. So we don't reject this connection request. + * Instead, we create the nspace and rank objects for + * it and let the RM/host decide if this behavior + * is allowed */ + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + rc = PMIX_ERR_NOMEM; + goto error; + } + nptr->nspace = strdup(nspace); } /* now look for the rank */ info = NULL; @@ -1367,11 +1417,13 @@ static void connection_handler(int sd, short args, void *cbdata) } } if (!found) { - /* rank unknown, reject it */ - free(msg); - /* send an error reply to the client */ - rc = PMIX_ERR_NOT_FOUND; - goto error; + /* see above note about not finding nspace */ + info = PMIX_NEW(pmix_rank_info_t); + info->pname.nspace = strdup(nspace); + info->pname.rank = rank; + info->uid = pnd->uid; + info->gid = pnd->gid; + pmix_list_append(&nptr->ranks, &info->super); } PMIX_RETAIN(info); peer->info = info; @@ -1610,22 +1662,13 @@ static void connection_handler(int sd, short args, void *cbdata) /* validate the connection */ cred.bytes = pnd->cred; cred.size = pnd->len; - PMIX_PSEC_VALIDATE_CONNECTION(rc, peer, NULL, 0, NULL, NULL, &cred); - if (PMIX_SUCCESS != rc) { - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "validation of client connection failed"); - info->proc_cnt--; - pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); - PMIX_RELEASE(peer); - /* send an error reply to the client */ - goto error; - } + PMIX_PSEC_VALIDATE_CONNECTION(reply, peer, NULL, 0, NULL, NULL, &cred); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "client connection validated"); + "client connection validated with status=%d", reply); /* tell the client all is good */ - u32 = htonl(PMIX_SUCCESS); + u32 = htonl(reply); if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { PMIX_ERROR_LOG(rc); info->proc_cnt--; @@ -1635,6 +1678,22 @@ static void connection_handler(int sd, short args, void *cbdata) PMIX_RELEASE(pnd); return; } + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, peer, NULL, 0, NULL, NULL, &cred); + + /* It is possible that connection validation failed + * We need to reply to the client first and cleanup after */ + if (PMIX_SUCCESS != reply) { + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "validation of client connection failed"); + info->proc_cnt--; + pmix_pointer_array_set_item(&pmix_server_globals.clients, peer->index, NULL); + PMIX_RELEASE(peer); + /* send an error reply to the client */ + goto error; + } + + /* send the client's array index */ u32 = htonl(peer->index); if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { @@ -1697,7 +1756,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) pmix_namespace_t *nptr; pmix_rank_info_t *info; pmix_peer_t *peer; - int rc; + pmix_status_t rc, reply; uint32_t u32; pmix_info_t ginfo; pmix_byte_object_t cred; @@ -1856,8 +1915,23 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* validate the connection */ cred.bytes = pnd->cred; cred.size = pnd->len; - PMIX_PSEC_VALIDATE_CONNECTION(rc, peer, NULL, 0, NULL, NULL, &cred); - if (PMIX_SUCCESS != rc) { + PMIX_PSEC_VALIDATE_CONNECTION(reply, peer, NULL, 0, NULL, NULL, &cred); + /* communicate the result to the other side */ + u32 = htonl(reply); + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(peer); + pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + PMIX_RELEASE(nptr); // will release the info object + CLOSE_THE_SOCKET(pnd->sd); + goto done; + } + + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, peer, NULL, 0, NULL, NULL, &cred); + + /* If verification wasn't successful - stop here */ + if (PMIX_SUCCESS != reply) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "validation of tool credentials failed: %s", PMIx_Error_string(rc)); @@ -1880,7 +1954,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) /* probably cannot send an error reply if we are out of memory */ return; } - info->peerid = peer->index; + peer->info->peerid = peer->index; /* start the events for this tool */ pmix_event_assign(&peer->recv_event, pmix_globals.evbase, peer->sd, @@ -1906,8 +1980,8 @@ static void cnct_cbfunc(pmix_status_t status, pmix_setup_caddy_t *cd; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "pmix:tcp:cnct_cbfunc returning %s:%d", - proc->nspace, proc->rank); + "pmix:tcp:cnct_cbfunc returning %s:%d %s", + proc->nspace, proc->rank, PMIx_Error_string(status)); /* need to thread-shift this into our context */ cd = PMIX_NEW(pmix_setup_caddy_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am index e6606e2e844..2c91ac37c8d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/Makefile.am @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2016 Intel, Inc. All rights reserved +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -44,6 +44,9 @@ mcacomponentdir = $(pmixlibdir) mcacomponent_LTLIBRARIES = $(component) mca_ptl_usock_la_SOURCES = $(component_sources) mca_ptl_usock_la_LDFLAGS = -module -avoid-version +if NEED_LIBPMIX +mca_ptl_usock_la_LIBADD = $(top_builddir)/src/libpmix.la +endif noinst_LTLIBRARIES = $(lib) libmca_ptl_usock_la_SOURCES = $(lib_sources) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index 7cb073db767..ef33e766f9c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -12,10 +12,11 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -150,6 +151,10 @@ pmix_status_t component_close(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { + if (PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + return PMIX_ERR_NOT_SUPPORTED; + } + *module = (pmix_mca_base_module_t*)&pmix_ptl_usock_module; return PMIX_SUCCESS; } @@ -339,7 +344,7 @@ static void connection_handler(int sd, short args, void *cbdata) { pmix_pending_connection_t *pnd = (pmix_pending_connection_t*)cbdata; char *msg, *ptr, *nspace, *version, *sec, *bfrops, *gds; - pmix_status_t rc; + pmix_status_t rc, reply; unsigned int rank; pmix_usock_hdr_t hdr; pmix_namespace_t *nptr, *tmp; @@ -354,6 +359,7 @@ static void connection_handler(int sd, short args, void *cbdata) unsigned int msglen; pmix_info_t ginfo; pmix_byte_object_t cred; + uint32_t u32; /* acquire the object */ PMIX_ACQUIRE_OBJECT(pnd); @@ -687,12 +693,34 @@ static void connection_handler(int sd, short args, void *cbdata) * record it here for future use */ nptr->compat.ptl = &pmix_ptl_usock_module; - /* validate the connection - the macro will send the status result to the client */ - PMIX_PSEC_VALIDATE_CONNECTION(rc, psave, NULL, 0, NULL, 0, &cred); /* now done with the msg */ free(msg); - if (PMIX_SUCCESS != rc) { + /* validate the connection - the macro will send the status result to the client */ + PMIX_PSEC_VALIDATE_CONNECTION(reply, psave, NULL, 0, NULL, 0, &cred); + pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, + "client connection validated with status=%d", reply); + + /* Communicate the result of validation to the client */ + u32 = htonl(reply); + if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&u32, sizeof(uint32_t)))) { + PMIX_ERROR_LOG(rc); + info->proc_cnt--; + PMIX_RELEASE(info); + pmix_pointer_array_set_item(&pmix_server_globals.clients, psave->index, NULL); + PMIX_RELEASE(psave); + /* error reply was sent by the above macro */ + CLOSE_THE_SOCKET(pnd->sd); + PMIX_RELEASE(pnd); + return; + } + + /* If needed perform the handshake. The macro will update reply */ + PMIX_PSEC_SERVER_HANDSHAKE_IFNEED(reply, psave, NULL, 0, NULL, 0, &cred); + + /* It is possible that connection validation failed + * We need to reply to the client first and cleanup after */ + if (PMIX_SUCCESS != reply) { pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "validation of client credentials failed: %s", PMIx_Error_string(rc)); @@ -706,6 +734,8 @@ static void connection_handler(int sd, short args, void *cbdata) return; } + + /* send the client's array index */ if (PMIX_SUCCESS != (rc = pmix_ptl_base_send_blocking(pnd->sd, (char*)&psave->index, sizeof(int)))) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c index df0af87c280..a66e4d0a768 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c @@ -1,8 +1,10 @@ /* - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -119,7 +121,7 @@ static void stop_progress_engine(pmix_progress_tracker_t *trk) /* break the event loop - this will cause the loop to exit upon completion of any current event */ - pmix_event_base_loopbreak(trk->ev_base); + pmix_event_base_loopexit(trk->ev_base); pmix_thread_join(&trk->engine, NULL); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index 38b85c0175c..f827018d712 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -157,6 +157,8 @@ pmix_status_t pmix_server_initialize(void) return PMIX_SUCCESS; } +static pmix_server_module_t myhostserver = {0}; + PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, pmix_info_t info[], size_t ninfo) { @@ -185,7 +187,11 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, "pmix:server init called"); /* setup the function pointers */ - pmix_host_server = *module; + if (NULL == module) { + pmix_host_server = myhostserver; + } else { + pmix_host_server = *module; + } if (NULL != info) { for (n=0; n < ninfo; n++) { @@ -520,6 +526,13 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) return PMIX_SUCCESS; } +static void opcbfunc(pmix_status_t status, void *cbdata) +{ + pmix_lock_t *lock = (pmix_lock_t*)cbdata; + lock->status = status; + PMIX_WAKEUP_THREAD(lock); +} + static void _register_nspace(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; @@ -579,9 +592,7 @@ static void _register_nspace(int sd, short args, void *cbdata) cd->info, cd->ninfo); release: - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -591,6 +602,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_status_t rc; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -610,6 +623,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_nspace(const pmix_nspace_t nspace cd->info = info; } + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _register_nspace); + PMIX_WAIT_THREAD(&mylock); + rc = mylock.status; + PMIX_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS == rc) { + rc = PMIX_OPERATION_SUCCEEDED; + } + return rc; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _register_nspace); @@ -747,9 +776,7 @@ static void _deregister_nspace(int sd, short args, void *cbdata) } /* release the caller */ - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -758,6 +785,7 @@ PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_lock_t mylock; pmix_output_verbose(2, pmix_server_globals.base_output, "pmix:server deregister nspace %s", @@ -778,6 +806,18 @@ PMIX_EXPORT void PMIx_server_deregister_nspace(const pmix_nspace_t nspace, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _deregister_nspace); + PMIX_WAIT_THREAD(&mylock); + PMIX_DESTRUCT_LOCK(&mylock); + return; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _deregister_nspace); @@ -1054,9 +1094,7 @@ static void _register_client(int sd, short args, void *cbdata) cleanup: /* let the caller know we are done */ - if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } + cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); } @@ -1065,6 +1103,8 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_status_t rc; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1089,6 +1129,22 @@ PMIX_EXPORT pmix_status_t PMIx_server_register_client(const pmix_proc_t *proc, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _register_client); + PMIX_WAIT_THREAD(&mylock); + rc = mylock.status; + PMIX_DESTRUCT_LOCK(&mylock); + if (PMIX_SUCCESS == rc) { + rc = PMIX_OPERATION_SUCCEEDED; + } + return rc; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _register_client); @@ -1169,9 +1225,7 @@ static void _deregister_client(int sd, short args, void *cbdata) } cleanup: - if (NULL != cd->opcbfunc) { - cd->opcbfunc(PMIX_SUCCESS, cd->cbdata); - } + cd->opcbfunc(PMIX_SUCCESS, cd->cbdata); PMIX_RELEASE(cd); } @@ -1179,6 +1233,7 @@ PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; + pmix_lock_t mylock; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1206,6 +1261,18 @@ PMIX_EXPORT void PMIx_server_deregister_client(const pmix_proc_t *proc, cd->opcbfunc = cbfunc; cd->cbdata = cbdata; + /* if the provided callback is NULL, then substitute + * our own internal cbfunc and block here */ + if (NULL == cbfunc) { + PMIX_CONSTRUCT_LOCK(&mylock); + cd->opcbfunc = opcbfunc; + cd->cbdata = &mylock; + PMIX_THREADSHIFT(cd, _deregister_client); + PMIX_WAIT_THREAD(&mylock); + PMIX_DESTRUCT_LOCK(&mylock); + return; + } + /* we have to push this into our event library to avoid * potential threading issues */ PMIX_THREADSHIFT(cd, _deregister_client); @@ -2386,12 +2453,7 @@ static void _mdxcbfunc(int sd, short argc, void *cbdata) xfer.bytes_used = 0; PMIX_DESTRUCT(&xfer); - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); PMIX_LIST_DESTRUCT(&nslist); @@ -2644,12 +2706,7 @@ static void _cnct(int sd, short args, void *cbdata) if (NULL != nspaces) { pmix_argv_free(nspaces); } - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); /* we are done */ @@ -2726,12 +2783,7 @@ static void _discnct(int sd, short args, void *cbdata) cleanup: /* cleanup the tracker -- the host RM is responsible for * telling us when to remove the nspace from our data */ - if (!tracker->lost_connection) { - /* if this tracker has gone thru the "lost_connection" procedure, - * then it has already been removed from the list - otherwise, - * remove it now */ - pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); - } + pmix_list_remove_item(&pmix_server_globals.collectives, &tracker->super); PMIX_RELEASE(tracker); /* we are done */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 5e239e0d03d..5f7ad645f86 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -375,6 +375,7 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, bool all_def; pmix_namespace_t *nptr, *ns; pmix_rank_info_t *info; + pmix_rank_t ns_local = 0; pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker called with %d procs", (int)nprocs); @@ -450,6 +451,7 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, * of the loop */ } /* is this one of my local ranks? */ + ns_local = 0; PMIX_LIST_FOREACH(info, &nptr->ranks, pmix_rank_info_t) { if (procs[i].rank == info->pname.rank || PMIX_RANK_WILDCARD == procs[i].rank) { @@ -457,12 +459,26 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, "adding local proc %s.%d to tracker", info->pname.nspace, info->pname.rank); /* track the count */ - ++trk->nlocal; + ns_local++; if (PMIX_RANK_WILDCARD != procs[i].rank) { break; } } } + + trk->nlocal += ns_local; + if (!ns_local) { + trk->local = false; + } else if (PMIX_RANK_WILDCARD == procs[i].rank) { + /* If proc is a wildcard we need to additionally check + * that all of the processes in the namespace were + * locally found. + * Otherwise this tracker is not local + */ + if (ns_local != nptr->nprocs) { + trk->local = false; + } + } } if (all_def) { trk->def_complete = true; @@ -645,6 +661,37 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { pmix_output_verbose(2, pmix_server_globals.base_output, "fence complete"); + /* if this is a purely local fence (i.e., all participants are local), + * then it is done and we notify accordingly */ + if (trk->local) { + /* the modexcbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here. The switchyard + * will acknowledge successful acceptance of the fence request, + * but the client still requires a return from the callback in + * that scenario, so we leave this caddy on the list of local cbs */ + trk->modexcbfunc(PMIX_SUCCESS, NULL, 0, trk, NULL, NULL); + rc = PMIX_SUCCESS; + goto cleanup; + } + /* this fence involves non-local procs - check if the + * host supports it */ + if (NULL == pmix_host_server.fence_nb) { + rc = PMIX_ERR_NOT_SUPPORTED; + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); + goto cleanup; + } /* if the user asked us to collect data, then we have * to provide any locally collected data to the host * server so they can circulate it - only take data @@ -719,18 +766,51 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, PMIX_BYTE_OBJECT_DESTRUCT(&bo); // releases the data if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); + PMIX_DESTRUCT(&bucket); + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); goto cleanup; } /* now unload the blob and pass it upstairs */ PMIX_UNLOAD_BUFFER(&bucket, data, sz); PMIX_DESTRUCT(&bucket); + trk->host_called = true; rc = pmix_host_server.fence_nb(trk->pcs, trk->npcs, trk->info, trk->ninfo, data, sz, trk->modexcbfunc, trk); - if (PMIX_SUCCESS != rc) { - pmix_list_remove_item(&pmix_server_globals.collectives, &trk->super); - PMIX_RELEASE(trk); + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the fence completion + * function doesn't need to do so */ + pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the fence completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(rc, NULL, 0, trk, NULL, NULL); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the modexcbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + trk->modexcbfunc(PMIX_SUCCESS, NULL, 0, trk, NULL, NULL); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } @@ -1377,11 +1457,31 @@ pmix_status_t pmix_server_disconnect(pmix_server_caddy_t *cd, * across all participants has been completed */ if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { + trk->host_called = true; rc = pmix_host_server.disconnect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); - if (PMIX_SUCCESS != rc) { - /* remove this contributor from the list - they will be notified - * by the switchyard */ + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the op completion + * function doesn't need to do so */ pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the op completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(rc, trk); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the cbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(PMIX_SUCCESS, trk); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } else { rc = PMIX_SUCCESS; @@ -1526,11 +1626,31 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, * across all participants has been completed */ if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { + trk->host_called = true; rc = pmix_host_server.connect(trk->pcs, trk->npcs, trk->info, trk->ninfo, cbfunc, trk); - if (PMIX_SUCCESS != rc) { - /* remove this contributor from the list - they will be notified - * by the switchyard */ + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + /* clear the caddy from this tracker so it can be + * released upon return - the switchyard will send an + * error to this caller, and so the op completion + * function doesn't need to do so */ pmix_list_remove_item(&trk->local_cbs, &cd->super); + cd->trk = NULL; + /* we need to ensure that all other local participants don't + * just hang waiting for the error return, so execute + * the op completion function - it threadshifts the call + * prior to processing, so it is okay to call it directly + * from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(rc, trk); + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* the operation was atomically completed and the host will + * not be calling us back - ensure we notify all participants. + * the cbfunc thread-shifts the call prior to processing, + * so it is okay to call it directly from here */ + trk->host_called = false; // the host will not be calling us back + cbfunc(PMIX_SUCCESS, trk); + /* ensure that the switchyard doesn't release the caddy */ + rc = PMIX_SUCCESS; } } else { rc = PMIX_SUCCESS; @@ -1555,29 +1675,194 @@ pmix_status_t pmix_server_connect(pmix_server_caddy_t *cd, return rc; } +static void _check_cached_events(int sd, short args, void *cbdata) +{ + pmix_setup_caddy_t *scd = (pmix_setup_caddy_t*)cbdata; + pmix_notify_caddy_t *cd; + pmix_range_trkr_t rngtrk; + pmix_proc_t proc; + int i; + size_t k, n; + bool found, matched; + pmix_buffer_t *relay; + pmix_status_t ret = PMIX_SUCCESS; + pmix_cmd_t cmd = PMIX_NOTIFY_CMD; + + /* check if any matching notifications have been cached */ + rngtrk.procs = NULL; + rngtrk.nprocs = 0; + for (i=0; i < pmix_globals.max_events; i++) { + pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd); + if (NULL == cd) { + continue; + } + found = false; + if (NULL == scd->codes) { + if (!cd->nondefault) { + /* they registered a default event handler - always matches */ + found = true; + } + } else { + for (k=0; k < scd->ncodes; k++) { + if (scd->codes[k] == cd->status) { + found = true; + break; + } + } + } + if (!found) { + continue; + } + /* check if the affected procs (if given) match those they + * wanted to know about */ + if (!pmix_notify_check_affected(cd->affected, cd->naffected, + scd->procs, scd->nprocs)) { + continue; + } + /* check the range */ + if (NULL == cd->targets) { + rngtrk.procs = &cd->source; + rngtrk.nprocs = 1; + } else { + rngtrk.procs = cd->targets; + rngtrk.nprocs = cd->ntargets; + } + rngtrk.range = cd->range; + PMIX_LOAD_PROCID(&proc, scd->peer->info->pname.nspace, scd->peer->info->pname.rank); + if (!pmix_notify_check_range(&rngtrk, &proc)) { + continue; + } + /* if we were given specific targets, check if this is one */ + found = false; + if (NULL != cd->targets) { + matched = false; + for (n=0; n < cd->ntargets; n++) { + /* if the source of the event is the same peer just registered, then ignore it + * as the event notification system will have already locally + * processed it */ + if (PMIX_CHECK_PROCID(&cd->source, &scd->peer->info->pname)) { + continue; + } + if (PMIX_CHECK_PROCID(&scd->peer->info->pname, &cd->targets[n])) { + matched = true; + /* track the number of targets we have left to notify */ + --cd->nleft; + /* if this is the last one, then evict this event + * from the cache */ + if (0 == cd->nleft) { + pmix_hotel_checkout(&pmix_globals.notifications, cd->room); + found = true; // mark that we should release cd + } + break; + } + } + if (!matched) { + /* do not notify this one */ + continue; + } + } + + /* all matches - notify */ + relay = PMIX_NEW(pmix_buffer_t); + if (NULL == relay) { + /* nothing we can do */ + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + ret = PMIX_ERR_NOMEM; + break; + } + /* pack the info data stored in the event */ + PMIX_BFROPS_PACK(ret, scd->peer, relay, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + break; + } + PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->status, 1, PMIX_STATUS); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + break; + } + PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->source, 1, PMIX_PROC); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + break; + } + PMIX_BFROPS_PACK(ret, scd->peer, relay, &cd->ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + break; + } + if (0 < cd->ninfo) { + PMIX_BFROPS_PACK(ret, scd->peer, relay, cd->info, cd->ninfo, PMIX_INFO); + if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); + break; + } + } + PMIX_SERVER_QUEUE_REPLY(ret, scd->peer, 0, relay); + if (PMIX_SUCCESS != ret) { + PMIX_RELEASE(relay); + } + if (found) { + PMIX_RELEASE(cd); + } + } + /* release the caddy */ + if (NULL != scd->codes) { + free(scd->codes); + } + if (NULL != scd->info) { + PMIX_INFO_FREE(scd->info, scd->ninfo); + } + if (NULL != scd->opcbfunc) { + scd->opcbfunc(ret, scd->cbdata); + } + PMIX_RELEASE(scd); +} + +/* provide a callback function for the host when it finishes + * processing the registration */ +static void regevopcbfunc(pmix_status_t status, void *cbdata) +{ + pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; + + /* if the registration succeeded, then check local cache */ + if (PMIX_SUCCESS == status) { + _check_cached_events(0, 0, cd); + return; + } + + /* it didn't succeed, so cleanup and execute the callback + * so we don't hang */ + if (NULL != cd->codes) { + free(cd->codes); + } + if (NULL != cd->info) { + PMIX_INFO_FREE(cd->info, cd->ninfo); + } + if (NULL != cd->opcbfunc) { + cd->opcbfunc(status, cd->cbdata); + } + PMIX_RELEASE(cd); +} + + pmix_status_t pmix_server_register_events(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_op_cbfunc_t cbfunc, void *cbdata) { int32_t cnt; - pmix_status_t rc, ret = PMIX_SUCCESS; + pmix_status_t rc; pmix_status_t *codes = NULL; pmix_info_t *info = NULL; - size_t ninfo=0, ncodes, n, k; + size_t ninfo=0, ncodes, n; pmix_regevents_info_t *reginfo; pmix_peer_events_info_t *prev = NULL; - pmix_notify_caddy_t *cd; pmix_setup_caddy_t *scd; - int i; bool enviro_events = false; - bool found, matched; - pmix_buffer_t *relay; - pmix_cmd_t cmd = PMIX_NOTIFY_CMD; + bool found; pmix_proc_t *affected = NULL; size_t naffected = 0; - pmix_range_trkr_t rngtrk; - pmix_proc_t proc; pmix_output_verbose(2, pmix_server_globals.event_output, "recvd register events for peer %s:%d", @@ -1775,47 +2060,68 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, rc = PMIX_ERR_NOMEM; goto cleanup; } - if (NULL != codes) { - scd->codes = (pmix_status_t*)malloc(ncodes * sizeof(pmix_status_t)); - if (NULL == scd->codes) { - rc = PMIX_ERR_NOMEM; - PMIX_RELEASE(scd); - goto cleanup; - } - memcpy(scd->codes, codes, ncodes * sizeof(pmix_status_t)); - scd->ncodes = ncodes; - } - if (NULL != info) { - PMIX_INFO_CREATE(scd->info, ninfo); - if (NULL == scd->info) { - rc = PMIX_ERR_NOMEM; - if (NULL != scd->codes) { - free(scd->codes); - } - PMIX_RELEASE(scd); - goto cleanup; - } - /* copy the info across */ - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&scd->info[n], &info[n]); - } - scd->ninfo = ninfo; - } + PMIX_RETAIN(peer); + scd->peer = peer; + scd->codes = codes; + scd->ncodes = ncodes; + scd->info = info; + scd->ninfo = ninfo; scd->opcbfunc = cbfunc; scd->cbdata = cbdata; - if (PMIX_SUCCESS != (rc = pmix_host_server.register_events(scd->codes, scd->ncodes, scd->info, scd->ninfo, opcbfunc, scd))) { + if (PMIX_SUCCESS == (rc = pmix_host_server.register_events(scd->codes, scd->ncodes, scd->info, scd->ninfo, regevopcbfunc, scd))) { + /* the host will call us back when completed */ pmix_output_verbose(2, pmix_server_globals.event_output, - "server register events: host server reg events returned rc =%d", rc); - if (NULL != scd->codes) { - free(scd->codes); - } - if (NULL != scd->info) { - PMIX_INFO_FREE(scd->info, scd->ninfo); + "server register events: host server processing event registration"); + if (NULL != affected) { + free(affected); } + return rc; + } else if (PMIX_OPERATION_SUCCEEDED == rc) { + /* we need to check cached notifications, but we want to ensure + * that occurs _after_ the client returns from registering the + * event handler in case the event is flagged for do_not_cache. + * Setup an event to fire after we return as that means it will + * occur after we send the registration response back to the client, + * thus guaranteeing that the client will get their registration + * callback prior to delivery of an event notification */ + PMIX_RETAIN(peer); + scd->peer = peer; + scd->procs = affected; + scd->nprocs = naffected; + scd->opcbfunc = NULL; + scd->cbdata = NULL; + PMIX_THREADSHIFT(scd, _check_cached_events); + return rc; + } else { + /* host returned a genuine error and won't be calling the callback function */ + pmix_output_verbose(2, pmix_server_globals.event_output, + "server register events: host server reg events returned rc =%d", rc); PMIX_RELEASE(scd); + goto cleanup; } } else { rc = PMIX_OPERATION_SUCCEEDED; + /* we need to check cached notifications, but we want to ensure + * that occurs _after_ the client returns from registering the + * event handler in case the event is flagged for do_not_cache. + * Setup an event to fire after we return as that means it will + * occur after we send the registration response back to the client, + * thus guaranteeing that the client will get their registration + * callback prior to delivery of an event notification */ + scd = PMIX_NEW(pmix_setup_caddy_t); + PMIX_RETAIN(peer); + scd->peer = peer; + scd->codes = codes; + scd->ncodes = ncodes; + scd->procs = affected; + scd->nprocs = naffected; + scd->opcbfunc = NULL; + scd->cbdata = NULL; + PMIX_THREADSHIFT(scd, _check_cached_events); + if (NULL != info) { + PMIX_INFO_FREE(info, ninfo); + } + return rc; } cleanup: @@ -1824,144 +2130,12 @@ pmix_status_t pmix_server_register_events(pmix_peer_t *peer, if (NULL != info) { PMIX_INFO_FREE(info, ninfo); } - if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { - if (NULL != codes) { - free(codes); - } - if (NULL != affected) { - PMIX_PROC_FREE(affected, naffected); - } - return rc; - } - - /* check if any matching notifications have been cached */ - rngtrk.procs = NULL; - rngtrk.nprocs = 0; - for (i=0; i < pmix_globals.max_events; i++) { - pmix_hotel_knock(&pmix_globals.notifications, i, (void**)&cd); - if (NULL == cd) { - continue; - } - found = false; - if (NULL == codes) { - if (!cd->nondefault) { - /* they registered a default event handler - always matches */ - found = true; - } - } else { - for (k=0; k < ncodes; k++) { - if (codes[k] == cd->status) { - found = true; - break; - } - } - } - if (!found) { - continue; - } - /* check if the affected procs (if given) match those they - * wanted to know about */ - if (!pmix_notify_check_affected(cd->affected, cd->naffected, - affected, naffected)) { - continue; - } - /* check the range */ - if (NULL == cd->targets) { - rngtrk.procs = &cd->source; - rngtrk.nprocs = 1; - } else { - rngtrk.procs = cd->targets; - rngtrk.nprocs = cd->ntargets; - } - rngtrk.range = cd->range; - PMIX_LOAD_PROCID(&proc, peer->info->pname.nspace, peer->info->pname.rank); - if (!pmix_notify_check_range(&rngtrk, &proc)) { - continue; - } - /* if we were given specific targets, check if this is one */ - found = false; - if (NULL != cd->targets) { - matched = false; - for (n=0; n < cd->ntargets; n++) { - /* if the source of the event is the same peer just registered, then ignore it - * as the event notification system will have already locally - * processed it */ - if (PMIX_CHECK_PROCID(&cd->source, &peer->info->pname)) { - continue; - } - if (PMIX_CHECK_PROCID(&peer->info->pname, &cd->targets[n])) { - matched = true; - /* track the number of targets we have left to notify */ - --cd->nleft; - /* if this is the last one, then evict this event - * from the cache */ - if (0 == cd->nleft) { - pmix_hotel_checkout(&pmix_globals.notifications, cd->room); - found = true; // mark that we should release cd - } - break; - } - } - if (!matched) { - /* do not notify this one */ - continue; - } - } - - /* all matches - notify */ - relay = PMIX_NEW(pmix_buffer_t); - if (NULL == relay) { - /* nothing we can do */ - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - ret = PMIX_ERR_NOMEM; - break; - } - /* pack the info data stored in the event */ - PMIX_BFROPS_PACK(ret, peer, relay, &cmd, 1, PMIX_COMMAND); - if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); - break; - } - PMIX_BFROPS_PACK(ret, peer, relay, &cd->status, 1, PMIX_STATUS); - if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); - break; - } - PMIX_BFROPS_PACK(ret, peer, relay, &cd->source, 1, PMIX_PROC); - if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); - break; - } - PMIX_BFROPS_PACK(ret, peer, relay, &cd->ninfo, 1, PMIX_SIZE); - if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); - break; - } - if (0 < cd->ninfo) { - PMIX_BFROPS_PACK(ret, peer, relay, cd->info, cd->ninfo, PMIX_INFO); - if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); - break; - } - } - PMIX_SERVER_QUEUE_REPLY(ret, peer, 0, relay); - if (PMIX_SUCCESS != ret) { - PMIX_RELEASE(relay); - } - if (found) { - PMIX_RELEASE(cd); - } - } - if (NULL != codes) { free(codes); } if (NULL != affected) { PMIX_PROC_FREE(affected, naffected); } - if (PMIX_SUCCESS != ret) { - rc = ret; - } return rc; } @@ -3318,7 +3492,7 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, static void tcon(pmix_server_trkr_t *t) { t->event_active = false; - t->lost_connection = false; + t->host_called = false; t->id = NULL; memset(t->pname.nspace, 0, PMIX_MAX_NSLEN+1); t->pname.rank = PMIX_RANK_UNDEF; @@ -3426,11 +3600,17 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_setup_caddy_t, static void ncon(pmix_notify_caddy_t *p) { - struct timespec tp; - PMIX_CONSTRUCT_LOCK(&p->lock); - clock_gettime(CLOCK_MONOTONIC, &tp); +#if defined(__linux__) && OPAL_HAVE_CLOCK_GETTIME + struct timespec tp; + (void) clock_gettime(CLOCK_MONOTONIC, &tp); p->ts = tp.tv_sec; +#else + /* Fall back to gettimeofday() if we have nothing else */ + struct timeval tv; + gettimeofday(&tv, NULL); + p->ts = tv.tv_sec; +#endif p->room = -1; memset(p->source.nspace, 0, PMIX_MAX_NSLEN+1); p->source.rank = PMIX_RANK_UNDEF; diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index effa1190ff2..d2b9c9acbe5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -260,9 +260,7 @@ static void job_data(struct pmix_peer_t *pr, PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_info_t info[], size_t ninfo) { - pmix_kval_t *kptr; pmix_status_t rc; - char hostname[PMIX_MAX_NSLEN]; char *evar, *nspace = NULL; pmix_rank_t rank = PMIX_RANK_UNDEF; bool gdsfound, do_not_connect = false; @@ -738,314 +736,39 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } + /* quick check to see if we got something back. If this + * is a launcher that is being executed multiple times + * in a job-script, then the original registration data + * will have been deleted after the first invocation. In + * such a case, we simply regenerate it locally as it is + * well-known */ + pmix_cb_t cb; + PMIX_CONSTRUCT(&cb, pmix_cb_t); + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + wildcard.rank = PMIX_RANK_WILDCARD; + cb.proc = &wildcard; + cb.copy = true; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + PMIX_DESTRUCT(&cb); + if (PMIX_SUCCESS != rc) { + pmix_output_verbose(5, pmix_client_globals.get_output, + "pmix:tool:client data not found in internal storage"); + rc = pmix_tool_init_info(); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + } } else { /* now finish the initialization by filling our local * datastore with typical job-related info. No point * in having the server generate these as we are * obviously a singleton, and so the values are well-known */ - pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); - wildcard.rank = pmix_globals.myid.rank; - - /* the jobid is just our nspace */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_JOBID); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(pmix_globals.myid.nspace); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* our rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_INT; - kptr->value->data.integer = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* nproc offset */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NPROC_OFFSET); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* node size */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NODE_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local peers */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_PEERS); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup("0"); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local leader */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCALLDR); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* universe size */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_UNIV_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* job size - we are our very own job, so we have no peers */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_JOB_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local size - only us in our job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_SIZE); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* max procs - since we are a self-started tool, there is no - * allocation within which we can grow ourselves */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_MAX_PROCS); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 1; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app number */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APPNUM); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app leader */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APPLDR); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* app rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_APP_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* global rank */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_GLOBAL_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT32; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* local rank - we are alone in our job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_LOCAL_RANK); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_UINT16; - kptr->value->data.uint32 = 0; - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* we cannot know the node rank as we don't know what - * other processes are executing on this node - so - * we'll add that info to the server-tool handshake - * and load it from there */ - - /* hostname */ - gethostname(hostname, PMIX_MAX_NSLEN); - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_HOSTNAME); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(hostname); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &pmix_globals.myid, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* we cannot know the RM's nodeid for this host, so - * we'll add that info to the server-tool handshake - * and load it from there */ - - /* the nodemap is simply our hostname as there is no - * regex to generate */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_NODE_MAP); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup(hostname); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - PMIX_RELEASE(kptr); // maintain accounting - - /* likewise, the proc map is just our rank as we are - * the only proc in this job */ - kptr = PMIX_NEW(pmix_kval_t); - kptr->key = strdup(PMIX_PROC_MAP); - PMIX_VALUE_CREATE(kptr->value, 1); - kptr->value->type = PMIX_STRING; - kptr->value->data.string = strdup("0"); - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, - &wildcard, - PMIX_INTERNAL, kptr); + rc = pmix_tool_init_info(); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; } - PMIX_RELEASE(kptr); // maintain accounting } PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -1061,6 +784,307 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, return rc; } +pmix_status_t pmix_tool_init_info(void) +{ + pmix_kval_t *kptr; + pmix_status_t rc; + pmix_proc_t wildcard; + char hostname[PMIX_MAX_NSLEN]; + + pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); + wildcard.rank = pmix_globals.myid.rank; + + /* the jobid is just our nspace */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_JOBID); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(pmix_globals.myid.nspace); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* our rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_INT; + kptr->value->data.integer = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* nproc offset */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NPROC_OFFSET); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* node size */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NODE_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local peers */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_PEERS); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup("0"); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local leader */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCALLDR); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* universe size */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_UNIV_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* job size - we are our very own job, so we have no peers */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_JOB_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local size - only us in our job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_SIZE); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* max procs - since we are a self-started tool, there is no + * allocation within which we can grow ourselves */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_MAX_PROCS); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 1; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app number */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APPNUM); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app leader */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APPLDR); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* app rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_APP_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* global rank */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_GLOBAL_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT32; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* local rank - we are alone in our job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_LOCAL_RANK); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_UINT16; + kptr->value->data.uint32 = 0; + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* we cannot know the node rank as we don't know what + * other processes are executing on this node - so + * we'll add that info to the server-tool handshake + * and load it from there */ + + /* hostname */ + if (NULL != pmix_globals.hostname) { + pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAX_NSLEN); + } else { + gethostname(hostname, PMIX_MAX_NSLEN); + } + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_HOSTNAME); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(hostname); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &pmix_globals.myid, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* we cannot know the RM's nodeid for this host, so + * we'll add that info to the server-tool handshake + * and load it from there */ + + /* the nodemap is simply our hostname as there is no + * regex to generate */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_NODE_MAP); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup(hostname); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + /* likewise, the proc map is just our rank as we are + * the only proc in this job */ + kptr = PMIX_NEW(pmix_kval_t); + kptr->key = strdup(PMIX_PROC_MAP); + PMIX_VALUE_CREATE(kptr->value, 1); + kptr->value->type = PMIX_STRING; + kptr->value->data.string = strdup("0"); + PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, + &wildcard, + PMIX_INTERNAL, kptr); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_RELEASE(kptr); // maintain accounting + + return PMIX_SUCCESS; +} + + typedef struct { pmix_lock_t lock; pmix_event_t ev; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.c b/opal/mca/pmix/pmix3x/pmix/src/util/output.c index 8648f1a0b72..cf73f507008 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2006 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -332,15 +332,10 @@ PMIX_EXPORT void pmix_output(int output_id, const char *format, ...) /* * Send a message to a stream if the verbose level is high enough */ - PMIX_EXPORT void pmix_output_verbose(int level, int output_id, const char *format, ...) + PMIX_EXPORT bool pmix_output_check_verbosity(int level, int output_id) { - if (output_id >= 0 && output_id < PMIX_OUTPUT_MAX_STREAMS && - info[output_id].ldi_verbose_level >= level) { - va_list arglist; - va_start(arglist, format); - output(output_id, format, arglist); - va_end(arglist); - } + return (output_id >= 0 && output_id < PMIX_OUTPUT_MAX_STREAMS && + info[output_id].ldi_verbose_level >= level); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.h b/opal/mca/pmix/pmix3x/pmix/src/util/output.h index c3274bab7d0..5e8fa677b5e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -414,12 +414,13 @@ PMIX_EXPORT void pmix_output(int output_id, const char *format, ...) __pmix_attr * * @see pmix_output_set_verbosity() */ -PMIX_EXPORT void pmix_output_verbose(int verbose_level, int output_id, - const char *format, ...) __pmix_attribute_format__(__printf__, 3, 4); +#define pmix_output_verbose(verbose_level, output_id, ...) \ + if (pmix_output_check_verbosity(verbose_level, output_id)) { \ + pmix_output(output_id, __VA_ARGS__); \ + } + +PMIX_EXPORT bool pmix_output_check_verbosity(int verbose_level, int output_id); -/** -* Same as pmix_output_verbose(), but takes a va_list form of varargs. -*/ PMIX_EXPORT void pmix_output_vverbose(int verbose_level, int output_id, const char *format, va_list ap) __pmix_attribute_format__(__printf__, 3, 0); diff --git a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am index 3b4ee7214ca..c886e3b1fb3 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -33,9 +33,61 @@ headers = test_common.h cli_stages.h server_callbacks.h utils.h test_fence.h \ AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_builddir)/src/include -I$(top_builddir)/src/api -noinst_SCRIPTS = pmix_client_otheruser.sh +noinst_SCRIPTS = pmix_client_otheruser.sh \ + run_tests00.pl \ + run_tests01.pl \ + run_tests02.pl \ + run_tests03.pl \ + run_tests04.pl \ + run_tests05.pl \ + run_tests06.pl \ + run_tests07.pl \ + run_tests08.pl \ + run_tests09.pl \ + run_tests10.pl \ + run_tests11.pl \ + run_tests12.pl \ + run_tests13.pl \ + run_tests14.pl \ + run_tests15.pl + noinst_PROGRAMS = +######################### +# Support for "make check" + +check_PROGRAMS = \ + pmix_test \ + pmix_client \ + pmix_regex + +if WANT_PMI_BACKWARD +check_PROGRAMS += \ + pmi_client \ + pmi2_client +endif + +TESTS = \ + run_tests00.pl \ + run_tests01.pl \ + run_tests02.pl \ + run_tests03.pl \ + run_tests04.pl \ + run_tests05.pl \ + run_tests06.pl \ + run_tests07.pl \ + run_tests08.pl \ + run_tests09.pl \ + run_tests10.pl \ + run_tests11.pl \ + run_tests12.pl \ + run_tests13.pl \ + run_tests14.pl \ + run_tests15.pl + + +########################## + if WANT_PMI_BACKWARD noinst_PROGRAMS += pmi_client pmi2_client endif diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in new file mode 100755 index 00000000000..fb139c9ce7d --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2019 Intel, Inc. +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow + +use strict; + +my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:0]\"", + "-n 4 --ns-dist 3:1 --fence \"[db | 0:;1:]\"", + "-n 4 --ns-dist 3:1 --fence \"[0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[b | 0:]\"", + "-n 4 --ns-dist 3:1 --fence \"[d | 0:]\" --noise \"[0:0,1]\"", + "-n 4 --job-fence -c", + "-n 4 --job-fence", + "-n 2 --test-publish", + "-n 2 --test-spawn", + "-n 2 --test-connect", + "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", + "-n 5 --test-replace 100:0,1,10,50,99", + "-n 5 --test-internal 10", + "-s 2 -n 2 --job-fence", + "-s 2 -n 2 --job-fence -c"); + +my $test; +my $cmd; +my $output; +my $status = 0; +my $testnum; + +# We are running tests against the build tree (vs. the installation +# tree). Autogen gives us a full list of all possible component +# directories in PMIX_COMPONENT_LIBRARY_PATHS. Iterate through each +# of those directories: 1) to see if there is actually a component +# built in there, and 2) to turn it into an absolute path name. Then +# put the new list in the "mca_bast_component_path" MCA parameter env +# variable so that the MCA base knows where to find all the +# components. +my @myfullpaths; +my $mybuilddir = "@PMIX_BUILT_TEST_PREFIX@"; +my $mypathstr = "@PMIX_COMPONENT_LIBRARY_PATHS@"; +my @splitstr = split(':', $mypathstr); +foreach my $path (@splitstr) { + # Note that the component is actually built in the ".libs" + # subdirectory. If the component wasn't built, that subdirectory + # will not exist, so don't save it. + my $fullpath = $mybuilddir . "/" . $path . "/.libs"; + push(@myfullpaths, $fullpath) + if (-d $fullpath); +} +my $mymcapaths = join(":", @myfullpaths); +$ENV{'PMIX_MCA_mca_base_component_path'} = $mymcapaths; + +my $wdir = $mybuilddir . "/test"; +chdir $wdir; + +$testnum = $0; +$testnum =~ s/.pl//; +$testnum = substr($testnum, -2); +$test = @tests[$testnum]; + +$cmd = "./pmix_test " . $test . " 2>&1"; +print $cmd . "\n"; +$output = `$cmd`; +print $output . "\n"; +print "CODE $?\n"; +$status = "$?"; + +exit($status >> 8); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index fd25f8bdf87..10b180e6598 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -262,7 +262,7 @@ typedef struct { TEST_VERBOSE(("%s:%d want to get from %s:%d key %s", my_nspace, my_rank, ns, r, key)); \ if (blocking) { \ if (PMIX_SUCCESS != (rc = PMIx_Get(&foobar, key, NULL, 0, &val))) { \ - if( !( rc == PMIX_ERR_NOT_FOUND && ok_notfnd ) ){ \ + if( !( (rc == PMIX_ERR_NOT_FOUND || rc == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ TEST_ERROR(("%s:%d: PMIx_Get failed: %d from %s:%d, key %s", my_nspace, my_rank, rc, ns, r, key)); \ } \ rc = PMIX_ERROR; \ @@ -289,7 +289,7 @@ typedef struct { } \ if (PMIX_SUCCESS == rc) { \ if( PMIX_SUCCESS != cbdata.status ){ \ - if( !( cbdata.status == PMIX_ERR_NOT_FOUND && ok_notfnd ) ){ \ + if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \ my_nspace, my_rank, rc, my_nspace, r)); \ } \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c index 9ad4cf786df..a33d9618b71 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -384,7 +384,7 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) if( local ){ GET(int, (12340+j), my_nspace, i+params.base_rank, 100, j, 0, 0, 0); if (PMIX_SUCCESS != rc) { - TEST_ERROR(("%s:%d: PMIx_Get failed: %d", my_nspace, my_rank, rc)); + TEST_ERROR(("%s:%d: PMIx_Get failed: %s", my_nspace, my_rank, PMIx_Error_string(rc))); return PMIX_ERROR; } @@ -423,9 +423,10 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) my_nspace, my_rank)); return PMIX_ERROR; } - if (PMIX_ERR_NOT_FOUND != rc) { - TEST_ERROR(("%s:%d [ERROR]: PMIx_Get returned %d instead of not_found", - my_nspace, my_rank, rc)); + if (PMIX_ERR_NOT_FOUND != rc && PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) { + TEST_ERROR(("%s:%d [ERROR]: PMIx_Get returned %s instead of not_found", + my_nspace, my_rank, PMIx_Error_string(rc))); + return PMIX_ERROR; } if (NULL != val) { TEST_ERROR(("%s:%d [ERROR]: PMIx_Get did not return NULL value", my_nspace, my_rank)); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.c b/opal/mca/pmix/pmix3x/pmix/test/test_server.c index 3627dade912..426014149ef 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_server.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 Research Organization for Information Science @@ -93,12 +93,36 @@ static void release_cb(pmix_status_t status, void *cbdata) *ptr = 0; } -static void set_namespace(int local_size, int univ_size, char *ranks, char *name) +static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) +{ + uint32_t i; + int len = 0, max_ranks_len; + if (0 >= nprocs) { + return; + } + max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); + *ranks = (char*) malloc(max_ranks_len); + for (i = 0; i < nprocs; i++) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); + if (i != nprocs-1) { + len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); + } + } + if (len >= max_ranks_len-1) { + free(*ranks); + *ranks = NULL; + TEST_ERROR(("Not enough allocated space for global ranks array.")); + } +} + +static void set_namespace(int local_size, int univ_size, + int base_rank, char *name) { size_t ninfo; pmix_info_t *info; ninfo = 8; char *regex, *ppn; + char *ranks = NULL; PMIX_INFO_CREATE(info, ninfo); pmix_strncpy(info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); @@ -113,19 +137,31 @@ static void set_namespace(int local_size, int univ_size, char *ranks, char *name info[2].value.type = PMIX_UINT32; info[2].value.data.uint32 = local_size; + /* generate the array of local peers */ + fill_seq_ranks_array(local_size, base_rank, &ranks); + if (NULL == ranks) { + return; + } pmix_strncpy(info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); info[3].value.type = PMIX_STRING; info[3].value.data.string = strdup(ranks); + free(ranks); PMIx_generate_regex(NODE_NAME, ®ex); pmix_strncpy(info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); info[4].value.type = PMIX_STRING; - info[4].value.data.string = regex; + info[4].value.data.string = strdup(regex); + /* generate the global proc map */ + fill_seq_ranks_array(univ_size, 0, &ranks); + if (NULL == ranks) { + return; + } PMIx_generate_ppn(ranks, &ppn); + free(ranks); pmix_strncpy(info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); info[5].value.type = PMIX_STRING; - info[5].value.data.string = ppn; + info[5].value.data.string = strdup(ppn); pmix_strncpy(info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); info[6].value.type = PMIX_UINT32; @@ -143,28 +179,6 @@ static void set_namespace(int local_size, int univ_size, char *ranks, char *name PMIX_INFO_FREE(info, ninfo); } -static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) -{ - uint32_t i; - int len = 0, max_ranks_len; - if (0 >= nprocs) { - return; - } - max_ranks_len = nprocs * (MAX_DIGIT_LEN+1); - *ranks = (char*) malloc(max_ranks_len); - for (i = 0; i < nprocs; i++) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%d", i+base_rank); - if (i != nprocs-1) { - len += snprintf(*ranks + len, max_ranks_len-len-1, "%c", ','); - } - } - if (len >= max_ranks_len-1) { - free(*ranks); - *ranks = NULL; - TEST_ERROR(("Not enough allocated space for global ranks array.")); - } -} - static void server_unpack_procs(char *buf, size_t size) { char *ptr = buf; @@ -878,14 +892,8 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, univ_size)); TEST_VERBOSE(("Setting job info")); - fill_seq_ranks_array(local_size, base_rank, &ranks); - if (NULL == ranks) { - PMIx_server_finalize(); - TEST_ERROR(("fill_seq_ranks_array failed")); - return PMIX_ERROR; - } (void)snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s-%d", TEST_NAMESPACE, num_ns); - set_namespace(local_size, univ_size, ranks, proc.nspace); + set_namespace(local_size, univ_size, base_rank, proc.nspace); if (NULL != ranks) { free(ranks); } @@ -909,17 +917,18 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, /* fork/exec the test */ for (n = 0; n < local_size; n++) { proc.rank = base_rank + rank_counter; - if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n - TEST_ERROR(("Server fork setup failed with error %d", rc)); + rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL); + if (PMIX_SUCCESS != rc && PMIX_OPERATION_SUCCEEDED != rc) { + TEST_ERROR(("Server register client failed with error %d", rc)); PMIx_server_finalize(); cli_kill_all(); - return rc; + return 0; } - if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, NULL, NULL))) {//n + if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, client_env))) {//n TEST_ERROR(("Server fork setup failed with error %d", rc)); PMIx_server_finalize(); cli_kill_all(); - return 0; + return rc; } cli_info[cli_counter].pid = fork(); From 9d0adbc6bc7d8028a859d4062bce1ef1d4083e2f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 26 Jun 2019 09:31:43 -0700 Subject: [PATCH 365/674] Update to track 32-bit support commit Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/configure.ac | 37 +++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index dcea50ac001..53c0d64441f 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -44,13 +44,27 @@ m4_include([config/autogen_found_items.m4]) AC_INIT([pmix], [m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))], - [http://pmix.github.io/master], [pmix]) + [https://github.com/pmix/pmix/issues], [pmix]) AC_PREREQ(2.69) AC_CONFIG_AUX_DIR(./config) # Note that this directory must *exactly* match what was specified via # -I in ACLOCAL_AMFLAGS in the top-level Makefile.am. AC_CONFIG_MACRO_DIR(./config) +# autotools expects to perform tests without interference +# from user-provided CFLAGS, particularly -Werror flags. +# Search for them here and cache any we find +PMIX_CFLAGS_cache= +PMIX_CFLAGS_pass= +for val in $CFLAGS; do + if echo "$val" | grep -q -e "-W"; then + PMIX_CFLAGS_cache="$PMIX_CFLAGS_cache $val"; + else + PMIX_CFLAGS_pass="$PMIX_CFLAGS_pass $val"; + fi +done +CFLAGS=$PMIX_CFLAGS_pass + PMIX_CAPTURE_CONFIGURE_CLI([PMIX_CONFIGURE_CLI]) # Get our platform support file. This has to be done very, very early @@ -208,7 +222,17 @@ AS_IF([test -z "$CC_FOR_BUILD"],[ AC_SUBST([CC_FOR_BUILD], [$CC]) ]) +# restore any user-provided Werror flags +AS_IF([test ! -z "$PMIX_CFLAGS_cache"], [CFLAGS="$CFLAGS $PMIX_CFLAGS_cache"]) + +# Delay setting pickyness until here so we +# don't break configure code tests +#if test "$WANT_PICKY_COMPILER" = "1"; then +# CFLAGS="$CFLAGS -Wall -Wextra -Werror" +#fi + # Cleanup duplicate flags +PMIX_FLAGS_UNIQ(CFLAGS) PMIX_FLAGS_UNIQ(CPPFLAGS) PMIX_FLAGS_UNIQ(LDFLAGS) PMIX_FLAGS_UNIQ(LIBS) @@ -235,6 +259,17 @@ AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([final LIBS]) AC_MSG_RESULT([$LIBS]) +#################################################################### +# -Werror for CI scripts +#################################################################### + +AC_ARG_ENABLE(werror, + AC_HELP_STRING([--enable-werror], + [Treat compiler warnings as errors]), +[ + CFLAGS="$CFLAGS -Werror" +]) + #################################################################### # Version information #################################################################### From 1d0e0557b9fa382e52da574751f93a740f907683 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 2 Jul 2019 08:56:20 -0700 Subject: [PATCH 366/674] v4.0.x: Update PMIx to official v3.1.3 release Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/NEWS | 3 ++- opal/mca/pmix/pmix3x/pmix/VERSION | 6 +++--- opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 6 +++--- opal/mca/pmix/pmix3x/pmix/configure.ac | 16 ++-------------- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- .../pmix/pmix3x/pmix/contrib/whitespace-purge.sh | 4 ++-- .../pmix3x/pmix/src/mca/pnet/opa/configure.m4 | 4 ++-- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index dd478a9a87e..6445b18275d 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -21,7 +21,7 @@ example, a bug might be fixed in the master, and then moved to multiple release branches. -3.1.3 -- TBD +3.1.3 -- 2 July 2019 ---------------------- - PR #1096: Restore PMIX_NUM_SLOTS for backward compatibility - PR #1106: Automatically generate PMIX_NUMERIC_VERSION @@ -64,6 +64,7 @@ multiple release branches. - PR #1311: Work around memory bug in older gcc compilers - PR #1321: Provide memory op hooks in user-facing macros - PR #1329: Add -fPIC to static builds +- PR #1340: Do not use '==' in m4 test statements 3.1.2 -- 24 Jan 2019 diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index 98c143b2677..13511b92a55 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -23,14 +23,14 @@ release=3 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek=rc4 +greek= # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git5e6ec324 +repo_rev=gitc10fd1d4 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Jun 25, 2019" +date="Jul 02, 2019" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index a90e23b9795..e0585256c49 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -191,7 +191,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ [Link the output PMIx library to this extra lib (used in embedded mode)])) AC_MSG_CHECKING([for extra lib]) AS_IF([test ! -z "$with_pmix_extra_lib"], - [AS_IF([test "$with_pmix_extra_lib" == "yes" || test "$with_pmix_extra_lib" == "no"], + [AS_IF([test "$with_pmix_extra_lib" = "yes" || test "$with_pmix_extra_lib" = "no"], [AC_MSG_RESULT([ERROR]) AC_MSG_WARN([Invalid value for --with-extra-pmix-lib:]) AC_MSG_WARN([ $with_pmix_extra_lib]) @@ -209,7 +209,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ [Link any embedded components/tools that require it to the provided libtool lib (used in embedded mode)])) AC_MSG_CHECKING([for extra ltlib]) AS_IF([test ! -z "$with_pmix_extra_ltlib"], - [AS_IF([test "$with_pmix_extra_ltlib" == "yes" || test "$with_pmix_extra_ltlib" == "no"], + [AS_IF([test "$with_pmix_extra_ltlib" = "yes" || test "$with_pmix_extra_ltlib" = "no"], [AC_MSG_RESULT([ERROR]) AC_MSG_WARN([Invalid value for --with-pmix-extra-ltlib:]) AC_MSG_WARN([ $with_pmix_extra_ltlib]) @@ -1184,7 +1184,7 @@ AC_MSG_CHECKING([if want to support dlopen of non-global namespaces]) AC_ARG_ENABLE([nonglobal-dlopen], AC_HELP_STRING([--enable-nonglobal-dlopen], [enable non-global dlopen (default: enabled)])) -if test "$enable_nonglobal_dlopen" == "no"; then +if test "$enable_nonglobal_dlopen" = "no"; then AC_MSG_RESULT([no]) pmix_need_libpmix=0 else diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index 53c0d64441f..3cbd07e8914 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -44,7 +44,7 @@ m4_include([config/autogen_found_items.m4]) AC_INIT([pmix], [m4_normalize(esyscmd([config/pmix_get_version.sh VERSION --tarball]))], - [https://github.com/pmix/pmix/issues], [pmix]) + [http://pmix.github.io/master], [pmix]) AC_PREREQ(2.69) AC_CONFIG_AUX_DIR(./config) # Note that this directory must *exactly* match what was specified via @@ -171,7 +171,7 @@ LT_PREREQ([2.2.6]) pmix_enable_shared="$enable_shared" pmix_enable_static="$enable_static" -AS_IF([test ! -z "$enable_static" && test "$enable_static" == "yes"], +AS_IF([test ! -z "$enable_static" && test "$enable_static" = "yes"], [CFLAGS="$CFLAGS -fPIC"]) AM_ENABLE_SHARED @@ -232,7 +232,6 @@ AS_IF([test ! -z "$PMIX_CFLAGS_cache"], [CFLAGS="$CFLAGS $PMIX_CFLAGS_cache"]) #fi # Cleanup duplicate flags -PMIX_FLAGS_UNIQ(CFLAGS) PMIX_FLAGS_UNIQ(CPPFLAGS) PMIX_FLAGS_UNIQ(LDFLAGS) PMIX_FLAGS_UNIQ(LIBS) @@ -259,17 +258,6 @@ AC_MSG_RESULT([$LDFLAGS]) AC_MSG_CHECKING([final LIBS]) AC_MSG_RESULT([$LIBS]) -#################################################################### -# -Werror for CI scripts -#################################################################### - -AC_ARG_ENABLE(werror, - AC_HELP_STRING([--enable-werror], - [Treat compiler warnings as errors]), -[ - CFLAGS="$CFLAGS -Werror" -]) - #################################################################### # Version information #################################################################### diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index 44b3810a926..6a47f054807 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.3rc4 +Version: 3.1.3 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/whitespace-purge.sh b/opal/mca/pmix/pmix3x/pmix/contrib/whitespace-purge.sh index 9c9d8fe909e..905796bc1ef 100755 --- a/opal/mca/pmix/pmix3x/pmix/contrib/whitespace-purge.sh +++ b/opal/mca/pmix/pmix3x/pmix/contrib/whitespace-purge.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved # Copyright (c) 2015 Cisco Systems, Inc. @@ -18,7 +18,7 @@ for file in $(git ls-files) ; do # skip sym links, pdfs, etc. If any other file types should be # skipped add the check here. type=$(file -b --mime-type -h $file) - if test ${type::4} == "text" ; then + if test ${type::4} = "text" ; then # Eliminate whitespace at the end of lines perl -pi -e 's/\s*$/\n/' $file fi diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 index d822ffaf74e..f613cba102d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/configure.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Sandia National Laboratories. All rights reserved. -# Copyright (c) 2014-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -46,7 +46,7 @@ AC_DEFUN([MCA_pmix_pnet_opa_CONFIG],[ pmix_check_opamgt_dir= AC_MSG_CHECKING([if opamgt requested]) - AS_IF([test "$with_opamgt" == "no"], + AS_IF([test "$with_opamgt" = "no"], [AC_MSG_RESULT([no]) pmix_check_opamgt_happy=no], [AC_MSG_RESULT([yes]) From b6da090090efc66bef3a0278e528ed7f777c2dac Mon Sep 17 00:00:00 2001 From: "Nysal Jan K.A" Date: Wed, 3 Jul 2019 14:33:01 +0530 Subject: [PATCH 367/674] pml/ucx: Fix the max tag and context id values Signed-off-by: Nysal Jan K.A (cherry picked from commit fe4ef147f81b2ac56661175005de6c330eace690) --- ompi/mca/pml/ucx/pml_ucx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 348dae8e1a6..ffb7d618343 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -72,8 +72,8 @@ mca_pml_ucx_module_t ompi_pml_ucx = { .pml_mrecv = mca_pml_ucx_mrecv, .pml_dump = mca_pml_ucx_dump, .pml_ft_event = NULL, - .pml_max_contextid = 1ul << (PML_UCX_CONTEXT_BITS), - .pml_max_tag = 1ul << (PML_UCX_TAG_BITS - 1) + .pml_max_contextid = (1ul << (PML_UCX_CONTEXT_BITS)) - 1, + .pml_max_tag = (1ul << (PML_UCX_TAG_BITS - 1)) - 1 }, .ucp_context = NULL, .ucp_worker = NULL From 667fe3f3f3a0e9abe382e2e8a550609a3de630c3 Mon Sep 17 00:00:00 2001 From: Orivej Desh Date: Thu, 4 Jul 2019 20:24:50 +0000 Subject: [PATCH 368/674] Fix oob_tcp tcp_component_close segfault with active listeners oob_tcp in non-HNP mode shares libevent event_base with oob_base [1]. orte_oob_base_close calls: (1) oob_tcp component_shutdown, then (2) opal_progress_thread_finalize, then (3) oob_tcp tcp_component_close [2]. opal_progress_thread_finalize calls tracker_destructor [3] that frees the event_base [4]. If any oob_tcp event listeners are active at this time, oob_tcp will crash trying to delete them at [5] [6]. This change moves oob_tcp event listener cleanup from component_close to component_shutdown so that it happens before the event_base is freed. [1] https://github.com/open-mpi/ompi/blob/v4.0.1/orte/mca/oob/tcp/oob_tcp_listener.c#L160 [2] https://github.com/open-mpi/ompi/blob/v4.0.1/orte/mca/oob/base/oob_base_frame.c#L95 [3] https://github.com/open-mpi/ompi/blob/v4.0.1/opal/runtime/opal_progress_threads.c#L232 [4] https://github.com/open-mpi/ompi/blob/v4.0.1/opal/runtime/opal_progress_threads.c#L65 [5] https://github.com/open-mpi/ompi/blob/v4.0.1/orte/mca/oob/tcp/oob_tcp_component.c#L192 [6] https://github.com/open-mpi/ompi/blob/v4.0.1/orte/mca/oob/tcp/oob_tcp_listener.c#L955 Signed-off-by: Orivej Desh (cherry picked from commit 78b7e342bd26f493547f750dac842252e7a15143) --- orte/mca/oob/tcp/oob_tcp_component.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/orte/mca/oob/tcp/oob_tcp_component.c b/orte/mca/oob/tcp/oob_tcp_component.c index 2843ce9cd3c..244c799631e 100644 --- a/orte/mca/oob/tcp/oob_tcp_component.c +++ b/orte/mca/oob/tcp/oob_tcp_component.c @@ -188,9 +188,6 @@ static int tcp_component_open(void) */ static int tcp_component_close(void) { - /* cleanup listen event list */ - OPAL_LIST_DESTRUCT(&mca_oob_tcp_component.listeners); - OBJ_DESTRUCT(&mca_oob_tcp_component.peers); if (NULL != mca_oob_tcp_component.ipv4conns) { @@ -748,6 +745,9 @@ static void component_shutdown(void) (void **) &peer, node, &node); } + /* cleanup listen event list */ + OPAL_LIST_DESTRUCT(&mca_oob_tcp_component.listeners); + opal_output_verbose(2, orte_oob_base_framework.framework_output, "%s TCP SHUTDOWN done", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); From 9499dcfe41c6c2d261d1bc456277a76b689acb72 Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Fri, 26 Jan 2018 10:11:21 -0500 Subject: [PATCH 369/674] Manage errors in NBC collective ops Signed-off-by: Aurelien Bouteiller Correctly bubble up errors in NBC collective operations Signed-off-by: Aurelien Bouteiller The error field of requests needs to be rearmed at start, not at create Signed-off-by: Aurelien Bouteiller (cherry picked from commit open-mpi/ompi@65660e5999fb7ed422536b79e1092520bed96694) --- ompi/mca/coll/libnbc/nbc.c | 39 ++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc.c b/ompi/mca/coll/libnbc/nbc.c index 039e6d4c9b0..54236c25a19 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -3,7 +3,7 @@ * Copyright (c) 2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2013 The University of Tennessee and The University + * Copyright (c) 2013-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2006 The Technical University of Chemnitz. All @@ -335,8 +335,14 @@ int NBC_Progress(NBC_Handle *handle) { while (handle->req_count) { ompi_request_t *subreq = handle->req_array[handle->req_count - 1]; if (REQUEST_COMPLETE(subreq)) { - ompi_request_free(&subreq); + if(OPAL_UNLIKELY( OMPI_SUCCESS != subreq->req_status.MPI_ERROR )) { + NBC_Error ("MPI Error in NBC subrequest %p : %d", subreq, subreq->req_status.MPI_ERROR); + /* copy the error code from the underlying request and let the + * round finish */ + handle->super.req_status.MPI_ERROR = subreq->req_status.MPI_ERROR; + } handle->req_count--; + ompi_request_free(&subreq); } else { flag = false; break; @@ -349,6 +355,26 @@ int NBC_Progress(NBC_Handle *handle) { /* a round is finished */ if (flag) { + /* reset handle for next round */ + if (NULL != handle->req_array) { + /* free request array */ + free (handle->req_array); + handle->req_array = NULL; + } + + handle->req_count = 0; + + /* previous round had an error */ + if (OPAL_UNLIKELY(OMPI_SUCCESS != handle->super.req_status.MPI_ERROR)) { + res = handle->super.req_status.MPI_ERROR; + NBC_Error("NBC_Progress: an error %d was found during schedule %p at row-offset %li - aborting the schedule\n", res, handle->schedule, handle->row_offset); + handle->nbc_complete = true; + if (!handle->super.req_persistent) { + NBC_Free(handle); + } + return res; + } + /* adjust delim to start of current round */ NBC_DEBUG(5, "NBC_Progress: going in schedule %p to row-offset: %li\n", handle->schedule, handle->row_offset); delim = handle->schedule->data + handle->row_offset; @@ -358,14 +384,6 @@ int NBC_Progress(NBC_Handle *handle) { /* adjust delim to end of current round -> delimiter */ delim = delim + size; - if (NULL != handle->req_array) { - /* free request array */ - free (handle->req_array); - handle->req_array = NULL; - } - - handle->req_count = 0; - if (*delim == 0) { /* this was the last round - we're done */ NBC_DEBUG(5, "NBC_Progress last round finished - we're done\n"); @@ -638,6 +656,7 @@ int NBC_Start(NBC_Handle *handle) { /* kick off first round */ handle->super.req_state = OMPI_REQUEST_ACTIVE; + handle->super.req_status.MPI_ERROR = OMPI_SUCCESS; res = NBC_Start_round(handle); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; From c9e4240e70d6e5c1186f7ba2090b8f5bc1c9dc2b Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 9 Apr 2019 15:11:07 +0900 Subject: [PATCH 370/674] mpi: retain operation and datatype in non blocking collectives MPI standard states a user MPI_Op and/or user MPI_Datatype can be free'd after a call to a non blocking collective and before the non-blocking collective completes. Retain user (only) MPI_Op and MPI_Datatype when the non blocking call is invoked, and set a request callback so they are free'd when the MPI_Request completes. Thanks Thomas Ponweiser for reporting this Fixes open-mpi/ompi#2151 Fixes open-mpi/ompi#1304 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@0fe756d4166eecf2f0ee2598da690c69a7c824c4) --- ompi/mca/coll/base/coll_base_util.c | 189 +++++++++++++++++- ompi/mca/coll/base/coll_base_util.h | 47 ++++- ompi/mca/coll/libnbc/coll_libnbc.h | 14 +- ompi/mca/coll/libnbc/coll_libnbc_component.c | 30 +-- ompi/mca/coll/libnbc/nbc.c | 20 +- ompi/mpi/c/iallgather.c | 8 +- ompi/mpi/c/iallgatherv.c | 8 +- ompi/mpi/c/iallreduce.c | 10 +- ompi/mpi/c/ialltoall.c | 8 +- ompi/mpi/c/ialltoallv.c | 8 +- ompi/mpi/c/ialltoallw.c | 8 +- ompi/mpi/c/ibcast.c | 13 +- ompi/mpi/c/iexscan.c | 10 +- ompi/mpi/c/igather.c | 24 ++- ompi/mpi/c/igatherv.c | 22 +- ompi/mpi/c/ineighbor_allgather.c | 8 +- ompi/mpi/c/ineighbor_allgatherv.c | 8 +- ompi/mpi/c/ineighbor_alltoall.c | 8 +- ompi/mpi/c/ineighbor_alltoallv.c | 4 + ompi/mpi/c/ineighbor_alltoallw.c | 4 + ompi/mpi/c/ireduce.c | 10 +- ompi/mpi/c/ireduce_scatter.c | 10 +- ompi/mpi/c/ireduce_scatter_block.c | 10 +- ompi/mpi/c/iscan.c | 10 +- ompi/mpi/c/iscatter.c | 24 ++- ompi/mpi/c/iscatterv.c | 24 ++- ompi/mpiext/pcollreq/c/allgather_init.c | 8 +- ompi/mpiext/pcollreq/c/allgatherv_init.c | 8 +- ompi/mpiext/pcollreq/c/allreduce_init.c | 10 +- ompi/mpiext/pcollreq/c/alltoall_init.c | 8 +- ompi/mpiext/pcollreq/c/alltoallv_init.c | 8 +- ompi/mpiext/pcollreq/c/alltoallw_init.c | 8 +- ompi/mpiext/pcollreq/c/bcast_init.c | 13 +- ompi/mpiext/pcollreq/c/exscan_init.c | 10 +- ompi/mpiext/pcollreq/c/gather_init.c | 24 ++- ompi/mpiext/pcollreq/c/gatherv_init.c | 24 ++- .../pcollreq/c/neighbor_allgather_init.c | 8 +- .../pcollreq/c/neighbor_allgatherv_init.c | 8 +- .../pcollreq/c/neighbor_alltoall_init.c | 8 +- .../pcollreq/c/neighbor_alltoallv_init.c | 8 +- .../pcollreq/c/neighbor_alltoallw_init.c | 8 +- ompi/mpiext/pcollreq/c/reduce_init.c | 10 +- .../pcollreq/c/reduce_scatter_block_init.c | 10 +- ompi/mpiext/pcollreq/c/reduce_scatter_init.c | 10 +- ompi/mpiext/pcollreq/c/scan_init.c | 10 +- ompi/mpiext/pcollreq/c/scatter_init.c | 24 ++- ompi/mpiext/pcollreq/c/scatterv_init.c | 24 ++- 47 files changed, 649 insertions(+), 139 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_util.c b/ompi/mca/coll/base/coll_base_util.c index 6187098598f..57fe14bad20 100644 --- a/ompi/mca/coll/base/coll_base_util.c +++ b/ompi/mca/coll/base/coll_base_util.c @@ -9,8 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -26,6 +26,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/mca/coll/base/coll_tags.h" #include "ompi/mca/coll/base/coll_base_functions.h" +#include "ompi/mca/topo/base/base.h" #include "ompi/mca/pml/pml.h" #include "coll_base_util.h" @@ -103,3 +104,187 @@ int ompi_rounddown(int num, int factor) num /= factor; return num * factor; /* floor(num / factor) * factor */ } + +static void release_objs_callback(struct ompi_coll_base_nbc_request_t *request) { + if (NULL != request->data.objs.objs[0]) { + OBJ_RELEASE(request->data.objs.objs[0]); + } + if (NULL != request->data.objs.objs[1]) { + OBJ_RELEASE(request->data.objs.objs[1]); + } +} + +static int complete_objs_callback(struct ompi_request_t *req) { + struct ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; + int rc = OMPI_SUCCESS; + assert (NULL != request); + if (NULL != request->cb.req_complete_cb) { + rc = request->cb.req_complete_cb(request->req_complete_cb_data); + } + release_objs_callback(request); + return rc; +} + +static int free_objs_callback(struct ompi_request_t **rptr) { + struct ompi_coll_base_nbc_request_t *request = *(ompi_coll_base_nbc_request_t **)rptr; + int rc = OMPI_SUCCESS; + if (NULL != request->cb.req_free) { + rc = request->cb.req_free(rptr); + } + release_objs_callback(request); + return rc; +} + +int ompi_coll_base_retain_op( ompi_request_t *req, ompi_op_t *op, + ompi_datatype_t *type) { + ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; + bool retain = false; + if (!ompi_op_is_intrinsic(op)) { + OBJ_RETAIN(op); + request->data.op.op = op; + retain = true; + } + if (!ompi_datatype_is_predefined(type)) { + OBJ_RETAIN(type); + request->data.op.datatype = type; + retain = true; + } + if (OPAL_UNLIKELY(retain)) { + /* We need to consider two cases : + * - non blocking collectives: + * the objects can be released when MPI_Wait() completes + * and we use the req_complete_cb callback + * - persistent non blocking collectives: + * the objects can only be released when the request is freed + * (e.g. MPI_Request_free() completes) and we use req_free callback + */ + if (req->req_persistent) { + request->cb.req_free = req->req_free; + req->req_free = free_objs_callback; + } else { + request->cb.req_complete_cb = req->req_complete_cb; + request->req_complete_cb_data = req->req_complete_cb_data; + req->req_complete_cb = complete_objs_callback; + req->req_complete_cb_data = request; + } + } + return OMPI_SUCCESS; +} + +int ompi_coll_base_retain_datatypes( ompi_request_t *req, ompi_datatype_t *stype, + ompi_datatype_t *rtype) { + ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; + bool retain = false; + if (NULL != stype && !ompi_datatype_is_predefined(stype)) { + OBJ_RETAIN(stype); + request->data.types.stype = stype; + retain = true; + } + if (NULL != rtype && !ompi_datatype_is_predefined(rtype)) { + OBJ_RETAIN(rtype); + request->data.types.rtype = rtype; + retain = true; + } + if (OPAL_UNLIKELY(retain)) { + if (req->req_persistent) { + request->cb.req_free = req->req_free; + req->req_free = free_objs_callback; + } else { + request->cb.req_complete_cb = req->req_complete_cb; + request->req_complete_cb_data = req->req_complete_cb_data; + req->req_complete_cb = complete_objs_callback; + req->req_complete_cb_data = request; + } + } + return OMPI_SUCCESS; +} + +static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) { + ompi_communicator_t *comm = request->super.req_mpi_object.comm; + int scount, rcount; + if (OMPI_COMM_IS_TOPO(comm)) { + (void)mca_topo_base_neighbor_count (comm, &rcount, &scount); + } else { + scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm); + } + for (int i=0; idata.vecs.stypes && NULL != request->data.vecs.stypes[i]) { + OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]); + } + } + for (int i=0; idata.vecs.rtypes && NULL != request->data.vecs.rtypes[i]) { + OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]); + } + } +} + +static int complete_vecs_callback(struct ompi_request_t *req) { + ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; + int rc = OMPI_SUCCESS; + assert (NULL != request); + if (NULL != request->cb.req_complete_cb) { + rc = request->cb.req_complete_cb(request->req_complete_cb_data); + } + release_vecs_callback(request); + return rc; +} + +static int free_vecs_callback(struct ompi_request_t **rptr) { + struct ompi_coll_base_nbc_request_t *request = *(ompi_coll_base_nbc_request_t **)rptr; + int rc = OMPI_SUCCESS; + if (NULL != request->cb.req_free) { + rc = request->cb.req_free(rptr); + } + release_vecs_callback(request); + return rc; +} + +int ompi_coll_base_retain_datatypes_w( ompi_request_t *req, + ompi_datatype_t *stypes[], ompi_datatype_t *rtypes[]) { + ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; + bool retain = false; + ompi_communicator_t *comm = request->super.req_mpi_object.comm; + int scount, rcount; + if (OMPI_COMM_IS_TOPO(comm)) { + (void)mca_topo_base_neighbor_count (comm, &rcount, &scount); + } else { + scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm); + } + + for (int i=0; idata.vecs.stypes = stypes; + request->data.vecs.rtypes = rtypes; + if (req->req_persistent) { + request->cb.req_free = req->req_free; + req->req_free = free_vecs_callback; + } else { + request->cb.req_complete_cb = req->req_complete_cb; + request->req_complete_cb_data = req->req_complete_cb_data; + req->req_complete_cb = complete_vecs_callback; + req->req_complete_cb_data = request; + } + } + return OMPI_SUCCESS; +} + +static void nbc_req_cons(ompi_coll_base_nbc_request_t *req) { + req->cb.req_complete_cb = NULL; + req->req_complete_cb_data = NULL; + req->data.objs.objs[0] = NULL; + req->data.objs.objs[1] = NULL; +} + +OBJ_CLASS_INSTANCE(ompi_coll_base_nbc_request_t, ompi_request_t, nbc_req_cons, NULL); diff --git a/ompi/mca/coll/base/coll_base_util.h b/ompi/mca/coll/base/coll_base_util.h index 8306b8fe83d..a5b80161240 100644 --- a/ompi/mca/coll/base/coll_base_util.h +++ b/ompi/mca/coll/base/coll_base_util.h @@ -9,8 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,10 +27,41 @@ #include "ompi/mca/mca.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/request/request.h" +#include "ompi/op/op.h" #include "ompi/mca/pml/pml.h" BEGIN_C_DECLS +struct ompi_coll_base_nbc_request_t { + ompi_request_t super; + union { + ompi_request_complete_fn_t req_complete_cb; + ompi_request_free_fn_t req_free; + } cb; + void *req_complete_cb_data; + union { + struct { + ompi_op_t *op; + ompi_datatype_t *datatype; + } op; + struct { + ompi_datatype_t *stype; + ompi_datatype_t *rtype; + } types; + struct { + opal_object_t *objs[2]; + } objs; + struct { + ompi_datatype_t **stypes; + ompi_datatype_t **rtypes; + } vecs; + } data; +}; + +OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_coll_base_nbc_request_t); + +typedef struct ompi_coll_base_nbc_request_t ompi_coll_base_nbc_request_t; + /** * A MPI_like function doing a send and a receive simultaneously. * If one of the communications results in a zero-byte message the @@ -84,5 +115,17 @@ unsigned int ompi_mirror_perm(unsigned int x, int nbits); */ int ompi_rounddown(int num, int factor); +int ompi_coll_base_retain_op( ompi_request_t *request, + ompi_op_t *op, + ompi_datatype_t *type); + +int ompi_coll_base_retain_datatypes( ompi_request_t *request, + ompi_datatype_t *stype, + ompi_datatype_t *rtype); + +int ompi_coll_base_retain_datatypes_w( ompi_request_t *request, + ompi_datatype_t *stypes[], + ompi_datatype_t *rtypes[]); + END_C_DECLS #endif /* MCA_COLL_BASE_UTIL_EXPORT_H */ diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 967a7794257..17abf86f2ab 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -13,8 +13,8 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -28,7 +28,7 @@ #define MCA_COLL_LIBNBC_EXPORT_H #include "ompi/mca/coll/coll.h" -#include "ompi/request/request.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "opal/sys/atomic.h" BEGIN_C_DECLS @@ -114,7 +114,7 @@ typedef struct NBC_Schedule NBC_Schedule; OBJ_CLASS_DECLARATION(NBC_Schedule); struct ompi_coll_libnbc_request_t { - ompi_request_t super; + ompi_coll_base_nbc_request_t super; MPI_Comm comm; long row_offset; bool nbc_complete; /* status in libnbc level */ @@ -138,13 +138,13 @@ typedef ompi_coll_libnbc_request_t NBC_Handle; opal_free_list_item_t *item; \ item = opal_free_list_wait (&mca_coll_libnbc_component.requests); \ req = (ompi_coll_libnbc_request_t*) item; \ - OMPI_REQUEST_INIT(&req->super, persistent); \ - req->super.req_mpi_object.comm = comm; \ + OMPI_REQUEST_INIT(&req->super.super, persistent); \ + req->super.super.req_mpi_object.comm = comm; \ } while (0) #define OMPI_COLL_LIBNBC_REQUEST_RETURN(req) \ do { \ - OMPI_REQUEST_FINI(&(req)->super); \ + OMPI_REQUEST_FINI(&(req)->super.super); \ opal_free_list_return (&mca_coll_libnbc_component.requests, \ (opal_free_list_item_t*) (req)); \ } while (0) diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index bf4960d9235..c5b1656385d 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -13,8 +13,8 @@ * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2017 Ian Bradley Morgan and Anthony Skjellum. All * rights reserved. @@ -328,21 +328,21 @@ ompi_coll_libnbc_progress(void) /* done, remove and complete */ OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); opal_list_remove_item(&mca_coll_libnbc_component.active_requests, - &request->super.super.super); + &request->super.super.super.super); OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock); if( OMPI_SUCCESS == res || NBC_OK == res || NBC_SUCCESS == res ) { - request->super.req_status.MPI_ERROR = OMPI_SUCCESS; + request->super.super.req_status.MPI_ERROR = OMPI_SUCCESS; } else { - request->super.req_status.MPI_ERROR = res; + request->super.super.req_status.MPI_ERROR = res; } - if(request->super.req_persistent) { + if(request->super.super.req_persistent) { /* reset for the next communication */ request->row_offset = 0; } - if(!request->super.req_persistent || !REQUEST_COMPLETE(&request->super)) { - ompi_request_complete(&request->super, true); + if(!request->super.super.req_persistent || !REQUEST_COMPLETE(&request->super.super)) { + ompi_request_complete(&request->super.super, true); } } OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); @@ -407,7 +407,7 @@ request_start(size_t count, ompi_request_t ** requests) NBC_DEBUG(5, "tmpbuf address=%p size=%u\n", handle->tmpbuf, sizeof(handle->tmpbuf)); NBC_DEBUG(5, "--------------------------------\n"); - handle->super.req_complete = REQUEST_PENDING; + handle->super.super.req_complete = REQUEST_PENDING; handle->nbc_complete = false; res = NBC_Start(handle); @@ -437,7 +437,7 @@ request_free(struct ompi_request_t **ompi_req) ompi_coll_libnbc_request_t *request = (ompi_coll_libnbc_request_t*) *ompi_req; - if( !REQUEST_COMPLETE(&request->super) ) { + if( !REQUEST_COMPLETE(&request->super.super) ) { return MPI_ERR_REQUEST; } @@ -451,11 +451,11 @@ request_free(struct ompi_request_t **ompi_req) static void request_construct(ompi_coll_libnbc_request_t *request) { - request->super.req_type = OMPI_REQUEST_COLL; - request->super.req_status._cancelled = 0; - request->super.req_start = request_start; - request->super.req_free = request_free; - request->super.req_cancel = request_cancel; + request->super.super.req_type = OMPI_REQUEST_COLL; + request->super.super.req_status._cancelled = 0; + request->super.super.req_start = request_start; + request->super.super.req_free = request_free; + request->super.super.req_cancel = request_cancel; } diff --git a/ompi/mca/coll/libnbc/nbc.c b/ompi/mca/coll/libnbc/nbc.c index 54236c25a19..171f5a37e9c 100644 --- a/ompi/mca/coll/libnbc/nbc.c +++ b/ompi/mca/coll/libnbc/nbc.c @@ -10,8 +10,8 @@ * rights reserved. * Copyright (c) 2015 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * * Author(s): Torsten Hoefler * @@ -339,7 +339,7 @@ int NBC_Progress(NBC_Handle *handle) { NBC_Error ("MPI Error in NBC subrequest %p : %d", subreq, subreq->req_status.MPI_ERROR); /* copy the error code from the underlying request and let the * round finish */ - handle->super.req_status.MPI_ERROR = subreq->req_status.MPI_ERROR; + handle->super.super.req_status.MPI_ERROR = subreq->req_status.MPI_ERROR; } handle->req_count--; ompi_request_free(&subreq); @@ -365,11 +365,11 @@ int NBC_Progress(NBC_Handle *handle) { handle->req_count = 0; /* previous round had an error */ - if (OPAL_UNLIKELY(OMPI_SUCCESS != handle->super.req_status.MPI_ERROR)) { - res = handle->super.req_status.MPI_ERROR; + if (OPAL_UNLIKELY(OMPI_SUCCESS != handle->super.super.req_status.MPI_ERROR)) { + res = handle->super.super.req_status.MPI_ERROR; NBC_Error("NBC_Progress: an error %d was found during schedule %p at row-offset %li - aborting the schedule\n", res, handle->schedule, handle->row_offset); handle->nbc_complete = true; - if (!handle->super.req_persistent) { + if (!handle->super.super.req_persistent) { NBC_Free(handle); } return res; @@ -389,7 +389,7 @@ int NBC_Progress(NBC_Handle *handle) { NBC_DEBUG(5, "NBC_Progress last round finished - we're done\n"); handle->nbc_complete = true; - if (!handle->super.req_persistent) { + if (!handle->super.super.req_persistent) { NBC_Free(handle); } @@ -655,15 +655,15 @@ int NBC_Start(NBC_Handle *handle) { } /* kick off first round */ - handle->super.req_state = OMPI_REQUEST_ACTIVE; - handle->super.req_status.MPI_ERROR = OMPI_SUCCESS; + handle->super.super.req_state = OMPI_REQUEST_ACTIVE; + handle->super.super.req_status.MPI_ERROR = OMPI_SUCCESS; res = NBC_Start_round(handle); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); - opal_list_append(&mca_coll_libnbc_component.active_requests, &(handle->super.super.super)); + opal_list_append(&mca_coll_libnbc_component.active_requests, (opal_list_item_t *)handle); OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock); return OMPI_SUCCESS; diff --git a/ompi/mpi/c/iallgather.c b/ompi/mpi/c/iallgather.c index 7d2740b6512..8e0abe3fe8c 100644 --- a/ompi/mpi/c/iallgather.c +++ b/ompi/mpi/c/iallgather.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -102,6 +103,9 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_iallgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, comm->c_coll->coll_iallgather_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iallgatherv.c b/ompi/mpi/c/iallgatherv.c index 0373a15b1d3..e743cb9b06f 100644 --- a/ompi/mpi/c/iallgatherv.c +++ b/ompi/mpi/c/iallgatherv.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -126,6 +127,9 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, recvbuf, recvcounts, displs, recvtype, comm, request, comm->c_coll->coll_iallgatherv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iallreduce.c b/ompi/mpi/c/iallreduce.c index d0ea511cf84..bfa968c55b4 100644 --- a/ompi/mpi/c/iallreduce.c +++ b/ompi/mpi/c/iallreduce.c @@ -12,8 +12,8 @@ * All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -112,10 +113,11 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_iallreduce(sendbuf, recvbuf, count, datatype, op, comm, request, comm->c_coll->coll_iallreduce_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ialltoall.c b/ompi/mpi/c/ialltoall.c index 2d46b76f38f..0637f29f396 100644 --- a/ompi/mpi/c/ialltoall.c +++ b/ompi/mpi/c/ialltoall.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2013 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -101,5 +102,8 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_ialltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, comm->c_coll->coll_ialltoall_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ialltoallv.c b/ompi/mpi/c/ialltoallv.c index 577b3828949..cef857cdf78 100644 --- a/ompi/mpi/c/ialltoallv.c +++ b/ompi/mpi/c/ialltoallv.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -130,6 +131,9 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl err = comm->c_coll->coll_ialltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, request, comm->c_coll->coll_ialltoallv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ialltoallw.c b/ompi/mpi/c/ialltoallw.c index b7bc86eaa7d..6dc4af8854a 100644 --- a/ompi/mpi/c/ialltoallw.c +++ b/ompi/mpi/c/ialltoallw.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -127,6 +128,9 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, request, comm->c_coll->coll_ialltoallw_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes_w(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtypes, recvtypes); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ibcast.c b/ompi/mpi/c/ibcast.c index 1f049b4c6de..2dcdbb9633d 100644 --- a/ompi/mpi/c/ibcast.c +++ b/ompi/mpi/c/ibcast.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. @@ -19,6 +19,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -86,5 +87,13 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, err = comm->c_coll->coll_ibcast(buffer, count, datatype, root, comm, request, comm->c_coll->coll_ibcast_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (!OMPI_COMM_IS_INTRA(comm)) { + if (MPI_PROC_NULL == root) { + datatype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, datatype, NULL); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iexscan.c b/ompi/mpi/c/iexscan.c index 14cf23c590b..4c56e08f1e4 100644 --- a/ompi/mpi/c/iexscan.c +++ b/ompi/mpi/c/iexscan.c @@ -12,8 +12,8 @@ * 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -82,10 +83,11 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_iexscan(sendbuf, recvbuf, count, datatype, op, comm, request, comm->c_coll->coll_iexscan_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/igather.c b/ompi/mpi/c/igather.c index 3fcda7e8069..c876daa7ec7 100644 --- a/ompi/mpi/c/igather.c +++ b/ompi/mpi/c/igather.c @@ -15,8 +15,8 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -173,5 +174,24 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_igather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, comm->c_coll->coll_igather_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == sendbuf) { + sendtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + recvtype = NULL; + } + } else { + if (MPI_ROOT == root) { + sendtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + recvtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/igatherv.c b/ompi/mpi/c/igatherv.c index e2deab3cc9f..1d575dce4cc 100644 --- a/ompi/mpi/c/igatherv.c +++ b/ompi/mpi/c/igatherv.c @@ -13,7 +13,7 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science + * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -29,6 +29,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -196,5 +197,24 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_igatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm, request, comm->c_coll->coll_igatherv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == sendbuf) { + sendtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + recvtype = NULL; + } + } else { + if (MPI_ROOT == root) { + sendtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + recvtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ineighbor_allgather.c b/ompi/mpi/c/ineighbor_allgather.c index 2706ea44d4a..cba5b5d4e36 100644 --- a/ompi/mpi/c/ineighbor_allgather.c +++ b/ompi/mpi/c/ineighbor_allgather.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Rigde National Laboratory. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -124,6 +125,9 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen err = comm->c_coll->coll_ineighbor_allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, comm->c_coll->coll_ineighbor_allgather_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ineighbor_allgatherv.c b/ompi/mpi/c/ineighbor_allgatherv.c index 2f3c244064c..58dedb61057 100644 --- a/ompi/mpi/c/ineighbor_allgatherv.c +++ b/ompi/mpi/c/ineighbor_allgatherv.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -147,6 +148,9 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se recvbuf, (int *) recvcounts, (int *) displs, recvtype, comm, request, comm->c_coll->coll_ineighbor_allgatherv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ineighbor_alltoall.c b/ompi/mpi/c/ineighbor_alltoall.c index b3d0846421e..b03b7cc50fa 100644 --- a/ompi/mpi/c/ineighbor_alltoall.c +++ b/ompi/mpi/c/ineighbor_alltoall.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -124,5 +125,8 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send err = comm->c_coll->coll_ineighbor_alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, request, comm->c_coll->coll_ineighbor_alltoall_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ineighbor_alltoallv.c b/ompi/mpi/c/ineighbor_alltoallv.c index 9645e15b05d..a44d081e10a 100644 --- a/ompi/mpi/c/ineighbor_alltoallv.c +++ b/ompi/mpi/c/ineighbor_alltoallv.c @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -147,6 +148,9 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i err = comm->c_coll->coll_ineighbor_alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, request, comm->c_coll->coll_ineighbor_alltoallv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ineighbor_alltoallw.c b/ompi/mpi/c/ineighbor_alltoallw.c index 150f28d7173..efb4d24f5f7 100644 --- a/ompi/mpi/c/ineighbor_alltoallw.c +++ b/ompi/mpi/c/ineighbor_alltoallw.c @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -147,6 +148,9 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M err = comm->c_coll->coll_ineighbor_alltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, request, comm->c_coll->coll_ineighbor_alltoallw_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes_w(*request, sendtypes, recvtypes); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ireduce.c b/ompi/mpi/c/ireduce.c index 47948887824..be552250fce 100644 --- a/ompi/mpi/c/ireduce.c +++ b/ompi/mpi/c/ireduce.c @@ -13,8 +13,8 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -136,10 +137,11 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, OPAL_CR_ENTER_LIBRARY(); /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_ireduce(sendbuf, recvbuf, count, datatype, op, root, comm, request, comm->c_coll->coll_ireduce_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ireduce_scatter.c b/ompi/mpi/c/ireduce_scatter.c index 211b217971e..56525fa19f7 100644 --- a/ompi/mpi/c/ireduce_scatter.c +++ b/ompi/mpi/c/ireduce_scatter.c @@ -13,8 +13,8 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -133,10 +134,11 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_ireduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm, request, comm->c_coll->coll_ireduce_scatter_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/ireduce_scatter_block.c b/ompi/mpi/c/ireduce_scatter_block.c index ded4abf2232..ce43ab3cd4f 100644 --- a/ompi/mpi/c/ireduce_scatter_block.c +++ b/ompi/mpi/c/ireduce_scatter_block.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -100,10 +101,11 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount, /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_ireduce_scatter_block(sendbuf, recvbuf, recvcount, datatype, op, comm, request, comm->c_coll->coll_ireduce_scatter_block_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iscan.c b/ompi/mpi/c/iscan.c index 34502b8e366..cfae0ff409a 100644 --- a/ompi/mpi/c/iscan.c +++ b/ompi/mpi/c/iscan.c @@ -13,8 +13,8 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -96,11 +97,12 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, /* Call the coll component to actually perform the allgather */ - OBJ_RETAIN(op); err = comm->c_coll->coll_iscan(sendbuf, recvbuf, count, datatype, op, comm, request, comm->c_coll->coll_iscan_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iscatter.c b/ompi/mpi/c/iscatter.c index 79a22d57a52..3357ad21158 100644 --- a/ompi/mpi/c/iscatter.c +++ b/ompi/mpi/c/iscatter.c @@ -15,8 +15,8 @@ * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -156,5 +157,24 @@ int MPI_Iscatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_iscatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, request, comm->c_coll->coll_iscatter_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == recvbuf) { + recvtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + sendtype = NULL; + } + } else { + if (MPI_ROOT == root) { + recvtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + sendtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpi/c/iscatterv.c b/ompi/mpi/c/iscatterv.c index 66ae9003caa..2d164662f4a 100644 --- a/ompi/mpi/c/iscatterv.c +++ b/ompi/mpi/c/iscatterv.c @@ -13,8 +13,8 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -196,5 +197,24 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[ err = comm->c_coll->coll_iscatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, request, comm->c_coll->coll_iscatterv_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == recvbuf) { + recvtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + sendtype = NULL; + } + } else { + if (MPI_ROOT == root) { + recvtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + sendtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/allgather_init.c b/ompi/mpiext/pcollreq/c/allgather_init.c index 46a568bc65d..4b699f91a16 100644 --- a/ompi/mpiext/pcollreq/c/allgather_init.c +++ b/ompi/mpiext/pcollreq/c/allgather_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -103,6 +104,9 @@ int MPIX_Allgather_init(const void *sendbuf, int sendcount, MPI_Datatype sendtyp err = comm->c_coll->coll_allgather_init(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, info, request, comm->c_coll->coll_allgather_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/allgatherv_init.c b/ompi/mpiext/pcollreq/c/allgatherv_init.c index d4b3c7368ab..2021ab9668e 100644 --- a/ompi/mpiext/pcollreq/c/allgatherv_init.c +++ b/ompi/mpiext/pcollreq/c/allgatherv_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -128,6 +129,9 @@ int MPIX_Allgatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendty recvbuf, recvcounts, displs, recvtype, comm, info, request, comm->c_coll->coll_allgatherv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/allreduce_init.c b/ompi/mpiext/pcollreq/c/allreduce_init.c index dd224f1115d..1213395f3ec 100644 --- a/ompi/mpiext/pcollreq/c/allreduce_init.c +++ b/ompi/mpiext/pcollreq/c/allreduce_init.c @@ -12,8 +12,8 @@ * 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-2019 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$ @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -115,9 +116,10 @@ int MPIX_Allreduce_init(const void *sendbuf, void *recvbuf, int count, /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_allreduce_init(sendbuf, recvbuf, count, datatype, op, comm, info, request, comm->c_coll->coll_allreduce_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/alltoall_init.c b/ompi/mpiext/pcollreq/c/alltoall_init.c index b176f63c753..7cb36216474 100644 --- a/ompi/mpiext/pcollreq/c/alltoall_init.c +++ b/ompi/mpiext/pcollreq/c/alltoall_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -102,5 +103,8 @@ int MPIX_Alltoall_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype err = comm->c_coll->coll_alltoall_init(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, info, request, comm->c_coll->coll_alltoall_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/alltoallv_init.c b/ompi/mpiext/pcollreq/c/alltoallv_init.c index 06d5922b2ac..3d34536fb01 100644 --- a/ompi/mpiext/pcollreq/c/alltoallv_init.c +++ b/ompi/mpiext/pcollreq/c/alltoallv_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -131,6 +132,9 @@ int MPIX_Alltoallv_init(const void *sendbuf, const int sendcounts[], const int s err = comm->c_coll->coll_alltoallv_init(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, info, request, comm->c_coll->coll_alltoallv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/alltoallw_init.c b/ompi/mpiext/pcollreq/c/alltoallw_init.c index 405cc4c4f82..50902f1f639 100644 --- a/ompi/mpiext/pcollreq/c/alltoallw_init.c +++ b/ompi/mpiext/pcollreq/c/alltoallw_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -128,6 +129,9 @@ int MPIX_Alltoallw_init(const void *sendbuf, const int sendcounts[], const int s sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm, info, request, comm->c_coll->coll_alltoallw_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes_w(*request, (MPI_IN_PLACE==sendbuf)?NULL:sendtypes, recvtypes); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/bcast_init.c b/ompi/mpiext/pcollreq/c/bcast_init.c index 6a2798a9700..9cf71a7a671 100644 --- a/ompi/mpiext/pcollreq/c/bcast_init.c +++ b/ompi/mpiext/pcollreq/c/bcast_init.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2012 Oak Rigde National Laboratory. All rights reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017-2018 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. @@ -19,6 +19,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -87,5 +88,13 @@ int MPIX_Bcast_init(void *buffer, int count, MPI_Datatype datatype, err = comm->c_coll->coll_bcast_init(buffer, count, datatype, root, comm, info, request, comm->c_coll->coll_bcast_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (!OMPI_COMM_IS_INTRA(comm)) { + if (MPI_PROC_NULL == root) { + datatype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, datatype, NULL); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/exscan_init.c b/ompi/mpiext/pcollreq/c/exscan_init.c index 23f155429cd..f8e34ced68a 100644 --- a/ompi/mpiext/pcollreq/c/exscan_init.c +++ b/ompi/mpiext/pcollreq/c/exscan_init.c @@ -12,8 +12,8 @@ * 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -84,10 +85,11 @@ int MPIX_Exscan_init(const void *sendbuf, void *recvbuf, int count, /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_exscan_init(sendbuf, recvbuf, count, datatype, op, comm, info, request, comm->c_coll->coll_exscan_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/gather_init.c b/ompi/mpiext/pcollreq/c/gather_init.c index f62dd9b54dd..051a0eaa133 100644 --- a/ompi/mpiext/pcollreq/c/gather_init.c +++ b/ompi/mpiext/pcollreq/c/gather_init.c @@ -15,8 +15,8 @@ * Copyright (c) 2008 Sun Microsystems, Inc. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -174,5 +175,24 @@ int MPIX_Gather_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_gather_init(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, info, request, comm->c_coll->coll_gather_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == sendbuf) { + sendtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + recvtype = NULL; + } + } else { + if (MPI_ROOT == root) { + sendtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + recvtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/gatherv_init.c b/ompi/mpiext/pcollreq/c/gatherv_init.c index fbbd346008c..bd875a051c7 100644 --- a/ompi/mpiext/pcollreq/c/gatherv_init.c +++ b/ompi/mpiext/pcollreq/c/gatherv_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/memchecker.h" #include "ompi/runtime/ompi_spc.h" @@ -199,5 +200,24 @@ int MPIX_Gatherv_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype, recvcounts, displs, recvtype, root, comm, info, request, comm->c_coll->coll_gatherv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == sendbuf) { + sendtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + recvtype = NULL; + } + } else { + if (MPI_ROOT == root) { + sendtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + recvtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/neighbor_allgather_init.c b/ompi/mpiext/pcollreq/c/neighbor_allgather_init.c index 4494b507b72..cd3037d0bda 100644 --- a/ompi/mpiext/pcollreq/c/neighbor_allgather_init.c +++ b/ompi/mpiext/pcollreq/c/neighbor_allgather_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Rigde National Laboratory. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -125,6 +126,9 @@ int MPIX_Neighbor_allgather_init(const void *sendbuf, int sendcount, MPI_Datatyp err = comm->c_coll->coll_neighbor_allgather_init(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm, info, request, comm->c_coll->coll_neighbor_allgather_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/neighbor_allgatherv_init.c b/ompi/mpiext/pcollreq/c/neighbor_allgatherv_init.c index 66fa0487c57..3e53b846312 100644 --- a/ompi/mpiext/pcollreq/c/neighbor_allgatherv_init.c +++ b/ompi/mpiext/pcollreq/c/neighbor_allgatherv_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -149,6 +150,9 @@ int MPIX_Neighbor_allgatherv_init(const void *sendbuf, int sendcount, MPI_Dataty recvbuf, (int *) recvcounts, (int *) displs, recvtype, comm, info, request, comm->c_coll->coll_neighbor_allgatherv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/neighbor_alltoall_init.c b/ompi/mpiext/pcollreq/c/neighbor_alltoall_init.c index c564ee7e9e5..c2b0ac3c19b 100644 --- a/ompi/mpiext/pcollreq/c/neighbor_alltoall_init.c +++ b/ompi/mpiext/pcollreq/c/neighbor_alltoall_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Laboratory. All rights reserved. * Copyright (c) 2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -32,6 +32,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -126,5 +127,8 @@ int MPIX_Neighbor_alltoall_init(const void *sendbuf, int sendcount, MPI_Datatype recvbuf, recvcount, recvtype, comm, info, request, comm->c_coll->coll_neighbor_alltoall_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/neighbor_alltoallv_init.c b/ompi/mpiext/pcollreq/c/neighbor_alltoallv_init.c index 8d3503bf57b..f86e256d815 100644 --- a/ompi/mpiext/pcollreq/c/neighbor_alltoallv_init.c +++ b/ompi/mpiext/pcollreq/c/neighbor_alltoallv_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -149,6 +150,9 @@ int MPIX_Neighbor_alltoallv_init(const void *sendbuf, const int sendcounts[], co sendtype, recvbuf, recvcounts, rdispls, recvtype, comm, info, request, comm->c_coll->coll_neighbor_alltoallv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/neighbor_alltoallw_init.c b/ompi/mpiext/pcollreq/c/neighbor_alltoallw_init.c index 68e2b2cad22..1143ccbb3cf 100644 --- a/ompi/mpiext/pcollreq/c/neighbor_alltoallw_init.c +++ b/ompi/mpiext/pcollreq/c/neighbor_alltoallw_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mca/topo/topo.h" #include "ompi/mca/topo/base/base.h" @@ -149,6 +150,9 @@ int MPIX_Neighbor_alltoallw_init(const void *sendbuf, const int sendcounts[], co recvbuf, recvcounts, rdispls, recvtypes, comm, info, request, comm->c_coll->coll_neighbor_alltoallw_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_datatypes_w(*request, sendtypes, recvtypes); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/reduce_init.c b/ompi/mpiext/pcollreq/c/reduce_init.c index 1e72877d504..d3b50747bfe 100644 --- a/ompi/mpiext/pcollreq/c/reduce_init.c +++ b/ompi/mpiext/pcollreq/c/reduce_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2006 Cisco Systems, Inc. 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-2019 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$ @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -139,10 +140,11 @@ int MPIX_Reduce_init(const void *sendbuf, void *recvbuf, int count, OPAL_CR_ENTER_LIBRARY(); /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_reduce_init(sendbuf, recvbuf, count, datatype, op, root, comm, info, request, comm->c_coll->coll_reduce_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/reduce_scatter_block_init.c b/ompi/mpiext/pcollreq/c/reduce_scatter_block_init.c index ef000ae6e16..c0b8c344e62 100644 --- a/ompi/mpiext/pcollreq/c/reduce_scatter_block_init.c +++ b/ompi/mpiext/pcollreq/c/reduce_scatter_block_init.c @@ -14,8 +14,8 @@ * Copyright (c) 2012 Oak Ridge National Labs. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -101,10 +102,11 @@ int MPIX_Reduce_scatter_block_init(const void *sendbuf, void *recvbuf, int recvc /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_reduce_scatter_block_init(sendbuf, recvbuf, recvcount, datatype, op, comm, info, request, comm->c_coll->coll_reduce_scatter_block_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/reduce_scatter_init.c b/ompi/mpiext/pcollreq/c/reduce_scatter_init.c index b8c470f064d..5bf5712e3e6 100644 --- a/ompi/mpiext/pcollreq/c/reduce_scatter_init.c +++ b/ompi/mpiext/pcollreq/c/reduce_scatter_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 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$ @@ -32,6 +32,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -135,10 +136,11 @@ int MPIX_Reduce_scatter_init(const void *sendbuf, void *recvbuf, const int recvc /* Invoke the coll component to perform the back-end operation */ - OBJ_RETAIN(op); err = comm->c_coll->coll_reduce_scatter_init(sendbuf, recvbuf, recvcounts, datatype, op, comm, info, request, comm->c_coll->coll_reduce_scatter_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/scan_init.c b/ompi/mpiext/pcollreq/c/scan_init.c index 8ff34dd5f5f..35540c1a102 100644 --- a/ompi/mpiext/pcollreq/c/scan_init.c +++ b/ompi/mpiext/pcollreq/c/scan_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2006 Cisco Systems, Inc. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -98,11 +99,12 @@ int MPIX_Scan_init(const void *sendbuf, void *recvbuf, int count, /* Call the coll component to actually perform the allgather */ - OBJ_RETAIN(op); err = comm->c_coll->coll_scan_init(sendbuf, recvbuf, count, datatype, op, comm, info, request, comm->c_coll->coll_scan_init_module); - OBJ_RELEASE(op); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + ompi_coll_base_retain_op(*request, op, datatype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/scatter_init.c b/ompi/mpiext/pcollreq/c/scatter_init.c index 30ee31f88d4..7ab7700c62a 100644 --- a/ompi/mpiext/pcollreq/c/scatter_init.c +++ b/ompi/mpiext/pcollreq/c/scatter_init.c @@ -15,8 +15,8 @@ * Copyright (c) 2008 Sun Microsystems, Inc. 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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,6 +31,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -157,5 +158,24 @@ int MPIX_Scatter_init(const void *sendbuf, int sendcount, MPI_Datatype sendtype, err = comm->c_coll->coll_scatter_init(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm, info, request, comm->c_coll->coll_scatter_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == recvbuf) { + recvtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + sendtype = NULL; + } + } else { + if (MPI_ROOT == root) { + recvtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + sendtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } diff --git a/ompi/mpiext/pcollreq/c/scatterv_init.c b/ompi/mpiext/pcollreq/c/scatterv_init.c index fef368caf7b..d2d53c7fd95 100644 --- a/ompi/mpiext/pcollreq/c/scatterv_init.c +++ b/ompi/mpiext/pcollreq/c/scatterv_init.c @@ -13,8 +13,8 @@ * Copyright (c) 2006-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-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-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,6 +29,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/errhandler/errhandler.h" #include "ompi/datatype/ompi_datatype.h" +#include "ompi/mca/coll/base/coll_base_util.h" #include "ompi/memchecker.h" #include "ompi/mpiext/pcollreq/c/mpiext_pcollreq_c.h" #include "ompi/runtime/ompi_spc.h" @@ -197,5 +198,24 @@ int MPIX_Scatterv_init(const void *sendbuf, const int sendcounts[], const int di err = comm->c_coll->coll_scatterv_init(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm, info, request, comm->c_coll->coll_scatterv_init_module); + if (OPAL_LIKELY(OMPI_SUCCESS == err)) { + if (OMPI_COMM_IS_INTRA(comm)) { + if (MPI_IN_PLACE == recvbuf) { + recvtype = NULL; + } else if (ompi_comm_rank(comm) != root) { + sendtype = NULL; + } + } else { + if (MPI_ROOT == root) { + recvtype = NULL; + } else if (MPI_PROC_NULL == root) { + sendtype = NULL; + recvtype = NULL; + } else { + sendtype = NULL; + } + } + ompi_coll_base_retain_datatypes(*request, sendtype, recvtype); + } OMPI_ERRHANDLER_RETURN(err, comm, err, FUNC_NAME); } From 71f240f078b9dcb177b15b3b2ee8777d039801b9 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 12 Jul 2019 07:35:56 -0600 Subject: [PATCH 371/674] btl/openib: fix issue 6785 Commit d7053a3 broke things for the case when Open MPI 4.0.x is built without UCX support. Problem was it was trying to partially initialize the btl to try and delay printing of a help message till wireup. Well this sort of doesn't work in all cases. Rather than keep piling on changes to support a help message for a BTL that we are deprecating, take a keep it simple stupid approach. So, revert most of d7053a3 and instead put the help message back in the original location, during scan of ports of the available HCAs to check for whether or not link layer for that port is configured for ethernet or infiniband. If Open MPI was built with UCX support, don't emit the help message, if UCX was not linked in, emit the help message. Verified on a system with connectX5 HCAs configured with two ports configured for ethernet and two for infiniband. relates to #6785 Signed-off-by: Howard Pritchard --- config/ompi_check_ucx.m4 | 2 + opal/mca/btl/openib/btl_openib.c | 137 ++++++++++----------- opal/mca/btl/openib/btl_openib.h | 4 +- opal/mca/btl/openib/btl_openib_component.c | 91 ++++++-------- 4 files changed, 103 insertions(+), 131 deletions(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 044b599dc3b..42e53f9ce80 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -135,9 +135,11 @@ AC_DEFUN([OMPI_CHECK_UCX],[ [$1_CPPFLAGS="[$]$1_CPPFLAGS $ompi_check_ucx_CPPFLAGS" $1_LDFLAGS="[$]$1_LDFLAGS $ompi_check_ucx_LDFLAGS" $1_LIBS="[$]$1_LIBS $ompi_check_ucx_LIBS" + AC_DEFINE([HAVE_UCX], [1], [have ucx]) $2], [AS_IF([test ! -z "$with_ucx" && test "$with_ucx" != "no"], [AC_MSG_ERROR([UCX support requested but not found. Aborting])]) + AC_DEFINE([HAVE_UCX], [0], [have ucx]) $3]) OPAL_VAR_SCOPE_POP diff --git a/opal/mca/btl/openib/btl_openib.c b/opal/mca/btl/openib/btl_openib.c index c2686a0676a..f9ba3a3de61 100644 --- a/opal/mca/btl/openib/btl_openib.c +++ b/opal/mca/btl/openib/btl_openib.c @@ -22,6 +22,7 @@ * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved + * Copyrigth (c) 2019 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -1040,15 +1041,6 @@ int mca_btl_openib_add_procs( int btl_rank = 0; volatile mca_btl_base_endpoint_t* endpoint; - - if (! openib_btl->allowed) { - opal_bitmap_clear_all_bits(reachable); - opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", - true, opal_process_info.nodename, - openib_btl->device_name, openib_btl->port_num); - return OPAL_SUCCESS; - } - btl_rank = get_openib_btl_params(openib_btl, &lcl_subnet_id_port_cnt); if( 0 > btl_rank ){ return OPAL_ERR_NOT_FOUND; @@ -1648,81 +1640,80 @@ static int mca_btl_openib_finalize_resources(struct mca_btl_base_module_t* btl) return OPAL_SUCCESS; } - if (openib_btl->allowed) { - /* Release all QPs */ - if (NULL != openib_btl->device->endpoints) { - for (ep_index=0; - ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); - ep_index++) { - endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, + /* Release all QPs */ + if (NULL != openib_btl->device->endpoints) { + for (ep_index=0; + ep_index < opal_pointer_array_get_size(openib_btl->device->endpoints); + ep_index++) { + + endpoint=(mca_btl_openib_endpoint_t *)opal_pointer_array_get_item(openib_btl->device->endpoints, ep_index); - if(!endpoint) { - BTL_VERBOSE(("In finalize, got another null endpoint")); - continue; - } - if(endpoint->endpoint_btl != openib_btl) { - continue; - } - for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { - if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { - openib_btl->device->eager_rdma_buffers[i] = NULL; - OBJ_RELEASE(endpoint); - } + if(!endpoint) { + BTL_VERBOSE(("In finalize, got another null endpoint")); + continue; + } + if(endpoint->endpoint_btl != openib_btl) { + continue; + } + for(i = 0; i < openib_btl->device->eager_rdma_buffers_count; i++) { + if(openib_btl->device->eager_rdma_buffers[i] == endpoint) { + openib_btl->device->eager_rdma_buffers[i] = NULL; + OBJ_RELEASE(endpoint); } - opal_pointer_array_set_item(openib_btl->device->endpoints, - ep_index, NULL); - assert(((opal_object_t*)endpoint)->obj_reference_count == 1); - OBJ_RELEASE(endpoint); } + opal_pointer_array_set_item(openib_btl->device->endpoints, + ep_index, NULL); + assert(((opal_object_t*)endpoint)->obj_reference_count == 1); + OBJ_RELEASE(endpoint); } + } - /* Release SRQ resources */ - for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { - if(!BTL_OPENIB_QP_TYPE_PP(qp)) { - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( - &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); - MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( - &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); - if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { - opal_mutex_t *lock = - &mca_btl_openib_component.srq_manager.lock; - - opal_hash_table_t *srq_addr_table = - &mca_btl_openib_component.srq_manager.srq_addr_table; - - opal_mutex_lock(lock); - if (OPAL_SUCCESS != - opal_hash_table_remove_value_ptr(srq_addr_table, - &openib_btl->qps[qp].u.srq_qp.srq, - sizeof(struct ibv_srq *))) { - BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); - rc = OPAL_ERROR; - } - opal_mutex_unlock(lock); - if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { - BTL_VERBOSE(("Failed to close SRQ %d", qp)); - rc = OPAL_ERROR; - } - } + /* Release SRQ resources */ + for(qp = 0; qp < mca_btl_openib_component.num_qps; qp++) { + if(!BTL_OPENIB_QP_TYPE_PP(qp)) { + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( + &openib_btl->qps[qp].u.srq_qp.pending_frags[0]); + MCA_BTL_OPENIB_CLEAN_PENDING_FRAGS( + &openib_btl->qps[qp].u.srq_qp.pending_frags[1]); + if (NULL != openib_btl->qps[qp].u.srq_qp.srq) { + opal_mutex_t *lock = + &mca_btl_openib_component.srq_manager.lock; - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); - OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); - } - } + opal_hash_table_t *srq_addr_table = + &mca_btl_openib_component.srq_manager.srq_addr_table; - /* Finalize the CPC modules on this openib module */ - for (i = 0; i < openib_btl->num_cpcs; ++i) { - if (NULL != openib_btl->cpcs[i]->cbm_finalize) { - openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); + opal_mutex_lock(lock); + if (OPAL_SUCCESS != + opal_hash_table_remove_value_ptr(srq_addr_table, + &openib_btl->qps[qp].u.srq_qp.srq, + sizeof(struct ibv_srq *))) { + BTL_VERBOSE(("Failed to remove SRQ %d entry from hash table.", qp)); + rc = OPAL_ERROR; + } + opal_mutex_unlock(lock); + if (0 != ibv_destroy_srq(openib_btl->qps[qp].u.srq_qp.srq)) { + BTL_VERBOSE(("Failed to close SRQ %d", qp)); + rc = OPAL_ERROR; + } } - free(openib_btl->cpcs[i]); + + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[0]); + OBJ_DESTRUCT(&openib_btl->qps[qp].u.srq_qp.pending_frags[1]); } - free(openib_btl->cpcs); + } - /* Release device if there are no more users */ - if(!(--openib_btl->device->allowed_btls)) { - OBJ_RELEASE(openib_btl->device); + /* Finalize the CPC modules on this openib module */ + for (i = 0; i < openib_btl->num_cpcs; ++i) { + if (NULL != openib_btl->cpcs[i]->cbm_finalize) { + openib_btl->cpcs[i]->cbm_finalize(openib_btl, openib_btl->cpcs[i]); } + free(openib_btl->cpcs[i]); + } + free(openib_btl->cpcs); + + /* Release device if there are no more users */ + if(!(--openib_btl->device->allowed_btls)) { + OBJ_RELEASE(openib_btl->device); } if (NULL != openib_btl->qps) { diff --git a/opal/mca/btl/openib/btl_openib.h b/opal/mca/btl/openib/btl_openib.h index 0b85bfb5662..3ffc0feffce 100644 --- a/opal/mca/btl/openib/btl_openib.h +++ b/opal/mca/btl/openib/btl_openib.h @@ -20,6 +20,8 @@ * Copyright (c) 2014 Bull SAS. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyrigth (c) 2019 Triad National Security, LLC. All rights reserved. + * * $COPYRIGHT$ * * Additional copyrights may follow @@ -506,8 +508,6 @@ struct mca_btl_openib_module_t { int local_procs; /** number of local procs */ bool atomic_ops_be; /** atomic result is big endian */ - - bool allowed; /** is this port allowed */ }; typedef struct mca_btl_openib_module_t mca_btl_openib_module_t; diff --git a/opal/mca/btl/openib/btl_openib_component.c b/opal/mca/btl/openib/btl_openib_component.c index fcc0ac56973..d93178fb537 100644 --- a/opal/mca/btl/openib/btl_openib_component.c +++ b/opal/mca/btl/openib/btl_openib_component.c @@ -22,6 +22,7 @@ * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved. + * Copyrigth (c) 2019 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -278,9 +279,6 @@ static int btl_openib_modex_send(void) ); /* For each module, add in the size of the per-CPC data */ for (i = 0; i < mca_btl_openib_component.ib_num_btls; i++) { - if (! mca_btl_openib_component.openib_btls[i]->allowed) { - continue; - } for (j = 0; j < mca_btl_openib_component.openib_btls[i]->num_cpcs; ++j) { @@ -309,9 +307,6 @@ static int btl_openib_modex_send(void) /* Pack each of the modules */ for (i = 0; i < mca_btl_openib_component.ib_num_btls; i++) { - if (! mca_btl_openib_component.openib_btls[i]->allowed) { - continue; - } /* Pack the modex common message struct. */ size = modex_message_size; @@ -633,38 +628,26 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, * unless the user specifically requested to override this * policy. For ancient OFED, only allow if user has set * the MCA parameter. + * + * We emit a help message if Open MPI was configured without + * UCX support if the port is configured to use infiniband for link + * layer. If UCX support is available, don't emit help message + * since UCX PML has higher priority than OB1 and this BTL will + * not be used. */ - if (! mca_btl_openib_component.allow_ib + if (false == mca_btl_openib_component.allow_ib #if HAVE_DECL_IBV_LINK_LAYER_ETHERNET && IBV_LINK_LAYER_INFINIBAND == ib_port_attr->link_layer #endif ) { - openib_btl = (mca_btl_openib_module_t *) calloc(1, sizeof(mca_btl_openib_module_t)); - if(NULL == openib_btl) { - BTL_ERROR(("Failed malloc: %s:%d", __FILE__, __LINE__)); - return OPAL_ERR_OUT_OF_RESOURCE; - } - memcpy(openib_btl, &mca_btl_openib_module, - sizeof(mca_btl_openib_module)); - ib_selected = OBJ_NEW(mca_btl_base_selected_module_t); - ib_selected->btl_module = (mca_btl_base_module_t*) openib_btl; - openib_btl->port_num = (uint8_t) port_num; - openib_btl->allowed = false; - openib_btl->device = NULL; - openib_btl->device_name = strdup(ibv_get_device_name(device->ib_dev)); - OBJ_CONSTRUCT(&openib_btl->ib_lock, opal_mutex_t); - opal_list_append(btl_list, (opal_list_item_t*) ib_selected); - opal_pointer_array_add(device->device_btls, (void*) openib_btl); - ++device->btls; - ++mca_btl_openib_component.ib_num_btls; - if (-1 != mca_btl_openib_component.ib_max_btls && - mca_btl_openib_component.ib_num_btls >= - mca_btl_openib_component.ib_max_btls) { - return OPAL_ERR_VALUE_OUT_OF_BOUNDS; - } - return OPAL_SUCCESS; - } - +#if !HAVE_UCX + opal_show_help("help-mpi-btl-openib.txt", "ib port not selected", + true, opal_process_info.nodename, + ibv_get_device_name(device->ib_dev), + port_num); +#endif + return OPAL_ERR_NOT_FOUND; + } /* Ensure that the requested GID index (via the btl_openib_gid_index MCA param) is within the GID table @@ -901,8 +884,6 @@ static int init_one_port(opal_list_t *btl_list, mca_btl_openib_device_t *device, } } - openib_btl->allowed = true; - opal_list_append(btl_list, (opal_list_item_t*) ib_selected); opal_pointer_array_add(device->device_btls, (void*) openib_btl); ++device->btls; @@ -2999,29 +2980,27 @@ btl_openib_component_init(int *num_btl_modules, ib_selected = (mca_btl_base_selected_module_t*)item; openib_btl = (mca_btl_openib_module_t*)ib_selected->btl_module; - if (openib_btl->allowed) { - /* Search for a CPC that can handle this port */ - ret = opal_btl_openib_connect_base_select_for_local_port(openib_btl); - /* If we get NOT_SUPPORTED, then no CPC was found for this - port. But that's not a fatal error -- just keep going; - let's see if we find any usable openib modules or not. */ - if (OPAL_ERR_NOT_SUPPORTED == ret) { - continue; - } else if (OPAL_SUCCESS != ret) { - /* All others *are* fatal. Note that we already did a - show_help in the lower layer */ - goto no_btls; - } + /* Search for a CPC that can handle this port */ + ret = opal_btl_openib_connect_base_select_for_local_port(openib_btl); + /* If we get NOT_SUPPORTED, then no CPC was found for this + port. But that's not a fatal error -- just keep going; + let's see if we find any usable openib modules or not. */ + if (OPAL_ERR_NOT_SUPPORTED == ret) { + continue; + } else if (OPAL_SUCCESS != ret) { + /* All others *are* fatal. Note that we already did a + show_help in the lower layer */ + goto no_btls; + } - if (mca_btl_openib_component.max_hw_msg_size > 0 && - (uint32_t)mca_btl_openib_component.max_hw_msg_size > openib_btl->ib_port_attr.max_msg_sz) { - BTL_ERROR(("max_hw_msg_size (%" PRIu32 ") is larger than hw max message size (%" PRIu32 ")", - mca_btl_openib_component.max_hw_msg_size, openib_btl->ib_port_attr.max_msg_sz)); - } + if (mca_btl_openib_component.max_hw_msg_size > 0 && + (uint32_t)mca_btl_openib_component.max_hw_msg_size > openib_btl->ib_port_attr.max_msg_sz) { + BTL_ERROR(("max_hw_msg_size (%" PRIu32 ") is larger than hw max message size (%" PRIu32 ")", + mca_btl_openib_component.max_hw_msg_size, openib_btl->ib_port_attr.max_msg_sz)); + } - if (finish_btl_init(openib_btl) != OPAL_SUCCESS) { - goto no_btls; - } + if (finish_btl_init(openib_btl) != OPAL_SUCCESS) { + goto no_btls; } mca_btl_openib_component.openib_btls[i] = openib_btl; From 63605fc4669902a2b83bf0777898e461cf5b45a3 Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Fri, 12 Jul 2019 22:23:33 +0300 Subject: [PATCH 372/674] v4.0.x OSC: Reset external request to NULL to avoid double request completion Co-authored with Artem Polyakov Signed-off-by: Tomislav Janjusic --- ompi/mca/osc/ucx/osc_ucx_request.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ompi/mca/osc/ucx/osc_ucx_request.c b/ompi/mca/osc/ucx/osc_ucx_request.c index efbd9c38cc6..4be050e3dcc 100644 --- a/ompi/mca/osc/ucx/osc_ucx_request.c +++ b/ompi/mca/osc/ucx/osc_ucx_request.c @@ -55,6 +55,7 @@ void req_completion(void *request, ucs_status_t status) { if(req->external_req != NULL) { ompi_request_complete(&(req->external_req->super), true); + req->external_req = NULL; ucp_request_release(req); mca_osc_ucx_component.num_incomplete_req_ops--; assert(mca_osc_ucx_component.num_incomplete_req_ops >= 0); From aae73d9cf7517693cfc7b9280f1687d30178b4d9 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sat, 13 Jul 2019 18:36:12 +0900 Subject: [PATCH 373/674] fortran/mpif-h: fix C to Fortran error code conversion - remove incorrect use of OMPI_INT_2_FINT() - use homogenous syntax (e.g. c_ierr = PMPI_...()) Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@223e6cc5377f968d135a44f0470a6de38740315c) --- ompi/mpi/fortran/mpif-h/comm_split_type_f.c | 14 +++++----- .../mpif-h/dist_graph_create_adjacent_f.c | 26 ++++++++++--------- ompi/mpi/fortran/mpif-h/dist_graph_create_f.c | 14 +++++----- .../mpif-h/dist_graph_neighbors_count_f.c | 14 +++++----- .../fortran/mpif-h/dist_graph_neighbors_f.c | 19 ++++++++------ ompi/mpi/fortran/mpif-h/improbe_f.c | 12 ++++----- ompi/mpi/fortran/mpif-h/imrecv_f.c | 8 +++--- ompi/mpi/fortran/mpif-h/mprobe_f.c | 10 +++---- ompi/mpi/fortran/mpif-h/mrecv_f.c | 8 +++--- 9 files changed, 67 insertions(+), 58 deletions(-) diff --git a/ompi/mpi/fortran/mpif-h/comm_split_type_f.c b/ompi/mpi/fortran/mpif-h/comm_split_type_f.c index c6eb7306a37..b35d45ac06f 100644 --- a/ompi/mpi/fortran/mpif-h/comm_split_type_f.c +++ b/ompi/mpi/fortran/mpif-h/comm_split_type_f.c @@ -11,8 +11,8 @@ * All rights reserved. * Copyright (c) 2012 Sandia National Laboratories. All rights reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -77,11 +77,11 @@ void ompi_comm_split_type_f(MPI_Fint *comm, MPI_Fint *split_type, MPI_Fint *key, c_info = PMPI_Info_f2c(*info); - c_ierr = OMPI_INT_2_FINT(PMPI_Comm_split_type(c_comm, - OMPI_FINT_2_INT(*split_type), - OMPI_FINT_2_INT(*key), - c_info, - &c_newcomm )); + c_ierr = PMPI_Comm_split_type(c_comm, + OMPI_FINT_2_INT(*split_type), + OMPI_FINT_2_INT(*key), + c_info, + &c_newcomm); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { diff --git a/ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c b/ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c index f9668b379a8..1f2e6bc795a 100644 --- a/ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c +++ b/ompi/mpi/fortran/mpif-h/dist_graph_create_adjacent_f.c @@ -8,8 +8,8 @@ * Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,6 +78,7 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree, MPI_Info c_info; MPI_Comm c_comm_old, c_comm_graph; int *c_destweights, *c_sourceweights; + int c_ierr; OMPI_ARRAY_NAME_DECL(sources); OMPI_ARRAY_NAME_DECL(destinations); @@ -105,16 +106,17 @@ void ompi_dist_graph_create_adjacent_f(MPI_Fint *comm_old, MPI_Fint *indegree, c_destweights = OMPI_ARRAY_NAME_CONVERT(destweights); } - *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree), - OMPI_ARRAY_NAME_CONVERT(sources), - c_sourceweights, - OMPI_FINT_2_INT(*outdegree), - OMPI_ARRAY_NAME_CONVERT(destinations), - c_destweights, - c_info, - OMPI_LOGICAL_2_INT(*reorder), - &c_comm_graph)); - if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { + c_ierr = PMPI_Dist_graph_create_adjacent(c_comm_old, OMPI_FINT_2_INT(*indegree), + OMPI_ARRAY_NAME_CONVERT(sources), + c_sourceweights, + OMPI_FINT_2_INT(*outdegree), + OMPI_ARRAY_NAME_CONVERT(destinations), + c_destweights, + c_info, + OMPI_LOGICAL_2_INT(*reorder), + &c_comm_graph); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); + if (OMPI_SUCCESS == c_ierr) { *comm_graph = PMPI_Comm_c2f(c_comm_graph); } diff --git a/ompi/mpi/fortran/mpif-h/dist_graph_create_f.c b/ompi/mpi/fortran/mpif-h/dist_graph_create_f.c index 2692f9b7d06..3380be8a537 100644 --- a/ompi/mpi/fortran/mpif-h/dist_graph_create_f.c +++ b/ompi/mpi/fortran/mpif-h/dist_graph_create_f.c @@ -7,8 +7,8 @@ * Copyright (c) 2011-2013 Université Bordeaux 1 * Copyright (c) 2014 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -75,6 +75,7 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources int count = 0, i; MPI_Info c_info; int *c_weights; + int c_ierr; OMPI_ARRAY_NAME_DECL(sources); OMPI_ARRAY_NAME_DECL(degrees); @@ -98,10 +99,11 @@ void ompi_dist_graph_create_f(MPI_Fint *comm_old, MPI_Fint *n, MPI_Fint *sources } - *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources), - OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations), - c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph)); - if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { + c_ierr = PMPI_Dist_graph_create(c_comm_old, OMPI_FINT_2_INT(*n), OMPI_ARRAY_NAME_CONVERT(sources), + OMPI_ARRAY_NAME_CONVERT(degrees), OMPI_ARRAY_NAME_CONVERT(destinations), + c_weights, c_info, OMPI_LOGICAL_2_INT(*reorder), &c_comm_graph); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); + if (OMPI_SUCCESS == c_ierr) { *comm_graph = PMPI_Comm_c2f(c_comm_graph); } diff --git a/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_count_f.c b/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_count_f.c index 4f8611e783a..aad5aac5f80 100644 --- a/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_count_f.c +++ b/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_count_f.c @@ -4,7 +4,7 @@ * reserved. * Copyright (c) 2011-2013 Inria. All rights reserved. * Copyright (c) 2011-2013 Université Bordeaux 1 - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -69,15 +69,17 @@ void ompi_dist_graph_neighbors_count_f(MPI_Fint *comm, MPI_Fint *inneighbors, OMPI_SINGLE_NAME_DECL(inneighbors); OMPI_SINGLE_NAME_DECL(outneighbors); OMPI_LOGICAL_NAME_DECL(weighted); + int c_ierr; c_comm = PMPI_Comm_f2c(*comm); - *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors_count(c_comm, - OMPI_SINGLE_NAME_CONVERT(inneighbors), - OMPI_SINGLE_NAME_CONVERT(outneighbors), - OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted))); + c_ierr = PMPI_Dist_graph_neighbors_count(c_comm, + OMPI_SINGLE_NAME_CONVERT(inneighbors), + OMPI_SINGLE_NAME_CONVERT(outneighbors), + OMPI_LOGICAL_SINGLE_NAME_CONVERT(weighted)); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); OMPI_SINGLE_INT_2_LOGICAL(weighted); - if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { + if (OMPI_SUCCESS == c_ierr) { OMPI_SINGLE_INT_2_FINT(inneighbors); OMPI_SINGLE_INT_2_FINT(outneighbors); } diff --git a/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c b/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c index 5309b322c35..556d909ad1d 100644 --- a/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c +++ b/ompi/mpi/fortran/mpif-h/dist_graph_neighbors_f.c @@ -4,8 +4,8 @@ * reserved. * Copyright (c) 2011-2013 Inria. All rights reserved. * Copyright (c) 2011-2013 Université Bordeaux 1 - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -74,6 +74,7 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree, OMPI_ARRAY_NAME_DECL(sourceweights); OMPI_ARRAY_NAME_DECL(destinations); OMPI_ARRAY_NAME_DECL(destweights); + int c_ierr; c_comm = PMPI_Comm_f2c(*comm); @@ -86,12 +87,14 @@ void ompi_dist_graph_neighbors_f(MPI_Fint* comm, MPI_Fint* maxindegree, OMPI_ARRAY_FINT_2_INT_ALLOC(destweights, *maxoutdegree); } - *ierr = OMPI_INT_2_FINT(PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree), - OMPI_ARRAY_NAME_CONVERT(sources), - OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights), - OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations), - OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights))); - if (OMPI_SUCCESS == OMPI_FINT_2_INT(*ierr)) { + c_ierr = PMPI_Dist_graph_neighbors(c_comm, OMPI_FINT_2_INT(*maxindegree), + OMPI_ARRAY_NAME_CONVERT(sources), + OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(sourceweights), + OMPI_FINT_2_INT(*maxoutdegree), OMPI_ARRAY_NAME_CONVERT(destinations), + OMPI_IS_FORTRAN_UNWEIGHTED(destweights) ? MPI_UNWEIGHTED : OMPI_ARRAY_NAME_CONVERT(destweights)); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); + + if (OMPI_SUCCESS == c_ierr) { OMPI_ARRAY_INT_2_FINT(sources, *maxindegree); if( !OMPI_IS_FORTRAN_UNWEIGHTED(sourceweights) ) { OMPI_ARRAY_INT_2_FINT(sourceweights, *maxindegree); diff --git a/ompi/mpi/fortran/mpif-h/improbe_f.c b/ompi/mpi/fortran/mpif-h/improbe_f.c index 8d7764fffd1..936cc4e399c 100644 --- a/ompi/mpi/fortran/mpif-h/improbe_f.c +++ b/ompi/mpi/fortran/mpif-h/improbe_f.c @@ -11,8 +11,8 @@ * All rights reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * @@ -87,10 +87,10 @@ void ompi_improbe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status) - c_ierr = OMPI_INT_2_FINT(PMPI_Improbe(OMPI_FINT_2_INT(*source), - OMPI_FINT_2_INT(*tag), - c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), - &c_message, c_status)); + c_ierr = PMPI_Improbe(OMPI_FINT_2_INT(*source), + OMPI_FINT_2_INT(*tag), + c_comm, OMPI_LOGICAL_SINGLE_NAME_CONVERT(flag), + &c_message, c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { diff --git a/ompi/mpi/fortran/mpif-h/imrecv_f.c b/ompi/mpi/fortran/mpif-h/imrecv_f.c index 4ba7a13a2ad..2f706d941c1 100644 --- a/ompi/mpi/fortran/mpif-h/imrecv_f.c +++ b/ompi/mpi/fortran/mpif-h/imrecv_f.c @@ -10,8 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2015 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * @@ -80,8 +80,8 @@ void ompi_imrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype, c_message = PMPI_Message_f2c(*message); - c_ierr = OMPI_INT_2_FINT(PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), - c_type, &c_message, &c_req)); + c_ierr = PMPI_Imrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), + c_type, &c_message, &c_req); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { diff --git a/ompi/mpi/fortran/mpif-h/mprobe_f.c b/ompi/mpi/fortran/mpif-h/mprobe_f.c index db39bce941c..0558e9543f8 100644 --- a/ompi/mpi/fortran/mpif-h/mprobe_f.c +++ b/ompi/mpi/fortran/mpif-h/mprobe_f.c @@ -12,7 +12,7 @@ * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ @@ -86,10 +86,10 @@ void ompi_mprobe_f(MPI_Fint *source, MPI_Fint *tag, MPI_Fint *comm, OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status) - c_ierr = OMPI_INT_2_FINT(PMPI_Mprobe(OMPI_FINT_2_INT(*source), - OMPI_FINT_2_INT(*tag), - c_comm, &c_message, - c_status)); + c_ierr = PMPI_Mprobe(OMPI_FINT_2_INT(*source), + OMPI_FINT_2_INT(*tag), + c_comm, &c_message, + c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { diff --git a/ompi/mpi/fortran/mpif-h/mrecv_f.c b/ompi/mpi/fortran/mpif-h/mrecv_f.c index 33a122510cd..8a898ce7f5d 100644 --- a/ompi/mpi/fortran/mpif-h/mrecv_f.c +++ b/ompi/mpi/fortran/mpif-h/mrecv_f.c @@ -77,16 +77,16 @@ void ompi_mrecv_f(char *buf, MPI_Fint *count, MPI_Fint *datatype, MPI_Fint *message, MPI_Fint *status, MPI_Fint *ierr) { int c_ierr; - OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2) + OMPI_FORTRAN_STATUS_DECLARATION(c_status,c_status2) MPI_Message c_message = PMPI_Message_f2c(*message); MPI_Datatype c_type = PMPI_Type_f2c(*datatype); OMPI_FORTRAN_STATUS_SET_POINTER(c_status,c_status2,status) /* Call the C function */ - c_ierr = OMPI_INT_2_FINT(PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), - c_type, &c_message, - c_status)); + c_ierr = PMPI_Mrecv(OMPI_F2C_BOTTOM(buf), OMPI_FINT_2_INT(*count), + c_type, &c_message, + c_status); if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); if (MPI_SUCCESS == c_ierr) { From fbf7d31fd18e09ee5acfebcb03414920ada0cc17 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sat, 13 Jul 2019 22:08:11 +0900 Subject: [PATCH 374/674] fortran/mpif-h: fix MPI_[I]Alltoallw() binding - ignore sendcounts, sendispls and sendtypes arguments when MPI_IN_PLACE is used - use the right size when an inter-communicator is used. Thanks Markus Geimer for reporting this. Refs. open-mpi/ompi#5459 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@cdaed89d0481e8352a6c1a6cb8f71a250ea9352b) --- ompi/mpi/fortran/mpif-h/alltoallw_f.c | 29 +++++++++++++---------- ompi/mpi/fortran/mpif-h/ialltoallw_f.c | 32 +++++++++++++++----------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/ompi/mpi/fortran/mpif-h/alltoallw_f.c b/ompi/mpi/fortran/mpif-h/alltoallw_f.c index cb2328cf972..581eb7288e1 100644 --- a/ompi/mpi/fortran/mpif-h/alltoallw_f.c +++ b/ompi/mpi/fortran/mpif-h/alltoallw_f.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science + * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -23,6 +23,7 @@ #include "ompi/mpi/fortran/mpif-h/bindings.h" #include "ompi/mpi/fortran/base/constants.h" +#include "ompi/communicator/communicator.h" #if OMPI_BUILD_MPI_PROFILING #if OPAL_HAVE_WEAK_SYMBOLS @@ -82,20 +83,22 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts, OMPI_ARRAY_NAME_DECL(rdispls); c_comm = PMPI_Comm_f2c(*comm); - PMPI_Comm_size(c_comm, &size); + size = OMPI_COMM_IS_INTER(c_comm)?ompi_comm_remote_size(c_comm):ompi_comm_size(c_comm); - c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype)); - c_recvtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype)); + if (!OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) { + c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype)); + OMPI_ARRAY_FINT_2_INT(sendcounts, size); + OMPI_ARRAY_FINT_2_INT(sdispls, size); + for (int i=0; i 0) { - c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]); - c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]); - --size; + for (int i=0; i 0) { - c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]); - c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]); - --size; + for (int i=0; i Date: Wed, 17 Jul 2019 09:28:43 +0900 Subject: [PATCH 375/674] fortran/mpif-h: fix [i]alltoallw bindings Fix a regression introduced in open-mpi/ompi@cdaed89d0481e8352a6c1a6cb8f71a250ea9352b Fixes CID 1451610, 1451611 and 1451612 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@ed703bec1bcfc5425598ccc197a3735e6cef19d8) --- ompi/mpi/fortran/mpif-h/alltoallw_f.c | 4 ++-- ompi/mpi/fortran/mpif-h/ialltoallw_f.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ompi/mpi/fortran/mpif-h/alltoallw_f.c b/ompi/mpi/fortran/mpif-h/alltoallw_f.c index 581eb7288e1..55b782a7928 100644 --- a/ompi/mpi/fortran/mpif-h/alltoallw_f.c +++ b/ompi/mpi/fortran/mpif-h/alltoallw_f.c @@ -75,7 +75,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts, MPI_Fint *comm, MPI_Fint *ierr) { MPI_Comm c_comm; - MPI_Datatype *c_sendtypes, *c_recvtypes; + MPI_Datatype *c_sendtypes = NULL, *c_recvtypes; int size, c_ierr; OMPI_ARRAY_NAME_DECL(sendcounts); OMPI_ARRAY_NAME_DECL(sdispls); @@ -119,7 +119,7 @@ void ompi_alltoallw_f(char *sendbuf, MPI_Fint *sendcounts, OMPI_ARRAY_FINT_2_INT_CLEANUP(sdispls); OMPI_ARRAY_FINT_2_INT_CLEANUP(recvcounts); OMPI_ARRAY_FINT_2_INT_CLEANUP(rdispls); - if (MPI_IN_PLACE != sendbuf) { + if (NULL != c_sendtypes) { free(c_sendtypes); } free(c_recvtypes); diff --git a/ompi/mpi/fortran/mpif-h/ialltoallw_f.c b/ompi/mpi/fortran/mpif-h/ialltoallw_f.c index 2aed76900e8..75f8262bef5 100644 --- a/ompi/mpi/fortran/mpif-h/ialltoallw_f.c +++ b/ompi/mpi/fortran/mpif-h/ialltoallw_f.c @@ -75,7 +75,7 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts, MPI_Fint *comm, MPI_Fint *request, MPI_Fint *ierr) { MPI_Comm c_comm; - MPI_Datatype *c_sendtypes, *c_recvtypes; + MPI_Datatype *c_sendtypes = NULL, *c_recvtypes; MPI_Request c_request; int size, c_ierr; OMPI_ARRAY_NAME_DECL(sendcounts); @@ -101,7 +101,6 @@ void ompi_ialltoallw_f(char *sendbuf, MPI_Fint *sendcounts, for (int i=0; i Date: Wed, 17 Jul 2019 09:30:09 +0900 Subject: [PATCH 376/674] pcollreq/mpif-h: fix MPIX_Alltoallw_init() binding Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@b71af0eca0ed8b5acf2bdddc720e163cf491422a) --- .../mpiext/pcollreq/mpif-h/alltoallw_init_f.c | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c b/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c index 183d739f797..a90047c093f 100644 --- a/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c +++ b/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c @@ -10,8 +10,8 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,6 +23,7 @@ #include "ompi/mpi/fortran/mpif-h/bindings.h" #include "ompi/mpi/fortran/base/constants.h" +#include "ompi/communicator/communicator.h" #include "ompi/mpiext/pcollreq/mpif-h/mpiext_pcollreq_prototypes.h" #if OMPI_BUILD_MPI_PROFILING @@ -85,22 +86,22 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts, OMPI_ARRAY_NAME_DECL(rdispls); c_comm = PMPI_Comm_f2c(*comm); - PMPI_Comm_size(c_comm, &size); + size = OMPI_COMM_IS_INTER(c_comm)?ompi_comm_remote_size(c_comm):ompi_comm_size(c_comm); + + if (!OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) { + c_sendtypes = (MPI_Datatype *) malloc(size * sizeof(MPI_Datatype)); + OMPI_ARRAY_FINT_2_INT(sendcounts, size); + OMPI_ARRAY_FINT_2_INT(sdispls, size); + for (int i=0; i 0) { - c_sendtypes[size - 1] = PMPI_Type_f2c(sendtypes[size - 1]); - c_recvtypes[size - 1] = PMPI_Type_f2c(recvtypes[size - 1]); - --size; + for (int i=0; i Date: Tue, 23 Jul 2019 08:45:17 +0900 Subject: [PATCH 377/674] pcollreq/mpif-h: fix MPIX_Alltoallw_init() binding These issues were introduced in the recent commit b71af0eca0. This commit fixes Coverity CID 1451661 and 1451660. Though `c_info` part was an actual bug, the `c_sendtypes` part was not. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit open-mpi/ompi@facf8c5e98b22a615d50a56f0a2ae94515ef0bad) --- ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c b/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c index a90047c093f..0fae1e194db 100644 --- a/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c +++ b/ompi/mpiext/pcollreq/mpif-h/alltoallw_init_f.c @@ -76,7 +76,7 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts, MPI_Fint *comm, MPI_Fint *info, MPI_Fint *request, MPI_Fint *ierr) { MPI_Comm c_comm; - MPI_Datatype *c_sendtypes, *c_recvtypes; + MPI_Datatype *c_sendtypes = NULL, *c_recvtypes; MPI_Info c_info; MPI_Request c_request; int size, c_ierr; @@ -86,6 +86,7 @@ void ompix_alltoallw_init_f(char *sendbuf, MPI_Fint *sendcounts, OMPI_ARRAY_NAME_DECL(rdispls); c_comm = PMPI_Comm_f2c(*comm); + c_info = PMPI_Info_f2c(*info); size = OMPI_COMM_IS_INTER(c_comm)?ompi_comm_remote_size(c_comm):ompi_comm_size(c_comm); if (!OMPI_IS_FORTRAN_IN_PLACE(sendbuf)) { From 0422b23f3509b98ad5bcbff1927f93bfdc37cec6 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Thu, 18 Jul 2019 18:45:50 -0400 Subject: [PATCH 378/674] Try to prevent the compiler from optimizing out MPIR_Breakpoint(). Signed-off-by: Austen Lauria (cherry picked from commit 00106f5ac96a3d9e6288ec07dc47e325897cd5f8) Signed-off-by: Austen Lauria --- orte/orted/orted_submit.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index ccc089e51cb..33eddc5818d 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -175,12 +175,30 @@ static void orte_debugger_init_before_spawn(orte_job_t *jdata); ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void); +/* + * Attempt to prevent the compiler from optimizing out + * MPIR_Breakpoint(). + * + * Some older versions of automake can add -O3 to every + * file via CFLAGS (which was demonstrated in automake v1.13.4), + * so there is a possibility that the compiler will see + * this function as a NOOP and optimize it out on older versions. + * While using the current/recommended version of automake + * does not do this, the following will help those + * stuck with an older version, as well as guard against + * future regressions. + * + * See the following git issue for more discussion: + * https://github.com/open-mpi/ompi/issues/5501 + */ +static volatile void* volatile noop_mpir_breakpoint_ptr = NULL; + /* * Breakpoint function for parallel debuggers */ void* MPIR_Breakpoint(void) { - return NULL; + return noop_mpir_breakpoint_ptr; } /* local objects */ From 3d5b7b4a1b5473c0aa235baaca1388d8790804b5 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Tue, 2 Jul 2019 16:04:03 +0300 Subject: [PATCH 379/674] COLL/TUNED: Update alltoall selection rule for mlx Use linear with sync alltoall algorithm for certain message/comm size ranges. Does not affect default fixed decision, unless HPCX (with its custom parameters) is used or corresponding mca is set. Signed-off-by: Mikhail Brinskii (cherry picked from commit 404c4800688548b021bda68bdf10792424e6b1c5) --- contrib/platform/mellanox/optimized.conf | 5 ++++ ompi/mca/coll/tuned/coll_tuned.h | 3 +++ .../coll/tuned/coll_tuned_alltoall_decision.c | 27 ++++++++++++++----- ompi/mca/coll/tuned/coll_tuned_component.c | 7 +++++ .../coll/tuned/coll_tuned_decision_fixed.c | 6 +++++ 5 files changed, 41 insertions(+), 7 deletions(-) diff --git a/contrib/platform/mellanox/optimized.conf b/contrib/platform/mellanox/optimized.conf index c58428cf6ad..986db6f6b39 100644 --- a/contrib/platform/mellanox/optimized.conf +++ b/contrib/platform/mellanox/optimized.conf @@ -78,3 +78,8 @@ opal_event_include=epoll bml_r2_show_unreach_errors = 0 +# alltoall algorithm selection settings for tuned coll mca +coll_tuned_alltoall_large_msg = 250000 +coll_tuned_alltoall_min_procs = 2048 +coll_tuned_alltoall_algorithm_max_requests = 8 + diff --git a/ompi/mca/coll/tuned/coll_tuned.h b/ompi/mca/coll/tuned/coll_tuned.h index d4b201bc7a3..7ae039c9809 100644 --- a/ompi/mca/coll/tuned/coll_tuned.h +++ b/ompi/mca/coll/tuned/coll_tuned.h @@ -38,6 +38,9 @@ extern int ompi_coll_tuned_init_chain_fanout; extern int ompi_coll_tuned_init_max_requests; extern int ompi_coll_tuned_alltoall_small_msg; extern int ompi_coll_tuned_alltoall_intermediate_msg; +extern int ompi_coll_tuned_alltoall_large_msg; +extern int ompi_coll_tuned_alltoall_min_procs; +extern int ompi_coll_tuned_alltoall_max_reqs; /* forced algorithm choices */ /* this structure is for storing the indexes to the forced algorithm mca params... */ diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c b/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c index 2ef1e6b9038..86c16be5352 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c @@ -28,7 +28,6 @@ /* alltoall algorithm variables */ static int coll_tuned_alltoall_forced_algorithm = 0; static int coll_tuned_alltoall_segment_size = 0; -static int coll_tuned_alltoall_max_requests; static int coll_tuned_alltoall_tree_fanout; static int coll_tuned_alltoall_chain_fanout; @@ -115,7 +114,22 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm MCA_BASE_VAR_SCOPE_ALL, &coll_tuned_alltoall_chain_fanout); - coll_tuned_alltoall_max_requests = 0; /* no limit for alltoall by default */ + (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "alltoall_large_msg", + "threshold (if supported) to decide if large MSGs alltoall algorithm will be used", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_coll_tuned_alltoall_large_msg); + + (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "alltoall_min_procs", + "threshold (if supported) to decide if many processes alltoall algorithm will be used", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_coll_tuned_alltoall_min_procs); + mca_param_indices->max_requests_param_index = mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, "alltoall_algorithm_max_requests", @@ -123,17 +137,16 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, - &coll_tuned_alltoall_max_requests); + &ompi_coll_tuned_alltoall_max_reqs); if (mca_param_indices->max_requests_param_index < 0) { return mca_param_indices->max_requests_param_index; } - if (coll_tuned_alltoall_max_requests < 0) { + if (ompi_coll_tuned_alltoall_max_reqs < 0) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { - opal_output( 0, "Maximum outstanding requests must be positive number greater than 1. Switching to system level default %d \n", - ompi_coll_tuned_init_max_requests ); + opal_output( 0, "Maximum outstanding requests must be positive number greater than 1. Switching to 0 \n"); } - coll_tuned_alltoall_max_requests = 0; + ompi_coll_tuned_alltoall_max_reqs = 0; } return (MPI_SUCCESS); diff --git a/ompi/mca/coll/tuned/coll_tuned_component.c b/ompi/mca/coll/tuned/coll_tuned_component.c index be0d14a988f..3de5aedfe29 100644 --- a/ompi/mca/coll/tuned/coll_tuned_component.c +++ b/ompi/mca/coll/tuned/coll_tuned_component.c @@ -57,6 +57,13 @@ int ompi_coll_tuned_init_max_requests = 128; int ompi_coll_tuned_alltoall_small_msg = 200; int ompi_coll_tuned_alltoall_intermediate_msg = 3000; +/* Set it to intermediate value by default, so it does not affect default + * algorithm selection. Changing this value will force using linear with sync + * algorithm on certain message sizes. */ +int ompi_coll_tuned_alltoall_large_msg = 3000; +int ompi_coll_tuned_alltoall_min_procs = 0; /* not used by default */ +int ompi_coll_tuned_alltoall_max_reqs = 0; /* no limit for alltoall by default */ + /* forced alogrithm variables */ /* indices for the MCA parameters */ coll_tuned_force_algorithm_mca_param_indices_t ompi_coll_tuned_forced_params[COLLCOUNT] = {{0}}; diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index 0150fcc3b49..2518afee981 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -136,6 +136,12 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, int scount, return ompi_coll_base_alltoall_intra_basic_linear(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module); + } else if ((block_dsize < (size_t) ompi_coll_tuned_alltoall_large_msg) && + (communicator_size <= ompi_coll_tuned_alltoall_min_procs)) { + return ompi_coll_base_alltoall_intra_linear_sync(sbuf, scount, sdtype, + rbuf, rcount, rdtype, + comm, module, + ompi_coll_tuned_alltoall_max_reqs); } return ompi_coll_base_alltoall_intra_pairwise(sbuf, scount, sdtype, From b9998a14dc2a5c87b55405d753a28656c89a9851 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Wed, 24 Jul 2019 10:23:38 +0000 Subject: [PATCH 380/674] COLL/TUNED: Minor var names/comments fixes Signed-off-by: Mikhail Brinskii (cherry picked from commit 65618f8db848613c95cbe112033df94721d326a8) --- ompi/mca/coll/tuned/coll_tuned.h | 2 +- ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c | 10 +++++----- ompi/mca/coll/tuned/coll_tuned_component.c | 10 +++++----- ompi/mca/coll/tuned/coll_tuned_decision_fixed.c | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned.h b/ompi/mca/coll/tuned/coll_tuned.h index 7ae039c9809..d6fc4b89bde 100644 --- a/ompi/mca/coll/tuned/coll_tuned.h +++ b/ompi/mca/coll/tuned/coll_tuned.h @@ -40,7 +40,7 @@ extern int ompi_coll_tuned_alltoall_small_msg; extern int ompi_coll_tuned_alltoall_intermediate_msg; extern int ompi_coll_tuned_alltoall_large_msg; extern int ompi_coll_tuned_alltoall_min_procs; -extern int ompi_coll_tuned_alltoall_max_reqs; +extern int ompi_coll_tuned_alltoall_max_requests; /* forced algorithm choices */ /* this structure is for storing the indexes to the forced algorithm mca params... */ diff --git a/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c b/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c index 86c16be5352..b63037e1237 100644 --- a/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_alltoall_decision.c @@ -116,7 +116,7 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, "alltoall_large_msg", - "threshold (if supported) to decide if large MSGs alltoall algorithm will be used", + "use pairwise exchange algorithm for messages larger than this value", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_6, MCA_BASE_VAR_SCOPE_READONLY, @@ -124,7 +124,7 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, "alltoall_min_procs", - "threshold (if supported) to decide if many processes alltoall algorithm will be used", + "use pairwise exchange algorithm for communicators larger than this value", MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, OPAL_INFO_LVL_6, MCA_BASE_VAR_SCOPE_READONLY, @@ -137,16 +137,16 @@ int ompi_coll_tuned_alltoall_intra_check_forced_init (coll_tuned_force_algorithm MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, - &ompi_coll_tuned_alltoall_max_reqs); + &ompi_coll_tuned_alltoall_max_requests); if (mca_param_indices->max_requests_param_index < 0) { return mca_param_indices->max_requests_param_index; } - if (ompi_coll_tuned_alltoall_max_reqs < 0) { + if (ompi_coll_tuned_alltoall_max_requests < 0) { if( 0 == ompi_comm_rank( MPI_COMM_WORLD ) ) { opal_output( 0, "Maximum outstanding requests must be positive number greater than 1. Switching to 0 \n"); } - ompi_coll_tuned_alltoall_max_reqs = 0; + ompi_coll_tuned_alltoall_max_requests = 0; } return (MPI_SUCCESS); diff --git a/ompi/mca/coll/tuned/coll_tuned_component.c b/ompi/mca/coll/tuned/coll_tuned_component.c index 3de5aedfe29..25e9bc77a0d 100644 --- a/ompi/mca/coll/tuned/coll_tuned_component.c +++ b/ompi/mca/coll/tuned/coll_tuned_component.c @@ -57,12 +57,12 @@ int ompi_coll_tuned_init_max_requests = 128; int ompi_coll_tuned_alltoall_small_msg = 200; int ompi_coll_tuned_alltoall_intermediate_msg = 3000; -/* Set it to intermediate value by default, so it does not affect default - * algorithm selection. Changing this value will force using linear with sync - * algorithm on certain message sizes. */ +/* Set it to the same value as intermediate msg by default, so it does not affect + * default algorithm selection. Changing this value will force using linear with + * sync algorithm on certain message sizes. */ int ompi_coll_tuned_alltoall_large_msg = 3000; -int ompi_coll_tuned_alltoall_min_procs = 0; /* not used by default */ -int ompi_coll_tuned_alltoall_max_reqs = 0; /* no limit for alltoall by default */ +int ompi_coll_tuned_alltoall_min_procs = 0; /* disable by default */ +int ompi_coll_tuned_alltoall_max_requests = 0; /* no limit for alltoall by default */ /* forced alogrithm variables */ /* indices for the MCA parameters */ diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index 2518afee981..97560c5c089 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -141,7 +141,7 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, int scount, return ompi_coll_base_alltoall_intra_linear_sync(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module, - ompi_coll_tuned_alltoall_max_reqs); + ompi_coll_tuned_alltoall_max_requests); } return ompi_coll_base_alltoall_intra_pairwise(sbuf, scount, sdtype, From 359cdf2b539ffd5b2266749c8ddfb56cde3ba9af Mon Sep 17 00:00:00 2001 From: "Nysal Jan K.A" Date: Wed, 24 Jul 2019 13:04:41 +0530 Subject: [PATCH 381/674] osc/ucx: Fix data corruption with non-contiguous accumulates Signed-off-by: Nysal Jan K.A (cherry picked from commit 3529d447020684ab305411caa97423826bb40906) --- ompi/mca/osc/ucx/osc_ucx_comm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index 55af123fbb4..adedae5c3ec 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -566,12 +566,13 @@ int ompi_osc_ucx_accumulate(const void *origin_addr, int origin_count, if ((op != &ompi_mpi_op_maxloc.op && op != &ompi_mpi_op_minloc.op) || ompi_datatype_is_contiguous_memory_layout(temp_dt, temp_count)) { size_t temp_size; + char *curr_temp_addr = (char *)temp_addr; ompi_datatype_type_size(temp_dt, &temp_size); while (origin_ucx_iov_idx < origin_ucx_iov_count) { int curr_count = origin_ucx_iov[origin_ucx_iov_idx].len / temp_size; ompi_op_reduce(op, origin_ucx_iov[origin_ucx_iov_idx].addr, - temp_addr, curr_count, temp_dt); - temp_addr = (void *)((char *)temp_addr + curr_count * temp_size); + curr_temp_addr, curr_count, temp_dt); + curr_temp_addr += curr_count * temp_size; origin_ucx_iov_idx++; } } else { @@ -811,12 +812,13 @@ int ompi_osc_ucx_get_accumulate(const void *origin_addr, int origin_count, if ((op != &ompi_mpi_op_maxloc.op && op != &ompi_mpi_op_minloc.op) || ompi_datatype_is_contiguous_memory_layout(temp_dt, temp_count)) { size_t temp_size; + char *curr_temp_addr = (char *)temp_addr; ompi_datatype_type_size(temp_dt, &temp_size); while (origin_ucx_iov_idx < origin_ucx_iov_count) { int curr_count = origin_ucx_iov[origin_ucx_iov_idx].len / temp_size; ompi_op_reduce(op, origin_ucx_iov[origin_ucx_iov_idx].addr, - temp_addr, curr_count, temp_dt); - temp_addr = (void *)((char *)temp_addr + curr_count * temp_size); + curr_temp_addr, curr_count, temp_dt); + curr_temp_addr += curr_count * temp_size; origin_ucx_iov_idx++; } } else { From f68b06e9ee01d79469d691019e4aca7535ceb4a2 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 9 May 2019 16:27:49 -0400 Subject: [PATCH 382/674] Fix incorrect behavior with length == 0 Fixes #6575. Signed-off-by: George Bosilca --- .../ompi_datatype_create_contiguous.c | 13 ++- ompi/datatype/ompi_datatype_create_darray.c | 4 +- ompi/datatype/ompi_datatype_create_indexed.c | 79 +++++++++---------- ompi/datatype/ompi_datatype_create_struct.c | 38 ++++----- ompi/datatype/ompi_datatype_create_vector.c | 21 ++--- 5 files changed, 68 insertions(+), 87 deletions(-) diff --git a/ompi/datatype/ompi_datatype_create_contiguous.c b/ompi/datatype/ompi_datatype_create_contiguous.c index fb44673ef5c..6a287caa41c 100644 --- a/ompi/datatype/ompi_datatype_create_contiguous.c +++ b/ompi/datatype/ompi_datatype_create_contiguous.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -29,13 +29,12 @@ int32_t ompi_datatype_create_contiguous( int count, const ompi_datatype_t* oldTy { ompi_datatype_t* pdt; - if( 0 == count ) { - pdt = ompi_datatype_create( 0 ); - ompi_datatype_add( pdt, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); - } else { - pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); - opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) ); + if( (0 == count) || (0 == oldType->super.size) ) { + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } + + pdt = ompi_datatype_create( oldType->super.desc.used + 2 ); + opal_datatype_add( &(pdt->super), &(oldType->super), count, 0, (oldType->super.ub - oldType->super.lb) ); *newType = pdt; return OMPI_SUCCESS; } diff --git a/ompi/datatype/ompi_datatype_create_darray.c b/ompi/datatype/ompi_datatype_create_darray.c index a245dcebce4..e0292755c4b 100644 --- a/ompi/datatype/ompi_datatype_create_darray.c +++ b/ompi/datatype/ompi_datatype_create_darray.c @@ -192,9 +192,7 @@ int32_t ompi_datatype_create_darray(int size, if (ndims < 1) { /* Don't just return MPI_DATATYPE_NULL as that can't be MPI_TYPE_FREE()ed, and that seems bad */ - *newtype = ompi_datatype_create(0); - ompi_datatype_add(*newtype, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return MPI_SUCCESS; + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newtype); } rc = ompi_datatype_type_extent(oldtype, &orig_extent); diff --git a/ompi/datatype/ompi_datatype_create_indexed.c b/ompi/datatype/ompi_datatype_create_indexed.c index 457efb1e6ff..e72b41afc7d 100644 --- a/ompi/datatype/ompi_datatype_create_indexed.c +++ b/ompi/datatype/ompi_datatype_create_indexed.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -34,24 +34,28 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { - ompi_datatype_t* pdt; - int i; ptrdiff_t extent, disp, endat; + ompi_datatype_t* pdt; size_t dLength; + int i; - if( 0 == count ) { + /* ignore all cases that lead to an empty type */ + ompi_datatype_type_size(oldType, &dLength); + for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ ); /* find first non zero */ + if( (i == count) || (0 == dLength) ) { return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } - disp = pDisp[0]; - dLength = pBlockLength[0]; + disp = pDisp[i]; + dLength = pBlockLength[i]; endat = disp + dLength; ompi_datatype_type_extent( oldType, &extent ); - pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); - for( i = 1; i < count; i++ ) { - if( endat == pDisp[i] ) { - /* contiguous with the previsious */ + pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) ); + for( i += 1; i < count; i++ ) { + if( 0 == pBlockLength[i] ) /* ignore empty length */ + continue; + if( endat == pDisp[i] ) { /* contiguous with the previsious */ dLength += pBlockLength[i]; endat += pBlockLength[i]; } else { @@ -71,26 +75,28 @@ int32_t ompi_datatype_create_indexed( int count, const int* pBlockLength, const int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { - ompi_datatype_t* pdt; - int i; ptrdiff_t extent, disp, endat; + ompi_datatype_t* pdt; size_t dLength; + int i; - if( 0 == count ) { - *newType = ompi_datatype_create( 0 ); - ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; + /* ignore all cases that lead to an empty type */ + ompi_datatype_type_size(oldType, &dLength); + for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ ); /* find first non zero */ + if( (i == count) || (0 == dLength) ) { + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } - ompi_datatype_type_extent( oldType, &extent ); - pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); - disp = pDisp[0]; - dLength = pBlockLength[0]; + disp = pDisp[i]; + dLength = pBlockLength[i]; endat = disp + dLength * extent; + ompi_datatype_type_extent( oldType, &extent ); - for( i = 1; i < count; i++ ) { - if( endat == pDisp[i] ) { - /* contiguous with the previsious */ + pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) ); + for( i += 1; i < count; i++ ) { + if( 0 == pBlockLength[i] ) /* ignore empty length */ + continue; + if( endat == pDisp[i] ) { /* contiguous with the previsious */ dLength += pBlockLength[i]; endat += pBlockLength[i] * extent; } else { @@ -110,21 +116,15 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { - ompi_datatype_t* pdt; - int i; ptrdiff_t extent, disp, endat; + ompi_datatype_t* pdt; size_t dLength; + int i; - ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { - if( 0 == count ) { - return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType); - } else { - *newType = ompi_datatype_create(1); - ompi_datatype_add( *newType, oldType, 0, pDisp[0] * extent, extent ); - return OMPI_SUCCESS; - } + return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType); } + ompi_datatype_type_extent( oldType, &extent ); pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); disp = pDisp[0]; dLength = bLength; @@ -150,20 +150,15 @@ int32_t ompi_datatype_create_indexed_block( int count, int bLength, const int* p int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdiff_t* pDisp, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { - ompi_datatype_t* pdt; - int i; ptrdiff_t extent, disp, endat; + ompi_datatype_t* pdt; size_t dLength; + int i; - ompi_datatype_type_extent( oldType, &extent ); if( (count == 0) || (bLength == 0) ) { - *newType = ompi_datatype_create(1); - if( 0 == count ) - ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0 ); - else - ompi_datatype_add( *newType, oldType, 0, pDisp[0] * extent, extent ); - return OMPI_SUCCESS; + return ompi_datatype_duplicate(&ompi_mpi_datatype_null.dt, newType); } + ompi_datatype_type_extent( oldType, &extent ); pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); disp = pDisp[0]; dLength = bLength; diff --git a/ompi/datatype/ompi_datatype_create_struct.c b/ompi/datatype/ompi_datatype_create_struct.c index 98daa8bacbb..9c78f53fee3 100644 --- a/ompi/datatype/ompi_datatype_create_struct.c +++ b/ompi/datatype/ompi_datatype_create_struct.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -31,27 +31,27 @@ int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const ptrdiff_t* pDisp, ompi_datatype_t* const * pTypes, ompi_datatype_t** newType ) { - int i; ptrdiff_t disp = 0, endto, lastExtent, lastDisp; - int lastBlock; ompi_datatype_t *pdt, *lastType; + int lastBlock; + int i, start_from; - if( 0 == count ) { - *newType = ompi_datatype_create( 0 ); - ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; + /* Find first non-zero length element */ + for( i = 0; (i < count) && (0 == pBlockLength[i]); i++ ); + if( i == count ) { /* either nothing or nothing relevant */ + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } - - /* if we compute the total number of elements before we can + /* compute the total number of elements before we can * avoid increasing the size of the desc array often. */ - lastType = (ompi_datatype_t*)pTypes[0]; - lastBlock = pBlockLength[0]; + start_from = i; + lastType = (ompi_datatype_t*)pTypes[start_from]; + lastBlock = pBlockLength[start_from]; lastExtent = lastType->super.ub - lastType->super.lb; - lastDisp = pDisp[0]; - endto = pDisp[0] + lastExtent * lastBlock; + lastDisp = pDisp[start_from]; + endto = pDisp[start_from] + lastExtent * lastBlock; - for( i = 1; i < count; i++ ) { + for( i = (start_from + 1); i < count; i++ ) { if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { lastBlock += pBlockLength[i]; endto = lastDisp + lastBlock * lastExtent; @@ -68,16 +68,16 @@ int32_t ompi_datatype_create_struct( int count, const int* pBlockLength, const p disp += lastType->super.desc.used; if( lastBlock != 1 ) disp += 2; - lastType = (ompi_datatype_t*)pTypes[0]; - lastBlock = pBlockLength[0]; + lastType = (ompi_datatype_t*)pTypes[start_from]; + lastBlock = pBlockLength[start_from]; lastExtent = lastType->super.ub - lastType->super.lb; - lastDisp = pDisp[0]; - endto = pDisp[0] + lastExtent * lastBlock; + lastDisp = pDisp[start_from]; + endto = pDisp[start_from] + lastExtent * lastBlock; pdt = ompi_datatype_create( (int32_t)disp ); /* Do again the same loop but now add the elements */ - for( i = 1; i < count; i++ ) { + for( i = (start_from + 1); i < count; i++ ) { if( (pTypes[i] == lastType) && (pDisp[i] == endto) ) { lastBlock += pBlockLength[i]; endto = lastDisp + lastBlock * lastExtent; diff --git a/ompi/datatype/ompi_datatype_create_vector.c b/ompi/datatype/ompi_datatype_create_vector.c index 1de8df4d2d2..c4829a4b54c 100644 --- a/ompi/datatype/ompi_datatype_create_vector.c +++ b/ompi/datatype/ompi_datatype_create_vector.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -28,23 +28,14 @@ #include "ompi/datatype/ompi_datatype.h" -/* Open questions ... - * - how to improuve the handling of these vectors (creating a temporary datatype - * can be ONLY a initial solution. - * - */ - int32_t ompi_datatype_create_vector( int count, int bLength, int stride, const ompi_datatype_t* oldType, ompi_datatype_t** newType ) { ompi_datatype_t *pTempData, *pData; ptrdiff_t extent = oldType->super.ub - oldType->super.lb; - - if( 0 == count ) { - *newType = ompi_datatype_create( 0 ); - ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; + if( (0 == count) || (0 == bLength) ) { + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } pData = ompi_datatype_create( oldType->super.desc.used + 2 ); @@ -72,10 +63,8 @@ int32_t ompi_datatype_create_hvector( int count, int bLength, ptrdiff_t stride, ompi_datatype_t *pTempData, *pData; ptrdiff_t extent = oldType->super.ub - oldType->super.lb; - if( 0 == count ) { - *newType = ompi_datatype_create( 0 ); - ompi_datatype_add( *newType, &ompi_mpi_datatype_null.dt, 0, 0, 0); - return OMPI_SUCCESS; + if( (0 == count) || (0 == bLength) ) { + return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } pTempData = ompi_datatype_create( oldType->super.desc.used + 2 ); From 4f754d01562340f66d4eee40913dca3786a38909 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 15 May 2019 23:41:22 -0400 Subject: [PATCH 383/674] Optimized datatype description. Move toward a base type of vector (count, type, blocklen, extent, disp) with disp and extent applying toward the count repertition and blocklen being a contiguous memory of type type. Implement 2 optimizations on this description used during type_commit: - collapse: successive similar datatype descriptions are collapsed together with an increased count. - fusion: fuse successive datatype descriptions in order to minimize the number of resulting memcpy during pack/unpack. Fixes at the OMPI datatype level including: - Fix the create_hindexed and vector creation. - Fix the handling of [get|set]_elements and _count. - Correctly compute the dispacement for block indexed types. - Support the MPI_LB and MPI_UB deprecation, aka. OMPI_ENABLE_MPI1_COMPAT. Signed-off-by: George Bosilca --- ompi/datatype/ompi_datatype.h | 2 +- ompi/datatype/ompi_datatype_create_indexed.c | 8 +- ompi/datatype/ompi_datatype_external.c | 3 +- opal/datatype/opal_convertor.c | 17 +- opal/datatype/opal_datatype.h | 40 ++- opal/datatype/opal_datatype_add.c | 55 +++- opal/datatype/opal_datatype_copy.h | 63 ++-- opal/datatype/opal_datatype_get_count.c | 10 +- opal/datatype/opal_datatype_internal.h | 26 +- opal/datatype/opal_datatype_module.c | 1 + opal/datatype/opal_datatype_monotonic.c | 31 +- opal/datatype/opal_datatype_optimize.c | 287 +++++++++---------- opal/datatype/opal_datatype_pack.h | 144 ++++++---- opal/datatype/opal_datatype_position.c | 85 +++++- opal/datatype/opal_datatype_unpack.h | 145 ++++++---- 15 files changed, 548 insertions(+), 369 deletions(-) diff --git a/ompi/datatype/ompi_datatype.h b/ompi/datatype/ompi_datatype.h index 8b48bc30973..f589c874b64 100644 --- a/ompi/datatype/ompi_datatype.h +++ b/ompi/datatype/ompi_datatype.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2009-2013 The University of Tennessee and The University + * Copyright (c) 2009-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. diff --git a/ompi/datatype/ompi_datatype_create_indexed.c b/ompi/datatype/ompi_datatype_create_indexed.c index e72b41afc7d..2684d9d7df0 100644 --- a/ompi/datatype/ompi_datatype_create_indexed.c +++ b/ompi/datatype/ompi_datatype_create_indexed.c @@ -87,10 +87,10 @@ int32_t ompi_datatype_create_hindexed( int count, const int* pBlockLength, const return ompi_datatype_duplicate( &ompi_mpi_datatype_null.dt, newType); } + ompi_datatype_type_extent( oldType, &extent ); disp = pDisp[i]; dLength = pBlockLength[i]; endat = disp + dLength * extent; - ompi_datatype_type_extent( oldType, &extent ); pdt = ompi_datatype_create( (count - i) * (2 + oldType->super.desc.used) ); for( i += 1; i < count; i++ ) { @@ -162,17 +162,17 @@ int32_t ompi_datatype_create_hindexed_block( int count, int bLength, const ptrdi pdt = ompi_datatype_create( count * (2 + oldType->super.desc.used) ); disp = pDisp[0]; dLength = bLength; - endat = disp + dLength; + endat = disp + dLength * extent; for( i = 1; i < count; i++ ) { if( endat == pDisp[i] ) { /* contiguous with the previsious */ dLength += bLength; - endat += bLength; + endat += bLength * extent; } else { ompi_datatype_add( pdt, oldType, dLength, disp, extent ); disp = pDisp[i]; dLength = bLength; - endat = disp + bLength; + endat = disp + bLength * extent; } } ompi_datatype_add( pdt, oldType, dLength, disp, extent ); diff --git a/ompi/datatype/ompi_datatype_external.c b/ompi/datatype/ompi_datatype_external.c index d47531ef29e..53b907218cf 100644 --- a/ompi/datatype/ompi_datatype_external.c +++ b/ompi/datatype/ompi_datatype_external.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2007 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, @@ -26,7 +26,6 @@ #include #include "ompi/runtime/params.h" -#include "ompi/communicator/communicator.h" #include "ompi/datatype/ompi_datatype.h" #include "opal/datatype/opal_convertor.h" diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index ce889f7e959..631d3adab43 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -324,8 +324,9 @@ int32_t opal_convertor_unpack( opal_convertor_t* pConv, return pConv->fAdvance( pConv, iov, out_size, max_data ); } -static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor, - size_t starting_point, const size_t* sizes ) +static inline int +opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor, + size_t starting_point, const size_t* sizes ) { dt_stack_t* pStack; /* pointer to the position on the stack */ const opal_datatype_t* pData = pConvertor->pDesc; @@ -349,7 +350,7 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pStack[0].disp = count * extent; /* now compute the number of pending bytes */ - count = starting_point - count * pData->size; + count = starting_point % pData->size; /** * We save the current displacement starting from the begining * of this data. @@ -370,9 +371,9 @@ static inline int opal_convertor_create_stack_with_pos_contig( opal_convertor_t* return OPAL_SUCCESS; } -static inline -int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, - const size_t* sizes ) +static inline int +opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, + const size_t* sizes ) { dt_stack_t* pStack = convertor->pStack; dt_elem_desc_t* pElems; @@ -402,7 +403,7 @@ int opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, pStack[1].count = pElems[0].loop.loops; pStack[1].type = OPAL_DATATYPE_LOOP; } else { - pStack[1].count = pElems[0].elem.count; + pStack[1].count = pElems[0].elem.count * pElems[0].elem.blocklen; pStack[1].type = pElems[0].elem.common.type; } return OPAL_SUCCESS; diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h index a836a5aae03..e1bc18c67f9 100644 --- a/opal/datatype/opal_datatype.h +++ b/opal/datatype/opal_datatype.h @@ -224,13 +224,41 @@ opal_datatype_is_contiguous_memory_layout( const opal_datatype_t* datatype, int3 } -OPAL_DECLSPEC void opal_datatype_dump( const opal_datatype_t* pData ); +OPAL_DECLSPEC void +opal_datatype_dump( const opal_datatype_t* pData ); + /* data creation functions */ -OPAL_DECLSPEC int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t * dest_type ); -OPAL_DECLSPEC int32_t opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType, opal_datatype_t** newType ); -OPAL_DECLSPEC int32_t opal_datatype_resize( opal_datatype_t* type, ptrdiff_t lb, ptrdiff_t extent ); -OPAL_DECLSPEC int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtAdd, size_t count, - ptrdiff_t disp, ptrdiff_t extent ); + +/** + * Create a duplicate of the source datatype. + */ +OPAL_DECLSPEC int32_t +opal_datatype_clone( const opal_datatype_t* src_type, + opal_datatype_t* dest_type ); +/** + * A contiguous array of identical datatypes. + */ +OPAL_DECLSPEC int32_t +opal_datatype_create_contiguous( int count, const opal_datatype_t* oldType, + opal_datatype_t** newType ); +/** + * Add a new datatype to the base type description. The count is the number + * repetitions of the same element to be added, and the extent is the extent + * of each element. The displacement is the initial displacement of the + * first element. + */ +OPAL_DECLSPEC int32_t +opal_datatype_add( opal_datatype_t* pdtBase, + const opal_datatype_t* pdtAdd, size_t count, + ptrdiff_t disp, ptrdiff_t extent ); + +/** + * Alter the lb and extent of an existing datatype in place. + */ +OPAL_DECLSPEC int32_t +opal_datatype_resize( opal_datatype_t* type, + ptrdiff_t lb, + ptrdiff_t extent ); static inline int32_t opal_datatype_type_lb( const opal_datatype_t* pData, ptrdiff_t* disp ) diff --git a/opal/datatype/opal_datatype_add.c b/opal/datatype/opal_datatype_add.c index 146ce12afe2..108b4e3d1be 100644 --- a/opal/datatype/opal_datatype_add.c +++ b/opal/datatype/opal_datatype_add.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -281,15 +281,23 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA if( (pdtAdd->flags & (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA)) == (OPAL_DATATYPE_FLAG_PREDEFINED | OPAL_DATATYPE_FLAG_DATA) ) { if( NULL != pdtBase->ptypes ) pdtBase->ptypes[pdtAdd->id] += count; + + pLast->elem.common.flags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITTED); pLast->elem.common.type = pdtAdd->id; - pLast->elem.count = count; pLast->elem.disp = disp; - pLast->elem.extent = extent; - pdtBase->desc.used++; - pLast->elem.common.flags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITTED); - if( (extent != (ptrdiff_t)pdtAdd->size) && (count > 1) ) { /* gaps around the datatype */ - pLast->elem.common.flags &= ~(OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS); + pLast->elem.extent = count * extent; + /* assume predefined datatypes without extent, aka. contiguous */ + pLast->elem.count = 1; + pLast->elem.blocklen = count; + if( extent != (ptrdiff_t)pdtAdd->size ) { /* not contiguous: let's fix */ + pLast->elem.count = count; + pLast->elem.blocklen = 1; + pLast->elem.extent = extent; + if( count > 1 ) { /* gaps around the predefined datatype */ + pLast->elem.common.flags &= ~(OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS); + } } + pdtBase->desc.used++; } else { /* keep trace of the total number of basic datatypes in the datatype definition */ pdtBase->loops += pdtAdd->loops; @@ -299,13 +307,40 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA for( i = OPAL_DATATYPE_FIRST_TYPE; i < OPAL_DATATYPE_MAX_PREDEFINED; i++ ) if( pdtAdd->ptypes[i] != 0 ) pdtBase->ptypes[i] += (count * pdtAdd->ptypes[i]); } - if( (1 == pdtAdd->desc.used) && (extent == (pdtAdd->ub - pdtAdd->lb)) && - (extent == pdtAdd->desc.desc[0].elem.extent) ){ + if( 1 == pdtAdd->desc.used ) { pLast->elem = pdtAdd->desc.desc[0].elem; - pLast->elem.count *= count; pLast->elem.disp += disp; + if( 1 == count ) { + /* Extent only has a meaning when there are multiple elements. Bail out */ + } else if( 1 == pLast->elem.count ) { + /* The size and true_extent of the added datatype are identical, signaling a datatype + * that is mostly contiguous with the exception of the initial and final gaps. These + * gaps do not matter here as they will amended (the initial gaps being shifted by the + * new displacement and the final gap being replaced with the new gap + */ + if( pdtAdd->desc.desc[0].elem.extent == extent ) { + /* pure bliss everything is fully contiguous and we can collapse + * everything by updating the blocklen and extent + */ + pLast->elem.blocklen *= count; + pLast->elem.extent *= count; + } else { + pLast->elem.count = count; + pLast->elem.extent = extent; + } + } else if( extent == (ptrdiff_t)(pLast->elem.count * pLast->elem.extent) ) { + /* It's just a repetition of the same element, increase the count */ + pLast->elem.count *= count; + } else { + /* No luck here, no optimization can be applied. Fall back to the + * normal case where we add a loop around the datatype. + */ + goto build_loop; + } pdtBase->desc.used++; } else { + +build_loop: /* if the extent of the datatype is the same as the extent of the loop * description of the datatype then we simply have to update the main loop. */ diff --git a/opal/datatype/opal_datatype_copy.h b/opal/datatype/opal_datatype_copy.h index 7aeac8e63ec..40f119a684d 100644 --- a/opal/datatype/opal_datatype_copy.h +++ b/opal/datatype/opal_datatype_copy.h @@ -48,37 +48,37 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM, unsigned char* DESTINATION, size_t* SPACE ) { - size_t _copy_count = (COUNT); - size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (SOURCE) + _elem->disp; unsigned char* _destination = (DESTINATION) + _elem->disp; + size_t total_count = _elem->count * _elem->blocklen; + size_t do_now, do_now_bytes; - _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; + assert( (COUNT) == total_count); + assert( total_count <= ((*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size) ); - if( _copy_blength == (size_t)_elem->extent ) { - _copy_blength *= _copy_count; - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), - (DATATYPE), (TOTAL_COUNT) ); - /* the extent and the size of the basic datatype are equals */ - DO_DEBUG( opal_output( 0, "copy 1. %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", - STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, _copy_blength, *(SPACE) ); ); - MEM_OP( _destination, _source, _copy_blength ); - _source += _copy_blength; - _destination += _copy_blength; - } else { - for(size_t _i = 0; _i < _copy_count; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (SOURCE_BASE), - (DATATYPE), (TOTAL_COUNT) ); - DO_DEBUG( opal_output( 0, "copy 2. %s( %p, %p, %lu ) => space %lu\n", - STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); - MEM_OP( _destination, _source, _copy_blength ); - _source += _elem->extent; + /* We don't a prologue and epilogue here as we are __always__ working + * with full copies of the data description. + */ + + /** + * Compute how many full blocklen we need to do and do them. + */ + do_now = _elem->count; + if( 0 != do_now ) { + do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, do_now_bytes, (SOURCE_BASE), + (DATATYPE), (TOTAL_COUNT) ); + DO_DEBUG( opal_output( 0, "copy %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", + STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, do_now_bytes, *(SPACE) ); ); + MEM_OP( _destination, _source, do_now_bytes ); _destination += _elem->extent; + _source += _elem->extent; + *(SPACE) -= do_now_bytes; } - _copy_blength *= _copy_count; + (COUNT) -= total_count; } - *(SPACE) -= _copy_blength; } static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, @@ -147,12 +147,10 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i if( (ptrdiff_t)datatype->size == extent ) { /* all contiguous == no gaps around */ size_t total_length = iov_len_local; size_t memop_chunk = opal_datatype_memop_block_size; + OPAL_DATATYPE_SAFEGUARD_POINTER( source, iov_len_local, + (unsigned char*)source_base, datatype, count ); while( total_length > 0 ) { if( memop_chunk > total_length ) memop_chunk = total_length; - OPAL_DATATYPE_SAFEGUARD_POINTER( destination, memop_chunk, - (unsigned char*)destination_base, datatype, count ); - OPAL_DATATYPE_SAFEGUARD_POINTER( source, memop_chunk, - (unsigned char*)source_base, datatype, count ); DO_DEBUG( opal_output( 0, "copy c1. %s( %p, %p, %lu ) => space %lu\n", STRINGIFY(MEM_OP_NAME), (void*)destination, (void*)source, (unsigned long)memop_chunk, (unsigned long)total_length ); ); MEM_OP( destination, source, memop_chunk ); @@ -184,17 +182,12 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i pos_desc = 0; stack_pos = 0; - if( datatype->opt_desc.desc != NULL ) { - description = datatype->opt_desc.desc; - } else { + description = datatype->opt_desc.desc; + if( NULL == description ) { description = datatype->desc.desc; } - if( description[0].elem.common.type == OPAL_DATATYPE_LOOP ) - count_desc = description[0].loop.loops; - else - count_desc = description[0].elem.count; - pElem = &(description[pos_desc]); + UPDATE_INTERNAL_COUNTERS( description, 0, pElem, count_desc ); while( 1 ) { while( OPAL_LIKELY(pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA) ) { diff --git a/opal/datatype/opal_datatype_get_count.c b/opal/datatype/opal_datatype_get_count.c index ae085c42704..f75b86d0e2d 100644 --- a/opal/datatype/opal_datatype_get_count.c +++ b/opal/datatype/opal_datatype_get_count.c @@ -69,14 +69,14 @@ ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); - local_size = pElems[pos_desc].elem.count * basic_type->size; + local_size = (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen) * basic_type->size; if( local_size >= iSize ) { local_size = iSize / basic_type->size; nbElems += (int32_t)local_size; iSize -= local_size * basic_type->size; return (iSize == 0 ? nbElems : -1); } - nbElems += pElems[pos_desc].elem.count; + nbElems += (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); iSize -= local_size; pos_desc++; /* advance to the next data */ } @@ -131,7 +131,7 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); - local_length = pElems[pos_desc].elem.count; + local_length = (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); if( local_length >= count ) { *length += count * basic_type->size; return 0; @@ -188,8 +188,8 @@ int opal_datatype_compute_ptypes( opal_datatype_t* datatype ) } while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - datatype->ptypes[pElems[pos_desc].elem.common.type] += pElems[pos_desc].elem.count; - nbElems += pElems[pos_desc].elem.count; + datatype->ptypes[pElems[pos_desc].elem.common.type] += pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; + nbElems += pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; DUMP( " compute_ptypes-add: type %d count %"PRIsize_t" (total type %"PRIsize_t" total %lld)\n", pElems[pos_desc].elem.common.type, datatype->ptypes[pElems[pos_desc].elem.common.type], diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index bc3f8aa7cab..2b2ddc0961e 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2018 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -220,14 +220,14 @@ union dt_elem_desc { * elem.blocklen to create it. If the number is prime then create a second * element to account for the difference. */ -#define CREATE_ELEM( _place, _type, _flags, _count, _disp, _extent ) \ +#define CREATE_ELEM(_place, _type, _flags, _blocklen, _count, _disp, _extent) \ do { \ (_place)->elem.common.flags = (_flags) | OPAL_DATATYPE_FLAG_DATA; \ (_place)->elem.common.type = (_type); \ - (_place)->elem.disp = (_disp); \ - (_place)->elem.extent = (_extent); \ + (_place)->elem.blocklen = (_blocklen); \ (_place)->elem.count = (_count); \ - (_place)->elem.blocklen = 1; \ + (_place)->elem.extent = (_extent); \ + (_place)->elem.disp = (_disp); \ } while(0) /* * This array holds the descriptions desc.desc[2] of the predefined basic datatypes. @@ -480,22 +480,22 @@ static inline int GET_FIRST_NON_LOOP( const union dt_elem_desc* _pElem ) } #define UPDATE_INTERNAL_COUNTERS( DESCRIPTION, POSITION, ELEMENT, COUNTER ) \ - do { \ - (ELEMENT) = &((DESCRIPTION)[(POSITION)]); \ - if( OPAL_DATATYPE_LOOP == (ELEMENT)->elem.common.type ) \ - (COUNTER) = (ELEMENT)->loop.loops; \ - else \ - (COUNTER) = (ELEMENT)->elem.count; \ + do { \ + (ELEMENT) = &((DESCRIPTION)[(POSITION)]); \ + if( OPAL_DATATYPE_LOOP == (ELEMENT)->elem.common.type ) \ + (COUNTER) = (ELEMENT)->loop.loops; \ + else \ + (COUNTER) = (ELEMENT)->elem.count * (ELEMENT)->elem.blocklen; \ } while (0) OPAL_DECLSPEC int opal_datatype_contain_basic_datatypes( const struct opal_datatype_t* pData, char* ptr, size_t length ); OPAL_DECLSPEC int opal_datatype_dump_data_flags( unsigned short usflags, char* ptr, size_t length ); OPAL_DECLSPEC int opal_datatype_dump_data_desc( union dt_elem_desc* pDesc, int nbElems, char* ptr, size_t length ); -#if OPAL_ENABLE_DEBUG extern bool opal_position_debug; extern bool opal_copy_debug; -#endif /* OPAL_ENABLE_DEBUG */ +extern bool opal_unpack_debug; +extern bool opal_pack_debug; END_C_DECLS #endif /* OPAL_DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_datatype_module.c b/opal/datatype/opal_datatype_module.c index 2d8dedc94e7..7976392b63e 100644 --- a/opal/datatype/opal_datatype_module.c +++ b/opal/datatype/opal_datatype_module.c @@ -226,6 +226,7 @@ int32_t opal_datatype_init( void ) datatype->desc.desc[0].elem.common.type = i; /* datatype->desc.desc[0].elem.blocklen XXX not set at the moment, it will be needed later */ datatype->desc.desc[0].elem.count = 1; + datatype->desc.desc[0].elem.blocklen = 1; datatype->desc.desc[0].elem.disp = 0; datatype->desc.desc[0].elem.extent = datatype->size; diff --git a/opal/datatype/opal_datatype_monotonic.c b/opal/datatype/opal_datatype_monotonic.c index b467d95ecbe..247fd66142d 100644 --- a/opal/datatype/opal_datatype_monotonic.c +++ b/opal/datatype/opal_datatype_monotonic.c @@ -2,6 +2,9 @@ /* * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2018-2019 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -18,35 +21,43 @@ #include "opal/datatype/opal_datatype_internal.h" #include "opal/datatype/opal_convertor.h" +#define OPAL_DATATYPE_MAX_MONOTONIC_IOVEC 32 + +/** + * Check if the datatype describes a memory layout where the pointers to + * the contiguous pieces are always advancing in the same direction, i.e. + * there is no potential for overlap. + */ int32_t opal_datatype_is_monotonic(opal_datatype_t* type ) { + struct iovec iov[OPAL_DATATYPE_MAX_MONOTONIC_IOVEC]; + ptrdiff_t upper_limit = (ptrdiff_t)type->true_lb; /* as conversion base will be NULL the first address is true_lb */ + size_t max_data = 0x7FFFFFFF; opal_convertor_t *pConv; + bool monotonic = true; uint32_t iov_count; - struct iovec iov[5]; - size_t max_data = 0; - long prev = -1; int rc; - bool monotonic = true; pConv = opal_convertor_create( opal_local_arch, 0 ); if (OPAL_UNLIKELY(NULL == pConv)) { - return 0; + return -1; } rc = opal_convertor_prepare_for_send( pConv, type, 1, NULL ); if( OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { OBJ_RELEASE(pConv); - return 0; + return -1; } do { - iov_count = 5; + iov_count = OPAL_DATATYPE_MAX_MONOTONIC_IOVEC; rc = opal_convertor_raw( pConv, iov, &iov_count, &max_data); - for (uint32_t i=0; icommon.flags = OPAL_DATATYPE_FLAG_BASIC; \ - _elem->common.type = OPAL_DATATYPE_LOOP; \ - _elem->count = 0; \ - _elem->disp = 0; \ - _elem->extent = 0; \ - } while (0) - static int32_t opal_datatype_optimize_short( opal_datatype_t* pData, size_t count, dt_type_desc_t* pTypeDesc ) { dt_elem_desc_t* pElemDesc; - ddt_elem_desc_t opt_elem; - dt_stack_t* pOrigStack; - dt_stack_t* pStack; /* pointer to the position on the stack */ - int32_t pos_desc = 0; /* actual position in the description of the derived datatype */ - int32_t stack_pos = 0, last_type = OPAL_DATATYPE_UINT1; - int32_t type = OPAL_DATATYPE_LOOP, nbElems = 0, continuity; - ptrdiff_t total_disp = 0, last_extent = 1, last_disp = 0; - uint16_t last_flags = 0xFFFF; /* keep all for the first datatype */ - uint32_t i; - size_t last_length = 0; + dt_stack_t *pOrigStack, *pStack; /* pointer to the position on the stack */ + int32_t pos_desc = 0; /* actual position in the description of the derived datatype */ + int32_t stack_pos = 0; + int32_t nbElems = 0; + ptrdiff_t total_disp = 0; + ddt_elem_desc_t last = {.common.flags = 0xFFFF /* all on */, .count = 0, .disp = 0}, compress; + ddt_elem_desc_t* current; pOrigStack = pStack = (dt_stack_t*)malloc( sizeof(dt_stack_t) * (pData->loops+2) ); SAVE_STACK( pStack, -1, 0, count, 0 ); @@ -64,22 +51,17 @@ opal_datatype_optimize_short( opal_datatype_t* pData, pTypeDesc->desc = pElemDesc = (dt_elem_desc_t*)malloc( sizeof(dt_elem_desc_t) * pTypeDesc->length ); pTypeDesc->used = 0; - SET_EMPTY_ELEMENT( &opt_elem ); assert( OPAL_DATATYPE_END_LOOP == pData->desc.desc[pData->desc.used].elem.common.type ); - opt_elem.common.type = OPAL_DATATYPE_LOOP; - opt_elem.common.flags = 0xFFFF; /* keep all for the first datatype */ - opt_elem.count = 0; - opt_elem.disp = pData->desc.desc[pData->desc.used].end_loop.first_elem_disp; - opt_elem.extent = 0; while( stack_pos >= 0 ) { if( OPAL_DATATYPE_END_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { /* end of the current loop */ ddt_endloop_desc_t* end_loop = &(pData->desc.desc[pos_desc].end_loop); - if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); + if( 0 != last.count ) { + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count, last.disp, last.extent ); pElemDesc++; nbElems++; - last_disp += last_length; - last_length = 0; + last.disp += last.count; + last.count= 0; } CREATE_LOOP_END( pElemDesc, nbElems - pStack->index + 1, /* # of elems in this loop */ end_loop->first_elem_disp, end_loop->size, end_loop->common.flags ); @@ -97,153 +79,146 @@ opal_datatype_optimize_short( opal_datatype_t* pData, ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]); ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]); int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) ); - ptrdiff_t loop_disp = pData->desc.desc[pos_desc + index].elem.disp; - continuity = ((last_disp + (ptrdiff_t)last_length * (ptrdiff_t)opal_datatype_basicDatatypes[last_type]->size) - == (total_disp + loop_disp)); if( loop->common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - /* the loop is contiguous or composed by contiguous elements with a gap */ - if( loop->extent == (ptrdiff_t)end_loop->size ) { - /* the whole loop is contiguous */ - if( !continuity ) { - if( 0 != last_length ) { - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, - last_length, last_disp, last_extent ); - pElemDesc++; nbElems++; - last_length = 0; - } - last_disp = total_disp + loop_disp; - } - last_length = (last_length * opal_datatype_basicDatatypes[last_type]->size - + loop->loops * end_loop->size); - last_type = OPAL_DATATYPE_UINT1; - last_extent = 1; - } else { - int counter = loop->loops; - ptrdiff_t merged_disp = 0; - /* if the previous data is contiguous with this piece and it has a length not ZERO */ - if( last_length != 0 ) { - if( continuity ) { - last_length *= opal_datatype_basicDatatypes[last_type]->size; - last_length += end_loop->size; - last_type = OPAL_DATATYPE_UINT1; - last_extent = 1; - counter--; - merged_disp = loop->extent; /* merged loop, update the disp of the remaining elems */ - } - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, - last_length, last_disp, last_extent ); - pElemDesc++; nbElems++; - last_disp += last_length; - last_length = 0; - last_type = OPAL_DATATYPE_LOOP; - } - /** - * The content of the loop is contiguous (maybe with a gap before or after). - * - * If any of the loops have been merged with the previous element, then the - * displacement of the first element (or the displacement of all elements if the - * loop will be removed) must be updated accordingly. - */ - if( counter <= 2 ) { - merged_disp += end_loop->first_elem_disp; - while( counter > 0 ) { - CREATE_ELEM( pElemDesc, OPAL_DATATYPE_UINT1, OPAL_DATATYPE_FLAG_BASIC, - end_loop->size, merged_disp, 1); - pElemDesc++; nbElems++; counter--; - merged_disp += loop->extent; - } - } else { - CREATE_LOOP_START( pElemDesc, counter, 2, loop->extent, loop->common.flags ); - pElemDesc++; nbElems++; - CREATE_ELEM( pElemDesc, OPAL_DATATYPE_UINT1, OPAL_DATATYPE_FLAG_BASIC, - end_loop->size, loop_disp, 1); - pElemDesc++; nbElems++; - CREATE_LOOP_END( pElemDesc, 2, end_loop->first_elem_disp + merged_disp, - end_loop->size, end_loop->common.flags ); - pElemDesc++; nbElems++; + assert(pData->desc.desc[pos_desc + index].elem.disp == end_loop->first_elem_disp); + compress.common.flags = loop->common.flags; + compress.common.type = pData->desc.desc[pos_desc + index].elem.common.type; + compress.blocklen = pData->desc.desc[pos_desc + index].elem.blocklen; + for( uint32_t i = index+1; i < loop->items; i++ ) { + current = &pData->desc.desc[pos_desc + i].elem; + assert(1 == current->count); + if( (current->common.type == OPAL_DATATYPE_LOOP) || + compress.common.type != current->common.type ) { + compress.common.type = OPAL_DATATYPE_UINT1; + compress.blocklen = end_loop->size; + break; } + compress.blocklen += current->blocklen; } + compress.count = loop->loops; + compress.extent = loop->extent; + compress.disp = end_loop->first_elem_disp; + + /** + * The current loop has been compressed and can now be treated as if it + * was a data element. We can now look if it can be fused with last, + * as done in the fusion of 2 elements below. Let's use the same code. + */ pos_desc += loop->items + 1; - } else { - ddt_elem_desc_t* elem = (ddt_elem_desc_t*)&(pData->desc.desc[pos_desc+1]); - if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); - pElemDesc++; nbElems++; - last_disp += last_length; - last_length = 0; - last_type = OPAL_DATATYPE_LOOP; - } - if( 2 == loop->items ) { /* small loop */ - if( (1 == elem->count) - && (elem->extent == (ptrdiff_t)opal_datatype_basicDatatypes[elem->common.type]->size) ) { - CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags & ~OPAL_DATATYPE_FLAG_CONTIGUOUS, - loop->loops, elem->disp, loop->extent ); + current = &compress; + goto fuse_loops; + } + + /** + * If the content of the loop is not contiguous there is little we can do + * that would not incur significant optimization cost and still be beneficial + * in reducing the number of memcpy during pack/unpack. + */ + + if( 0 != last.count ) { /* Generate the pending element */ + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count, last.disp, last.extent ); + pElemDesc++; nbElems++; + last.count = 0; + last.common.type = OPAL_DATATYPE_LOOP; + } + + /* Can we unroll the loop? */ + if( (loop->items <= 3) && (loop->loops <= 2) ) { + ptrdiff_t elem_displ = 0; + for( uint32_t i = 0; i < loop->loops; i++ ) { + for( uint32_t j = 0; j < (loop->items - 1); j++ ) { + current = &pData->desc.desc[pos_desc + index + j].elem; + CREATE_ELEM( pElemDesc, current->common.type, current->common.flags, + current->blocklen, current->count, current->disp + elem_displ, current->extent ); pElemDesc++; nbElems++; - pos_desc += loop->items + 1; - goto complete_loop; - } else if( loop->loops < 3 ) { - ptrdiff_t elem_displ = elem->disp; - for( i = 0; i < loop->loops; i++ ) { - CREATE_ELEM( pElemDesc, elem->common.type, elem->common.flags, - elem->count, elem_displ, elem->extent ); - elem_displ += loop->extent; - pElemDesc++; nbElems++; - } - pos_desc += loop->items + 1; - goto complete_loop; } + elem_displ += loop->extent; } - CREATE_LOOP_START( pElemDesc, loop->loops, loop->items, loop->extent, loop->common.flags ); - pElemDesc++; nbElems++; - PUSH_STACK( pStack, stack_pos, nbElems, OPAL_DATATYPE_LOOP, loop->loops, total_disp ); - pos_desc++; - DDT_DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" ); + pos_desc += loop->items + 1; + goto complete_loop; } + + CREATE_LOOP_START( pElemDesc, loop->loops, loop->items, loop->extent, loop->common.flags ); + pElemDesc++; nbElems++; + PUSH_STACK( pStack, stack_pos, nbElems, OPAL_DATATYPE_LOOP, loop->loops, total_disp ); + pos_desc++; + DDT_DUMP_STACK( pStack, stack_pos, pData->desc.desc, "advance loops" ); + complete_loop: total_disp = pStack->disp; /* update the displacement */ continue; } - while( pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* keep doing it until we reach a non datatype element */ - /* now here we have a basic datatype */ - type = pData->desc.desc[pos_desc].elem.common.type; - continuity = ((last_disp + (ptrdiff_t)last_length * (ptrdiff_t)opal_datatype_basicDatatypes[last_type]->size) - == (total_disp + pData->desc.desc[pos_desc].elem.disp)); + while( pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* go over all basic datatype elements */ + current = &pData->desc.desc[pos_desc].elem; + pos_desc++; /* point to the next element as current points to the current one */ - if( (pData->desc.desc[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && continuity && - (pData->desc.desc[pos_desc].elem.extent == (int32_t)opal_datatype_basicDatatypes[type]->size) ) { - if( type == last_type ) { - last_length += pData->desc.desc[pos_desc].elem.count; - last_extent = pData->desc.desc[pos_desc].elem.extent; + fuse_loops: + if( 0 == last.count ) { /* first data of the datatype */ + last = *current; + continue; /* next data */ + } + + /* are the two elements compatible: aka they have very similar values and they + * can be merged together by increasing the count. This optimizes the memory + * required for storing the datatype description. + */ + if( ((last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) == + (current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size)) && + (current->disp == (last.disp + (ptrdiff_t)last.count * last.extent)) && + ((last.count == 1) || (current->count == 1) || (last.extent == current->extent)) ) { + last.count += current->count; + if( last.count == 1 ) { + last.extent = current->extent; + } /* otherwise keep the last.extent */ + /* find the lowest common denomitaor type */ + if( last.common.type != current->common.type ) { + last.common.type = OPAL_DATATYPE_UINT1; + last.blocklen *= opal_datatype_basicDatatypes[last.common.type]->size; + } + continue; /* next data */ + } + /* are the elements fusionable such that we can fusion the last blocklen of one with the first + * blocklen of the other. + */ + if( (ptrdiff_t)(last.disp + (last.count - 1) * last.extent + last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) == + current->disp ) { + if( last.count != 1 ) { + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count - 1, last.disp, last.extent ); + pElemDesc++; nbElems++; + last.disp += (last.count - 1) * last.extent; + last.count = 1; + } + if( last.common.type == current->common.type ) { + last.blocklen += current->blocklen; } else { - if( last_length == 0 ) { - last_type = type; - last_length = pData->desc.desc[pos_desc].elem.count; - last_extent = pData->desc.desc[pos_desc].elem.extent; - } else { - last_length = last_length * opal_datatype_basicDatatypes[last_type]->size + - pData->desc.desc[pos_desc].elem.count * opal_datatype_basicDatatypes[type]->size; - last_type = OPAL_DATATYPE_UINT1; - last_extent = 1; - } + last.blocklen = ((last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) + + (current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size)); + last.common.type = OPAL_DATATYPE_UINT1; } - last_flags &= pData->desc.desc[pos_desc].elem.common.flags; - } else { - if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); + last.extent += current->extent; + if( current->count != 1 ) { + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count, last.disp, last.extent ); pElemDesc++; nbElems++; + last = *current; + last.count -= 1; + last.disp += last.extent; } - last_disp = total_disp + pData->desc.desc[pos_desc].elem.disp; - last_length = pData->desc.desc[pos_desc].elem.count; - last_extent = pData->desc.desc[pos_desc].elem.extent; - last_type = type; + continue; } - pos_desc++; /* advance to the next data */ + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count, last.disp, last.extent ); + pElemDesc++; nbElems++; + last = *current; } } - if( last_length != 0 ) { - CREATE_ELEM( pElemDesc, last_type, OPAL_DATATYPE_FLAG_BASIC, last_length, last_disp, last_extent ); + if( 0 != last.count ) { + CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, + last.blocklen, last.count, last.disp, last.extent ); pElemDesc++; nbElems++; } /* cleanup the stack */ diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index f952cabc3c0..66259f8b66b 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. @@ -19,8 +19,6 @@ #include "opal_config.h" -#include - #if !defined(CHECKSUM) && OPAL_CUDA_SUPPORT /* Make use of existing macro to do CUDA style memcpy */ #undef MEMCPY_CSUM @@ -28,75 +26,117 @@ CONVERTOR->cbmemcpy( (DST), (SRC), (BLENGTH), (CONVERTOR) ) #endif -static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, - const dt_elem_desc_t* ELEM, - size_t* COUNT, - unsigned char** SOURCE, - unsigned char** DESTINATION, - size_t* SPACE ) +static inline void +pack_predefined_data( opal_convertor_t* CONVERTOR, + const dt_elem_desc_t* ELEM, + size_t* COUNT, + unsigned char** memory, + unsigned char** packed, + size_t* SPACE ) { - size_t _copy_count = *(COUNT); - size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); - unsigned char* _source = (*SOURCE) + _elem->disp; + size_t total_count = _elem->count * _elem->blocklen; + size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t do_now, do_now_bytes; + unsigned char* _memory = (*memory) + _elem->disp; + + assert( *(COUNT) <= _elem->count * _elem->blocklen); + + if( cando_count > *(COUNT) ) + cando_count = *(COUNT); + + /** + * First check if we already did something on this element ? + */ + do_now = (total_count - *(COUNT)); /* done elements */ + if( 0 != do_now ) { + do_now = do_now % _elem->blocklen; /* partial blocklen? */ + + if( 0 != do_now ) { + size_t left_in_block = _elem->blocklen - do_now; /* left in the current blocklen */ + do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; - if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = (*(SPACE) / _copy_blength); - if( 0 == _copy_count ) return; /* nothing to do */ + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", + (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); + _memory = (*memory) + _elem->disp + (ptrdiff_t)do_now_bytes; + /* compensate if we just completed a blocklen */ + if( do_now == left_in_block ) + _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); + *(packed) += do_now_bytes; + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; + cando_count -= do_now; + } } - if( (ptrdiff_t)_copy_blength == _elem->extent ) { - _copy_blength *= _copy_count; - /* the extent and the size of the basic datatype are equal */ - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)*(DESTINATION), (void*)_source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( *(DESTINATION), _source, _copy_blength, (CONVERTOR) ); - _source += _copy_blength; - *(DESTINATION) += _copy_blength; - } else { - for(size_t _i = 0; _i < _copy_count; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _copy_blength, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); + /** + * Compute how many full blocklen we need to do and do them. + */ + do_now = cando_count / _elem->blocklen; + if( 0 != do_now ) { + do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)*(DESTINATION), (void*)_source, (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); - MEMCPY_CSUM( *(DESTINATION), _source, _copy_blength, (CONVERTOR) ); - *(DESTINATION) += _copy_blength; - _source += _elem->extent; + (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); + MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); + *(packed) += do_now_bytes; + _memory += _elem->extent; + *(SPACE) -= do_now_bytes; + *(COUNT) -= _elem->blocklen; + cando_count -= _elem->blocklen; } - _copy_blength *= _copy_count; } - *(SOURCE) = _source - _elem->disp; - *(SPACE) -= _copy_blength; - *(COUNT) -= _copy_count; + + /** + * As an epilog do anything left from the last blocklen. + */ + do_now = cando_count; + if( 0 != do_now ) { + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", + (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); + _memory += do_now_bytes; + *(packed) += do_now_bytes; + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; + } + + *(memory) = _memory - _elem->disp; } static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, size_t* COUNT, - unsigned char** SOURCE, - unsigned char** DESTINATION, + unsigned char** memory, + unsigned char** packed, size_t* SPACE ) { const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items); - unsigned char* _source = (*SOURCE) + _end_loop->first_elem_disp; + unsigned char* _memory = (*memory) + _end_loop->first_elem_disp; size_t _copy_loops = *(COUNT); if( (_copy_loops * _end_loop->size) > *(SPACE) ) _copy_loops = (*(SPACE) / _end_loop->size); for(size_t _i = 0; _i < _copy_loops; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, _end_loop->size, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)*(DESTINATION), (void*)_source, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); - MEMCPY_CSUM( *(DESTINATION), _source, _end_loop->size, (CONVERTOR) ); - *(DESTINATION) += _end_loop->size; - _source += _loop->extent; + (void*)*(packed), (void*)_memory, (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); + MEMCPY_CSUM( *(packed), _memory, _end_loop->size, (CONVERTOR) ); + *(packed) += _end_loop->size; + _memory += _loop->extent; } - *(SOURCE) = _source - _end_loop->first_elem_disp; + *(memory) = _memory - _end_loop->first_elem_disp; *(SPACE) -= _copy_loops * _end_loop->size; *(COUNT) -= _copy_loops; } @@ -104,12 +144,12 @@ static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, #define PACK_PREDEFINED_DATATYPE( CONVERTOR, /* the convertor */ \ ELEM, /* the basic element to be packed */ \ COUNT, /* the number of elements */ \ - SOURCE, /* the source pointer (char*) */ \ - DESTINATION, /* the destination pointer (char*) */ \ + MEMORY, /* the source pointer (char*) */ \ + PACKED, /* the destination pointer (char*) */ \ SPACE ) /* the space in the destination buffer */ \ -pack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) +pack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(MEMORY), &(PACKED), &(SPACE) ) -#define PACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, SOURCE, DESTINATION, SPACE ) \ - pack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) +#define PACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, MEMORY, PACKED, SPACE ) \ + pack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(MEMORY), &(PACKED), &(SPACE) ) #endif /* OPAL_DATATYPE_PACK_H_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index 3b8eaec69c6..381a31086d6 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -61,22 +61,77 @@ position_predefined_data( opal_convertor_t* CONVERTOR, unsigned char** POINTER, size_t* SPACE ) { - size_t _copy_count = *(COUNT); - size_t _copy_blength; - ddt_elem_desc_t* _elem = &((ELEM)->elem); + const ddt_elem_desc_t* _elem = &((ELEM)->elem); + size_t total_count = _elem->count * _elem->blocklen; + size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t do_now, do_now_bytes; + unsigned char* _memory = (*POINTER) + _elem->disp; - _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; - if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = *(SPACE) / _copy_blength; - if( 0 == _copy_count ) return; /* nothing to do */ + assert( *(COUNT) <= _elem->count * _elem->blocklen); + + if( cando_count > *(COUNT) ) + cando_count = *(COUNT); + + /** + * First check if we already did something on this element ? + */ + do_now = (total_count - *(COUNT)); /* done elements */ + if( 0 != do_now ) { + do_now = do_now % _elem->blocklen; /* partial blocklen? */ + + if( 0 != do_now ) { + size_t left_in_block = _elem->blocklen - do_now; /* left in the current blocklen */ + do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu [prolog]\n", + (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + _memory = *(POINTER) + _elem->disp + (ptrdiff_t)do_now_bytes; + /* compensate if we just completed a blocklen */ + if( do_now == left_in_block ) + _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; + cando_count -= do_now; + } + } + + /** + * Compute how many full blocklen we need to do and do them. + */ + do_now = cando_count / _elem->blocklen; + if( 0 != do_now ) { + do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu\n", + (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); + _memory += _elem->extent; + *(SPACE) -= do_now_bytes; + *(COUNT) -= _elem->blocklen; + cando_count -= _elem->blocklen; + } + } + + /** + * As an epilog do anything left from the last blocklen. + */ + do_now = cando_count; + if( 0 != do_now ) { + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu [epilog]\n", + (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + _memory += do_now_bytes; + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; } - _copy_blength *= _copy_count; - OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _elem->disp, _copy_blength, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - *(POINTER) += (_copy_count * _elem->extent); - *(SPACE) -= _copy_blength; - *(COUNT) -= _copy_count; + *(POINTER) = _memory - _elem->disp; } /** @@ -128,8 +183,8 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, /* We dont want to have to parse the datatype multiple times. What we are interested in * here is to compute the number of completed datatypes that we can move forward, update - * the counters and finally compute the position taking in account only the remaining - * elements. The only problem is that we have to modify all the elements on the stack. + * the counters and compute the position taking in account only the remaining elements. + * The only problem is that we have to modify all the elements on the stack. */ iov_len_local = *position - pConvertor->bConverted; if( iov_len_local > pConvertor->pDesc->size ) { diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index d837aad5ab7..f51a609294d 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. @@ -27,83 +27,124 @@ #endif static inline void -unpack_predefined_data( opal_convertor_t* CONVERTOR, /* the convertor */ - const dt_elem_desc_t* ELEM, /* the element description */ - size_t* COUNT, /* the number of elements */ - unsigned char** SOURCE, /* the source pointer */ - unsigned char** DESTINATION, /* the destination pointer */ - size_t* SPACE ) /* the space in the destination buffer */ +unpack_predefined_data( opal_convertor_t* CONVERTOR, + const dt_elem_desc_t* ELEM, + size_t* COUNT, + unsigned char** packed, + unsigned char** memory, + size_t* SPACE ) { - size_t _copy_count = *(COUNT); - size_t _copy_blength; const ddt_elem_desc_t* _elem = &((ELEM)->elem); - unsigned char* _destination = (*DESTINATION) + _elem->disp; + size_t total_count = _elem->count * _elem->blocklen; + size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t do_now, do_now_bytes; + unsigned char* _memory = (*memory) + _elem->disp; - _copy_blength = opal_datatype_basicDatatypes[_elem->common.type]->size; - if( (_copy_count * _copy_blength) > *(SPACE) ) { - _copy_count = (*(SPACE) / _copy_blength); - if( 0 == _copy_count ) return; /* nothing to do */ + assert( *(COUNT) <= _elem->count * _elem->blocklen); + + if( cando_count > *(COUNT) ) + cando_count = *(COUNT); + + /** + * First check if we already did something on this element ? + */ + do_now = (total_count - *(COUNT)); /* done elements */ + if( 0 != do_now ) { + do_now = do_now % _elem->blocklen; /* partial blocklen? */ + + if( 0 != do_now ) { + size_t left_in_block = _elem->blocklen - do_now; /* left in the current blocklen */ + do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", + (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); + _memory = (*memory) + _elem->disp + (ptrdiff_t)do_now_bytes; + /* compensate if we just completed a blocklen */ + if( do_now == left_in_block ) + _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); + *(packed) += do_now_bytes; + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; + cando_count -= do_now; + } } - if( (ptrdiff_t)_copy_blength == _elem->extent ) { - _copy_blength *= _copy_count; - /* the extent and the size of the basic datatype are equal */ - OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_destination, (void*)*(SOURCE), (unsigned long)_copy_blength, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( _destination, *(SOURCE), _copy_blength, (CONVERTOR) ); - *(SOURCE) += _copy_blength; - _destination += _copy_blength; - } else { - for(size_t _i = 0; _i < _copy_count; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _copy_blength, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_destination, (void*)*(SOURCE), (unsigned long)_copy_blength, (unsigned long)(*(SPACE) - (_i * _copy_blength)) ); ); - MEMCPY_CSUM( _destination, *(SOURCE), _copy_blength, (CONVERTOR) ); - *(SOURCE) += _copy_blength; - _destination += _elem->extent; + /** + * Compute how many full blocklen we need to do and do them. + */ + do_now = cando_count / _elem->blocklen; + if( 0 != do_now ) { + do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); + MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); + *(packed) += do_now_bytes; + _memory += _elem->extent; + *(SPACE) -= do_now_bytes; + *(COUNT) -= _elem->blocklen; + cando_count -= _elem->blocklen; } - _copy_blength *= _copy_count; } - (*DESTINATION) = _destination - _elem->disp; - *(SPACE) -= _copy_blength; - *(COUNT) -= _copy_count; + + /** + * As an epilog do anything left from the last blocklen. + */ + do_now = cando_count; + if( 0 != do_now ) { + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", + (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); + _memory += do_now_bytes; + *(packed) += do_now_bytes; + *(SPACE) -= do_now_bytes; + *(COUNT) -= do_now; + } + + *(memory) = _memory - _elem->disp; } static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, size_t* COUNT, - unsigned char** SOURCE, - unsigned char** DESTINATION, + unsigned char** packed, + unsigned char** memory, size_t* SPACE ) { const ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); const ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + _loop->items); - unsigned char* _destination = (*DESTINATION) + _end_loop->first_elem_disp; + unsigned char* _memory = (*memory) + _end_loop->first_elem_disp; size_t _copy_loops = *(COUNT); if( (_copy_loops * _end_loop->size) > *(SPACE) ) _copy_loops = (*(SPACE) / _end_loop->size); for(size_t _i = 0; _i < _copy_loops; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _destination, _end_loop->size, (CONVERTOR)->pBaseBuf, + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, _end_loop->size, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "unpack 3. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_destination, (void*)*(SOURCE), (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); - MEMCPY_CSUM( _destination, *(SOURCE), _end_loop->size, (CONVERTOR) ); - *(SOURCE) += _end_loop->size; - _destination += _loop->extent; + (void*)_memory, (void*)*(packed), (unsigned long)_end_loop->size, (unsigned long)(*(SPACE) - _i * _end_loop->size) ); ); + MEMCPY_CSUM( _memory, *(packed), _end_loop->size, (CONVERTOR) ); + *(packed) += _end_loop->size; + _memory += _loop->extent; } - *(DESTINATION) = _destination - _end_loop->first_elem_disp; - *(SPACE) -= _copy_loops * _end_loop->size; - *(COUNT) -= _copy_loops; + *(memory) = _memory - _end_loop->first_elem_disp; + *(SPACE) -= _copy_loops * _end_loop->size; + *(COUNT) -= _copy_loops; } -#define UNPACK_PREDEFINED_DATATYPE( CONVERTOR, ELEM, COUNT, SOURCE, DESTINATION, SPACE ) \ - unpack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) +#define UNPACK_PREDEFINED_DATATYPE( CONVERTOR, ELEM, COUNT, PACKED, MEMORY, SPACE ) \ + unpack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) -#define UNPACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, SOURCE, DESTINATION, SPACE ) \ - unpack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(SOURCE), &(DESTINATION), &(SPACE) ) +#define UNPACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, PACKED, MEMORY, SPACE ) \ + unpack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) #endif /* OPAL_DATATYPE_UNPACK_H_HAS_BEEN_INCLUDED */ From 8b794235b8d9882154f45734f1290a4eeedfe4c6 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 8 May 2019 13:08:48 -0400 Subject: [PATCH 384/674] Update the datatype dump to match the actual types. Update the comments to better reflect what is going on. Minor indentations. Signed-off-by: George Bosilca --- ompi/datatype/ompi_datatype_module.c | 18 ++++---- opal/datatype/opal_convertor.c | 6 +-- opal/datatype/opal_convertor_raw.c | 30 ++++++------- opal/datatype/opal_datatype_dump.c | 36 +++++++-------- test/datatype/ddt_raw.c | 66 +++++++++++++++------------- 5 files changed, 80 insertions(+), 76 deletions(-) diff --git a/ompi/datatype/ompi_datatype_module.c b/ompi/datatype/ompi_datatype_module.c index 3ee09173cd8..33e8d9b9e92 100644 --- a/ompi/datatype/ompi_datatype_module.c +++ b/ompi/datatype/ompi_datatype_module.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -736,14 +736,14 @@ void ompi_datatype_dump( const ompi_datatype_t* pData ) length = length * 100 + 500; buffer = (char*)malloc( length ); index += snprintf( buffer, length - index, - "Datatype %p[%s] id %d size %ld align %d opal_id %d length %d used %d\n" - "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" - "nbElems %d loops %d flags %X (", - (void*)pData, pData->name, pData->id, - (long)pData->super.size, (int)pData->super.align, pData->super.id, (int)pData->super.desc.length, (int)pData->super.desc.used, - (long)pData->super.true_lb, (long)pData->super.true_ub, (long)(pData->super.true_ub - pData->super.true_lb), - (long)pData->super.lb, (long)pData->super.ub, (long)(pData->super.ub - pData->super.lb), - (int)pData->super.nbElems, (int)pData->super.loops, (int)pData->super.flags ); + "Datatype %p[%s] id %d size %" PRIsize_t " align %u opal_id %u length %" PRIsize_t " used %" PRIsize_t "\n" + "true_lb %td true_ub %td (true_extent %td) lb %td ub %td (extent %td)\n" + "nbElems %" PRIsize_t " loops %u flags %X (", + (void*)pData, pData->name, pData->id, + pData->super.size, pData->super.align, (uint32_t)pData->super.id, pData->super.desc.length, pData->super.desc.used, + pData->super.true_lb, pData->super.true_ub, pData->super.true_ub - pData->super.true_lb, + pData->super.lb, pData->super.ub, pData->super.ub - pData->super.lb, + pData->super.nbElems, pData->super.loops, (int)pData->super.flags ); /* dump the flags */ if( ompi_datatype_is_predefined(pData) ) { index += snprintf( buffer + index, length - index, "predefined " ); diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 631d3adab43..331cb95a715 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -700,12 +700,12 @@ int opal_convertor_clone( const opal_convertor_t* source, void opal_convertor_dump( opal_convertor_t* convertor ) { - opal_output( 0, "Convertor %p count %" PRIsize_t" stack position %d bConverted %" PRIsize_t "\n" - "\tlocal_size %ld remote_size %ld flags %X stack_size %d pending_length %" PRIsize_t "\n" + opal_output( 0, "Convertor %p count %" PRIsize_t " stack position %u bConverted %" PRIsize_t "\n" + "\tlocal_size %" PRIsize_t " remote_size %" PRIsize_t " flags %X stack_size %u pending_length %" PRIsize_t "\n" "\tremote_arch %u local_arch %u\n", (void*)convertor, convertor->count, convertor->stack_pos, convertor->bConverted, - (unsigned long)convertor->local_size, (unsigned long)convertor->remote_size, + convertor->local_size, convertor->remote_size, convertor->flags, convertor->stack_size, convertor->partial_length, convertor->remoteArch, opal_local_arch ); if( convertor->flags & CONVERTOR_RECV ) opal_output( 0, "unpack "); diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 28022809679..3c2073155b2 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -32,13 +32,13 @@ /** * This function always work in local representation. This means no representation - * conversion (i.e. no heterogeneity) has to be taken into account, and that all + * conversion (i.e. no heterogeneity) is taken into account, and that all * length we're working on are local. */ int32_t opal_convertor_raw( opal_convertor_t* pConvertor, - struct iovec* iov, uint32_t* iov_count, - size_t* length ) + struct iovec* iov, uint32_t* iov_count, + size_t* length ) { const opal_datatype_t *pData = pConvertor->pDesc; dt_stack_t* pStack; /* pointer to the position on the stack */ @@ -77,9 +77,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, description = pConvertor->use_desc->desc; /* For the first step we have to add both displacement to the source. After in the - * main while loop we will set back the source_base to the correct value. This is - * due to the fact that the convertor can stop in the middle of a data with a count - */ + * main while loop we will set back the source_base to the correct value. This is + * due to the fact that the convertor can stop in the middle of a data with a count + */ pStack = pConvertor->pStack + pConvertor->stack_pos; pos_desc = pStack->index; source_base = pConvertor->pBaseBuf + pStack->disp; @@ -101,9 +101,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, blength *= count_desc; /* now here we have a basic datatype */ OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, - pConvertor->pDesc, pConvertor->count ); + pConvertor->pDesc, pConvertor->count ); DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n", - index, (void*)source_base, (unsigned long)blength ); ); + index, (void*)source_base, blength ); ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = blength; source_base += blength; @@ -114,9 +114,9 @@ opal_convertor_raw( opal_convertor_t* pConvertor, } else { for(size_t i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, - pConvertor->pDesc, pConvertor->count ); + pConvertor->pDesc, pConvertor->count ); DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", - index, (void*)source_base, (unsigned long)blength ); ); + index, (void*)source_base, blength ); ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = blength; source_base += pElem->elem.extent; @@ -141,8 +141,8 @@ opal_convertor_raw( opal_convertor_t* pConvertor, if( --(pStack->count) == 0 ) { /* end of loop */ if( pConvertor->stack_pos == 0 ) { /* we lie about the size of the next element in order to - * make sure we exit the main loop. - */ + * make sure we exit the main loop. + */ *iov_count = index; goto complete_loop; /* completed */ } @@ -174,7 +174,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, source_base += offset; for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, - pConvertor->pDesc, pConvertor->count ); + pConvertor->pDesc, pConvertor->count ); iov[index].iov_base = (IOVBASE_TYPE *) source_base; iov[index].iov_len = end_loop->size; source_base += pElem->loop.extent; @@ -198,14 +198,14 @@ opal_convertor_raw( opal_convertor_t* pConvertor, PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, pStack->disp + local_disp); pos_desc++; - update_loop_description: /* update the current state */ + update_loop_description: /* update the current state */ source_base = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" ); continue; } } -complete_loop: + complete_loop: pConvertor->bConverted += raw_data; /* update the already converted bytes */ *length = raw_data; *iov_count = index; diff --git a/opal/datatype/opal_datatype_dump.c b/opal/datatype/opal_datatype_dump.c index 4c26292b8be..7782a805d0a 100644 --- a/opal/datatype/opal_datatype_dump.c +++ b/opal/datatype/opal_datatype_dump.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -64,7 +64,7 @@ int opal_datatype_dump_data_flags( unsigned short usflags, char* ptr, size_t len int index = 0; if( length < 22 ) return 0; index = snprintf( ptr, 22, "-----------[---][---]" ); /* set everything to - */ - if( usflags & OPAL_DATATYPE_FLAG_COMMITTED ) ptr[1] = 'c'; + if( usflags & OPAL_DATATYPE_FLAG_COMMITTED ) ptr[1] = 'c'; if( usflags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) ptr[2] = 'C'; if( usflags & OPAL_DATATYPE_FLAG_OVERLAP ) ptr[3] = 'o'; if( usflags & OPAL_DATATYPE_FLAG_USER_LB ) ptr[4] = 'l'; @@ -90,17 +90,17 @@ int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, index += snprintf( ptr + index, length - index, "%15s ", opal_datatype_basicDatatypes[pDesc->elem.common.type]->name ); if( length <= (size_t)index ) break; if( OPAL_DATATYPE_LOOP == pDesc->elem.common.type ) - index += snprintf( ptr + index, length - index, "%d times the next %d elements extent %d\n", - (int)pDesc->loop.loops, (int)pDesc->loop.items, - (int)pDesc->loop.extent ); + index += snprintf( ptr + index, length - index, "%u times the next %u elements extent %td\n", + pDesc->loop.loops, pDesc->loop.items, + pDesc->loop.extent ); else if( OPAL_DATATYPE_END_LOOP == pDesc->elem.common.type ) - index += snprintf( ptr + index, length - index, "prev %d elements first elem displacement %ld size of data %d\n", - (int)pDesc->end_loop.items, (long)pDesc->end_loop.first_elem_disp, - (int)pDesc->end_loop.size ); + index += snprintf( ptr + index, length - index, "prev %u elements first elem displacement %td size of data %" PRIsize_t "\n", + pDesc->end_loop.items, pDesc->end_loop.first_elem_disp, + pDesc->end_loop.size ); else - index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%lx (%ld) blen %d extent %ld (size %ld)\n", - pDesc->elem.count, (long)pDesc->elem.disp, (long)pDesc->elem.disp, (int)pDesc->elem.blocklen, - pDesc->elem.extent, (long)(pDesc->elem.count * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); + index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%tx (%td) blen %u extent %td (size %zd)\n", + pDesc->elem.count, pDesc->elem.disp, pDesc->elem.disp, pDesc->elem.blocklen, + pDesc->elem.extent, (pDesc->elem.count * pDesc->elem.blocklen * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); pDesc++; if( length <= (size_t)index ) break; @@ -118,13 +118,13 @@ void opal_datatype_dump( const opal_datatype_t* pData ) length = pData->opt_desc.used + pData->desc.used; length = length * 100 + 500; buffer = (char*)malloc( length ); - index += snprintf( buffer, length - index, "Datatype %p[%s] size %ld align %d id %d length %d used %d\n" - "true_lb %ld true_ub %ld (true_extent %ld) lb %ld ub %ld (extent %ld)\n" - "nbElems %" PRIsize_t " loops %d flags %X (", - (void*)pData, pData->name, (long)pData->size, (int)pData->align, pData->id, (int)pData->desc.length, (int)pData->desc.used, - (long)pData->true_lb, (long)pData->true_ub, (long)(pData->true_ub - pData->true_lb), - (long)pData->lb, (long)pData->ub, (long)(pData->ub - pData->lb), - pData->nbElems, (int)pData->loops, (int)pData->flags ); + index += snprintf( buffer, length - index, "Datatype %p[%s] size %" PRIsize_t " align %u id %u length %" PRIsize_t " used %" PRIsize_t "\n" + "true_lb %td true_ub %td (true_extent %td) lb %td ub %td (extent %td)\n" + "nbElems %" PRIsize_t " loops %u flags %X (", + (void*)pData, pData->name, pData->size, pData->align, (uint32_t)pData->id, pData->desc.length, pData->desc.used, + pData->true_lb, pData->true_ub, pData->true_ub - pData->true_lb, + pData->lb, pData->ub, pData->ub - pData->lb, + pData->nbElems, pData->loops, (int)pData->flags ); /* dump the flags */ if( pData->flags == OPAL_DATATYPE_FLAG_PREDEFINED ) index += snprintf( buffer + index, length - index, "predefined " ); diff --git a/test/datatype/ddt_raw.c b/test/datatype/ddt_raw.c index de35d6b83f4..bba285ceea0 100644 --- a/test/datatype/ddt_raw.c +++ b/test/datatype/ddt_raw.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2013 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -71,7 +71,7 @@ static int test_upper( unsigned int length ) iov_count = 5; max_data = 0; opal_convertor_raw( pConv, iov, &iov_count, &max_data ); - i -= max_data; + i -= max_data; } GET_TIME( end ); total_time = ELAPSED_TIME( start, end ); @@ -85,12 +85,12 @@ static int test_upper( unsigned int length ) } /** - * Conversion function. They deal with data-types in 3 ways, always making local copies. + * Conversion function. They deal with datatypes in 3 ways, always making local copies. * In order to allow performance testings, there are 3 functions: * - one copying directly from one memory location to another one using the - * data-type copy function. - * - one which use a 2 convertors created with the same data-type - * - and one using 2 convertors created from different data-types. + * datatype copy function. + * - one which use a 2 convertors created with the same datatype + * - and one using 2 convertors created from different datatypes. * */ static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) @@ -114,13 +114,13 @@ static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) GET_TIME( start ); while( 0 == opal_convertor_raw(convertor, iov, &iov_count, &max_data) ) { #if 0 - printf( "New raw extraction (iov_count = %d, max_data = %zu)\n", - iov_count, max_data ); - for( i = 0; i < iov_count; i++ ) { - printf( "\t{%p, %d}\n", iov[i].iov_base, iov[i].iov_len ); - } + printf( "New raw extraction (iov_count = %d, max_data = %zu)\n", + iov_count, max_data ); + for( i = 0; i < iov_count; i++ ) { + printf( "\t{%p, %d}\n", iov[i].iov_base, iov[i].iov_len ); + } #endif - remaining_length -= max_data; + remaining_length -= max_data; iov_count = iov_num; } remaining_length -= max_data; @@ -129,19 +129,23 @@ static int local_copy_ddt_raw( ompi_datatype_t* pdt, int count, int iov_num ) printf( "raw extraction in %ld microsec\n", total_time ); OBJ_RELEASE( convertor ); if( remaining_length != 0 ) { - printf( "Not all raw description was been extracted (%lu bytes missing)\n", - (unsigned long) remaining_length ); + printf( "Not all raw description was been extracted (%lu bytes missing)\n", + (unsigned long) remaining_length ); } free(iov); return OMPI_SUCCESS; } /** - * Main function. Call several tests and print-out the results. It try to stress the convertor - * using difficult data-type constructions as well as strange segment sizes for the conversion. - * Usually, it is able to detect most of the data-type and convertor problems. Any modifications - * on the data-type engine should first pass all the tests from this file, before going into other - * tests. + * Go over a set of datatypes and copy them using the raw functionality provided by the + * convertor. The goal of this test is to stress the convertor using several more or less + * difficult datatype, with a large set of segment sizes for the conversion. It can be used + * to highlight the raw capability of the convertor as well as detecting datatype convertor + * problems. + * + * This test is part of the testing infrastructure for the core datatype engine. As such any + * modifications on the datatype engine should first pass all the tests from this file, + * before going into other tests. */ int main( int argc, char* argv[] ) { @@ -226,7 +230,7 @@ int main( int argc, char* argv[] ) OBJ_RELEASE( pdt3 ); assert( pdt3 == NULL ); printf( ">>--------------------------------------------<<\n" ); - printf( " Contiguous data-type (MPI_DOUBLE)\n" ); + printf( " Contiguous datatype (MPI_DOUBLE)\n" ); pdt = MPI_DOUBLE; if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_raw(pdt, 4500, iov_num); @@ -235,37 +239,37 @@ int main( int argc, char* argv[] ) printf( ">>--------------------------------------------<<\n" ); if( outputFlags & CHECK_PACK_UNPACK ) { - printf( "Contiguous multiple data-type (4500*1)\n" ); + printf( "Contiguous multiple datatype (4500*1)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 4500 ); local_copy_ddt_raw(pdt, 1, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - printf( "Contiguous multiple data-type (450*10)\n" ); + printf( "Contiguous multiple datatype (450*10)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 450 ); local_copy_ddt_raw(pdt, 10, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - printf( "Contiguous multiple data-type (45*100)\n" ); + printf( "Contiguous multiple datatype (45*100)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 45 ); local_copy_ddt_raw(pdt, 100, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - printf( "Contiguous multiple data-type (100*45)\n" ); + printf( "Contiguous multiple datatype (100*45)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 100 ); local_copy_ddt_raw(pdt, 45, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - printf( "Contiguous multiple data-type (10*450)\n" ); + printf( "Contiguous multiple datatype (10*450)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 10 ); local_copy_ddt_raw(pdt, 450, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); - printf( "Contiguous multiple data-type (1*4500)\n" ); + printf( "Contiguous multiple datatype (1*4500)\n" ); pdt = create_contiguous_type( MPI_DOUBLE, 1 ); local_copy_ddt_raw(pdt, 4500, iov_num); OBJ_RELEASE( pdt ); assert( pdt == NULL ); } printf( ">>--------------------------------------------<<\n" ); printf( ">>--------------------------------------------<<\n" ); - printf( "Vector data-type (450 times 10 double stride 11)\n" ); + printf( "Vector datatype (450 times 10 double stride 11)\n" ); pdt = create_vector_type( MPI_DOUBLE, 450, 10, 11 ); if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_datatype_dump( pdt ); + ompi_datatype_dump( pdt ); } if( outputFlags & CHECK_PACK_UNPACK ) { local_copy_ddt_raw(pdt, 1, iov_num); @@ -292,9 +296,9 @@ int main( int argc, char* argv[] ) printf( ">>--------------------------------------------<<\n" ); pdt = test_create_blacs_type(); if( outputFlags & CHECK_PACK_UNPACK ) { - if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { - ompi_datatype_dump( pdt ); - } + if( outputFlags & DUMP_DATA_AFTER_COMMIT ) { + ompi_datatype_dump( pdt ); + } local_copy_ddt_raw(pdt, 4500, iov_num); } printf( ">>--------------------------------------------<<\n" ); From 4cdc2155e540d13b3145aa5cc095f4d7282c072d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 20 May 2019 11:39:16 -0400 Subject: [PATCH 385/674] Optimize the raw representation. Merge contiguous iov in order to minimize the number of returned iovec. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor_raw.c | 175 ++++++++++++++++++----------- 1 file changed, 109 insertions(+), 66 deletions(-) diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 3c2073155b2..df2340122a9 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2009 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. @@ -30,6 +30,29 @@ #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ +/* Take a new iovec (base + len) and try to merge it with what we already + * have. If we succeed return 0 and move forward, if not save it into a new + * iovec location. If we need to go to a new position and we reach the end + * of the iovec array, return 1 to signal we did not saved the last iovec. + */ +static inline int +opal_convertor_merge_iov( struct iovec* iov, uint32_t* iov_count, + IOVBASE_TYPE* base, size_t len, + uint32_t* idx ) +{ + if( 0 != iov[*idx].iov_len ) { + if( (base == ((char*)iov[*idx].iov_base + iov[*idx].iov_len)) ) { + iov[*idx].iov_len += len; /* merge with previous iovec */ + return 0; + } /* cannot merge, move to the next position */ + *idx = *idx + 1; + if( *idx == *iov_count ) return 1; /* do not overwrite outside the iove array boundaries */ + } + iov[*idx].iov_base = base; + iov[*idx].iov_len = len; + return 0; +} + /** * This function always work in local representation. This means no representation * conversion (i.e. no heterogeneity) is taken into account, and that all @@ -44,10 +67,11 @@ opal_convertor_raw( opal_convertor_t* pConvertor, dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ size_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t do_now, blength; dt_elem_desc_t* description, *pElem; unsigned char *source_base; /* origin of the data */ - size_t raw_data = 0; /* sum of raw data lengths in the iov_len fields */ - uint32_t index = 0; /* the iov index and a simple counter */ + size_t sum_iov_len = 0; /* sum of raw data lengths in the iov_len fields */ + uint32_t index = 0; /* the iov index and a simple counter */ assert( (*iov_count) > 0 ); if( OPAL_LIKELY(pConvertor->flags & CONVERTOR_COMPLETED) ) { @@ -87,64 +111,86 @@ opal_convertor_raw( opal_convertor_t* pConvertor, pStack--; pConvertor->stack_pos--; pElem = &(description[pos_desc]); - source_base += pStack->disp; + DO_DEBUG( opal_output( 0, "raw start pos_desc %d count_desc %" PRIsize_t " disp %ld\n" "stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pos_desc, count_desc, (long)(source_base - pConvertor->pBaseBuf), pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); + + iov[index].iov_len = 0; + /* Special case if we start from a position that is in the middle of a data element blocklen. + * We can treat this outside the loop as it is an exception that can only happen once, + * and will simplify the loop handling. + */ + if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + const ddt_elem_desc_t* current = &(pElem->elem); + + if( count_desc != (current->count * current->blocklen) ) { /* Not the full element description */ + do_now = current->blocklen - (count_desc % current->blocklen); /* how much left in the block */ + if( do_now ) { + source_base += current->disp; + blength = do_now * opal_datatype_basicDatatypes[current->common.type]->size; + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, + pConvertor->pDesc, pConvertor->count ); + DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n", + index, (void*)source_base, blength ); ); + opal_convertor_merge_iov( iov, iov_count, + (IOVBASE_TYPE *) source_base, blength, &index ); + /* not check the return value, we know there was at least one element in the iovec */ + sum_iov_len += blength; + count_desc -= do_now; + + source_base += (current->extent - current->disp + + (current->blocklen - do_now) * opal_datatype_basicDatatypes[current->common.type]->size); + } + } + } + while( 1 ) { while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { - size_t blength = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; - source_base += pElem->elem.disp; - if( blength == (size_t)pElem->elem.extent ) { /* no resized data */ - if( index < *iov_count ) { - blength *= count_desc; - /* now here we have a basic datatype */ - OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, - pConvertor->pDesc, pConvertor->count ); - DO_DEBUG( opal_output( 0, "raw 1. iov[%d] = {base %p, length %" PRIsize_t "}\n", - index, (void*)source_base, blength ); ); - iov[index].iov_base = (IOVBASE_TYPE *) source_base; - iov[index].iov_len = blength; - source_base += blength; - raw_data += blength; - index++; - count_desc = 0; - } - } else { - for(size_t i = count_desc; (i > 0) && (index < *iov_count); i--, index++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, - pConvertor->pDesc, pConvertor->count ); - DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", - index, (void*)source_base, blength ); ); - iov[index].iov_base = (IOVBASE_TYPE *) source_base; - iov[index].iov_len = blength; - source_base += pElem->elem.extent; - raw_data += blength; - count_desc--; - } + const ddt_elem_desc_t* current = &(pElem->elem); + source_base += current->disp; + + do_now = current->count; + if( count_desc != (current->count * current->blocklen) ) { + do_now = count_desc / current->blocklen; + assert( 0 == (count_desc % current->blocklen) ); } - source_base -= pElem->elem.disp; + + blength = current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size; + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, + pConvertor->pDesc, pConvertor->count ); + DO_DEBUG( opal_output( 0, "raw 2. iov[%d] = {base %p, length %" PRIsize_t "}\n", + index, (void*)source_base, blength ); ); + if( opal_convertor_merge_iov( iov, iov_count, + (IOVBASE_TYPE *) source_base, blength, &index ) ) + break; /* no more iovec available, bail out */ + + source_base += current->extent; + sum_iov_len += blength; + count_desc -= current->blocklen; + } + if( 0 == count_desc ) { /* completed */ source_base = pConvertor->pBaseBuf + pStack->disp; pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); continue; } + source_base -= current->disp; goto complete_loop; } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "raw end_loop count %" PRIsize_t " stack_pos %d" - " pos_desc %d disp %ld space %lu\n", + " pos_desc %d disp %ld space %" PRIsize_t "\n", pStack->count, pConvertor->stack_pos, - pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); + pos_desc, (long)pStack->disp, sum_iov_len ); ); if( --(pStack->count) == 0 ) { /* end of loop */ - if( pConvertor->stack_pos == 0 ) { - /* we lie about the size of the next element in order to - * make sure we exit the main loop. - */ - *iov_count = index; - goto complete_loop; /* completed */ + if( 0 == pConvertor->stack_pos ) { + /* we're done. Force the exit of the main for loop (around iovec) */ + index++; /* account for the currently updating iovec */ + goto complete_loop; } pConvertor->stack_pos--; pStack--; @@ -155,15 +201,15 @@ opal_convertor_raw( opal_convertor_t* pConvertor, pStack->disp += (pData->ub - pData->lb); } else { assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); - pStack->disp += description[pStack->index].loop.extent; + pStack->disp += description[pStack->index].loop.extent; /* jump by the loop extent */ } } source_base = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); DO_DEBUG( opal_output( 0, "raw new_loop count %" PRIsize_t " stack_pos %d " - "pos_desc %d disp %ld space %lu\n", + "pos_desc %d disp %ld space %" PRIsize_t "\n", pStack->count, pConvertor->stack_pos, - pos_desc, (long)pStack->disp, (unsigned long)raw_data ); ); + pos_desc, (long)pStack->disp, sum_iov_len ); ); } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)source_base; @@ -172,42 +218,39 @@ opal_convertor_raw( opal_convertor_t* pConvertor, if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { ptrdiff_t offset = end_loop->first_elem_disp; source_base += offset; - for(size_t i = MIN(count_desc, *iov_count - index); i > 0; i--, index++ ) { + for(; count_desc > 0; ) { OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, end_loop->size, pConvertor->pBaseBuf, pConvertor->pDesc, pConvertor->count ); - iov[index].iov_base = (IOVBASE_TYPE *) source_base; - iov[index].iov_len = end_loop->size; + if( opal_convertor_merge_iov( iov, iov_count, + (IOVBASE_TYPE *) source_base, end_loop->size, &index ) ) { + source_base -= offset; + goto complete_loop; + } + source_base += pElem->loop.extent; - raw_data += end_loop->size; + sum_iov_len += end_loop->size; count_desc--; DO_DEBUG( opal_output( 0, "raw contig loop generate iov[%d] = {base %p, length %" PRIsize_t "}" - "space %lu [pos_desc %d]\n", + "space %" PRIsize_t " [pos_desc %d]\n", index, iov[index].iov_base, iov[index].iov_len, - (unsigned long)raw_data, pos_desc ); ); + sum_iov_len, pos_desc ); ); } source_base -= offset; - if( 0 == count_desc ) { /* completed */ - pos_desc += pElem->loop.items + 1; - goto update_loop_description; - } - } - if( index == *iov_count ) { /* all iov have been filled, we need to bail out */ - goto complete_loop; + pos_desc += pElem->loop.items + 1; + } else { + local_disp = (ptrdiff_t)source_base - local_disp; + PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, + pStack->disp + local_disp); + pos_desc++; } - local_disp = (ptrdiff_t)source_base - local_disp; - PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, count_desc, - pStack->disp + local_disp); - pos_desc++; - update_loop_description: /* update the current state */ source_base = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" ); - continue; } } complete_loop: - pConvertor->bConverted += raw_data; /* update the already converted bytes */ - *length = raw_data; + pConvertor->bConverted += sum_iov_len; /* update the already converted bytes */ + *length = sum_iov_len; *iov_count = index; if( pConvertor->bConverted == pConvertor->local_size ) { pConvertor->flags |= CONVERTOR_COMPLETED; From 0a00b02e4882cc0cf612128a715073ea3f9ce688 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Sat, 18 May 2019 19:31:24 -0400 Subject: [PATCH 386/674] Small improvements on the test. Rework the to_self test to be able to be used as a benchmark. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor.c | 2 +- opal/datatype/opal_datatype_optimize.c | 13 +- test/datatype/ddt_raw2.c | 29 +-- test/datatype/opal_datatype_test.c | 3 +- test/datatype/opal_ddt_lib.c | 4 +- test/datatype/to_self.c | 348 ++++++++++++++++--------- test/datatype/unpack_ooo.c | 21 +- 7 files changed, 267 insertions(+), 153 deletions(-) diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 331cb95a715..7a449302bff 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -357,7 +357,7 @@ opal_convertor_create_stack_with_pos_contig( opal_convertor_t* pConvertor, */ if( OPAL_LIKELY(0 == count) ) { pStack[1].type = pElems->elem.common.type; - pStack[1].count = pElems->elem.count; + pStack[1].count = pElems->elem.blocklen; } else { pStack[1].type = OPAL_DATATYPE_UINT1; pStack[1].count = pData->size - count; diff --git a/opal/datatype/opal_datatype_optimize.c b/opal/datatype/opal_datatype_optimize.c index 48ea0f3c78b..fbaacb592c2 100644 --- a/opal/datatype/opal_datatype_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -167,15 +167,18 @@ opal_datatype_optimize_short( opal_datatype_t* pData, if( ((last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) == (current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size)) && (current->disp == (last.disp + (ptrdiff_t)last.count * last.extent)) && - ((last.count == 1) || (current->count == 1) || (last.extent == current->extent)) ) { + ((current->count == 1) || (last.extent == current->extent)) ) { last.count += current->count; - if( last.count == 1 ) { - last.extent = current->extent; - } /* otherwise keep the last.extent */ /* find the lowest common denomitaor type */ if( last.common.type != current->common.type ) { - last.common.type = OPAL_DATATYPE_UINT1; last.blocklen *= opal_datatype_basicDatatypes[last.common.type]->size; + last.common.type = OPAL_DATATYPE_UINT1; + } + /* maximize the contiguous pieces */ + if( last.extent == (ptrdiff_t)(last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) ) { + last.blocklen *= last.count; + last.count = 1; + last.extent = last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size; } continue; /* next data */ } diff --git a/test/datatype/ddt_raw2.c b/test/datatype/ddt_raw2.c index cc78e23006a..7e91a323f7a 100644 --- a/test/datatype/ddt_raw2.c +++ b/test/datatype/ddt_raw2.c @@ -33,9 +33,6 @@ mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, uint32_t *iovec_count, int increment) { - - - opal_convertor_t *convertor; size_t remaining_length = 0; uint32_t i; @@ -43,7 +40,6 @@ mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, struct iovec *temp_iov=NULL; size_t temp_data; - convertor = opal_convertor_create( opal_local_arch, 0 ); if (OMPI_SUCCESS != opal_convertor_prepare_for_send (convertor, @@ -55,9 +51,9 @@ mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, } if ( 0 == datatype->super.size ) { - *iovec_count = 0; - *iov = NULL; - return OMPI_SUCCESS; + *iovec_count = 0; + *iov = NULL; + return OMPI_SUCCESS; } remaining_length = count * datatype->super.size; @@ -69,10 +65,8 @@ mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, return OMPI_ERR_OUT_OF_RESOURCE; } - while (0 == opal_convertor_raw(convertor, - temp_iov, - &temp_count, - &temp_data)) { + while (0 == opal_convertor_raw(convertor, temp_iov, + &temp_count, &temp_data)) { *iovec_count = *iovec_count + temp_count; *iov = (struct iovec *) realloc (*iov, *iovec_count * sizeof(struct iovec)); if (NULL == *iov) { @@ -80,7 +74,7 @@ mca_common_ompio_decode_datatype ( ompi_datatype_t *datatype, free(temp_iov); return OMPI_ERR_OUT_OF_RESOURCE; } - for (i=0 ; i 0 ) { - *iov = (struct iovec *) realloc (*iov, *iovec_count * sizeof(struct iovec)); - if (NULL == *iov) { - opal_output(1, "OUT OF MEMORY\n"); + *iov = (struct iovec *) realloc (*iov, *iovec_count * sizeof(struct iovec)); + if (NULL == *iov) { + opal_output(1, "OUT OF MEMORY\n"); free(temp_iov); - return OMPI_ERR_OUT_OF_RESOURCE; - } + return OMPI_ERR_OUT_OF_RESOURCE; + } } for (i=0 ; idesc.used + 2 ); - if( (bLength == stride) || (1 >= count) ) { /* the elements are contiguous */ + if( (bLength == stride) || (1 == count) ) { /* the elements are contiguous */ opal_datatype_add( pData, oldType, count * bLength, 0, extent ); } else { if( 1 == bLength ) { @@ -476,7 +476,7 @@ static int32_t opal_datatype_create_hvector( int count, int bLength, ptrdiff_t s } pTempData = opal_datatype_create( oldType->desc.used + 2 ); - if( ((extent * bLength) == stride) || (1 >= count) ) { /* contiguous */ + if( ((extent * bLength) == stride) || (1 == count) ) { /* contiguous */ pData = pTempData; opal_datatype_add( pData, oldType, count * bLength, 0, extent ); } else { diff --git a/test/datatype/to_self.c b/test/datatype/to_self.c index 58849f5e90c..073fe4f0b57 100644 --- a/test/datatype/to_self.c +++ b/test/datatype/to_self.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * $COPYRIGHT$ @@ -15,8 +15,9 @@ #include #include #include +#include -#if OPEN_MPI && 0 +#if 0 && OPEN_MPI extern void ompi_datatype_dump( MPI_Datatype ddt ); #define MPI_DDT_DUMP(ddt) ompi_datatype_dump( (ddt) ) #else @@ -178,23 +179,145 @@ create_indexed_gap_optimized_ddt( void ) return dt3; } -static void print_result( int length, int cycles, double time ) -{ - double bandwidth, clock_prec; +/******************************************************************** + *******************************************************************/ + +#define DO_CONTIG 0x00000001 +#define DO_CONSTANT_GAP 0x00000002 +#define DO_INDEXED_GAP 0x00000004 +#define DO_OPTIMIZED_INDEXED_GAP 0x00000008 +#define DO_STRUCT_CONSTANT_GAP_RESIZED 0x00000010 + +#define DO_PACK 0x01000000 +#define DO_UNPACK 0x02000000 +#define DO_ISEND_RECV 0x04000000 +#define DO_ISEND_IRECV 0x08000000 +#define DO_IRECV_SEND 0x10000000 +#define DO_IRECV_ISEND 0x20000000 + +#define MIN_LENGTH 1024 +#define MAX_LENGTH (1024*1024) + +static int cycles = 100; +static int trials = 20; +static int warmups = 2; + +static void print_result( int length, int trials, double* timers ) +{ + double bandwidth, clock_prec, temp; + double min_time, max_time, average, std_dev = 0.0; + double ordered[trials]; + int t, pos, quartile_start, quartile_end; + + for( t = 0; t < trials; ordered[t] = timers[t], t++ ); + for( t = 0; t < trials-1; t++ ) { + temp = ordered[t]; + pos = t; + for( int i = t+1; i < trials; i++ ) { + if( temp > ordered[i] ) { + temp = ordered[i]; + pos = i; + } + } + if( pos != t ) { + temp = ordered[t]; + ordered[t] = ordered[pos]; + ordered[pos] = temp; + } + } + quartile_start = trials - (3 * trials) / 4; + quartile_end = trials - (1 * trials) / 4; clock_prec = MPI_Wtick(); - bandwidth = (length * clock_prec * cycles) / (1024.0 * 1024.0) / (time * clock_prec); - printf( "%8d\t%.6f\t%.4f MB/s\n", length, time / cycles, bandwidth ); + min_time = ordered[quartile_start]; + max_time = ordered[quartile_start]; + average = ordered[quartile_start]; + for( t = quartile_start + 1; t < quartile_end; t++ ) { + if( min_time > ordered[t] ) min_time = ordered[t]; + if( max_time < ordered[t] ) max_time = ordered[t]; + average += ordered[t]; + } + average /= (quartile_end - quartile_start); + for( t = quartile_start; t < quartile_end; t++ ) { + std_dev += (ordered[t] - average) * (ordered[t] - average); + } + std_dev = sqrt( std_dev/(quartile_end - quartile_start) ); + + bandwidth = (length * clock_prec) / (1024.0 * 1024.0) / (average * clock_prec); + printf( "%8d\t%15g\t%10.4f MB/s [min %10g max %10g std %2.2f%%]\n", length, average, bandwidth, + min_time, max_time, (100.0 * std_dev) / average ); +} + +static int pack( int cycles, + MPI_Datatype sdt, int scount, void* sbuf, + void* packed_buf ) +{ + int position, myself, c, t, outsize; + double timers[trials]; + + MPI_Type_size( sdt, &outsize ); + outsize *= scount; + + MPI_Comm_rank( MPI_COMM_WORLD, &myself ); + + for( t = 0; t < warmups; t++ ) { + for( c = 0; c < cycles; c++ ) { + position = 0; + MPI_Pack(sbuf, scount, sdt, packed_buf, outsize, &position, MPI_COMM_WORLD); + } + } + + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + position = 0; + MPI_Pack(sbuf, scount, sdt, packed_buf, outsize, &position, MPI_COMM_WORLD); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; + } + print_result( outsize, trials, timers ); + return 0; +} + +static int unpack( int cycles, + void* packed_buf, + MPI_Datatype rdt, int rcount, void* rbuf ) +{ + int position, myself, c, t, insize; + double timers[trials]; + + MPI_Type_size( rdt, &insize ); + insize *= rcount; + + MPI_Comm_rank( MPI_COMM_WORLD, &myself ); + + for( t = 0; t < warmups; t++ ) { + for( c = 0; c < cycles; c++ ) { + position = 0; + MPI_Unpack(packed_buf, insize, &position, rbuf, rcount, rdt, MPI_COMM_WORLD); + } + } + + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + position = 0; + MPI_Unpack(packed_buf, insize, &position, rbuf, rcount, rdt, MPI_COMM_WORLD); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; + } + print_result( insize, trials, timers ); + return 0; } static int isend_recv( int cycles, MPI_Datatype sdt, int scount, void* sbuf, MPI_Datatype rdt, int rcount, void* rbuf ) { - int myself, tag = 0, i, slength, rlength; + int myself, tag = 0, c, t, slength, rlength; MPI_Status status; MPI_Request req; - double tstart, tend; + double timers[trials]; MPI_Type_size( sdt, &slength ); slength *= scount; @@ -203,21 +326,16 @@ static int isend_recv( int cycles, MPI_Comm_rank( MPI_COMM_WORLD, &myself ); - tstart = MPI_Wtime(); - for( i = 0; i < cycles; i++ ) { -#ifndef FAST - MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &req ); - MPI_Recv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &status ); - MPI_Wait( &req, &status ); - /*MPI_Request_free( &req );*/ -#else - ftmpi_mpi_isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &req ); - ftmpi_mpi_recv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &status ); - ftmpi_request_free( &req ); -#endif + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &req ); + MPI_Recv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &status ); + MPI_Wait( &req, &status ); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; } - tend = MPI_Wtime(); - print_result( rlength, cycles, tend - tstart ); + print_result( rlength, trials, timers ); return 0; } @@ -225,10 +343,10 @@ static int irecv_send( int cycles, MPI_Datatype sdt, int scount, void* sbuf, MPI_Datatype rdt, int rcount, void* rbuf ) { - int myself, tag = 0, i, slength, rlength; + int myself, tag = 0, c, t, slength, rlength; MPI_Request req; MPI_Status status; - double tstart, tend; + double timers[trials]; MPI_Type_size( sdt, &slength ); slength *= scount; @@ -237,21 +355,16 @@ static int irecv_send( int cycles, MPI_Comm_rank( MPI_COMM_WORLD, &myself ); - tstart = MPI_Wtime(); - for( i = 0; i < cycles; i++ ) { -#ifndef FAST - MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &req ); - MPI_Send( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD ); - MPI_Wait( &req, &status ); - /*MPI_Request_free( &req );*/ -#else - ftmpi_mpi_irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &req ); - ftmpi_mpi_send( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD ); - ftmpi_request_free( &req ); -#endif + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &req ); + MPI_Send( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD ); + MPI_Wait( &req, &status ); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; } - tend = MPI_Wtime(); - print_result( rlength, cycles, tend - tstart ); + print_result( rlength, trials, timers ); return 0; } @@ -259,10 +372,10 @@ static int isend_irecv_wait( int cycles, MPI_Datatype sdt, int scount, void* sbuf, MPI_Datatype rdt, int rcount, void* rbuf ) { - int myself, tag = 0, i, slength, rlength; - MPI_Request sreq, rreq; - MPI_Status status; - double tstart, tend; + int myself, tag = 0, c, t, slength, rlength; + MPI_Request requests[2]; + MPI_Status statuses[2]; + double timers[trials]; MPI_Type_size( sdt, &slength ); slength *= scount; @@ -271,25 +384,16 @@ static int isend_irecv_wait( int cycles, MPI_Comm_rank( MPI_COMM_WORLD, &myself ); - tstart = MPI_Wtime(); - for( i = 0; i < cycles; i++ ) { -#ifndef FAST - MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &sreq ); - MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &rreq ); - MPI_Wait( &sreq, &status ); - MPI_Wait( &rreq, &status ); - /*MPI_Request_free( &sreq );*/ - /*MPI_Request_free( &rreq );*/ -#else - ftmpi_mpi_isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &sreq ); - ftmpi_mpi_irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &rreq ); - ftmpi_wait( &sreq, &status ); - ftmpi_request_free( &sreq ); - ftmpi_request_free( &rreq ); -#endif + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &requests[0] ); + MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &requests[1] ); + MPI_Waitall( 2, requests, statuses ); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; } - tend = MPI_Wtime(); - print_result( rlength, cycles, tend - tstart ); + print_result( rlength, trials, timers ); return 0; } @@ -297,10 +401,10 @@ static int irecv_isend_wait( int cycles, MPI_Datatype sdt, int scount, void* sbuf, MPI_Datatype rdt, int rcount, void* rbuf ) { - int myself, tag = 0, i, slength, rlength; - MPI_Request sreq, rreq; - MPI_Status status; - double tstart, tend; + int myself, tag = 0, c, t, slength, rlength; + MPI_Request requests[2]; + MPI_Status statuses[2]; + double timers[trials]; MPI_Type_size( sdt, &slength ); slength *= scount; @@ -309,74 +413,82 @@ static int irecv_isend_wait( int cycles, MPI_Comm_rank( MPI_COMM_WORLD, &myself ); - tstart = MPI_Wtime(); - for( i = 0; i < cycles; i++ ) { -#ifndef FAST - MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &rreq ); - MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &sreq ); - MPI_Wait( &sreq, &status ); - MPI_Wait( &rreq, &status ); - /*MPI_Request_free( &sreq );*/ - /*MPI_Request_free( &rreq );*/ -#else - ftmpi_mpi_irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &rreq ); - ftmpi_mpi_isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &sreq ); - ftmpi_wait( &sreq, &status ); - ftmpi_request_free( &sreq ); - ftmpi_request_free( &rreq ); -#endif + for( t = 0; t < trials; t++ ) { + timers[t] = MPI_Wtime(); + for( c = 0; c < cycles; c++ ) { + MPI_Irecv( rbuf, rcount, rdt, myself, tag, MPI_COMM_WORLD, &requests[0] ); + MPI_Isend( sbuf, scount, sdt, myself, tag, MPI_COMM_WORLD, &requests[1] ); + MPI_Waitall( 2, requests, statuses ); + } + timers[t] = (MPI_Wtime() - timers[t]) / cycles; } - tend = MPI_Wtime(); - print_result( rlength, cycles, tend - tstart ); + print_result( rlength, trials, timers); return 0; } -static int do_test_for_ddt( MPI_Datatype sddt, MPI_Datatype rddt, int length ) +static int do_test_for_ddt( int doop, MPI_Datatype sddt, MPI_Datatype rddt, int length ) { - int i; MPI_Aint lb, extent; char *sbuf, *rbuf; + int i; MPI_Type_get_extent( sddt, &lb, &extent ); sbuf = (char*)malloc( length ); rbuf = (char*)malloc( length ); - printf( "# Isend recv (length %d)\n", length ); - for( i = 1; i <= (length/extent); i *= 2 ) { - isend_recv( 10, sddt, i, sbuf, rddt, i, rbuf ); + if( doop & DO_PACK ) { + printf("# Pack (max length %d)\n", length); + for( i = 1; i <= (length/extent); i *= 2 ) { + pack( cycles, sddt, i, sbuf, rbuf ); + } } - printf( "# Isend Irecv Wait (length %d)\n", length ); - for( i = 1; i <= (length/extent); i *= 2 ) { - isend_irecv_wait( 10, sddt, i, sbuf, rddt, i, rbuf ); + + if( doop & DO_UNPACK ) { + printf("# Unpack (length %d)\n", length); + for( i = 1; i <= (length/extent); i *= 2 ) { + unpack( cycles, sbuf, rddt, i, rbuf ); + } } - printf( "# Irecv send (length %d)\n", length ); - for( i = 1; i <= (length/extent); i *= 2 ) { - irecv_send( 10, sddt, i, sbuf, rddt, i, rbuf ); + + if( doop & DO_ISEND_RECV ) { + printf( "# Isend recv (length %d)\n", length ); + for( i = 1; i <= (length/extent); i *= 2 ) { + isend_recv( cycles, sddt, i, sbuf, rddt, i, rbuf ); + } } - printf( "# Irecv Isend Wait (length %d)\n", length ); - for( i = 1; i <= (length/extent); i *= 2 ) { - irecv_isend_wait( 10, sddt, i, sbuf, rddt, i, rbuf ); + + if( doop & DO_ISEND_IRECV ) { + printf( "# Isend Irecv Wait (length %d)\n", length ); + for( i = 1; i <= (length/extent); i *= 2 ) { + isend_irecv_wait( cycles, sddt, i, sbuf, rddt, i, rbuf ); + } + } + + if( doop & DO_IRECV_SEND ) { + printf( "# Irecv send (length %d)\n", length ); + for( i = 1; i <= (length/extent); i *= 2 ) { + irecv_send( cycles, sddt, i, sbuf, rddt, i, rbuf ); + } + } + + if( doop & DO_IRECV_SEND ) { + printf( "# Irecv Isend Wait (length %d)\n", length ); + for( i = 1; i <= (length/extent); i *= 2 ) { + irecv_isend_wait( cycles, sddt, i, sbuf, rddt, i, rbuf ); + } } free( sbuf ); free( rbuf ); return 0; } -#define DO_CONTIG 0x01 -#define DO_CONSTANT_GAP 0x02 -#define DO_INDEXED_GAP 0x04 -#define DO_OPTIMIZED_INDEXED_GAP 0x08 -#define DO_STRUCT_CONSTANT_GAP_RESIZED 0x10 - -#define MIN_LENGTH 1024 -#define MAX_LENGTH (1024*1024) - int main( int argc, char* argv[] ) { - int run_tests = 0xffffffff; /* do all tests by default */ - int length, rank, size; + int run_tests = 0xffff; /* do all datatype tests by default */ + int rank, size; MPI_Datatype ddt; - /*int run_tests = DO_CONSTANT_GAP;*/ + run_tests |= DO_PACK | DO_UNPACK; + MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); @@ -389,16 +501,14 @@ int main( int argc, char* argv[] ) if( run_tests & DO_CONTIG ) { printf( "\ncontiguous datatype\n\n" ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( MPI_INT, MPI_INT, length ); + do_test_for_ddt( run_tests, MPI_INT, MPI_INT, MAX_LENGTH ); } if( run_tests & DO_INDEXED_GAP ) { printf( "\nindexed gap\n\n" ); ddt = create_indexed_gap_ddt(); MPI_DDT_DUMP( ddt ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( ddt, ddt, length ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); MPI_Type_free( &ddt ); } @@ -406,8 +516,7 @@ int main( int argc, char* argv[] ) printf( "\noptimized indexed gap\n\n" ); ddt = create_indexed_gap_optimized_ddt(); MPI_DDT_DUMP( ddt ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( ddt, ddt, length ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); MPI_Type_free( &ddt ); } @@ -415,8 +524,7 @@ int main( int argc, char* argv[] ) printf( "\nconstant indexed gap\n\n" ); ddt = create_indexed_constant_gap_ddt( 80, 100, 1 ); MPI_DDT_DUMP( ddt ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( ddt, ddt, length ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); MPI_Type_free( &ddt ); } @@ -424,8 +532,7 @@ int main( int argc, char* argv[] ) printf( "\noptimized constant indexed gap\n\n" ); ddt = create_optimized_indexed_constant_gap_ddt( 80, 100, 1 ); MPI_DDT_DUMP( ddt ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( ddt, ddt, length ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); MPI_Type_free( &ddt ); } @@ -433,8 +540,7 @@ int main( int argc, char* argv[] ) printf( "\nstruct constant gap resized\n\n" ); ddt = create_struct_constant_gap_resized_ddt( 0 /* unused */, 0 /* unused */, 0 /* unused */ ); MPI_DDT_DUMP( ddt ); - for( length = MIN_LENGTH; length < MAX_LENGTH; length <<=1 ) - do_test_for_ddt( ddt, ddt, length ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); MPI_Type_free( &ddt ); } diff --git a/test/datatype/unpack_ooo.c b/test/datatype/unpack_ooo.c index 458ef550930..58ef8a95774 100644 --- a/test/datatype/unpack_ooo.c +++ b/test/datatype/unpack_ooo.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; -*- */ /* - * Copyright (c) 2014 The University of Tennessee and The University + * Copyright (c) 2014-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2014 Research Organization for Information Science @@ -18,7 +18,6 @@ #include "opal/runtime/opal.h" #include "opal/datatype/opal_convertor.h" #include "opal/datatype/opal_datatype_internal.h" -// #include #include #include #include @@ -61,6 +60,18 @@ static void print_bar_pbar(struct foo_t* bar, struct pfoo_t* pbar) fprintf(stderr, "\n"); } +static void print_stack(opal_convertor_t* conv) +{ + printf("Stack pos %d [converted %" PRIsize_t "/%" PRIsize_t "]\n", + conv->stack_pos, conv->bConverted, conv->local_size); + for( uint32_t i = 0; i <= conv->stack_pos; i++ ) { + printf( "[%u] index %d, type %s count %" PRIsize_t " disp %p\n", + i, conv->pStack[i].index, opal_datatype_basicDatatypes[conv->pStack[i].type]->name, + conv->pStack[i].count, (void*)conv->pStack[i].disp); + } + printf("\n"); +} + static int testcase(ompi_datatype_t * newtype, size_t arr[10][2]) { int i, j, errors = 0; struct iovec a; @@ -104,6 +115,7 @@ static int testcase(ompi_datatype_t * newtype, size_t arr[10][2]) { max_data = a.iov_len; pos = arr[i][1]; opal_convertor_set_position(pConv, &pos); + print_stack(pConv); assert(arr[i][1] == pos); opal_convertor_unpack( pConv, &a, &iov_count, &max_data ); a.iov_base = (char*)a.iov_base - 1024; @@ -118,9 +130,10 @@ static int testcase(ompi_datatype_t * newtype, size_t arr[10][2]) { bar[j].d[1] != 0.0 || bar[j].d[2] != pbar[j].d[1]) { if(0 == errors) { - fprintf(stderr, "ERROR ! count=%d, position=%d, ptr = %p" + (void)opal_datatype_dump(&newtype->super); + fprintf(stderr, "ERROR ! position=%d/%d, ptr = %p" " got (%d,%d,%d,%g,%g,%g) expected (%d,%d,%d,%g,%g,%g)\n", - N, j, (void*)&bar[j], + j, N, (void*)&bar[j], bar[j].i[0], bar[j].i[1], bar[j].i[2], From 012a00480616cfd30c91de50635c0718d5cde72d Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Mon, 20 May 2019 11:43:29 -0400 Subject: [PATCH 387/674] Clean and sync the pack and unpack functions. - optimize handling of contiguous with gaps datatypes. - fixes a performance issue for all datatypes with a count of 1. - optimize the pack/unpack of contiguous with gaps datatype. - optimize the case of blocklen == 1 Signed-off-by: George Bosilca --- opal/datatype/opal_convertor_raw.c | 6 +- opal/datatype/opal_datatype_copy.h | 32 ++-- opal/datatype/opal_datatype_module.c | 1 - opal/datatype/opal_datatype_pack.c | 218 ++++++++++--------------- opal/datatype/opal_datatype_pack.h | 108 ++++++------ opal/datatype/opal_datatype_position.c | 60 ++++--- opal/datatype/opal_datatype_unpack.c | 128 +++++++-------- opal/datatype/opal_datatype_unpack.h | 112 +++++++------ 8 files changed, 314 insertions(+), 351 deletions(-) diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index df2340122a9..893792583f9 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -31,8 +31,8 @@ #endif /* OPAL_ENABLE_DEBUG */ /* Take a new iovec (base + len) and try to merge it with what we already - * have. If we succeed return 0 and move forward, if not save it into a new - * iovec location. If we need to go to a new position and we reach the end + * have. If we succeed return 0 and move forward, otherwise save it into a new + * iovec location. If we need to advance position and we reach the end * of the iovec array, return 1 to signal we did not saved the last iovec. */ static inline int @@ -46,7 +46,7 @@ opal_convertor_merge_iov( struct iovec* iov, uint32_t* iov_count, return 0; } /* cannot merge, move to the next position */ *idx = *idx + 1; - if( *idx == *iov_count ) return 1; /* do not overwrite outside the iove array boundaries */ + if( *idx == *iov_count ) return 1; /* do not overwrite outside the iovec array boundaries */ } iov[*idx].iov_base = base; iov[*idx].iov_len = len; diff --git a/opal/datatype/opal_datatype_copy.h b/opal/datatype/opal_datatype_copy.h index 40f119a684d..11058012e1e 100644 --- a/opal/datatype/opal_datatype_copy.h +++ b/opal/datatype/opal_datatype_copy.h @@ -51,11 +51,9 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM, const ddt_elem_desc_t* _elem = &((ELEM)->elem); unsigned char* _source = (SOURCE) + _elem->disp; unsigned char* _destination = (DESTINATION) + _elem->disp; - size_t total_count = _elem->count * _elem->blocklen; - size_t do_now, do_now_bytes; + size_t do_now = _elem->count, do_now_bytes; - assert( (COUNT) == total_count); - assert( total_count <= ((*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size) ); + assert( (COUNT) == (do_now * _elem->blocklen)); /* We don't a prologue and epilogue here as we are __always__ working * with full copies of the data description. @@ -64,21 +62,19 @@ static inline void _predefined_data( const dt_elem_desc_t* ELEM, /** * Compute how many full blocklen we need to do and do them. */ - do_now = _elem->count; - if( 0 != do_now ) { - do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; - for(size_t _i = 0; _i < do_now; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _source, do_now_bytes, (SOURCE_BASE), - (DATATYPE), (TOTAL_COUNT) ); - DO_DEBUG( opal_output( 0, "copy %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", - STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, do_now_bytes, *(SPACE) ); ); - MEM_OP( _destination, _source, do_now_bytes ); - _destination += _elem->extent; - _source += _elem->extent; - *(SPACE) -= do_now_bytes; - } - (COUNT) -= total_count; + do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; + assert( (do_now * do_now_bytes) <= (*SPACE) ); + + for(size_t _i = 0; _i < do_now; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _source, do_now_bytes, (SOURCE_BASE), + (DATATYPE), (TOTAL_COUNT) ); + DO_DEBUG( opal_output( 0, "copy %s( %p, %p, %" PRIsize_t " ) => space %" PRIsize_t "\n", + STRINGIFY(MEM_OP_NAME), (void*)_destination, (void*)_source, do_now_bytes, *(SPACE) - _i * do_now_bytes ); ); + MEM_OP( _destination, _source, do_now_bytes ); + _destination += _elem->extent; + _source += _elem->extent; } + *(SPACE) -= (do_now_bytes * do_now); } static inline void _contiguous_loop( const dt_elem_desc_t* ELEM, diff --git a/opal/datatype/opal_datatype_module.c b/opal/datatype/opal_datatype_module.c index 7976392b63e..d4415b21ef1 100644 --- a/opal/datatype/opal_datatype_module.c +++ b/opal/datatype/opal_datatype_module.c @@ -224,7 +224,6 @@ int32_t opal_datatype_init( void ) OPAL_DATATYPE_FLAG_CONTIGUOUS | OPAL_DATATYPE_FLAG_NO_GAPS; datatype->desc.desc[0].elem.common.type = i; - /* datatype->desc.desc[0].elem.blocklen XXX not set at the moment, it will be needed later */ datatype->desc.desc[0].elem.count = 1; datatype->desc.desc[0].elem.blocklen = 1; datatype->desc.desc[0].elem.disp = 0; diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index 55889fcaa55..cf69f6ada22 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -53,8 +53,6 @@ #endif /* defined(CHECKSUM) */ -#define IOVEC_MEM_LIMIT 8192 - /* the contig versions does not use the stack. They can easily retrieve * the status with just the informations from pConvertor->bConverted. */ @@ -68,9 +66,8 @@ opal_pack_homogeneous_contig_function( opal_convertor_t* pConv, unsigned char *source_base = NULL; uint32_t iov_count; size_t length = pConv->local_size - pConv->bConverted, initial_amount = pConv->bConverted; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; - source_base = (pConv->pBaseBuf + initial_displ + pStack[0].disp + pStack[1].disp); + source_base = (pConv->pBaseBuf + pConv->pDesc->true_lb + pStack[0].disp + pStack[1].disp); /* There are some optimizations that can be done if the upper level * does not provide a buffer. @@ -111,155 +108,116 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, uint32_t* out_size, size_t* max_data ) { + size_t remaining, length, initial_bytes_converted = pConv->bConverted; const opal_datatype_t* pData = pConv->pDesc; dt_stack_t* stack = pConv->pStack; + ptrdiff_t extent = pData->ub - pData->lb; unsigned char *user_memory, *packed_buffer; - uint32_t iov_count, index; + uint32_t idx; size_t i; - size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; - ptrdiff_t extent= pData->ub - pData->lb; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; + /* The memory layout is contiguous with gaps in the begining and at the end. The datatype true_lb + * is the initial displacement, the size the length of the contiguous area and the extent represent + * how much we should jump between elements. + */ assert( (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && ((ptrdiff_t)pData->size != extent) ); DO_DEBUG( opal_output( 0, "pack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", (void*)pConv->pBaseBuf, *out_size ); ); if( stack[1].type != opal_datatype_uint1.id ) { stack[1].count *= opal_datatype_basicDatatypes[stack[1].type]->size; - stack[1].type = opal_datatype_uint1.id; + stack[1].type = opal_datatype_uint1.id; + } + /* We can provide directly the pointers in the user buffers (like the convertor_raw) */ + if( NULL == iov[0].iov_base ) { + user_memory = pConv->pBaseBuf + pData->true_lb; + + for( idx = 0; (idx < (*out_size)) && stack[0].count; idx++ ) { + iov[idx].iov_base = user_memory + stack[0].disp + stack[1].disp; + iov[idx].iov_len = stack[1].count; + COMPUTE_CSUM( iov[idx].iov_base, iov[idx].iov_len, pConv ); + + pConv->bConverted += stack[1].count; + + stack[0].disp += extent; + stack[0].count--; + stack[1].disp = 0; + stack[1].count = pData->size; /* we might need this to update the partial + * length for the first iteration */ + } + goto update_status_and_return; } - /* There are some optimizations that can be done if the upper level - * does not provide a buffer. - */ - for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { + for( idx = 0; idx < (*out_size); idx++ ) { /* Limit the amount of packed data to the data left over on this convertor */ remaining = pConv->local_size - pConv->bConverted; if( 0 == remaining ) break; /* we're done this time */ - if( remaining > iov[iov_count].iov_len ) - remaining = iov[iov_count].iov_len; - packed_buffer = (unsigned char *)iov[iov_count].iov_base; - bConverted = remaining; /* how much will get unpacked this time */ - user_memory = pConv->pBaseBuf + initial_displ + stack[0].disp + stack[1].disp; - i = pConv->count - stack[0].count; /* how many we already packed */ - assert(i == (pConv->bConverted / pData->size)); - - if( packed_buffer == NULL ) { - /* special case for small data. We avoid allocating memory if we - * can fill the iovec directly with the address of the remaining - * data. - */ - if( stack->count < (size_t)((*out_size) - iov_count) ) { - stack[1].count = pData->size - (pConv->bConverted % pData->size); - for( index = iov_count; i < pConv->count; i++, index++ ) { - iov[index].iov_base = (IOVBASE_TYPE *) user_memory; - iov[index].iov_len = stack[1].count; - stack[0].disp += extent; - pConv->bConverted += stack[1].count; - stack[1].disp = 0; /* reset it for the next round */ - stack[1].count = pData->size; - user_memory = pConv->pBaseBuf + initial_displ + stack[0].disp; - COMPUTE_CSUM( iov[index].iov_base, iov[index].iov_len, pConv ); - } - *out_size = iov_count + index; - *max_data = (pConv->bConverted - initial_bytes_converted); - pConv->flags |= CONVERTOR_COMPLETED; - return 1; /* we're done */ - } - /* now special case for big contiguous data with gaps around */ - if( pData->size >= IOVEC_MEM_LIMIT ) { - /* as we dont have to copy any data, we can simply fill the iovecs - * with data from the user data description. - */ - for( index = iov_count; (i < pConv->count) && (index < (*out_size)); - i++, index++ ) { - if( remaining < pData->size ) { - iov[index].iov_base = (IOVBASE_TYPE *) user_memory; - iov[index].iov_len = remaining; - remaining = 0; - COMPUTE_CSUM( iov[index].iov_base, iov[index].iov_len, pConv ); - break; - } else { - iov[index].iov_base = (IOVBASE_TYPE *) user_memory; - iov[index].iov_len = pData->size; - user_memory += extent; - COMPUTE_CSUM( iov[index].iov_base, (size_t)iov[index].iov_len, pConv ); - } - remaining -= iov[index].iov_len; - pConv->bConverted += iov[index].iov_len; - } - *out_size = index; - *max_data = (pConv->bConverted - initial_bytes_converted); - if( pConv->bConverted == pConv->local_size ) { - pConv->flags |= CONVERTOR_COMPLETED; - return 1; - } - return 0; + if( remaining > iov[idx].iov_len ) + remaining = iov[idx].iov_len; + packed_buffer = (unsigned char *)iov[idx].iov_base; + pConv->bConverted += remaining; + user_memory = pConv->pBaseBuf + pData->true_lb + stack[0].disp + stack[1].disp; + + DO_DEBUG( opal_output( 0, "pack_homogeneous_contig( user_memory %p, packed_buffer %p length %" PRIsize_t "\n", + (void*)user_memory, (void*)packed_buffer, remaining ); ); + + length = (0 == pConv->stack_pos ? 0 : stack[1].count); /* left over from the last pack */ + /* data left from last round and enough space in the buffer */ + if( (pData->size != length) && (length <= remaining)) { + /* copy the partial left-over from the previous round */ + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, length, pConv->pBaseBuf, + pData, pConv->count ); + DO_DEBUG( opal_output( 0, "pack dest %p src %p length %" PRIsize_t " [prologue]\n", + (void*)user_memory, (void*)packed_buffer, length ); ); + MEMCPY_CSUM( packed_buffer, user_memory, length, pConv ); + packed_buffer += length; + remaining -= length; + stack[1].count -= length; + stack[1].disp += length; /* just in case, we overwrite this below */ + if( 0 == stack[1].count) { /* one completed element */ + stack[0].count--; + stack[0].disp += extent; + if( 0 == stack[0].count ) /* not yet done */ + break; + stack[1].count = pData->size; + stack[1].disp = 0; } + user_memory = pConv->pBaseBuf + pData->true_lb + stack[0].disp + stack[1].disp; } - { - DO_DEBUG( opal_output( 0, "pack_homogeneous_contig( user_memory %p, packed_buffer %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); - - length = (0 == pConv->stack_pos ? 0 : stack[1].count); /* left over from the last pack */ - /* data left from last round and enough space in the buffer */ - if( (0 != length) && (length <= remaining)) { - /* copy the partial left-over from the previous round */ - OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, length, pConv->pBaseBuf, - pData, pConv->count ); - DO_DEBUG( opal_output( 0, "2. pack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)length ); ); - MEMCPY_CSUM( packed_buffer, user_memory, length, pConv ); - packed_buffer += length; - user_memory += (extent - pData->size + length); - remaining -= length; - stack[1].count -= length; - if( 0 == stack[1].count) { /* one completed element */ - stack[0].count--; - stack[0].disp += extent; - if( 0 != stack[0].count ) { /* not yet done */ - stack[1].count = pData->size; - stack[1].disp = 0; - } - } - } - for( i = 0; pData->size <= remaining; i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, - pData, pConv->count ); - DO_DEBUG( opal_output( 0, "3. pack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)pData->size ); ); - MEMCPY_CSUM( packed_buffer, user_memory, pData->size, pConv ); - packed_buffer += pData->size; - user_memory += extent; - remaining -= pData->size; - } - stack[0].count -= i; /* the filled up and the entire types */ - stack[0].disp += (i * extent); - stack[1].disp += remaining; - /* Copy the last bits */ - if( 0 != remaining ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, - pData, pConv->count ); - DO_DEBUG( opal_output( 0, "4. pack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); - MEMCPY_CSUM( packed_buffer, user_memory, remaining, pConv ); - user_memory += remaining; - stack[1].count -= remaining; - } + for( i = 0; pData->size <= remaining; i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, + pData, pConv->count ); + DO_DEBUG( opal_output( 0, "pack dest %p src %p length %" PRIsize_t " [%" PRIsize_t "/%" PRIsize_t "\n", + (void*)user_memory, (void*)packed_buffer, pData->size, remaining, iov[idx].iov_len ); ); + MEMCPY_CSUM( packed_buffer, user_memory, pData->size, pConv ); + packed_buffer += pData->size; + user_memory += extent; + remaining -= pData->size; + } + stack[0].count -= i; /* the entire datatype copied above */ + stack[0].disp += (i * extent); + + /* Copy the last bits */ + if( 0 != remaining ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, + pData, pConv->count ); + DO_DEBUG( opal_output( 0, "4. pack dest %p src %p length %" PRIsize_t "\n", + (void*)user_memory, (void*)packed_buffer, remaining ); ); + MEMCPY_CSUM( packed_buffer, user_memory, remaining, pConv ); + stack[1].count -= remaining; + stack[1].disp += remaining; /* keep the += in case we are copying less that the datatype size */ if( 0 == stack[1].count ) { /* prepare for the next element */ stack[1].count = pData->size; stack[1].disp = 0; } } - pConv->bConverted += bConverted; } - *out_size = iov_count; - *max_data = (pConv->bConverted - initial_bytes_converted); - if( pConv->bConverted == pConv->local_size ) { - pConv->flags |= CONVERTOR_COMPLETED; - return 1; - } - return 0; + + update_status_and_return: + *out_size = idx; + *max_data = pConv->bConverted - initial_bytes_converted; + if( pConv->bConverted == pConv->local_size ) pConv->flags |= CONVERTOR_COMPLETED; + return !!(pConv->flags & CONVERTOR_COMPLETED); /* done or not */ } /* The pack/unpack functions need a cleanup. I have to create a proper interface to access diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 66259f8b66b..514f8bd7b02 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -35,82 +35,90 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, size_t* SPACE ) { const ddt_elem_desc_t* _elem = &((ELEM)->elem); - size_t total_count = _elem->count * _elem->blocklen; size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; size_t do_now, do_now_bytes; + size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; unsigned char* _memory = (*memory) + _elem->disp; + unsigned char* _packed = *packed; assert( *(COUNT) <= _elem->count * _elem->blocklen); if( cando_count > *(COUNT) ) cando_count = *(COUNT); - /** - * First check if we already did something on this element ? - */ - do_now = (total_count - *(COUNT)); /* done elements */ - if( 0 != do_now ) { - do_now = do_now % _elem->blocklen; /* partial blocklen? */ - - if( 0 != do_now ) { - size_t left_in_block = _elem->blocklen - do_now; /* left in the current blocklen */ - do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", - (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); - _memory = (*memory) + _elem->disp + (ptrdiff_t)do_now_bytes; - /* compensate if we just completed a blocklen */ - if( do_now == left_in_block ) - _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); - *(packed) += do_now_bytes; - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; - cando_count -= do_now; + if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ + *(COUNT) -= cando_count; + for(; cando_count > 0; cando_count--) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_packed, (void*)_memory, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _packed, _memory, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; } + goto update_and_return; } + blocklen_bytes *= _elem->blocklen; /** - * Compute how many full blocklen we need to do and do them. + * First check if we already did something on this element ? The COUNT is the number + * of remaining predefined types in the current elem, not how many predefined types + * should be manipulated in the current call (this number is instead reflected on the + * SPACE). */ - do_now = cando_count / _elem->blocklen; + do_now = *(COUNT) % _elem->blocklen; /* any partial elements ? */ + /* premptively update the number of COUNT we will return. */ + *(COUNT) -= cando_count; if( 0 != do_now ) { - do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; - for(size_t _i = 0; _i < do_now; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); - MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); - *(packed) += do_now_bytes; - _memory += _elem->extent; - *(SPACE) -= do_now_bytes; - *(COUNT) -= _elem->blocklen; - cando_count -= _elem->blocklen; - } + size_t left_in_block = do_now; /* left in the current blocklen */ + do_now = (do_now > cando_count ) ? cando_count : do_now; + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", + _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); + _memory += (ptrdiff_t)do_now_bytes; + /* compensate if we just completed a blocklen */ + if( do_now == left_in_block ) + _memory += _elem->extent - blocklen_bytes; + _packed += do_now_bytes; + cando_count -= do_now; + } + + /* Do as many full blocklen as possible */ + for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_packed, (void*)_memory, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _packed, _memory, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; + cando_count -= _elem->blocklen; } /** * As an epilog do anything left from the last blocklen. */ - do_now = cando_count; - if( 0 != do_now ) { - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + if( 0 != cando_count ) { + assert( cando_count < _elem->blocklen ); + do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); + (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", - (void*)*(packed), (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( *(packed), _memory, do_now_bytes, (CONVERTOR) ); + (void*)_packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); _memory += do_now_bytes; - *(packed) += do_now_bytes; - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; + _packed += do_now_bytes; } + update_and_return: *(memory) = _memory - _elem->disp; + *(SPACE) -= (_packed - *packed); + *(packed) = _packed; } static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index 381a31086d6..f8137c7e0cb 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -49,10 +49,24 @@ * - the DT_CONTIGUOUS flag for the type OPAL_DATATYPE_END_LOOP is meaningless. */ +static inline void +position_single_block(opal_convertor_t* CONVERTOR, + unsigned char** mem, ptrdiff_t mem_update, + size_t* space, size_t space_update, + size_t* cnt, size_t cnt_update) +{ + OPAL_DATATYPE_SAFEGUARD_POINTER( *mem, mem_update, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu [prolog]\n", + (void*)*mem, (unsigned long)space_update, (unsigned long)(*space) ); ); + *mem += mem_update; + *space -= space_update; + *cnt -= cnt_update; +} + /** - * Advance the current position in the convertor based using the - * current element and a left-over counter. Update the head pointer - * and the leftover byte space. + * Advance the convertors' position according. Update the pointer and the remaining space + * accordingly. */ static inline void position_predefined_data( opal_convertor_t* CONVERTOR, @@ -64,7 +78,7 @@ position_predefined_data( opal_convertor_t* CONVERTOR, const ddt_elem_desc_t* _elem = &((ELEM)->elem); size_t total_count = _elem->count * _elem->blocklen; size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; - size_t do_now, do_now_bytes; + size_t do_now, do_now_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; unsigned char* _memory = (*POINTER) + _elem->disp; assert( *(COUNT) <= _elem->count * _elem->blocklen); @@ -72,6 +86,15 @@ position_predefined_data( opal_convertor_t* CONVERTOR, if( cando_count > *(COUNT) ) cando_count = *(COUNT); + if( 1 == _elem->blocklen ) { + DO_DEBUG( opal_output( 0, "position( %p, %" PRIsize_t " ) x (count %" PRIsize_t ", extent %ld) => space %lu [prolog]\n", + (void*)_memory, (unsigned long)do_now_bytes, cando_count, _elem->extent, (unsigned long)(*SPACE) ); ); + _memory += cando_count * _elem->extent; + *SPACE -= cando_count * do_now_bytes; + *COUNT -= cando_count; + goto update_and_return; + } + /** * First check if we already did something on this element ? */ @@ -84,16 +107,12 @@ position_predefined_data( opal_convertor_t* CONVERTOR, do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu [prolog]\n", - (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - _memory = *(POINTER) + _elem->disp + (ptrdiff_t)do_now_bytes; + position_single_block( CONVERTOR, &_memory, do_now_bytes, + SPACE, do_now_bytes, COUNT, do_now ); + /* compensate if we just completed a blocklen */ if( do_now == left_in_block ) _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; cando_count -= do_now; } } @@ -105,13 +124,8 @@ position_predefined_data( opal_convertor_t* CONVERTOR, if( 0 != do_now ) { do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; for(size_t _i = 0; _i < do_now; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu\n", - (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); - _memory += _elem->extent; - *(SPACE) -= do_now_bytes; - *(COUNT) -= _elem->blocklen; + position_single_block( CONVERTOR, &_memory, _elem->extent, + SPACE, do_now_bytes, COUNT, _elem->blocklen ); cando_count -= _elem->blocklen; } } @@ -122,15 +136,11 @@ position_predefined_data( opal_convertor_t* CONVERTOR, do_now = cando_count; if( 0 != do_now ) { do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "position( %p, %lu ) => space %lu [epilog]\n", - (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - _memory += do_now_bytes; - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; + position_single_block( CONVERTOR, &_memory, do_now_bytes, + SPACE, do_now_bytes, COUNT, do_now ); } + update_and_return: *(POINTER) = _memory - _elem->disp; } diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index 3edb9161923..ac35a03c267 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -70,98 +70,82 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, { const opal_datatype_t *pData = pConv->pDesc; unsigned char *user_memory, *packed_buffer; - uint32_t iov_count, i; - size_t bConverted, remaining, length, initial_bytes_converted = pConv->bConverted; + uint32_t iov_idx, i; + size_t remaining, initial_bytes_converted = pConv->bConverted; dt_stack_t* stack = pConv->pStack; ptrdiff_t extent = pData->ub - pData->lb; - ptrdiff_t initial_displ = pConv->use_desc->desc[pConv->use_desc->used].end_loop.first_elem_disp; - DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", + DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( pBaseBuf %p, iov count %d )\n", (void*)pConv->pBaseBuf, *out_size ); ); if( stack[1].type != opal_datatype_uint1.id ) { stack[1].count *= opal_datatype_basicDatatypes[stack[1].type]->size; stack[1].type = opal_datatype_uint1.id; } - for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { - remaining = pConv->local_size - pConv->bConverted; - if( 0 == remaining ) break; /* we're done this time */ - if( remaining > iov[iov_count].iov_len ) - remaining = iov[iov_count].iov_len; - packed_buffer = (unsigned char*)iov[iov_count].iov_base; - bConverted = remaining; /* how much will get unpacked this time */ - user_memory = pConv->pBaseBuf + initial_displ; - - if( (ptrdiff_t)pData->size == extent ) { - user_memory += pConv->bConverted; - DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); + + if( (ptrdiff_t)pData->size == extent ) { + for( iov_idx = 0; iov_idx < (*out_size); iov_idx++ ) { + remaining = pConv->local_size - pConv->bConverted; + if( 0 == remaining ) break; /* we're done this time */ + if( remaining > iov[iov_idx].iov_len ) + remaining = iov[iov_idx].iov_len; + + packed_buffer = (unsigned char*)iov[iov_idx].iov_base; + user_memory = pConv->pBaseBuf + pData->true_lb + pConv->bConverted; /* contiguous data or basic datatype with count */ OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, pData, pConv->count ); - DO_DEBUG( opal_output( 0, "1. unpack contig dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); + DO_DEBUG( opal_output( 0, "unpack contig [%d] dest %p src %p length %" PRIsize_t "\n", + iov_idx, (void*)user_memory, (void*)packed_buffer, remaining ); ); MEMCPY_CSUM( user_memory, packed_buffer, remaining, pConv ); - } else { - user_memory += stack[0].disp + stack[1].disp; + pConv->bConverted += remaining; /* how much will get unpacked this time */ + } + } else { + for( iov_idx = 0; iov_idx < (*out_size); iov_idx++ ) { + remaining = pConv->local_size - pConv->bConverted; + if( 0 == remaining ) break; /* we're done this time */ + if( remaining > iov[iov_idx].iov_len ) + remaining = iov[iov_idx].iov_len; + + packed_buffer = (unsigned char*)iov[iov_idx].iov_base; + user_memory = pConv->pBaseBuf + pData->true_lb + stack[0].disp + stack[1].disp; + pConv->bConverted += remaining; /* how much will get unpacked this time */ + + for( i = 0; stack[1].count <= remaining; i++ ) { /* partial or full data */ + OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, stack[1].count, pConv->pBaseBuf, + pData, pConv->count ); + DO_DEBUG( opal_output( 0, "unpack gaps [%d] dest %p src %p length %" PRIsize_t " [%d]\n", + iov_idx, (void*)user_memory, (void*)packed_buffer, stack[1].count, i ); ); + MEMCPY_CSUM( user_memory, packed_buffer, stack[1].count, pConv ); - DO_DEBUG( opal_output( 0, "unpack_homogeneous_contig( user_memory %p, packed_buffer %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); + packed_buffer += stack[1].count; + remaining -= stack[1].count; - length = (0 == pConv->stack_pos ? 0 : stack[1].count); /* left over from the last unpack */ - /* complete the last copy */ - if( (0 != length) && (length <= remaining) ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, length, pConv->pBaseBuf, - pData, pConv->count ); - DO_DEBUG( opal_output( 0, "2. unpack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)length ); ); - MEMCPY_CSUM( user_memory, packed_buffer, length, pConv ); - packed_buffer += length; - user_memory += (extent - (pData->size - length)); - remaining -= length; - stack[1].count -= length; - if( 0 == stack[1].count) { /* one completed element */ - stack[0].count--; - stack[0].disp += extent; - if( 0 != stack[0].count ) { /* not yet done */ - stack[1].count = pData->size; - stack[1].disp = 0; - } - } - } - for( i = 0; pData->size <= remaining; i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, pData->size, pConv->pBaseBuf, - pData, pConv->count ); - DO_DEBUG( opal_output( 0, "3. unpack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)pData->size ); ); - MEMCPY_CSUM( user_memory, packed_buffer, pData->size, pConv ); - packed_buffer += pData->size; - user_memory += extent; - remaining -= pData->size; + stack[0].count--; + stack[0].disp += extent; + stack[1].count = pData->size; + stack[1].disp = 0; + + user_memory = pConv->pBaseBuf + pData->true_lb + stack[0].disp; } - stack[0].count -= i; - stack[0].disp += (i * extent); - stack[1].disp += remaining; - /* copy the last bits */ + + /* Copy the last bits */ if( 0 != remaining ) { OPAL_DATATYPE_SAFEGUARD_POINTER( user_memory, remaining, pConv->pBaseBuf, pData, pConv->count ); - DO_DEBUG( opal_output( 0, "4. unpack dest %p src %p length %lu\n", - (void*)user_memory, (void*)packed_buffer, (unsigned long)remaining ); ); + DO_DEBUG( opal_output( 0, "unpack gaps [%d] dest %p src %p length %" PRIsize_t " [epilog]\n", + iov_idx, (void*)user_memory, (void*)packed_buffer, remaining ); ); MEMCPY_CSUM( user_memory, packed_buffer, remaining, pConv ); - user_memory += remaining; stack[1].count -= remaining; + stack[1].disp += remaining; /* keep the += in case we are copying less that the datatype size */ + assert( stack[1].count ); } } - pConv->bConverted += bConverted; } - *out_size = iov_count; /* we only reach this line after the for loop succesfully complete */ - *max_data = (pConv->bConverted - initial_bytes_converted); - if( pConv->bConverted == pConv->local_size ) { - pConv->flags |= CONVERTOR_COMPLETED; - return 1; - } - return 0; + *out_size = iov_idx; /* we only reach this line after the for loop succesfully complete */ + *max_data = pConv->bConverted - initial_bytes_converted; + if( pConv->bConverted == pConv->local_size ) pConv->flags |= CONVERTOR_COMPLETED; + return !!(pConv->flags & CONVERTOR_COMPLETED); /* done or not */ } /** @@ -179,7 +163,7 @@ opal_unpack_homogeneous_contig_function( opal_convertor_t* pConv, static inline void opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pElem, unsigned char* partial_data, - ptrdiff_t start_position, ptrdiff_t length, + ptrdiff_t start_position, size_t length, unsigned char** user_buffer ) { char unused_byte = 0x7F, saved_data[16]; @@ -195,7 +179,7 @@ opal_unpack_partial_datatype( opal_convertor_t* pConvertor, dt_elem_desc_t* pEle /* Find a byte that is not used in the partial buffer */ find_unused_byte: - for(ptrdiff_t i = 0; i < length; i++ ) { + for(size_t i = 0; i < length; i++ ) { if( unused_byte == partial_data[i] ) { unused_byte--; goto find_unused_byte; @@ -306,7 +290,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, COMPUTE_CSUM( iov_ptr, missing_length, pConvertor ); opal_unpack_partial_datatype( pConvertor, pElem, iov_ptr, - pConvertor->partial_length, element_length - pConvertor->partial_length, + pConvertor->partial_length, (size_t)(element_length - pConvertor->partial_length), &conv_ptr ); --count_desc; if( 0 == count_desc ) { diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index f51a609294d..5a3679bc37f 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -35,82 +35,90 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, size_t* SPACE ) { const ddt_elem_desc_t* _elem = &((ELEM)->elem); - size_t total_count = _elem->count * _elem->blocklen; size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; size_t do_now, do_now_bytes; + size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; unsigned char* _memory = (*memory) + _elem->disp; + unsigned char* _packed = *packed; - assert( *(COUNT) <= _elem->count * _elem->blocklen); + assert( *(COUNT) <= (_elem->count * _elem->blocklen)); if( cando_count > *(COUNT) ) cando_count = *(COUNT); - /** - * First check if we already did something on this element ? - */ - do_now = (total_count - *(COUNT)); /* done elements */ - if( 0 != do_now ) { - do_now = do_now % _elem->blocklen; /* partial blocklen? */ - - if( 0 != do_now ) { - size_t left_in_block = _elem->blocklen - do_now; /* left in the current blocklen */ - do_now = (left_in_block > cando_count ) ? cando_count : left_in_block; - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", - (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); - _memory = (*memory) + _elem->disp + (ptrdiff_t)do_now_bytes; - /* compensate if we just completed a blocklen */ - if( do_now == left_in_block ) - _memory += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); - *(packed) += do_now_bytes; - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; - cando_count -= do_now; + if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ + *(COUNT) -= cando_count; + for(; cando_count > 0; cando_count--) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_memory, (void*)_packed, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _memory, _packed, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; } + goto update_and_return; } + blocklen_bytes *= _elem->blocklen; /** - * Compute how many full blocklen we need to do and do them. + * First check if we already did something on this element ? The COUNT is the number + * of remaining predefined types in the current elem, not how many predefined types + * should be manipulated in the current call (this number is instead reflected on the + * SPACE). */ - do_now = cando_count / _elem->blocklen; + do_now = *(COUNT) % _elem->blocklen; /* any partial elements ? */ + /* premptively update the number of COUNT we will return. */ + *(COUNT) -= cando_count; if( 0 != do_now ) { - do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; - for(size_t _i = 0; _i < do_now; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)*(SPACE) ); ); - MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); - *(packed) += do_now_bytes; - _memory += _elem->extent; - *(SPACE) -= do_now_bytes; - *(COUNT) -= _elem->blocklen; - cando_count -= _elem->blocklen; - } + size_t left_in_block = do_now; /* left in the current blocklen */ + do_now = (do_now > cando_count ) ? cando_count : do_now; + do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", + (void*)_memory, (void*)_packed, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _memory, _packed, do_now_bytes, (CONVERTOR) ); + _memory += (ptrdiff_t)do_now_bytes; + /* compensate if we just completed a blocklen */ + if( do_now == left_in_block ) + _memory += _elem->extent - blocklen_bytes; + _packed += do_now_bytes; + cando_count -= do_now; + } + + /* Do as many full blocklen as possible */ + for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_memory, (void*)_packed, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _memory, _packed, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; + cando_count -= _elem->blocklen; } /** * As an epilog do anything left from the last blocklen. */ - do_now = cando_count; - if( 0 != do_now ) { - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; + if( 0 != cando_count ) { + assert( cando_count < _elem->blocklen ); + do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", - (void*)_memory, (void*)*(packed), (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( _memory, *(packed), do_now_bytes, (CONVERTOR) ); + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", + (void*)_memory, (void*)_packed, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _memory, _packed, do_now_bytes, (CONVERTOR) ); _memory += do_now_bytes; - *(packed) += do_now_bytes; - *(SPACE) -= do_now_bytes; - *(COUNT) -= do_now; + _packed += do_now_bytes; } + update_and_return: *(memory) = _memory - _elem->disp; + *(SPACE) -= (_packed - *packed); + *(packed) = _packed; } static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, From 78cc0ff89193b0ec7034b4ea26f93aefb83e7d15 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 28 May 2019 14:54:40 -0400 Subject: [PATCH 388/674] Disable checksum. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor.c | 16 +++++++++------- opal/datatype/opal_convertor.h | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 7a449302bff..4754723f68a 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -579,8 +579,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, assert(! (convertor->flags & CONVERTOR_SEND)); OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); - if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) { - if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) { +#if defined(CHECKSUM) + if( OPAL_UNLIKELY(convertor->flags & CONVERTOR_WITH_CHECKSUM) ) { + if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) { convertor->fAdvance = opal_unpack_general_checksum; } else { if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { @@ -589,8 +590,9 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, convertor->fAdvance = opal_generic_simple_unpack_checksum; } } - } else { - if( !(convertor->flags & CONVERTOR_HOMOGENEOUS) ) { + } else +#endif /* defined(CHECKSUM) */ + if( OPAL_UNLIKELY(!(convertor->flags & CONVERTOR_HOMOGENEOUS)) ) { convertor->fAdvance = opal_unpack_general; } else { if( convertor->pDesc->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { @@ -599,7 +601,6 @@ int32_t opal_convertor_prepare_for_recv( opal_convertor_t* convertor, convertor->fAdvance = opal_generic_simple_unpack; } } - } return OPAL_SUCCESS; } @@ -618,6 +619,7 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, OPAL_CONVERTOR_PREPARE( convertor, datatype, count, pUserBuf ); +#if defined(CHECKSUM) if( convertor->flags & CONVERTOR_WITH_CHECKSUM ) { if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) { convertor->fAdvance = opal_pack_general_checksum; @@ -632,7 +634,8 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, convertor->fAdvance = opal_generic_simple_pack_checksum; } } - } else { + } else +#endif /* defined(CHECKSUM) */ if( CONVERTOR_SEND_CONVERSION == (convertor->flags & (CONVERTOR_SEND_CONVERSION|CONVERTOR_HOMOGENEOUS)) ) { convertor->fAdvance = opal_pack_general; } else { @@ -646,7 +649,6 @@ int32_t opal_convertor_prepare_for_send( opal_convertor_t* convertor, convertor->fAdvance = opal_generic_simple_pack; } } - } return OPAL_SUCCESS; } diff --git a/opal/datatype/opal_convertor.h b/opal/datatype/opal_convertor.h index 875c111b1f1..b24d94c37b0 100644 --- a/opal/datatype/opal_convertor.h +++ b/opal/datatype/opal_convertor.h @@ -332,8 +332,10 @@ opal_convertor_set_position( opal_convertor_t* convertor, /* Remove the completed flag if it's already set */ convertor->flags &= ~CONVERTOR_COMPLETED; - if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && - (convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) && + if( (convertor->flags & OPAL_DATATYPE_FLAG_NO_GAPS) && +#if defined(CHECKSUM) + !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && +#endif /* defined(CHECKSUM) */ (convertor->flags & (CONVERTOR_SEND | CONVERTOR_HOMOGENEOUS)) ) { /* Contiguous and no checkpoint and no homogeneous unpack */ convertor->bConverted = *position; From d5cdfe70eff1371f69edf847bc1b164bd7e05d92 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 21 Jun 2019 13:15:12 -0400 Subject: [PATCH 389/674] Optimize the position placement. Upon detecting a datatype loop representation skip the entire loop according the the remaining space. Signed-off-by: George Bosilca --- opal/datatype/opal_datatype_position.c | 67 +++++++++----------------- 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index f8137c7e0cb..204d670a3ef 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -3,7 +3,7 @@ * Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2004-2014 The University of Tennessee and The University + * Copyright (c) 2004-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -123,11 +123,18 @@ position_predefined_data( opal_convertor_t* CONVERTOR, do_now = cando_count / _elem->blocklen; if( 0 != do_now ) { do_now_bytes = _elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size; +#if OPAL_ENABLE_DEBUG for(size_t _i = 0; _i < do_now; _i++ ) { position_single_block( CONVERTOR, &_memory, _elem->extent, SPACE, do_now_bytes, COUNT, _elem->blocklen ); cando_count -= _elem->blocklen; } +#else + _memory += do_now * _elem->extent; + *SPACE -= do_now * do_now_bytes; + *COUNT -= do_now * _elem->blocklen; + cando_count -= do_now * _elem->blocklen; +#endif /* OPAL_ENABLE_DEBUG */ } /** @@ -144,48 +151,16 @@ position_predefined_data( opal_convertor_t* CONVERTOR, *(POINTER) = _memory - _elem->disp; } -/** - * Advance the current position in the convertor based using the - * current contiguous loop and a left-over counter. Update the head - * pointer and the leftover byte space. - */ -static inline void -position_contiguous_loop( opal_convertor_t* CONVERTOR, - dt_elem_desc_t* ELEM, - size_t* COUNT, - unsigned char** POINTER, - size_t* SPACE ) -{ - ddt_loop_desc_t *_loop = (ddt_loop_desc_t*)(ELEM); - ddt_endloop_desc_t* _end_loop = (ddt_endloop_desc_t*)((ELEM) + (ELEM)->loop.items); - size_t _copy_loops = *(COUNT); - - if( (_copy_loops * _end_loop->size) > *(SPACE) ) - _copy_loops = *(SPACE) / _end_loop->size; - OPAL_DATATYPE_SAFEGUARD_POINTER( *(POINTER) + _end_loop->first_elem_disp, - (_copy_loops - 1) * _loop->extent + _end_loop->size, - (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); - *(POINTER) += _copy_loops * _loop->extent; - *(SPACE) -= _copy_loops * _end_loop->size; - *(COUNT) -= _copy_loops; -} - -#define POSITION_PREDEFINED_DATATYPE( CONVERTOR, ELEM, COUNT, POSITION, SPACE ) \ - position_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(POSITION), &(SPACE) ) - -#define POSITION_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, POSITION, SPACE ) \ - position_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(POSITION), &(SPACE) ) - int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, size_t* position ) { dt_stack_t* pStack; /* pointer to the position on the stack */ uint32_t pos_desc; /* actual position in the description of the derived datatype */ size_t count_desc; /* the number of items already done in the actual pos_desc */ + size_t iov_len_local; dt_elem_desc_t* description = pConvertor->use_desc->desc; dt_elem_desc_t* pElem; /* current position */ unsigned char *base_pointer = pConvertor->pBaseBuf; - size_t iov_len_local; ptrdiff_t extent = pConvertor->pDesc->ub - pConvertor->pDesc->lb; DUMP( "opal_convertor_generic_simple_position( %p, &%ld )\n", (void*)pConvertor, (long)*position ); @@ -236,21 +211,19 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, assert(pConvertor->partial_length < element_length); return 0; } - pConvertor->partial_length = (pConvertor->partial_length + missing_length) % element_length; - assert(pConvertor->partial_length == 0); + pConvertor->partial_length = 0; pConvertor->bConverted += missing_length; iov_len_local -= missing_length; count_desc--; } while( 1 ) { - if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ + if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the the entire datatype */ DO_DEBUG( opal_output( 0, "position end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %lx space %lu\n", pStack->count, pConvertor->stack_pos, pos_desc, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( pConvertor->stack_pos == 0 ) { pConvertor->flags |= CONVERTOR_COMPLETED; - pConvertor->partial_length = 0; goto complete_loop; /* completed */ } pConvertor->stack_pos--; @@ -259,11 +232,13 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } else { if( pStack->index == -1 ) { pStack->disp += extent; + pos_desc = 0; /* back to the first element */ } else { assert( OPAL_DATATYPE_LOOP == description[pStack->index].loop.common.type ); pStack->disp += description[pStack->index].loop.extent; + pos_desc = pStack->index; /* go back to the loop start itself to give a chance + * to move forward by entire loops */ } - pos_desc = pStack->index + 1; } base_pointer = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); @@ -273,9 +248,14 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } if( OPAL_DATATYPE_LOOP == pElem->elem.common.type ) { ptrdiff_t local_disp = (ptrdiff_t)base_pointer; - if( pElem->loop.common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { - POSITION_CONTIGUOUS_LOOP( pConvertor, pElem, count_desc, - base_pointer, iov_len_local ); + ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)(pElem + pElem->loop.items); + size_t full_loops = iov_len_local / end_loop->size; + full_loops = count_desc <= full_loops ? count_desc : full_loops; + if( full_loops ) { + base_pointer += full_loops * pElem->loop.extent; + iov_len_local -= full_loops * end_loop->size; + count_desc -= full_loops; + if( 0 == count_desc ) { /* completed */ pos_desc += pElem->loop.items + 1; goto update_loop_description; @@ -297,8 +277,7 @@ int opal_convertor_generic_simple_position( opal_convertor_t* pConvertor, } while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - POSITION_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, - base_pointer, iov_len_local ); + position_predefined_data( pConvertor, pElem, &count_desc, &base_pointer, &iov_len_local ); if( 0 != count_desc ) { /* completed */ pConvertor->partial_length = iov_len_local; goto complete_loop; From fad707d3b05f7e4baef3c55c1dbfaf4537b348c9 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 26 Jun 2019 12:55:44 -0400 Subject: [PATCH 390/674] Rework the datatype commit. Optimize contiguous loops by collapsing them into a single element. During datatype optimization collapse similar elements into larger blocks. Signed-off-by: George Bosilca --- opal/datatype/opal_datatype_internal.h | 12 ++++-- opal/datatype/opal_datatype_optimize.c | 60 ++++++++++++++++++-------- 2 files changed, 49 insertions(+), 23 deletions(-) diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index 2b2ddc0961e..1f10c9138aa 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -215,10 +215,8 @@ union dt_elem_desc { /** - * Create one or more elements depending on the value of _count. If the value - * is too large for the type of elem.count then use oth the elem.count and - * elem.blocklen to create it. If the number is prime then create a second - * element to account for the difference. + * Create an element entry in the description. If the element is contiguous + * collapse everything into the blocklen. */ #define CREATE_ELEM(_place, _type, _flags, _blocklen, _count, _disp, _extent) \ do { \ @@ -228,6 +226,12 @@ union dt_elem_desc { (_place)->elem.count = (_count); \ (_place)->elem.extent = (_extent); \ (_place)->elem.disp = (_disp); \ + if( _extent == (ptrdiff_t)(_blocklen * opal_datatype_basicDatatypes[_type]->size) ) { \ + /* collapse it into a single large blocklen */ \ + (_place)->elem.blocklen *= _count; \ + (_place)->elem.extent *= _count; \ + (_place)->elem.count = 1; \ + } \ } while(0) /* * This array holds the descriptions desc.desc[2] of the predefined basic datatypes. diff --git a/opal/datatype/opal_datatype_optimize.c b/opal/datatype/opal_datatype_optimize.c index fbaacb592c2..336e11f0560 100644 --- a/opal/datatype/opal_datatype_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -60,27 +60,27 @@ opal_datatype_optimize_short( opal_datatype_t* pData, CREATE_ELEM( pElemDesc, last.common.type, OPAL_DATATYPE_FLAG_BASIC, last.blocklen, last.count, last.disp, last.extent ); pElemDesc++; nbElems++; - last.disp += last.count; last.count= 0; } CREATE_LOOP_END( pElemDesc, nbElems - pStack->index + 1, /* # of elems in this loop */ end_loop->first_elem_disp, end_loop->size, end_loop->common.flags ); - pElemDesc++; nbElems++; if( --stack_pos >= 0 ) { /* still something to do ? */ ddt_loop_desc_t* pStartLoop = &(pTypeDesc->desc[pStack->index - 1].loop); - pStartLoop->items = end_loop->items; + pStartLoop->items = pElemDesc->end_loop.items; total_disp = pStack->disp; /* update the displacement position */ } + pElemDesc++; nbElems++; pStack--; /* go down one position on the stack */ pos_desc++; continue; } if( OPAL_DATATYPE_LOOP == pData->desc.desc[pos_desc].elem.common.type ) { ddt_loop_desc_t* loop = (ddt_loop_desc_t*)&(pData->desc.desc[pos_desc]); - ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]); int index = GET_FIRST_NON_LOOP( &(pData->desc.desc[pos_desc]) ); if( loop->common.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS ) { + ddt_endloop_desc_t* end_loop = (ddt_endloop_desc_t*)&(pData->desc.desc[pos_desc + loop->items]); + assert(pData->desc.desc[pos_desc + index].elem.disp == end_loop->first_elem_disp); compress.common.flags = loop->common.flags; compress.common.type = pData->desc.desc[pos_desc + index].elem.common.type; @@ -99,7 +99,12 @@ opal_datatype_optimize_short( opal_datatype_t* pData, compress.count = loop->loops; compress.extent = loop->extent; compress.disp = end_loop->first_elem_disp; - + if( compress.extent == (ptrdiff_t)(compress.blocklen * opal_datatype_basicDatatypes[compress.common.type]->size) ) { + /* The compressed element is contiguous: collapse it into a single large blocklen */ + compress.blocklen *= compress.count; + compress.extent *= compress.count; + compress.count = 1; + } /** * The current loop has been compressed and can now be treated as if it * was a data element. We can now look if it can be fused with last, @@ -161,26 +166,43 @@ opal_datatype_optimize_short( opal_datatype_t* pData, } /* are the two elements compatible: aka they have very similar values and they - * can be merged together by increasing the count. This optimizes the memory - * required for storing the datatype description. + * can be merged together by increasing the count, and/or changing the extent. */ - if( ((last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) == - (current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size)) && - (current->disp == (last.disp + (ptrdiff_t)last.count * last.extent)) && - ((current->count == 1) || (last.extent == current->extent)) ) { - last.count += current->count; - /* find the lowest common denomitaor type */ + if( (last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) == + (current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size) ) { + ddt_elem_desc_t save = last; /* safekeep the type and blocklen */ if( last.common.type != current->common.type ) { last.blocklen *= opal_datatype_basicDatatypes[last.common.type]->size; last.common.type = OPAL_DATATYPE_UINT1; } - /* maximize the contiguous pieces */ - if( last.extent == (ptrdiff_t)(last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size) ) { - last.blocklen *= last.count; - last.count = 1; - last.extent = last.blocklen * opal_datatype_basicDatatypes[last.common.type]->size; + + if( 1 == last.count ) { + /* we can ignore the extent of the element with count == 1 and merge them together if their displacements match */ + if( 1 == current->count ) { + last.extent = current->disp - last.disp; + last.count++; + continue; + } + /* can we compute a matching displacement ? */ + if( (last.disp + current->extent) == current->disp ) { + last.extent = current->extent; + last.count = current->count + 1; + continue; + } } - continue; /* next data */ + if( (last.extent * (ptrdiff_t)last.count + last.disp) == current->disp ) { + if( 1 == current->count ) { + last.count++; + continue; + } + if( last.extent == current->extent ) { + last.count += current->count; + continue; + } + } + last.blocklen = save.blocklen; + last.common.type = save.common.type; + /* try other optimizations */ } /* are the elements fusionable such that we can fusion the last blocklen of one with the first * blocklen of the other. From 87299e0b1c3a14b3ca70799fc0be12ef98ed7bcd Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 10 Jul 2019 00:28:29 -0400 Subject: [PATCH 391/674] Get rid of the division in the critical path. Amazing how a bad instruction scheduling can have such a drastic impact on the code performance. With this change, the get a boost of at least 50% on the performance of data with a small blocklen and/or count. Signed-off-by: George Bosilca --- opal/datatype/opal_datatype_pack.h | 28 +++++++++++++++++++--------- opal/datatype/opal_datatype_unpack.h | 27 +++++++++++++++++++-------- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 514f8bd7b02..4da9bd2450e 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -35,19 +35,24 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, size_t* SPACE ) { const ddt_elem_desc_t* _elem = &((ELEM)->elem); - size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; - size_t do_now, do_now_bytes; size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t cando_count = *(COUNT), do_now, do_now_bytes; unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; assert( *(COUNT) <= _elem->count * _elem->blocklen); - if( cando_count > *(COUNT) ) - cando_count = *(COUNT); + if( (blocklen_bytes * cando_count) > *(SPACE) ) + cando_count = (*SPACE) / blocklen_bytes; + do_now = *(COUNT); /* save the COUNT for later */ + /* premptively update the number of COUNT we will return. */ + *(COUNT) -= cando_count; + + if( 1 == _elem->count ) { /* Everything is contiguous, handle it as a prologue */ + goto do_epilog; + } if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ - *(COUNT) -= cando_count; for(; cando_count > 0; cando_count--) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); @@ -59,17 +64,19 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, } goto update_and_return; } - blocklen_bytes *= _elem->blocklen; + blocklen_bytes *= _elem->blocklen; + if( (_elem->count * _elem->blocklen) == cando_count ) { + goto skip_prolog; + } /** * First check if we already did something on this element ? The COUNT is the number * of remaining predefined types in the current elem, not how many predefined types * should be manipulated in the current call (this number is instead reflected on the * SPACE). */ - do_now = *(COUNT) % _elem->blocklen; /* any partial elements ? */ - /* premptively update the number of COUNT we will return. */ - *(COUNT) -= cando_count; + do_now = do_now % _elem->blocklen; /* any partial elements ? */ + if( 0 != do_now ) { size_t left_in_block = do_now; /* left in the current blocklen */ do_now = (do_now > cando_count ) ? cando_count : do_now; @@ -88,6 +95,7 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, cando_count -= do_now; } + skip_prolog: /* Do as many full blocklen as possible */ for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, @@ -104,6 +112,8 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, * As an epilog do anything left from the last blocklen. */ if( 0 != cando_count ) { + + do_epilog: assert( cando_count < _elem->blocklen ); do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index 5a3679bc37f..49a418ba2b3 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -35,19 +35,24 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, size_t* SPACE ) { const ddt_elem_desc_t* _elem = &((ELEM)->elem); - size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; - size_t do_now, do_now_bytes; size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t cando_count = (*COUNT), do_now, do_now_bytes; unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; assert( *(COUNT) <= (_elem->count * _elem->blocklen)); - if( cando_count > *(COUNT) ) - cando_count = *(COUNT); + if( (blocklen_bytes * cando_count) > *(SPACE) ) + cando_count = (*SPACE) / blocklen_bytes; + do_now = *(COUNT); /* save the COUNT for later */ + /* premptively update the number of COUNT we will return. */ + *(COUNT) -= cando_count; + + if( 1 == _elem->count ) { /* Everything is contiguous, handle it as a prologue */ + goto do_epilog; + } if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ - *(COUNT) -= cando_count; for(; cando_count > 0; cando_count--) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); @@ -59,7 +64,11 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, } goto update_and_return; } + blocklen_bytes *= _elem->blocklen; + if( (_elem->count * _elem->blocklen) == cando_count ) { + goto skip_prolog; + } /** * First check if we already did something on this element ? The COUNT is the number @@ -67,9 +76,8 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, * should be manipulated in the current call (this number is instead reflected on the * SPACE). */ - do_now = *(COUNT) % _elem->blocklen; /* any partial elements ? */ - /* premptively update the number of COUNT we will return. */ - *(COUNT) -= cando_count; + do_now = do_now % _elem->blocklen; /* any partial elements ? */ + if( 0 != do_now ) { size_t left_in_block = do_now; /* left in the current blocklen */ do_now = (do_now > cando_count ) ? cando_count : do_now; @@ -88,6 +96,7 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, cando_count -= do_now; } + skip_prolog: /* Do as many full blocklen as possible */ for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, @@ -104,6 +113,8 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, * As an epilog do anything left from the last blocklen. */ if( 0 != cando_count ) { + + do_epilog: assert( cando_count < _elem->blocklen ); do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, From f78d3d52cd32846fab0cceeb624a1f51caaa9fca Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 10 Jul 2019 11:30:59 -0400 Subject: [PATCH 392/674] Optimize the pack/unpack. Start optimizing the code. This commit divides the operations in 2 parts, the first, outside the critical part, deals with partial blocks of predefined elements, and the second, inside the critical path, only deals with full blocks of elements. This reduces the number of expensive operations in the critical path and results in a decent performance increase. Signed-off-by: George Bosilca --- opal/datatype/opal_datatype_pack.c | 30 ++++-- opal/datatype/opal_datatype_pack.h | 135 ++++++++++++++++---------- opal/datatype/opal_datatype_unpack.c | 82 +++++++++------- opal/datatype/opal_datatype_unpack.h | 140 +++++++++++++++++---------- 4 files changed, 238 insertions(+), 149 deletions(-) diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index cf69f6ada22..c0ab6df66d8 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -272,18 +272,32 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; - while( 1 ) { - while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { - /* now here we have a basic datatype */ - PACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, - conv_ptr, iov_ptr, iov_len_local ); - if( 0 == count_desc ) { /* completed */ + + if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + if( (pElem->elem.count * pElem->elem.blocklen) != count_desc ) { + /* we have a partial (less than blocklen) basic datatype */ + int rc = PACK_PARTIAL_BLOCKLEN( pConvertor, pElem, count_desc, + conv_ptr, iov_ptr, iov_len_local ); + if( 0 == rc ) /* not done */ + goto complete_loop; + if( 0 == count_desc ) { conv_ptr = pConvertor->pBaseBuf + pStack->disp; pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - continue; } - goto complete_loop; + } + } + + while( 1 ) { + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + /* we have a basic datatype (working on full blocks) */ + PACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, + conv_ptr, iov_ptr, iov_len_local ); + if( 0 != count_desc ) /* completed? */ + goto complete_loop; + conv_ptr = pConvertor->pBaseBuf + pStack->disp; + pos_desc++; /* advance to the next data */ + UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "pack end_loop count %" PRIsize_t " stack_pos %d" diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 4da9bd2450e..1eaf2e8b9f9 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -26,6 +26,63 @@ CONVERTOR->cbmemcpy( (DST), (SRC), (BLENGTH), (CONVERTOR) ) #endif +/** + * This function deals only with partial elements. The COUNT points however to the whole leftover count, + * but this function is only expected to operate on an amount less than blength, that would allow the rest + * of the pack process to handle only entire blength blocks (plus the left over). + * + * Return 1 if we are now aligned on a block, 0 otherwise. + */ +static inline int +pack_partial_blocklen( opal_convertor_t* CONVERTOR, + const dt_elem_desc_t* ELEM, + size_t* COUNT, + unsigned char** memory, + unsigned char** packed, + size_t* SPACE ) +{ + const ddt_elem_desc_t* _elem = &((ELEM)->elem); + size_t do_now_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t do_now = *(COUNT); + unsigned char* _memory = (*memory) + _elem->disp; + unsigned char* _packed = *packed; + + assert( *(COUNT) <= _elem->count * _elem->blocklen); + + /** + * First check if we already did something on this element ? The COUNT is the number + * of remaining predefined types in the current elem, not how many predefined types + * should be manipulated in the current call (this number is instead reflected on the + * SPACE). + */ + if( 0 == (do_now = (*COUNT) % _elem->blocklen) ) + return 1; + + size_t left_in_block = do_now; /* left in the current blocklen */ + + if( (do_now_bytes * do_now) > *(SPACE) ) + do_now = (*SPACE) / do_now_bytes; + + do_now_bytes *= do_now; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack memcpy( %p, %p, %lu ) => space %lu [partial]\n", + _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); + *(memory) += (ptrdiff_t)do_now_bytes; + if( do_now == left_in_block ) /* compensate if completed a blocklen */ + *(memory) += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); + + *(COUNT) -= do_now; + *(SPACE) -= do_now_bytes; + *(packed) += do_now_bytes; + return (do_now == left_in_block); +} + +/** + * Pack entire blocks, plus a possible remainder if SPACE is constrained to less than COUNT elements. + */ static inline void pack_predefined_data( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, @@ -36,27 +93,24 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, { const ddt_elem_desc_t* _elem = &((ELEM)->elem); size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; - size_t cando_count = *(COUNT), do_now, do_now_bytes; + size_t cando_count = *(COUNT), do_now_bytes; unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; + assert( 0 == (cando_count % _elem->blocklen) ); /* no partials here */ assert( *(COUNT) <= _elem->count * _elem->blocklen); if( (blocklen_bytes * cando_count) > *(SPACE) ) cando_count = (*SPACE) / blocklen_bytes; - do_now = *(COUNT); /* save the COUNT for later */ /* premptively update the number of COUNT we will return. */ *(COUNT) -= cando_count; - if( 1 == _elem->count ) { /* Everything is contiguous, handle it as a prologue */ - goto do_epilog; - } if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ for(; cando_count > 0; cando_count--) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", + DO_DEBUG( opal_output( 0, "pack memcpy( %p, %p, %lu ) => space %lu [blen = 1]\n", (void*)_packed, (void*)_memory, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); MEMCPY_CSUM( _packed, _memory, blocklen_bytes, (CONVERTOR) ); _packed += blocklen_bytes; @@ -65,61 +119,32 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, goto update_and_return; } - blocklen_bytes *= _elem->blocklen; - if( (_elem->count * _elem->blocklen) == cando_count ) { - goto skip_prolog; - } - /** - * First check if we already did something on this element ? The COUNT is the number - * of remaining predefined types in the current elem, not how many predefined types - * should be manipulated in the current call (this number is instead reflected on the - * SPACE). - */ - do_now = do_now % _elem->blocklen; /* any partial elements ? */ + if( (1 < _elem->count) && (_elem->blocklen <= cando_count) ) { + blocklen_bytes *= _elem->blocklen; - if( 0 != do_now ) { - size_t left_in_block = do_now; /* left in the current blocklen */ - do_now = (do_now > cando_count ) ? cando_count : do_now; - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", - _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); - _memory += (ptrdiff_t)do_now_bytes; - /* compensate if we just completed a blocklen */ - if( do_now == left_in_block ) - _memory += _elem->extent - blocklen_bytes; - _packed += do_now_bytes; - cando_count -= do_now; - } - - skip_prolog: - /* Do as many full blocklen as possible */ - for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_packed, (void*)_memory, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); - MEMCPY_CSUM( _packed, _memory, blocklen_bytes, (CONVERTOR) ); - _packed += blocklen_bytes; - _memory += _elem->extent; - cando_count -= _elem->blocklen; + do { /* Do as many full blocklen as possible */ + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "pack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_packed, (void*)_memory, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _packed, _memory, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; + cando_count -= _elem->blocklen; + } while (_elem->blocklen <= cando_count); } /** * As an epilog do anything left from the last blocklen. */ if( 0 != cando_count ) { - - do_epilog: - assert( cando_count < _elem->blocklen ); + assert( (cando_count < _elem->blocklen) || + ((1 == _elem->count) && (cando_count <= _elem->blocklen)) ); do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack 3. memcpy( %p, %p, %lu ) => space %lu [epilog]\n", - (void*)_packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + (void*)_packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); _memory += do_now_bytes; _packed += do_now_bytes; @@ -159,7 +184,15 @@ static inline void pack_contiguous_loop( opal_convertor_t* CONVERTOR, *(COUNT) -= _copy_loops; } -#define PACK_PREDEFINED_DATATYPE( CONVERTOR, /* the convertor */ \ +#define PACK_PARTIAL_BLOCKLEN( CONVERTOR, /* the convertor */ \ + ELEM, /* the basic element to be packed */ \ + COUNT, /* the number of elements */ \ + MEMORY, /* the source pointer (char*) */ \ + PACKED, /* the destination pointer (char*) */ \ + SPACE ) /* the space in the destination buffer */ \ +pack_partial_blocklen( (CONVERTOR), (ELEM), &(COUNT), &(MEMORY), &(PACKED), &(SPACE) ) + +#define PACK_PREDEFINED_DATATYPE( CONVERTOR, /* the convertor */ \ ELEM, /* the basic element to be packed */ \ COUNT, /* the number of elements */ \ MEMORY, /* the source pointer (char*) */ \ diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index ac35a03c267..dca07796d99 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -282,6 +282,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; + if( 0 != pConvertor->partial_length ) { size_t element_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; size_t missing_length = element_length - pConvertor->partial_length; @@ -302,34 +303,31 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, iov_len_local -= missing_length; pConvertor->partial_length = 0; /* nothing more inside */ } - while( 1 ) { - while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { - /* now here we have a basic datatype */ - UNPACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, - iov_ptr, conv_ptr, iov_len_local ); - if( 0 == count_desc ) { /* completed */ + if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + if( (pElem->elem.count * pElem->elem.blocklen) != count_desc ) { + /* we have a partial (less than blocklen) basic datatype */ + int rc = UNPACK_PARTIAL_BLOCKLEN( pConvertor, pElem, count_desc, + iov_ptr, conv_ptr, iov_len_local ); + if( 0 == rc ) /* not done */ + goto complete_loop; + if( 0 == count_desc ) { conv_ptr = pConvertor->pBaseBuf + pStack->disp; pos_desc++; /* advance to the next data */ UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); - continue; - } - assert( pElem->elem.common.type < OPAL_DATATYPE_MAX_PREDEFINED ); - if( 0 != iov_len_local ) { - unsigned char* temp = conv_ptr; - /* We have some partial data here. Let's copy it into the convertor - * and keep it hot until the next round. - */ - assert( iov_len_local < opal_datatype_basicDatatypes[pElem->elem.common.type]->size ); - COMPUTE_CSUM( iov_ptr, iov_len_local, pConvertor ); - - opal_unpack_partial_datatype( pConvertor, pElem, - iov_ptr, 0, iov_len_local, - &temp ); - - pConvertor->partial_length = iov_len_local; - iov_len_local = 0; } - goto complete_loop; + } + } + + while( 1 ) { + while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { + /* we have a basic datatype (working on full blocks) */ + UNPACK_PREDEFINED_DATATYPE( pConvertor, pElem, count_desc, + iov_ptr, conv_ptr, iov_len_local ); + if( 0 != count_desc ) /* completed? */ + goto complete_loop; + conv_ptr = pConvertor->pBaseBuf + pStack->disp; + pos_desc++; /* advance to the next data */ + UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); } if( OPAL_DATATYPE_END_LOOP == pElem->elem.common.type ) { /* end of the current loop */ DO_DEBUG( opal_output( 0, "unpack end_loop count %" PRIsize_t " stack_pos %d pos_desc %d disp %ld space %lu\n", @@ -337,11 +335,9 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { - /* Do the same thing as when the loop is completed */ - iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */ - total_unpacked += iov[iov_count].iov_len; - iov_count++; /* go to the next */ - goto complete_conversion; + /* we're done. Force the exit of the main for loop (around iovec) */ + *out_size = iov_count; + goto complete_loop; } pConvertor->stack_pos--; pStack--; @@ -380,14 +376,29 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, conv_ptr = pConvertor->pBaseBuf + pStack->disp; UPDATE_INTERNAL_COUNTERS( description, pos_desc, pElem, count_desc ); DDT_DUMP_STACK( pConvertor->pStack, pConvertor->stack_pos, pElem, "advance loop" ); - continue; } } complete_loop: + assert( pElem->elem.common.type < OPAL_DATATYPE_MAX_PREDEFINED ); + if( 0 != iov_len_local ) { + unsigned char* temp = conv_ptr; + /* We have some partial data here. Let's copy it into the convertor + * and keep it hot until the next round. + */ + assert( iov_len_local < opal_datatype_basicDatatypes[pElem->elem.common.type]->size ); + COMPUTE_CSUM( iov_ptr, iov_len_local, pConvertor ); + + opal_unpack_partial_datatype( pConvertor, pElem, + iov_ptr, 0, iov_len_local, + &temp ); + + pConvertor->partial_length = iov_len_local; + iov_len_local = 0; + } + iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */ total_unpacked += iov[iov_count].iov_len; } - complete_conversion: *max_data = total_unpacked; pConvertor->bConverted += total_unpacked; /* update the already converted bytes */ *out_size = iov_count; @@ -514,11 +525,9 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, pStack->disp, (unsigned long)iov_len_local ); ); if( --(pStack->count) == 0 ) { /* end of loop */ if( 0 == pConvertor->stack_pos ) { - /* Do the same thing as when the loop is completed */ - iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */ - total_unpacked += iov[iov_count].iov_len; - iov_count++; /* go to the next */ - goto complete_conversion; + /* we're done. Force the exit of the main for loop (around iovec) */ + *out_size = iov_count; + goto complete_loop; } pConvertor->stack_pos--; pStack--; @@ -552,7 +561,6 @@ opal_unpack_general_function( opal_convertor_t* pConvertor, iov[iov_count].iov_len -= iov_len_local; /* update the amount of valid data */ total_unpacked += iov[iov_count].iov_len; } - complete_conversion: *max_data = total_unpacked; pConvertor->bConverted += total_unpacked; /* update the already converted bytes */ *out_size = iov_count; diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index 49a418ba2b3..db5b58fd3c3 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -26,6 +26,60 @@ CONVERTOR->cbmemcpy( (DST), (SRC), (BLENGTH), (CONVERTOR) ) #endif +/** + * This function deals only with partial elements. The COUNT points however to the whole leftover count, + * but this function is only expected to operate on an amount less than blength, that would allow the rest + * of the pack process to handle only entire blength blocks (plus the left over). + * + * Return 1 if we are now aligned on a block, 0 otherwise. + */ +static inline int +unpack_partial_blocklen( opal_convertor_t* CONVERTOR, + const dt_elem_desc_t* ELEM, + size_t* COUNT, + unsigned char** packed, + unsigned char** memory, + size_t* SPACE ) +{ + const ddt_elem_desc_t* _elem = &((ELEM)->elem); + size_t do_now_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; + size_t do_now = (*COUNT); + unsigned char* _memory = (*memory) + _elem->disp; + unsigned char* _packed = *packed; + + assert( *(COUNT) <= (_elem->count * _elem->blocklen)); + + /** + * First check if we already did something on this element ? The COUNT is the number + * of remaining predefined types in the current elem, not how many predefined types + * should be manipulated in the current call (this number is instead reflected on the + * SPACE). + */ + if( 0 == (do_now = (*COUNT) % _elem->blocklen) ) + return 1; + + size_t left_in_block = do_now; /* left in the current blocklen */ + + if( (do_now_bytes * do_now) > *(SPACE) ) + do_now = (*SPACE) / do_now_bytes; + + do_now_bytes *= do_now; + + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack memcpy( %p, %p, %lu ) => space %lu [prolog]\n", + (void*)_memory, (void*)_packed, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + MEMCPY_CSUM( _memory, _packed, do_now_bytes, (CONVERTOR) ); + *(memory) += (ptrdiff_t)do_now_bytes; + if( do_now == left_in_block ) /* compensate if completed a blocklen */ + *(memory) += _elem->extent - (_elem->blocklen * opal_datatype_basicDatatypes[_elem->common.type]->size); + + *(COUNT) -= do_now; + *(SPACE) -= do_now_bytes; + *(packed) += do_now_bytes; + return (do_now == left_in_block); +} + static inline void unpack_predefined_data( opal_convertor_t* CONVERTOR, const dt_elem_desc_t* ELEM, @@ -36,27 +90,24 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, { const ddt_elem_desc_t* _elem = &((ELEM)->elem); size_t blocklen_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; - size_t cando_count = (*COUNT), do_now, do_now_bytes; + size_t cando_count = (*COUNT), do_now_bytes; unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; + assert( 0 == (cando_count % _elem->blocklen) ); /* no partials here */ assert( *(COUNT) <= (_elem->count * _elem->blocklen)); if( (blocklen_bytes * cando_count) > *(SPACE) ) cando_count = (*SPACE) / blocklen_bytes; - do_now = *(COUNT); /* save the COUNT for later */ /* premptively update the number of COUNT we will return. */ *(COUNT) -= cando_count; - - if( 1 == _elem->count ) { /* Everything is contiguous, handle it as a prologue */ - goto do_epilog; - } + if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ for(; cando_count > 0; cando_count--) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", + DO_DEBUG( opal_output( 0, "unpack memcpy( %p, %p, %lu ) => space %lu [blen = 1]\n", (void*)_memory, (void*)_packed, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); MEMCPY_CSUM( _memory, _packed, blocklen_bytes, (CONVERTOR) ); _packed += blocklen_bytes; @@ -65,57 +116,27 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, goto update_and_return; } - blocklen_bytes *= _elem->blocklen; - if( (_elem->count * _elem->blocklen) == cando_count ) { - goto skip_prolog; - } - - /** - * First check if we already did something on this element ? The COUNT is the number - * of remaining predefined types in the current elem, not how many predefined types - * should be manipulated in the current call (this number is instead reflected on the - * SPACE). - */ - do_now = do_now % _elem->blocklen; /* any partial elements ? */ - - if( 0 != do_now ) { - size_t left_in_block = do_now; /* left in the current blocklen */ - do_now = (do_now > cando_count ) ? cando_count : do_now; - do_now_bytes = do_now * opal_datatype_basicDatatypes[_elem->common.type]->size; - - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 1. memcpy( %p, %p, %lu ) => space %lu [prolog]\n", - (void*)_memory, (void*)_packed, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); - MEMCPY_CSUM( _memory, _packed, do_now_bytes, (CONVERTOR) ); - _memory += (ptrdiff_t)do_now_bytes; - /* compensate if we just completed a blocklen */ - if( do_now == left_in_block ) - _memory += _elem->extent - blocklen_bytes; - _packed += do_now_bytes; - cando_count -= do_now; - } + if( (1 < _elem->count) && (_elem->blocklen <= cando_count) ) { + blocklen_bytes *= _elem->blocklen; - skip_prolog: - /* Do as many full blocklen as possible */ - for(size_t _i = 0; _elem->blocklen <= cando_count; _i++ ) { - OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, - (CONVERTOR)->pDesc, (CONVERTOR)->count ); - DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", - (void*)_memory, (void*)_packed, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); - MEMCPY_CSUM( _memory, _packed, blocklen_bytes, (CONVERTOR) ); - _packed += blocklen_bytes; - _memory += _elem->extent; - cando_count -= _elem->blocklen; + do { /* Do as many full blocklen as possible */ + OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, + (CONVERTOR)->pDesc, (CONVERTOR)->count ); + DO_DEBUG( opal_output( 0, "unpack 2. memcpy( %p, %p, %lu ) => space %lu\n", + (void*)_memory, (void*)_packed, (unsigned long)blocklen_bytes, (unsigned long)(*(SPACE) - (_packed - *(packed))) ); ); + MEMCPY_CSUM( _memory, _packed, blocklen_bytes, (CONVERTOR) ); + _packed += blocklen_bytes; + _memory += _elem->extent; + cando_count -= _elem->blocklen; + } while (_elem->blocklen <= cando_count); } /** * As an epilog do anything left from the last blocklen. */ if( 0 != cando_count ) { - - do_epilog: - assert( cando_count < _elem->blocklen ); + assert( (cando_count < _elem->blocklen) || + ((1 == _elem->count) && (cando_count <= _elem->blocklen)) ); do_now_bytes = cando_count * opal_datatype_basicDatatypes[_elem->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); @@ -160,8 +181,21 @@ static inline void unpack_contiguous_loop( opal_convertor_t* CONVERTOR, *(COUNT) -= _copy_loops; } -#define UNPACK_PREDEFINED_DATATYPE( CONVERTOR, ELEM, COUNT, PACKED, MEMORY, SPACE ) \ - unpack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) +#define UNPACK_PARTIAL_BLOCKLEN( CONVERTOR, /* the convertor */ \ + ELEM, /* the basic element to be packed */ \ + COUNT, /* the number of elements */ \ + PACKED, /* the destination pointer (char*) */ \ + MEMORY, /* the source pointer (char*) */ \ + SPACE ) /* the space in the destination buffer */ \ +unpack_partial_blocklen( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) + +#define UNPACK_PREDEFINED_DATATYPE( CONVERTOR, /* the convertor */ \ + ELEM, /* the basic element to be packed */ \ + COUNT, /* the number of elements */ \ + PACKED, /* the destination pointer (char*) */ \ + MEMORY, /* the source pointer (char*) */ \ + SPACE ) /* the space in the destination buffer */ \ +unpack_predefined_data( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) #define UNPACK_CONTIGUOUS_LOOP( CONVERTOR, ELEM, COUNT, PACKED, MEMORY, SPACE ) \ unpack_contiguous_loop( (CONVERTOR), (ELEM), &(COUNT), &(PACKED), &(MEMORY), &(SPACE) ) From 9898332ae0bc7e61ce88353ec4d08faf7a98bcd3 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 6 Aug 2019 07:48:58 -0700 Subject: [PATCH 393/674] Allow individual jobs to set their map/rank/bind policies Override the defaults when provided. Ignore LSF binding file if user overrides by specifying a policy. Fixes #6631 Signed-off-by: Ralph Castain (cherry picked from commit ea0dfc321809db50f78e742da1d22f9ef59650a3) --- orte/mca/ras/lsf/ras_lsf_module.c | 16 ++++++++++++++-- orte/mca/rmaps/base/rmaps_base_frame.c | 1 + orte/orted/pmix/pmix_server_dyn.c | 21 --------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/orte/mca/ras/lsf/ras_lsf_module.c b/orte/mca/ras/lsf/ras_lsf_module.c index becec82f213..43b3c7e7571 100644 --- a/orte/mca/ras/lsf/ras_lsf_module.c +++ b/orte/mca/ras/lsf/ras_lsf_module.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2014 Intel, Inc. All rights reserved + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -70,6 +70,7 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes) char *affinity_file; struct stat buf; char *ptr; + bool directives_given = false; /* get the list of allocated nodes */ if ((num_nodes = lsb_getalloc(&nodelist)) < 0) { @@ -112,8 +113,19 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes) /* release the nodelist from lsf */ opal_argv_free(nodelist); + /* check to see if any mapping or binding directives were given */ + if (NULL != jdata && NULL != jdata->map) { + if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(jdata->map->mapping)) || + OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) { + directives_given = true; + } + } else if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) || + OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy) { + directives_given = true; + } + /* check for an affinity file */ - if (NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) { + if (!directives_given && NULL != (affinity_file = getenv("LSB_AFFINITY_HOSTFILE"))) { /* check to see if the file is empty - if it is, * then affinity wasn't actually set for this job */ if (0 != stat(affinity_file, &buf)) { diff --git a/orte/mca/rmaps/base/rmaps_base_frame.c b/orte/mca/rmaps/base/rmaps_base_frame.c index befb9fd5fe5..bca9a6d8693 100644 --- a/orte/mca/rmaps/base/rmaps_base_frame.c +++ b/orte/mca/rmaps/base/rmaps_base_frame.c @@ -556,6 +556,7 @@ static int check_modifiers(char *ck, orte_mapping_policy_t *tmp) for (i=0; NULL != ck2[i]; i++) { if (0 == strncasecmp(ck2[i], "span", strlen(ck2[i]))) { ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_SPAN); + ORTE_SET_MAPPING_DIRECTIVE(*tmp, ORTE_MAPPING_GIVEN); found = true; } else if (0 == strncasecmp(ck2[i], "pe", strlen("pe"))) { /* break this at the = sign to get the number */ diff --git a/orte/orted/pmix/pmix_server_dyn.c b/orte/orted/pmix/pmix_server_dyn.c index 4a8bf3ee8d2..c3ab28f7ae8 100644 --- a/orte/orted/pmix/pmix_server_dyn.c +++ b/orte/orted/pmix/pmix_server_dyn.c @@ -302,13 +302,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor, /*** MAP-BY ***/ } else if (0 == strcmp(info->key, OPAL_PMIX_MAPBY)) { - if (ORTE_MAPPING_POLICY_IS_SET(jdata->map->mapping)) { - /* not allowed to provide multiple mapping policies */ - orte_show_help("help-orte-rmaps-base.txt", "redefining-policy", - true, "mapping", info->data.string, - orte_rmaps_base_print_mapping(orte_rmaps_base.mapping)); - return ORTE_ERR_BAD_PARAM; - } rc = orte_rmaps_base_set_mapping_policy(jdata, &jdata->map->mapping, NULL, info->data.string); if (ORTE_SUCCESS != rc) { @@ -317,13 +310,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor, /*** RANK-BY ***/ } else if (0 == strcmp(info->key, OPAL_PMIX_RANKBY)) { - if (ORTE_RANKING_POLICY_IS_SET(jdata->map->ranking)) { - /* not allowed to provide multiple ranking policies */ - orte_show_help("help-orte-rmaps-base.txt", "redefining-policy", - true, "ranking", info->data.string, - orte_rmaps_base_print_ranking(orte_rmaps_base.ranking)); - return ORTE_ERR_BAD_PARAM; - } rc = orte_rmaps_base_set_ranking_policy(&jdata->map->ranking, jdata->map->mapping, info->data.string); @@ -333,13 +319,6 @@ int pmix_server_spawn_fn(opal_process_name_t *requestor, /*** BIND-TO ***/ } else if (0 == strcmp(info->key, OPAL_PMIX_BINDTO)) { - if (OPAL_BINDING_POLICY_IS_SET(jdata->map->binding)) { - /* not allowed to provide multiple mapping policies */ - orte_show_help("help-opal-hwloc-base.txt", "redefining-policy", true, - info->data.string, - opal_hwloc_base_print_binding(opal_hwloc_binding_policy)); - return ORTE_ERR_BAD_PARAM; - } rc = opal_hwloc_base_set_binding_policy(&jdata->map->binding, info->data.string); if (ORTE_SUCCESS != rc) { From f0f25b60a8c4b0341f5e5dc8400585c37288ec24 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 7 Aug 2019 05:47:12 -0700 Subject: [PATCH 394/674] Fix typos Provide a missing header and paren Thanks to @zerothi for the assistance Signed-off-by: Ralph Castain (cherry picked from commit bd5a1765eea200651babc5bfd9f45a9f3cedefbc) --- orte/mca/ras/lsf/ras_lsf_module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orte/mca/ras/lsf/ras_lsf_module.c b/orte/mca/ras/lsf/ras_lsf_module.c index 43b3c7e7571..6dd3b68be5f 100644 --- a/orte/mca/ras/lsf/ras_lsf_module.c +++ b/orte/mca/ras/lsf/ras_lsf_module.c @@ -36,6 +36,7 @@ #include "orte/mca/rmaps/rmaps_types.h" #include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/rmaps/base/base.h" #include "orte/runtime/orte_globals.h" #include "orte/util/show_help.h" @@ -120,7 +121,7 @@ static int allocate(orte_job_t *jdata, opal_list_t *nodes) directives_given = true; } } else if ((ORTE_MAPPING_GIVEN & ORTE_GET_MAPPING_DIRECTIVE(orte_rmaps_base.mapping)) || - OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy) { + OPAL_BINDING_POLICY_IS_SET(opal_hwloc_binding_policy)) { directives_given = true; } From 2fa112c0a6163c2689976d1f831efbd417fffeb5 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 5 Aug 2019 18:05:01 +0300 Subject: [PATCH 395/674] UCX: added PPN hint for UCX context - added PPN hint for UCX context init Signed-off-by: Sergey Oblomov (cherry picked from commit 43186e494b47ca29e8d5e7a864b6b98b8e873195) Conflicts: opal/mca/common/ucx/common_ucx_wpool.c --- config/ompi_check_ucx.m4 | 3 ++- ompi/mca/pml/ucx/pml_ucx.c | 29 ++++++++++++++---------- oshmem/mca/spml/ucx/spml_ucx_component.c | 13 +++++++++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 42e53f9ce80..7f04ba3a52c 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -120,7 +120,8 @@ AC_DEFUN([OMPI_CHECK_UCX],[ UCP_ATOMIC_POST_OP_XOR, UCP_ATOMIC_FETCH_OP_FAND, UCP_ATOMIC_FETCH_OP_FOR, - UCP_ATOMIC_FETCH_OP_FXOR], + UCP_ATOMIC_FETCH_OP_FXOR, + UCP_PARAM_FIELD_ESTIMATED_NUM_PPN], [], [], [#include ]) AC_CHECK_DECLS([UCP_WORKER_ATTR_FIELD_ADDRESS_FLAGS], diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index ffb7d618343..fb7b7f84615 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -197,22 +197,27 @@ int mca_pml_ucx_open(void) } /* Initialize UCX context */ - params.field_mask = UCP_PARAM_FIELD_FEATURES | - UCP_PARAM_FIELD_REQUEST_SIZE | - UCP_PARAM_FIELD_REQUEST_INIT | - UCP_PARAM_FIELD_REQUEST_CLEANUP | - UCP_PARAM_FIELD_TAG_SENDER_MASK | - UCP_PARAM_FIELD_MT_WORKERS_SHARED | - UCP_PARAM_FIELD_ESTIMATED_NUM_EPS; - params.features = UCP_FEATURE_TAG; - params.request_size = sizeof(ompi_request_t); - params.request_init = mca_pml_ucx_request_init; - params.request_cleanup = mca_pml_ucx_request_cleanup; - params.tag_sender_mask = PML_UCX_SPECIFIC_SOURCE_MASK; + params.field_mask = UCP_PARAM_FIELD_FEATURES | + UCP_PARAM_FIELD_REQUEST_SIZE | + UCP_PARAM_FIELD_REQUEST_INIT | + UCP_PARAM_FIELD_REQUEST_CLEANUP | + UCP_PARAM_FIELD_TAG_SENDER_MASK | + UCP_PARAM_FIELD_MT_WORKERS_SHARED | + UCP_PARAM_FIELD_ESTIMATED_NUM_EPS; + params.features = UCP_FEATURE_TAG; + params.request_size = sizeof(ompi_request_t); + params.request_init = mca_pml_ucx_request_init; + params.request_cleanup = mca_pml_ucx_request_cleanup; + params.tag_sender_mask = PML_UCX_SPECIFIC_SOURCE_MASK; params.mt_workers_shared = 0; /* we do not need mt support for context since it will be protected by worker */ params.estimated_num_eps = ompi_proc_world_size(); +#if HAVE_DECL_UCP_PARAM_FIELD_ESTIMATED_NUM_PPN + params.estimated_num_ppn = opal_process_info.num_local_peers + 1; + params.field_mask |= UCP_PARAM_FIELD_ESTIMATED_NUM_PPN; +#endif + status = ucp_init(¶ms, config, &ompi_pml_ucx.ucp_context); ucp_config_release(config); diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 0f0ce2a15a3..3d29bd4e5d8 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -212,8 +212,12 @@ static int spml_ucx_init(void) opal_common_ucx_mca_register(); memset(¶ms, 0, sizeof(params)); - params.field_mask = UCP_PARAM_FIELD_FEATURES|UCP_PARAM_FIELD_ESTIMATED_NUM_EPS|UCP_PARAM_FIELD_MT_WORKERS_SHARED; - params.features = UCP_FEATURE_RMA|UCP_FEATURE_AMO32|UCP_FEATURE_AMO64; + params.field_mask = UCP_PARAM_FIELD_FEATURES | + UCP_PARAM_FIELD_ESTIMATED_NUM_EPS | + UCP_PARAM_FIELD_MT_WORKERS_SHARED; + params.features = UCP_FEATURE_RMA | + UCP_FEATURE_AMO32 | + UCP_FEATURE_AMO64; params.estimated_num_eps = ompi_proc_world_size(); if (oshmem_mpi_thread_requested == SHMEM_THREAD_MULTIPLE) { params.mt_workers_shared = 1; @@ -221,6 +225,11 @@ static int spml_ucx_init(void) params.mt_workers_shared = 0; } +#if HAVE_DECL_UCP_PARAM_FIELD_ESTIMATED_NUM_PPN + params.estimated_num_ppn = opal_process_info.num_local_peers + 1; + params.field_mask |= UCP_PARAM_FIELD_ESTIMATED_NUM_PPN; +#endif + err = ucp_init(¶ms, ucp_config, &mca_spml_ucx.ucp_context); ucp_config_release(ucp_config); if (UCS_OK != err) { From 167ca31a311f6542a06011d25dba60e10d4114b2 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 9 Aug 2019 13:13:45 -0700 Subject: [PATCH 396/674] Update PMIx to official v3.1.4 release Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/NEWS | 61 + opal/mca/pmix/pmix3x/pmix/VERSION | 12 +- .../pmix3x/pmix/config/c_get_alignment.m4 | 8 +- opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 16 +- .../config/pmix_check_compiler_version.m4 | 7 +- .../pmix/pmix3x/pmix/config/pmix_check_icc.m4 | 7 +- .../pmix3x/pmix/config/pmix_setup_libev.m4 | 96 ++ .../pmix3x/pmix/config/pmix_setup_libevent.m4 | 197 +-- opal/mca/pmix/pmix3x/pmix/configure.ac | 1 - opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- opal/mca/pmix/pmix3x/pmix/examples/client.c | 3 + opal/mca/pmix/pmix3x/pmix/examples/dynamic.c | 82 +- opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c | 20 +- .../pmix/pmix3x/pmix/src/client/pmix_client.c | 4 +- .../pmix/src/client/pmix_client_fence.c | 18 +- .../pmix3x/pmix/src/client/pmix_client_get.c | 95 +- .../pmix/pmix3x/pmix/src/common/pmix_log.c | 14 +- .../pmix/pmix3x/pmix/src/common/pmix_query.c | 44 +- .../pmix/src/event/pmix_event_notification.c | 2 +- .../pmix3x/pmix/src/include/pmix_globals.c | 31 + .../pmix3x/pmix/src/include/pmix_globals.h | 13 + opal/mca/pmix/pmix3x/pmix/src/include/types.h | 60 +- .../mca/base/pmix_mca_base_component_find.c | 6 +- .../pmix/src/mca/base/pmix_mca_base_open.c | 6 +- .../pmix3x/pmix/src/mca/bfrops/v20/copy.c | 26 +- .../src/mca/common/dstore/dstore_segment.c | 9 +- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.c | 1181 +++++++++++++++-- .../pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c | 4 +- .../src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c | 4 +- .../src/mca/pif/linux_ipv6/pif_linux_ipv6.c | 17 +- opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h | 4 +- .../mca/pif/solaris_ipv6/pif_solaris_ipv6.c | 4 +- .../pmix/src/mca/plog/base/plog_base_stubs.c | 12 +- .../pmix/src/mca/plog/stdfd/plog_stdfd.c | 6 +- .../pmix/src/mca/pnet/base/pnet_base_fns.c | 14 +- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c | 4 +- .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c | 11 +- .../pmix/src/mca/pshmem/mmap/pshmem_mmap.c | 6 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 6 +- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 28 +- .../pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c | 4 +- .../src/mca/ptl/usock/ptl_usock_component.c | 2 +- .../pmix3x/pmix/src/runtime/pmix_finalize.c | 8 +- .../pmix/pmix3x/pmix/src/runtime/pmix_init.c | 10 +- .../pmix/src/runtime/pmix_progress_threads.c | 148 ++- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 35 +- .../pmix3x/pmix/src/server/pmix_server_get.c | 83 +- .../pmix3x/pmix/src/server/pmix_server_ops.c | 32 +- .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 9 +- opal/mca/pmix/pmix3x/pmix/src/util/compress.c | 10 +- opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c | 46 +- opal/mca/pmix/pmix3x/pmix/src/util/output.c | 6 +- opal/mca/pmix/pmix3x/pmix/src/util/pif.h | 6 +- .../pmix/pmix3x/pmix/src/util/pmix_environ.c | 78 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.c | 16 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.h | 4 +- opal/mca/pmix/pmix3x/pmix/test/pmi_client.c | 59 +- .../pmix/pmix3x/pmix/test/simple/Makefile.am | 4 +- .../mca/pmix/pmix3x/pmix/test/simple/gwtest.c | 10 +- .../pmix3x/pmix/test/simple/quietclient.c | 117 +- .../pmix/pmix3x/pmix/test/simple/simpclient.c | 126 +- .../pmix/pmix3x/pmix/test/simple/simpdie.c | 11 +- .../pmix/pmix3x/pmix/test/simple/simpdmodex.c | 78 +- .../pmix/pmix3x/pmix/test/simple/simpdyn.c | 37 +- .../mca/pmix/pmix3x/pmix/test/simple/simpft.c | 11 +- .../pmix/pmix3x/pmix/test/simple/simpjctrl.c | 13 +- .../pmix/pmix3x/pmix/test/simple/simplegacy.c | 248 +--- .../pmix/pmix3x/pmix/test/simple/simppub.c | 11 +- .../pmix/pmix3x/pmix/test/simple/simptest.c | 266 +++- .../pmix3x/pmix/test/simple/simptimeout.c | 10 +- .../pmix/pmix3x/pmix/test/simple/stability.c | 337 ++++- opal/mca/pmix/pmix3x/pmix/test/test_common.h | 6 +- opal/mca/pmix/pmix3x/pmix/test/test_error.c | 6 +- opal/mca/pmix/pmix3x/pmix/test/test_server.c | 36 +- 74 files changed, 2970 insertions(+), 1054 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index 6445b18275d..f18016dd7f2 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -21,6 +21,28 @@ example, a bug might be fixed in the master, and then moved to multiple release branches. +3.1.4 -- 9 Aug 2019 +---------------------- +- PR #1342: Fix if_linux_ipv6_open interface filter +- PR #1344: Remove unnecessary libtool init for c++ +- PR #1346: Fix incorrect pointer casts/deref +- PR #1347/#1348: Fix use of gethostname +- PR #1353/#1357: util/environ: use setenv() if available +- PR #1354: Plug a misc memory leak in the pmix_query_caddy_t destructor +- PR #1356: Fix another pointer cast/deref in test suite +- PR #1358: Implement support for class-based info arrays +- PR #1359: Plug misc minor memory leaks +- PR #1368: Backport support for libev +- PR #1369: Fix legacy support for PMI-1 +- PR #1370: Cleanup handling of data requests for different nspaces +- PR #1193: Resolve get of proc-specific job-level info from another nspace +- PR #1376: Fix problems in the Log code path, updates to simple test suite +- PR #1377: Skip fastpath/dstore for NULL keys +- PR #1379: Change IF_NAMESIZE to PMIX_IF_NAMESIZE and set to safe size +- PR #1385: Check for EINVAL return from posix_fallocate +- PR #1389: Plug misc memory leaks in configure + + 3.1.3 -- 2 July 2019 ---------------------- - PR #1096: Restore PMIX_NUM_SLOTS for backward compatibility @@ -120,6 +142,45 @@ multiple release branches. - Fix a bug when registering default event handlers +3.1.0 -- 17 Jan 2019 +---------------------- +**** THIS RELEASE MARKS THE STARTING POINT FOR FULL COMPLIANCE +**** WITH THE PMIX v3 STANDARD. ALL API BEHAVIORS AND ATTRIBUTE +**** DEFINITIONS MEET THE v3 STANDARD SPECIFICATIONS. + - Add a new, faster dstore GDS component 'ds21' + - Performance optimizations for the dstore GDS components. + - Plug miscellaneous memory leaks + - Silence an unnecessary warning message when checking connection + to a non-supporting server + - Ensure lost-connection events get delivered to default event + handlers + - Correctly handle cache refresh for queries + - Protect against race conditions between host and internal library + when dealing with async requests + - Cleanup tool operations and add support for connections to + remote servers. Initial support for debugger direct/indirect + launch verified with PRRTE. Cleanup setting of tmpdir options. + Drop rendezvous files when acting as a launcher + - Automatically store the server URI for easy access by client + - Provide MCA parameter to control TCP connect retry/timeout + - Update event notification system to properly evict oldest events + when more space is needed + - Fix a number of error paths + - Update IOF cache code to properly drop oldest message. Provide + MCA parameter for setting cache size. + - Handle setsockopt(SO_RCVTIMEO) not being supported + - Ensure that epilogs get run even when connections unexpectedly + terminate. Properly split epilog strings to process multiple + paths + - Pass the tool's command line to the server so it can be returned + in queries + - Add support for C11 atomics + - Support collection and forwarding of fabric-specific envars + - Improve handling of hwloc configure option + - Fix PMIx_server_generate_regex to preserve node ordering + - Fix a bug when registering default event handlers + + 3.0.2 -- 18 Sept 2018 ---------------------- - Ensure we cleanup any active sensors when a peer departs. Allow the diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index 13511b92a55..8d2b40af3ea 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -15,7 +15,7 @@ major=3 minor=1 -release=3 +release=4 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -30,7 +30,7 @@ greek= # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gitc10fd1d4 +repo_rev=gite6837057 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +44,7 @@ tarball_version= # The date when this release was created -date="Jul 02, 2019" +date="Aug 09, 2019" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,8 +75,8 @@ date="Jul 02, 2019" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:23:2 -libpmi_so_version=1:0:0 +libpmix_so_version=4:24:2 +libpmi_so_version=1:1:0 libpmi2_so_version=1:0:0 # "Common" components install standalone libraries that are run-time @@ -84,4 +84,4 @@ libpmi2_so_version=1:0:0 # # well. Yuck; this somewhat breaks the # # components-don't-affect-the-build-system abstraction. # -libmca_common_dstore_so_version=1:0:0 +libmca_common_dstore_so_version=1:1:0 diff --git a/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 b/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 index db379100994..6596c0ae88d 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 @@ -11,9 +11,9 @@ 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) 2009 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved. -dnl Copyright (c) 2015 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2015-2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -44,7 +44,9 @@ AC_DEFUN([PMIX_C_GET_ALIGNMENT],[ FILE *f=fopen("conftestval", "w"); if (!f) exit(1); diff = ((char *)&p->x) - ((char *)&p->c); + free(p); fprintf(f, "%d\n", (diff >= 0) ? diff : -diff); + fclose(f); ]])], [AS_TR_SH([pmix_cv_c_align_$1])=`cat conftestval`], [AC_MSG_WARN([*** Problem running configure test!]) AC_MSG_WARN([*** See config.log for details.]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index e0585256c49..1d37089f8ae 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -663,7 +663,7 @@ AC_DEFUN([PMIX_SETUP_CORE],[ # -lrt might be needed for clock_gettime PMIX_SEARCH_LIBS_CORE([clock_gettime], [rt]) - AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp]) + AC_CHECK_FUNCS([asprintf snprintf vasprintf vsnprintf strsignal socketpair strncpy_s usleep statfs statvfs getpeereid getpeerucred strnlen posix_fallocate tcgetpgrp setpgid ptsname openpty setenv]) # On some hosts, htonl is a define, so the AC_CHECK_FUNC will get # confused. On others, it's in the standard library, but stubbed with @@ -754,8 +754,22 @@ AC_DEFUN([PMIX_SETUP_CORE],[ ################################## pmix_show_title "Libevent" + PMIX_LIBEV_CONFIG PMIX_LIBEVENT_CONFIG + AS_IF([test $pmix_libevent_support -eq 1 && test $pmix_libev_support -eq 1], + [AC_MSG_WARN([Both libevent and libev support have been specified.]) + AC_MSG_WARN([Only one can be configured against at a time. Please]) + AC_MSG_WARN([remove one from the configure command line.]) + AC_MSG_ERROR([Cannot continue])]) + + AS_IF([test $pmix_libevent_support -eq 0 && test $pmix_libev_support -eq 0], + [AC_MSG_WARN([Either libevent or libev support is required, but neither]) + AC_MSG_WARN([was found. Please use the configure options to point us]) + AC_MSG_WARN([to where we can find one or the other library]) + AC_MSG_ERROR([Cannot continue])]) + + ################################## # HWLOC ################################## diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 index eca2013be82..da822b04810 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 @@ -1,7 +1,9 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl dnl $COPYRIGHT$ dnl @@ -43,6 +45,7 @@ int main (int argc, char * argv[]) f=fopen("conftestval", "w"); if (!f) exit(1); fprintf (f, "%d", PLATFORM_COMPILER_$1); + fclose(f); return 0; } ], [ @@ -75,6 +78,7 @@ int main (int argc, char * argv[]) f=fopen("conftestval", "w"); if (!f) exit(1); fprintf (f, "%s", PLATFORM_COMPILER_$1); + fclose(f); return 0; } ], [ @@ -110,6 +114,7 @@ int main (int argc, char * argv[]) f=fopen("conftestval", "w"); if (!f) exit(1); fprintf (f, "%s", _STRINGIFY(PLATFORM_COMPILER_$1)); + fclose(f); return 0; } ], [ diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 index e8a06b25148..05ce9431bd3 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 @@ -10,9 +10,9 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 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) 2014 Intel, Inc. All rights reserved. -dnl Copyright (c) 2016 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2016-2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -45,6 +45,7 @@ int main () func (4711, "Help %d [%s]\n", 10, "ten"); f=fopen ("conftestval", "w"); if (!f) exit (1); + fclose(f); return 0; } diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 new file mode 100644 index 00000000000..494cc2a2c39 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libev.m4 @@ -0,0 +1,96 @@ +# -*- shell-script -*- +# +# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_libev_CONFIG([action-if-found], [action-if-not-found]) +# -------------------------------------------------------------------- +AC_DEFUN([PMIX_LIBEV_CONFIG],[ + PMIX_VAR_SCOPE_PUSH([pmix_libev_dir pmix_libev_libdir pmix_libev_standard_header_location pmix_libev_standard_lib_location]) + + AC_ARG_WITH([libev], + [AC_HELP_STRING([--with-libev=DIR], + [Search for libev headers and libraries in DIR ])]) + PMIX_CHECK_WITHDIR([libev], [$with_libev], [include/event.h]) + + AC_ARG_WITH([libev-libdir], + [AC_HELP_STRING([--with-libev-libdir=DIR], + [Search for libev libraries in DIR ])]) + PMIX_CHECK_WITHDIR([libev-libdir], [$with_livev_libdir], [libev.*]) + + pmix_libev_support=0 + + AS_IF([test -n "$with_libev" && test "$with_libev" != "no"], + [AC_MSG_CHECKING([for libev in]) + pmix_check_libev_save_CPPFLAGS="$CPPFLAGS" + pmix_check_libeve_save_LDFLAGS="$LDFLAGS" + pmix_check_libev_save_LIBS="$LIBS" + if test "$with_libev" != "yes"; then + pmix_libev_dir=$with_libev/include + pmix_libev_standard_header_location=no + pmix_libev_standard_lib_location=no + AS_IF([test -z "$with_libev_libdir" || test "$with_libev_libdir" = "yes"], + [if test -d $with_libev/lib; then + pmix_libev_libdir=$with_libev/lib + elif test -d $with_libev/lib64; then + pmix_libev_libdir=$with_libev/lib64 + else + AC_MSG_RESULT([Could not find $with_libev/lib or $with_libev/lib64]) + AC_MSG_ERROR([Can not continue]) + fi + AC_MSG_RESULT([$pmix_libev_dir and $pmix_libev_libdir])], + [AC_MSG_RESULT([$with_libev_libdir])]) + else + AC_MSG_RESULT([(default search paths)]) + pmix_libev_standard_header_location=yes + pmix_libev_standard_lib_location=yes + fi + AS_IF([test ! -z "$with_libev_libdir" && test "$with_libev_libdir" != "yes"], + [pmix_libev_libdir="$with_libev_libdir" + pmix_libev_standard_lib_location=no]) + + PMIX_CHECK_PACKAGE([pmix_libev], + [event.h], + [ev], + [event_base_new], + [], + [$pmix_libev_dir], + [$pmix_libev_libdir], + [pmix_libev_support=1], + [pmix_libev_support=0]) + CPPFLAGS="$pmix_check_libev_save_CPPFLAGS" + LDFLAGS="$pmix_check_libev_save_LDFLAGS" + LIBS="$pmix_check_libev_save_LIBS"]) + + AS_IF([test $pmix_libev_support -eq 1], + [LIBS="$LIBS $pmix_libev_LIBS" + + AS_IF([test "$pmix_libev_standard_header_location" != "yes"], + [CPPFLAGS="$CPPFLAGS $pmix_libev_CPPFLAGS"]) + AS_IF([test "$pmix_libev_standard_lib_location" != "yes"], + [LDFLAGS="$LDFLAGS $pmix_libev_LDFLAGS"])]) + + AC_MSG_CHECKING([will libev support be built]) + if test $pmix_libev_support -eq 1; then + AC_MSG_RESULT([yes]) + PMIX_EVENT_HEADER="" + AC_DEFINE_UNQUOTED([PMIX_EVENT_HEADER], [$PMIX_EVENT_HEADER], + [Location of event.h]) + PMIX_SUMMARY_ADD([[External Packages]],[[libev]],[libev],[$pmix_libev_dir]) + else + AC_MSG_RESULT([no]) + fi + + AC_DEFINE_UNQUOTED([PMIX_HAVE_LIBEV], [$pmix_libev_support], [Whether we are building against libev]) + + PMIX_VAR_SCOPE_POP +])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 index 949af1cfd58..28e3a412273 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_setup_libevent.m4 @@ -3,8 +3,8 @@ # Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved. # Copyright (c) 2013-2019 Intel, Inc. All rights reserved. -# Copyright (c) 2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -19,20 +19,25 @@ AC_DEFUN([PMIX_LIBEVENT_CONFIG],[ [AC_HELP_STRING([--with-libevent-header=HEADER], [The value that should be included in C files to include event.h])]) + pmix_libevent_support=0 + AS_IF([test "$pmix_mode" = "embedded"], [_PMIX_LIBEVENT_EMBEDDED_MODE], - [_PMIX_LIBEVENT_EXTERNAL]) - - AC_MSG_CHECKING([libevent header]) - AC_DEFINE_UNQUOTED([PMIX_EVENT_HEADER], [$PMIX_EVENT_HEADER], - [Location of event.h]) - AC_MSG_RESULT([$PMIX_EVENT_HEADER]) - AC_MSG_CHECKING([libevent2/thread header]) - AC_DEFINE_UNQUOTED([PMIX_EVENT2_THREAD_HEADER], [$PMIX_EVENT2_THREAD_HEADER], - [Location of event2/thread.h]) - AC_MSG_RESULT([$PMIX_EVENT2_THREAD_HEADER]) - - PMIX_SUMMARY_ADD([[External Packages]],[[Libevent]], [pmix_libevent], [yes ($pmix_libevent_source)]) + [AS_IF([test $pmix_libev_support -eq 0], + [_PMIX_LIBEVENT_EXTERNAL])]) + + if test $pmix_libevent_support -eq 1; then + AC_MSG_CHECKING([libevent header]) + AC_DEFINE_UNQUOTED([PMIX_EVENT_HEADER], [$PMIX_EVENT_HEADER], + [Location of event.h]) + AC_MSG_RESULT([$PMIX_EVENT_HEADER]) + AC_MSG_CHECKING([libevent2/thread header]) + AC_DEFINE_UNQUOTED([PMIX_EVENT2_THREAD_HEADER], [$PMIX_EVENT2_THREAD_HEADER], + [Location of event2/thread.h]) + AC_MSG_RESULT([$PMIX_EVENT2_THREAD_HEADER]) + + PMIX_SUMMARY_ADD([[External Packages]],[[Libevent]], [pmix_libevent], [yes ($pmix_libevent_source)]) + fi ]) AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[ @@ -46,7 +51,8 @@ AC_DEFUN([_PMIX_LIBEVENT_EMBEDDED_MODE],[ PMIX_EVENT2_THREAD_HEADER="$with_libevent_header"]) pmix_libevent_source=embedded - ]) + pmix_libevent_support=1 +]) AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ PMIX_VAR_SCOPE_PUSH([pmix_event_dir pmix_event_libdir pmix_event_defaults]) @@ -55,88 +61,109 @@ AC_DEFUN([_PMIX_LIBEVENT_EXTERNAL],[ [AC_HELP_STRING([--with-libevent=DIR], [Search for libevent headers and libraries in DIR ])]) - # Bozo check - AS_IF([test "$with_libevent" = "no"], - [AC_MSG_WARN([It is not possible to configure PMIx --without-libevent]) - AC_MSG_ERROR([Cannot continue])]) - AC_ARG_WITH([libevent-libdir], [AC_HELP_STRING([--with-libevent-libdir=DIR], [Search for libevent libraries in DIR ])]) + pmix_check_libevent_save_CPPFLAGS="$CPPFLAGS" + pmix_check_libevent_save_LDFLAGS="$LDFLAGS" + pmix_check_libevent_save_LIBS="$LIBS" + # get rid of the trailing slash(es) libevent_prefix=$(echo $with_libevent | sed -e 'sX/*$XXg') libeventdir_prefix=$(echo $with_libevent_libdir | sed -e 'sX/*$XXg') - AC_MSG_CHECKING([for libevent in]) - if test ! -z "$libevent_prefix" && test "$libevent_prefix" != "yes"; then - pmix_event_defaults=no - pmix_event_dir=$libevent_prefix - if test -d $libevent_prefix/lib; then - pmix_event_libdir=$libevent_prefix/lib - elif test -d $libevent_prefix/lib64; then - pmix_event_libdir=$libevent_prefix/lib64 - elif test -d $libevent_prefix; then - pmix_event_libdir=$libevent_prefix + if test "$libevent_prefix" != "no"; then + AC_MSG_CHECKING([for libevent in]) + if test ! -z "$libevent_prefix" && test "$libevent_prefix" != "yes"; then + pmix_event_defaults=no + pmix_event_dir=$libevent_prefix/include + if test -d $libevent_prefix/lib; then + pmix_event_libdir=$libevent_prefix/lib + elif test -d $libevent_prefix/lib64; then + pmix_event_libdir=$libevent_prefix/lib64 + elif test -d $libevent_prefix; then + pmix_event_libdir=$libevent_prefix + else + AC_MSG_RESULT([Could not find $libevent_prefix/lib, $libevent_prefix/lib64, or $libevent_prefix]) + AC_MSG_ERROR([Can not continue]) + fi + AC_MSG_RESULT([$pmix_event_dir and $pmix_event_libdir]) else - AC_MSG_RESULT([Could not find $libevent_prefix/lib, $libevent_prefix/lib64, or $libevent_prefix]) - AC_MSG_ERROR([Can not continue]) + pmix_event_defaults=yes + pmix_event_dir=/usr/include + if test -d /usr/lib; then + pmix_event_libdir=/usr/lib + AC_MSG_RESULT([(default search paths)]) + elif test -d /usr/lib64; then + pmix_event_libdir=/usr/lib64 + AC_MSG_RESULT([(default search paths)]) + else + AC_MSG_RESULT([default paths not found]) + pmix_libevent_support=0 + fi fi - AC_MSG_RESULT([$pmix_event_dir and $pmix_event_libdir]) - else - pmix_event_defaults=yes - pmix_event_dir=/usr/include - if test -d /usr/lib; then - pmix_event_libdir=/usr/lib - elif test -d /usr/lib64; then - pmix_event_libdir=/usr/lib64 - else - AC_MSG_RESULT([not found]) - AC_MSG_WARN([Could not find /usr/lib or /usr/lib64 - you may]) - AC_MSG_WARN([need to specify --with-libevent-libdir=]) - AC_MSG_ERROR([Can not continue]) + AS_IF([test ! -z "$libeventdir_prefix" && "$libeventdir_prefix" != "yes"], + [pmix_event_libdir="$libeventdir_prefix"]) + + PMIX_CHECK_PACKAGE([pmix_libevent], + [event.h], + [event], + [event_config_new], + [-levent -levent_pthreads], + [$pmix_event_dir], + [$pmix_event_libdir], + [pmix_libevent_support=1], + [pmix_libevent_support=0]) + + AS_IF([test "$pmix_event_defaults" = "no"], + [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) + PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) + PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) + + if test $pmix_libevent_support -eq 1; then + # Ensure that this libevent has the symbol + # "evthread_set_lock_callbacks", which will only exist if + # libevent was configured with thread support. + AC_CHECK_LIB([event], [evthread_set_lock_callbacks], + [], + [AC_MSG_WARN([External libevent does not have thread support]) + AC_MSG_WARN([PMIx requires libevent to be compiled with]) + AC_MSG_WARN([thread support enabled]) + pmix_libevent_support=0]) + fi + if test $pmix_libevent_support -eq 1; then + AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads], + [], + [AC_MSG_WARN([External libevent does not have thread support]) + AC_MSG_WARN([PMIx requires libevent to be compiled with]) + AC_MSG_WARN([thread support enabled]) + pmix_libevent_support=0]) fi - AC_MSG_RESULT([(default search paths)]) fi - AS_IF([test ! -z "$libeventdir_prefix" && "$libeventdir_prefix" != "yes"], - [pmix_event_libdir="$libeventdir_prefix"]) - - PMIX_CHECK_PACKAGE([pmix_libevent], - [event.h], - [event], - [event_config_new], - [-levent -levent_pthreads], - [$pmix_event_dir], - [$pmix_event_libdir], - [], - [AC_MSG_WARN([LIBEVENT SUPPORT NOT FOUND]) - AC_MSG_ERROR([CANNOT CONTINUE])]) - - AS_IF([test "$pmix_event_defaults" = "no"], - [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) - PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) - PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) - - # Ensure that this libevent has the symbol - # "evthread_set_lock_callbacks", which will only exist if - # libevent was configured with thread support. - AC_CHECK_LIB([event], [evthread_set_lock_callbacks], - [], - [AC_MSG_WARN([External libevent does not have thread support]) - AC_MSG_WARN([PMIx requires libevent to be compiled with]) - AC_MSG_WARN([thread support enabled]) - AC_MSG_ERROR([Cannot continue])]) - AC_CHECK_LIB([event_pthreads], [evthread_use_pthreads], - [], - [AC_MSG_WARN([External libevent does not have thread support]) - AC_MSG_WARN([PMIx requires libevent to be compiled with]) - AC_MSG_WARN([thread support enabled]) - AC_MSG_ERROR([Cannot continue])]) - - # Set output variables - PMIX_EVENT_HEADER="" - PMIX_EVENT2_THREAD_HEADER="" - pmix_libevent_source=$pmix_event_dir + + CPPFLAGS="$pmix_check_libevent_save_CPPFLAGS" + LDFLAGS="$pmix_check_libevent_save_LDFLAGS" + LIBS="$pmix_check_libevent_save_LIBS" + + AC_MSG_CHECKING([will libevent support be built]) + if test $pmix_libevent_support -eq 1; then + AC_MSG_RESULT([yes]) + # Set output variables + PMIX_EVENT_HEADER="" + PMIX_EVENT2_THREAD_HEADER="" + AC_DEFINE_UNQUOTED([PMIX_EVENT_HEADER], [$PMIX_EVENT_HEADER], + [Location of event.h]) + pmix_libevent_source=$pmix_event_dir + AS_IF([test "$pmix_event_defaults" = "no"], + [PMIX_FLAGS_APPEND_UNIQ(CPPFLAGS, $pmix_libevent_CPPFLAGS) + PMIX_FLAGS_APPEND_UNIQ(LDFLAGS, $pmix_libevent_LDFLAGS)]) + PMIX_FLAGS_APPEND_UNIQ(LIBS, $pmix_libevent_LIBS) + else + AC_MSG_RESULT([no]) + fi + + AC_DEFINE_UNQUOTED([PMIX_HAVE_LIBEVENT], [$pmix_libevent_support], [Whether we are building against libevent]) PMIX_VAR_SCOPE_POP ])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/configure.ac b/opal/mca/pmix/pmix3x/pmix/configure.ac index 3cbd07e8914..4bab86e668f 100644 --- a/opal/mca/pmix/pmix3x/pmix/configure.ac +++ b/opal/mca/pmix/pmix3x/pmix/configure.ac @@ -201,7 +201,6 @@ AS_IF([test "$pmix_debug" = "1"], LT_INIT() LT_LANG([C]) -LT_LANG([C++]) ############################################################################ # Setup the core diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index 6a47f054807..ae488781f7e 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.3 +Version: 3.1.4 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/examples/client.c b/opal/mca/pmix/pmix3x/pmix/examples/client.c index 519ef649d62..49e471fb258 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/client.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/client.c @@ -254,6 +254,9 @@ int main(int argc, char **argv) fprintf(stderr, "Client ns %s rank %d: PMIx_Commit failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } + if (0 == myproc.rank) { + sleep(2); + } /* call fence to synchronize with our peers - instruct * the fence operation to collect and return all "put" diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c index d7c0d3701ff..6b929420b7e 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dynamic.c @@ -49,9 +49,7 @@ int main(int argc, char **argv) char nsp2[PMIX_MAX_NSLEN+1]; pmix_app_t *app; char hostname[1024], dir[1024]; - pmix_proc_t *peers; - size_t npeers, ntmp=0; - char *nodelist; + size_t ntmp=0; if (0 > gethostname(hostname, sizeof(hostname))) { exit(1); @@ -71,14 +69,14 @@ int main(int argc, char **argv) (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - /* get our universe size */ - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + /* get our job size */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); + fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs); /* call fence to sync */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); @@ -103,13 +101,6 @@ int main(int argc, char **argv) app->env = (char**)malloc(2 * sizeof(char*)); app->env[0] = strdup("PMIX_ENV_VALUE=3"); app->env[1] = NULL; - PMIX_INFO_CREATE(app->info, 2); - (void)strncpy(app->info[0].key, "DARTH", PMIX_MAX_KEYLEN); - app->info[0].value.type = PMIX_INT8; - app->info[0].value.data.int8 = 12; - (void)strncpy(app->info[1].key, "VADER", PMIX_MAX_KEYLEN); - app->info[1].value.type = PMIX_DOUBLE; - app->info[1].value.data.dval = 12.34; fprintf(stderr, "Client ns %s rank %d: calling PMIx_Spawn\n", myproc.nspace, myproc.rank); if (PMIX_SUCCESS != (rc = PMIx_Spawn(NULL, 0, app, 1, nsp2))) { @@ -122,65 +113,28 @@ int main(int argc, char **argv) val = NULL; (void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val)) || + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val)) || NULL == val) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } ntmp = val->data.uint32; PMIX_VALUE_RELEASE(val); - fprintf(stderr, "Client %s:%d universe %s size %d\n", myproc.nspace, myproc.rank, nsp2, (int)ntmp); - } - - /* just cycle the connect/disconnect functions */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Connect(&proc, 1, NULL, 0))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Connect failed: %d\n", myproc.nspace, myproc.rank, rc); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Connect succeeded\n", - myproc.nspace, myproc.rank); - if (PMIX_SUCCESS != (rc = PMIx_Disconnect(&proc, 1, NULL, 0))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Disonnect failed: %d\n", myproc.nspace, myproc.rank, rc); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Disconnect succeeded\n", myproc.nspace, myproc.rank); + fprintf(stderr, "Client %s:%d job %s size %d\n", myproc.nspace, myproc.rank, nsp2, (int)ntmp); - /* finally, test the resolve functions */ - if (0 == myproc.rank) { - if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers(hostname, NULL, &peers, &npeers))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n", myproc.nspace, myproc.rank, nsp2, rc); - goto done; - } - if ((nprocs+ntmp) != npeers) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n", myproc.nspace, myproc.rank, (int)(nprocs+ntmp), (int)npeers); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n", myproc.nspace, myproc.rank, (int)npeers); - if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes(nsp2, &nodelist))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes failed for nspace %s: %d\n", myproc.nspace, myproc.rank, nsp2, rc); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes %s", myproc.nspace, myproc.rank, nodelist); - } else { - if (PMIX_SUCCESS != (rc = PMIx_Resolve_peers(hostname, myproc.nspace, &peers, &npeers))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers failed for nspace %s: %d\n", myproc.nspace, myproc.rank, myproc.nspace, rc); - goto done; - } - if (nprocs != npeers) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned incorrect npeers: %d vs %d\n", myproc.nspace, myproc.rank, nprocs, (int)npeers); - goto done; - } - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_peers returned %d npeers\n", myproc.nspace, myproc.rank, (int)npeers); - if (PMIX_SUCCESS != (rc = PMIx_Resolve_nodes(myproc.nspace, &nodelist))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes failed: %d\n", myproc.nspace, myproc.rank, rc); + /* get a proc-specific value */ + val = NULL; + (void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN); + proc.rank = 1; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_RANK, NULL, 0, &val)) || + NULL == val) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get local rank failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } - fprintf(stderr, "Client ns %s rank %d: PMIx_Resolve_nodes %s\n", myproc.nspace, myproc.rank, nodelist); + ntmp = (int)val->data.uint16; + PMIX_VALUE_RELEASE(val); + fprintf(stderr, "Client %s:%d job %s local rank %d\n", myproc.nspace, myproc.rank, nsp2, (int)ntmp); } - PMIX_PROC_FREE(peers, npeers); - free(nodelist); done: /* call fence to sync */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c index dd5cb66e7d9..56774e4fb24 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmi1.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -85,7 +85,7 @@ PMIX_EXPORT int PMI_Init(int *spawned) /* getting internal key requires special rank value */ memcpy(&proc, &myproc, sizeof(myproc)); - proc.rank = PMIX_RANK_UNDEF; + proc.rank = PMIX_RANK_WILDCARD; /* set controlling parameters * PMIX_OPTIONAL - expect that these keys should be available on startup @@ -394,8 +394,6 @@ PMIX_EXPORT int PMI_Get_appnum(int *appnum) pmix_value_t *val; pmix_info_t info[1]; bool val_optinal = 1; - pmix_proc_t proc = myproc; - proc.rank = PMIX_RANK_WILDCARD; PMI_CHECK(); @@ -414,11 +412,11 @@ PMIX_EXPORT int PMI_Get_appnum(int *appnum) PMIX_INFO_CONSTRUCT(&info[0]); PMIX_INFO_LOAD(&info[0], PMIX_OPTIONAL, &val_optinal, PMIX_BOOL); - rc = PMIx_Get(&proc, PMIX_APPNUM, info, 1, &val); + rc = PMIx_Get(&myproc, PMIX_APPNUM, info, 1, &val); if (PMIX_SUCCESS == rc) { rc = convert_int(appnum, val); PMIX_VALUE_RELEASE(val); - } else if( PMIX_ERR_NOT_FOUND == rc ){ + } else { /* this is optional value, set to 0 */ *appnum = 0; rc = PMIX_SUCCESS; @@ -445,7 +443,7 @@ PMIX_EXPORT int PMI_Publish_name(const char service_name[], const char port[]) } /* pass the service/port */ - pmix_strncpy(info.key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(info.key, service_name, PMIX_MAX_KEYLEN); info.value.type = PMIX_STRING; info.value.data.string = (char*) port; @@ -497,7 +495,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[]) PMIX_PDATA_CONSTRUCT(&pdata); /* pass the service */ - pmix_strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN); + pmix_strncpy(pdata.key, service_name, PMIX_MAX_KEYLEN); /* PMI-1 doesn't want the nspace back */ if (PMIX_SUCCESS != (rc = PMIx_Lookup(&pdata, 1, NULL, 0))) { @@ -514,7 +512,7 @@ PMIX_EXPORT int PMI_Lookup_name(const char service_name[], char port[]) * potential we could overrun it. As this feature * isn't widely supported in PMI-1, try being * conservative */ - pmix_strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN); + pmix_strncpy(port, pdata.value.data.string, PMIX_MAX_KEYLEN); PMIX_PDATA_DESTRUCT(&pdata); return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index a99f7141922..8d522e7a4fa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -50,7 +50,9 @@ #include #endif #include PMIX_EVENT_HEADER +#if ! PMIX_HAVE_LIBEV #include PMIX_EVENT2_THREAD_HEADER +#endif static const char pmix_version_string[] = PMIX_VERSION; static pmix_status_t pmix_init_result = PMIX_ERR_INIT; diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c index 7a587dcad46..adac9bbf4d3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -73,7 +73,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs, PMIX_ACQUIRE_THREAD(&pmix_global_lock); - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "pmix: executing fence"); if (pmix_globals.init_cntr <= 0) { @@ -106,7 +106,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs, rc = cb->status; PMIX_RELEASE(cb); - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "pmix: fence released"); return rc; @@ -125,7 +125,7 @@ PMIX_EXPORT pmix_status_t PMIx_Fence_nb(const pmix_proc_t procs[], size_t nprocs PMIX_ACQUIRE_THREAD(&pmix_global_lock); - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "pmix: fence_nb called"); if (pmix_globals.init_cntr <= 0) { @@ -185,7 +185,7 @@ static pmix_status_t unpack_return(pmix_buffer_t *data) pmix_status_t ret; int32_t cnt; - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "client:unpack fence called"); /* unpack the status code */ @@ -196,7 +196,7 @@ static pmix_status_t unpack_return(pmix_buffer_t *data) PMIX_ERROR_LOG(rc); return rc; } - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "client:unpack fence received status %d", ret); return ret; } @@ -255,7 +255,7 @@ static void wait_cbfunc(struct pmix_peer_t *pr, pmix_ptl_hdr_t *hdr, pmix_cb_t *cb = (pmix_cb_t*)cbdata; pmix_status_t rc; - pmix_output_verbose(2, pmix_globals.debug_output, + pmix_output_verbose(2, pmix_client_globals.fence_output, "pmix: fence_nb callback recvd"); if (NULL == cb) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index 46d6c62db8f..48cee715afe 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -57,6 +57,7 @@ #include "src/util/compress.h" #include "src/util/error.h" #include "src/util/hash.h" +#include "src/util/name_fns.h" #include "src/util/output.h" #include "src/mca/gds/gds.h" #include "src/mca/ptl/ptl.h" @@ -99,14 +100,15 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_client_globals.get_output, - "pmix:client get for %s:%d key %s", - (NULL == proc) ? "NULL" : proc->nspace, - (NULL == proc) ? PMIX_RANK_UNDEF : proc->rank, + "pmix:client get for %s key %s", + (NULL == proc) ? "NULL" : PMIX_NAME_PRINT(proc), (NULL == key) ? "NULL" : key); /* try to get data directly, without threadshift */ - if (PMIX_SUCCESS == (rc = _getfn_fastpath(proc, key, info, ninfo, val))) { - goto done; + if (PMIX_RANK_UNDEF != proc->rank && NULL != key) { + if (PMIX_SUCCESS == (rc = _getfn_fastpath(proc, key, info, ninfo, val))) { + goto done; + } } /* create a callback object as we need to pass it to the @@ -329,9 +331,14 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, } if (PMIX_SUCCESS != ret) { + PMIX_ERROR_LOG(ret); goto done; } - PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_client_globals.myserver, buf); + if (PMIX_RANK_UNDEF == proc.rank) { + PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_globals.mypeer, buf); + } else { + PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_client_globals.myserver, buf); + } if (PMIX_SUCCESS != rc) { goto done; } @@ -350,7 +357,11 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, /* fetch the data from server peer module - since it is passing * it back to the user, we need a copy of it */ cb->copy = true; - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + if (PMIX_RANK_UNDEF == proc.rank) { + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); + } else { + PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + } if (PMIX_SUCCESS == rc) { if (1 != pmix_list_get_size(&cb->kvs)) { rc = PMIX_ERR_INVALID_VAL; @@ -496,9 +507,15 @@ static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t k /* scan the incoming directives */ if (NULL != info) { for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_DATA_SCOPE)) { cb->scope = info[n].value.data.scope; - break; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_OPTIONAL) || + PMIX_CHECK_KEY(&info[n], PMIX_IMMEDIATE)) { + continue; + } else { + /* we cannot handle any other directives via this path */ + PMIX_RELEASE(cb); + return PMIX_ERR_NOT_SUPPORTED; } } } @@ -508,16 +525,16 @@ static pmix_status_t _getfn_fastpath(const pmix_proc_t *proc, const pmix_key_t k cb->info = (pmix_info_t*)info; cb->ninfo = ninfo; - PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_globals.mypeer); + PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_client_globals.myserver); if (PMIX_SUCCESS == rc) { - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); + PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); if (PMIX_SUCCESS == rc) { goto done; } } - PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_client_globals.myserver); + PMIX_GDS_FETCH_IS_TSAFE(rc, pmix_globals.mypeer); if (PMIX_SUCCESS == rc) { - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); if (PMIX_SUCCESS == rc) { goto done; } @@ -551,23 +568,23 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* cb was passed to us from another thread - acquire it */ PMIX_ACQUIRE_OBJECT(cb); - pmix_output_verbose(2, pmix_client_globals.get_output, - "pmix: getnbfn value for proc %s:%u key %s", - cb->pname.nspace, cb->pname.rank, - (NULL == cb->key) ? "NULL" : cb->key); - /* set the proc object identifier */ pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); proc.rank = cb->pname.rank; + pmix_output_verbose(2, pmix_client_globals.get_output, + "pmix: getnbfn value for proc %s key %s", + PMIX_NAME_PRINT(&proc), + (NULL == cb->key) ? "NULL" : cb->key); + /* scan the incoming directives */ if (NULL != cb->info) { for (n=0; n < cb->ninfo; n++) { - if (0 == strncmp(cb->info[n].key, PMIX_OPTIONAL, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&cb->info[n], PMIX_OPTIONAL)) { optional = PMIX_INFO_TRUE(&cb->info[n]); - } else if (0 == strncmp(cb->info[n].key, PMIX_IMMEDIATE, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_IMMEDIATE)) { immediate = PMIX_INFO_TRUE(&cb->info[n]); - } else if (0 == strncmp(cb->info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_TIMEOUT)) { /* set a timer to kick us out if we don't * have an answer within their window */ if (0 < cb->info[n].value.data.integer) { @@ -578,8 +595,16 @@ static void _getnbfn(int fd, short flags, void *cbdata) pmix_event_evtimer_add(&cb->ev, &tv); cb->timer_running = true; } - } else if (0 == strncmp(cb->info[n].key, PMIX_DATA_SCOPE, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_DATA_SCOPE)) { cb->scope = cb->info[n].value.data.scope; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_SESSION_INFO)) { + cb->level = PMIX_LEVEL_SESSION; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_JOB_INFO)) { + cb->level = PMIX_LEVEL_JOB; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_APP_INFO)) { + cb->level = PMIX_LEVEL_APP; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_NODE_INFO)) { + cb->level = PMIX_LEVEL_NODE; } } } @@ -604,7 +629,13 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* fetch the data from my server's module - since we are passing * it back to the user, we need a copy of it */ cb->copy = true; - PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + /* if the peer and server GDS component are the same, then no + * point in trying it again */ + if (0 != strcmp(pmix_globals.mypeer->nptr->compat.gds->name, pmix_client_globals.myserver->nptr->compat.gds->name)) { + PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); + } else { + rc = PMIX_ERR_TAKE_NEXT_OPTION; + } if (PMIX_SUCCESS != rc) { pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client job-level data NOT found"); @@ -653,7 +684,17 @@ static void _getnbfn(int fd, short flags, void *cbdata) "pmix:client job-level data NOT found"); rc = process_values(&val, cb); goto respond; + } else if (PMIX_RANK_UNDEF == proc.rank) { + /* the data would have to be stored on our own peer, so + * we need to go request it */ + goto request; } else { + /* if the peer and server GDS component are the same, then no + * point in trying it again */ + if (0 == strcmp(pmix_globals.mypeer->nptr->compat.gds->name, pmix_client_globals.myserver->nptr->compat.gds->name)) { + val = NULL; + goto request; + } cb->proc = &proc; cb->copy = true; PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); @@ -722,9 +763,9 @@ static void _getnbfn(int fd, short flags, void *cbdata) } pmix_output_verbose(2, pmix_client_globals.get_output, - "%s:%d REQUESTING DATA FROM SERVER FOR %s:%d KEY %s", - pmix_globals.myid.nspace, pmix_globals.myid.rank, - cb->pname.nspace, cb->pname.rank, cb->key); + "%s REQUESTING DATA FROM SERVER FOR %s KEY %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(cb->proc), cb->key); /* track the callback object */ pmix_list_append(&pmix_client_globals.pending_requests, &cb->super); diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c index 582a64e4eaa..0c5aa760fc7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -82,14 +82,18 @@ PMIX_EXPORT pmix_status_t PMIx_Log(const pmix_info_t data[], size_t ndata, * recv routine so we know which callback to use when * the return message is recvd */ PMIX_CONSTRUCT(&cb, pmix_cb_t); - if (PMIX_SUCCESS != (rc = PMIx_Log_nb(data, ndata, directives, - ndirs, opcbfunc, &cb))) { + rc = PMIx_Log_nb(data, ndata, directives, ndirs, opcbfunc, &cb); + if (PMIX_SUCCESS == rc) { + /* wait for the operation to complete */ + PMIX_WAIT_THREAD(&cb.lock); + } else { PMIX_DESTRUCT(&cb); + if (PMIX_OPERATION_SUCCEEDED == rc) { + rc = PMIX_SUCCESS; + } return rc; } - /* wait for the operation to complete */ - PMIX_WAIT_THREAD(&cb.lock); rc = cb.status; PMIX_DESTRUCT(&cb); diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c index c40f08b6a0e..1f217d18a5d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c @@ -144,6 +144,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque pmix_list_t results; pmix_kval_t *kv, *kvnxt; pmix_proc_t proc; + bool rank_given; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -190,6 +191,7 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque memset(proc.nspace, 0, PMIX_MAX_NSLEN+1); proc.rank = PMIX_RANK_INVALID; for (n=0; n < nqueries; n++) { + rank_given = false; for (p=0; p < queries[n].nqual; p++) { if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_QUERY_REFRESH_CACHE)) { if (PMIX_INFO_TRUE(&queries[n].qualifiers[p])) { @@ -199,37 +201,41 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_PROCID)) { PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.proc->nspace); proc.rank = queries[n].qualifiers[p].value.data.proc->rank; + rank_given = true; } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_NSPACE)) { PMIX_LOAD_NSPACE(proc.nspace, queries[n].qualifiers[p].value.data.string); } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_RANK)) { proc.rank = queries[n].qualifiers[p].value.data.rank; - } else if (PMIX_CHECK_KEY(&queries[n].qualifiers[p], PMIX_HOSTNAME)) { - if (0 != strcmp(queries[n].qualifiers[p].value.data.string, pmix_globals.hostname)) { - /* asking about a different host, so ask for the info */ - PMIX_LIST_DESTRUCT(&results); - goto query; - } + rank_given = true; } } /* we get here if a refresh isn't required - first try a local * "get" on the data to see if we already have it */ PMIX_CONSTRUCT(&cb, pmix_cb_t); cb.copy = false; - /* set the proc */ - if (PMIX_RANK_INVALID == proc.rank && - 0 == strlen(proc.nspace)) { - /* use our id */ - cb.proc = &pmix_globals.myid; + /* if they are querying about node or app values not directly + * associated with a proc (i.e., they didn't specify the proc), + * then we obtain those by leaving the proc info as undefined */ + if (!rank_given) { + proc.rank = PMIX_RANK_UNDEF; + cb.proc = &proc; } else { - if (0 == strlen(proc.nspace)) { - /* use our nspace */ - PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); - } - if (PMIX_RANK_INVALID == proc.rank) { - /* user the wildcard rank */ - proc.rank = PMIX_RANK_WILDCARD; + /* set the proc */ + if (PMIX_RANK_INVALID == proc.rank && + 0 == strlen(proc.nspace)) { + /* use our id */ + cb.proc = &pmix_globals.myid; + } else { + if (0 == strlen(proc.nspace)) { + /* use our nspace */ + PMIX_LOAD_NSPACE(cb.proc->nspace, pmix_globals.myid.nspace); + } + if (PMIX_RANK_INVALID == proc.rank) { + /* user the wildcard rank */ + proc.rank = PMIX_RANK_WILDCARD; + } + cb.proc = &proc; } - cb.proc = &proc; } for (p=0; NULL != queries[n].keys[p]; p++) { cb.key = queries[n].keys[p]; diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index 574607ec4b0..c667489394c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -883,7 +883,7 @@ static void _notify_client_event(int sd, short args, void *cbdata) } else { /* look up the nspace for this proc */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (PMIX_CHECK_NSPACE(tmp->nspace, cd->targets[n].nspace)) { nptr = tmp; break; diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c index 8959ba56845..df8a6b6e5b4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c @@ -306,6 +306,7 @@ static void cbcon(pmix_cb_t *p) PMIX_CONSTRUCT(&p->kvs, pmix_list_t); p->copy = false; p->timer_running = false; + p->level = PMIX_LEVEL_UNDEF; } static void cbdes(pmix_cb_t *p) { @@ -342,6 +343,7 @@ static void qcon(pmix_query_caddy_t *p) p->relcbfunc = NULL; p->credcbfunc = NULL; p->validcbfunc = NULL; + PMIX_CONSTRUCT(&p->results, pmix_list_t); } static void qdes(pmix_query_caddy_t *p) { @@ -349,6 +351,8 @@ static void qdes(pmix_query_caddy_t *p) PMIX_BYTE_OBJECT_DESTRUCT(&p->bo); PMIX_PROC_FREE(p->targets, p->ntargets); PMIX_INFO_FREE(p->info, p->ninfo); + PMIX_LIST_DESTRUCT(&p->results); + PMIX_QUERY_FREE(p->queries, p->nqueries); } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_query_caddy_t, pmix_object_t, @@ -566,3 +570,30 @@ static bool dirpath_is_empty(const char *path ) return true; } + +int pmix_event_assign(struct event *ev, pmix_event_base_t *evbase, + int fd, short arg, event_callback_fn cbfn, void *cbd) +{ +#if PMIX_HAVE_LIBEV + event_set(ev, fd, arg, cbfn, cbd); + event_base_set(evbase, ev); +#else + event_assign(ev, evbase, fd, arg, cbfn, cbd); +#endif + return 0; +} + +pmix_event_t* pmix_event_new(pmix_event_base_t *b, int fd, + short fg, event_callback_fn cbfn, void *cbd) +{ + pmix_event_t *ev = NULL; + +#if PMIX_HAVE_LIBEV + ev = (pmix_event_t*)calloc(1, sizeof(pmix_event_t)); + ev->ev_base = b; +#else + ev = event_new(b, fd, fg, (event_callback_fn) cbfn, cbd); +#endif + + return ev; +} diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 202679cc4ee..113cd48faab 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -122,6 +122,16 @@ typedef enum { PMIX_COLLECT_MAX } pmix_collect_t; +/* define a set of flags indicating the level + * of information being stored/requested */ +typedef enum { + PMIX_LEVEL_UNDEF, + PMIX_LEVEL_SESSION, + PMIX_LEVEL_JOB, + PMIX_LEVEL_APP, + PMIX_LEVEL_NODE +} pmix_level_t; + /**** PEER STRUCTURES ****/ /* clients can only talk to their server, and servers are @@ -268,6 +278,7 @@ typedef struct { pmix_info_t *info; size_t ninfo; pmix_byte_object_t bo; + pmix_list_t results; pmix_info_cbfunc_t cbfunc; pmix_value_cbfunc_t valcbfunc; pmix_release_cbfunc_t relcbfunc; @@ -388,6 +399,7 @@ typedef struct { pmix_list_t kvs; bool copy; bool timer_running; + pmix_level_t level; } pmix_cb_t; PMIX_CLASS_DECLARATION(pmix_cb_t); @@ -481,6 +493,7 @@ typedef struct { bool xml_output; bool timestamp_output; size_t output_limit; + pmix_list_t nspaces; } pmix_globals_t; /* provide access to a function to cleanup epilogs */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/types.h b/opal/mca/pmix/pmix3x/pmix/src/include/types.h index cf8d082c34d..6b52843ee48 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/types.h @@ -9,9 +9,11 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -43,11 +45,17 @@ #include #endif #include PMIX_EVENT_HEADER +#if ! PMIX_HAVE_LIBEV +#include PMIX_EVENT2_THREAD_HEADER +#endif #if PMIX_ENABLE_DEBUG #include "src/util/output.h" #endif +#include +#include + /* * portable assignment of pointer to int @@ -137,6 +145,18 @@ static inline uint64_t pmix_ntoh64(uint64_t val) #endif } +/* Convert size_t value from host to network byte order and back */ +#if SIZEOF_SIZE_T == 4 + +#define pmix_htonsizet(x) htonl(x) +#define pmix_ntohsizet(x) ntohl(x) + +#elif SIZEOF_SIZE_T == 8 + +#define pmix_htonsizet(x) pmix_hton64(x) +#define pmix_ntohsizet(x) pmix_ntoh64(x) + +#endif /** * Convert between a local representation of pointer and a 64 bits value. @@ -225,6 +245,8 @@ static inline uint64_t pmix_swap_bytes8(uint64_t val) #define PMIX_EVLOOP_ONCE EVLOOP_ONCE /**< Block at most once. */ #define PMIX_EVLOOP_NONBLOCK EVLOOP_NONBLOCK /**< Do not block. */ +#define PMIX_EVENT_SIGNAL(ev) pmix_event_get_signal(ev) + typedef struct event_base pmix_event_base_t; typedef struct event pmix_event_t; @@ -232,42 +254,52 @@ typedef struct event pmix_event_t; #define pmix_event_base_free(b) event_base_free(b) -#define pmix_event_free(x) event_free(x) -#define pmix_event_base_loopbreak(b) event_base_loopbreak(b) - -#define pmix_event_base_loopexit(b) event_base_loopexit(b, NULL) +#if PMIX_HAVE_LIBEV +#define pmix_event_use_threads() +#define pmix_event_free(b) free(b) +#define pmix_event_get_signal(x) (x)->ev_fd +#else /* thread support APIs */ #define pmix_event_use_threads() evthread_use_pthreads() +#define pmix_event_free(x) event_free(x) +#define pmix_event_get_signal(x) event_get_signal(x) +#endif /* Basic event APIs */ #define pmix_event_enable_debug_mode() event_enable_debug_mode() -#define pmix_event_assign(x, b, fd, fg, cb, arg) event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg)) +PMIX_EXPORT int pmix_event_assign(struct event *ev, pmix_event_base_t *evbase, + int fd, short arg, event_callback_fn cbfn, void *cbd); -#define pmix_event_set(b, x, fd, fg, cb, arg) event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg)) +#define pmix_event_set(b, x, fd, fg, cb, arg) pmix_event_assign((x), (b), (fd), (fg), (event_callback_fn) (cb), (arg)) +#if PMIX_HAVE_LIBEV +PMIX_EXPORT int pmix_event_add(struct event *ev, struct timeval *tv); +PMIX_EXPORT int pmix_event_del(struct event *ev); +PMIX_EXPORT void pmix_event_active (struct event *ev, int res, short ncalls); +PMIX_EXPORT void pmix_event_base_loopexit (pmix_event_base_t *b); +#else #define pmix_event_add(ev, tv) event_add((ev), (tv)) - #define pmix_event_del(ev) event_del((ev)) - #define pmix_event_active(x, y, z) event_active((x), (y), (z)) +#define pmix_event_base_loopexit(b) event_base_loopexit(b, NULL) +#endif -#define pmix_event_new(b, fd, fg, cb, arg) event_new((b), (fd), (fg), (event_callback_fn) (cb), (arg)) +PMIX_EXPORT pmix_event_t* pmix_event_new(pmix_event_base_t *b, int fd, + short fg, event_callback_fn cbfn, void *cbd); #define pmix_event_loop(b, fg) event_base_loop((b), (fg)) -#define pmix_event_active(x, y, z) event_active((x), (y), (z)) - #define pmix_event_evtimer_new(b, cb, arg) pmix_event_new((b), -1, 0, (cb), (arg)) #define pmix_event_evtimer_add(x, tv) pmix_event_add((x), (tv)) -#define pmix_event_evtimer_set(b, x, cb, arg) event_assign((x), (b), -1, 0, (event_callback_fn) (cb), (arg)) +#define pmix_event_evtimer_set(b, x, cb, arg) pmix_event_assign((x), (b), -1, 0, (event_callback_fn) (cb), (arg)) #define pmix_event_evtimer_del(x) pmix_event_del((x)) -#define pmix_event_signal_set(b, x, fd, cb, arg) event_assign((x), (b), (fd), EV_SIGNAL|EV_PERSIST, (event_callback_fn) (cb), (arg)) +#define pmix_event_signal_set(b, x, fd, cb, arg) pmix_event_assign((x), (b), (fd), EV_SIGNAL|EV_PERSIST, (event_callback_fn) (cb), (arg)) #endif /* PMIX_TYPES_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c index fed38f988fd..7d96e21c36a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_component_find.c @@ -16,7 +16,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -339,8 +339,8 @@ static int component_find_check (pmix_mca_base_framework_t *framework, char **re } if (!found) { - char h[MAXHOSTNAMELEN]; - gethostname(h, sizeof(h)); + char h[PMIX_MAXHOSTNAMELEN] = {0}; + gethostname(h, sizeof(h)-1); pmix_show_help("help-pmix-mca-base.txt", "find-available:not-valid", true, h, framework->framework_name, requested_component_names[i]); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c index f152f2c2a95..fbb55dcb355 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/pmix_mca_base_open.c @@ -13,7 +13,7 @@ * Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +68,7 @@ int pmix_mca_base_open(void) { char *value; pmix_output_stream_t lds; - char hostname[64]; + char hostname[PMIX_MAXHOSTNAMELEN] = {0}; int var_id; int rc; @@ -155,7 +155,7 @@ int pmix_mca_base_open(void) } else { set_defaults(&lds); } - gethostname(hostname, 64); + gethostname(hostname, PMIX_MAXHOSTNAMELEN-1); rc = asprintf(&lds.lds_prefix, "[%s:%05d] ", hostname, getpid()); if (0 > rc) { return PMIX_ERR_OUT_OF_RESOURCE; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c index 06720cf32ec..fbdbae3efff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v20/copy.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -431,10 +431,15 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src) memcpy(&p->data.status, &src->data.status, sizeof(pmix_status_t)); break; case PMIX_PROC: - memcpy(&p->data.proc, &src->data.proc, sizeof(pmix_proc_t)); + /* create the storage */ + p->data.proc = (pmix_proc_t*)malloc(sizeof(pmix_proc_t)); + if (NULL == p->data.proc) { + return PMIX_ERR_NOMEM; + } + memcpy(p->data.proc, src->data.proc, sizeof(pmix_proc_t)); break; case PMIX_PROC_RANK: - memcpy(&p->data.proc, &src->data.rank, sizeof(pmix_rank_t)); + memcpy(&p->data.rank, &src->data.rank, sizeof(pmix_rank_t)); break; case PMIX_BYTE_OBJECT: case PMIX_COMPRESSED_STRING: @@ -653,7 +658,12 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src) p1 = (pmix_info_t*)p->data.darray->array; s1 = (pmix_info_t*)src->data.darray->array; for (n=0; n < src->data.darray->size; n++) { - PMIX_INFO_LOAD(&p1[n], s1[n].key, &s1[n].value.data.flag, s1[n].value.type); + PMIX_LOAD_KEY(p1[n].key, s1[n].key); + rc = pmix_value_xfer(&p1[n].value, &s1[n].value); + if (PMIX_SUCCESS != rc) { + PMIX_INFO_FREE(p1, src->data.darray->size); + return rc; + } } break; case PMIX_PDATA: @@ -664,7 +674,13 @@ pmix_status_t pmix20_bfrop_value_xfer(pmix_value_t *p, const pmix_value_t *src) pd = (pmix_pdata_t*)p->data.darray->array; sd = (pmix_pdata_t*)src->data.darray->array; for (n=0; n < src->data.darray->size; n++) { - PMIX_PDATA_LOAD(&pd[n], &sd[n].proc, sd[n].key, &sd[n].value.data.flag, sd[n].value.type); + memcpy(&pd[n].proc, &sd[n].proc, sizeof(pmix_proc_t)); + PMIX_LOAD_KEY(pd[n].key, sd[n].key); + rc = pmix_value_xfer(&pd[n].value, &sd[n].value); + if (PMIX_SUCCESS != rc) { + PMIX_INFO_FREE(pd, src->data.darray->size); + return rc; + } } break; case PMIX_BUFFER: diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c index a219bed9c0b..69ec1ba577f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c @@ -1,9 +1,9 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2018 Research Organization for Information Science + * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ @@ -30,6 +30,11 @@ #ifdef HAVE_SYS_AUXV_H #include +#if PMIX_HAVE_LIBEV +/* EV_NONE is macro-defined in that is included by + * and used in an enum in from libev, so #undef it to fix an issue*/ +#undef EV_NONE +#endif #endif #include diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index 4e092fc5a68..5e6a5341bd2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -38,11 +38,12 @@ #include "src/server/pmix_server_ops.h" #include "src/util/argv.h" #include "src/util/compress.h" +#include "src/mca/preg/preg.h" #include "src/util/error.h" #include "src/util/hash.h" #include "src/util/output.h" +#include "src/util/name_fns.h" #include "src/util/pmix_environ.h" -#include "src/mca/preg/preg.h" #include "src/mca/gds/base/base.h" #include "gds_hash.h" @@ -115,6 +116,24 @@ pmix_gds_base_module_t pmix_hash_module = { .accept_kvs_resp = accept_kvs_resp }; +/* Define a bitmask to track what information may not have + * been provided but is computable from other info */ +#define PMIX_HASH_PROC_DATA 0x00000001 +#define PMIX_HASH_JOB_SIZE 0x00000002 +#define PMIX_HASH_MAX_PROCS 0x00000004 +#define PMIX_HASH_NUM_NODES 0x00000008 +#define PMIX_HASH_PROC_MAP 0x00000010 +#define PMIX_HASH_NODE_MAP 0x00000020 + +/**********************************************/ +/* struct definitions */ +typedef struct { + pmix_list_item_t super; + uint32_t session; + pmix_list_t sessioninfo; + pmix_list_t nodeinfo; +} pmix_session_t; + typedef struct { pmix_list_item_t super; char *ns; @@ -123,12 +142,49 @@ typedef struct { pmix_hash_table_t remote; pmix_hash_table_t local; bool gdata_added; -} pmix_hash_trkr_t; + pmix_list_t jobinfo; + pmix_list_t apps; + pmix_list_t nodeinfo; + pmix_session_t *session; +} pmix_job_t; -static void htcon(pmix_hash_trkr_t *p) +typedef struct { + pmix_list_item_t super; + uint32_t appnum; + pmix_list_t appinfo; + pmix_list_t nodeinfo; + pmix_job_t *job; +} pmix_apptrkr_t; + +typedef struct { + pmix_list_item_t super; + uint32_t nodeid; + char *hostname; + pmix_list_t info; +} pmix_nodeinfo_t; + +/**********************************************/ +/* class instantiations */ +static void scon(pmix_session_t *s) +{ + s->session = UINT32_MAX; + PMIX_CONSTRUCT(&s->sessioninfo, pmix_list_t); + PMIX_CONSTRUCT(&s->nodeinfo, pmix_list_t); +} +static void sdes(pmix_session_t *s) +{ + PMIX_LIST_DESTRUCT(&s->sessioninfo); + PMIX_LIST_DESTRUCT(&s->nodeinfo); +} +static PMIX_CLASS_INSTANCE(pmix_session_t, + pmix_list_item_t, + scon, sdes); + +static void htcon(pmix_job_t *p) { p->ns = NULL; p->nptr = NULL; + PMIX_CONSTRUCT(&p->jobinfo, pmix_list_t); PMIX_CONSTRUCT(&p->internal, pmix_hash_table_t); pmix_hash_table_init(&p->internal, 256); PMIX_CONSTRUCT(&p->remote, pmix_hash_table_t); @@ -136,8 +192,11 @@ static void htcon(pmix_hash_trkr_t *p) PMIX_CONSTRUCT(&p->local, pmix_hash_table_t); pmix_hash_table_init(&p->local, 256); p->gdata_added = false; + PMIX_CONSTRUCT(&p->apps, pmix_list_t); + PMIX_CONSTRUCT(&p->nodeinfo, pmix_list_t); + p->session = NULL; } -static void htdes(pmix_hash_trkr_t *p) +static void htdes(pmix_job_t *p) { if (NULL != p->ns) { free(p->ns); @@ -145,25 +204,411 @@ static void htdes(pmix_hash_trkr_t *p) if (NULL != p->nptr) { PMIX_RELEASE(p->nptr); } + PMIX_LIST_DESTRUCT(&p->jobinfo); pmix_hash_remove_data(&p->internal, PMIX_RANK_WILDCARD, NULL); PMIX_DESTRUCT(&p->internal); pmix_hash_remove_data(&p->remote, PMIX_RANK_WILDCARD, NULL); PMIX_DESTRUCT(&p->remote); pmix_hash_remove_data(&p->local, PMIX_RANK_WILDCARD, NULL); PMIX_DESTRUCT(&p->local); + PMIX_LIST_DESTRUCT(&p->apps); + PMIX_LIST_DESTRUCT(&p->nodeinfo); + if (NULL != p->session) { + PMIX_RELEASE(p->session); + } } -static PMIX_CLASS_INSTANCE(pmix_hash_trkr_t, +static PMIX_CLASS_INSTANCE(pmix_job_t, pmix_list_item_t, htcon, htdes); -static pmix_list_t myhashes; +static void apcon(pmix_apptrkr_t *p) +{ + p->appnum = 0; + PMIX_CONSTRUCT(&p->appinfo, pmix_list_t); + PMIX_CONSTRUCT(&p->nodeinfo, pmix_list_t); + p->job = NULL; +} +static void apdes(pmix_apptrkr_t *p) +{ + PMIX_LIST_DESTRUCT(&p->appinfo); + PMIX_LIST_DESTRUCT(&p->nodeinfo); + if (NULL != p->job) { + PMIX_RELEASE(p->job); + } +} +static PMIX_CLASS_INSTANCE(pmix_apptrkr_t, + pmix_list_item_t, + apcon, apdes); + +static void ndinfocon(pmix_nodeinfo_t *p) +{ + p->nodeid = 0; + p->hostname = NULL; + PMIX_CONSTRUCT(&p->info, pmix_list_t); +} +static void ndinfodes(pmix_nodeinfo_t *p) +{ + if (NULL != p->hostname) { + free(p->hostname); + } + PMIX_LIST_DESTRUCT(&p->info); +} +static PMIX_CLASS_INSTANCE(pmix_nodeinfo_t, + pmix_list_item_t, + ndinfocon, ndinfodes); + +/**********************************************/ + +/* process a node array - contains an array of + * node-level info for a single node. Either the + * nodeid, hostname, or both must be included + * in the array to identify the node */ +static pmix_status_t process_node_array(pmix_info_t *info, + pmix_list_t *tgt) +{ + size_t size, j; + pmix_info_t *iptr; + pmix_status_t rc = PMIX_SUCCESS; + pmix_kval_t *kp2, *k1, *knext; + pmix_list_t cache; + pmix_nodeinfo_t *nd = NULL, *ndptr; + bool update; + + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "PROCESSING NODE ARRAY"); + + /* array of node-level info for a specific node */ + if (PMIX_DATA_ARRAY != info->value.type) { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + return PMIX_ERR_TYPE_MISMATCH; + } + + /* setup arrays */ + size = info->value.data.darray->size; + iptr = (pmix_info_t*)info->value.data.darray->array; + PMIX_CONSTRUCT(&cache, pmix_list_t); + + /* cache the values while searching for the nodeid + * and/or hostname */ + for (j=0; j < size; j++) { + if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODEID)) { + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + } + PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, nd->nodeid, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(nd); + PMIX_LIST_DESTRUCT(&cache); + return rc; + } + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_HOSTNAME)) { + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + } + nd->hostname = strdup(iptr[j].value.data.string); + } else { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + if (NULL != nd) { + PMIX_RELEASE(nd); + } + PMIX_LIST_DESTRUCT(&cache); + return rc; + } + pmix_list_append(&cache, &kp2->super); + } + } + + if (NULL == nd) { + /* they forgot to pass us the ident for the node */ + PMIX_LIST_DESTRUCT(&cache); + return PMIX_ERR_BAD_PARAM; + } + + /* see if we already have this node on the + * provided list */ + update = false; + PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { + if (ndptr->nodeid == nd->nodeid || + (NULL != ndptr->hostname && NULL != nd->hostname && 0 == strcmp(ndptr->hostname, nd->hostname))) { + /* we assume that the data is updating the current + * values */ + if (NULL == ndptr->hostname && NULL != nd->hostname) { + ndptr->hostname = strdup(nd->hostname); + } + PMIX_RELEASE(nd); + nd = ndptr; + update = true; + break; + } + } + + /* transfer the cached items to the nodeinfo list */ + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + while (NULL != kp2) { + /* if this is an update, we have to ensure each data + * item only appears once on the list */ + if (update) { + PMIX_LIST_FOREACH_SAFE(k1, knext, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(k1, kp2->key)) { + pmix_list_remove_item(&nd->info, &k1->super); + PMIX_RELEASE(k1); + break; + } + } + } + pmix_list_append(&nd->info, &kp2->super); + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + } + PMIX_LIST_DESTRUCT(&cache); + + pmix_list_append(tgt, &nd->super); + return PMIX_SUCCESS; +} + +/* process an app array - contains an array of + * app-level info for a single app. If the + * appnum is not included in the array, then + * it is assumed that only app is in the job. + * This assumption is checked and generates + * an error if violated */ +static pmix_status_t process_app_array(pmix_info_t *info, + pmix_job_t *trk) +{ + pmix_list_t cache, ncache; + size_t size, j; + pmix_info_t *iptr; + pmix_status_t rc = PMIX_SUCCESS; + uint32_t appnum; + pmix_apptrkr_t *app = NULL, *apptr; + pmix_kval_t *kp2, *k1, *knext; + pmix_nodeinfo_t *nd; + bool update; + + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "PROCESSING APP ARRAY"); + + /* apps have to belong to a job */ + if (NULL == trk) { + return PMIX_ERR_BAD_PARAM; + } + + /* array of app-level info */ + if (PMIX_DATA_ARRAY != info->value.type) { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + return PMIX_ERR_TYPE_MISMATCH; + } + + /* setup arrays and lists */ + PMIX_CONSTRUCT(&cache, pmix_list_t); + PMIX_CONSTRUCT(&ncache, pmix_list_t); + size = info->value.data.darray->size; + iptr = (pmix_info_t*)info->value.data.darray->array; + + for (j=0; j < size; j++) { + if (PMIX_CHECK_KEY(&iptr[j], PMIX_APPNUM)) { + PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, appnum, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto release; + } + if (NULL != app) { + /* this is an error - there can be only one app + * described in this array */ + PMIX_RELEASE(app); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + return PMIX_ERR_BAD_PARAM; + } + app = PMIX_NEW(pmix_apptrkr_t); + app->appnum = appnum; + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &ncache))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + goto release; + } + pmix_list_append(&cache, &kp2->super); + } + } + if (NULL == app) { + /* per the standard, they don't have to provide us with + * an appnum so long as only one app is in the job */ + if (0 == pmix_list_get_size(&trk->apps)) { + app = PMIX_NEW(pmix_apptrkr_t); + } else { + /* this is not allowed to happen - they are required + * to provide us with an app number per the standard */ + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + goto release; + } + } + /* see if we already have this app on the + * provided list */ + update = false; + PMIX_LIST_FOREACH(apptr, &trk->apps, pmix_apptrkr_t) { + if (apptr->appnum == app->appnum) { + /* we assume that the data is updating the current + * values */ + PMIX_RELEASE(app); + app = apptr; + update = true; + break; + } + } + + /* point the app at its job */ + if (NULL == app->job) { + PMIX_RETAIN(trk); + app->job = trk; + } + + /* transfer the app-level data across */ + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + while (NULL != kp2) { + /* if this is an update, we have to ensure each data + * item only appears once on the list */ + if (update) { + PMIX_LIST_FOREACH_SAFE(k1, knext, &app->appinfo, pmix_kval_t) { + if (PMIX_CHECK_KEY(k1, kp2->key)) { + pmix_list_remove_item(&app->appinfo, &k1->super); + PMIX_RELEASE(k1); + break; + } + } + } + pmix_list_append(&app->appinfo, &kp2->super); + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + } + /* transfer the associated node-level data across */ + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + while (NULL != nd) { + pmix_list_append(&app->nodeinfo, &nd->super); + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + } + + release: + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + + return rc; +} + +/* process a job array */ +static pmix_status_t process_job_array(pmix_info_t *info, + pmix_job_t *trk, + uint32_t *flags, + char ***procs, + char ***nodes) +{ + pmix_list_t cache; + size_t j, size; + pmix_info_t *iptr; + pmix_kval_t *kp2; + pmix_status_t rc; + + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "PROCESSING JOB ARRAY"); + + /* array of job-level info */ + if (PMIX_DATA_ARRAY != info->value.type) { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + return PMIX_ERR_TYPE_MISMATCH; + } + size = info->value.data.darray->size; + iptr = (pmix_info_t*)info->value.data.darray->array; + PMIX_CONSTRUCT(&cache, pmix_list_t); + for (j=0; j < size; j++) { + if (PMIX_CHECK_KEY(&iptr[j], PMIX_APP_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_app_array(&iptr[j], trk))) { + return rc; + } + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &trk->nodeinfo))) { + PMIX_ERROR_LOG(rc); + return rc; + } + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_PROC_MAP)) { + /* not allowed to get this more than once */ + if (*flags & PMIX_HASH_PROC_MAP) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } + /* parse the regex to get the argv array containing proc ranks on each node */ + if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(iptr[j].value.data.string, procs))) { + PMIX_ERROR_LOG(rc); + return rc; + } + /* mark that we got the map */ + *flags |= PMIX_HASH_PROC_MAP; + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_MAP)) { + /* not allowed to get this more than once */ + if (*flags & PMIX_HASH_NODE_MAP) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } + /* store the node map itself since that is + * what v3 uses */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(PMIX_NODE_MAP); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kp2->value->type = PMIX_STRING; + kp2->value->data.string = strdup(iptr[j].value.data.string); + if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->internal, PMIX_RANK_WILDCARD, kp2))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + PMIX_RELEASE(kp2); // maintain acctg + + /* parse the regex to get the argv array of node names */ + if (PMIX_SUCCESS != (rc = pmix_preg.parse_nodes(iptr[j].value.data.string, nodes))) { + PMIX_ERROR_LOG(rc); + return rc; + } + /* mark that we got the map */ + *flags |= PMIX_HASH_NODE_MAP; + } else { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(kp2); + PMIX_LIST_DESTRUCT(&cache); + return rc; + } + pmix_list_append(&trk->jobinfo, &kp2->super); + } + } + return PMIX_SUCCESS; +} + +static pmix_list_t mysessions, myjobs; static pmix_status_t hash_init(pmix_info_t info[], size_t ninfo) { pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "gds: hash init"); - PMIX_CONSTRUCT(&myhashes, pmix_list_t); + PMIX_CONSTRUCT(&mysessions, pmix_list_t); + PMIX_CONSTRUCT(&myjobs, pmix_list_t); return PMIX_SUCCESS; } @@ -172,7 +617,8 @@ static void hash_finalize(void) pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "gds: hash finalize"); - PMIX_LIST_DESTRUCT(&myhashes); + PMIX_LIST_DESTRUCT(&mysessions); + PMIX_LIST_DESTRUCT(&myjobs); } static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, @@ -201,13 +647,6 @@ static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, return PMIX_SUCCESS; } -/* Define a bitmask to track what information may not have - * been provided but is computable from other info */ -#define PMIX_HASH_PROC_DATA 0x00000001 -#define PMIX_HASH_JOB_SIZE 0x00000002 -#define PMIX_HASH_MAX_PROCS 0x00000004 -#define PMIX_HASH_NUM_NODES 0x00000008 - static pmix_status_t store_map(pmix_hash_table_t *ht, char **nodes, char **ppn, uint32_t flags) @@ -496,16 +935,20 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo) { pmix_namespace_t *nptr = (pmix_namespace_t*)ns; - pmix_hash_trkr_t *trk, *t; + pmix_job_t *trk, *t; + pmix_session_t *s = NULL, *sptr; pmix_hash_table_t *ht; pmix_kval_t *kp2, *kvptr; pmix_info_t *iptr; char **nodes=NULL, **procs=NULL; uint8_t *tmp; + uint32_t sid=UINT32_MAX; pmix_rank_t rank; pmix_status_t rc=PMIX_SUCCESS; size_t n, j, size, len; uint32_t flags = 0; + pmix_list_t cache, ncache; + pmix_nodeinfo_t *nd; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:cache_job_info for nspace %s", @@ -514,7 +957,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, /* find the hash table for this nspace */ trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(nptr->nspace, t->ns)) { trk = t; break; @@ -522,14 +965,14 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, } if (NULL == trk) { /* create a tracker as we will likely need it */ - trk = PMIX_NEW(pmix_hash_trkr_t); + trk = PMIX_NEW(pmix_job_t); if (NULL == trk) { return PMIX_ERR_NOMEM; } PMIX_RETAIN(nptr); trk->nptr = nptr; trk->ns = strdup(nptr->nspace); - pmix_list_append(&myhashes, &trk->super); + pmix_list_append(&myjobs, &trk->super); } /* if there isn't any data, then be content with just @@ -541,7 +984,141 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, /* cache the job info on the internal hash table for this nspace */ ht = &trk->internal; for (n=0; n < ninfo; n++) { - if (0 == strcmp(info[n].key, PMIX_NODE_MAP)) { + if (PMIX_CHECK_KEY(&info[n], PMIX_SESSION_ID)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, sid, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto release; + } + /* see if we have this session */ + s = NULL; + PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { + if (sptr->session == sid) { + s = sptr; + break; + } + } + if (NULL == s) { + s = PMIX_NEW(pmix_session_t); + s->session = sid; + pmix_list_append(&mysessions, &s->super); + } + /* point the job at it */ + if (NULL == trk->session) { + PMIX_RETAIN(s); + trk->session = s; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SESSION_INFO_ARRAY)) { + /* array of session-level info */ + if (PMIX_DATA_ARRAY != info[n].value.type) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + rc = PMIX_ERR_TYPE_MISMATCH; + goto release; + } + size = info[n].value.data.darray->size; + iptr = (pmix_info_t*)info[n].value.data.darray->array; + PMIX_CONSTRUCT(&cache, pmix_list_t); + PMIX_CONSTRUCT(&ncache, pmix_list_t); + for (j=0; j < size; j++) { + if (PMIX_CHECK_KEY(&iptr[j], PMIX_SESSION_ID)) { + PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, sid, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_LIST_DESTRUCT(&cache); + return rc; + } + /* setup a session object */ + if (NULL != s) { + /* does this match the one we were previously given? */ + if (sid != s->session) { + /* no - see if we already have this session */ + PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { + if (sptr->session == sid) { + s = sptr; + break; + } + } + if (sid != s->session) { + /* wasn't found, so create one */ + s = PMIX_NEW(pmix_session_t); + s->session = sid; + pmix_list_append(&mysessions, &s->super); + } + } + } else { + s = PMIX_NEW(pmix_session_t); + s->session = sid; + pmix_list_append(&mysessions, &s->super); + } + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &ncache))) { + PMIX_ERROR_LOG(rc); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + goto release; + } + } else { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + goto release; + } + pmix_list_append(&cache, &kp2->super); + } + } + if (NULL == s) { + /* this is not allowed to happen - they are required + * to provide us with a session ID per the standard */ + PMIX_LIST_DESTRUCT(&cache); + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + goto release; + } + /* point the job at it */ + if (NULL == trk->session) { + PMIX_RETAIN(s); + trk->session = s; + } + /* transfer the data across */ + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + while (NULL != kp2) { + pmix_list_append(&s->sessioninfo, &kp2->super); + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + } + PMIX_LIST_DESTRUCT(&cache); + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + while (NULL != nd) { + pmix_list_append(&s->nodeinfo, &nd->super); + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + } + PMIX_LIST_DESTRUCT(&ncache); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_JOB_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_job_array(&info[n], trk, &flags, &procs, &nodes))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_APP_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_app_array(&info[n], trk))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(&info[n], &trk->nodeinfo))) { + PMIX_ERROR_LOG(rc); + goto release; + } + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_MAP)) { + /* not allowed to get this more than once */ + if (flags & PMIX_HASH_NODE_MAP) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } /* store the node map itself since that is * what v3 uses */ kp2 = PMIX_NEW(pmix_kval_t); @@ -561,12 +1138,21 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, PMIX_ERROR_LOG(rc); goto release; } - } else if (0 == strcmp(info[n].key, PMIX_PROC_MAP)) { + /* mark that we got the map */ + flags |= PMIX_HASH_NODE_MAP; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_PROC_MAP)) { + /* not allowed to get this more than once */ + if (flags & PMIX_HASH_PROC_MAP) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } /* parse the regex to get the argv array containing proc ranks on each node */ if (PMIX_SUCCESS != (rc = pmix_preg.parse_procs(info[n].value.data.string, &procs))) { PMIX_ERROR_LOG(rc); goto release; } + /* mark that we got the map */ + flags |= PMIX_HASH_PROC_MAP; } else if (0 == strcmp(info[n].key, PMIX_PROC_DATA)) { flags |= PMIX_HASH_PROC_DATA; /* an array of data pertaining to a specific proc */ @@ -723,18 +1309,18 @@ static pmix_status_t register_info(pmix_peer_t *peer, pmix_namespace_t *ns, pmix_buffer_t *reply) { - pmix_hash_trkr_t *trk, *t; + pmix_job_t *trk, *t; pmix_hash_table_t *ht; pmix_value_t *val, blob; pmix_status_t rc = PMIX_SUCCESS; pmix_info_t *info; size_t ninfo, n; - pmix_kval_t kv; + pmix_kval_t kv, *kvptr; pmix_buffer_t buf; pmix_rank_t rank; trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(ns->nspace, t->ns)) { trk = t; break; @@ -773,6 +1359,12 @@ static pmix_status_t register_info(pmix_peer_t *peer, PMIX_VALUE_RELEASE(val); } + /* add all values in the jobinfo list */ + PMIX_LIST_FOREACH(kvptr, &trk->jobinfo, pmix_kval_t) { + PMIX_BFROPS_PACK(rc, peer, reply, kvptr, 1, PMIX_KVAL); + } + + /* get the proc-level data for each proc in the job */ for (rank=0; rank < ns->nprocs; rank++) { val = NULL; rc = pmix_hash_fetch(ht, rank, NULL, &val); @@ -820,7 +1412,7 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, pmix_namespace_t *ns = peer->nptr; char *msg; pmix_status_t rc; - pmix_hash_trkr_t *trk, *t2; + pmix_job_t *trk, *t2; if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { @@ -857,7 +1449,7 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, /* setup a tracker for this nspace as we will likely * need it again */ trk = NULL; - PMIX_LIST_FOREACH(t2, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t2, &myjobs, pmix_job_t) { if (ns == t2->nptr) { trk = t2; if (NULL == trk->ns) { @@ -867,11 +1459,11 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, } } if (NULL == trk) { - trk = PMIX_NEW(pmix_hash_trkr_t); + trk = PMIX_NEW(pmix_job_t); trk->ns = strdup(ns->nspace); PMIX_RETAIN(ns); trk->nptr = ns; - pmix_list_append(&myhashes, &trk->super); + pmix_list_append(&myjobs, &trk->super); } /* the job info for the specified nspace has @@ -914,10 +1506,11 @@ static pmix_status_t hash_store_job_info(const char *nspace, pmix_byte_object_t *bo; pmix_buffer_t buf2; int rank; - pmix_hash_trkr_t *htptr; + pmix_job_t *htptr; pmix_hash_table_t *ht; char **nodelist = NULL; pmix_info_t *info, *iptr; + pmix_namespace_t *ns, *nptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%u] pmix:gds:hash store job info for nspace %s", @@ -937,9 +1530,27 @@ static pmix_status_t hash_store_job_info(const char *nspace, return rc; } + /* see if we already have this nspace */ + nptr = NULL; + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(ns->nspace, nspace)) { + nptr = ns; + break; + } + } + if (NULL == nptr) { + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + rc = PMIX_ERR_NOMEM; + return rc; + } + nptr->nspace = strdup(nspace); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); + } + /* see if we already have a hash table for this nspace */ ht = NULL; - PMIX_LIST_FOREACH(htptr, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(htptr, &myjobs, pmix_job_t) { if (0 == strcmp(htptr->ns, nspace)) { ht = &htptr->internal; break; @@ -947,9 +1558,11 @@ static pmix_status_t hash_store_job_info(const char *nspace, } if (NULL == ht) { /* nope - create one */ - htptr = PMIX_NEW(pmix_hash_trkr_t); + htptr = PMIX_NEW(pmix_job_t); htptr->ns = strdup(nspace); - pmix_list_append(&myhashes, &htptr->super); + PMIX_RETAIN(nptr); + htptr->nptr = nptr; + pmix_list_append(&myjobs, &htptr->super); ht = &htptr->internal; } @@ -961,7 +1574,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%u] pmix:gds:hash store job info working key %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, kptr->key); - if (0 == strcmp(kptr->key, PMIX_PROC_BLOB)) { + if (PMIX_CHECK_KEY(kptr, PMIX_PROC_BLOB)) { bo = &(kptr->value->data.bo); PMIX_CONSTRUCT(&buf2, pmix_buffer_t); PMIX_LOAD_BUFFER(pmix_client_globals.myserver, &buf2, bo->bytes, bo->size); @@ -1012,7 +1625,7 @@ static pmix_status_t hash_store_job_info(const char *nspace, /* cleanup */ PMIX_DESTRUCT(&buf2); // releases the original kptr data PMIX_RELEASE(kp2); - } else if (0 == strcmp(kptr->key, PMIX_MAP_BLOB)) { + } else if (PMIX_CHECK_KEY(kptr, PMIX_MAP_BLOB)) { /* transfer the byte object for unpacking */ bo = &(kptr->value->data.bo); PMIX_CONSTRUCT(&buf2, pmix_buffer_t); @@ -1183,6 +1796,11 @@ static pmix_status_t hash_store_job_info(const char *nspace, PMIX_RELEASE(kptr); return rc; } + /* if this is the job size, then store it in + * the nptr tracker */ + if (0 == nptr->nprocs && PMIX_CHECK_KEY(kptr, PMIX_JOB_SIZE)) { + nptr->nprocs = kptr->value->data.uint32; + } } PMIX_RELEASE(kptr); kptr = PMIX_NEW(pmix_kval_t); @@ -1205,14 +1823,15 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, pmix_scope_t scope, pmix_kval_t *kv) { - pmix_hash_trkr_t *trk, *t; + pmix_job_t *trk, *t; pmix_status_t rc; pmix_kval_t *kp; + pmix_namespace_t *ns, *nptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, - "[%s:%d] gds:hash:hash_store for proc [%s:%d] key %s type %s scope %s", - pmix_globals.myid.nspace, pmix_globals.myid.rank, - proc->nspace, proc->rank, kv->key, + "%s gds:hash:hash_store for proc %s key %s type %s scope %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(proc), kv->key, PMIx_Data_type_string(kv->value->type), PMIx_Scope_string(scope)); if (NULL == kv->key) { @@ -1221,7 +1840,7 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, /* find the hash table for this nspace */ trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(proc->nspace, t->ns)) { trk = t; break; @@ -1229,9 +1848,29 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, } if (NULL == trk) { /* create one */ - trk = PMIX_NEW(pmix_hash_trkr_t); + trk = PMIX_NEW(pmix_job_t); trk->ns = strdup(proc->nspace); - pmix_list_append(&myhashes, &trk->super); + /* see if we already have this nspace */ + nptr = NULL; + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(ns->nspace, proc->nspace)) { + nptr = ns; + break; + } + } + if (NULL == nptr) { + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + rc = PMIX_ERR_NOMEM; + PMIX_RELEASE(trk); + return rc; + } + nptr->nspace = strdup(proc->nspace); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); + } + PMIX_RETAIN(nptr); + trk->nptr = nptr; + pmix_list_append(&myjobs, &trk->super); } /* see if the proc is me */ @@ -1264,6 +1903,11 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, } } + /* if the number of procs for the nspace object is new, then update it */ + if (0 == trk->nptr->nprocs && PMIX_CHECK_KEY(kv, PMIX_JOB_SIZE)) { + trk->nptr->nprocs = kv->value->data.uint32; + } + /* store it in the corresponding hash table */ if (PMIX_INTERNAL == scope) { if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->internal, proc->rank, kv))) { @@ -1332,12 +1976,13 @@ static pmix_status_t _hash_store_modex(void * cbdata, pmix_byte_object_t *bo) { pmix_namespace_t *ns = (pmix_namespace_t*)nspace; - pmix_hash_trkr_t *trk, *t; + pmix_job_t *trk, *t; pmix_status_t rc = PMIX_SUCCESS; int32_t cnt; pmix_buffer_t pbkt; pmix_proc_t proc; pmix_kval_t *kv; + pmix_namespace_t *ns2, *nptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_modex for nspace %s", @@ -1346,7 +1991,7 @@ static pmix_status_t _hash_store_modex(void * cbdata, /* find the hash table for this nspace */ trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(ns->nspace, t->ns)) { trk = t; break; @@ -1354,9 +1999,29 @@ static pmix_status_t _hash_store_modex(void * cbdata, } if (NULL == trk) { /* create one */ - trk = PMIX_NEW(pmix_hash_trkr_t); + trk = PMIX_NEW(pmix_job_t); trk->ns = strdup(ns->nspace); - pmix_list_append(&myhashes, &trk->super); + /* see if we already have this nspace */ + nptr = NULL; + PMIX_LIST_FOREACH(ns2, &pmix_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(ns->nspace, ns2->nspace)) { + nptr = ns2; + break; + } + } + if (NULL == nptr) { + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + rc = PMIX_ERR_NOMEM; + PMIX_RELEASE(trk); + return rc; + } + nptr->nspace = strdup(ns->nspace); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); + } + PMIX_RETAIN(nptr); + trk->nptr = nptr; + pmix_list_append(&myjobs, &trk->super); } /* this is data returned via the PMIx_Fence call when @@ -1386,14 +2051,20 @@ static pmix_status_t _hash_store_modex(void * cbdata, kv = PMIX_NEW(pmix_kval_t); PMIX_BFROPS_UNPACK(rc, pmix_globals.mypeer, &pbkt, kv, &cnt, PMIX_KVAL); while (PMIX_SUCCESS == rc) { - /* store this in the hash table */ - if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, proc.rank, kv))) { - PMIX_ERROR_LOG(rc); - bo->bytes = pbkt.base_ptr; - bo->size = pbkt.bytes_used; // restore the incoming data - pbkt.base_ptr = NULL; - PMIX_DESTRUCT(&pbkt); - return rc; + if (PMIX_RANK_UNDEF == proc.rank) { + /* if the rank is undefined, then we store it on the + * remote table of rank=0 as we know that rank must + * always exist */ + if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, 0, kv))) { + PMIX_ERROR_LOG(rc); + return rc; + } + } else { + /* store this in the hash table */ + if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->remote, proc.rank, kv))) { + PMIX_ERROR_LOG(rc); + return rc; + } } PMIX_RELEASE(kv); // maintain accounting as the hash increments the ref count /* continue along */ @@ -1415,25 +2086,257 @@ static pmix_status_t _hash_store_modex(void * cbdata, } +static pmix_status_t dohash(pmix_hash_table_t *ht, + const char *key, + pmix_rank_t rank, + bool skip_genvals, + pmix_list_t *kvs) +{ + pmix_status_t rc; + pmix_value_t *val; + pmix_kval_t *kv, *k2; + pmix_info_t *info; + size_t n, ninfo; + bool found; + + rc = pmix_hash_fetch(ht, rank, key, &val); + if (PMIX_SUCCESS == rc) { + /* if the key was NULL, then all found keys will be + * returned as a pmix_data_array_t in the value */ + if (NULL == key) { + if (NULL == val->data.darray || + PMIX_INFO != val->data.darray->type || + 0 == val->data.darray->size) { + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + PMIX_RELEASE(val); + return PMIX_ERR_NOT_FOUND; + } + info = (pmix_info_t*)val->data.darray->array; + ninfo = val->data.darray->size; + for (n=0; n < ninfo; n++) { + /* if the rank is UNDEF, then we don't want + * anything that starts with "pmix" */ + if (skip_genvals && + 0 == strncmp(info[n].key, "pmix", 4)) { + continue; + } + /* see if we already have this on the list */ + found = false; + PMIX_LIST_FOREACH(k2, kvs, pmix_kval_t) { + if (PMIX_CHECK_KEY(&info[n], k2->key)) { + found = true; + break; + } + } + if (found) { + continue; + } + kv = PMIX_NEW(pmix_kval_t); + if (NULL == kv) { + PMIX_VALUE_RELEASE(val); + return PMIX_ERR_NOMEM; + } + kv->key = strdup(info[n].key); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_VALUE_RELEASE(val); + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, + kv->value, &info[n].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_VALUE_RELEASE(val); + PMIX_RELEASE(kv); + return rc; + } + pmix_list_append(kvs, &kv->super); + } + PMIX_VALUE_RELEASE(val); + } else { + kv = PMIX_NEW(pmix_kval_t); + if (NULL == kv) { + PMIX_VALUE_RELEASE(val); + return PMIX_ERR_NOMEM; + } + kv->key = strdup(key); + kv->value = val; + pmix_list_append(kvs, &kv->super); + } + } + return rc; +} + +static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, + pmix_info_t *info, size_t ninfo, + pmix_list_t *kvs) +{ + size_t n; + pmix_status_t rc; + uint32_t nid=0; + char *hostname = NULL; + bool found = false; + pmix_nodeinfo_t *nd, *ndptr; + pmix_kval_t *kv, *kp2; + + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "FETCHING NODE INFO"); + + /* scan for the nodeID or hostname to identify + * which node they are asking about */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_NODEID)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, nid, uint32_t); + if (PMIX_SUCCESS != rc) { + return rc; + } + found = true; + break; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_HOSTNAME)) { + hostname = info[n].value.data.string; + found = true; + break; + } + } + if (!found) { + return PMIX_ERR_DATA_VALUE_NOT_FOUND; + } + + /* scan the list of nodes to find the matching entry */ + nd = NULL; + PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { + if (NULL != hostname && 0 == strcmp(ndptr->hostname, hostname)) { + nd = ndptr; + break; + } + if (NULL == hostname && nid == ndptr->nodeid) { + nd = ndptr; + break; + } + } + if (NULL == nd) { + return PMIX_ERR_NOT_FOUND; + } + /* scan the info list of this node to generate the results */ + rc = PMIX_ERR_NOT_FOUND; + PMIX_LIST_FOREACH(kv, &nd->info, pmix_kval_t) { + if (NULL == key || PMIX_CHECK_KEY(kv, key)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(kv->key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, kv->value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + pmix_list_append(kvs, &kp2->super); + rc = PMIX_SUCCESS; + if (NULL != key) { + break; + } + } + } + + return rc; +} + +static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, + pmix_info_t *info, size_t ninfo, + pmix_list_t *kvs) +{ + size_t n; + pmix_status_t rc; + uint32_t appnum; + bool found = false; + pmix_apptrkr_t *app, *apptr; + pmix_kval_t *kv, *kp2; + + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "FETCHING APP INFO"); + + /* scan for the appnum to identify + * which app they are asking about */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_APPNUM)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, appnum, uint32_t); + if (PMIX_SUCCESS != rc) { + return rc; + } + found = true; + break; + } + } + if (!found) { + return PMIX_ERR_DATA_VALUE_NOT_FOUND; + } + + /* scan the list of apps to find the matching entry */ + app = NULL; + PMIX_LIST_FOREACH(apptr, tgt, pmix_apptrkr_t) { + if (appnum == apptr->appnum) { + app = apptr; + break; + } + } + if (NULL == app) { + return PMIX_ERR_NOT_FOUND; + } + + /* see if they wanted to know something about a node that + * is associated with this app */ + rc = fetch_nodeinfo(key, &app->nodeinfo, info, ninfo, kvs); + if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { + return rc; + } + + /* scan the info list of this app to generate the results */ + rc = PMIX_ERR_NOT_FOUND; + PMIX_LIST_FOREACH(kv, &app->appinfo, pmix_kval_t) { + if (NULL == key || PMIX_CHECK_KEY(kv, key)) { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(kv->key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, kv->value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + pmix_list_append(kvs, &kp2->super); + rc = PMIX_SUCCESS; + if (NULL != key) { + break; + } + } + } + + return rc; +} + static pmix_status_t hash_fetch(const pmix_proc_t *proc, pmix_scope_t scope, bool copy, const char *key, pmix_info_t qualifiers[], size_t nqual, pmix_list_t *kvs) { - pmix_hash_trkr_t *trk, *t; + pmix_job_t *trk, *t; pmix_status_t rc; pmix_value_t *val; - pmix_kval_t *kv; + pmix_kval_t *kv, *kvptr; pmix_info_t *info; size_t n, ninfo; pmix_hash_table_t *ht; + pmix_session_t *sptr; + uint32_t sid; + pmix_rank_t rnk; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, - "[%s:%u] pmix:gds:hash fetch %s for proc %s:%u on scope %s", - pmix_globals.myid.nspace, pmix_globals.myid.rank, + "%s pmix:gds:hash fetch %s for proc %s on scope %s", + PMIX_NAME_PRINT(&pmix_globals.myid), (NULL == key) ? "NULL" : key, - proc->nspace, proc->rank, PMIx_Scope_string(scope)); + PMIX_NAME_PRINT(proc), PMIx_Scope_string(scope)); /* if the rank is wildcard and the key is NULL, then * they are asking for a complete copy of the job-level @@ -1442,7 +2345,7 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, /* see if we have a tracker for this nspace - we will * if we already cached the job info for it */ trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(proc->nspace, t->ns)) { trk = t; break; @@ -1497,9 +2400,58 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, return PMIX_SUCCESS; } + /* if the nspace and rank are undefined, then they are asking + * for session-level information. */ + if (0 == strlen(proc->nspace) && PMIX_RANK_UNDEF == proc->rank) { + /* they must have included something identifying the info + * class they are querying */ + for (n=0; n < nqual; n++) { + if (PMIX_CHECK_KEY(&qualifiers[n], PMIX_SESSION_ID)) { + /* they want session-level info - see if we have + * that session */ + PMIX_VALUE_GET_NUMBER(rc, &qualifiers[n].value, sid, uint32_t); + if (PMIX_SUCCESS != rc) { + /* didn't provide a correct value */ + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { + if (sptr->session == sid) { + /* see if they want info for a specific node */ + rc = fetch_nodeinfo(key, &sptr->nodeinfo, qualifiers, nqual, kvs); + /* if they did, then we are done */ + if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { + return rc; + } + /* check the session info */ + PMIX_LIST_FOREACH(kvptr, &sptr->sessioninfo, pmix_kval_t) { + if (NULL == key || PMIX_CHECK_KEY(kvptr, key)) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(kvptr->key); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kv->value, kvptr->value); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(kv); + return rc; + } + pmix_list_append(kvs, &kv->super); + if (NULL != key) { + /* we are done */ + return PMIX_SUCCESS; + } + } + } + } + } + /* if we get here, then the session wasn't found */ + return PMIX_ERR_NOT_FOUND; + } + } + } + /* find the hash table for this nspace */ trk = NULL; - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(proc->nspace, t->ns)) { trk = t; break; @@ -1509,6 +2461,24 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, return PMIX_ERR_INVALID_NAMESPACE; } + /* if the rank isn't specified, check to see if they + * are looking for app-level or node-level info for + * this job */ + if (PMIX_RANK_UNDEF == proc->rank) { + /* see if they want info for a specific node */ + rc = fetch_nodeinfo(key, &trk->nodeinfo, qualifiers, nqual, kvs); + /* if they did, then we are done */ + if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { + return rc; + } + /* see if they want info for a specific app */ + rc = fetch_appinfo(key, &trk->apps, qualifiers, nqual, kvs); + /* if they did, then we are done */ + if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { + return rc; + } + } + /* fetch from the corresponding hash table - note that * we always provide a copy as we don't support * shared memory */ @@ -1528,59 +2498,56 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, } doover: - rc = pmix_hash_fetch(ht, proc->rank, key, &val); - if (PMIX_SUCCESS == rc) { - /* if the key was NULL, then all found keys will be - * returned as a pmix_data_array_t in the value */ - if (NULL == key) { - if (NULL == val->data.darray || - PMIX_INFO != val->data.darray->type || - 0 == val->data.darray->size) { - PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); - return PMIX_ERR_NOT_FOUND; + /* if rank=PMIX_RANK_UNDEF, then we need to search all + * known ranks for this nspace as any one of them could + * be the source */ + if (PMIX_RANK_UNDEF == proc->rank) { + for (rnk=0; rnk < trk->nptr->nprocs; rnk++) { + rc = dohash(ht, key, rnk, true, kvs); + if (PMIX_ERR_NOMEM == rc) { + return rc; } - info = (pmix_info_t*)val->data.darray->array; - ninfo = val->data.darray->size; - for (n=0; n < ninfo; n++) { + if (PMIX_SUCCESS == rc && NULL != key) { + return rc; + } + } + /* also need to check any job-level info */ + PMIX_LIST_FOREACH(kvptr, &trk->jobinfo, pmix_kval_t) { + if (NULL == key || PMIX_CHECK_KEY(kvptr, key)) { kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - PMIX_VALUE_RELEASE(val); - return PMIX_ERR_NOMEM; - } - kv->key = strdup(info[n].key); + kv->key = strdup(kvptr->key); kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kv->value) { - PMIX_VALUE_RELEASE(val); - PMIX_RELEASE(kv); - return PMIX_ERR_NOMEM; - } - PMIX_BFROPS_VALUE_XFER(rc, pmix_globals.mypeer, - kv->value, &info[n].value); + PMIX_VALUE_XFER(rc, kv->value, kvptr->value); if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_VALUE_RELEASE(val); PMIX_RELEASE(kv); return rc; } pmix_list_append(kvs, &kv->super); + if (NULL != key) { + break; + } } - PMIX_VALUE_RELEASE(val); - if (PMIX_GLOBAL == scope && ht == &trk->local) { + } + if (NULL == key) { + /* and need to add all job info just in case that was + * passed via a different GDS component */ + dohash(&trk->internal, NULL, PMIX_RANK_WILDCARD, false, kvs); + } + } else { + rc = dohash(ht, key, proc->rank, false, kvs); + } + if (PMIX_SUCCESS == rc) { + if (PMIX_GLOBAL == scope) { + if (ht == &trk->local) { /* need to do this again for the remote data */ ht = &trk->remote; goto doover; + } else if (ht == &trk->internal) { + /* check local */ + ht = &trk->local; + goto doover; } - return PMIX_SUCCESS; } - /* just return the value */ - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - PMIX_VALUE_RELEASE(val); - return PMIX_ERR_NOMEM; - } - kv->key = strdup(key); - kv->value = val; - pmix_list_append(kvs, &kv->super); } else { if (PMIX_GLOBAL == scope || PMIX_SCOPE_UNDEF == scope) { @@ -1595,6 +2562,9 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, } } } + if (0 == pmix_list_get_size(kvs)) { + rc = PMIX_ERR_NOT_FOUND; + } return rc; } @@ -1615,13 +2585,13 @@ static pmix_status_t nspace_add(const char *nspace, static pmix_status_t nspace_del(const char *nspace) { - pmix_hash_trkr_t *t; + pmix_job_t *t; /* find the hash table for this nspace */ - PMIX_LIST_FOREACH(t, &myhashes, pmix_hash_trkr_t) { + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { if (0 == strcmp(nspace, t->ns)) { /* release it */ - pmix_list_remove_item(&myhashes, &t->super); + pmix_list_remove_item(&myjobs, &t->super); PMIX_RELEASE(t); break; } @@ -1685,6 +2655,12 @@ static pmix_status_t accept_kvs_resp(pmix_buffer_t *buf) PMIX_ERROR_LOG(rc); return rc; } + /* if the rank is UNDEF, then we store this on our own + * rank tables */ + if (PMIX_RANK_UNDEF == proct.rank) { + proct.rank = pmix_globals.myid.rank; + } + cnt = 1; kv = PMIX_NEW(pmix_kval_t); PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, @@ -1694,7 +2670,6 @@ static pmix_status_t accept_kvs_resp(pmix_buffer_t *buf) * the kval contains shmem connection info, then the * component will know what to do about it (or else * we selected the wrong component for this peer!) */ - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, &proct, PMIX_INTERNAL, kv); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c index 800923c34fc..1d48b462770 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv4/pif_bsdx.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -158,7 +158,7 @@ static int if_bsdx_open(void) /* fill values into the pmix_pif_t */ memcpy(&a4, &(sin_addr->sin_addr), sizeof(struct in_addr)); - pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE-1); + pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, PMIX_IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list) + 1; ((struct sockaddr_in*) &intf->if_addr)->sin_addr = a4; ((struct sockaddr_in*) &intf->if_addr)->sin_family = AF_INET; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c index 5954f1580c5..ff30d73500b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/bsdx_ipv6/pif_bsdx_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -183,7 +183,7 @@ static int if_bsdx_ipv6_open(void) return PMIX_ERR_OUT_OF_RESOURCE; } intf->af_family = AF_INET6; - pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, IF_NAMESIZE-1); + pmix_strncpy(intf->if_name, cur_ifaddrs->ifa_name, PMIX_IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list) + 1; ((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6; ((struct sockaddr_in6*) &intf->if_addr)->sin6_family = AF_INET6; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c index f0bb2db9f5e..53bec6fb04a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/linux_ipv6/pif_linux_ipv6.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -80,12 +80,17 @@ static int if_linux_ipv6_open(void) { FILE *f; if ((f = fopen("/proc/net/if_inet6", "r"))) { - char ifname[IF_NAMESIZE]; + /* IF_NAMESIZE is normally 16 on Linux, + but the next scanf allows up to 21 bytes */ + char ifname[PMIX_IF_NAMESIZE]; unsigned int idx, pfxlen, scope, dadstat; struct in6_addr a6; int iter; uint32_t flag; - unsigned int addrbyte[16]; + unsigned int addrbyte[PMIX_IF_NAMESIZE]; + + memset(addrbyte, 0, PMIX_IF_NAMESIZE*sizeof(unsigned int)); + memset(ifname, 0, PMIX_IF_NAMESIZE*sizeof(char)); while (fscanf(f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x %x %x %x %x %20s\n", &addrbyte[0], &addrbyte[1], &addrbyte[2], &addrbyte[3], @@ -102,8 +107,8 @@ static int if_linux_ipv6_open(void) addrbyte[8], addrbyte[9], addrbyte[10], addrbyte[11], addrbyte[12], addrbyte[13], addrbyte[14], addrbyte[15], scope); - /* we don't want any other scope less than link-local */ - if (scope < 0x20) { + /* Only interested in global (0x00) scope */ + if (scope != 0x00) { pmix_output_verbose(1, pmix_pif_base_framework.framework_output, "skipping interface %2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x:%2x%2x scope %x\n", addrbyte[0], addrbyte[1], addrbyte[2], addrbyte[3], @@ -127,7 +132,7 @@ static int if_linux_ipv6_open(void) } /* now construct the pmix_pif_t */ - pmix_strncpy(intf->if_name, ifname, IF_NAMESIZE-1); + pmix_strncpy(intf->if_name, ifname, PMIX_IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list)+1; intf->if_kernel_index = (uint16_t) idx; ((struct sockaddr_in6*) &intf->if_addr)->sin6_addr = a6; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h index e43de4707db..9d23fdf1ff5 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/pif.h @@ -3,7 +3,7 @@ * Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -73,7 +73,7 @@ BEGIN_C_DECLS typedef struct pmix_pif_t { pmix_list_item_t super; - char if_name[IF_NAMESIZE+1]; + char if_name[PMIX_IF_NAMESIZE+1]; int if_index; uint16_t if_kernel_index; uint16_t af_family; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c index a7d94f79086..c9895cb6617 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pif/solaris_ipv6/pif_solaris_ipv6.c @@ -3,7 +3,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -190,7 +190,7 @@ static int if_solaris_ipv6_open(void) } intf->af_family = AF_INET6; - pmix_strncpy (intf->if_name, lifreq->lifr_name, IF_NAMESIZE-1); + pmix_strncpy (intf->if_name, lifreq->lifr_name, PMIX_IF_NAMESIZE-1); intf->if_index = pmix_list_get_size(&pmix_if_list)+1; memcpy(&intf->if_addr, my_addr, sizeof (*my_addr)); intf->if_mask = 64; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c index 226db25b275..221ec775f87 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * @@ -109,8 +109,8 @@ pmix_status_t pmix_plog_base_log(const pmix_proc_t *source, * channel that can successfully handle this request, * and any channel directives */ for (n=0; n < ndirs; n++) { - if (0 == strncmp(directives[n].key, PMIX_LOG_ONCE, PMIX_MAX_KEYLEN)) { - logonce = true; + if (PMIX_CHECK_KEY(&directives[n], PMIX_LOG_ONCE)) { + logonce = PMIX_INFO_TRUE(&directives[n]); break; } } @@ -237,14 +237,10 @@ pmix_status_t pmix_plog_base_log(const pmix_proc_t *source, rc = mycount->status; // save the status as it could change when the lock is released if (0 == mycount->nreqs) { - /* execute their callback */ - if (NULL != mycount->cbfunc) { - mycount->cbfunc(mycount->status, mycount->cbdata); - } PMIX_RELEASE_THREAD(&mycount->lock); PMIX_RELEASE(mycount); PMIX_RELEASE_THREAD(&pmix_plog_globals.lock); - return PMIX_SUCCESS; + return PMIX_OPERATION_SUCCEEDED; } PMIX_RELEASE_THREAD(&mycount->lock); PMIX_RELEASE_THREAD(&pmix_plog_globals.lock); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c index 619dc38f702..2aceac179ad 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -101,6 +101,9 @@ static pmix_status_t mylog(const pmix_proc_t *source, /* check to see if there are any stdfd entries */ rc = PMIX_ERR_TAKE_NEXT_OPTION; for (n=0; n < ndata; n++) { + if (PMIX_INFO_OP_IS_COMPLETE(&data[n])) { + continue; + } if (0 == strncmp(data[n].key, PMIX_LOG_STDERR, PMIX_MAX_KEYLEN)) { bo.bytes = data[n].value.data.string; bo.size = strlen(bo.bytes); @@ -117,6 +120,5 @@ static pmix_status_t mylog(const pmix_proc_t *source, rc = PMIX_SUCCESS; } } - return rc; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index d62268dbd52..447a8e1ca14 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -60,7 +60,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, nptr = NULL; /* find this nspace - note that it may not have * been registered yet */ - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; @@ -73,7 +73,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, return PMIX_ERR_NOMEM; } nptr->nspace = strdup(nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } if (NULL != info) { @@ -146,7 +146,7 @@ pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, /* find this proc's nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; @@ -159,7 +159,7 @@ pmix_status_t pmix_pnet_base_setup_local_network(char *nspace, return PMIX_ERR_NOMEM; } nptr->nspace = strdup(nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { @@ -191,7 +191,7 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) /* find this proc's nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, proc->nspace)) { nptr = ns; break; @@ -204,7 +204,7 @@ pmix_status_t pmix_pnet_base_setup_fork(const pmix_proc_t *proc, char ***env) return PMIX_ERR_NOMEM; } nptr->nspace = strdup(proc->nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } PMIX_LIST_FOREACH(active, &pmix_pnet_globals.actives, pmix_pnet_base_active_module_t) { @@ -282,7 +282,7 @@ void pmix_pnet_base_deregister_nspace(char *nspace) /* find this nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { nptr = ns; break; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c index d795c8bc486..712b1644219 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c @@ -435,7 +435,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_buffer_t bucket, pbkt; bool found = false; pmix_byte_object_t pbo; - char nodename[PMIX_MAXHOSTNAMELEN], *foo; + char nodename[PMIX_MAXHOSTNAMELEN] = {0}, *foo; pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet:opa collect inventory"); @@ -443,7 +443,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, /* setup the bucket - we will pass the results as a blob */ PMIX_CONSTRUCT(&bucket, pmix_buffer_t); /* pack our node name */ - gethostname(nodename, sizeof(nodename)); + gethostname(nodename, sizeof(nodename)-1); foo = &nodename[0]; PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &foo, 1, PMIX_STRING); if (PMIX_SUCCESS != rc) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c index fecec014243..81e823ad245 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c @@ -737,6 +737,7 @@ static pmix_status_t setup_local_network(pmix_namespace_t *nptr, "pnet:tcp:setup_local_network"); if (NULL != info) { + idkey = strdup("default"); for (n=0; n < ninfo; n++) { /* look for my key */ if (0 == strncmp(info[n].key, PMIX_TCP_SETUP_APP_KEY, PMIX_MAX_KEYLEN)) { @@ -866,8 +867,8 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, pmix_inventory_cbfunc_t cbfunc, void *cbdata) { pmix_inventory_rollup_t *cd = (pmix_inventory_rollup_t*)cbdata; - char *prefix, myhost[PMIX_MAXHOSTNAMELEN]; - char myconnhost[PMIX_MAXHOSTNAMELEN]; + char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0}; + char myconnhost[PMIX_MAXHOSTNAMELEN] = {0}; char name[32], uri[2048]; struct sockaddr_storage my_ss; char *foo; @@ -884,7 +885,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, /* setup the bucket - we will pass the results as a blob */ PMIX_CONSTRUCT(&bucket, pmix_buffer_t); /* add our hostname */ - gethostname(myhost, sizeof(myhost)); + gethostname(myhost, sizeof(myhost)-1); foo = &myhost[0]; PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &bucket, &foo, 1, PMIX_STRING); if (PMIX_SUCCESS != rc) { @@ -919,11 +920,11 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, if (AF_INET == my_ss.ss_family) { prefix = "tcp4://"; inet_ntop(AF_INET, &((struct sockaddr_in*) &my_ss)->sin_addr, - myconnhost, PMIX_MAXHOSTNAMELEN); + myconnhost, PMIX_MAXHOSTNAMELEN-1); } else if (AF_INET6 == my_ss.ss_family) { prefix = "tcp6://"; inet_ntop(AF_INET6, &((struct sockaddr_in6*) &my_ss)->sin6_addr, - myconnhost, PMIX_MAXHOSTNAMELEN); + myconnhost, PMIX_MAXHOSTNAMELEN-1); } else { continue; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c index 09c377cd8bb..6529c1fa4a8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pshmem/mmap/pshmem_mmap.c @@ -3,7 +3,7 @@ * All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -82,9 +82,9 @@ static int _mmap_segment_create(pmix_pshmem_seg_t *sm_seg, const char *file_name if (ENOSPC == rc) { rc = PMIX_ERR_OUT_OF_RESOURCE; goto out; - } else if ((ENOTSUP != rc) + } else if (EINVAL != rc && ENOTSUP != rc #ifdef EOPNOTSUPP - && (EOPNOTSUPP != rc) + && EOPNOTSUPP != rc #endif ){ rc = PMIX_ERROR; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index 0252eed51c2..e86a4126405 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -24,6 +24,7 @@ */ #include +#include "src/include/pmix_globals.h" #ifdef HAVE_FCNTL_H #include @@ -50,7 +51,6 @@ #include #endif -#include "src/include/pmix_globals.h" #include "src/include/pmix_socket_errno.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" @@ -131,7 +131,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, char *p, *p2, *server_nspace = NULL, *rendfile = NULL; int sd, rc; size_t n; - char myhost[PMIX_MAXHOSTNAMELEN]; + char myhost[PMIX_MAXHOSTNAMELEN] = {0}; bool system_level = false; bool system_level_only = false; bool reconnect = false; @@ -414,7 +414,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* mark that we are using the V2 protocol */ pmix_globals.mypeer->protocol = PMIX_PROTOCOL_V2; - gethostname(myhost, sizeof(myhost)); + gethostname(myhost, sizeof(myhost)-1); /* if we were given a URI via MCA param, then look no further */ if (NULL != suri) { if (NULL != server_nspace) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index 61eb18ec305..cb800a6fdf9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -360,8 +360,8 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, bool session_tool = false; bool system_tool = false; pmix_socklen_t addrlen; - char *prefix, myhost[PMIX_MAXHOSTNAMELEN]; - char myconnhost[PMIX_MAXHOSTNAMELEN]; + char *prefix, myhost[PMIX_MAXHOSTNAMELEN] = {0}; + char myconnhost[PMIX_MAXHOSTNAMELEN] = {0}; int myport; pmix_kval_t *urikv; @@ -624,17 +624,17 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, goto sockerror; } - gethostname(myhost, sizeof(myhost)); + gethostname(myhost, sizeof(myhost)-1); if (AF_INET == mca_ptl_tcp_component.connection.ss_family) { prefix = "tcp4://"; myport = ntohs(((struct sockaddr_in*) &mca_ptl_tcp_component.connection)->sin_port); inet_ntop(AF_INET, &((struct sockaddr_in*) &mca_ptl_tcp_component.connection)->sin_addr, - myconnhost, PMIX_MAXHOSTNAMELEN); + myconnhost, PMIX_MAXHOSTNAMELEN-1); } else if (AF_INET6 == mca_ptl_tcp_component.connection.ss_family) { prefix = "tcp6://"; myport = ntohs(((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_port); inet_ntop(AF_INET6, &((struct sockaddr_in6*) &mca_ptl_tcp_component.connection)->sin6_addr, - myconnhost, PMIX_MAXHOSTNAMELEN); + myconnhost, PMIX_MAXHOSTNAMELEN-1); } else { goto sockerror; } @@ -898,7 +898,7 @@ static char **split_and_resolve(char **orig_str, char *name) { int i, ret, save, if_index; char **argv, *str, *tmp; - char if_name[IF_NAMESIZE]; + char if_name[PMIX_IF_NAMESIZE]; struct sockaddr_storage argv_inaddr, if_inaddr; uint32_t argv_prefix; @@ -1384,7 +1384,7 @@ static void connection_handler(int sd, short args, void *cbdata) * of local clients. So let's start by searching for * the nspace object */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, nspace)) { nptr = tmp; break; @@ -1534,7 +1534,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* see if we know this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, nspace)) { nptr = tmp; break; @@ -1838,7 +1838,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) if (5 != pnd->flag && 8 != pnd->flag) { PMIX_RETAIN(nptr); nptr->nspace = strdup(cd->proc.nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); info = PMIX_NEW(pmix_rank_info_t); info->pname.nspace = strdup(nptr->nspace); info->pname.rank = cd->proc.rank; @@ -1866,7 +1866,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) peer->nptr->compat.psec = pmix_psec_base_assign_module(pnd->psec); if (NULL == peer->nptr->compat.psec) { PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super); PMIX_RELEASE(nptr); // will release the info object CLOSE_THE_SOCKET(pnd->sd); goto done; @@ -1881,7 +1881,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) PMIX_INFO_DESTRUCT(&ginfo); if (NULL == peer->nptr->compat.gds) { PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super); PMIX_RELEASE(nptr); // will release the info object CLOSE_THE_SOCKET(pnd->sd); goto done; @@ -1900,7 +1900,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) req = PMIX_NEW(pmix_iof_req_t); if (NULL == req) { PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super); PMIX_RELEASE(nptr); // will release the info object CLOSE_THE_SOCKET(pnd->sd); goto done; @@ -1936,7 +1936,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) "validation of tool credentials failed: %s", PMIx_Error_string(rc)); PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super); PMIX_RELEASE(nptr); // will release the info object CLOSE_THE_SOCKET(pnd->sd); goto done; @@ -1949,7 +1949,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) PMIX_RELEASE(pnd); PMIX_RELEASE(cd); PMIX_RELEASE(peer); - pmix_list_remove_item(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_remove_item(&pmix_globals.nspaces, &nptr->super); PMIX_RELEASE(nptr); // will release the info object /* probably cannot send an error reply if we are out of memory */ return; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c index fc7b6da1c47..51417f3e032 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c @@ -13,7 +13,7 @@ * Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -611,7 +611,7 @@ void pmix_usock_send_handler(int sd, short flags, void *cbdata) return; } else { // report the error - event_del(&peer->send_event); + pmix_event_del(&peer->send_event); peer->send_ev_active = false; PMIX_RELEASE(msg); peer->send_msg = NULL; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index ef33e766f9c..36637cc9882 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -552,7 +552,7 @@ static void connection_handler(int sd, short args, void *cbdata) /* see if we know this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, nspace)) { nptr = tmp; break; diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c index 87a1456f4d4..c083ad645f3 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c @@ -12,9 +12,9 @@ * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010-2015 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2016-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -116,6 +116,8 @@ void pmix_rte_finalize(void) } PMIX_DESTRUCT(&pmix_globals.notifications); PMIX_LIST_DESTRUCT(&pmix_globals.iof_requests); + free(pmix_globals.hostname); + PMIX_LIST_DESTRUCT(&pmix_globals.nspaces); /* now safe to release the event base */ if (!pmix_globals.external_evbase) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c index d1803de7046..b3255e4e5da 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c @@ -33,7 +33,9 @@ #include #endif #include PMIX_EVENT_HEADER -#include "event2/thread.h" +#if ! PMIX_HAVE_LIBEV +#include PMIX_EVENT2_THREAD_HEADER +#endif #include @@ -98,7 +100,7 @@ int pmix_rte_init(pmix_proc_type_t type, int ret, debug_level; char *error = NULL, *evar; size_t n; - char hostname[PMIX_MAXHOSTNAMELEN]; + char hostname[PMIX_MAXHOSTNAMELEN] = {0}; if( ++pmix_initialized != 1 ) { if( pmix_initialized < 1 ) { @@ -159,7 +161,7 @@ int pmix_rte_init(pmix_proc_type_t type, } /* setup the globals structure */ - gethostname(hostname, PMIX_MAXHOSTNAMELEN); + gethostname(hostname, PMIX_MAXHOSTNAMELEN-1); pmix_globals.hostname = strdup(hostname); memset(&pmix_globals.myid.nspace, 0, PMIX_MAX_NSLEN+1); pmix_globals.myid.rank = PMIX_RANK_INVALID; @@ -172,6 +174,8 @@ int pmix_rte_init(pmix_proc_type_t type, ret = pmix_hotel_init(&pmix_globals.notifications, pmix_globals.max_events, pmix_globals.evbase, pmix_globals.event_eviction_time, _notification_eviction_cbfunc); + PMIX_CONSTRUCT(&pmix_globals.nspaces, pmix_list_t); + if (PMIX_SUCCESS != ret) { error = "notification hotel init"; goto return_error; diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c index a66e4d0a768..7e40422a0bd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_progress_threads.c @@ -1,8 +1,8 @@ /* * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2017 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2017-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -13,7 +13,6 @@ */ #include -#include "src/include/types.h" #ifdef HAVE_UNISTD_H #include @@ -49,6 +48,12 @@ typedef struct { bool engine_constructed; pmix_thread_t engine; +#if PMIX_HAVE_LIBEV + ev_async async; + pthread_mutex_t mutex; + pthread_cond_t cond; + pmix_list_t list; +#endif } pmix_progress_tracker_t; static void tracker_constructor(pmix_progress_tracker_t *p) @@ -58,6 +63,10 @@ static void tracker_constructor(pmix_progress_tracker_t *p) p->ev_base = NULL; p->ev_active = false; p->engine_constructed = false; +#if PMIX_HAVE_LIBEV + pthread_mutex_init(&p->mutex, NULL); + PMIX_CONSTRUCT(&p->list, pmix_list_t); +#endif } static void tracker_destructor(pmix_progress_tracker_t *p) @@ -73,6 +82,10 @@ static void tracker_destructor(pmix_progress_tracker_t *p) if (p->engine_constructed) { PMIX_DESTRUCT(&p->engine); } +#if PMIX_HAVE_LIBEV + pthread_mutex_destroy(&p->mutex); + PMIX_LIST_DESTRUCT(&p->list); +#endif } static PMIX_CLASS_INSTANCE(pmix_progress_tracker_t, @@ -80,6 +93,114 @@ static PMIX_CLASS_INSTANCE(pmix_progress_tracker_t, tracker_constructor, tracker_destructor); +#if PMIX_HAVE_LIBEV + +typedef enum { + PMIX_EVENT_ACTIVE, + PMIX_EVENT_ADD, + PMIX_EVENT_DEL +} pmix_event_type_t; + +typedef struct { + pmix_list_item_t super; + struct event *ev; + struct timeval *tv; + int res; + short ncalls; + pmix_event_type_t type; +} pmix_event_caddy_t; + +static PMIX_CLASS_INSTANCE(pmix_event_caddy_t, + pmix_list_item_t, + NULL, NULL); + +static pmix_progress_tracker_t* pmix_progress_tracker_get_by_base(struct event_base *); + +static void pmix_libev_ev_async_cb (EV_P_ ev_async *w, int revents) +{ + pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base((struct event_base *)EV_A); + assert(NULL != trk); + pthread_mutex_lock (&trk->mutex); + pmix_event_caddy_t *cd, *next; + PMIX_LIST_FOREACH_SAFE(cd, next, &trk->list, pmix_event_caddy_t) { + switch (cd->type) { + case PMIX_EVENT_ADD: + (void)event_add(cd->ev, cd->tv); + break; + case PMIX_EVENT_DEL: + (void)event_del(cd->ev); + break; + case PMIX_EVENT_ACTIVE: + (void)event_active(cd->ev, cd->res, cd->ncalls); + break; + } + pmix_list_remove_item(&trk->list, &cd->super); + PMIX_RELEASE(cd); + } + pthread_mutex_unlock (&trk->mutex); +} + +int pmix_event_add(struct event *ev, struct timeval *tv) { + int res; + pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev->ev_base); + if ((NULL != trk) && !pthread_equal(pthread_self(), trk->engine.t_handle)) { + pmix_event_caddy_t *cd = PMIX_NEW(pmix_event_caddy_t); + cd->type = PMIX_EVENT_ADD; + cd->ev = ev; + cd->tv = tv; + pthread_mutex_lock(&trk->mutex); + pmix_list_append(&trk->list, &cd->super); + ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async); + pthread_mutex_unlock(&trk->mutex); + res = PMIX_SUCCESS; + } else { + res = event_add(ev, tv); + } + return res; +} + +int pmix_event_del(struct event *ev) { + int res; + pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev->ev_base); + if ((NULL != trk) && !pthread_equal(pthread_self(), trk->engine.t_handle)) { + pmix_event_caddy_t *cd = PMIX_NEW(pmix_event_caddy_t); + cd->type = PMIX_EVENT_DEL; + cd->ev = ev; + pthread_mutex_lock(&trk->mutex); + pmix_list_append(&trk->list, &cd->super); + ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async); + pthread_mutex_unlock(&trk->mutex); + res = PMIX_SUCCESS; + } else { + res = event_del(ev); + } + return res; +} + +void pmix_event_active (struct event *ev, int res, short ncalls) { + pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev->ev_base); + if ((NULL != trk) && !pthread_equal(pthread_self(), trk->engine.t_handle)) { + pmix_event_caddy_t *cd = PMIX_NEW(pmix_event_caddy_t); + cd->type = PMIX_EVENT_ACTIVE; + cd->ev = ev; + cd->res = res; + cd->ncalls = ncalls; + pthread_mutex_lock(&trk->mutex); + pmix_list_append(&trk->list, &cd->super); + ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async); + pthread_mutex_unlock(&trk->mutex); + } else { + event_active(ev, res, ncalls); + } +} + +void pmix_event_base_loopexit (pmix_event_base_t *ev_base) { + pmix_progress_tracker_t *trk = pmix_progress_tracker_get_by_base(ev_base); + assert(NULL != trk); + ev_async_send ((struct ev_loop *)trk->ev_base, &trk->async); +} +#endif + static bool inited = false; static pmix_list_t tracking; static struct timeval long_timeout = { @@ -118,7 +239,6 @@ static void stop_progress_engine(pmix_progress_tracker_t *trk) { assert(trk->ev_active); trk->ev_active = false; - /* break the event loop - this will cause the loop to exit upon completion of any current event */ pmix_event_base_loopexit(trk->ev_base); @@ -192,6 +312,11 @@ pmix_event_base_t *pmix_progress_thread_init(const char *name) dummy_timeout_cb, trk); pmix_event_add(&trk->block, &long_timeout); +#if PMIX_HAVE_LIBEV + ev_async_init (&trk->async, pmix_libev_ev_async_cb); + ev_async_start((struct ev_loop *)trk->ev_base, &trk->async); +#endif + /* construct the thread object */ PMIX_CONSTRUCT(&trk->engine, pmix_thread_t); trk->engine_constructed = true; @@ -302,6 +427,21 @@ int pmix_progress_thread_pause(const char *name) return PMIX_ERR_NOT_FOUND; } +#if PMIX_HAVE_LIBEV +static pmix_progress_tracker_t* pmix_progress_tracker_get_by_base(pmix_event_base_t *base) { + pmix_progress_tracker_t *trk; + + if (inited) { + PMIX_LIST_FOREACH(trk, &tracking, pmix_progress_tracker_t) { + if(trk->ev_base == base) { + return trk; + } + } + } + return NULL; +} +#endif + int pmix_progress_thread_resume(const char *name) { pmix_progress_tracker_t *trk; diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index f827018d712..2ea33a056c1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -50,7 +50,9 @@ #include #include #include PMIX_EVENT_HEADER +#if ! PMIX_HAVE_LIBEV #include PMIX_EVENT2_THREAD_HEADER +#endif #include "src/util/argv.h" #include "src/util/error.h" @@ -97,7 +99,6 @@ pmix_status_t pmix_server_initialize(void) PMIX_CONSTRUCT(&pmix_server_globals.gdata, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.events, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.local_reqs, pmix_list_t); - PMIX_CONSTRUCT(&pmix_server_globals.nspaces, pmix_list_t); PMIX_CONSTRUCT(&pmix_server_globals.iof, pmix_list_t); pmix_output_verbose(2, pmix_server_globals.base_output, @@ -361,7 +362,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, pmix_globals.mypeer->nptr = PMIX_NEW(pmix_namespace_t); /* ensure our own nspace is first on the list */ PMIX_RETAIN(pmix_globals.mypeer->nptr); - pmix_list_prepend(&pmix_server_globals.nspaces, &pmix_globals.mypeer->nptr->super); + pmix_list_prepend(&pmix_globals.nspaces, &pmix_globals.mypeer->nptr->super); } pmix_globals.mypeer->nptr->nspace = strdup(pmix_globals.myid.nspace); rinfo->pname.nspace = strdup(pmix_globals.mypeer->nptr->nspace); @@ -474,13 +475,12 @@ PMIX_EXPORT pmix_status_t PMIx_server_finalize(void) PMIX_LIST_DESTRUCT(&pmix_server_globals.local_reqs); PMIX_LIST_DESTRUCT(&pmix_server_globals.gdata); PMIX_LIST_DESTRUCT(&pmix_server_globals.events); - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { /* ensure that we do the specified cleanup - if this is an * abnormal termination, then the nspace object may not be * at zero refcount */ pmix_execute_epilog(&ns->epilog); } - PMIX_LIST_DESTRUCT(&pmix_server_globals.nspaces); PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); pmix_hwloc_cleanup(); @@ -547,7 +547,7 @@ static void _register_nspace(int sd, short args, void *cbdata) /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->proc.nspace)) { nptr = tmp; break; @@ -560,7 +560,7 @@ static void _register_nspace(int sd, short args, void *cbdata) goto release; } nptr->nspace = strdup(cd->proc.nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } nptr->nlocalprocs = cd->nlocalprocs; @@ -764,12 +764,12 @@ static void _deregister_nspace(int sd, short args, void *cbdata) pmix_server_purge_events(NULL, &cd->proc); /* release this nspace */ - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (PMIX_CHECK_NSPACE(tmp->nspace, cd->proc.nspace)) { /* perform any nspace-level epilog */ pmix_execute_epilog(&tmp->epilog); /* remove and release it */ - pmix_list_remove_item(&pmix_server_globals.nspaces, &tmp->super); + pmix_list_remove_item(&pmix_globals.nspaces, &tmp->super); PMIX_RELEASE(tmp); break; } @@ -997,7 +997,7 @@ static void _register_client(int sd, short args, void *cbdata) /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, cd->proc.nspace)) { nptr = ns; break; @@ -1010,7 +1010,7 @@ static void _register_client(int sd, short args, void *cbdata) goto cleanup; } nptr->nspace = strdup(cd->proc.nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } /* setup a peer object for this client - since the host server * only deals with the original processes and not any clones, @@ -1051,7 +1051,7 @@ static void _register_client(int sd, short args, void *cbdata) * if the nspaces are all defined */ if (all_def) { /* so far, they have all been defined - check this one */ - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 < ns->nlocalprocs && 0 == strcmp(trk->pcs[i].nspace, ns->nspace)) { all_def = ns->all_registered; @@ -1166,7 +1166,7 @@ static void _deregister_client(int sd, short args, void *cbdata) /* see if we already have this nspace */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->proc.nspace)) { nptr = tmp; break; @@ -1368,15 +1368,15 @@ static void _dmodex_req(int sd, short args, void *cbdata) PMIX_ACQUIRE_OBJECT(cd); pmix_output_verbose(2, pmix_server_globals.base_output, - "DMODX LOOKING FOR %s:%d", - cd->proc.nspace, cd->proc.rank); + "DMODX LOOKING FOR %s", + PMIX_NAME_PRINT(&cd->proc)); /* this should be one of my clients, but a race condition * could cause this request to arrive prior to us having * been informed of it - so first check to see if we know * about this nspace yet */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, cd->proc.nspace)) { nptr = ns; break; @@ -1502,8 +1502,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_dmodex_request(const pmix_proc_t *proc, } pmix_output_verbose(2, pmix_server_globals.base_output, - "pmix:server dmodex request%s:%d", - proc->nspace, proc->rank); + "%s pmix:server dmodex request for proc %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(proc)); cd = PMIX_NEW(pmix_setup_caddy_t); pmix_strncpy(cd->proc.nspace, proc->nspace, PMIX_MAX_NSLEN); diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c index 56c05308014..c8fe13cdd6e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -51,6 +51,7 @@ #include "src/mca/gds/gds.h" #include "src/util/argv.h" #include "src/util/error.h" +#include "src/util/name_fns.h" #include "src/util/output.h" #include "src/util/pmix_environ.h" @@ -126,6 +127,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_dmdx_request_t *req; bool local; bool localonly = false; + bool diffnspace = false; struct timeval tv = {0, 0}; pmix_buffer_t pbkt, pkt; pmix_byte_object_t bo; @@ -133,10 +135,10 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_proc_t proc; char *data; size_t sz, n; - pmix_peer_t *peer; pmix_output_verbose(2, pmix_server_globals.get_output, - "recvd GET"); + "%s recvd GET", + PMIX_NAME_PRINT(&pmix_globals.myid)); /* setup */ memset(nspace, 0, sizeof(nspace)); @@ -191,13 +193,19 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* find the nspace object for this client */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(nspace, ns->nspace)) { nptr = ns; break; } } + /* check if the nspace of the requestor is different from + * the nspace of the target process */ + if (!PMIX_CHECK_NSPACE(nspace, cd->peer->info->pname.nspace)) { + diffnspace = true; + } + pmix_output_verbose(2, pmix_server_globals.get_output, "%s:%d EXECUTE GET FOR %s:%d ON BEHALF OF %s:%d", pmix_globals.myid.nspace, @@ -294,10 +302,10 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, return PMIX_SUCCESS; } - /* this nspace is known, so we can process the request. - * if the rank is wildcard, then they are asking for the - * job-level info for this nspace - provide it */ - if (PMIX_RANK_WILDCARD == rank) { + /* the target nspace is known, so we can process the request. + * if the rank is wildcard, or the nspace is different, then + * they are asking for the job-level info for this nspace - provide it */ + if (PMIX_RANK_WILDCARD == rank || diffnspace) { /* see if we have the job-level info - we won't have it * if we have no local procs and haven't already asked * for it, so there is no guarantee we have it */ @@ -309,21 +317,32 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * can retrieve the info from that GDS. Otherwise, * we need to retrieve it from our own */ PMIX_CONSTRUCT(&cb, pmix_cb_t); - peer = pmix_globals.mypeer; /* this data is for a local client, so give the gds the * option of returning a complete copy of the data, * or returning a pointer to local storage */ cb.proc = &proc; cb.scope = PMIX_SCOPE_UNDEF; cb.copy = false; - PMIX_GDS_FETCH_KV(rc, peer, &cb); + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS != rc) { PMIX_DESTRUCT(&cb); return rc; } + /* if the requested rank is not WILDCARD, then retrieve the + * job-specific data for that rank - a scope of UNDEF + * will direct the GDS to provide it. Anything found will + * simply be added to the cb.kvs list */ + if (PMIX_RANK_WILDCARD != rank) { + proc.rank = rank; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS != rc) { + PMIX_DESTRUCT(&cb); + return rc; + } + } PMIX_CONSTRUCT(&pkt, pmix_buffer_t); /* assemble the provided data into a byte object */ - PMIX_GDS_ASSEMB_KVS_REQ(rc, peer, &proc, &cb.kvs, &pkt, cd); + PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&cb); @@ -333,7 +352,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, PMIX_DESTRUCT(&pkt); /* pack it into the payload */ PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); free(bo.bytes); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -604,6 +623,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, char *data = NULL; size_t sz = 0; pmix_scope_t scope = PMIX_SCOPE_UNDEF; + bool diffnspace = false; pmix_output_verbose(2, pmix_server_globals.get_output, "%s:%d SATISFY REQUEST CALLED", @@ -617,10 +637,18 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); pmix_strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); - /* if we have local clients of this nspace, then we use - * the corresponding GDS to retrieve the data. Otherwise, - * the data will have been stored under our GDS */ - if (0 < nptr->nlocalprocs) { + if (!PMIX_CHECK_NSPACE(nptr->nspace, cd->peer->info->pname.nspace)) { + diffnspace = true; + } + + /* if rank is PMIX_RANK_UNDEF, then it was stored in our GDS */ + if (PMIX_RANK_UNDEF == rank) { + scope = PMIX_GLOBAL; // we have to search everywhere + peer = pmix_globals.mypeer; + } else if (0 < nptr->nlocalprocs) { + /* if we have local clients of this nspace, then we use + * the corresponding GDS to retrieve the data. Otherwise, + * the data will have been stored under our GDS */ if (local) { *local = true; } @@ -660,8 +688,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, /* if they are asking about a rank from an nspace different * from their own, or they gave a rank of "wildcard", then * include a copy of the job-level info */ - if (PMIX_RANK_WILDCARD == rank || - 0 != strncmp(nptr->nspace, cd->peer->info->pname.nspace, PMIX_MAX_NSLEN)) { + if (PMIX_RANK_WILDCARD == rank || diffnspace) { proc.rank = PMIX_RANK_WILDCARD; PMIX_CONSTRUCT(&cb, pmix_cb_t); /* this data is requested by a local client, so give the gds the option @@ -674,7 +701,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, if (PMIX_SUCCESS == rc) { PMIX_CONSTRUCT(&pkt, pmix_buffer_t); /* assemble the provided data into a byte object */ - PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd); + PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); if (rc != PMIX_SUCCESS) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&pkt); @@ -720,7 +747,8 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, /* retrieve the data for the specific rank they are asking about */ if (PMIX_RANK_WILDCARD != rank) { - if (!PMIX_PROC_IS_SERVER(peer) && !peer->commit_cnt) { + if (!PMIX_PROC_IS_SERVER(peer) && 0 == peer->commit_cnt) { + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); /* this condition works only for local requests, server does * count commits for local ranks, and check this count when * local request. @@ -743,7 +771,11 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, found = true; PMIX_CONSTRUCT(&pkt, pmix_buffer_t); /* assemble the provided data into a byte object */ - PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd); + if (PMIX_RANK_UNDEF == rank || diffnspace) { + PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); + } else { + PMIX_GDS_ASSEMB_KVS_REQ(rc, cd->peer, &proc, &cb.kvs, &pkt, cd); + } if (rc != PMIX_SUCCESS) { PMIX_ERROR_LOG(rc); PMIX_DESTRUCT(&pkt); @@ -789,6 +821,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, } PMIX_DESTRUCT(&cb); } + PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); @@ -896,7 +929,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) /* find the nspace object for the proc whose data is being received */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(caddy->lcd->proc.nspace, ns->nspace)) { nptr = ns; break; @@ -910,7 +943,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) nptr = PMIX_NEW(pmix_namespace_t); nptr->nspace = strdup(caddy->lcd->proc.nspace); /* add to the list */ - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } /* if the request was successfully satisfied, then store the data. diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 5f7ad645f86..37ec6c5b412 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -425,7 +425,7 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, } /* is this nspace known to us? */ nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(procs[i].nspace, ns->nspace)) { nptr = ns; break; @@ -583,10 +583,15 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, /* see if we are to collect data or enforce a timeout - we don't internally care * about any other directives */ for (n=0; n < ninfo; n++) { - if (0 == strcmp(info[n].key, PMIX_COLLECT_DATA)) { - collect_data = true; - } else if (0 == strncmp(info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) { - tv.tv_sec = info[n].value.data.uint32; + if (PMIX_CHECK_KEY(&info[n], PMIX_COLLECT_DATA)) { + collect_data = PMIX_INFO_TRUE(&info[n]); + } else if (PMIX_CHECK_KEY(&info[n], PMIX_TIMEOUT)) { + PMIX_VALUE_GET_NUMBER(rc, &info[n].value, tv.tv_sec, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_PROC_FREE(procs, nprocs); + PMIX_INFO_FREE(info, ninfo); + return rc; + } } } } @@ -2738,7 +2743,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, for (n=0; n < cd->ntargets; n++) { /* find the nspace of this proc */ nptr = NULL; - PMIX_LIST_FOREACH(tmp, &pmix_server_globals.nspaces, pmix_namespace_t) { + PMIX_LIST_FOREACH(tmp, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(tmp->nspace, cd->targets[n].nspace)) { nptr = tmp; break; @@ -2751,7 +2756,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, goto exit; } nptr->nspace = strdup(cd->targets[n].nspace); - pmix_list_append(&pmix_server_globals.nspaces, &nptr->super); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); } /* if the rank is wildcard, then we use the epilog for the nspace */ if (PMIX_RANK_WILDCARD == cd->targets[n].rank) { @@ -2805,7 +2810,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, cnt = 0; // track how many infos are cleanup related for (n=0; n < cd->ninfo; n++) { - if (0 == strncmp(cd->info[n].key, PMIX_REGISTER_CLEANUP, PMIX_MAX_KEYLEN)) { + if (PMIX_CHECK_KEY(&cd->info[n], PMIX_REGISTER_CLEANUP)) { ++cnt; if (PMIX_STRING != cd->info[n].value.type || NULL == cd->info[n].value.data.string) { @@ -2821,7 +2826,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, } cf->path = strdup(cd->info[n].value.data.string); pmix_list_append(&cachefiles, &cf->super); - } else if (0 == strncmp(cd->info[n].key, PMIX_REGISTER_CLEANUP_DIR, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_REGISTER_CLEANUP_DIR)) { ++cnt; if (PMIX_STRING != cd->info[n].value.type || NULL == cd->info[n].value.data.string) { @@ -2837,10 +2842,10 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, } cdir->path = strdup(cd->info[n].value.data.string); pmix_list_append(&cachedirs, &cdir->super); - } else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_RECURSIVE, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_RECURSIVE)) { recurse = PMIX_INFO_TRUE(&cd->info[n]); ++cnt; - } else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_IGNORE, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_IGNORE)) { if (PMIX_STRING != cd->info[n].value.type || NULL == cd->info[n].value.data.string) { /* return an error */ @@ -2856,7 +2861,7 @@ pmix_status_t pmix_server_job_ctrl(pmix_peer_t *peer, cf->path = strdup(cd->info[n].value.data.string); pmix_list_append(&ignorefiles, &cf->super); ++cnt; - } else if (0 == strncmp(cd->info[n].key, PMIX_CLEANUP_LEAVE_TOPDIR, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_CLEANUP_LEAVE_TOPDIR)) { leave_topdir = PMIX_INFO_TRUE(&cd->info[n]); ++cnt; } @@ -3274,8 +3279,7 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, continue; } /* do we already have this source for this peer? */ - if (0 == strncmp(cd->procs[n].nspace, req->pname.nspace, PMIX_MAX_NSLEN) && - (PMIX_RANK_WILDCARD == req->pname.rank || cd->procs[n].rank == req->pname.rank)) { + if (PMIX_CHECK_PROCID(&cd->procs[n], &req->pname)) { match = true; if ((req->channels & cd->channels) != cd->channels) { /* this is a channel update */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index d2b9c9acbe5..585ea08fe49 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -50,7 +50,9 @@ #endif /* HAVE_DIRENT_H */ #include PMIX_EVENT_HEADER +#if ! PMIX_HAVE_LIBEV #include PMIX_EVENT2_THREAD_HEADER +#endif #include "src/class/pmix_list.h" #include "src/util/argv.h" @@ -789,7 +791,7 @@ pmix_status_t pmix_tool_init_info(void) pmix_kval_t *kptr; pmix_status_t rc; pmix_proc_t wildcard; - char hostname[PMIX_MAX_NSLEN]; + char hostname[PMIX_MAXHOSTNAMELEN] = {0}; pmix_strncpy(wildcard.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN); wildcard.rank = pmix_globals.myid.rank; @@ -1027,9 +1029,9 @@ pmix_status_t pmix_tool_init_info(void) /* hostname */ if (NULL != pmix_globals.hostname) { - pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAX_NSLEN); + pmix_strncpy(hostname, pmix_globals.hostname, PMIX_MAXHOSTNAMELEN); } else { - gethostname(hostname, PMIX_MAX_NSLEN); + gethostname(hostname, PMIX_MAXHOSTNAMELEN-1); } kptr = PMIX_NEW(pmix_kval_t); kptr->key = strdup(PMIX_HOSTNAME); @@ -1227,7 +1229,6 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) PMIX_LIST_DESTRUCT(&pmix_server_globals.local_reqs); PMIX_LIST_DESTRUCT(&pmix_server_globals.gdata); PMIX_LIST_DESTRUCT(&pmix_server_globals.events); - PMIX_LIST_DESTRUCT(&pmix_server_globals.nspaces); PMIX_LIST_DESTRUCT(&pmix_server_globals.iof); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c b/opal/mca/pmix/pmix3x/pmix/src/util/compress.c index 867a3d5e57d..d71cdf37c63 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -31,6 +31,7 @@ bool pmix_util_compress_string(char *instring, size_t len, outlen; uint8_t *tmp, *ptr; uint32_t inlen; + int rc; /* set default output */ *outbytes = NULL; @@ -43,7 +44,6 @@ bool pmix_util_compress_string(char *instring, /* get an upper bound on the required output storage */ len = deflateBound(&strm, inlen); if (NULL == (tmp = (uint8_t*)malloc(len))) { - *outbytes = NULL; return false; } strm.next_in = (uint8_t*)instring; @@ -54,8 +54,12 @@ bool pmix_util_compress_string(char *instring, strm.avail_out = len; strm.next_out = tmp; - deflate (&strm, Z_FINISH); + rc = deflate (&strm, Z_FINISH); deflateEnd (&strm); + if (Z_OK != rc) { + free(tmp); + return false; + } /* allocate 4 bytes beyond the size reqd by zlib so we * can pass the size of the uncompressed string to the diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c index 14f19aef022..96b46ea9d58 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c @@ -12,7 +12,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -98,6 +98,7 @@ char* pmix_util_print_name_args(const pmix_proc_t *name) { pmix_print_args_buffers_t *ptr; char *rank; + int index; /* get the next buffer */ ptr = get_print_name_buffer(); @@ -105,29 +106,36 @@ char* pmix_util_print_name_args(const pmix_proc_t *name) PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); return pmix_print_args_null; } - /* cycle around the ring */ - if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { - ptr->cntr = 0; - } /* protect against NULL names */ if (NULL == name) { - snprintf(ptr->buffers[ptr->cntr++], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "[NO-NAME]"); - return ptr->buffers[ptr->cntr-1]; + index = ptr->cntr; + snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "[NO-NAME]"); + ptr->cntr++; + if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { + ptr->cntr = 0; + } + return ptr->buffers[index]; } rank = pmix_util_print_rank(name->rank); - snprintf(ptr->buffers[ptr->cntr++], + index = ptr->cntr; + snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, - "[%s,%s]", name->nspace, rank); + "[%s:%s]", name->nspace, rank); + ptr->cntr++; + if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { + ptr->cntr = 0; + } - return ptr->buffers[ptr->cntr-1]; + return ptr->buffers[index]; } char* pmix_util_print_rank(const pmix_rank_t vpid) { pmix_print_args_buffers_t *ptr; + int index; ptr = get_print_name_buffer(); @@ -136,19 +144,19 @@ char* pmix_util_print_rank(const pmix_rank_t vpid) return pmix_print_args_null; } - /* cycle around the ring */ - if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { - ptr->cntr = 0; - } - + index = ptr->cntr; if (PMIX_RANK_UNDEF == vpid) { - snprintf(ptr->buffers[ptr->cntr++], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "UNDEF"); + snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "UNDEF"); } else if (PMIX_RANK_WILDCARD == vpid) { - snprintf(ptr->buffers[ptr->cntr++], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "WILDCARD"); + snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "WILDCARD"); } else { - snprintf(ptr->buffers[ptr->cntr++], + snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "%ld", (long)vpid); } - return ptr->buffers[ptr->cntr-1]; + ptr->cntr++; + if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { + ptr->cntr = 0; + } + return ptr->buffers[index]; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/output.c b/opal/mca/pmix/pmix3x/pmix/src/util/output.c index cf73f507008..4e90280c8ae 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/output.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/output.c @@ -125,7 +125,7 @@ PMIX_CLASS_INSTANCE(pmix_output_stream_t, pmix_object_t, construct, destruct); bool pmix_output_init(void) { int i; - char hostname[PMIX_MAXHOSTNAMELEN]; + char hostname[PMIX_MAXHOSTNAMELEN] = {0}; char *str; if (initialized) { @@ -176,7 +176,7 @@ bool pmix_output_init(void) } else { verbose.lds_want_stderr = true; } - gethostname(hostname, sizeof(hostname)); + gethostname(hostname, sizeof(hostname)-1); hostname[sizeof(hostname)-1] = '\0'; if (0 > asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid())) { return PMIX_ERR_NOMEM; @@ -256,7 +256,7 @@ bool pmix_output_switch(int output_id, bool enable) void pmix_output_reopen_all(void) { char *str; - char hostname[PMIX_MAXHOSTNAMELEN]; + char hostname[PMIX_MAXHOSTNAMELEN] = {0}; str = getenv("PMIX_OUTPUT_STDERR_FD"); if (NULL != str) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pif.h b/opal/mca/pmix/pmix3x/pmix/src/util/pif.h index fb9f1b79a24..57ed1bfd749 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pif.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pif.h @@ -13,7 +13,7 @@ * reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,9 +38,7 @@ #include #endif -#ifndef IF_NAMESIZE -#define IF_NAMESIZE 32 -#endif +#define PMIX_IF_NAMESIZE 256 BEGIN_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c index 1e1cfaaa880..2662a86bff7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/pmix_environ.c @@ -12,8 +12,10 @@ * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,10 +32,12 @@ #include #include "src/util/printf.h" +#include "src/util/error.h" #include "src/util/argv.h" #include "src/util/pmix_environ.h" #define PMIX_DEFAULT_TMPDIR "/tmp" +#define PMIX_MAX_ENVAR_LENGTH 100000 /* * Merge two environ-like char arrays, ensuring that there are no @@ -74,7 +78,7 @@ char **pmix_environ_merge(char **minor, char **major) pmix_setenv(minor[i], NULL, false, &ret); } else { - /* strdup minor[i] in case it's a constat string */ + /* strdup minor[i] in case it's a constant string */ name = strdup(minor[i]); value = name + (value - minor[i]); @@ -99,9 +103,60 @@ char **pmix_environ_merge(char **minor, char **major) int i; char *newvalue, *compare; size_t len; + bool valid; - /* Make the new value */ + /* Check the bozo case */ + if( NULL == env ) { + return PMIX_ERR_BAD_PARAM; + } + if (NULL != value) { + /* check the string for unacceptable length - i.e., ensure + * it is NULL-terminated */ + valid = false; + for (i=0; i < PMIX_MAX_ENVAR_LENGTH; i++) { + if ('\0' == value[i]) { + valid = true; + break; + } + } + if (!valid) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_BAD_PARAM; + } + } + + /* If this is the "environ" array, use putenv or setenv */ + if (*env == environ) { + /* THIS IS POTENTIALLY A MEMORY LEAK! But I am doing it + because so that we don't violate the law of least + astonishmet for PMIX developers (i.e., those that don't + check the return code of pmix_setenv() and notice that we + returned an error if you passed in the real environ) */ +#if defined (HAVE_SETENV) + if (NULL == value) { + /* this is actually an unsetenv request */ + unsetenv(name); + } else { + setenv(name, value, overwrite); + } +#else + /* Make the new value */ + if (NULL == value) { + i = asprintf(&newvalue, "%s=", name); + } else { + i = asprintf(&newvalue, "%s=%s", name, value); + } + if (NULL == newvalue || 0 > i) { + return PMIX_ERR_OUT_OF_RESOURCE; + } + putenv(newvalue); + /* cannot free it as putenv doesn't copy the value */ +#endif + return PMIX_SUCCESS; + } + + /* Make the new value */ if (NULL == value) { i = asprintf(&newvalue, "%s=", name); } else { @@ -111,28 +166,13 @@ char **pmix_environ_merge(char **minor, char **major) return PMIX_ERR_OUT_OF_RESOURCE; } - /* Check the bozo case */ - - if( NULL == env ) { - return PMIX_ERR_BAD_PARAM; - } else if (NULL == *env) { + if (NULL == *env) { i = 0; pmix_argv_append(&i, env, newvalue); free(newvalue); return PMIX_SUCCESS; } - /* If this is the "environ" array, use putenv */ - if( *env == environ ) { - /* THIS IS POTENTIALLY A MEMORY LEAK! But I am doing it - because so that we don't violate the law of least - astonishmet for PMIX developers (i.e., those that don't - check the return code of pmix_setenv() and notice that we - returned an error if you passed in the real environ) */ - putenv(newvalue); - return PMIX_SUCCESS; - } - /* Make something easy to compare to */ i = asprintf(&compare, "%s=", name); diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c index ecd41c2bd42..5fbfec419dc 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. @@ -58,7 +58,7 @@ void cli_init(int nprocs) } } -void cli_connect(cli_info_t *cli, int sd, struct event_base * ebase, event_callback_fn callback) +void cli_connect(cli_info_t *cli, int sd, pmix_event_base_t * ebase, event_callback_fn callback) { if( CLI_CONNECTED != cli->next_state[cli->state] ){ TEST_ERROR(("Rank %d has bad next state: expect %d have %d!", @@ -68,9 +68,9 @@ void cli_connect(cli_info_t *cli, int sd, struct event_base * ebase, event_callb } cli->sd = sd; - cli->ev = event_new(ebase, sd, - EV_READ|EV_PERSIST, callback, cli); - event_add(cli->ev,NULL); + cli->ev = pmix_event_new(ebase, sd, + EV_READ|EV_PERSIST, callback, cli); + pmix_event_add(cli->ev,NULL); pmix_ptl_base_set_nonblocking(sd); TEST_VERBOSE(("Connection accepted from rank %d", cli_rank(cli) )); cli->state = CLI_CONNECTED; @@ -105,12 +105,12 @@ void cli_disconnect(cli_info_t *cli) } if( NULL == cli->ev ){ - TEST_ERROR(("Bad ev = NULL of rank = %d ", cli->sd, cli_rank(cli))); + TEST_ERROR(("Bad ev = NULL of rank = %d ", cli_rank(cli))); test_abort = true; } else { TEST_VERBOSE(("remove event of rank %d from event queue", cli_rank(cli))); - event_del(cli->ev); - event_free(cli->ev); + pmix_event_del(cli->ev); + pmix_event_free(cli->ev); cli->ev = NULL; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h index b716480b0a9..011023d7a79 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. @@ -56,7 +56,7 @@ extern bool test_abort; int cli_rank(cli_info_t *cli); void cli_init(int nprocs); -void cli_connect(cli_info_t *cli, int sd, struct event_base * ebase, event_callback_fn callback); +void cli_connect(cli_info_t *cli, int sd, pmix_event_base_t * ebase, event_callback_fn callback); void cli_finalize(cli_info_t *cli); void cli_disconnect(cli_info_t *cli); void cli_terminate(cli_info_t *cli); diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmi_client.c b/opal/mca/pmix/pmix3x/pmix/test/pmi_client.c index ad21f6db3cc..819429b4fd7 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmi_client.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmi_client.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -24,6 +24,9 @@ static int _legacy = 0; /* Verbose level 0-silent, 1-fatal, 2-error, 3+ debug*/ static int _verbose = 1; +static int spawned, size, rank=-1, appnum; +static char jobid[255]; + static void log_fatal(const char *format, ...) { va_list arglist; @@ -36,7 +39,7 @@ static void log_fatal(const char *format, ...) va_end(arglist); return; } - fprintf(stderr, "FATAL: %s", output); + fprintf(stderr, "%d:FATAL: %s", rank, output); free(output); } va_end(arglist); @@ -54,7 +57,7 @@ static void log_error(const char *format, ...) va_end(arglist); return; } - fprintf(stderr, "ERROR: %s", output); + fprintf(stderr, "%d:ERROR: %s", rank, output); free(output); } va_end(arglist); @@ -72,7 +75,7 @@ static void log_info(const char *format, ...) va_end(arglist); return; } - fprintf(stderr, "INFO: %s", output); + fprintf(stderr, "%d:INFO: %s", rank, output); free(output); } va_end(arglist); @@ -81,7 +84,7 @@ static void log_info(const char *format, ...) #define log_assert(e, msg) \ do { \ if (!(e)) { \ - log_fatal("%s at %s:%d\n", msg, __func__, __LINE__); \ + log_fatal("%d:%s at %s:%d\n", rank, msg, __func__, __LINE__); \ rc = -1; \ } \ } while (0) @@ -99,10 +102,6 @@ static int test_item5(void); static int test_item6(void); static int test_item7(void); -static int spawned, size, rank, appnum; -static char jobid[255]; - - int main(int argc, char **argv) { int ret = 0; @@ -372,21 +371,24 @@ static int test_item6(void) { int rc = 0; char val[100]; - const char *tkey = __func__; + char *tkey; const char *tval = __FILE__; + asprintf(&tkey, "%d:%s", rank, __func__); if (PMI_SUCCESS != (rc = PMI_KVS_Put(jobid, tkey, tval))) { log_fatal("PMI_KVS_Put %d\n", rc); + free(tkey); return rc; } if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, tkey, val, sizeof(val)))) { log_fatal("PMI_KVS_Get %d\n", rc); + free(tkey); return rc; } log_info("tkey=%s tval=%s val=%s\n", tkey, tval, val); - + free(tkey); log_assert(!strcmp(tval, val), "value does not meet expectation"); return rc; @@ -398,16 +400,16 @@ static int test_item7(void) char tkey[100]; char tval[100]; char val[100]; - int i = 0; + int i = 0, j; + +log_info("TEST7\n"); for (i = 0; i < size; i++) { - sprintf(tkey, "KEY-%d", i); + sprintf(tkey, "%d:KEY-%d", rank, i); sprintf(tval, "VALUE-%d", i); - if (i == rank) { - if (PMI_SUCCESS != (rc = PMI_KVS_Put(jobid, tkey, tval))) { - log_fatal("PMI_KVS_Put [%s=%s] %d\n", tkey, tval, rc); - return rc; - } + if (PMI_SUCCESS != (rc = PMI_KVS_Put(jobid, tkey, tval))) { + log_fatal("PMI_KVS_Put [%s=%s] %d\n", tkey, tval, rc); + return rc; } } @@ -416,22 +418,27 @@ static int test_item7(void) return rc; } + + log_info("BARRIER\n"); if (PMI_SUCCESS != (rc = PMI_Barrier())) { log_fatal("PMI_Barrier %d\n", rc); return rc; } for (i = 0; i < size; i++) { - sprintf(tkey, "KEY-%d", i); - sprintf(tval, "VALUE-%d", i); - if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, tkey, val, sizeof(val)))) { - log_fatal("PMI_KVS_Get [%s=?] %d\n", tkey, rc); - return rc; - } + for (j=0; j < size; j++) { + sprintf(tkey, "%d:KEY-%d", i, j); + sprintf(tval, "VALUE-%d", j); + log_info("Get key %s\n", tkey); + if (PMI_SUCCESS != (rc = PMI_KVS_Get(jobid, tkey, val, sizeof(val)))) { + log_fatal("PMI_KVS_Get [%s=?] %d\n", tkey, rc); + return rc; + } - log_info("tkey=%s tval=%s val=%s\n", tkey, tval, val); + log_info("tkey=%s tval=%s val=%s\n", tkey, tval, val); - log_assert(!strcmp(tval, val), "value does not meet expectation"); + log_assert(!strcmp(tval, val), "value does not meet expectation"); + } } return rc; diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am index 8ee50d6ca8a..5ab9f568bb0 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -85,7 +85,7 @@ simplegacy_SOURCES = $(headers) \ simplegacy.c simplegacy_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simplegacy_LDADD = \ - $(top_builddir)/src/libpmix.la + $(top_builddir)/src/libpmi.la simptimeout_SOURCES = $(headers) \ simptimeout.c diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c index 2f1fae47017..3d9f8ee8d7d 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/gwtest.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -392,9 +392,9 @@ int main(int argc, char **argv) /* setup to see sigchld on the forked tests */ PMIX_CONSTRUCT(&children, pmix_list_t); - event_assign(&handler, pmix_globals.evbase, SIGCHLD, - EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); - event_add(&handler, NULL); + pmix_event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); + pmix_event_add(&handler, NULL); /* we have a single namespace for all clients */ atmp = NULL; @@ -1023,7 +1023,7 @@ static void wait_signal_callback(int fd, short event, void *arg) pid_t pid; wait_tracker_t *t2; - if (SIGCHLD != event_get_signal(sig)) { + if (SIGCHLD != pmix_event_get_signal(sig)) { return; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c index 428ba4e341b..d91e7e58e35 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/quietclient.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -103,12 +103,15 @@ int main(int argc, char **argv) pmix_value_t *val = &value; char *tmp; pmix_proc_t proc; - uint32_t nprocs, n; + uint32_t nprocs, n, k, nlocal; int cnt, j; volatile bool active; pmix_info_t *iptr; size_t ninfo; pmix_status_t code; + char **peers; + bool all_local, local; + pmix_rank_t *locals = NULL; /* init us and declare we are a test programming model */ PMIX_INFO_CREATE(iptr, 2); @@ -152,11 +155,11 @@ int main(int argc, char **argv) usleep(10); } - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s", + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } @@ -173,6 +176,27 @@ int main(int argc, char **argv) goto done; } + /* get a list of our local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get local peers failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + /* split the returned string to get the rank of each local peer */ + peers = pmix_argv_split(val->data.string, ','); + PMIX_VALUE_RELEASE(val); + nlocal = pmix_argv_count(peers); + if (nprocs == nlocal) { + all_local = true; + } else { + all_local = false; + locals = (pmix_rank_t*)malloc(pmix_argv_count(peers) * sizeof(pmix_rank_t)); + for (cnt=0; NULL != peers[cnt]; cnt++) { + locals[cnt] = strtoul(peers[cnt], NULL, 10); + } + } + pmix_argv_free(peers); + for (cnt=0; cnt < MAXCNT; cnt++) { (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, myproc.rank, cnt); value.type = PMIX_UINT64; @@ -213,42 +237,67 @@ int main(int argc, char **argv) for (j=0; j <= cnt; j++) { for (n=0; n < nprocs; n++) { proc.rank = n; - (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j); - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s", - myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc)); - continue; - } - if (NULL == val) { - pmix_output(0, "Client ns %s rank %d: NULL value returned", - myproc.nspace, myproc.rank); - break; - } - if (PMIX_UINT64 != val->type) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - continue; + if (all_local) { + local = true; + } else { + local = false; + /* see if this proc is local to us */ + for (k=0; k < nlocal; k++) { + if (proc.rank == locals[k]) { + local = true; + break; + } + } } - if (1234 != val->data.uint64) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); + if (local) { + (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s", + myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc)); + continue; + } + if (NULL == val) { + pmix_output(0, "Client ns %s rank %d: NULL value returned", + myproc.nspace, myproc.rank); + break; + } + if (PMIX_UINT64 != val->type) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); + continue; + } + if (1234 != val->data.uint64) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); + PMIX_VALUE_RELEASE(val); + free(tmp); + continue; + } PMIX_VALUE_RELEASE(val); free(tmp); - continue; - } - PMIX_VALUE_RELEASE(val); - free(tmp); - if (n != myproc.rank) { + /* now check that we don't get data for a remote proc - note that we + * always can get our own remote data as we published it */ + if (proc.rank != myproc.rank) { + (void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j); + if (PMIX_SUCCESS == (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + /* this data should _not_ be found as we are on the same node + * and the data was "put" with a PMIX_REMOTE scope */ + pmix_output(0, "ERROR: Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc", + myproc.nspace, myproc.rank, j, tmp); + } + PMIX_VALUE_RELEASE(val); + free(tmp); + } + } else { (void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j); if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - /* this data should _not_ be found as we are on the same node - * and the data was "put" with a PMIX_REMOTE scope */ - continue; + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed for remote proc", + myproc.nspace, myproc.rank, j, tmp); + } + if (NULL != val) { + PMIX_VALUE_RELEASE(val); } - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc", - myproc.nspace, myproc.rank, j, tmp); - PMIX_VALUE_RELEASE(val); free(tmp); } } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c index ae5b4ababc4..80aea143083 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -127,13 +127,16 @@ int main(int argc, char **argv) pmix_value_t *val = &value; char *tmp; pmix_proc_t proc; - uint32_t nprocs, n; + uint32_t nprocs, n, k, nlocal; int cnt, j; bool doabort = false; volatile bool active; pmix_info_t info, *iptr; size_t ninfo; pmix_status_t code; + char **peers; + bool all_local, local; + pmix_rank_t *locals = NULL; if (1 < argc) { if (0 == strcmp("-abort", argv[1])) { @@ -185,17 +188,17 @@ int main(int argc, char **argv) } - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s", + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); /* put a few values */ (void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank); @@ -207,6 +210,27 @@ int main(int argc, char **argv) goto done; } + /* get a list of our local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get local peers failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + /* split the returned string to get the rank of each local peer */ + peers = pmix_argv_split(val->data.string, ','); + PMIX_VALUE_RELEASE(val); + nlocal = pmix_argv_count(peers); + if (nprocs == nlocal) { + all_local = true; + } else { + all_local = false; + locals = (pmix_rank_t*)malloc(pmix_argv_count(peers) * sizeof(pmix_rank_t)); + for (cnt=0; NULL != peers[cnt]; cnt++) { + locals[cnt] = strtoul(peers[cnt], NULL, 10); + } + } + pmix_argv_free(peers); + for (cnt=0; cnt < MAXCNT; cnt++) { (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, myproc.rank, cnt); value.type = PMIX_UINT64; @@ -247,43 +271,71 @@ int main(int argc, char **argv) for (j=0; j <= cnt; j++) { for (n=0; n < nprocs; n++) { proc.rank = n; - (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j); - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s", - myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc)); - continue; - } - if (NULL == val) { - pmix_output(0, "Client ns %s rank %d: NULL value returned", - myproc.nspace, myproc.rank); - break; - } - if (PMIX_UINT64 != val->type) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - continue; + if (all_local) { + local = true; + } else { + local = false; + /* see if this proc is local to us */ + for (k=0; k < nlocal; k++) { + if (proc.rank == locals[k]) { + local = true; + break; + } + } } - if (1234 != val->data.uint64) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); + if (local) { + (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, n, j); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s", + myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc)); + continue; + } + if (NULL == val) { + pmix_output(0, "Client ns %s rank %d: NULL value returned", + myproc.nspace, myproc.rank); + break; + } + if (PMIX_UINT64 != val->type) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); + PMIX_VALUE_RELEASE(val); + free(tmp); + continue; + } + if (1234 != val->data.uint64) { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); + PMIX_VALUE_RELEASE(val); + free(tmp); + continue; + } + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); PMIX_VALUE_RELEASE(val); free(tmp); - continue; - } - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); - PMIX_VALUE_RELEASE(val); - free(tmp); - if (n != myproc.rank) { + /* now check that we don't get data for a remote proc - note that we + * always can get our own remote data as we published it */ + if (proc.rank != myproc.rank) { + (void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + /* this data should _not_ be found as we are on the same node + * and the data was "put" with a PMIX_REMOTE scope */ + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); + } else { + pmix_output(0, "ERROR: Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc", + myproc.nspace, myproc.rank, j, tmp); + } + if (NULL != val) { + PMIX_VALUE_RELEASE(val); + } + free(tmp); + } + } else { (void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j); - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - /* this data should _not_ be found as we are on the same node - * and the data was "put" with a PMIX_REMOTE scope */ + if (PMIX_SUCCESS == (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); - continue; + } else { + pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed for remote proc", + myproc.nspace, myproc.rank, j, tmp); } - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc", - myproc.nspace, myproc.rank, j, tmp); PMIX_VALUE_RELEASE(val); free(tmp); } @@ -321,7 +373,7 @@ int main(int argc, char **argv) /* log something */ PMIX_INFO_CONSTRUCT(&info); - PMIX_INFO_LOAD(&info, PMIX_LOG_STDERR, "test log msg", PMIX_STRING); + PMIX_INFO_LOAD(&info, PMIX_LOG_STDERR, "test log msg\n", PMIX_STRING); active = true; rc = PMIx_Log_nb(&info, 1, NULL, 0, opcbfunc, (void*)&active); if (PMIX_SUCCESS != rc) { diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c index fd6a61eba4b..cb0ae490227 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdie.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -97,16 +97,17 @@ int main(int argc, char **argv) } pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); completed = false; /* register our errhandler */ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c index c042f1948a8..2a7e067d148 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdmodex.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -98,9 +98,12 @@ int main(int argc, char **argv) pmix_value_t *val = &value; char *tmp; pmix_proc_t proc; - uint32_t n, num_gets; + uint32_t n, num_gets, k, nlocal; bool active; bool dofence = true; + bool local, all_local; + char **peers; + pmix_rank_t *locals; if (NULL != getenv("PMIX_SIMPDMODEX_ASYNC")) { dofence = false; @@ -113,16 +116,17 @@ int main(int argc, char **argv) } pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); /* put a few values */ (void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank); @@ -174,24 +178,60 @@ int main(int argc, char **argv) } } + /* get a list of our local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get local peers failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + goto done; + } + /* split the returned string to get the rank of each local peer */ + peers = pmix_argv_split(val->data.string, ','); + PMIX_VALUE_RELEASE(val); + nlocal = pmix_argv_count(peers); + if (nprocs == nlocal) { + all_local = true; + } else { + all_local = false; + locals = (pmix_rank_t*)malloc(pmix_argv_count(peers) * sizeof(pmix_rank_t)); + for (n=0; NULL != peers[n]; n++) { + locals[n] = strtoul(peers[n], NULL, 10); + } + } + pmix_argv_free(peers); + /* get the committed data - ask for someone who doesn't exist as well */ num_gets = 0; for (n=0; n < nprocs; n++) { - (void)asprintf(&tmp, "%s-%d-local", myproc.nspace, n); - proc.rank = n; - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, - NULL, 0, valcbfunc, tmp))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get %s failed: %d", myproc.nspace, n, tmp, rc); - goto done; + if (all_local) { + local = true; + } else { + local = false; + /* see if this proc is local to us */ + for (k=0; k < nlocal; k++) { + if (proc.rank == locals[k]) { + local = true; + break; + } + } } - ++num_gets; - (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, n); - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, - NULL, 0, valcbfunc, tmp))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get %s failed: %d", myproc.nspace, n, tmp, rc); - goto done; + if (local) { + (void)asprintf(&tmp, "%s-%d-local", myproc.nspace, n); + proc.rank = n; + if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, + NULL, 0, valcbfunc, tmp))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get %s failed: %d", myproc.nspace, n, tmp, rc); + goto done; + } + ++num_gets; + } else { + (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, n); + if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, + NULL, 0, valcbfunc, tmp))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get %s failed: %d", myproc.nspace, n, tmp, rc); + goto done; + } + ++num_gets; } - ++num_gets; } if (dofence) { diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c index a20b8418a4f..ef5286dd6e5 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpdyn.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -62,16 +62,17 @@ int main(int argc, char **argv) } pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); /* call fence to sync */ PMIX_PROC_CONSTRUCT(&proc); @@ -85,19 +86,12 @@ int main(int argc, char **argv) /* rank=0 calls spawn */ if (0 == myproc.rank) { PMIX_APP_CREATE(app, 1); - app->cmd = strdup("gumby"); + app->cmd = strdup("./simpclient"); app->maxprocs = 2; - pmix_argv_append_nosize(&app->argv, "gumby"); + pmix_argv_append_nosize(&app->argv, "simpclient"); pmix_argv_append_nosize(&app->argv, "-n"); pmix_argv_append_nosize(&app->argv, "2"); pmix_setenv("PMIX_ENV_VALUE", "3", true, &app->env); - PMIX_INFO_CREATE(app->info, 2); - (void)strncpy(app->info[0].key, "DARTH", PMIX_MAX_KEYLEN); - app->info[0].value.type = PMIX_INT8; - app->info[0].value.data.int8 = 12; - (void)strncpy(app->info[1].key, "VADER", PMIX_MAX_KEYLEN); - app->info[1].value.type = PMIX_DOUBLE; - app->info[1].value.data.dval = 12.34; pmix_output(0, "Client ns %s rank %d: calling PMIx_Spawn", myproc.nspace, myproc.rank); if (PMIX_SUCCESS != (rc = PMIx_Spawn(NULL, 0, app, 1, nsp2))) { @@ -106,25 +100,18 @@ int main(int argc, char **argv) } PMIX_APP_FREE(app, 1); - /* check to see if we got the expected info back */ - if (0 != strncmp(nsp2, "DYNSPACE", PMIX_MAX_NSLEN)) { - pmix_output(0, "Client ns %s rank %d: PMIx_Spawn returned incorrect nspace: %s", myproc.nspace, myproc.rank, nsp2); - goto done; - } else { - pmix_output(0, "Client ns %s rank %d: PMIx_Spawn succeeded returning nspace: %s", myproc.nspace, myproc.rank, nsp2); - } - /* get their universe size */ + /* get their job size */ (void)strncpy(proc.nspace, nsp2, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; val = NULL; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val)) || + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val)) || NULL == val) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + pmix_output(0, "Client ns %s rank %d: PMIx_Get job %s size failed: %d", myproc.nspace, myproc.rank, nsp2, rc); goto done; } ntmp = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe %s size %d", myproc.nspace, myproc.rank, nsp2, (int)ntmp); + pmix_output(0, "Client %s:%d job %s size %d", myproc.nspace, myproc.rank, nsp2, (int)ntmp); } /* just cycle the connect/disconnect functions */ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c index 57a6bfc8c6b..a6acf5f89ca 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpft.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -83,16 +83,17 @@ int main(int argc, char **argv) } pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); completed = false; /* register our errhandler */ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c index c9ac506520a..037f7eae383 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpjctrl.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -133,14 +133,17 @@ int main(int argc, char **argv) (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - /* get our universe size */ - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + /* get our job size */ + (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + proc.rank = PMIX_RANK_WILDCARD; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); + fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs); /* inform the RM that we are preemptible, and that our checkpoint methods are * "signal" on SIGUSR2 and event on PMIX_JCTRL_CHECKPOINT */ diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c index 1b15366cd4a..98f40a15dd4 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simplegacy.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -24,230 +24,90 @@ */ #include -#include +#include #include #include #include #include -#include "src/class/pmix_object.h" -#include "src/util/output.h" -#include "src/util/printf.h" - #define MAXCNT 3 -static volatile bool completed = false; -static pmix_proc_t myproc; - -static void notification_fn(size_t evhdlr_registration_id, - pmix_status_t status, - const pmix_proc_t *source, - pmix_info_t info[], size_t ninfo, - pmix_info_t results[], size_t nresults, - pmix_event_notification_cbfunc_fn_t cbfunc, - void *cbdata) -{ - pmix_output(0, "Client %s:%d NOTIFIED with status %s", myproc.nspace, myproc.rank, PMIx_Error_string(status)); - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); - } - completed = true; -} - -static void errhandler_reg_callbk(pmix_status_t status, - size_t errhandler_ref, - void *cbdata) -{ - volatile bool *active = (volatile bool*)cbdata; - - pmix_output(0, "Client: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", - status, (unsigned long)errhandler_ref); - *active = false; -} - -/* this is an event notification function that we explicitly request - * be called when the PMIX_MODEL_DECLARED notification is issued. - * We could catch it in the general event notification function and test - * the status to see if the status matched, but it often is simpler - * to declare a use-specific notification callback point. In this case, - * we are asking to know whenever a model is declared as a means - * of testing server self-notification */ -static void model_callback(size_t evhdlr_registration_id, - pmix_status_t status, - const pmix_proc_t *source, - pmix_info_t info[], size_t ninfo, - pmix_info_t results[], size_t nresults, - pmix_event_notification_cbfunc_fn_t cbfunc, - void *cbdata) -{ - size_t n; - - /* just let us know it was received */ - fprintf(stderr, "%s:%d Model event handler called with status %d(%s)\n", - myproc.nspace, myproc.rank, status, PMIx_Error_string(status)); - for (n=0; n < ninfo; n++) { - if (PMIX_STRING == info[n].value.type) { - fprintf(stderr, "%s:%d\t%s:\t%s\n", - myproc.nspace, myproc.rank, - info[n].key, info[n].value.data.string); - } - } - - /* we must NOT tell the event handler state machine that we - * are the last step as that will prevent it from notifying - * anyone else that might be listening for declarations */ - if (NULL != cbfunc) { - cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); - } -} - -/* event handler registration is done asynchronously */ -static void model_registration_callback(pmix_status_t status, - size_t evhandler_ref, - void *cbdata) -{ - volatile int *active = (volatile int*)cbdata; - - fprintf(stderr, "simpclient EVENT HANDLER REGISTRATION RETURN STATUS %d, ref=%lu\n", - status, (unsigned long)evhandler_ref); - *active = false; -} - int main(int argc, char **argv) { - int rc; - pmix_value_t value; - pmix_value_t *val = &value; + int rc, j, n; char *tmp; - pmix_proc_t proc; - uint32_t nprocs, n; - int cnt, j; - volatile bool active; - pmix_info_t info, *iptr; - size_t ninfo; - pmix_status_t code; - - /* init us and declare we are a test programming model */ - PMIX_INFO_CREATE(iptr, 2); - PMIX_INFO_LOAD(&iptr[0], PMIX_PROGRAMMING_MODEL, "TEST", PMIX_STRING); - PMIX_INFO_LOAD(&iptr[1], PMIX_MODEL_LIBRARY_NAME, "PMIX", PMIX_STRING); - if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, iptr, 2))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Init failed: %s", - myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + int spawned; + int rank; + int nprocs; + char value[1024]; + + fprintf(stderr, "Client calling init\n"); + if (PMI_SUCCESS != (rc = PMI_Init(&spawned))) { + fprintf(stderr, "Client PMI_Init failed: %d\n", rc); exit(rc); } - PMIX_INFO_FREE(iptr, 2); - pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); + fprintf(stderr, "Client Running\n"); /* test something */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s", - myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + if (PMI_SUCCESS != (rc = PMI_Get_rank(&rank))) { + fprintf(stderr, "Client PMI_Get_rank failed: %d\n", rc); exit(rc); } - nprocs = val->data .uint32; - PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); - - /* register a handler specifically for when models declare */ - active = true; - ninfo = 1; - PMIX_INFO_CREATE(iptr, ninfo); - PMIX_INFO_LOAD(&iptr[0], PMIX_EVENT_HDLR_NAME, "SIMPCLIENT-MODEL", PMIX_STRING); - code = PMIX_MODEL_DECLARED; - PMIx_Register_event_handler(&code, 1, iptr, ninfo, - model_callback, model_registration_callback, (void*)&active); - while (active) { - usleep(10); - } - PMIX_INFO_FREE(iptr, ninfo); - - /* register our errhandler */ - active = true; - PMIx_Register_event_handler(NULL, 0, NULL, 0, - notification_fn, errhandler_reg_callbk, (void*)&active); - while (active) { - usleep(10); + if (PMI_SUCCESS != (rc = PMI_Get_universe_size(&nprocs))) { + fprintf(stderr, "Client %d: PMI_Get_universe_size failed: %d\n", rank, rc); + exit(rc); } + fprintf(stderr, "Client %d job size %d\n", rank, nprocs); - memset(&info, 0, sizeof(pmix_info_t)); - (void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN); - info.value.type = PMIX_UNDEF; - info.value.data.flag = 1; - - for (cnt=0; cnt < MAXCNT; cnt++) { - pmix_output(0, "EXECUTING LOOP %d", cnt); - for (j=0; j < 10; j++) { - (void)asprintf(&tmp, "%s-%d-gasnet-%d-%d", myproc.nspace, myproc.rank, cnt, j); - value.type = PMIX_UINT64; - value.data.uint64 = 1234; - if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_GLOBAL, tmp, &value))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Put failed: %s", - myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; - } - free(tmp); - } - - if (PMIX_SUCCESS != (rc = PMIx_Commit())) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Commit failed: %s", - myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc)); + for (j=0; j < 10; j++) { + (void)asprintf(&tmp, "%d-gasnet-0-%d", rank, j); + if (PMI_SUCCESS != (rc = PMI_KVS_Put("foobar", tmp, "myvalue"))) { + fprintf(stderr, "Client %d: j %d PMI_KVS_Put failed: %d\n", + rank, j, rc); goto done; } + free(tmp); + } - /* call fence to ensure the data is received */ - if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0, &info, 1))) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Fence failed: %s", - myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc)); + if (PMIX_SUCCESS != (rc = PMI_KVS_Commit("foobar"))) { + fprintf(stderr, "Client %d: PMI_KVS_Commit failed: %d\n", rank, rc); goto done; - } + } - /* check the returned data */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_UNDEF; - for (j=0; j < 10; j++) { - for (n=0; n < nprocs; n++) { - (void)asprintf(&tmp, "%s-%d-gasnet-%d-%d", myproc.nspace, n, cnt, j); - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed: %s", - myproc.nspace, myproc.rank, j, tmp, PMIx_Error_string(rc)); - continue; - } - if (NULL == val) { - pmix_output(0, "Client ns %s rank %d: NULL value returned", - myproc.nspace, myproc.rank); - break; - } - if (PMIX_UINT64 != val->type) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); - PMIX_VALUE_RELEASE(val); - free(tmp); - continue; - } - if (1234 != val->data.uint64) { - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); - PMIX_VALUE_RELEASE(val); - free(tmp); - continue; - } - pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); - PMIX_VALUE_RELEASE(val); - free(tmp); + fprintf(stderr, "Client rank %d: CALLING PMI_Barrier\n", rank); + + /* call fence to ensure the data is received */ + if (PMI_SUCCESS != (rc = PMI_Barrier())) { + fprintf(stderr, "Client %d: PMI_Barrier failed: %d\n", rank, rc); + goto done; + } + + /* check the returned data */ + for (j=0; j < 10; j++) { + for (n=0; n < nprocs; n++) { + (void)asprintf(&tmp, "%d-gasnet-0-%d", n, j); + fprintf(stderr, "Client %d: Calling get\n", rank); + if (PMI_SUCCESS != (rc = PMI_KVS_Get("foobar", tmp, value, 1024))) { + fprintf(stderr, "Client %d: PMI_Get failed: %d\n", rank, rc); + continue; } + if (0 == strcmp(value, "myvalue")) { + fprintf(stderr, "Client %d: PMI_Get returned correct value\n", rank); + } else { + fprintf(stderr, "Client %d: PMI_Get returned incorrect value\n", rank); + } + free(tmp); } } done: /* finalize us */ - pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank); - if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { - fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %s\n", - myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + fprintf(stderr, "Client rank %d: Finalizing\n", rank); + if (PMI_SUCCESS != (rc = PMI_Finalize())) { + fprintf(stderr, "Client rank %d: finalize failed %d\n", rank, rc); } else { - fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize successfully completed\n", myproc.nspace, myproc.rank); + fprintf(stderr, "Client %d:PMI_Finalize successfully completed\n", rank); } fflush(stderr); return(rc); diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c index 12d6c68735e..2ccf9b258f4 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simppub.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -54,16 +54,17 @@ int main(int argc, char **argv) } pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %d", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); /* call fence to ensure the data is received */ PMIX_PROC_CONSTRUCT(&proc); diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index e31f4211b9f..b78165f704a 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -38,7 +38,6 @@ #include #include #include -#include PMIX_EVENT_HEADER #if PMIX_HAVE_HWLOC #include @@ -230,8 +229,6 @@ static void dlcbfunc(int sd, short flags, void *cbdata) { myxfer_t *x = (myxfer_t*)cbdata; - pmix_output(0, "INVENTORY READY FOR DELIVERY"); - PMIx_server_deliver_inventory(x->info, x->ninfo, NULL, 0, opcbfunc, (void*)x); } @@ -245,8 +242,6 @@ static void infocbfunc(pmix_status_t status, myxfer_t *x; size_t n; - pmix_output(0, "INVENTORY RECEIVED"); - /* we don't have any place to send this, so for test * purposes only, let's push it back down for processing. * Note: it must be thread-shifted first as we are in @@ -343,12 +338,14 @@ int main(int argc, char **argv) pmix_info_t *info; size_t ninfo; bool cross_version = false; + bool usock = true; bool hwloc = false; #if PMIX_HAVE_HWLOC char *hwloc_file = NULL; #endif mylock_t mylock; pmix_status_t code; + sigset_t unblock; /* smoke test */ if (PMIX_SUCCESS != 0) { @@ -378,6 +375,25 @@ int main(int argc, char **argv) /* cross-version test - we will set one child to * run at a different version. Requires -n >= 2 */ cross_version = true; + usock = false; + } else if (0 == strcmp("-u", argv[n])) { + /* enable usock */ + usock = false; +#if PMIX_HAVE_HWLOC + } else if (0 == strcmp("-hwloc", argv[n]) || + 0 == strcmp("--hwloc", argv[n])) { + /* test hwloc support */ + hwloc = true; + } else if (0 == strcmp("-hwloc-file", argv[n]) || + 0 == strcmp("--hwloc-file", argv[n])) { + if (NULL == argv[n+1]) { + fprintf(stderr, "The --hwloc-file option requires an argument\n"); + exit(1); + } + hwloc_file = strdup(argv[n+1]); + hwloc = true; + ++n; +#endif } else if (0 == strcmp("-h", argv[n])) { /* print the options and exit */ fprintf(stderr, "usage: simptest \n"); @@ -393,6 +409,12 @@ int main(int argc, char **argv) if (NULL == executable) { executable = strdup("./simpclient"); } + /* check for executable existence and permissions */ + if (0 != access(executable, X_OK)) { + fprintf(stderr, "Executable %s not found or missing executable permissions\n", executable); + exit(1); + } + if (cross_version && nprocs < 2) { fprintf(stderr, "Cross-version testing requires at least two clients\n"); exit(1); @@ -407,6 +429,21 @@ int main(int argc, char **argv) fprintf(stderr, "Testing version %s\n", PMIx_Get_version()); + /* ensure that SIGCHLD is unblocked as we need to capture it */ + if (0 != sigemptyset(&unblock)) { + fprintf(stderr, "SIGEMPTYSET FAILED\n"); + exit(1); + } + if (0 != sigaddset(&unblock, SIGCHLD)) { + fprintf(stderr, "SIGADDSET FAILED\n"); + exit(1); + } + if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) { + fprintf(stderr, "SIG_UNBLOCK FAILED\n"); + exit(1); + } + + /* setup the server library and tell it to support tool connections */ #if PMIX_HAVE_HWLOC if (hwloc) { @@ -477,9 +514,9 @@ int main(int argc, char **argv) /* setup to see sigchld on the forked tests */ PMIX_CONSTRUCT(&children, pmix_list_t); - event_assign(&handler, pmix_globals.evbase, SIGCHLD, - EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); - event_add(&handler, NULL); + pmix_event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); + pmix_event_add(&handler, NULL); /* we have a single namespace for all clients */ atmp = NULL; @@ -539,6 +576,9 @@ int main(int argc, char **argv) } else { pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); } + } else if (!usock) { + /* don't disable usock => enable it on client */ + pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); } x = PMIX_NEW(myxfer_t); if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, @@ -616,6 +656,24 @@ int main(int argc, char **argv) DEBUG_DESTRUCT_LOCK(&globallock); PMIX_INFO_FREE(info, ninfo); +#if 0 + fprintf(stderr, "TEST NONDEFAULT NOTIFICATION\n"); + /* verify that notifications don't recirculate */ + ninfo = 1; + PMIX_INFO_CREATE(info, ninfo); + /* mark that it is not to go to any default handlers */ + PMIX_INFO_LOAD(&info[0], PMIX_EVENT_NON_DEFAULT, NULL, PMIX_BOOL); + PMIx_Notify_event(PMIX_ERR_DEBUGGER_RELEASE, + &pmix_globals.myid, PMIX_RANGE_LOCAL, + info, ninfo, NULL, NULL); + PMIX_INFO_FREE(info, ninfo); + /* wait a little in case we get notified */ + for (ninfo=0; ninfo < 100000; ninfo++) { + struct timespec t = {0, 100}; + nanosleep(&t, NULL); + } +#endif + done: /* deregister the event handlers */ PMIx_Deregister_event_handler(0, NULL, NULL); @@ -645,42 +703,132 @@ static void set_namespace(int nprocs, char *ranks, char *nspace, pmix_op_cbfunc_t cbfunc, myxfer_t *x) { char *regex, *ppn; - char hostname[PMIX_MAXHOSTNAMELEN]; + int n, m, k; + pmix_info_t *info; + pmix_data_array_t *array; - gethostname(hostname, sizeof(hostname)); - x->ninfo = 7; + x->ninfo = 16 + nprocs; PMIX_INFO_CREATE(x->info, x->ninfo); - (void)strncpy(x->info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); - x->info[0].value.type = PMIX_UINT32; - x->info[0].value.data.uint32 = nprocs; - - (void)strncpy(x->info[1].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); - x->info[1].value.type = PMIX_UINT32; - x->info[1].value.data.uint32 = 0; - - (void)strncpy(x->info[2].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); - x->info[2].value.type = PMIX_UINT32; - x->info[2].value.data.uint32 = nprocs; - - (void)strncpy(x->info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); - x->info[3].value.type = PMIX_STRING; - x->info[3].value.data.string = strdup(ranks); - - PMIx_generate_regex(hostname, ®ex); - (void)strncpy(x->info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); - x->info[4].value.type = PMIX_STRING; - x->info[4].value.data.string = regex; - - PMIx_generate_ppn(ranks, &ppn); - (void)strncpy(x->info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); - x->info[5].value.type = PMIX_STRING; - x->info[5].value.data.string = ppn; - - (void)strncpy(x->info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); - x->info[6].value.type = PMIX_UINT32; - x->info[6].value.data.uint32 = nprocs; - + n = 0; + + PMIx_generate_regex("test000,test001,test002", ®ex); + PMIx_generate_ppn("0;1;2", &ppn); + + (void)strncpy(x->info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = regex; + ++n; + + /* if we have some empty nodes, then fill their spots */ + (void)strncpy(x->info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = ppn; + ++n; + + (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = strdup(ranks); + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOBID, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = strdup("1234"); + ++n; + + (void)strncpy(x->info[n].key, PMIX_NPROC_OFFSET, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NODEID, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NODE_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NUM_NODES, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 1; + ++n; + + (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_MAX_PROCS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOB_NUM_APPS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 1; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCALLDR, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_PROC_RANK; + x->info[n].value.data.uint32 = 0; + ++n; + + /* add the proc-specific data */ + for (m=0; m < nprocs; m++) { + (void)strncpy(x->info[n].key, PMIX_PROC_DATA, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(array, 5, PMIX_INFO); + x->info[n].value.data.darray = array; + info = (pmix_info_t*)array->array; + k = 0; + (void)strncpy(info[k].key, PMIX_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_PROC_RANK; + info[k].value.data.rank = m; + ++k; + (void)strncpy(info[k].key, PMIX_GLOBAL_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_PROC_RANK; + info[k].value.data.rank = m; + ++k; + (void)strncpy(info[k].key, PMIX_LOCAL_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT16; + info[k].value.data.uint16 = m; + ++k; + + (void)strncpy(info[k].key, PMIX_NODE_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT16; + info[k].value.data.uint16 = m; + ++k; + + (void)strncpy(info[k].key, PMIX_NODEID, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT32; + info[k].value.data.uint32 = 0; + ++k; + /* move to next proc */ + ++n; + } PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo, cbfunc, x); } @@ -694,6 +842,12 @@ static void errhandler(size_t evhdlr_registration_id, void *cbdata) { pmix_output(0, "SERVER: ERRHANDLER CALLED WITH STATUS %d", status); + /* we must NOT tell the event handler state machine that we + * are the last step as that will prevent it from notifying + * anyone else that might be listening for declarations */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); + } } static void errhandler_reg_callbk (pmix_status_t status, @@ -702,8 +856,6 @@ static void errhandler_reg_callbk (pmix_status_t status, { mylock_t *lock = (mylock_t*)cbdata; - pmix_output(0, "SERVER: ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", - status, (unsigned long)errhandler_ref); lock->status = status; DEBUG_WAKEUP_THREAD(lock); } @@ -716,8 +868,6 @@ static pmix_status_t connected(const pmix_proc_t *proc, void *server_object, static pmix_status_t finalized(const pmix_proc_t *proc, void *server_object, pmix_op_cbfunc_t cbfunc, void *cbdata) { - pmix_output(0, "SERVER: FINALIZED %s:%d WAKEUP %d", - proc->nspace, proc->rank, wakeup); return PMIX_OPERATION_SUCCEEDED; } @@ -793,7 +943,6 @@ static pmix_status_t fencenb_fn(const pmix_proc_t procs[], size_t nprocs, { pmix_shift_caddy_t *scd; - pmix_output(0, "SERVER: FENCENB"); scd = PMIX_NEW(pmix_shift_caddy_t); scd->status = PMIX_SUCCESS; scd->data = data; @@ -811,8 +960,6 @@ static pmix_status_t dmodex_fn(const pmix_proc_t *proc, { pmix_shift_caddy_t *scd; - pmix_output(0, "SERVER: DMODEX"); - /* if this is a timeout test, then do nothing */ if (istimeouttest) { return PMIX_SUCCESS; @@ -835,8 +982,6 @@ static pmix_status_t publish_fn(const pmix_proc_t *proc, pmix_locdat_t *p; size_t n; - pmix_output(0, "SERVER: PUBLISH"); - for (n=0; n < ninfo; n++) { p = PMIX_NEW(pmix_locdat_t); (void)strncpy(p->pdata.proc.nspace, proc->nspace, PMIX_MAX_NSLEN); @@ -877,8 +1022,6 @@ static pmix_status_t lookup_fn(const pmix_proc_t *proc, char **keys, pmix_status_t ret = PMIX_ERR_NOT_FOUND; lkobj_t *lk; - pmix_output(0, "SERVER: LOOKUP"); - PMIX_CONSTRUCT(&results, pmix_list_t); for (n=0; NULL != keys[n]; n++) { @@ -928,8 +1071,6 @@ static pmix_status_t unpublish_fn(const pmix_proc_t *proc, char **keys, pmix_locdat_t *p, *p2; size_t n; - pmix_output(0, "SERVER: UNPUBLISH"); - for (n=0; NULL != keys[n]; n++) { PMIX_LIST_FOREACH_SAFE(p, p2, &pubdata, pmix_locdat_t) { if (0 == strncmp(keys[n], p->pdata.key, PMIX_MAX_KEYLEN)) { @@ -961,8 +1102,6 @@ static pmix_status_t spawn_fn(const pmix_proc_t *proc, pmix_proc_t *pptr; bool spawned; - pmix_output(0, "SERVER: SPAWN"); - /* check the job info for parent and spawned keys */ for (n=0; n < ninfo; n++) { if (0 == strncmp(job_info[n].key, PMIX_PARENT_ID, PMIX_MAX_KEYLEN)) { @@ -996,8 +1135,6 @@ static pmix_status_t connect_fn(const pmix_proc_t procs[], size_t nprocs, const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { - pmix_output(0, "SERVER: CONNECT"); - /* in practice, we would pass this request to the local * resource manager for handling */ @@ -1011,8 +1148,6 @@ static pmix_status_t disconnect_fn(const pmix_proc_t procs[], size_t nprocs, const pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { - pmix_output(0, "SERVER: DISCONNECT"); - return PMIX_OPERATION_SUCCEEDED; } @@ -1035,7 +1170,6 @@ static pmix_status_t notify_event(pmix_status_t code, pmix_info_t info[], size_t ninfo, pmix_op_cbfunc_t cbfunc, void *cbdata) { - pmix_output(0, "SERVER: NOTIFY EVENT"); return PMIX_OPERATION_SUCCEEDED; } @@ -1064,8 +1198,6 @@ static pmix_status_t query_fn(pmix_proc_t *proct, pmix_info_t *info; query_data_t qd; - pmix_output(0, "SERVER: QUERY"); - if (NULL == cbfunc) { return PMIX_ERROR; } @@ -1093,8 +1225,6 @@ static void tool_connect_fn(pmix_info_t *info, size_t ninfo, { pmix_proc_t proc; - pmix_output(0, "SERVER: TOOL CONNECT"); - /* just pass back an arbitrary nspace */ (void)strncpy(proc.nspace, "TOOL", PMIX_MAX_NSLEN); proc.rank = 0; @@ -1122,8 +1252,6 @@ static void log_fn(const pmix_proc_t *client, { mylog_t *lg = (mylog_t *)malloc(sizeof(mylog_t)); - pmix_output(0, "SERVER: LOG"); - lg->cbfunc = cbfunc; lg->cbdata = cbdata; PMIX_THREADSHIFT(lg, foobar); @@ -1161,7 +1289,7 @@ static void wait_signal_callback(int fd, short event, void *arg) pid_t pid; wait_tracker_t *t2; - if (SIGCHLD != event_get_signal(sig)) { + if (SIGCHLD != pmix_event_get_signal(sig)) { return; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c index f5454029887..10835d68abf 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptimeout.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -103,17 +103,17 @@ int main(int argc, char **argv) usleep(10); } - /* get our universe size */ + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get universe size failed: %s", + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d universe size %d", myproc.nspace, myproc.rank, nprocs); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); /* if we are rank=0, then do a fence with timeout */ if (0 == myproc.rank) { diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c b/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c index d67b6f84109..c97df8c74fe 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/stability.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. @@ -183,6 +183,8 @@ static pmix_list_t pubdata; static pmix_event_t handler; static pmix_list_t children; static bool istimeouttest = false; +static bool nettest = false; +static bool arrays = false; static void set_namespace(int nprocs, char *ranks, char *nspace, pmix_op_cbfunc_t cbfunc, myxfer_t *x); @@ -209,6 +211,32 @@ static void opcbfunc(pmix_status_t status, void *cbdata) DEBUG_WAKEUP_THREAD(&x->lock); } +static void setup_cbfunc(pmix_status_t status, + pmix_info_t info[], size_t ninfo, + void *provided_cbdata, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + myxfer_t *x = (myxfer_t*)provided_cbdata; + size_t n; + + /* transfer it to the caddy for return to the main thread */ + if (0 < ninfo) { + PMIX_INFO_CREATE(x->info, ninfo); + x->ninfo = ninfo; + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&x->info[n], &info[n]); + } + } + + /* let the library release the data and cleanup from + * the operation */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + + DEBUG_WAKEUP_THREAD(&x->lock); +} + int main(int argc, char **argv) { char **client_env=NULL; @@ -225,6 +253,11 @@ int main(int argc, char **argv) size_t ninfo; mylock_t mylock; int ncycles=1, m, delay=0; + bool hwloc = false; +#if PMIX_HAVE_HWLOC + char *hwloc_file = NULL; +#endif + sigset_t unblock; /* smoke test */ if (PMIX_SUCCESS != 0) { @@ -260,30 +293,115 @@ int main(int argc, char **argv) 0 == strcmp("--sleep", argv[n])) && NULL != argv[n+1]) { delay = strtol(argv[n+1], NULL, 10); +#if PMIX_HAVE_HWLOC + } else if (0 == strcmp("-hwloc", argv[n]) || + 0 == strcmp("--hwloc", argv[n])) { + /* test hwloc support */ + hwloc = true; + } else if (0 == strcmp("-hwloc-file", argv[n]) || + 0 == strcmp("--hwloc-file", argv[n])) { + if (NULL == argv[n+1]) { + fprintf(stderr, "The --hwloc-file option requires an argument\n"); + exit(1); + } + hwloc_file = strdup(argv[n+1]); + hwloc = true; + ++n; +#endif } else if (0 == strcmp("-h", argv[n])) { /* print the options and exit */ fprintf(stderr, "usage: simptest \n"); fprintf(stderr, " -n N Number of clients to run\n"); fprintf(stderr, " -e foo Name of the client executable to run (default: simpclient\n"); fprintf(stderr, " -reps N Cycle for N repetitions"); + fprintf(stderr, " -hwloc Test hwloc support\n"); + fprintf(stderr, " -hwloc-file FILE Use file to import topology\n"); + fprintf(stderr, " -net-test Test network endpt assignments\n"); + fprintf(stderr, " -arrays Use the job session array to pass registration info\n"); exit(0); + } else if (0 == strcmp("-net-test", argv[n]) || + 0 == strcmp("--net-test", argv[n])) { + /* test network support */ + nettest = true; + } else if (0 == strcmp("-arrays", argv[n]) || + 0 == strcmp("--arrays", argv[n])) { + /* test network support */ + arrays = true; } } if (NULL == executable) { - executable = strdup("./quietclient"); + if (nettest) { + executable = strdup("./simpcoord"); + } else { + executable = strdup("./quietclient"); + } + } + /* check for executable existence and permissions */ + if (0 != access(executable, X_OK)) { + fprintf(stderr, "Executable %s not found or missing executable permissions\n", executable); + exit(1); + } + + /* ensure that SIGCHLD is unblocked as we need to capture it */ + if (0 != sigemptyset(&unblock)) { + fprintf(stderr, "SIGEMPTYSET FAILED\n"); + exit(1); + } + if (0 != sigaddset(&unblock, SIGCHLD)) { + fprintf(stderr, "SIGADDSET FAILED\n"); + exit(1); + } + if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) { + fprintf(stderr, "SIG_UNBLOCK FAILED\n"); + exit(1); } + /* setup the server library and tell it to support tool connections */ +#if PMIX_HAVE_HWLOC + if (hwloc) { +#if HWLOC_API_VERSION < 0x20000 + ninfo = 4; +#else + ninfo = 5; +#endif + } else { + ninfo = 4; + } +#else ninfo = 3; +#endif PMIX_INFO_CREATE(info, ninfo); PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TOOL_SUPPORT, NULL, PMIX_BOOL); PMIX_INFO_LOAD(&info[1], PMIX_USOCK_DISABLE, NULL, PMIX_BOOL); PMIX_INFO_LOAD(&info[2], PMIX_SERVER_GATEWAY, NULL, PMIX_BOOL); +#if PMIX_HAVE_HWLOC + if (hwloc) { + if (NULL != hwloc_file) { + PMIX_INFO_LOAD(&info[3], PMIX_TOPOLOGY_FILE, hwloc_file, PMIX_STRING); + } else { + PMIX_INFO_LOAD(&info[3], PMIX_TOPOLOGY, NULL, PMIX_STRING); + } +#if HWLOC_API_VERSION >= 0x20000 + PMIX_INFO_LOAD(&info[4], PMIX_HWLOC_SHARE_TOPO, NULL, PMIX_BOOL); +#endif + } +#endif + if (nettest) { + /* set a known network configuration for the pnet/test component */ + putenv("PMIX_MCA_pnet_test_nverts=nodes:5;plane:d:3;plane:s:2;plane:d:5"); + putenv("PMIX_MCA_pnet=test"); + } + if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, ninfo))) { fprintf(stderr, "Init failed with error %d\n", rc); return rc; } PMIX_INFO_FREE(info, ninfo); + if (nettest) { + unsetenv("PMIX_MCA_pnet"); + unsetenv("PMIX_MCA_pnet_test_nverts"); + } /* register the default errhandler */ DEBUG_CONSTRUCT_LOCK(&mylock); @@ -304,9 +422,9 @@ int main(int argc, char **argv) /* setup to see sigchld on the forked tests */ PMIX_CONSTRUCT(&children, pmix_list_t); - event_assign(&handler, pmix_globals.evbase, SIGCHLD, - EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); - event_add(&handler, NULL); + pmix_event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST,wait_signal_callback, &handler); + pmix_event_add(&handler, NULL); for (m=0; m < ncycles; m++) { fprintf(stderr, "Running cycle %d\n", m); @@ -445,43 +563,186 @@ int main(int argc, char **argv) static void set_namespace(int nprocs, char *ranks, char *nspace, pmix_op_cbfunc_t cbfunc, myxfer_t *x) { - char *regex, *ppn; - char hostname[PMIX_MAXHOSTNAMELEN]; + char *regex, *ppn, *rks; + int n, m, k; + pmix_data_array_t *array; + pmix_info_t *info, *iptr, *ip; + myxfer_t cd, lock; + pmix_status_t rc; - gethostname(hostname, sizeof(hostname)); - x->ninfo = 7; + if (arrays) { + x->ninfo = 15 + nprocs; + } else { + x->ninfo = 16 + nprocs; + } PMIX_INFO_CREATE(x->info, x->ninfo); - (void)strncpy(x->info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); - x->info[0].value.type = PMIX_UINT32; - x->info[0].value.data.uint32 = nprocs; - - (void)strncpy(x->info[1].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); - x->info[1].value.type = PMIX_UINT32; - x->info[1].value.data.uint32 = 0; - - (void)strncpy(x->info[2].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); - x->info[2].value.type = PMIX_UINT32; - x->info[2].value.data.uint32 = nprocs; - - (void)strncpy(x->info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); - x->info[3].value.type = PMIX_STRING; - x->info[3].value.data.string = strdup(ranks); - - PMIx_generate_regex(hostname, ®ex); - (void)strncpy(x->info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); - x->info[4].value.type = PMIX_STRING; - x->info[4].value.data.string = regex; - - PMIx_generate_ppn(ranks, &ppn); - (void)strncpy(x->info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); - x->info[5].value.type = PMIX_STRING; - x->info[5].value.data.string = ppn; + n = 0; + + PMIx_generate_regex("test000,test001,test002", ®ex); + PMIx_generate_ppn("0;1;2", &ppn); + + if (arrays) { + (void)strncpy(x->info[n].key, PMIX_JOB_INFO_ARRAY, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(x->info[n].value.data.darray, 2, PMIX_INFO); + iptr = (pmix_info_t*)x->info[n].value.data.darray->array; + (void)strncpy(iptr[0].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); + iptr[0].value.type = PMIX_STRING; + iptr[0].value.data.string = regex; + (void)strncpy(iptr[1].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); + iptr[1].value.type = PMIX_STRING; + iptr[1].value.data.string = ppn; + ++n; + } else { + (void)strncpy(x->info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = regex; + ++n; + + /* if we have some empty nodes, then fill their spots */ + (void)strncpy(x->info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = ppn; + ++n; + } - (void)strncpy(x->info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); - x->info[6].value.type = PMIX_UINT32; - x->info[6].value.data.uint32 = nprocs; + /* we have the required info to run setup_app, so do that now */ + PMIX_INFO_CREATE(iptr, 4); + PMIX_INFO_XFER(&iptr[0], &x->info[0]); + PMIX_INFO_XFER(&iptr[1], &x->info[1]); + PMIX_INFO_LOAD(&iptr[2], PMIX_SETUP_APP_ENVARS, NULL, PMIX_BOOL); + PMIX_LOAD_KEY(iptr[3].key, PMIX_ALLOC_NETWORK); + iptr[3].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(iptr[3].value.data.darray, 2, PMIX_INFO); + ip = (pmix_info_t*)iptr[3].value.data.darray->array; + asprintf(&rks, "%s.net", nspace); + PMIX_INFO_LOAD(&ip[0], PMIX_ALLOC_NETWORK_ID, rks, PMIX_STRING); + free(rks); + PMIX_INFO_LOAD(&ip[1], PMIX_ALLOC_NETWORK_SEC_KEY, NULL, PMIX_BOOL); + PMIX_CONSTRUCT(&cd, myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_setup_application(nspace, iptr, 4, + setup_cbfunc, &cd))) { + pmix_output(0, "[%s:%d] PMIx_server_setup_application failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc)); + DEBUG_DESTRUCT_LOCK(&cd.lock); + } else { + DEBUG_WAIT_THREAD(&cd.lock); + } + /* use the results to setup the local subsystems */ + PMIX_CONSTRUCT(&lock, myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support(nspace, cd.info, cd.ninfo, + opcbfunc, &lock))) { + pmix_output(0, "[%s:%d] PMIx_server_setup_local_support failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc)); + } else { + DEBUG_WAIT_THREAD(&lock.lock); + } + PMIX_DESTRUCT(&lock); + PMIX_DESTRUCT(&cd); + + (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = strdup(ranks); + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOBID, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_STRING; + x->info[n].value.data.string = strdup("1234"); + ++n; + + (void)strncpy(x->info[n].key, PMIX_NPROC_OFFSET, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NODEID, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 0; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NODE_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_NUM_NODES, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 1; + ++n; + + (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_MAX_PROCS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = nprocs; + ++n; + + (void)strncpy(x->info[n].key, PMIX_JOB_NUM_APPS, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_UINT32; + x->info[n].value.data.uint32 = 1; + ++n; + + (void)strncpy(x->info[n].key, PMIX_LOCALLDR, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_PROC_RANK; + x->info[n].value.data.uint32 = 0; + ++n; + + /* add the proc-specific data */ + for (m=0; m < nprocs; m++) { + (void)strncpy(x->info[n].key, PMIX_PROC_DATA, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(array, 5, PMIX_INFO); + x->info[n].value.data.darray = array; + info = (pmix_info_t*)array->array; + k = 0; + (void)strncpy(info[k].key, PMIX_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_PROC_RANK; + info[k].value.data.rank = m; + ++k; + (void)strncpy(info[k].key, PMIX_GLOBAL_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_PROC_RANK; + info[k].value.data.rank = m; + ++k; + (void)strncpy(info[k].key, PMIX_LOCAL_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT16; + info[k].value.data.uint16 = m; + ++k; + + (void)strncpy(info[k].key, PMIX_NODE_RANK, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT16; + info[k].value.data.uint16 = m; + ++k; + + (void)strncpy(info[k].key, PMIX_NODEID, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_UINT32; + info[k].value.data.uint32 = 0; + ++k; + /* move to next proc */ + ++n; + } PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo, cbfunc, x); } @@ -852,7 +1113,7 @@ static void wait_signal_callback(int fd, short event, void *arg) pid_t pid; wait_tracker_t *t2; - if (SIGCHLD != event_get_signal(sig)) { + if (SIGCHLD != pmix_event_get_signal(sig)) { return; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index 10b180e6598..490f68323be 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -289,9 +289,9 @@ typedef struct { } \ if (PMIX_SUCCESS == rc) { \ if( PMIX_SUCCESS != cbdata.status ){ \ - if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ - TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \ - my_nspace, my_rank, rc, my_nspace, r)); \ + if( !( (cbdata.status == PMIX_ERR_NOT_FOUND || cbdata.status == PMIX_ERR_PROC_ENTRY_NOT_FOUND) && ok_notfnd ) ){ \ + TEST_ERROR(("%s:%d: PMIx_Get_nb failed: %d from %s:%d, key=%s", \ + my_nspace, my_rank, rc, my_nspace, r, key)); \ } \ rc = PMIX_ERROR; \ } else if (NULL == val) { \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_error.c b/opal/mca/pmix/pmix3x/pmix/test/test_error.c index f5217f0657c..24a63da4917 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_error.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_error.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2016 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +38,7 @@ static void timeout_errhandler(size_t evhdlr_registration_id, void *cbdata) { TEST_ERROR(("timeout errhandler called for error status = %d ninfo = %d", - status, ninfo)); + status, (int)ninfo)); if (NULL != cbfunc) { cbfunc(PMIX_SUCCESS, NULL, 0, NULL, NULL, cbdata); } @@ -58,7 +58,7 @@ static void errhandler_reg_callbk1 (pmix_status_t status, size_t *ref = (size_t*) cbdata; *ref = errhandler_ref; TEST_VERBOSE(("PMIX client ERRHANDLER REGISTRATION CALLED WITH STATUS %d, ref=%lu", - status, *ref, (unsigned long)errhandler_ref)); + status, (unsigned long)errhandler_ref)); } diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.c b/opal/mca/pmix/pmix3x/pmix/test/test_server.c index 426014149ef..30d174a9567 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_server.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.c @@ -77,7 +77,7 @@ PMIX_CLASS_INSTANCE(server_nspace_t, nscon, nsdes); static int server_send_procs(void); -static void server_read_cb(evutil_socket_t fd, short event, void *arg); +static void server_read_cb(int fd, short event, void *arg); static int srv_wait_all(double timeout); static int server_fwd_msg(msg_hdr_t *msg_hdr, char *buf, size_t size); static int server_send_msg(msg_hdr_t *msg_hdr, char *data, size_t size); @@ -187,7 +187,7 @@ static void server_unpack_procs(char *buf, size_t size) char *nspace; while ((size_t)(ptr - buf) < size) { - ns_count = (size_t)*ptr; + ns_count = *(size_t *)ptr; ptr += sizeof(size_t); for (i = 0; i < ns_count; i++) { @@ -195,16 +195,16 @@ static void server_unpack_procs(char *buf, size_t size) size_t ltasks, ntasks; int server_id; - server_id = *ptr; + server_id = *(int *)ptr; ptr += sizeof(int); nspace = ptr; ptr += PMIX_MAX_NSLEN+1; - ntasks = (size_t)*ptr; + ntasks = *(size_t *)ptr; ptr += sizeof(size_t); - ltasks = (size_t)*ptr; + ltasks = *(size_t *)ptr; ptr += sizeof(size_t); PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { @@ -226,7 +226,7 @@ static void server_unpack_procs(char *buf, size_t size) } size_t i; for (i = 0; i < ltasks; i++) { - int rank = (int)*ptr; + int rank = *(int *)ptr; ptr += sizeof(int); if (ns_item->task_map[rank] >= 0) { continue; @@ -473,7 +473,7 @@ static void _libpmix_cb(void *cbdata) } } -static void server_read_cb(evutil_socket_t fd, short event, void *arg) +static void server_read_cb(int fd, short event, void *arg) { server_info_t *server = (server_info_t*)arg; msg_hdr_t msg_hdr; @@ -505,8 +505,8 @@ static void server_read_cb(evutil_socket_t fd, short event, void *arg) switch(msg_hdr.cmd) { case CMD_BARRIER_REQUEST: barrier_cnt++; - TEST_VERBOSE(("CMD_BARRIER_REQ req from %d cnt %d", msg_hdr.src_id, - barrier_cnt)); + TEST_VERBOSE(("CMD_BARRIER_REQ req from %d cnt %lu", msg_hdr.src_id, + (unsigned long)barrier_cnt)); if (pmix_list_get_size(server_list) == barrier_cnt) { barrier_cnt = 0; /* reset barrier counter */ server_info_t *tmp_server; @@ -535,8 +535,8 @@ static void server_read_cb(evutil_socket_t fd, short event, void *arg) msg_buf = NULL; } - TEST_VERBOSE(("CMD_FENCE_CONTRIB req from %d cnt %d size %d", - msg_hdr.src_id, contrib_cnt, msg_hdr.size)); + TEST_VERBOSE(("CMD_FENCE_CONTRIB req from %d cnt %lu size %d", + msg_hdr.src_id, (unsigned long)contrib_cnt, msg_hdr.size)); if (pmix_list_get_size(server_list) == contrib_cnt) { server_info_t *tmp_server; PMIX_LIST_FOREACH(tmp_server, server_list, server_info_t) { @@ -547,8 +547,8 @@ static void server_read_cb(evutil_socket_t fd, short event, void *arg) resp_hdr.size = fence_buf_offset; server_send_msg(&resp_hdr, fence_buf, fence_buf_offset); } - TEST_VERBOSE(("CMD_FENCE_CONTRIB complete, size %d", - fence_buf_offset)); + TEST_VERBOSE(("CMD_FENCE_CONTRIB complete, size %lu", + (unsigned long)fence_buf_offset)); if (fence_buf) { free(fence_buf); fence_buf = NULL; @@ -651,13 +651,13 @@ static void server_unpack_dmdx(char *buf, int *sender, pmix_proc_t *proc) { char *ptr = buf; - *sender = (int)*ptr; + *sender = *(int *)ptr; ptr += sizeof(int); memcpy(proc->nspace, ptr, PMIX_MAX_NSLEN +1); ptr += PMIX_MAX_NSLEN +1; - proc->rank = (int)*ptr; + proc->rank = *(int *)ptr; ptr += sizeof(int); } @@ -671,6 +671,8 @@ static void _dmdx_cb(int status, char *data, size_t sz, void *cbdata) msg_hdr.src_id = my_server_id; msg_hdr.size = sz; msg_hdr.dst_id = *sender_id; + TEST_VERBOSE(("srv #%d: DMDX RESPONSE: receiver=%d, size=%lu,", + my_server_id, *sender_id, (unsigned long)sz)); free(sender_id); server_send_msg(&msg_hdr, data, sz); @@ -804,9 +806,9 @@ int server_init(test_params *params) if (params->nservers && pmix_list_get_size(server_list)) { server_info_t *server; PMIX_LIST_FOREACH(server, server_list, server_info_t) { - server->evread = event_new(pmix_globals.evbase, server->rd_fd, + server->evread = pmix_event_new(pmix_globals.evbase, server->rd_fd, EV_READ|EV_PERSIST, server_read_cb, server); - event_add(server->evread, NULL); + pmix_event_add(server->evread, NULL); } } From b37c85dcca027abf1da36ad1477fc8687a6e9621 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 8 Aug 2019 10:45:40 +0900 Subject: [PATCH 397/674] coll/libnbc: fixes ompi ompi_coll_libnbc_request_t parent base ompi_coll_libnbc_request_t on top of ompi_coll_base_nbc_request_t to correctly support the retention of datatypes/operators This fixes a regression introduced in open-mpi/ompi@0fe756d4166eecf2f0ee2598da690c69a7c824c4 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@f8eef0fde99d44653835797b15988ebd3cd3ddc4) --- ompi/mca/coll/libnbc/coll_libnbc_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index c5b1656385d..6598972773d 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -460,6 +460,6 @@ request_construct(ompi_coll_libnbc_request_t *request) OBJ_CLASS_INSTANCE(ompi_coll_libnbc_request_t, - ompi_request_t, + ompi_coll_base_nbc_request_t, request_construct, NULL); From ae26957619d4a957b3dfe88af3f7652dce3b3590 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 8 Aug 2019 10:48:06 +0900 Subject: [PATCH 398/674] coll/base: cleanup ompi_coll_base_nbc_request_t elements Since ompi_coll_base_nbc_request_t is to be used in an opal_free_list_t, it must be returned into a "clean" state. So cleanup some data in the callback completion subroutines. This fixes a regression introduced in open-mpi/ompi@0fe756d4166eecf2f0ee2598da690c69a7c824c4 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@0862c409f1094cfccf5dc31ae7579676daa30b86) --- ompi/mca/coll/base/coll_base_util.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_util.c b/ompi/mca/coll/base/coll_base_util.c index 57fe14bad20..d414166d67e 100644 --- a/ompi/mca/coll/base/coll_base_util.c +++ b/ompi/mca/coll/base/coll_base_util.c @@ -108,9 +108,11 @@ int ompi_rounddown(int num, int factor) static void release_objs_callback(struct ompi_coll_base_nbc_request_t *request) { if (NULL != request->data.objs.objs[0]) { OBJ_RELEASE(request->data.objs.objs[0]); + request->data.objs.objs[0] = NULL; } if (NULL != request->data.objs.objs[1]) { OBJ_RELEASE(request->data.objs.objs[1]); + request->data.objs.objs[1] = NULL; } } @@ -207,15 +209,21 @@ static void release_vecs_callback(ompi_coll_base_nbc_request_t *request) { } else { scount = rcount = OMPI_COMM_IS_INTER(comm)?ompi_comm_remote_size(comm):ompi_comm_size(comm); } - for (int i=0; idata.vecs.stypes && NULL != request->data.vecs.stypes[i]) { - OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]); + if (NULL != request->data.vecs.stypes) { + for (int i=0; idata.vecs.stypes[i]) { + OMPI_DATATYPE_RELEASE(request->data.vecs.stypes[i]); + } } + request->data.vecs.stypes = NULL; } - for (int i=0; idata.vecs.rtypes && NULL != request->data.vecs.rtypes[i]) { - OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]); + if (NULL != request->data.vecs.rtypes) { + for (int i=0; idata.vecs.rtypes[i]) { + OMPI_DATATYPE_RELEASE(request->data.vecs.rtypes[i]); + } } + request->data.vecs.rtypes = NULL; } } From 39ec580b76d4e579abdf2b1d7790036a51efa4bf Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Fri, 9 Aug 2019 09:57:56 +0900 Subject: [PATCH 399/674] coll/base: only retain datatypes/op if the request has not yet completed a non blocking collective might return ompi_request_null, so we should not retain anything in that case. Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@63d3ccde9ddc922737fe3e307cc1af3a70474265) --- ompi/mca/coll/base/coll_base_util.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ompi/mca/coll/base/coll_base_util.c b/ompi/mca/coll/base/coll_base_util.c index d414166d67e..5736c0946ff 100644 --- a/ompi/mca/coll/base/coll_base_util.c +++ b/ompi/mca/coll/base/coll_base_util.c @@ -141,6 +141,9 @@ int ompi_coll_base_retain_op( ompi_request_t *req, ompi_op_t *op, ompi_datatype_t *type) { ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; bool retain = false; + if (REQUEST_COMPLETE(req)) { + return OMPI_SUCCESS; + } if (!ompi_op_is_intrinsic(op)) { OBJ_RETAIN(op); request->data.op.op = op; @@ -177,6 +180,9 @@ int ompi_coll_base_retain_datatypes( ompi_request_t *req, ompi_datatype_t *stype ompi_datatype_t *rtype) { ompi_coll_base_nbc_request_t *request = (ompi_coll_base_nbc_request_t *)req; bool retain = false; + if (REQUEST_COMPLETE(req)) { + return OMPI_SUCCESS; + } if (NULL != stype && !ompi_datatype_is_predefined(stype)) { OBJ_RETAIN(stype); request->data.types.stype = stype; @@ -254,6 +260,9 @@ int ompi_coll_base_retain_datatypes_w( ompi_request_t *req, bool retain = false; ompi_communicator_t *comm = request->super.req_mpi_object.comm; int scount, rcount; + if (REQUEST_COMPLETE(req)) { + return OMPI_SUCCESS; + } if (OMPI_COMM_IS_TOPO(comm)) { (void)mca_topo_base_neighbor_count (comm, &rcount, &scount); } else { From e9a034378086096c9018386254c6044a3d29924f Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Fri, 28 Jun 2019 22:34:30 +0300 Subject: [PATCH 400/674] osc/ucx: Fix possible win creation/destruction race condition To avoid fully initializing the osc/ucx component for MPI application that are not using One-Sided functionality, the initialization happens at the first MPI window creation. This commit ensures atomicity of global state modifications. ported from: 6678ac0f557935b291ec2310216b7ea46e0c13b1 Signed-off-by: Artem Polyakov fix alignment, and fix error path --- ompi/mca/osc/ucx/osc_ucx_component.c | 73 +++++++++++++++++++++------- 1 file changed, 55 insertions(+), 18 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_component.c b/ompi/mca/osc/ucx/osc_ucx_component.c index a5b392568b3..f4032a67151 100644 --- a/ompi/mca/osc/ucx/osc_ucx_component.c +++ b/ompi/mca/osc/ucx/osc_ucx_component.c @@ -21,6 +21,20 @@ memcpy(((char*)(_dst)) + (_off), _src, _len); \ (_off) += (_len); +opal_mutex_t mca_osc_service_mutex = OPAL_MUTEX_STATIC_INIT; +static void _osc_ucx_init_lock(void) +{ + if(mca_osc_ucx_component.enable_mpi_threads) { + opal_mutex_lock(&mca_osc_service_mutex); + } +} +static void _osc_ucx_init_unlock(void) +{ + if(mca_osc_ucx_component.enable_mpi_threads) { + opal_mutex_unlock(&mca_osc_service_mutex); + } +} + static int component_open(void); static int component_register(void); static int component_init(bool enable_progress_threads, bool enable_mpi_threads); @@ -254,6 +268,9 @@ static void ompi_osc_ucx_unregister_progress() { int ret; + /* May be called concurrently - protect */ + _osc_ucx_init_lock(); + mca_osc_ucx_component.num_modules--; OSC_UCX_ASSERT(mca_osc_ucx_component.num_modules >= 0); if (0 == mca_osc_ucx_component.num_modules) { @@ -262,6 +279,8 @@ static void ompi_osc_ucx_unregister_progress() OSC_UCX_VERBOSE(1, "opal_progress_unregister failed: %d", ret); } } + + _osc_ucx_init_unlock(); } static int component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit, @@ -295,6 +314,8 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in return OMPI_ERR_NOT_SUPPORTED; } + _osc_ucx_init_lock(); + if (mca_osc_ucx_component.env_initialized == false) { ucp_config_t *config = NULL; ucp_params_t context_params; @@ -304,7 +325,8 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in status = ucp_config_read("MPI", NULL, &config); if (UCS_OK != status) { OSC_UCX_VERBOSE(1, "ucp_config_read failed: %d", status); - return OMPI_ERROR; + ret = OMPI_ERROR; + goto select_unlock; } OBJ_CONSTRUCT(&mca_osc_ucx_component.requests, opal_free_list_t); @@ -315,7 +337,7 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in 0, 0, 8, 0, 8, NULL, 0, NULL, NULL, NULL); if (OMPI_SUCCESS != ret) { OSC_UCX_VERBOSE(1, "opal_free_list_init failed: %d", ret); - goto error; + goto select_unlock; } /* initialize UCP context */ @@ -337,7 +359,7 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in if (UCS_OK != status) { OSC_UCX_VERBOSE(1, "ucp_init failed: %d", status); ret = OMPI_ERROR; - goto error; + goto select_unlock; } assert(mca_osc_ucx_component.ucp_worker == NULL); @@ -349,8 +371,8 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in &(mca_osc_ucx_component.ucp_worker)); if (UCS_OK != status) { OSC_UCX_VERBOSE(1, "ucp_worker_create failed: %d", status); - ret = OMPI_ERROR; - goto error_nomem; + ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE; + goto select_unlock; } /* query UCP worker attributes */ @@ -358,20 +380,44 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in status = ucp_worker_query(mca_osc_ucx_component.ucp_worker, &worker_attr); if (UCS_OK != status) { OSC_UCX_VERBOSE(1, "ucp_worker_query failed: %d", status); - ret = OMPI_ERROR; - goto error_nomem; + ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE; + goto select_unlock; } if (mca_osc_ucx_component.enable_mpi_threads == true && worker_attr.thread_mode != UCS_THREAD_MODE_MULTI) { OSC_UCX_VERBOSE(1, "ucx does not support multithreading"); - ret = OMPI_ERROR; - goto error_nomem; + ret = OMPI_ERR_TEMP_OUT_OF_RESOURCE; + goto select_unlock; } mca_osc_ucx_component.env_initialized = true; env_initialized = true; } + + mca_osc_ucx_component.num_modules++; + + OSC_UCX_ASSERT(mca_osc_ucx_component.num_modules > 0); + if (1 == mca_osc_ucx_component.num_modules) { + ret = opal_progress_register(progress_callback); + if (OMPI_SUCCESS != ret) { + OSC_UCX_VERBOSE(1, "opal_progress_register failed: %d", ret); + goto select_unlock; + } + } + +select_unlock: + _osc_ucx_init_unlock(); + switch(ret) { + case OMPI_SUCCESS: + break; + case OMPI_ERROR: + goto error; + case OMPI_ERR_TEMP_OUT_OF_RESOURCE: + goto error_nomem; + default: + goto error; + } /* create module structure */ module = (ompi_osc_ucx_module_t *)calloc(1, sizeof(ompi_osc_ucx_module_t)); @@ -380,7 +426,6 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error_nomem; } - mca_osc_ucx_component.num_modules++; /* fill in the function pointer part */ memcpy(module, &ompi_osc_ucx_module_template, sizeof(ompi_osc_base_module_t)); @@ -648,14 +693,6 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in goto error; } - OSC_UCX_ASSERT(mca_osc_ucx_component.num_modules > 0); - if (1 == mca_osc_ucx_component.num_modules) { - ret = opal_progress_register(progress_callback); - if (OMPI_SUCCESS != ret) { - OSC_UCX_VERBOSE(1, "opal_progress_register failed: %d", ret); - goto error; - } - } return ret; error: From 14f3fbb8c1d52671194042b0c83e3a360d9fb88c Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 22 Jul 2019 07:28:54 -0700 Subject: [PATCH 401/674] Provide locality for all procs on node Update PMIx to latest master to get supporting updates. For connect/accept (part of comm_spawn as well), lookup locality for all participating procs on the node and compute the relative locality so it can be used for MPI operations. Signed-off-by: Ralph Castain (cherry picked from commit d202e10c1407d2f9177e9b871eadde1f25526676) --- ompi/dpm/dpm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 8 deletions(-) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index a9a2de586c4..bc3ad8e002e 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -15,7 +15,7 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -404,9 +404,43 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root, goto exit; } if (0 < opal_list_get_size(&ilist)) { + uint32_t *peer_ranks = NULL; + int prn, nprn; + char *val, *mycpuset; + uint16_t u16; + opal_process_name_t wildcard_rank; /* convert the list of new procs to a proc_t array */ new_proc_list = (ompi_proc_t**)calloc(opal_list_get_size(&ilist), sizeof(ompi_proc_t *)); + /* get the list of local peers for the new procs */ + cd = (ompi_dpm_proct_caddy_t*)opal_list_get_first(&ilist); + proc = cd->p; + wildcard_rank.jobid = proc->super.proc_name.jobid; + wildcard_rank.vpid = OMPI_NAME_WILDCARD->vpid; + /* retrieve the local peers */ + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, OPAL_PMIX_LOCAL_PEERS, + &wildcard_rank, &val, OPAL_STRING); + if (OPAL_SUCCESS == rc && NULL != val) { + char **peers = opal_argv_split(val, ','); + free(val); + nprn = opal_argv_count(peers); + peer_ranks = (uint32_t*)calloc(nprn, sizeof(uint32_t)); + for (prn = 0; NULL != peers[prn]; prn++) { + peer_ranks[prn] = strtoul(peers[prn], NULL, 10); + } + opal_argv_free(peers); + } + + /* get my locality string */ + val = NULL; + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, OPAL_PMIX_LOCALITY_STRING, + OMPI_PROC_MY_NAME, &val, OPAL_STRING); + if (OPAL_SUCCESS == rc && NULL != val) { + mycpuset = val; + } else { + mycpuset = NULL; + } + i = 0; OPAL_LIST_FOREACH(cd, &ilist, ompi_dpm_proct_caddy_t) { opal_value_t *kv; @@ -416,15 +450,38 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root, * OPAL_PMIX_LOCALITY and OPAL_PMIX_HOSTNAME. since we can live without * them, we are just fine */ ompi_proc_complete_init_single(proc); - /* save the locality for later */ - kv = OBJ_NEW(opal_value_t); - kv->key = strdup(OPAL_PMIX_LOCALITY); - kv->type = OPAL_UINT16; - kv->data.uint16 = proc->super.proc_flags; - opal_pmix.store_local(&proc->super.proc_name, kv); - OBJ_RELEASE(kv); // maintain accounting + /* if this proc is local, then get its locality */ + if (NULL != peer_ranks) { + for (prn=0; prn < nprn; prn++) { + if (peer_ranks[prn] == proc->super.proc_name.vpid) { + /* get their locality string */ + val = NULL; + OPAL_MODEX_RECV_VALUE_IMMEDIATE(rc, OPAL_PMIX_LOCALITY_STRING, + &proc->super.proc_name, &val, OPAL_STRING); + if (OPAL_SUCCESS == rc && NULL != val) { + u16 = opal_hwloc_compute_relative_locality(mycpuset, val); + free(val); + } else { + /* all we can say is that it shares our node */ + u16 = OPAL_PROC_ON_CLUSTER | OPAL_PROC_ON_CU | OPAL_PROC_ON_NODE; + } + proc->super.proc_flags = u16; + /* save the locality for later */ + kv = OBJ_NEW(opal_value_t); + kv->key = strdup(OPAL_PMIX_LOCALITY); + kv->type = OPAL_UINT16; + kv->data.uint16 = proc->super.proc_flags; + opal_pmix.store_local(&proc->super.proc_name, kv); + OBJ_RELEASE(kv); // maintain accounting + break; + } + } + } ++i; } + if (NULL != mycpuset) { + free(mycpuset); + } /* call add_procs on the new ones */ rc = MCA_PML_CALL(add_procs(new_proc_list, opal_list_get_size(&ilist))); free(new_proc_list); From e17203b4f7f07f128177fe9f8cea30697f13d390 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 12 Aug 2019 12:24:05 -0700 Subject: [PATCH 402/674] Silence Coverity warning Signed-off-by: Ralph Castain --- ompi/dpm/dpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index bc3ad8e002e..9fb42dcce08 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -482,6 +482,9 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root, if (NULL != mycpuset) { free(mycpuset); } + if (NULL != peer_ranks) { + free(peer_ranks); + } /* call add_procs on the new ones */ rc = MCA_PML_CALL(add_procs(new_proc_list, opal_list_get_size(&ilist))); free(new_proc_list); From d72d39bfee83977094f92f9fc1d7346c5e22e633 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 5 Aug 2019 15:56:25 -0500 Subject: [PATCH 403/674] io_ompio_file_open: fix offset calculation with SEEK_END and SEEK_CUR. fixes an issue reported by Wei-keng Liao Fixes Issue #6858 Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_file_open.c | 48 ++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_file_open.c b/ompi/mca/io/ompio/io_ompio_file_open.c index 37bc8fea572..dbb62d718cc 100644 --- a/ompi/mca/io/ompio/io_ompio_file_open.c +++ b/ompi/mca/io/ompio/io_ompio_file_open.c @@ -385,6 +385,45 @@ int mca_io_ompio_file_sync (ompi_file_t *fh) return ret; } +static void mca_io_ompio_file_get_eof_offset (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE in_offset, + OMPI_MPI_OFFSET_TYPE *out_offset) +{ + /* a file_seek with SEEK_END might require an actual offset that is + not lined up with the end of the file, depending on the file view. + This routine determines the closest (smaller or equal) offset to + the provided in_offset value, avoiding gaps in the file view and avoiding to + break up an etype. + */ + OMPI_MPI_OFFSET_TYPE offset=0, prev_offset=0, start_offset=0; + size_t k=0, blocklen=0; + size_t index_in_file_view=0; + + in_offset -= fh->f_disp; + if ( fh->f_view_size > 0 ) { + /* starting offset of the current copy of the filew view */ + start_offset = in_offset / fh->f_view_extent; + + index_in_file_view = 0; + /* determine block id that the offset is located in and + the starting offset of that block */ + while ( offset <= in_offset && index_in_file_view < fh->f_iov_count) { + prev_offset = offset; + offset = start_offset + (OMPI_MPI_OFFSET_TYPE)(intptr_t) fh->f_decoded_iov[index_in_file_view++].iov_base; + } + + offset = prev_offset; + blocklen = fh->f_decoded_iov[index_in_file_view-1].iov_len; + while ( offset <= in_offset && k <= blocklen ) { + prev_offset = offset; + offset += fh->f_etype_size; + k += fh->f_etype_size; + } + + *out_offset = prev_offset; + } + return; +} int mca_io_ompio_file_seek (ompi_file_t *fh, OMPI_MPI_OFFSET_TYPE off, @@ -392,7 +431,7 @@ int mca_io_ompio_file_seek (ompi_file_t *fh, { int ret = OMPI_SUCCESS; mca_common_ompio_data_t *data; - OMPI_MPI_OFFSET_TYPE offset, temp_offset; + OMPI_MPI_OFFSET_TYPE offset, temp_offset, temp_offset2; data = (mca_common_ompio_data_t *) fh->f_io_selected_data; @@ -409,7 +448,7 @@ int mca_io_ompio_file_seek (ompi_file_t *fh, case MPI_SEEK_CUR: ret = mca_common_ompio_file_get_position (&data->ompio_fh, &temp_offset); - offset += temp_offset; + offset += temp_offset * data->ompio_fh.f_etype_size; if (offset < 0) { OPAL_THREAD_UNLOCK(&fh->f_lock); return OMPI_ERROR; @@ -417,7 +456,9 @@ int mca_io_ompio_file_seek (ompi_file_t *fh, break; case MPI_SEEK_END: ret = data->ompio_fh.f_fs->fs_file_get_size (&data->ompio_fh, - &temp_offset); + &temp_offset2); + mca_io_ompio_file_get_eof_offset (&data->ompio_fh, + temp_offset2, &temp_offset); offset += temp_offset; if (offset < 0 || OMPI_SUCCESS != ret) { OPAL_THREAD_UNLOCK(&fh->f_lock); @@ -436,6 +477,7 @@ int mca_io_ompio_file_seek (ompi_file_t *fh, return ret; } + int mca_io_ompio_file_get_position (ompi_file_t *fd, OMPI_MPI_OFFSET_TYPE *offset) { From 83d40c1e14c370bea685314988371856c9ad57ae Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 14 Aug 2019 01:05:28 -0400 Subject: [PATCH 404/674] Fix the stack displacement. Fixes the convertor iovec description on the MPI-IO reported by Edgar. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor_raw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 893792583f9..3d22cd792a3 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -126,8 +126,8 @@ opal_convertor_raw( opal_convertor_t* pConvertor, const ddt_elem_desc_t* current = &(pElem->elem); if( count_desc != (current->count * current->blocklen) ) { /* Not the full element description */ - do_now = current->blocklen - (count_desc % current->blocklen); /* how much left in the block */ - if( do_now ) { + if( (do_now = count_desc % current->blocklen) ) { + do_now = current->blocklen - do_now; /* how much left in the block */ source_base += current->disp; blength = do_now * opal_datatype_basicDatatypes[current->common.type]->size; OPAL_DATATYPE_SAFEGUARD_POINTER( source_base, blength, pConvertor->pBaseBuf, @@ -136,12 +136,12 @@ opal_convertor_raw( opal_convertor_t* pConvertor, index, (void*)source_base, blength ); ); opal_convertor_merge_iov( iov, iov_count, (IOVBASE_TYPE *) source_base, blength, &index ); - /* not check the return value, we know there was at least one element in the iovec */ + /* ignore the return value, we know there was at least one element in the iovec */ sum_iov_len += blength; count_desc -= do_now; - source_base += (current->extent - current->disp + - (current->blocklen - do_now) * opal_datatype_basicDatatypes[current->common.type]->size); + source_base += (blength - current->blocklen * opal_datatype_basicDatatypes[current->common.type]->size + + current->extent - current->disp); } } } @@ -258,7 +258,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, } /* I complete an element, next step I should go to the next one */ PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_UINT1, count_desc, - source_base - pStack->disp - pConvertor->pBaseBuf ); + source_base - pConvertor->pBaseBuf ); DO_DEBUG( opal_output( 0, "raw save stack stack_pos %d pos_desc %d count_desc %" PRIsize_t " disp %ld\n", pConvertor->stack_pos, pStack->index, pStack->count, (long)pStack->disp ); ); return 0; From 8e6e826b54725ded4f15f9677ff0a11f80ee3e6c Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 14 Aug 2019 10:59:50 -0400 Subject: [PATCH 405/674] Fix the variable names used for the datatype dump. Signed-off-by: George Bosilca --- opal/datatype/opal_convertor_internal.h | 5 --- opal/datatype/opal_convertor_raw.c | 2 +- opal/datatype/opal_datatype_copy.c | 2 +- opal/datatype/opal_datatype_internal.h | 9 +++-- opal/datatype/opal_datatype_module.c | 51 +++++++++++++++---------- opal/datatype/opal_datatype_pack.c | 4 +- opal/datatype/opal_datatype_position.c | 2 +- opal/datatype/opal_datatype_unpack.c | 2 +- 8 files changed, 41 insertions(+), 36 deletions(-) diff --git a/opal/datatype/opal_convertor_internal.h b/opal/datatype/opal_convertor_internal.h index 025633cb7e7..39690f5bd19 100644 --- a/opal/datatype/opal_convertor_internal.h +++ b/opal/datatype/opal_convertor_internal.h @@ -50,11 +50,6 @@ opal_convertor_master_t* opal_convertor_find_or_create_master( uint32_t remote_a void opal_convertor_destroy_masters( void ); -#if OPAL_ENABLE_DEBUG -extern bool opal_pack_debug; -extern bool opal_unpack_debug; -#endif /* OPAL_ENABLE_DEBUG */ - END_C_DECLS #endif /* OPAL_CONVERTOR_INTERNAL_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 3d22cd792a3..5bea5dcf5b8 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -25,7 +25,7 @@ #if OPAL_ENABLE_DEBUG #include "opal/util/output.h" -#define DO_DEBUG(INST) if( opal_pack_debug ) { INST } +#define DO_DEBUG(INST) if( opal_ddt_raw_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ diff --git a/opal/datatype/opal_datatype_copy.c b/opal/datatype/opal_datatype_copy.c index 7bf94ef97b9..c70bdd24dfa 100644 --- a/opal/datatype/opal_datatype_copy.c +++ b/opal/datatype/opal_datatype_copy.c @@ -36,7 +36,7 @@ #if OPAL_ENABLE_DEBUG -#define DO_DEBUG(INST) if( opal_copy_debug ) { INST } +#define DO_DEBUG(INST) if( opal_ddt_copy_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index 1f10c9138aa..bdeb0cc429e 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -496,10 +496,11 @@ OPAL_DECLSPEC int opal_datatype_contain_basic_datatypes( const struct opal_datat OPAL_DECLSPEC int opal_datatype_dump_data_flags( unsigned short usflags, char* ptr, size_t length ); OPAL_DECLSPEC int opal_datatype_dump_data_desc( union dt_elem_desc* pDesc, int nbElems, char* ptr, size_t length ); -extern bool opal_position_debug; -extern bool opal_copy_debug; -extern bool opal_unpack_debug; -extern bool opal_pack_debug; +extern bool opal_ddt_position_debug; +extern bool opal_ddt_copy_debug; +extern bool opal_ddt_unpack_debug; +extern bool opal_ddt_pack_debug; +extern bool opal_ddt_raw_debug; END_C_DECLS #endif /* OPAL_DATATYPE_INTERNAL_H_HAS_BEEN_INCLUDED */ diff --git a/opal/datatype/opal_datatype_module.c b/opal/datatype/opal_datatype_module.c index d4415b21ef1..ba933b5fe2b 100644 --- a/opal/datatype/opal_datatype_module.c +++ b/opal/datatype/opal_datatype_module.c @@ -37,10 +37,11 @@ /* by default the debuging is turned off */ int opal_datatype_dfd = -1; -bool opal_unpack_debug = false; -bool opal_pack_debug = false; -bool opal_position_debug = false; -bool opal_copy_debug = false; +bool opal_ddt_unpack_debug = false; +bool opal_ddt_pack_debug = false; +bool opal_ddt_position_debug = false; +bool opal_ddt_copy_debug = false; +bool opal_ddt_raw_debug = false; int opal_ddt_verbose = -1; /* Has the datatype verbose it's own output stream */ extern int opal_cuda_verbose; @@ -148,35 +149,43 @@ int opal_datatype_register_params(void) int ret; ret = mca_base_var_register ("opal", "mpi", NULL, "ddt_unpack_debug", - "Whether to output debugging information in the ddt unpack functions (nonzero = enabled)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_LOCAL, &opal_unpack_debug); + "Whether to output debugging information in the ddt unpack functions (nonzero = enabled)", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &opal_ddt_unpack_debug); if (0 > ret) { - return ret; + return ret; } ret = mca_base_var_register ("opal", "mpi", NULL, "ddt_pack_debug", - "Whether to output debugging information in the ddt pack functions (nonzero = enabled)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_LOCAL, &opal_pack_debug); + "Whether to output debugging information in the ddt pack functions (nonzero = enabled)", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &opal_ddt_pack_debug); if (0 > ret) { - return ret; + return ret; + } + + ret = mca_base_var_register ("opal", "mpi", NULL, "ddt_raw_debug", + "Whether to output debugging information in the ddt raw functions (nonzero = enabled)", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &opal_ddt_raw_debug); + if (0 > ret) { + return ret; } ret = mca_base_var_register ("opal", "mpi", NULL, "ddt_position_debug", - "Non zero lead to output generated by the datatype position functions", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_LOCAL, &opal_position_debug); + "Non zero lead to output generated by the datatype position functions", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &opal_ddt_position_debug); if (0 > ret) { - return ret; + return ret; } ret = mca_base_var_register ("opal", "mpi", NULL, "ddt_copy_debug", - "Whether to output debugging information in the ddt copy functions (nonzero = enabled)", - MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, - MCA_BASE_VAR_SCOPE_LOCAL, &opal_copy_debug); + "Whether to output debugging information in the ddt copy functions (nonzero = enabled)", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, &opal_ddt_copy_debug); if (0 > ret) { - return ret; + return ret; } ret = mca_base_var_register ("opal", "opal", NULL, "ddt_verbose", @@ -195,7 +204,7 @@ int opal_datatype_register_params(void) OPAL_INFO_LVL_8, MCA_BASE_VAR_SCOPE_LOCAL, &opal_cuda_verbose); if (0 > ret) { - return ret; + return ret; } #endif diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index c0ab6df66d8..f21adcccb34 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -31,7 +31,7 @@ #if OPAL_ENABLE_DEBUG #include "opal/util/output.h" -#define DO_DEBUG(INST) if( opal_pack_debug ) { INST } +#define DO_DEBUG(INST) if( opal_ddt_pack_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ @@ -272,7 +272,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; - + if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { if( (pElem->elem.count * pElem->elem.blocklen) != count_desc ) { /* we have a partial (less than blocklen) basic datatype */ diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index 204d670a3ef..02ec55651a0 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -33,7 +33,7 @@ #if OPAL_ENABLE_DEBUG #include "opal/util/output.h" -#define DO_DEBUG(INST) if( opal_position_debug ) { INST } +#define DO_DEBUG(INST) if( opal_ddt_position_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index dca07796d99..0925bde736d 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -33,7 +33,7 @@ #if OPAL_ENABLE_DEBUG #include "opal/util/output.h" -#define DO_DEBUG(INST) if( opal_unpack_debug ) { INST } +#define DO_DEBUG(INST) if( opal_ddt_unpack_debug ) { INST } #else #define DO_DEBUG(INST) #endif /* OPAL_ENABLE_DEBUG */ From c9f48e2e77dbf4928b2d6c18f2576557c112cc1c Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 14 Aug 2019 11:06:47 -0400 Subject: [PATCH 406/674] Whitespace cleanup No code or logic changes. Signed-off-by: George Bosilca Signed-off-by: Jeff Squyres --- ompi/mca/common/monitoring/common_monitoring.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/mca/common/monitoring/common_monitoring.c b/ompi/mca/common/monitoring/common_monitoring.c index e521ca56417..ff252bf944f 100644 --- a/ompi/mca/common/monitoring/common_monitoring.c +++ b/ompi/mca/common/monitoring/common_monitoring.c @@ -268,7 +268,7 @@ void mca_common_monitoring_register(void*pml_monitoring_component) &mca_common_monitoring_enabled); mca_common_monitoring_current_state = mca_common_monitoring_enabled; - + (void)mca_base_var_register("ompi", "pml", "monitoring", "enable_output", "Enable the PML monitoring textual output at MPI_Finalize " "(it will be automatically turned off when MPIT is used to " @@ -278,7 +278,7 @@ void mca_common_monitoring_register(void*pml_monitoring_component) MCA_BASE_VAR_FLAG_DWG, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY, &mca_common_monitoring_output_enabled); - + (void)mca_base_var_register("ompi", "pml", "monitoring", "filename", /*&mca_common_monitoring_component.pmlm_version, "filename",*/ "The name of the file where the monitoring information " @@ -292,7 +292,7 @@ void mca_common_monitoring_register(void*pml_monitoring_component) /* Now that the MCA variables are automatically unregistered when * their component close, we need to keep a safe copy of the - * filename. + * filename. * Keep the copy completely separated in order to let the initial * filename to be handled by the framework. It's easier to deal * with the string lifetime. From f49c22af6d9c4215f8d97f388ca47961c46015b2 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Mon, 12 Aug 2019 16:15:42 -0700 Subject: [PATCH 407/674] Run-as-root env vars in orterun.c I found that I needed to apply the same change as #5597 to orterun.c for the environment variables to work correctly. Signed-off-by: Simon Byrne (cherry picked from commit 9c8671c48b946f4387cddb6a66aaab572fa983dd) --- orte/tools/orterun/orterun.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index 7f80b147aed..2c436c69db3 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -142,6 +142,14 @@ int orterun(int argc, char *argv[]) * exit with a giant warning flag */ if (0 == geteuid() && !orte_cmd_options.run_as_root) { + char *r1, *r2; + if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) && + NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) { + if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) { + goto moveon; + } + } + fprintf(stderr, "--------------------------------------------------------------------------\n"); if (NULL != orte_cmd_options.help) { fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename); @@ -159,6 +167,7 @@ int orterun(int argc, char *argv[]) exit(1); } + moveon: /* setup to listen for commands sent specifically to me, even though I would probably * be the one sending them! Unfortunately, since I am a participating daemon, * there are times I need to send a command to "all daemons", and that means *I* have From 549abeaa8743db7a8cac77c6291549d92696f8aa Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 19 Aug 2019 15:36:59 -0400 Subject: [PATCH 408/674] orterun: remove duplicate code https://github.com/open-mpi/ompi/pull/6895 fixed the code in orterun.c to allow running as root if both OMPI_ALLOW_RUN_AS_ROOT and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM env vars are set. However, this env-var-checking code already exists in orte_submit.c:orte_submit_init() -- it looks like the geteuid()/getenv()-checking code here in orterun is now duplicate code. So let's just get rid of the duplicate code. Signed-off-by: Jeff Squyres (cherry picked from commit 197beb30d555922b084ac3b89bb97321bf157e88) --- orte/tools/orterun/orterun.c | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/orte/tools/orterun/orterun.c b/orte/tools/orterun/orterun.c index 2c436c69db3..3a7abc6a361 100644 --- a/orte/tools/orterun/orterun.c +++ b/orte/tools/orterun/orterun.c @@ -137,37 +137,6 @@ int orterun(int argc, char *argv[]) exit(1); } - /* check if we are running as root - if we are, then only allow - * us to proceed if the allow-run-as-root flag was given. Otherwise, - * exit with a giant warning flag - */ - if (0 == geteuid() && !orte_cmd_options.run_as_root) { - char *r1, *r2; - if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) && - NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) { - if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) { - goto moveon; - } - } - - fprintf(stderr, "--------------------------------------------------------------------------\n"); - if (NULL != orte_cmd_options.help) { - fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename); - } else { - /* show_help is not yet available, so print an error manually */ - fprintf(stderr, "%s has detected an attempt to run as root.\n", orte_basename); - } - fprintf(stderr, "Running at root is *strongly* discouraged as any mistake (e.g., in\n"); - fprintf(stderr, "defining TMPDIR) or bug can result in catastrophic damage to the OS\n"); - fprintf(stderr, "file system, leaving your system in an unusable state.\n\n"); - fprintf(stderr, "You can override this protection by adding the --allow-run-as-root\n"); - fprintf(stderr, "option to your cmd line. However, we reiterate our strong advice\n"); - fprintf(stderr, "against doing so - please do so at your own risk.\n"); - fprintf(stderr, "--------------------------------------------------------------------------\n"); - exit(1); - } - - moveon: /* setup to listen for commands sent specifically to me, even though I would probably * be the one sending them! Unfortunately, since I am a participating daemon, * there are times I need to send a command to "all daemons", and that means *I* have From 66e18563bf4867763b63e520fd355b9ed6a6d0b6 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 21 Aug 2019 12:01:55 +0300 Subject: [PATCH 409/674] SPML/UCX: fixed hang in SHMEM_FINALIZE - used MPI _Barrier to synchronize processes Signed-off-by: Sergey Oblomov (cherry picked from commit 182023febb6f8f31ce34dc54c8aa409ad7e44fa2) --- opal/mca/common/ucx/common_ucx.c | 7 +++++-- oshmem/mca/spml/ucx/spml_ucx.c | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index a3a12a8fa88..bf5d6c04943 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -186,8 +186,11 @@ static void opal_common_ucx_wait_all_requests(void **reqs, int count, ucp_worker } } -OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, size_t count, - size_t my_rank, size_t max_disconnect, ucp_worker_h worker) { +OPAL_DECLSPEC int opal_common_ucx_del_procs_nofence(opal_common_ucx_del_proc_t *procs, + size_t count, size_t my_rank, + size_t max_disconnect, + ucp_worker_h worker) +{ size_t num_reqs; size_t max_reqs; void *dreq, **dreqs; diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 4a0dd121d89..44ad1b4f095 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -127,18 +127,16 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn = NULL; } - ret = opal_common_ucx_del_procs(del_procs, nprocs, oshmem_my_proc_id(), - mca_spml_ucx.num_disconnect, - mca_spml_ucx_ctx_default.ucp_worker); - + ret = opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), + mca_spml_ucx.num_disconnect, + mca_spml_ucx_ctx_default.ucp_worker); + /* Do not barrier here - barrier is called in _shmem_finalize */ free(del_procs); free(mca_spml_ucx.remote_addrs_tbl); free(mca_spml_ucx_ctx_default.ucp_peers); mca_spml_ucx_ctx_default.ucp_peers = NULL; - opal_common_ucx_mca_proc_added(); - return ret; } @@ -326,6 +324,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) free(wk_roffs); SPML_UCX_VERBOSE(50, "*** ADDED PROCS ***"); + + opal_common_ucx_mca_proc_added(); return OSHMEM_SUCCESS; error2: From 1f9fce8955c3ba904daace618661e936c34f010b Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Wed, 21 Aug 2019 12:08:09 +0300 Subject: [PATCH 410/674] SPML/UCX: fixed comment Signed-off-by: Sergey Oblomov (cherry picked from commit 01dacaa6a42b35c1b7538d8ff0036bded913c847) --- oshmem/mca/spml/ucx/spml_ucx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 44ad1b4f095..36d3467bf5c 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -130,7 +130,7 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) ret = opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), mca_spml_ucx.num_disconnect, mca_spml_ucx_ctx_default.ucp_worker); - /* Do not barrier here - barrier is called in _shmem_finalize */ + /* No need to barrier here - barrier is called in _shmem_finalize */ free(del_procs); free(mca_spml_ucx.remote_addrs_tbl); free(mca_spml_ucx_ctx_default.ucp_peers); From b07d58a0fec15b5c86bf20a056dc237691ae448f Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Fri, 23 Aug 2019 16:36:10 -0400 Subject: [PATCH 411/674] Updating VERSION for v4.0.2rc1 Signed-off-by: Geoffrey Paulsen --- VERSION | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index ea6b0bc3c1c..1b15d265b58 100644 --- a/VERSION +++ b/VERSION @@ -5,7 +5,9 @@ # All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2018 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Triad National Security, LLC. All rights +# reserved. +# Copyright (c) 2018-2019 IBM Corporation. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -28,7 +30,7 @@ release=2 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=a1 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -86,16 +88,16 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=60:1:20 -libmpi_cxx_so_version=60:0:20 -libmpi_mpifh_so_version=60:1:20 +libmpi_so_version=60:2:20 +libmpi_cxx_so_version=60:1:20 +libmpi_mpifh_so_version=60:2:20 libmpi_usempi_tkr_so_version=60:0:20 libmpi_usempi_ignore_tkr_so_version=60:0:20 -libmpi_usempif08_so_version=60:0:20 -libopen_rte_so_version=60:1:20 -libopen_pal_so_version=60:1:20 +libmpi_usempif08_so_version=60:1:20 +libopen_rte_so_version=60:2:20 +libopen_pal_so_version=60:2:20 libmpi_java_so_version=60:0:20 -liboshmem_so_version=61:0:21 +liboshmem_so_version=62:0:22 libompitrace_so_version=60:0:20 # "Common" components install standalone libraries that are run-time @@ -104,7 +106,7 @@ libompitrace_so_version=60:0:20 # components-don't-affect-the-build-system abstraction. # OMPI layer -libmca_ompi_common_ompio_so_version=60:1:19 +libmca_ompi_common_ompio_so_version=60:2:19 libmca_ompi_common_monitoring_so_version=60:0:10 # ORTE layer @@ -113,6 +115,6 @@ libmca_orte_common_alps_so_version=60:0:20 # OPAL layer libmca_opal_common_cuda_so_version=60:0:20 libmca_opal_common_sm_so_version=60:0:20 -libmca_opal_common_ucx_so_version=60:0:20 +libmca_opal_common_ucx_so_version=60:1:20 libmca_opal_common_ugni_so_version=60:0:20 libmca_opal_common_verbs_so_version=60:0:20 From 1b0cfdf264c793bb5f0fe2714cbbdfc6f54b46eb Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Tue, 20 Aug 2019 14:46:16 -0400 Subject: [PATCH 412/674] v4.0.x: regx/naive: add regx/naive component Signed-off-by: Scott Miller --- orte/mca/regx/fwd/regx_fwd.c | 4 + orte/mca/regx/naive/Makefile.am | 36 ++++ orte/mca/regx/naive/owner.txt | 7 + orte/mca/regx/naive/regx_naive.c | 181 +++++++++++++++++++++ orte/mca/regx/naive/regx_naive.h | 34 ++++ orte/mca/regx/naive/regx_naive_component.c | 62 +++++++ orte/mca/regx/reverse/regx_reverse.c | 4 + 7 files changed, 328 insertions(+) create mode 100644 orte/mca/regx/naive/Makefile.am create mode 100644 orte/mca/regx/naive/owner.txt create mode 100644 orte/mca/regx/naive/regx_naive.c create mode 100644 orte/mca/regx/naive/regx_naive.h create mode 100644 orte/mca/regx/naive/regx_naive_component.c diff --git a/orte/mca/regx/fwd/regx_fwd.c b/orte/mca/regx/fwd/regx_fwd.c index c5c4d5d9030..bdb7e145bf2 100644 --- a/orte/mca/regx/fwd/regx_fwd.c +++ b/orte/mca/regx/fwd/regx_fwd.c @@ -296,5 +296,9 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) free(nodenames); free(tmp); *regex = tmp2; + opal_output_verbose(5, orte_regx_base_framework.framework_output, + "%s Final regex: <%s>", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + *regex); return ORTE_SUCCESS; } diff --git a/orte/mca/regx/naive/Makefile.am b/orte/mca/regx/naive/Makefile.am new file mode 100644 index 00000000000..0cb7fea20d6 --- /dev/null +++ b/orte/mca/regx/naive/Makefile.am @@ -0,0 +1,36 @@ +# +# Copyright (c) 2016-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2019 IBM Corporation. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +sources = \ + regx_naive_component.c \ + regx_naive.h \ + regx_naive.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_orte_regx_naive_DSO +component_noinst = +component_install = mca_regx_naive.la +else +component_noinst = libmca_regx_naive.la +component_install = +endif + +mcacomponentdir = $(ortelibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_regx_naive_la_SOURCES = $(sources) +mca_regx_naive_la_LDFLAGS = -module -avoid-version +mca_regx_naive_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la + +noinst_LTLIBRARIES = $(component_noinst) +libmca_regx_naive_la_SOURCES = $(sources) +libmca_regx_naive_la_LDFLAGS = -module -avoid-version diff --git a/orte/mca/regx/naive/owner.txt b/orte/mca/regx/naive/owner.txt new file mode 100644 index 00000000000..2fd247dddb1 --- /dev/null +++ b/orte/mca/regx/naive/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: IBM +status: active diff --git a/orte/mca/regx/naive/regx_naive.c b/orte/mca/regx/naive/regx_naive.c new file mode 100644 index 00000000000..710b70fb08d --- /dev/null +++ b/orte/mca/regx/naive/regx_naive.c @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include "orte_config.h" +#include "orte/types.h" +#include "opal/types.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#include + +#include "opal/util/argv.h" +#include "opal/util/basename.h" +#include "opal/util/opal_environ.h" + +#include "orte/runtime/orte_globals.h" +#include "orte/util/name_fns.h" +#include "orte/util/show_help.h" +#include "orte/mca/errmgr/errmgr.h" +#include "orte/mca/rmaps/base/base.h" +#include "orte/mca/routed/routed.h" +#include "orte/mca/regx/base/base.h" + +#include "regx_naive.h" + +static int nidmap_create(opal_pointer_array_t *pool, char **regex); + +orte_regx_base_module_t orte_regx_naive_module = { + .nidmap_create = nidmap_create, + .nidmap_parse = orte_regx_base_nidmap_parse, + .extract_node_names = orte_regx_base_extract_node_names, + .encode_nodemap = orte_regx_base_encode_nodemap, + .decode_daemon_nodemap = orte_regx_base_decode_daemon_nodemap, + .generate_ppn = orte_regx_base_generate_ppn, + .parse_ppn = orte_regx_base_parse_ppn +}; + +static int nidmap_create(opal_pointer_array_t *pool, char **regex) +{ + char *node; + int n; + char *nodenames; + orte_regex_range_t *rng; + opal_list_t dvpids; + opal_list_item_t *item; + char **regexargs = NULL, **vpidargs = NULL, *tmp, *tmp2; + orte_node_t *nptr; + orte_vpid_t vpid; + + if (mca_regx_naive_component.compress_vpids) { + OBJ_CONSTRUCT(&dvpids, opal_list_t); + } + + rng = NULL; + for (n=0; n < pool->size; n++) { + if (NULL == (nptr = (orte_node_t*)opal_pointer_array_get_item(pool, n))) { + continue; + } + /* if no daemon has been assigned, then this node is not being used */ + if (NULL == nptr->daemon) { + vpid = -1; // indicates no daemon assigned + } else { + vpid = nptr->daemon->name.vpid; + } + + if (mca_regx_naive_component.compress_vpids) { + /* deal with the daemon vpid - see if it is next in the + * current range */ + if (NULL == rng) { + /* just starting */ + rng = OBJ_NEW(orte_regex_range_t); + rng->vpid = vpid; + rng->cnt = 1; + opal_list_append(&dvpids, &rng->super); + } else if (UINT32_MAX == vpid) { + if (-1 == rng->vpid) { + rng->cnt++; + } else { + /* need to start another range */ + rng = OBJ_NEW(orte_regex_range_t); + rng->vpid = vpid; + rng->cnt = 1; + opal_list_append(&dvpids, &rng->super); + } + } else if (-1 == rng->vpid) { + /* need to start another range */ + rng = OBJ_NEW(orte_regex_range_t); + rng->vpid = vpid; + rng->cnt = 1; + opal_list_append(&dvpids, &rng->super); + } else { + /* is this the next in line */ + if (vpid == (orte_vpid_t)(rng->vpid + rng->cnt)) { + rng->cnt++; + } else { + /* need to start another range */ + rng = OBJ_NEW(orte_regex_range_t); + rng->vpid = vpid; + rng->cnt = 1; + opal_list_append(&dvpids, &rng->super); + } + } + } + else { + asprintf(&tmp, "%u", vpid); + opal_argv_append_nosize(&vpidargs, tmp); + free(tmp); + } + + node = nptr->name; + opal_output_verbose(5, orte_regx_base_framework.framework_output, + "%s PROCESS NODE <%s>", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + node); + + /* Don't compress the name - just add it to the list */ + if (NULL != node) { + /* solitary node */ + opal_argv_append_nosize(®exargs, node); + } + } + + /* assemble final result */ + nodenames = opal_argv_join(regexargs, ','); + /* cleanup */ + opal_argv_free(regexargs); + + if (mca_regx_naive_component.compress_vpids) { + /* do the same for the vpids */ + tmp = NULL; + while (NULL != (item = opal_list_remove_first(&dvpids))) { + rng = (orte_regex_range_t*)item; + if (1 < rng->cnt) { + if (NULL == tmp) { + asprintf(&tmp, "%u(%u)", rng->vpid, rng->cnt); + } else { + asprintf(&tmp2, "%s,%u(%u)", tmp, rng->vpid, rng->cnt); + free(tmp); + tmp = tmp2; + } + } else { + if (NULL == tmp) { + asprintf(&tmp, "%u", rng->vpid); + } else { + asprintf(&tmp2, "%s,%u", tmp, rng->vpid); + free(tmp); + tmp = tmp2; + } + } + OBJ_RELEASE(rng); + } + OPAL_LIST_DESTRUCT(&dvpids); + } + else { + tmp = opal_argv_join(vpidargs, ','); + /* cleanup */ + opal_argv_free(vpidargs); + } + + /* now concatenate the results into one string */ + asprintf(&tmp2, "%s@%s", nodenames, tmp); + free(nodenames); + free(tmp); + *regex = tmp2; + opal_output_verbose(5, orte_regx_base_framework.framework_output, + "%s Final regex: <%s>", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + *regex); + return ORTE_SUCCESS; +} diff --git a/orte/mca/regx/naive/regx_naive.h b/orte/mca/regx/naive/regx_naive.h new file mode 100644 index 00000000000..012dfa25680 --- /dev/null +++ b/orte/mca/regx/naive/regx_naive.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef _MCA_REGX_NONE_H_ +#define _MCA_REGX_NONE_H_ + +#include "orte_config.h" + +#include "orte/types.h" + +#include "opal/mca/base/base.h" +#include "orte/mca/regx/regx.h" + + +BEGIN_C_DECLS + +struct orte_regx_naive_component_t { + orte_regx_base_component_t super; + bool compress_vpids; +}; +typedef struct orte_regx_naive_component_t orte_regx_naive_component_t; + +ORTE_MODULE_DECLSPEC extern orte_regx_naive_component_t mca_regx_naive_component; +extern orte_regx_base_module_t orte_regx_naive_module; + +END_C_DECLS + +#endif /* MCA_REGX_ORTE_H_ */ diff --git a/orte/mca/regx/naive/regx_naive_component.c b/orte/mca/regx/naive/regx_naive_component.c new file mode 100644 index 00000000000..b29641f194f --- /dev/null +++ b/orte/mca/regx/naive/regx_naive_component.c @@ -0,0 +1,62 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "orte_config.h" +#include "orte/types.h" +#include "opal/types.h" + +#include "opal/util/show_help.h" + +#include "orte/mca/regx/regx.h" +#include "regx_naive.h" + +static int component_query(mca_base_module_t **module, int *priority); +static int component_register(void); + +/* + * Struct of function pointers and all that to let us be initialized + */ +orte_regx_naive_component_t mca_regx_naive_component = { + { + .base_version = { + MCA_REGX_BASE_VERSION_1_0_0, + .mca_component_name = "naive", + MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, + ORTE_RELEASE_VERSION), + .mca_query_component = component_query, + .mca_register_component_params = component_register, + }, + .base_data = { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + } +}; + +static int component_query(mca_base_module_t **module, int *priority) +{ + *module = (mca_base_module_t*)&orte_regx_naive_module; + *priority = 1; + return ORTE_SUCCESS; +} + +static int component_register(void) +{ + mca_base_component_t *c = &mca_regx_naive_component.super.base_version; + + mca_regx_naive_component.compress_vpids = false; + (void) mca_base_component_var_register (c, "compress_vpids", "Enable compression of vpids (default: false)", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_regx_naive_component.compress_vpids); + + return ORTE_SUCCESS; +} diff --git a/orte/mca/regx/reverse/regx_reverse.c b/orte/mca/regx/reverse/regx_reverse.c index b6c3ba187a0..1437f48ad75 100644 --- a/orte/mca/regx/reverse/regx_reverse.c +++ b/orte/mca/regx/reverse/regx_reverse.c @@ -315,5 +315,9 @@ static int nidmap_create(opal_pointer_array_t *pool, char **regex) free(nodenames); free(tmp); *regex = tmp2; + opal_output_verbose(5, orte_regx_base_framework.framework_output, + "%s Final regex: <%s>", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + *regex); return ORTE_SUCCESS; } From 197607c896dfe5260c8015a97fb50484365638f9 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Sat, 24 Aug 2019 16:42:36 -0500 Subject: [PATCH 413/674] Updating NEWS for v4.0.2 Signed-off-by: Geoffrey Paulsen --- NEWS | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c7fcd83b079..a4374b10d4e 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,7 @@ Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights reserved. -Copyright (c) 2010-2018 IBM Corporation. All rights reserved. +Copyright (c) 2010-2019 IBM Corporation. All rights reserved. Copyright (c) 2012 Oak Ridge National Labs. All rights reserved. Copyright (c) 2012 Sandia National Laboratories. All rights reserved. Copyright (c) 2012 University of Houston. All rights reserved. @@ -57,6 +57,51 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. +4.0.2 -- September, 2019 +------------------------ +- Update embedded PMIx to 3.1.4 +- Fix an issue with env processing when running as root. + Thanks to Simon Byrne for reporting and providing a fix. +- Fix Fortran MPI_FILE_GET_POSITION return code bug. + Thanks to Wei-Keng Liao for reporting. +- Fix user defined datatypes/ops leak in nonblocking base collective + component. Thanks to Andrey Maslennikov for verifying fix. +- Fixed shared memory not working with spawned processes. + Thanks to @rodarima for reporting. +- Fix data corruption of overlapping datatypes on sends. + Thanks to DKRZ for reporting. +- Fix segfault in oob_tcp component on close with active listeners. + Thanks to Orivej Desh for reporting and providing a fix. +- Fix divide by zero segfault in ompio. + Thanks to @haraldkl for reporting and providing a fix. +- Fix finalize of flux compnents. + Thanks to Stephen Herbein and Jim Garlick for providing a fix. +- Fix osc_rdma_acc_single_intrinsic regression. + Thanks to Joseph Schuchart for reporting and providing a fix. +- Fix hostnames with large integers. + Thanks to @perrynzhou for reporting and providing a fix. +- Fix Deadlock in MPI_Fetch_and_op when using UCX + Thanks to Joseph Schuchart for reporting. +- Fix the SLURM plm for mpirun-based launching. + Thanks to Jordon Hayes for reporting and providing a fix. +- Prevent grep failure in rpmbuild from aborting. + Thanks to Daniel Letai for reporting. +- Fix btl/vader finalize sequence. + Thanks to Daniel Vollmer for reporting. +- Fix pml/ob1 local handle sent during PUT control message. + Thanks to @EmmanuelBRELLE for reporting and providing a fix. +- Fix Memory leak with persistent MPI sends and the ob1 "get" protocol. + Thanks to @s-kuberski for reporting. +- v4.0.x: mpi: mark MPI_COMBINER_{HVECTOR,HINDEXED,STRUCT}_INTEGER + removed unless configured with --enable-mpi1-compatibility +- Fix make-authors.pl when run in a git submodule. + Thanks to Michael Heinz for reporting and providing a fix. +- Fix deadlock with mpi_assert_allow_overtaking in MPI_Issend. + Thanks to Joseph Schuchart and George Bosilca for reporting. +- Add compilation flag to allow unwinding through files that are + present in the stack when attaching with MPIR. + Thanks to James A Clark for reporting and providing a fix. + 4.0.1 -- March, 2019 -------------------- From 8efc6e1dc15eb19afea48a53f09830ce1328ad10 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 26 Aug 2019 23:48:34 -0700 Subject: [PATCH 414/674] Remove unnecessary error log Refs https://github.com/pmix/pmix/pull/1413 Signed-off-by: Ralph Castain --- opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c | 1 - 1 file changed, 1 deletion(-) diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index 48cee715afe..b620c05cf29 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -331,7 +331,6 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, } if (PMIX_SUCCESS != ret) { - PMIX_ERROR_LOG(ret); goto done; } if (PMIX_RANK_UNDEF == proc.rank) { From 83a251899482398a33e0d79240a48b541e937ec2 Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Tue, 27 Aug 2019 15:44:26 +0300 Subject: [PATCH 415/674] Coll/hcoll: fixes hcoll non-blocking colls support open-mpi/ompi@0fe756d4166eecf2f0ee2598da690c69a7c824c4 Introduced a bug in coll/hcoll component. The ompi_requests allocated by libhcoll would be treated as coll_base_nbc_request during ompi_coll_base_retain_<> call. Afterwards this would lead to a segv in the request cleanup. Fix: since libhcoll interface does not distinguish between the blocling/non-blocking requests use coll_base_nbc_request all the time and initialize it properly in coll/hcoll/get_coll_handle(). It is still within 2 cache lines. Signed-off-by: Valentin Petrov --- ompi/mca/coll/hcoll/coll_hcoll_rte.c | 47 +++++++++++----------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/ompi/mca/coll/hcoll/coll_hcoll_rte.c b/ompi/mca/coll/hcoll/coll_hcoll_rte.c index 6df2dde7e90..b7b87d0f41a 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_rte.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_rte.c @@ -39,7 +39,7 @@ #include "ompi/datatype/ompi_datatype.h" #include "ompi/datatype/ompi_datatype_internal.h" #include "ompi/mca/pml/pml.h" - +#include "ompi/mca/coll/base/coll_base_util.h" #include "hcoll/api/hcoll_dte.h" #include "hcoll/api/hcoll_api.h" @@ -151,25 +151,13 @@ void hcoll_rte_fns_setup(void) { init_module_fns(); OBJ_CONSTRUCT(&mca_coll_hcoll_component.requests, opal_free_list_t); - opal_free_list_init( - &(mca_coll_hcoll_component.requests), - sizeof(ompi_request_t), - /* no special alignment needed */ - 8, - OBJ_CLASS(ompi_request_t), - /* no payload data */ - 0, 0, - /* NOTE: hack - need to parametrize this */ - 10, - -1, - 10, - /* No Mpool or init function */ - NULL, - 0, - NULL, - NULL, - NULL - ); + opal_free_list_init(&(mca_coll_hcoll_component.requests), + sizeof(ompi_coll_base_nbc_request_t), + opal_cache_line_size, OBJ_CLASS(ompi_coll_base_nbc_request_t), + /* no payload data */ + 0, 0, 10, -1, 10, + /* No Mpool or init function */ + NULL, 0, NULL, NULL, NULL); } static int recv_nb(struct dte_data_representation_t data, @@ -349,20 +337,23 @@ request_free(struct ompi_request_t **ompi_req) static void* get_coll_handle(void) { - ompi_request_t *ompi_req; + ompi_coll_base_nbc_request_t *ompi_req; opal_free_list_item_t *item; item = opal_free_list_wait (&(mca_coll_hcoll_component.requests)); if (OPAL_UNLIKELY(NULL == item)) { HCOL_ERROR("Wait for free list failed.\n"); return NULL; } - ompi_req = (ompi_request_t *)item; - OMPI_REQUEST_INIT(ompi_req,false); - ompi_req->req_complete_cb = NULL; - ompi_req->req_status.MPI_ERROR = MPI_SUCCESS; - ompi_req->req_state = OMPI_REQUEST_ACTIVE; - ompi_req->req_free = request_free; - ompi_req->req_type = OMPI_REQUEST_COLL; + ompi_req = (ompi_coll_base_nbc_request_t *)item; + OMPI_REQUEST_INIT(&ompi_req->super,false); + ompi_req->super.req_complete_cb = NULL; + ompi_req->super.req_complete_cb_data = NULL; + ompi_req->super.req_status.MPI_ERROR = MPI_SUCCESS; + ompi_req->super.req_state = OMPI_REQUEST_ACTIVE; + ompi_req->super.req_free = request_free; + ompi_req->super.req_type = OMPI_REQUEST_COLL; + ompi_req->data.objs.objs[0] = NULL; + ompi_req->data.objs.objs[1] = NULL; return (void *)ompi_req; } From 8b3fd5682ff6b54c71b6513a9ba74a537078faec Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 27 Aug 2019 11:55:03 -0700 Subject: [PATCH 416/674] Update OPAL DDT variable names These variables were renamed in 904276bb44caec207638247f23139bc21bc6a09e; update them to use the new names. Signed-off-by: Jeff Squyres (cherry picked from commit 2ab8109be15a7739caa72ec8f863e8e01c2c9a0f) --- test/datatype/position.c | 12 ++++++------ test/datatype/position_noncontig.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/datatype/position.c b/test/datatype/position.c index 07725816e43..0be4f77fd85 100644 --- a/test/datatype/position.c +++ b/test/datatype/position.c @@ -197,9 +197,9 @@ static void dump_ldi( ddt_ldi_t* buffer, int start_pos, int end_pos ) #endif #if (OPAL_ENABLE_DEBUG == 1) && (OPAL_C_HAVE_VISIBILITY == 0) -extern bool opal_unpack_debug; -extern bool opal_pack_debug; -extern bool opal_position_debug ; +extern bool opal_ddt_unpack_debug; +extern bool opal_ddt_pack_debug; +extern bool opal_ddt_position_debug ; #endif /* OPAL_ENABLE_DEBUG */ static char* bytes_dump( void* src, size_t cnt ) @@ -235,9 +235,9 @@ int main( int argc, char* argv[] ) ompi_datatype_init(); #if (OPAL_ENABLE_DEBUG == 1) && (OPAL_C_HAVE_VISIBILITY == 0) - opal_unpack_debug = false; - opal_pack_debug = false; - opal_position_debug = false; + opal_ddt_unpack_debug = false; + opal_ddt_pack_debug = false; + opal_ddt_position_debug = false; #endif /* OPAL_ENABLE_DEBUG */ create_segments( datatype, data_count, fragment_size, diff --git a/test/datatype/position_noncontig.c b/test/datatype/position_noncontig.c index 0fb94c224ab..7058c6d17ba 100644 --- a/test/datatype/position_noncontig.c +++ b/test/datatype/position_noncontig.c @@ -178,9 +178,9 @@ unpack_segments( ompi_datatype_t* datatype, int count, } #if (OPAL_ENABLE_DEBUG == 1) && (OPAL_C_HAVE_VISIBILITY == 0) -extern bool opal_unpack_debug; -extern bool opal_pack_debug; -extern bool opal_position_debug ; +extern bool opal_ddt_unpack_debug; +extern bool opal_ddt_pack_debug; +extern bool opal_ddt_position_debug ; #endif /* OPAL_ENABLE_DEBUG */ int main( int argc, char* argv[] ) @@ -206,9 +206,9 @@ int main( int argc, char* argv[] ) ompi_datatype_commit(&datatype); #if (OPAL_ENABLE_DEBUG == 1) && (OPAL_C_HAVE_VISIBILITY == 0) - opal_unpack_debug = false; - opal_pack_debug = false; - opal_position_debug = false; + opal_ddt_unpack_debug = false; + opal_ddt_pack_debug = false; + opal_ddt_position_debug = false; #endif /* OPAL_ENABLE_DEBUG */ create_segments( datatype, 1, fragment_size, From 8d130e1964e4278efaf3bc8bc56e101b29a6a790 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 27 Aug 2019 15:43:15 +0200 Subject: [PATCH 417/674] UCX osc: properly release exclusive lock to avoid lockup Signed-off-by: Joseph Schuchart (cherry picked from commit 08cb6389e034c1a70368671f745f20904c774a1e) --- ompi/mca/osc/ucx/osc_ucx_passive_target.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_passive_target.c b/ompi/mca/osc/ucx/osc_ucx_passive_target.c index 38a7dccb273..89920a29918 100644 --- a/ompi/mca/osc/ucx/osc_ucx_passive_target.c +++ b/ompi/mca/osc/ucx/osc_ucx_passive_target.c @@ -90,21 +90,19 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) { } static inline int end_exclusive(ompi_osc_ucx_module_t *module, int target) { - uint64_t result_value = 0; ucp_ep_h ep = OSC_UCX_GET_EP(module->comm, target); ucp_rkey_h rkey = (module->state_info_array)[target].rkey; uint64_t remote_addr = (module->state_info_array)[target].addr + OSC_UCX_STATE_LOCK_OFFSET; - int ret; + ucs_status_t status; - ret = opal_common_ucx_atomic_fetch(ep, UCP_ATOMIC_FETCH_OP_SWAP, TARGET_LOCK_UNLOCKED, - &result_value, sizeof(result_value), - remote_addr, rkey, mca_osc_ucx_component.ucp_worker); - if (OMPI_SUCCESS != ret) { - return ret; + status = ucp_atomic_post(ep, UCP_ATOMIC_POST_OP_ADD, + -((int64_t)TARGET_LOCK_EXCLUSIVE), sizeof(uint64_t), + remote_addr, rkey); + if (UCS_OK != status) { + OSC_UCX_VERBOSE(1, "ucp_atomic_post(OP_ADD) failed: %d", status); + return OMPI_ERROR; } - assert(result_value >= TARGET_LOCK_EXCLUSIVE); - return OMPI_SUCCESS; } From 4c1160e257c945d095c1985671b8a478fc45ca6a Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Thu, 29 Aug 2019 16:26:43 -0400 Subject: [PATCH 418/674] Fix tree spawn routed component issue * Fix #6618 - See comments on Issue #6618 for finer details. * The `plm/rsh` component uses the highest priority `routed` component to construct the launch tree. The remote orted's will activate all available `routed` components when updating routes. This allows the opportunity for the parent vpid on the remote `orted` to not match that which was expected in the tree launch. The result is that the remote orted tries to contact their parent with the wrong contact information and orted wireup will fail. * This fix forces the orteds to use the same `routed` component as the HNP used when contructing the tree, if tree launch is enabled. Signed-off-by: Joshua Hursey --- orte/mca/plm/rsh/plm_rsh_module.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/orte/mca/plm/rsh/plm_rsh_module.c b/orte/mca/plm/rsh/plm_rsh_module.c index 7e34de9ecfe..d022fe51c29 100644 --- a/orte/mca/plm/rsh/plm_rsh_module.c +++ b/orte/mca/plm/rsh/plm_rsh_module.c @@ -343,11 +343,12 @@ static int setup_launch(int *argcptr, char ***argvptr, char *orted_cmd, *orted_prefix, *final_cmd; int orted_index; int rc; - int i, j; + int i, j, cnt; bool found; char *lib_base=NULL, *bin_base=NULL; char *opal_prefix = getenv("OPAL_PREFIX"); char* full_orted_cmd = NULL; + char * rtmod; /* Figure out the basenames for the libdir and bindir. This requires some explanation: @@ -609,6 +610,18 @@ static int setup_launch(int *argcptr, char ***argvptr, (mca_plm_rsh_component.using_llspawn && mca_plm_rsh_component.daemonize_llspawn))) { } + if (!mca_plm_rsh_component.no_tree_spawn) { + // Remove problematic and/or conflicting command line arguments that + // should not be passed on to our children. + cnt = opal_argv_count(orted_cmd_line); + for (i=0; i < cnt; i+=3) { + if (0 == strcmp(orted_cmd_line[i+1], "routed")) { + opal_argv_delete(&cnt, &orted_cmd_line, i, 3); + break; + } + } + } + /* * Add the basic arguments to the orted command line, including * all debug options @@ -627,6 +640,16 @@ static int setup_launch(int *argcptr, char ***argvptr, if (!mca_plm_rsh_component.no_tree_spawn) { opal_argv_append(&argc, &argv, "--tree-spawn"); orte_oob_base_get_addr(¶m); + + // When tree-spawn'ing we need to force the remote daemons to use + // the routing component that was used to setup the launch tree. + // Otherwise the orte_parent_uri will not match the orted they + // expect to find in the routing tree. + rtmod = orte_rml.get_routed(orte_coll_conduit); + opal_argv_append(&argc, &argv, "-"OPAL_MCA_CMD_LINE_ID); + opal_argv_append(&argc, &argv, "routed"); + opal_argv_append(&argc, &argv, rtmod); + opal_argv_append(&argc, &argv, "-"OPAL_MCA_CMD_LINE_ID); opal_argv_append(&argc, &argv, "orte_parent_uri"); opal_argv_append(&argc, &argv, param); @@ -1187,6 +1210,10 @@ static void launch_daemons(int fd, short args, void *cbdata) OBJ_CONSTRUCT(&coll, opal_list_t); rtmod = orte_rml.get_routed(orte_coll_conduit); orte_routed.get_routing_list(rtmod, &coll); + + OPAL_OUTPUT_VERBOSE((1, orte_plm_base_framework.framework_output, + "%s plm:rsh:launch Tree Launch using routed/%s", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), rtmod)); } /* setup the launch */ From fbbacc1303f02b4c955975911b82e8755ea0721c Mon Sep 17 00:00:00 2001 From: Harumi Kuno Date: Tue, 30 Jul 2019 06:32:27 -0700 Subject: [PATCH 419/674] Fix mmap infinite recurse in memory patcher This commit fixes issue #6853 by removing MacOS/Darwin-specific logic from intercept_mmap. Signed-off-by: Harumi Kuno --- opal/mca/memory/patcher/configure.m4 | 4 ---- opal/mca/memory/patcher/memory_patcher_component.c | 5 ----- 2 files changed, 9 deletions(-) diff --git a/opal/mca/memory/patcher/configure.m4 b/opal/mca/memory/patcher/configure.m4 index 6881ec69366..0c5d8553259 100644 --- a/opal/mca/memory/patcher/configure.m4 +++ b/opal/mca/memory/patcher/configure.m4 @@ -40,10 +40,6 @@ AC_DEFUN([MCA_opal_memory_patcher_CONFIG],[ AC_CHECK_HEADERS([linux/mman.h sys/syscall.h]) - AC_CHECK_DECLS([__mmap], [], [], [#include ]) - - AC_CHECK_FUNCS([__mmap]) - AC_CHECK_DECLS([__syscall], [], [], [#include ]) AC_CHECK_FUNCS([__syscall]) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 5db3a6016f8..687d430fa36 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -125,12 +125,7 @@ static void *_intercept_mmap(void *start, size_t length, int prot, int flags, in } if (!original_mmap) { -#ifdef HAVE___MMAP - /* the darwin syscall returns an int not a long so call the underlying __mmap function */ - result = __mmap (start, length, prot, flags, fd, offset); -#else result = (void*)(intptr_t) memory_patcher_syscall(SYS_mmap, start, length, prot, flags, fd, offset); -#endif } else { result = original_mmap (start, length, prot, flags, fd, offset); } From 9bf1873215d318d1cb1b581def966125ff9c1b54 Mon Sep 17 00:00:00 2001 From: guserav Date: Tue, 9 Jul 2019 13:39:15 -0700 Subject: [PATCH 420/674] Fix osc sm posts when only 32 bit atomics support Signed-off-by: guserav (cherry picked from commit 3c9f4e682369e6fd5860b46ba81d79f2d1599a35) --- ompi/mca/osc/sm/osc_sm_active_target.c | 6 +++--- ompi/mca/osc/sm/osc_sm_component.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mca/osc/sm/osc_sm_active_target.c b/ompi/mca/osc/sm/osc_sm_active_target.c index ab0f73f87c6..e34389be6c7 100644 --- a/ompi/mca/osc/sm/osc_sm_active_target.c +++ b/ompi/mca/osc/sm/osc_sm_active_target.c @@ -151,7 +151,7 @@ ompi_osc_sm_start(struct ompi_group_t *group, for (int i = 0 ; i < size ; ++i) { int rank_byte = ranks[i] >> OSC_SM_POST_BITS; - osc_sm_post_type_t rank_bit = ((osc_sm_post_type_t) 1) << (ranks[i] & 0x3f); + osc_sm_post_type_t rank_bit = ((osc_sm_post_type_t) 1) << (ranks[i] & OSC_SM_POST_MASK); /* wait for rank to post */ while (!(module->posts[my_rank][rank_byte] & rank_bit)) { @@ -221,8 +221,8 @@ ompi_osc_sm_post(struct ompi_group_t *group, ompi_osc_sm_module_t *module = (ompi_osc_sm_module_t*) win->w_osc_module; int my_rank = ompi_comm_rank (module->comm); - int my_byte = my_rank >> 6; - uint64_t my_bit = ((uint64_t) 1) << (my_rank & 0x3f); + int my_byte = my_rank >> OSC_SM_POST_BITS; + osc_sm_post_type_t my_bit = ((osc_sm_post_type_t) 1) << (my_rank & OSC_SM_POST_MASK); int gsize; OPAL_THREAD_LOCK(&module->lock); diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index de891e71a11..0475e65266b 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -242,7 +242,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit int i, flag; size_t pagesize; size_t state_size; - size_t posts_size, post_size = (comm_size + 63) / 64; + size_t posts_size, post_size = (comm_size + OSC_SM_POST_MASK) / (OSC_SM_POST_MASK + 1); OPAL_OUTPUT_VERBOSE((1, ompi_osc_base_framework.framework_output, "allocating shared memory region of size %ld\n", (long) size)); From e2b154327e09e3aa0029463b6d20a90632ab680a Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 29 Aug 2019 18:04:46 -0400 Subject: [PATCH 421/674] Small optimization on the datatype commit. This patch fixes the merge of contiguous elements into larger but more compact datatypes, and allows for contiguous elements to have thir blocklen increasing instead of the count. The idea is to always maximize the blocklen, aka. the contiguous part of the datatype. Signed-off-by: George Bosilca (cherry picked from commit 41e6f55807b01ad5c04e8387a3699cf743931f6a) --- opal/datatype/opal_datatype_optimize.c | 26 ++++++++++++++++---------- opal/datatype/opal_datatype_pack.c | 1 + 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/opal/datatype/opal_datatype_optimize.c b/opal/datatype/opal_datatype_optimize.c index 336e11f0560..2e661b95daa 100644 --- a/opal/datatype/opal_datatype_optimize.c +++ b/opal/datatype/opal_datatype_optimize.c @@ -163,6 +163,12 @@ opal_datatype_optimize_short( opal_datatype_t* pData, if( 0 == last.count ) { /* first data of the datatype */ last = *current; continue; /* next data */ + } else { /* can we merge it in order to decrease count */ + if( (ptrdiff_t)last.blocklen * (ptrdiff_t)opal_datatype_basicDatatypes[last.common.type]->size == last.extent ) { + last.extent *= last.count; + last.blocklen *= last.count; + last.count = 1; + } } /* are the two elements compatible: aka they have very similar values and they @@ -176,27 +182,27 @@ opal_datatype_optimize_short( opal_datatype_t* pData, last.common.type = OPAL_DATATYPE_UINT1; } - if( 1 == last.count ) { - /* we can ignore the extent of the element with count == 1 and merge them together if their displacements match */ + if( (last.extent * (ptrdiff_t)last.count + last.disp) == current->disp ) { if( 1 == current->count ) { - last.extent = current->disp - last.disp; last.count++; continue; } - /* can we compute a matching displacement ? */ - if( (last.disp + current->extent) == current->disp ) { - last.extent = current->extent; - last.count = current->count + 1; + if( last.extent == current->extent ) { + last.count += current->count; continue; } } - if( (last.extent * (ptrdiff_t)last.count + last.disp) == current->disp ) { + if( 1 == last.count ) { + /* we can ignore the extent of the element with count == 1 and merge them together if their displacements match */ if( 1 == current->count ) { + last.extent = current->disp - last.disp; last.count++; continue; } - if( last.extent == current->extent ) { - last.count += current->count; + /* can we compute a matching displacement ? */ + if( (last.disp + current->extent) == current->disp ) { + last.extent = current->extent; + last.count = current->count + last.count; continue; } } diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index f21adcccb34..6dc0b81a253 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -121,6 +121,7 @@ opal_pack_homogeneous_contig_with_gaps_function( opal_convertor_t* pConv, * how much we should jump between elements. */ assert( (pData->flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && ((ptrdiff_t)pData->size != extent) ); + assert( pData->opt_desc.used <= 1 ); DO_DEBUG( opal_output( 0, "pack_homogeneous_contig( pBaseBuf %p, iov_count %d )\n", (void*)pConv->pBaseBuf, *out_size ); ); if( stack[1].type != opal_datatype_uint1.id ) { From 8f16780ee023d25055d04300d3b16f3f1c9d808a Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Fri, 30 Aug 2019 19:55:41 -0400 Subject: [PATCH 422/674] Add a test for datatypes composed by multiple predefined elements that can be merged into a larger UINT1 type. Signed-off-by: George Bosilca (cherry picked from commit 82d632278ae5ab4337984d5ef4793f818c4dd437) --- test/datatype/to_self.c | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/test/datatype/to_self.c b/test/datatype/to_self.c index 073fe4f0b57..2ba3eb92163 100644 --- a/test/datatype/to_self.c +++ b/test/datatype/to_self.c @@ -24,6 +24,26 @@ extern void ompi_datatype_dump( MPI_Datatype ddt ); #define MPI_DDT_DUMP(ddt) #endif /* OPEN_MPI */ +static MPI_Datatype +create_merged_contig_with_gaps(int count) /* count of the basic datatype */ +{ + int array_of_blocklengths[] = {1, 1, 1}; + MPI_Aint array_of_displacements[] = {0, 8, 16}; + MPI_Datatype array_of_types[] = {MPI_DOUBLE, MPI_LONG, MPI_CHAR}; + MPI_Datatype type; + + MPI_Type_create_struct(3, array_of_blocklengths, + array_of_displacements, array_of_types, + &type); + if( 1 < count ) { + MPI_Datatype temp = type; + MPI_Type_contiguous(count, temp, &type); + } + MPI_Type_commit(&type); + MPI_DDT_DUMP( type ); + return type; +} + /* Create a non-contiguous resized datatype */ struct structure { double not_transfered; @@ -183,11 +203,12 @@ create_indexed_gap_optimized_ddt( void ) /******************************************************************** *******************************************************************/ -#define DO_CONTIG 0x00000001 -#define DO_CONSTANT_GAP 0x00000002 -#define DO_INDEXED_GAP 0x00000004 -#define DO_OPTIMIZED_INDEXED_GAP 0x00000008 -#define DO_STRUCT_CONSTANT_GAP_RESIZED 0x00000010 +#define DO_CONTIG 0x00000001 +#define DO_CONSTANT_GAP 0x00000002 +#define DO_INDEXED_GAP 0x00000004 +#define DO_OPTIMIZED_INDEXED_GAP 0x00000008 +#define DO_STRUCT_CONSTANT_GAP_RESIZED 0x00000010 +#define DO_STRUCT_MERGED_WITH_GAP_RESIZED 0x00000020 #define DO_PACK 0x01000000 #define DO_UNPACK 0x02000000 @@ -483,7 +504,7 @@ static int do_test_for_ddt( int doop, MPI_Datatype sddt, MPI_Datatype rddt, int int main( int argc, char* argv[] ) { - int run_tests = 0xffff; /* do all datatype tests by default */ + int run_tests = DO_STRUCT_MERGED_WITH_GAP_RESIZED; /* do all datatype tests by default */ int rank, size; MPI_Datatype ddt; @@ -544,6 +565,14 @@ int main( int argc, char* argv[] ) MPI_Type_free( &ddt ); } + if( run_tests & DO_STRUCT_MERGED_WITH_GAP_RESIZED ) { + printf( "\nstruct constant gap resized\n\n" ); + ddt = create_merged_contig_with_gaps( 1 ); + MPI_DDT_DUMP( ddt ); + do_test_for_ddt( run_tests, ddt, ddt, MAX_LENGTH ); + MPI_Type_free( &ddt ); + } + MPI_Finalize (); exit(0); } From 95cc53e331b13477749802a853b44794b1050d03 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Fri, 6 Sep 2019 08:27:05 -0700 Subject: [PATCH 423/674] Be a little less restrictive on interface requirements If both types of interfaces are enabled, don't error out if one of them isn't able to open listener sockets. Only one interface family may be available on some machines, but someone might want to build the code to run more generally. Refs https://github.com/pmix/prrte/pull/249 Signed-off-by: Ralph Castain (cherry picked from commit 06d188ebf3646760f50d4513361b50642af9cec4) --- orte/mca/oob/tcp/help-oob-tcp.txt | 6 +++++- orte/mca/oob/tcp/oob_tcp_listener.c | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/orte/mca/oob/tcp/help-oob-tcp.txt b/orte/mca/oob/tcp/help-oob-tcp.txt index e5562ac4708..8af0589032f 100644 --- a/orte/mca/oob/tcp/help-oob-tcp.txt +++ b/orte/mca/oob/tcp/help-oob-tcp.txt @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2014-2017 Intel, Inc. All rights reserved. +# Copyright (c) 2014-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015-2018 Cisco Systems, Inc. All rights reserved # $COPYRIGHT$ # @@ -132,3 +132,7 @@ up aborting your job. Peer host: %s Peer process name: %s Peer Open MPI version: %s +# +[no-listeners] +No sockets were able to be opened on the available protocols +(IPv4 and/or IPv6). Please check your network and retry. diff --git a/orte/mca/oob/tcp/oob_tcp_listener.c b/orte/mca/oob/tcp/oob_tcp_listener.c index e97103c07f1..d34d1a2b18b 100644 --- a/orte/mca/oob/tcp/oob_tcp_listener.c +++ b/orte/mca/oob/tcp/oob_tcp_listener.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -98,7 +98,7 @@ static void connection_event_handler(int sd, short flags, void* cbdata); */ int orte_oob_tcp_start_listening(void) { - int rc; + int rc = ORTE_SUCCESS, rc2 = ORTE_SUCCESS; mca_oob_tcp_listener_t *listener; /* if we don't have any TCP interfaces, we shouldn't be here */ @@ -112,19 +112,19 @@ int orte_oob_tcp_start_listening(void) } /* create listen socket(s) for incoming connection attempts */ - if (ORTE_SUCCESS != (rc = create_listen())) { - ORTE_ERROR_LOG(rc); - return rc; - } + rc = create_listen(); #if OPAL_ENABLE_IPV6 /* create listen socket(s) for incoming connection attempts */ - if (ORTE_SUCCESS != (rc = create_listen6())) { - ORTE_ERROR_LOG(rc); - return rc; - } + rc2 = create_listen6(); #endif + if (ORTE_SUCCESS != rc && ORTE_SUCCESS != rc2) { + /* we were unable to open any listening sockets */ + opal_show_help("help-oob-tcp.txt", "no-listeners", true); + return ORTE_ERR_FATAL; + } + /* if I am the HNP, start a listening thread so we can * harvest connection requests as rapidly as possible */ From 49a2558eff9a14327398097543f1b47d59d7ccde Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 9 Sep 2019 14:48:52 -0400 Subject: [PATCH 424/674] Reving VERSION to v4.0.2rc2 Reving VERSION to v4.0.2rc2 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1b15d265b58..b4422111a08 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=2 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc1 +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 5a945f668c81fbbc34091c2269e8d3d5338488f7 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 5 Sep 2019 23:05:55 -0700 Subject: [PATCH 425/674] btl/vader: when using single-copy emulation fragment large rdma This commit changes how the single-copy emulation in the vader btl operates. Before this change the BTL set its put and get limits based on the max send size. After this change the limits are unset and the put or get operation is fragmented internally. References #6568 Signed-off-by: Nathan Hjelm (cherry picked from commit ae91b11de2314ab11a9842d9738cd14f8f1e393b) --- opal/mca/btl/vader/btl_vader_atomic.c | 83 +++--------------------- opal/mca/btl/vader/btl_vader_component.c | 7 +- opal/mca/btl/vader/btl_vader_frag.h | 82 ++++++++++++++++++++--- opal/mca/btl/vader/btl_vader_get.c | 39 +---------- opal/mca/btl/vader/btl_vader_put.c | 36 +--------- 5 files changed, 90 insertions(+), 157 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_atomic.c b/opal/mca/btl/vader/btl_vader_atomic.c index df3c2664be8..1bf54430df2 100644 --- a/opal/mca/btl/vader/btl_vader_atomic.c +++ b/opal/mca/btl/vader/btl_vader_atomic.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2010-2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,58 +17,14 @@ #include "btl_vader_endpoint.h" #include "btl_vader_xpmem.h" -static void mca_btl_vader_sc_emu_aop_complete (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, - mca_btl_base_descriptor_t *desc, int status) -{ - mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) desc; - void *local_address = frag->rdma.local_address; - void *context = frag->rdma.context; - void *cbdata = frag->rdma.cbdata; - mca_btl_base_rdma_completion_fn_t cbfunc = frag->rdma.cbfunc; - - /* return the fragment first since the callback may call put/get/amo and could use this fragment */ - MCA_BTL_VADER_FRAG_RETURN(frag); - - cbfunc (btl, endpoint, local_address, NULL, context, cbdata, status); -} - int mca_btl_vader_emu_aop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_vader_frag_t *frag; - - frag = mca_btl_vader_rdma_frag_alloc (btl, endpoint, MCA_BTL_VADER_OP_ATOMIC, operand, 0, op, 0, order, flags, NULL, - remote_address, cbfunc, cbcontext, cbdata, mca_btl_vader_sc_emu_aop_complete); - if (OPAL_UNLIKELY(NULL == frag)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - /* send is always successful */ - (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); - - return OPAL_SUCCESS; -} - -static void mca_btl_vader_sc_emu_afop_complete (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, - mca_btl_base_descriptor_t *desc, int status) -{ - mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) desc; - mca_btl_vader_sc_emu_hdr_t *hdr; - void *local_address = frag->rdma.local_address; - void *context = frag->rdma.context; - void *cbdata = frag->rdma.cbdata; - mca_btl_base_rdma_completion_fn_t cbfunc = frag->rdma.cbfunc; - - hdr = (mca_btl_vader_sc_emu_hdr_t *) frag->segments[0].seg_addr.pval; - - *((int64_t *) frag->rdma.local_address) = hdr->operand[0]; - - /* return the fragment first since the callback may call put/get/amo and could use this fragment */ - MCA_BTL_VADER_FRAG_RETURN(frag); - - cbfunc (btl, endpoint, local_address, NULL, context, cbdata, status); + size_t size = (flags & MCA_BTL_ATOMIC_FLAG_32BIT) ? 4 : 8; + return mca_btl_vader_rdma_frag_start (btl, endpoint, MCA_BTL_VADER_OP_ATOMIC, operand, 0, op, order, flags, + size, NULL, remote_address, cbfunc, cbcontext, cbdata); } int mca_btl_vader_emu_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, @@ -76,19 +33,9 @@ int mca_btl_vader_emu_afop (struct mca_btl_base_module_t *btl, struct mca_btl_ba uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_vader_frag_t *frag; - - frag = mca_btl_vader_rdma_frag_alloc (btl, endpoint, MCA_BTL_VADER_OP_ATOMIC, operand, 0, op, 0, order, flags, - local_address, remote_address, cbfunc, cbcontext, cbdata, - mca_btl_vader_sc_emu_afop_complete); - if (OPAL_UNLIKELY(NULL == frag)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - /* send is always successful */ - (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); - - return OPAL_SUCCESS; + size_t size = (flags & MCA_BTL_ATOMIC_FLAG_32BIT) ? 4 : 8; + return mca_btl_vader_rdma_frag_start (btl, endpoint, MCA_BTL_VADER_OP_ATOMIC, operand, 0, op, order, flags, + size, local_address, remote_address, cbfunc, cbcontext, cbdata); } int mca_btl_vader_emu_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, @@ -96,17 +43,7 @@ int mca_btl_vader_emu_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_ mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_vader_frag_t *frag; - - frag = mca_btl_vader_rdma_frag_alloc (btl, endpoint, MCA_BTL_VADER_OP_CSWAP, compare, value, 0, 0, order, - flags, local_address, remote_address, cbfunc, cbcontext, cbdata, - mca_btl_vader_sc_emu_afop_complete); - if (OPAL_UNLIKELY(NULL == frag)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - /* send is always successful */ - (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); - - return OPAL_SUCCESS; + size_t size = (flags & MCA_BTL_ATOMIC_FLAG_32BIT) ? 4 : 8; + return mca_btl_vader_rdma_frag_start (btl, endpoint, MCA_BTL_VADER_OP_CSWAP, compare, value, 0, order, + flags, size, local_address, remote_address, cbfunc, cbcontext, cbdata); } diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 5a163f637ab..98ac462b71e 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -21,6 +21,7 @@ * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -477,12 +478,6 @@ static void mca_btl_vader_check_single_copy (void) mca_btl_vader.super.btl_get = NULL; mca_btl_vader.super.btl_put = NULL; } - - if (MCA_BTL_VADER_EMUL == mca_btl_vader_component.single_copy_mechanism) { - /* limit to the maximum fragment size */ - mca_btl_vader.super.btl_put_limit = mca_btl_vader.super.btl_max_send_size - sizeof (mca_btl_vader_sc_emu_hdr_t); - mca_btl_vader.super.btl_get_limit = mca_btl_vader.super.btl_max_send_size - sizeof (mca_btl_vader_sc_emu_hdr_t); - } } /* diff --git a/opal/mca/btl/vader/btl_vader_frag.h b/opal/mca/btl/vader/btl_vader_frag.h index d3ce21dae3c..2de26914818 100644 --- a/opal/mca/btl/vader/btl_vader_frag.h +++ b/opal/mca/btl/vader/btl_vader_frag.h @@ -14,6 +14,7 @@ * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -91,9 +92,12 @@ struct mca_btl_vader_frag_t { /** rdma callback data */ struct mca_btl_vader_rdma_cbdata_t { void *local_address; + uint64_t remote_address; mca_btl_base_rdma_completion_fn_t cbfunc; void *context; void *cbdata; + size_t remaining; + size_t sent; } rdma; }; @@ -151,28 +155,87 @@ static inline void mca_btl_vader_frag_complete (mca_btl_vader_frag_t *frag) { int mca_btl_vader_frag_init (opal_free_list_item_t *item, void *ctx); -static inline mca_btl_vader_frag_t * -mca_btl_vader_rdma_frag_alloc (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, int type, +static inline void mca_btl_vader_rdma_frag_advance (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, + mca_btl_vader_frag_t *frag, int status) +{ + mca_btl_vader_sc_emu_hdr_t *hdr = (mca_btl_vader_sc_emu_hdr_t *) frag->segments[0].seg_addr.pval; + mca_btl_base_rdma_completion_fn_t cbfunc = frag->rdma.cbfunc; + size_t hdr_size = sizeof (*hdr); + size_t len = frag->rdma.sent ? frag->segments[0].seg_len - hdr_size : 0; + void *context = frag->rdma.context; + void *cbdata = frag->rdma.cbdata; + void *data = (void *) (hdr + 1); + + if (frag->rdma.sent) { + if (MCA_BTL_VADER_OP_GET == hdr->type) { + memcpy (frag->rdma.local_address, data, len); + } else if ((MCA_BTL_VADER_OP_ATOMIC == hdr->type || MCA_BTL_VADER_OP_CSWAP == hdr->type) && + frag->rdma.local_address) { + if (8 == len) { + *((int64_t *) frag->rdma.local_address) = hdr->operand[0]; + } else { + *((int32_t *) frag->rdma.local_address) = (int32_t) hdr->operand[0]; + } + } + } + + if (frag->rdma.remaining) { + size_t packet_size = (frag->rdma.remaining + hdr_size) <= mca_btl_vader.super.btl_max_send_size ? + frag->rdma.remaining : mca_btl_vader.super.btl_max_send_size - hdr_size; + + /* advance the local and remote pointers */ + frag->rdma.local_address = (void *)((uintptr_t) frag->rdma.local_address + len); + frag->rdma.remote_address += len; + + if (MCA_BTL_VADER_OP_PUT == hdr->type) { + /* copy the next block into the fragment buffer */ + memcpy ((void *) (hdr + 1), frag->rdma.local_address, packet_size); + } + + hdr->addr = frag->rdma.remote_address; + /* clear out the complete flag before sending the fragment again */ + frag->hdr->flags &= ~MCA_BTL_VADER_FLAG_COMPLETE; + frag->segments[0].seg_len = packet_size + sizeof (*hdr); + frag->rdma.sent += packet_size; + frag->rdma.remaining -= packet_size; + + /* send is always successful */ + (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); + return; + } + + /* return the fragment before calling the callback */ + MCA_BTL_VADER_FRAG_RETURN(frag); + cbfunc (btl, endpoint, (void *)((uintptr_t) frag->rdma.local_address - frag->rdma.sent), NULL, + context, cbdata, status); +} + +static inline int +mca_btl_vader_rdma_frag_start (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, int type, uint64_t operand1, uint64_t operand2, mca_btl_base_atomic_op_t op, int order, int flags, size_t size, void *local_address, int64_t remote_address, - mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, - void *cbdata, mca_btl_base_completion_fn_t des_cbfunc) + mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { mca_btl_vader_sc_emu_hdr_t *hdr; - size_t total_size = size + sizeof (*hdr); + size_t hdr_size = sizeof (*hdr); + size_t packet_size = (size + hdr_size) <= mca_btl_vader.super.btl_max_send_size ? size : + mca_btl_vader.super.btl_max_send_size - hdr_size; mca_btl_vader_frag_t *frag; - frag = (mca_btl_vader_frag_t *) mca_btl_vader_alloc (btl, endpoint, order, total_size, + frag = (mca_btl_vader_frag_t *) mca_btl_vader_alloc (btl, endpoint, order, packet_size + hdr_size, MCA_BTL_DES_SEND_ALWAYS_CALLBACK); if (OPAL_UNLIKELY(NULL == frag)) { - return NULL; + return OPAL_ERR_OUT_OF_RESOURCE; } - frag->base.des_cbfunc = des_cbfunc; + frag->base.des_cbfunc = (mca_btl_base_completion_fn_t) mca_btl_vader_rdma_frag_advance; frag->rdma.local_address = local_address; + frag->rdma.remote_address = remote_address; frag->rdma.cbfunc = cbfunc; frag->rdma.context = cbcontext; frag->rdma.cbdata = cbdata; + frag->rdma.remaining = size; + frag->rdma.sent = 0; hdr = (mca_btl_vader_sc_emu_hdr_t *) frag->segments[0].seg_addr.pval; @@ -183,7 +246,8 @@ mca_btl_vader_rdma_frag_alloc (mca_btl_base_module_t *btl, mca_btl_base_endpoint hdr->operand[0] = operand1; hdr->operand[1] = operand2; - return frag; + mca_btl_vader_rdma_frag_advance (btl, endpoint, frag, OPAL_SUCCESS); + return OPAL_SUCCESS; } #endif /* MCA_BTL_VADER_SEND_FRAG_H */ diff --git a/opal/mca/btl/vader/btl_vader_get.c b/opal/mca/btl/vader/btl_vader_get.c index db4b678ef19..a71203f1ad9 100644 --- a/opal/mca/btl/vader/btl_vader_get.c +++ b/opal/mca/btl/vader/btl_vader_get.c @@ -4,6 +4,7 @@ * reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -156,49 +157,15 @@ int mca_btl_vader_get_knem (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t } #endif -static void mca_btl_vader_sc_emu_get_complete (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, - mca_btl_base_descriptor_t *desc, int status) -{ - mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) desc; - mca_btl_vader_sc_emu_hdr_t *hdr; - void *local_address = frag->rdma.local_address; - size_t len = frag->segments[0].seg_len - sizeof (*hdr); - void *context = frag->rdma.context; - void *cbdata = frag->rdma.cbdata; - mca_btl_base_rdma_completion_fn_t cbfunc = frag->rdma.cbfunc; - void *data; - - hdr = (mca_btl_vader_sc_emu_hdr_t *) frag->segments[0].seg_addr.pval; - data = (void *) (hdr + 1); - - memcpy (local_address, data, len); - - /* return the fragment before calling the callback */ - MCA_BTL_VADER_FRAG_RETURN(frag); - - cbfunc (btl, endpoint, local_address, NULL, context, cbdata, status); -} - int mca_btl_vader_get_sc_emu (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_vader_frag_t *frag; - if (size > mca_btl_vader.super.btl_get_limit) { return OPAL_ERR_NOT_AVAILABLE; } - frag = mca_btl_vader_rdma_frag_alloc (btl, endpoint, MCA_BTL_VADER_OP_GET, 0, 0, 0, order, flags, size, - local_address, remote_address, cbfunc, cbcontext, cbdata, - mca_btl_vader_sc_emu_get_complete); - if (OPAL_UNLIKELY(NULL == frag)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - /* send is always successful */ - (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); - - return OPAL_SUCCESS; + return mca_btl_vader_rdma_frag_start (btl, endpoint, MCA_BTL_VADER_OP_GET, 0, 0, 0, order, flags, size, + local_address, remote_address, cbfunc, cbcontext, cbdata); } diff --git a/opal/mca/btl/vader/btl_vader_put.c b/opal/mca/btl/vader/btl_vader_put.c index 0224d2fe193..8e47a70332c 100644 --- a/opal/mca/btl/vader/btl_vader_put.c +++ b/opal/mca/btl/vader/btl_vader_put.c @@ -4,6 +4,7 @@ * reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -135,21 +136,6 @@ int mca_btl_vader_put_knem (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t } #endif -static void mca_btl_vader_sc_emu_put_complete (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, - mca_btl_base_descriptor_t *desc, int status) -{ - mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) desc; - void *local_address = frag->rdma.local_address; - void *context = frag->rdma.context; - void *cbdata = frag->rdma.cbdata; - mca_btl_base_rdma_completion_fn_t cbfunc = frag->rdma.cbfunc; - - /* return the fragment first since the callback may call put/get/amo and could use this fragment */ - MCA_BTL_VADER_FRAG_RETURN(frag); - - cbfunc (btl, endpoint, local_address, NULL, context, cbdata, status); -} - /** * @brief Provides an emulated put path which uses copy-in copy-out with shared memory buffers */ @@ -158,26 +144,10 @@ int mca_btl_vader_put_sc_emu (mca_btl_base_module_t *btl, mca_btl_base_endpoint_ mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) { - mca_btl_vader_sc_emu_hdr_t *hdr; - mca_btl_vader_frag_t *frag; - if (size > mca_btl_vader.super.btl_put_limit) { return OPAL_ERR_NOT_AVAILABLE; } - frag = mca_btl_vader_rdma_frag_alloc (btl, endpoint, MCA_BTL_VADER_OP_PUT, 0, 0, 0, order, flags, size, - local_address, remote_address, cbfunc, cbcontext, cbdata, - mca_btl_vader_sc_emu_put_complete); - if (OPAL_UNLIKELY(NULL == frag)) { - return OPAL_ERR_OUT_OF_RESOURCE; - } - - hdr = (mca_btl_vader_sc_emu_hdr_t *) frag->segments[0].seg_addr.pval; - - memcpy ((void *) (hdr + 1), local_address, size); - - /* send is always successful */ - (void) mca_btl_vader_send (btl, endpoint, &frag->base, MCA_BTL_TAG_VADER); - - return OPAL_SUCCESS; + return mca_btl_vader_rdma_frag_start (btl, endpoint, MCA_BTL_VADER_OP_PUT, 0, 0, 0, order, flags, size, + local_address, remote_address, cbfunc, cbcontext, cbdata); } From 3eb7b27d3a1998d645df7f8e5ec88baaf182ece5 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Tue, 17 Sep 2019 14:45:51 -0400 Subject: [PATCH 426/674] Conform MPIR_Breakpoint to MPIR standard. - Fix MPIR_Breakpoint standard violation by returning void instead of a void*. Signed-off-by: Austen Lauria (cherry picked from commit 067adfa417f95396c713f6e6597619fac94f0048) --- orte/orted/orted_submit.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index 33eddc5818d..dd6fdc7ce85 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -173,7 +173,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0}; int MPIR_force_to_main = 0; static void orte_debugger_init_before_spawn(orte_job_t *jdata); -ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void); +ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint(void); /* * Attempt to prevent the compiler from optimizing out @@ -191,14 +191,26 @@ ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void); * See the following git issue for more discussion: * https://github.com/open-mpi/ompi/issues/5501 */ -static volatile void* volatile noop_mpir_breakpoint_ptr = NULL; +volatile void* volatile noop_mpir_breakpoint_ptr = NULL; /* * Breakpoint function for parallel debuggers */ -void* MPIR_Breakpoint(void) +void MPIR_Breakpoint(void) { - return noop_mpir_breakpoint_ptr; + /* + * Actually do something with this pointer to make + * sure the compiler does not optimize out this function. + * The compiler should be forced to keep this + * function around due to the volatile void* type. + * + * This pointer doesn't actually do anything other than + * prevent unwanted optimization, and + * *should not* be used anywhere else in the code. + * So pointing this to the weeds should be OK. + */ + noop_mpir_breakpoint_ptr = (volatile void *) 0x42; + return; } /* local objects */ From 1430df3c0fc906a97200d455265b422c259fb438 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Wed, 18 Sep 2019 17:44:40 -0400 Subject: [PATCH 427/674] Add 'orte_' prefix to noop_mpir_breakpoint_ptr. Signed-off-by: Austen Lauria (cherry picked from commit 77144689f062f38d2edc9086e3fbb99c3d855f9a) --- orte/orted/orted_submit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index dd6fdc7ce85..0db2703e46d 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -191,7 +191,7 @@ ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint(void); * See the following git issue for more discussion: * https://github.com/open-mpi/ompi/issues/5501 */ -volatile void* volatile noop_mpir_breakpoint_ptr = NULL; +volatile void* volatile orte_noop_mpir_breakpoint_ptr = NULL; /* * Breakpoint function for parallel debuggers @@ -209,7 +209,7 @@ void MPIR_Breakpoint(void) * *should not* be used anywhere else in the code. * So pointing this to the weeds should be OK. */ - noop_mpir_breakpoint_ptr = (volatile void *) 0x42; + orte_noop_mpir_breakpoint_ptr = (volatile void *) 0x42; return; } From 0bb0e59345ed9318ef5b3fa066d27e620c6578d2 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 19 Sep 2019 14:21:04 -0500 Subject: [PATCH 428/674] Updating VERSION to v4.0.2rc3. Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index b4422111a08..ce7c45397b2 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=2 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc2 +greek=rc3 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From e5be033c14dcb0e38504b04db32164db05660e4e Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Mon, 12 Nov 2018 15:56:37 +0900 Subject: [PATCH 429/674] ess/pmi: Fix `--enable-timing` compilation error This commit fixes an compilation error when configured with `--enable-timing`. Procedures in the function `orte_ess_base_app_setup` in `orte/mca/ess/base/ess_base_std_app.c` are moved to `orte/mca/ess/pmi/ess_pmi_module.c` and `orte/mca/ess/singleton/ess_singleton_module.c` in the recent commit 57f6b94fa5. In `ess_pmi_module.c`, the first argument of the `OPAL_TIMING_ENV_NEXT` macro should have been adapted to the destination function but was not. In `ess_singleton_module.c`, `OPAL_TIMING_ENV_INIT` was not used in the destination function originally. So `OPAL_TIMING_ENV_NEXT` cannot be used in the function. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit 8e7d874e14a5485dceff836419e36b6b24a66f48) --- orte/mca/ess/pmi/ess_pmi_module.c | 9 +++++---- orte/mca/ess/singleton/ess_singleton_module.c | 6 ------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/orte/mca/ess/pmi/ess_pmi_module.c b/orte/mca/ess/pmi/ess_pmi_module.c index 39518749ab1..45d75f56161 100644 --- a/orte/mca/ess/pmi/ess_pmi_module.c +++ b/orte/mca/ess/pmi/ess_pmi_module.c @@ -17,6 +17,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -464,7 +465,7 @@ static int rte_init(void) error = "orte_state_base_select"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "state_framework_open"); + OPAL_TIMING_ENV_NEXT(rte_init, "state_framework_open"); /* open the errmgr */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_errmgr_base_framework, 0))) { @@ -472,7 +473,7 @@ static int rte_init(void) error = "orte_errmgr_base_open"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_framework_open"); + OPAL_TIMING_ENV_NEXT(rte_init, "errmgr_framework_open"); /* setup my session directory */ if (orte_create_session_dirs) { @@ -508,7 +509,7 @@ static int rte_init(void) } } } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "create_session_dirs"); + OPAL_TIMING_ENV_NEXT(rte_init, "create_session_dirs"); /* if we have info on the HNP and local daemon, process it */ if (NULL != orte_process_info.my_hnp_uri) { @@ -560,7 +561,7 @@ static int rte_init(void) error = "orte_errmgr_base_select"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_select"); + OPAL_TIMING_ENV_NEXT(rte_init, "errmgr_select"); /* setup process binding */ if (ORTE_SUCCESS != (ret = orte_ess_base_proc_binding())) { diff --git a/orte/mca/ess/singleton/ess_singleton_module.c b/orte/mca/ess/singleton/ess_singleton_module.c index c35909484b8..da9321b08ed 100644 --- a/orte/mca/ess/singleton/ess_singleton_module.c +++ b/orte/mca/ess/singleton/ess_singleton_module.c @@ -321,7 +321,6 @@ static int rte_init(void) error = "orte_state_base_select"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "state_framework_open"); /* open the errmgr */ if (ORTE_SUCCESS != (ret = mca_base_framework_open(&orte_errmgr_base_framework, 0))) { @@ -329,7 +328,6 @@ static int rte_init(void) error = "orte_errmgr_base_open"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_framework_open"); /* setup my session directory */ if (orte_create_session_dirs) { @@ -365,7 +363,6 @@ static int rte_init(void) } } } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "create_session_dirs"); /* if we have info on the HNP and local daemon, process it */ if (NULL != orte_process_info.my_hnp_uri) { @@ -417,14 +414,12 @@ static int rte_init(void) error = "orte_errmgr_base_select"; goto error; } - OPAL_TIMING_ENV_NEXT(ess_base_setup, "errmgr_select"); /* setup process binding */ if (ORTE_SUCCESS != (ret = orte_ess_base_proc_binding())) { error = "proc_binding"; goto error; } - OPAL_TIMING_ENV_NEXT(rte_init, "ess_base_proc_binding"); /* this needs to be set to enable debugger use when direct launched */ if (NULL == orte_process_info.my_daemon_uri) { @@ -463,7 +458,6 @@ static int rte_init(void) goto error; } } - OPAL_TIMING_ENV_NEXT(rte_init, "rte_init_done"); return ORTE_SUCCESS; From 674655c641e3b55f49ec6d2236d50db43a1947c7 Mon Sep 17 00:00:00 2001 From: Adrian Reber Date: Thu, 25 Jul 2019 12:32:33 +0200 Subject: [PATCH 430/674] Do not use CMA in user namespaces Trying out to run processes via mpirun in Podman containers has shown that the CMA btl_vader_single_copy_mechanism does not work when user namespaces are involved. Creating containers with Podman requires at least user namespaces to be able to do unprivileged mounts in a container Even if running the container with user namespace user ID mappings which result in the same user ID on the inside and outside of all involved containers, the check in the kernel to allow ptrace (and thus process_vm_{read,write}v()), fails if the same IDs are not in the same user namespace. One workaround is to specify '--mca btl_vader_single_copy_mechanism none' and this commit adds code to automatically skip CMA if user namespaces are detected and fall back to MCA_BTL_VADER_EMUL. Signed-off-by: Adrian Reber (cherry picked from commit fc68d8a90fe86284e9dc730f878b55c0412f01d2) --- opal/mca/btl/vader/btl_vader.h | 9 +++- opal/mca/btl/vader/btl_vader_component.c | 35 +++++++++++- opal/mca/btl/vader/btl_vader_module.c | 69 +++++++++++++++++++++++- opal/mca/btl/vader/help-btl-vader.txt | 19 +++++++ 4 files changed, 127 insertions(+), 5 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader.h b/opal/mca/btl/vader/btl_vader.h index 028c7a38167..eab5f5a87d3 100644 --- a/opal/mca/btl/vader/btl_vader.h +++ b/opal/mca/btl/vader/btl_vader.h @@ -84,7 +84,12 @@ union vader_modex_t { void *segment_base; } xpmem; #endif - opal_shmem_ds_t seg_ds; + struct vader_modex_other_t { + ino_t user_ns_id; + int seg_ds_size; + /* seg_ds needs to be the last element */ + opal_shmem_ds_t seg_ds; + } other; }; /** @@ -270,6 +275,8 @@ int mca_btl_vader_get_knem (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); #endif +ino_t mca_btl_vader_get_user_ns_id(void); + int mca_btl_vader_get_sc_emu (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 98ac462b71e..44de7e004c2 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -41,6 +41,10 @@ #include "btl_vader_fbox.h" #include "btl_vader_xpmem.h" +#ifdef HAVE_SYS_STAT_H +#include +#endif + #include #include @@ -350,6 +354,25 @@ static int mca_btl_vader_component_close(void) return OPAL_SUCCESS; } +/* + * mca_btl_vader_parse_proc_ns_user() tries to get the user namespace ID + * of the current process. + * Returns the ID of the user namespace. In the case of an error '0' is returned. + */ +ino_t mca_btl_vader_get_user_ns_id(void) +{ + struct stat buf; + + if (0 > stat("/proc/self/ns/user", &buf)) { + /* + * Something went wrong, probably an old kernel that does not support namespaces + * simply assume all processes are in the same user namespace and return 0 + */ + return 0; + } + + return buf.st_ino; +} static int mca_btl_base_vader_modex_send (void) { union vader_modex_t modex; @@ -363,8 +386,16 @@ static int mca_btl_base_vader_modex_send (void) modex_size = sizeof (modex.xpmem); } else { #endif - modex_size = opal_shmem_sizeof_shmem_ds (&mca_btl_vader_component.seg_ds); - memmove (&modex.seg_ds, &mca_btl_vader_component.seg_ds, modex_size); + modex.other.seg_ds_size = opal_shmem_sizeof_shmem_ds (&mca_btl_vader_component.seg_ds); + memmove (&modex.other.seg_ds, &mca_btl_vader_component.seg_ds, modex.other.seg_ds_size); + modex.other.user_ns_id = mca_btl_vader_get_user_ns_id(); + /* + * If modex.other.user_ns_id is '0' something did not work out + * during user namespace detection. Assuming there are no + * namespaces available it will return '0' for all processes and + * the check later will see '0' everywhere and not disable CMA. + */ + modex_size = sizeof (modex.other); #if OPAL_BTL_VADER_HAVE_XPMEM } diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index a1cd167e222..e54c02b5698 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -27,6 +27,7 @@ */ #include "opal_config.h" +#include "opal/util/show_help.h" #include "btl_vader.h" #include "btl_vader_endpoint.h" @@ -79,6 +80,28 @@ mca_btl_vader_t mca_btl_vader = { } }; +/* + * Exit function copied from btl_usnic_util.c + * + * The following comment tells Coverity that this function does not return. + * See https://scan.coverity.com/tune. + */ + +/* coverity[+kill] */ +static void vader_btl_exit(mca_btl_vader_t *btl) +{ + if (NULL != btl && NULL != btl->error_cb) { + btl->error_cb(&btl->super, MCA_BTL_ERROR_FLAGS_FATAL, + (opal_proc_t*) opal_proc_local_get(), + "The vader BTL is aborting the MPI job (via PML error callback)."); + } + + /* If the PML error callback returns (or if there wasn't one), just exit. Shrug. */ + fprintf(stderr, "*** The Open MPI vader BTL is aborting the MPI job (via exit(3)).\n"); + fflush(stderr); + exit(1); +} + static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) { mca_btl_vader_component_t *component = &mca_btl_vader_component; @@ -173,6 +196,7 @@ static int vader_btl_first_time_init(mca_btl_vader_t *vader_btl, int n) static int init_vader_endpoint (struct mca_btl_base_endpoint_t *ep, struct opal_proc_t *proc, int remote_rank) { mca_btl_vader_component_t *component = &mca_btl_vader_component; union vader_modex_t *modex; + ino_t my_user_ns_id; size_t msg_size; int rc; @@ -197,17 +221,58 @@ static int init_vader_endpoint (struct mca_btl_base_endpoint_t *ep, struct opal_ } else { #endif /* store a copy of the segment information for detach */ - ep->segment_data.other.seg_ds = malloc (msg_size); + ep->segment_data.other.seg_ds = malloc (modex->other.seg_ds_size); if (NULL == ep->segment_data.other.seg_ds) { return OPAL_ERR_OUT_OF_RESOURCE; } - memcpy (ep->segment_data.other.seg_ds, &modex->seg_ds, msg_size); + memcpy (ep->segment_data.other.seg_ds, &modex->other.seg_ds, modex->other.seg_ds_size); ep->segment_base = opal_shmem_segment_attach (ep->segment_data.other.seg_ds); if (NULL == ep->segment_base) { return OPAL_ERROR; } + + if (MCA_BTL_VADER_CMA == mca_btl_vader_component.single_copy_mechanism) { + my_user_ns_id = mca_btl_vader_get_user_ns_id(); + if (my_user_ns_id != modex->other.user_ns_id) { + mca_base_var_source_t source; + int vari; + rc = mca_base_var_find_by_name("btl_vader_single_copy_mechanism", &vari); + if (OPAL_ERROR == rc) { + return OPAL_ERROR; + } + rc = mca_base_var_get_value(vari, NULL, &source, NULL); + if (OPAL_ERROR == rc) { + return OPAL_ERROR; + } + /* + * CMA is not possible as different user namespaces are in use. + * Currently the kernel does not allow * process_vm_{read,write}v() + * for processes running in different user namespaces even if + * all involved user IDs are mapped to the same user ID. + * + * Fallback to MCA_BTL_VADER_EMUL. + */ + if (MCA_BASE_VAR_SOURCE_DEFAULT != source) { + /* If CMA has been explicitly selected we want to error out */ + opal_show_help("help-btl-vader.txt", "cma-different-user-namespace-error", + true, opal_process_info.nodename); + vader_btl_exit(&mca_btl_vader); + } + /* + * If CMA has been selected because it is the default or + * some fallback, this falls back even further. + */ + opal_show_help("help-btl-vader.txt", "cma-different-user-namespace-warning", + true, opal_process_info.nodename); + mca_btl_vader_component.single_copy_mechanism = MCA_BTL_VADER_EMUL; + mca_btl_vader.super.btl_get = mca_btl_vader_get_sc_emu; + mca_btl_vader.super.btl_put = mca_btl_vader_put_sc_emu; + mca_btl_vader.super.btl_put_limit = mca_btl_vader.super.btl_max_send_size - sizeof (mca_btl_vader_sc_emu_hdr_t); + mca_btl_vader.super.btl_get_limit = mca_btl_vader.super.btl_max_send_size - sizeof (mca_btl_vader_sc_emu_hdr_t); + } + } #if OPAL_BTL_VADER_HAVE_XPMEM } #endif diff --git a/opal/mca/btl/vader/help-btl-vader.txt b/opal/mca/btl/vader/help-btl-vader.txt index 9d87267564a..ea87559d454 100644 --- a/opal/mca/btl/vader/help-btl-vader.txt +++ b/opal/mca/btl/vader/help-btl-vader.txt @@ -121,6 +121,25 @@ WARNING: Linux kernel CMA support was requested via the btl_vader_single_copy_mechanism MCA variable, but CMA support is not available due to restrictive ptrace settings. +The vader shared memory BTL will fall back on another single-copy +mechanism if one is available. This may result in lower performance. + + Local host: %s +# +[cma-different-user-namespace-error] +ERROR: Linux kernel CMA support was requested via the +btl_vader_single_copy_mechanism MCA variable, but CMA support is +not available due to different user namespaces. + +Your MPI job will abort now. Please select another value for +btl_vader_single_copy_mechanism. + + Local host: %s +# +[cma-different-user-namespace-warning] +WARNING: The default btl_vader_single_copy_mechanism CMA is +not available due to different user namespaces. + The vader shared memory BTL will fall back on another single-copy mechanism if one is available. This may result in lower performance. From 226dfc4ef081b2b88fffa478798e4d77f7088fbe Mon Sep 17 00:00:00 2001 From: Andrey Maslennikov Date: Sun, 22 Sep 2019 16:01:20 +0300 Subject: [PATCH 431/674] platform/mellanox: disable missing libcuda warning Signed-off-by: Andrey Maslennikov (cherry picked from commit 63ba7bec46e6a08f9948c82cba602d3b8d50fada) --- contrib/platform/mellanox/optimized.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contrib/platform/mellanox/optimized.conf b/contrib/platform/mellanox/optimized.conf index 986db6f6b39..048d85f3427 100644 --- a/contrib/platform/mellanox/optimized.conf +++ b/contrib/platform/mellanox/optimized.conf @@ -76,6 +76,8 @@ oob_tcp_rcvbuf = 32768 opal_event_include=epoll +opal_warn_on_missing_libcuda = 0 + bml_r2_show_unreach_errors = 0 # alltoall algorithm selection settings for tuned coll mca From f8843bba7c6c2135c2c3d6ffbcf25c60dd2b3532 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Mon, 16 Sep 2019 12:13:56 +0300 Subject: [PATCH 432/674] IKRIT: restored compilation - due to some refactoring and adding new functionality compilation of ikrit module was broken - this commit restores compilation Signed-off-by: Sergey Oblomov (cherry picked from commit 991082abf2da3a76849be021c5f7ecced8052709) --- oshmem/mca/memheap/base/base.h | 3 +- oshmem/mca/spml/ikrit/spml_ikrit.c | 78 ++++++++++++++++-------------- oshmem/mca/spml/ikrit/spml_ikrit.h | 2 +- 3 files changed, 44 insertions(+), 39 deletions(-) diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index a91a03ae0c1..ec84d4c734f 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -36,13 +36,14 @@ OSHMEM_DECLSPEC int mca_memheap_base_select(void); #define MEMHEAP_BASE_MIN_ORDER 3 /* forces 64 bit alignment */ #define MEMHEAP_BASE_PAGE_ORDER 21 #define MEMHEAP_BASE_PRIVATE_SIZE (1ULL << MEMHEAP_BASE_PAGE_ORDER) /* should be at least the same as a huge page size */ -#define MEMHEAP_BASE_MIN_SIZE (1ULL << MEMHEAP_BASE_PAGE_ORDER) /* must fit into at least one huge page */ +#define MEMHEAP_BASE_MIN_SIZE (1ULL << MEMHEAP_BASE_PAGE_ORDER) /* must fit into at least one huge page */ extern int mca_memheap_base_already_opened; extern int mca_memheap_base_key_exchange; #define MCA_MEMHEAP_MAX_SEGMENTS 8 #define HEAP_SEG_INDEX 0 +#define MCA_MEMHEAP_SEG_COUNT 2 #define MEMHEAP_SEG_INVALID 0xFFFF diff --git a/oshmem/mca/spml/ikrit/spml_ikrit.c b/oshmem/mca/spml/ikrit/spml_ikrit.c index 1cff194b4ad..f5b47cd3c08 100644 --- a/oshmem/mca/spml/ikrit/spml_ikrit.c +++ b/oshmem/mca/spml/ikrit/spml_ikrit.c @@ -151,44 +151,46 @@ int mca_spml_ikrit_put_simple(void* dst_addr, void* src_addr, int dst); -static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *, uint32_t seg, int remote_pe, int tr_id); +static void mca_spml_ikrit_cache_mkeys(shmem_ctx_t ctx, sshmem_mkey_t *, + uint32_t seg, int remote_pe, int tr_id); static mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void **rva); mca_spml_ikrit_t mca_spml_ikrit = { - { + .super = { /* Init mca_spml_base_module_t */ - mca_spml_ikrit_add_procs, - mca_spml_ikrit_del_procs, - mca_spml_ikrit_enable, - mca_spml_ikrit_register, - mca_spml_ikrit_deregister, - mca_spml_ikrit_oob_get_mkeys, - mca_spml_ikrit_ctx_create, - mca_spml_ikrit_ctx_destroy, - mca_spml_ikrit_put, - mca_spml_ikrit_put_nb, - mca_spml_ikrit_get, - mca_spml_ikrit_get_nb, - mca_spml_ikrit_recv, - mca_spml_ikrit_send, - mca_spml_base_wait, - mca_spml_base_wait_nb, - mca_spml_base_test, - mca_spml_ikrit_fence, /* fence is implemented as quiet */ - mca_spml_ikrit_fence, - mca_spml_ikrit_cache_mkeys, - mca_spml_base_rmkey_free, - mca_spml_base_rmkey_ptr, - mca_spml_base_memuse_hook, - mca_spml_base_put_all_nb, - - (void*)&mca_spml_ikrit + .spml_add_procs = mca_spml_ikrit_add_procs, + .spml_del_procs = mca_spml_ikrit_del_procs, + .spml_enable = mca_spml_ikrit_enable, + .spml_register = mca_spml_ikrit_register, + .spml_deregister = mca_spml_ikrit_deregister, + .spml_oob_get_mkeys = mca_spml_ikrit_oob_get_mkeys, + .spml_ctx_create = mca_spml_ikrit_ctx_create, + .spml_ctx_destroy = mca_spml_ikrit_ctx_destroy, + .spml_put = mca_spml_ikrit_put, + .spml_put_nb = mca_spml_ikrit_put_nb, + .spml_get = mca_spml_ikrit_get, + .spml_get_nb = mca_spml_ikrit_get_nb, + .spml_recv = mca_spml_ikrit_recv, + .spml_send = mca_spml_ikrit_send, + .spml_wait = mca_spml_base_wait, + .spml_wait_nb = mca_spml_base_wait_nb, + .spml_test = mca_spml_base_test, + .spml_fence = mca_spml_ikrit_fence, /* fence is implemented as quiet */ + .spml_quiet = mca_spml_ikrit_fence, + .spml_rmkey_unpack = mca_spml_ikrit_cache_mkeys, + .spml_rmkey_free = mca_spml_base_rmkey_free, + .spml_rmkey_ptr = mca_spml_base_rmkey_ptr, + .spml_memuse_hook = mca_spml_base_memuse_hook, + .spml_put_all_nb = mca_spml_base_put_all_nb, + + .self = (void*)&mca_spml_ikrit }, - mca_spml_ikrit_get_mkey_slow + .get_mkey_slow = mca_spml_ikrit_get_mkey_slow }; -static void mca_spml_ikrit_cache_mkeys(sshmem_mkey_t *mkey, uint32_t seg, int dst_pe, int tr_id) +static void mca_spml_ikrit_cache_mkeys(shmem_ctx_t ctx, sshmem_mkey_t *mkey, + uint32_t seg, int dst_pe, int tr_id) { mxm_peer_t *peer; @@ -212,7 +214,7 @@ mxm_mem_key_t *mca_spml_ikrit_get_mkey_slow(int pe, void *va, int ptl_id, void * sshmem_mkey_t *mkey; retry: - mkey = mca_memheap_base_get_cached_mkey(pe, va, ptl_id, rva); + mkey = mca_memheap_base_get_cached_mkey(oshmem_ctx_default, pe, va, ptl_id, rva); if (NULL == mkey) { SPML_ERROR("pe=%d: %p is not address of shared variable", pe, va); oshmem_shmem_abort(-1); @@ -438,9 +440,9 @@ int mca_spml_ikrit_add_procs(ompi_proc_t** procs, size_t nprocs) } sshmem_mkey_t *mca_spml_ikrit_register(void* addr, - size_t size, - uint64_t shmid, - int *count) + size_t size, + uint64_t shmid, + int *count) { int i; sshmem_mkey_t *mkeys; @@ -507,7 +509,8 @@ sshmem_mkey_t *mca_spml_ikrit_register(void* addr, my_rank, i, addr, (unsigned long long)size, mca_spml_base_mkey2str(&mkeys[i])); - mca_spml_ikrit_cache_mkeys(&mkeys[i], memheap_find_segnum(addr), my_rank, i); + mca_spml_ikrit_cache_mkeys(oshmem_ctx_default, &mkeys[i], + memheap_find_segnum(addr), my_rank, i); } *count = MXM_PTL_LAST; @@ -551,7 +554,8 @@ int mca_spml_ikrit_deregister(sshmem_mkey_t *mkeys) } -int mca_spml_ikrit_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys) +int mca_spml_ikrit_oob_get_mkeys(shmem_ctx_t ctx, int pe, uint32_t seg, + sshmem_mkey_t *mkeys) { int ptl; @@ -570,7 +574,7 @@ int mca_spml_ikrit_oob_get_mkeys(int pe, uint32_t seg, sshmem_mkey_t *mkeys) mkeys[ptl].len = 0; mkeys[ptl].va_base = mca_memheap_seg2base_va(seg); mkeys[ptl].u.key = MAP_SEGMENT_SHM_INVALID; - mca_spml_ikrit_cache_mkeys(&mkeys[ptl], seg, pe, ptl); + mca_spml_ikrit_cache_mkeys(ctx, &mkeys[ptl], seg, pe, ptl); return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/spml/ikrit/spml_ikrit.h b/oshmem/mca/spml/ikrit/spml_ikrit.h index e275c3bf592..b819957efcf 100644 --- a/oshmem/mca/spml/ikrit/spml_ikrit.h +++ b/oshmem/mca/spml/ikrit/spml_ikrit.h @@ -183,7 +183,7 @@ extern sshmem_mkey_t *mca_spml_ikrit_register(void* addr, uint64_t shmid, int *count); extern int mca_spml_ikrit_deregister(sshmem_mkey_t *mkeys); -extern int mca_spml_ikrit_oob_get_mkeys(int pe, +extern int mca_spml_ikrit_oob_get_mkeys(shmem_ctx_t ctx, int pe, uint32_t segno, sshmem_mkey_t *mkeys); From 89be953cfd93a78dc85b9f3ef4429466207bd5fc Mon Sep 17 00:00:00 2001 From: Michael Heinz Date: Mon, 23 Sep 2019 13:09:09 -0400 Subject: [PATCH 433/674] REF6976 Silent failure of OMPI over OFI with large messages sizes INTERNAL: STL-59403 The OFI (libfabric) MTL does not respect the maximum message size parameter that OFI provides in the fi_info data. This patch adds this missing max_msg_size field to the mca_ofi_module_t structure and adds a length check to the low-level send routines. (cherry-picked from commit 3aca4af548a3d781b6b52f89f4d6c7e66d379609) Change-Id: Ie50445e5edfb0f30916de0836db0edc64ecf7c60 Signed-off-by: Michael Heinz Reviewed-by: Adam Goldman Reviewed-by: Brendan Cunningham --- ompi/mca/mtl/ofi/help-mtl-ofi.txt | 2 ++ ompi/mca/mtl/ofi/mtl_ofi.h | 20 ++++++++++++++++++-- ompi/mca/mtl/ofi/mtl_ofi_component.c | 3 ++- ompi/mca/mtl/ofi/mtl_ofi_types.h | 3 +++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ompi/mca/mtl/ofi/help-mtl-ofi.txt b/ompi/mca/mtl/ofi/help-mtl-ofi.txt index 8131766ae00..fe00f11159a 100644 --- a/ompi/mca/mtl/ofi/help-mtl-ofi.txt +++ b/ompi/mca/mtl/ofi/help-mtl-ofi.txt @@ -16,3 +16,5 @@ unusual; your job may behave unpredictably (and/or abort) after this. Local host: %s Location: %s:%d Error: %s (%zd) +[message too big] +Message size %llu bigger than supported by selected transport. Max = %llu diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 1a04a5bad23..74f6324c8bb 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -308,13 +308,22 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); - if (OMPI_SUCCESS != ompi_ret) return ompi_ret; + if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_ret)) { + return ompi_ret; + } ofi_req.buffer = (free_after) ? start : NULL; ofi_req.length = length; ofi_req.status.MPI_ERROR = OMPI_SUCCESS; ofi_req.completion_count = 0; + if (OPAL_UNLIKELY(length > endpoint->mtl_ofi_module->max_msg_size)) { + opal_show_help("help-mtl-ofi.txt", + "message too big", false, + length, endpoint->mtl_ofi_module->max_msg_size); + return OMPI_ERROR; + } + if (ompi_mtl_ofi.fi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); src_addr = endpoint->peer_fiaddr; @@ -438,13 +447,20 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); - if (OMPI_SUCCESS != ompi_ret) return ompi_ret; + if (OMPI_UNLIKELY(OMPI_SUCCESS != ompi_ret)) return ompi_ret; ofi_req->buffer = (free_after) ? start : NULL; ofi_req->length = length; ofi_req->status.MPI_ERROR = OMPI_SUCCESS; ofi_req->completion_count = 1; + if (OPAL_UNLIKELY(length > endpoint->mtl_ofi_module->max_msg_size)) { + opal_show_help("help-mtl-ofi.txt", + "message too big", false, + length, endpoint->mtl_ofi_module->max_msg_size); + return OMPI_ERROR; + } + if (ompi_mtl_ofi.fi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); src_addr = endpoint->peer_fiaddr; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index bc1a694789c..1da8f2b0451 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -630,9 +630,10 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, } /** - * Save the maximum inject size. + * Save the maximum sizes. */ ompi_mtl_ofi.max_inject_size = prov->tx_attr->inject_size; + ompi_mtl_ofi.max_msg_size = prov->ep_attr->max_msg_size; /** * Create the objects that will be bound to the endpoint. diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 5514b67a483..ec82cde5894 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -49,6 +49,9 @@ typedef struct mca_mtl_ofi_module_t { /** Maximum inject size */ size_t max_inject_size; + /** Largest message that can be sent in a single send. */ + size_t max_msg_size; + /** Maximum number of CQ events to read in OFI Progress */ int ofi_progress_event_count; From 5f3dbdb5c8a94a4f426ecca1a3a91c83035f956c Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 26 Sep 2019 15:54:46 -0500 Subject: [PATCH 434/674] mtl/ofi: replace OMPI_UNLIKELY with OPAL version one off patch for v4.0.x. for some reason commit on master didn't have this problem. Signed-off-by: Howard Pritchard --- ompi/mca/mtl/ofi/mtl_ofi.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 74f6324c8bb..d523595c14b 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -2,6 +2,8 @@ * Copyright (c) 2013-2018 Intel, Inc. All rights reserved * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Triad National Security, LLC. All rights + * reserved. * * $COPYRIGHT$ * @@ -447,7 +449,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); - if (OMPI_UNLIKELY(OMPI_SUCCESS != ompi_ret)) return ompi_ret; + if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_ret)) return ompi_ret; ofi_req->buffer = (free_after) ? start : NULL; ofi_req->length = length; From edbfcf090a941f608e10228be55b0bc7606d2601 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 25 Sep 2019 13:27:41 -0700 Subject: [PATCH 435/674] Cleanup stale code in ORTE/OOB Remove code for multiple OOB progress threads as it is an optimization nobody uses. Also turns out to have a race condition that can cause segfault on finalize, so maybe good that nobody is using it. Signed-off-by: Ralph Castain (cherry picked from commit 41eb41c3f224abcacec78f4d77c138197c36f172) (cherry picked from commit a2f35c1834ab2fcb216285621d177a179e33dfe7) --- orte/mca/oob/base/base.h | 4 +--- orte/mca/oob/base/oob_base_frame.c | 21 +----------------- orte/mca/oob/tcp/oob_tcp.c | 12 +---------- orte/mca/oob/tcp/oob_tcp_component.c | 31 --------------------------- orte/mca/oob/tcp/oob_tcp_component.h | 14 +----------- orte/mca/oob/tcp/oob_tcp_connection.c | 8 ++----- orte/mca/oob/tcp/oob_tcp_connection.h | 8 +++---- orte/mca/oob/tcp/oob_tcp_listener.c | 4 ++-- orte/mca/oob/tcp/oob_tcp_peer.h | 3 +-- orte/mca/oob/tcp/oob_tcp_sendrecv.h | 8 +++---- 10 files changed, 17 insertions(+), 96 deletions(-) diff --git a/orte/mca/oob/base/base.h b/orte/mca/oob/base/base.h index 7dfe4b0adfc..51c98f8de45 100644 --- a/orte/mca/oob/base/base.h +++ b/orte/mca/oob/base/base.h @@ -55,14 +55,12 @@ BEGIN_C_DECLS * Convenience Typedef */ typedef struct { - opal_event_base_t *ev_base; char *include; char *exclude; opal_list_t components; opal_list_t actives; int max_uri_length; opal_hash_table_t peers; - int num_threads; #if OPAL_ENABLE_TIMING bool timing; #endif @@ -121,7 +119,7 @@ ORTE_DECLSPEC void orte_oob_base_send_nb(int fd, short args, void *cbdata); __FILE__, __LINE__); \ cd = OBJ_NEW(orte_oob_send_t); \ cd->msg = (m); \ - ORTE_THREADSHIFT(cd, orte_oob_base.ev_base, \ + ORTE_THREADSHIFT(cd, orte_event_base, \ orte_oob_base_send_nb, ORTE_MSG_PRI); \ }while(0) diff --git a/orte/mca/oob/base/oob_base_frame.c b/orte/mca/oob/base/oob_base_frame.c index be5c745e507..deaf851a90c 100644 --- a/orte/mca/oob/base/oob_base_frame.c +++ b/orte/mca/oob/base/oob_base_frame.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -55,14 +55,6 @@ orte_oob_base_t orte_oob_base = {0}; static int orte_oob_base_register(mca_base_register_flag_t flags) { - orte_oob_base.num_threads = 0; - (void)mca_base_var_register("orte", "oob", "base", "num_progress_threads", - "Number of independent progress OOB messages for each interface", - MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, - OPAL_INFO_LVL_9, - MCA_BASE_VAR_SCOPE_READONLY, - &orte_oob_base.num_threads); - #if OPAL_ENABLE_TIMING /* Detailed timing setup */ orte_oob_base.timing = false; @@ -91,10 +83,6 @@ static int orte_oob_base_close(void) OBJ_RELEASE(cli); } - if (!ORTE_PROC_IS_APP && !ORTE_PROC_IS_TOOL) { - opal_progress_thread_finalize("OOB-BASE"); - } - /* destruct our internal lists */ OBJ_DESTRUCT(&orte_oob_base.actives); @@ -122,13 +110,6 @@ static int orte_oob_base_open(mca_base_open_flag_t flags) opal_hash_table_init(&orte_oob_base.peers, 128); OBJ_CONSTRUCT(&orte_oob_base.actives, opal_list_t); - if (ORTE_PROC_IS_APP || ORTE_PROC_IS_TOOL) { - orte_oob_base.ev_base = orte_event_base; - } else { - orte_oob_base.ev_base = opal_progress_thread_init("OOB-BASE"); - } - - #if OPAL_ENABLE_FT_CR == 1 /* register the FT events callback */ orte_state.add_job_state(ORTE_JOB_STATE_FT_CHECKPOINT, orte_oob_base_ft_event, ORTE_ERROR_PRI); diff --git a/orte/mca/oob/tcp/oob_tcp.c b/orte/mca/oob/tcp/oob_tcp.c index d5f5ce9c55d..df97be168a7 100644 --- a/orte/mca/oob/tcp/oob_tcp.c +++ b/orte/mca/oob/tcp/oob_tcp.c @@ -141,12 +141,6 @@ static void ping(const orte_process_name_t *proc) return; } - /* has this peer had a progress thread assigned yet? */ - if (NULL == peer->ev_base) { - /* nope - assign one */ - ORTE_OOB_TCP_NEXT_BASE(peer); - } - /* if we are already connected, there is nothing to do */ if (MCA_OOB_TCP_CONNECTED == peer->state) { opal_output_verbose(2, orte_oob_base_framework.framework_output, @@ -204,11 +198,7 @@ static void send_nb(orte_rml_send_t *msg) __FILE__, __LINE__, ORTE_NAME_PRINT(&msg->dst), msg->tag, msg->seq_num, ORTE_NAME_PRINT(&peer->name)); - /* has this peer had a progress thread assigned yet? */ - if (NULL == peer->ev_base) { - /* nope - assign one */ - ORTE_OOB_TCP_NEXT_BASE(peer); - } + /* add the msg to the hop's send queue */ if (MCA_OOB_TCP_CONNECTED == peer->state) { opal_output_verbose(2, orte_oob_base_framework.framework_output, diff --git a/orte/mca/oob/tcp/oob_tcp_component.c b/orte/mca/oob/tcp/oob_tcp_component.c index 244c799631e..4398b9bd483 100644 --- a/orte/mca/oob/tcp/oob_tcp_component.c +++ b/orte/mca/oob/tcp/oob_tcp_component.c @@ -147,12 +147,8 @@ mca_oob_tcp_component_t mca_oob_tcp_component = { */ static int tcp_component_open(void) { - mca_oob_tcp_component.next_base = 0; OBJ_CONSTRUCT(&mca_oob_tcp_component.peers, opal_hash_table_t); opal_hash_table_init(&mca_oob_tcp_component.peers, 32); - OBJ_CONSTRUCT(&mca_oob_tcp_component.ev_bases, opal_pointer_array_t); - opal_pointer_array_init(&mca_oob_tcp_component.ev_bases, - orte_oob_base.num_threads, 256, 8); OBJ_CONSTRUCT(&mca_oob_tcp_component.listeners, opal_list_t); if (ORTE_PROC_IS_HNP) { @@ -206,8 +202,6 @@ static int tcp_component_close(void) } #endif - OBJ_DESTRUCT(&mca_oob_tcp_component.ev_bases); - return ORTE_SUCCESS; } static char *static_port_string; @@ -664,27 +658,11 @@ static orte_rml_pathway_t* component_query_transports(void) static int component_startup(void) { int rc = ORTE_SUCCESS; - int i; - char *tmp; - opal_event_base_t *evb; opal_output_verbose(2, orte_oob_base_framework.framework_output, "%s TCP STARTUP", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - /* initialize state */ - if (0 == orte_oob_base.num_threads) { - opal_pointer_array_add(&mca_oob_tcp_component.ev_bases, orte_oob_base.ev_base); - } else { - for (i=0; i < orte_oob_base.num_threads; i++) { - asprintf(&tmp, "OOB-TCP-%d", i); - evb = opal_progress_thread_init(tmp); - opal_pointer_array_add(&mca_oob_tcp_component.ev_bases, evb); - opal_argv_append_nosize(&mca_oob_tcp_component.ev_threads, tmp); - free(tmp); - } - } - /* if we are a daemon/HNP, or we are a standalone app, * then it is possible that someone else may initiate a * connection to us. In these cases, we need to start the @@ -712,14 +690,6 @@ static void component_shutdown(void) "%s TCP SHUTDOWN", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); - if (0 < orte_oob_base.num_threads) { - for (i=0; i < orte_oob_base.num_threads; i++) { - opal_progress_thread_finalize(mca_oob_tcp_component.ev_threads[i]); - opal_pointer_array_set_item(&mca_oob_tcp_component.ev_bases, i, NULL); - } - opal_argv_free(mca_oob_tcp_component.ev_threads); - } - if (ORTE_PROC_IS_HNP && mca_oob_tcp_component.listen_thread_active) { mca_oob_tcp_component.listen_thread_active = false; /* tell the thread to exit */ @@ -1366,7 +1336,6 @@ static char **split_and_resolve(char **orig_str, char *name) static void peer_cons(mca_oob_tcp_peer_t *peer) { - peer->ev_base = NULL; peer->auth_method = NULL; peer->sd = -1; OBJ_CONSTRUCT(&peer->addrs, opal_list_t); diff --git a/orte/mca/oob/tcp/oob_tcp_component.h b/orte/mca/oob/tcp/oob_tcp_component.h index 37f91466f0e..7a36ea3c30b 100644 --- a/orte/mca/oob/tcp/oob_tcp_component.h +++ b/orte/mca/oob/tcp/oob_tcp_component.h @@ -12,7 +12,7 @@ * Copyright (c) 2006-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -48,9 +48,6 @@ typedef struct { int max_retries; /**< max number of retries before declaring peer gone */ opal_list_t events; /**< events for monitoring connections */ int peer_limit; /**< max size of tcp peer cache */ - opal_pointer_array_t ev_bases; // event base array for progress threads - char** ev_threads; // event progress thread names - int next_base; // counter to load-level thread use opal_hash_table_t peers; // connection addresses for peers /* Port specifications */ @@ -96,13 +93,4 @@ ORTE_MODULE_DECLSPEC void mca_oob_tcp_component_failed_to_connect(int fd, short ORTE_MODULE_DECLSPEC void mca_oob_tcp_component_no_route(int fd, short args, void *cbdata); ORTE_MODULE_DECLSPEC void mca_oob_tcp_component_hop_unknown(int fd, short args, void *cbdata); -#define ORTE_OOB_TCP_NEXT_BASE(p) \ - do { \ - ++mca_oob_tcp_component.next_base; \ - if (orte_oob_base.num_threads <= mca_oob_tcp_component.next_base) { \ - mca_oob_tcp_component.next_base = 0; \ - } \ - (p)->ev_base = (opal_event_base_t*)opal_pointer_array_get_item(&mca_oob_tcp_component.ev_bases, mca_oob_tcp_component.next_base); \ - } while(0) - #endif /* _MCA_OOB_TCP_COMPONENT_H_ */ diff --git a/orte/mca/oob/tcp/oob_tcp_connection.c b/orte/mca/oob/tcp/oob_tcp_connection.c index 402d41c16ab..0358ba487b3 100644 --- a/orte/mca/oob/tcp/oob_tcp_connection.c +++ b/orte/mca/oob/tcp/oob_tcp_connection.c @@ -515,10 +515,7 @@ static void tcp_peer_event_init(mca_oob_tcp_peer_t* peer) { if (peer->sd >= 0) { assert(!peer->send_ev_active && !peer->recv_ev_active); - if (NULL == peer->ev_base) { - ORTE_OOB_TCP_NEXT_BASE(peer); - } - opal_event_set(peer->ev_base, + opal_event_set(orte_event_base, &peer->recv_event, peer->sd, OPAL_EV_READ|OPAL_EV_PERSIST, @@ -530,7 +527,7 @@ static void tcp_peer_event_init(mca_oob_tcp_peer_t* peer) peer->recv_ev_active = false; } - opal_event_set(peer->ev_base, + opal_event_set(orte_event_base, &peer->send_event, peer->sd, OPAL_EV_WRITE|OPAL_EV_PERSIST, @@ -811,7 +808,6 @@ int mca_oob_tcp_peer_recv_connect_ack(mca_oob_tcp_peer_t* pr, ORTE_NAME_PRINT(ORTE_PROC_MY_NAME)); peer = OBJ_NEW(mca_oob_tcp_peer_t); peer->name = hdr.origin; - ORTE_OOB_TCP_NEXT_BASE(peer); // assign it an event base peer->state = MCA_OOB_TCP_ACCEPTING; ui64 = (uint64_t*)(&peer->name); if (OPAL_SUCCESS != opal_hash_table_set_value_uint64(&mca_oob_tcp_component.peers, (*ui64), peer)) { diff --git a/orte/mca/oob/tcp/oob_tcp_connection.h b/orte/mca/oob/tcp/oob_tcp_connection.h index e1392fe781c..0cac37d8da9 100644 --- a/orte/mca/oob/tcp/oob_tcp_connection.h +++ b/orte/mca/oob/tcp/oob_tcp_connection.h @@ -12,7 +12,7 @@ * Copyright (c) 2006-2013 Los Alamos National Security, LLC. * All rights reserved. * Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -60,14 +60,14 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_conn_op_t); ORTE_NAME_PRINT((&(p)->name))); \ cop = OBJ_NEW(mca_oob_tcp_conn_op_t); \ cop->peer = (p); \ - ORTE_THREADSHIFT(cop, (p)->ev_base, (cbfunc), ORTE_MSG_PRI); \ + ORTE_THREADSHIFT(cop, orte_event_base, (cbfunc), ORTE_MSG_PRI); \ } while(0); #define ORTE_ACTIVATE_TCP_ACCEPT_STATE(s, a, cbfunc) \ do { \ mca_oob_tcp_conn_op_t *cop; \ cop = OBJ_NEW(mca_oob_tcp_conn_op_t); \ - opal_event_set(orte_oob_base.ev_base, &cop->ev, s, \ + opal_event_set(orte_event_base, &cop->ev, s, \ OPAL_EV_READ, (cbfunc), cop); \ opal_event_set_priority(&cop->ev, ORTE_MSG_PRI); \ ORTE_POST_OBJECT(cop); \ @@ -84,7 +84,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_conn_op_t); ORTE_NAME_PRINT((&(p)->name))); \ cop = OBJ_NEW(mca_oob_tcp_conn_op_t); \ cop->peer = (p); \ - opal_event_evtimer_set((p)->ev_base, \ + opal_event_evtimer_set(orte_event_base, \ &cop->ev, \ (cbfunc), cop); \ ORTE_POST_OBJECT(cop); \ diff --git a/orte/mca/oob/tcp/oob_tcp_listener.c b/orte/mca/oob/tcp/oob_tcp_listener.c index d34d1a2b18b..41c4aeb51c3 100644 --- a/orte/mca/oob/tcp/oob_tcp_listener.c +++ b/orte/mca/oob/tcp/oob_tcp_listener.c @@ -157,7 +157,7 @@ int orte_oob_tcp_start_listening(void) /* otherwise, setup to listen via the event lib */ OPAL_LIST_FOREACH(listener, &mca_oob_tcp_component.listeners, mca_oob_tcp_listener_t) { listener->ev_active = true; - opal_event_set(orte_oob_base.ev_base, &listener->event, + opal_event_set(orte_event_base, &listener->event, listener->sd, OPAL_EV_READ|OPAL_EV_PERSIST, connection_event_handler, @@ -744,7 +744,7 @@ static void* listen_thread(opal_object_t *obj) * OS might start rejecting connections due to timeout. */ pending_connection = OBJ_NEW(mca_oob_tcp_pending_connection_t); - opal_event_set(orte_oob_base.ev_base, &pending_connection->ev, -1, + opal_event_set(orte_event_base, &pending_connection->ev, -1, OPAL_EV_WRITE, connection_handler, pending_connection); opal_event_set_priority(&pending_connection->ev, ORTE_MSG_PRI); pending_connection->fd = accept(sd, diff --git a/orte/mca/oob/tcp/oob_tcp_peer.h b/orte/mca/oob/tcp/oob_tcp_peer.h index 8d04fd44387..395e4f8b5fc 100644 --- a/orte/mca/oob/tcp/oob_tcp_peer.h +++ b/orte/mca/oob/tcp/oob_tcp_peer.h @@ -52,7 +52,6 @@ typedef struct { mca_oob_tcp_addr_t *active_addr; mca_oob_tcp_state_t state; int num_retries; - opal_event_base_t *ev_base; // progress thread this peer is assigned to opal_event_t send_event; /**< registration with event thread for send events */ bool send_ev_active; opal_event_t recv_event; /**< registration with event thread for recv events */ @@ -88,7 +87,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_peer_op_t); if (NULL != proxy) { \ pop->rtmod = strdup(proxy); \ } \ - ORTE_THREADSHIFT(pop, orte_oob_base.ev_base, \ + ORTE_THREADSHIFT(pop, orte_event_base, \ (cbfunc), ORTE_MSG_PRI); \ } while(0); diff --git a/orte/mca/oob/tcp/oob_tcp_sendrecv.h b/orte/mca/oob/tcp/oob_tcp_sendrecv.h index 9412a4e0fd6..3ab8f479343 100644 --- a/orte/mca/oob/tcp/oob_tcp_sendrecv.h +++ b/orte/mca/oob/tcp/oob_tcp_sendrecv.h @@ -82,7 +82,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_recv_t); do { \ (s)->peer = (struct mca_oob_tcp_peer_t*)(p); \ (s)->activate = (f); \ - ORTE_THREADSHIFT((s), (p)->ev_base, \ + ORTE_THREADSHIFT((s), orte_event_base, \ mca_oob_tcp_queue_msg, ORTE_MSG_PRI); \ } while(0) @@ -235,7 +235,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_msg_op_t); ORTE_NAME_PRINT(&((ms)->dst))); \ mop = OBJ_NEW(mca_oob_tcp_msg_op_t); \ mop->msg = (ms); \ - ORTE_THREADSHIFT(mop, (ms)->peer->ev_base, \ + ORTE_THREADSHIFT(mop, orte_event_base, \ (cbfunc), ORTE_MSG_PRI); \ } while(0); @@ -281,7 +281,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_msg_error_t); mop->hop.jobid = (h)->jobid; \ mop->hop.vpid = (h)->vpid; \ /* this goes to the OOB framework, so use that event base */ \ - ORTE_THREADSHIFT(mop, orte_oob_base.ev_base, \ + ORTE_THREADSHIFT(mop, orte_event_base, \ (cbfunc), ORTE_MSG_PRI); \ } while(0) @@ -299,7 +299,7 @@ OBJ_CLASS_DECLARATION(mca_oob_tcp_msg_error_t); mop->hop.vpid = (h)->vpid; \ /* this goes to the component, so use the framework \ * event base */ \ - ORTE_THREADSHIFT(mop, orte_oob_base.ev_base, \ + ORTE_THREADSHIFT(mop, orte_event_base, \ (c), ORTE_MSG_PRI); \ } while(0) From c6fab321379dfe59f5ef36b1c401b8a28e90dbb7 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Tue, 1 Oct 2019 17:32:39 -0400 Subject: [PATCH 436/674] Fix the sigkill timeout sleep to prevent SIGCHLD from preventing completion. * The user can set `-mca odls_base_sigkill_timeout 30` to have ORTE wait 30 seconds before sending SIGTERM then another 30 seconds before sending SIGKILL to remaining processes. This usually happens on an abnormal termination. Sometimes the user wants to delay the cleanup to give the system time to write out corefile or run other diagnostics. * The problem is that child processes may be completing while ORTE is in this loop. The SIGCHLD will interrupt the `sleep` system call. Without the loop the sleep could effectively be ignored in this case. - Sleep returns the amount of time remaining to sleep. If it was interrupted by a signal then it is a positive number less than or equal to the parameter passed to it. If it slept the whole time then it returns 0. Signed-off-by: Joshua Hursey (cherry picked from commit 0e8a97c598d841d472047ea1025931813c3ef8a9) --- orte/mca/odls/base/odls_base_default_fns.c | 28 ++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/orte/mca/odls/base/odls_base_default_fns.c b/orte/mca/odls/base/odls_base_default_fns.c index a9282dd4bbd..69974bb5790 100644 --- a/orte/mca/odls/base/odls_base_default_fns.c +++ b/orte/mca/odls/base/odls_base_default_fns.c @@ -1767,7 +1767,7 @@ int orte_odls_base_default_kill_local_procs(opal_pointer_array_t *procs, orte_proc_t *child; opal_list_t procs_killed; orte_proc_t *proc, proctmp; - int i, j; + int i, j, ret; opal_pointer_array_t procarray, *procptr; bool do_cleanup; orte_odls_quick_caddy_t *cd; @@ -1913,7 +1913,17 @@ int orte_odls_base_default_kill_local_procs(opal_pointer_array_t *procs, /* if we are issuing signals, then we need to wait a little * and send the next in sequence */ if (0 < opal_list_get_size(&procs_killed)) { - sleep(orte_odls_globals.timeout_before_sigkill); + /* Wait a little. Do so in a loop since sleep() can be interrupted by a + * signal. Most likely SIGCHLD in this case */ + ret = orte_odls_globals.timeout_before_sigkill; + while( ret > 0 ) { + OPAL_OUTPUT_VERBOSE((5, orte_odls_base_framework.framework_output, + "%s Sleep %d sec (total = %d)", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + ret, orte_odls_globals.timeout_before_sigkill)); + ret = sleep(ret); + } + /* issue a SIGTERM to all */ OPAL_LIST_FOREACH(cd, &procs_killed, orte_odls_quick_caddy_t) { OPAL_OUTPUT_VERBOSE((5, orte_odls_base_framework.framework_output, @@ -1922,8 +1932,18 @@ int orte_odls_base_default_kill_local_procs(opal_pointer_array_t *procs, ORTE_NAME_PRINT(&cd->child->name))); kill_local(cd->child->pid, SIGTERM); } - /* wait a little again */ - sleep(orte_odls_globals.timeout_before_sigkill); + + /* Wait a little. Do so in a loop since sleep() can be interrupted by a + * signal. Most likely SIGCHLD in this case */ + ret = orte_odls_globals.timeout_before_sigkill; + while( ret > 0 ) { + OPAL_OUTPUT_VERBOSE((5, orte_odls_base_framework.framework_output, + "%s Sleep %d sec (total = %d)", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + ret, orte_odls_globals.timeout_before_sigkill)); + ret = sleep(ret); + } + /* issue a SIGKILL to all */ OPAL_LIST_FOREACH(cd, &procs_killed, orte_odls_quick_caddy_t) { OPAL_OUTPUT_VERBOSE((5, orte_odls_base_framework.framework_output, From 0839a9c3135a4c76e5629d35cbda031f90cdc45d Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 4 Oct 2019 09:59:59 -0700 Subject: [PATCH 437/674] btl/usnic: s/get_nsec/get_nticks/g Rename "get_nsec()" to "get_ticks()" to more accurately reflect that this function has no correlation to wall clock time at all. Signed-off-by: Jeff Squyres (cherry picked from commit ce2910a28aea61043b81324c67999f3a47cfe7ac) --- opal/mca/btl/usnic/btl_usnic.h | 2 +- opal/mca/btl/usnic/btl_usnic_module.c | 2 +- opal/mca/btl/usnic/btl_usnic_recv.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opal/mca/btl/usnic/btl_usnic.h b/opal/mca/btl/usnic/btl_usnic.h index e8f6dafa2de..d25d6309bbd 100644 --- a/opal/mca/btl/usnic/btl_usnic.h +++ b/opal/mca/btl/usnic/btl_usnic.h @@ -68,7 +68,7 @@ extern uint64_t opal_btl_usnic_ticks; extern opal_recursive_mutex_t btl_usnic_lock; static inline uint64_t -get_nsec(void) +get_ticks(void) { return opal_btl_usnic_ticks; } diff --git a/opal/mca/btl/usnic/btl_usnic_module.c b/opal/mca/btl/usnic/btl_usnic_module.c index ba0442c43c4..2c3d8e04635 100644 --- a/opal/mca/btl/usnic/btl_usnic_module.c +++ b/opal/mca/btl/usnic/btl_usnic_module.c @@ -1236,7 +1236,7 @@ opal_btl_usnic_module_progress_sends( /* Is it time to send ACK? */ if (endpoint->endpoint_acktime == 0 || - endpoint->endpoint_acktime <= get_nsec()) { + endpoint->endpoint_acktime <= get_ticks()) { if (OPAL_LIKELY(opal_btl_usnic_ack_send(module, endpoint) == OPAL_SUCCESS)) { opal_btl_usnic_remove_from_endpoints_needing_ack(endpoint); } else { diff --git a/opal/mca/btl/usnic/btl_usnic_recv.h b/opal/mca/btl/usnic/btl_usnic_recv.h index 7e056e488db..256132f4b59 100644 --- a/opal/mca/btl/usnic/btl_usnic_recv.h +++ b/opal/mca/btl/usnic/btl_usnic_recv.h @@ -114,7 +114,7 @@ opal_btl_usnic_update_window( /* give this process a chance to send something before ACKing */ if (0 == endpoint->endpoint_acktime) { - endpoint->endpoint_acktime = get_nsec() + 50000; /* 50 usec */ + endpoint->endpoint_acktime = get_ticks() + 50000; } /* Save this incoming segment in the received segmentss array on the From b5cb03450cc6198bca0ab223fef0c6be9e44c125 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 4 Oct 2019 11:52:48 -0700 Subject: [PATCH 438/674] btl/usnic: clarifications and fixes regarding ACKs New MCA parameter: btl_usnic_ack_iteration_delay. Set this to the number of times through the usNIC component progress function before sending a standalone ACK (vs. piggy-backing the ACK on any other send going to the target peer). Use "ticks" language to clarify that we're really counting the number of times through the usNIC component DATA_CHANNEL completion check (to check for incoming messages) -- it has no relation to wall clock time whatsoever. Also slightly change the channel-checking scheme in usNIC component progress: only check the PRIORITY channel once (vs. checking it once, not finding anything, and then falling through the progress_2() where we check PRIORITY again and then check the DATA channel). As before, if our "progress" libevent fires, increment the tick counter enough to guarantee that all endpoints that need an ACK will get triggered to send standalone ACKs the next time through progress, if necessary. Signed-off-by: Jeff Squyres (cherry picked from commit 968b1a51b59898877a8c7268d463d3d7d78d86a3) --- opal/mca/btl/usnic/btl_usnic.h | 4 ++++ opal/mca/btl/usnic/btl_usnic_component.c | 25 +++++++++++++----------- opal/mca/btl/usnic/btl_usnic_mca.c | 4 ++++ opal/mca/btl/usnic/btl_usnic_recv.h | 7 +++++-- 4 files changed, 27 insertions(+), 13 deletions(-) diff --git a/opal/mca/btl/usnic/btl_usnic.h b/opal/mca/btl/usnic/btl_usnic.h index d25d6309bbd..3251b673698 100644 --- a/opal/mca/btl/usnic/btl_usnic.h +++ b/opal/mca/btl/usnic/btl_usnic.h @@ -206,6 +206,10 @@ typedef struct opal_btl_usnic_component_t { /** retrans characteristics */ int retrans_timeout; + /** minimum number of times through component progress before + checking to see if standalone ACKs need to be sent */ + int ack_iteration_delay; + /** transport header length for all usNIC devices on this server (it is guaranteed that all usNIC devices on a single server will have the same underlying transport, and therefore the diff --git a/opal/mca/btl/usnic/btl_usnic_component.c b/opal/mca/btl/usnic/btl_usnic_component.c index 25a64a25d26..629d292c305 100644 --- a/opal/mca/btl/usnic/btl_usnic_component.c +++ b/opal/mca/btl/usnic/btl_usnic_component.c @@ -384,8 +384,9 @@ static int check_usnic_config(opal_btl_usnic_module_t *module, static void usnic_clock_callback(int fd, short flags, void *timeout) { - /* 1ms == 1,000,000 ns */ - opal_btl_usnic_ticks += 1000000; + /* Increase by so many ticks that we will definitely force sending + any ACKs that are pending */ + opal_btl_usnic_ticks += 1000; /* run progress to make sure time change gets noticed */ usnic_component_progress(); @@ -1132,7 +1133,7 @@ static mca_btl_base_module_t** usnic_component_init(int* num_btl_modules, */ static int usnic_handle_completion(opal_btl_usnic_module_t* module, opal_btl_usnic_channel_t *channel, struct fi_cq_entry *completion); -static int usnic_component_progress_2(void); +static int usnic_component_progress_2(bool check_priority); static void usnic_handle_cq_error(opal_btl_usnic_module_t* module, opal_btl_usnic_channel_t *channel, int cq_ret); @@ -1145,9 +1146,7 @@ static int usnic_component_progress(void) struct fi_cq_entry completion; opal_btl_usnic_channel_t *channel; static bool fastpath_ok = true; - - /* update our simulated clock */ - opal_btl_usnic_ticks += 5000; + bool check_priority = true; count = 0; if (fastpath_ok) { @@ -1180,10 +1179,11 @@ static int usnic_component_progress(void) usnic_handle_cq_error(module, channel, ret); } } + check_priority = false; } fastpath_ok = true; - return count + usnic_component_progress_2(); + return count + usnic_component_progress_2(check_priority); } static int usnic_handle_completion( @@ -1304,7 +1304,7 @@ usnic_handle_cq_error(opal_btl_usnic_module_t* module, } } -static int usnic_component_progress_2(void) +static int usnic_component_progress_2(bool check_priority) { int i, j, count = 0, num_events, ret; opal_btl_usnic_module_t* module; @@ -1313,15 +1313,18 @@ static int usnic_component_progress_2(void) int rc; int c; - /* update our simulated clock */ - opal_btl_usnic_ticks += 5000; + opal_btl_usnic_ticks += 1; + + /* If we need to check priority, start with the priority channel. + Otherwise, just check the data channel. */ + int c_start = check_priority ? USNIC_PRIORITY_CHANNEL : USNIC_DATA_CHANNEL; /* Poll for completions */ for (i = 0; i < mca_btl_usnic_component.num_modules; i++) { module = mca_btl_usnic_component.usnic_active_modules[i]; /* poll each channel */ - for (c=0; cmod_channels[c]; if (channel->chan_deferred_recv != NULL) { diff --git a/opal/mca/btl/usnic/btl_usnic_mca.c b/opal/mca/btl/usnic/btl_usnic_mca.c index 84f987cf22c..515f32abaaa 100644 --- a/opal/mca/btl/usnic/btl_usnic_mca.c +++ b/opal/mca/btl/usnic/btl_usnic_mca.c @@ -260,6 +260,10 @@ int opal_btl_usnic_component_register(void) 5000, &mca_btl_usnic_component.retrans_timeout, REGINT_GE_ONE, OPAL_INFO_LVL_5)); + CHECK(reg_int("ack_iteration_delay", "Minimum number of times through usNIC \"progress\" function before checking to see if standalone ACKs need to be sent", + 0, &mca_btl_usnic_component.ack_iteration_delay, + REGINT_GE_ZERO, OPAL_INFO_LVL_5)); + CHECK(reg_int("priority_limit", "Max size of \"priority\" messages (0 = use pre-set defaults; depends on number and type of devices available)", 0, &max_tiny_msg_size, REGINT_GE_ZERO, OPAL_INFO_LVL_5)); diff --git a/opal/mca/btl/usnic/btl_usnic_recv.h b/opal/mca/btl/usnic/btl_usnic_recv.h index 256132f4b59..7a178c1630f 100644 --- a/opal/mca/btl/usnic/btl_usnic_recv.h +++ b/opal/mca/btl/usnic/btl_usnic_recv.h @@ -112,9 +112,12 @@ opal_btl_usnic_update_window( opal_btl_usnic_add_to_endpoints_needing_ack(endpoint); } - /* give this process a chance to send something before ACKing */ + /* A hueristic: set to send this ACK after we have checked our + incoming DATA_CHANNEL component.act_iteration_delay times + (i.e., so we can piggyback an ACK on an outgoing send) */ if (0 == endpoint->endpoint_acktime) { - endpoint->endpoint_acktime = get_ticks() + 50000; + endpoint->endpoint_acktime = + get_ticks() + mca_btl_usnic_component.ack_iteration_delay; } /* Save this incoming segment in the received segmentss array on the From 8f929c68f10c9bdbac6729082327c1904d688de7 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 4 Oct 2019 11:59:01 -0700 Subject: [PATCH 439/674] btl/usnic: increase default retrans_timeout Significantly increase the default retrans timeout. If the retrans timeout is too soon, we can end up in a retransmission storm where the logic will continually re-transmit the same frames during a single run through the usNIC progress function (because the timer for a single frame expires before we have run through re-transmitting all the frames pending re-transmission). Signed-off-by: Jeff Squyres (cherry picked from commit 3cc95d86b2123f38f392e56adca7ac8a1fef6454) --- opal/mca/btl/usnic/btl_usnic_mca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/usnic/btl_usnic_mca.c b/opal/mca/btl/usnic/btl_usnic_mca.c index 515f32abaaa..54050dde300 100644 --- a/opal/mca/btl/usnic/btl_usnic_mca.c +++ b/opal/mca/btl/usnic/btl_usnic_mca.c @@ -257,7 +257,7 @@ int opal_btl_usnic_component_register(void) mca_btl_usnic_component.udp_port_base = (int) udp_port_base; CHECK(reg_int("retrans_timeout", "Number of microseconds before retransmitting a frame", - 5000, &mca_btl_usnic_component.retrans_timeout, + 100000, &mca_btl_usnic_component.retrans_timeout, REGINT_GE_ONE, OPAL_INFO_LVL_5)); CHECK(reg_int("ack_iteration_delay", "Minimum number of times through usNIC \"progress\" function before checking to see if standalone ACKs need to be sent", From 58155bc760276daca76b6565f6186f4f53d8a977 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 4 Oct 2019 12:05:13 -0700 Subject: [PATCH 440/674] btl/usnic: cap the number of resends per progress iteration New MCA param: btl_usnic_max_resends_per_iteration. This is the max number of resends we'll do in a single pass through usNIC component progress. This prevents progress from getting stuck in an endless loop of retransmissions (i.e., if more retransmissions are triggered during the sending of retransmissions). Specifically: we need to leave the resend loop to allow receives to happen (which may ACK messages we have sent previously, and therefore cause pending resends to be moot). Signed-off-by: Jeff Squyres (cherry picked from commit 27e3040dfeba00a9a2615a217c164899f0009e59) --- opal/mca/btl/usnic/btl_usnic.h | 4 ++++ opal/mca/btl/usnic/btl_usnic_mca.c | 4 ++++ opal/mca/btl/usnic/btl_usnic_module.c | 7 +++++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/opal/mca/btl/usnic/btl_usnic.h b/opal/mca/btl/usnic/btl_usnic.h index 3251b673698..b4831d82d9a 100644 --- a/opal/mca/btl/usnic/btl_usnic.h +++ b/opal/mca/btl/usnic/btl_usnic.h @@ -206,6 +206,10 @@ typedef struct opal_btl_usnic_component_t { /** retrans characteristics */ int retrans_timeout; + /** max number of messages re-sent during a single progress + iteration */ + int max_resends_per_iteration; + /** minimum number of times through component progress before checking to see if standalone ACKs need to be sent */ int ack_iteration_delay; diff --git a/opal/mca/btl/usnic/btl_usnic_mca.c b/opal/mca/btl/usnic/btl_usnic_mca.c index 54050dde300..f0399cbeb8c 100644 --- a/opal/mca/btl/usnic/btl_usnic_mca.c +++ b/opal/mca/btl/usnic/btl_usnic_mca.c @@ -260,6 +260,10 @@ int opal_btl_usnic_component_register(void) 100000, &mca_btl_usnic_component.retrans_timeout, REGINT_GE_ONE, OPAL_INFO_LVL_5)); + CHECK(reg_int("max_resends_per_iteration", "Maximum number of frames to resend in a single iteration through usNIC component progress", + 16, &mca_btl_usnic_component.max_resends_per_iteration, + REGINT_GE_ONE, OPAL_INFO_LVL_5)); + CHECK(reg_int("ack_iteration_delay", "Minimum number of times through usNIC \"progress\" function before checking to see if standalone ACKs need to be sent", 0, &mca_btl_usnic_component.ack_iteration_delay, REGINT_GE_ZERO, OPAL_INFO_LVL_5)); diff --git a/opal/mca/btl/usnic/btl_usnic_module.c b/opal/mca/btl/usnic/btl_usnic_module.c index 2c3d8e04635..086f99f5128 100644 --- a/opal/mca/btl/usnic/btl_usnic_module.c +++ b/opal/mca/btl/usnic/btl_usnic_module.c @@ -963,11 +963,12 @@ usnic_do_resends( opal_btl_usnic_send_segment_t *sseg; opal_btl_usnic_endpoint_t *endpoint; struct opal_btl_usnic_channel_t *data_channel; - int ret; + int ret, count; data_channel = &module->mod_channels[USNIC_DATA_CHANNEL]; - while ((get_send_credits(data_channel) > 1) && + count = mca_btl_usnic_component.max_resends_per_iteration; + while (count > 0 && (get_send_credits(data_channel) > 1) && !opal_list_is_empty(&module->pending_resend_segs)) { /* @@ -1009,6 +1010,8 @@ usnic_do_resends( BTL_ERROR(("hotel checkin failed\n")); abort(); /* should not be possible */ } + + --count; } } From 22bc268e6e86baaef59101690ee647de37b03aa0 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 4 Oct 2019 14:40:56 -0700 Subject: [PATCH 441/674] btl/usnic: properly size freelist items Move the prefix area from the head to the body in relevant size computations. This fixes a problem in high traffic situations where usNIC may have sent from unregistered memory. Signed-off-by: Jeff Squyres (cherry picked from commit fe7f772f21627b01838c007db7cedbbb0ce8b536) --- opal/mca/btl/usnic/btl_usnic_module.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/opal/mca/btl/usnic/btl_usnic_module.c b/opal/mca/btl/usnic/btl_usnic_module.c index 086f99f5128..94aefc9b715 100644 --- a/opal/mca/btl/usnic/btl_usnic_module.c +++ b/opal/mca/btl/usnic/btl_usnic_module.c @@ -2369,14 +2369,14 @@ static void init_freelists(opal_btl_usnic_module_t *module) uint32_t segsize; segsize = (module->local_modex.max_msg_size + - opal_cache_line_size - 1) & + mca_btl_usnic_component.prefix_send_offset + + opal_cache_line_size - 1) & ~(opal_cache_line_size - 1); /* Send frags freelists */ OBJ_CONSTRUCT(&module->small_send_frags, opal_free_list_t); rc = usnic_compat_free_list_init(&module->small_send_frags, - sizeof(opal_btl_usnic_small_send_frag_t) + - mca_btl_usnic_component.prefix_send_offset, + sizeof(opal_btl_usnic_small_send_frag_t), opal_cache_line_size, OBJ_CLASS(opal_btl_usnic_small_send_frag_t), segsize, @@ -2393,8 +2393,7 @@ static void init_freelists(opal_btl_usnic_module_t *module) OBJ_CONSTRUCT(&module->large_send_frags, opal_free_list_t); rc = usnic_compat_free_list_init(&module->large_send_frags, - sizeof(opal_btl_usnic_large_send_frag_t) + - mca_btl_usnic_component.prefix_send_offset, + sizeof(opal_btl_usnic_large_send_frag_t), opal_cache_line_size, OBJ_CLASS(opal_btl_usnic_large_send_frag_t), 0, /* payload size */ @@ -2411,8 +2410,7 @@ static void init_freelists(opal_btl_usnic_module_t *module) OBJ_CONSTRUCT(&module->put_dest_frags, opal_free_list_t); rc = usnic_compat_free_list_init(&module->put_dest_frags, - sizeof(opal_btl_usnic_put_dest_frag_t) + - mca_btl_usnic_component.prefix_send_offset, + sizeof(opal_btl_usnic_put_dest_frag_t), opal_cache_line_size, OBJ_CLASS(opal_btl_usnic_put_dest_frag_t), 0, /* payload size */ @@ -2430,8 +2428,7 @@ static void init_freelists(opal_btl_usnic_module_t *module) /* list of segments to use for sending */ OBJ_CONSTRUCT(&module->chunk_segs, opal_free_list_t); rc = usnic_compat_free_list_init(&module->chunk_segs, - sizeof(opal_btl_usnic_chunk_segment_t) + - mca_btl_usnic_component.prefix_send_offset, + sizeof(opal_btl_usnic_chunk_segment_t), opal_cache_line_size, OBJ_CLASS(opal_btl_usnic_chunk_segment_t), segsize, @@ -2449,11 +2446,11 @@ static void init_freelists(opal_btl_usnic_module_t *module) /* ACK segments freelist */ uint32_t ack_segment_len; ack_segment_len = (sizeof(opal_btl_usnic_btl_header_t) + + mca_btl_usnic_component.prefix_send_offset + opal_cache_line_size - 1) & ~(opal_cache_line_size - 1); OBJ_CONSTRUCT(&module->ack_segs, opal_free_list_t); rc = usnic_compat_free_list_init(&module->ack_segs, - sizeof(opal_btl_usnic_ack_segment_t) + - mca_btl_usnic_component.prefix_send_offset, + sizeof(opal_btl_usnic_ack_segment_t), opal_cache_line_size, OBJ_CLASS(opal_btl_usnic_ack_segment_t), ack_segment_len, From 7c2efbd6162b2c511cd3573f169b7763f89d408e Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Sat, 5 Oct 2019 13:14:31 -0600 Subject: [PATCH 442/674] NEWS: update for the v4.0.2 release [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/NEWS b/NEWS index a4374b10d4e..b2f4789136a 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,12 @@ included in the vX.Y.Z section and be denoted as: 4.0.2 -- September, 2019 ------------------------ - Update embedded PMIx to 3.1.4 +- Enhance Open MPI to detect when processes are running in + different name spaces on the same node, in which case the + vader CMA single copy mechanism is disabled. Thanks + to Adrian Reber for reporting and providing a fix. +- Fix an issue with ORTE job tree launch mechanism. Thanks + to @lanyangyang for reporting. - Fix an issue with env processing when running as root. Thanks to Simon Byrne for reporting and providing a fix. - Fix Fortran MPI_FILE_GET_POSITION return code bug. @@ -102,6 +108,13 @@ included in the vX.Y.Z section and be denoted as: present in the stack when attaching with MPIR. Thanks to James A Clark for reporting and providing a fix. +Known issues: + +- There is a known issue with the OFI libfabric and PSM2 MTLs when trying to send + very long (> 4 GBytes) messages. In this release, these MTLs will catch + this case and abort the transfer. A future release will provide a + better solution to this issue. + 4.0.1 -- March, 2019 -------------------- From 1565239506f4589b6b14c2f4af77b4a7da3bd42b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 8 Oct 2019 11:17:30 -0700 Subject: [PATCH 443/674] btl/usnic: set ack_iteration_delay default to 4 It was previously accidentally set to 0. Signed-off-by: Jeff Squyres (cherry picked from commit 132e4cab3bc71df0da87368a332d6af0090a6977) --- opal/mca/btl/usnic/btl_usnic_mca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/usnic/btl_usnic_mca.c b/opal/mca/btl/usnic/btl_usnic_mca.c index f0399cbeb8c..e9f8fd294ad 100644 --- a/opal/mca/btl/usnic/btl_usnic_mca.c +++ b/opal/mca/btl/usnic/btl_usnic_mca.c @@ -265,7 +265,7 @@ int opal_btl_usnic_component_register(void) REGINT_GE_ONE, OPAL_INFO_LVL_5)); CHECK(reg_int("ack_iteration_delay", "Minimum number of times through usNIC \"progress\" function before checking to see if standalone ACKs need to be sent", - 0, &mca_btl_usnic_component.ack_iteration_delay, + 4, &mca_btl_usnic_component.ack_iteration_delay, REGINT_GE_ZERO, OPAL_INFO_LVL_5)); CHECK(reg_int("priority_limit", "Max size of \"priority\" messages (0 = use pre-set defaults; depends on number and type of devices available)", From c6592822c0efe628547c7dc3ba2ebdb81851477c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 8 Oct 2019 11:17:54 -0700 Subject: [PATCH 444/674] btl/usnic: set retrans_timeout back down to 5ms Signed-off-by: Jeff Squyres (cherry picked from commit 3080033a8c4db64199b03b6058e18488f619088c) --- opal/mca/btl/usnic/btl_usnic_mca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/usnic/btl_usnic_mca.c b/opal/mca/btl/usnic/btl_usnic_mca.c index e9f8fd294ad..b3e130850c2 100644 --- a/opal/mca/btl/usnic/btl_usnic_mca.c +++ b/opal/mca/btl/usnic/btl_usnic_mca.c @@ -257,7 +257,7 @@ int opal_btl_usnic_component_register(void) mca_btl_usnic_component.udp_port_base = (int) udp_port_base; CHECK(reg_int("retrans_timeout", "Number of microseconds before retransmitting a frame", - 100000, &mca_btl_usnic_component.retrans_timeout, + 5000, &mca_btl_usnic_component.retrans_timeout, REGINT_GE_ONE, OPAL_INFO_LVL_5)); CHECK(reg_int("max_resends_per_iteration", "Maximum number of frames to resend in a single iteration through usNIC component progress", From 6185fa1946a696e98f1626d91df2df4233b7ecff Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 8 Oct 2019 10:47:02 -0500 Subject: [PATCH 445/674] MPIR_Status_set_bytes: fix for large count sizes Change the ncounts argument to MPI_Count and use MPI_Status_set_elements_x for enabling read/write operations beyond the 2GB limit. Thanks to Richard Warren from the HDF5 group for reporting the issue and providing the suggested fix for romio. Signed-off-by: Edgar Gabriel (cherry picked from commit 8a3abbf80373bb36eb78688954118f1fb0cc2e9d) --- ompi/mca/io/romio321/src/io_romio321_module.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/mca/io/romio321/src/io_romio321_module.c b/ompi/mca/io/romio321/src/io_romio321_module.c index 0f7016ea7b2..d0a2f1632a5 100644 --- a/ompi/mca/io/romio321/src/io_romio321_module.c +++ b/ompi/mca/io/romio321/src/io_romio321_module.c @@ -33,7 +33,7 @@ * because ROMIO just expects these functions to exist. */ int MPIR_Status_set_bytes(ompi_status_public_t *status, - struct ompi_datatype_t *datatype, int size); + struct ompi_datatype_t *datatype, MPI_Count size); void ADIOI_Datatype_iscontig(MPI_Datatype datatype, int *flag); @@ -115,7 +115,7 @@ mca_io_base_module_2_0_0_t mca_io_romio321_module = { * MPI_Status_set_elements (almost like they planned that... hmmm...). */ int MPIR_Status_set_bytes(ompi_status_public_t *status, - struct ompi_datatype_t *datatype, int nbytes) + struct ompi_datatype_t *datatype, MPI_Count nbytes) { /* Note that ROMIO is going to give a number of *bytes* here, but MPI_STATUS_SET_ELEMENTS requires a number of *elements*. So @@ -125,7 +125,7 @@ int MPIR_Status_set_bytes(ompi_status_public_t *status, we do the right calculations there. This prevents roundoff errors here, potentially "losing" bytes in the process. */ - MPI_Status_set_elements(status, MPI_CHAR, nbytes); + MPI_Status_set_elements_x(status, MPI_CHAR, nbytes); return MPI_SUCCESS; } From a3e1ecc14bd377d5b03415350ac0530fbfe4fa71 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Sat, 5 Oct 2019 09:50:02 -0500 Subject: [PATCH 446/674] comomn_ompio_file_read/write: fix 2GB limiting issue individual read/write operations exceeding 2GB fail in ompio due to improper conversions from size_t to int in two different locations. This commit fixes an issue reported by Richard Warren from the HDF5 group. Fixes Issue #7045 Cherry-picked from commit a130f569df6badebe639d17c0a1a0cb79a596094 Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio.h | 2 +- ompi/mca/common/ompio/common_ompio_file_read.c | 4 ++-- ompi/mca/common/ompio/common_ompio_file_write.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index e1d7fe21280..a1c195de08c 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -261,7 +261,7 @@ OMPI_DECLSPEC int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp, OMPI_MP int count, struct ompi_datatype_t *datatype, ompi_request_t **request); OMPI_DECLSPEC int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles, - size_t bytes_per_cycle, int max_data, uint32_t iov_count, + size_t bytes_per_cycle, size_t max_data, uint32_t iov_count, struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw, size_t *spc ); diff --git a/ompi/mca/common/ompio/common_ompio_file_read.c b/ompi/mca/common/ompio/common_ompio_file_read.c index 452683605a8..eafd1c44319 100644 --- a/ompi/mca/common/ompio/common_ompio_file_read.c +++ b/ompi/mca/common/ompio/common_ompio_file_read.c @@ -429,8 +429,8 @@ int mca_common_ompio_file_iread_at_all (ompio_file_t *fp, int mca_common_ompio_set_explicit_offset (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE offset) { - int i = 0; - int k = 0; + size_t i = 0; + size_t k = 0; if ( fh->f_view_size > 0 ) { /* starting offset of the current copy of the filew view */ diff --git a/ompi/mca/common/ompio/common_ompio_file_write.c b/ompi/mca/common/ompio/common_ompio_file_write.c index adb9c844d7c..62f728e66a3 100644 --- a/ompi/mca/common/ompio/common_ompio_file_write.c +++ b/ompi/mca/common/ompio/common_ompio_file_write.c @@ -409,7 +409,7 @@ int mca_common_ompio_file_iwrite_at_all (ompio_file_t *fp, /**************************************************************/ int mca_common_ompio_build_io_array ( ompio_file_t *fh, int index, int cycles, - size_t bytes_per_cycle, int max_data, uint32_t iov_count, + size_t bytes_per_cycle, size_t max_data, uint32_t iov_count, struct iovec *decoded_iov, int *ii, int *jj, size_t *tbw, size_t *spc) { From b7f5c17d8341a85cdf6e6708e4b078c1bb6683cf Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Wed, 18 Sep 2019 18:55:11 +0200 Subject: [PATCH 447/674] Ensure that grequestx continuously make progress Signed-off-by: Joseph Schuchart (cherry picked from commit 37e6bbb1e12a61b4a7ac90c411752a768fede67d) --- ompi/request/grequestx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ompi/request/grequestx.c b/ompi/request/grequestx.c index acd688eacf1..1cc069c2432 100644 --- a/ompi/request/grequestx.c +++ b/ompi/request/grequestx.c @@ -50,6 +50,7 @@ static int grequestx_progress(void) { } OPAL_THREAD_LOCK(&lock); } + in_progress = false; } OPAL_THREAD_UNLOCK(&lock); From 8eae54fd27ed460af9530bebbe34ddd9ea2efc59 Mon Sep 17 00:00:00 2001 From: Scott Miller Date: Mon, 14 Oct 2019 12:46:24 -0400 Subject: [PATCH 448/674] plm/rsh: Add chdir option to change directory before orted exec Signed-off-by: Scott Miller (cherry picked from commit c1b8599528feaac3c1d9ad44f0113f65eb7cc97f) Conflicts: orte/mca/plm/rsh/plm_rsh_module.c --- orte/mca/plm/rsh/plm_rsh.h | 3 ++- orte/mca/plm/rsh/plm_rsh_component.c | 10 +++++++++- orte/mca/plm/rsh/plm_rsh_module.c | 12 +++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/orte/mca/plm/rsh/plm_rsh.h b/orte/mca/plm/rsh/plm_rsh.h index c523b99c55a..1b858e89210 100644 --- a/orte/mca/plm/rsh/plm_rsh.h +++ b/orte/mca/plm/rsh/plm_rsh.h @@ -12,7 +12,7 @@ * Copyright (c) 2011 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2011 IBM Corporation. All rights reserved. + * Copyright (c) 2011-2019 IBM Corporation. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -65,6 +65,7 @@ struct orte_plm_rsh_component_t { bool pass_environ_mca_params; char *ssh_args; char *pass_libpath; + char *chdir; }; typedef struct orte_plm_rsh_component_t orte_plm_rsh_component_t; diff --git a/orte/mca/plm/rsh/plm_rsh_component.c b/orte/mca/plm/rsh/plm_rsh_component.c index bb87725befa..c78f0c0251b 100644 --- a/orte/mca/plm/rsh/plm_rsh_component.c +++ b/orte/mca/plm/rsh/plm_rsh_component.c @@ -16,7 +16,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights * reserved. * Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2011 IBM Corporation. All rights reserved. + * Copyright (c) 2011-2019 IBM Corporation. All rights reserved. * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -222,6 +222,14 @@ static int rsh_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &mca_plm_rsh_component.pass_libpath); + mca_plm_rsh_component.chdir = NULL; + (void) mca_base_component_var_register (c, "chdir", + "Change working directory after rsh/ssh, but before exec of orted", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_2, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_plm_rsh_component.chdir); + return ORTE_SUCCESS; } diff --git a/orte/mca/plm/rsh/plm_rsh_module.c b/orte/mca/plm/rsh/plm_rsh_module.c index d022fe51c29..0a795f077d1 100644 --- a/orte/mca/plm/rsh/plm_rsh_module.c +++ b/orte/mca/plm/rsh/plm_rsh_module.c @@ -13,7 +13,7 @@ * Copyright (c) 2007-2012 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2011-2017 IBM Corporation. All rights reserved. + * Copyright (c) 2011-2019 IBM Corporation. All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -501,10 +501,13 @@ static int setup_launch(int *argcptr, char ***argvptr, * we have to insert the orted_prefix in the right place */ (void)asprintf (&final_cmd, - "%s%s%s PATH=%s%s$PATH ; export PATH ; " + "%s%s%s%s%s%s PATH=%s%s$PATH ; export PATH ; " "LD_LIBRARY_PATH=%s%s$LD_LIBRARY_PATH ; export LD_LIBRARY_PATH ; " "DYLD_LIBRARY_PATH=%s%s$DYLD_LIBRARY_PATH ; export DYLD_LIBRARY_PATH ; " "%s %s", + (NULL != mca_plm_rsh_component.chdir ? "cd " : " "), + (NULL != mca_plm_rsh_component.chdir ? mca_plm_rsh_component.chdir : " "), + (NULL != mca_plm_rsh_component.chdir ? " ; " : " "), (opal_prefix != NULL ? "OPAL_PREFIX=" : " "), (opal_prefix != NULL ? opal_prefix : " "), (opal_prefix != NULL ? " ; export OPAL_PREFIX;" : " "), @@ -531,7 +534,7 @@ static int setup_launch(int *argcptr, char ***argvptr, * we have to insert the orted_prefix in the right place */ (void)asprintf (&final_cmd, - "%s%s%s set path = ( %s $path ) ; " + "%s%s%s%s%s%s set path = ( %s $path ) ; " "if ( $?LD_LIBRARY_PATH == 1 ) " "set OMPI_have_llp ; " "if ( $?LD_LIBRARY_PATH == 0 ) " @@ -545,6 +548,9 @@ static int setup_launch(int *argcptr, char ***argvptr, "if ( $?OMPI_have_dllp == 1 ) " "setenv DYLD_LIBRARY_PATH %s%s$DYLD_LIBRARY_PATH ; " "%s %s", + (NULL != mca_plm_rsh_component.chdir ? "cd " : " "), + (NULL != mca_plm_rsh_component.chdir ? mca_plm_rsh_component.chdir : " "), + (NULL != mca_plm_rsh_component.chdir ? " ; " : " "), (opal_prefix != NULL ? "setenv OPAL_PREFIX " : " "), (opal_prefix != NULL ? opal_prefix : " "), (opal_prefix != NULL ? " ;" : " "), From 628883b38bade1b49aad70d4fe3ef49fa783e463 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 1 Oct 2018 13:22:29 +0900 Subject: [PATCH 449/674] fortran/use-mpi-f08: add MPI C types Refers open-mpi/ompi#5801 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@69f1a19c5da4f3776da717ba718f6c59c3967884) --- ompi/mpi/fortran/common_sym_whitelist.txt | 43 ++++++++++++++++++- ompi/mpi/fortran/use-mpi-f08/constants.c | 39 ++++++++++++++++- .../fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 39 ++++++++++++++++- 3 files changed, 118 insertions(+), 3 deletions(-) diff --git a/ompi/mpi/fortran/common_sym_whitelist.txt b/ompi/mpi/fortran/common_sym_whitelist.txt index 1b21fe88059..8e14af4a16e 100644 --- a/ompi/mpi/fortran/common_sym_whitelist.txt +++ b/ompi/mpi/fortran/common_sym_whitelist.txt @@ -3,6 +3,7 @@ ompi_f08_mpi_2complex ompi_f08_mpi_2double_complex ompi_f08_mpi_2double_precision +ompi_f08_mpi_2int ompi_f08_mpi_2integer ompi_f08_mpi_2real ompi_f08_mpi_aint @@ -10,25 +11,45 @@ ompi_f08_mpi_band ompi_f08_mpi_bor ompi_f08_mpi_bxor ompi_f08_mpi_byte +ompi_f08_mpi_c_bool +ompi_f08_mpi_c_complex +ompi_f08_mpi_count +ompi_f08_mpi_c_double +ompi_f08_mpi_c_double_complex +ompi_f08_mpi_c_float +ompi_f08_mpi_c_float_complex +ompi_f08_mpi_char ompi_f08_mpi_character +ompi_f08_mpi_c_long_double +ompi_f08_mpi_c_long_double_complex +ompi_f08_mpi_c_offset ompi_f08_mpi_comm_null ompi_f08_mpi_comm_self ompi_f08_mpi_comm_world ompi_f08_mpi_complex -ompi_f08_mpi_complex8 ompi_f08_mpi_complex16 ompi_f08_mpi_complex32 +ompi_f08_mpi_complex8 ompi_f08_mpi_datatype_null +ompi_f08_mpi_double ompi_f08_mpi_double_complex +ompi_f08_mpi_double_int ompi_f08_mpi_double_precision ompi_f08_mpi_errhandler_null ompi_f08_mpi_errors_are_fatal ompi_f08_mpi_errors_return ompi_f08_mpi_file_null +ompi_f08_mpi_float +ompi_f08_mpi_float_int ompi_f08_mpi_group_empty ompi_f08_mpi_group_null ompi_f08_mpi_info_env ompi_f08_mpi_info_null +ompi_f08_mpi_int +ompi_f08_mpi_int16 +ompi_f08_mpi_int32 +ompi_f08_mpi_int64 +ompi_f08_mpi_int8 ompi_f08_mpi_integer ompi_f08_mpi_integer1 ompi_f08_mpi_integer16 @@ -42,6 +63,12 @@ ompi_f08_mpi_logical1 ompi_f08_mpi_logical2 ompi_f08_mpi_logical4 ompi_f08_mpi_logical8 +ompi_f08_mpi_long +ompi_f08_mpi_long_double +ompi_f08_mpi_long_double_int +ompi_f08_mpi_long_int +ompi_f08_mpi_long_long +ompi_f08_mpi_long_long_int ompi_f08_mpi_lor ompi_f08_mpi_lxor ompi_f08_mpi_max @@ -50,6 +77,7 @@ ompi_f08_mpi_message_no_proc ompi_f08_mpi_message_null ompi_f08_mpi_min ompi_f08_mpi_minloc +ompi_f08_mpi_offset ompi_f08_mpi_op_null ompi_f08_mpi_packed ompi_f08_mpi_prod @@ -60,6 +88,19 @@ ompi_f08_mpi_real4 ompi_f08_mpi_real8 ompi_f08_mpi_replace ompi_f08_mpi_request_null +ompi_f08_mpi_short +ompi_f08_mpi_short_int +ompi_f08_mpi_signed_char ompi_f08_mpi_sum ompi_f08_mpi_ub +ompi_f08_mpi_uint16 +ompi_f08_mpi_uint32 +ompi_f08_mpi_uint64 +ompi_f08_mpi_uint8 +ompi_f08_mpi_unsigned +ompi_f08_mpi_unsigned_char +ompi_f08_mpi_unsigned_long +ompi_f08_mpi_unsigned_long_long +ompi_f08_mpi_unsigned_short +ompi_f08_mpi_wchar ompi_f08_mpi_win_null diff --git a/ompi/mpi/fortran/use-mpi-f08/constants.c b/ompi/mpi/fortran/use-mpi-f08/constants.c index 377b5de99e5..9fab20b0187 100644 --- a/ompi/mpi/fortran/use-mpi-f08/constants.c +++ b/ompi/mpi/fortran/use-mpi-f08/constants.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science + * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * $COPYRIGHT$ @@ -72,26 +72,60 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_byte OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_packed = {OMPI_MPI_PACKED}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_ub = {OMPI_MPI_UB}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_lb = {OMPI_MPI_LB}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_char = {OMPI_MPI_CHAR}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_signed_char = {OMPI_MPI_SIGNED_CHAR}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_unsigned_char = {OMPI_MPI_UNSIGNED_CHAR}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_wchar = {OMPI_MPI_WCHAR}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_character = {OMPI_MPI_CHARACTER}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical = {OMPI_MPI_LOGICAL}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_int = {OMPI_MPI_INT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_int16 = {OMPI_MPI_INT16_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_int32 = {OMPI_MPI_INT32_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_int64 = {OMPI_MPI_INT64_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_int8 = {OMPI_MPI_INT8_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_uint16 = {OMPI_MPI_UINT16_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_uint32 = {OMPI_MPI_UINT32_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_uint64 = {OMPI_MPI_UINT64_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_uint8 = {OMPI_MPI_UINT8_T}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_short = {OMPI_MPI_SHORT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_unsigned_short = {OMPI_MPI_UNSIGNED_SHORT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_unsigned = {OMPI_MPI_UNSIGNED}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long = {OMPI_MPI_LONG}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_unsigned_long = {OMPI_MPI_UNSIGNED_LONG}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long_long = {OMPI_MPI_LONG_LONG}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_unsigned_long_long = {OMPI_MPI_UNSIGNED_LONG_LONG}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long_long_int = {OMPI_MPI_LONG_LONG_INT}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer = {OMPI_MPI_INTEGER}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer1 = {OMPI_MPI_INTEGER1}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer2 = {OMPI_MPI_INTEGER2}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer4 = {OMPI_MPI_INTEGER4}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer8 = {OMPI_MPI_INTEGER8}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_integer16 = {OMPI_MPI_INTEGER16}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_float = {OMPI_MPI_FLOAT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_double = {OMPI_MPI_DOUBLE}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long_double = {OMPI_MPI_LONG_DOUBLE}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_real = {OMPI_MPI_REAL}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_real4 = {OMPI_MPI_REAL4}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_real8 = {OMPI_MPI_REAL8}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_real16 = {OMPI_MPI_REAL16}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_double_precision = {OMPI_MPI_DOUBLE_PRECISION}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_complex = {OMPI_MPI_C_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_float_complex = {OMPI_MPI_C_FLOAT_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_double_complex = {OMPI_MPI_C_DOUBLE_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_long_double_complex = {OMPI_MPI_C_LONG_DOUBLE_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex = {OMPI_MPI_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex8 = {OMPI_MPI_COMPLEX8}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex16 = {OMPI_MPI_COMPLEX16}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex32 = {OMPI_MPI_COMPLEX32}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_double_complex = {OMPI_MPI_DOUBLE_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_float_int = {OMPI_MPI_FLOAT_INT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_double_int = {OMPI_MPI_DOUBLE_INT}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2real = {OMPI_MPI_2REAL}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2double_precision = {OMPI_MPI_2DOUBLE_PRECISION}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2int = {OMPI_MPI_2INT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_short_int = {OMPI_MPI_SHORT_INT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long_int = {OMPI_MPI_LONG_INT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_long_double_int = {OMPI_MPI_LONG_DOUBLE_INT}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2integer = {OMPI_MPI_2INTEGER}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2complex = {OMPI_MPI_2COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_2double_complex = {OMPI_MPI_2DOUBLE_COMPLEX}; @@ -100,3 +134,6 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logi OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical2 = {OMPI_MPI_LOGICAL2}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical4 = {OMPI_MPI_LOGICAL4}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical8 = {OMPI_MPI_LOGICAL8}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_bool = {OMPI_MPI_C_BOOL}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_count = {OMPI_MPI_COUNT}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_offset = {OMPI_MPI_OFFSET}; 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 9eabb36eb7c..44ded4700b5 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-2017 Research Organization for Information Science +! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. ! $COPYRIGHT$ ! @@ -130,26 +130,60 @@ module mpi_f08_types type(MPI_Datatype), bind(C, name="ompi_f08_mpi_packed") OMPI_PROTECTED :: MPI_PACKED type(MPI_Datatype), bind(C, name="ompi_f08_mpi_ub") OMPI_PROTECTED :: MPI_UB type(MPI_Datatype), bind(C, name="ompi_f08_mpi_lb") OMPI_PROTECTED :: MPI_LB + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_char") OMPI_PROTECTED :: MPI_CHAR + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_signed_char") OMPI_PROTECTED :: MPI_SIGNED_CHAR + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_char") OMPI_PROTECTED :: MPI_UNSIGNED_CHAR + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_wchar") OMPI_PROTECTED :: MPI_WCHAR type(MPI_Datatype), bind(C, name="ompi_f08_mpi_character") OMPI_PROTECTED :: MPI_CHARACTER type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical") OMPI_PROTECTED :: MPI_LOGICAL + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int") OMPI_PROTECTED :: MPI_INT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int16") OMPI_PROTECTED :: MPI_INT16_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int32") OMPI_PROTECTED :: MPI_INT32_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int64") OMPI_PROTECTED :: MPI_INT64_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int8") OMPI_PROTECTED :: MPI_INT8_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint16") OMPI_PROTECTED :: MPI_UINT16_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint32") OMPI_PROTECTED :: MPI_UINT32_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint64") OMPI_PROTECTED :: MPI_UINT64_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint8") OMPI_PROTECTED :: MPI_UINT8_T + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_short") OMPI_PROTECTED :: MPI_SHORT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_short") OMPI_PROTECTED :: MPI_UNSIGNED_SHORT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned") OMPI_PROTECTED :: MPI_UNSIGNED + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long") OMPI_PROTECTED :: MPI_LONG + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_long") OMPI_PROTECTED :: MPI_UNSIGNED_LONG + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_long") OMPI_PROTECTED :: MPI_LONG_LONG + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_long_long") OMPI_PROTECTED :: MPI_UNSIGNED_LONG_LONG + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_long_int") OMPI_PROTECTED :: MPI_LONG_LONG_INT type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer") OMPI_PROTECTED :: MPI_INTEGER type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer1") OMPI_PROTECTED :: MPI_INTEGER1 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer2") OMPI_PROTECTED :: MPI_INTEGER2 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer4") OMPI_PROTECTED :: MPI_INTEGER4 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer8") OMPI_PROTECTED :: MPI_INTEGER8 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer16") OMPI_PROTECTED :: MPI_INTEGER16 + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_float") OMPI_PROTECTED :: MPI_FLOAT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double") OMPI_PROTECTED :: MPI_DOUBLE + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_double") OMPI_PROTECTED :: MPI_LONG_DOUBLE type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real") OMPI_PROTECTED :: MPI_REAL type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real4") OMPI_PROTECTED :: MPI_REAL4 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real8") OMPI_PROTECTED :: MPI_REAL8 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real16") OMPI_PROTECTED :: MPI_REAL16 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_precision") OMPI_PROTECTED :: MPI_DOUBLE_PRECISION + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_complex") OMPI_PROTECTED :: MPI_C_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_float_complex") OMPI_PROTECTED :: MPI_C_FLOAT_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_double_complex") OMPI_PROTECTED :: MPI_C_DOUBLE_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_long_double_complex") OMPI_PROTECTED :: MPI_C_LONG_DOUBLE_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex") OMPI_PROTECTED :: MPI_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex8") OMPI_PROTECTED :: MPI_COMPLEX8 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex16") OMPI_PROTECTED :: MPI_COMPLEX16 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex32") OMPI_PROTECTED :: MPI_COMPLEX32 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_complex") OMPI_PROTECTED :: MPI_DOUBLE_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_float_int") OMPI_PROTECTED :: MPI_FLOAT_INT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_int") OMPI_PROTECTED :: MPI_DOUBLE_INT type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2real") OMPI_PROTECTED :: MPI_2REAL type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2double_precision") OMPI_PROTECTED :: MPI_2DOUBLE_PRECISION + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2int") OMPI_PROTECTED :: MPI_2INT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_short_int") OMPI_PROTECTED :: MPI_SHORT_INT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_int") OMPI_PROTECTED :: MPI_LONG_INT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_double_int") OMPI_PROTECTED :: MPI_LONG_DOUBLE_INT type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2integer") OMPI_PROTECTED :: MPI_2INTEGER type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2complex") OMPI_PROTECTED :: MPI_2COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2double_complex") OMPI_PROTECTED :: MPI_2DOUBLE_COMPLEX @@ -158,6 +192,9 @@ module mpi_f08_types type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical2") OMPI_PROTECTED :: MPI_LOGICAL2 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical4") OMPI_PROTECTED :: MPI_LOGICAL4 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical8") OMPI_PROTECTED :: MPI_LOGICAL8 + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_bool") OMPI_PROTECTED :: MPI_C_BOOL + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_count") OMPI_PROTECTED :: MPI_COUNT + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_offset") OMPI_PROTECTED :: MPI_OFFSET !... Special sentinel constants !------------------------------ From 792b5a01a53d78b5dbe994ad00a3653b2901a5f0 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Tue, 11 Dec 2018 09:06:21 +0900 Subject: [PATCH 450/674] fortran/use-mpi-f08: Remove unnecessary `;` Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit open-mpi/ompi@e0c5bad1955a49efe75b4664be2a83135daf81a1) --- .../fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) 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 44ded4700b5..d17f659693f 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 @@ -107,16 +107,16 @@ module mpi_f08_types ! NULL "handles" (indices) ! - type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_null") OMPI_PROTECTED :: MPI_COMM_NULL; - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_datatype_null") OMPI_PROTECTED :: MPI_DATATYPE_NULL; - type(MPI_Errhandler), bind(C, name="ompi_f08_mpi_errhandler_null") OMPI_PROTECTED :: MPI_ERRHANDLER_NULL; - type(MPI_Group), bind(C, name="ompi_f08_mpi_group_null") OMPI_PROTECTED :: MPI_GROUP_NULL; - type(MPI_Info), bind(C, name="ompi_f08_mpi_info_null") OMPI_PROTECTED :: MPI_INFO_NULL; - type(MPI_Message), bind(C, name="ompi_f08_mpi_message_null") OMPI_PROTECTED :: MPI_MESSAGE_NULL; - type(MPI_Op), bind(C, name="ompi_f08_mpi_op_null") OMPI_PROTECTED :: MPI_OP_NULL; - type(MPI_Request), bind(C, name="ompi_f08_mpi_request_null") OMPI_PROTECTED :: MPI_REQUEST_NULL; - type(MPI_Win), bind(C, name="ompi_f08_mpi_win_null") OMPI_PROTECTED :: MPI_WIN_NULL; - type(MPI_File), bind(C, name="ompi_f08_mpi_file_null") OMPI_PROTECTED :: MPI_FILE_NULL; + type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_null") OMPI_PROTECTED :: MPI_COMM_NULL + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_datatype_null") OMPI_PROTECTED :: MPI_DATATYPE_NULL + type(MPI_Errhandler), bind(C, name="ompi_f08_mpi_errhandler_null") OMPI_PROTECTED :: MPI_ERRHANDLER_NULL + type(MPI_Group), bind(C, name="ompi_f08_mpi_group_null") OMPI_PROTECTED :: MPI_GROUP_NULL + type(MPI_Info), bind(C, name="ompi_f08_mpi_info_null") OMPI_PROTECTED :: MPI_INFO_NULL + type(MPI_Message), bind(C, name="ompi_f08_mpi_message_null") OMPI_PROTECTED :: MPI_MESSAGE_NULL + type(MPI_Op), bind(C, name="ompi_f08_mpi_op_null") OMPI_PROTECTED :: MPI_OP_NULL + type(MPI_Request), bind(C, name="ompi_f08_mpi_request_null") OMPI_PROTECTED :: MPI_REQUEST_NULL + type(MPI_Win), bind(C, name="ompi_f08_mpi_win_null") OMPI_PROTECTED :: MPI_WIN_NULL + type(MPI_File), bind(C, name="ompi_f08_mpi_file_null") OMPI_PROTECTED :: MPI_FILE_NULL ! ! Pre-defined datatype bindings From 56d2865cf6a0e486e4f13e4254a042ab1e967243 Mon Sep 17 00:00:00 2001 From: KAWASHIMA Takahiro Date: Tue, 11 Dec 2018 12:58:43 +0900 Subject: [PATCH 451/674] fortran/use-mpi-f08: Add C++ datatypes and MPI_NO_OP Though the MPI standard does not have `MPI_CXX_COMPLEX`, `mpi.h`, `mpif.h`, and `mpi.mod` have it. So I added it for consistency. Signed-off-by: KAWASHIMA Takahiro (cherry picked from commit open-mpi/ompi@63ecf01610e2767029e91537fe9fa94e86953297) --- ompi/mpi/fortran/common_sym_whitelist.txt | 10 ++++++---- ompi/mpi/fortran/use-mpi-f08/constants.c | 7 +++++++ ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 7 +++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ompi/mpi/fortran/common_sym_whitelist.txt b/ompi/mpi/fortran/common_sym_whitelist.txt index 8e14af4a16e..539df317720 100644 --- a/ompi/mpi/fortran/common_sym_whitelist.txt +++ b/ompi/mpi/fortran/common_sym_whitelist.txt @@ -14,15 +14,11 @@ ompi_f08_mpi_byte ompi_f08_mpi_c_bool ompi_f08_mpi_c_complex ompi_f08_mpi_count -ompi_f08_mpi_c_double ompi_f08_mpi_c_double_complex -ompi_f08_mpi_c_float ompi_f08_mpi_c_float_complex ompi_f08_mpi_char ompi_f08_mpi_character -ompi_f08_mpi_c_long_double ompi_f08_mpi_c_long_double_complex -ompi_f08_mpi_c_offset ompi_f08_mpi_comm_null ompi_f08_mpi_comm_self ompi_f08_mpi_comm_world @@ -30,6 +26,11 @@ ompi_f08_mpi_complex ompi_f08_mpi_complex16 ompi_f08_mpi_complex32 ompi_f08_mpi_complex8 +ompi_f08_mpi_cxx_bool +ompi_f08_mpi_cxx_complex +ompi_f08_mpi_cxx_double_complex +ompi_f08_mpi_cxx_float_complex +ompi_f08_mpi_cxx_long_double_complex ompi_f08_mpi_datatype_null ompi_f08_mpi_double ompi_f08_mpi_double_complex @@ -77,6 +78,7 @@ ompi_f08_mpi_message_no_proc ompi_f08_mpi_message_null ompi_f08_mpi_min ompi_f08_mpi_minloc +ompi_f08_mpi_no_op ompi_f08_mpi_offset ompi_f08_mpi_op_null ompi_f08_mpi_packed diff --git a/ompi/mpi/fortran/use-mpi-f08/constants.c b/ompi/mpi/fortran/use-mpi-f08/constants.c index 9fab20b0187..4626ce24386 100644 --- a/ompi/mpi/fortran/use-mpi-f08/constants.c +++ b/ompi/mpi/fortran/use-mpi-f08/constants.c @@ -3,6 +3,7 @@ * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * This file provides symbols for the derived type values needed @@ -49,6 +50,7 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_bxor OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_maxloc = {OMPI_MPI_MAXLOC}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_minloc = {OMPI_MPI_MINLOC}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_replace = {OMPI_MPI_REPLACE}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_no_op = {OMPI_MPI_NO_OP}; /* * NULL "handles" (indices) @@ -113,6 +115,10 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_co OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_float_complex = {OMPI_MPI_C_FLOAT_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_double_complex = {OMPI_MPI_C_DOUBLE_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_long_double_complex = {OMPI_MPI_C_LONG_DOUBLE_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_complex = {OMPI_MPI_CXX_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_float_complex = {OMPI_MPI_CXX_FLOAT_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_double_complex = {OMPI_MPI_CXX_DOUBLE_COMPLEX}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_long_double_complex = {OMPI_MPI_CXX_LONG_DOUBLE_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex = {OMPI_MPI_COMPLEX}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex8 = {OMPI_MPI_COMPLEX8}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_complex16 = {OMPI_MPI_COMPLEX16}; @@ -135,5 +141,6 @@ OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logi OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical4 = {OMPI_MPI_LOGICAL4}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_logical8 = {OMPI_MPI_LOGICAL8}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_c_bool = {OMPI_MPI_C_BOOL}; +OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_cxx_bool = {OMPI_MPI_CXX_BOOL}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_count = {OMPI_MPI_COUNT}; OMPI_DECLSPEC ompi_fortran_08_handle_t OMPI_F08_HANDLE_ALIGNED ompi_f08_mpi_offset = {OMPI_MPI_OFFSET}; 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 d17f659693f..60426a5e414 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 @@ -5,6 +5,7 @@ ! All rights reserved. ! Copyright (c) 2015-2018 Research Organization for Information Science ! and Technology (RIST). All rights reserved. +! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! ! This file creates mappings between MPI C types (e.g., MPI_Comm) and @@ -102,6 +103,7 @@ module mpi_f08_types type(MPI_Op), bind(C, name="ompi_f08_mpi_maxloc" ) OMPI_PROTECTED :: MPI_MAXLOC type(MPI_Op), bind(C, name="ompi_f08_mpi_minloc" ) OMPI_PROTECTED :: MPI_MINLOC type(MPI_Op), bind(C, name="ompi_f08_mpi_replace" ) OMPI_PROTECTED :: MPI_REPLACE + type(MPI_Op), bind(C, name="ompi_f08_mpi_no_op" ) OMPI_PROTECTED :: MPI_NO_OP ! ! NULL "handles" (indices) @@ -171,6 +173,10 @@ module mpi_f08_types type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_float_complex") OMPI_PROTECTED :: MPI_C_FLOAT_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_double_complex") OMPI_PROTECTED :: MPI_C_DOUBLE_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_long_double_complex") OMPI_PROTECTED :: MPI_C_LONG_DOUBLE_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_complex") OMPI_PROTECTED :: MPI_CXX_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_float_complex") OMPI_PROTECTED :: MPI_CXX_FLOAT_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_double_complex") OMPI_PROTECTED :: MPI_CXX_DOUBLE_COMPLEX + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_long_double_complex") OMPI_PROTECTED :: MPI_CXX_LONG_DOUBLE_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex") OMPI_PROTECTED :: MPI_COMPLEX type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex8") OMPI_PROTECTED :: MPI_COMPLEX8 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex16") OMPI_PROTECTED :: MPI_COMPLEX16 @@ -193,6 +199,7 @@ module mpi_f08_types type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical4") OMPI_PROTECTED :: MPI_LOGICAL4 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical8") OMPI_PROTECTED :: MPI_LOGICAL8 type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_bool") OMPI_PROTECTED :: MPI_C_BOOL + type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_bool") OMPI_PROTECTED :: MPI_CXX_BOOL type(MPI_Datatype), bind(C, name="ompi_f08_mpi_count") OMPI_PROTECTED :: MPI_COUNT type(MPI_Datatype), bind(C, name="ompi_f08_mpi_offset") OMPI_PROTECTED :: MPI_OFFSET From 23ed2f44a26eed17cd7743aec0273c509ad46731 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 24 Oct 2019 11:05:29 +0900 Subject: [PATCH 452/674] fortran/use-mpi-f08: revamp constant declarations In order to work around an issue with flang based compilers, avoid declaring bind(C) constants and use plain Fortran parameter instead. For example, type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_world") OMPI_PROTECTED :: MPI_COMM_WORLD is changed to type(MPI_Comm), parameter :: MPI_COMM_WORLD = MPI_Comm(OMPI_MPI_COMM_WORLD) Note that in order to preserve ABI compatibility, ompi/mpi/fortran/use-mpi-f08/constants.{c,h} have been kept even if its symbols are no more referenced by Open MPI. Refs. open-mpi/ompi#7091 Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@b10a60a5a935991a6000585298e0061a6159cd0d) --- .gitignore | 1 + ompi/include/mpif-values.pl | 62 ++++- ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am | 1 + .../fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 217 +++++++++--------- 4 files changed, 171 insertions(+), 110 deletions(-) diff --git a/.gitignore b/.gitignore index d9de74cae8f..07c17512a1b 100644 --- a/.gitignore +++ b/.gitignore @@ -213,6 +213,7 @@ ompi/mpi/fortran/mpif-h/sizeof_f.f90 ompi/mpi/fortran/mpif-h/profile/p*.c ompi/mpi/fortran/mpif-h/profile/psizeof_f.f90 +ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h ompi/mpi/fortran/use-mpi-f08/constants.h ompi/mpi/fortran/use-mpi-f08/sizeof_f08.f90 ompi/mpi/fortran/use-mpi-f08/sizeof_f08.h diff --git a/ompi/include/mpif-values.pl b/ompi/include/mpif-values.pl index 1b955ec50d1..70026216eb4 100755 --- a/ompi/include/mpif-values.pl +++ b/ompi/include/mpif-values.pl @@ -1,8 +1,8 @@ #!/usr/bin/env perl # # Copyright (c) 2011-2014 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2016-2017 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2016-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2016 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -526,4 +526,62 @@ sub write_fortran_file { write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/constants.h", $output); +$output = '! WARNING! THIS IS A GENERATED FILE!! +! ANY EDITS YOU PUT HERE WILL BE LOST! +! Instead, edit topdir/ompi/include/mpif-values.pl +! + +! +! Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +! University Research and Technology +! Corporation. All rights reserved. +! Copyright (c) 2004-2006 The University of Tennessee and The University +! of Tennessee Research Foundation. All rights +! reserved. +! Copyright (c) 2004-2007 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) 2007-2009 Cisco Systems, Inc. All rights reserved. +! Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. +! Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +! Copyright (c) 2009-2012 Los Alamos National Security, LLC. +! All rights reserved. +! Copyright (c) 2016-2019 Research Organization for Information Science +! and Technology (RIST). All rights reserved. +! $COPYRIGHT$ +! +! Additional copyrights may follow +! +! $HEADER$ +! + +#ifndef USE_MPI_F08_CONSTANTS_H +#define USE_MPI_F08_CONSTANTS_H + +'; + +foreach my $key (sort(keys(%{$constants}))) { + $output .= "#define OMPI_$key $constants->{$key}\n"; +} +$output .= "\n"; +foreach my $key (sort(keys(%{$handles}))) { + $output .= "#define OMPI_$key $handles->{$key}\n"; +} + +foreach my $key (sort(keys(%{$io_constants}))) { + $output .= "#define OMPI_$key $io_constants->{$key}\n"; +} +foreach my $key (sort(keys(%{$lio_constants}))) { + $output .= "#define OMPI_$key $lio_constants->{$key}\n"; +} +$output .= "\n"; +foreach my $key (sort(keys(%{$io_handles}))) { + $output .= "#define OMPI_$key $io_handles->{$key}\n"; +} +$output .= "\n"; +$output .= "#endif\n"; + +write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h", $output); + exit(0); diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index 45b7753b2be..9bd3a7a4576 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am @@ -48,6 +48,7 @@ libforce_usempif08_internal_modules_to_be_built_la_SOURCES = \ mpi-f08-interfaces.F90 \ mpi-f08-interfaces-callbacks.F90 \ mpi-f08-callbacks.F90 \ + mpi-f08-constants.h \ pmpi-f08-interfaces.F90 config_h = \ 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 60426a5e414..9aafbf72ba9 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,8 +3,8 @@ ! 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-2018 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2015-2019 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. ! $COPYRIGHT$ ! @@ -13,6 +13,7 @@ ! (type(MPI_Comm_world) and MPI_COMM_WORLD, respectively). #include "ompi/mpi/fortran/configure-fortran-output.h" +#include "ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h" module mpi_f08_types @@ -78,47 +79,47 @@ module mpi_f08_types ! Pre-defined handles ! - type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_world") OMPI_PROTECTED :: MPI_COMM_WORLD - type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_self") OMPI_PROTECTED :: MPI_COMM_SELF + type(MPI_Comm), parameter :: MPI_COMM_WORLD = MPI_Comm(OMPI_MPI_COMM_WORLD) + type(MPI_Comm), parameter :: MPI_COMM_SELF = MPI_Comm(OMPI_MPI_COMM_SELF) - type(MPI_Group), bind(C, name="ompi_f08_mpi_group_empty") OMPI_PROTECTED :: MPI_GROUP_EMPTY + type(MPI_Group), parameter :: MPI_GROUP_EMPTY = MPI_Group(OMPI_MPI_GROUP_EMPTY) - type(MPI_Errhandler), bind(C, name="ompi_f08_mpi_errors_are_fatal") OMPI_PROTECTED :: MPI_ERRORS_ARE_FATAL - type(MPI_Errhandler), bind(C, name="ompi_f08_mpi_errors_return") OMPI_PROTECTED :: MPI_ERRORS_RETURN + type(MPI_Errhandler), parameter :: MPI_ERRORS_ARE_FATAL = MPI_Errhandler(OMPI_MPI_ERRORS_ARE_FATAL) + type(MPI_Errhandler), parameter :: MPI_ERRORS_RETURN = MPI_Errhandler(OMPI_MPI_ERRORS_RETURN) - type(MPI_Message), bind(C, name="ompi_f08_mpi_message_no_proc") OMPI_PROTECTED :: MPI_MESSAGE_NO_PROC + type(MPI_Message), parameter :: MPI_MESSAGE_NO_PROC = MPI_Message(OMPI_MPI_MESSAGE_NO_PROC) - type(MPI_Info), bind(C, name="ompi_f08_mpi_info_env") OMPI_PROTECTED :: MPI_INFO_ENV + type(MPI_Info), parameter :: MPI_INFO_ENV = MPI_Info(OMPI_MPI_INFO_ENV) - type(MPI_Op), bind(C, name="ompi_f08_mpi_max" ) OMPI_PROTECTED :: MPI_MAX - type(MPI_Op), bind(C, name="ompi_f08_mpi_min" ) OMPI_PROTECTED :: MPI_MIN - type(MPI_Op), bind(C, name="ompi_f08_mpi_sum" ) OMPI_PROTECTED :: MPI_SUM - type(MPI_Op), bind(C, name="ompi_f08_mpi_prod" ) OMPI_PROTECTED :: MPI_PROD - type(MPI_Op), bind(C, name="ompi_f08_mpi_land" ) OMPI_PROTECTED :: MPI_LAND - type(MPI_Op), bind(C, name="ompi_f08_mpi_band" ) OMPI_PROTECTED :: MPI_BAND - type(MPI_Op), bind(C, name="ompi_f08_mpi_lor" ) OMPI_PROTECTED :: MPI_LOR - type(MPI_Op), bind(C, name="ompi_f08_mpi_bor" ) OMPI_PROTECTED :: MPI_BOR - type(MPI_Op), bind(C, name="ompi_f08_mpi_lxor" ) OMPI_PROTECTED :: MPI_LXOR - type(MPI_Op), bind(C, name="ompi_f08_mpi_bxor" ) OMPI_PROTECTED :: MPI_BXOR - type(MPI_Op), bind(C, name="ompi_f08_mpi_maxloc" ) OMPI_PROTECTED :: MPI_MAXLOC - type(MPI_Op), bind(C, name="ompi_f08_mpi_minloc" ) OMPI_PROTECTED :: MPI_MINLOC - type(MPI_Op), bind(C, name="ompi_f08_mpi_replace" ) OMPI_PROTECTED :: MPI_REPLACE - type(MPI_Op), bind(C, name="ompi_f08_mpi_no_op" ) OMPI_PROTECTED :: MPI_NO_OP + type(MPI_Op), parameter :: MPI_MAX = MPI_Op(OMPI_MPI_MAX) + type(MPI_Op), parameter :: MPI_MIN = MPI_Op(OMPI_MPI_MIN) + type(MPI_Op), parameter :: MPI_SUM = MPI_Op(OMPI_MPI_SUM) + type(MPI_Op), parameter :: MPI_PROD = MPI_Op(OMPI_MPI_PROD) + type(MPI_Op), parameter :: MPI_LAND = MPI_Op(OMPI_MPI_LAND) + type(MPI_Op), parameter :: MPI_BAND = MPI_Op(OMPI_MPI_BAND) + type(MPI_Op), parameter :: MPI_LOR = MPI_Op(OMPI_MPI_LOR) + type(MPI_Op), parameter :: MPI_BOR = MPI_Op(OMPI_MPI_BOR) + type(MPI_Op), parameter :: MPI_LXOR = MPI_Op(OMPI_MPI_LXOR) + type(MPI_Op), parameter :: MPI_BXOR = MPI_Op(OMPI_MPI_BXOR) + type(MPI_Op), parameter :: MPI_MAXLOC = MPI_Op(OMPI_MPI_MAXLOC) + type(MPI_Op), parameter :: MPI_MINLOC = MPI_Op(OMPI_MPI_MINLOC) + type(MPI_Op), parameter :: MPI_REPLACE = MPI_Op(OMPI_MPI_REPLACE) + type(MPI_Op), parameter :: MPI_NO_OP = MPI_Op(OMPI_MPI_NO_OP) ! ! NULL "handles" (indices) ! - type(MPI_Comm), bind(C, name="ompi_f08_mpi_comm_null") OMPI_PROTECTED :: MPI_COMM_NULL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_datatype_null") OMPI_PROTECTED :: MPI_DATATYPE_NULL - type(MPI_Errhandler), bind(C, name="ompi_f08_mpi_errhandler_null") OMPI_PROTECTED :: MPI_ERRHANDLER_NULL - type(MPI_Group), bind(C, name="ompi_f08_mpi_group_null") OMPI_PROTECTED :: MPI_GROUP_NULL - type(MPI_Info), bind(C, name="ompi_f08_mpi_info_null") OMPI_PROTECTED :: MPI_INFO_NULL - type(MPI_Message), bind(C, name="ompi_f08_mpi_message_null") OMPI_PROTECTED :: MPI_MESSAGE_NULL - type(MPI_Op), bind(C, name="ompi_f08_mpi_op_null") OMPI_PROTECTED :: MPI_OP_NULL - type(MPI_Request), bind(C, name="ompi_f08_mpi_request_null") OMPI_PROTECTED :: MPI_REQUEST_NULL - type(MPI_Win), bind(C, name="ompi_f08_mpi_win_null") OMPI_PROTECTED :: MPI_WIN_NULL - type(MPI_File), bind(C, name="ompi_f08_mpi_file_null") OMPI_PROTECTED :: MPI_FILE_NULL + type(MPI_Comm), parameter :: MPI_COMM_NULL = MPI_Comm(OMPI_MPI_COMM_NULL) + type(MPI_Datatype), parameter :: MPI_DATATYPE_NULL = MPI_Datatype(OMPI_MPI_COMM_NULL) + type(MPI_Errhandler), parameter:: MPI_ERRHANDLER_NULL = MPI_Errhandler(OMPI_MPI_ERRHANDLER_NULL) + type(MPI_Group), parameter :: MPI_GROUP_NULL = MPI_Group(OMPI_MPI_GROUP_NULL) + type(MPI_Info), parameter :: MPI_INFO_NULL = MPI_Info(OMPI_MPI_INFO_NULL) + type(MPI_Message), parameter :: MPI_MESSAGE_NULL = MPI_Message(OMPI_MPI_MESSAGE_NULL) + type(MPI_Op), parameter :: MPI_OP_NULL = MPI_Op(OMPI_MPI_OP_NULL) + type(MPI_Request), parameter :: MPI_REQUEST_NULL = MPI_Request(OMPI_MPI_REQUEST_NULL) + type(MPI_Win), parameter :: MPI_WIN_NULL = MPI_Win(OMPI_MPI_WIN_NULL) + type(MPI_File), parameter :: MPI_FILE_NULL = MPI_File(OMPI_MPI_FILE_NULL) ! ! Pre-defined datatype bindings @@ -127,81 +128,81 @@ module mpi_f08_types ! They are defined in ompi/runtime/ompi_mpi_init.c ! - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_aint") OMPI_PROTECTED :: MPI_AINT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_byte") OMPI_PROTECTED :: MPI_BYTE - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_packed") OMPI_PROTECTED :: MPI_PACKED - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_ub") OMPI_PROTECTED :: MPI_UB - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_lb") OMPI_PROTECTED :: MPI_LB - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_char") OMPI_PROTECTED :: MPI_CHAR - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_signed_char") OMPI_PROTECTED :: MPI_SIGNED_CHAR - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_char") OMPI_PROTECTED :: MPI_UNSIGNED_CHAR - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_wchar") OMPI_PROTECTED :: MPI_WCHAR - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_character") OMPI_PROTECTED :: MPI_CHARACTER - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical") OMPI_PROTECTED :: MPI_LOGICAL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int") OMPI_PROTECTED :: MPI_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int16") OMPI_PROTECTED :: MPI_INT16_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int32") OMPI_PROTECTED :: MPI_INT32_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int64") OMPI_PROTECTED :: MPI_INT64_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_int8") OMPI_PROTECTED :: MPI_INT8_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint16") OMPI_PROTECTED :: MPI_UINT16_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint32") OMPI_PROTECTED :: MPI_UINT32_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint64") OMPI_PROTECTED :: MPI_UINT64_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_uint8") OMPI_PROTECTED :: MPI_UINT8_T - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_short") OMPI_PROTECTED :: MPI_SHORT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_short") OMPI_PROTECTED :: MPI_UNSIGNED_SHORT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned") OMPI_PROTECTED :: MPI_UNSIGNED - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long") OMPI_PROTECTED :: MPI_LONG - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_long") OMPI_PROTECTED :: MPI_UNSIGNED_LONG - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_long") OMPI_PROTECTED :: MPI_LONG_LONG - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_unsigned_long_long") OMPI_PROTECTED :: MPI_UNSIGNED_LONG_LONG - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_long_int") OMPI_PROTECTED :: MPI_LONG_LONG_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer") OMPI_PROTECTED :: MPI_INTEGER - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer1") OMPI_PROTECTED :: MPI_INTEGER1 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer2") OMPI_PROTECTED :: MPI_INTEGER2 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer4") OMPI_PROTECTED :: MPI_INTEGER4 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer8") OMPI_PROTECTED :: MPI_INTEGER8 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_integer16") OMPI_PROTECTED :: MPI_INTEGER16 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_float") OMPI_PROTECTED :: MPI_FLOAT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double") OMPI_PROTECTED :: MPI_DOUBLE - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_double") OMPI_PROTECTED :: MPI_LONG_DOUBLE - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real") OMPI_PROTECTED :: MPI_REAL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real4") OMPI_PROTECTED :: MPI_REAL4 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real8") OMPI_PROTECTED :: MPI_REAL8 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real16") OMPI_PROTECTED :: MPI_REAL16 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_precision") OMPI_PROTECTED :: MPI_DOUBLE_PRECISION - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_complex") OMPI_PROTECTED :: MPI_C_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_float_complex") OMPI_PROTECTED :: MPI_C_FLOAT_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_double_complex") OMPI_PROTECTED :: MPI_C_DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_long_double_complex") OMPI_PROTECTED :: MPI_C_LONG_DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_complex") OMPI_PROTECTED :: MPI_CXX_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_float_complex") OMPI_PROTECTED :: MPI_CXX_FLOAT_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_double_complex") OMPI_PROTECTED :: MPI_CXX_DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_long_double_complex") OMPI_PROTECTED :: MPI_CXX_LONG_DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex") OMPI_PROTECTED :: MPI_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex8") OMPI_PROTECTED :: MPI_COMPLEX8 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex16") OMPI_PROTECTED :: MPI_COMPLEX16 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_complex32") OMPI_PROTECTED :: MPI_COMPLEX32 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_complex") OMPI_PROTECTED :: MPI_DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_float_int") OMPI_PROTECTED :: MPI_FLOAT_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_double_int") OMPI_PROTECTED :: MPI_DOUBLE_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2real") OMPI_PROTECTED :: MPI_2REAL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2double_precision") OMPI_PROTECTED :: MPI_2DOUBLE_PRECISION - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2int") OMPI_PROTECTED :: MPI_2INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_short_int") OMPI_PROTECTED :: MPI_SHORT_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_int") OMPI_PROTECTED :: MPI_LONG_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_long_double_int") OMPI_PROTECTED :: MPI_LONG_DOUBLE_INT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2integer") OMPI_PROTECTED :: MPI_2INTEGER - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2complex") OMPI_PROTECTED :: MPI_2COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_2double_complex") OMPI_PROTECTED :: MPI_2DOUBLE_COMPLEX - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_real2") OMPI_PROTECTED :: MPI_REAL2 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical1") OMPI_PROTECTED :: MPI_LOGICAL1 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical2") OMPI_PROTECTED :: MPI_LOGICAL2 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical4") OMPI_PROTECTED :: MPI_LOGICAL4 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_logical8") OMPI_PROTECTED :: MPI_LOGICAL8 - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_c_bool") OMPI_PROTECTED :: MPI_C_BOOL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_cxx_bool") OMPI_PROTECTED :: MPI_CXX_BOOL - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_count") OMPI_PROTECTED :: MPI_COUNT - type(MPI_Datatype), bind(C, name="ompi_f08_mpi_offset") OMPI_PROTECTED :: MPI_OFFSET + type(MPI_Datatype), parameter :: MPI_AINT = MPI_Datatype(OMPI_MPI_AINT) + type(MPI_Datatype), parameter :: MPI_BYTE = MPI_Datatype(OMPI_MPI_BYTE) + type(MPI_Datatype), parameter :: MPI_PACKED = MPI_Datatype(OMPI_MPI_PACKED) + type(MPI_Datatype), parameter :: MPI_UB = MPI_Datatype(OMPI_MPI_UB) + type(MPI_Datatype), parameter :: MPI_LB = MPI_Datatype(OMPI_MPI_LB) + type(MPI_Datatype), parameter :: MPI_CHAR = MPI_Datatype(OMPI_MPI_CHAR) + type(MPI_Datatype), parameter :: MPI_SIGNED_CHAR = MPI_Datatype(OMPI_MPI_SIGNED_CHAR) + type(MPI_Datatype), parameter :: MPI_UNSIGNED_CHAR = MPI_Datatype(OMPI_MPI_UNSIGNED_CHAR) + type(MPI_Datatype), parameter :: MPI_WCHAR = MPI_Datatype(OMPI_MPI_WCHAR) + type(MPI_Datatype), parameter :: MPI_CHARACTER = MPI_Datatype(OMPI_MPI_CHARACTER) + type(MPI_Datatype), parameter :: MPI_LOGICAL = MPI_Datatype(OMPI_MPI_LOGICAL) + type(MPI_Datatype), parameter :: MPI_INT = MPI_Datatype(OMPI_MPI_INT) + type(MPI_Datatype), parameter :: MPI_INT16_T = MPI_Datatype(OMPI_MPI_INT16_T) + type(MPI_Datatype), parameter :: MPI_INT32_T = MPI_Datatype(OMPI_MPI_INT32_T) + type(MPI_Datatype), parameter :: MPI_INT64_T = MPI_Datatype(OMPI_MPI_INT64_T) + type(MPI_Datatype), parameter :: MPI_INT8_T = MPI_Datatype(OMPI_MPI_INT8_T) + type(MPI_Datatype), parameter :: MPI_UINT16_T = MPI_Datatype(OMPI_MPI_UINT16_T) + type(MPI_Datatype), parameter :: MPI_UINT32_T = MPI_Datatype(OMPI_MPI_UINT32_T) + type(MPI_Datatype), parameter :: MPI_UINT64_T = MPI_Datatype(OMPI_MPI_UINT64_T) + type(MPI_Datatype), parameter :: MPI_UINT8_T = MPI_Datatype(OMPI_MPI_UINT8_T) + type(MPI_Datatype), parameter :: MPI_SHORT = MPI_Datatype(OMPI_MPI_SHORT) + type(MPI_Datatype), parameter :: MPI_UNSIGNED_SHORT = MPI_Datatype(OMPI_MPI_UNSIGNED_SHORT) + type(MPI_Datatype), parameter :: MPI_UNSIGNED = MPI_Datatype(OMPI_MPI_UNSIGNED) + type(MPI_Datatype), parameter :: MPI_LONG = MPI_Datatype(OMPI_MPI_LONG) + type(MPI_Datatype), parameter :: MPI_UNSIGNED_LONG = MPI_Datatype(OMPI_MPI_UNSIGNED_LONG) + type(MPI_Datatype), parameter :: MPI_LONG_LONG = MPI_Datatype(OMPI_MPI_LONG_LONG) + type(MPI_Datatype), parameter :: MPI_UNSIGNED_LONG_LONG = MPI_Datatype(OMPI_MPI_UNSIGNED_LONG_LONG) + type(MPI_Datatype), parameter :: MPI_LONG_LONG_INT = MPI_Datatype(OMPI_MPI_LONG_LONG_INT) + type(MPI_Datatype), parameter :: MPI_INTEGER = MPI_Datatype(OMPI_MPI_INTEGER) + type(MPI_Datatype), parameter :: MPI_INTEGER1 = MPI_Datatype(OMPI_MPI_INTEGER1) + type(MPI_Datatype), parameter :: MPI_INTEGER2 = MPI_Datatype(OMPI_MPI_INTEGER2) + type(MPI_Datatype), parameter :: MPI_INTEGER4 = MPI_Datatype(OMPI_MPI_INTEGER4) + type(MPI_Datatype), parameter :: MPI_INTEGER8 = MPI_Datatype(OMPI_MPI_INTEGER8) + type(MPI_Datatype), parameter :: MPI_INTEGER16 = MPI_Datatype(OMPI_MPI_INTEGER16) + type(MPI_Datatype), parameter :: MPI_FLOAT = MPI_Datatype(OMPI_MPI_FLOAT) + type(MPI_Datatype), parameter :: MPI_DOUBLE = MPI_Datatype(OMPI_MPI_DOUBLE) + type(MPI_Datatype), parameter :: MPI_LONG_DOUBLE = MPI_Datatype(OMPI_MPI_LONG_DOUBLE) + type(MPI_Datatype), parameter :: MPI_REAL = MPI_Datatype(OMPI_MPI_REAL) + type(MPI_Datatype), parameter :: MPI_REAL4 = MPI_Datatype(OMPI_MPI_REAL4) + type(MPI_Datatype), parameter :: MPI_REAL8 = MPI_Datatype(OMPI_MPI_REAL8) + type(MPI_Datatype), parameter :: MPI_REAL16 = MPI_Datatype(OMPI_MPI_REAL16) + type(MPI_Datatype), parameter :: MPI_DOUBLE_PRECISION = MPI_Datatype(OMPI_MPI_DOUBLE_PRECISION) + type(MPI_Datatype), parameter :: MPI_C_COMPLEX = MPI_Datatype(OMPI_MPI_C_COMPLEX) + type(MPI_Datatype), parameter :: MPI_C_FLOAT_COMPLEX = MPI_Datatype(OMPI_MPI_C_FLOAT_COMPLEX) + type(MPI_Datatype), parameter :: MPI_C_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_C_DOUBLE_COMPLEX) + type(MPI_Datatype), parameter :: MPI_C_LONG_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_C_LONG_DOUBLE_COMPLEX) + type(MPI_Datatype), parameter :: MPI_CXX_COMPLEX = MPI_Datatype(OMPI_MPI_CXX_COMPLEX) + type(MPI_Datatype), parameter :: MPI_CXX_FLOAT_COMPLEX = MPI_Datatype(OMPI_MPI_CXX_FLOAT_COMPLEX) + type(MPI_Datatype), parameter :: MPI_CXX_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_CXX_DOUBLE_COMPLEX) + type(MPI_Datatype), parameter :: MPI_CXX_LONG_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_CXX_LONG_DOUBLE_COMPLEX) + type(MPI_Datatype), parameter :: MPI_COMPLEX = MPI_Datatype(OMPI_MPI_COMPLEX) + type(MPI_Datatype), parameter :: MPI_COMPLEX8 = MPI_Datatype(OMPI_MPI_COMPLEX8) + type(MPI_Datatype), parameter :: MPI_COMPLEX16 = MPI_Datatype(OMPI_MPI_COMPLEX16) + type(MPI_Datatype), parameter :: MPI_COMPLEX32 = MPI_Datatype(OMPI_MPI_COMPLEX32) + type(MPI_Datatype), parameter :: MPI_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_COMPLEX) + type(MPI_Datatype), parameter :: MPI_FLOAT_INT = MPI_Datatype(OMPI_MPI_FLOAT_INT) + type(MPI_Datatype), parameter :: MPI_DOUBLE_INT = MPI_Datatype(OMPI_MPI_DOUBLE_INT) + type(MPI_Datatype), parameter :: MPI_2REAL = MPI_Datatype(OMPI_MPI_2REAL) + type(MPI_Datatype), parameter :: MPI_2DOUBLE_PRECISION = MPI_Datatype(OMPI_MPI_2DOUBLE_PRECISION) + type(MPI_Datatype), parameter :: MPI_2INT = MPI_Datatype(OMPI_MPI_2INT) + type(MPI_Datatype), parameter :: MPI_SHORT_INT = MPI_Datatype(OMPI_MPI_SHORT_INT) + type(MPI_Datatype), parameter :: MPI_LONG_INT = MPI_Datatype(OMPI_MPI_LONG_INT) + type(MPI_Datatype), parameter :: MPI_LONG_DOUBLE_INT = MPI_Datatype(OMPI_MPI_LONG_DOUBLE_INT) + type(MPI_Datatype), parameter :: MPI_2INTEGER = MPI_Datatype(OMPI_MPI_2INTEGER) + type(MPI_Datatype), parameter :: MPI_2COMPLEX = MPI_Datatype(OMPI_MPI_2COMPLEX) + type(MPI_Datatype), parameter :: MPI_2DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_2DOUBLE_COMPLEX) + type(MPI_Datatype), parameter :: MPI_REAL2 = MPI_Datatype(OMPI_MPI_REAL2) + type(MPI_Datatype), parameter :: MPI_LOGICAL1 = MPI_Datatype(OMPI_MPI_LOGICAL1) + type(MPI_Datatype), parameter :: MPI_LOGICAL2 = MPI_Datatype(OMPI_MPI_LOGICAL2) + type(MPI_Datatype), parameter :: MPI_LOGICAL4 = MPI_Datatype(OMPI_MPI_LOGICAL4) + type(MPI_Datatype), parameter :: MPI_LOGICAL8 = MPI_Datatype(OMPI_MPI_LOGICAL8) + type(MPI_Datatype), parameter :: MPI_C_BOOL = MPI_Datatype(OMPI_MPI_C_BOOL) + type(MPI_Datatype), parameter :: MPI_CXX_BOOL = MPI_Datatype(OMPI_MPI_CXX_BOOL) + type(MPI_Datatype), parameter :: MPI_COUNT = MPI_Datatype(OMPI_MPI_COUNT) + type(MPI_Datatype), parameter :: MPI_OFFSET = MPI_Datatype(OMPI_MPI_OFFSET) !... Special sentinel constants !------------------------------ From 0ab61c9b74a23997244986cfb2624cf65526647b Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 29 Oct 2019 13:51:58 +0900 Subject: [PATCH 453/674] fortran/use-mpi-f08: remove unused references to OMPI_PROTECTED Signed-off-by: Gilles Gouaillardet (back-ported from commit open-mpi/ompi@df6d763a53724a6410f9ab6456fbdc8ff501967b) --- config/ompi_setup_mpi_fortran.m4 | 7 +++---- ompi/mpi/fortran/configure-fortran-output-bottom.h | 9 ++------- ompi/mpi/fortran/configure-fortran-output.h.in | 7 ++----- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index 04ae4e0a8f9..95c88aeb8b5 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -15,8 +15,8 @@ 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-2017 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2014-2019 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 IBM Corporation. All rights reserved. dnl $COPYRIGHT$ dnl @@ -743,8 +743,7 @@ end type test_mpi_handle], [$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-types.F90 (and ompi_info) - AC_SUBST([OMPI_FORTRAN_HAVE_PROTECTED]) + # For ompi_info only AC_DEFINE_UNQUOTED([OMPI_FORTRAN_HAVE_PROTECTED], [$OMPI_FORTRAN_HAVE_PROTECTED], [For mpi-f08-types.f90 and .F90 and ompi_info: whether the compiler supports the "protected" keyword or not]) diff --git a/ompi/mpi/fortran/configure-fortran-output-bottom.h b/ompi/mpi/fortran/configure-fortran-output-bottom.h index 895f0496d7f..951bcaa4c58 100644 --- a/ompi/mpi/fortran/configure-fortran-output-bottom.h +++ b/ompi/mpi/fortran/configure-fortran-output-bottom.h @@ -3,6 +3,8 @@ ! Copyright (c) 2006-2014 Cisco Systems, Inc. All rights reserved. ! Copyright (c) 2009-2012 Los Alamos National Security, LLC. ! All rights reserved. +! Copyright (c) 2019 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! ! $COPYRIGHT$ ! @@ -38,11 +40,4 @@ #define OMPI_PRIVATE #endif -! PROTECTED or not -#if OMPI_FORTRAN_HAVE_PROTECTED -#define OMPI_PROTECTED , PROTECTED -#else -#define OMPI_PROTECTED -#endif - #endif diff --git a/ompi/mpi/fortran/configure-fortran-output.h.in b/ompi/mpi/fortran/configure-fortran-output.h.in index 6f1b82588ad..c44e965a07d 100644 --- a/ompi/mpi/fortran/configure-fortran-output.h.in +++ b/ompi/mpi/fortran/configure-fortran-output.h.in @@ -3,8 +3,8 @@ ! 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-2018 Research Organization for Information Science -! and Technology (RIST). All rights reserved. +! Copyright (c) 2017-2019 Research Organization for Information Science +! and Technology (RIST). All rights reserved. ! ! $COPYRIGHT$ ! @@ -25,9 +25,6 @@ ! Whether we have PRIVATE or not #define OMPI_FORTRAN_HAVE_PRIVATE @OMPI_FORTRAN_HAVE_PRIVATE@ -! Whether we have PROTECTED or not -#define OMPI_FORTRAN_HAVE_PROTECTED @OMPI_FORTRAN_HAVE_PROTECTED@ - ! Whether we have ABSTRACT or not #define OMPI_FORTRAN_HAVE_ABSTRACT @OMPI_FORTRAN_HAVE_ABSTRACT@ From 02c79ac0c8db9954949b6c4478cc972f532fb07a Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 29 Oct 2019 15:00:51 +0900 Subject: [PATCH 454/674] fortran/use-mpi-f08: misc fixes - fix typos from open-mpi/ompi@b10a60a5a935991a6000585298e0061a6159cd0d - remove remaining references to OMPI_PROTECTED from open-mpi/ompi@df6d763a53724a6410f9ab6456fbdc8ff501967b Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@fda4d040da257d5bd8387244847d2c3fa5a2fcc6) --- ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-types.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 9aafbf72ba9..4d8007c42c9 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 @@ -111,7 +111,7 @@ module mpi_f08_types ! type(MPI_Comm), parameter :: MPI_COMM_NULL = MPI_Comm(OMPI_MPI_COMM_NULL) - type(MPI_Datatype), parameter :: MPI_DATATYPE_NULL = MPI_Datatype(OMPI_MPI_COMM_NULL) + type(MPI_Datatype), parameter :: MPI_DATATYPE_NULL = MPI_Datatype(OMPI_MPI_DATATYPE_NULL) type(MPI_Errhandler), parameter:: MPI_ERRHANDLER_NULL = MPI_Errhandler(OMPI_MPI_ERRHANDLER_NULL) type(MPI_Group), parameter :: MPI_GROUP_NULL = MPI_Group(OMPI_MPI_GROUP_NULL) type(MPI_Info), parameter :: MPI_INFO_NULL = MPI_Info(OMPI_MPI_INFO_NULL) @@ -182,7 +182,7 @@ module mpi_f08_types type(MPI_Datatype), parameter :: MPI_COMPLEX8 = MPI_Datatype(OMPI_MPI_COMPLEX8) type(MPI_Datatype), parameter :: MPI_COMPLEX16 = MPI_Datatype(OMPI_MPI_COMPLEX16) type(MPI_Datatype), parameter :: MPI_COMPLEX32 = MPI_Datatype(OMPI_MPI_COMPLEX32) - type(MPI_Datatype), parameter :: MPI_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_COMPLEX) + type(MPI_Datatype), parameter :: MPI_DOUBLE_COMPLEX = MPI_Datatype(OMPI_MPI_DOUBLE_COMPLEX) type(MPI_Datatype), parameter :: MPI_FLOAT_INT = MPI_Datatype(OMPI_MPI_FLOAT_INT) type(MPI_Datatype), parameter :: MPI_DOUBLE_INT = MPI_Datatype(OMPI_MPI_DOUBLE_INT) type(MPI_Datatype), parameter :: MPI_2REAL = MPI_Datatype(OMPI_MPI_2REAL) @@ -199,7 +199,7 @@ module mpi_f08_types type(MPI_Datatype), parameter :: MPI_LOGICAL2 = MPI_Datatype(OMPI_MPI_LOGICAL2) type(MPI_Datatype), parameter :: MPI_LOGICAL4 = MPI_Datatype(OMPI_MPI_LOGICAL4) type(MPI_Datatype), parameter :: MPI_LOGICAL8 = MPI_Datatype(OMPI_MPI_LOGICAL8) - type(MPI_Datatype), parameter :: MPI_C_BOOL = MPI_Datatype(OMPI_MPI_C_BOOL) + type(MPI_Datatype), parameter :: MPI_C_BOOL = MPI_Datatype(OMPI_MPI_C_BOOL) type(MPI_Datatype), parameter :: MPI_CXX_BOOL = MPI_Datatype(OMPI_MPI_CXX_BOOL) type(MPI_Datatype), parameter :: MPI_COUNT = MPI_Datatype(OMPI_MPI_COUNT) type(MPI_Datatype), parameter :: MPI_OFFSET = MPI_Datatype(OMPI_MPI_OFFSET) From ad86d043cf97aaba01773df491bbf7b931b6222e Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 5 Nov 2019 15:44:59 +0100 Subject: [PATCH 455/674] Shmem: use bitwise and instead of logical and to check for allocator capabilities Signed-off-by: Joseph Schuchart (cherry picked from commit 9f2c6a42c3c9be42057c8f7881cc2fdff6a36962) --- oshmem/mca/memheap/base/memheap_base_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oshmem/mca/memheap/base/memheap_base_alloc.c b/oshmem/mca/memheap/base/memheap_base_alloc.c index b83499f250c..8ff20677ab9 100644 --- a/oshmem/mca/memheap/base/memheap_base_alloc.c +++ b/oshmem/mca/memheap/base/memheap_base_alloc.c @@ -70,7 +70,7 @@ int mca_memheap_alloc_with_hint(size_t size, long hint, void** ptr) for (i = 0; i < mca_memheap_base_map.n_segments; i++) { map_segment_t *s = &mca_memheap_base_map.mem_segs[i]; - if (s->allocator && (hint && s->alloc_hints)) { + if (s->allocator && (hint & s->alloc_hints)) { /* Do not fall back to default allocator since it will break the * symmetry between PEs */ From 47ec3e4d2bd30d3feaaca3989124452fca60f5d6 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Thu, 26 Sep 2019 08:57:00 -0700 Subject: [PATCH 456/674] btl/uct: add support for OpenUCX v1.8 API changes OpenUCX broke the UCT API again in v1.8. This commit updates btl/uct to fix compilation with current OpenUCX master (future v1.8). Further changes will likely be needed for the final release. Signed-off-by: Nathan Hjelm (cherry picked from commit 526775dfd7ad75c308532784de4fb3ffed25458f) --- opal/mca/btl/uct/btl_uct.h | 4 ++ opal/mca/btl/uct/btl_uct_amo.c | 4 +- opal/mca/btl/uct/btl_uct_component.c | 82 +++++++++++++++++++++++++++- opal/mca/btl/uct/btl_uct_rdma.c | 4 +- opal/mca/btl/uct/btl_uct_rdma.h | 14 +++++ opal/mca/btl/uct/btl_uct_tl.c | 6 ++ 6 files changed, 107 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index 38756794430..73640103c07 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -85,6 +85,10 @@ struct mca_btl_uct_module_t { /** array containing the am_tl and rdma_tl */ mca_btl_uct_tl_t *comm_tls[2]; +#if UCT_API > UCT_VERSION(1, 7) + uct_component_h uct_component; +#endif + /** registration cache */ mca_rcache_base_module_t *rcache; diff --git a/opal/mca/btl/uct/btl_uct_amo.c b/opal/mca/btl/uct/btl_uct_amo.c index f7d02326884..72398ce7369 100644 --- a/opal/mca/btl/uct/btl_uct_amo.c +++ b/opal/mca/btl/uct/btl_uct_amo.c @@ -110,7 +110,7 @@ int mca_btl_uct_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_end mca_btl_uct_uct_completion_release (comp); } - uct_rkey_release (&rkey); + mca_btl_uct_rkey_release (uct_btl, &rkey); return rc; } @@ -184,7 +184,7 @@ int mca_btl_uct_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_e mca_btl_uct_uct_completion_release (comp); } - uct_rkey_release (&rkey); + mca_btl_uct_rkey_release (uct_btl, &rkey); return rc; } diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index f968cb9c31c..538872860f9 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -314,7 +314,12 @@ ucs_status_t mca_btl_uct_am_handler (void *arg, void *data, size_t length, unsig return UCS_OK; } +#if UCT_API > UCT_VERSION(1, 7) +static int mca_btl_uct_component_process_uct_md (uct_component_h component, uct_md_resource_desc_t *md_desc, + char **allowed_ifaces) +#else static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc, char **allowed_ifaces) +#endif { mca_rcache_base_resources_t rcache_resources; uct_tl_resource_desc_t *tl_desc; @@ -348,8 +353,14 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc md = OBJ_NEW(mca_btl_uct_md_t); + +#if UCT_API > UCT_VERSION(1, 7) + uct_md_config_read (component, NULL, NULL, &uct_config); + uct_md_open (component, md_desc->md_name, uct_config, &md->uct_md); +#else uct_md_config_read (md_desc->md_name, NULL, NULL, &uct_config); uct_md_open (md_desc->md_name, uct_config, &md->uct_md); +#endif uct_config_release (uct_config); uct_md_query (md->uct_md, &md_attr); @@ -375,6 +386,10 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc return OPAL_ERR_NOT_AVAILABLE; } +#if UCT_API > UCT_VERSION(1, 7) + module->uct_component = component; +#endif + mca_btl_uct_component.modules[mca_btl_uct_component.module_count++] = module; /* NTH: a registration cache shouldn't be necessary when using UCT but there are measurable @@ -400,6 +415,42 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc return OPAL_SUCCESS; } +#if UCT_API > UCT_VERSION(1, 7) +static int mca_btl_uct_component_process_uct_component (uct_component_h component, char **allowed_ifaces) +{ + uct_component_attr_t attr = {.field_mask = UCT_COMPONENT_ATTR_FIELD_NAME | + UCT_COMPONENT_ATTR_FIELD_MD_RESOURCE_COUNT}; + ucs_status_t ucs_status; + int rc; + + ucs_status = uct_component_query (component, &attr); + if (UCS_OK != ucs_status) { + return OPAL_ERROR; + } + + BTL_VERBOSE(("processing uct component %s", attr.name)); + + attr.md_resources = calloc (attr.md_resource_count, sizeof (*attr.md_resources)); + attr.field_mask |= UCT_COMPONENT_ATTR_FIELD_MD_RESOURCES; + ucs_status = uct_component_query (component, &attr); + if (UCS_OK != ucs_status) { + return OPAL_ERROR; + } + + for (int i = 0 ; i < attr.md_resource_count ; ++i) { + rc = mca_btl_uct_component_process_uct_md (component, attr.md_resources + i, + allowed_ifaces); + if (OPAL_SUCCESS != rc) { + break; + } + } + + free (attr.md_resources); + + return OPAL_SUCCESS; +} +#endif /* UCT_API > UCT_VERSION(1, 7) */ + /* * UCT component initialization: * (1) read interface list from kernel and compare against component parameters @@ -415,6 +466,7 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, struct mca_btl_base_module_t **base_modules; uct_md_resource_desc_t *resources; unsigned resource_count; + ucs_status_t ucs_status; char **allowed_ifaces; int rc; @@ -431,10 +483,32 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, return NULL; } - uct_query_md_resources (&resources, &resource_count); - mca_btl_uct_component.module_count = 0; +#if UCT_API > UCT_VERSION(1, 7) + uct_component_h *components; + unsigned num_components; + + ucs_status = uct_query_components(&components, &num_components); + if (UCS_OK != ucs_status) { + BTL_ERROR(("could not query UCT components")); + return NULL; + } + + /* generate all suitable btl modules */ + for (unsigned i = 0 ; i < num_components ; ++i) { + rc = mca_btl_uct_component_process_uct_component (components[i], allowed_ifaces); + if (OPAL_SUCCESS != rc) { + break; + } + } + + uct_release_component_list (components); + +#else /* UCT 1.6 and older */ + + uct_query_md_resources (&resources, &resource_count); + /* generate all suitable btl modules */ for (unsigned i = 0 ; i < resource_count ; ++i) { rc = mca_btl_uct_component_process_uct_md (resources + i, allowed_ifaces); @@ -443,9 +517,11 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, } } - opal_argv_free (allowed_ifaces); uct_release_md_resource_list (resources); +#endif /* UCT_API > UCT_VERSION(1, 7) */ + + opal_argv_free (allowed_ifaces); mca_btl_uct_modex_send (); /* pass module array back to caller */ diff --git a/opal/mca/btl/uct/btl_uct_rdma.c b/opal/mca/btl/uct/btl_uct_rdma.c index 2d2d1c3f04b..9ee9530f260 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.c +++ b/opal/mca/btl/uct/btl_uct_rdma.c @@ -132,7 +132,7 @@ int mca_btl_uct_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi BTL_VERBOSE(("get issued. status = %d", ucs_status)); - uct_rkey_release (&rkey); + mca_btl_uct_rkey_release (uct_btl, &rkey); return OPAL_LIKELY(UCS_OK == ucs_status) ? OPAL_SUCCESS : OPAL_ERR_RESOURCE_BUSY; } @@ -237,7 +237,7 @@ int mca_btl_uct_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi mca_btl_uct_uct_completion_release (comp); } - uct_rkey_release (&rkey); + mca_btl_uct_rkey_release (uct_btl, &rkey); return OPAL_LIKELY(UCS_OK == ucs_status) ? OPAL_SUCCESS : OPAL_ERR_RESOURCE_BUSY; } diff --git a/opal/mca/btl/uct/btl_uct_rdma.h b/opal/mca/btl/uct/btl_uct_rdma.h index e9b0d6b19dc..609fec91f52 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.h +++ b/opal/mca/btl/uct/btl_uct_rdma.h @@ -55,8 +55,22 @@ static inline int mca_btl_uct_get_rkey (mca_btl_uct_module_t *module, return rc; } +#if UCT_API > UCT_VERSION(1, 7) + ucs_status = uct_rkey_unpack (module->uct_component, (void *) remote_handle, rkey); +#else ucs_status = uct_rkey_unpack ((void *) remote_handle, rkey); +#endif return (UCS_OK == ucs_status) ? OPAL_SUCCESS : OPAL_ERROR; } +static inline void mca_btl_uct_rkey_release (mca_btl_uct_module_t *uct_btl, uct_rkey_bundle_t *rkey) +{ +#if UCT_API > UCT_VERSION(1, 7) + uct_rkey_release (uct_btl->uct_component, rkey); +#else + (void) uct_btl; + uct_rkey_release (rkey); +#endif +} + #endif /* !defined(BTL_UCT_RDMA_H) */ diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index a711a41ce99..dcf00f23524 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -516,7 +516,13 @@ static int mca_btl_uct_evaluate_tl (mca_btl_uct_module_t *module, mca_btl_uct_tl * come up with a better estimate. */ /* UCT bandwidth is in bytes/sec, BTL is in MB/sec */ +#if UCT_API > UCT_VERSION(1, 7) + module->super.btl_bandwidth = (uint32_t) ((MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth.dedicated + + MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth.shared / + (opal_process_info.num_local_peers + 1)) / 1048576.0); +#else module->super.btl_bandwidth = (uint32_t) (MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth / 1048576.0); +#endif /* TODO -- figure out how to translate UCT latency to us */ module->super.btl_latency = 1; } From 55e01220cd213ff2b24950becc49c764dd62de17 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 5 Nov 2019 12:52:42 -0800 Subject: [PATCH 457/674] btl/uct: fix compilation for UCX 1.7.0 Ref #7128 Signed-off-by: Nathan Hjelm (cherry picked from commit a3026c016a6a8be379f62585b6ddc070175c8106) --- opal/mca/btl/uct/btl_uct.h | 3 ++- opal/mca/btl/uct/btl_uct_component.c | 14 +++++++------- opal/mca/btl/uct/btl_uct_rdma.h | 4 ++-- opal/mca/btl/uct/btl_uct_tl.c | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/opal/mca/btl/uct/btl_uct.h b/opal/mca/btl/uct/btl_uct.h index 73640103c07..0e4ec9a9498 100644 --- a/opal/mca/btl/uct/btl_uct.h +++ b/opal/mca/btl/uct/btl_uct.h @@ -12,6 +12,7 @@ * All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -85,7 +86,7 @@ struct mca_btl_uct_module_t { /** array containing the am_tl and rdma_tl */ mca_btl_uct_tl_t *comm_tls[2]; -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) uct_component_h uct_component; #endif diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index 538872860f9..bff160736bc 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -314,7 +314,7 @@ ucs_status_t mca_btl_uct_am_handler (void *arg, void *data, size_t length, unsig return UCS_OK; } -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) static int mca_btl_uct_component_process_uct_md (uct_component_h component, uct_md_resource_desc_t *md_desc, char **allowed_ifaces) #else @@ -354,7 +354,7 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc md = OBJ_NEW(mca_btl_uct_md_t); -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) uct_md_config_read (component, NULL, NULL, &uct_config); uct_md_open (component, md_desc->md_name, uct_config, &md->uct_md); #else @@ -386,7 +386,7 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc return OPAL_ERR_NOT_AVAILABLE; } -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) module->uct_component = component; #endif @@ -415,7 +415,7 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc return OPAL_SUCCESS; } -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) static int mca_btl_uct_component_process_uct_component (uct_component_h component, char **allowed_ifaces) { uct_component_attr_t attr = {.field_mask = UCT_COMPONENT_ATTR_FIELD_NAME | @@ -449,7 +449,7 @@ static int mca_btl_uct_component_process_uct_component (uct_component_h componen return OPAL_SUCCESS; } -#endif /* UCT_API > UCT_VERSION(1, 7) */ +#endif /* UCT_API >= UCT_VERSION(1, 7) */ /* * UCT component initialization: @@ -485,7 +485,7 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, mca_btl_uct_component.module_count = 0; -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) uct_component_h *components; unsigned num_components; @@ -519,7 +519,7 @@ static mca_btl_base_module_t **mca_btl_uct_component_init (int *num_btl_modules, uct_release_md_resource_list (resources); -#endif /* UCT_API > UCT_VERSION(1, 7) */ +#endif /* UCT_API >= UCT_VERSION(1, 7) */ opal_argv_free (allowed_ifaces); mca_btl_uct_modex_send (); diff --git a/opal/mca/btl/uct/btl_uct_rdma.h b/opal/mca/btl/uct/btl_uct_rdma.h index 609fec91f52..ab790371afe 100644 --- a/opal/mca/btl/uct/btl_uct_rdma.h +++ b/opal/mca/btl/uct/btl_uct_rdma.h @@ -55,7 +55,7 @@ static inline int mca_btl_uct_get_rkey (mca_btl_uct_module_t *module, return rc; } -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) ucs_status = uct_rkey_unpack (module->uct_component, (void *) remote_handle, rkey); #else ucs_status = uct_rkey_unpack ((void *) remote_handle, rkey); @@ -65,7 +65,7 @@ static inline int mca_btl_uct_get_rkey (mca_btl_uct_module_t *module, static inline void mca_btl_uct_rkey_release (mca_btl_uct_module_t *uct_btl, uct_rkey_bundle_t *rkey) { -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) uct_rkey_release (uct_btl->uct_component, rkey); #else (void) uct_btl; diff --git a/opal/mca/btl/uct/btl_uct_tl.c b/opal/mca/btl/uct/btl_uct_tl.c index dcf00f23524..e69c769b41f 100644 --- a/opal/mca/btl/uct/btl_uct_tl.c +++ b/opal/mca/btl/uct/btl_uct_tl.c @@ -516,7 +516,7 @@ static int mca_btl_uct_evaluate_tl (mca_btl_uct_module_t *module, mca_btl_uct_tl * come up with a better estimate. */ /* UCT bandwidth is in bytes/sec, BTL is in MB/sec */ -#if UCT_API > UCT_VERSION(1, 7) +#if UCT_API >= UCT_VERSION(1, 7) module->super.btl_bandwidth = (uint32_t) ((MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth.dedicated + MCA_BTL_UCT_TL_ATTR(tl, 0).bandwidth.shared / (opal_process_info.num_local_peers + 1)) / 1048576.0); From 59b24ab4f7f9856e06007d57aa0b41636def672a Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 5 Nov 2019 09:28:34 -0700 Subject: [PATCH 458/674] btl/uct: add UCT API version check to configury related to #7128 The UCX crew is no longer guaranteeing that the UCT API is going to be frozen, so this is kind of a whack-a-mole problem trying to keep the BTL UCT working with various changing UCT APIs. Signed-off-by: Howard Pritchard (cherry picked from commit 9d345d9aa000233bec148540b071cecffc94438c) --- opal/mca/btl/uct/configure.m4 | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index 82844857740..61c7c8cd0f3 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -16,6 +16,8 @@ # All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2019 Triad National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -35,6 +37,41 @@ AC_DEFUN([MCA_opal_btl_uct_CONFIG],[ OMPI_CHECK_UCX([btl_uct], [btl_uct_happy="yes"], [btl_uct_happy="no"]) +dnl +dnl check UCT version. UCT API can change at any given release +dnl so we only allow compiling against ones we know work. +dnl + AC_ARG_ENABLE([uct-version-check], + [AC_HELP_STRING([--enable-uct-version-check], + [enable UCT version check (default: enabled)])]) + AC_MSG_CHECKING([check uct version]) + if test "$enable_uct_version_check" != "no"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + + max_allowed_uct_major=1 + max_allowed_uct_minor=7 + if test "$btl_uct_happy" = "yes" && test "$enable_uct_version_check" != "no"; then + AC_MSG_CHECKING([UCT version compatibility]) + OPAL_VAR_SCOPE_PUSH([CPPFLAGS_save]) + CPPFLAGS_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $btl_uct_CPPFLAGS" + AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include + #if (UCT_VERNO_MAJOR > $max_allowed_uct_major) + #error "UCT MAJOR VERNO > $max_allowed_uct_major" + #endif + #if (UCT_VERNO_MINOR > $max_allowed_uct_minor) + #error "UCT MINOR VERNO > $max_allowed_uct_minor" + #endif], [])], + [AC_MSG_RESULT([UCT version compatible])], + [AC_MSG_RESULT([UCT version not compatible - need UCX $max_allowed_uct_major.$max_allowed_uct_minor or older]) + btl_uct_happy="no"]) + CPPFLAGS="$CPPFLAGS_save" + OPAL_VAR_SCOPE_POP + fi + if test "$btl_uct_happy" = "yes" ; then OPAL_VAR_SCOPE_PUSH([CPPFLAGS_save]) From db3e563749c8fd577b0e260c187504ff78568996 Mon Sep 17 00:00:00 2001 From: Akshay Venkatesh Date: Mon, 18 Nov 2019 17:04:54 -0800 Subject: [PATCH 459/674] OPAL/MCA/BTL/OPENIB: Detect ConnectX-6 HCAs Signed-off-by: Akshay Venkatesh --- opal/mca/btl/openib/mca-btl-openib-device-params.ini | 9 +++++++++ opal/mca/common/verbs/common_verbs_port.c | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/opal/mca/btl/openib/mca-btl-openib-device-params.ini b/opal/mca/btl/openib/mca-btl-openib-device-params.ini index 4a0a62467d4..c46c303a35d 100644 --- a/opal/mca/btl/openib/mca-btl-openib-device-params.ini +++ b/opal/mca/btl/openib/mca-btl-openib-device-params.ini @@ -190,6 +190,15 @@ max_inline_data = 256 ############################################################################ +[Mellanox ConnectX6] +vendor_id = 0x2c9,0x5ad,0x66a,0x8f1,0x1708,0x03ba,0x15b3,0x119f +vendor_part_id = 4123 +use_eager_rdma = 1 +mtu = 4096 +max_inline_data = 256 + +############################################################################ + [IBM eHCA 4x and 12x] vendor_id = 0x5076 vendor_part_id = 0 diff --git a/opal/mca/common/verbs/common_verbs_port.c b/opal/mca/common/verbs/common_verbs_port.c index 973a82666ef..56166dcb776 100644 --- a/opal/mca/common/verbs/common_verbs_port.c +++ b/opal/mca/common/verbs/common_verbs_port.c @@ -94,6 +94,10 @@ int opal_common_verbs_port_bw(struct ibv_port_attr *port_attr, /* 12x */ *bandwidth *= 12; break; + case 16: + /* 16x */ + *bandwidth *= 16; + break; default: /* Who knows? */ return OPAL_ERR_NOT_FOUND; From 87c0178ed42bb86330ea8ee993bb45269bdb7bfe Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 18 Oct 2019 11:30:00 -0700 Subject: [PATCH 460/674] opal_check_alps: fix configure output There was a path where OPAL_CHECK_ALPS would exit its testing but still leave `opal_check_cray_alps_happy` blank. Fix that by setting it to "no". Signed-off-by: Jeff Squyres (cherry picked from commit 26705efad0ab539031049d50f5e21775d9c3f84f) --- config/opal_check_alps.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/config/opal_check_alps.m4 b/config/opal_check_alps.m4 index 560930ad4fd..344a5d1fec5 100644 --- a/config/opal_check_alps.m4 +++ b/config/opal_check_alps.m4 @@ -101,6 +101,7 @@ AC_DEFUN([OPAL_CHECK_ALPS],[ [opal_check_cray_alps_happy="no"])], [AS_IF([test "$with_alps" = "no"], [AC_MSG_RESULT([no]) + opal_check_cray_alps_happy=no $3], [AS_IF([test "$with_alps" = "auto" || test "$with_alps" = "yes"], [PKG_CHECK_MODULES_STATIC([CRAY_ALPSLLI], [cray-alpslli], From a346756bf4a3e728901d7473247323d90b18288c Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Fri, 25 Oct 2019 18:15:36 +0200 Subject: [PATCH 461/674] uGNI: Fix potential deadlock when processing outstanding transfers Signed-off-by: Joseph Schuchart (cherry picked from commit c09ca039b4703e26d6d7a0494e042dd27827e091) --- opal/mca/btl/ugni/btl_ugni_component.c | 30 ++++++++++++++++++-------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/opal/mca/btl/ugni/btl_ugni_component.c b/opal/mca/btl/ugni/btl_ugni_component.c index 6d77548e08c..9e478914576 100644 --- a/opal/mca/btl/ugni/btl_ugni_component.c +++ b/opal/mca/btl/ugni/btl_ugni_component.c @@ -664,34 +664,46 @@ static inline int mca_btl_ugni_progress_wait_list (mca_btl_ugni_module_t *ugni_module) { int rc = OPAL_SUCCESS; + opal_list_t tmplist; + opal_list_t *waitlist = &ugni_module->ep_wait_list; mca_btl_base_endpoint_t *endpoint = NULL; int count; - if (0 == opal_list_get_size(&ugni_module->ep_wait_list)) { - return 0; - } - /* check the count before taking the lock to avoid unnecessary locking */ - count = opal_list_get_size(&ugni_module->ep_wait_list); + count = opal_list_get_size(waitlist); if (0 == count) { return 0; } + /* Don't hold the wait-list lock while processing the list as that may lead + * to a deadlock. + * Instead, move the wait_list elements into a temporary list and work on that.*/ + OBJ_CONSTRUCT(&tmplist, opal_list_t); OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock); - count = opal_list_get_size(&ugni_module->ep_wait_list); + opal_list_join(&tmplist, opal_list_get_end(&tmplist), waitlist); + OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock); + count = opal_list_get_size(&tmplist); do { - endpoint = (mca_btl_base_endpoint_t *) opal_list_remove_first (&ugni_module->ep_wait_list); + endpoint = (mca_btl_base_endpoint_t *) opal_list_remove_first (&tmplist); if (endpoint != NULL) { rc = mca_btl_ugni_progress_send_wait_list (endpoint); if (OPAL_SUCCESS != rc) { - opal_list_append (&ugni_module->ep_wait_list, &endpoint->super); + opal_list_append (&tmplist, &endpoint->super); } else { endpoint->wait_listed = false; } } } while (endpoint != NULL && --count > 0) ; - OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock); + + /* reinsert unfinished elements into the wait-list */ + count = opal_list_get_size(&tmplist); + if (0 < count) { + OPAL_THREAD_LOCK(&ugni_module->ep_wait_list_lock); + opal_list_join(waitlist, opal_list_get_end(waitlist), &tmplist); + OPAL_THREAD_UNLOCK(&ugni_module->ep_wait_list_lock); + } + OBJ_DESTRUCT(&tmplist); return rc; } From 39acc3a251bffb2e68ca534ccf2f4aac7127a50f Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 29 Oct 2019 12:30:41 -0500 Subject: [PATCH 462/674] common/ompio: fix calculation in simple-grouping option This is based on a bug reported on the mailing list using a netcdf testcase. The problem occurs if processes are using a custom file view, but on some of them it appears as if the default file view is being used. Because of that, the simple-grouping option lead to different number of aggregators used on different processes, and ultimately to a deadlock. This patch fixes the problem by not using the file_view size anymore for the calculation in the simple-grouping option, but the contiguous chunk size (which is identical on all processes). Fixes issue #7109 Signed-off-by: Edgar Gabriel (cherry picked from commit ad5d0df4e91d66efa5b69e8388f7ed0b4b6a1d09) --- ompi/mca/common/ompio/common_ompio_aggregators.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_aggregators.c b/ompi/mca/common/ompio/common_ompio_aggregators.c index 5a570d8e005..fdde4dee96f 100644 --- a/ompi/mca/common/ompio/common_ompio_aggregators.c +++ b/ompi/mca/common/ompio/common_ompio_aggregators.c @@ -126,17 +126,17 @@ int mca_common_ompio_simple_grouping(ompio_file_t *fh, } P_a = 1; - time_prev = cost_calc ( fh->f_size, P_a, fh->f_view_size, (size_t) fh->f_bytes_per_agg, mode ); + time_prev = cost_calc ( fh->f_size, P_a, fh->f_cc_size, (size_t) fh->f_bytes_per_agg, mode ); P_a_prev = P_a; for ( P_a = incr; P_a <= fh->f_size; P_a += incr ) { - time = cost_calc ( fh->f_size, P_a, fh->f_view_size, (size_t) fh->f_bytes_per_agg, mode ); + time = cost_calc ( fh->f_size, P_a, fh->f_cc_size, (size_t) fh->f_bytes_per_agg, mode ); dtime_abs = (time_prev - time); dtime = dtime_abs / time_prev; dtime_diff = ( P_a == incr ) ? dtime : (dtime_prev - dtime); #ifdef OMPIO_DEBUG if ( 0 == fh->f_rank ){ printf(" d_p = %ld P_a = %d time = %lf dtime = %lf dtime_abs =%lf dtime_diff=%lf\n", - fh->f_view_size, P_a, time, dtime, dtime_abs, dtime_diff ); + fh->f_cc_size, P_a, time, dtime, dtime_abs, dtime_diff ); } #endif if ( dtime_diff < dtime_threshold ) { @@ -171,7 +171,7 @@ int mca_common_ompio_simple_grouping(ompio_file_t *fh, num_groups = P_a_prev; #ifdef OMPIO_DEBUG printf(" For P=%d d_p=%ld b_c=%d threshold=%f chosen P_a = %d \n", - fh->f_size, fh->f_view_size, fh->f_bytes_per_agg, dtime_threshold, P_a_prev); + fh->f_size, fh->f_cc_size, fh->f_bytes_per_agg, dtime_threshold, P_a_prev); #endif /* Cap the maximum number of aggregators.*/ @@ -183,6 +183,7 @@ int mca_common_ompio_simple_grouping(ompio_file_t *fh, } *num_groups_out = num_groups; + return mca_common_ompio_forced_grouping ( fh, num_groups, contg_groups); } @@ -576,7 +577,7 @@ int mca_common_ompio_create_groups(ompio_file_t *fh, opal_output (1, "mca_common_ompio_create_groups: error in mca_common_ompio_prepare_to_group\n"); goto exit; } - + switch(ompio_grouping_flag){ case OMPIO_SPLIT: From 02da54c174add6bdc87ab135e9b34e84ad19e51e Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Tue, 29 Oct 2019 15:21:22 -0500 Subject: [PATCH 463/674] fcoll/two_phase: fix error in calculating aggregators in 32bit mode In fcoll_two_phase_supprot_fns.c: calculation of the aggregator index failed for large offsets on 32bit machine, due to improper handling of 64bit offsets. Fixes Issue #7110 Signed-off-by: Edgar Gabriel (cherry picked from commit ea1355beae918b3acd67d5c0ccc44afbcc5b7ca9) --- .../two_phase/fcoll_two_phase_support_fns.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c index 777cf08b9ae..69a56f2c6c7 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2008-2019 University of Houston. All rights reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights @@ -156,23 +156,26 @@ int mca_fcoll_two_phase_calc_aggregator(ompio_file_t *fh, { - int rank_index, rank; + int rank_index, rank; OMPI_MPI_OFFSET_TYPE avail_bytes; - - rank_index = (int) ((off - min_off + fd_size)/ fd_size - 1); - + long long off_ll = (long long) off; + long long min_off_ll = (long long) min_off; + long long fd_size_ll = (long long) fd_size; + long long rank_index_ll; + + rank_index_ll = (((off_ll - min_off_ll + fd_size_ll)/ fd_size_ll) - 1); + rank_index = (int) rank_index_ll; if (striping_unit > 0){ rank_index = 0; while (off > fd_end[rank_index]) rank_index++; } - if (rank_index >= num_aggregators || rank_index < 0) { fprintf(stderr, - "Error in ompi_io_ompio_calcl_aggregator():"); + "Error in mca_fcoll_two_phase_calc_aggregator:"); fprintf(stderr, - "rank_index(%d) >= num_aggregators(%d)fd_size=%lld off=%lld\n", - rank_index,num_aggregators,fd_size,off); + "rank_index(%d) >= num_aggregators(%d) fd_size=%ld off=%ld min_off=%ld striping_unit=%d\n", + rank_index, num_aggregators, fd_size, off, min_off, striping_unit); ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); } @@ -184,9 +187,9 @@ int mca_fcoll_two_phase_calc_aggregator(ompio_file_t *fh, rank = aggregator_list[rank_index]; - #if 0 +#if 0 printf("rank : %d, rank_index : %d\n",rank, rank_index); - #endif +#endif return rank; } From b004f4c391091ec8f5ec221774db82ebaffab5aa Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 28 Feb 2019 09:53:29 +0900 Subject: [PATCH 464/674] schizo/ompi: correctly handle the yield_when_idle option in schizo/ompi, sets the new OMPI_MCA_mpi_oversubscribe environment variable according to the node oversubscription state. This MCA parameter is used to set the default value of the mpi_yield_when_idle parameter. This two steps tango is needed so the mpi_yield_when_idle setting is always honored when set in a config file. Refs. open-mpi/ompi#6433 Signed-off-by: Gilles Gouaillardet (cherry-picked from cc97c0f6116ae62feef) --- ompi/runtime/ompi_mpi_params.c | 16 +++++++++++----- orte/mca/schizo/ompi/schizo_ompi.c | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ompi/runtime/ompi_mpi_params.c b/ompi/runtime/ompi_mpi_params.c index a490453d0d6..adb9a1a4abb 100644 --- a/ompi/runtime/ompi_mpi_params.c +++ b/ompi/runtime/ompi_mpi_params.c @@ -17,7 +17,7 @@ * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 Research Organization for Information Science + * Copyright (c) 2016-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * @@ -82,6 +82,7 @@ static bool show_default_mca_params = false; static bool show_file_mca_params = false; static bool show_enviro_mca_params = false; static bool show_override_mca_params = false; +static bool ompi_mpi_oversubscribe = false; int ompi_mpi_register_params(void) { @@ -108,13 +109,18 @@ int ompi_mpi_register_params(void) * opal_progress: decide whether to yield and the event library * tick rate */ - /* JMS: Need ORTE data here -- set this to 0 when - exactly/under-subscribed, or 1 when oversubscribed */ - ompi_mpi_yield_when_idle = false; + ompi_mpi_oversubscribe = false; + (void) mca_base_var_register("ompi", "mpi", NULL, "oversubscribe", + "Internal MCA parameter set by the runtime environment when oversubscribing nodes", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mpi_oversubscribe); + ompi_mpi_yield_when_idle = ompi_mpi_oversubscribe; (void) mca_base_var_register("ompi", "mpi", NULL, "yield_when_idle", "Yield the processor when waiting for MPI communication (for MPI processes, will default to 1 when oversubscribing nodes)", MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, - OPAL_INFO_LVL_9, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, &ompi_mpi_yield_when_idle); diff --git a/orte/mca/schizo/ompi/schizo_ompi.c b/orte/mca/schizo/ompi/schizo_ompi.c index 2b1763c29b5..f9ce1327ea1 100644 --- a/orte/mca/schizo/ompi/schizo_ompi.c +++ b/orte/mca/schizo/ompi/schizo_ompi.c @@ -15,8 +15,8 @@ * Copyright (c) 2011-2017 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2017 UT-Battelle, LLC. All rights reserved. * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2015-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -914,9 +914,9 @@ static int setup_fork(orte_job_t *jdata, /* setup yield schedule - do not override any user-supplied directive! */ if (oversubscribed) { - opal_setenv("OMPI_MCA_mpi_yield_when_idle", "1", false, &app->env); + opal_setenv("OMPI_MCA_mpi_oversubscribe", "1", true, &app->env); } else { - opal_setenv("OMPI_MCA_mpi_yield_when_idle", "0", false, &app->env); + opal_setenv("OMPI_MCA_mpi_oversubscribe", "0", true, &app->env); } /* set the app_context number into the environment */ From 91866789f2fefff8e11ad24a29452077f74f8062 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 5 Dec 2019 18:57:37 -0500 Subject: [PATCH 465/674] mpool/base: fix basic mpool_base() function The prior implementation was simply wrong. Signed-off-by: Jeff Squyres (cherry picked from commit 53ebea12aa98ba5440924a8ee914f6707f63608b) --- opal/mca/mpool/base/mpool_base_basic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/opal/mca/mpool/base/mpool_base_basic.c b/opal/mca/mpool/base/mpool_base_basic.c index fba7e6fed7b..e11f5273eae 100644 --- a/opal/mca/mpool/base/mpool_base_basic.c +++ b/opal/mca/mpool/base/mpool_base_basic.c @@ -81,7 +81,15 @@ static void mca_mpool_base_basic_finalize (struct mca_mpool_base_module_t *mpool free (mpool); } +static void *mca_mpool_base_basic_base(mca_mpool_base_module_t *mpool) +{ + mca_mpool_base_basic_module_t *basic_module = (mca_mpool_base_basic_module_t *) mpool; + + return (void*) basic_module->ptr; +} + static mca_mpool_base_module_t mca_mpool_basic_template = { + .mpool_base = mca_mpool_base_basic_base, .mpool_alloc = mca_mpool_base_basic_alloc, .mpool_free = mca_mpool_base_basic_free, .mpool_finalize = mca_mpool_base_basic_finalize, @@ -100,7 +108,6 @@ mca_mpool_base_module_t *mca_mpool_basic_create (void *base, size_t size, unsign OBJ_CONSTRUCT(&basic_module->lock, opal_mutex_t); - basic_module->super.mpool_base = base; basic_module->ptr = (uintptr_t) base; basic_module->size = basic_module->avail = size; basic_module->min_align = min_align; From 71fe9d78e0415381bd53a4ebfe73b0eea67ccef3 Mon Sep 17 00:00:00 2001 From: William Bailey Date: Sun, 8 Dec 2019 12:40:14 -0500 Subject: [PATCH 466/674] fcoll/two_phase: Compiler warning for wrong variable type used Squash compiler warning. Changed output specifier to match variable type (long int -> long long int). Signed-off-by: William Bailey (cherry picked from commit e2718e01961782bffeef0bdfdb19ea286da0db2a) --- ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c b/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c index 69a56f2c6c7..5196a7a7086 100644 --- a/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c +++ b/ompi/mca/fcoll/two_phase/fcoll_two_phase_support_fns.c @@ -174,7 +174,7 @@ int mca_fcoll_two_phase_calc_aggregator(ompio_file_t *fh, fprintf(stderr, "Error in mca_fcoll_two_phase_calc_aggregator:"); fprintf(stderr, - "rank_index(%d) >= num_aggregators(%d) fd_size=%ld off=%ld min_off=%ld striping_unit=%d\n", + "rank_index(%d) >= num_aggregators(%d) fd_size=%lld off=%lld min_off=%lld striping_unit=%d\n", rank_index, num_aggregators, fd_size, off, min_off, striping_unit); ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); } From b84074d4d0ec0a6e0c990881a4382c08ac607405 Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Wed, 9 Oct 2019 18:45:32 +0300 Subject: [PATCH 467/674] oshmem:ucx, fix race condition and add context recycling 1) Race condition: Do not add private contexts to active list. Private contexts are only visible to the user. 2) Recycled contexts: Destroyed contexts are put on an idle list until finalize, continuous context creation will lead to oom condition. Instead, check if context from idle list meets new context requirements and reuse it. Co-authored with: Artem Y. Polyakov , Manjunath Gorentla Venkata Signed-off-by: Tomislav Janjusic (cherry picked from commit bd7cdf718488627e7943aab34275c150baf2284a) --- oshmem/mca/spml/ucx/spml_ucx.c | 39 ++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 36d3467bf5c..2ea8ba86343 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -576,11 +576,9 @@ static inline void _ctx_add(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t array->ctxs_count++; } -static inline void _ctx_remove(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t *ctx) +static inline void _ctx_remove(mca_spml_ucx_ctx_array_t *array, mca_spml_ucx_ctx_t *ctx, int i) { - int i; - - for (i = 0; i < array->ctxs_count; i++) { + for (; i < array->ctxs_count; i++) { if (array->ctxs[i] == ctx) { array->ctxs[i] = array->ctxs[array->ctxs_count-1]; array->ctxs[array->ctxs_count-1] = NULL; @@ -684,14 +682,29 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) { - mca_spml_ucx_ctx_t *ucx_ctx; - int rc; + mca_spml_ucx_ctx_t *ucx_ctx = NULL; + mca_spml_ucx_ctx_array_t *idle_array = &mca_spml_ucx.idle_array; + mca_spml_ucx_ctx_array_t *active_array = &mca_spml_ucx.active_array; + int i, rc; /* Take a lock controlling context creation. AUX context may set specific * UCX parameters affecting worker creation, which are not needed for * regular contexts. */ pthread_mutex_lock(&mca_spml_ucx.ctx_create_mutex); - rc = mca_spml_ucx_ctx_create_common(options, &ucx_ctx); + + /* Check if we have an idle context to reuse */ + for (i = 0; i < idle_array->ctxs_count; i++) { + if (idle_array->ctxs[i]->options & options) { + ucx_ctx = idle_array->ctxs[i]; + _ctx_remove(idle_array, ucx_ctx, i); + } + } + + /* If we cannot reuse, create new ctx */ + if (ucx_ctx == NULL) { + rc = mca_spml_ucx_ctx_create_common(options, &ucx_ctx); + } + pthread_mutex_unlock(&mca_spml_ucx.ctx_create_mutex); if (rc != OSHMEM_SUCCESS) { return rc; @@ -701,9 +714,11 @@ int mca_spml_ucx_ctx_create(long options, shmem_ctx_t *ctx) opal_progress_register(spml_ucx_ctx_progress); } - SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); - _ctx_add(&mca_spml_ucx.active_array, ucx_ctx); - SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); + if (!(options & SHMEM_CTX_PRIVATE)) { + SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); + _ctx_add(&mca_spml_ucx.active_array, ucx_ctx); + SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); + } (*ctx) = (shmem_ctx_t)ucx_ctx; return OSHMEM_SUCCESS; @@ -714,7 +729,9 @@ void mca_spml_ucx_ctx_destroy(shmem_ctx_t ctx) MCA_SPML_CALL(quiet(ctx)); SHMEM_MUTEX_LOCK(mca_spml_ucx.internal_mutex); - _ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx); + if (!(((mca_spml_ucx_ctx_t *)ctx)->options & SHMEM_CTX_PRIVATE)) { + _ctx_remove(&mca_spml_ucx.active_array, (mca_spml_ucx_ctx_t *)ctx, 0); + } _ctx_add(&mca_spml_ucx.idle_array, (mca_spml_ucx_ctx_t *)ctx); SHMEM_MUTEX_UNLOCK(mca_spml_ucx.internal_mutex); From 1f5a79bbd4ac8edc959473dd9132204e67ad9bf2 Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Wed, 9 Oct 2019 17:07:50 -0500 Subject: [PATCH 468/674] mtl-portals4: don't finalize flow control if Portals4 was not initialized This commit fixes a segfault in mtl-portals4 finalize(). The segfault occurs if finalize() is called without any calls to add_procs(). This commit resolves the segfault by skipping the flow control fini() call if Portals4 was not initialized. Signed-off-by: Todd Kordenbrock (cherry picked from commit e7b867c044f8b776b75f3c6d917745c06237743e) --- ompi/mca/mtl/portals4/mtl_portals4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mca/mtl/portals4/mtl_portals4.c b/ompi/mca/mtl/portals4/mtl_portals4.c index 5371a8be4dc..6d2dc9498da 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4.c +++ b/ompi/mca/mtl/portals4/mtl_portals4.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2010-2015 Sandia National Laboratories. All rights reserved. + * Copyright (c) 2010-2019 Sandia National Laboratories. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -551,12 +551,12 @@ ompi_mtl_portals4_finalize(struct mca_mtl_base_module_t *mtl) if (0 == ompi_mtl_portals4.need_init) { opal_progress_unregister(ompi_mtl_portals4_progress); while (0 != ompi_mtl_portals4_progress()) { } - } #if OMPI_MTL_PORTALS4_FLOW_CONTROL - ompi_mtl_portals4_flowctl_fini(); + ompi_mtl_portals4_flowctl_fini(); #endif - ompi_mtl_portals4_recv_short_fini(); + ompi_mtl_portals4_recv_short_fini(); + } if (!PtlHandleIsEqual(ompi_mtl_portals4.long_overflow_me_h, PTL_INVALID_HANDLE)) { PtlMEUnlink(ompi_mtl_portals4.long_overflow_me_h); From 2c082b6c7cd7bcb7d206f4a41abc638b7dcad09e Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Wed, 9 Oct 2019 17:12:56 -0500 Subject: [PATCH 469/674] btl-portals4: fix a flow control configure bug This commit fixes a configure bug that caused flow control to be disabled regardless of the configure options used. Signed-off-by: Todd Kordenbrock (cherry picked from commit f7e74b6a3d19cd6e3edc3364783311e595f81b3d) --- opal/mca/btl/portals4/configure.m4 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opal/mca/btl/portals4/configure.m4 b/opal/mca/btl/portals4/configure.m4 index cc7c0dbda2c..1b62c0da1f3 100644 --- a/opal/mca/btl/portals4/configure.m4 +++ b/opal/mca/btl/portals4/configure.m4 @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2010 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2010-2019 Sandia National Laboratories. All rights reserved. # Copyright (c) 2014 Bull SAS. All rights reserved. # $COPYRIGHT$ # @@ -44,9 +44,9 @@ AC_DEFUN([MCA_opal_btl_portals4_CONFIG],[ [AC_HELP_STRING([--enable-btl-portals4-flow-control], [enable flow control for Portals 4 BTL (default: disabled)])]) AC_MSG_CHECKING([whether to enable flow control]) - if test "$enable_btl_portals4_flow_control" != "yes"; then - AC_MSG_RESULT([no]) - btl_portals4_flow_control_enabled=0 + if test "$enable_btl_portals4_flow_control" != "no"; then + AC_MSG_RESULT([yes]) + btl_portals4_flow_control_enabled=1 else AC_MSG_RESULT([no]) btl_portals4_flow_control_enabled=0 From 3964144ca55dd506f280cba97debb05851cdc311 Mon Sep 17 00:00:00 2001 From: Maxwell Coil Date: Sun, 10 Nov 2019 14:58:55 -0500 Subject: [PATCH 470/674] Fix misleading error message with missing #! interpreter This change fixes the misleading error message. I added a conditional to determine whether the error is due to a missing file or a bad interpreter. If it is the latter, a new, more precise error message will be displayed. Fixes #4528 Signed-off-by: Maxwell Coil (cherry picked from commit 9b73f6ac83b1efd6db60d71a6e0a4c83b52af0aa) --- orte/mca/odls/default/odls_default_module.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index ab9d6e442f6..f8012bb3c92 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -454,11 +454,22 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd) /* Exec the new executable */ execve(cd->cmd, cd->argv, cd->env); - getcwd(dir, sizeof(dir)); + /* If we get here, an error has occurred. */ + (void) getcwd(dir, sizeof(dir)); + struct stat stats; + char* msg; + /* If errno is ENOENT, that indicates either cd->cmd does not exist, or + * cd->cmd is a script, but has a bad interpreter specified. */ + if (ENOENT == errno && 0 == stat(cd->app->app, &stats)) { + asprintf(&msg, "%s has a bad interpreter on the first line.", + cd->app->app); + } else { + msg = strdup(strerror(errno)); + } send_error_show_help(write_fd, 1, "help-orte-odls-default.txt", "execve error", - orte_process_info.nodename, dir, cd->app->app, strerror(errno)); - /* Does not return */ + orte_process_info.nodename, dir, cd->app->app, msg); + free(msg); } From 879a25c239e1c45bb255156497f995af23b921cf Mon Sep 17 00:00:00 2001 From: Maxwell Coil Date: Mon, 2 Dec 2019 17:52:06 -0500 Subject: [PATCH 471/674] ompi/dpm/dpm.c: Fix uninititalized variable Squash compiler warning. Signed-off-by: Maxwell Coil (cherry picked from commit 3ced33c2ebf403206c242c89bb70b6b9a0fc8968) --- ompi/dpm/dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index 9fb42dcce08..435b5ce96ec 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -405,7 +405,7 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root, } if (0 < opal_list_get_size(&ilist)) { uint32_t *peer_ranks = NULL; - int prn, nprn; + int prn, nprn = 0; char *val, *mycpuset; uint16_t u16; opal_process_name_t wildcard_rank; From 84a67bd6cfa5d40e212f999adf425bcf06a2e16e Mon Sep 17 00:00:00 2001 From: Maxwell Coil Date: Mon, 2 Dec 2019 17:53:15 -0500 Subject: [PATCH 472/674] libnbc: fixed uninitialized variable Squash compiler warning. Signed-off-by: Maxwell Coil (cherry picked from commit 52241dbbcdcbf3605c8098d0cfbcf3c5a75a1c9c) --- ompi/mca/coll/libnbc/nbc_ialltoall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/coll/libnbc/nbc_ialltoall.c b/ompi/mca/coll/libnbc/nbc_ialltoall.c index e2731e1a1d3..6c5883f23c9 100644 --- a/ompi/mca/coll/libnbc/nbc_ialltoall.c +++ b/ompi/mca/coll/libnbc/nbc_ialltoall.c @@ -70,7 +70,7 @@ static int nbc_alltoall_init(const void* sendbuf, int sendcount, MPI_Datatype se enum {NBC_A2A_LINEAR, NBC_A2A_PAIRWISE, NBC_A2A_DISS, NBC_A2A_INPLACE} alg; void *tmpbuf = NULL; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; - ptrdiff_t span, gap; + ptrdiff_t span, gap = 0; NBC_IN_PLACE(sendbuf, recvbuf, inplace); From 6fdd902d3ffcf650c7353f398986efebde50be47 Mon Sep 17 00:00:00 2001 From: Maxwell Coil Date: Thu, 5 Dec 2019 18:24:02 -0500 Subject: [PATCH 473/674] romio: Update ADIOI_R_Exchange_data function Squash compiler warning due to whitespace/brace problems. The code block from lines 829-839 was improperly indented, which led to both the code being confusing and a compiler warning. Comparing this code to the current version in the MPICH repo made it clear that the code was simply improperly indented. Fixing the indentation both makes the code readable and squashes the compiler warning. Signed-off-by: Maxwell Coil (cherry picked from commit 8c237e268472a763ad4aa55e24d25ee7ca64b888) --- .../romio321/romio/adio/common/ad_read_coll.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ompi/mca/io/romio321/romio/adio/common/ad_read_coll.c b/ompi/mca/io/romio321/romio/adio/common/ad_read_coll.c index 11e657b7e39..d81ba2d3c44 100644 --- a/ompi/mca/io/romio321/romio/adio/common/ad_read_coll.c +++ b/ompi/mca/io/romio321/romio/adio/common/ad_read_coll.c @@ -826,17 +826,17 @@ static void ADIOI_R_Exchange_data(ADIO_File fd, void *buf, ADIOI_Flatlist_node if (recv_size[i]) recv_buf[i] = (char *) ADIOI_Malloc(recv_size[i]); - j = 0; - for (i=0; i < nprocs; i++) - if (recv_size[i]) { - MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, - myrank+i+100*iter, fd->comm, requests+j); - j++; + j = 0; + for (i=0; i < nprocs; i++) + if (recv_size[i]) { + MPI_Irecv(recv_buf[i], recv_size[i], MPI_BYTE, i, + myrank+i+100*iter, fd->comm, requests+j); + j++; #ifdef RDCOLL_DEBUG - DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", - myrank, recv_size[i], myrank+i+100*iter); + DBG_FPRINTF(stderr, "node %d, recv_size %d, tag %d \n", + myrank, recv_size[i], myrank+i+100*iter); #endif - } + } } /* create derived datatypes and send data */ From 07a54b7025fbc8fa745d55e5c3a66c56a62cdb14 Mon Sep 17 00:00:00 2001 From: Maxwell Coil Date: Sun, 8 Dec 2019 13:56:00 -0500 Subject: [PATCH 474/674] memory/patcher: fix compiler warning syscall() returns a long, but we are invoking shmat(), which returns a void*. Signed-off-by: Maxwell Coil (cherry picked from commit 52a9cce6f3dcd87e9ae66177398b60b9317e9339) --- opal/mca/memory/patcher/memory_patcher_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 687d430fa36..272ec721225 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -440,7 +440,7 @@ static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) if (!original_shmat) { #if defined(SYS_shmat) - result = memory_patcher_syscall(SYS_shmat, shmid, shmaddr, shmflg); + result = (void*) memory_patcher_syscall(SYS_shmat, shmid, shmaddr, shmflg); #else // IPCOP_shmat unsigned long ret; ret = memory_patcher_syscall(SYS_ipc, IPCOP_shmat, From bc018dec4af7199702da8b448ea9e50faf9724aa Mon Sep 17 00:00:00 2001 From: William Bailey Date: Sun, 27 Oct 2019 22:33:50 -0400 Subject: [PATCH 475/674] Changed the final URL to https://github.com/westes/flex Signed-off-by: William Bailey (cherry picked from commit caf1d9292c51af8b8ccdd4da1238e774c7f04545) --- HACKING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HACKING b/HACKING index 473500aa5c3..2bc008eae95 100644 --- a/HACKING +++ b/HACKING @@ -246,4 +246,4 @@ have done little to try to remove those warnings. If you do not have Flex installed, it can be downloaded from the following URL: - http://flex.sourceforge.net/ + https://github.com/westes/flex From c01a71fbe9a79b1aa22b9bdfb8f4727fe075a959 Mon Sep 17 00:00:00 2001 From: William Bailey Date: Mon, 2 Dec 2019 17:32:09 -0500 Subject: [PATCH 476/674] romio: fix uninitialized variable Squash compiler warning. ROMIO is third-party software but has an annoying compiler warning; this is the minimum distance fix. Signed-off-by: William Bailey (cherry picked from commit 30bda56bcef6f56823ac07f0418fd33e1eff837f) --- ompi/mca/io/romio321/romio/adio/common/onesided_aggregation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/io/romio321/romio/adio/common/onesided_aggregation.c b/ompi/mca/io/romio321/romio/adio/common/onesided_aggregation.c index 3e0ad1f8fcd..71a5b7bee6e 100644 --- a/ompi/mca/io/romio321/romio/adio/common/onesided_aggregation.c +++ b/ompi/mca/io/romio321/romio/adio/common/onesided_aggregation.c @@ -1966,7 +1966,7 @@ printf("iAmUsedAgg - currentRoundFDStart initialized " int *sourceAggBlockLengths=NULL; MPI_Aint *sourceAggDisplacements=NULL, *recvBufferDisplacements=NULL; MPI_Datatype *sourceAggDataTypes=NULL; - char *derivedTypePackedSourceBuffer; + char *derivedTypePackedSourceBuffer=NULL; int derivedTypePackedSourceBufferOffset = 0; int allocatedDerivedTypeArrays = 0; ADIO_Offset amountOfDataReadThisRoundAgg = 0; From 21221eb70a5281070e3300d2716bd4c90158787b Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 8 Oct 2019 21:10:49 -0700 Subject: [PATCH 477/674] coll/basic: fix neighbor alltoall message ordering This commit updates the coll/basic component to correctly order sends and receives for cartesian communicators with cyclic boundaries. This addresses an issue identified by mpi-forum/mpi-issues#153. This issue occurs when the size in any dimension is 1. This gives the same neighbor in the positive and negative directions. The old code was sending and receiving in the same order so the -1 buffer contained the +1 result and vise-versa. The problem is addressed by using unique tags for each send. This should cover both the case where overtaking is allowed and is not allowed. The former case will be possible is a MPI_Cart_create_with_info() call is added to the standard. Signed-off-by: Nathan Hjelm (cherry picked from commit 196a91e604885d7aae9ac9dfbd9b2e846b3015b7) --- ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c index 70fdf9dc1b6..c5103860e01 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c @@ -15,6 +15,7 @@ * Copyright (c) 2014-2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -67,7 +68,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, srank, - MCA_COLL_BASE_TAG_ALLTOALL, + MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -77,7 +78,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, drank, - MCA_COLL_BASE_TAG_ALLTOALL, + MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -104,7 +105,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ * a const for the send buffer. */ nreqs++; rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank, - MCA_COLL_BASE_TAG_ALLTOALL, + MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -115,7 +116,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank, - MCA_COLL_BASE_TAG_ALLTOALL, + MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; From be58cf7982e26a87b66713bb4591e2a0972366d2 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 11 Dec 2019 12:40:38 -0500 Subject: [PATCH 478/674] Fix the communication ordering for all cartesian neighbor collectives. This work is rooted in the [MPI Forum issue 153](https://github.com/mpi-forum/mpi-issues/issues/153). Signed-off-by: George Bosilca (cherry picked from commit 86acdee4606c1ac3b38070d1b7973a00a991f1d6) --- ompi/mca/coll/base/coll_tags.h | 2 ++ .../mca/coll/basic/coll_basic_neighbor_allgather.c | 10 +++++----- .../coll/basic/coll_basic_neighbor_allgatherv.c | 12 +++++++----- ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c | 14 +++++++++----- .../mca/coll/basic/coll_basic_neighbor_alltoallv.c | 10 +++++----- .../mca/coll/basic/coll_basic_neighbor_alltoallw.c | 10 +++++----- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/ompi/mca/coll/base/coll_tags.h b/ompi/mca/coll/base/coll_tags.h index f40f029fbbc..2bcf2a6cc95 100644 --- a/ompi/mca/coll/base/coll_tags.h +++ b/ompi/mca/coll/base/coll_tags.h @@ -43,6 +43,8 @@ #define MCA_COLL_BASE_TAG_SCATTERV -26 #define MCA_COLL_BASE_TAG_NONBLOCKING_BASE -27 #define MCA_COLL_BASE_TAG_NONBLOCKING_END ((-1 * INT_MAX/2) + 1) +#define MCA_COLL_BASE_TAG_NEIGHBOR_BASE (MCA_COLL_BASE_TAG_NONBLOCKING_END - 1) +#define MCA_COLL_BASE_TAG_NEIGHBOR_END (MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 1024) #define MCA_COLL_BASE_TAG_HCOLL_BASE (-1 * INT_MAX/2) #define MCA_COLL_BASE_TAG_HCOLL_END (-1 * INT_MAX) #endif /* MCA_COLL_BASE_TAGS_H */ diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_allgather.c b/ompi/mca/coll/basic/coll_basic_neighbor_allgather.c index 8f79b43d870..9bb1e360fe3 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_allgather.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_allgather.c @@ -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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -70,7 +70,7 @@ mca_coll_basic_neighbor_allgather_cart(const void *sbuf, int scount, if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, srank, - MCA_COLL_BASE_TAG_ALLGATHER, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -78,7 +78,7 @@ mca_coll_basic_neighbor_allgather_cart(const void *sbuf, int scount, /* remove cast from const when the pml layer is updated to take * a const for the send buffer. */ rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank, - MCA_COLL_BASE_TAG_ALLGATHER, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -89,13 +89,13 @@ mca_coll_basic_neighbor_allgather_cart(const void *sbuf, int scount, if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, drank, - MCA_COLL_BASE_TAG_ALLGATHER, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; nreqs++; rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank, - MCA_COLL_BASE_TAG_ALLGATHER, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c b/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c index f837109f908..37d97970a30 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_allgatherv.c @@ -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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -69,13 +69,14 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + disps[i] * extent, rcounts[i], rdtype, srank, - MCA_COLL_BASE_TAG_ALLGATHER, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; /* remove cast from const when the pml layer is updated to take * a const for the send buffer. */ nreqs++; - rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank, MCA_COLL_BASE_TAG_ALLGATHER, + rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -83,11 +84,12 @@ mca_coll_basic_neighbor_allgatherv_cart(const void *sbuf, int scount, struct omp if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + disps[i+1] * extent, rcounts[i+1], rdtype, drank, - MCA_COLL_BASE_TAG_ALLGATHER, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; nreqs++; - rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank, MCA_COLL_BASE_TAG_ALLGATHER, + rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c index c5103860e01..6d6468174ff 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoall.c @@ -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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -37,6 +37,10 @@ #include "coll_basic.h" #include "ompi/mca/topo/base/base.h" +/** + * We only have 1024 tags for the neighbor collective, so for now we only support + * 512 dimensions. + */ static int mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_datatype_t *sdtype, void *rbuf, int rcount, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, @@ -68,7 +72,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, srank, - MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -78,7 +82,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv(rbuf, rcount, rdtype, drank, - MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } @@ -105,7 +109,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ * a const for the send buffer. */ nreqs++; rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, srank, - MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim - 1, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; @@ -116,7 +120,7 @@ mca_coll_basic_neighbor_alltoall_cart(const void *sbuf, int scount, struct ompi_ if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(isend((void *) sbuf, scount, sdtype, drank, - MCA_COLL_BASE_TAG_NONBLOCKING_BASE - 2 * dim, + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c index 8449778140f..e963dc25412 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallv.c @@ -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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -68,14 +68,14 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i] * rdextent, rcounts[i], rdtype, srank, - MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i+1] * rdextent, rcounts[i+1], rdtype, drank, - MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } } @@ -98,14 +98,14 @@ mca_coll_basic_neighbor_alltoallv_cart(const void *sbuf, const int scounts[], co nreqs++; /* remove cast from const when the pml layer is updated to take a const for the send buffer */ rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i] * sdextent, scounts[i], sdtype, srank, - MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i+1] * sdextent, scounts[i+1], sdtype, drank, - MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } } diff --git a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c index 9060c82c106..29abb456252 100644 --- a/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c +++ b/ompi/mca/coll/basic/coll_basic_neighbor_alltoallw.c @@ -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-2019 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -65,14 +65,14 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co if (MPI_PROC_NULL != srank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i], rcounts[i], rdtypes[i], srank, - MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(irecv((char *) rbuf + rdisps[i+1], rcounts[i+1], rdtypes[i+1], drank, - MCA_COLL_BASE_TAG_ALLTOALL, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } } @@ -95,14 +95,14 @@ mca_coll_basic_neighbor_alltoallw_cart(const void *sbuf, const int scounts[], co nreqs++; /* remove cast from const when the pml layer is updated to take a const for the send buffer */ rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i], scounts[i], sdtypes[i], srank, - MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim - 1, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } if (MPI_PROC_NULL != drank) { nreqs++; rc = MCA_PML_CALL(isend((char *) sbuf + sdisps[i+1], scounts[i+1], sdtypes[i+1], drank, - MCA_COLL_BASE_TAG_ALLTOALL, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); + MCA_COLL_BASE_TAG_NEIGHBOR_BASE - 2 * dim, MCA_PML_BASE_SEND_STANDARD, comm, preqs++)); if (OMPI_SUCCESS != rc) break; } } From ae30df4bae2cf9316fe697454287f9c2e0faa78a Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Thu, 19 Dec 2019 21:14:54 +0200 Subject: [PATCH 479/674] oshmem/ucx: fixed a build issue Co-authored with: Artem Polyakov Signed-off-by: Tomislav Janjusic (cherry picked from commit cb5ff55b27528817a2fbe6dbf452535a6219f57f) --- oshmem/mca/sshmem/ucx/sshmem_ucx_module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c index 52b4d560626..a069bf5cd2e 100644 --- a/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c +++ b/oshmem/mca/sshmem/ucx/sshmem_ucx_module.c @@ -226,6 +226,7 @@ segment_create(map_segment_t *ds_buf, int ret; #if HAVE_UCX_DEVICE_MEM + int ret = OSHMEM_ERROR; if (hint & SHMEM_HINT_DEVICE_NIC_MEM) { if (size > UINT_MAX) { return OSHMEM_ERR_BAD_PARAM; From 5489bc081f4417fb77c583d5f5b2cbf1bb83d1f0 Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Thu, 19 Dec 2019 21:15:41 +0200 Subject: [PATCH 480/674] oshmem/extended: Fix shmem_atomic_set for float and double. Co-authored with: Artem Polyakov Signed-off-by: Tomislav Janjusic (cherry picked from commit 2d8f9b1d09d0dd8dee9e81f0ea4eaac6f979621c) --- oshmem/shmem/c/shmem_set.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/oshmem/shmem/c/shmem_set.c b/oshmem/shmem/c/shmem_set.c index 5091882714e..30fef842cb3 100644 --- a/oshmem/shmem/c/shmem_set.c +++ b/oshmem/shmem/c/shmem_set.c @@ -27,17 +27,18 @@ int rc = OSHMEM_SUCCESS; \ size_t size = 0; \ type out_value; \ - \ + uint64_t value_tmp; \ RUNTIME_CHECK_INIT(); \ RUNTIME_CHECK_PE(pe); \ RUNTIME_CHECK_ADDR(target); \ \ size = sizeof(out_value); \ + memcpy(&value_tmp, &value, size); \ rc = MCA_ATOMIC_CALL(swap( \ ctx, \ (void*)target, \ (void*)&out_value, \ - value, \ + value_tmp, \ size, \ pe)); \ RUNTIME_CHECK_RC(rc); \ From 814f3e9caa40118eb63cdb146954a7489ae8130a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 19 Dec 2019 08:38:57 -0800 Subject: [PATCH 481/674] hwloc: clarify --with-hwloc behavior Clarify in README what --with-hwloc does in its different use cases. Also, ensure that the behavior when specifying `--with-hwloc` is the same as if that option is not specified at all. This is what we did in Open MPI <= v3.x; looks like we inadvertantly caused `--with-hwloc` to be synonymous with `--with-hwloc=external` in v4.0.0. Signed-off-by: Jeff Squyres (cherry picked from commit 18c3e1af5ef281e8b502a7ad778256889cc707d1) --- README | 36 +++++++++++++++++------------------- opal/mca/hwloc/configure.m4 | 4 ++++ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/README b/README index e6b8018f940..150fbda2ae2 100644 --- a/README +++ b/README @@ -1281,28 +1281,26 @@ MISCELLANEOUS SUPPORT LIBRARIES this option is only needed for special configurations. --with-hwloc(=value) - Build hwloc support (default: enabled). This option specifies where - to find the hwloc support headers and library. The following values - are permitted: + hwloc is a support library that provides processor and memory + affinity information for NUMA platforms. It is required by Open + MPI. Therefore, specifying --with-hwloc=no (or --without-hwloc) is + disallowed. - internal: Use Open MPI's internal copy of hwloc. - external: Use an external hwloc installation (rely on default - compiler and linker paths to find it) - : Same as "internal". - : Specify the location of a specific hwloc - installation to use + By default (i.e., if --with-hwloc is not specified, or if + --with-hwloc is specified without a value), Open MPI will first try + to find/use an hwloc installation on the current system. If Open + MPI cannot find one, it will fall back to build and use the internal + copy of hwloc included in the Open MPI source tree. - By default (or if --with-hwloc is specified with no VALUE), Open MPI - will build and use the copy of hwloc that it has in its source tree. - However, if the VALUE is "external", Open MPI will look for the - relevant hwloc header files and library in default compiler / linker - locations. Or, VALUE can be a directory tree where the hwloc header - file and library can be found. This option allows operating systems - to include Open MPI and use their default hwloc installation instead - of Open MPI's bundled hwloc. + Alternatively, the --with-hwloc option can be used to specify where + to find the hwloc support headers and library. The following values + are permitted: - hwloc is a support library that provides processor and memory - affinity information for NUMA platforms. + internal: Only use Open MPI's internal copy of hwloc. + external: Only use an external hwloc installation (rely on + default compiler and linker paths to find it). + : Only use the specific hwloc installation found in + the specified directory. --with-hwloc-libdir= Look in directory for the hwloc libraries. This option is only diff --git a/opal/mca/hwloc/configure.m4 b/opal/mca/hwloc/configure.m4 index 1f933c34f30..f56f947c8fb 100644 --- a/opal/mca/hwloc/configure.m4 +++ b/opal/mca/hwloc/configure.m4 @@ -75,6 +75,10 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ AC_MSG_WARN([an external copy that you supply.]) AC_MSG_ERROR([Cannot continue])]) + # check for no-op + AS_IF([test "$with_hwloc" = "yes"], + [with_hwloc=""]) + # set default opal_hwloc_base_enable_xml=0 From 1bee429a8d1f8e3a57fb4b62b8838d43a76eba7e Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Thu, 1 Nov 2018 14:03:00 -0700 Subject: [PATCH 482/674] MTL/OFI: Check threshold number of peers allowed per rank When the provider does not support FI_REMOTE_CQ_DATA, the OFI tag does not have sizeof(int) bits for the rank. Therefore, unexpected behavior will occur when this limit is crossed. Check the max allowed number of ranks during add_procs() and return if there is danger of exceeding this threshold. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 5cf43de44538b818b014bdad0490439e2d212395) --- ompi/mca/mtl/ofi/mtl_ofi.c | 16 ++++++++++++++++ ompi/mca/mtl/ofi/mtl_ofi_component.c | 6 +++++- ompi/mca/mtl/ofi/mtl_ofi_endpoint.h | 8 +++++++- ompi/mca/mtl/ofi/mtl_ofi_types.h | 3 ++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.c b/ompi/mca/mtl/ofi/mtl_ofi.c index 7e19f170e64..b7f0b019b66 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.c +++ b/ompi/mca/mtl/ofi/mtl_ofi.c @@ -54,9 +54,22 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, char *ep_names = NULL; fi_addr_t *fi_addrs = NULL; mca_mtl_ofi_endpoint_t *endpoint = NULL; + int num_peers_limit = (1 << ompi_mtl_ofi.num_bits_source_rank) - 1; namelen = ompi_mtl_ofi.epnamelen; + /* We cannot add more ranks than available tag bits */ + if ((false == ompi_mtl_ofi.fi_cq_data) && + OPAL_UNLIKELY(((int) (nprocs + ompi_mtl_ofi.num_peers) > num_peers_limit))) { + opal_output(0, "%s:%d: OFI provider: %s does not have enough bits for source rank in its tag.\n" + "Adding more ranks will result in undefined behaviour. Please enable\n" + "FI_REMOTE_CQ_DATA feature in the provider. For more info refer fi_cq(3).\n", + __FILE__, __LINE__, ompi_mtl_ofi.provider_name); + fflush(stderr); + ret = OMPI_ERROR; + goto bail; + } + /** * Create array of EP names. */ @@ -126,6 +139,9 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL] = endpoint; } + /* Update global counter of number of procs added to this rank */ + ompi_mtl_ofi.num_peers += nprocs; + ret = OMPI_SUCCESS; bail: diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 1da8f2b0451..70ed0d24d50 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -14,7 +14,7 @@ #include "mtl_ofi.h" #include "opal/util/argv.h" -#include "opal/util/show_help.h" +#include "opal/util/printf.h" static int ompi_mtl_ofi_component_open(void); static int ompi_mtl_ofi_component_query(mca_base_module_t **module, int *priority); @@ -576,6 +576,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi_define_tag_mode(ofi_tag_mode); } + ompi_mtl_ofi.num_peers = 0; + /** * Open fabric * The getinfo struct returns a fabric attribute struct that can be used to @@ -709,6 +711,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } + ompi_mtl_ofi.provider_name = strdup(prov->fabric_attr->prov_name); + /** * Free providers info since it's not needed anymore. */ diff --git a/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h b/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h index 788d0919168..11003e675b9 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h @@ -41,7 +41,13 @@ typedef struct mca_mtl_ofi_endpoint_t mca_mtl_ofi_endpoint_t; static inline mca_mtl_ofi_endpoint_t *ompi_mtl_ofi_get_endpoint (struct mca_mtl_base_module_t* mtl, ompi_proc_t *ompi_proc) { if (OPAL_UNLIKELY(NULL == ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL])) { - ompi_mtl_ofi_add_procs(mtl, 1, &ompi_proc); + if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_mtl_ofi_add_procs(mtl, 1, &ompi_proc))) { + /* Fatal error. exit() out */ + opal_output(0, "%s:%d: *** The Open MPI OFI MTL is aborting the MPI job (via exit(3)).\n", + __FILE__, __LINE__); + fflush(stderr); + exit(1); + } } return ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL]; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index ec82cde5894..0831c3b9881 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -43,7 +43,7 @@ typedef struct mca_mtl_ofi_module_t { /** "Any source" address */ fi_addr_t any_addr; - /** Optional user-specified OFI provider name */ + /** OFI provider name */ char *provider_name; /** Maximum inject size */ @@ -64,6 +64,7 @@ typedef struct mca_mtl_ofi_module_t { unsigned long long source_rank_mask; unsigned long long mpi_tag_mask; int num_bits_mpi_tag; + int num_peers; /** Synchronous protocol tag bits */ unsigned long long sync_send; From 47c435e531567cdfe8a440f6f1cd0246092dbd2c Mon Sep 17 00:00:00 2001 From: Robert Wespetal Date: Mon, 16 Dec 2019 13:05:00 -0800 Subject: [PATCH 483/674] mtl/ofi: ignore case when comparing provider names Change the provider include and exclude list name comparison check to ignore case. The UDP provider's name is uppercase and was being selected despite being in the exclude list. Signed-off-by: Robert Wespetal (cherry picked from commit 9b72e9465da3f2891ac13ed0443db44136506a1a) --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 1da8f2b0451..56e1d893214 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -293,7 +293,7 @@ is_in_list(char **list, char *item) } while (NULL != list[i]) { - if (0 == strncmp(item, list[i], strlen(list[i]))) { + if (0 == strncasecmp(item, list[i], strlen(list[i]))) { return 1; } else { i++; From a183bb019d313e059fe6781a57d1fb96e311acd0 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 30 Dec 2019 06:05:49 -0800 Subject: [PATCH 484/674] openmpi.spec: update modulefile_path behavior Allow the user to override the modulefile_path (root directory to install the Open MPI modulefile), even if install_in_opt==1. For example: rpmbuild \ --rebuild \ --define 'install_in_opt 1' \ --define 'modulefile_path /path/to/my/modulefiles/openmpi/%{version}' \ openmpi-4.0.2-1.src.rpm Signed-off-by: Jeff Squyres (cherry picked from commit 352e575e187bfc0a129c51924c244384f3303a65) --- contrib/dist/linux/openmpi.spec | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/contrib/dist/linux/openmpi.spec b/contrib/dist/linux/openmpi.spec index 01a7b1b4d0f..970d2fe8073 100644 --- a/contrib/dist/linux/openmpi.spec +++ b/contrib/dist/linux/openmpi.spec @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. # Copyright (c) 2015 Research Organization for Information Science @@ -51,7 +51,10 @@ ############################################################################# # Define this if you want to make this SRPM build in -# /opt/NAME/VERSION-RELEASE instead of the default /usr/. +# /opt/NAME/VERSION-RELEASE instead of the default /usr/. Note that +# Open MPI will be *entirely* installed in /opt. One possible +# exception is the modulefile -- see the description of +# modulefile_path, below. # type: bool (0/1) %{!?install_in_opt: %define install_in_opt 0} @@ -67,8 +70,15 @@ # Define this to 1 if you want this RPM to install a modulefile. # type: bool (0/1) %{!?install_modulefile: %define install_modulefile 0} -# type: string (root path to install modulefiles) -%{!?modulefile_path: %define modulefile_path /usr/share/Modules/modulefiles} + +# Root path to install modulefiles. If the value modulefile_path is +# set, that directory is the root path for where the modulefile will +# be installed there (assuming install_modulefile==1), even if +# install_in_opt==1. type: string (root path to install modulefile) +# +# NOTE: modulefile_path is not actually defined here, because we have +# to check/process install_in_opt first. + # type: string (subdir to install modulefile) %{!?modulefile_subdir: %define modulefile_subdir %{name}} # type: string (name of modulefile) @@ -152,21 +162,31 @@ %define _libdir /opt/%{name}/%{version}/lib %define _includedir /opt/%{name}/%{version}/include %define _mandir /opt/%{name}/%{version}/man + # Note that the name "openmpi" is hard-coded in # opal/mca/installdirs/config for pkgdatadir; there is currently no # easy way to have OMPI change this directory name internally. So we # just hard-code that name here as well (regardless of the value of # %{name} or %{_name}). %define _pkgdatadir /opt/%{name}/%{version}/share/openmpi + # Per advice from Doug Ledford at Red Hat, docdir is supposed to be in # a fixed location. But if you're installing a package in /opt, all # bets are off. So feel free to install it anywhere in your tree. He # suggests $prefix/doc. %define _defaultdocdir /opt/%{name}/%{version}/doc -# Also put the modulefile in /opt. -%define modulefile_path /opt/%{name}/%{version}/share/openmpi/modulefiles + +# Also put the modulefile in /opt (unless the user already specified +# where they want it to go -- the modulefile is a bit different in +# that the user may want it outside of /opt). +%{!?modulefile_path: %define modulefile_path /opt/%{name}/%{version}/share/openmpi/modulefiles} %endif +# Now that we have processed install_in_opt, we can see if +# modulefile_path was not set. If it was not, then set it to a +# default value. +%{!?modulefile_path: %define modulefile_path /usr/share/Modules/modulefiles} + %if !%{build_debuginfo_rpm} %define debug_package %{nil} %endif From a1b4e697f5d512f65eec324e8ca3598cbdcda5ea Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 6 Nov 2019 11:38:56 -0500 Subject: [PATCH 485/674] Prevent overflow when dealing with datatype count. This patch fixes #7147 by preventing overflow when multiplying the count and the blocklen. The count reflects MPI count and is therefore bound to the size of an int (it is an uint32_t) while the blocklen can be merged together to represent the largest contiguous memory layout and it is therefore promoted to a size_t. Signed-off-by: George Bosilca (cherry picked from commit 59fb02618e75022e3cd137199e3d390757e3c7e0) --- opal/datatype/opal_convertor.c | 2 +- opal/datatype/opal_convertor_raw.c | 4 ++-- opal/datatype/opal_datatype.h | 4 ++-- opal/datatype/opal_datatype_add.c | 15 ++++++++++++--- opal/datatype/opal_datatype_copy.h | 2 +- opal/datatype/opal_datatype_dump.c | 2 +- opal/datatype/opal_datatype_fake_stack.c | 6 +++--- opal/datatype/opal_datatype_get_count.c | 12 ++++++------ opal/datatype/opal_datatype_internal.h | 4 ++-- opal/datatype/opal_datatype_pack.c | 2 +- opal/datatype/opal_datatype_pack.h | 4 ++-- opal/datatype/opal_datatype_position.c | 4 ++-- opal/datatype/opal_datatype_unpack.c | 6 +++--- opal/datatype/opal_datatype_unpack.h | 6 +++--- 14 files changed, 41 insertions(+), 32 deletions(-) diff --git a/opal/datatype/opal_convertor.c b/opal/datatype/opal_convertor.c index 4754723f68a..853e5b1632f 100644 --- a/opal/datatype/opal_convertor.c +++ b/opal/datatype/opal_convertor.c @@ -403,7 +403,7 @@ opal_convertor_create_stack_at_begining( opal_convertor_t* convertor, pStack[1].count = pElems[0].loop.loops; pStack[1].type = OPAL_DATATYPE_LOOP; } else { - pStack[1].count = pElems[0].elem.count * pElems[0].elem.blocklen; + pStack[1].count = (size_t)pElems[0].elem.count * pElems[0].elem.blocklen; pStack[1].type = pElems[0].elem.common.type; } return OPAL_SUCCESS; diff --git a/opal/datatype/opal_convertor_raw.c b/opal/datatype/opal_convertor_raw.c index 5bea5dcf5b8..c00bf5ff4d3 100644 --- a/opal/datatype/opal_convertor_raw.c +++ b/opal/datatype/opal_convertor_raw.c @@ -125,7 +125,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { const ddt_elem_desc_t* current = &(pElem->elem); - if( count_desc != (current->count * current->blocklen) ) { /* Not the full element description */ + if( count_desc != ((size_t)current->count * current->blocklen) ) { /* Not the full element description */ if( (do_now = count_desc % current->blocklen) ) { do_now = current->blocklen - do_now; /* how much left in the block */ source_base += current->disp; @@ -152,7 +152,7 @@ opal_convertor_raw( opal_convertor_t* pConvertor, source_base += current->disp; do_now = current->count; - if( count_desc != (current->count * current->blocklen) ) { + if( count_desc != ((size_t)current->count * current->blocklen) ) { do_now = count_desc / current->blocklen; assert( 0 == (count_desc % current->blocklen) ); } diff --git a/opal/datatype/opal_datatype.h b/opal/datatype/opal_datatype.h index e1bc18c67f9..5e34b9955b0 100644 --- a/opal/datatype/opal_datatype.h +++ b/opal/datatype/opal_datatype.h @@ -373,7 +373,7 @@ opal_datatype_create_from_packed_description( void** packed_buffer, * argument, the number of bytes of the gap at the beginning. */ static inline ptrdiff_t -opal_datatype_span( const opal_datatype_t* pData, int64_t count, +opal_datatype_span( const opal_datatype_t* pData, size_t count, ptrdiff_t* gap) { if (OPAL_UNLIKELY(0 == pData->size) || (0 == count)) { @@ -383,7 +383,7 @@ opal_datatype_span( const opal_datatype_t* pData, int64_t count, *gap = pData->true_lb; ptrdiff_t extent = (pData->ub - pData->lb); ptrdiff_t true_extent = (pData->true_ub - pData->true_lb); - return true_extent + (count - 1) * extent; + return true_extent + extent * (count - 1); } #if OPAL_ENABLE_DEBUG diff --git a/opal/datatype/opal_datatype_add.c b/opal/datatype/opal_datatype_add.c index 108b4e3d1be..7038d37a4c4 100644 --- a/opal/datatype/opal_datatype_add.c +++ b/opal/datatype/opal_datatype_add.c @@ -285,7 +285,7 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA pLast->elem.common.flags = pdtAdd->flags & ~(OPAL_DATATYPE_FLAG_COMMITTED); pLast->elem.common.type = pdtAdd->id; pLast->elem.disp = disp; - pLast->elem.extent = count * extent; + pLast->elem.extent = (ptrdiff_t)count * extent; /* assume predefined datatypes without extent, aka. contiguous */ pLast->elem.count = 1; pLast->elem.blocklen = count; @@ -328,9 +328,18 @@ int32_t opal_datatype_add( opal_datatype_t* pdtBase, const opal_datatype_t* pdtA pLast->elem.count = count; pLast->elem.extent = extent; } - } else if( extent == (ptrdiff_t)(pLast->elem.count * pLast->elem.extent) ) { + } else if( extent == ((ptrdiff_t)pLast->elem.count * pLast->elem.extent) ) { /* It's just a repetition of the same element, increase the count */ - pLast->elem.count *= count; + /* We need to protect against the case where the multiplication below results in a + * number larger than the max uint32_t. In the unlikely situation where that's the case + * we should not try to optimize the item further but instead fall back and build a loop + * around it. + */ + uint32_t cnt = pLast->elem.count * count; + if( cnt < pLast->elem.count ) { + goto build_loop; + } + pLast->elem.count = cnt; /* we're good, merge the elements */ } else { /* No luck here, no optimization can be applied. Fall back to the * normal case where we add a loop around the datatype. diff --git a/opal/datatype/opal_datatype_copy.h b/opal/datatype/opal_datatype_copy.h index 11058012e1e..1a5c021e760 100644 --- a/opal/datatype/opal_datatype_copy.h +++ b/opal/datatype/opal_datatype_copy.h @@ -128,7 +128,7 @@ static inline int32_t _copy_content_same_ddt( const opal_datatype_t* datatype, i DO_DEBUG( opal_output( 0, "_copy_content_same_ddt( %p, %d, dst %p, src %p )\n", (void*)datatype, count, (void*)destination_base, (void*)source_base ); ); - iov_len_local = count * datatype->size; + iov_len_local = (size_t)count * datatype->size; /* If we have to copy a contiguous datatype then simply * do a MEM_OP. diff --git a/opal/datatype/opal_datatype_dump.c b/opal/datatype/opal_datatype_dump.c index 7782a805d0a..27903db657e 100644 --- a/opal/datatype/opal_datatype_dump.c +++ b/opal/datatype/opal_datatype_dump.c @@ -98,7 +98,7 @@ int opal_datatype_dump_data_desc( dt_elem_desc_t* pDesc, int nbElems, char* ptr, pDesc->end_loop.items, pDesc->end_loop.first_elem_disp, pDesc->end_loop.size ); else - index += snprintf( ptr + index, length - index, "count %" PRIsize_t " disp 0x%tx (%td) blen %u extent %td (size %zd)\n", + index += snprintf( ptr + index, length - index, "count %u disp 0x%tx (%td) blen %" PRIsize_t " extent %td (size %zd)\n", pDesc->elem.count, pDesc->elem.disp, pDesc->elem.disp, pDesc->elem.blocklen, pDesc->elem.extent, (pDesc->elem.count * pDesc->elem.blocklen * opal_datatype_basicDatatypes[pDesc->elem.common.type]->size) ); pDesc++; diff --git a/opal/datatype/opal_datatype_fake_stack.c b/opal/datatype/opal_datatype_fake_stack.c index bd1d919e374..aee2ccf9058 100644 --- a/opal/datatype/opal_datatype_fake_stack.c +++ b/opal/datatype/opal_datatype_fake_stack.c @@ -44,7 +44,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, int pos_desc; /* actual position in the description of the derived datatype */ size_t lastLength = 0; const opal_datatype_t* pData = pConvertor->pDesc; - size_t loop_length, *remoteLength, remote_size; + size_t loop_length, *remoteLength, remote_size; size_t resting_place = starting_point; dt_elem_desc_t* pElems; size_t count; @@ -152,7 +152,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, if( OPAL_DATATYPE_LOOP == pElems->elem.common.type ) { remoteLength[pConvertor->stack_pos] += loop_length; PUSH_STACK( pStack, pConvertor->stack_pos, pos_desc, OPAL_DATATYPE_LOOP, - pElems->loop.loops, pStack->disp ); + pElems->loop.loops, pStack->disp ); pos_desc++; pElems++; remoteLength[pConvertor->stack_pos] = 0; @@ -161,7 +161,7 @@ int opal_convertor_create_stack_with_pos_general( opal_convertor_t* pConvertor, while( pElems->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM( (*pElems) ); - lastLength = pElems->elem.count * basic_type->size; + lastLength = (size_t)pElems->elem.count * basic_type->size; if( resting_place < lastLength ) { int32_t cnt = (int32_t)(resting_place / basic_type->size); loop_length += (cnt * basic_type->size); diff --git a/opal/datatype/opal_datatype_get_count.c b/opal/datatype/opal_datatype_get_count.c index f75b86d0e2d..12dba4d0d48 100644 --- a/opal/datatype/opal_datatype_get_count.c +++ b/opal/datatype/opal_datatype_get_count.c @@ -69,14 +69,14 @@ ssize_t opal_datatype_get_element_count( const opal_datatype_t* datatype, size_t while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); - local_size = (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen) * basic_type->size; + local_size = ((size_t)pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen) * basic_type->size; if( local_size >= iSize ) { local_size = iSize / basic_type->size; nbElems += (int32_t)local_size; iSize -= local_size * basic_type->size; return (iSize == 0 ? nbElems : -1); } - nbElems += (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); + nbElems += ((size_t)pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); iSize -= local_size; pos_desc++; /* advance to the next data */ } @@ -131,7 +131,7 @@ int32_t opal_datatype_set_element_count( const opal_datatype_t* datatype, size_t while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ const opal_datatype_t* basic_type = BASIC_DDT_FROM_ELEM(pElems[pos_desc]); - local_length = (pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); + local_length = ((size_t)pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen); if( local_length >= count ) { *length += count * basic_type->size; return 0; @@ -188,10 +188,10 @@ int opal_datatype_compute_ptypes( opal_datatype_t* datatype ) } while( pElems[pos_desc].elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* now here we have a basic datatype */ - datatype->ptypes[pElems[pos_desc].elem.common.type] += pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; - nbElems += pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; + datatype->ptypes[pElems[pos_desc].elem.common.type] += (size_t)pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; + nbElems += (size_t)pElems[pos_desc].elem.count * pElems[pos_desc].elem.blocklen; - DUMP( " compute_ptypes-add: type %d count %"PRIsize_t" (total type %"PRIsize_t" total %lld)\n", + DUMP( " compute_ptypes-add: type %d count %"PRIsize_t" (total type %u total %lld)\n", pElems[pos_desc].elem.common.type, datatype->ptypes[pElems[pos_desc].elem.common.type], pElems[pos_desc].elem.count, nbElems ); pos_desc++; /* advance to the next data */ diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index bdeb0cc429e..d61ff8523f0 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -154,8 +154,8 @@ typedef struct ddt_elem_id_description ddt_elem_id_description; */ struct ddt_elem_desc { ddt_elem_id_description common; /**< basic data description and flags */ - uint32_t blocklen; /**< number of elements on each block */ - size_t count; /**< number of blocks */ + size_t blocklen; /**< number of elements on each block */ + uint32_t count; /**< number of blocks */ ptrdiff_t extent; /**< extent of each block (in bytes) */ ptrdiff_t disp; /**< displacement of the first block */ }; diff --git a/opal/datatype/opal_datatype_pack.c b/opal/datatype/opal_datatype_pack.c index 6dc0b81a253..b5225017a59 100644 --- a/opal/datatype/opal_datatype_pack.c +++ b/opal/datatype/opal_datatype_pack.c @@ -275,7 +275,7 @@ opal_generic_simple_pack_function( opal_convertor_t* pConvertor, iov_len_local = iov[iov_count].iov_len; if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { - if( (pElem->elem.count * pElem->elem.blocklen) != count_desc ) { + if( ((size_t)pElem->elem.count * pElem->elem.blocklen) != count_desc ) { /* we have a partial (less than blocklen) basic datatype */ int rc = PACK_PARTIAL_BLOCKLEN( pConvertor, pElem, count_desc, conv_ptr, iov_ptr, iov_len_local ); diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index 1eaf2e8b9f9..cbe488b7b7e 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -47,7 +47,7 @@ pack_partial_blocklen( opal_convertor_t* CONVERTOR, unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; - assert( *(COUNT) <= _elem->count * _elem->blocklen); + assert( *(COUNT) <= ((size_t)_elem->count * _elem->blocklen) ); /** * First check if we already did something on this element ? The COUNT is the number @@ -98,7 +98,7 @@ pack_predefined_data( opal_convertor_t* CONVERTOR, unsigned char* _packed = *packed; assert( 0 == (cando_count % _elem->blocklen) ); /* no partials here */ - assert( *(COUNT) <= _elem->count * _elem->blocklen); + assert( *(COUNT) <= ((size_t)_elem->count * _elem->blocklen) ); if( (blocklen_bytes * cando_count) > *(SPACE) ) cando_count = (*SPACE) / blocklen_bytes; diff --git a/opal/datatype/opal_datatype_position.c b/opal/datatype/opal_datatype_position.c index 02ec55651a0..6dc38e4ff4a 100644 --- a/opal/datatype/opal_datatype_position.c +++ b/opal/datatype/opal_datatype_position.c @@ -76,12 +76,12 @@ position_predefined_data( opal_convertor_t* CONVERTOR, size_t* SPACE ) { const ddt_elem_desc_t* _elem = &((ELEM)->elem); - size_t total_count = _elem->count * _elem->blocklen; + size_t total_count = (size_t)_elem->count * _elem->blocklen; size_t cando_count = (*SPACE) / opal_datatype_basicDatatypes[_elem->common.type]->size; size_t do_now, do_now_bytes = opal_datatype_basicDatatypes[_elem->common.type]->size; unsigned char* _memory = (*POINTER) + _elem->disp; - assert( *(COUNT) <= _elem->count * _elem->blocklen); + assert( *(COUNT) <= ((size_t)_elem->count * _elem->blocklen) ); if( cando_count > *(COUNT) ) cando_count = *(COUNT); diff --git a/opal/datatype/opal_datatype_unpack.c b/opal/datatype/opal_datatype_unpack.c index 0925bde736d..efed62451ac 100644 --- a/opal/datatype/opal_datatype_unpack.c +++ b/opal/datatype/opal_datatype_unpack.c @@ -282,7 +282,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, for( iov_count = 0; iov_count < (*out_size); iov_count++ ) { iov_ptr = (unsigned char *) iov[iov_count].iov_base; iov_len_local = iov[iov_count].iov_len; - + if( 0 != pConvertor->partial_length ) { size_t element_length = opal_datatype_basicDatatypes[pElem->elem.common.type]->size; size_t missing_length = element_length - pConvertor->partial_length; @@ -304,7 +304,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, pConvertor->partial_length = 0; /* nothing more inside */ } if( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { - if( (pElem->elem.count * pElem->elem.blocklen) != count_desc ) { + if( ((size_t)pElem->elem.count * pElem->elem.blocklen) != count_desc ) { /* we have a partial (less than blocklen) basic datatype */ int rc = UNPACK_PARTIAL_BLOCKLEN( pConvertor, pElem, count_desc, iov_ptr, conv_ptr, iov_len_local ); @@ -317,7 +317,7 @@ opal_generic_simple_unpack_function( opal_convertor_t* pConvertor, } } } - + while( 1 ) { while( pElem->elem.common.flags & OPAL_DATATYPE_FLAG_DATA ) { /* we have a basic datatype (working on full blocks) */ diff --git a/opal/datatype/opal_datatype_unpack.h b/opal/datatype/opal_datatype_unpack.h index db5b58fd3c3..79068729a14 100644 --- a/opal/datatype/opal_datatype_unpack.h +++ b/opal/datatype/opal_datatype_unpack.h @@ -47,7 +47,7 @@ unpack_partial_blocklen( opal_convertor_t* CONVERTOR, unsigned char* _memory = (*memory) + _elem->disp; unsigned char* _packed = *packed; - assert( *(COUNT) <= (_elem->count * _elem->blocklen)); + assert( *(COUNT) <= ((size_t)(_elem->count * _elem->blocklen)) ); /** * First check if we already did something on this element ? The COUNT is the number @@ -95,14 +95,14 @@ unpack_predefined_data( opal_convertor_t* CONVERTOR, unsigned char* _packed = *packed; assert( 0 == (cando_count % _elem->blocklen) ); /* no partials here */ - assert( *(COUNT) <= (_elem->count * _elem->blocklen)); + assert( *(COUNT) <= ((size_t)_elem->count * _elem->blocklen) ); if( (blocklen_bytes * cando_count) > *(SPACE) ) cando_count = (*SPACE) / blocklen_bytes; /* premptively update the number of COUNT we will return. */ *(COUNT) -= cando_count; - + if( 1 == _elem->blocklen ) { /* Do as many full blocklen as possible */ for(; cando_count > 0; cando_count--) { OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, blocklen_bytes, (CONVERTOR)->pBaseBuf, From 9330dc2a426836aa934de1c4092daa7696309a97 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 7 Nov 2019 11:18:01 -0500 Subject: [PATCH 486/674] Swap the 2 fields to maintain the size of the struct. Thanks @devreal for catching this. Signed-off-by: George Bosilca (cherry picked from commit 3de636dc6fda43fb31bcd69b6a91b7f8de1a985c) --- opal/datatype/opal_datatype_internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/datatype/opal_datatype_internal.h b/opal/datatype/opal_datatype_internal.h index d61ff8523f0..7015e99b4ff 100644 --- a/opal/datatype/opal_datatype_internal.h +++ b/opal/datatype/opal_datatype_internal.h @@ -154,8 +154,8 @@ typedef struct ddt_elem_id_description ddt_elem_id_description; */ struct ddt_elem_desc { ddt_elem_id_description common; /**< basic data description and flags */ - size_t blocklen; /**< number of elements on each block */ uint32_t count; /**< number of blocks */ + size_t blocklen; /**< number of elements on each block */ ptrdiff_t extent; /**< extent of each block (in bytes) */ ptrdiff_t disp; /**< displacement of the first block */ }; From 9582b76168f6639ecce0f0db26588d0da26e9422 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 21 Nov 2019 15:01:28 -0600 Subject: [PATCH 487/674] cray ftn: modify fortran module loc checker to support the Cray Fortran compiler. Cray Fortran compiler does not contain all symbol info in the module file, have to link with the *.o created as part of module file compilation. Signed-off-by: Howard Pritchard (cherry picked from commit 441bad9a758d79f1eb0fb85fbe6ee10a6f5e57b7) --- config/ompi_fortran_find_module_include_flag.m4 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/ompi_fortran_find_module_include_flag.m4 b/config/ompi_fortran_find_module_include_flag.m4 index 5b6e0debf0c..311a10e3ab4 100644 --- a/config/ompi_fortran_find_module_include_flag.m4 +++ b/config/ompi_fortran_find_module_include_flag.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-2012 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2019 Triad National Security, LLC. All rights +dnl reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -67,7 +69,12 @@ EOF if test "$ofi_module_flag" = ""; then OPAL_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 conftest.f90 ${flag}subdir $LDFLAGS $LIBS], [AS_VAR_SET(fortran_inc_var, [$flag]) - ofi_module_flag="$flag"]) + ofi_module_flag="$flag"], +dnl try and see if we need to link in a possible object file + [OPAL_LOG_COMMAND([$FC $FCFLAGS $FCFLAGS_f90 conftest.f90 subdir/conftest-module.o \ + ${flag}subdir $LDFLAGS $LIBS], + [AS_VAR_SET(fortran_inc_var, [$flag]) + ofi_module_flag="$flag"],[])]) fi done cd .. From a479beeeaeb1e14ffa96ee0c8edfa03c32404138 Mon Sep 17 00:00:00 2001 From: Geoffroy Vallee Date: Sun, 24 Nov 2019 11:04:10 -0500 Subject: [PATCH 488/674] Add the missing code to check a return code Signed-off-by: Geoffroy Vallee (cherry picked from commit de6f130b4a5b001ef85317fe3ebc2c8f8c8077e9) Signed-off-by: Geoffrey Paulsen --- opal/mca/shmem/mmap/shmem_mmap_component.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opal/mca/shmem/mmap/shmem_mmap_component.c b/opal/mca/shmem/mmap/shmem_mmap_component.c index acac7bb8f32..ee09b287710 100644 --- a/opal/mca/shmem/mmap/shmem_mmap_component.c +++ b/opal/mca/shmem/mmap/shmem_mmap_component.c @@ -14,6 +14,7 @@ * Copyright (c) 2010-2015 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Sylabs, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -110,6 +111,9 @@ mmap_register(void) OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_ALL_EQ, &mca_shmem_mmap_component.priority); + if (0 > ret) { + return ret; + } /* * Do we want the "warning: your mmap file is on NFS!" message? Per a From d59faea8681995f2d9ce9354665a732bf5a374cd Mon Sep 17 00:00:00 2001 From: Geoffroy Vallee Date: Sun, 24 Nov 2019 00:36:06 -0500 Subject: [PATCH 489/674] Fix a type in comments: insertted -> inserted Signed-off-by: Geoffroy Vallee (cherry picked from commit 98de17c6da85eb42963928ecbbcc9ca88fcc0598) Signed-off-by: Geoffrey Paulsen --- opal/class/opal_list.c | 2 +- opal/util/argv.h | 6 +++--- opal/util/cmd_line.c | 2 +- opal/util/opal_environ.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/opal/class/opal_list.c b/opal/class/opal_list.c index 87cb1192b1b..f61580eeabd 100644 --- a/opal/class/opal_list.c +++ b/opal/class/opal_list.c @@ -142,7 +142,7 @@ bool opal_list_insert(opal_list_t *list, opal_list_item_t *item, long long idx) #if OPAL_ENABLE_DEBUG /* Spot check: ensure this item is only on the list that we - just insertted it into */ + just inserted it into */ opal_atomic_add ( &(item->opal_list_item_refcount), 1 ); assert(1 == item->opal_list_item_refcount); diff --git a/opal/util/argv.h b/opal/util/argv.h index 3dd9b4e202b..c119d1b0bd8 100644 --- a/opal/util/argv.h +++ b/opal/util/argv.h @@ -139,7 +139,7 @@ OPAL_DECLSPEC void opal_argv_free(char **argv); * @retval argv pointer to new argv array on success * @retval NULL on error * - * All strings are insertted into the argv array by value; the + * All strings are inserted into the argv array by value; the * newly-allocated array makes no references to the src_string * argument (i.e., it can be freed after calling this function * without invalidating the output argv). @@ -156,7 +156,7 @@ OPAL_DECLSPEC char **opal_argv_split(const char *src_string, int delimiter) __o * @retval argv pointer to new argv array on success * @retval NULL on error * - * All strings are insertted into the argv array by value; the + * All strings are inserted into the argv array by value; the * newly-allocated array makes no references to the src_string * argument (i.e., it can be freed after calling this function * without invalidating the output argv). @@ -259,7 +259,7 @@ OPAL_DECLSPEC int opal_argv_delete(int *argc, char ***argv, * @retval OPAL_BAD_PARAM if any parameters are non-sensical * * This function takes one arg and inserts it in the middle of - * another. The first token in source will be insertted at index + * another. The first token in source will be inserted at index * start in the target argv; all other tokens will follow it. * Similar to opal_argv_append(), the target may be realloc()'ed * to accomodate the new storage requirements. diff --git a/opal/util/cmd_line.c b/opal/util/cmd_line.c index f17263ac3c0..3fe1f26f9bb 100644 --- a/opal/util/cmd_line.c +++ b/opal/util/cmd_line.c @@ -383,7 +383,7 @@ int opal_cmd_line_parse(opal_cmd_line_t *cmd, bool ignore_unknown, bool ignore_u /* Suck down the following parameters that belong to this option. If we run out of parameters, or find that any of them are the special_empty_param - (insertted by split_shorts()), then print an error + (inserted by split_shorts()), then print an error and return. */ param = OBJ_NEW(ompi_cmd_line_param_t); diff --git a/opal/util/opal_environ.h b/opal/util/opal_environ.h index 094266c40d8..f7dac6adfe4 100644 --- a/opal/util/opal_environ.h +++ b/opal/util/opal_environ.h @@ -79,7 +79,7 @@ OPAL_DECLSPEC char **opal_environ_merge(char **minor, char **major) __opal_attri * * \em env is expected to be a NULL-terminated array of pointers * (argv-style). Note that unlike some implementations of - * putenv(3), if \em value is insertted in \em env, it is copied. + * putenv(3), if \em value is inserted in \em env, it is copied. * So the caller can modify/free both \em name and \em value after * opal_setenv() returns. * From 836ce83c9aa4dd7398202eec899f8e60bbe6efeb Mon Sep 17 00:00:00 2001 From: Geoffroy Vallee Date: Sun, 24 Nov 2019 11:06:41 -0500 Subject: [PATCH 490/674] Fix typo in comment: contiaing -> containing Signed-off-by: Geoffroy Vallee (cherry picked from commit 127573cf44973c5c670a55e80ab3603e22af70ac) Signed-off-by: Geoffrey Paulsen --- opal/util/path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/util/path.c b/opal/util/path.c index 7c69c017ce7..885a9047028 100644 --- a/opal/util/path.c +++ b/opal/util/path.c @@ -298,7 +298,7 @@ char *opal_path_access(char *fname, char *path, int mode) * Loads argument array with $PATH env var. * * Accepts - * -path String contiaing the $PATH + * -path String containing the $PATH * -argc Pointer to argc * -argv Pointer to list of argv */ From e06595d7f6a4622d7bb8a93c669a4d20d5b7ed3e Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 21 Nov 2019 14:14:40 -0600 Subject: [PATCH 491/674] lustre: squash some compiler warnings Compiling OMPI on cray systems using latest Cray compilers (clang based) yielded some compiler warnings from ompio/lustre. Squash these warnings. Signed-off-by: Howard Pritchard (cherry picked from commit e66a7cef11c51f64b7766080e1cef34b1395c4da) Signed-off-by: Geoffrey Paulsen --- ompi/mca/fs/lustre/fs_lustre.c | 2 +- ompi/mca/fs/lustre/fs_lustre_file_open.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ompi/mca/fs/lustre/fs_lustre.c b/ompi/mca/fs/lustre/fs_lustre.c index e2aad6fa2ff..df2c7c3ac7c 100644 --- a/ompi/mca/fs/lustre/fs_lustre.c +++ b/ompi/mca/fs/lustre/fs_lustre.c @@ -92,7 +92,7 @@ mca_fs_lustre_component_file_query (ompio_file_t *fh, int *priority) if (!tmp) { /* The communicator might be NULL if we only want to delete the file */ if (OMPIO_ROOT == fh->f_rank || MPI_COMM_NULL == fh->f_comm) { - fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename ); + fh->f_fstype = mca_fs_base_get_fstype ( (char *)fh->f_filename ); } if (fh->f_comm != MPI_COMM_NULL) { fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype), diff --git a/ompi/mca/fs/lustre/fs_lustre_file_open.c b/ompi/mca/fs/lustre/fs_lustre_file_open.c index 1baf6a159b3..6dc996caf3a 100644 --- a/ompi/mca/fs/lustre/fs_lustre_file_open.c +++ b/ompi/mca/fs/lustre/fs_lustre_file_open.c @@ -34,11 +34,11 @@ #include -static void *alloc_lum(); +static void *alloc_lum(void); -static void *alloc_lum() +static void *alloc_lum(void) { - int v1, v3, join; + int v1, v3; v1 = sizeof(struct lov_user_md_v1) + LOV_MAX_STRIPE_COUNT * sizeof(struct lov_user_ost_data_v1); From ff85c82151ade9231bd53b4e2a2e36c6a6861b6e Mon Sep 17 00:00:00 2001 From: Michael Lass Date: Fri, 22 Nov 2019 19:49:11 +0100 Subject: [PATCH 492/674] dims_create: fix calculation of factors for odd squares Until now sqrt(n) was missed as a factor for odd square numbers n. This lead to suboptimal results of MPI_Dims_create for input numbers like 9, 25, 49, ... Fix the results by including sqrt(n) in the search for factors. Refs: #7186 Signed-off-by: Michael Lass (cherry picked from commit 67490118adb8372d2aefe1d2d923432e51e100cd) --- ompi/mpi/c/dims_create.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mpi/c/dims_create.c b/ompi/mpi/c/dims_create.c index fbbc31c42f4..1acdace5ff9 100644 --- a/ompi/mpi/c/dims_create.c +++ b/ompi/mpi/c/dims_create.c @@ -240,7 +240,7 @@ getfactors(int num, int *nfactors, int **factors) { } /* determine all occurences of uneven prime numbers up to sqrt(num) */ d = 3; - for(d = 3; (num > 1) && (d < sqrtnum); d += 2) { + for(d = 3; (num > 1) && (d <= sqrtnum); d += 2) { while((num % d) == 0) { num /= d; (*factors)[i++] = d; From baf1b06c9ed5b363826dd197470cc5d7519ca88c Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 17 Jan 2020 10:21:40 -0700 Subject: [PATCH 493/674] VERSION - update for v4.0.3 Signed-off-by: Howard Pritchard --- VERSION | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/VERSION b/VERSION index ce7c45397b2..2ecbba1b9c9 100644 --- a/VERSION +++ b/VERSION @@ -21,7 +21,7 @@ major=4 minor=0 -release=2 +release=3 # greek is generally used for alpha or beta release tags. If it is # non-empty, it will be appended to the version number. It does not @@ -30,7 +30,7 @@ release=2 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc3 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -88,16 +88,16 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=60:2:20 +libmpi_so_version=60:3:20 libmpi_cxx_so_version=60:1:20 libmpi_mpifh_so_version=60:2:20 libmpi_usempi_tkr_so_version=60:0:20 libmpi_usempi_ignore_tkr_so_version=60:0:20 -libmpi_usempif08_so_version=60:1:20 -libopen_rte_so_version=60:2:20 -libopen_pal_so_version=60:2:20 +libmpi_usempif08_so_version=61:0:21 +libopen_rte_so_version=60:3:20 +libopen_pal_so_version=60:3:20 libmpi_java_so_version=60:0:20 -liboshmem_so_version=62:0:22 +liboshmem_so_version=62:1:22 libompitrace_so_version=60:0:20 # "Common" components install standalone libraries that are run-time @@ -106,7 +106,7 @@ libompitrace_so_version=60:0:20 # components-don't-affect-the-build-system abstraction. # OMPI layer -libmca_ompi_common_ompio_so_version=60:2:19 +libmca_ompi_common_ompio_so_version=60:3:19 libmca_ompi_common_monitoring_so_version=60:0:10 # ORTE layer From 9d32fedd55ba53dfe98a66f5584b75d8fffc83ec Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 17 Jan 2020 11:29:08 -0700 Subject: [PATCH 494/674] NEWS: update for 4.0.3 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/NEWS b/NEWS index b2f4789136a..560b809e543 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,31 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. +4.0.3 -- January, 2020 +------------------------ +- Add support for Mellanox Connectx6. +- Improve dimensions returned by MPI_Dims_create for certain + cases. Thanks to @aw32 for reporting. +- Fix an issue when sending messages larger than 4GB. Thanks to + Philip Salzmann for reporting this issue. +- Add ability to specify alternative module file path using + Open MPI's RPM spec file. Thanks to @jschwartz-cray for reporting. +- Clarify use of --with-hwloc configuration option in the README. + Thanks to Marcin Mielniczuk for raising this documentation issue. +- Fix an issue with shmem_atomic_set. Thanks to Sameh Sharkawi for reporting. +- Fix a problem with MPI_Neighbor_alltoall(v,w) for cartesian communicators + with cyclic boundary conditions. Thanks to Ralph Rabenseifner and + Tony Skjellum for reporting. +- Fix an issue using Open MPIO on 32 bit systems. Thanks to + Orion Poplawski for reporting. +- Fix an issue with NetCDF test deadlocking when using the vulcan + Open MPIO component. Thanks to Orion Poplawski for reporting. +- Fix an issue with the mpi_yield_when_idle parameter being ignored + when set in the Open MPI MCA parameter configuration file. + Thanks to @iassiour for reporting. +- Address an issue with Open MPIO when writing/reading more than 2GB + in an operation. Thanks to Richard Warren for reporting. + 4.0.2 -- September, 2019 ------------------------ - Update embedded PMIx to 3.1.4 From 76002ada84436db394ba93496c4a94d40f3f880f Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 7 Jan 2020 21:43:58 -0700 Subject: [PATCH 495/674] opal: make interval tree resilient to similar intervals There are cases where the same interval may be in the tree multiple times. This generally isn't a problem when searching the tree but may cause issues when attempting to delete a particular registration from the tree. The issue is fixed by breaking a low value tie by checking the high value then the interval data. If the high, low, and data of a new insertion exactly matches an existing interval then an assertion is raised. Signed-off-by: Nathan Hjelm (cherry picked from commit 1145abc0b790f82ea25e24a3becad91ff502769c) --- opal/class/opal_interval_tree.c | 55 +++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/opal/class/opal_interval_tree.c b/opal/class/opal_interval_tree.c index e8ccda2024b..110dccdacc9 100644 --- a/opal/class/opal_interval_tree.c +++ b/opal/class/opal_interval_tree.c @@ -12,6 +12,7 @@ * All rights reserved. * Copyright (c) 2015-2018 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +40,7 @@ static opal_interval_tree_node_t *opal_interval_tree_next (opal_interval_tree_t opal_interval_tree_node_t *node); static opal_interval_tree_node_t * opal_interval_tree_find_node(opal_interval_tree_t *tree, uint64_t low, uint64_t high, - bool exact, void *data); + void *data); static opal_interval_tree_node_t *left_rotate (opal_interval_tree_t *tree, opal_interval_tree_node_t *x); static opal_interval_tree_node_t *right_rotate (opal_interval_tree_t *tree, opal_interval_tree_node_t *x); @@ -355,31 +356,54 @@ int opal_interval_tree_insert (opal_interval_tree_t *tree, void *value, uint64_t return OPAL_SUCCESS; } +static int opal_interval_tree_compare_node(opal_interval_tree_node_t *node, uint64_t low, uint64_t high, void *data) { + if ((data && node->low == low && node->high == high && node->data == data) || + (!data && node->low <= low && node->high >= high)) { + return 0; + } + if (node->low > low) { + return -1; + } + if (node->low < low) { + return 1; + } + if (node->high < high) { + return -1; + } + if (node->high > high) { + return 1; + } + if (node->data > data) { + return -1; + } + return 1; +} + static opal_interval_tree_node_t *opal_interval_tree_find_interval(opal_interval_tree_t *tree, opal_interval_tree_node_t *node, uint64_t low, - uint64_t high, bool exact, void *data) + uint64_t high, void *data) { if (node == &tree->nill) { return NULL; } - if (((exact && node->low == low && node->high == high) || (!exact && node->low <= low && node->high >= high)) && - (!data || node->data == data)) { + int check = opal_interval_tree_compare_node(node, low, high, data); + if (0 == check) { return node; } - if (low <= node->low) { - return opal_interval_tree_find_interval (tree, node->left, low, high, exact, data); + if (-1 == check) { + return opal_interval_tree_find_interval (tree, node->left, low, high, data); } - return opal_interval_tree_find_interval (tree, node->right, low, high, exact, data); + return opal_interval_tree_find_interval (tree, node->right, low, high, data); } /* Finds the node in the tree based on the key and returns a pointer * to the node. This is a bit a code duplication, but this has to be fast * so we go ahead with the duplication */ -static opal_interval_tree_node_t *opal_interval_tree_find_node(opal_interval_tree_t *tree, uint64_t low, uint64_t high, bool exact, void *data) +static opal_interval_tree_node_t *opal_interval_tree_find_node(opal_interval_tree_t *tree, uint64_t low, uint64_t high, void *data) { - return opal_interval_tree_find_interval (tree, tree->root.left, low, high, exact, data); + return opal_interval_tree_find_interval (tree, tree->root.left, low, high, data); } void *opal_interval_tree_find_overlapping (opal_interval_tree_t *tree, uint64_t low, uint64_t high) @@ -388,7 +412,7 @@ void *opal_interval_tree_find_overlapping (opal_interval_tree_t *tree, uint64_t opal_interval_tree_node_t *node; token = opal_interval_tree_reader_get_token (tree); - node = opal_interval_tree_find_node (tree, low, high, true, NULL); + node = opal_interval_tree_find_node (tree, low, high, NULL); opal_interval_tree_reader_return_token (tree, token); return node ? node->data : NULL; @@ -536,7 +560,7 @@ int opal_interval_tree_delete (opal_interval_tree_t *tree, uint64_t low, uint64_ opal_interval_tree_node_t *node; opal_interval_tree_write_lock (tree); - node = opal_interval_tree_find_node (tree, low, high, true, data); + node = opal_interval_tree_find_node (tree, low, high, data); if (NULL == node) { opal_interval_tree_write_unlock (tree); return OPAL_ERR_NOT_FOUND; @@ -618,18 +642,23 @@ static void opal_interval_tree_insert_node (opal_interval_tree_t *tree, opal_int node->right = nill; /* find the leaf where we will insert the node */ + int check = -1; while (n != nill) { + check = opal_interval_tree_compare_node(n, node->low, node->high, node->data); + /* node already exists */ + assert (0 != check); + if (n->max < node->high) { n->max = node->high; } parent = n; - n = ((node->low < n->low) ? n->left : n->right); + n = (-1 == check) ? n->left : n->right; assert (nill == n || n->parent == parent); } /* place it on either the left or the right */ - if ((node->low < parent->low)) { + if (-1 == check) { parent->left = node; } else { parent->right = node; From a64a7c8a0a20b6b883b55abc1b92d6db1f75adb8 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 7 Jan 2020 21:48:01 -0700 Subject: [PATCH 496/674] btl/vader: fix issues with xpmem registration invalidation This commit fixes an issue discovered in the XPMEM registration cache. It was possible for a registration to be invalidated by multiple threads leading to a double-free situation or re-use of an invalidated registration. This commit fixes the issue by setting the INVALID flag on a registation when it will be deleted. The flag is set while iterating over the tree to take advantage of the fact that a registration can not be removed from the VMA tree by a thread while another thread is traversing the VMA tree. References #6524 References #7030 Closes #6534 Signed-off-by: Nathan Hjelm (cherry picked from commit f86f805be1145ace46b570c5c518555b38e58cee) --- opal/mca/btl/vader/btl_vader_xpmem.c | 69 +++++++++++++++++++--------- 1 file changed, 48 insertions(+), 21 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader_xpmem.c b/opal/mca/btl/vader/btl_vader_xpmem.c index 219c0bd5f7b..5bfe8e1a641 100644 --- a/opal/mca/btl/vader/btl_vader_xpmem.c +++ b/opal/mca/btl/vader/btl_vader_xpmem.c @@ -5,6 +5,7 @@ * Copyright (c) 2014 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,8 +45,7 @@ static int vader_check_reg (mca_rcache_base_registration_t *reg, void *ctx) { vader_check_reg_ctx_t *vader_ctx = (vader_check_reg_ctx_t *) ctx; - if ((intptr_t) reg->alloc_base != vader_ctx->ep->peer_smp_rank || - (reg->flags & MCA_RCACHE_FLAGS_PERSIST)) { + if ((intptr_t) reg->alloc_base != vader_ctx->ep->peer_smp_rank) { /* ignore this registration */ return OPAL_SUCCESS; } @@ -53,10 +53,26 @@ static int vader_check_reg (mca_rcache_base_registration_t *reg, void *ctx) vader_ctx->reg[0] = reg; if (vader_ctx->bound <= (uintptr_t) reg->bound && vader_ctx->base >= (uintptr_t) reg->base) { - opal_atomic_add (®->ref_count, 1); + if (0 == opal_atomic_fetch_add_32 (®->ref_count, 1)) { + /* registration is being deleted by a thread in vader_return_registration. the + * VMA tree implementation will block in mca_rcache_delete until we finish + * iterating over the VMA tree so it is safe to just ignore this registration + * and continue. */ + vader_ctx->reg[0] = NULL; + return OPAL_SUCCESS; + } return 1; } + if (MCA_RCACHE_FLAGS_INVALID & opal_atomic_fetch_or_32(®->flags, MCA_RCACHE_FLAGS_INVALID)) { + /* another thread has already marked this registration as invalid. ignore and continue. */ + vader_ctx->reg[0] = NULL; + return OPAL_SUCCESS; + } + + /* let the caller know we found an overlapping registration that can be coalesced into + * the requested interval. the caller will remove the last reference and delete the + * registration. */ return 2; } @@ -67,8 +83,12 @@ void vader_return_registration (mca_rcache_base_registration_t *reg, struct mca_ ref_count = opal_atomic_add_fetch_32 (®->ref_count, -1); if (OPAL_UNLIKELY(0 == ref_count && !(reg->flags & MCA_RCACHE_FLAGS_PERSIST))) { - mca_rcache_base_vma_delete (vma_module, reg); - +#if OPAL_DEBUG + int ret = mca_rcache_base_vma_delete (vma_module, reg); + assert (OPAL_SUCCESS == ret); +#else + (void) mca_rcache_base_vma_delete (vma_module, reg); +#endif opal_memchecker_base_mem_noaccess (reg->rcache_context, (uintptr_t)(reg->bound - reg->base)); (void)xpmem_detach (reg->rcache_context); OBJ_RELEASE (reg); @@ -100,16 +120,9 @@ mca_rcache_base_registration_t *vader_get_registation (struct mca_btl_base_endpo /* several segments may match the base pointer */ rc = mca_rcache_base_vma_iterate (vma_module, (void *) base, bound - base, true, vader_check_reg, &check_ctx); if (2 == rc) { - /* remove this pointer from the rcache and decrement its reference count - (so it is detached later) */ - mca_rcache_base_vma_delete (vma_module, reg); - - /* start the new segment from the lower of the two bases */ - base = (uintptr_t) reg->base < base ? (uintptr_t) reg->base : base; - - /* remove the last reference to this registration */ - vader_return_registration (reg, ep); - + bound = bound < (uintptr_t) reg->bound ? (uintptr_t) reg->bound : bound; + base = base > (uintptr_t) reg->base ? (uintptr_t) reg->base : base; + vader_return_registration(reg, ep); reg = NULL; } @@ -151,13 +164,16 @@ mca_rcache_base_registration_t *vader_get_registation (struct mca_btl_base_endpo return reg; } +struct vader_cleanup_reg_ctx { + mca_btl_vader_endpoint_t *ep; + opal_list_t *registrations; +}; + static int mca_btl_vader_endpoint_xpmem_rcache_cleanup (mca_rcache_base_registration_t *reg, void *ctx) { - mca_btl_vader_endpoint_t *ep = (mca_btl_vader_endpoint_t *) ctx; - if ((intptr_t) reg->alloc_base == ep->peer_smp_rank) { - /* otherwise dereg will fail on assert */ - reg->ref_count = 0; - OBJ_RELEASE(reg); + struct vader_cleanup_reg_ctx *cleanup_ctx = (struct vader_cleanup_reg_ctx *) ctx; + if ((intptr_t) reg->alloc_base == cleanup_ctx->ep->peer_smp_rank) { + opal_list_append(cleanup_ctx->registrations, ®->super.super); } return OPAL_SUCCESS; @@ -165,11 +181,22 @@ static int mca_btl_vader_endpoint_xpmem_rcache_cleanup (mca_rcache_base_registra void mca_btl_vader_xpmem_cleanup_endpoint (struct mca_btl_base_endpoint_t *ep) { + mca_rcache_base_registration_t *reg; + opal_list_t registrations; + struct vader_cleanup_reg_ctx cleanup_ctx = {.ep = ep, .registrations = ®istrations}; + + OBJ_CONSTRUCT(®istrations, opal_list_t); + /* clean out the registration cache */ (void) mca_rcache_base_vma_iterate (mca_btl_vader_component.vma_module, NULL, (size_t) -1, true, mca_btl_vader_endpoint_xpmem_rcache_cleanup, - (void *) ep); + (void *) &cleanup_ctx); + while (NULL != (reg = (mca_rcache_base_registration_t *) opal_list_remove_first(®istrations))) { + vader_return_registration (reg, ep); + } + OBJ_DESTRUCT(®istrations); + if (ep->segment_base) { xpmem_release (ep->segment_data.xpmem.apid); ep->segment_data.xpmem.apid = 0; From 66684bbda3bf11304dfaa1d044183ab23afceb60 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 14 Jan 2020 11:49:32 -0700 Subject: [PATCH 497/674] btl/vader: modify how the max attachment address is determined This PR removes the constant defining the max attachment address and replaces it with the largest address that shows up in /proc/self/maps. This should address issues found on AARCH64 where the max address may differ based on the configuration. Since the calculated max address may differ between processes the max address is sent as part of the modex and stored in the endpoint data. Signed-off-by: Nathan Hjelm (cherry picked from commit 728d51f9f3f2df6577e5f9729b9d6a0fe9441d37) --- opal/mca/btl/vader/btl_vader.h | 3 ++ opal/mca/btl/vader/btl_vader_component.c | 3 +- opal/mca/btl/vader/btl_vader_endpoint.h | 1 + opal/mca/btl/vader/btl_vader_module.c | 2 ++ opal/mca/btl/vader/btl_vader_xpmem.c | 46 ++++++++++++++++++++++-- opal/mca/btl/vader/btl_vader_xpmem.h | 8 +---- 6 files changed, 52 insertions(+), 11 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader.h b/opal/mca/btl/vader/btl_vader.h index eab5f5a87d3..e3921429d5f 100644 --- a/opal/mca/btl/vader/btl_vader.h +++ b/opal/mca/btl/vader/btl_vader.h @@ -17,6 +17,7 @@ * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * * $COPYRIGHT$ * @@ -82,6 +83,7 @@ union vader_modex_t { struct vader_modex_xpmem_t { xpmem_segid_t seg_id; void *segment_base; + uintptr_t address_max; } xpmem; #endif struct vader_modex_other_t { @@ -113,6 +115,7 @@ struct mca_btl_vader_component_t { int vader_free_list_inc; /**< number of elements to alloc when growing free lists */ #if OPAL_BTL_VADER_HAVE_XPMEM xpmem_segid_t my_seg_id; /**< this rank's xpmem segment id */ + uintptr_t my_address_max; /**< largest address */ mca_rcache_base_vma_module_t *vma_module; /**< registration cache for xpmem segments */ #endif opal_shmem_ds_t seg_ds; /**< this rank's shared memory segment (when not using xpmem) */ diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index 44de7e004c2..bbb8fc8f140 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -21,7 +21,7 @@ * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2018 Triad National Security, LLC. All rights * reserved. - * Copyright (c) 2019 Google, Inc. All rights reserved. + * Copyright (c) 2019-2020 Google, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -382,6 +382,7 @@ static int mca_btl_base_vader_modex_send (void) if (MCA_BTL_VADER_XPMEM == mca_btl_vader_component.single_copy_mechanism) { modex.xpmem.seg_id = mca_btl_vader_component.my_seg_id; modex.xpmem.segment_base = mca_btl_vader_component.my_segment; + modex.xpmem.address_max = mca_btl_vader_component.my_address_max; modex_size = sizeof (modex.xpmem); } else { diff --git a/opal/mca/btl/vader/btl_vader_endpoint.h b/opal/mca/btl/vader/btl_vader_endpoint.h index e9409b90c11..e8ff1923a3d 100644 --- a/opal/mca/btl/vader/btl_vader_endpoint.h +++ b/opal/mca/btl/vader/btl_vader_endpoint.h @@ -78,6 +78,7 @@ typedef struct mca_btl_base_endpoint_t { #if OPAL_BTL_VADER_HAVE_XPMEM struct { xpmem_apid_t apid; /**< xpmem apid for remote peer */ + uintptr_t address_max; /**< largest address that can be attached */ } xpmem; #endif struct { diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index e54c02b5698..1a54bbfcab9 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -19,6 +19,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2018-2019 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -216,6 +217,7 @@ static int init_vader_endpoint (struct mca_btl_base_endpoint_t *ep, struct opal_ if (MCA_BTL_VADER_XPMEM == mca_btl_vader_component.single_copy_mechanism) { /* always use xpmem if it is available */ ep->segment_data.xpmem.apid = xpmem_get (modex->xpmem.seg_id, XPMEM_RDWR, XPMEM_PERMIT_MODE, (void *) 0666); + ep->segment_data.xpmem.address_max = modex->xpmem.address_max; (void) vader_get_registation (ep, modex->xpmem.segment_base, mca_btl_vader_component.segment_size, MCA_RCACHE_FLAGS_PERSIST, (void **) &ep->segment_base); } else { diff --git a/opal/mca/btl/vader/btl_vader_xpmem.c b/opal/mca/btl/vader/btl_vader_xpmem.c index 219c0bd5f7b..3522ac64288 100644 --- a/opal/mca/btl/vader/btl_vader_xpmem.c +++ b/opal/mca/btl/vader/btl_vader_xpmem.c @@ -21,7 +21,47 @@ int mca_btl_vader_xpmem_init (void) { - mca_btl_vader_component.my_seg_id = xpmem_make (0, VADER_MAX_ADDRESS, XPMEM_PERMIT_MODE, (void *)0666); + /* Any attachment that goes past the Linux TASK_SIZE will always fail. To prevent this we need to + * determine the value of TASK_SIZE. On x86_64 the value was hard-coded in vader to be + * 0x7ffffffffffful but this approach does not work with AARCH64 (and possibly other architectures). + * Since there is really no way to directly determine the value we can (in all cases?) look through + * the mapping for this process to determine what the largest address is. This should be the top + * of the stack. No heap allocations should be larger than this value. Since the largest address + * may differ between processes the value must be shared as part of the modex and stored in the + * endpoint. */ + FILE *fh = fopen("/proc/self/maps", "r"); + if (NULL == fh) { + BTL_ERROR(("could not open /proc/self/maps for reading. disabling XPMEM")); + return OPAL_ERR_NOT_AVAILABLE; + } + + char buffer[1024]; + uintptr_t address_max = 0; + while (fgets(buffer, sizeof(buffer), fh)) { + uintptr_t low, high; + char *tmp; + /* each line of /proc/self/maps starts with low-high in hexidecimal (without a 0x) */ + low = strtoul(buffer, &tmp, 16); + high = strtoul(tmp+1, NULL, 16); + if (address_max < high) { + address_max = high; + } + } + + fclose (fh); + + if (0 == address_max) { + BTL_ERROR(("could not determine the address max")); + return OPAL_ERR_NOT_AVAILABLE; + } + + /* save the calcuated maximum */ + mca_btl_vader_component.my_address_max = address_max - 1; + + /* it is safe to use XPMEM_MAXADDR_SIZE here (which is always (size_t)-1 even though + * it is not safe for attach */ + mca_btl_vader_component.my_seg_id = xpmem_make (0, XPMEM_MAXADDR_SIZE, XPMEM_PERMIT_MODE, + (void *)0666); if (-1 == mca_btl_vader_component.my_seg_id) { return OPAL_ERR_NOT_AVAILABLE; } @@ -90,8 +130,8 @@ mca_rcache_base_registration_t *vader_get_registation (struct mca_btl_base_endpo base = OPAL_DOWN_ALIGN((uintptr_t) rem_ptr, attach_align, uintptr_t); bound = OPAL_ALIGN((uintptr_t) rem_ptr + size - 1, attach_align, uintptr_t) + 1; - if (OPAL_UNLIKELY(bound > VADER_MAX_ADDRESS)) { - bound = VADER_MAX_ADDRESS; + if (OPAL_UNLIKELY(bound > ep->segment_data.xpmem.address_max)) { + bound = ep->segment_data.xpmem.address_max; } check_ctx.base = base; diff --git a/opal/mca/btl/vader/btl_vader_xpmem.h b/opal/mca/btl/vader/btl_vader_xpmem.h index fa47773697c..5b6e7f01fb7 100644 --- a/opal/mca/btl/vader/btl_vader_xpmem.h +++ b/opal/mca/btl/vader/btl_vader_xpmem.h @@ -3,6 +3,7 @@ * Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016 ARM, Inc. All rights reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -32,13 +33,6 @@ /* look up the remote pointer in the peer rcache and attach if * necessary */ -/* largest address we can attach to using xpmem */ -#if defined(__x86_64__) -#define VADER_MAX_ADDRESS ((uintptr_t)0x7ffffffff000ul) -#else -#define VADER_MAX_ADDRESS XPMEM_MAXADDR_SIZE -#endif - struct mca_btl_base_endpoint_t; int mca_btl_vader_xpmem_init (void); From 9e755d38038974a094085c9408e37cdca072a0ed Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Wed, 30 Oct 2019 15:55:51 +0200 Subject: [PATCH 498/674] oshmem/ucx: Improves performance for non-blocking put/get operations. Improves the performance when excess non-blocking operations are posted by periodically calling progress on ucx workers. Co-authored with: Artem Y. Polyakov , Manjunath Gorentla Venkata Signed-off-by: Tomislav Janjusic (cherry picked from commit 1b58e3d07388c8c63d485fe308589009279c1f4f) --- oshmem/mca/spml/ucx/spml_ucx.c | 52 ++++++++++++++++++++++++ oshmem/mca/spml/ucx/spml_ucx.h | 20 +++++++++ oshmem/mca/spml/ucx/spml_ucx_component.c | 37 +++++++++++++++++ 3 files changed, 109 insertions(+) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 2ea8ba86343..6ade52446ae 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -777,6 +777,30 @@ int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_ return ucx_status_to_oshmem_nb(status); } +int mca_spml_ucx_get_nb_wprogress(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_addr, int src, void **handle) +{ + unsigned int i; + void *rva; + ucs_status_t status; + spml_ucx_mkey_t *ucx_mkey; + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + + ucx_mkey = mca_spml_ucx_get_mkey(ctx, src, src_addr, &rva, &mca_spml_ucx); + status = ucp_get_nbi(ucx_ctx->ucp_peers[src].ucp_conn, dst_addr, size, + (uint64_t)rva, ucx_mkey->rkey); + + if (++ucx_ctx->nb_progress_cnt > mca_spml_ucx.nb_get_progress_thresh) { + for (i = 0; i < mca_spml_ucx.nb_ucp_worker_progress; i++) { + if (!ucp_worker_progress(ucx_ctx->ucp_worker)) { + ucx_ctx->nb_progress_cnt = 0; + break; + } + } + } + + return ucx_status_to_oshmem_nb(status); +} + int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_addr, int dst) { void *rva; @@ -825,7 +849,33 @@ int mca_spml_ucx_put_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_ return ucx_status_to_oshmem_nb(status); } +int mca_spml_ucx_put_nb_wprogress(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_addr, int dst, void **handle) +{ + unsigned int i; + void *rva; + ucs_status_t status; + spml_ucx_mkey_t *ucx_mkey; + mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; + + ucx_mkey = mca_spml_ucx_get_mkey(ctx, dst, dst_addr, &rva, &mca_spml_ucx); + status = ucp_put_nbi(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, + (uint64_t)rva, ucx_mkey->rkey); + + if (OPAL_LIKELY(status >= 0)) { + mca_spml_ucx_remote_op_posted(ucx_ctx, dst); + } + if (++ucx_ctx->nb_progress_cnt > mca_spml_ucx.nb_put_progress_thresh) { + for (i = 0; i < mca_spml_ucx.nb_ucp_worker_progress; i++) { + if (!ucp_worker_progress(ucx_ctx->ucp_worker)) { + ucx_ctx->nb_progress_cnt = 0; + break; + } + } + } + + return ucx_status_to_oshmem_nb(status); +} int mca_spml_ucx_fence(shmem_ctx_t ctx) { @@ -883,6 +933,8 @@ int mca_spml_ucx_quiet(shmem_ctx_t ctx) } } + ucx_ctx->nb_progress_cnt = 0; + return OSHMEM_SUCCESS; } diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index 95c56622351..d390002f3ed 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -72,6 +72,7 @@ struct mca_spml_ucx_ctx { ucp_peer_t *ucp_peers; long options; opal_bitmap_t put_op_bitmap; + unsigned long nb_progress_cnt; int *put_proc_indexes; unsigned put_proc_count; }; @@ -109,6 +110,10 @@ struct mca_spml_ucx { pthread_spinlock_t async_lock; int aux_refcnt; bool synchronized_quiet; + unsigned long nb_progress_thresh_global; + unsigned long nb_put_progress_thresh; + unsigned long nb_get_progress_thresh; + unsigned long nb_ucp_worker_progress; }; typedef struct mca_spml_ucx mca_spml_ucx_t; @@ -123,6 +128,7 @@ extern int mca_spml_ucx_get(shmem_ctx_t ctx, size_t size, void* src_addr, int src); + extern int mca_spml_ucx_get_nb(shmem_ctx_t ctx, void* dst_addr, size_t size, @@ -130,6 +136,13 @@ extern int mca_spml_ucx_get_nb(shmem_ctx_t ctx, int src, void **handle); +extern int mca_spml_ucx_get_nb_wprogress(shmem_ctx_t ctx, + void* dst_addr, + size_t size, + void* src_addr, + int src, + void **handle); + extern int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, @@ -143,6 +156,13 @@ extern int mca_spml_ucx_put_nb(shmem_ctx_t ctx, int dst, void **handle); +extern int mca_spml_ucx_put_nb_wprogress(shmem_ctx_t ctx, + void* dst_addr, + size_t size, + void* src_addr, + int dst, + void **handle); + extern int mca_spml_ucx_recv(void* buf, size_t size, int src); extern int mca_spml_ucx_send(void* buf, size_t size, diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 3d29bd4e5d8..192934649ac 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -60,6 +60,20 @@ mca_spml_base_component_2_0_0_t mca_spml_ucx_component = { .spmlm_finalize = mca_spml_ucx_component_fini }; +static inline void mca_spml_ucx_param_register_ulong(const char* param_name, + unsigned long default_value, + const char *help_msg, + unsigned long *storage) +{ + *storage = default_value; + (void) mca_base_component_var_register(&mca_spml_ucx_component.spmlm_version, + param_name, + help_msg, + MCA_BASE_VAR_TYPE_UNSIGNED_LONG, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + storage); +} static inline void mca_spml_ucx_param_register_int(const char* param_name, int default_value, @@ -132,6 +146,22 @@ static int mca_spml_ucx_component_register(void) "Use synchronized quiet on shmem_quiet or shmem_barrier_all operations", &mca_spml_ucx.synchronized_quiet); + mca_spml_ucx_param_register_ulong("nb_progress_thresh_global", 0, + "Number of nb_put or nb_get operations before ucx progress is triggered. Disabled by default (0)", + &mca_spml_ucx.nb_progress_thresh_global); + + mca_spml_ucx_param_register_ulong("nb_put_progress_thresh", mca_spml_ucx.nb_progress_thresh_global, + "Number of nb_put operations before ucx progress is triggered. Disabled by default (0), setting this value will override nb_progress_thresh_global", + &mca_spml_ucx.nb_put_progress_thresh); + + mca_spml_ucx_param_register_ulong("nb_get_progress_thresh", mca_spml_ucx.nb_progress_thresh_global, + "Number of nb_get operations before ucx progress is triggered. Disabled by default (0), setting this value will override nb_progress_thresh_global ", + &mca_spml_ucx.nb_get_progress_thresh); + + mca_spml_ucx_param_register_ulong("nb_ucp_worker_progress", 32, + "Maximum number of ucx worker progress calls if triggered during nb_put or nb_get", + &mca_spml_ucx.nb_ucp_worker_progress); + opal_common_ucx_mca_var_register(&mca_spml_ucx_component.spmlm_version); return OSHMEM_SUCCESS; @@ -294,6 +324,13 @@ static int spml_ucx_init(void) mca_spml_ucx.aux_ctx = NULL; mca_spml_ucx.aux_refcnt = 0; + if (mca_spml_ucx.nb_put_progress_thresh) { + mca_spml_ucx.super.spml_put_nb = &mca_spml_ucx_put_nb_wprogress; + } + if (mca_spml_ucx.nb_get_progress_thresh) { + mca_spml_ucx.super.spml_get_nb = &mca_spml_ucx_get_nb_wprogress; + } + oshmem_ctx_default = (shmem_ctx_t) &mca_spml_ucx_ctx_default; return OSHMEM_SUCCESS; From 0daf3df384c59efd546f07f0f55d8f8de10f0151 Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Wed, 6 Nov 2019 18:10:52 +0200 Subject: [PATCH 499/674] oshmem/ucx: improves spml ucx performance for multi-threaded applications. Improves multi-threaded performance by adding the option to create multiple ucx workers in threaded applications. Co-authored with: Artem Y. Polyakov , Manjunath Gorentla Venkata Signed-off-by: Tomislav Janjusic (cherry picked from commit 3d6bf9fd8ec729d1c07470600e2c92c0f1580830) --- oshmem/mca/atomic/ucx/atomic_ucx_cswap.c | 2 +- oshmem/mca/atomic/ucx/atomic_ucx_module.c | 2 +- oshmem/mca/spml/ucx/spml_ucx.c | 223 +++++++++++++++------- oshmem/mca/spml/ucx/spml_ucx.h | 7 +- oshmem/mca/spml/ucx/spml_ucx_component.c | 81 +++++--- 5 files changed, 213 insertions(+), 102 deletions(-) diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c index 8c5fa1d1a64..b3cddcd6d2b 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_cswap.c @@ -50,6 +50,6 @@ int mca_atomic_ucx_cswap(shmem_ctx_t ctx, mca_spml_ucx_remote_op_posted(ucx_ctx, pe); } - return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker, + return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker[0], "ucp_atomic_fetch_nb"); } diff --git a/oshmem/mca/atomic/ucx/atomic_ucx_module.c b/oshmem/mca/atomic/ucx/atomic_ucx_module.c index 882b83f6520..34ed0b551b9 100644 --- a/oshmem/mca/atomic/ucx/atomic_ucx_module.c +++ b/oshmem/mca/atomic/ucx/atomic_ucx_module.c @@ -80,7 +80,7 @@ int mca_atomic_ucx_fop(shmem_ctx_t ctx, op, value, prev, size, rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); - return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker, + return opal_common_ucx_wait_request(status_ptr, ucx_ctx->ucp_worker[0], "ucp_atomic_fetch_nb"); } diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index 6ade52446ae..d838f749bab 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -105,8 +105,9 @@ int mca_spml_ucx_enable(bool enable) int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) { opal_common_ucx_del_proc_t *del_procs; - size_t i; + size_t i, w, n; int ret; + int ucp_workers = mca_spml_ucx.ucp_workers; oshmem_shmem_barrier(); @@ -129,10 +130,23 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) ret = opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), mca_spml_ucx.num_disconnect, - mca_spml_ucx_ctx_default.ucp_worker); + mca_spml_ucx_ctx_default.ucp_worker[0]); /* No need to barrier here - barrier is called in _shmem_finalize */ free(del_procs); - free(mca_spml_ucx.remote_addrs_tbl); + if (mca_spml_ucx.remote_addrs_tbl) { + for (w = 0; w < ucp_workers; w++) { + if (mca_spml_ucx.remote_addrs_tbl[w]) { + for (n = 0; n < nprocs; n++) { + if (mca_spml_ucx.remote_addrs_tbl[w][n]) { + free(mca_spml_ucx.remote_addrs_tbl[w][n]); + } + } + free(mca_spml_ucx.remote_addrs_tbl[w]); + } + } + free(mca_spml_ucx.remote_addrs_tbl); + } + free(mca_spml_ucx_ctx_default.ucp_peers); mca_spml_ucx_ctx_default.ucp_peers = NULL; @@ -142,48 +156,80 @@ int mca_spml_ucx_del_procs(ompi_proc_t** procs, size_t nprocs) /* TODO: move func into common place, use it with rkey exchng too */ static int oshmem_shmem_xchng( - void *local_data, int local_size, int nprocs, - void **rdata_p, int **roffsets_p, int **rsizes_p) + void **local_data, unsigned int *local_size, int nprocs, int ucp_workers, + void **rdata_p, unsigned int **roffsets_p, unsigned int **rsizes_p) { - int *rcv_sizes = NULL; - int *rcv_offsets = NULL; - void *rcv_buf = NULL; + unsigned int *rcv_sizes = NULL; + int *_rcv_sizes = NULL; + unsigned int *rcv_offsets = NULL; + int *_rcv_offsets = NULL; + void *rcv_buf = NULL; int rc; - int i; + int i,j,k; - /* do llgatherv */ - rcv_offsets = malloc(nprocs * sizeof(*rcv_offsets)); + /* do allgatherv */ + rcv_offsets = calloc(ucp_workers * nprocs, sizeof(*rcv_offsets)); if (NULL == rcv_offsets) { goto err; } /* todo: move into separate function. do allgatherv */ - rcv_sizes = malloc(nprocs * sizeof(*rcv_sizes)); + rcv_sizes = calloc(ucp_workers * nprocs, sizeof(*rcv_sizes)); if (NULL == rcv_sizes) { goto err; } - - rc = oshmem_shmem_allgather(&local_size, rcv_sizes, sizeof(int)); + + rc = oshmem_shmem_allgather(local_size, rcv_sizes, ucp_workers * sizeof(*rcv_sizes)); if (MPI_SUCCESS != rc) { goto err; } /* calculate displacements */ rcv_offsets[0] = 0; - for (i = 1; i < nprocs; i++) { + for (i = 1; i < ucp_workers * nprocs; i++) { rcv_offsets[i] = rcv_offsets[i - 1] + rcv_sizes[i - 1]; } - rcv_buf = malloc(rcv_offsets[nprocs - 1] + rcv_sizes[nprocs - 1]); + rcv_buf = calloc(1, rcv_offsets[(ucp_workers * nprocs) - 1] + + rcv_sizes[(ucp_workers * nprocs) - 1]); if (NULL == rcv_buf) { goto err; } + + int _local_size = 0; + for (i = 0; i < ucp_workers; i++) { + _local_size += local_size[i]; + } + _rcv_offsets = calloc(nprocs, sizeof(*rcv_offsets)); + _rcv_sizes = calloc(nprocs, sizeof(*rcv_sizes)); + + k = 0; + for (i = 0; i < nprocs; i++) { + for (j = 0; j < ucp_workers; j++, k++) { + _rcv_sizes[i] += rcv_sizes[k]; + } + } + + _rcv_offsets[0] = 0; + for (i = 1; i < nprocs; i++) { + _rcv_offsets[i] = _rcv_offsets[i - 1] + _rcv_sizes[i - 1]; + } + + char *_local_data = calloc(_local_size, 1); + int new_offset = 0; + for (i = 0; i < ucp_workers; i++) { + memcpy((char *) (_local_data+new_offset), (char *)local_data[i], local_size[i]); + new_offset += local_size[i]; + } - rc = oshmem_shmem_allgatherv(local_data, rcv_buf, local_size, rcv_sizes, rcv_offsets); + rc = oshmem_shmem_allgatherv(_local_data, rcv_buf, _local_size, _rcv_sizes, _rcv_offsets); if (MPI_SUCCESS != rc) { goto err; } + free (_local_data); + free (_rcv_sizes); + free (_rcv_offsets); *rdata_p = rcv_buf; *roffsets_p = rcv_offsets; *rsizes_p = rcv_sizes; @@ -199,19 +245,6 @@ static int oshmem_shmem_xchng( return OSHMEM_ERROR; } -static void dump_address(int pe, char *addr, size_t len) -{ -#ifdef SPML_UCX_DEBUG - int my_rank = oshmem_my_proc_id(); - unsigned i; - - printf("me=%d dest_pe=%d addr=%p len=%d\n", my_rank, pe, addr, len); - for (i = 0; i < len; i++) { - printf("%02X ", (unsigned)0xFF&addr[i]); - } - printf("\n"); -#endif -} static char spml_ucx_transport_ids[1] = { 0 }; @@ -251,17 +284,20 @@ int mca_spml_ucx_clear_put_op_mask(mca_spml_ucx_ctx_t *ctx) int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) { - size_t i, j, n; + size_t i, j, k, w, n; int rc = OSHMEM_ERROR; int my_rank = oshmem_my_proc_id(); + int ucp_workers = mca_spml_ucx.ucp_workers; ucs_status_t err; - ucp_address_t *wk_local_addr; - size_t wk_addr_len; - int *wk_roffs = NULL; - int *wk_rsizes = NULL; + ucp_address_t **wk_local_addr; + unsigned int *wk_addr_len; + unsigned int *wk_roffs = NULL; + unsigned int *wk_rsizes = NULL; char *wk_raddrs = NULL; ucp_ep_params_t ep_params; + wk_local_addr = calloc(mca_spml_ucx.ucp_workers, sizeof(ucp_address_t *)); + wk_addr_len = calloc(mca_spml_ucx.ucp_workers, sizeof(size_t)); mca_spml_ucx_ctx_default.ucp_peers = (ucp_peer_t *) calloc(nprocs, sizeof(*(mca_spml_ucx_ctx_default.ucp_peers))); if (NULL == mca_spml_ucx_ctx_default.ucp_peers) { @@ -273,13 +309,16 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) goto error; } - err = ucp_worker_get_address(mca_spml_ucx_ctx_default.ucp_worker, &wk_local_addr, &wk_addr_len); - if (err != UCS_OK) { - goto error; + for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { + size_t tmp_len; + err = ucp_worker_get_address(mca_spml_ucx_ctx_default.ucp_worker[i], &wk_local_addr[i], &tmp_len); + wk_addr_len[i] = (unsigned int)tmp_len; + if (err != UCS_OK) { + goto error; + } } - dump_address(my_rank, (char *)wk_local_addr, wk_addr_len); - rc = oshmem_shmem_xchng(wk_local_addr, wk_addr_len, nprocs, + rc = oshmem_shmem_xchng((void **)wk_local_addr, wk_addr_len, nprocs, (int) mca_spml_ucx.ucp_workers, (void **)&wk_raddrs, &wk_roffs, &wk_rsizes); if (rc != OSHMEM_SUCCESS) { goto error; @@ -287,22 +326,34 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) opal_progress_register(spml_ucx_default_progress); - mca_spml_ucx.remote_addrs_tbl = (char **)calloc(nprocs, sizeof(char *)); - memset(mca_spml_ucx.remote_addrs_tbl, 0, nprocs * sizeof(char *)); + mca_spml_ucx.remote_addrs_tbl = (char ***)calloc(mca_spml_ucx.ucp_workers, sizeof(char ***)); + for (w = 0; w < ucp_workers; w++) { + mca_spml_ucx.remote_addrs_tbl[w] = (char **)calloc(nprocs, sizeof(char **)); + memset(mca_spml_ucx.remote_addrs_tbl[w], 0, nprocs * sizeof(char **)); + } + + /* Store all remote addresses */ + int offset = 0; + for (i = 0, n = 0; n < nprocs; n++) { + for (w = 0; w < ucp_workers; w++, i++) { + mca_spml_ucx.remote_addrs_tbl[w][n] = (char *)malloc(wk_rsizes[i]); + memcpy(mca_spml_ucx.remote_addrs_tbl[w][n], (char *)(wk_raddrs + offset), wk_rsizes[i]); + offset+=wk_rsizes[i]; + } + } /* Get the EP connection requests for all the processes from modex */ for (n = 0; n < nprocs; ++n) { i = (my_rank + n) % nprocs; - dump_address(i, (char *)(wk_raddrs + wk_roffs[i]), wk_rsizes[i]); ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS; - ep_params.address = (ucp_address_t *)(wk_raddrs + wk_roffs[i]); + ep_params.address = (ucp_address_t *)mca_spml_ucx.remote_addrs_tbl[0][i]; - err = ucp_ep_create(mca_spml_ucx_ctx_default.ucp_worker, &ep_params, - &mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn); + err = ucp_ep_create(mca_spml_ucx_ctx_default.ucp_worker[0], &ep_params, + &mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn); if (UCS_OK != err) { SPML_UCX_ERROR("ucp_ep_create(proc=%zu/%zu) failed: %s", n, nprocs, - ucs_status_string(err)); + ucs_status_string(err)); goto error2; } @@ -312,13 +363,12 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) for (j = 0; j < MCA_MEMHEAP_MAX_SEGMENTS; j++) { mca_spml_ucx_ctx_default.ucp_peers[i].mkeys[j].key.rkey = NULL; } + } - mca_spml_ucx.remote_addrs_tbl[i] = (char *)malloc(wk_rsizes[i]); - memcpy(mca_spml_ucx.remote_addrs_tbl[i], (char *)(wk_raddrs + wk_roffs[i]), - wk_rsizes[i]); + for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { + ucp_worker_release_address(mca_spml_ucx_ctx_default.ucp_worker[i], wk_local_addr[i]); } - ucp_worker_release_address(mca_spml_ucx_ctx_default.ucp_worker, wk_local_addr); free(wk_raddrs); free(wk_rsizes); free(wk_roffs); @@ -326,6 +376,7 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) SPML_UCX_VERBOSE(50, "*** ADDED PROCS ***"); opal_common_ucx_mca_proc_added(); + return OSHMEM_SUCCESS; error2: @@ -333,16 +384,25 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) if (mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn) { ucp_ep_destroy(mca_spml_ucx_ctx_default.ucp_peers[i].ucp_conn); } - if (mca_spml_ucx.remote_addrs_tbl[i]) { - free(mca_spml_ucx.remote_addrs_tbl[i]); - } + } + + if (mca_spml_ucx.remote_addrs_tbl) { + for (w = 0; w < ucp_workers; w++) { + if (mca_spml_ucx.remote_addrs_tbl[w]) { + for (n = 0; n < nprocs; n++) { + if (mca_spml_ucx.remote_addrs_tbl[w][n]) { + free(mca_spml_ucx.remote_addrs_tbl[w][n]); + } + } + free(mca_spml_ucx.remote_addrs_tbl[w]); + } + } + free(mca_spml_ucx.remote_addrs_tbl); } mca_spml_ucx_clear_put_op_mask(&mca_spml_ucx_ctx_default); if (mca_spml_ucx_ctx_default.ucp_peers) free(mca_spml_ucx_ctx_default.ucp_peers); - if (mca_spml_ucx.remote_addrs_tbl) - free(mca_spml_ucx.remote_addrs_tbl); free(wk_raddrs); free(wk_rsizes); free(wk_roffs); @@ -596,6 +656,7 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx ucp_ep_params_t ep_params; size_t i, nprocs = oshmem_num_procs(); int j; + unsigned int cur_ucp_worker = mca_spml_ucx.ucp_worker_cnt++ % mca_spml_ucx.ucp_workers; ucs_status_t err; spml_ucx_mkey_t *ucx_mkey; sshmem_mkey_t *mkey; @@ -604,6 +665,8 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx ucx_ctx = malloc(sizeof(mca_spml_ucx_ctx_t)); ucx_ctx->options = options; + ucx_ctx->ucp_worker = calloc(1, sizeof(ucp_worker_h)); + ucx_ctx->ucp_workers = 1; params.field_mask = UCP_WORKER_PARAM_FIELD_THREAD_MODE; if (oshmem_mpi_thread_provided == SHMEM_THREAD_SINGLE || options & SHMEM_CTX_PRIVATE || options & SHMEM_CTX_SERIALIZED) { @@ -613,7 +676,7 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx } err = ucp_worker_create(mca_spml_ucx.ucp_context, ¶ms, - &ucx_ctx->ucp_worker); + &ucx_ctx->ucp_worker[0]); if (UCS_OK != err) { free(ucx_ctx); return OSHMEM_ERROR; @@ -631,8 +694,9 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx for (i = 0; i < nprocs; i++) { ep_params.field_mask = UCP_EP_PARAM_FIELD_REMOTE_ADDRESS; - ep_params.address = (ucp_address_t *)(mca_spml_ucx.remote_addrs_tbl[i]); - err = ucp_ep_create(ucx_ctx->ucp_worker, &ep_params, + ep_params.address = (ucp_address_t *)(mca_spml_ucx.remote_addrs_tbl[cur_ucp_worker][i]); + + err = ucp_ep_create(ucx_ctx->ucp_worker[0], &ep_params, &ucx_ctx->ucp_peers[i].ucp_conn); if (UCS_OK != err) { SPML_ERROR("ucp_ep_create(proc=%d/%d) failed: %s", i, nprocs, @@ -673,7 +737,9 @@ static int mca_spml_ucx_ctx_create_common(long options, mca_spml_ucx_ctx_t **ucx free(ucx_ctx->ucp_peers); error: - ucp_worker_destroy(ucx_ctx->ucp_worker); + ucp_worker_destroy(ucx_ctx->ucp_worker[0]); + free(ucx_ctx->ucp_worker); + ucx_ctx->ucp_worker = NULL; free(ucx_ctx); rc = OSHMEM_ERR_OUT_OF_RESOURCE; SPML_ERROR("ctx create FAILED rc=%d", rc); @@ -755,7 +821,7 @@ int mca_spml_ucx_get(shmem_ctx_t ctx, void *src_addr, size_t size, void *dst_add #if HAVE_DECL_UCP_GET_NB request = ucp_get_nb(ucx_ctx->ucp_peers[src].ucp_conn, dst_addr, size, (uint64_t)rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); - return opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker, "ucp_get_nb"); + return opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker[0], "ucp_get_nb"); #else status = ucp_get(ucx_ctx->ucp_peers[src].ucp_conn, dst_addr, size, (uint64_t)rva, ucx_mkey->rkey); @@ -791,7 +857,7 @@ int mca_spml_ucx_get_nb_wprogress(shmem_ctx_t ctx, void *src_addr, size_t size, if (++ucx_ctx->nb_progress_cnt > mca_spml_ucx.nb_get_progress_thresh) { for (i = 0; i < mca_spml_ucx.nb_ucp_worker_progress; i++) { - if (!ucp_worker_progress(ucx_ctx->ucp_worker)) { + if (!ucp_worker_progress(ucx_ctx->ucp_worker[0])) { ucx_ctx->nb_progress_cnt = 0; break; } @@ -817,7 +883,7 @@ int mca_spml_ucx_put(shmem_ctx_t ctx, void* dst_addr, size_t size, void* src_add #if HAVE_DECL_UCP_PUT_NB request = ucp_put_nb(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey, opal_common_ucx_empty_complete_cb); - res = opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker, "ucp_put_nb"); + res = opal_common_ucx_wait_request(request, ucx_ctx->ucp_worker[0], "ucp_put_nb"); #else status = ucp_put(ucx_ctx->ucp_peers[dst].ucp_conn, src_addr, size, (uint64_t)rva, ucx_mkey->rkey); @@ -867,7 +933,7 @@ int mca_spml_ucx_put_nb_wprogress(shmem_ctx_t ctx, void* dst_addr, size_t size, if (++ucx_ctx->nb_progress_cnt > mca_spml_ucx.nb_put_progress_thresh) { for (i = 0; i < mca_spml_ucx.nb_ucp_worker_progress; i++) { - if (!ucp_worker_progress(ucx_ctx->ucp_worker)) { + if (!ucp_worker_progress(ucx_ctx->ucp_worker[0])) { ucx_ctx->nb_progress_cnt = 0; break; } @@ -880,15 +946,20 @@ int mca_spml_ucx_put_nb_wprogress(shmem_ctx_t ctx, void* dst_addr, size_t size, int mca_spml_ucx_fence(shmem_ctx_t ctx) { ucs_status_t err; + unsigned int i = 0; mca_spml_ucx_ctx_t *ucx_ctx = (mca_spml_ucx_ctx_t *)ctx; opal_atomic_wmb(); - err = ucp_worker_fence(ucx_ctx->ucp_worker); - if (UCS_OK != err) { - SPML_UCX_ERROR("fence failed: %s", ucs_status_string(err)); - oshmem_shmem_abort(-1); - return OSHMEM_ERROR; + for (i=0; i < ucx_ctx->ucp_workers; i++) { + if (ucx_ctx->ucp_worker[i] != NULL) { + err = ucp_worker_fence(ucx_ctx->ucp_worker[i]); + if (UCS_OK != err) { + SPML_UCX_ERROR("fence failed: %s", ucs_status_string(err)); + oshmem_shmem_abort(-1); + return OSHMEM_ERROR; + } + } } return OSHMEM_SUCCESS; } @@ -919,10 +990,14 @@ int mca_spml_ucx_quiet(shmem_ctx_t ctx) opal_atomic_wmb(); - ret = opal_common_ucx_worker_flush(ucx_ctx->ucp_worker); - if (OMPI_SUCCESS != ret) { - oshmem_shmem_abort(-1); - return ret; + for (i = 0; i < ucx_ctx->ucp_workers; i++) { + if (ucx_ctx->ucp_worker[i] != NULL) { + ret = opal_common_ucx_worker_flush(ucx_ctx->ucp_worker[i]); + if (OMPI_SUCCESS != ret) { + oshmem_shmem_abort(-1); + return ret; + } + } } /* If put_all_nb op/s is/are being executed asynchronously, need to wait its @@ -1060,7 +1135,7 @@ int mca_spml_ucx_put_all_nb(void *dest, const void *source, size_t size, long *c RUNTIME_CHECK_RC(rc); } - request = ucp_worker_flush_nb(((mca_spml_ucx_ctx_t*)ctx)->ucp_worker, 0, + request = ucp_worker_flush_nb(((mca_spml_ucx_ctx_t*)ctx)->ucp_worker[0], 0, mca_spml_ucx_put_all_complete_cb); if (!UCS_PTR_IS_PTR(request)) { mca_spml_ucx_put_all_complete_cb(NULL, UCS_PTR_STATUS(request)); diff --git a/oshmem/mca/spml/ucx/spml_ucx.h b/oshmem/mca/spml/ucx/spml_ucx.h index d390002f3ed..56db4278c4e 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.h +++ b/oshmem/mca/spml/ucx/spml_ucx.h @@ -68,11 +68,12 @@ struct ucp_peer { typedef struct ucp_peer ucp_peer_t; struct mca_spml_ucx_ctx { - ucp_worker_h ucp_worker; + ucp_worker_h *ucp_worker; ucp_peer_t *ucp_peers; long options; opal_bitmap_t put_op_bitmap; unsigned long nb_progress_cnt; + unsigned int ucp_workers; int *put_proc_indexes; unsigned put_proc_count; }; @@ -95,7 +96,7 @@ struct mca_spml_ucx { int heap_reg_nb; bool enabled; mca_spml_ucx_get_mkey_slow_fn_t get_mkey_slow; - char **remote_addrs_tbl; + char ***remote_addrs_tbl; mca_spml_ucx_ctx_array_t active_array; mca_spml_ucx_ctx_array_t idle_array; int priority; /* component priority */ @@ -114,6 +115,8 @@ struct mca_spml_ucx { unsigned long nb_put_progress_thresh; unsigned long nb_get_progress_thresh; unsigned long nb_ucp_worker_progress; + unsigned int ucp_workers; + unsigned int ucp_worker_cnt; }; typedef struct mca_spml_ucx mca_spml_ucx_t; diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 192934649ac..5fd43bdbe5e 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -75,6 +75,21 @@ static inline void mca_spml_ucx_param_register_ulong(const char* param_name, storage); } +static inline void mca_spml_ucx_param_register_uint(const char* param_name, + unsigned int default_value, + const char *help_msg, + unsigned int *storage) +{ + *storage = default_value; + (void) mca_base_component_var_register(&mca_spml_ucx_component.spmlm_version, + param_name, + help_msg, + MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + storage); +} + static inline void mca_spml_ucx_param_register_int(const char* param_name, int default_value, const char *help_msg, @@ -161,6 +176,9 @@ static int mca_spml_ucx_component_register(void) mca_spml_ucx_param_register_ulong("nb_ucp_worker_progress", 32, "Maximum number of ucx worker progress calls if triggered during nb_put or nb_get", &mca_spml_ucx.nb_ucp_worker_progress); + mca_spml_ucx_param_register_uint("default_ctx_ucp_workers", 1, + "Number of ucp workers per default context", + &mca_spml_ucx.ucp_workers); opal_common_ucx_mca_var_register(&mca_spml_ucx_component.spmlm_version); @@ -171,14 +189,17 @@ int spml_ucx_ctx_progress(void) { int i; for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { - ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); + ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); } return 1; } int spml_ucx_default_progress(void) { - ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); + unsigned int i=0; + for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { + ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]); + } return 1; } @@ -194,7 +215,7 @@ int spml_ucx_progress_aux_ctx(void) return 0; } - count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker[0]); pthread_spin_unlock(&mca_spml_ucx.async_lock); return count; @@ -209,7 +230,7 @@ void mca_spml_ucx_async_cb(int fd, short event, void *cbdata) } do { - count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + count = ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker[0]); } while (count); pthread_spin_unlock(&mca_spml_ucx.async_lock); @@ -227,12 +248,13 @@ static int mca_spml_ucx_component_close(void) static int spml_ucx_init(void) { + unsigned int i; ucs_status_t err; ucp_config_t *ucp_config; ucp_params_t params; ucp_context_attr_t attr; ucp_worker_params_t wkr_params; - ucp_worker_attr_t wkr_attr; + ucp_worker_attr_t wrk_attr; err = ucp_config_read("OSHMEM", NULL, &ucp_config); if (UCS_OK != err) { @@ -293,18 +315,22 @@ static int spml_ucx_init(void) } else { wkr_params.thread_mode = UCS_THREAD_MODE_SINGLE; } - - err = ucp_worker_create(mca_spml_ucx.ucp_context, &wkr_params, - &mca_spml_ucx_ctx_default.ucp_worker); - if (UCS_OK != err) { - return OSHMEM_ERROR; + + mca_spml_ucx_ctx_default.ucp_worker = calloc(mca_spml_ucx.ucp_workers, sizeof(ucp_worker_h)); + for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { + err = ucp_worker_create(mca_spml_ucx.ucp_context, &wkr_params, + &mca_spml_ucx_ctx_default.ucp_worker[i]); + if (UCS_OK != err) { + return OSHMEM_ERROR; + } + mca_spml_ucx_ctx_default.ucp_workers++; } - wkr_attr.field_mask = UCP_WORKER_ATTR_FIELD_THREAD_MODE; - err = ucp_worker_query(mca_spml_ucx_ctx_default.ucp_worker, &wkr_attr); + wrk_attr.field_mask = UCP_WORKER_ATTR_FIELD_THREAD_MODE; + err = ucp_worker_query(mca_spml_ucx_ctx_default.ucp_worker[0], &wrk_attr); if (oshmem_mpi_thread_requested == SHMEM_THREAD_MULTIPLE && - wkr_attr.thread_mode != UCS_THREAD_MODE_MULTI) { + wrk_attr.thread_mode != UCS_THREAD_MODE_MULTI) { oshmem_mpi_thread_provided = SHMEM_THREAD_SINGLE; } @@ -377,7 +403,7 @@ static void _ctx_cleanup(mca_spml_ucx_ctx_t *ctx) opal_common_ucx_del_procs_nofence(del_procs, nprocs, oshmem_my_proc_id(), mca_spml_ucx.num_disconnect, - ctx->ucp_worker); + ctx->ucp_worker[0]); free(del_procs); mca_spml_ucx_clear_put_op_mask(ctx); free(ctx->ucp_peers); @@ -423,37 +449,45 @@ static int mca_spml_ucx_component_fini(void) while (!fenced) { for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { - ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); + ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); } for (i = 0; i < mca_spml_ucx.idle_array.ctxs_count; i++) { - ucp_worker_progress(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker); + ucp_worker_progress(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker[0]); + } + + for (i = 0; i < (signed int)mca_spml_ucx.ucp_workers; i++) { + ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]); } - - ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker); if (mca_spml_ucx.aux_ctx != NULL) { - ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker); + ucp_worker_progress(mca_spml_ucx.aux_ctx->ucp_worker[0]); } } /* delete all workers */ for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { - ucp_worker_destroy(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); + ucp_worker_destroy(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); + free(mca_spml_ucx.active_array.ctxs[i]->ucp_worker); free(mca_spml_ucx.active_array.ctxs[i]); } for (i = 0; i < mca_spml_ucx.idle_array.ctxs_count; i++) { - ucp_worker_destroy(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker); + ucp_worker_destroy(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker[0]); + free(mca_spml_ucx.idle_array.ctxs[i]->ucp_worker); free(mca_spml_ucx.idle_array.ctxs[i]); } if (mca_spml_ucx_ctx_default.ucp_worker) { - ucp_worker_destroy(mca_spml_ucx_ctx_default.ucp_worker); + for (i = 0; i < (signed int)mca_spml_ucx.ucp_workers; i++) { + ucp_worker_destroy(mca_spml_ucx_ctx_default.ucp_worker[i]); + } + free(mca_spml_ucx_ctx_default.ucp_worker); } if (mca_spml_ucx.aux_ctx != NULL) { - ucp_worker_destroy(mca_spml_ucx.aux_ctx->ucp_worker); + ucp_worker_destroy(mca_spml_ucx.aux_ctx->ucp_worker[0]); + free(mca_spml_ucx.aux_ctx->ucp_worker); } mca_spml_ucx.enabled = false; /* not anymore */ @@ -472,4 +506,3 @@ static int mca_spml_ucx_component_fini(void) return OSHMEM_SUCCESS; } - From 91ab0e219127496f339461eac70899bea5bf418d Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Thu, 23 Jan 2020 12:58:00 +0200 Subject: [PATCH 500/674] SPML/UCX: fixed coverity issues - fixed sizeof(char***) by variable datatype - fixed resorce leak in proc_add Signed-off-by: Sergey Oblomov (cherry picked from commit 8543860689029dc09b5edfa25afafa087fe8603b) --- oshmem/mca/spml/ucx/spml_ucx.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/oshmem/mca/spml/ucx/spml_ucx.c b/oshmem/mca/spml/ucx/spml_ucx.c index d838f749bab..60453e92438 100644 --- a/oshmem/mca/spml/ucx/spml_ucx.c +++ b/oshmem/mca/spml/ucx/spml_ucx.c @@ -326,10 +326,10 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) opal_progress_register(spml_ucx_default_progress); - mca_spml_ucx.remote_addrs_tbl = (char ***)calloc(mca_spml_ucx.ucp_workers, sizeof(char ***)); + mca_spml_ucx.remote_addrs_tbl = (char ***)calloc(mca_spml_ucx.ucp_workers, + sizeof(mca_spml_ucx.remote_addrs_tbl[0])); for (w = 0; w < ucp_workers; w++) { - mca_spml_ucx.remote_addrs_tbl[w] = (char **)calloc(nprocs, sizeof(char **)); - memset(mca_spml_ucx.remote_addrs_tbl[w], 0, nprocs * sizeof(char **)); + mca_spml_ucx.remote_addrs_tbl[w] = (char **)calloc(nprocs, sizeof(mca_spml_ucx.remote_addrs_tbl[w][0])); } /* Store all remote addresses */ @@ -372,6 +372,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) free(wk_raddrs); free(wk_rsizes); free(wk_roffs); + free(wk_addr_len); + free(wk_local_addr); SPML_UCX_VERBOSE(50, "*** ADDED PROCS ***"); @@ -407,6 +409,8 @@ int mca_spml_ucx_add_procs(ompi_proc_t** procs, size_t nprocs) free(wk_rsizes); free(wk_roffs); error: + free(wk_addr_len); + free(wk_local_addr); rc = OSHMEM_ERR_OUT_OF_RESOURCE; SPML_UCX_ERROR("add procs FAILED rc=%d", rc); return rc; From d12e0fdf32e922f0788ef64e5624ae49c10898d4 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 2 Jan 2020 09:06:10 -0700 Subject: [PATCH 501/674] make mpifort obey disable-wrapper-runpath related to #6539 Signed-off-by: Howard Pritchard (cherry picked from commit 37b3e2f3fa7a4971dda64d8d2ff933dc4d4c807d) --- config/opal_setup_wrappers.m4 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index 397e1eca37c..016b89c7f31 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -15,6 +15,8 @@ dnl Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015-2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 IBM Corporation. All rights reserved. +dnl Copyright (c) 2020 Triad National Security, LLC. All rights +dnl reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -216,6 +218,7 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ # Set the output in $runpath_args runpath_args= + runpath_fc_args= LDFLAGS_save=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags" AS_IF([test x"$enable_wrapper_runpath" = x"yes"], @@ -226,17 +229,17 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ runpath_args="-Wl,--enable-new-dtags" AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])], [AC_MSG_RESULT([no])]) - AC_LANG_POP([C])]) - m4_ifdef([project_ompi],[ - OPAL_LIBTOOL_CONFIG([wl],[wl_fc],[--tag=FC],[]) - - LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags" - AC_LANG_PUSH([Fortran]) - AC_LINK_IFELSE([AC_LANG_SOURCE([[program test -end program]])], - [runpath_fc_args="${wl_fc}--enable-new-dtags"], - [runpath_fc_args=""]) - AC_LANG_POP([Fortran])]) + AC_LANG_POP([C]) + m4_ifdef([project_ompi], + [OPAL_LIBTOOL_CONFIG([wl],[wl_fc],[--tag=FC],[]) + LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags" + AC_LANG_PUSH([Fortran]) + AC_LINK_IFELSE([AC_LANG_SOURCE([[program test end program]])], + [runpath_fc_args="${wl_fc}--enable-new-dtags" + AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])], + [AC_MSG_RESULT([no])]) + AC_LANG_POP([Fortran])])]) + LDFLAGS=$LDFLAGS_save OPAL_VAR_SCOPE_POP From 297505592a9ace23fca5cb5cb489c3e391e5b55e Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 24 Jan 2020 15:42:00 -0600 Subject: [PATCH 502/674] Fix a problem with fortran configure test. Signed-off-by: Howard Pritchard --- config/opal_setup_wrappers.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index 016b89c7f31..36795a56978 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -234,7 +234,8 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ [OPAL_LIBTOOL_CONFIG([wl],[wl_fc],[--tag=FC],[]) LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags" AC_LANG_PUSH([Fortran]) - AC_LINK_IFELSE([AC_LANG_SOURCE([[program test end program]])], + AC_LINK_IFELSE([AC_LANG_SOURCE([[program test +end program]])], [runpath_fc_args="${wl_fc}--enable-new-dtags" AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])], [AC_MSG_RESULT([no])]) From 05d003b109fa0a6dd4cca854e9c0d66aebbcfc22 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Fri, 24 Jan 2020 14:02:53 -0500 Subject: [PATCH 503/674] plm/rsh: Fix segv on missing agent. * Additionally, fixes the `NULL` option to `OMPI_MCA_plm_rsh_agent` would would also lead to a segv. Now it operates as intended by disqualifying the `rsh` component and falling back onto the `isolated` component. Signed-off-by: Joshua Hursey (cherry picked from commit 62d0058738e8a111cd099199bc5f1886f13aa8ec) --- orte/mca/errmgr/base/errmgr_base_fns.c | 5 ++++- orte/mca/plm/rsh/plm_rsh_component.c | 14 +++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/orte/mca/errmgr/base/errmgr_base_fns.c b/orte/mca/errmgr/base/errmgr_base_fns.c index 8ce8794f295..592fd33995d 100644 --- a/orte/mca/errmgr/base/errmgr_base_fns.c +++ b/orte/mca/errmgr/base/errmgr_base_fns.c @@ -16,6 +16,7 @@ * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2014 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -118,7 +119,9 @@ void orte_errmgr_base_abort(int error_code, char *fmt, ...) /* if I am a daemon or the HNP... */ if (ORTE_PROC_IS_HNP || ORTE_PROC_IS_DAEMON) { /* whack my local procs */ - orte_odls.kill_local_procs(NULL); + if( NULL != orte_odls.kill_local_procs ) { + orte_odls.kill_local_procs(NULL); + } /* whack any session directories */ orte_session_dir_cleanup(ORTE_JOBID_WILDCARD); } diff --git a/orte/mca/plm/rsh/plm_rsh_component.c b/orte/mca/plm/rsh/plm_rsh_component.c index c78f0c0251b..691c338334d 100644 --- a/orte/mca/plm/rsh/plm_rsh_component.c +++ b/orte/mca/plm/rsh/plm_rsh_component.c @@ -16,7 +16,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights * reserved. * Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2011-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2011-2020 IBM Corporation. All rights reserved. * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ * @@ -370,6 +370,10 @@ char **orte_plm_rsh_search(const char* agent_list, const char *path) char **tokens, *tmp; char cwd[OPAL_PATH_MAX]; + if (NULL == agent_list && NULL == mca_plm_rsh_component.agent) { + return NULL; + } + if (NULL == path) { getcwd(cwd, OPAL_PATH_MAX); } else { @@ -421,6 +425,14 @@ static int rsh_launch_agent_lookup(const char *agent_list, char *path) char *bname; int i; + if (NULL == agent_list && NULL == mca_plm_rsh_component.agent) { + OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output, + "%s plm:rsh_lookup on agent (null) path %s - No agent specified.", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + (NULL == path) ? "NULL" : path)); + return ORTE_ERR_NOT_FOUND; + } + OPAL_OUTPUT_VERBOSE((5, orte_plm_base_framework.framework_output, "%s plm:rsh_lookup on agent %s path %s", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), From 7147a8c3bb0a202af9264a7b0052b9081628c85d Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Mon, 27 Jan 2020 13:50:35 -0700 Subject: [PATCH 504/674] NEWS: updates for 4.0.3rc2 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 560b809e543..1572bd8de85 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,13 @@ included in the vX.Y.Z section and be denoted as: 4.0.3 -- January, 2020 ------------------------ - Add support for Mellanox Connectx6. +- Fix a problem with Fortran compiler wrappers ignoring use of + disable-wrapper-runpath configure option. Thanks to David + Shrader for reporting. +- Fixed an issue with trying to use mpirun on systems where neither + ssh nor rsh is installed. +- Address some problems found when using XPMEM for intra-node message + transport. - Improve dimensions returned by MPI_Dims_create for certain cases. Thanks to @aw32 for reporting. - Fix an issue when sending messages larger than 4GB. Thanks to From 44c1b6fb98d8298c2eed3273514689a650d0864d Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Tue, 28 Jan 2020 10:39:19 -0500 Subject: [PATCH 505/674] Updating VERSION to v4.0.3rc3 We tried doing an RC2 built without updating the greek, and found where that failed in build automation. Reving again for rc3, as we've already applied the rc2 tag. Signed-off-by: Geoffrey Paulsen --- VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 2ecbba1b9c9..df2d5147331 100644 --- a/VERSION +++ b/VERSION @@ -7,7 +7,7 @@ # reserved. # Copyright (c) 2019 Triad National Security, LLC. All rights # reserved. -# Copyright (c) 2018-2019 IBM Corporation. All rights reserved. +# Copyright (c) 2018-2020 IBM Corporation. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -30,7 +30,7 @@ release=3 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc1 +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 80950480a9aa1c623e42798874dd83c50a080b45 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Tue, 28 Jan 2020 15:16:06 -0600 Subject: [PATCH 506/674] Actually Updating VERSION to v4.0.3rc3 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index df2d5147331..378510cd29a 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=3 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc2 +greek=rc3 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 0f1f13c67ad2d273b5c6fc11c6158a0a76c84f2d Mon Sep 17 00:00:00 2001 From: Artem Ryabov Date: Fri, 31 Jan 2020 21:59:51 +0300 Subject: [PATCH 507/674] Enabled Mellanox CI for release branches. Signed-off-by: Artem Ryabov --- .ci/README.md | 18 ++++++++++++ .ci/mellanox/azure-pipelines.yml | 48 ++++++++++++++++++++++++++++++++ .gitignore | 1 + 3 files changed, 67 insertions(+) create mode 100644 .ci/README.md create mode 100644 .ci/mellanox/azure-pipelines.yml diff --git a/.ci/README.md b/.ci/README.md new file mode 100644 index 00000000000..53618af51be --- /dev/null +++ b/.ci/README.md @@ -0,0 +1,18 @@ +# Open MPI Continuous Integration (CI) Services +## Mellanox Open MPI CI +[![Build Status](https://dev.azure.com/mlnx-swx/mellanox-ompi/_apis/build/status/Mellanox%20CI?branchName=v4.0.x)](https://dev.azure.com/mlnx-swx/mellanox-ompi/_build/latest?definitionId=12&branchName=v4.0.x) +### Scope +[Mellanox](https://www.mellanox.com/) Open MPI CI is intended to verify Open MPI with recent Mellanox SW components ([Mellanox OFED](https://www.mellanox.com/page/products_dyn?product_family=26), [UCX](https://www.mellanox.com/page/products_dyn?product_family=281&mtag=ucx) and other [HPC-X](https://www.mellanox.com/page/products_dyn?product_family=189&mtag=hpc-x) components) in the Mellanox lab environment. + +CI is managed by [Azure Pipelines](https://docs.microsoft.com/en-us/azure/devops/pipelines/?view=azure-devops) service. + +Mellanox Open MPI CI includes: +* Open MPI building with internal stable engineering versions of UCX and HCOLL. The building is run in Docker-based environment. +* Sanity functional testing. +### How to Run CI +Mellanox Open MPI CI is triggered upon the following events: +* Push a commit into the master branch or release branches (starting from v4.0.x). CI is started automatically. CI status and log files are available on the Azure DevOps server. +* Create a pull request (PR). CI status is visible in the PR status. CI is restarted automatically upon each new commit within the PR. CI status and log files are also available on the Azure DevOps server. +* Trigger CI with special PR comments (for example, `/azp run`). Comment triggers are available only if the comment author has write permission to the PR target repo. Detailed information about comment triggers is available in the official Azure DevOps [documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#comment-triggers). +### Support +In case of any issues, questions or suggestions please contact to [Mellanox Open MPI CI support team](mailto:swx-azure-svc@mellanox.com). diff --git a/.ci/mellanox/azure-pipelines.yml b/.ci/mellanox/azure-pipelines.yml new file mode 100644 index 00000000000..a4fb7213238 --- /dev/null +++ b/.ci/mellanox/azure-pipelines.yml @@ -0,0 +1,48 @@ +trigger: + - master + - v*.*.x +pr: + - master + - v*.*.x + +pool: + name: Default + demands: + - AGENT_CI_TARGET -equals ompi + - MLNX_IB_DEVICE -equals yes + +variables: + ompi_jenkins_scripts_git_repo_url: https://github.com/mellanox-hpc/jenkins_scripts.git + ompi_jenkins_scripts_git_branch: master + # Enable debug information, supported values: true, false + debug: true + +jobs: +- job: mellanox_ompi_ci + displayName: Mellanox Open MPI CI + timeoutInMinutes: 240 + container: + image: rdmz-harbor.rdmz.labs.mlnx/hpcx/ompi_ci:latest + options: -v /hpc/local:/hpc/local -v /opt:/opt --uts=host --ipc=host --ulimit stack=67108864 + --ulimit memlock=-1 --security-opt seccomp=unconfined --cap-add=SYS_ADMIN --device=/dev/infiniband/ + steps: + - task: DeleteFiles@1 + displayName: Cleanup workspace folder + inputs: + sourceFolder: $(Pipeline.Workspace) + contents: | + **/* + - checkout: self + submodules: true + path: ompi + - bash: | + set -eE + [ "$(debug)" = "true" ] && set -x + cd $(Pipeline.Workspace) + git clone $(ompi_jenkins_scripts_git_repo_url) + cd $(Pipeline.Workspace)/jenkins_scripts && git checkout $(ompi_jenkins_scripts_git_branch) + export WORKSPACE=$(Pipeline.Workspace)/ompi + # TODO: rework ompi_test.sh to avoid Jenkins mentions + export JENKINS_RUN_TESTS=yes + $(Pipeline.Workspace)/jenkins_scripts/jenkins/ompi/ompi_test.sh + displayName: Build and test Open MPI diff --git a/.gitignore b/.gitignore index 07c17512a1b..d9744ac97c3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ .cdt* .project .gdb* +.idea .hgrc .hgignore From 89e3a2ba023ffaa2b80374211d93bbe01aa0edf2 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Fri, 31 Jan 2020 12:38:41 -0700 Subject: [PATCH 508/674] NEWS: tweak for v4.0.3 release [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 560b809e543..0cb598a6704 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,7 @@ Copyright (c) 2013 NVIDIA Corporation. All rights reserved. Copyright (c) 2013-2018 Intel, Inc. All rights reserved. Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. -Copyright (c) 2019 Triad National Security, LLC. All rights +Copyright (c) 2019-2020 Triad National Security, LLC. All rights reserved. $COPYRIGHT$ @@ -57,8 +57,8 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. -4.0.3 -- January, 2020 ------------------------- +4.0.3 -- February, 2020 +----------------------- - Add support for Mellanox Connectx6. - Improve dimensions returned by MPI_Dims_create for certain cases. Thanks to @aw32 for reporting. From 02f3795299685159f0c7eb8f34744705dc10e042 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 30 Nov 2019 16:56:45 -0800 Subject: [PATCH 509/674] Make C and Fortran types for MPI sentinels agree in size Fix the C types for the following: * MPI_UNWEIGHTED * MPI_WEIGHTS_EMPTY * MPI_ARGV_NULL * MPI_ARGVS_NULL * MPI_ERRCODES_IGNORE There is lengthy discussion on https://github.com/open-mpi/ompi/pull/7210 describing the issue; the gist of it is that the C and Fortran types for several MPI global sentenial values should agree (specifically: their sizes must(**) agree). We erroneously had several of these array-like sentinel values be "array-like" values in C. E.g., MPI_ERRCODES_IGNORE was an (int *) in C while its corresponding Fortran type was "integer, dimension(1)". On a 64 bit platform, this resulted in C expecting the symbol size to be sizeof(int*)==8 while Fortran expected the symbol size to be sizeof(INTEGER, DIMENSION(1))==4. That is incorrect -- the corresponding C type needed to be (int). Then both C and Fortran expect the size of the symbol to be the same. (**) NOTE: This code has been wrong for years. This mismatch of types typically worked because, due to Fortran's call-by-reference semantics, Open MPI was comparing the *addresses* of these instances, not their *types* (or sizes) -- so even if C expected the size of the symbol to be X and Fortran expected the size of the symbol to be Y (where X!=Y), all we really checked at run time was that the addresses of the symbols were the same. But it caused linker warning messages, and even caused errors in some cases. Specifically: due to a GNU ld bug (https://sourceware.org/bugzilla/show_bug.cgi?id=25236), the 5 common symbols are incorrectly versioned VER_NDX_LOCAL because their definitions in Fortran sources have smaller st_size than those in libmpi.so. This makes the Fortran library not linkable with lld in distributions that ship openmpi built with -Wl,--version-script (https://bugs.llvm.org/show_bug.cgi?id=43748): % mpifort -fuse-ld=lld /dev/null ld.lld: error: corrupt input file: version definition index 0 for symbol mpi_fortran_argv_null_ is out of bounds >>> defined in /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_usempif08.so ... If we fix the C and Fortran symbols to actually be the same size, the problem goes away and the GNU ld bug does not come into play. This commit also fixes a minor issue that MPI_UNWEIGHTED and MPI_WEIGHTS_EMPTY were not declared as Fortran arrays (not fully fixed by commit 107c0073dd11fb90d18122c521686f692a32cdd8). Fixes open-mpi/ompi#7209 Signed-off-by: Fangrui Song Signed-off-by: Jeff Squyres (cherry picked from commit 5609268e90cb0ff7b2431d29041c10a700fd6996) --- ompi/mpi/fortran/base/gen-mpi-mangling.pl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ompi/mpi/fortran/base/gen-mpi-mangling.pl b/ompi/mpi/fortran/base/gen-mpi-mangling.pl index ab568b98ecd..a049c625228 100755 --- a/ompi/mpi/fortran/base/gen-mpi-mangling.pl +++ b/ompi/mpi/fortran/base/gen-mpi-mangling.pl @@ -2,7 +2,7 @@ # # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Subroutine to generate a bunch of Fortran declarations and symbols @@ -62,33 +62,33 @@ f_name => "MPI_IN_PLACE", }; $fortran->{unweighted} = { - c_type => "int *", + c_type => "int", c_name => "mpi_fortran_unweighted", - f_type => "integer", + f_type => "integer, dimension(1)", f_name => "MPI_UNWEIGHTED", }; $fortran->{weights_empty} = { - c_type => "int *", + c_type => "int", c_name => "mpi_fortran_weights_empty", - f_type => "integer", + f_type => "integer, dimension(1)", f_name => "MPI_WEIGHTS_EMPTY", }; $fortran->{argv_null} = { - c_type => "char *", + c_type => "char", c_name => "mpi_fortran_argv_null", f_type => "character, dimension(1)", f_name => "MPI_ARGV_NULL", }; $fortran->{argvs_null} = { - c_type => "char *", + c_type => "char", c_name => "mpi_fortran_argvs_null", f_type => "character, dimension(1, 1)", f_name => "MPI_ARGVS_NULL", }; $fortran->{errcodes_ignore} = { - c_type => "int *", + c_type => "int", c_name => "mpi_fortran_errcodes_ignore", f_type => "integer, dimension(1)", f_name => "MPI_ERRCODES_IGNORE", From 82567996f76c6438379a20b9492856b167c20bcc Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Wed, 27 Nov 2019 12:32:27 +0100 Subject: [PATCH 510/674] hwloc/base: fix opal proc locality wrt to NUMA nodes on hwloc 2.0 Both opal_hwloc_base_get_relative_locality() and _get_locality_string() iterate over hwloc levels to build the proc locality information. Unfortunately, NUMA nodes are not in those normal levels anymore since 2.0. We have to explicitly look a the special NUMA level to get that locality info. I am factorizing the core of the iterations inside dedicated "_by_depth" functions and calling them again for the NUMA level at the end of the loops. Thanks to Hatem Elshazly for reporting the NUMA communicator split failure at https://www.mail-archive.com/users@lists.open-mpi.org/msg33589.html It looks like only the opal_hwloc_base_get_locality_string() part is needed to fix that split, but there's no reason not to fix get_relative_locality() as well. Signed-off-by: Brice Goglin (cherry picked from commit ea80a20e108cb69efc67ad04ad968da7b85772af) --- opal/mca/hwloc/base/hwloc_base_util.c | 207 ++++++++++++++++---------- 1 file changed, 127 insertions(+), 80 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index ba26ba0ac6d..7bb9520f35a 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -20,6 +20,7 @@ * All rights reserved. * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Inria. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -1215,16 +1216,84 @@ int opal_hwloc_base_cpu_list_parse(const char *slot_str, return OPAL_SUCCESS; } +static void opal_hwloc_base_get_relative_locality_by_depth(hwloc_topology_t topo, unsigned d, + hwloc_cpuset_t loc1, hwloc_cpuset_t loc2, + opal_hwloc_locality_t *locality, bool *shared) +{ + unsigned width, w; + hwloc_obj_t obj; + int sect1, sect2; + + /* get the width of the topology at this depth */ + width = hwloc_get_nbobjs_by_depth(topo, d); + + /* scan all objects at this depth to see if + * our locations overlap with them + */ + for (w=0; w < width; w++) { + /* get the object at this depth/index */ + obj = hwloc_get_obj_by_depth(topo, d, w); + /* see if our locations intersect with the cpuset for this obj */ + sect1 = hwloc_bitmap_intersects(obj->cpuset, loc1); + sect2 = hwloc_bitmap_intersects(obj->cpuset, loc2); + /* if both intersect, then we share this level */ + if (sect1 && sect2) { + *shared = true; + switch(obj->type) { + case HWLOC_OBJ_NODE: + *locality |= OPAL_PROC_ON_NUMA; + break; + case HWLOC_OBJ_SOCKET: + *locality |= OPAL_PROC_ON_SOCKET; + break; +#if HWLOC_API_VERSION < 0x20000 + case HWLOC_OBJ_CACHE: + if (3 == obj->attr->cache.depth) { + *locality |= OPAL_PROC_ON_L3CACHE; + } else if (2 == obj->attr->cache.depth) { + *locality |= OPAL_PROC_ON_L2CACHE; + } else { + *locality |= OPAL_PROC_ON_L1CACHE; + } + break; +#else + case HWLOC_OBJ_L3CACHE: + *locality |= OPAL_PROC_ON_L3CACHE; + break; + case HWLOC_OBJ_L2CACHE: + *locality |= OPAL_PROC_ON_L2CACHE; + break; + case HWLOC_OBJ_L1CACHE: + *locality |= OPAL_PROC_ON_L1CACHE; + break; +#endif + case HWLOC_OBJ_CORE: + *locality |= OPAL_PROC_ON_CORE; + break; + case HWLOC_OBJ_PU: + *locality |= OPAL_PROC_ON_HWTHREAD; + break; + default: + /* just ignore it */ + break; + } + break; + } + /* otherwise, we don't share this + * object - but we still might share another object + * on this level, so we have to keep searching + */ + } +} + opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t topo, char *cpuset1, char *cpuset2) { opal_hwloc_locality_t locality; - hwloc_obj_t obj; - unsigned depth, d, width, w; + hwloc_cpuset_t loc1, loc2; + unsigned depth, d; bool shared; hwloc_obj_type_t type; - int sect1, sect2; - hwloc_cpuset_t loc1, loc2; /* start with what we know - they share a node on a cluster * NOTE: we may alter that latter part as hwloc's ability to @@ -1265,66 +1334,8 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top HWLOC_OBJ_PU != type) { continue; } - /* get the width of the topology at this depth */ - width = hwloc_get_nbobjs_by_depth(topo, d); + opal_hwloc_base_get_relative_locality_by_depth(topo, d, loc1, loc2, &locality, &shared); - /* scan all objects at this depth to see if - * our locations overlap with them - */ - for (w=0; w < width; w++) { - /* get the object at this depth/index */ - obj = hwloc_get_obj_by_depth(topo, d, w); - /* see if our locations intersect with the cpuset for this obj */ - sect1 = hwloc_bitmap_intersects(obj->cpuset, loc1); - sect2 = hwloc_bitmap_intersects(obj->cpuset, loc2); - /* if both intersect, then we share this level */ - if (sect1 && sect2) { - shared = true; - switch(obj->type) { - case HWLOC_OBJ_NODE: - locality |= OPAL_PROC_ON_NUMA; - break; - case HWLOC_OBJ_SOCKET: - locality |= OPAL_PROC_ON_SOCKET; - break; -#if HWLOC_API_VERSION < 0x20000 - case HWLOC_OBJ_CACHE: - if (3 == obj->attr->cache.depth) { - locality |= OPAL_PROC_ON_L3CACHE; - } else if (2 == obj->attr->cache.depth) { - locality |= OPAL_PROC_ON_L2CACHE; - } else { - locality |= OPAL_PROC_ON_L1CACHE; - } - break; -#else - case HWLOC_OBJ_L3CACHE: - locality |= OPAL_PROC_ON_L3CACHE; - break; - case HWLOC_OBJ_L2CACHE: - locality |= OPAL_PROC_ON_L2CACHE; - break; - case HWLOC_OBJ_L1CACHE: - locality |= OPAL_PROC_ON_L1CACHE; - break; -#endif - case HWLOC_OBJ_CORE: - locality |= OPAL_PROC_ON_CORE; - break; - case HWLOC_OBJ_PU: - locality |= OPAL_PROC_ON_HWTHREAD; - break; - default: - /* just ignore it */ - break; - } - break; - } - /* otherwise, we don't share this - * object - but we still might share another object - * on this level, so we have to keep searching - */ - } /* if we spanned the entire width without finding * a point of intersection, then no need to go * deeper @@ -1333,6 +1344,9 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top break; } } +#if HWLOC_API_VERSION >= 0x20000 + opal_hwloc_base_get_relative_locality_by_depth(topo, HWLOC_TYPE_DEPTH_NUMANODE, loc1, loc2, &locality, &shared); +#endif opal_output_verbose(5, opal_hwloc_base_framework.framework_output, "locality: %s", @@ -2063,12 +2077,40 @@ char* opal_hwloc_base_get_topo_signature(hwloc_topology_t topo) return sig; } +static int opal_hwloc_base_get_locality_string_by_depth(hwloc_topology_t topo, + int d, + hwloc_cpuset_t cpuset, + hwloc_cpuset_t result) +{ + hwloc_obj_t obj; + unsigned width, w; + + /* get the width of the topology at this depth */ + width = hwloc_get_nbobjs_by_depth(topo, d); + if (0 == width) { + return -1; + } + + /* scan all objects at this depth to see if + * the location overlaps with them + */ + for (w=0; w < width; w++) { + /* get the object at this depth/index */ + obj = hwloc_get_obj_by_depth(topo, d, w); + /* see if the location intersects with it */ + if (hwloc_bitmap_intersects(obj->cpuset, cpuset)) { + hwloc_bitmap_set(result, w); + } + } + + return 0; +} + char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) { - hwloc_obj_t obj; char *locality=NULL, *tmp, *t2; - unsigned depth, d, width, w; + unsigned depth, d; hwloc_cpuset_t cpuset, result; hwloc_obj_type_t type; @@ -2111,28 +2153,15 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, continue; } - /* get the width of the topology at this depth */ - width = hwloc_get_nbobjs_by_depth(topo, d); - if (0 == width) { + if (opal_hwloc_base_get_locality_string_by_depth(topo, d, cpuset, result) < 0) { continue; } - /* scan all objects at this depth to see if - * the location overlaps with them - */ - for (w=0; w < width; w++) { - /* get the object at this depth/index */ - obj = hwloc_get_obj_by_depth(topo, d, w); - /* see if the location intersects with it */ - if (hwloc_bitmap_intersects(obj->cpuset, cpuset)) { - hwloc_bitmap_set(result, w); - } - } /* it should be impossible, but allow for the possibility * that we came up empty at this depth */ if (!hwloc_bitmap_iszero(result)) { hwloc_bitmap_list_asprintf(&tmp, result); - switch(obj->type) { + switch(type) { case HWLOC_OBJ_NODE: asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { @@ -2217,6 +2246,24 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, } hwloc_bitmap_zero(result); } + +#if HWLOC_API_VERSION >= 0x20000 + if (opal_hwloc_base_get_locality_string_by_depth(topo, HWLOC_TYPE_DEPTH_NUMANODE, cpuset, result) == 0) { + /* it should be impossible, but allow for the possibility + * that we came up empty at this depth */ + if (!hwloc_bitmap_iszero(result)) { + hwloc_bitmap_list_asprintf(&tmp, result); + opal_asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp); + if (NULL != locality) { + free(locality); + } + locality = t2; + free(tmp); + } + hwloc_bitmap_zero(result); + } +#endif + hwloc_bitmap_free(result); hwloc_bitmap_free(cpuset); From bed0ce70a7436b31e7a6f86ddb0d22dda29f75ae Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Mon, 3 Feb 2020 14:19:12 -0700 Subject: [PATCH 511/674] fix a problem with opal_asprintf not being defined. related to #7201 Signed-off-by: Howard Pritchard --- opal/mca/hwloc/base/hwloc_base_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 7bb9520f35a..34885f9f192 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -21,6 +21,7 @@ * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2019 IBM Corporation. All rights reserved. * Copyright (c) 2019 Inria. All rights reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,6 +60,7 @@ #include "opal/mca/hwloc/hwloc-internal.h" #include "opal/mca/hwloc/base/base.h" +#include "opal/util/printf.h" static bool topo_in_shmem = false; From 85ce373730cd268e7333a4466e65551e79516642 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 31 Dec 2019 07:17:01 -0800 Subject: [PATCH 512/674] fortran: remove useless CPPFLAGS assignment These -D's are for C compilation, not Fortran compilation. Remove this useless statement. Signed-off-by: Jeff Squyres (cherry picked from commit f4a47a5a8e4e3f2c902807d75e211f7f500f802b) --- ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am | 4 +--- ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am | 13 ++++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index 281e24b17fc..b747cea2767 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# 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) 2016 IBM Corporation. All rights reserved. @@ -18,8 +18,6 @@ include $(top_srcdir)/Makefile.ompi-rules # mpi" MPI bindings. if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS -AM_CPPFLAGS = -DOMPI_PROFILE_LAYER=0 -DOMPI_COMPILING_FORTRAN_WRAPPERS=1 - AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) diff --git a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am index 5bd68ddea30..8f3157f8197 100644 --- a/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am +++ b/ompi/mpiext/pcollreq/use-mpi-f08/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2017-2018 Research Organization for Information Science -# and Technology (RIST). All rights reserved. +# Copyright (c) 2017-2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ # @@ -13,10 +13,17 @@ # This file builds the use_mpi_f08-based bindings for MPI extensions. It # is optional in MPI extensions. +# Note that Automake's Fortran-buidling rules uses CPPFLAGS and +# AM_CPPFLAGS. This can cause weirdness (e.g., +# https://github.com/open-mpi/ompi/issues/7253). Let's just zero +# those out and rely on AM_FCFLAGS. +CPPFLAGS = +AM_CPPFLAGS = + # We must set these #defines and include paths so that the inner OMPI # MPI prototype header files do the Right Thing. AM_FCFLAGS = $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08/mod \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_builddir) -I$(top_srcdir) $(FCFLAGS_f90) # Note that the mpi_f08-based bindings are optional -- they can only # be built if OMPI is also building the Fortran-based bindings. So we From fbeebdb9a0d073efc11967d12ffb9e53aeeb735c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 31 Dec 2019 07:06:51 -0800 Subject: [PATCH 513/674] fortran: ensure not to use [AM_]CPPFLAGS Automake's Fortran compilation rules inexplicably use CPPFLAGS and AM_CPPFLAGS. Unfortunately, this can cause problems in some cases (e.g., picking up already-installed mpi.mod in a system-default include search path). So in relevant module-using Fortran compilation Makefile.am's, zero out CPPFLAGS and AM_CPPFLAGS. This has a side-effect of requiring that we compile the one .c file in the F08 library in a new, separate subdirectory (with its own Makefile.am that does _not_ have CPPFLAGS/AM_CPPFLAGS zeroed out). Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet (cherry picked from commit ab398f4b9a340b54a88b83021b66911fe46d5862) --- config/ompi_config_files.m4 | 3 +- ompi/Makefile.am | 4 ++- .../fortran/mpiext-use-mpi-f08/Makefile.am | 12 +++++-- ompi/mpi/fortran/mpiext-use-mpi/Makefile.am | 12 +++++-- ompi/mpi/fortran/use-mpi-f08/Makefile.am | 25 +++++++++----- ompi/mpi/fortran/use-mpi-f08/base/Makefile.am | 34 +++++++++++++++++++ .../use-mpi-f08/{ => base}/buffer_detach.c | 0 .../use-mpi-f08/{ => base}/constants.c | 0 .../fortran/use-mpi-f08/bindings/Makefile.am | 11 ++++-- ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am | 11 ++++-- .../fortran/use-mpi-ignore-tkr/Makefile.am | 7 ++++ ompi/mpi/fortran/use-mpi-tkr/Makefile.am | 11 ++++-- 12 files changed, 110 insertions(+), 20 deletions(-) create mode 100644 ompi/mpi/fortran/use-mpi-f08/base/Makefile.am rename ompi/mpi/fortran/use-mpi-f08/{ => base}/buffer_detach.c (100%) rename ompi/mpi/fortran/use-mpi-f08/{ => base}/constants.c (100%) diff --git a/config/ompi_config_files.m4 b/config/ompi_config_files.m4 index 274b404d75d..e0a968b3ac7 100644 --- a/config/ompi_config_files.m4 +++ b/config/ompi_config_files.m4 @@ -1,6 +1,6 @@ # -*- shell-script -*- # -# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017-2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2018 Los Alamos National Security, LLC. All rights @@ -38,6 +38,7 @@ AC_DEFUN([OMPI_CONFIG_FILES],[ ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-file-interfaces.h ompi/mpi/fortran/use-mpi-ignore-tkr/mpi-ignore-tkr-removed-interfaces.h ompi/mpi/fortran/use-mpi-f08/Makefile + ompi/mpi/fortran/use-mpi-f08/base/Makefile ompi/mpi/fortran/use-mpi-f08/bindings/Makefile ompi/mpi/fortran/use-mpi-f08/mod/Makefile ompi/mpi/fortran/mpiext-use-mpi/Makefile diff --git a/ompi/Makefile.am b/ompi/Makefile.am index 5d1ce31ea88..dfaa42b0e7a 100644 --- a/ompi/Makefile.am +++ b/ompi/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2010-2011 Sandia National Laboratories. All rights reserved. # Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights @@ -92,6 +92,7 @@ SUBDIRS = \ $(OMPI_MPIEXT_USEMPI_DIR) \ $(OMPI_FORTRAN_USEMPI_DIR) \ mpi/fortran/mpiext-use-mpi \ + mpi/fortran/use-mpi-f08/base \ mpi/fortran/use-mpi-f08/mod \ mpi/fortran/use-mpi-f08/bindings \ $(OMPI_MPIEXT_USEMPIF08_DIRS) \ @@ -124,6 +125,7 @@ DIST_SUBDIRS = \ mpi/fortran/use-mpi-ignore-tkr \ mpi/fortran/mpiext-use-mpi \ mpi/fortran/use-mpi-f08 \ + mpi/fortran/use-mpi-f08/base \ mpi/fortran/use-mpi-f08/mod \ mpi/fortran/use-mpi-f08/bindings \ mpi/fortran/mpiext-use-mpi-f08 \ diff --git a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am index d5326b2c54f..23186eedb41 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi-f08/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# 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) 2018 FUJITSU LIMITED. All rights reserved. @@ -10,6 +10,13 @@ # $HEADER$ # +# 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 = + # # Only do the stuff in this file if we're going to build # the mpi_f08 ext modules. @@ -22,7 +29,8 @@ 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-f08/mod \ - -I$(top_srcdir) $(FCFLAGS_f90) + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-f08 \ + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) flibs = diff --git a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am index 944add7bc18..71bfad26d92 100644 --- a/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am +++ b/ompi/mpi/fortran/mpiext-use-mpi/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# 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) 2018 FUJITSU LIMITED. All rights reserved. @@ -10,6 +10,13 @@ # $HEADER$ # +# 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 = + # # Only do the stuff in this file if we're going to build # the mpi ext modules. @@ -21,7 +28,8 @@ 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 \ - -I$(top_srcdir) $(FCFLAGS_f90) + $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/mpi/fortran/use-mpi-ignore-tkr \ + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) flibs = diff --git a/ompi/mpi/fortran/use-mpi-f08/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/Makefile.am index dc04a83cf93..c641d585fd2 100644 --- a/ompi/mpi/fortran/use-mpi-f08/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile.am -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# 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. @@ -23,6 +23,13 @@ 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're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -32,7 +39,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG)mod \ $(OMPI_FC_MODULE_FLAG)bindings \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod @@ -795,10 +802,7 @@ pmpi_api_files = \ lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = \ $(mpi_api_files) \ $(pmpi_api_files) \ - mpi-f08.F90 \ - buffer_detach.c \ - constants.h \ - constants.c + mpi-f08.F90 # These are generated; do not ship them nodist_lib@OMPI_LIBMPI_NAME@_usempif08_la_SOURCES = @@ -814,13 +818,18 @@ endif # # Include the mpi_f08-based MPI extensions in libmpi_usempif08, too. # +# Also include the one .c file that we need in this library -- because +# we zero out CPPFLAGS and AM_CPPFLAGS in this Makefile.am, we have to +# compile that .c file in a separate directory / Makefile. +# lib@OMPI_LIBMPI_NAME@_usempif08_la_LIBADD = \ $(module_sentinel_file) \ $(OMPI_MPIEXT_USEMPIF08_LIBS) \ $(top_builddir)/ompi/mpi/fortran/mpif-h/lib@OMPI_LIBMPI_NAME@_mpifh.la \ - $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la -lib@OMPI_LIBMPI_NAME@_usempif08_la_DEPENDENCIES = $(module_sentinel_file) + $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + base/libusempif08_ccode.la +lib@OMPI_LIBMPI_NAME@_usempif08_la_DEPENDENCIES = $(module_sentinel_files) lib@OMPI_LIBMPI_NAME@_usempif08_la_LDFLAGS = -version-info $(libmpi_usempif08_so_version) # diff --git a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am new file mode 100644 index 00000000000..7e1bc3bc299 --- /dev/null +++ b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am @@ -0,0 +1,34 @@ +# -*- makefile -*- +# +# Copyright (c) 2019 Cisco Systems, Inc. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +include $(top_srcdir)/Makefile.ompi-rules + +# This Makefile is only relevant if we're building the "use mpi_f08" +# MPI bindings. +if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS + +# This directory only exists so that we can separate C compilation +# from Fortran compilation. Specifically: 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). So when compiling +# Fortran, we should zero out CPPFLAGS and AM_CPPFLAGS. + +# HOWEVER, we have one .c file in the use-mpi-f08 library. So we have +# to split it out to its own directory / Makefile.am where CPPFLAGS / +# AM_CPPFLAGS are *not* zeroed out. + +noinst_LTLIBRARIES = libusempif08_ccode.la + +libusempif08_ccode_la_SOURCES = \ + buffer_detach.c + +endif diff --git a/ompi/mpi/fortran/use-mpi-f08/buffer_detach.c b/ompi/mpi/fortran/use-mpi-f08/base/buffer_detach.c similarity index 100% rename from ompi/mpi/fortran/use-mpi-f08/buffer_detach.c rename to ompi/mpi/fortran/use-mpi-f08/base/buffer_detach.c diff --git a/ompi/mpi/fortran/use-mpi-f08/constants.c b/ompi/mpi/fortran/use-mpi-f08/base/constants.c similarity index 100% rename from ompi/mpi/fortran/use-mpi-f08/constants.c rename to ompi/mpi/fortran/use-mpi-f08/base/constants.c diff --git a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am index 77f861a6baf..b00d08757ca 100644 --- a/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/bindings/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# 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. @@ -20,6 +20,13 @@ 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're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -29,7 +36,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ $(OMPI_FC_MODULE_FLAG)../mod \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod diff --git a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am index 9bd3a7a4576..f85c4644f3d 100644 --- a/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-f08/mod/Makefile.am @@ -1,6 +1,6 @@ # -*- makefile -*- # -# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. +# 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. @@ -20,6 +20,13 @@ 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're building the "use mpi_f08" # MPI bindings. if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS @@ -28,7 +35,7 @@ AM_FCFLAGS = -I$(top_builddir)/ompi/include \ -I$(top_srcdir)/ompi/include \ $(OMPI_FC_MODULE_FLAG)$(top_builddir)/ompi/$(OMPI_FORTRAN_USEMPI_DIR) \ $(OMPI_FC_MODULE_FLAG). \ - -I$(top_srcdir) $(FCFLAGS_f90) + -I$(top_srcdir) -I$(top_builddir) $(FCFLAGS_f90) MOSTLYCLEANFILES = *.mod diff --git a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am index b747cea2767..cbc47c380a5 100644 --- a/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-ignore-tkr/Makefile.am @@ -14,6 +14,13 @@ 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're building the ignore-TKR "use # mpi" MPI bindings. if OMPI_BUILD_FORTRAN_USEMPI_IGNORE_TKR_BINDINGS diff --git a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am index e318971ef8a..f598c810d2c 100644 --- a/ompi/mpi/fortran/use-mpi-tkr/Makefile.am +++ b/ompi/mpi/fortran/use-mpi-tkr/Makefile.am @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved +# 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 @@ -31,6 +31,13 @@ include $(top_srcdir)/Makefile.ompi-rules # this directory -- instead, they compile # ompi/fortran/use-mpi-ignore-tkr. +# 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 = + if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS ######################################################################## @@ -40,7 +47,7 @@ if OMPI_BUILD_FORTRAN_USEMPI_TKR_BINDINGS # current directory) because it is generated. AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ - $(OMPI_FC_MODULE_FLAG). -I$(srcdir) -I. \ + $(OMPI_FC_MODULE_FLAG). -I$(top_srcdir) -I$(top_builddir) -I. \ -I$(top_builddir)/ompi/mpi/fortran/use-mpi-tkr $(FCFLAGS_f90) # Do different things if the top-level configure decided that we're From 45a722ad6a3c230f41b7d9906e316bdaec7281f4 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 7 Feb 2020 15:08:30 +0200 Subject: [PATCH 514/674] OSHMEM/SEGMENTS: increase number of max segments - increase number of max segments to allow application be launched on some Ubuntu configurations Signed-off-by: Sergey Oblomov (cherry picked from commit f742f289ea32a0f3dfe5f769fb318213f1a74c37) --- oshmem/mca/memheap/base/base.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index ec84d4c734f..1140e99d520 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -41,7 +41,7 @@ OSHMEM_DECLSPEC int mca_memheap_base_select(void); extern int mca_memheap_base_already_opened; extern int mca_memheap_base_key_exchange; -#define MCA_MEMHEAP_MAX_SEGMENTS 8 +#define MCA_MEMHEAP_MAX_SEGMENTS 32 #define HEAP_SEG_INDEX 0 #define MCA_MEMHEAP_SEG_COUNT 2 From 6702a4febbf25e345455eeaf73f6435960b8079f Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Tue, 4 Feb 2020 22:22:10 +0100 Subject: [PATCH 515/674] opal/hwloc: remove some unused variables when building with hwloc < 1.7 Refs #7362 Signed-off-by: Brice Goglin (cherry picked from commit 329d4451a6cdd544e532a29f594f6e5ee63e06da) --- opal/mca/hwloc/base/hwloc_base_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 34885f9f192..f88f990311c 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -1365,9 +1365,10 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top */ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo) { +#if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC hwloc_obj_t osdev; - unsigned i; char **cps = NULL; +#endif char *cpstring = NULL; int depth; @@ -1385,6 +1386,7 @@ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo) while (NULL != osdev) { if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type) { /* got one! find and save its serial number */ + unsigned i; for (i=0; i < osdev->infos_count; i++) { if (0 == strncmp(osdev->infos[i].name, "MICSerialNumber", strlen("MICSerialNumber"))) { OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output, From aff4fa6c8fb6c3fd74fe2156cb1c1640bd2bc63b Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 10 Feb 2020 15:56:28 -0600 Subject: [PATCH 516/674] Reving to VERSION v4.0.3rc4 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 378510cd29a..165c0de5cf8 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=3 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc3 +greek=rc4 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 81ad9bfdb629f4f00eb4a8aa1622e2df9ec0c588 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 10 Feb 2020 17:05:53 -0600 Subject: [PATCH 517/674] Adding PMIx v3.1.5rc2 Adding PMIx v3.1.5rc2 from: https://github.com/openpmix/openpmix/releases/tag/v3.1.5rc2 Signed-off-by: Geoffrey Paulsen --- opal/mca/pmix/pmix3x/pmix/Makefile.am | 2 +- opal/mca/pmix/pmix3x/pmix/NEWS | 41 +- opal/mca/pmix/pmix3x/pmix/VERSION | 14 +- opal/mca/pmix/pmix3x/pmix/config/Makefile.am | 2 +- .../pmix3x/pmix/config/c_get_alignment.m4 | 2 +- .../mca/pmix/pmix3x/pmix/config/distscript.sh | 2 +- opal/mca/pmix/pmix3x/pmix/config/pmix.m4 | 18 +- .../config/pmix_check_compiler_version.m4 | 2 +- .../pmix/pmix3x/pmix/config/pmix_check_icc.m4 | 2 +- .../pmix3x/pmix/config/pmix_check_lock.m4 | 74 +- .../pmix/config/pmix_config_pthreads.m4 | 7 +- .../pmix/pmix3x/pmix/config/pmix_functions.m4 | 16 +- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 4 +- opal/mca/pmix/pmix3x/pmix/examples/dmodex.c | 225 ++- opal/mca/pmix/pmix3x/pmix/include/pmix.h | 13 +- .../pmix/pmix3x/pmix/include/pmix_common.h.in | 92 +- .../pmix/pmix3x/pmix/include/pmix_server.h | 5 +- .../pmix/pmix3x/pmix/src/class/pmix_hotel.c | 5 +- .../pmix/pmix3x/pmix/src/class/pmix_hotel.h | 3 +- .../pmix/pmix3x/pmix/src/client/pmix_client.c | 503 ++++-- .../pmix/src/client/pmix_client_fence.c | 6 + .../pmix3x/pmix/src/client/pmix_client_get.c | 111 +- .../pmix3x/pmix/src/client/pmix_client_ops.h | 3 +- .../pmix3x/pmix/src/client/pmix_client_pub.c | 13 +- .../pmix3x/pmix/src/common/pmix_control.c | 8 +- .../pmix/pmix3x/pmix/src/common/pmix_data.c | 4 +- .../pmix/pmix3x/pmix/src/common/pmix_iof.c | 231 ++- .../pmix/pmix3x/pmix/src/common/pmix_iof.h | 5 + .../pmix/pmix3x/pmix/src/common/pmix_log.c | 25 +- .../pmix/pmix3x/pmix/src/common/pmix_query.c | 37 +- .../pmix3x/pmix/src/common/pmix_security.c | 8 +- .../pmix/pmix3x/pmix/src/event/pmix_event.h | 4 +- .../pmix/src/event/pmix_event_notification.c | 8 +- .../pmix/src/event/pmix_event_registration.c | 15 +- .../pmix3x/pmix/src/include/pmix_globals.c | 30 +- .../pmix3x/pmix/src/include/pmix_globals.h | 62 +- .../pmix/src/mca/base/help-pmix-mca-base.txt | 2 +- .../pmix3x/pmix/src/mca/bfrops/v12/unpack.c | 1 - .../pmix/src/mca/common/dstore/dstore_base.c | 157 +- .../src/mca/common/dstore/dstore_segment.c | 12 +- .../pmix/src/mca/gds/base/gds_base_fns.c | 2 +- .../pmix3x/pmix/src/mca/gds/ds12/configure.m4 | 34 + .../pmix/src/mca/gds/ds12/gds_ds12_base.c | 6 +- .../src/mca/gds/ds12/gds_ds12_component.c | 4 +- .../src/mca/gds/ds12/gds_ds12_lock_fcntl.c | 8 +- .../src/mca/gds/ds12/gds_ds12_lock_pthread.c | 15 +- .../pmix3x/pmix/src/mca/gds/ds21/configure.m4 | 32 + .../src/mca/gds/ds21/gds_ds21_component.c | 4 +- .../src/mca/gds/ds21/gds_ds21_lock_pthread.c | 6 +- .../pmix3x/pmix/src/mca/gds/hash/gds_hash.c | 1507 ++++++++++------- .../pmix/pmix3x/pmix/src/mca/pdl/configure.m4 | 2 +- .../pmix/src/mca/plog/base/plog_base_stubs.c | 2 +- .../pmix/src/mca/plog/stdfd/plog_stdfd.c | 2 +- .../pmix/src/mca/plog/syslog/plog_syslog.c | 4 +- .../pmix/src/mca/pnet/base/pnet_base_fns.c | 2 +- .../pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c | 4 +- .../pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c | 8 +- .../pmix3x/pmix/src/mca/pnet/test/pnet_test.c | 2 +- .../pmix/src/mca/preg/native/preg_native.c | 22 +- .../dummy_handshake/psec_dummy_handshake.c | 1 - .../dummy_handshake/psec_dummy_handshake.h | 1 - .../psec_dummy_handshake_component.c | 1 - opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h | 2 +- .../pmix/pmix3x/pmix/src/mca/ptl/base/base.h | 4 +- .../pmix/src/mca/ptl/base/ptl_base_frame.c | 9 +- .../pmix/src/mca/ptl/base/ptl_base_sendrecv.c | 8 +- .../pmix/src/mca/ptl/base/ptl_base_stubs.c | 48 +- .../pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h | 118 +- .../pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c | 74 +- .../pmix/src/mca/ptl/tcp/ptl_tcp_component.c | 89 +- .../pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c | 12 +- .../src/mca/ptl/usock/ptl_usock_component.c | 29 +- .../pmix3x/pmix/src/runtime/pmix_finalize.c | 9 +- .../pmix/pmix3x/pmix/src/runtime/pmix_init.c | 21 +- .../pmix/pmix3x/pmix/src/runtime/pmix_rte.h | 4 +- .../pmix/pmix3x/pmix/src/server/pmix_server.c | 338 ++-- .../pmix3x/pmix/src/server/pmix_server_get.c | 243 ++- .../pmix3x/pmix/src/server/pmix_server_ops.c | 395 +++-- .../pmix3x/pmix/src/server/pmix_server_ops.h | 7 + .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 98 +- .../pmix/src/tools/pmix_info/Makefile.am | 15 +- opal/mca/pmix/pmix3x/pmix/src/util/compress.c | 14 +- opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c | 29 +- opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h | 7 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.c | 65 +- opal/mca/pmix/pmix3x/pmix/test/cli_stages.h | 6 +- opal/mca/pmix/pmix3x/pmix/test/pmix_client.c | 64 +- opal/mca/pmix/pmix3x/pmix/test/pmix_regex.c | 5 +- opal/mca/pmix/pmix3x/pmix/test/pmix_test.c | 65 +- .../pmix/pmix3x/pmix/test/run_tests00.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests01.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests02.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests03.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests04.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests05.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests06.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests07.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests08.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests09.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests10.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests11.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests12.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests13.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests14.pl.in | 24 +- .../pmix/pmix3x/pmix/test/run_tests15.pl.in | 24 +- .../pmix/pmix3x/pmix/test/server_callbacks.c | 7 +- .../pmix/pmix3x/pmix/test/simple/Makefile.am | 9 +- .../pmix/pmix3x/pmix/test/simple/pmitest.c | 305 ++++ .../pmix/pmix3x/pmix/test/simple/simpclient.c | 78 +- .../pmix/pmix3x/pmix/test/simple/simptest.c | 388 +++-- opal/mca/pmix/pmix3x/pmix/test/test_cd.c | 10 +- opal/mca/pmix/pmix3x/pmix/test/test_common.c | 5 + opal/mca/pmix/pmix3x/pmix/test/test_common.h | 6 +- opal/mca/pmix/pmix3x/pmix/test/test_error.c | 3 + opal/mca/pmix/pmix3x/pmix/test/test_fence.c | 79 +- .../mca/pmix/pmix3x/pmix/test/test_internal.c | 10 +- opal/mca/pmix/pmix3x/pmix/test/test_publish.c | 15 +- opal/mca/pmix/pmix3x/pmix/test/test_replace.c | 15 +- .../pmix3x/pmix/test/test_resolve_peers.c | 36 +- opal/mca/pmix/pmix3x/pmix/test/test_server.c | 222 ++- opal/mca/pmix/pmix3x/pmix/test/test_server.h | 4 +- opal/mca/pmix/pmix3x/pmix/test/test_spawn.c | 12 +- 122 files changed, 4562 insertions(+), 2247 deletions(-) create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/configure.m4 create mode 100644 opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/configure.m4 create mode 100644 opal/mca/pmix/pmix3x/pmix/test/simple/pmitest.c diff --git a/opal/mca/pmix/pmix3x/pmix/Makefile.am b/opal/mca/pmix/pmix3x/pmix/Makefile.am index 47e21332730..88eda877676 100644 --- a/opal/mca/pmix/pmix3x/pmix/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/Makefile.am @@ -11,7 +11,7 @@ # All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved. # Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All Rights # reserved. # $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index f18016dd7f2..8b102555cba 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -1,5 +1,5 @@ Copyright (c) 2015-2019 Intel, Inc. All rights reserved. -Copyright (c) 2017-2019 IBM Corporation. All rights reserved. +Copyright (c) 2017-2020 IBM Corporation. All rights reserved. $COPYRIGHT$ Additional copyrights may follow @@ -21,6 +21,45 @@ example, a bug might be fixed in the master, and then moved to multiple release branches. +3.1.6 -- TBD +---------------------- + + +3.1.5 -- 14 Feb 2020 +---------------------- +NOTE: The signature of the PMIx_Allocation_request has changed +in accordance with an Errata update of the PMIx v3 Standard +- PR #1413/#1465: Remove unnecessary error log +- PR #1433: Return the correct status from PMIx_Publish +- PR #1445: Sync. with master to fix 'get' of data for unknown namespace + Includes the following PRs from master + - PR #1382: dstore: fixed truncate key-names while restoring + - PR #1405: Fix xnspace dmodex and add verbose debug + - PR #1406: Resolve request for job-level data + - PR #1407/#1409/#1411: Fix dmodex across nspaces + - PR #1434/#1436: Cleanup handling of info arrays + - PR #1435: Cleanup example and remove debug + - PR #1437: Update blocking Allocation_request signature + - PR #1440: Fix 'get' of data for unknown namespace + - PR #1442: Fix fences with namespaces where no local processes are running +- PR #1472: Initialize nlocal and local in the tracker +- PR #1487: Sync. with master to fix info array and cross-version issues +- PR #1493/#1497/#1501/#1505/#1589: Info array and Cross-version fixes +- PR #1511/#1517/#1520/#1523/#1534/#1565: Fix pmix tests +- PR #1530: Improve handling of servers piror to v3.1.5 +- PR #1531: Update transfer from hash to dstore +- PR #1538: Fix singleton initialization +- PR #1547: Add missing PMIx_IOF_deregister function +- PR #1554/#1591: Fix memory leak on namespace deregister +- PR #1561: Configury fix for reproducible builds +- PR #1579: Protect pthread setpshared calls +- PR #1587: Fix to gds/dstore configure logic +- PR #1610: Adjust hotel timeout to be in whole seconds +- PR #1613: dstore: Fix cache size calculation +- PR #1622: Fix multiple occurrences of unaligned access in pmix tests +- PR #1620: Re-address the collective tracker problem + + 3.1.4 -- 9 Aug 2019 ---------------------- - PR #1342: Fix if_linux_ipv6_open interface filter diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index 8d2b40af3ea..f3fb512ecf3 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -4,6 +4,8 @@ # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. # Copyright (c) 2014-2016 Intel, Inc. All rights reserved. +# Copyright (c) 2020 IBM Corporation. All rights reserved. + # This is the VERSION file for PMIx, describing the precise # version of PMIx in this distribution. The various components of @@ -15,7 +17,7 @@ major=3 minor=1 -release=4 +release=5 # greek is used for alpha or beta release tags. If it is non-empty, # it will be appended to the version number. It does not have to be @@ -23,14 +25,14 @@ release=4 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek= +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=gite6837057 +repo_rev=git1fca232 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -44,7 +46,7 @@ tarball_version= # The date when this release was created -date="Aug 09, 2019" +date="Feb 10, 2020" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -75,7 +77,7 @@ date="Aug 09, 2019" # Version numbers are described in the Libtool current:revision:age # format. -libpmix_so_version=4:24:2 +libpmix_so_version=4:25:2 libpmi_so_version=1:1:0 libpmi2_so_version=1:0:0 @@ -84,4 +86,4 @@ libpmi2_so_version=1:0:0 # # well. Yuck; this somewhat breaks the # # components-don't-affect-the-build-system abstraction. # -libmca_common_dstore_so_version=1:1:0 +libmca_common_dstore_so_version=1:2:0 diff --git a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am index ebc3af9d96a..ffe29370600 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/config/Makefile.am @@ -1,4 +1,4 @@ -# Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2013-2016 Intel, Inc. All rights reserved # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. diff --git a/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 b/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 index 6596c0ae88d..4ef0ba25e32 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/c_get_alignment.m4 @@ -11,7 +11,7 @@ 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) 2009 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2015 Intel, Inc. All rights reserved. dnl Copyright (c) 2015-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh index e5c948f15f1..d4a9dce6ab3 100755 --- a/opal/mca/pmix/pmix3x/pmix/config/distscript.sh +++ b/opal/mca/pmix/pmix3x/pmix/config/distscript.sh @@ -15,7 +15,7 @@ # and Technology (RIST). All rights reserved. # Copyright (c) 2015 Los Alamos National Security, LLC. All rights # reserved. -# Copyright (c) 2017-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 index 1d37089f8ae..b057aa91a67 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix.m4 @@ -17,7 +17,7 @@ dnl Copyright (c) 2009 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2009-2011 Oak Ridge National Labs. All rights reserved. dnl Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. -dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2020 Intel, Inc. All rights reserved. dnl Copyright (c) 2015-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 Mellanox Technologies, Inc. @@ -785,6 +785,15 @@ AC_DEFUN([PMIX_SETUP_CORE],[ PMIX_ZLIB_CONFIG + ################################## + # Dstore Locking + ################################## + + pmix_show_title "Dstore Locking" + + PMIX_CHECK_DSTOR_LOCK + + ################################## # MCA ################################## @@ -823,13 +832,6 @@ AC_DEFUN([PMIX_SETUP_CORE],[ PMIX_MCA - ################################## - # Dstore Locking - ################################## - - pmix_show_title "Dstore Locking" - - PMIX_CHECK_DSTOR_LOCK ############################################################################ # final compiler config diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 index da822b04810..4704b8f1c6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_compiler_version.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. -dnl Copyright (c) 2013-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2013-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 index 05ce9431bd3..de92a5d66cf 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_icc.m4 @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 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) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014 Intel, Inc. All rights reserved. dnl Copyright (c) 2016-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 index 0590dcf56cd..182b8329014 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_lock.m4 @@ -5,7 +5,7 @@ dnl All rights reserved. dnl Copyright (c) 2017 IBM Corporation. All rights reserved. dnl Copyright (c) 2017 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. -dnl Copyright (c) 2017 Intel, Inc. All rights reserved. +dnl Copyright (c) 2017-2020 Intel, Inc. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -14,35 +14,61 @@ dnl $HEADER$ dnl AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[ + + PMIX_VAR_SCOPE_PUSH(orig_libs pmix_prefer_write_nonrecursive) + orig_libs=$LIBS LIBS="-lpthread $LIBS" - _x_ac_pthread_lock_found="0" - _x_ac_fcntl_lock_found="0" + _x_ac_pthread_lock_found=0 + _x_ac_fcntl_lock_found=0 + pmix_prefer_write_nonrecursive=0 - AC_CHECK_MEMBERS([struct flock.l_type], - [ - AC_DEFINE([HAVE_FCNTL_FLOCK], [1], - [Define to 1 if you have the locking by fcntl.]) - _x_ac_fcntl_lock_found="1" - ], [], [#include ]) + AC_CHECK_MEMBER([struct flock.l_type], + [pmix_fcntl_flock_happy=yes + _x_ac_fcntl_lock_found=1], + [pmix_fcntl_flock_happy=no], + [#include ]) if test "$DSTORE_PTHREAD_LOCK" = "1"; then + + AC_MSG_CHECKING([pthread_process_shared]) + AC_EGREP_CPP([yes], + [#include + #ifdef PTHREAD_PROCESS_SHARED + yes + #endif + ], + [AC_MSG_RESULT(yes) + pmix_pthread_process_shared=yes], + [AC_MSG_RESULT(no) + pmix_pthread_process_shared=no]) + AC_CHECK_FUNC([pthread_rwlockattr_setkind_np], - [AC_EGREP_HEADER([PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP], - [pthread.h],[ - AC_DEFINE([HAVE_PTHREAD_SETKIND], [1], - [Define to 1 if you have the `pthread_rwlockattr_setkind_np` function.])])]) + [pmix_pthread_rwlockattr_setkind_np=yes + AC_EGREP_CPP([yes], + [#include + #ifdef PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP + yes + #endif + ], + [pmix_pthread_rwlock_prefer_writer_nonrecursive_np=yes], + [pmix_pthread_rwlock_prefer_writer_nonrecursive_np=no])], + [pmix_pthread_rwlockattr_setkind_np=no]) AC_CHECK_FUNC([pthread_rwlockattr_setpshared], - [AC_EGREP_HEADER([PTHREAD_PROCESS_SHARED], - [pthread.h],[ - AC_DEFINE([HAVE_PTHREAD_SHARED], [1], - [Define to 1 if you have the `PTHREAD_PROCESS_SHARED` definition. - ]) - _x_ac_pthread_lock_found="1" - ]) - ]) + [pmix_pthread_rwlockattr_setpshared=yes + AS_IF([test "$pmix_pthread_process_shared" = "yes"], + [_x_ac_pthread_lock_found=1]]), + [pmix_pthread_rwlockattr_setpshared=no]) + + AC_CHECK_FUNC([pthread_mutexattr_setpshared], + [pmix_pthread_mutexattr_setpshared=yes], + [pmix_pthread_mutexattr_setpshared=no]) + + AS_IF([test "$pmix_pthread_rwlockattr_setkind_np" = "yes" && test "$pmix_pthread_rwlock_prefer_writer_nonrecursive_np" = "yes"], + [pmix_prefer_write_nonrecursive=1], + [pmix_prefer_write_nonrecursive=0]) if test "$_x_ac_pthread_lock_found" = "0"; then if test "$_x_ac_fcntl_lock_found" = "1"; then @@ -57,6 +83,12 @@ AC_DEFUN([PMIX_CHECK_DSTOR_LOCK],[ fi fi LIBS="$orig_libs" + + AC_DEFINE_UNQUOTED([PMIX_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP], + [$pmix_prefer_write_nonrecursive], + [Whether or not we found the optional write_nonrecursive_np flag]) AM_CONDITIONAL([HAVE_DSTORE_PTHREAD_LOCK], [test "$_x_ac_pthread_lock_found" = "1"]) AM_CONDITIONAL([HAVE_DSTORE_FCNTL_LOCK], [test "$_x_ac_fcntl_lock_found" = "1"]) + + PMIX_VAR_SCOPE_POP ]) diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 index b23f66ebb01..6a93035e2b4 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_config_pthreads.m4 @@ -10,7 +10,7 @@ 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) 2012 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2014-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2014-2020 Intel, Inc. All rights reserved. dnl Copyright (c) 2014-2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ @@ -273,11 +273,6 @@ PMIX_INTL_POSIX_THREADS_SPECIAL_FLAGS # Try the normal linking methods (that's no fun) PMIX_INTL_POSIX_THREADS_LIBS -# -# check to see if we can create shared memory mutexes and conditions -# -AC_CHECK_FUNCS([pthread_mutexattr_setpshared pthread_condattr_setpshared]) - # # check to see if we can set error checking mutexes # diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 index e9b237cd53f..a75d339b2bd 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_functions.m4 @@ -94,9 +94,19 @@ EOF # Save some stats about this build # -PMIX_CONFIGURE_USER="`whoami`" -PMIX_CONFIGURE_HOST="`(hostname || uname -n) 2> /dev/null | sed 1q`" -PMIX_CONFIGURE_DATE="`date`" +DATE_FMT="+%Y-%m-%dT%H:%M:%S" +if test -n "$SOURCE_DATE_EPOCH" ; then + PMIX_CONFIGURE_USER="reproduciblebuild" + PMIX_CONFIGURE_HOST="reproduciblebuild" + PMIX_CONFIGURE_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u "$DATE_FMT") +else + PMIX_CONFIGURE_USER="`whoami`" + PMIX_CONFIGURE_HOST="`(hostname || uname -n) 2> /dev/null | sed 1q`" + PMIX_CONFIGURE_DATE="`date $DATE_FMT`" +fi + +AC_SUBST([SOURCE_DATE_EPOCH]) +AM_CONDITIONAL([SOURCE_DATE_EPOCH_SET], [test -n "$SOURCE_DATE_EPOCH"]) # # Save these details so that they can be used in pmix_info later diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index ae488781f7e..ad3e79c2972 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -12,7 +12,7 @@ # Copyright (c) 2006-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2013 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2015-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2015-2018 Intel, Inc. All rights reserved. # Copyright (c) 2015 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.4 +Version: 3.1.5rc2 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c index 76a1ac8ca0c..8a95a405b78 100644 --- a/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c +++ b/opal/mca/pmix/pmix3x/pmix/examples/dmodex.c @@ -23,67 +23,16 @@ * */ -#include +#include +#include -#define _GNU_SOURCE #include - #include #include #include -#include -#include "examples.h" - static uint32_t nprocs; static pmix_proc_t myproc; -static uint32_t getcount = 0; - -static void opcbfunc(pmix_status_t status, void *cbdata) -{ - mylock_t *lock = (mylock_t*)cbdata; - - fprintf(stderr, "%s:%d completed fence_nb\n", myproc.nspace, myproc.rank); - lock->status = status; - DEBUG_WAKEUP_THREAD(lock); -} - -static void valcbfunc(pmix_status_t status, - pmix_value_t *val, void *cbdata) -{ - char *key = (char*)cbdata; - - if (PMIX_SUCCESS == status) { - if (NULL != strstr(key, "local")) { - if (PMIX_UINT64 != val->type) { - fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, key, val->type); - goto done; - } - if (1234 != val->data.uint64) { - fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong value: %d\n", myproc.nspace, myproc.rank, key, (int)val->data.uint64); - goto done; - } - } else if (NULL != strstr(key, "remote")) { - if (PMIX_STRING != val->type) { - fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, key, val->type); - goto done; - } - if (0 != strcmp(val->data.string, "1234")) { - fprintf(stderr, "%s:%d: PMIx_Get_nb Key %s returned wrong value: %s\n", myproc.nspace, myproc.rank, key, val->data.string); - goto done; - } - } else { - fprintf(stderr, "%s:%d PMIx_Get_nb returned wrong key: %s\n", myproc.nspace, myproc.rank, key); - goto done; - } - fprintf(stderr, "%s:%d PMIx_Get_nb Key %s returned correctly\n", myproc.nspace, myproc.rank, key); - } else { - fprintf(stderr, "%s:%d PMIx_Get_nb Key %s failed\n", myproc.nspace, myproc.rank, key); - } - done: - free(key); - getcount++; -} int main(int argc, char **argv) { @@ -92,8 +41,11 @@ int main(int argc, char **argv) pmix_value_t *val = &value; char *tmp; pmix_proc_t proc; - uint32_t n, num_gets; - mylock_t mylock; + uint32_t n, k, nlocal; + bool local, all_local; + char **peers; + pmix_rank_t *locals; + uint8_t j; /* init us */ if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) { @@ -102,58 +54,55 @@ int main(int argc, char **argv) } fprintf(stderr, "Client ns %s rank %d: Running\n", myproc.nspace, myproc.rank); - /* get our universe size */ - PMIX_PROC_CONSTRUCT(&proc); + /* get our job size */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get universe size failed: %d\n", myproc.nspace, myproc.rank, rc); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get job size failed: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } nprocs = val->data.uint32; PMIX_VALUE_RELEASE(val); - fprintf(stderr, "Client %s:%d universe size %d\n", myproc.nspace, myproc.rank, nprocs); + fprintf(stderr, "Client %s:%d job size %d\n", myproc.nspace, myproc.rank, nprocs); /* put a few values */ - if (0 > asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank)) { - exit(1); - } + (void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank); value.type = PMIX_UINT32; value.data.uint32 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Store_internal failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } - free(tmp); - if (0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank)) { - exit(1); - } + (void)asprintf(&tmp, "%s-%d-local", myproc.nspace, myproc.rank); value.type = PMIX_UINT64; value.data.uint64 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } - free(tmp); - if (0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank)) { - exit(1); - } + (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, myproc.rank); value.type = PMIX_STRING; value.data.string = "1234"; - if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) { + if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_GLOBAL, tmp, &value))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Put internal failed: %d\n", myproc.nspace, myproc.rank, rc); goto done; } - free(tmp); - /* introduce a delay by one rank so we can check what happens - * if a "get" is received prior to data being provided */ - - if (0 == myproc.rank) { - sleep(2); + value.type = PMIX_BYTE_OBJECT; + value.data.bo.bytes = (char*)malloc(128); + for (j=0; j < 128; j++) { + value.data.bo.bytes[j] = j; + } + value.data.bo.size = 128; + if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_GLOBAL, "ghex", &value))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Put ghex failed: %d\n", myproc.nspace, myproc.rank, rc); + PMIX_VALUE_DESTRUCT(&value); + goto done; } + PMIX_VALUE_DESTRUCT(&value); /* commit the data to the server */ if (PMIX_SUCCESS != (rc = PMIx_Commit())) { @@ -161,56 +110,92 @@ int main(int argc, char **argv) goto done; } - /* call fence_nb, but don't return any data */ - PMIX_PROC_CONSTRUCT(&proc); - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - DEBUG_CONSTRUCT_LOCK(&mylock); - if (PMIX_SUCCESS != (rc = PMIx_Fence_nb(&proc, 1, NULL, 0, opcbfunc, &mylock))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); - DEBUG_DESTRUCT_LOCK(&mylock); + /* get a list of our local peers */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get local peers failed: %s\n", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); goto done; } + /* split the returned string to get the rank of each local peer */ + peers = pmix_argv_split(val->data.string, ','); + PMIX_VALUE_RELEASE(val); + nlocal = pmix_argv_count(peers); + if (nprocs == nlocal) { + all_local = true; + } else { + all_local = false; + locals = (pmix_rank_t*)malloc(pmix_argv_count(peers) * sizeof(pmix_rank_t)); + for (n=0; NULL != peers[n]; n++) { + locals[n] = strtoul(peers[n], NULL, 10); + } + } + pmix_argv_free(peers); /* get the committed data - ask for someone who doesn't exist as well */ - num_gets = 0; - for (n=0; n <= nprocs; n++) { - if (0 > asprintf(&tmp, "%s-%d-local", myproc.nspace, n)) { - exit(1); - } - (void)strncpy(proc.nspace, tmp, PMIX_MAX_NSLEN); - proc.rank = n; - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, - NULL, 0, valcbfunc, tmp))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); - goto done; + for (n=0; n < nprocs; n++) { + if (all_local) { + local = true; + } else { + local = false; + /* see if this proc is local to us */ + for (k=0; k < nlocal; k++) { + if (proc.rank == locals[k]) { + local = true; + break; + } + } } - ++num_gets; - if (0 > asprintf(&tmp, "%s-%d-remote", myproc.nspace, n)) { - exit(1); + if (local) { + (void)asprintf(&tmp, "%s-%d-local", myproc.nspace, n); + proc.rank = n; + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); + goto done; + } + if (PMIX_UINT64 != val->type) { + fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + goto done; + } + if (1234 != val->data.uint64) { + fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong value: %d\n", myproc.nspace, myproc.rank, tmp, (int)val->data.uint64); + goto done; + } + fprintf(stderr, "%s:%d Local value for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); + } else { + (void)asprintf(&tmp, "%s-%d-remote", myproc.nspace, n); + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); + goto done; + } + if (PMIX_STRING != val->type) { + fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong type: %d\n", myproc.nspace, myproc.rank, tmp, val->type); + goto done; + } + if (0 != strcmp(val->data.string, "1234")) { + fprintf(stderr, "%s:%d: PMIx_Get Key %s returned wrong value: %s\n", myproc.nspace, myproc.rank, tmp, val->data.string); + goto done; + } + fprintf(stderr, "%s:%d Remote value for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); } - (void)strncpy(proc.nspace, tmp, PMIX_MAX_NSLEN); - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&proc, tmp, - NULL, 0, valcbfunc, tmp))) { - fprintf(stderr, "Client ns %s rank %d: PMIx_Get %s failed: %d\n", myproc.nspace, n, tmp, rc); - goto done; + /* if this isn't us, then get the ghex key */ + if (n != myproc.rank) { + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, "ghex", NULL, 0, &val))) { + fprintf(stderr, "Client ns %s rank %d: PMIx_Get ghex failed: %d\n", myproc.nspace, n, rc); + goto done; + } + if (PMIX_BYTE_OBJECT != val->type) { + fprintf(stderr, "%s:%d: PMIx_Get ghex returned wrong type: %d\n", myproc.nspace, myproc.rank, val->type); + goto done; + } + if (128 != val->data.bo.size) { + fprintf(stderr, "%s:%d: PMIx_Get ghex returned wrong size: %d\n", myproc.nspace, myproc.rank, (int)val->data.bo.size); + goto done; + } + fprintf(stderr, "%s:%d Ghex for %s:%d successfully retrieved\n", myproc.nspace, myproc.rank, proc.nspace, proc.rank); } - ++num_gets; } - /* wait for the first fence to finish */ - DEBUG_WAIT_THREAD(&mylock); - - /* wait for all my "get" calls to complete */ - while (getcount < num_gets) { - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 100000; - nanosleep(&ts, NULL); - } - - /* call fence again so everyone waits before leaving */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); + /* call fence so everyone waits before leaving */ proc.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) { fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank, rc); @@ -219,7 +204,7 @@ int main(int argc, char **argv) done: /* finalize us */ - fprintf(stderr, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank); + fprintf(stderr, "Client ns %s rank %d: Finalizing\n", myproc.nspace, myproc.rank); if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { fprintf(stderr, "Client ns %s rank %d:PMIx_Finalize failed: %d\n", myproc.nspace, myproc.rank, rc); } else { diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix.h b/opal/mca/pmix/pmix3x/pmix/include/pmix.h index ba29692c99d..61ce017ca6a 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix.h @@ -473,7 +473,8 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata, * previously released is included. */ PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directive, - pmix_info_t *info, size_t ninfo); + pmix_info_t *info, size_t ninfo, + pmix_info_t **results, size_t *nresults); PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t directive, pmix_info_t *info, size_t ninfo, @@ -620,8 +621,8 @@ PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cre * * source - the nspace/rank of the process that generated the data * - * payload - pointer to character array containing the data. Note that - * multiple strings may be included, and that the array may + * payload - pointer to a PMIx byte object containing the data. Note that + * multiple strings may be included, and that the data may * _not_ be NULL terminated * * info - an optional array of info provided by the source containing @@ -630,7 +631,7 @@ PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cre * ninfo - number of elements in the optional info array */ typedef void (*pmix_iof_cbfunc_t)(size_t iofhdlr, pmix_iof_channel_t channel, - pmix_proc_t *source, char *payload, + pmix_proc_t *source, pmix_byte_object_t *payload, pmix_info_t info[], size_t ninfo); @@ -654,7 +655,9 @@ PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cre * NOTE: STDIN is not supported as it will always * be delivered to the stdin file descriptor * - * cbfunc - function to be called when relevant IO is received + * cbfunc - function to be called when relevant IO is received. A + * NULL indicates that the IO is to be written to stdout + * or stderr as per the originating channel * * regcbfunc - since registration is async, this is the * function to be called when registration is diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in index a3039ff6748..62c4e3e01eb 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_common.h.in @@ -676,7 +676,7 @@ typedef uint32_t pmix_rank_t; #define PMIX_IOF_TAG_OUTPUT "pmix.iof.tag" // (bool) Tag output with the channel it comes from #define PMIX_IOF_TIMESTAMP_OUTPUT "pmix.iof.ts" // (bool) Timestamp output #define PMIX_IOF_XML_OUTPUT "pmix.iof.xml" // (bool) Format output in XML - +#define PMIX_IOF_STOP "pmix.iof.stop" // (bool) Stop forwarding the specified channel(s) /* Attributes for controlling contents of application setup data */ #define PMIX_SETUP_APP_ENVARS "pmix.setup.env" // (bool) harvest and include relevant envars @@ -735,7 +735,7 @@ typedef int pmix_status_t; * at least defined to ensure older codes will compile */ #define PMIX_SUCCESS 0 #define PMIX_ERROR -1 // general error -#define PMIX_ERR_SILENT -2 // internal-only +#define PMIX_ERR_SILENT -2 /* debugger release flag */ #define PMIX_ERR_DEBUGGER_RELEASE -3 /* fault tolerance */ @@ -749,45 +749,45 @@ typedef int pmix_status_t; /* communication failures */ #define PMIX_ERR_SERVER_FAILED_REQUEST -10 #define PMIX_EXISTS -11 -#define PMIX_ERR_INVALID_CRED -12 // internal-only -#define PMIX_ERR_HANDSHAKE_FAILED -13 // internal-only -#define PMIX_ERR_READY_FOR_HANDSHAKE -14 // internal-only +#define PMIX_ERR_INVALID_CRED -12 +#define PMIX_ERR_HANDSHAKE_FAILED -13 +#define PMIX_ERR_READY_FOR_HANDSHAKE -14 #define PMIX_ERR_WOULD_BLOCK -15 -#define PMIX_ERR_UNKNOWN_DATA_TYPE -16 // internal-only -#define PMIX_ERR_PROC_ENTRY_NOT_FOUND -17 // internal-only -#define PMIX_ERR_TYPE_MISMATCH -18 // internal-only -#define PMIX_ERR_UNPACK_INADEQUATE_SPACE -19 // internal-only -#define PMIX_ERR_UNPACK_FAILURE -20 // internal-only -#define PMIX_ERR_PACK_FAILURE -21 // internal-only -#define PMIX_ERR_PACK_MISMATCH -22 // internal-only +#define PMIX_ERR_UNKNOWN_DATA_TYPE -16 +#define PMIX_ERR_PROC_ENTRY_NOT_FOUND -17 +#define PMIX_ERR_TYPE_MISMATCH -18 +#define PMIX_ERR_UNPACK_INADEQUATE_SPACE -19 +#define PMIX_ERR_UNPACK_FAILURE -20 +#define PMIX_ERR_PACK_FAILURE -21 +#define PMIX_ERR_PACK_MISMATCH -22 #define PMIX_ERR_NO_PERMISSIONS -23 #define PMIX_ERR_TIMEOUT -24 #define PMIX_ERR_UNREACH -25 -#define PMIX_ERR_IN_ERRNO -26 // internal-only +#define PMIX_ERR_IN_ERRNO -26 #define PMIX_ERR_BAD_PARAM -27 -#define PMIX_ERR_RESOURCE_BUSY -28 // internal-only +#define PMIX_ERR_RESOURCE_BUSY -28 #define PMIX_ERR_OUT_OF_RESOURCE -29 #define PMIX_ERR_DATA_VALUE_NOT_FOUND -30 #define PMIX_ERR_INIT -31 -#define PMIX_ERR_NOMEM -32 // internal-only -#define PMIX_ERR_INVALID_ARG -33 // internal-only -#define PMIX_ERR_INVALID_KEY -34 // internal-only -#define PMIX_ERR_INVALID_KEY_LENGTH -35 // internal-only -#define PMIX_ERR_INVALID_VAL -36 // internal-only -#define PMIX_ERR_INVALID_VAL_LENGTH -37 // internal-only -#define PMIX_ERR_INVALID_LENGTH -38 // internal-only -#define PMIX_ERR_INVALID_NUM_ARGS -39 // internal-only -#define PMIX_ERR_INVALID_ARGS -40 // internal-only -#define PMIX_ERR_INVALID_NUM_PARSED -41 // internal-only -#define PMIX_ERR_INVALID_KEYVALP -42 // internal-only +#define PMIX_ERR_NOMEM -32 +#define PMIX_ERR_INVALID_ARG -33 +#define PMIX_ERR_INVALID_KEY -34 +#define PMIX_ERR_INVALID_KEY_LENGTH -35 +#define PMIX_ERR_INVALID_VAL -36 +#define PMIX_ERR_INVALID_VAL_LENGTH -37 +#define PMIX_ERR_INVALID_LENGTH -38 +#define PMIX_ERR_INVALID_NUM_ARGS -39 +#define PMIX_ERR_INVALID_ARGS -40 +#define PMIX_ERR_INVALID_NUM_PARSED -41 +#define PMIX_ERR_INVALID_KEYVALP -42 #define PMIX_ERR_INVALID_SIZE -43 #define PMIX_ERR_INVALID_NAMESPACE -44 -#define PMIX_ERR_SERVER_NOT_AVAIL -45 // internal-only +#define PMIX_ERR_SERVER_NOT_AVAIL -45 #define PMIX_ERR_NOT_FOUND -46 #define PMIX_ERR_NOT_SUPPORTED -47 #define PMIX_ERR_NOT_IMPLEMENTED -48 #define PMIX_ERR_COMM_FAILURE -49 -#define PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER -50 // internal-only +#define PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER -50 #define PMIX_ERR_CONFLICTING_CLEANUP_DIRECTIVES -51 /* define a starting point for v2.x error values */ @@ -1018,10 +1018,12 @@ static inline void* pmix_calloc(size_t n, size_t m) }while(0) /* define a convenience macro for loading nspaces */ -#define PMIX_LOAD_NSPACE(a, b) \ - do { \ - memset((a), 0, PMIX_MAX_NSLEN+1); \ - pmix_strncpy((a), (b), PMIX_MAX_NSLEN); \ +#define PMIX_LOAD_NSPACE(a, b) \ + do { \ + memset((a), 0, PMIX_MAX_NSLEN+1); \ + if (NULL != (b)) { \ + pmix_strncpy((char*)(a), (b), PMIX_MAX_NSLEN); \ + } \ }while(0) /* define a convenience macro for checking nspaces */ @@ -1239,7 +1241,7 @@ typedef struct pmix_proc { #define PMIX_PROC_LOAD(m, n, r) \ do { \ PMIX_PROC_CONSTRUCT((m)); \ - pmix_strncpy((m)->nspace, (n), PMIX_MAX_NSLEN); \ + pmix_strncpy((char*)(m)->nspace, (n), PMIX_MAX_NSLEN); \ (m)->rank = (r); \ } while(0) @@ -1249,9 +1251,9 @@ typedef struct pmix_proc { memset((t), 0, PMIX_MAX_NSLEN+1); \ _len = strlen((c)); \ if ((_len + strlen((n))) < PMIX_MAX_NSLEN) { \ - pmix_strncpy((t), (c), PMIX_MAX_NSLEN); \ + pmix_strncpy((char*)(t), (c), PMIX_MAX_NSLEN); \ (t)[_len] = ':'; \ - pmix_strncpy(&(t)[_len+1], (n), PMIX_MAX_NSLEN - _len); \ + pmix_strncpy((char*)&(t)[_len+1], (n), PMIX_MAX_NSLEN - _len); \ } \ } while(0) @@ -1539,7 +1541,7 @@ typedef struct pmix_info { #define PMIX_INFO_LOAD(m, k, v, t) \ do { \ if (NULL != (k)) { \ - pmix_strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ + pmix_strncpy((char*)(m)->key, (k), PMIX_MAX_KEYLEN); \ } \ (m)->flags = 0; \ pmix_value_load(&((m)->value), (v), (t)); \ @@ -1547,7 +1549,7 @@ typedef struct pmix_info { #define PMIX_INFO_XFER(d, s) \ do { \ if (NULL != (s)->key) { \ - pmix_strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ + pmix_strncpy((char*)(d)->key, (s)->key, PMIX_MAX_KEYLEN); \ } \ (d)->flags = (s)->flags; \ pmix_value_xfer(&(d)->value, (pmix_value_t*)&(s)->value); \ @@ -1628,9 +1630,9 @@ typedef struct pmix_pdata { do { \ if (NULL != (m)) { \ memset((m), 0, sizeof(pmix_pdata_t)); \ - pmix_strncpy((m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \ + pmix_strncpy((char*)(m)->proc.nspace, (p)->nspace, PMIX_MAX_NSLEN); \ (m)->proc.rank = (p)->rank; \ - pmix_strncpy((m)->key, (k), PMIX_MAX_KEYLEN); \ + pmix_strncpy((char*)(m)->key, (k), PMIX_MAX_KEYLEN); \ pmix_value_load(&((m)->value), (v), (t)); \ } \ } while (0) @@ -1639,9 +1641,9 @@ typedef struct pmix_pdata { do { \ if (NULL != (d)) { \ memset((d), 0, sizeof(pmix_pdata_t)); \ - pmix_strncpy((d)->proc.nspace, (s)->proc.nspace, PMIX_MAX_NSLEN); \ + pmix_strncpy((char*)(d)->proc.nspace, (s)->proc.nspace, PMIX_MAX_NSLEN); \ (d)->proc.rank = (s)->proc.rank; \ - pmix_strncpy((d)->key, (s)->key, PMIX_MAX_KEYLEN); \ + pmix_strncpy((char*)(d)->key, (s)->key, PMIX_MAX_KEYLEN); \ pmix_value_xfer(&((d)->value), &((s)->value)); \ } \ } while (0) @@ -2657,10 +2659,12 @@ static inline void pmix_darray_destruct(pmix_data_array_t *m) (m)->array = NULL; \ } \ } while(0) -#define PMIX_DATA_ARRAY_CREATE(m, n, t) \ - do { \ - (m) = (pmix_data_array_t*)pmix_calloc(1, sizeof(pmix_data_array_t)); \ - PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ +#define PMIX_DATA_ARRAY_CREATE(m, n, t) \ + do { \ + (m) = (pmix_data_array_t*)pmix_calloc(1, sizeof(pmix_data_array_t)); \ + if (NULL != (m)) { \ + PMIX_DATA_ARRAY_CONSTRUCT((m), (n), (t)); \ + } \ } while(0) #define PMIX_DATA_ARRAY_DESTRUCT(m) pmix_darray_destruct(m) diff --git a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h index 4d3f36bbd43..9a5ac16ff2e 100644 --- a/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h +++ b/opal/mca/pmix/pmix3x/pmix/include/pmix_server.h @@ -449,7 +449,10 @@ typedef pmix_status_t (*pmix_server_validate_cred_fn_t)(const pmix_proc_t *proc, * * This call serves as a registration with the host RM for the given IO channels from * the specified procs - the host RM is expected to ensure that this local PMIx server - * is on the distribution list for the channel/proc combination + * is on the distribution list for the channel/proc combination. IF the PMIX_IOF_STOP + * is included in the directives, then the local PMIx server is requesting that the + * host RM remove the server from the distribution list for the specified channel/proc + * combination. */ typedef pmix_status_t (*pmix_server_iof_fn_t)(const pmix_proc_t procs[], size_t nprocs, const pmix_info_t directives[], size_t ndirs, diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c index fd114a77aa3..69126edba37 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.c @@ -3,6 +3,7 @@ * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,8 +60,8 @@ pmix_status_t pmix_hotel_init(pmix_hotel_t *h, int num_rooms, h->num_rooms = num_rooms; h->evbase = evbase; - h->eviction_timeout.tv_usec = eviction_timeout % 1000000; - h->eviction_timeout.tv_sec = eviction_timeout / 1000000; + h->eviction_timeout.tv_usec = 0; + h->eviction_timeout.tv_sec = eviction_timeout; h->evict_callback_fn = evict_callback_fn; h->rooms = (pmix_hotel_room_t*)malloc(num_rooms * sizeof(pmix_hotel_room_t)); if (NULL != evict_callback_fn) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h index 883a2c5c6ce..f1e331dbb8e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h +++ b/opal/mca/pmix/pmix3x/pmix/src/class/pmix_hotel.h @@ -3,6 +3,7 @@ * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights reserved * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -141,7 +142,7 @@ PMIX_CLASS_DECLARATION(pmix_hotel_t); * @param num_rooms The total number of rooms in the hotel (IN) * @param evbase Pointer to event base used for eviction timeout * @param eviction_timeout Max length of a stay at the hotel before - * the eviction callback is invoked (in microseconds) + * the eviction callback is invoked (in seconds) * @param evict_callback_fn Callback function invoked if an occupant * does not check out before the eviction_timeout. * diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c index 8d522e7a4fa..23110da10c4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c @@ -223,7 +223,11 @@ static void job_data(struct pmix_peer_t *pr, /* unpack the nspace - should be same as our own */ PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, buf, &nspace, &cnt, PMIX_STRING); - if (PMIX_SUCCESS != rc) { + if (PMIX_SUCCESS != rc || + !PMIX_CHECK_NSPACE(nspace, pmix_globals.myid.nspace)) { + if (PMIX_SUCCESS == rc) { + rc = PMIX_ERR_INVALID_VAL; + } PMIX_ERROR_LOG(rc); cb->status = PMIX_ERROR; PMIX_POST_OBJECT(cb); @@ -235,6 +239,7 @@ static void job_data(struct pmix_peer_t *pr, PMIX_GDS_STORE_JOB_INFO(cb->status, pmix_client_globals.myserver, nspace, buf); + free(nspace); cb->status = PMIX_SUCCESS; PMIX_POST_OBJECT(cb); @@ -386,14 +391,18 @@ static void client_iof_handler(struct pmix_peer_t *pr, pmix_byte_object_t bo; int32_t cnt; pmix_status_t rc; + size_t refid, ninfo=0; + pmix_iof_req_t *req; + pmix_info_t *info=NULL; pmix_output_verbose(2, pmix_client_globals.iof_output, - "recvd IOF"); + "recvd IOF with %d bytes", (int)buf->bytes_used); - /* if the buffer is empty, they are simply closing the channel */ + /* if the buffer is empty, they are simply closing the socket */ if (0 == buf->bytes_used) { return; } + PMIX_BYTE_OBJECT_CONSTRUCT(&bo); cnt = 1; PMIX_BFROPS_UNPACK(rc, peer, buf, &source, &cnt, PMIX_PROC); @@ -408,13 +417,52 @@ static void client_iof_handler(struct pmix_peer_t *pr, return; } cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, buf, &bo, &cnt, PMIX_BYTE_OBJECT); + PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return; } - if (NULL != bo.bytes && 0 < bo.size) { - pmix_iof_write_output(&source, channel, &bo, NULL); + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return; + } + if (0 < ninfo) { + PMIX_INFO_CREATE(info, ninfo); + cnt = ninfo; + PMIX_BFROPS_UNPACK(rc, peer, buf, info, &cnt, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + } + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &bo, &cnt, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + /* lookup the handler for this IOF package */ + if (NULL == (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid))) { + /* something wrong here - should not happen */ + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + goto cleanup; + } + /* if the handler invokes a callback function, do so */ + if (NULL != req->cbfunc) { + req->cbfunc(refid, channel, &source, &bo, info, ninfo); + } else { + /* otherwise, simply write it out to the specified std IO channel */ + if (NULL != bo.bytes && 0 < bo.size) { + pmix_iof_write_output(&source, channel, &bo, NULL); + } + } + + cleanup: + /* cleanup the memory */ + if (0 < ninfo) { + PMIX_INFO_FREE(info, ninfo); } PMIX_BYTE_OBJECT_DESTRUCT(&bo); } @@ -435,11 +483,12 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, size_t n; bool found; pmix_ptl_posted_recv_t *rcv; + pid_t pid; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (0 < pmix_globals.init_cntr || - (NULL != pmix_globals.mypeer && PMIX_PROC_IS_SERVER(pmix_globals.mypeer))) { + (NULL != pmix_globals.mypeer && PMIX_PEER_IS_SERVER(pmix_globals.mypeer))) { /* since we have been called before, the nspace and * rank should be known. So return them here if * requested */ @@ -459,13 +508,6 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, } ++pmix_globals.init_cntr; - /* if we don't see the required info, then we cannot init */ - if (NULL == (evar = getenv("PMIX_NAMESPACE"))) { - pmix_init_result = PMIX_ERR_INVALID_NAMESPACE; - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_INVALID_NAMESPACE; - } - /* setup the runtime - this init's the globals, * opens and initializes the required frameworks */ if (PMIX_SUCCESS != (rc = pmix_rte_init(PMIX_PROC_CLIENT, info, ninfo, @@ -519,24 +561,39 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, pmix_output_verbose(2, pmix_client_globals.base_output, "pmix: init called"); - /* we require our nspace */ - if (NULL != proc) { - pmix_strncpy(proc->nspace, evar, PMIX_MAX_NSLEN); - } - PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, evar); - /* set the global pmix_namespace_t object for our peer */ - pmix_globals.mypeer->nptr->nspace = strdup(evar); - - /* we also require our rank */ - if (NULL == (evar = getenv("PMIX_RANK"))) { - /* let the caller know that the server isn't available yet */ - pmix_init_result = PMIX_ERR_DATA_VALUE_NOT_FOUND; - PMIX_RELEASE_THREAD(&pmix_global_lock); - return PMIX_ERR_DATA_VALUE_NOT_FOUND; - } - pmix_globals.myid.rank = strtol(evar, NULL, 10); - if (NULL != proc) { - proc->rank = pmix_globals.myid.rank; + /* see if the required info is present */ + if (NULL == (evar = getenv("PMIX_NAMESPACE"))) { + /* if we didn't see a PMIx server (e.g., missing envar), + * then allow us to run as a singleton */ + pid = getpid(); + snprintf(pmix_globals.myid.nspace, PMIX_MAX_NSLEN, "singleton.%lu", (unsigned long)pid); + pmix_globals.myid.rank = 0; + /* mark that we shouldn't connect to a server */ + pmix_client_globals.singleton = true; + if (NULL != proc) { + PMIX_LOAD_PROCID(proc, pmix_globals.myid.nspace, pmix_globals.myid.rank); + } + pmix_globals.mypeer->nptr->nspace = strdup(pmix_globals.myid.nspace); + } else { + if (NULL != proc) { + pmix_strncpy(proc->nspace, evar, PMIX_MAX_NSLEN); + } + PMIX_LOAD_NSPACE(pmix_globals.myid.nspace, evar); + /* set the global pmix_namespace_t object for our peer */ + pmix_globals.mypeer->nptr->nspace = strdup(evar); + + /* we also require our rank */ + if (NULL == (evar = getenv("PMIX_RANK"))) { + /* let the caller know that the server isn't available yet */ + pmix_init_result = PMIX_ERR_DATA_VALUE_NOT_FOUND; + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_DATA_VALUE_NOT_FOUND; + } else { + pmix_globals.myid.rank = strtol(evar, NULL, 10); + } + if (NULL != proc) { + proc->rank = pmix_globals.myid.rank; + } } pmix_globals.pindex = -1; /* setup a rank_info object for us */ @@ -619,42 +676,55 @@ PMIX_EXPORT pmix_status_t PMIx_Init(pmix_proc_t *proc, } PMIX_INFO_DESTRUCT(&ginfo); - /* connect to the server */ - rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); - if (PMIX_SUCCESS != rc) { - pmix_init_result = rc; - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* mark that we are using the same module as used for the server */ - pmix_globals.mypeer->nptr->compat.ptl = pmix_client_globals.myserver->nptr->compat.ptl; - - /* send a request for our job info - we do this as a non-blocking - * transaction because some systems cannot handle very large - * blocking operations and error out if we try them. */ - req = PMIX_NEW(pmix_buffer_t); - PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - req, &cmd, 1, PMIX_COMMAND); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(req); - pmix_init_result = rc; - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; - } - /* send to the server */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, - req, job_data, (void*)&cb); - if (PMIX_SUCCESS != rc) { - pmix_init_result = rc; - PMIX_RELEASE_THREAD(&pmix_global_lock); - return rc; + if (pmix_client_globals.singleton) { + pmix_globals.mypeer->nptr->compat.ptl = pmix_ptl_base_assign_module(); + pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module(NULL); + pmix_client_globals.myserver->nptr->compat.bfrops = pmix_bfrops_base_assign_module(NULL); + /* initialize our data values */ + rc = pmix_tool_init_info(); + if (PMIX_SUCCESS != rc) { + pmix_init_result = rc; + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + } else { + /* connect to the server */ + rc = pmix_ptl_base_connect_to_peer((struct pmix_peer_t*)pmix_client_globals.myserver, info, ninfo); + if (PMIX_SUCCESS != rc) { + pmix_init_result = rc; + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* mark that we are using the same module as used for the server */ + pmix_globals.mypeer->nptr->compat.ptl = pmix_client_globals.myserver->nptr->compat.ptl; + + /* send a request for our job info - we do this as a non-blocking + * transaction because some systems cannot handle very large + * blocking operations and error out if we try them. */ + req = PMIX_NEW(pmix_buffer_t); + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + req, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(req); + pmix_init_result = rc; + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* send to the server */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + req, job_data, (void*)&cb); + if (PMIX_SUCCESS != rc) { + pmix_init_result = rc; + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* wait for the data to return */ + PMIX_WAIT_THREAD(&cb.lock); + rc = cb.status; + PMIX_DESTRUCT(&cb); } - /* wait for the data to return */ - PMIX_WAIT_THREAD(&cb.lock); - rc = cb.status; - PMIX_DESTRUCT(&cb); if (PMIX_SUCCESS == rc) { pmix_init_result = PMIX_SUCCESS; @@ -1201,8 +1271,14 @@ static void _commitfn(int sd, short args, void *cbdata) return PMIX_ERR_INIT; } + /* if we are a singleton, there is nothing to do */ + if (pmix_client_globals.singleton) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_SUCCESS; + } + /* if we are a server, or we aren't connected, don't attempt to send */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_SUCCESS; // not an error } @@ -1225,25 +1301,23 @@ static void _commitfn(int sd, short args, void *cbdata) return rc; } -static void _resolve_peers(int sd, short args, void *cbdata) -{ - pmix_cb_t *cb = (pmix_cb_t*)cbdata; - - cb->status = pmix_preg.resolve_peers(cb->key, cb->pname.nspace, - &cb->procs, &cb->nprocs); - /* post the data so the receiving thread can acquire it */ - PMIX_POST_OBJECT(cb); - PMIX_WAKEUP_THREAD(&cb->lock); -} - /* need to thread-shift this request */ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, const pmix_nspace_t nspace, pmix_proc_t **procs, size_t *nprocs) { - pmix_cb_t *cb; + pmix_info_t info[2], *iptr; pmix_status_t rc; pmix_proc_t proc; + pmix_value_t *val; + char **p, **tmp=NULL, *prs; + pmix_proc_t *pa; + size_t m, n, np, ninfo; + pmix_namespace_t *ns; + + /* set default response */ + *procs = NULL; + *nprocs = 0; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1252,70 +1326,153 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_peers(const char *nodename, } PMIX_RELEASE_THREAD(&pmix_global_lock); + /* if I am a client and my server is earlier than v3.1.5, then + * I need to look for this data under rank=PMIX_RANK_WILDCARD + * with a key equal to the nodename */ + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer) && + PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { + proc.rank = PMIX_RANK_WILDCARD; + iptr = NULL; + ninfo = 0; + } else { + proc.rank = PMIX_RANK_UNDEF; + PMIX_INFO_LOAD(&info[0], PMIX_NODE_INFO, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&info[1], PMIX_HOSTNAME, nodename, PMIX_STRING); + iptr = info; + ninfo = 2; + } + + if (NULL == nspace || 0 == strlen(nspace)) { + rc = PMIX_ERR_NOT_FOUND; + np = 0; + /* cycle across all known nspaces and aggregate the results */ + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + PMIX_LOAD_NSPACE(proc.nspace, ns->nspace); + rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, iptr, ninfo, &val); + if (PMIX_SUCCESS != rc) { + continue; + } - cb = PMIX_NEW(pmix_cb_t); - cb->key = (char*)nodename; - cb->pname.nspace = strdup(nspace); + /* sanity check */ + if (NULL == val) { + rc = PMIX_ERR_NOT_FOUND; + continue; + } + if (PMIX_STRING != val->type) { + rc = PMIX_ERR_INVALID_VAL; + PMIX_VALUE_FREE(val, 1); + continue; + } + if (NULL == val->data.string) { + /* no local peers on this node */ + PMIX_VALUE_FREE(val, 1); + continue; + } + /* prepend the nspace */ + if (0 > asprintf(&prs, "%s:%s", ns->nspace, val->data.string)) { + PMIX_VALUE_FREE(val, 1); + continue; + } + /* add to our list of results */ + pmix_argv_append_nosize(&tmp, prs); + /* split to count the npeers */ + p = pmix_argv_split(val->data.string, ','); + np += pmix_argv_count(p); + /* done with this entry */ + pmix_argv_free(p); + free(prs); + PMIX_VALUE_FREE(val, 1); + } + if (0 < np) { + /* allocate the proc array */ + PMIX_PROC_CREATE(pa, np); + if (NULL == pa) { + rc = PMIX_ERR_NOMEM; + pmix_argv_free(tmp); + goto done; + } + *procs = pa; + *nprocs = np; + /* transfer the results */ + np = 0; + for (n=0; NULL != tmp[n]; n++) { + /* find the nspace delimiter */ + prs = strchr(tmp[n], ':'); + *prs = '\0'; + ++prs; + p = pmix_argv_split(prs, ','); + for (m=0; NULL != p[m]; m++) { + PMIX_LOAD_NSPACE(&pa[np].nspace, tmp[n]); + pa[n].rank = strtoul(p[m], NULL, 10); + } + pmix_argv_free(p); + } + pmix_argv_free(tmp); + rc = PMIX_SUCCESS; + } + goto done; + } - PMIX_THREADSHIFT(cb, _resolve_peers); + /* get the list of local peers for this nspace and node */ + PMIX_LOAD_NSPACE(proc.nspace, nspace); - /* wait for the result */ - PMIX_WAIT_THREAD(&cb->lock); + rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, iptr, ninfo, &val); + if (PMIX_SUCCESS != rc) { + goto done; + } - /* if the nspace wasn't found, then we need to - * ask the server for that info */ - if (PMIX_ERR_INVALID_NAMESPACE == cb->status) { - pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - /* any key will suffice as it will bring down - * the entire data blob */ - rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, NULL); - if (PMIX_SUCCESS != rc) { - PMIX_RELEASE(cb); - return rc; - } - /* retry the fetch */ - cb->lock.active = true; - PMIX_THREADSHIFT(cb, _resolve_peers); - PMIX_WAIT_THREAD(&cb->lock); + /* sanity check */ + if (NULL == val) { + rc = PMIX_ERR_NOT_FOUND; + goto done; + } + if (PMIX_STRING != val->type || + NULL == val->data.string) { + rc = PMIX_ERR_INVALID_VAL; + PMIX_VALUE_FREE(val, 1); + goto done; } - *procs = cb->procs; - *nprocs = cb->nprocs; - rc = cb->status; - PMIX_RELEASE(cb); - return rc; -} + /* split the procs to get a list */ + p = pmix_argv_split(val->data.string, ','); + np = pmix_argv_count(p); + PMIX_VALUE_FREE(val, 1); -static void _resolve_nodes(int fd, short args, void *cbdata) -{ - pmix_cb_t *cb = (pmix_cb_t*)cbdata; - char *regex, **names; - - /* get a regular expression describing the PMIX_NODE_MAP */ - cb->status = pmix_preg.resolve_nodes(cb->pname.nspace, ®ex); - if (PMIX_SUCCESS == cb->status) { - /* parse it into an argv array of names */ - cb->status = pmix_preg.parse_nodes(regex, &names); - if (PMIX_SUCCESS == cb->status) { - /* assemble it into a comma-delimited list */ - cb->key = pmix_argv_join(names, ','); - pmix_argv_free(names); - } else { - free(regex); - } + /* allocate the proc array */ + PMIX_PROC_CREATE(pa, np); + if (NULL == pa) { + rc = PMIX_ERR_NOMEM; + pmix_argv_free(p); + goto done; } - /* post the data so the receiving thread can acquire it */ - PMIX_POST_OBJECT(cb); - PMIX_WAKEUP_THREAD(&cb->lock); + /* transfer the results */ + for (n=0; n < np; n++) { + PMIX_LOAD_NSPACE(&pa[n].nspace, nspace); + pa[n].rank = strtoul(p[n], NULL, 10); + } + pmix_argv_free(p); + *procs = pa; + *nprocs = np; + + done: + if (NULL != iptr) { + PMIX_INFO_DESTRUCT(&info[0]); + PMIX_INFO_DESTRUCT(&info[1]); + } + return rc; } -/* need to thread-shift this request */ PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char **nodelist) { - pmix_cb_t *cb; pmix_status_t rc; pmix_proc_t proc; + pmix_value_t *val; + char **tmp = NULL, **p; + size_t n; + pmix_namespace_t *ns; + + /* set default response */ + *nodelist = NULL; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { @@ -1324,35 +1481,69 @@ PMIX_EXPORT pmix_status_t PMIx_Resolve_nodes(const pmix_nspace_t nspace, char ** } PMIX_RELEASE_THREAD(&pmix_global_lock); - cb = PMIX_NEW(pmix_cb_t); - cb->pname.nspace = strdup(nspace); - - PMIX_THREADSHIFT(cb, _resolve_nodes); + /* get the list of nodes for this nspace */ + proc.rank = PMIX_RANK_WILDCARD; - /* wait for the result */ - PMIX_WAIT_THREAD(&cb->lock); + if (NULL == nspace || 0 == strlen(nspace)) { + rc = PMIX_ERR_NOT_FOUND; + /* cycle across all known nspaces and aggregate the results */ + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + PMIX_LOAD_NSPACE(proc.nspace, ns->nspace); + rc = PMIx_Get(&proc, PMIX_NODE_LIST, NULL, 0, &val); + if (PMIX_SUCCESS != rc) { + continue; + } - /* if the nspace wasn't found, then we need to - * ask the server for that info */ - if (PMIX_ERR_INVALID_NAMESPACE == cb->status) { - pmix_strncpy(proc.nspace, nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - /* any key will suffice as it will bring down - * the entire data blob */ - rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, NULL); - if (PMIX_SUCCESS != rc) { - PMIX_RELEASE(cb); - return rc; + /* sanity check */ + if (NULL == val) { + rc = PMIX_ERR_NOT_FOUND; + continue; + } + if (PMIX_STRING != val->type) { + rc = PMIX_ERR_INVALID_VAL; + PMIX_VALUE_FREE(val, 1); + continue; + } + if (NULL == val->data.string) { + /* no nodes found */ + PMIX_VALUE_FREE(val, 1); + continue; + } + /* add to our list of results, ensuring uniqueness */ + p = pmix_argv_split(val->data.string, ','); + for (n=0; NULL != p[n]; n++) { + pmix_argv_append_unique_nosize(&tmp, p[n], true); + } + pmix_argv_free(p); + PMIX_VALUE_FREE(val, 1); + } + if (0 < pmix_argv_count(tmp)) { + *nodelist = pmix_argv_join(tmp, ','); + pmix_argv_free(tmp); + rc = PMIX_SUCCESS; } - /* retry the fetch */ - cb->lock.active = true; - PMIX_THREADSHIFT(cb, _resolve_nodes); - PMIX_WAIT_THREAD(&cb->lock); + return rc; } - /* the string we want is in the key field */ - *nodelist = cb->key; - rc = cb->status; - PMIX_RELEASE(cb); - return rc; + PMIX_LOAD_NSPACE(proc.nspace, nspace); + rc = PMIx_Get(&proc, PMIX_NODE_LIST, NULL, 0, &val); + if (PMIX_SUCCESS != rc) { + return rc; + } + + /* sanity check */ + if (NULL == val) { + return PMIX_ERR_NOT_FOUND; + } + if (PMIX_STRING != val->type || + NULL == val->data.string) { + PMIX_VALUE_FREE(val, 1); + return PMIX_ERR_INVALID_VAL; + } + + /* pass back the result */ + *nodelist = strdup(val->data.string); + PMIX_VALUE_FREE(val, 1); + + return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c index adac9bbf4d3..76c8a936c6e 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_fence.c @@ -81,6 +81,12 @@ PMIX_EXPORT pmix_status_t PMIx_Fence(const pmix_proc_t procs[], size_t nprocs, return PMIX_ERR_INIT; } + /* if we are a singleton, there is nothing to do */ + if (pmix_client_globals.singleton) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_SUCCESS; + } + /* if we aren't connected, don't attempt to send */ if (!pmix_globals.connected) { PMIX_RELEASE_THREAD(&pmix_global_lock); diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index b620c05cf29..a2a92ae87d9 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -52,6 +52,7 @@ #include "src/class/pmix_list.h" #include "src/mca/bfrops/bfrops.h" +#include "src/mca/ptl/base/base.h" #include "src/threads/threads.h" #include "src/util/argv.h" #include "src/util/compress.h" @@ -60,7 +61,7 @@ #include "src/util/name_fns.h" #include "src/util/output.h" #include "src/mca/gds/gds.h" -#include "src/mca/ptl/ptl.h" +#include "src/mca/ptl/base/base.h" #include "pmix_client_ops.h" @@ -90,6 +91,9 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, { pmix_cb_t *cb; pmix_status_t rc; + size_t n, nfo; + pmix_proc_t p; + pmix_info_t nodeinfo, *iptr; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -104,18 +108,62 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, (NULL == proc) ? "NULL" : PMIX_NAME_PRINT(proc), (NULL == key) ? "NULL" : key); - /* try to get data directly, without threadshift */ - if (PMIX_RANK_UNDEF != proc->rank && NULL != key) { - if (PMIX_SUCCESS == (rc = _getfn_fastpath(proc, key, info, ninfo, val))) { - goto done; + memcpy(&p, proc, sizeof(pmix_proc_t)); + iptr = (pmix_info_t*)info; + nfo = ninfo; + + if (!PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { + if (PMIX_RANK_UNDEF == proc->rank || NULL == key) { + goto doget; + } + /* if they are asking about a node-level piece of info, + * then the rank must be UNDEF */ + if (pmix_check_node_info(key)) { + p.rank = PMIX_RANK_UNDEF; + /* see if they told us to get node info */ + if (NULL == info) { + /* guess not - better do it */ + PMIX_INFO_LOAD(&nodeinfo, PMIX_NODE_INFO, NULL, PMIX_BOOL); + iptr = &nodeinfo; + nfo = 1; + } + goto doget; + } + /* if they are asking about an app-level piece of info, + * then the rank must be UNDEF */ + if (pmix_check_app_info(key)) { + p.rank = PMIX_RANK_UNDEF; + /* see if they told us to get app info */ + if (NULL == info) { + /* guess not - better do it */ + PMIX_INFO_LOAD(&nodeinfo, PMIX_APP_INFO, NULL, PMIX_BOOL); + iptr = &nodeinfo; + nfo = 1; + } + goto doget; + } + + /* see if they are requesting session, node, or app-level info */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(info, PMIX_NODE_INFO) || + PMIX_CHECK_KEY(info, PMIX_APP_INFO) || + PMIX_CHECK_KEY(info, PMIX_SESSION_INFO)) { + goto doget; + } } } + /* try to get data directly, without threadshift */ + if (PMIX_SUCCESS == (rc = _getfn_fastpath(&p, key, iptr, nfo, val))) { + goto done; + } + + doget: /* create a callback object as we need to pass it to the * recv routine so we know which callback to use when * the return message is recvd */ cb = PMIX_NEW(pmix_cb_t); - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(proc, key, info, ninfo, _value_cbfunc, cb))) { + if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&p, key, iptr, nfo, _value_cbfunc, cb))) { PMIX_RELEASE(cb); return rc; } @@ -298,6 +346,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, int32_t cnt; pmix_proc_t proc; pmix_kval_t *kv; + bool diffnspace; pmix_output_verbose(2, pmix_client_globals.get_output, "pmix: get_nb callback recvd"); @@ -312,6 +361,9 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, pmix_strncpy(proc.nspace, cb->pname.nspace, PMIX_MAX_NSLEN); proc.rank = cb->pname.rank; + /* check for a different nspace */ + diffnspace = !PMIX_CHECK_NSPACE(pmix_globals.myid.nspace, proc.nspace); + /* a zero-byte buffer indicates that this recv is being * completed due to a lost connection */ if (PMIX_BUFFER_IS_EMPTY(buf)) { @@ -333,7 +385,7 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, if (PMIX_SUCCESS != ret) { goto done; } - if (PMIX_RANK_UNDEF == proc.rank) { + if (PMIX_RANK_UNDEF == proc.rank || diffnspace) { PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_globals.mypeer, buf); } else { PMIX_GDS_ACCEPT_KVS_RESP(rc, pmix_client_globals.myserver, buf); @@ -356,9 +408,18 @@ static void _getnb_cbfunc(struct pmix_peer_t *pr, /* fetch the data from server peer module - since it is passing * it back to the user, we need a copy of it */ cb->copy = true; - if (PMIX_RANK_UNDEF == proc.rank) { + if (PMIX_RANK_UNDEF == proc.rank || diffnspace) { + if (PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { + /* everything is under rank=wildcard */ + proc.rank = PMIX_RANK_WILDCARD; + } PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, cb); } else { + if (PMIX_RANK_UNDEF == proc.rank && + PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { + /* everything is under rank=wildcard */ + proc.rank = PMIX_RANK_WILDCARD; + } PMIX_GDS_FETCH_KV(rc, pmix_client_globals.myserver, cb); } if (PMIX_SUCCESS == rc) { @@ -561,6 +622,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) pmix_proc_t proc; bool optional = false; bool immediate = false; + bool internal_only = false; struct timeval tv; pmix_query_caddy_t *cd; @@ -596,14 +658,10 @@ static void _getnbfn(int fd, short flags, void *cbdata) } } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_DATA_SCOPE)) { cb->scope = cb->info[n].value.data.scope; - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_SESSION_INFO)) { - cb->level = PMIX_LEVEL_SESSION; - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_JOB_INFO)) { - cb->level = PMIX_LEVEL_JOB; - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_APP_INFO)) { - cb->level = PMIX_LEVEL_APP; - } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_NODE_INFO)) { - cb->level = PMIX_LEVEL_NODE; + } else if (PMIX_CHECK_KEY(&cb->info[n], PMIX_NODE_INFO) || + PMIX_CHECK_KEY(&cb->info[n], PMIX_APP_INFO) || + PMIX_CHECK_KEY(&cb->info[n], PMIX_SESSION_INFO)) { + internal_only = true; } } } @@ -623,7 +681,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* if the key is NULL or starts with "pmix", then they are looking * for data that was provided by the server at startup */ - if (NULL == cb->key || 0 == strncmp(cb->key, "pmix", 4)) { + if (!internal_only && (NULL == cb->key || 0 == strncmp(cb->key, "pmix", 4))) { cb->proc = &proc; /* fetch the data from my server's module - since we are passing * it back to the user, we need a copy of it */ @@ -638,11 +696,13 @@ static void _getnbfn(int fd, short flags, void *cbdata) if (PMIX_SUCCESS != rc) { pmix_output_verbose(5, pmix_client_globals.get_output, "pmix:client job-level data NOT found"); - if (0 != strncmp(cb->pname.nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) { + if (!PMIX_CHECK_NSPACE(cb->pname.nspace, pmix_globals.myid.nspace)) { /* we are asking about the job-level info from another * namespace. It seems that we don't have it - go and - * ask server + * ask server and indicate we only need job-level info + * by setting the rank to WILDCARD */ + proc.rank = PMIX_RANK_WILDCARD; goto request; } else if (NULL != cb->key) { /* if immediate was given, then we are being directed to @@ -723,8 +783,8 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* if we got here, then we don't have the data for this proc. If we * are a server, or we are a client and not connected, then there is * nothing more we can do */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || - (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || + (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && !pmix_globals.connected)) { rc = PMIX_ERR_NOT_FOUND; goto respond; } @@ -744,8 +804,7 @@ static void _getnbfn(int fd, short flags, void *cbdata) * this nspace:rank. If we do, then no need to ask again as the * request will return _all_ data from that proc */ PMIX_LIST_FOREACH(cbret, &pmix_client_globals.pending_requests, pmix_cb_t) { - if (0 == strncmp(cbret->pname.nspace, cb->pname.nspace, PMIX_MAX_NSLEN) && - cbret->pname.rank == cb->pname.rank) { + if (PMIX_CHECK_PROCID(&cbret->pname, &cb->pname)) { /* we do have a pending request, but we still need to track this * outstanding request so we can satisfy it once the data is returned */ pmix_list_append(&pmix_client_globals.pending_requests, &cb->super); @@ -755,16 +814,16 @@ static void _getnbfn(int fd, short flags, void *cbdata) /* we don't have a pending request, so let's create one - don't worry * about packing the key as we return everything from that proc */ - msg = _pack_get(cb->pname.nspace, cb->pname.rank, cb->info, cb->ninfo, PMIX_GETNB_CMD); + msg = _pack_get(cb->pname.nspace, proc.rank, cb->info, cb->ninfo, PMIX_GETNB_CMD); if (NULL == msg) { rc = PMIX_ERROR; goto respond; } pmix_output_verbose(2, pmix_client_globals.get_output, - "%s REQUESTING DATA FROM SERVER FOR %s KEY %s", + "%s REQUESTING DATA FROM SERVER FOR %s:%s KEY %s", PMIX_NAME_PRINT(&pmix_globals.myid), - PMIX_NAME_PRINT(cb->proc), cb->key); + cb->proc->nspace, PMIX_RANK_PRINT(proc.rank), cb->key); /* track the callback object */ pmix_list_append(&pmix_client_globals.pending_requests, &cb->super); diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h index c84dffd6d67..11fc42ca3b8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_ops.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,6 +23,7 @@ BEGIN_C_DECLS typedef struct { pmix_peer_t *myserver; // messaging support to/from my server + bool singleton; // no server pmix_list_t pending_requests; // list of pmix_cb_t pending data requests pmix_pointer_array_t peers; // array of pmix_peer_t cached for data ops // verbosity for client get operations diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c index bd6795eac5e..df1799de916 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_pub.c @@ -1,8 +1,8 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. @@ -523,13 +523,13 @@ static void wait_cbfunc(struct pmix_peer_t *pr, (NULL == buf) ? -1 : (int)buf->bytes_used); if (NULL == buf) { - rc = PMIX_ERR_BAD_PARAM; + ret = PMIX_ERR_BAD_PARAM; goto report; } /* a zero-byte buffer indicates that this recv is being * completed due to a lost connection */ if (PMIX_BUFFER_IS_EMPTY(buf)) { - rc = PMIX_ERR_UNREACH; + ret = PMIX_ERR_UNREACH; goto report; } @@ -539,11 +539,12 @@ static void wait_cbfunc(struct pmix_peer_t *pr, buf, &ret, &cnt, PMIX_STATUS); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); + ret = rc; } report: if (NULL != cb->cbfunc.opfn) { - cb->cbfunc.opfn(rc, cb->cbdata); + cb->cbfunc.opfn(ret, cb->cbdata); } PMIX_RELEASE(cb); } diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c index 1c2f74308a0..cce767474ed 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_control.c @@ -187,8 +187,8 @@ PMIX_EXPORT pmix_status_t PMIx_Job_control_nb(const pmix_proc_t targets[], size_ /* if we are the server, then we just issue the request and * return the response */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); if (NULL == pmix_host_server.job_control) { /* nothing we can do */ @@ -344,8 +344,8 @@ PMIX_EXPORT pmix_status_t PMIx_Process_monitor_nb(const pmix_info_t *monitor, pm /* if we are the server, then we just issue the request and * return the response */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); if (NULL == pmix_host_server.monitor) { /* nothing we can do */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c index a9e32c661f6..b2b26f60c67 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_data.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -85,7 +85,7 @@ static pmix_peer_t* find_peer(const pmix_proc_t *proc) return pmix_globals.mypeer; } - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { /* see if we know this proc */ for (i=0; i < pmix_server_globals.clients.size; i++) { if (NULL != (peer = (pmix_peer_t*)pmix_pointer_array_get_item(&pmix_server_globals.clients, i))) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c index 03f38eddc60..893d19544b8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.c @@ -40,24 +40,49 @@ static void msgcbfunc(struct pmix_peer_t *peer, pmix_shift_caddy_t *cd = (pmix_shift_caddy_t*)cbdata; int32_t m; pmix_status_t rc, status; + size_t refid = 0; + + PMIX_ACQUIRE_OBJECT(cd); /* unpack the return status */ m=1; PMIX_BFROPS_UNPACK(rc, peer, buf, &status, &m, PMIX_STATUS); - if (PMIX_SUCCESS == rc && PMIX_SUCCESS == status) { - /* store the request on our list - we are in an event, and + if (NULL != cd->iofreq && PMIX_SUCCESS == rc && PMIX_SUCCESS == status) { + /* get the reference ID */ + m=1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &m, PMIX_SIZE); + /* store the request - we are in an event, and * so this is safe */ - pmix_list_append(&pmix_globals.iof_requests, &cd->iofreq->super); + if (NULL == pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid)) { + pmix_pointer_array_set_item(&pmix_globals.iof_requests, refid, cd->iofreq); + } + if (NULL != cd->cbfunc.hdlrregcbfn) { + cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, refid, cd->cbdata); + } } else if (PMIX_SUCCESS != rc) { status = rc; - PMIX_RELEASE(cd->iofreq); } pmix_output_verbose(2, pmix_client_globals.iof_output, - "pmix:iof_register returned status %s", PMIx_Error_string(status)); + "pmix:iof_register/deregister returned status %s", PMIx_Error_string(status)); - if (NULL != cd->cbfunc.opcbfn) { - cd->cbfunc.opcbfn(status, cd->cbdata); + if (NULL == cd->iofreq) { + /* this was a deregistration request */ + if (NULL == cd->cbfunc.opcbfn) { + cd->status = status; + PMIX_WAKEUP_THREAD(&cd->lock); + } else { + cd->cbfunc.opcbfn(status, cd->cbdata); + } + } else if (NULL == cd->cbfunc.hdlrregcbfn) { + cd->status = status; + cd->ncodes = refid; + PMIX_WAKEUP_THREAD(&cd->lock); + } else { + cd->cbfunc.hdlrregcbfn(PMIX_SUCCESS, refid, cd->cbdata); + } + if (PMIX_SUCCESS != rc && NULL != cd->iofreq) { + PMIX_RELEASE(cd->iofreq); } PMIX_RELEASE(cd); } @@ -83,8 +108,8 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs } /* if we are a server, we cannot do this */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_NOT_SUPPORTED; } @@ -182,6 +207,97 @@ PMIX_EXPORT pmix_status_t PMIx_IOF_pull(const pmix_proc_t procs[], size_t nprocs return rc; } +PMIX_EXPORT pmix_status_t PMIx_IOF_deregister(size_t iofhdlr, + const pmix_info_t directives[], size_t ndirs, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + pmix_shift_caddy_t *cd; + pmix_cmd_t cmd = PMIX_IOF_DEREG_CMD; + pmix_buffer_t *msg; + pmix_status_t rc; + + PMIX_ACQUIRE_THREAD(&pmix_global_lock); + + pmix_output_verbose(2, pmix_client_globals.iof_output, + "pmix:iof_deregister"); + + if (pmix_globals.init_cntr <= 0) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_INIT; + } + + /* if we are a server, we cannot do this */ + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_NOT_SUPPORTED; + } + + /* if we aren't connected, don't attempt to send */ + if (!pmix_globals.connected) { + PMIX_RELEASE_THREAD(&pmix_global_lock); + return PMIX_ERR_UNREACH; + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + + /* send this request to the server */ + cd = PMIX_NEW(pmix_shift_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + cd->cbfunc.opcbfn = cbfunc; + cd->cbdata = cbdata; + + /* setup the registration cmd */ + msg = PMIX_NEW(pmix_buffer_t); + if (NULL == msg) { + PMIX_RELEASE(cd->iofreq); + PMIX_RELEASE(cd); + return PMIX_ERR_NOMEM; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &cmd, 1, PMIX_COMMAND); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &ndirs, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + if (0 < ndirs) { + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, directives, ndirs, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + } + + /* pack the handler ID */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, &iofhdlr, 1, PMIX_SIZE); + + pmix_output_verbose(2, pmix_client_globals.iof_output, + "pmix:iof_dereg sending to server"); + PMIX_PTL_SEND_RECV(rc, pmix_client_globals.myserver, + msg, msgcbfunc, (void*)cd); + + cleanup: + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + PMIX_RELEASE(cd); + } else if (NULL == cbfunc) { + PMIX_WAIT_THREAD(&cd->lock); + rc = cd->status; + PMIX_RELEASE(cd); + } + return rc; +} + typedef struct { pmix_op_cbfunc_t cbfunc; void *cbdata; @@ -237,8 +353,8 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, /* if we are not a server, then we send the provided * data to our server for processing */ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || - PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || + PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { msg = PMIX_NEW(pmix_buffer_t); if (NULL == msg) { return PMIX_ERR_NOMEM; @@ -317,6 +433,99 @@ pmix_status_t PMIx_IOF_push(const pmix_proc_t targets[], size_t ntargets, return PMIX_SUCCESS; } +pmix_status_t pmix_iof_process_iof(pmix_iof_channel_t channels, + const pmix_proc_t *source, + const pmix_byte_object_t *bo, + const pmix_info_t *info, size_t ninfo, + const pmix_iof_req_t *req) +{ + bool match; + size_t m; + pmix_buffer_t *msg; + pmix_status_t rc; + + /* if the channel wasn't included, then ignore it */ + if (!(channels & req->channels)) { + return PMIX_SUCCESS; + } + /* see if the source matches the request */ + match = false; + for (m=0; m < req->nprocs; m++) { + if (PMIX_CHECK_PROCID(source, &req->procs[m])) { + match = true; + break; + } + } + if (!match) { + return PMIX_SUCCESS; + } + /* never forward back to the source! This can happen if the source + * is a launcher - also, never forward to a peer that is no + * longer with us */ + if (NULL == req->requestor->info || req->requestor->finalized) { + return PMIX_SUCCESS; + } + if (PMIX_CHECK_PROCID(source, &req->requestor->info->pname)) { + return PMIX_SUCCESS; + } + /* setup the msg */ + if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { + PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); + return PMIX_ERR_OUT_OF_RESOURCE; + } + /* provide the source */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, source, 1, PMIX_PROC); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + /* provide the channel */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &channels, 1, PMIX_IOF_CHANNEL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + /* provide the handler ID so they know which cbfunc to use */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &req->refid, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + /* pack the number of info's provided */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, &ninfo, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + /* if some were provided, then pack them too */ + if (0 < ninfo) { + PMIX_BFROPS_PACK(rc, req->requestor, msg, info, ninfo, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + } + /* pack the data */ + PMIX_BFROPS_PACK(rc, req->requestor, msg, bo, 1, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + return rc; + } + /* send it to the requestor */ + PMIX_PTL_SEND_ONEWAY(rc, req->requestor, msg, PMIX_PTL_TAG_IOF); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + } + return PMIX_OPERATION_SUCCEEDED; +} + pmix_status_t pmix_iof_write_output(const pmix_proc_t *name, pmix_iof_channel_t stream, const pmix_byte_object_t *bo, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h index 3525c5fb471..66f05a0ade2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_iof.h @@ -200,6 +200,11 @@ PMIX_EXPORT void pmix_iof_stdin_write_handler(int fd, short event, void *cbdata) PMIX_EXPORT bool pmix_iof_stdin_check(int fd); PMIX_EXPORT void pmix_iof_stdin_cb(int fd, short event, void *cbdata); PMIX_EXPORT void pmix_iof_read_local_handler(int fd, short event, void *cbdata); +PMIX_EXPORT pmix_status_t pmix_iof_process_iof(pmix_iof_channel_t channels, + const pmix_proc_t *source, + const pmix_byte_object_t *bo, + const pmix_info_t *info, size_t ninfo, + const pmix_iof_req_t *req); END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c index 0c5aa760fc7..e8c97667e43 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_log.c @@ -28,6 +28,7 @@ #include "src/util/output.h" #include "src/mca/bfrops/bfrops.h" #include "src/mca/plog/base/base.h" +#include "src/mca/ptl/base/base.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" @@ -159,8 +160,8 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata, /* if we are a client or tool, we never do this ourselves - we * always pass this request to our server for execution */ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* if we aren't connected, don't attempt to send */ if (!pmix_globals.connected) { PMIX_RELEASE_THREAD(&pmix_global_lock); @@ -181,15 +182,17 @@ PMIX_EXPORT pmix_status_t PMIx_Log_nb(const pmix_info_t data[], size_t ndata, PMIX_RELEASE(cd); return rc; } - /* provide the timestamp - zero will indicate - * that it wasn't taken */ - PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, - msg, ×tamp, 1, PMIX_TIME); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - PMIX_RELEASE(cd); - return rc; + if (!PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, PMIX_MINOR_WILDCARD, PMIX_RELEASE_WILDCARD)) { + /* provide the timestamp - zero will indicate + * that it wasn't taken */ + PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, + msg, ×tamp, 1, PMIX_TIME); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(msg); + PMIX_RELEASE(cd); + return rc; + } } /* pack the number of data entries */ PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c index 1f217d18a5d..d4a944cb046 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_query.c @@ -290,8 +290,8 @@ PMIX_EXPORT pmix_status_t PMIx_Query_info_nb(pmix_query_t queries[], size_t nque query: /* if we are the server, then we just issue the query and * return the response */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); if (NULL == pmix_host_server.query) { /* nothing we can do */ @@ -359,7 +359,22 @@ static void acb(pmix_status_t status, void *release_cbdata) { pmix_cb_t *cb = (pmix_cb_t*)cbdata; + size_t n; + cb->status = status; + if (NULL != info) { + PMIX_INFO_CREATE(cb->info, ninfo); + if (NULL == cb->info) { + cb->status = PMIX_ERR_NOMEM; + goto done; + } + cb->ninfo = ninfo; + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&cb->info[n], &info[n]); + } + } + + done: if (NULL != release_fn) { release_fn(release_cbdata); } @@ -367,7 +382,8 @@ static void acb(pmix_status_t status, } PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directive, - pmix_info_t *info, size_t ninfo) + pmix_info_t *info, size_t ninfo, + pmix_info_t **results, size_t *nresults) { pmix_cb_t cb; pmix_status_t rc; @@ -383,6 +399,10 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directi pmix_output_verbose(2, pmix_globals.debug_output, "%s pmix:allocate", PMIX_NAME_PRINT(&pmix_globals.myid)); + /* set the default response */ + *results = NULL; + *nresults = 0; + /* create a callback object as we need to pass it to the * recv routine so we know which callback to use when * the return message is recvd */ @@ -396,6 +416,13 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directi /* wait for the operation to complete */ PMIX_WAIT_THREAD(&cb.lock); rc = cb.status; + if (NULL != cb.info) { + *results = cb.info; + *nresults = cb.ninfo; + /* protect the data */ + cb.info = NULL; + cb.ninfo = 0; + } PMIX_DESTRUCT(&cb); pmix_output_verbose(2, pmix_globals.debug_output, @@ -425,8 +452,8 @@ PMIX_EXPORT pmix_status_t PMIx_Allocation_request_nb(pmix_alloc_directive_t dire /* if we are the server, then we just issue the request and * return the response */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); if (NULL == pmix_host_server.allocate) { /* nothing we can do */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c index c4797c1cd05..995f45bdddd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c +++ b/opal/mca/pmix/pmix3x/pmix/src/common/pmix_security.c @@ -131,8 +131,8 @@ PMIX_EXPORT pmix_status_t PMIx_Get_credential(const pmix_info_t info[], size_t n } /* if we are the server */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); /* if the host doesn't support this operation, * see if we can generate it ourselves */ @@ -317,8 +317,8 @@ PMIX_EXPORT pmix_status_t PMIx_Validate_credential(const pmix_byte_object_t *cre } /* if we are the server */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); /* if the host doesn't support this operation, * see if we can validate it ourselves */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h index 6ba6b774932..abfd05f96f4 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -200,7 +200,7 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg); (p)->info->pname.rank); \ /* if I'm a client or tool and this is my server, then we don't */ \ /* set the targets - otherwise, we do */ \ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && \ + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && \ !PMIX_CHECK_PROCID(&pmix_client_globals.myserver->info->pname, \ &(p)->info->pname)) { \ PMIX_PROC_CREATE(ch->targets, 1); \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c index c667489394c..3f59e6a8815 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_notification.c @@ -51,8 +51,8 @@ PMIX_EXPORT pmix_status_t PMIx_Notify_event(pmix_status_t status, return PMIX_ERR_INIT; } - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_RELEASE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_server_globals.event_output, @@ -1223,8 +1223,8 @@ void pmix_event_timeout_cb(int fd, short flags, void *arg) pmix_list_remove_item(&pmix_globals.cached_events, &ch->super); /* process this event thru the regular channels */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { pmix_server_notify_client_of_event(ch->status, &ch->source, ch->range, ch->info, ch->ninfo, ch->final_cbfunc, ch->final_cbdata); diff --git a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c index be2346048d8..4ba4d72f1cd 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c +++ b/opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c @@ -97,11 +97,6 @@ static void regevents_cbfunc(struct pmix_peer_t *peer, pmix_ptl_hdr_t *hdr, PMIX_BFROPS_UNPACK(rc, peer, buf, &ret, &cnt, PMIX_STATUS); if ((PMIX_SUCCESS != rc) || (PMIX_SUCCESS != ret)) { - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - } else { - PMIX_ERROR_LOG(ret); - } /* remove the err handler and call the error handler * reg completion callback fn so the requestor * doesn't hang */ @@ -310,9 +305,9 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer) * type with our server, or if we have directives, then we need to notify * the server - however, don't do this for a v1 server as the event * notification system there doesn't work */ - if ((!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) && + if ((!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) && pmix_globals.connected && - !PMIX_PROC_IS_V1(pmix_client_globals.myserver) && + !PMIX_PEER_IS_V1(pmix_client_globals.myserver) && (need_register || 0 < pmix_list_get_size(xfer))) { pmix_output_verbose(2, pmix_client_globals.event_output, "pmix: _add_hdlr sending to server"); @@ -332,8 +327,8 @@ static pmix_status_t _add_hdlr(pmix_rshift_caddy_t *cd, pmix_list_t *xfer) /* if we are a server and are registering for events, then we only contact * our host if we want environmental events */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer) && cd->enviro && + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer) && cd->enviro && NULL != pmix_host_server.register_events) { pmix_output_verbose(2, pmix_client_globals.event_output, "pmix: _add_hdlr registering with server"); @@ -918,7 +913,7 @@ static void dereg_event_hdlr(int sd, short args, void *cbdata) /* if I am not the server, and I am connected, then I need * to notify the server to remove my registration */ - if ((!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) && + if ((!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) && pmix_globals.connected) { msg = PMIX_NEW(pmix_buffer_t); PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c index df8a6b6e5b4..ee8f83f1461 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c @@ -1,8 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. - * Copyright (c) 2014-2017 Research Organization for Information Science - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. @@ -100,7 +99,7 @@ static void nscon(pmix_namespace_t *p) { p->nspace = NULL; p->nprocs = 0; - p->nlocalprocs = 0; + p->nlocalprocs = SIZE_MAX; p->all_registered = false; p->version_stored = false; p->jobbkt = NULL; @@ -170,7 +169,11 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_rank_info_t, static void pcon(pmix_peer_t *p) { - p->proc_type = PMIX_PROC_UNDEF; + p->proc_type.type = PMIX_PROC_UNDEF; + p->proc_type.major = PMIX_MAJOR_WILDCARD; + p->proc_type.minor = PMIX_MINOR_WILDCARD; + p->proc_type.release = PMIX_RELEASE_WILDCARD; + p->proc_type.padding = 0; p->protocol = PMIX_PROTOCOL_UNDEF; p->finalized = false; p->info = NULL; @@ -228,22 +231,24 @@ PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_peer_t, static void iofreqcon(pmix_iof_req_t *p) { - p->peer = NULL; - memset(&p->pname, 0, sizeof(pmix_name_t)); + p->requestor = NULL; + p->refid = 0; + p->procs = NULL; + p->nprocs = 0; p->channels = PMIX_FWD_NO_CHANNELS; p->cbfunc = NULL; } static void iofreqdes(pmix_iof_req_t *p) { - if (NULL != p->peer) { - PMIX_RELEASE(p->peer); + if (NULL != p->requestor) { + PMIX_RELEASE(p->requestor); } - if (NULL != p->pname.nspace) { - free(p->pname.nspace); + if (0 < p->nprocs) { + PMIX_PROC_FREE(p->procs, p->nprocs); } } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_iof_req_t, - pmix_list_item_t, + pmix_object_t, iofreqcon, iofreqdes); @@ -306,7 +311,6 @@ static void cbcon(pmix_cb_t *p) PMIX_CONSTRUCT(&p->kvs, pmix_list_t); p->copy = false; p->timer_running = false; - p->level = PMIX_LEVEL_UNDEF; } static void cbdes(pmix_cb_t *p) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 113cd48faab..8da9c9ccd2d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -106,6 +106,7 @@ typedef uint8_t pmix_cmd_t; #define PMIX_VALIDATE_CRED_CMD 21 #define PMIX_IOF_PULL_CMD 22 #define PMIX_IOF_PUSH_CMD 23 +#define PMIX_IOF_DEREG_CMD 29 /* provide a "pretty-print" function for cmds */ const char* pmix_command_string(pmix_cmd_t cmd); @@ -122,16 +123,6 @@ typedef enum { PMIX_COLLECT_MAX } pmix_collect_t; -/* define a set of flags indicating the level - * of information being stored/requested */ -typedef enum { - PMIX_LEVEL_UNDEF, - PMIX_LEVEL_SESSION, - PMIX_LEVEL_JOB, - PMIX_LEVEL_APP, - PMIX_LEVEL_NODE -} pmix_level_t; - /**** PEER STRUCTURES ****/ /* clients can only talk to their server, and servers are @@ -256,9 +247,11 @@ PMIX_CLASS_DECLARATION(pmix_peer_t); /* tracker for IOF requests */ typedef struct { - pmix_list_item_t super; - pmix_peer_t *peer; - pmix_name_t pname; + pmix_object_t super; + pmix_peer_t *requestor; + size_t refid; + pmix_proc_t *procs; + size_t nprocs; pmix_iof_channel_t channels; pmix_iof_cbfunc_t cbfunc; } pmix_iof_req_t; @@ -302,6 +295,7 @@ typedef struct { bool hybrid; // true if participating procs are from more than one nspace pmix_proc_t *pcs; // copy of the original array of participants size_t npcs; // number of procs in the array + pmix_list_t nslist; // unique nspace list of participants pmix_lock_t lock; // flag for waiting for completion bool def_complete; // all local procs have been registered and the trk definition is complete pmix_list_t local_cbs; // list of pmix_server_caddy_t for sending result to the local participants @@ -329,6 +323,8 @@ typedef struct { pmix_server_trkr_t *trk; pmix_ptl_hdr_t hdr; pmix_peer_t *peer; + pmix_info_t *info; + size_t ninfo; } pmix_server_caddy_t; PMIX_CLASS_DECLARATION(pmix_server_caddy_t); @@ -399,7 +395,6 @@ typedef struct { pmix_list_t kvs; bool copy; bool timer_running; - pmix_level_t level; } pmix_cb_t; PMIX_CLASS_DECLARATION(pmix_cb_t); @@ -477,7 +472,7 @@ typedef struct { bool commits_pending; struct timeval event_window; pmix_list_t cached_events; // events waiting in the window prior to processing - pmix_list_t iof_requests; // list of pmix_iof_req_t IOF requests + pmix_pointer_array_t iof_requests; // array of pmix_iof_req_t IOF requests int max_events; // size of the notifications hotel int event_eviction_time; // max time to cache notifications pmix_hotel_t notifications; // hotel of pending notifications @@ -490,6 +485,7 @@ typedef struct { pmix_gds_base_module_t *mygds; /* IOF controls */ bool tag_output; + pmix_list_t stdin_targets; // list of pmix_namelist_t bool xml_output; bool timestamp_output; size_t output_limit; @@ -502,6 +498,40 @@ PMIX_EXPORT void pmix_execute_epilog(pmix_epilog_t *ep); PMIX_EXPORT extern pmix_globals_t pmix_globals; PMIX_EXPORT extern pmix_lock_t pmix_global_lock; +static inline bool pmix_check_node_info(const char* key) +{ + char *keys[] = { + PMIX_LOCAL_PEERS, + PMIX_LOCAL_SIZE, + NULL + }; + size_t n; + + for (n=0; NULL != keys[n]; n++) { + if (0 == strncmp(key, keys[n], PMIX_MAX_KEYLEN)) { + return true; + } + } + return false; +} + +static inline bool pmix_check_app_info(const char* key) +{ + char *keys[] = { + PMIX_APP_SIZE, + NULL + }; + size_t n; + + for (n=0; NULL != keys[n]; n++) { + if (0 == strncmp(key, keys[n], PMIX_MAX_KEYLEN)) { + return true; + } + } + return false; +} + + END_C_DECLS #endif /* PMIX_GLOBALS_H */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt index 3c8a67f1990..16b8b86ada7 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/base/help-pmix-mca-base.txt @@ -11,7 +11,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2008-2019 Cisco Systems, Inc. All rights reserved -# Copyright (c) 2018-2019 Intel, Inc. All rights reserved. +# Copyright (c) 2018 Intel, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c index a001728ef02..667f9c64841 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/bfrops/v12/unpack.c @@ -119,7 +119,6 @@ pmix_status_t pmix12_bfrop_unpack(pmix_buffer_t *buffer, *num_vals = 0; /* don't error log here as the user may be unpacking past * the end of the buffer, which isn't necessarily an error */ - PMIX_ERROR_LOG(rc); return rc; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c index c0fc676e6c9..81abef989df 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_base.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. - * Copyright (c) 2016-2018 Mellanox Technologies, Inc. + * Copyright (c) 2016-2019 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -48,7 +48,7 @@ #include "src/util/pmix_environ.h" #include "src/util/hash.h" #include "src/mca/preg/preg.h" - +#include "src/mca/ptl/base/base.h" #include "src/mca/gds/base/base.h" #include "src/mca/pshmem/base/base.h" #include "dstore_common.h" @@ -514,7 +514,7 @@ static int _esh_session_init(pmix_common_dstore_ctx_t *ds_ctx, size_t idx, ns_ma s->jobuid = jobuid; s->nspace_path = strdup(ds_ctx->base_path); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { if (0 != mkdir(s->nspace_path, 0770)) { if (EEXIST != errno) { pmix_output(0, "session init: can not create session directory \"%s\": %s", @@ -566,7 +566,7 @@ static void _esh_session_release(pmix_common_dstore_ctx_t *ds_ctx, size_t idx) ds_ctx->lock_cbs->finalize(&_ESH_SESSION_lock(ds_ctx->session_array, idx)); if (NULL != s->nspace_path) { - if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if(PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { _esh_dir_del(s->nspace_path); } free(s->nspace_path); @@ -649,7 +649,7 @@ static int _update_ns_elem(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns /* synchronize number of meta segments for the target namespace. */ for (i = ns_elem->num_meta_seg; i < info->num_meta_seg; i++) { - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { seg = pmix_common_dstor_create_new_segment(PMIX_DSTORE_NS_META_SEGMENT, ds_ctx->base_path, info->ns_map.name, i, ds_ctx->jobuid, ds_ctx->setjobuid); @@ -684,7 +684,7 @@ static int _update_ns_elem(pmix_common_dstore_ctx_t *ds_ctx, ns_track_elem_t *ns } /* synchronize number of data segments for the target namespace. */ for (i = ns_elem->num_data_seg; i < info->num_data_seg; i++) { - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { seg = pmix_common_dstor_create_new_segment(PMIX_DSTORE_NS_DATA_SEGMENT, ds_ctx->base_path, info->ns_map.name, i, ds_ctx->jobuid, ds_ctx->setjobuid); @@ -821,6 +821,8 @@ static ns_track_elem_t *_get_track_elem_for_namespace(pmix_common_dstore_ctx_t * { ns_track_elem_t *new_elem = NULL; size_t size = pmix_value_array_get_size(ds_ctx->ns_track_array); + ns_track_elem_t *ns_trk; + size_t i, idx = -1; PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: nspace %s", @@ -836,16 +838,30 @@ static ns_track_elem_t *_get_track_elem_for_namespace(pmix_common_dstore_ctx_t * return pmix_value_array_get_item(ds_ctx->ns_track_array, ns_map->track_idx); } + /* Try to find an empty tracker structure */ + ns_trk = PMIX_VALUE_ARRAY_GET_BASE(ds_ctx->ns_track_array, ns_track_elem_t); + for (i = 0; i < size; i++) { + ns_track_elem_t *trk = ns_trk + i; + if (!trk->in_use) { + idx = i; + new_elem = trk; + break; + } + } + /* If we failed - allocate a new tracker */ + if (NULL == new_elem) { + idx = size; + if (NULL == (new_elem = pmix_value_array_get_item(ds_ctx->ns_track_array, idx))) { + return NULL; + } + } + /* create shared memory regions for this namespace and store its info locally * to operate with address and detach/unlink afterwards. */ - if (NULL == (new_elem = pmix_value_array_get_item(ds_ctx->ns_track_array, size))) { - return NULL; - } PMIX_CONSTRUCT(new_elem, ns_track_elem_t); pmix_strncpy(new_elem->ns_map.name, ns_map->name, sizeof(new_elem->ns_map.name)-1); /* save latest track idx to info of nspace */ - ns_map->track_idx = size; - + ns_map->track_idx = idx; return new_elem; } @@ -1591,7 +1607,7 @@ pmix_common_dstore_ctx_t *pmix_common_dstor_init(const char *ds_name, pmix_info_ ds_ctx->ds_name = strdup(ds_name); /* find the temp dir */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { ds_ctx->session_map_search = (session_map_search_fn_t)_esh_session_map_search_server; /* scan incoming info for directives */ @@ -1762,7 +1778,8 @@ PMIX_EXPORT void pmix_common_dstor_finalize(pmix_common_dstore_ctx_t *ds_ctx) pmix_pshmem.finalize(); if (NULL != ds_ctx->base_path){ - if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { + /* coverity[toctou] */ if (lstat(ds_ctx->base_path, &st) >= 0){ if (PMIX_SUCCESS != (rc = _esh_dir_del(ds_ctx->base_path))) { PMIX_ERROR_LOG(rc); @@ -1878,7 +1895,7 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_store(pmix_common_dstore_ctx_t *ds_c "[%s:%d] gds: dstore store for key '%s' scope %d", proc->nspace, proc->rank, kv->key, scope); - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { rc = PMIX_ERR_NOT_SUPPORTED; PMIX_ERROR_LOG(rc); return rc; @@ -1965,7 +1982,7 @@ static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, __FILE__, __LINE__, __func__, nspace, rank, key)); /* protect info of dstore segments before it will be updated */ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { if (0 != (rc = pthread_mutex_lock(&ds_ctx->lock))) { goto error; } @@ -2156,9 +2173,10 @@ static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, break; } } else if (NULL == key) { + char *kname_ptr = PMIX_DS_KNAME_PTR(ds_ctx, addr); PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s: for rank %s:%u, found target key %s", - __FILE__, __LINE__, __func__, nspace, cur_rank, PMIX_DS_KNAME_PTR(ds_ctx, addr))); + __FILE__, __LINE__, __func__, nspace, cur_rank, kname_ptr)); uint8_t *data_ptr = PMIX_DS_DATA_PTR(ds_ctx, addr); size_t data_size = PMIX_DS_DATA_SIZE(ds_ctx, addr, data_ptr); @@ -2172,8 +2190,8 @@ static pmix_status_t _dstore_fetch(pmix_common_dstore_ctx_t *ds_ctx, PMIX_ERROR_LOG(rc); goto done; } - pmix_strncpy(info[kval_cnt - 1].key, PMIX_DS_KNAME_PTR(ds_ctx, addr), - PMIX_DS_KNAME_LEN(ds_ctx, addr)); + pmix_strncpy(info[kval_cnt - 1].key, kname_ptr, + PMIX_DS_KNAME_LEN(ds_ctx, kname_ptr)); pmix_value_xfer(&info[kval_cnt - 1].value, &val); PMIX_VALUE_DESTRUCT(&val); buffer.base_ptr = NULL; @@ -2464,10 +2482,29 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t if (ns_map[map_idx].in_use && (ns_map[map_idx].data.tbl_idx == ns_map_data->tbl_idx)) { if (0 == strcmp(ns_map[map_idx].data.name, nspace)) { + /* Unmap corresponding memory regions and stop tracking this namespace */ + size_t nst_size = pmix_value_array_get_size(ds_ctx->ns_track_array); + if (nst_size && (dstor_track_idx >= 0)) { + if((dstor_track_idx + 1) > (int)nst_size) { + rc = PMIX_ERR_VALUE_OUT_OF_BOUNDS; + PMIX_ERROR_LOG(rc); + goto exit; + } + trk = pmix_value_array_get_item(ds_ctx->ns_track_array, dstor_track_idx); + if (true == trk->in_use) { + PMIX_DESTRUCT(trk); + } + } + /* Cleanup the mapping structure */ _esh_session_map_clean(ds_ctx, &ns_map[map_idx]); continue; + } else { + /* Count other namespaces belonging to this session. + * This is required to identify the moment where all + * namespaces are deleted and session can be removed as well + */ + in_use++; } - in_use++; } } @@ -2478,19 +2515,6 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_del_nspace(pmix_common_dstore_ctx_t PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s delete session for jobuid: %d", __FILE__, __LINE__, __func__, session_tbl[session_tbl_idx].jobuid)); - size = pmix_value_array_get_size(ds_ctx->ns_track_array); - if (size && (dstor_track_idx >= 0)) { - if((dstor_track_idx + 1) > (int)size) { - rc = PMIX_ERR_VALUE_OUT_OF_BOUNDS; - PMIX_ERROR_LOG(rc); - goto exit; - } - trk = pmix_value_array_get_item(ds_ctx->ns_track_array, dstor_track_idx); - if (true == trk->in_use) { - PMIX_DESTRUCT(trk); - pmix_value_array_remove_item(ds_ctx->ns_track_array, dstor_track_idx); - } - } _esh_session_release(ds_ctx, session_tbl_idx); } exit: @@ -2697,8 +2721,9 @@ static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_da pmix_cb_t cb; pmix_kval_t *kv; pmix_buffer_t buf; - pmix_kval_t *kv2 = NULL, *kvp; + pmix_kval_t kv2, *kvp; pmix_status_t rc = PMIX_SUCCESS; + pmix_info_t *ihost; PMIX_CONSTRUCT(&cb, pmix_cb_t); PMIX_CONSTRUCT(&buf, pmix_buffer_t); @@ -2720,33 +2745,55 @@ static pmix_status_t _store_job_info(pmix_common_dstore_ctx_t *ds_ctx, ns_map_da } PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - if ((PMIX_PROC_IS_V1(_client_peer(ds_ctx)) || PMIX_PROC_IS_V20(_client_peer(ds_ctx))) && - 0 != strncmp("pmix.", kv->key, 4) && - kv->value->type == PMIX_DATA_ARRAY) { - pmix_info_t *info; - size_t size, i; - info = kv->value->data.darray->array; - size = kv->value->data.darray->size; - - for (i = 0; i < size; i++) { - if (0 == strcmp(PMIX_LOCAL_PEERS, info[i].key)) { - kv2 = PMIX_NEW(pmix_kval_t); - kv2->key = strdup(kv->key); - PMIX_VALUE_XFER(rc, kv2->value, &info[i].value); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kv2); - goto exit; + if (PMIX_CHECK_KEY(kv, PMIX_NODE_INFO_ARRAY)) { + /* earlier PMIx versions don't know how to handle + * the info arrays - what they need is a key-value + * pair where the key is the name of the node and + * the value is the local peers. So if the peer + * is earlier than 3.1.5, construct the necessary + * translation. Otherwise, ignore it as the hash + * component will handle it for them */ + if (PMIX_PEER_IS_EARLIER(ds_ctx->clients_peer, 3, 1, 5)) { + pmix_info_t *info; + size_t size, i; + /* if it is our local node, then we are going to pass + * all info */ + info = kv->value->data.darray->array; + size = kv->value->data.darray->size; + ihost = NULL; + for (i = 0; i < size; i++) { + if (PMIX_CHECK_KEY(&info[i], PMIX_HOSTNAME)) { + ihost = &info[i]; + break; } - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv2, 1, PMIX_KVAL); + } + if (NULL != ihost) { + PMIX_CONSTRUCT(&kv2, pmix_kval_t); + kv2.key = ihost->value.data.string; + kv2.value = kv->value; + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kv2); goto exit; } - PMIX_RELEASE(kv2); + /* if this host is us, then store each value as its own key */ + if (0 == strcmp(kv2.key, pmix_globals.hostname)) { + for (i = 0; i < size; i++) { + kv2.key = info[i].key; + kv2.value = &info[i].value; + PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, &kv2, 1, PMIX_KVAL); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } + } + } } } + } else if (PMIX_CHECK_KEY(kv, PMIX_APP_INFO_ARRAY) || + PMIX_CHECK_KEY(kv, PMIX_JOB_INFO_ARRAY) || + PMIX_CHECK_KEY(kv, PMIX_SESSION_INFO_ARRAY)) { + continue; } else { PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &buf, kv, 1, PMIX_KVAL); if (PMIX_SUCCESS != rc) { @@ -2804,12 +2851,14 @@ PMIX_EXPORT pmix_status_t pmix_common_dstor_register_job_info(pmix_common_dstore return rc; } + /* pickup all the job-level info by using rank=wildcard */ rc = _store_job_info(ds_ctx, ns_map, &proc); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return rc; } + /* get the rank-level info for each rank in the job */ for (rank=0; rank < ns->nprocs; rank++) { proc.rank = rank; rc = _store_job_info(ds_ctx, ns_map, &proc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c index 69ec1ba577f..362eeb1d56f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/common/dstore/dstore_segment.c @@ -65,16 +65,22 @@ PMIX_EXPORT int pmix_common_dstor_getpagesize(void) PMIX_EXPORT size_t pmix_common_dstor_getcacheblocksize(void) { - size_t cache_line = 0; + long cache_line = 0; #if defined(_SC_LEVEL1_DCACHE_LINESIZE) cache_line = sysconf(_SC_LEVEL1_DCACHE_LINESIZE); #endif #if (defined(HAVE_SYS_AUXV_H)) && (defined(AT_DCACHEBSIZE)) - if (0 == cache_line) { - cache_line = getauxval(AT_DCACHEBSIZE); + if (0 >= cache_line) { + unsigned long auxval; + if( (auxval = getauxval(AT_DCACHEBSIZE)) ){ + cache_line = auxval; + } } #endif + if (0 >= cache_line) { + cache_line = 64; + } return cache_line; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c index abec7a744da..505536a31d6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/base/gds_base_fns.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2018 IBM Corporation. All rights reserved. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/configure.m4 new file mode 100644 index 00000000000..2902ffad943 --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/configure.m4 @@ -0,0 +1,34 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_gds_ds12_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_pmix_gds_ds12_CONFIG],[ + AC_CONFIG_FILES([src/mca/gds/ds12/Makefile]) + + AS_IF([test "$pmix_fcntl_flock_happy" = "yes"], + [$1], + [AS_IF([test "$pmix_pthread_rwlockattr_setpshared" = "yes" && test "$pmix_pthread_process_shared" = "yes"], + [$1], [$2])]) + +])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c index cdfcb252709..43c1008d561 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_base.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. @@ -33,7 +33,7 @@ static pmix_status_t ds12_init(pmix_info_t info[], size_t ninfo) pmix_status_t rc = PMIX_SUCCESS; pmix_common_dstore_file_cbs_t *dstore_file_cbs = NULL; - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { dstore_file_cbs = &pmix_ds20_file_module; } ds12_ctx = pmix_common_dstor_init("ds12", info, ninfo, @@ -94,7 +94,7 @@ static pmix_status_t ds12_cache_job_info(struct pmix_namespace_t *ns, static pmix_status_t ds12_register_job_info(struct pmix_peer_t *pr, pmix_buffer_t *reply) { - if (PMIX_PROC_IS_V1(pr)) { + if (PMIX_PEER_IS_V1(pr)) { ds12_ctx->file_cbs = &pmix_ds12_file_module; } else { ds12_ctx->file_cbs = &pmix_ds20_file_module; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c index 9f52d4fe996..54d29c69ef2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -75,7 +75,7 @@ static int component_open(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { /* launchers cannot use the dstore */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { *priority = 0; *module = NULL; return PMIX_ERROR; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c index 477e91465fb..53c805580fc 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_fcntl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. @@ -112,7 +112,7 @@ pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, lock_ctx->lockfile)); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { lock_ctx->lockfd = open(lock_ctx->lockfile, O_CREAT | O_RDWR | O_EXCL, 0600); /* if previous launch was crashed, the lockfile might not be deleted and unlocked, @@ -157,7 +157,7 @@ pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c } if (0 > lock_ctx->lockfd) { close(lock_ctx->lockfd); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { unlink(lock_ctx->lockfile); } } @@ -180,7 +180,7 @@ void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx) close(fcntl_lock->lockfd); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { unlink(fcntl_lock->lockfile); } free(fcntl_lock); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c index 163015856eb..57177ef5003 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016-2018 Mellanox Technologies, Inc. * All rights reserved. @@ -105,7 +105,7 @@ pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s _lockfile_name: %s", __FILE__, __LINE__, __func__, lock_ctx->lockfile)); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { if (PMIX_SUCCESS != (rc = pmix_pshmem.segment_create(lock_ctx->segment, lock_ctx->lockfile, size))) { PMIX_ERROR_LOG(rc); @@ -138,21 +138,24 @@ pmix_status_t pmix_gds_ds12_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c PMIX_ERROR_LOG(rc); goto error; } -#ifdef HAVE_PTHREAD_SETKIND +#if PMIX_PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP if (0 != pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP)) { pthread_rwlockattr_destroy(&attr); - PMIX_ERROR_LOG(PMIX_ERR_INIT); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); goto error; } #endif if (0 != pthread_rwlock_init(lock_ctx->rwlock, &attr)) { pthread_rwlockattr_destroy(&attr); - PMIX_ERROR_LOG(PMIX_ERR_INIT); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); goto error; } if (0 != pthread_rwlockattr_destroy(&attr)) { - PMIX_ERROR_LOG(PMIX_ERR_INIT); + rc = PMIX_ERR_INIT; + PMIX_ERROR_LOG(rc); goto error; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/configure.m4 new file mode 100644 index 00000000000..673ffce5f9e --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/configure.m4 @@ -0,0 +1,32 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 Sandia National Laboratories. All rights reserved. +# Copyright (c) 2014-2020 Intel, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_gds_ds21_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_pmix_gds_ds21_CONFIG],[ + AC_CONFIG_FILES([src/mca/gds/ds21/Makefile]) + + AS_IF([test "$pmix_pthread_mutexattr_setpshared" = "yes" && test "$pmix_pthread_process_shared" = "yes"], + [$1], [$2]) + +])dnl diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c index c1f42944df8..14e4e49b752 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_component.c @@ -12,7 +12,7 @@ * All rights reserved. * Copyright (c) 2015 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -75,7 +75,7 @@ static int component_open(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { /* launchers cannot use the dstore */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { *priority = 0; *module = NULL; return PMIX_ERROR; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c index 99713f5651e..a9194a8a68b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds21/gds_ds21_lock_pthread.c @@ -2,7 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2020 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -88,7 +88,7 @@ static void ncon(lock_item_t *p) { static void ldes(lock_item_t *p) { uint32_t i; - if(PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if(PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { segment_hdr_t *seg_hdr = (segment_hdr_t *)p->seg_desc->seg_info.seg_base_addr; if (p->lockfile) { unlink(p->lockfile); @@ -150,7 +150,7 @@ pmix_status_t pmix_gds_ds21_lock_init(pmix_common_dstor_lock_ctx_t *ctx, const c PMIX_OUTPUT_VERBOSE((10, pmix_gds_base_framework.framework_output, "%s:%d:%s local_size %d", __FILE__, __LINE__, __func__, local_size)); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { size_t seg_align_size; size_t seg_hdr_size; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c index 5e6a5341bd2..de12f51c148 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/hash/gds_hash.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2020 Intel, Inc. All rights reserved. * Copyright (c) 2016-2018 IBM Corporation. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -36,6 +36,7 @@ #include "src/class/pmix_list.h" #include "src/client/pmix_client_ops.h" #include "src/server/pmix_server_ops.h" +#include "src/mca/ptl/base/base.h" #include "src/util/argv.h" #include "src/util/compress.h" #include "src/mca/preg/preg.h" @@ -125,6 +126,8 @@ pmix_gds_base_module_t pmix_hash_module = { #define PMIX_HASH_PROC_MAP 0x00000010 #define PMIX_HASH_NODE_MAP 0x00000020 +static pmix_list_t mysessions, myjobs; + /**********************************************/ /* struct definitions */ typedef struct { @@ -242,7 +245,7 @@ static PMIX_CLASS_INSTANCE(pmix_apptrkr_t, static void ndinfocon(pmix_nodeinfo_t *p) { - p->nodeid = 0; + p->nodeid = UINT32_MAX; p->hostname = NULL; PMIX_CONSTRUCT(&p->info, pmix_list_t); } @@ -257,19 +260,70 @@ static PMIX_CLASS_INSTANCE(pmix_nodeinfo_t, pmix_list_item_t, ndinfocon, ndinfodes); +static pmix_job_t* get_tracker(const pmix_nspace_t nspace, bool create) +{ + pmix_job_t *trk, *t; + pmix_namespace_t *ns, *nptr; + + /* find the hash table for this nspace */ + trk = NULL; + PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { + if (0 == strcmp(nspace, t->ns)) { + trk = t; + break; + } + } + if (NULL == trk && create) { + /* create one */ + trk = PMIX_NEW(pmix_job_t); + trk->ns = strdup(nspace); + /* see if we already have this nspace */ + nptr = NULL; + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(ns->nspace, nspace)) { + nptr = ns; + break; + } + } + if (NULL == nptr) { + nptr = PMIX_NEW(pmix_namespace_t); + if (NULL == nptr) { + PMIX_RELEASE(trk); + return NULL; + } + nptr->nspace = strdup(nspace); + pmix_list_append(&pmix_globals.nspaces, &nptr->super); + } + PMIX_RETAIN(nptr); + trk->nptr = nptr; + pmix_list_append(&myjobs, &trk->super); + } + return trk; +} + +/********************************************** + * Forward Declarations + **********************************************/ +static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, + pmix_info_t *info, size_t ninfo, + pmix_list_t *kvs); +static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, + pmix_info_t *info, size_t ninfo, + pmix_list_t *kvs); + /**********************************************/ /* process a node array - contains an array of * node-level info for a single node. Either the * nodeid, hostname, or both must be included * in the array to identify the node */ -static pmix_status_t process_node_array(pmix_info_t *info, +static pmix_status_t process_node_array(pmix_value_t *val, pmix_list_t *tgt) { size_t size, j; pmix_info_t *iptr; pmix_status_t rc = PMIX_SUCCESS; - pmix_kval_t *kp2, *k1, *knext; + pmix_kval_t *kp2, *k1; pmix_list_t cache; pmix_nodeinfo_t *nd = NULL, *ndptr; bool update; @@ -278,14 +332,14 @@ static pmix_status_t process_node_array(pmix_info_t *info, "PROCESSING NODE ARRAY"); /* array of node-level info for a specific node */ - if (PMIX_DATA_ARRAY != info->value.type) { + if (PMIX_DATA_ARRAY != val->type) { PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); return PMIX_ERR_TYPE_MISMATCH; } /* setup arrays */ - size = info->value.data.darray->size; - iptr = (pmix_info_t*)info->value.data.darray->array; + size = val->data.darray->size; + iptr = (pmix_info_t*)val->data.darray->array; PMIX_CONSTRUCT(&cache, pmix_list_t); /* cache the values while searching for the nodeid @@ -335,7 +389,7 @@ static pmix_status_t process_node_array(pmix_info_t *info, * provided list */ update = false; PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { - if (ndptr->nodeid == nd->nodeid || + if ((ndptr->nodeid != UINT32_MAX && (ndptr->nodeid == nd->nodeid)) || (NULL != ndptr->hostname && NULL != nd->hostname && 0 == strcmp(ndptr->hostname, nd->hostname))) { /* we assume that the data is updating the current * values */ @@ -355,7 +409,7 @@ static pmix_status_t process_node_array(pmix_info_t *info, /* if this is an update, we have to ensure each data * item only appears once on the list */ if (update) { - PMIX_LIST_FOREACH_SAFE(k1, knext, &nd->info, pmix_kval_t) { + PMIX_LIST_FOREACH(k1, &nd->info, pmix_kval_t) { if (PMIX_CHECK_KEY(k1, kp2->key)) { pmix_list_remove_item(&nd->info, &k1->super); PMIX_RELEASE(k1); @@ -368,7 +422,9 @@ static pmix_status_t process_node_array(pmix_info_t *info, } PMIX_LIST_DESTRUCT(&cache); - pmix_list_append(tgt, &nd->super); + if (!update) { + pmix_list_append(tgt, &nd->super); + } return PMIX_SUCCESS; } @@ -378,7 +434,7 @@ static pmix_status_t process_node_array(pmix_info_t *info, * it is assumed that only app is in the job. * This assumption is checked and generates * an error if violated */ -static pmix_status_t process_app_array(pmix_info_t *info, +static pmix_status_t process_app_array(pmix_value_t *val, pmix_job_t *trk) { pmix_list_t cache, ncache; @@ -400,7 +456,7 @@ static pmix_status_t process_app_array(pmix_info_t *info, } /* array of app-level info */ - if (PMIX_DATA_ARRAY != info->value.type) { + if (PMIX_DATA_ARRAY != val->type) { PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); return PMIX_ERR_TYPE_MISMATCH; } @@ -408,8 +464,8 @@ static pmix_status_t process_app_array(pmix_info_t *info, /* setup arrays and lists */ PMIX_CONSTRUCT(&cache, pmix_list_t); PMIX_CONSTRUCT(&ncache, pmix_list_t); - size = info->value.data.darray->size; - iptr = (pmix_info_t*)info->value.data.darray->array; + size = val->data.darray->size; + iptr = (pmix_info_t*)val->data.darray->array; for (j=0; j < size; j++) { if (PMIX_CHECK_KEY(&iptr[j], PMIX_APPNUM)) { @@ -429,7 +485,7 @@ static pmix_status_t process_app_array(pmix_info_t *info, app = PMIX_NEW(pmix_apptrkr_t); app->appnum = appnum; } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &ncache))) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j].value, &ncache))) { PMIX_ERROR_LOG(rc); goto release; } @@ -536,11 +592,11 @@ static pmix_status_t process_job_array(pmix_info_t *info, PMIX_CONSTRUCT(&cache, pmix_list_t); for (j=0; j < size; j++) { if (PMIX_CHECK_KEY(&iptr[j], PMIX_APP_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_app_array(&iptr[j], trk))) { + if (PMIX_SUCCESS != (rc = process_app_array(&iptr[j].value, trk))) { return rc; } } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &trk->nodeinfo))) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j].value, &trk->nodeinfo))) { PMIX_ERROR_LOG(rc); return rc; } @@ -595,12 +651,114 @@ static pmix_status_t process_job_array(pmix_info_t *info, return rc; } pmix_list_append(&trk->jobinfo, &kp2->super); + /* check for job size */ + if (PMIX_CHECK_KEY(&iptr[j], PMIX_JOB_SIZE) && + !(PMIX_HASH_JOB_SIZE & *flags)) { + trk->nptr->nprocs = iptr[j].value.data.uint32; + *flags |= PMIX_HASH_JOB_SIZE; + } } } return PMIX_SUCCESS; } -static pmix_list_t mysessions, myjobs; +static pmix_status_t process_session_array(pmix_value_t *val, + pmix_job_t *trk) +{ + pmix_session_t *s = NULL, *sptr; + size_t j, size; + pmix_info_t *iptr; + pmix_list_t cache, ncache; + pmix_status_t rc; + pmix_kval_t *kp2; + pmix_nodeinfo_t *nd; + uint32_t sid; + + /* array of session-level info */ + if (PMIX_DATA_ARRAY != val->type) { + PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); + return PMIX_ERR_TYPE_MISMATCH; + } + size = val->data.darray->size; + iptr = (pmix_info_t*)val->data.darray->array; + + PMIX_CONSTRUCT(&cache, pmix_list_t); + PMIX_CONSTRUCT(&ncache, pmix_list_t); + for (j=0; j < size; j++) { + if (PMIX_CHECK_KEY(&iptr[j], PMIX_SESSION_ID)) { + PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, sid, uint32_t); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + return rc; + } + /* see if we already have this session - it could have + * been defined by a separate PMIX_SESSION_ID key */ + PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { + if (sptr->session == sid) { + s = sptr; + break; + } + } + if (NULL == s) { + /* wasn't found, so create one */ + s = PMIX_NEW(pmix_session_t); + s->session = sid; + pmix_list_append(&mysessions, &s->super); + } + } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j].value, &ncache))) { + PMIX_ERROR_LOG(rc); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + return rc; + } + } else { + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(iptr[j].key); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + return rc; + } + pmix_list_append(&cache, &kp2->super); + } + } + if (NULL == s) { + /* this is not allowed to happen - they are required + * to provide us with a session ID per the standard */ + PMIX_LIST_DESTRUCT(&cache); + PMIX_LIST_DESTRUCT(&ncache); + rc = PMIX_ERR_BAD_PARAM; + PMIX_ERROR_LOG(rc); + return rc; + } + /* point the job at it */ + if (NULL != trk->session) { + PMIX_RELEASE(trk->session); + } + PMIX_RETAIN(s); + trk->session = s; + /* transfer the data across */ + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + while (NULL != kp2) { + pmix_list_append(&s->sessioninfo, &kp2->super); + kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); + } + PMIX_LIST_DESTRUCT(&cache); + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + while (NULL != nd) { + pmix_list_append(&s->nodeinfo, &nd->super); + nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); + } + PMIX_LIST_DESTRUCT(&ncache); + return PMIX_SUCCESS; +} static pmix_status_t hash_init(pmix_info_t info[], size_t ninfo) { @@ -647,20 +805,18 @@ static pmix_status_t hash_assign_module(pmix_info_t *info, size_t ninfo, return PMIX_SUCCESS; } -static pmix_status_t store_map(pmix_hash_table_t *ht, +static pmix_status_t store_map(pmix_job_t *trk, char **nodes, char **ppn, uint32_t flags) { pmix_status_t rc; - pmix_value_t *val; size_t m, n; - pmix_info_t *iptr, *info; pmix_rank_t rank; - bool updated; - pmix_kval_t *kp2; + pmix_kval_t *kp1, *kp2; char **procs; uint32_t totalprocs=0; - bool localldr; + pmix_hash_table_t *ht = &trk->internal; + pmix_nodeinfo_t *nd, *ndptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_map", @@ -689,133 +845,99 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, } for (n=0; NULL != nodes[n]; n++) { - /* check and see if we already have data for this node */ - val = NULL; - rc = pmix_hash_fetch(ht, PMIX_RANK_WILDCARD, nodes[n], &val); - if (PMIX_SUCCESS == rc && NULL != val) { - /* already have some data. See if we have the list of local peers */ - if (PMIX_DATA_ARRAY != val->type || - NULL == val->data.darray || - PMIX_INFO != val->data.darray->type || - 0 == val->data.darray->size) { - /* something is wrong */ - PMIX_VALUE_RELEASE(val); - PMIX_ERROR_LOG(PMIX_ERR_INVALID_VAL); - return PMIX_ERR_INVALID_VAL; - } - iptr = (pmix_info_t*)val->data.darray->array; - updated = false; - localldr = false; - for (m=0; m < val->data.darray->size; m++) { - if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCAL_PEERS)) { - /* we will update this entry */ - if (NULL != iptr[m].value.data.string) { - free(iptr[m].value.data.string); - } - iptr[m].value.data.string = strdup(ppn[n]); - updated = true; // no need to add the local_peers to the array - } else if (PMIX_CHECK_KEY(&iptr[m], PMIX_LOCALLDR)) { - rank = strtoul(ppn[n], NULL, 10); - iptr[m].value.data.rank = rank; - localldr = true; // no need to add localldr to the array - } - } - if (!updated || !localldr) { - /* append this entry to the current data */ - kp2 = PMIX_NEW(pmix_kval_t); - if (NULL == kp2) { - return PMIX_ERR_NOMEM; - } - kp2->key = strdup(nodes[n]); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kp2->value) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->type = PMIX_DATA_ARRAY; - kp2->value->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); - if (NULL == kp2->value->data.darray) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->data.darray->type = PMIX_INFO; - /* if we didn't update the local leader, then we will - * add it here */ - m = 0; - if (!localldr) { - kp2->value->data.darray->size = val->data.darray->size + 1; - ++m; - } - /* if they didn't update the local peers, then we add it here */ - if (!updated) { - kp2->value->data.darray->size = val->data.darray->size + 1; - ++m; + /* check and see if we already have this node */ + nd = NULL; + PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { + if (NULL != ndptr->hostname && 0 == strcmp(ndptr->hostname, nodes[n])) { + /* we assume that the data is updating the current + * values */ + if (NULL == ndptr->hostname) { + ndptr->hostname = strdup(nodes[n]); } - PMIX_INFO_CREATE(info, kp2->value->data.darray->size); - if (NULL == info) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - /* copy the pre-existing data across */ - for (m=0; m < val->data.darray->size; m++) { - PMIX_INFO_XFER(&info[m], &iptr[m]); - } - if (!updated) { - PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); - --m; - } - if (!localldr) { - rank = strtoul(ppn[n], NULL, 10); - PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-m], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); - --m; - } - kp2->value->data.darray->array = info; - if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - return rc; - } - PMIX_RELEASE(kp2); - } - } else { - /* store the list as-is */ - kp2 = PMIX_NEW(pmix_kval_t); - if (NULL == kp2) { - return PMIX_ERR_NOMEM; - } - kp2->key = strdup(nodes[n]); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - if (NULL == kp2->value) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->type = PMIX_DATA_ARRAY; - kp2->value->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); - if (NULL == kp2->value->data.darray) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->data.darray->type = PMIX_INFO; - PMIX_INFO_CREATE(info, 2); - if (NULL == info) { - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; + nd = ndptr; + break; } - PMIX_INFO_LOAD(&info[0], PMIX_LOCAL_PEERS, ppn[n], PMIX_STRING); - rank = strtoul(ppn[n], NULL, 10); - PMIX_INFO_LOAD(&info[1], PMIX_LOCALLDR, &rank, PMIX_PROC_RANK); - kp2->value->data.darray->array = info; - kp2->value->data.darray->size = 2; - if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - return rc; + } + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + nd->hostname = strdup(nodes[n]); + pmix_list_append(&trk->nodeinfo, &nd->super); + } + /* store the proc list as-is */ + kp2 = PMIX_NEW(pmix_kval_t); + if (NULL == kp2) { + return PMIX_ERR_NOMEM; + } + kp2->key = strdup(PMIX_LOCAL_PEERS); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kp2->value) { + PMIX_RELEASE(kp2); + return PMIX_ERR_NOMEM; + } + kp2->value->type = PMIX_STRING; + kp2->value->data.string = strdup(ppn[n]); + /* ensure this item only appears once on the list */ + PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp1, kp2->key)) { + pmix_list_remove_item(&nd->info, &kp1->super); + PMIX_RELEASE(kp1); + break; } + } + pmix_list_append(&nd->info, &kp2->super); + + /* save the local leader */ + rank = strtoul(ppn[n], NULL, 10); + kp2 = PMIX_NEW(pmix_kval_t); + if (NULL == kp2) { + return PMIX_ERR_NOMEM; + } + kp2->key = strdup(PMIX_LOCALLDR); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kp2->value) { PMIX_RELEASE(kp2); + return PMIX_ERR_NOMEM; + } + kp2->value->type = PMIX_PROC_RANK; + kp2->value->data.rank = rank; + /* ensure this item only appears once on the list */ + PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp1, kp2->key)) { + pmix_list_remove_item(&nd->info, &kp1->super); + PMIX_RELEASE(kp1); + break; + } } + pmix_list_append(&nd->info, &kp2->super); + /* split the list of procs so we can store their * individual location data */ procs = pmix_argv_split(ppn[n], ','); + /* save the local size in case they don't + * give it to us */ + kp2 = PMIX_NEW(pmix_kval_t); + if (NULL == kp2) { + return PMIX_ERR_NOMEM; + } + kp2->key = strdup(PMIX_LOCAL_SIZE); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kp2->value) { + PMIX_RELEASE(kp2); + return PMIX_ERR_NOMEM; + } + kp2->value->type = PMIX_UINT32; + kp2->value->data.uint32 = pmix_argv_count(procs); + /* ensure this item only appears once on the list */ + PMIX_LIST_FOREACH(kp1, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp1, kp2->key)) { + pmix_list_remove_item(&nd->info, &kp1->super); + PMIX_RELEASE(kp1); + break; + } + } + pmix_list_append(&nd->info, &kp2->super); + /* track total procs in job in case they + * didn't give it to us */ totalprocs += pmix_argv_count(procs); for (m=0; NULL != procs[m]; m++) { /* store the hostname for each proc */ @@ -825,6 +947,10 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, kp2->value->type = PMIX_STRING; kp2->value->data.string = strdup(nodes[n]); rank = strtol(procs[m], NULL, 10); + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:store_map for [%s:%u]: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, rank, kp2->key); if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -908,6 +1034,8 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return rc; } PMIX_RELEASE(kp2); // maintain acctg + flags |= PMIX_HASH_JOB_SIZE; + trk->nptr->nprocs = totalprocs; } /* if they didn't provide a value for max procs, just @@ -925,6 +1053,7 @@ static pmix_status_t store_map(pmix_hash_table_t *ht, return rc; } PMIX_RELEASE(kp2); // maintain acctg + flags |= PMIX_HASH_MAX_PROCS; } @@ -935,7 +1064,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_info_t info[], size_t ninfo) { pmix_namespace_t *nptr = (pmix_namespace_t*)ns; - pmix_job_t *trk, *t; + pmix_job_t *trk; pmix_session_t *s = NULL, *sptr; pmix_hash_table_t *ht; pmix_kval_t *kp2, *kvptr; @@ -947,32 +1076,17 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, pmix_status_t rc=PMIX_SUCCESS; size_t n, j, size, len; uint32_t flags = 0; - pmix_list_t cache, ncache; - pmix_nodeinfo_t *nd; + pmix_nodeinfo_t *nd, *ndptr; + pmix_apptrkr_t *apptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, - "[%s:%d] gds:hash:cache_job_info for nspace %s", + "[%s:%d] gds:hash:cache_job_info for nspace %s with %lu info", pmix_globals.myid.nspace, pmix_globals.myid.rank, - nptr->nspace); + nptr->nspace, ninfo); - /* find the hash table for this nspace */ - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(nptr->nspace, t->ns)) { - trk = t; - break; - } - } + trk = get_tracker(nptr->nspace, true); if (NULL == trk) { - /* create a tracker as we will likely need it */ - trk = PMIX_NEW(pmix_job_t); - if (NULL == trk) { - return PMIX_ERR_NOMEM; - } - PMIX_RETAIN(nptr); - trk->nptr = nptr; - trk->ns = strdup(nptr->nspace); - pmix_list_append(&myjobs, &trk->super); + return PMIX_ERR_NOMEM; } /* if there isn't any data, then be content with just @@ -1009,107 +1123,22 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, trk->session = s; } } else if (PMIX_CHECK_KEY(&info[n], PMIX_SESSION_INFO_ARRAY)) { - /* array of session-level info */ - if (PMIX_DATA_ARRAY != info[n].value.type) { - PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); - rc = PMIX_ERR_TYPE_MISMATCH; - goto release; - } - size = info[n].value.data.darray->size; - iptr = (pmix_info_t*)info[n].value.data.darray->array; - PMIX_CONSTRUCT(&cache, pmix_list_t); - PMIX_CONSTRUCT(&ncache, pmix_list_t); - for (j=0; j < size; j++) { - if (PMIX_CHECK_KEY(&iptr[j], PMIX_SESSION_ID)) { - PMIX_VALUE_GET_NUMBER(rc, &iptr[j].value, sid, uint32_t); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_LIST_DESTRUCT(&cache); - return rc; - } - /* setup a session object */ - if (NULL != s) { - /* does this match the one we were previously given? */ - if (sid != s->session) { - /* no - see if we already have this session */ - PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { - if (sptr->session == sid) { - s = sptr; - break; - } - } - if (sid != s->session) { - /* wasn't found, so create one */ - s = PMIX_NEW(pmix_session_t); - s->session = sid; - pmix_list_append(&mysessions, &s->super); - } - } - } else { - s = PMIX_NEW(pmix_session_t); - s->session = sid; - pmix_list_append(&mysessions, &s->super); - } - } else if (PMIX_CHECK_KEY(&iptr[j], PMIX_NODE_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_node_array(&iptr[j], &ncache))) { - PMIX_ERROR_LOG(rc); - PMIX_LIST_DESTRUCT(&cache); - PMIX_LIST_DESTRUCT(&ncache); - goto release; - } - } else { - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(iptr[j].key); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - PMIX_VALUE_XFER(rc, kp2->value, &iptr[j].value); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - PMIX_LIST_DESTRUCT(&cache); - PMIX_LIST_DESTRUCT(&ncache); - goto release; - } - pmix_list_append(&cache, &kp2->super); - } - } - if (NULL == s) { - /* this is not allowed to happen - they are required - * to provide us with a session ID per the standard */ - PMIX_LIST_DESTRUCT(&cache); - rc = PMIX_ERR_BAD_PARAM; + if (PMIX_SUCCESS != (rc = process_session_array(&info[n].value, trk))) { PMIX_ERROR_LOG(rc); goto release; } - /* point the job at it */ - if (NULL == trk->session) { - PMIX_RETAIN(s); - trk->session = s; - } - /* transfer the data across */ - kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); - while (NULL != kp2) { - pmix_list_append(&s->sessioninfo, &kp2->super); - kp2 = (pmix_kval_t*)pmix_list_remove_first(&cache); - } - PMIX_LIST_DESTRUCT(&cache); - nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); - while (NULL != nd) { - pmix_list_append(&s->nodeinfo, &nd->super); - nd = (pmix_nodeinfo_t*)pmix_list_remove_first(&ncache); - } - PMIX_LIST_DESTRUCT(&ncache); } else if (PMIX_CHECK_KEY(&info[n], PMIX_JOB_INFO_ARRAY)) { if (PMIX_SUCCESS != (rc = process_job_array(&info[n], trk, &flags, &procs, &nodes))) { PMIX_ERROR_LOG(rc); goto release; } } else if (PMIX_CHECK_KEY(&info[n], PMIX_APP_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_app_array(&info[n], trk))) { + if (PMIX_SUCCESS != (rc = process_app_array(&info[n].value, trk))) { PMIX_ERROR_LOG(rc); goto release; } } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_INFO_ARRAY)) { - if (PMIX_SUCCESS != (rc = process_node_array(&info[n], &trk->nodeinfo))) { + if (PMIX_SUCCESS != (rc = process_node_array(&info[n].value, &trk->nodeinfo))) { PMIX_ERROR_LOG(rc); goto release; } @@ -1153,7 +1182,7 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, } /* mark that we got the map */ flags |= PMIX_HASH_PROC_MAP; - } else if (0 == strcmp(info[n].key, PMIX_PROC_DATA)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_PROC_DATA)) { flags |= PMIX_HASH_PROC_DATA; /* an array of data pertaining to a specific proc */ if (PMIX_DATA_ARRAY != info[n].value.type) { @@ -1200,6 +1229,10 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, kp2->value->data.bo.size = len; } } + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "[%s:%d] gds:hash:cache_job_info proc data for [%s:%u]: key %s", + pmix_globals.myid.nspace, pmix_globals.myid.rank, + trk->ns, rank, kp2->key); /* store it in the hash_table */ if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, rank, kp2))) { PMIX_ERROR_LOG(rc); @@ -1208,6 +1241,60 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, } PMIX_RELEASE(kp2); // maintain acctg } + } else if (pmix_check_node_info(info[n].key)) { + /* they are passing us the node-level info for just this + * node - start by seeing if our node is on the list */ + nd = NULL; + PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { + if (0 == strcmp(pmix_globals.hostname, ndptr->hostname)) { + nd = ndptr; + break; + } + } + /* if not, then add it */ + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + nd->hostname = strdup(pmix_globals.hostname); + pmix_list_append(&trk->nodeinfo, &nd->super); + } + /* ensure the value isn't already on the node info */ + PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp2, info[n].key)) { + pmix_list_remove_item(&nd->info, &kp2->super); + PMIX_RELEASE(kp2); + break; + } + } + /* add the provided value */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(info[n].key); + PMIX_VALUE_XFER(rc, kp2->value, &info[n].value); + pmix_list_append(&nd->info, &kp2->super); + } else if (pmix_check_app_info(info[n].key)) { + /* they are passing us app-level info for a default + * app number - have to assume it is app=0 */ + if (0 == pmix_list_get_size(&trk->apps)) { + apptr = PMIX_NEW(pmix_apptrkr_t); + pmix_list_append(&trk->apps, &apptr->super); + } else if (1 < pmix_list_get_size(&trk->apps)) { + rc = PMIX_ERR_BAD_PARAM; + goto release; + } else { + apptr = (pmix_apptrkr_t*)pmix_list_get_first(&trk->apps); + } + /* ensure the value isn't already on the app info */ + PMIX_LIST_FOREACH(kp2, &apptr->appinfo, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp2, info[n].key)) { + pmix_list_remove_item(&apptr->appinfo, &kp2->super); + PMIX_RELEASE(kp2); + break; + } + } + /* add the provided value */ + kp2 = PMIX_NEW(pmix_kval_t); + kp2->key = strdup(info[n].key); + PMIX_VALUE_XFER(rc, kp2->value, &info[n].value); + pmix_list_append(&apptr->appinfo, &kp2->super); } else { /* just a value relating to the entire job */ kp2 = PMIX_NEW(pmix_kval_t); @@ -1285,14 +1372,10 @@ pmix_status_t hash_cache_job_info(struct pmix_namespace_t *ns, } /* we must have the proc AND node maps */ - if (NULL == procs || NULL == nodes) { - rc = PMIX_ERR_NOT_FOUND; - goto release; - } - - if (PMIX_SUCCESS != (rc = store_map(ht, nodes, procs, flags))) { - PMIX_ERROR_LOG(rc); - goto release; + if (NULL != procs && NULL != nodes) { + if (PMIX_SUCCESS != (rc = store_map(trk, nodes, procs, flags))) { + PMIX_ERROR_LOG(rc); + } } release: @@ -1309,7 +1392,7 @@ static pmix_status_t register_info(pmix_peer_t *peer, pmix_namespace_t *ns, pmix_buffer_t *reply) { - pmix_job_t *trk, *t; + pmix_job_t *trk; pmix_hash_table_t *ht; pmix_value_t *val, blob; pmix_status_t rc = PMIX_SUCCESS; @@ -1318,16 +1401,16 @@ static pmix_status_t register_info(pmix_peer_t *peer, pmix_kval_t kv, *kvptr; pmix_buffer_t buf; pmix_rank_t rank; + pmix_list_t results; + char *hname; - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(ns->nspace, t->ns)) { - trk = t; - break; - } - } + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "REGISTERING FOR PEER %s type %d.%d.%d", PMIX_PNAME_PRINT(&peer->info->pname), + peer->proc_type.major, peer->proc_type.minor, peer->proc_type.release); + + trk = get_tracker(ns->nspace, true); if (NULL == trk) { - return PMIX_ERR_INVALID_NAMESPACE; + return PMIX_ERR_NOMEM; } /* the job data is stored on the internal hash table */ ht = &trk->internal; @@ -1364,8 +1447,63 @@ static pmix_status_t register_info(pmix_peer_t *peer, PMIX_BFROPS_PACK(rc, peer, reply, kvptr, 1, PMIX_KVAL); } + /* get any node-level info for this job */ + PMIX_CONSTRUCT(&results, pmix_list_t); + rc = fetch_nodeinfo(NULL, &trk->nodeinfo, NULL, 0, &results); + if (PMIX_SUCCESS == rc) { + PMIX_LIST_FOREACH(kvptr, &results, pmix_kval_t) { + /* if the peer is earlier than v3.1.5, it is expecting + * node info to be in the form of an array, but with the + * hostname as the key. Detect and convert that here */ + if (PMIX_PEER_IS_EARLIER(peer, 3, 1, 5)) { + info = (pmix_info_t*)kvptr->value->data.darray->array; + ninfo = kvptr->value->data.darray->size; + hname = NULL; + /* find the hostname */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_HOSTNAME)) { + free(kvptr->key); + kvptr->key = strdup(info[n].value.data.string); + PMIX_BFROPS_PACK(rc, peer, reply, kvptr, 1, PMIX_KVAL); + hname = kvptr->key; + break; + } + } + if (NULL != hname && 0 == strcmp(pmix_globals.hostname, hname)) { + /* older versions are looking for node-level keys for + * only their own node as standalone keys */ + for (n=0; n < ninfo; n++) { + if (pmix_check_node_info(info[n].key)) { + kv.key = strdup(info[n].key); + kv.value = &info[n].value; + PMIX_BFROPS_PACK(rc, peer, reply, &kv, 1, PMIX_KVAL); + } + } + } + } else { + PMIX_BFROPS_PACK(rc, peer, reply, kvptr, 1, PMIX_KVAL); + } + } + } + PMIX_LIST_DESTRUCT(&results); + + /* get any app-level info for this job */ + PMIX_CONSTRUCT(&results, pmix_list_t); + rc = fetch_appinfo(NULL, &trk->apps, NULL, 0, &results); + if (PMIX_SUCCESS == rc) { + PMIX_LIST_FOREACH(kvptr, &results, pmix_kval_t) { + PMIX_BFROPS_PACK(rc, peer, reply, kvptr, 1, PMIX_KVAL); + } + } + PMIX_LIST_DESTRUCT(&results); + /* get the proc-level data for each proc in the job */ + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "FETCHING PROC INFO FOR NSPACE %s NPROCS %u", + ns->nspace, ns->nprocs); for (rank=0; rank < ns->nprocs; rank++) { + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "FETCHING PROC INFO FOR RANK %s", PMIX_RANK_PRINT(rank)); val = NULL; rc = pmix_hash_fetch(ht, rank, NULL, &val); if (PMIX_SUCCESS != rc && PMIX_ERR_PROC_ENTRY_NOT_FOUND != rc) { @@ -1412,10 +1550,10 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, pmix_namespace_t *ns = peer->nptr; char *msg; pmix_status_t rc; - pmix_job_t *trk, *t2; + pmix_job_t *trk; - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* this function is only available on servers */ PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; @@ -1437,7 +1575,7 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, } /* now see if we have delivered it to all our local * clients for this nspace */ - if (ns->ndelivered == ns->nlocalprocs) { + if (!PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer) && ns->ndelivered == ns->nlocalprocs) { /* we have, so let's get rid of the packed * copy of the data */ PMIX_RELEASE(ns->jobbkt); @@ -1448,22 +1586,9 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, /* setup a tracker for this nspace as we will likely * need it again */ - trk = NULL; - PMIX_LIST_FOREACH(t2, &myjobs, pmix_job_t) { - if (ns == t2->nptr) { - trk = t2; - if (NULL == trk->ns) { - trk->ns = strdup(ns->nspace); - } - break; - } - } + trk = get_tracker(ns->nspace, true); if (NULL == trk) { - trk = PMIX_NEW(pmix_job_t); - trk->ns = strdup(ns->nspace); - PMIX_RETAIN(ns); - trk->nptr = ns; - pmix_list_append(&myjobs, &trk->super); + return PMIX_ERR_NOMEM; } /* the job info for the specified nspace has @@ -1481,7 +1606,7 @@ static pmix_status_t hash_register_job_info(struct pmix_peer_t *pr, if (PMIX_SUCCESS == rc) { /* if we have more than one local client for this nspace, * save this packed object so we don't do this again */ - if (1 < ns->nlocalprocs) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer) || 1 < ns->nlocalprocs) { PMIX_RETAIN(reply); ns->jobbkt = reply; } @@ -1496,28 +1621,27 @@ static pmix_status_t hash_store_job_info(const char *nspace, pmix_buffer_t *buf) { pmix_status_t rc = PMIX_SUCCESS; - pmix_kval_t *kptr, *kp2, kv; - pmix_value_t *val; + pmix_kval_t *kptr, *kp2, *kp3, kv; int32_t cnt; - size_t nnodes, len, n; + size_t nnodes, len; uint32_t i, j; char **procs = NULL; uint8_t *tmp; pmix_byte_object_t *bo; pmix_buffer_t buf2; int rank; - pmix_job_t *htptr; + pmix_job_t *trk; pmix_hash_table_t *ht; char **nodelist = NULL; - pmix_info_t *info, *iptr; + pmix_nodeinfo_t *nd, *ndptr; pmix_namespace_t *ns, *nptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%u] pmix:gds:hash store job info for nspace %s", pmix_globals.myid.nspace, pmix_globals.myid.rank, nspace); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* this function is NOT available on servers */ PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; @@ -1530,7 +1654,13 @@ static pmix_status_t hash_store_job_info(const char *nspace, return rc; } - /* see if we already have this nspace */ + trk = get_tracker(nspace, true); + if (NULL == trk) { + return PMIX_ERR_NOMEM; + } + ht = &trk->internal; + + /* retrieve the nspace pointer */ nptr = NULL; PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { if (0 == strcmp(ns->nspace, nspace)) { @@ -1539,31 +1669,8 @@ static pmix_status_t hash_store_job_info(const char *nspace, } } if (NULL == nptr) { - nptr = PMIX_NEW(pmix_namespace_t); - if (NULL == nptr) { - rc = PMIX_ERR_NOMEM; - return rc; - } - nptr->nspace = strdup(nspace); - pmix_list_append(&pmix_globals.nspaces, &nptr->super); - } - - /* see if we already have a hash table for this nspace */ - ht = NULL; - PMIX_LIST_FOREACH(htptr, &myjobs, pmix_job_t) { - if (0 == strcmp(htptr->ns, nspace)) { - ht = &htptr->internal; - break; - } - } - if (NULL == ht) { - /* nope - create one */ - htptr = PMIX_NEW(pmix_job_t); - htptr->ns = strdup(nspace); - PMIX_RETAIN(nptr); - htptr->nptr = nptr; - pmix_list_append(&myjobs, &htptr->super); - ht = &htptr->internal; + /* only can happen if we are out of mem */ + return PMIX_ERR_NOMEM; } cnt = 1; @@ -1639,8 +1746,8 @@ static pmix_status_t hash_store_job_info(const char *nspace, PMIX_DESTRUCT(&buf2); return rc; } - /* unpack the list of procs on each node */ for (i=0; i < nnodes; i++) { + /* unpack the list of procs on each node */ cnt = 1; PMIX_CONSTRUCT(&kv, pmix_kval_t); PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, @@ -1653,79 +1760,46 @@ static pmix_status_t hash_store_job_info(const char *nspace, } /* track the nodes in this nspace */ pmix_argv_append_nosize(&nodelist, kv.key); - /* save the list of peers for this node - but first - * check to see if we already have some data for this node */ - rc = pmix_hash_fetch(ht, PMIX_RANK_WILDCARD, kv.key, &val); - if (PMIX_SUCCESS == rc) { - /* already have some data, so we need to add to it */ - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(kv.key); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - kp2->value->type = PMIX_DATA_ARRAY; - kp2->value->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); - if (NULL == kp2->value->data.darray) { - PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->data.darray->type = PMIX_INFO; - kp2->value->data.darray->size = val->data.darray->size + 1; - PMIX_INFO_CREATE(info, kp2->value->data.darray->size); - if (NULL == info) { - PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - iptr = (pmix_info_t*)val->data.darray->array; - /* copy the pre-existing data across */ - for (n=0; n < val->data.darray->size; n++) { - PMIX_INFO_XFER(&info[n], &iptr[n]); - } - PMIX_INFO_LOAD(&info[kp2->value->data.darray->size-1], PMIX_LOCAL_PEERS, kv.value->data.string, PMIX_STRING); - kp2->value->data.darray->array = info; - if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - PMIX_DESTRUCT(&kv); - PMIX_DESTRUCT(&buf2); - return rc; - } - PMIX_RELEASE(kp2); // maintain acctg - } else { - /* nope - so add this by itself */ - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(kv.key); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - kp2->value->type = PMIX_DATA_ARRAY; - kp2->value->data.darray = (pmix_data_array_t*)malloc(sizeof(pmix_data_array_t)); - if (NULL == kp2->value->data.darray) { - PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; - } - kp2->value->data.darray->type = PMIX_INFO; - PMIX_INFO_CREATE(info, 1); - if (NULL == info) { - PMIX_DESTRUCT(&buf2); - PMIX_DESTRUCT(&kv); - PMIX_RELEASE(kp2); - return PMIX_ERR_NOMEM; + /* check and see if we already have this node */ + nd = NULL; + PMIX_LIST_FOREACH(ndptr, &trk->nodeinfo, pmix_nodeinfo_t) { + if (NULL != ndptr->hostname && 0 == strcmp(ndptr->hostname, kv.key)) { + /* we assume that the data is updating the current + * values */ + if (NULL == ndptr->hostname) { + ndptr->hostname = strdup(kv.key); + } + nd = ndptr; + break; } - PMIX_INFO_LOAD(&info[0], PMIX_LOCAL_PEERS, kv.value->data.string, PMIX_STRING); - kp2->value->data.darray->array = info; - kp2->value->data.darray->size = 1; - if (PMIX_SUCCESS != (rc = pmix_hash_store(ht, PMIX_RANK_WILDCARD, kp2))) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); - PMIX_DESTRUCT(&kv); - PMIX_DESTRUCT(&buf2); - return rc; + } + if (NULL == nd) { + nd = PMIX_NEW(pmix_nodeinfo_t); + nd->hostname = strdup(kv.key); + pmix_list_append(&trk->nodeinfo, &nd->super); + } + /* save the list of peers for this node */ + kp2 = PMIX_NEW(pmix_kval_t); + if (NULL == kp2) { + return PMIX_ERR_NOMEM; + } + kp2->key = strdup(PMIX_LOCAL_PEERS); + kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kp2->value) { + PMIX_RELEASE(kp2); + return PMIX_ERR_NOMEM; + } + kp2->value->type = PMIX_STRING; + kp2->value->data.string = strdup(kv.value->data.string); + /* ensure this item only appears once on the list */ + PMIX_LIST_FOREACH(kp3, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp3, kp2->key)) { + pmix_list_remove_item(&nd->info, &kp3->super); + PMIX_RELEASE(kp3); + break; } - PMIX_RELEASE(kp2); // maintain acctg } + pmix_list_append(&nd->info, &kp2->super); /* split the list of procs so we can store their * individual location data */ procs = pmix_argv_split(kv.value->data.string, ','); @@ -1772,6 +1846,18 @@ static pmix_status_t hash_store_job_info(const char *nspace, } /* cleanup */ PMIX_DESTRUCT(&buf2); + } else if (PMIX_CHECK_KEY(kptr, PMIX_APP_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_app_array(kptr->value, trk))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } + } else if (PMIX_CHECK_KEY(kptr, PMIX_NODE_INFO_ARRAY)) { + if (PMIX_SUCCESS != (rc = process_node_array(kptr->value, &trk->nodeinfo))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp2); + return rc; + } } else { /* if the value contains a string that is longer than the * limit, then compress it */ @@ -1823,10 +1909,13 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, pmix_scope_t scope, pmix_kval_t *kv) { - pmix_job_t *trk, *t; + pmix_job_t *trk; pmix_status_t rc; pmix_kval_t *kp; - pmix_namespace_t *ns, *nptr; + pmix_rank_t rank; + size_t j, size, len; + pmix_info_t *iptr; + uint8_t *tmp; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "%s gds:hash:hash_store for proc %s key %s type %s scope %s", @@ -1839,43 +1928,15 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, } /* find the hash table for this nspace */ - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(proc->nspace, t->ns)) { - trk = t; - break; - } - } + trk = get_tracker(proc->nspace, true); if (NULL == trk) { - /* create one */ - trk = PMIX_NEW(pmix_job_t); - trk->ns = strdup(proc->nspace); - /* see if we already have this nspace */ - nptr = NULL; - PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { - if (0 == strcmp(ns->nspace, proc->nspace)) { - nptr = ns; - break; - } - } - if (NULL == nptr) { - nptr = PMIX_NEW(pmix_namespace_t); - if (NULL == nptr) { - rc = PMIX_ERR_NOMEM; - PMIX_RELEASE(trk); - return rc; - } - nptr->nspace = strdup(proc->nspace); - pmix_list_append(&pmix_globals.nspaces, &nptr->super); - } - PMIX_RETAIN(nptr); - trk->nptr = nptr; - pmix_list_append(&myjobs, &trk->super); + return PMIX_ERR_NOMEM; } - /* see if the proc is me */ + /* see if the proc is me - cannot use CHECK_PROCID as + * we don't want rank=wildcard to match */ if (proc->rank == pmix_globals.myid.rank && - 0 == strncmp(proc->nspace, pmix_globals.myid.nspace, PMIX_MAX_NSLEN)) { + PMIX_CHECK_NSPACE(proc->nspace, pmix_globals.myid.nspace)) { if (PMIX_INTERNAL != scope) { /* always maintain a copy of my own info here to simplify * later retrieval */ @@ -1910,6 +1971,67 @@ static pmix_status_t hash_store(const pmix_proc_t *proc, /* store it in the corresponding hash table */ if (PMIX_INTERNAL == scope) { + /* if this is proc data, then we have to expand it and + * store the values on that rank */ + if (PMIX_CHECK_KEY(kv, PMIX_PROC_DATA)) { + /* an array of data pertaining to a specific proc */ + if (PMIX_DATA_ARRAY != kv->value->type) { + PMIX_ERROR_LOG(PMIX_ERR_TYPE_MISMATCH); + return PMIX_ERR_TYPE_MISMATCH; + } + size = kv->value->data.darray->size; + iptr = (pmix_info_t*)kv->value->data.darray->array; + /* first element of the array must be the rank */ + if (0 != strcmp(iptr[0].key, PMIX_RANK) || + PMIX_PROC_RANK != iptr[0].value.type) { + rc = PMIX_ERR_TYPE_MISMATCH; + PMIX_ERROR_LOG(rc); + return rc; + } + rank = iptr[0].value.data.rank; + /* cycle thru the values for this rank and store them */ + for (j=1; j < size; j++) { + kp = PMIX_NEW(pmix_kval_t); + if (NULL == kp) { + rc = PMIX_ERR_NOMEM; + return rc; + } + kp->key = strdup(iptr[j].key); + PMIX_VALUE_XFER(rc, kp->value, &iptr[j].value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp); + return rc; + } + /* if the value contains a string that is longer than the + * limit, then compress it */ + if (PMIX_STRING_SIZE_CHECK(kp->value)) { + if (pmix_util_compress_string(kp->value->data.string, &tmp, &len)) { + if (NULL == tmp) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + rc = PMIX_ERR_NOMEM; + return rc; + } + kp->value->type = PMIX_COMPRESSED_STRING; + free(kp->value->data.string); + kp->value->data.bo.bytes = (char*)tmp; + kp->value->data.bo.size = len; + } + } + pmix_output_verbose(2, pmix_gds_base_framework.framework_output, + "%s gds:hash:STORE data for nspace %s rank %u: key %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + trk->ns, rank, kp->key); + /* store it in the hash_table */ + if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->internal, rank, kp))) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kp); + return rc; + } + PMIX_RELEASE(kp); // maintain acctg + } + return PMIX_SUCCESS; + } if (PMIX_SUCCESS != (rc = pmix_hash_store(&trk->internal, proc->rank, kv))) { PMIX_ERROR_LOG(rc); return rc; @@ -1976,13 +2098,12 @@ static pmix_status_t _hash_store_modex(void * cbdata, pmix_byte_object_t *bo) { pmix_namespace_t *ns = (pmix_namespace_t*)nspace; - pmix_job_t *trk, *t; + pmix_job_t *trk; pmix_status_t rc = PMIX_SUCCESS; int32_t cnt; pmix_buffer_t pbkt; pmix_proc_t proc; pmix_kval_t *kv; - pmix_namespace_t *ns2, *nptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "[%s:%d] gds:hash:store_modex for nspace %s", @@ -1990,38 +2111,9 @@ static pmix_status_t _hash_store_modex(void * cbdata, ns->nspace); /* find the hash table for this nspace */ - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(ns->nspace, t->ns)) { - trk = t; - break; - } - } + trk = get_tracker(ns->nspace, true); if (NULL == trk) { - /* create one */ - trk = PMIX_NEW(pmix_job_t); - trk->ns = strdup(ns->nspace); - /* see if we already have this nspace */ - nptr = NULL; - PMIX_LIST_FOREACH(ns2, &pmix_globals.nspaces, pmix_namespace_t) { - if (0 == strcmp(ns->nspace, ns2->nspace)) { - nptr = ns2; - break; - } - } - if (NULL == nptr) { - nptr = PMIX_NEW(pmix_namespace_t); - if (NULL == nptr) { - rc = PMIX_ERR_NOMEM; - PMIX_RELEASE(trk); - return rc; - } - nptr->nspace = strdup(ns->nspace); - pmix_list_append(&pmix_globals.nspaces, &nptr->super); - } - PMIX_RETAIN(nptr); - trk->nptr = nptr; - pmix_list_append(&myjobs, &trk->super); + return PMIX_ERR_NOMEM; } /* this is data returned via the PMIx_Fence call when @@ -2089,7 +2181,7 @@ static pmix_status_t _hash_store_modex(void * cbdata, static pmix_status_t dohash(pmix_hash_table_t *ht, const char *key, pmix_rank_t rank, - bool skip_genvals, + int skip_genvals, pmix_list_t *kvs) { pmix_status_t rc; @@ -2111,12 +2203,24 @@ static pmix_status_t dohash(pmix_hash_table_t *ht, PMIX_RELEASE(val); return PMIX_ERR_NOT_FOUND; } + /* if they want the value returned in its array form, + * then we are done */ + if (2 == skip_genvals) { + kv = PMIX_NEW(pmix_kval_t); + if (NULL == kv) { + PMIX_VALUE_RELEASE(val); + return PMIX_ERR_NOMEM; + } + kv->value = val; + pmix_list_append(kvs, &kv->super); + return PMIX_SUCCESS; + } info = (pmix_info_t*)val->data.darray->array; ninfo = val->data.darray->size; for (n=0; n < ninfo; n++) { /* if the rank is UNDEF, then we don't want * anything that starts with "pmix" */ - if (skip_genvals && + if (1 == skip_genvals && 0 == strncmp(info[n].key, "pmix", 4)) { continue; } @@ -2172,13 +2276,15 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, pmix_info_t *info, size_t ninfo, pmix_list_t *kvs) { - size_t n; + size_t n, nds; pmix_status_t rc; uint32_t nid=0; char *hostname = NULL; bool found = false; pmix_nodeinfo_t *nd, *ndptr; pmix_kval_t *kv, *kp2; + pmix_data_array_t *darray; + pmix_info_t *iptr; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "FETCHING NODE INFO"); @@ -2200,17 +2306,75 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, } } if (!found) { + /* if the key is NULL, then they want all the info from + * all nodes */ + if (NULL == key) { + PMIX_LIST_FOREACH(nd, tgt, pmix_nodeinfo_t) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(PMIX_NODE_INFO_ARRAY); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + nds = pmix_list_get_size(&nd->info); + if (NULL != nd->hostname) { + ++nds; + } + if (UINT32_MAX != nd->nodeid) { + ++nds; + } + PMIX_DATA_ARRAY_CREATE(darray, nds, PMIX_INFO); + if (NULL == darray) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + iptr = (pmix_info_t*)darray->array; + n = 0; + if (NULL != nd->hostname) { + PMIX_INFO_LOAD(&iptr[n], PMIX_HOSTNAME, nd->hostname, PMIX_STRING); + ++n; + } + if (UINT32_MAX != nd->nodeid) { + PMIX_INFO_LOAD(&iptr[n], PMIX_NODEID, &nd->nodeid, PMIX_UINT32); + ++n; + } + PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + PMIX_LOAD_KEY(iptr[n].key, kp2->key); + rc = pmix_value_xfer(&iptr[n].value, kp2->value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DATA_ARRAY_FREE(darray); + PMIX_RELEASE(kv); + return rc; + } + ++n; + } + kv->value->data.darray = darray; + kv->value->type = PMIX_DATA_ARRAY; + pmix_list_append(kvs, &kv->super); + } + return PMIX_SUCCESS; + + } else { + /* assume they want it from this node */ + hostname = pmix_globals.hostname; + goto scan; + } return PMIX_ERR_DATA_VALUE_NOT_FOUND; } + scan: /* scan the list of nodes to find the matching entry */ nd = NULL; PMIX_LIST_FOREACH(ndptr, tgt, pmix_nodeinfo_t) { - if (NULL != hostname && 0 == strcmp(ndptr->hostname, hostname)) { - nd = ndptr; - break; - } - if (NULL == hostname && nid == ndptr->nodeid) { + if (NULL != hostname) { + nds = strlen(hostname) < strlen(ndptr->hostname) ? strlen(hostname) : strlen(ndptr->hostname); + if (0 == strncmp(ndptr->hostname, hostname, nds)) { + nd = ndptr; + break; + } + } else if (nid == ndptr->nodeid) { nd = ndptr; break; } @@ -2218,27 +2382,77 @@ static pmix_status_t fetch_nodeinfo(const char *key, pmix_list_t *tgt, if (NULL == nd) { return PMIX_ERR_NOT_FOUND; } - /* scan the info list of this node to generate the results */ - rc = PMIX_ERR_NOT_FOUND; - PMIX_LIST_FOREACH(kv, &nd->info, pmix_kval_t) { - if (NULL == key || PMIX_CHECK_KEY(kv, key)) { - kp2 = PMIX_NEW(pmix_kval_t); - kp2->key = strdup(kv->key); - kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - PMIX_VALUE_XFER(rc, kp2->value, kv->value); + + /* if they want it all, give it to them */ + if (NULL == key) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(PMIX_NODE_INFO_ARRAY); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + nds = pmix_list_get_size(&nd->info); + if (NULL != nd->hostname) { + ++nds; + } + if (UINT32_MAX != nd->nodeid) { + ++nds; + } + PMIX_DATA_ARRAY_CREATE(darray, nds, PMIX_INFO); + if (NULL == darray) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + iptr = (pmix_info_t*)darray->array; + n = 0; + if (NULL != nd->hostname) { + PMIX_INFO_LOAD(&iptr[n], PMIX_HOSTNAME, nd->hostname, PMIX_STRING); + ++n; + } + if (UINT32_MAX != nd->nodeid) { + PMIX_INFO_LOAD(&iptr[n], PMIX_NODEID, &nd->nodeid, PMIX_UINT32); + ++n; + } + PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + PMIX_LOAD_KEY(iptr[n].key, kp2->key); + rc = pmix_value_xfer(&iptr[n].value, kp2->value); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kp2); + PMIX_DATA_ARRAY_FREE(darray); + PMIX_RELEASE(kv); return rc; } - pmix_list_append(kvs, &kp2->super); - rc = PMIX_SUCCESS; - if (NULL != key) { - break; - } + ++n; } + kv->value->data.darray = darray; + kv->value->type = PMIX_DATA_ARRAY; + pmix_list_append(kvs, &kv->super); + return PMIX_SUCCESS; } + /* scan the info list of this node to find the key they want */ + rc = PMIX_ERR_NOT_FOUND; + PMIX_LIST_FOREACH(kp2, &nd->info, pmix_kval_t) { + if (PMIX_CHECK_KEY(kp2, key)) { + /* since they only asked for one key, return just that value */ + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(kp2->key); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + rc = pmix_value_xfer(kv->value, kp2->value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(kv); + return rc; + } + pmix_list_append(kvs, &kv->super); + break; + } + } return rc; } @@ -2246,12 +2460,13 @@ static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, pmix_info_t *info, size_t ninfo, pmix_list_t *kvs) { - size_t n; + size_t n, nds; pmix_status_t rc; uint32_t appnum; bool found = false; pmix_apptrkr_t *app, *apptr; pmix_kval_t *kv, *kp2; + pmix_data_array_t *darray; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "FETCHING APP INFO"); @@ -2269,6 +2484,46 @@ static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, } } if (!found) { + /* if the key is NULL, then they want all the info from + * all apps */ + if (NULL == key) { + PMIX_LIST_FOREACH(apptr, tgt, pmix_apptrkr_t) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(PMIX_APP_INFO_ARRAY); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + if (NULL == kv->value) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + nds = pmix_list_get_size(&apptr->appinfo) + 1; + PMIX_DATA_ARRAY_CREATE(darray, nds, PMIX_INFO); + if (NULL == darray) { + PMIX_RELEASE(kv); + return PMIX_ERR_NOMEM; + } + info = (pmix_info_t*)darray->array; + n = 0; + /* put in the appnum */ + PMIX_INFO_LOAD(&info[n], PMIX_APPNUM, &apptr->appnum, PMIX_UINT32); + ++n; + PMIX_LIST_FOREACH(kp2, &apptr->appinfo, pmix_kval_t) { + PMIX_LOAD_KEY(info[n].key, kp2->key); + rc = pmix_value_xfer(&info[n].value, kp2->value); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DATA_ARRAY_FREE(darray); + PMIX_RELEASE(kv); + return rc; + } + ++n; + } + kv->value->data.darray = darray; + kv->value->type = PMIX_DATA_ARRAY; + pmix_list_append(kvs, &kv->super); + } + return PMIX_SUCCESS; + + } return PMIX_ERR_DATA_VALUE_NOT_FOUND; } @@ -2298,7 +2553,7 @@ static pmix_status_t fetch_appinfo(const char *key, pmix_list_t *tgt, kp2 = PMIX_NEW(pmix_kval_t); kp2->key = strdup(kv->key); kp2->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - PMIX_VALUE_XFER(rc, kp2->value, kv->value); + rc = pmix_value_xfer(kp2->value, kv->value); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kp2); @@ -2321,16 +2576,18 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, pmix_info_t qualifiers[], size_t nqual, pmix_list_t *kvs) { - pmix_job_t *trk, *t; + pmix_job_t *trk; pmix_status_t rc; - pmix_value_t *val; pmix_kval_t *kv, *kvptr; - pmix_info_t *info; - size_t n, ninfo; + pmix_info_t *info, *iptr; + size_t m, n, ninfo, niptr; pmix_hash_table_t *ht; pmix_session_t *sptr; uint32_t sid; pmix_rank_t rnk; + pmix_list_t rkvs; + bool nodeinfo = false; + bool appinfo = false; pmix_output_verbose(2, pmix_gds_base_framework.framework_output, "%s pmix:gds:hash fetch %s for proc %s on scope %s", @@ -2344,139 +2601,148 @@ static pmix_status_t hash_fetch(const pmix_proc_t *proc, if (NULL == key && PMIX_RANK_WILDCARD == proc->rank) { /* see if we have a tracker for this nspace - we will * if we already cached the job info for it */ - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(proc->nspace, t->ns)) { - trk = t; - break; - } - } + trk = get_tracker(proc->nspace, false); if (NULL == trk) { /* let the caller know */ return PMIX_ERR_INVALID_NAMESPACE; } - /* the job data is stored on the internal hash table */ - ht = &trk->internal; /* fetch all values from the hash table tied to rank=wildcard */ - val = NULL; - rc = pmix_hash_fetch(ht, PMIX_RANK_WILDCARD, NULL, &val); - if (PMIX_SUCCESS != rc) { - if (NULL != val) { - PMIX_VALUE_RELEASE(val); + dohash(&trk->internal, NULL, PMIX_RANK_WILDCARD, 0, kvs); + /* also need to add any job-level info */ + PMIX_LIST_FOREACH(kvptr, &trk->jobinfo, pmix_kval_t) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(kvptr->key); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kv->value, kvptr->value); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(kv); + return rc; } - return rc; + pmix_list_append(kvs, &kv->super); } - if (NULL == val) { - return PMIX_ERR_NOT_FOUND; + /* collect the relevant node-level info */ + rc = fetch_nodeinfo(NULL, &trk->nodeinfo, qualifiers, nqual, kvs); + if (PMIX_SUCCESS != rc) { + return rc; } - /* the data is returned in a pmix_data_array_t of pmix_info_t - * structs. cycle thru and transfer them to the list */ - if (PMIX_DATA_ARRAY != val->type || - NULL == val->data.darray || - PMIX_INFO != val->data.darray->type) { - PMIX_VALUE_RELEASE(val); - return PMIX_ERR_INVALID_VAL; + /* collect the relevant app-level info */ + rc = fetch_appinfo(NULL, &trk->apps, qualifiers, nqual, kvs); + if (PMIX_SUCCESS != rc) { + return rc; } - info = (pmix_info_t*)val->data.darray->array; - ninfo = val->data.darray->size; - for (n=0; n < ninfo; n++) { - kv = PMIX_NEW(pmix_kval_t); - if (NULL == kv) { - rc = PMIX_ERR_NOMEM; - PMIX_VALUE_RELEASE(val); + /* finally, we need the job-level info for each rank in the job */ + for (rnk=0; rnk < trk->nptr->nprocs; rnk++) { + PMIX_CONSTRUCT(&rkvs, pmix_list_t); + rc = dohash(&trk->internal, NULL, rnk, 2, &rkvs); + if (PMIX_ERR_NOMEM == rc) { return rc; } - kv->key = strdup(info[n].key); - PMIX_VALUE_XFER(rc, kv->value, &info[n].value); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(kv); - PMIX_VALUE_RELEASE(val); - return rc; + if (0 == pmix_list_get_size(&rkvs)) { + PMIX_DESTRUCT(&rkvs); + continue; + } + /* should only have one entry on list */ + kvptr = (pmix_kval_t*)pmix_list_get_first(&rkvs); + /* we have to assemble the results into a proc blob + * so the remote end will know what to do with it */ + info = (pmix_info_t*)kvptr->value->data.darray->array; + ninfo = kvptr->value->data.darray->size; + /* setup to return the result */ + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(PMIX_PROC_DATA); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + kv->value->type = PMIX_DATA_ARRAY; + niptr = ninfo + 1; // need space for the rank + PMIX_DATA_ARRAY_CREATE(kv->value->data.darray, niptr, PMIX_INFO); + iptr = (pmix_info_t*)kv->value->data.darray->array; + /* start with the rank */ + PMIX_INFO_LOAD(&iptr[0], PMIX_RANK, &rnk, PMIX_PROC_RANK); + /* now transfer rest of data across */ + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n+1], &info[n]); } + /* add to the results */ pmix_list_append(kvs, &kv->super); + /* release the search result */ + PMIX_LIST_DESTRUCT(&rkvs); } - PMIX_VALUE_RELEASE(val); return PMIX_SUCCESS; } - /* if the nspace and rank are undefined, then they are asking - * for session-level information. */ - if (0 == strlen(proc->nspace) && PMIX_RANK_UNDEF == proc->rank) { - /* they must have included something identifying the info - * class they are querying */ - for (n=0; n < nqual; n++) { - if (PMIX_CHECK_KEY(&qualifiers[n], PMIX_SESSION_ID)) { - /* they want session-level info - see if we have - * that session */ - PMIX_VALUE_GET_NUMBER(rc, &qualifiers[n].value, sid, uint32_t); - if (PMIX_SUCCESS != rc) { - /* didn't provide a correct value */ - PMIX_ERROR_LOG(rc); - return rc; - } - PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { - if (sptr->session == sid) { - /* see if they want info for a specific node */ - rc = fetch_nodeinfo(key, &sptr->nodeinfo, qualifiers, nqual, kvs); - /* if they did, then we are done */ - if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { - return rc; - } - /* check the session info */ - PMIX_LIST_FOREACH(kvptr, &sptr->sessioninfo, pmix_kval_t) { - if (NULL == key || PMIX_CHECK_KEY(kvptr, key)) { - kv = PMIX_NEW(pmix_kval_t); - kv->key = strdup(kvptr->key); - kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); - PMIX_VALUE_XFER(rc, kv->value, kvptr->value); - if (PMIX_SUCCESS != rc) { - PMIX_RELEASE(kv); - return rc; - } - pmix_list_append(kvs, &kv->super); - if (NULL != key) { - /* we are done */ - return PMIX_SUCCESS; + /* see if they are asking for session, node, or app-level info */ + for (n=0; n < nqual; n++) { + if (PMIX_CHECK_KEY(&qualifiers[n], PMIX_SESSION_INFO)) { + /* they must have provided a session ID */ + for (m=0; m < nqual; m++) { + if (PMIX_CHECK_KEY(&qualifiers[m], PMIX_SESSION_ID)) { + /* see if we have this session */ + PMIX_VALUE_GET_NUMBER(rc, &qualifiers[m].value, sid, uint32_t); + if (PMIX_SUCCESS != rc) { + /* didn't provide a correct value */ + PMIX_ERROR_LOG(rc); + return rc; + } + PMIX_LIST_FOREACH(sptr, &mysessions, pmix_session_t) { + if (sptr->session == sid) { + /* see if they want info for a specific node */ + rc = fetch_nodeinfo(key, &sptr->nodeinfo, qualifiers, nqual, kvs); + /* if they did, then we are done */ + if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { + return rc; + } + /* check the session info */ + PMIX_LIST_FOREACH(kvptr, &sptr->sessioninfo, pmix_kval_t) { + if (NULL == key || PMIX_CHECK_KEY(kvptr, key)) { + kv = PMIX_NEW(pmix_kval_t); + kv->key = strdup(kvptr->key); + kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_XFER(rc, kv->value, kvptr->value); + if (PMIX_SUCCESS != rc) { + PMIX_RELEASE(kv); + return rc; + } + pmix_list_append(kvs, &kv->super); + if (NULL != key) { + /* we are done */ + return PMIX_SUCCESS; + } } } } } } - /* if we get here, then the session wasn't found */ - return PMIX_ERR_NOT_FOUND; } + /* if we get here, then the session wasn't found */ + return PMIX_ERR_NOT_FOUND; + } else if (PMIX_CHECK_KEY(&qualifiers[n], PMIX_NODE_INFO)) { + nodeinfo = PMIX_INFO_TRUE(&qualifiers[n]); + } else if (PMIX_CHECK_KEY(&qualifiers[n], PMIX_APP_INFO)) { + appinfo = PMIX_INFO_TRUE(&qualifiers[n]); } } /* find the hash table for this nspace */ - trk = NULL; - PMIX_LIST_FOREACH(t, &myjobs, pmix_job_t) { - if (0 == strcmp(proc->nspace, t->ns)) { - trk = t; - break; - } - } + trk = get_tracker(proc->nspace, false); if (NULL == trk) { return PMIX_ERR_INVALID_NAMESPACE; } - /* if the rank isn't specified, check to see if they - * are looking for app-level or node-level info for - * this job */ - if (PMIX_RANK_UNDEF == proc->rank) { - /* see if they want info for a specific node */ + if (nodeinfo) { rc = fetch_nodeinfo(key, &trk->nodeinfo, qualifiers, nqual, kvs); - /* if they did, then we are done */ - if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { - return rc; + if (PMIX_SUCCESS != rc && PMIX_RANK_WILDCARD == proc->rank) { + /* need to check internal as we might have an older peer */ + ht = &trk->internal; + goto doover; } - /* see if they want info for a specific app */ + return rc; + } else if (appinfo) { rc = fetch_appinfo(key, &trk->apps, qualifiers, nqual, kvs); - /* if they did, then we are done */ - if (PMIX_ERR_DATA_VALUE_NOT_FOUND != rc) { - return rc; + if (PMIX_SUCCESS != rc && PMIX_RANK_WILDCARD == proc->rank) { + /* need to check internal as we might have an older peer */ + ht = &trk->internal; + goto doover; } + return rc; } /* fetch from the corresponding hash table - note that @@ -2608,7 +2874,7 @@ static pmix_status_t assemb_kvs_req(const pmix_proc_t *proc, pmix_server_caddy_t *cd = (pmix_server_caddy_t*)cbdata; pmix_kval_t *kv; - if (!PMIX_PROC_IS_V1(cd->peer)) { + if (!PMIX_PEER_IS_V1(cd->peer)) { PMIX_BFROPS_PACK(rc, cd->peer, buf, proc, 1, PMIX_PROC); if (PMIX_SUCCESS != rc) { return rc; @@ -2623,6 +2889,51 @@ static pmix_status_t assemb_kvs_req(const pmix_proc_t *proc, return rc; } +static pmix_status_t store_session_info(pmix_nspace_t nspace, + pmix_kval_t *kv) +{ + pmix_job_t *trk; + pmix_status_t rc; + + /* find the hash table for this nspace */ + trk = get_tracker(nspace, true); + if (NULL == trk) { + return PMIX_ERR_NOMEM; + } + rc = process_session_array(kv->value, trk); + return rc; +} + +static pmix_status_t store_node_info(pmix_nspace_t nspace, + pmix_kval_t *kv) +{ + pmix_job_t *trk; + pmix_status_t rc; + + /* find the hash table for this nspace */ + trk = get_tracker(nspace, true); + if (NULL == trk) { + return PMIX_ERR_NOMEM; + } + rc = process_node_array(kv->value, &trk->nodeinfo); + return rc; +} + +static pmix_status_t store_app_info(pmix_nspace_t nspace, + pmix_kval_t *kv) +{ + pmix_job_t *trk; + pmix_status_t rc; + + /* find the hash table for this nspace */ + trk = get_tracker(nspace, true); + if (NULL == trk) { + return PMIX_ERR_NOMEM; + } + rc = process_app_array(kv->value, trk); + return rc; +} + static pmix_status_t accept_kvs_resp(pmix_buffer_t *buf) { pmix_status_t rc = PMIX_SUCCESS; @@ -2666,11 +2977,17 @@ static pmix_status_t accept_kvs_resp(pmix_buffer_t *buf) PMIX_BFROPS_UNPACK(rc, pmix_client_globals.myserver, &pbkt, kv, &cnt, PMIX_KVAL); while (PMIX_SUCCESS == rc) { - /* let the GDS component for this peer store it - if - * the kval contains shmem connection info, then the - * component will know what to do about it (or else - * we selected the wrong component for this peer!) */ - PMIX_GDS_STORE_KV(rc, pmix_globals.mypeer, &proct, PMIX_INTERNAL, kv); + /* if this is an info array, then store it here as dstore + * doesn't know how to handle it */ + if (PMIX_CHECK_KEY(kv, PMIX_SESSION_INFO_ARRAY)) { + rc = store_session_info(proct.nspace, kv); + } else if (PMIX_CHECK_KEY(kv, PMIX_NODE_INFO_ARRAY)) { + rc = store_node_info(proct.nspace, kv); + } else if (PMIX_CHECK_KEY(kv, PMIX_APP_INFO_ARRAY)) { + rc = store_app_info(proct.nspace, kv); + } else { + rc = hash_store(&proct, PMIX_INTERNAL, kv); + } if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(kv); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 index 1e749df5b2d..c84738f189b 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pdl/configure.m4 @@ -1,7 +1,7 @@ dnl -*- shell-script -*- dnl dnl Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2016-2019 Intel, Inc. All rights reserved. +dnl Copyright (c) 2016-2017 Intel, Inc. All rights reserved. dnl Copyright (c) 2016-2019 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c index 221ec775f87..5d3419a616d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/base/plog_base_stubs.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2018 Intel, Inc. All rights reserved. * * $COPYRIGHT$ * diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c index 2aceac179ad..f7dfc65c7fa 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/stdfd/plog_stdfd.c @@ -83,7 +83,7 @@ static pmix_status_t mylog(const pmix_proc_t *source, } /* if we are not a gateway, then we don't handle this */ - if (!PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { return PMIX_ERR_TAKE_NEXT_OPTION; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c index 64edceed18c..3da5dea649c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/plog/syslog/plog_syslog.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -129,7 +129,7 @@ static pmix_status_t mylog(const pmix_proc_t *source, } } else if (0 == strncmp(data[n].key, PMIX_LOG_GLOBAL_SYSLOG, PMIX_MAX_KEYLEN)) { /* only do this if we are a gateway server */ - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { rc = write_local(source, timestamp, pri, data[n].value.data.string, data, ndata); if (PMIX_SUCCESS == rc) { /* flag that we did this one */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c index 447a8e1ca14..adc11e9e4a2 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/base/pnet_base_fns.c @@ -56,7 +56,7 @@ pmix_status_t pmix_pnet_base_allocate(char *nspace, if (NULL == nspace || NULL == ilist) { return PMIX_ERR_BAD_PARAM; } - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { nptr = NULL; /* find this nspace - note that it may not have * been registered yet */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c index 712b1644219..c7ae9276257 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/opa/pnet_opa.c @@ -524,7 +524,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, query: #if 0 #if PMIX_WANT_OPAMGT - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { /* collect the switch information from the FM */ OMGT_STATUS_T status = OMGT_STATUS_SUCCESS; struct omgt_port * port = NULL; @@ -562,7 +562,7 @@ static pmix_status_t collect_inventory(pmix_info_t directives[], size_t ndirs, #else // have_hwloc #if 0 #if PMIX_WANT_OPAMGT - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { /* query the FM for the inventory */ } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c index 81e823ad245..617a1c0455a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/tcp/pnet_tcp.c @@ -200,7 +200,7 @@ static pmix_status_t tcp_init(void) /* if we are not the "gateway", then there is nothing * for us to do */ - if (!PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { return PMIX_SUCCESS; } @@ -258,7 +258,7 @@ static void tcp_finalize(void) { pmix_output_verbose(2, pmix_pnet_base_framework.framework_output, "pnet: tcp finalize"); - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { PMIX_LIST_DESTRUCT(&allocations); PMIX_LIST_DESTRUCT(&available); } @@ -320,7 +320,7 @@ static pmix_status_t allocate(pmix_namespace_t *nptr, /* if I am not the gateway, then ignore this call - should never * happen, but check to be safe */ - if (!PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { return PMIX_SUCCESS; } @@ -847,7 +847,7 @@ static void deregister_nspace(pmix_namespace_t *nptr) /* if we are not the "gateway", then there is nothing * for us to do */ - if (!PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { return; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c index 830e0c02e59..119110f8762 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/pnet/test/pnet_test.c @@ -117,7 +117,7 @@ static pmix_status_t allocate(pmix_namespace_t *nptr, /* if I am not the gateway, then ignore this call - should never * happen, but check to be safe */ - if (!PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c index 0c9d6188a0d..8704191ecd6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/preg/native/preg_native.c @@ -88,6 +88,7 @@ static pmix_status_t generate_node_regex(const char *input, pmix_list_t vids; char **regexargs = NULL, *tmp, *tmp2; char *cptr; + pmix_status_t rc; /* define the default */ *regexp = NULL; @@ -302,17 +303,22 @@ static pmix_status_t generate_node_regex(const char *input, } /* assemble final result */ - tmp = pmix_argv_join(regexargs, ','); - if (0 > asprintf(regexp, "pmix[%s]", tmp)) { - return PMIX_ERR_NOMEM; - } - free(tmp); + if (NULL != regexargs) { + tmp = pmix_argv_join(regexargs, ','); + if (0 > asprintf(regexp, "pmix[%s]", tmp)) { + return PMIX_ERR_NOMEM; + } + free(tmp); - /* cleanup */ - pmix_argv_free(regexargs); + /* cleanup */ + pmix_argv_free(regexargs); + rc = PMIX_SUCCESS; + } else { + rc = PMIX_ERR_TAKE_NEXT_OPTION; + } PMIX_DESTRUCT(&vids); - return PMIX_SUCCESS; + return rc; } static pmix_status_t generate_ppn(const char *input, diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c index ae1f9b62e59..0e707049f6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.c @@ -2,7 +2,6 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h index 74cc3632213..5a8ea519108 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake.h @@ -2,7 +2,6 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c index 53fb13b6fed..fd826b817cb 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/dummy_handshake/psec_dummy_handshake_component.c @@ -2,7 +2,6 @@ /* * Copyright (c) 2019 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h index 10c31e9bfa3..e088cd5ff4a 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/psec/psec.h @@ -1,7 +1,7 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* * Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h index 718a377fc5c..197658f7f37 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/base.h @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -118,7 +118,7 @@ PMIX_EXPORT void pmix_ptl_base_connection_handler(int sd, short args, void *cbda PMIX_EXPORT pmix_status_t pmix_ptl_base_send_connect_ack(int sd); PMIX_EXPORT pmix_status_t pmix_ptl_base_recv_connect_ack(int sd); PMIX_EXPORT void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err); - +PMIX_EXPORT bool pmix_ptl_base_peer_is_earlier(pmix_peer_t *peer, uint8_t major, uint8_t minor, uint8_t release); END_C_DECLS diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c index 2e6a101752e..0723e49b1ff 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_frame.c @@ -11,7 +11,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2012-2013 Los Alamos National Security, Inc. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -43,6 +43,7 @@ #include "src/mca/base/pmix_mca_base_framework.h" #include "src/class/pmix_list.h" #include "src/client/pmix_client_ops.h" +#include "src/mca/ptl/ptl_types.h" #include "src/mca/ptl/base/base.h" /* @@ -208,7 +209,11 @@ static void pccon(pmix_pending_connection_t *p) p->gds = NULL; p->ptl = NULL; p->cred = NULL; - p->proc_type = PMIX_PROC_UNDEF; + p->proc_type.type = PMIX_PROC_UNDEF; + p->proc_type.major = PMIX_MAJOR_WILDCARD; + p->proc_type.minor = PMIX_MINOR_WILDCARD; + p->proc_type.release = PMIX_RELEASE_WILDCARD; + p->proc_type.padding = 0; } static void pcdes(pmix_pending_connection_t *p) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c index 043a68e1388..93e16ba53e8 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_sendrecv.c @@ -87,8 +87,8 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) } CLOSE_THE_SOCKET(peer->sd); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_TOOL(pmix_globals.mypeer)) { /* if I am a server, then we need to ensure that * we properly account for the loss of this client * from any local collectives in which it was @@ -185,7 +185,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) /* purge any notifications cached for this client */ pmix_server_purge_events(peer, NULL); - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* only connection I can lose is to my server, so mark it */ pmix_globals.connected = false; } else { @@ -193,7 +193,7 @@ void pmix_ptl_base_lost_connection(pmix_peer_t *peer, pmix_status_t err) pmix_psensor.stop(peer, NULL); } - if (!peer->finalized && !PMIX_PROC_IS_TOOL(peer) && !pmix_globals.mypeer->finalized) { + if (!peer->finalized && !PMIX_PEER_IS_TOOL(peer) && !pmix_globals.mypeer->finalized) { /* if this peer already called finalize, then * we are just seeing their connection go away * when they terminate - so do not generate diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c index f2334e21a11..a653d4c8524 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/base/ptl_base_stubs.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,52 @@ #include "src/mca/ptl/base/base.h" +bool pmix_ptl_base_peer_is_earlier(pmix_peer_t *peer, uint8_t major, + uint8_t minor, uint8_t release) +{ + /* if they don't care, then don't check */ + if (PMIX_MAJOR_WILDCARD != major) { + if (PMIX_PEER_MAJOR_VERSION(peer) == PMIX_MAJOR_WILDCARD) { + /* we don't know what it is - assume earlier */ + return true; + } + if (PMIX_PEER_MAJOR_VERSION(peer) > major) { + return false; + } + if (PMIX_PEER_MAJOR_VERSION(peer) < major) { + return true; + } + } + /* major value must be equal, so check minor */ + if (PMIX_MINOR_WILDCARD != minor) { + if (PMIX_PEER_MINOR_VERSION(peer) == PMIX_MINOR_WILDCARD) { + /* we don't know what it is - assume earlier */ + return true; + } + if (PMIX_PEER_MINOR_VERSION(peer) > minor) { + return false; + } + if (PMIX_PEER_MINOR_VERSION(peer) < minor) { + return true; + } + } + /* major and minor must be equal - check release */ + if (PMIX_RELEASE_WILDCARD != release) { + if (PMIX_PEER_REL_VERSION(peer) == PMIX_RELEASE_WILDCARD) { + /* we don't know what it is - assume earlier */ + return true; + } + if (PMIX_PEER_REL_VERSION(peer) > release) { + return false; + } + if (PMIX_PEER_REL_VERSION(peer) < release) { + return true; + } + } + /* must be equal */ + return false; +} + pmix_status_t pmix_ptl_base_setup_fork(const pmix_proc_t *proc, char ***env) { pmix_ptl_base_active_t *active; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h index 0017c5b8134..a0e500655ce 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/ptl_types.h @@ -62,34 +62,104 @@ struct pmix_peer_t; struct pmix_ptl_module_t; /* define a process type */ -typedef uint16_t pmix_proc_type_t; - -#define PMIX_PROC_UNDEF 0x0000 -#define PMIX_PROC_CLIENT 0x0001 // simple client process -#define PMIX_PROC_SERVER 0x0002 // simple server process -#define PMIX_PROC_TOOL 0x0004 // simple tool -#define PMIX_PROC_V1 0x0008 // process is using PMIx v1 protocols -#define PMIX_PROC_V20 0x0010 // process is using PMIx v2.0 protocols -#define PMIX_PROC_V21 0x0020 // process is using PMIx v2.1 protocols -#define PMIX_PROC_V3 0x0040 // process is using PMIx v3 protocols -#define PMIX_PROC_LAUNCHER_ACT 0x1000 // process acting as launcher +typedef struct { + uint32_t type; + uint8_t major; + uint8_t minor; + uint8_t release; + uint8_t padding; // make the struct be 64-bits for addressing +} pmix_proc_type_t; + +#define PMIX_MAJOR_WILDCARD 255 +#define PMIX_MINOR_WILDCARD 255 +#define PMIX_RELEASE_WILDCARD 255 + +/* use 255 as WILDCARD for the release triplet values */ +#define PMIX_PROC_TYPE_STATIC_INIT \ + { \ + .type = PMIX_PROC_UNDEF, \ + .major = PMIX_MAJOR_WILDCARD, \ + .minor = PMIX_MINOR_WILDCARD, \ + .release = PMIX_RELEASE_WILDCARD, \ + .padding = 0 \ + } + +/* Define process types - we use a bit-mask as procs can + * span multiple types */ +#define PMIX_PROC_UNDEF 0x00000000 +#define PMIX_PROC_CLIENT 0x00000001 // simple client process +#define PMIX_PROC_SERVER 0x00000002 // simple server process +#define PMIX_PROC_TOOL 0x00000004 // simple tool +#define PMIX_PROC_LAUNCHER_ACT 0x10000000 // process acting as launcher #define PMIX_PROC_LAUNCHER (PMIX_PROC_TOOL | PMIX_PROC_SERVER | PMIX_PROC_LAUNCHER_ACT) -#define PMIX_PROC_CLIENT_TOOL_ACT 0x2000 +#define PMIX_PROC_CLIENT_LAUNCHER (PMIX_PROC_LAUNCHER | PMIX_PROC_CLIENT) +#define PMIX_PROC_CLIENT_TOOL_ACT 0x20000000 #define PMIX_PROC_CLIENT_TOOL (PMIX_PROC_TOOL | PMIX_PROC_CLIENT | PMIX_PROC_CLIENT_TOOL_ACT) -#define PMIX_PROC_GATEWAY_ACT 0x4000 +#define PMIX_PROC_GATEWAY_ACT 0x40000000 #define PMIX_PROC_GATEWAY (PMIX_PROC_SERVER | PMIX_PROC_GATEWAY_ACT) -/* defins some convenience macros for testing proc type */ -#define PMIX_PROC_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->proc_type) -#define PMIX_PROC_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->proc_type) -#define PMIX_PROC_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->proc_type) -#define PMIX_PROC_IS_V1(p) (PMIX_PROC_V1 & (p)->proc_type) -#define PMIX_PROC_IS_V20(p) (PMIX_PROC_V20 & (p)->proc_type) -#define PMIX_PROC_IS_V21(p) (PMIX_PROC_V21 & (p)->proc_type) -#define PMIX_PROC_IS_V3(p) (PMIX_PROC_V3 & (p)->proc_type) -#define PMIX_PROC_IS_LAUNCHER(p) (PMIX_PROC_LAUNCHER_ACT & (p)->proc_type) -#define PMIX_PROC_IS_CLIENT_TOOL(p) (PMIX_PROC_CLIENT_TOOL_ACT & (p)->proc_type) -#define PMIX_PROC_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->proc_type) +#define PMIX_SET_PEER_TYPE(a, b) \ + (a)->proc_type.type |= (b) +#define PMIX_SET_PROC_TYPE(a, b) \ + (a)->type |= (b) + +/* define some convenience macros for testing proc type */ +#define PMIX_PEER_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->proc_type.type) +#define PMIX_PEER_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->proc_type.type) +#define PMIX_PEER_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->proc_type.type) +#define PMIX_PEER_IS_LAUNCHER(p) (PMIX_PROC_LAUNCHER_ACT & (p)->proc_type.type) +#define PMIX_PEER_IS_CLIENT_LAUNCHER(p) ((PMIX_PROC_LAUNCHER_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type)) +#define PMIX_PEER_IS_CLIENT_TOOL(p) ((PMIX_PROC_CLIENT_TOOL_ACT & (p)->proc_type.type) && (PMIX_PROC_CLIENT & (p)->proc_type.type)) +#define PMIX_PEER_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->proc_type.type) + +#define PMIX_PROC_IS_CLIENT(p) (PMIX_PROC_CLIENT & (p)->type) +#define PMIX_PROC_IS_SERVER(p) (PMIX_PROC_SERVER & (p)->type) +#define PMIX_PROC_IS_TOOL(p) (PMIX_PROC_TOOL & (p)->type) +#define PMIX_PROC_IS_LAUNCHER(p) (PMIX_PROC_LAUNCHER_ACT & (p)->type) +#define PMIX_PROC_IS_CLIENT_LAUNCHER(p) ((PMIX_PROC_LAUNCHER_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type)) +#define PMIX_PROC_IS_CLIENT_TOOL(p) ((PMIX_PROC_CLIENT_TOOL_ACT & (p)->type) && (PMIX_PROC_CLIENT & (p)->type)) +#define PMIX_PROC_IS_GATEWAY(p) (PMIX_PROC_GATEWAY_ACT & (p)->type) + +/* provide macros for setting the major, minor, and release values + * just so people don't have to deal with the details of the struct */ +#define PMIX_SET_PEER_MAJOR(p, a) \ + (p)->proc_type.major = (a) +#define PMIX_SET_PEER_MINOR(p, a) \ + (p)->proc_type.minor = (a) +#define PMIX_SET_PEER_RELEASE(p, a) \ + (p)->proc_type.release = (a) +#define PMIX_SET_PROC_MAJOR(p, a) \ + (p)->major = (a) +#define PMIX_SET_PROC_MINOR(p, a) \ + (p)->minor = (a) +#define PMIX_SET_PROC_RELEASE(p, a) \ + (p)->release = (a) + +/* define some convenience macros for testing version */ +#define PMIX_PEER_MAJOR_VERSION(p) (p)->proc_type.major +#define PMIX_PEER_MINOR_VERSION(p) (p)->proc_type.minor +#define PMIX_PEER_REL_VERSION(p) (p)->proc_type.release +#define PMIX_PROC_MAJOR_VERSION(p) (p)->major +#define PMIX_PROC_MINOR_VERSION(p) (p)->minor +#define PMIX_PROC_REL_VERSION(p) (p)->release +#define PMIX_PEER_IS_V1(p) ((p)->proc_type.major == 1) +#define PMIX_PEER_IS_V20(p) ((p)->proc_type.major == 2 && (p)->proc_type.minor == 0) +#define PMIX_PEER_IS_V21(p) ((p)->proc_type.major == 2 && (p)->proc_type.minor == 1) +#define PMIX_PEER_IS_V3(p) ((p)->proc_type.major == 3) + + +#define PMIX_PEER_TRIPLET(p, a, b, c) \ + ((PMIX_PEER_MAJOR_VERSION(p) == PMIX_MAJOR_WILDCARD || (a) == PMIX_MAJOR_WILDCARD || PMIX_PEER_MAJOR_VERSION(p) == (a)) && \ + (PMIX_PEER_MINOR_VERSION(p) == PMIX_MINOR_WILDCARD || (b) == PMIX_MINOR_WILDCARD || PMIX_PEER_MINOR_VERSION(p) == (b)) && \ + (PMIX_PEER_REL_VERSION(p) == PMIX_RELEASE_WILDCARD || (c) == PMIX_RELEASE_WILDCARD || PMIX_PEER_REL_VERSION(p) == (c))) + +#define PMIX_PROC_TRIPLET(p, a, b, c) \ + ((PMIX_PROC_MAJOR_VERSION(p) == PMIX_MAJOR_WILDCARD || PMIX_PROC_MAJOR_VERSION(p) == (a)) && \ + (PMIX_PROC_MINOR_VERSION(p) == PMIX_MINOR_WILDCARD || PMIX_PROC_MINOR_VERSION(p) == (b)) && \ + (PMIX_PROC_REL_VERSION(p) == PMIX_RELEASE_WILDCARD || PMIX_PROC_REL_VERSION(p) == (c))) + +#define PMIX_PEER_IS_EARLIER(p, a, b, c) \ + pmix_ptl_base_peer_is_earlier(p, a, b, c) /**** MESSAGING STRUCTURES ****/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c index e86a4126405..af6ccc69f1f 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp.c @@ -141,6 +141,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_info_t *iptr = NULL, mypidinfo, mycmdlineinfo, launcher; size_t niptr = 0; pmix_kval_t *urikv = NULL; + int major, minor, release; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "ptl:tcp: connecting to server"); @@ -151,10 +152,11 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* if I am a client, then we need to look for the appropriate * connection info in the environment */ - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { if (NULL != (evar = getenv("PMIX_SERVER_URI3"))) { /* we are talking to a v3 server */ - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V3; + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 3); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "V3 SERVER DETECTED"); /* must use the v3 bfrops module */ @@ -164,7 +166,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, } } else if (NULL != (evar = getenv("PMIX_SERVER_URI21"))) { /* we are talking to a v2.1 server */ - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V21; + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 2); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, 1); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "V21 SERVER DETECTED"); /* must use the v21 bfrops module */ @@ -174,7 +178,9 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, } } else if (NULL != (evar = getenv("PMIX_SERVER_URI2"))) { /* we are talking to a v2.0 server */ - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V20; + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 2); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, 0); pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "V20 SERVER DETECTED"); /* must use the v20 bfrops module */ @@ -191,6 +197,18 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* mark that we are using the V2 (i.e., tcp) protocol */ pmix_globals.mypeer->protocol = PMIX_PROTOCOL_V2; + /* see if they set their version in the env */ + if (NULL != (p2 = getenv("PMIX_VERSION"))) { + major = strtoul(p2, &p, 10); + ++p; + minor = strtoul(p, &p, 10); + ++p; + release = strtoul(p, NULL, 10); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, major); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, minor); + PMIX_SET_PEER_RELEASE(pmix_client_globals.myserver, release); + } + /* the URI consists of the following elements: * - server nspace.rank * - ptl rendezvous URI @@ -306,7 +324,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, pmix_list_append(&ilist, &kv->super); /* if I am a launcher, tell them so */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { kv = PMIX_NEW(pmix_info_caddy_t); PMIX_INFO_LOAD(&launcher, PMIX_LAUNCHER, NULL, PMIX_BOOL); kv->info = &launcher; @@ -716,7 +734,7 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, /* tools setup their server info in try_connect because they * utilize a broader handshake */ - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { /* setup the server info */ if (NULL == pmix_client_globals.myserver->info) { pmix_client_globals.myserver->info = PMIX_NEW(pmix_rank_info_t); @@ -827,12 +845,12 @@ static pmix_status_t parse_uri_file(char *filename, pmix_rank_t *rank) { FILE *fp; - char *srvr, *p, *p2; + char *srvr, *p, *p2, *p3; pmix_lock_t lock; pmix_event_t ev; struct timeval tv; int retries; - int major; + int major, minor, release; fp = fopen(filename, "r"); if (NULL == fp) { @@ -881,27 +899,29 @@ static pmix_status_t parse_uri_file(char *filename, /* see if this file contains the server's version */ p2 = pmix_getline(fp); if (NULL == p2) { - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V20; + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 2); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, 0); pmix_client_globals.myserver->protocol = PMIX_PROTOCOL_V2; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "V20 SERVER DETECTED"); } else { /* convert the version to a number */ if ('v' == p2[0]) { - major = strtoul(&p2[1], NULL, 10); + major = strtoul(&p2[1], &p3, 10); } else { - major = strtoul(p2, NULL, 10); - } - if (2 == major) { - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V21; + major = strtoul(p2, &p3, 10); + } + minor = strtoul(p3, &p3, 10); + release = strtoul(p3, NULL, 10); + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, major); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, minor); + PMIX_SET_PEER_RELEASE(pmix_client_globals.myserver, release); + if (2 <= major) { pmix_client_globals.myserver->protocol = PMIX_PROTOCOL_V2; pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "V21 SERVER DETECTED"); - } else if (3 <= major) { - pmix_client_globals.myserver->proc_type = PMIX_PROC_SERVER | PMIX_PROC_V3; - pmix_client_globals.myserver->protocol = PMIX_PROTOCOL_V2; - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "V3 SERVER DETECTED"); + "V2 PROTOCOL SERVER DETECTED"); } } if (NULL != p2) { @@ -1068,8 +1088,8 @@ static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, "pmix:tcp SEND CONNECT ACK"); /* if we are a server, then we shouldn't be here */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) && - !PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) && + !PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); return PMIX_ERR_NOT_SUPPORTED; } @@ -1107,8 +1127,8 @@ static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, * 7 => self-started launcher that was given an identifier by caller * 8 => launcher that was started by a PMIx server - identifier specified by server */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { /* if we are both launcher and client, then we need * to tell the server we are both */ flag = 8; @@ -1129,8 +1149,8 @@ static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, } } - } else if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer) && - !PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + } else if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer) && + !PMIX_PEER_IS_TOOL(pmix_globals.mypeer)) { /* we are a simple client */ flag = 0; /* reserve space for our nspace and rank info */ @@ -1139,7 +1159,7 @@ static pmix_status_t send_connect_ack(int sd, uint8_t *myflag, } else { // must be a tool of some sort /* add space for our uid/gid for ACL purposes */ sdsize += 2*sizeof(uint32_t); - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { /* if we are both tool and client, then we need * to tell the server we are both */ flag = 5; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c index cb800a6fdf9..8032c272f30 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/tcp/ptl_tcp_component.c @@ -254,8 +254,8 @@ static pmix_status_t component_open(void) /* check for environ-based directives * on system tmpdir to use */ - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || - PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || + PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { mca_ptl_tcp_component.session_tmpdir = strdup(pmix_server_globals.tmpdir); } else { if (NULL != (tdir = getenv("PMIX_SERVER_TMPDIR"))) { @@ -265,8 +265,8 @@ static pmix_status_t component_open(void) } } - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer) || - PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || + PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { mca_ptl_tcp_component.system_tmpdir = strdup(pmix_server_globals.system_tmpdir); } else { if (NULL != (tdir = getenv("PMIX_SYSTEM_TMPDIR"))) { @@ -281,6 +281,14 @@ static pmix_status_t component_open(void) 0 != strcmp(mca_ptl_tcp_component.report_uri, "+")) { urifile = strdup(mca_ptl_tcp_component.report_uri); } + + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer) || + PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { + if (NULL != (tdir = getenv("PMIX_LAUNCHER_RENDEZVOUS_FILE"))) { + mca_ptl_tcp_component.rendezvous_filename = strdup(tdir); + } + } + return PMIX_SUCCESS; } @@ -369,7 +377,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, "ptl:tcp setup_listener"); /* if we are not a server, then we shouldn't be doing this */ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { return PMIX_ERR_NOT_SUPPORTED; } @@ -420,7 +428,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, session_tool = PMIX_INFO_TRUE(&info[n]); } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_SYSTEM_SUPPORT)) { system_tool = PMIX_INFO_TRUE(&info[n]); - } else if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer) && + } else if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer) && PMIX_CHECK_KEY(&info[n], PMIX_LAUNCHER_RENDEZVOUS_FILE)) { mca_ptl_tcp_component.rendezvous_filename = strdup(info[n].value.data.string); } @@ -687,7 +695,16 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, /* if we were given a rendezvous file, then drop it */ if (NULL != mca_ptl_tcp_component.rendezvous_filename) { FILE *fp; - + /* if we are a tool and the file already exists, then we + * just use it as providing the rendezvous info for our + * server */ + if (PMIX_PEER_IS_TOOL(pmix_globals.mypeer)) { + struct stat buf; + /* coverity[toctou] */ + if (0 == stat(mca_ptl_tcp_component.rendezvous_filename, &buf)) { + goto nextstep; + } + } pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "WRITING RENDEZVOUS FILE %s", mca_ptl_tcp_component.rendezvous_filename); @@ -716,6 +733,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, } } + nextstep: /* if we are going to support tools, then drop contact file(s) */ if (system_tool) { FILE *fp; @@ -859,7 +877,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, } } /* if we are a tool and connected, then register any rendezvous files for cleanup */ - if (PMIX_PROC_IS_TOOL(pmix_globals.mypeer) && pmix_globals.connected) { + if (PMIX_PEER_IS_TOOL(pmix_globals.mypeer) && pmix_globals.connected) { char **clnup = NULL, *cptr = NULL; pmix_info_t dir; if (NULL != mca_ptl_tcp_component.nspace_filename) { @@ -1009,9 +1027,10 @@ static void connection_handler(int sd, short args, void *cbdata) pmix_rank_info_t *info; pmix_proc_t proc; pmix_info_t ginfo; - pmix_proc_type_t proc_type; + pmix_proc_type_t proc_type = PMIX_PROC_TYPE_STATIC_INIT; pmix_byte_object_t cred; pmix_buffer_t buf; + uint8_t major, minor, release; /* acquire the object */ PMIX_ACQUIRE_OBJECT(pnd); @@ -1118,7 +1137,7 @@ static void connection_handler(int sd, short args, void *cbdata) if (0 == pnd->flag) { /* they must be a client, so get their nspace/rank */ - proc_type = PMIX_PROC_CLIENT; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_CLIENT); PMIX_STRNLEN(msglen, mg, cnt); if (msglen < cnt) { nspace = mg; @@ -1145,7 +1164,7 @@ static void connection_handler(int sd, short args, void *cbdata) } } else if (1 == pnd->flag) { /* they are a tool */ - proc_type = PMIX_PROC_TOOL; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_TOOL); /* extract the uid/gid */ if (sizeof(uint32_t) <= cnt) { memcpy(&u32, mg, sizeof(uint32_t)); @@ -1171,7 +1190,7 @@ static void connection_handler(int sd, short args, void *cbdata) } } else if (2 == pnd->flag) { /* they are a launcher */ - proc_type = PMIX_PROC_LAUNCHER; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_LAUNCHER); /* extract the uid/gid */ if (sizeof(uint32_t) <= cnt) { memcpy(&u32, mg, sizeof(uint32_t)); @@ -1198,9 +1217,9 @@ static void connection_handler(int sd, short args, void *cbdata) } else if (3 == pnd->flag || 6 == pnd->flag) { /* they are a tool or launcher that needs an identifier */ if (3 == pnd->flag) { - proc_type = PMIX_PROC_TOOL; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_TOOL); } else { - proc_type = PMIX_PROC_LAUNCHER; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_LAUNCHER); } /* extract the uid/gid */ if (sizeof(uint32_t) <= cnt) { @@ -1230,9 +1249,9 @@ static void connection_handler(int sd, short args, void *cbdata) } else if (4 == pnd->flag || 5 == pnd->flag || 7 == pnd->flag || 8 == pnd->flag) { /* they are a tool or launcher that has an identifier - start with our ACLs */ if (4 == pnd->flag || 5 == pnd->flag) { - proc_type = PMIX_PROC_TOOL; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_TOOL); } else { - proc_type = PMIX_PROC_LAUNCHER; + PMIX_SET_PROC_TYPE(&proc_type, PMIX_PROC_LAUNCHER); } /* extract the uid/gid */ if (sizeof(uint32_t) <= cnt) { @@ -1302,26 +1321,21 @@ static void connection_handler(int sd, short args, void *cbdata) rc = PMIX_ERR_BAD_PARAM; goto error; } + major = strtoul(version, &version, 10); + ++version; + minor = strtoul(version, &version, 10); + ++version; + release = strtoul(version, NULL, 10); + PMIX_SET_PROC_MAJOR(&proc_type, major); + PMIX_SET_PROC_MINOR(&proc_type, minor); + PMIX_SET_PROC_RELEASE(&proc_type, release); - if (0 == strncmp(version, "2.0", 3)) { + if (2 == major && 0 == minor) { /* the 2.0 release handshake ends with the version string */ - proc_type = proc_type | PMIX_PROC_V20; bfrops = "v20"; bftype = pmix_bfrops_globals.default_type; // we can't know any better gds = "ds12,hash"; } else { - int major; - major = strtoul(version, NULL, 10); - if (2 == major) { - proc_type = proc_type | PMIX_PROC_V21; - } else if (3 <= major) { - proc_type = proc_type | PMIX_PROC_V3; - } else { - free(msg); - PMIX_ERROR_LOG(PMIX_ERR_NOT_SUPPORTED); - rc = PMIX_ERR_NOT_SUPPORTED; - goto error; - } /* extract the name of the bfrops module they used */ PMIX_STRNLEN(msglen, mg, cnt); if (msglen < cnt) { @@ -1477,7 +1491,7 @@ static void connection_handler(int sd, short args, void *cbdata) } /* pass along the proc_type */ - pnd->proc_type = proc_type; + memcpy(&pnd->proc_type, &proc_type, sizeof(pmix_proc_type_t)); /* pass along the bfrop, buffer_type, and sec fields so * we can assign them once we create a peer object */ pnd->psec = strdup(sec); @@ -1577,7 +1591,7 @@ static void connection_handler(int sd, short args, void *cbdata) return; } /* mark that this peer is a client of the given type */ - peer->proc_type = proc_type; + memcpy(&peer->proc_type, &proc_type, sizeof(pmix_proc_type_t)); /* save the protocol */ peer->protocol = pnd->protocol; /* add in the nspace pointer */ @@ -1850,7 +1864,7 @@ static void process_cbfunc(int sd, short args, void *cbdata) } /* mark the peer proc type */ - peer->proc_type = pnd->proc_type; + memcpy(&peer->proc_type, &pnd->proc_type, sizeof(pmix_proc_type_t)); /* save the protocol */ peer->protocol = pnd->protocol; /* save the uid/gid */ @@ -1906,11 +1920,12 @@ static void process_cbfunc(int sd, short args, void *cbdata) goto done; } PMIX_RETAIN(peer); - req->peer = peer; - req->pname.nspace = strdup(pmix_globals.myid.nspace); - req->pname.rank = pmix_globals.myid.rank; + req->requestor = peer; + req->nprocs = 1; + PMIX_PROC_CREATE(req->procs, req->nprocs); + PMIX_LOAD_PROCID(&req->procs[0], pmix_globals.myid.nspace, pmix_globals.myid.rank); req->channels = PMIX_FWD_STDOUT_CHANNEL | PMIX_FWD_STDERR_CHANNEL | PMIX_FWD_STDDIAG_CHANNEL; - pmix_list_append(&pmix_globals.iof_requests, &req->super); + req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); /* validate the connection */ cred.bytes = pnd->cred; diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c index 51417f3e032..9e748e426ee 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock.c @@ -14,6 +14,8 @@ * Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -108,21 +110,25 @@ static pmix_status_t connect_to_peer(struct pmix_peer_t *peer, __FILE__, __LINE__); /* if we are not a client, there is nothing we can do */ - if (!PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { return PMIX_ERR_NOT_SUPPORTED; } + PMIX_SET_PEER_TYPE(pmix_client_globals.myserver, PMIX_PROC_SERVER); /* if we don't have a path to the daemon rendezvous point, * then we need to return an error */ if (NULL != (evar = getenv("PMIX_SERVER_URI2USOCK"))) { /* this is a v2.1+ server */ pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module("v21"); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 2); if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) { return PMIX_ERR_INIT; } } else if (NULL != (evar = getenv("PMIX_SERVER_URI"))) { /* this is a pre-v2.1 server - must use the v12 bfrops module */ pmix_globals.mypeer->nptr->compat.bfrops = pmix_bfrops_base_assign_module("v12"); + PMIX_SET_PEER_MAJOR(pmix_client_globals.myserver, 1); + PMIX_SET_PEER_MINOR(pmix_client_globals.myserver, 2); if (NULL == pmix_globals.mypeer->nptr->compat.bfrops) { return PMIX_ERR_INIT; } @@ -566,7 +572,7 @@ void pmix_usock_send_handler(int sd, short flags, void *cbdata) if (NULL != msg) { if (!msg->hdr_sent) { - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { /* we have to convert the header back to host-byte order */ msg->hdr.pindex = ntohl(msg->hdr.pindex); msg->hdr.tag = ntohl(msg->hdr.tag); @@ -598,7 +604,7 @@ void pmix_usock_send_handler(int sd, short flags, void *cbdata) /* exit this event and let the event lib progress */ pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, "usock:send_handler RES BUSY OR WOULD BLOCK"); - if (PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { /* have to convert back again so we are correct when we re-enter */ msg->hdr.pindex = htonl(msg->hdr.pindex); msg->hdr.tag = htonl(msg->hdr.tag); diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c index 36637cc9882..1a0716a8962 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/ptl/usock/ptl_usock_component.c @@ -151,7 +151,7 @@ pmix_status_t component_close(void) static int component_query(pmix_mca_base_module_t **module, int *priority) { - if (PMIX_PROC_IS_TOOL(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_TOOL(pmix_globals.mypeer)) { return PMIX_ERR_NOT_SUPPORTED; } @@ -177,7 +177,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, pmix_status_t rc; socklen_t addrlen; struct sockaddr_un *address; - bool disabled = false; + bool disabled = true; char *pmix_pid; pid_t mypid; @@ -185,7 +185,7 @@ static pmix_status_t setup_listener(pmix_info_t info[], size_t ninfo, "ptl:usock setup_listener"); /* if we are not a server, then we shouldn't be doing this */ - if (!PMIX_PROC_IS_SERVER(pmix_globals.mypeer)) { + if (!PMIX_PEER_IS_SERVER(pmix_globals.mypeer)) { return PMIX_ERR_NOT_SUPPORTED; } @@ -592,24 +592,11 @@ static void connection_handler(int sd, short args, void *cbdata) goto error; } /* mark it as being a client of the correct type */ - if (1 == major) { - psave->proc_type = PMIX_PROC_CLIENT | PMIX_PROC_V1; - } else if (2 == major && 0 == minor) { - psave->proc_type = PMIX_PROC_CLIENT | PMIX_PROC_V20; - } else if (2 == major && 1 == minor) { - psave->proc_type = PMIX_PROC_CLIENT | PMIX_PROC_V21; - } else if (3 == major) { - psave->proc_type = PMIX_PROC_CLIENT | PMIX_PROC_V3; - } else { - /* we don't recognize this version */ - pmix_output_verbose(2, pmix_ptl_base_framework.framework_output, - "connection request from client of unrecognized version %s", version); - free(msg); - PMIX_RELEASE(psave); - CLOSE_THE_SOCKET(pnd->sd); - PMIX_RELEASE(pnd); - return; - } + PMIX_SET_PROC_TYPE(&psave->proc_type, PMIX_PROC_CLIENT); + PMIX_SET_PROC_MAJOR(&psave->proc_type, major); + PMIX_SET_PROC_MINOR(&psave->proc_type, minor); + PMIX_SET_PROC_RELEASE(&psave->proc_type, rel); + /* save the protocol */ psave->protocol = pnd->protocol; /* add the nspace tracker */ diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c index c083ad645f3..828987884ba 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_finalize.c @@ -54,6 +54,7 @@ void pmix_rte_finalize(void) { int i; pmix_notify_caddy_t *cd; + pmix_iof_req_t *req; if( --pmix_initialized != 0 ) { if( pmix_initialized < 0 ) { @@ -115,7 +116,13 @@ void pmix_rte_finalize(void) } } PMIX_DESTRUCT(&pmix_globals.notifications); - PMIX_LIST_DESTRUCT(&pmix_globals.iof_requests); + for (i=0; i < pmix_globals.iof_requests.size; i++) { + if (NULL != (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, i))) { + PMIX_RELEASE(req); + } + } + PMIX_DESTRUCT(&pmix_globals.iof_requests); + PMIX_LIST_DESTRUCT(&pmix_globals.stdin_targets); free(pmix_globals.hostname); PMIX_LIST_DESTRUCT(&pmix_globals.nspaces); diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c index b3255e4e5da..368256cfc21 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_init.c @@ -93,7 +93,7 @@ static void _notification_eviction_cbfunc(struct pmix_hotel_t *hotel, } -int pmix_rte_init(pmix_proc_type_t type, +int pmix_rte_init(uint32_t type, pmix_info_t info[], size_t ninfo, pmix_ptl_cbfunc_t cbfunc) { @@ -161,8 +161,6 @@ int pmix_rte_init(pmix_proc_type_t type, } /* setup the globals structure */ - gethostname(hostname, PMIX_MAXHOSTNAMELEN-1); - pmix_globals.hostname = strdup(hostname); memset(&pmix_globals.myid.nspace, 0, PMIX_MAX_NSLEN+1); pmix_globals.myid.rank = PMIX_RANK_INVALID; PMIX_CONSTRUCT(&pmix_globals.events, pmix_events_t); @@ -175,6 +173,13 @@ int pmix_rte_init(pmix_proc_type_t type, pmix_globals.evbase, pmix_globals.event_eviction_time, _notification_eviction_cbfunc); PMIX_CONSTRUCT(&pmix_globals.nspaces, pmix_list_t); + /* if we were given a hostname in our environment, use it */ + if (NULL != (evar = getenv("PMIX_HOSTNAME"))) { + pmix_globals.hostname = strdup(evar); + } else { + gethostname(hostname, PMIX_MAXHOSTNAMELEN-1); + pmix_globals.hostname = strdup(hostname); + } if (PMIX_SUCCESS != ret) { error = "notification hotel init"; @@ -182,7 +187,10 @@ int pmix_rte_init(pmix_proc_type_t type, } /* and setup the iof request tracking list */ - PMIX_CONSTRUCT(&pmix_globals.iof_requests, pmix_list_t); + PMIX_CONSTRUCT(&pmix_globals.iof_requests, pmix_pointer_array_t); + pmix_pointer_array_init(&pmix_globals.iof_requests, 128, INT_MAX, 128); + /* setup the stdin forwarding target list */ + PMIX_CONSTRUCT(&pmix_globals.stdin_targets, pmix_list_t); /* Setup client verbosities as all procs are allowed to * access client APIs */ @@ -245,7 +253,10 @@ int pmix_rte_init(pmix_proc_type_t type, goto return_error; } /* whatever our declared proc type, we are definitely v3.0 */ - pmix_globals.mypeer->proc_type = type | PMIX_PROC_V3; + PMIX_SET_PEER_TYPE(pmix_globals.mypeer, type); + PMIX_SET_PEER_MAJOR(pmix_globals.mypeer, PMIX_VERSION_MAJOR); + PMIX_SET_PEER_MINOR(pmix_globals.mypeer, PMIX_VERSION_MINOR); + PMIX_SET_PEER_RELEASE(pmix_globals.mypeer, PMIX_VERSION_RELEASE); /* create an nspace object for ourselves - we will * fill in the nspace name later */ pmix_globals.mypeer->nptr = PMIX_NEW(pmix_namespace_t); diff --git a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h index d1744f05fbe..f7768e39426 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h +++ b/opal/mca/pmix/pmix3x/pmix/src/runtime/pmix_rte.h @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. - * Copyright (c) 2014-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -59,7 +59,7 @@ extern const char pmix_version_string[]; * @retval PMIX_ERROR Upon failure. * */ -PMIX_EXPORT pmix_status_t pmix_rte_init(pmix_proc_type_t type, +PMIX_EXPORT pmix_status_t pmix_rte_init(uint32_t type, pmix_info_t info[], size_t ninfo, pmix_ptl_cbfunc_t cbfunc); diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c index 2ea33a056c1..fe1cfc593ba 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server.c @@ -180,13 +180,14 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, }; char *evar; pmix_rank_info_t *rinfo; - pmix_proc_type_t ptype = PMIX_PROC_SERVER; + pmix_proc_type_t ptype = PMIX_PROC_TYPE_STATIC_INIT; PMIX_ACQUIRE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_server_globals.base_output, "pmix:server init called"); + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_SERVER); /* setup the function pointers */ if (NULL == module) { pmix_host_server = myhostserver; @@ -198,9 +199,9 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, for (n=0; n < ninfo; n++) { if (0 == strncmp(info[n].key, PMIX_SERVER_GATEWAY, PMIX_MAX_KEYLEN)) { if (PMIX_INFO_TRUE(&info[n])) { - ptype |= PMIX_PROC_GATEWAY; + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_GATEWAY); } - } else if (0 == strncmp(info[n].key, PMIX_SERVER_TMPDIR, PMIX_MAX_KEYLEN)) { + } else if (PMIX_CHECK_KEY(&info[n], PMIX_SERVER_TMPDIR)) { pmix_server_globals.tmpdir = strdup(info[n].value.data.string); } else if (0 == strncmp(info[n].key, PMIX_SYSTEM_TMPDIR, PMIX_MAX_KEYLEN)) { pmix_server_globals.system_tmpdir = strdup(info[n].value.data.string); @@ -224,7 +225,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, /* setup the runtime - this init's the globals, * opens and initializes the required frameworks */ - if (PMIX_SUCCESS != (rc = pmix_rte_init(ptype, info, ninfo, NULL))) { + if (PMIX_SUCCESS != (rc = pmix_rte_init(ptype.type, info, ninfo, NULL))) { PMIX_ERROR_LOG(rc); PMIX_RELEASE_THREAD(&pmix_global_lock); return rc; @@ -406,7 +407,7 @@ PMIX_EXPORT pmix_status_t PMIx_server_init(pmix_server_module_t *module, pmix_list_append(&pmix_ptl_globals.posted_recvs, &req->super); /* if we are a gateway, setup our IOF events */ - if (PMIX_PROC_IS_GATEWAY(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_GATEWAY(pmix_globals.mypeer)) { /* setup IOF */ PMIX_IOF_SINK_DEFINE(&pmix_client_globals.iof_stdout, &pmix_globals.myid, 1, PMIX_FWD_STDOUT_CHANNEL, pmix_iof_write_handler); @@ -539,6 +540,10 @@ static void _register_nspace(int sd, short args, void *cbdata) pmix_namespace_t *nptr, *tmp; pmix_status_t rc; size_t i; + bool all_def; + pmix_server_trkr_t *trk; + pmix_namespace_t *ns; + pmix_trkr_caddy_t *tcd; PMIX_ACQUIRE_OBJECT(caddy); @@ -591,6 +596,77 @@ static void _register_nspace(int sd, short args, void *cbdata) PMIX_GDS_CACHE_JOB_INFO(rc, pmix_globals.mypeer, nptr, cd->info, cd->ninfo); + /* check any pending trackers to see if they are + * waiting for us. There is a slight race condition whereby + * the host server could have spawned the local client and + * it called back into the collective -before- our local event + * would fire the register_client callback. Deal with that here. */ + all_def = true; + PMIX_LIST_FOREACH(trk, &pmix_server_globals.collectives, pmix_server_trkr_t) { + /* if this tracker is already complete, then we + * don't need to update it */ + if (trk->def_complete) { + continue; + } + /* the fact that the tracker is here means that the tracker was + * created in response to at least one collective call being received + * from a participant. However, not all local participants may have + * already called the collective. While the collective created the + * tracker, it would not have updated the number of local participants + * from this nspace if they specified PMIX_RANK_WILDCARD in the list of + * participants since the host hadn't yet called "register_nspace". + * Take care of that here */ + for (i=0; i < trk->npcs; i++) { + /* since we have to do this search, let's see + * if the nspaces are all completely registered */ + if (all_def) { + /* so far, they have all been defined - check this one */ + PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { + if (0 == strcmp(trk->pcs[i].nspace, ns->nspace)) { + if (SIZE_MAX == ns->nlocalprocs || + !ns->all_registered) { + all_def = false; + } + break; + } + } + } + /* now see if this nspace is the one we just registered */ + if (0 != strncmp(trk->pcs[i].nspace, nptr->nspace, PMIX_MAX_NSLEN)) { + /* if not, then we really can't say anything more about it as + * we have no new information about this nspace */ + continue; + } + /* if this request was for all participants from this nspace, then + * we handle this case here */ + if (PMIX_RANK_WILDCARD == trk->pcs[i].rank) { + trk->nlocal = nptr->nlocalprocs; + /* the total number of procs in this nspace was provided + * in the data blob delivered to register_nspace, so check + * to see if all the procs are local */ + if (nptr->nprocs != nptr->nlocalprocs) { + trk->local = false; + } + continue; + } + } + /* update this tracker's status */ + trk->def_complete = all_def; + /* is this now locally completed? */ + if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { + /* it did, so now we need to process it + * we don't want to block someone + * here, so kick any completed trackers into a + * new event for processing */ + PMIX_EXECUTE_COLLECTIVE(tcd, trk, pmix_server_execute_collective); + } + } + /* also check any pending local modex requests to see if + * someone has been waiting for a request on a remote proc + * in one of our nspaces, but we didn't know all the local procs + * and so couldn't determine the proc was remote */ + pmix_pending_nspace_requests(nptr); + release: cd->opcbfunc(rc, cd->cbdata); PMIX_RELEASE(cd); @@ -650,7 +726,7 @@ void pmix_server_purge_events(pmix_peer_t *peer, { pmix_regevents_info_t *reginfo, *regnext; pmix_peer_events_info_t *prev, *pnext; - pmix_iof_req_t *req, *nxt; + pmix_iof_req_t *req; int i; pmix_notify_caddy_t *ncd; size_t n, m, p, ntgs; @@ -676,10 +752,13 @@ void pmix_server_purge_events(pmix_peer_t *peer, /* since the client is finalizing, remove them from any IOF * registrations they may still have on our list */ - PMIX_LIST_FOREACH_SAFE(req, nxt, &pmix_globals.iof_requests, pmix_iof_req_t) { - if ((NULL != peer && PMIX_CHECK_PROCID(&req->peer->info->pname, &peer->info->pname)) || - (NULL != proc && PMIX_CHECK_PROCID(&req->peer->info->pname, proc))) { - pmix_list_remove_item(&pmix_globals.iof_requests, &req->super); + for (i=0; i < pmix_globals.iof_requests.size; i++) { + if (NULL == (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, i))) { + continue; + } + if ((NULL != peer && PMIX_CHECK_PROCID(&req->requestor->info->pname, &peer->info->pname)) || + (NULL != proc && PMIX_CHECK_PROCID(&req->requestor->info->pname, proc))) { + pmix_pointer_array_set_item(&pmix_globals.iof_requests, i, NULL); PMIX_RELEASE(req); } } @@ -980,7 +1059,7 @@ void pmix_server_execute_collective(int sd, short args, void *cbdata) static void _register_client(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; - pmix_rank_info_t *info, *iptr; + pmix_rank_info_t *info; pmix_namespace_t *nptr, *ns; pmix_server_trkr_t *trk; pmix_trkr_caddy_t *tcd; @@ -1004,6 +1083,10 @@ static void _register_client(int sd, short args, void *cbdata) } } if (NULL == nptr) { + /* there is no requirement in the Standard that hosts register + * an nspace prior to registering clients for that nspace. So + * if we didn't find it, just add it to our collection now in + * anticipation of eventually getting a "register_nspace" call */ nptr = PMIX_NEW(pmix_namespace_t); if (NULL == nptr) { rc = PMIX_ERR_NOMEM; @@ -1026,8 +1109,11 @@ static void _register_client(int sd, short args, void *cbdata) info->gid = cd->gid; info->server_object = cd->server_object; pmix_list_append(&nptr->ranks, &info->super); - /* see if we have everyone */ - if (nptr->nlocalprocs == pmix_list_get_size(&nptr->ranks)) { + /* see if we have everyone - not that nlocalprocs is set to + * a default value to ensure we don't execute this + * test until the host calls "register_nspace" */ + if (SIZE_MAX != nptr->nlocalprocs && + nptr->nlocalprocs == pmix_list_get_size(&nptr->ranks)) { nptr->all_registered = true; /* check any pending trackers to see if they are * waiting for us. There is a slight race condition whereby @@ -1041,36 +1127,47 @@ static void _register_client(int sd, short args, void *cbdata) if (trk->def_complete) { continue; } - /* see if any of our procs from this nspace are involved - the tracker will - * have been created because a callback was received, but - * we may or may not have received _all_ callbacks by this - * time. So check and see if any procs from this nspace are - * involved, and add them to the count of local participants */ + /* the fact that the tracker is here means that the tracker was + * created in response to at least one collective call being received + * from a participant. However, not all local participants may have + * already called the collective. While the collective created the + * tracker, it would not have updated the number of local participants + * from this nspace UNLESS the collective involves all procs in the + * nspace (i.e., they specified PMIX_RANK_WILDCARD in the list of + * participants) AND the host already provided the number of local + * procs for this nspace by calling "register_nspace". So avoid that + * scenario here to avoid double-counting */ for (i=0; i < trk->npcs; i++) { /* since we have to do this search, let's see - * if the nspaces are all defined */ + * if the nspaces are all completely registered */ if (all_def) { /* so far, they have all been defined - check this one */ PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { - if (0 < ns->nlocalprocs && - 0 == strcmp(trk->pcs[i].nspace, ns->nspace)) { - all_def = ns->all_registered; + if (0 == strcmp(trk->pcs[i].nspace, ns->nspace)) { + if (SIZE_MAX == ns->nlocalprocs || + !ns->all_registered) { + all_def = false; + } break; } } } - /* now see if this proc is local to us */ + /* now see if this nspace is the one to which the client we just + * registered belongs */ if (0 != strncmp(trk->pcs[i].nspace, nptr->nspace, PMIX_MAX_NSLEN)) { + /* if not, then we really can't say anything more about it as + * we have no new information about this nspace */ continue; } - /* need to check if this rank is one of mine */ - PMIX_LIST_FOREACH(iptr, &nptr->ranks, pmix_rank_info_t) { - if (PMIX_RANK_WILDCARD == trk->pcs[i].rank || - iptr->pname.rank == trk->pcs[i].rank) { - /* this is one of mine - track the count */ - ++trk->nlocal; - break; - } + /* if this request was for all participants from this nspace, then + * we handle this case elsewhere */ + if (PMIX_RANK_WILDCARD == trk->pcs[i].rank) { + continue; + } + /* see if the rank we just registered is a participant */ + if (cd->proc.rank == trk->pcs[i].rank) { + /* yes, we are included */ + ++trk->nlocal; } } /* update this tracker's status */ @@ -1204,7 +1301,7 @@ static void _deregister_client(int sd, short args, void *cbdata) /* resources may have been allocated to them, so * ensure they get cleaned up - this isn't true * for tools, so don't clean them up */ - if (!PMIX_PROC_IS_TOOL(peer)) { + if (!PMIX_PEER_IS_TOOL(peer)) { pmix_pnet.child_finalized(&cd->proc); pmix_psensor.stop(peer, NULL); } @@ -1344,6 +1441,13 @@ PMIX_EXPORT pmix_status_t PMIx_server_setup_fork(const pmix_proc_t *proc, char * return rc; } + /* ensure we agree on our hostname - typically only important in + * test scenarios where we are faking multiple nodes */ + pmix_setenv("PMIX_HOSTNAME", pmix_globals.hostname, true, env); + + /* communicate our version */ + pmix_setenv("PMIX_VERSION", PMIX_VERSION, true, env); + return PMIX_SUCCESS; } @@ -1758,69 +1862,26 @@ static void _iofdeliver(int sd, short args, void *cbdata) { pmix_setup_caddy_t *cd = (pmix_setup_caddy_t*)cbdata; pmix_iof_req_t *req; - pmix_status_t rc; - pmix_buffer_t *msg; bool found = false; - bool cached = false; pmix_iof_cache_t *iof; + int i; + size_t n; pmix_output_verbose(2, pmix_server_globals.iof_output, "PMIX:SERVER delivering IOF from %s on channel %0x", PMIX_NAME_PRINT(cd->procs), cd->channels); - /* cycle across our list of IOF requestors and see who wants + /* cycle across our list of IOF requests and see who wants * this channel from this source */ - PMIX_LIST_FOREACH(req, &pmix_globals.iof_requests, pmix_iof_req_t) { - /* if the channel wasn't included, then ignore it */ - if (!(cd->channels & req->channels)) { + for (i=0; i < pmix_globals.iof_requests.size; i++) { + if (NULL == (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, i))) { continue; } - /* see if the source matches the request */ - if (!PMIX_CHECK_PROCID(cd->procs, &req->pname)) { - continue; - } - /* never forward back to the source! This can happen if the source - * is a launcher - also, never forward to a peer that is no - * longer with us */ - if (NULL == req->peer->info || req->peer->finalized) { - continue; - } - if (PMIX_CHECK_PROCID(cd->procs, &req->peer->info->pname)) { - continue; - } - found = true; - /* setup the msg */ - if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - rc = PMIX_ERR_OUT_OF_RESOURCE; - break; - } - /* provide the source */ - PMIX_BFROPS_PACK(rc, req->peer, msg, cd->procs, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* provide the channel */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &cd->channels, 1, PMIX_IOF_CHANNEL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* pack the data */ - PMIX_BFROPS_PACK(rc, req->peer, msg, cd->bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* send it to the requestor */ - PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); + if (PMIX_OPERATION_SUCCEEDED == pmix_iof_process_iof(cd->channels, cd->procs, cd->bo, + cd->info, cd->ninfo, req)) { + /* flag that we do have at least one registrant for this info, + * so there is no need to cache it */ + found = true; } } @@ -1838,18 +1899,33 @@ static void _iofdeliver(int sd, short args, void *cbdata) iof = PMIX_NEW(pmix_iof_cache_t); memcpy(&iof->source, cd->procs, sizeof(pmix_proc_t)); iof->channel = cd->channels; - iof->bo = cd->bo; - cd->bo = NULL; // protect the data + /* copy the data */ + PMIX_BYTE_OBJECT_CREATE(iof->bo, 1); + iof->bo->bytes = (char*)malloc(cd->bo->size); + memcpy(iof->bo->bytes, cd->bo->bytes, cd->bo->size); + iof->bo->size = cd->bo->size; + if (0 < cd->ninfo) { + PMIX_INFO_CREATE(iof->info, cd->ninfo); + iof->ninfo = cd->ninfo; + for (n=0; n < iof->ninfo; n++) { + PMIX_INFO_XFER(&iof->info[n], &cd->info[n]); + } + } pmix_list_append(&pmix_server_globals.iof, &iof->super); } if (NULL != cd->opcbfunc) { - cd->opcbfunc(rc, cd->cbdata); - } - if (!cached) { - PMIX_RELEASE(cd); + cd->opcbfunc(PMIX_SUCCESS, cd->cbdata); } + + /* release the caddy */ + cd->procs = NULL; + cd->nprocs = 0; + cd->info = NULL; + cd->ninfo = 0; + cd->bo = NULL; + PMIX_RELEASE(cd); } pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, @@ -1859,48 +1935,18 @@ pmix_status_t PMIx_server_IOF_deliver(const pmix_proc_t *source, pmix_op_cbfunc_t cbfunc, void *cbdata) { pmix_setup_caddy_t *cd; - size_t n; /* need to threadshift this request */ cd = PMIX_NEW(pmix_setup_caddy_t); if (NULL == cd) { return PMIX_ERR_NOMEM; } - /* unfortunately, we need to copy the input because we - * might have to cache it for later delivery */ - PMIX_PROC_CREATE(cd->procs, 1); - if (NULL == cd->procs) { - PMIX_RELEASE(cd); - return PMIX_ERR_NOMEM; - } + cd->procs = (pmix_proc_t*)source; cd->nprocs = 1; - pmix_strncpy(cd->procs[0].nspace, source->nspace, PMIX_MAX_NSLEN); - cd->procs[0].rank = source->rank; cd->channels = channel; - PMIX_BYTE_OBJECT_CREATE(cd->bo, 1); - if (NULL == cd->bo) { - PMIX_RELEASE(cd); - return PMIX_ERR_NOMEM; - } - cd->nbo = 1; - cd->bo[0].bytes = (char*)malloc(bo->size); - if (NULL == cd->bo[0].bytes) { - PMIX_RELEASE(cd); - return PMIX_ERR_NOMEM; - } - memcpy(cd->bo[0].bytes, bo->bytes, bo->size); - cd->bo[0].size = bo->size; - if (0 < ninfo) { - PMIX_INFO_CREATE(cd->info, ninfo); - if (NULL == cd->info) { - PMIX_RELEASE(cd); - return PMIX_ERR_NOMEM; - } - cd->ninfo = ninfo; - for (n=0; n < ninfo; n++) { - PMIX_INFO_XFER(&cd->info[n], (pmix_info_t*)&info[n]); - } - } + cd->bo = (pmix_byte_object_t*)bo; + cd->info = (pmix_info_t*)info; + cd->ninfo = ninfo; cd->opcbfunc = cbfunc; cd->cbdata = cbdata; PMIX_THREADSHIFT(cd, _iofdeliver); @@ -2670,7 +2716,7 @@ static void _cnct(int sd, short args, void *cbdata) } PMIX_DESTRUCT(&cb); - if (PMIX_PROC_IS_V1(cd->peer) || PMIX_PROC_IS_V20(cd->peer)) { + if (PMIX_PEER_IS_V1(cd->peer) || PMIX_PEER_IS_V20(cd->peer)) { PMIX_BFROPS_PACK(rc, cd->peer, reply, &pbkt, 1, PMIX_BUFFER); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -3225,6 +3271,8 @@ static void _iofreg(int sd, short args, void *cbdata) pmix_server_caddy_t *scd = (pmix_server_caddy_t*)cd->cbdata; pmix_buffer_t *reply; pmix_status_t rc; + pmix_iof_req_t *req; + pmix_iof_cache_t *iof, *inxt; PMIX_ACQUIRE_OBJECT(cd); @@ -3245,7 +3293,18 @@ static void _iofreg(int sd, short args, void *cbdata) /* was the request a success? */ if (PMIX_SUCCESS != cd->status) { - /* find and remove the tracker(s) */ + /* find and remove the tracker */ + req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, cd->ncodes); + PMIX_RELEASE(req); + pmix_pointer_array_set_item(&pmix_globals.iof_requests, cd->ncodes, NULL); + } else { + /* return the reference ID for this handler */ + PMIX_BFROPS_PACK(rc, scd->peer, reply, &cd->ncodes, 1, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_RELEASE(reply); + goto cleanup; + } } pmix_output_verbose(2, pmix_server_globals.iof_output, @@ -3256,6 +3315,21 @@ static void _iofreg(int sd, short args, void *cbdata) PMIX_RELEASE(reply); } + /* if the request succeeded, then process any cached IO - doing it here + * guarantees that the IO will be received AFTER the client gets the + * refid response */ + if (PMIX_SUCCESS == cd->status) { + /* get the request */ + req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, cd->ncodes); + PMIX_LIST_FOREACH_SAFE(iof, inxt, &pmix_server_globals.iof, pmix_iof_cache_t) { + if (PMIX_OPERATION_SUCCEEDED == pmix_iof_process_iof(iof->channel, &iof->source, iof->bo, + iof->info, iof->ninfo, req)) { + pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); + PMIX_RELEASE(iof); + } + } + } + cleanup: /* release the cached info */ if (NULL != cd->procs) { @@ -3352,7 +3426,7 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, if (PMIX_COMMIT_CMD == cmd) { rc = pmix_server_commit(peer, buf); - if (!PMIX_PROC_IS_V1(peer)) { + if (!PMIX_PEER_IS_V1(peer)) { reply = PMIX_NEW(pmix_buffer_t); if (NULL == reply) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); @@ -3585,6 +3659,14 @@ static pmix_status_t server_switchyard(pmix_peer_t *peer, uint32_t tag, return rc; } + if (PMIX_IOF_DEREG_CMD == cmd) { + PMIX_GDS_CADDY(cd, peer, tag); + if (PMIX_SUCCESS != (rc = pmix_server_iofdereg(peer, buf, op_cbfunc, cd))) { + PMIX_RELEASE(cd); + } + return rc; + } + return PMIX_ERR_NOT_SUPPORTED; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c index c8fe13cdd6e..a968dddf206 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_get.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . @@ -121,8 +121,6 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, char *cptr; char nspace[PMIX_MAX_NSLEN+1]; pmix_namespace_t *ns, *nptr; - pmix_info_t *info=NULL; - size_t ninfo=0; pmix_dmdx_local_t *lcd; pmix_dmdx_request_t *req; bool local; @@ -160,34 +158,33 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, } /* retrieve any provided info structs */ cnt = 1; - PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &ninfo, &cnt, PMIX_SIZE); + PMIX_BFROPS_UNPACK(rc, cd->peer, buf, &cd->ninfo, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return rc; } - if (0 < ninfo) { - PMIX_INFO_CREATE(info, ninfo); - if (NULL == info) { + if (0 < cd->ninfo) { + PMIX_INFO_CREATE(cd->info, cd->ninfo); + if (NULL == cd->info) { PMIX_ERROR_LOG(PMIX_ERR_NOMEM); return PMIX_ERR_NOMEM; } - cnt = ninfo; - PMIX_BFROPS_UNPACK(rc, cd->peer, buf, info, &cnt, PMIX_INFO); + cnt = cd->ninfo; + PMIX_BFROPS_UNPACK(rc, cd->peer, buf, cd->info, &cnt, PMIX_INFO); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - PMIX_INFO_FREE(info, ninfo); return rc; } } /* search for directives we can deal with here */ - for (n=0; n < ninfo; n++) { - if (0 == strncmp(info[n].key, PMIX_IMMEDIATE, PMIX_MAX_KEYLEN)) { + for (n=0; n < cd->ninfo; n++) { + if (PMIX_CHECK_KEY(&cd->info[n], PMIX_IMMEDIATE)) { /* just check our own data - don't wait * or request it from someone else */ - localonly = PMIX_INFO_TRUE(&info[n]); - } else if (0 == strncmp(info[n].key, PMIX_TIMEOUT, PMIX_MAX_KEYLEN)) { - tv.tv_sec = info[n].value.data.uint32; + localonly = PMIX_INFO_TRUE(&cd->info[n]); + } else if (PMIX_CHECK_KEY(&cd->info[n], PMIX_TIMEOUT)) { + tv.tv_sec = cd->info[n].value.data.uint32; } } @@ -202,16 +199,13 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* check if the nspace of the requestor is different from * the nspace of the target process */ - if (!PMIX_CHECK_NSPACE(nspace, cd->peer->info->pname.nspace)) { - diffnspace = true; - } + diffnspace = !PMIX_CHECK_NSPACE(nspace, cd->peer->info->pname.nspace); pmix_output_verbose(2, pmix_server_globals.get_output, - "%s:%d EXECUTE GET FOR %s:%d ON BEHALF OF %s:%d", - pmix_globals.myid.nspace, - pmix_globals.myid.rank, nspace, rank, - cd->peer->info->pname.nspace, - cd->peer->info->pname.rank); + "%s EXECUTE GET FOR %s:%d ON BEHALF OF %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + nspace, rank, + PMIX_PNAME_PRINT(&cd->peer->info->pname)); /* This call flows upward from a local client If we don't * know about this nspace, then it cannot refer to the @@ -238,6 +232,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, if (localonly) { /* the user doesn't want us to look for the info, * so we simply return at this point */ + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s UNKNOWN NSPACE: LOCAL ONLY - NOT FOUND", + PMIX_NAME_PRINT(&pmix_globals.myid)); return PMIX_ERR_NOT_FOUND; } /* this is for an nspace we don't know about yet, so @@ -248,13 +245,15 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * the original requestor so they will get the data * back when we receive it */ rc = create_local_tracker(nspace, rank, - info, ninfo, + cd->info, cd->ninfo, cbfunc, cbdata, &lcd, &req); if (PMIX_ERR_NOMEM == rc) { - PMIX_INFO_FREE(info, ninfo); return rc; } if (PMIX_SUCCESS == rc) { + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s UNKNOWN NSPACE: DUPLICATE REQUEST - WAITING", + PMIX_NAME_PRINT(&pmix_globals.myid)); /* if they specified a timeout for this specific * request, set it up now */ if (0 < tv.tv_sec) { @@ -276,9 +275,11 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * up on its own, but at worst the direct modex * will simply overwrite the info later */ if (NULL != pmix_host_server.direct_modex) { - rc = pmix_host_server.direct_modex(&lcd->proc, info, ninfo, dmdx_cbfunc, lcd); + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s UNKNOWN NSPACE: REQUEST PASSED TO HOST", + PMIX_NAME_PRINT(&pmix_globals.myid)); + rc = pmix_host_server.direct_modex(&lcd->proc, cd->info, cd->ninfo, dmdx_cbfunc, lcd); if (PMIX_SUCCESS != rc) { - PMIX_INFO_FREE(info, ninfo); pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); PMIX_RELEASE(lcd); return rc; @@ -292,8 +293,10 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, req->event_active = true; } } else { - /* if we don't have direct modex feature, just respond with "not found" */ - PMIX_INFO_FREE(info, ninfo); + /* if we don't have direct modex feature, just respond with "not found" */ + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s UNKNOWN NSPACE: NO DMODEX AVAILABLE - NOT FOUND", + PMIX_NAME_PRINT(&pmix_globals.myid)); pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); PMIX_RELEASE(lcd); return PMIX_ERR_NOT_FOUND; @@ -306,6 +309,10 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * if the rank is wildcard, or the nspace is different, then * they are asking for the job-level info for this nspace - provide it */ if (PMIX_RANK_WILDCARD == rank || diffnspace) { + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s LOOKING FOR %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + diffnspace ? "WILDCARD RANK" : "DIFF NSPACE"); /* see if we have the job-level info - we won't have it * if we have no local procs and haven't already asked * for it, so there is no guarantee we have it */ @@ -317,29 +324,30 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * can retrieve the info from that GDS. Otherwise, * we need to retrieve it from our own */ PMIX_CONSTRUCT(&cb, pmix_cb_t); + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s GETTING JOB-DATA FOR %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(&proc)); /* this data is for a local client, so give the gds the * option of returning a complete copy of the data, * or returning a pointer to local storage */ cb.proc = &proc; cb.scope = PMIX_SCOPE_UNDEF; cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS != rc) { + cb.info = NULL; + cb.ninfo = 0; PMIX_DESTRUCT(&cb); return rc; } - /* if the requested rank is not WILDCARD, then retrieve the - * job-specific data for that rank - a scope of UNDEF - * will direct the GDS to provide it. Anything found will - * simply be added to the cb.kvs list */ - if (PMIX_RANK_WILDCARD != rank) { - proc.rank = rank; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - PMIX_DESTRUCT(&cb); - return rc; - } - } + /* store this as a byte object in the eventual data to + * be returned */ + PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); + cb.info = NULL; + cb.ninfo = 0; PMIX_CONSTRUCT(&pkt, pmix_buffer_t); /* assemble the provided data into a byte object */ PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); @@ -351,8 +359,7 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); PMIX_DESTRUCT(&pkt); /* pack it into the payload */ - PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - PMIX_BFROPS_PACK(rc, pmix_globals.mypeer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); + PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); free(bo.bytes); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); @@ -360,6 +367,52 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, PMIX_DESTRUCT(&cb); return rc; } + PMIX_DESTRUCT(&cb); + /* if the requested rank is not WILDCARD, then retrieve any + * posted data for that rank. Anything found will + * be added to the cb.kvs list */ + if (PMIX_RANK_WILDCARD != rank) { + PMIX_CONSTRUCT(&cb, pmix_cb_t); + proc.rank = rank; + cb.proc = &proc; + cb.scope = PMIX_LOCAL; + cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; + pmix_output_verbose(5, pmix_server_globals.get_output, + "%s GETTING DATA FOR %s", + PMIX_NAME_PRINT(&pmix_globals.myid), + PMIX_NAME_PRINT(&proc)); + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + if (PMIX_SUCCESS != rc) { + cb.info = NULL; + cb.ninfo = 0; + PMIX_DESTRUCT(&cb); + return rc; + } + cb.info = NULL; + cb.ninfo = 0; + PMIX_CONSTRUCT(&pkt, pmix_buffer_t); + /* assemble the provided data into a byte object */ + PMIX_GDS_ASSEMB_KVS_REQ(rc, pmix_globals.mypeer, &proc, &cb.kvs, &pkt, cd); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&cb); + return rc; + } + PMIX_UNLOAD_BUFFER(&pkt, bo.bytes, bo.size); + PMIX_DESTRUCT(&pkt); + /* pack it into the payload */ + PMIX_BFROPS_PACK(rc, cd->peer, &pbkt, &bo, 1, PMIX_BYTE_OBJECT); + free(bo.bytes); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + PMIX_DESTRUCT(&pbkt); + PMIX_DESTRUCT(&cb); + return rc; + } + PMIX_DESTRUCT(&cb); + } /* unload the resulting payload */ PMIX_UNLOAD_BUFFER(&pbkt, data, sz); PMIX_DESTRUCT(&pbkt); @@ -393,10 +446,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, } /* we cannot do anything further, so just track this request * for now */ - rc = create_local_tracker(nspace, rank, info, ninfo, + rc = create_local_tracker(nspace, rank, cd->info, cd->ninfo, cbfunc, cbdata, &lcd, &req); if (PMIX_ERR_NOMEM == rc) { - PMIX_INFO_FREE(info, ninfo); return rc; } pmix_output_verbose(2, pmix_server_globals.get_output, @@ -418,8 +470,6 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* if everyone has registered, see if we already have this data */ rc = _satisfy_request(nptr, rank, cd, cbfunc, cbdata, &local); if( PMIX_SUCCESS == rc ){ - /* request was successfully satisfied */ - PMIX_INFO_FREE(info, ninfo); /* return success as the satisfy_request function * calls the cbfunc for us, and it will have * released the cbdata object */ @@ -443,11 +493,10 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, /* Check to see if we already have a pending request for the data - if * we do, then we can just wait for it to arrive */ - rc = create_local_tracker(nspace, rank, info, ninfo, + rc = create_local_tracker(nspace, rank, cd->info, cd->ninfo, cbfunc, cbdata, &lcd, &req); if (PMIX_ERR_NOMEM == rc || NULL == lcd) { /* we have a problem */ - PMIX_INFO_FREE(info, ninfo); return PMIX_ERR_NOMEM; } /* if they specified a timeout, set it up now */ @@ -477,10 +526,9 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, * resource manager server to please get the info for us from * whomever is hosting the target process */ if (NULL != pmix_host_server.direct_modex) { - rc = pmix_host_server.direct_modex(&lcd->proc, info, ninfo, dmdx_cbfunc, lcd); + rc = pmix_host_server.direct_modex(&lcd->proc, cd->info, cd->ninfo, dmdx_cbfunc, lcd); if (PMIX_SUCCESS != rc) { /* may have a function entry but not support the request */ - PMIX_INFO_FREE(info, ninfo); pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); PMIX_RELEASE(lcd); } @@ -490,7 +538,6 @@ pmix_status_t pmix_server_get(pmix_buffer_t *buf, pmix_globals.myid.nspace, pmix_globals.myid.rank); /* if we don't have direct modex feature, just respond with "not found" */ - PMIX_INFO_FREE(info, ninfo); pmix_list_remove_item(&pmix_server_globals.local_reqs, &lcd->super); PMIX_RELEASE(lcd); rc = PMIX_ERR_NOT_FOUND; @@ -635,21 +682,22 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, * a remote peer, or due to data from a local client * having been committed */ PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); - pmix_strncpy(proc.nspace, nptr->nspace, PMIX_MAX_NSLEN); + PMIX_LOAD_NSPACE(proc.nspace, nptr->nspace); if (!PMIX_CHECK_NSPACE(nptr->nspace, cd->peer->info->pname.nspace)) { diffnspace = true; } - /* if rank is PMIX_RANK_UNDEF, then it was stored in our GDS */ - if (PMIX_RANK_UNDEF == rank) { + /* if rank is PMIX_RANK_UNDEF or is from a different nspace, + * then it was stored in our GDS */ + if (PMIX_RANK_UNDEF == rank || diffnspace) { scope = PMIX_GLOBAL; // we have to search everywhere peer = pmix_globals.mypeer; } else if (0 < nptr->nlocalprocs) { /* if we have local clients of this nspace, then we use * the corresponding GDS to retrieve the data. Otherwise, * the data will have been stored under our GDS */ - if (local) { + if (NULL != local) { *local = true; } if (PMIX_RANK_WILDCARD != rank) { @@ -668,9 +716,9 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, break; } } - if (PMIX_LOCAL != scope) { + if (NULL == peer) { /* this must be a remote rank */ - if (local) { + if (NULL != local) { *local = false; } scope = PMIX_REMOTE; @@ -678,7 +726,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, } } } else { - if (local) { + if (NULL != local) { *local = false; } peer = pmix_globals.mypeer; @@ -697,7 +745,11 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, cb.proc = &proc; cb.scope = PMIX_INTERNAL; cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); + cb.info = NULL; + cb.ninfo = 0; if (PMIX_SUCCESS == rc) { PMIX_CONSTRUCT(&pkt, pmix_buffer_t); /* assemble the provided data into a byte object */ @@ -709,7 +761,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, PMIX_DESTRUCT(&cb); return rc; } - if (PMIX_PROC_IS_V1(cd->peer)) { + if (PMIX_PEER_IS_V1(cd->peer)) { /* if the client is using v1, then it expects the * data returned to it as the rank followed by abyte object containing * a buffer - so we have to do a little gyration */ @@ -747,8 +799,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, /* retrieve the data for the specific rank they are asking about */ if (PMIX_RANK_WILDCARD != rank) { - if (!PMIX_PROC_IS_SERVER(peer) && 0 == peer->commit_cnt) { - PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + if (!PMIX_PEER_IS_SERVER(peer) && 0 == peer->commit_cnt) { /* this condition works only for local requests, server does * count commits for local ranks, and check this count when * local request. @@ -766,7 +817,11 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, cb.proc = &proc; cb.scope = scope; cb.copy = false; + cb.info = cd->info; + cb.ninfo = cd->ninfo; PMIX_GDS_FETCH_KV(rc, peer, &cb); + cb.info = NULL; + cb.ninfo = 0; if (PMIX_SUCCESS == rc) { found = true; PMIX_CONSTRUCT(&pkt, pmix_buffer_t); @@ -783,7 +838,7 @@ static pmix_status_t _satisfy_request(pmix_namespace_t *nptr, pmix_rank_t rank, PMIX_DESTRUCT(&cb); return rc; } - if (PMIX_PROC_IS_V1(cd->peer)) { + if (PMIX_PEER_IS_V1(cd->peer)) { /* if the client is using v1, then it expects the * data returned to it in a different order than v2 * - so we have to do a little gyration */ @@ -930,7 +985,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) /* find the nspace object for the proc whose data is being received */ nptr = NULL; PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { - if (0 == strcmp(caddy->lcd->proc.nspace, ns->nspace)) { + if (PMIX_CHECK_NSPACE(caddy->lcd->proc.nspace, ns->nspace)) { nptr = ns; break; } @@ -968,7 +1023,7 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) cd = (pmix_server_caddy_t*)dm->cbdata; found = false; PMIX_LIST_FOREACH(nm, &nspaces, pmix_nspace_caddy_t) { - if (0 == strcmp(nm->ns->nspace, cd->peer->nptr->nspace)) { + if (PMIX_CHECK_NSPACE(nm->ns->nspace, cd->peer->nptr->nspace)) { found = true; break; } @@ -982,9 +1037,12 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) } } /* now go thru each unique nspace and store the data using its - * assigned GDS component */ + * assigned GDS component - note that if the nspace of the requesting + * proc is different from the nspace of the proc whose data is being + * returned, then we have to store it into our hash tables */ PMIX_LIST_FOREACH(nm, &nspaces, pmix_nspace_caddy_t) { - if (NULL == nm->ns->compat.gds || 0 == nm->ns->nlocalprocs) { + if (NULL == nm->ns->compat.gds || 0 == nm->ns->nlocalprocs || + !PMIX_CHECK_NSPACE(nptr->nspace, nm->ns->nspace)) { peer = pmix_globals.mypeer; } else { /* there must be at least one local proc */ @@ -993,35 +1051,36 @@ static void _process_dmdx_reply(int fd, short args, void *cbdata) } PMIX_CONSTRUCT(&pbkt, pmix_buffer_t); if (NULL == caddy->data) { - /* we assume that the data was provided via a call to - * register_nspace, so what we need to do now is simply - * transfer it across to the individual nspace storage - * components */ - PMIX_CONSTRUCT(&cb, pmix_cb_t); - PMIX_PROC_CREATE(cb.proc, 1); - if (NULL == cb.proc) { - PMIX_ERROR_LOG(PMIX_ERR_NOMEM); - PMIX_DESTRUCT(&cb); - goto complete; - } - pmix_strncpy(cb.proc->nspace, nm->ns->nspace, PMIX_MAX_NSLEN); - cb.proc->rank = PMIX_RANK_WILDCARD; - cb.scope = PMIX_INTERNAL; - cb.copy = false; - PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_DESTRUCT(&cb); - goto complete; - } - PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { - PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_INTERNAL, kv); + if (peer != pmix_globals.mypeer) { + /* we assume that the data was provided via a call to + * register_nspace, so what we need to do now is simply + * transfer it across to the individual nspace storage + * components */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + PMIX_PROC_CREATE(cb.proc, 1); + if (NULL == cb.proc) { + PMIX_ERROR_LOG(PMIX_ERR_NOMEM); + PMIX_DESTRUCT(&cb); + goto complete; + } + PMIX_LOAD_PROCID(cb.proc, nm->ns->nspace, PMIX_RANK_WILDCARD); + cb.scope = PMIX_INTERNAL; + cb.copy = false; + PMIX_GDS_FETCH_KV(rc, pmix_globals.mypeer, &cb); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); - break; + PMIX_DESTRUCT(&cb); + goto complete; + } + PMIX_LIST_FOREACH(kv, &cb.kvs, pmix_kval_t) { + PMIX_GDS_STORE_KV(rc, peer, &caddy->lcd->proc, PMIX_INTERNAL, kv); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + break; + } } + PMIX_DESTRUCT(&cb); } - PMIX_DESTRUCT(&cb); } else { PMIX_LOAD_BUFFER(pmix_globals.mypeer, &pbkt, caddy->data, caddy->ndata); /* unpack and store it*/ diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c index 37ec6c5b412..31de2c365d0 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.c @@ -1,13 +1,13 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014-2015 Artem Y. Polyakov . * All rights reserved. * Copyright (c) 2016-2017 Mellanox Technologies, Inc. * All rights reserved. - * Copyright (c) 2016 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -56,6 +56,7 @@ #include "src/mca/bfrops/bfrops.h" #include "src/mca/plog/plog.h" #include "src/mca/psensor/psensor.h" +#include "src/mca/ptl/base/base.h" #include "src/util/argv.h" #include "src/util/error.h" #include "src/util/output.h" @@ -372,10 +373,11 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, { pmix_server_trkr_t *trk; size_t i; - bool all_def; + bool all_def, found; pmix_namespace_t *nptr, *ns; pmix_rank_info_t *info; - pmix_rank_t ns_local = 0; + pmix_nspace_caddy_t *nm; + pmix_nspace_t first; pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker called with %d procs", (int)nprocs); @@ -413,16 +415,12 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, trk->npcs = nprocs; } trk->type = type; + trk->local = false; + trk->nlocal = 0; all_def = true; + PMIX_LOAD_NSPACE(first, NULL); for (i=0; i < nprocs; i++) { - if (NULL == id) { - pmix_strncpy(trk->pcs[i].nspace, procs[i].nspace, PMIX_MAX_NSLEN); - trk->pcs[i].rank = procs[i].rank; - } - if (!all_def) { - continue; - } /* is this nspace known to us? */ nptr = NULL; PMIX_LIST_FOREACH(ns, &pmix_globals.nspaces, pmix_namespace_t) { @@ -431,14 +429,96 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, break; } } + /* check if multiple nspaces are involved in this operation */ + if (0 == strlen(first)) { + PMIX_LOAD_NSPACE(first, procs[i].nspace); + } else if (!PMIX_CHECK_NSPACE(first, procs[i].nspace)) { + trk->hybrid = true; + } if (NULL == nptr) { - /* cannot be a local proc */ + /* we don't know about this nspace. If there is going to + * be at least one local process participating in a fence, + * they we require that either at least one process must already + * have been registered (via "register client") or that the + * nspace itself have been regisered. So either the nspace + * wasn't registered because it doesn't include any local + * procs, or our host has not been told about this nspace + * because it won't host any local procs. We therefore mark + * this tracker as including non-local participants. + * + * NOTE: It is conceivable that someone might want to review + * this constraint at a future date. I believe it has to be + * required (at least for now) as otherwise we wouldn't have + * a way of knowing when all local procs have participated. + * It is possible that a new nspace could come along at some + * later time and add more local participants - but we don't + * know how long to wait. + * + * The only immediately obvious alternative solutions would + * be to either require that RMs always inform all daemons + * about the launch of nspaces, regardless of whether or + * not they will host local procs; or to drop the aggregation + * of local participants and just pass every fence call + * directly to the host. Neither of these seems palatable + * at this time. */ + trk->local = false; + /* we don't know any more info about this nspace, so + * there isn't anything more we can do */ + continue; + } + /* it is possible we know about this nspace because the host + * has registered one or more clients via "register_client", + * but the host has not yet called "register_nspace". There is + * a very tiny race condition whereby this can happen due + * to event-driven processing, but account for it here */ + if (SIZE_MAX == nptr->nlocalprocs) { + /* delay processing until this nspace is registered */ + all_def = false; + continue; + } + if (0 == nptr->nlocalprocs) { + /* the host has informed us that this nspace has no local procs */ pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker: unknown nspace %s", procs[i].nspace); continue; } - /* have all the clients for this nspace been defined? */ + /* check and add uniq ns into trk nslist */ + found = false; + PMIX_LIST_FOREACH(nm, &trk->nslist, pmix_nspace_caddy_t) { + if (0 == strcmp(nptr->nspace, nm->ns->nspace)) { + found = true; + break; + } + } + if (!found) { + nm = PMIX_NEW(pmix_nspace_caddy_t); + PMIX_RETAIN(nptr); + nm->ns = nptr; + pmix_list_append(&trk->nslist, &nm->super); + } + + /* if they want all the local members of this nspace, then + * add them in here. They told us how many procs will be + * local to us from this nspace, but we don't know their + * ranks. So as long as they want _all_ of them, we can + * handle that case regardless of whether the individual + * clients have been "registered" */ + if (PMIX_RANK_WILDCARD == procs[i].rank) { + trk->nlocal += nptr->nlocalprocs; + /* the total number of procs in this nspace was provided + * in the data blob delivered to register_nspace, so check + * to see if all the procs are local */ + if (nptr->nprocs != nptr->nlocalprocs) { + trk->local = false; + } + continue; + } + + /* They don't want all the local clients, or they are at + * least listing them individually. Check if all the clients + * for this nspace have been registered via "register_client" + * so we know the specific ranks on this node */ if (!nptr->all_registered) { /* nope, so no point in going further on this one - we'll * process it once all the procs are known */ @@ -446,40 +526,26 @@ static pmix_server_trkr_t* new_tracker(char *id, pmix_proc_t *procs, pmix_output_verbose(5, pmix_server_globals.base_output, "new_tracker: all clients not registered nspace %s", procs[i].nspace); - /* we have to continue processing the list of procs - * to setup the trk->pcs array, so don't break out - * of the loop */ + continue; } /* is this one of my local ranks? */ - ns_local = 0; + found = false; PMIX_LIST_FOREACH(info, &nptr->ranks, pmix_rank_info_t) { - if (procs[i].rank == info->pname.rank || - PMIX_RANK_WILDCARD == procs[i].rank) { - pmix_output_verbose(5, pmix_server_globals.base_output, - "adding local proc %s.%d to tracker", - info->pname.nspace, info->pname.rank); + if (procs[i].rank == info->pname.rank) { + pmix_output_verbose(5, pmix_server_globals.base_output, + "adding local proc %s.%d to tracker", + info->pname.nspace, info->pname.rank); + found = true; /* track the count */ - ns_local++; - if (PMIX_RANK_WILDCARD != procs[i].rank) { - break; - } + trk->nlocal++; + break; } } - - trk->nlocal += ns_local; - if (!ns_local) { + if (!found) { trk->local = false; - } else if (PMIX_RANK_WILDCARD == procs[i].rank) { - /* If proc is a wildcard we need to additionally check - * that all of the processes in the namespace were - * locally found. - * Otherwise this tracker is not local - */ - if (ns_local != nptr->nprocs) { - trk->local = false; - } } } + if (all_def) { trk->def_complete = true; } @@ -664,8 +730,8 @@ pmix_status_t pmix_server_fence(pmix_server_caddy_t *cd, * across all participants has been completed */ if (trk->def_complete && pmix_list_get_size(&trk->local_cbs) == trk->nlocal) { - pmix_output_verbose(2, pmix_server_globals.base_output, - "fence complete"); + pmix_output_verbose(2, pmix_server_globals.fence_output, + "fence LOCALLY complete"); /* if this is a purely local fence (i.e., all participants are local), * then it is done and we notify accordingly */ if (trk->local) { @@ -1148,11 +1214,12 @@ static void spcbfunc(pmix_status_t status, goto cleanup; } PMIX_RETAIN(cd->peer); - req->peer = cd->peer; - req->pname.nspace = strdup(nspace); - req->pname.rank = PMIX_RANK_WILDCARD; + req->requestor = cd->peer; + req->nprocs = 1; + PMIX_PROC_CREATE(req->procs, req->nprocs); + PMIX_LOAD_PROCID(&req->procs[0], nspace, PMIX_RANK_WILDCARD); req->channels = cd->channels; - pmix_list_append(&pmix_globals.iof_requests, &req->super); + req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); /* process any cached IO */ PMIX_LIST_FOREACH_SAFE(iof, ionext, &pmix_server_globals.iof, pmix_iof_cache_t) { /* if the channels don't match, then ignore it */ @@ -1160,18 +1227,19 @@ static void spcbfunc(pmix_status_t status, continue; } /* if the source does not match the request, then ignore it */ - if (!PMIX_CHECK_PROCID(&iof->source, &req->pname)) { + if (!PMIX_CHECK_PROCID(&iof->source, &req->procs[0])) { continue; } /* never forward back to the source! This can happen if the source * is a launcher */ - if (PMIX_CHECK_PROCID(&iof->source, &req->peer->info->pname)) { + if (PMIX_CHECK_PROCID(&iof->source, &req->requestor->info->pname)) { continue; } pmix_output_verbose(2, pmix_server_globals.iof_output, "PMIX:SERVER:SPAWN delivering cached IOF from %s:%d to %s:%d", iof->source.nspace, iof->source.rank, - req->pname.nspace, req->pname.rank); + req->requestor->info->pname.nspace, + req->requestor->info->pname.rank); /* setup the msg */ if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); @@ -1179,28 +1247,28 @@ static void spcbfunc(pmix_status_t status, break; } /* provide the source */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->source, 1, PMIX_PROC); + PMIX_BFROPS_PACK(rc, req->requestor, msg, &iof->source, 1, PMIX_PROC); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); break; } /* provide the channel */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->channel, 1, PMIX_IOF_CHANNEL); + PMIX_BFROPS_PACK(rc, req->requestor, msg, &iof->channel, 1, PMIX_IOF_CHANNEL); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); break; } /* pack the data */ - PMIX_BFROPS_PACK(rc, req->peer, msg, iof->bo, 1, PMIX_BYTE_OBJECT); + PMIX_BFROPS_PACK(rc, req->requestor, msg, iof->bo, 1, PMIX_BYTE_OBJECT); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); break; } /* send it to the requestor */ - PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); + PMIX_PTL_SEND_ONEWAY(rc, req->requestor, msg, PMIX_PTL_TAG_IOF); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); PMIX_RELEASE(msg); @@ -1310,7 +1378,7 @@ pmix_status_t pmix_server_spawn(pmix_peer_t *peer, * as we need the nspace of the spawned application! */ } /* add the directive to the end */ - if (PMIX_PROC_IS_TOOL(peer)) { + if (PMIX_PEER_IS_TOOL(peer)) { PMIX_INFO_LOAD(&cd->info[ninfo], PMIX_REQUESTOR_IS_TOOL, NULL, PMIX_BOOL); /* if the requestor is a tool, we default to forwarding all * output IO channels */ @@ -2541,12 +2609,16 @@ pmix_status_t pmix_server_log(pmix_peer_t *peer, } cd->cbfunc.opcbfn = cbfunc; cd->cbdata = cbdata; - /* unpack the timestamp */ - cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, buf, ×tamp, &cnt, PMIX_TIME); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - goto exit; + if (PMIX_PEER_IS_EARLIER(peer, 3, 0, 0)) { + timestamp = -1; + } else { + /* unpack the timestamp */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, ×tamp, &cnt, PMIX_TIME); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } } /* unpack the number of data */ @@ -3207,10 +3279,6 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, pmix_status_t rc; pmix_setup_caddy_t *cd; pmix_iof_req_t *req; - bool notify, match; - size_t n; - pmix_buffer_t *msg; - pmix_iof_cache_t *iof, *ionext; pmix_output_verbose(2, pmix_server_globals.iof_output, "recvd IOF PULL request from client"); @@ -3269,108 +3337,105 @@ pmix_status_t pmix_server_iofreg(pmix_peer_t *peer, goto exit; } - /* check to see if we have already registered this source/channel combination */ - notify = false; - for (n=0; n < cd->nprocs; n++) { - match = false; - PMIX_LIST_FOREACH(req, &pmix_globals.iof_requests, pmix_iof_req_t) { - /* is this request from the same peer? */ - if (peer != req->peer) { - continue; - } - /* do we already have this source for this peer? */ - if (PMIX_CHECK_PROCID(&cd->procs[n], &req->pname)) { - match = true; - if ((req->channels & cd->channels) != cd->channels) { - /* this is a channel update */ - req->channels |= cd->channels; - /* we need to notify the host */ - notify = true; - } - break; - } - } - /* if we didn't find the matching entry, then add it */ - if (!match) { - /* record the request */ - req = PMIX_NEW(pmix_iof_req_t); - if (NULL == req) { - rc = PMIX_ERR_NOMEM; - goto exit; - } - PMIX_RETAIN(peer); - req->peer = peer; - req->pname.nspace = strdup(cd->procs[n].nspace); - req->pname.rank = cd->procs[n].rank; - req->channels = cd->channels; - pmix_list_append(&pmix_globals.iof_requests, &req->super); - } - /* process any cached IO */ - PMIX_LIST_FOREACH_SAFE(iof, ionext, &pmix_server_globals.iof, pmix_iof_cache_t) { - /* if the channels don't match, then ignore it */ - if (!(iof->channel & req->channels)) { - continue; - } - /* if the source does not match the request, then ignore it */ - if (!PMIX_CHECK_PROCID(&iof->source, &req->pname)) { - continue; - } - /* never forward back to the source! This can happen if the source - * is a launcher */ - if (PMIX_CHECK_PROCID(&iof->source, &req->peer->info->pname)) { - continue; - } - pmix_output_verbose(2, pmix_server_globals.iof_output, - "PMIX:SERVER:IOFREQ delivering cached IOF from %s:%d to %s:%d", - iof->source.nspace, iof->source.rank, - req->peer->info->pname.nspace, req->peer->info->pname.rank); - /* setup the msg */ - if (NULL == (msg = PMIX_NEW(pmix_buffer_t))) { - PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE); - rc = PMIX_ERR_OUT_OF_RESOURCE; - break; - } - /* provide the source */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->source, 1, PMIX_PROC); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* provide the channel */ - PMIX_BFROPS_PACK(rc, req->peer, msg, &iof->channel, 1, PMIX_IOF_CHANNEL); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* pack the data */ - PMIX_BFROPS_PACK(rc, req->peer, msg, iof->bo, 1, PMIX_BYTE_OBJECT); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - break; - } - /* send it to the requestor */ - PMIX_PTL_SEND_ONEWAY(rc, req->peer, msg, PMIX_PTL_TAG_IOF); - if (PMIX_SUCCESS != rc) { - PMIX_ERROR_LOG(rc); - PMIX_RELEASE(msg); - } - /* remove it from the list since it has now been forwarded */ - pmix_list_remove_item(&pmix_server_globals.iof, &iof->super); - PMIX_RELEASE(iof); - } + /* add this peer/source/channel combination */ + req = PMIX_NEW(pmix_iof_req_t); + if (NULL == req) { + rc = PMIX_ERR_NOMEM; + goto exit; + } + PMIX_RETAIN(peer); + req->requestor = peer; + req->nprocs = cd->nprocs; + if (0 < req->nprocs) { + PMIX_PROC_CREATE(req->procs, cd->nprocs); + memcpy(req->procs, cd->procs, req->nprocs * sizeof(pmix_proc_t)); + } + req->channels = cd->channels; + req->refid = pmix_pointer_array_add(&pmix_globals.iof_requests, req); + cd->ncodes = req->refid; + + /* ask the host to execute the request */ + if (PMIX_SUCCESS != (rc = pmix_host_server.iof_pull(cd->procs, cd->nprocs, + cd->info, cd->ninfo, + cd->channels, + cbfunc, cd))) { + goto exit; } - if (notify) { - /* ask the host to execute the request */ - if (PMIX_SUCCESS != (rc = pmix_host_server.iof_pull(cd->procs, cd->nprocs, - cd->info, cd->ninfo, - cd->channels, - cbfunc, cd))) { + return PMIX_SUCCESS; + + exit: + PMIX_RELEASE(cd); + return rc; +} + +pmix_status_t pmix_server_iofdereg(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata) +{ + int32_t cnt; + pmix_status_t rc; + pmix_setup_caddy_t *cd; + pmix_iof_req_t *req; + size_t ninfo, refid; + + pmix_output_verbose(2, pmix_server_globals.iof_output, + "recvd IOF DEREGISTER from client"); + + if (NULL == pmix_host_server.iof_pull) { + return PMIX_ERR_NOT_SUPPORTED; + } + + cd = PMIX_NEW(pmix_setup_caddy_t); + if (NULL == cd) { + return PMIX_ERR_NOMEM; + } + cd->cbdata = cbdata; // this is the pmix_server_caddy_t + + /* unpack the number of directives */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } + /* unpack the directives - note that we have to add one + * to tell the server to stop forwarding to this channel */ + cd->ninfo = ninfo + 1; + PMIX_INFO_CREATE(cd->info, cd->ninfo); + if (0 < ninfo) { + cnt = ninfo; + PMIX_BFROPS_UNPACK(rc, peer, buf, cd->info, &cnt, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); goto exit; } } + /* add the directive to stop forwarding */ + PMIX_INFO_LOAD(&cd->info[ninfo], PMIX_IOF_STOP, NULL, PMIX_BOOL); + + /* unpack the handler ID */ + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto exit; + } + + /* get the referenced handler */ + req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid); + if (NULL == req) { + /* already gone? */ + rc = PMIX_ERR_NOT_FOUND; + goto exit; + } + /* tell the server to stop */ + if (PMIX_SUCCESS != (rc = pmix_host_server.iof_pull(cd->procs, cd->nprocs, + cd->info, cd->ninfo, + cd->channels, + cbfunc, cd))) { + goto exit; + } return PMIX_SUCCESS; exit: @@ -3502,6 +3567,7 @@ static void tcon(pmix_server_trkr_t *t) t->pname.rank = PMIX_RANK_UNDEF; t->pcs = NULL; t->npcs = 0; + PMIX_CONSTRUCT(&t->nslist, pmix_list_t); PMIX_CONSTRUCT_LOCK(&t->lock); t->def_complete = false; PMIX_CONSTRUCT(&t->local_cbs, pmix_list_t); @@ -3520,6 +3586,7 @@ static void tdes(pmix_server_trkr_t *t) if (NULL != t->id) { free(t->id); } + PMIX_LIST_DESTRUCT(&t->nslist); PMIX_DESTRUCT_LOCK(&t->lock); if (NULL != t->pcs) { free(t->pcs); @@ -3539,6 +3606,8 @@ static void cdcon(pmix_server_caddy_t *cd) cd->event_active = false; cd->trk = NULL; cd->peer = NULL; + cd->info = NULL; + cd->ninfo = 0; } static void cddes(pmix_server_caddy_t *cd) { @@ -3556,7 +3625,6 @@ PMIX_CLASS_INSTANCE(pmix_server_caddy_t, pmix_list_item_t, cdcon, cddes); - static void scadcon(pmix_setup_caddy_t *p) { p->peer = NULL; @@ -3757,10 +3825,15 @@ PMIX_CLASS_INSTANCE(pmix_inventory_rollup_t, static void iocon(pmix_iof_cache_t *p) { p->bo = NULL; + p->info = NULL; + p->ninfo = 0; } static void iodes(pmix_iof_cache_t *p) { PMIX_BYTE_OBJECT_FREE(p->bo, 1); // macro protects against NULL + if (0 < p->ninfo) { + PMIX_INFO_FREE(p->info, p->ninfo); + } } PMIX_CLASS_INSTANCE(pmix_iof_cache_t, pmix_list_item_t, diff --git a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h index 06fddc1fe96..a7f0be96ec6 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h +++ b/opal/mca/pmix/pmix3x/pmix/src/server/pmix_server_ops.h @@ -148,6 +148,8 @@ typedef struct { pmix_proc_t source; pmix_iof_channel_t channel; pmix_byte_object_t *bo; + pmix_info_t *info; + size_t ninfo; } pmix_iof_cache_t; PMIX_CLASS_DECLARATION(pmix_iof_cache_t); @@ -323,6 +325,11 @@ pmix_status_t pmix_server_iofstdin(pmix_peer_t *peer, pmix_op_cbfunc_t cbfunc, void *cbdata); +pmix_status_t pmix_server_iofdereg(pmix_peer_t *peer, + pmix_buffer_t *buf, + pmix_op_cbfunc_t cbfunc, + void *cbdata); + pmix_status_t pmix_server_event_recvd_from_client(pmix_peer_t *peer, pmix_buffer_t *buf, pmix_op_cbfunc_t cbfunc, diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index 585ea08fe49..956b16113a1 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -196,14 +196,18 @@ static void tool_iof_handler(struct pmix_peer_t *pr, pmix_byte_object_t bo; int32_t cnt; pmix_status_t rc; + size_t refid, ninfo=0; + pmix_iof_req_t *req; + pmix_info_t *info; pmix_output_verbose(2, pmix_client_globals.iof_output, "recvd IOF with %d bytes", (int)buf->bytes_used); - /* if the buffer is empty, they are simply closing the channel */ + /* if the buffer is empty, they are simply closing the socket */ if (0 == buf->bytes_used) { return; } + PMIX_BYTE_OBJECT_CONSTRUCT(&bo); cnt = 1; PMIX_BFROPS_UNPACK(rc, peer, buf, &source, &cnt, PMIX_PROC); @@ -218,13 +222,52 @@ static void tool_iof_handler(struct pmix_peer_t *pr, return; } cnt = 1; - PMIX_BFROPS_UNPACK(rc, peer, buf, &bo, &cnt, PMIX_BYTE_OBJECT); + PMIX_BFROPS_UNPACK(rc, peer, buf, &refid, &cnt, PMIX_SIZE); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + return; + } + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &ninfo, &cnt, PMIX_SIZE); if (PMIX_SUCCESS != rc) { PMIX_ERROR_LOG(rc); return; } - if (NULL != bo.bytes && 0 < bo.size) { - pmix_iof_write_output(&source, channel, &bo, NULL); + if (0 < ninfo) { + PMIX_INFO_CREATE(info, ninfo); + cnt = ninfo; + PMIX_BFROPS_UNPACK(rc, peer, buf, info, &cnt, PMIX_INFO); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + } + cnt = 1; + PMIX_BFROPS_UNPACK(rc, peer, buf, &bo, &cnt, PMIX_BYTE_OBJECT); + if (PMIX_SUCCESS != rc) { + PMIX_ERROR_LOG(rc); + goto cleanup; + } + /* lookup the handler for this IOF package */ + if (NULL == (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid))) { + /* something wrong here - should not happen */ + PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); + goto cleanup; + } + /* if the handler invokes a callback function, do so */ + if (NULL != req->cbfunc) { + req->cbfunc(refid, channel, &source, &bo, info, ninfo); + } else { + /* otherwise, simply write it out to the specified std IO channel */ + if (NULL != bo.bytes && 0 < bo.size) { + pmix_iof_write_output(&source, channel, &bo, NULL); + } + } + + cleanup: + /* cleanup the memory */ + if (0 < ninfo) { + PMIX_INFO_FREE(info, ninfo); } PMIX_BYTE_OBJECT_DESTRUCT(&bo); } @@ -275,7 +318,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_ptl_posted_recv_t *rcv; pmix_proc_t wildcard; int fd; - pmix_proc_type_t ptype; + pmix_proc_type_t ptype = PMIX_PROC_TYPE_STATIC_INIT; pmix_cb_t cb; pmix_buffer_t *req; pmix_cmd_t cmd = PMIX_REQ_CMD; @@ -301,7 +344,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* parse the input directives */ gdsfound = false; - ptype = PMIX_PROC_TOOL; + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_TOOL); if (NULL != info) { for (n=0; n < ninfo; n++) { if (0 == strncmp(info[n].key, PMIX_GDS_MODULE, PMIX_MAX_KEYLEN)) { @@ -328,7 +371,9 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* they want us to forward our stdin to someone */ fwd_stdin = true; } else if (0 == strncmp(info[n].key, PMIX_LAUNCHER, PMIX_MAX_KEYLEN)) { - ptype |= PMIX_PROC_LAUNCHER; + if (PMIX_INFO_TRUE(&info[n])) { + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_LAUNCHER); + } } else if (0 == strncmp(info[n].key, PMIX_SERVER_TMPDIR, PMIX_MAX_KEYLEN)) { pmix_server_globals.tmpdir = strdup(info[n].value.data.string); } else if (0 == strncmp(info[n].key, PMIX_SYSTEM_TMPDIR, PMIX_MAX_KEYLEN)) { @@ -389,7 +434,11 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, return PMIX_ERR_BAD_PARAM; } /* flag that this tool is also a client */ - ptype |= PMIX_PROC_CLIENT_TOOL; + if (PMIX_PROC_IS_LAUNCHER(&ptype)) { + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_CLIENT_LAUNCHER); + } else { + PMIX_SET_PROC_TYPE(&ptype, PMIX_PROC_CLIENT_TOOL); + } } else if (nspace_in_enviro) { /* this is an error - we can't have one and not * the other */ @@ -407,7 +456,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* if we are a launcher, then we also need to act as a server, * so setup the server-related structures here */ - if (PMIX_PROC_LAUNCHER_ACT & ptype) { + if (PMIX_PROC_IS_LAUNCHER(&ptype)) { if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { PMIX_ERROR_LOG(rc); if (NULL != nspace) { @@ -425,7 +474,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, /* setup the runtime - this init's the globals, * opens and initializes the required frameworks */ - if (PMIX_SUCCESS != (rc = pmix_rte_init(ptype, info, ninfo, + if (PMIX_SUCCESS != (rc = pmix_rte_init(ptype.type, info, ninfo, pmix_tool_notify_recv))) { PMIX_ERROR_LOG(rc); if (NULL != nspace) { @@ -486,7 +535,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_output_verbose(2, pmix_globals.debug_output, "pmix: init called"); - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { /* if we are a client, then we need to pickup the * rest of the envar-based server assignments */ pmix_globals.pindex = -1; @@ -576,6 +625,25 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, return PMIX_ERR_INIT; } + /* if we are a launcher, then we also need to act as a server, + * so setup the server-related structures here */ + if (PMIX_PROC_IS_LAUNCHER(&ptype) || + PMIX_PROC_IS_CLIENT_LAUNCHER(&ptype)) { + if (PMIX_SUCCESS != (rc = pmix_server_initialize())) { + PMIX_ERROR_LOG(rc); + if (NULL != nspace) { + free(nspace); + } + if (gdsfound) { + PMIX_INFO_DESTRUCT(&ginfo); + } + PMIX_RELEASE_THREAD(&pmix_global_lock); + return rc; + } + /* setup the function pointers */ + memset(&pmix_host_server, 0, sizeof(pmix_server_module_t)); + } + if (do_not_connect) { /* ensure we mark that we are not connected */ pmix_globals.connected = false; @@ -613,7 +681,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, pmix_globals.mypeer->info->pname.rank = pmix_globals.myid.rank; /* if we are acting as a server, then start listening */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* setup the wildcard recv for inbound messages from clients */ rcv = PMIX_NEW(pmix_ptl_posted_recv_t); rcv->tag = UINT32_MAX; @@ -712,7 +780,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, * job info - we do this as a non-blocking * transaction because some systems cannot handle very large * blocking operations and error out if we try them. */ - if (PMIX_PROC_IS_CLIENT(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_CLIENT(pmix_globals.mypeer)) { req = PMIX_NEW(pmix_buffer_t); PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver, req, &cmd, 1, PMIX_COMMAND); @@ -775,7 +843,7 @@ PMIX_EXPORT int PMIx_tool_init(pmix_proc_t *proc, PMIX_RELEASE_THREAD(&pmix_global_lock); /* if we are acting as a server, then start listening */ - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { /* start listening for connections */ if (PMIX_SUCCESS != pmix_ptl_base_start_listening(info, ninfo)) { pmix_show_help("help-pmix-server.txt", "listener-thread-start", true); @@ -1213,7 +1281,7 @@ PMIX_EXPORT pmix_status_t PMIx_tool_finalize(void) } } - if (PMIX_PROC_IS_LAUNCHER(pmix_globals.mypeer)) { + if (PMIX_PEER_IS_LAUNCHER(pmix_globals.mypeer)) { pmix_ptl_base_stop_listening(); for (n=0; n < pmix_server_globals.clients.size; n++) { diff --git a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am index 343cfaa3b84..71846055983 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/src/tools/pmix_info/Makefile.am @@ -19,13 +19,22 @@ # $HEADER$ # +if SOURCE_DATE_EPOCH_SET + USER = @PMIX_CONFIGURE_USER@ + PMIX_BUILD_HOST = @PMIX_CONFIGURE_HOST@ + PMIX_BUILD_DATE = @PMIX_CONFIGURE_DATE@ +else + PMIX_BUILD_HOST = `(hostname || uname -n) 2> /dev/null | sed 1q` + PMIX_BUILD_DATE = `date +%Y-%m-%dT%H:%M:%S` +endif + AM_CFLAGS = \ -DPMIX_CONFIGURE_USER="\"@PMIX_CONFIGURE_USER@\"" \ -DPMIX_CONFIGURE_HOST="\"@PMIX_CONFIGURE_HOST@\"" \ -DPMIX_CONFIGURE_DATE="\"@PMIX_CONFIGURE_DATE@\"" \ - -DPMIX_BUILD_USER="\"$$USER\"" \ - -DPMIX_BUILD_HOST="\"`(hostname || uname -n) 2> /dev/null | sed 1q`\"" \ - -DPMIX_BUILD_DATE="\"`date`\"" \ + -DPMIX_BUILD_USER="\"$(USER)\"" \ + -DPMIX_BUILD_HOST="\"$(PMIX_BUILD_HOST)\"" \ + -DPMIX_BUILD_DATE="\"$(PMIX_BUILD_DATE)\"" \ -DPMIX_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DPMIX_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ -DPMIX_BUILD_LDFLAGS="\"@LDFLAGS@\"" \ diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c b/opal/mca/pmix/pmix3x/pmix/src/util/compress.c index d71cdf37c63..7089fb77c32 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/compress.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/compress.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Intel, Inc. All rights reserved. * Copyright (c) 2017 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -43,7 +43,15 @@ bool pmix_util_compress_string(char *instring, /* get an upper bound on the required output storage */ len = deflateBound(&strm, inlen); + /* if this isn't going to result in a smaller footprint, + * then don't do it */ + if (len >= inlen) { + (void)deflateEnd(&strm); + return false; + } + if (NULL == (tmp = (uint8_t*)malloc(len))) { + (void)deflateEnd(&strm); return false; } strm.next_in = (uint8_t*)instring; @@ -55,8 +63,8 @@ bool pmix_util_compress_string(char *instring, strm.next_out = tmp; rc = deflate (&strm, Z_FINISH); - deflateEnd (&strm); - if (Z_OK != rc) { + (void)deflateEnd (&strm); + if (Z_OK != rc && Z_STREAM_END != rc) { free(tmp); return false; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c index 96b46ea9d58..7e51f7461ed 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c +++ b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.c @@ -27,6 +27,7 @@ #include "pmix_common.h" #include "src/threads/tsd.h" +#include "src/include/pmix_globals.h" #include "src/util/error.h" #include "src/util/name_fns.h" #include "src/util/printf.h" @@ -94,7 +95,7 @@ get_print_name_buffer(void) return (pmix_print_args_buffers_t*) ptr; } -char* pmix_util_print_name_args(const pmix_proc_t *name) +static char* print_args(char *ns, pmix_rank_t rnk) { pmix_print_args_buffers_t *ptr; char *rank; @@ -107,8 +108,8 @@ char* pmix_util_print_name_args(const pmix_proc_t *name) return pmix_print_args_null; } - /* protect against NULL names */ - if (NULL == name) { + /* protect against NULL nspace */ + if (NULL == ns) { index = ptr->cntr; snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, "[NO-NAME]"); ptr->cntr++; @@ -118,12 +119,12 @@ char* pmix_util_print_name_args(const pmix_proc_t *name) return ptr->buffers[index]; } - rank = pmix_util_print_rank(name->rank); + rank = pmix_util_print_rank(rnk); index = ptr->cntr; snprintf(ptr->buffers[index], PMIX_PRINT_NAME_ARGS_MAX_SIZE, - "[%s:%s]", name->nspace, rank); + "[%s:%s]", ns, rank); ptr->cntr++; if (PMIX_PRINT_NAME_ARG_NUM_BUFS == ptr->cntr) { ptr->cntr = 0; @@ -132,6 +133,24 @@ char* pmix_util_print_name_args(const pmix_proc_t *name) return ptr->buffers[index]; } +char* pmix_util_print_name_args(const pmix_proc_t *name) +{ + if (NULL == name) { + return print_args(NULL, PMIX_RANK_UNDEF); + } + + return print_args((char*)name->nspace, name->rank); +} + +char *pmix_util_print_pname_args(const pmix_name_t *name) +{ + if (NULL == name) { + return print_args(NULL, PMIX_RANK_UNDEF); + } + + return print_args((char*)name->nspace, name->rank); +} + char* pmix_util_print_rank(const pmix_rank_t vpid) { pmix_print_args_buffers_t *ptr; diff --git a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h index 4fa01e0c08e..e03e4da3b6c 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h +++ b/opal/mca/pmix/pmix3x/pmix/src/util/name_fns.h @@ -12,7 +12,7 @@ * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -30,6 +30,7 @@ #endif #include "pmix_common.h" +#include "src/include/pmix_globals.h" BEGIN_C_DECLS @@ -38,6 +39,10 @@ PMIX_EXPORT char* pmix_util_print_name_args(const pmix_proc_t *name); #define PMIX_NAME_PRINT(n) \ pmix_util_print_name_args(n) +PMIX_EXPORT char *pmix_util_print_pname_args(const pmix_name_t *name); +#define PMIX_PNAME_PRINT(n) \ + pmix_util_print_pname_args(n) + PMIX_EXPORT char* pmix_util_print_rank(const pmix_rank_t vpid); #define PMIX_RANK_PRINT(n) \ pmix_util_print_rank(n) diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c index 5fbfec419dc..52885b3b4b5 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.c @@ -17,6 +17,7 @@ cli_info_t *cli_info = NULL; int cli_info_cnt = 0; bool test_abort = false; +bool test_complete = false; int cli_rank(cli_info_t *cli) { @@ -177,70 +178,6 @@ void cli_cleanup(cli_info_t *cli) } -bool test_terminated(void) -{ - bool ret = true; - int i; - - // All clients should disconnect - for(i=0; i < cli_info_cnt; i++){ - ret = ret && (CLI_TERM <= cli_info[i].state); - } - return (ret || test_abort); -} - -void cli_wait_all(double timeout) -{ - struct timeval tv; - double start_time, cur_time; - - gettimeofday(&tv, NULL); - start_time = tv.tv_sec + 1E-6*tv.tv_usec; - cur_time = start_time; - - //TEST_VERBOSE(("Wait for all children to terminate")) - - // Wait for all children to cleanup after the test. - while( !test_terminated() && ( timeout >= (cur_time - start_time) ) ){ - struct timespec ts; - int status, i; - pid_t pid; - while( 0 < (pid = waitpid(-1, &status, WNOHANG) ) ){ - TEST_VERBOSE(("waitpid = %d", pid)); - for(i=0; i < cli_info_cnt; i++){ - if( cli_info[i].pid == pid ){ - TEST_VERBOSE(("the child with pid = %d has rank = %d, ns = %s\n" - "\t\texited = %d, signalled = %d", pid, - cli_info[i].rank, cli_info[i].ns, - WIFEXITED(status), WIFSIGNALED(status) )); - if( WIFEXITED(status) || WIFSIGNALED(status) ){ - cli_cleanup(&cli_info[i]); - } - } - } - } - if( pid < 0 ){ - if( errno == ECHILD ){ - TEST_VERBOSE(("No more children to wait. Happens on the last cli_wait_all call " - "which is used to ensure that all children terminated.\n")); - if (pmix_test_verbose) { - sleep(1); - } - break; - } else { - TEST_ERROR(("waitpid(): %d : %s", errno, strerror(errno))); - exit(0); - } - } - ts.tv_sec = 0; - ts.tv_nsec = 100000; - nanosleep(&ts, NULL); - // calculate current timestamp - gettimeofday(&tv, NULL); - cur_time = tv.tv_sec + 1E-6*tv.tv_usec; - } -} - void cli_kill_all(void) { int i; diff --git a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h index 011023d7a79..c66fc2ca21f 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h +++ b/opal/mca/pmix/pmix3x/pmix/test/cli_stages.h @@ -48,11 +48,14 @@ typedef struct { cli_state_t next_state[CLI_TERM+1]; pmix_rank_t rank; char *ns; + int exit_code; + bool alive; } cli_info_t; extern cli_info_t *cli_info; extern int cli_info_cnt; extern bool test_abort; +extern bool test_complete; int cli_rank(cli_info_t *cli); void cli_init(int nprocs); @@ -61,11 +64,8 @@ void cli_finalize(cli_info_t *cli); void cli_disconnect(cli_info_t *cli); void cli_terminate(cli_info_t *cli); void cli_cleanup(cli_info_t *cli); -void cli_wait_all(double timeout); void cli_kill_all(void); -bool test_terminated(void); - void errhandler(size_t evhdlr_registration_id, pmix_status_t status, const pmix_proc_t *source, diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c index 3d1b46fcfac..dc7f54c90c1 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_client.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -41,31 +41,6 @@ #include "test_replace.h" #include "test_internal.h" -static void errhandler(size_t evhdlr_registration_id, - pmix_status_t status, - const pmix_proc_t *source, - pmix_info_t info[], size_t ninfo, - pmix_info_t results[], size_t nresults, - pmix_event_notification_cbfunc_fn_t cbfunc, - void *cbdata) -{ - TEST_ERROR(("PMIX client: Error handler with status = %d", status)) -} - -static void op_callbk(pmix_status_t status, - void *cbdata) -{ - TEST_VERBOSE(( "OP CALLBACK CALLED WITH STATUS %d", status)); -} - -static void errhandler_reg_callbk (pmix_status_t status, - size_t errhandler_ref, - void *cbdata) -{ - TEST_VERBOSE(("PMIX client ERRHANDLER REGISTRATION CALLBACK CALLED WITH STATUS %d, ref=%lu", - status, (unsigned long)errhandler_ref)); -} - int main(int argc, char **argv) { int rc; @@ -97,13 +72,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, info, ninfo))) { TEST_ERROR(("Client ns %s rank %d: PMIx_Init failed: %d", params.nspace, params.rank, rc)); FREE_TEST_PARAMS(params); - exit(0); - } - PMIx_Register_event_handler(NULL, 0, NULL, 0, errhandler, errhandler_reg_callbk, NULL); - if (myproc.rank != params.rank) { - TEST_ERROR(("Client ns %s Rank returned in PMIx_Init %d does not match to rank from command line %d.", myproc.nspace, myproc.rank, params.rank)); - FREE_TEST_PARAMS(params); - exit(0); + exit(rc); } if ( NULL != params.prefix && -1 != params.ns_id) { TEST_SET_FILE(params.prefix, params.ns_id, params.rank); @@ -115,12 +84,12 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_UNIV_SIZE, NULL, 0, &val))) { TEST_ERROR(("rank %d: PMIx_Get universe size failed: %d", myproc.rank, rc)); FREE_TEST_PARAMS(params); - exit(0); + exit(rc); } if (NULL == val) { TEST_ERROR(("rank %d: PMIx_Get universe size returned NULL value", myproc.rank)); FREE_TEST_PARAMS(params); - exit(0); + exit(1); } if (val->type != PMIX_UINT32 || val->data.uint32 != (uint32_t)params.ns_size ) { TEST_ERROR(("rank %d: Universe size value or type mismatch," @@ -128,7 +97,7 @@ int main(int argc, char **argv) myproc.rank, params.ns_size, PMIX_UINT32, val->data.integer, val->type)); FREE_TEST_PARAMS(params); - exit(0); + exit(1); } TEST_VERBOSE(("rank %d: Universe size check: PASSED", myproc.rank)); @@ -136,7 +105,7 @@ int main(int argc, char **argv) if( NULL != params.nspace && 0 != strcmp(myproc.nspace, params.nspace) ) { TEST_ERROR(("rank %d: Bad nspace!", myproc.rank)); FREE_TEST_PARAMS(params); - exit(0); + exit(1); } if (NULL != params.fences) { @@ -144,7 +113,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Fence test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -153,7 +122,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Job fence test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -162,7 +131,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Publish/Lookup test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -171,7 +140,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Spawn test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -180,7 +149,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Connect/Disconnect test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -189,7 +158,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d Resolve peers test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -198,7 +167,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d error registration and event handling test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -207,7 +176,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d error key replace test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } @@ -216,12 +185,11 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { FREE_TEST_PARAMS(params); TEST_ERROR(("%s:%d error key store internal test failed: %d", myproc.nspace, myproc.rank, rc)); - exit(0); + exit(rc); } } TEST_VERBOSE(("Client ns %s rank %d: PASSED", myproc.nspace, myproc.rank)); - PMIx_Deregister_event_handler(1, op_callbk, NULL); /* In case of direct modex we want to delay Finalize until everybody has finished. Otherwise some processes @@ -240,5 +208,5 @@ int main(int argc, char **argv) TEST_OUTPUT_CLEAR(("OK\n")); TEST_CLOSE_FILE(); FREE_TEST_PARAMS(params); - exit(0); + exit(rc); } diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_regex.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_regex.c index 35a671305d2..b117140465e 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_regex.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_regex.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -75,6 +75,7 @@ int main(int argc, char **argv) free(regex); } else { fprintf(stderr, "Node reverse failed: %d\n\n\n", rc); + exit(rc); } fprintf(stderr, "PROCS: %s\n", TEST_PROCS); @@ -91,6 +92,7 @@ int main(int argc, char **argv) free(regex); } else { fprintf(stderr, "PPN reverse failed: %d\n", rc); + exit(rc); } fprintf(stderr, "NODES: %s\n", TEST_NODES2); @@ -107,6 +109,7 @@ int main(int argc, char **argv) free(regex); } else { fprintf(stderr, "Node reverse failed: %d\n\n\n", rc); + exit(rc); } return 0; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c b/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c index 9ceeb72d539..b8d0825f872 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c +++ b/opal/mca/pmix/pmix3x/pmix/test/pmix_test.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. @@ -30,6 +30,7 @@ #include #include #include +#include #include "src/util/pmix_environ.h" #include "src/util/output.h" @@ -45,18 +46,13 @@ int main(int argc, char **argv) { char **client_env=NULL; char **client_argv=NULL; - int rc; + int rc, i; struct stat stat_buf; - struct timeval tv; - double test_start; - test_params params; - INIT_TEST_PARAMS(params); - int test_fail = 0; char *tmp; int ns_nprocs; + sigset_t unblock; - gettimeofday(&tv, NULL); - test_start = tv.tv_sec + 1E-6*tv.tv_usec; + INIT_TEST_PARAMS(params); /* smoke test */ if (PMIX_SUCCESS != 0) { @@ -92,6 +88,20 @@ int main(int argc, char **argv) return 0; } + /* ensure that SIGCHLD is unblocked as we need to capture it */ + if (0 != sigemptyset(&unblock)) { + fprintf(stderr, "SIGEMPTYSET FAILED\n"); + exit(1); + } + if (0 != sigaddset(&unblock, SIGCHLD)) { + fprintf(stderr, "SIGADDSET FAILED\n"); + exit(1); + } + if (0 != sigprocmask(SIG_UNBLOCK, &unblock, NULL)) { + fprintf(stderr, "SIG_UNBLOCK FAILED\n"); + exit(1); + } + if (PMIX_SUCCESS != (rc = server_init(¶ms))) { FREE_TEST_PARAMS(params); return rc; @@ -136,26 +146,15 @@ int main(int argc, char **argv) TEST_ERROR(("Total number of processes doesn't correspond number specified by ns_dist parameter.")); cli_kill_all(); test_fail = 1; + goto done; } /* hang around until the client(s) finalize */ - while (!test_terminated()) { - // To avoid test hang we want to interrupt the loop each 0.1s - double test_current; - - // check if we exceed the max time - gettimeofday(&tv, NULL); - test_current = tv.tv_sec + 1E-6*tv.tv_usec; - if( (test_current - test_start) > params.timeout ){ - break; - } - cli_wait_all(0); - } - - if( !test_terminated() ){ - TEST_ERROR(("Test exited by a timeout!")); - cli_kill_all(); - test_fail = 1; + while (!test_complete) { + struct timespec ts; + ts.tv_sec = 0; + ts.tv_nsec = 100000; + nanosleep(&ts, NULL); } if( test_abort ){ @@ -170,17 +169,25 @@ int main(int argc, char **argv) if (0 != params.test_spawn) { PMIX_WAIT_FOR_COMPLETION(spawn_wait); } + for(i=0; i < cli_info_cnt; i++){ + if (cli_info[i].exit_code != 0) { + ++test_fail; + } + } /* deregister the errhandler */ - PMIx_Deregister_event_handler(0, op_callbk, NULL); - - cli_wait_all(1.0); +// PMIx_Deregister_event_handler(0, op_callbk, NULL); + done: + TEST_VERBOSE(("srv #%d: call server_finalize!", my_server_id)); test_fail += server_finalize(¶ms); FREE_TEST_PARAMS(params); pmix_argv_free(client_argv); pmix_argv_free(client_env); + if (0 == test_fail) { + TEST_OUTPUT(("Test SUCCEEDED!")); + } return test_fail; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests00.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests01.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests02.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests03.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests04.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests05.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests06.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests07.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests08.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests09.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests10.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests11.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests12.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests13.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests14.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in index fb139c9ce7d..d472b21b1fc 100755 --- a/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in +++ b/opal/mca/pmix/pmix3x/pmix/test/run_tests15.pl.in @@ -23,14 +23,15 @@ my @tests = ("-n 4 --ns-dist 3:1 --fence \"[db | 0:0-2;1:0]\"", "-n 5 --test-resolve-peers --ns-dist \"1:2:2\"", "-n 5 --test-replace 100:0,1,10,50,99", "-n 5 --test-internal 10", - "-s 2 -n 2 --job-fence", - "-s 2 -n 2 --job-fence -c"); + "-s 1 -n 2 --job-fence", + "-s 1 -n 2 --job-fence -c"); my $test; my $cmd; my $output; my $status = 0; my $testnum; +my $timeout_cmd = ""; # We are running tests against the build tree (vs. the installation # tree). Autogen gives us a full list of all possible component @@ -63,7 +64,24 @@ $testnum =~ s/.pl//; $testnum = substr($testnum, -2); $test = @tests[$testnum]; -$cmd = "./pmix_test " . $test . " 2>&1"; +# find the timeout or gtimeout cmd so we can timeout the +# test if it hangs +my @paths = split(/:/, $ENV{PATH}); +foreach my $p (@paths) { + my $fullpath = $p . "/" . "gtimeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } else { + my $fullpath = $p . "/" . "timeout"; + if ((-e $fullpath) && (-f $fullpath)) { + $timeout_cmd = $fullpath . " --preserve-status -k 35 30 "; + last; + } + } +} + +$cmd = $timeout_cmd . " ./pmix_test " . $test . " 2>&1"; print $cmd . "\n"; $output = `$cmd`; print $output . "\n"; diff --git a/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c b/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c index ae16129ecf2..ee16bb240f0 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c +++ b/opal/mca/pmix/pmix3x/pmix/test/server_callbacks.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2015-2018 Mellanox Technologies, Inc. @@ -32,9 +32,12 @@ pmix_server_module_t mymodule = { .unpublish = unpublish_fn, .spawn = spawn_fn, .connect = connect_fn, - .disconnect = disconnect_fn, + .disconnect = disconnect_fn +#if 0 +, .register_events = regevents_fn, .deregister_events = deregevents_fn +#endif }; typedef struct { diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am index 5ab9f568bb0..ee029668031 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/Makefile.am @@ -25,7 +25,8 @@ headers = simptest.h noinst_PROGRAMS = simptest simpclient simppub simpdyn simpft simpdmodex \ test_pmix simptool simpdie simplegacy simptimeout \ - gwtest gwclient stability quietclient simpjctrl + gwtest gwclient stability quietclient simpjctrl \ + pmitest simptest_SOURCES = $(headers) \ simptest.c @@ -122,3 +123,9 @@ simpjctrl_SOURCES = \ simpjctrl_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) simpjctrl_LDADD = \ $(top_builddir)/src/libpmix.la + +pmitest_SOURCES = \ + pmitest.c +pmitest_LDFLAGS = $(PMIX_PKG_CONFIG_LDFLAGS) +pmitest_LDADD = \ + $(top_builddir)/src/libpmi.la diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/pmitest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/pmitest.c new file mode 100644 index 00000000000..2546d550e6c --- /dev/null +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/pmitest.c @@ -0,0 +1,305 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ +/* + * + * (C) 2001 by Argonne National Laboratory. + * See COPYRIGHT in top-level directory. + */ +#include +#include +#include +#include "pmi.h" + +static const char * PMI_Err_str(int error) +{ + static char str[100]; + switch (error) + { + case PMI_SUCCESS: + return "PMI_SUCCESS"; + case PMI_FAIL: + return "PMI_FAIL"; + case PMI_ERR_INVALID_ARG: + return "PMI_ERR_INVALID_ARG"; + case PMI_ERR_INVALID_KEY: + return "PMI_ERR_INVALID_KEY"; + case PMI_ERR_INVALID_KEY_LENGTH: + return "PMI_ERR_INVALID_KEY_LENGTH"; + case PMI_ERR_INVALID_VAL: + return "PMI_ERR_INVALID_VAL"; + case PMI_ERR_INVALID_VAL_LENGTH: + return "PMI_ERR_INVALID_VAL_LENGTH"; + case PMI_ERR_INVALID_LENGTH: + return "PMI_ERR_INVALID_LENGTH"; + case PMI_ERR_INIT: + return "PMI_ERR_INIT"; + case PMI_ERR_NOMEM: + return "PMI_ERR_NOMEM"; + } + sprintf(str, "PMI_ERR_UNKNOWN: %d", error); + return str; +} + +#define PRINT_ERROR(error, fcname) if (error != PMI_SUCCESS) printf("%s failed: %s\n", fcname, PMI_Err_str(error)); else printf("%s unexpectedly succeeded\n", fcname); fflush(stdout); + +int main( int argc, char * argv[] ) +{ + int rc, spawned, size, rank, name_max, id_maxlen, key_maxlen, val_maxlen; + char *kvsname, *id, *domain_id, *key, *val; + + rc = PMI_Init( &spawned ); + if ( rc != PMI_SUCCESS ) + { + printf( "PMI_Init failed with rc = %s\n", PMI_Err_str(rc) ); + return -1 ; + } + else + { + printf( "PMI_Init returned spawned = %d\n", spawned ); + } + + rc = PMI_Get_size( &size ); + if ( rc == PMI_SUCCESS ) + { + rc = PMI_Get_rank( &rank ); + if ( rc == PMI_SUCCESS ) + printf( "size = %d, rank = %d\n", size, rank ); + else + printf( "PMI_Get_Rank failed with rc = %s\n", PMI_Err_str(rc) ); + } + else + printf( "PMI_Get_size failed with rc = %s\n", PMI_Err_str(rc) ); + + rc = PMI_KVS_Get_name_length_max( &name_max ); + if ( rc != PMI_SUCCESS ) + { + printf( "PMI_KVS_Get_name_length_max failed with rc = %s\n", PMI_Err_str(rc) ); + return -1; + } + else + printf( "PMI_KVS_Get_name_length_max got %d\n", name_max ); + + kvsname = (char *) malloc( name_max ); + rc = PMI_KVS_Get_my_name( kvsname, name_max ); + if ( rc != PMI_SUCCESS ) + { + printf( "PMI_KVS_Get_my_name failed with rc = %s\n", PMI_Err_str(rc) ); + return -1; + } + else + printf( "PMI_KVS_Get_my_name got %s\n", kvsname ); + + rc = PMI_Get_id_length_max( &id_maxlen ); + if ( rc != PMI_SUCCESS ) + { + printf("PMI_Get_id_length_max failed with rc = %s\n", PMI_Err_str(rc) ); + return -1; + } + else + printf("PMI_Get_id_length_max got %d\n", id_maxlen); + id = (char *) malloc( id_maxlen ); + rc = PMI_Get_id( id, id_maxlen ); + if ( rc != PMI_SUCCESS ) + { + printf("PMI_Get_id failed with rc = %s\n", PMI_Err_str(rc)); + } + else + printf( "PMI_Get_id got %s\n", id ); + domain_id = (char *) malloc( id_maxlen ); + rc = PMI_Get_kvs_domain_id( domain_id, id_maxlen ); + if ( rc != PMI_SUCCESS ) + { + printf("PMI_Get_kvs_domain_id failed with rc = %s\n", PMI_Err_str(rc)); + } + else + printf( "PMI_Get_kvs_domain_id got %s\n", domain_id ); + + rc = PMI_KVS_Get_key_length_max( &key_maxlen ); + if (rc != PMI_SUCCESS ) + { + printf("PMI_KVS_Get_key_length_max failed with rc = %s\n", PMI_Err_str(rc)); + return -1; + } + else + printf( "PMI_Get_key_maxlen got %d\n", key_maxlen ); + key = (char *) malloc( key_maxlen ); + rc = PMI_KVS_Get_value_length_max( &val_maxlen ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Get_value_length_max failed with rc = %s\n", PMI_Err_str(rc)); + return -1; + } + else + printf( "PMI_Get_val_maxlen got %d\n", val_maxlen ); + val = (char *) malloc( val_maxlen ); + + sprintf(key, "test_key_%d", rank); + sprintf(val, "test_value_%d", rank); + + rc = PMI_KVS_Put( kvsname, key, val ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Put failed with rc = %s\n", PMI_Err_str(rc)); + } + rc = PMI_KVS_Commit( kvsname ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Commit failed with rc = %s\n", PMI_Err_str(rc)); + } + rc = PMI_Barrier(); + if (rc != PMI_SUCCESS) + { + printf("PMI_Barrier failed with rc = %s\n", PMI_Err_str(rc)); + } + + sprintf(key, "test_key_%d", (rank + 1) % size); + rc = PMI_KVS_Get( kvsname, key, val, val_maxlen ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Get(%s) failed with rc = %s\n", key, PMI_Err_str(rc)); + } + else + printf("PMI_KVS_Get(%s) returned %s\n", key, val); + + /* Test awkward character string put and get */ + if (rank == 0) + { + sprintf(key, "foo"); + sprintf(val, "foo=bar baz=bif name=\"Buzz Bee\" clink=~!@#$\\;':<>,. clank=a b c"); + + rc = PMI_KVS_Put( kvsname, key, val ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Put failed with rc = %s\n", PMI_Err_str(rc)); + } + rc = PMI_KVS_Commit( kvsname ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Commit failed with rc = %s\n", PMI_Err_str(rc)); + } + } + + rc = PMI_Barrier(); + if (rc != PMI_SUCCESS) + { + printf("PMI_Barrier failed with rc = %s\n", PMI_Err_str(rc)); + } + + if (rank == size - 1) + { + sprintf(key, "foo"); + rc = PMI_KVS_Get( kvsname, key, val, val_maxlen ); + if (rc != PMI_SUCCESS) + { + printf("PMI_KVS_Get(%s) failed with rc = %s\n", key, PMI_Err_str(rc)); + } + else + printf("PMI_KVS_Get(%s) returned %s\n", key, val); + } + + if ( rank == (size - 1) ) + { + key[0] = '\0'; + val[0] = '\0'; + rc = PMI_KVS_Iter_first(kvsname, key, key_maxlen, val, val_maxlen); + if (rc == PMI_SUCCESS) + { + while (key[0] != '\0') + { + printf("PMI_KVS_Iter got key=%s val=%s\n",key,val); + rc = PMI_KVS_Iter_next(kvsname, key, key_maxlen, val, val_maxlen); + if (rc != PMI_SUCCESS) + { + printf("PMK_KVS_Iter_next failed with rc = %s\n", PMI_Err_str(rc)); + break; + } + } + } + else + { + printf("PMI_KVS_Iter_first failed with rc = %s\n", PMI_Err_str(rc)); + } +} + + /* error testing */ +if (rank != 0) +{ + printf("PMI error testing:\n"); + strcpy(key, "test_key"); + strcpy(val, "test_val"); + rc = PMI_KVS_Put("baloney", key, val); + PRINT_ERROR(rc, "PMI_KVS_Put(baloney, key, val)"); + rc = PMI_KVS_Put(NULL, key, val); + PRINT_ERROR(rc, "PMI_KVS_Put(NULL, key, val)"); + rc = PMI_KVS_Put(kvsname, NULL, val); + PRINT_ERROR(rc, "PMI_KVS_Put(kvsname, NULL, val)"); + rc = PMI_KVS_Put(kvsname, key, NULL); + PRINT_ERROR(rc, "PMI_KVS_Put(kvsname, key, NULL)"); + rc = PMI_KVS_Get("baloney", key, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Get(baloney, key, val, val_maxlen)"); + rc = PMI_KVS_Get(NULL, key, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Get(NULL, key, val, val_maxlen)"); + rc = PMI_KVS_Get(kvsname, NULL, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Get(kvsname, NULL, val, val_maxlen)"); + rc = PMI_KVS_Get(kvsname, key, NULL, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Get(kvsname, key, NULL, val_maxlen)"); + rc = PMI_KVS_Get(kvsname, key, val, -1); + PRINT_ERROR(rc, "PMI_KVS_Get(kvsname, key, val, -1)"); + rc = PMI_KVS_Commit(NULL); + PRINT_ERROR(rc, "PMI_KVS_Commit(NULL)"); + rc = PMI_KVS_Commit("baloney"); + PRINT_ERROR(rc, "PMI_KVS_Commit(baloney)"); + rc = PMI_KVS_Get_my_name(NULL, name_max); + PRINT_ERROR(rc, "PMI_KVS_Get_my_name(NULL, name_max)"); + rc = PMI_KVS_Get_my_name(kvsname, -1); + PRINT_ERROR(rc, "PMI_KVS_Get_my_name(kvsname, -1)"); + rc = PMI_Get_id(NULL, id_maxlen); + PRINT_ERROR(rc, "PMI_Get_id(NULL, id_maxlen)"); + rc = PMI_Get_id(id, -1); + PRINT_ERROR(rc, "PMI_Get_id(id, -1)"); + rc = PMI_Get_kvs_domain_id(NULL, id_maxlen); + PRINT_ERROR(rc, "PMI_Get_domain_id(NULL, id_maxlen)"); + rc = PMI_Get_kvs_domain_id(domain_id, -1); + PRINT_ERROR(rc, "PMI_Get_domain_id(domain_id, -1)"); + rc = PMI_Init(NULL); + PRINT_ERROR(rc, "PMI_Init(NULL)"); + rc = PMI_Get_rank(NULL); + PRINT_ERROR(rc, "PMI_Get_rank(NULL)"); + rc = PMI_Get_size(NULL); + PRINT_ERROR(rc, "PMI_Get_size(NULL)"); + rc = PMI_KVS_Get_name_length_max(NULL); + PRINT_ERROR(rc, "PMI_Get_name_length_max(NULL)"); + rc = PMI_Get_id_length_max(NULL); + PRINT_ERROR(rc, "PMI_Get_id_length_max(NULL)"); + rc = PMI_KVS_Get_key_length_max(NULL); + PRINT_ERROR(rc, "PMI_Get_key_length_max(NULL)"); + rc = PMI_KVS_Get_value_length_max(NULL); + PRINT_ERROR(rc, "PMI_Get_value_length_max(NULL)"); + rc = PMI_KVS_Iter_first("baloney", key, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(baloney, key, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_first(NULL, key, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(NULL, key, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_first(kvsname, NULL, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(kvsname, NULL, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_first(kvsname, key, -1, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(kvsname, key, -1, val, val_maxlen)"); + rc = PMI_KVS_Iter_first(kvsname, key, key_maxlen, NULL, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(kvsname, key, key_maxlen, NULL, val_maxlen)"); + rc = PMI_KVS_Iter_first(kvsname, key, key_maxlen, val, -1); + PRINT_ERROR(rc, "PMI_KVS_Iter_first(kvsname, key, key_maxlen, val, -1)"); + rc = PMI_KVS_Iter_next("baloney", key, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(baloney, key, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_next(NULL, key, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(NULL, key, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_next(kvsname, NULL, key_maxlen, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(kvsname, NULL, key_maxlen, val, val_maxlen)"); + rc = PMI_KVS_Iter_next(kvsname, key, -1, val, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(kvsname, key, -1, val, val_maxlen)"); + rc = PMI_KVS_Iter_next(kvsname, key, key_maxlen, NULL, val_maxlen); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(kvsname, key, key_maxlen, NULL, val_maxlen)"); + rc = PMI_KVS_Iter_next(kvsname, key, key_maxlen, val, -1); + PRINT_ERROR(rc, "PMI_KVS_Iter_next(kvsname, key, key_maxlen, val, -1)"); +} + +rc = PMI_Finalize( ); +return 0; +} diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c index 80aea143083..45b74292857 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simpclient.c @@ -13,7 +13,7 @@ * All rights reserved. * Copyright (c) 2009-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. - * Copyright (c) 2013-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. All rights reserved. * $COPYRIGHT$ * @@ -34,6 +34,7 @@ #include "src/class/pmix_object.h" #include "src/util/output.h" #include "src/util/printf.h" +#include "src/include/pmix_globals.h" #define MAXCNT 1 @@ -154,16 +155,43 @@ int main(int argc, char **argv) exit(rc); } PMIX_INFO_FREE(iptr, 2); - pmix_output(0, "Client ns %s rank %d: Running", myproc.nspace, myproc.rank); + pmix_output(0, "Client ns %s rank %d: Running on node %s", myproc.nspace, myproc.rank, pmix_globals.hostname); /* test something */ (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); + } + nprocs = val->data.uint32; + PMIX_VALUE_RELEASE(val); + pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); + + /* test something */ + if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_SERVER_URI, NULL, 0, &val))) { pmix_output(0, "Client ns %s rank %d: PMIx_Get failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); exit(rc); } + pmix_output(0, "CLIENT SERVER URI: %s", val->data.string); + PMIX_VALUE_RELEASE(val); + + if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_LOCAL_RANK, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get LOCAL RANK failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); + } + pmix_output(0, "CLIENT LOCAL RANK: %u", val->data.uint32); + PMIX_VALUE_RELEASE(val); + + if (PMIX_SUCCESS != (rc = PMIx_Get(&myproc, PMIX_HOSTNAME, NULL, 0, &val))) { + pmix_output(0, "Client ns %s rank %d: PMIx_Get HOSTNAME failed: %s", + myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); + } + pmix_output(0, "CLIENT HOSTNAME: %s", val->data.string); PMIX_VALUE_RELEASE(val); /* register a handler specifically for when models declare */ @@ -188,18 +216,6 @@ int main(int argc, char **argv) } - /* get our job size */ - (void)strncpy(proc.nspace, myproc.nspace, PMIX_MAX_NSLEN); - proc.rank = PMIX_RANK_WILDCARD; - if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_JOB_SIZE, NULL, 0, &val))) { - pmix_output(0, "Client ns %s rank %d: PMIx_Get job size failed: %s", - myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; - } - nprocs = val->data.uint32; - PMIX_VALUE_RELEASE(val); - pmix_output(0, "Client %s:%d job size %d", myproc.nspace, myproc.rank, nprocs); - /* put a few values */ (void)asprintf(&tmp, "%s-%d-internal", myproc.nspace, myproc.rank); value.type = PMIX_UINT32; @@ -207,14 +223,14 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != (rc = PMIx_Store_internal(&myproc, tmp, &value))) { pmix_output(0, "Client ns %s rank %d: PMIx_Store_internal failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; + exit(rc); } /* get a list of our local peers */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { pmix_output(0, "Client ns %s rank %d: PMIx_Get local peers failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; + exit(rc); } /* split the returned string to get the rank of each local peer */ peers = pmix_argv_split(val->data.string, ','); @@ -232,13 +248,14 @@ int main(int argc, char **argv) pmix_argv_free(peers); for (cnt=0; cnt < MAXCNT; cnt++) { + pmix_output(0, "Client %s:%d executing loop %d", myproc.nspace, myproc.rank, cnt); (void)asprintf(&tmp, "%s-%d-local-%d", myproc.nspace, myproc.rank, cnt); value.type = PMIX_UINT64; value.data.uint64 = 1234; if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_LOCAL, tmp, &value))) { pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; + exit(rc); } (void)asprintf(&tmp, "%s-%d-remote-%d", myproc.nspace, myproc.rank, cnt); @@ -247,13 +264,13 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != (rc = PMIx_Put(PMIX_REMOTE, tmp, &value))) { pmix_output(0, "Client ns %s rank %d: PMIx_Put internal failed: %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); - goto done; + exit(rc); } if (PMIX_SUCCESS != (rc = PMIx_Commit())) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Commit failed: %s", myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc)); - goto done; + exit(rc); } /* call fence to ensure the data is received */ @@ -263,7 +280,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != (rc = PMIx_Fence(&proc, 1, NULL, 0))) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Fence failed: %s", myproc.nspace, myproc.rank, cnt, PMIx_Error_string(rc)); - goto done; + exit(rc); } /* check the returned data */ @@ -293,19 +310,19 @@ int main(int argc, char **argv) if (NULL == val) { pmix_output(0, "Client ns %s rank %d: NULL value returned", myproc.nspace, myproc.rank); - break; + exit(1); } if (PMIX_UINT64 != val->type) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong type: %d", myproc.nspace, myproc.rank, j, tmp, val->type); PMIX_VALUE_RELEASE(val); free(tmp); - continue; + exit(1); } if (1234 != val->data.uint64) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned wrong value: %d", myproc.nspace, myproc.rank, j, tmp, (int)val->data.uint64); PMIX_VALUE_RELEASE(val); free(tmp); - continue; + exit(1); } pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); PMIX_VALUE_RELEASE(val); @@ -322,6 +339,7 @@ int main(int argc, char **argv) } else { pmix_output(0, "ERROR: Client ns %s rank %d cnt %d: PMIx_Get %s returned remote data for a local proc", myproc.nspace, myproc.rank, j, tmp); + exit(1); } if (NULL != val) { PMIX_VALUE_RELEASE(val); @@ -329,14 +347,18 @@ int main(int argc, char **argv) free(tmp); } } else { + val = NULL; (void)asprintf(&tmp, "%s-%d-remote-%d", proc.nspace, n, j); - if (PMIX_SUCCESS == (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { + if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, tmp, NULL, 0, &val))) { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s returned correct", myproc.nspace, myproc.rank, j, tmp); } else { pmix_output(0, "Client ns %s rank %d cnt %d: PMIx_Get %s failed for remote proc", myproc.nspace, myproc.rank, j, tmp); + exit(1); + } + if (NULL != val) { + PMIX_VALUE_RELEASE(val); } - PMIX_VALUE_RELEASE(val); free(tmp); } } @@ -351,14 +373,17 @@ int main(int argc, char **argv) pmix_output(0, "Client ns %s rank %d did not return an array for its internal modex blob", myproc.nspace, myproc.rank); PMIX_VALUE_RELEASE(val); + exit(1); } else if (PMIX_INFO != val->data.darray->type) { pmix_output(0, "Client ns %s rank %d returned an internal modex array of type %s instead of PMIX_INFO", myproc.nspace, myproc.rank, PMIx_Data_type_string(val->data.darray->type)); PMIX_VALUE_RELEASE(val); + exit(1); } else if (0 == val->data.darray->size) { pmix_output(0, "Client ns %s rank %d returned an internal modex array of zero length", myproc.nspace, myproc.rank); PMIX_VALUE_RELEASE(val); + exit(1); } else { pmix_info_t *iptr = (pmix_info_t*)val->data.darray->array; for (n=0; n < val->data.darray->size; n++) { @@ -369,6 +394,7 @@ int main(int argc, char **argv) } else { pmix_output(0, "Client ns %s rank %d internal modex blob FAILED with error %s(%d)", myproc.nspace, myproc.rank, PMIx_Error_string(rc), rc); + exit(rc); } /* log something */ @@ -379,6 +405,7 @@ int main(int argc, char **argv) if (PMIX_SUCCESS != rc) { pmix_output(0, "Client ns %s rank %d - log_nb returned %s", myproc.nspace, myproc.rank, PMIx_Error_string(rc)); + exit(rc); } else { while (active) { usleep(10); @@ -397,7 +424,6 @@ int main(int argc, char **argv) } } - done: /* finalize us */ pmix_output(0, "Client ns %s rank %d: Finalizing", myproc.nspace, myproc.rank); if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) { diff --git a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c index b78165f704a..1cbb4e78cea 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c +++ b/opal/mca/pmix/pmix3x/pmix/test/simple/simptest.c @@ -198,8 +198,17 @@ static pmix_event_t handler; static pmix_list_t children; static bool istimeouttest = false; static mylock_t globallock; +static bool nettest = false; +static bool model = false; +static bool xversion = false; +static char *hostnames[] = { + "test000", + "test001", + "test002", + NULL +}; -static void set_namespace(int nprocs, char *ranks, char *nspace, +static void set_namespace(int nprocs, char *nspace, pmix_op_cbfunc_t cbfunc, myxfer_t *x); static void errhandler(size_t evhdlr_registration_id, pmix_status_t status, @@ -262,6 +271,32 @@ static void infocbfunc(pmix_status_t status, DEBUG_WAKEUP_THREAD(lock); } +static void setup_cbfunc(pmix_status_t status, + pmix_info_t info[], size_t ninfo, + void *provided_cbdata, + pmix_op_cbfunc_t cbfunc, void *cbdata) +{ + myxfer_t *x = (myxfer_t*)provided_cbdata; + size_t n; + + /* transfer it to the caddy for return to the main thread */ + if (0 < ninfo) { + PMIX_INFO_CREATE(x->info, ninfo); + x->ninfo = ninfo; + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&x->info[n], &info[n]); + } + } + + /* let the library release the data and cleanup from + * the operation */ + if (NULL != cbfunc) { + cbfunc(PMIX_SUCCESS, cbdata); + } + + DEBUG_WAKEUP_THREAD(&x->lock); +} + /* this is an event notification function that we explicitly request * be called when the PMIX_MODEL_DECLARED notification is issued. * We could catch it in the general event notification function and test @@ -297,21 +332,6 @@ static void model_callback(size_t evhdlr_registration_id, DEBUG_WAKEUP_THREAD(&globallock); } -/* event handler registration is done asynchronously */ -static void model_registration_callback(pmix_status_t status, - size_t evhandler_ref, - void *cbdata) -{ - mylock_t *lock = (mylock_t*)cbdata; - - if (PMIX_SUCCESS != status) { - fprintf(stderr, "simptest EVENT HANDLER REGISTRATION FAILED WITH STATUS %d, ref=%lu\n", - status, (unsigned long)evhandler_ref); - } - lock->status = status; - DEBUG_WAKEUP_THREAD(lock); -} - static void set_handler_default(int sig) { struct sigaction act; @@ -327,7 +347,7 @@ int main(int argc, char **argv) { char **client_env=NULL; char **client_argv=NULL; - char *tmp, **atmp, *executable=NULL; + char *executable=NULL; int rc, nprocs=1, n, k; uid_t myuid; gid_t mygid; @@ -337,8 +357,6 @@ int main(int argc, char **argv) wait_tracker_t *child; pmix_info_t *info; size_t ninfo; - bool cross_version = false; - bool usock = true; bool hwloc = false; #if PMIX_HAVE_HWLOC char *hwloc_file = NULL; @@ -371,14 +389,6 @@ int main(int argc, char **argv) pmix_argv_append_nosize(&client_argv, argv[k]); } n += k; - } else if (0 == strcmp("-x", argv[n])) { - /* cross-version test - we will set one child to - * run at a different version. Requires -n >= 2 */ - cross_version = true; - usock = false; - } else if (0 == strcmp("-u", argv[n])) { - /* enable usock */ - usock = false; #if PMIX_HAVE_HWLOC } else if (0 == strcmp("-hwloc", argv[n]) || 0 == strcmp("--hwloc", argv[n])) { @@ -399,15 +409,32 @@ int main(int argc, char **argv) fprintf(stderr, "usage: simptest \n"); fprintf(stderr, " -n N Number of clients to run\n"); fprintf(stderr, " -e foo Name of the client executable to run (default: simpclient\n"); - fprintf(stderr, " -x Test cross-version support\n"); fprintf(stderr, " -u Enable legacy usock support\n"); fprintf(stderr, " -hwloc Test hwloc support\n"); fprintf(stderr, " -hwloc-file FILE Use file to import topology\n"); + fprintf(stderr, " -net-test Test network endpt assignments\n"); + fprintf(stderr, " -xversion Cross-version test - simulate single node only\n"); exit(0); + } else if (0 == strcmp("-net-test", argv[n]) || + 0 == strcmp("--net-test", argv[n])) { + /* test network support */ + nettest = true; + } else if (0 == strcmp("-model", argv[n]) || + 0 == strcmp("--model", argv[n])) { + /* test network support */ + model = true; + } else if (0 == strcmp("-x", argv[n]) || + 0 == strcmp("-xversion", argv[n]) || + 0 == strcmp("--xversion", argv[n])) { + xversion = true; } } if (NULL == executable) { - executable = strdup("./simpclient"); + if (nettest) { + executable = strdup("./simpcoord"); + } else { + executable = strdup("./simpclient"); + } } /* check for executable existence and permissions */ if (0 != access(executable, X_OK)) { @@ -415,11 +442,6 @@ int main(int argc, char **argv) exit(1); } - if (cross_version && nprocs < 2) { - fprintf(stderr, "Cross-version testing requires at least two clients\n"); - exit(1); - } - #if !PMIX_HAVE_HWLOC if (hwloc) { fprintf(stderr, "PMIx was not configured with HWLOC support - cannot continue\n"); @@ -448,37 +470,45 @@ int main(int argc, char **argv) #if PMIX_HAVE_HWLOC if (hwloc) { #if HWLOC_API_VERSION < 0x20000 - ninfo = 3; + ninfo = 2; #else - ninfo = 4; + ninfo = 3; #endif } else { - ninfo = 2; + ninfo = 1; } #else - ninfo = 2; + ninfo = 1; #endif PMIX_INFO_CREATE(info, ninfo); PMIX_INFO_LOAD(&info[0], PMIX_SERVER_TOOL_SUPPORT, NULL, PMIX_BOOL); - PMIX_INFO_LOAD(&info[1], PMIX_SERVER_GATEWAY, NULL, PMIX_BOOL); #if PMIX_HAVE_HWLOC if (hwloc) { if (NULL != hwloc_file) { - PMIX_INFO_LOAD(&info[2], PMIX_TOPOLOGY_FILE, hwloc_file, PMIX_STRING); + PMIX_INFO_LOAD(&info[1], PMIX_TOPOLOGY_FILE, hwloc_file, PMIX_STRING); } else { - PMIX_INFO_LOAD(&info[2], PMIX_TOPOLOGY, NULL, PMIX_STRING); + PMIX_INFO_LOAD(&info[1], PMIX_TOPOLOGY, NULL, PMIX_STRING); } #if HWLOC_API_VERSION >= 0x20000 - PMIX_INFO_LOAD(&info[3], PMIX_HWLOC_SHARE_TOPO, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&info[2], PMIX_HWLOC_SHARE_TOPO, NULL, PMIX_BOOL); #endif } #endif + if (nettest) { + /* set a known network configuration for the pnet/test component */ + putenv("PMIX_MCA_pnet_test_planes=plane:d:3;plane:s:2;plane:d:5:2"); + putenv("PMIX_MCA_pnet=test"); + } if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, ninfo))) { - fprintf(stderr, "Init failed with error %d\n", rc); + fprintf(stderr, "Init failed with error %s\n", PMIx_Error_string(rc)); return rc; } PMIX_INFO_FREE(info, ninfo); + if (nettest) { + unsetenv("PMIX_MCA_pnet"); + unsetenv("PMIX_MCA_pnet_test_planes"); + } /* register the default errhandler */ DEBUG_CONSTRUCT_LOCK(&mylock); @@ -501,8 +531,7 @@ int main(int argc, char **argv) PMIX_INFO_LOAD(&info[0], PMIX_EVENT_HDLR_NAME, "SIMPTEST-MODEL", PMIX_STRING); code = PMIX_MODEL_DECLARED; PMIx_Register_event_handler(&code, 1, info, ninfo, - model_callback, model_registration_callback, (void*)&mylock); - DEBUG_WAIT_THREAD(&mylock); + model_callback, NULL, NULL); PMIX_INFO_FREE(info, ninfo); if (PMIX_SUCCESS != mylock.status) { exit(mylock.status); @@ -519,16 +548,12 @@ int main(int argc, char **argv) pmix_event_add(&handler, NULL); /* we have a single namespace for all clients */ - atmp = NULL; - for (n=0; n < nprocs; n++) { - asprintf(&tmp, "%d", n); - pmix_argv_append_nosize(&atmp, tmp); - free(tmp); - } - tmp = pmix_argv_join(atmp, ','); - pmix_argv_free(atmp); x = PMIX_NEW(myxfer_t); - set_namespace(nprocs, tmp, "foobar", opcbfunc, x); + set_namespace(nprocs, "foobar", opcbfunc, x); + /* if the nspace registration hasn't completed yet, + * wait for it here */ + DEBUG_WAIT_THREAD(&x->lock); + PMIX_RELEASE(x); /* set common argv and env */ client_env = pmix_argv_copy(environ); @@ -553,33 +578,21 @@ int main(int argc, char **argv) } DEBUG_DESTRUCT_LOCK(&mylock); - /* if the nspace registration hasn't completed yet, - * wait for it here */ - DEBUG_WAIT_THREAD(&x->lock); - free(tmp); - PMIX_RELEASE(x); /* fork/exec the test */ (void)strncpy(proc.nspace, "foobar", PMIX_MAX_NSLEN); for (n = 0; n < nprocs; n++) { proc.rank = n; - if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, &client_env))) {//n + if (PMIX_SUCCESS != (rc = PMIx_server_setup_fork(&proc, &client_env))) { fprintf(stderr, "Server fork setup failed with error %d\n", rc); PMIx_server_finalize(); return rc; } - /* if cross-version test is requested, then oscillate PTL support - * by rank */ - if (cross_version) { - if (0 == n % 2) { - pmix_setenv("PMIX_MCA_ptl", "tcp", true, &client_env); - } else { - pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); - } - } else if (!usock) { - /* don't disable usock => enable it on client */ - pmix_setenv("PMIX_MCA_ptl", "usock", true, &client_env); + /* add the hostname we want them to use */ + if (!xversion) { + PMIX_SETENV(rc, "PMIX_HOSTNAME", hostnames[n % 3], &client_env); } + x = PMIX_NEW(myxfer_t); if (PMIX_SUCCESS != (rc = PMIx_server_register_client(&proc, myuid, mygid, NULL, opcbfunc, x))) { @@ -699,108 +712,153 @@ int main(int argc, char **argv) return exit_code; } -static void set_namespace(int nprocs, char *ranks, char *nspace, +static void set_namespace(int nprocs, char *nspace, pmix_op_cbfunc_t cbfunc, myxfer_t *x) { - char *regex, *ppn; - int n, m, k; - pmix_info_t *info; + char *regex, *ppn, *rks; + int n, m, k, nnodes; pmix_data_array_t *array; + pmix_info_t *info, *iptr, *ip; + pmix_info_t *isv1, *isv2; + myxfer_t cd, lock; + pmix_status_t rc; + char **map[3] = {NULL, NULL, NULL}; + char *peers[3] = {NULL, NULL, NULL}; + char tmp[50] , **agg = NULL; + + if (xversion) { + /* everything on one node */ + PMIx_generate_regex(pmix_globals.hostname, ®ex); + for (m=0; m < nprocs; m++) { + snprintf(tmp, 50, "%d", m); + pmix_argv_append_nosize(&agg, tmp); + memset(tmp, 0, 50); + } + rks = pmix_argv_join(agg, ','); + pmix_argv_free(agg); + PMIx_generate_ppn(rks, &ppn); + free(rks); + nnodes = 1; + } else { + if (nprocs < 3) { + /* take only the number of hostnames equal to + * the number of procs */ + for (m=0; m < nprocs; m++) { + pmix_argv_append_nosize(&agg, hostnames[m]); + } + ppn = pmix_argv_join(agg, ','); + pmix_argv_free(agg); + agg = NULL; + nnodes = nprocs; + } else { + nnodes = 3; + ppn = pmix_argv_join(hostnames, ','); + } + PMIx_generate_regex(ppn, ®ex); + free(ppn); + /* compute the placement of the procs */ + for (m=0; m < nprocs; m++) { + snprintf(tmp, 50, "%d", m); + pmix_argv_append_nosize(&map[m%3], tmp); + memset(tmp, 0, 50); + } + for (m=0; m < 3; m++) { + if (NULL != map[m]) { + peers[m] = pmix_argv_join(map[m], ','); + pmix_argv_append_nosize(&agg, peers[m]); + pmix_argv_free(map[m]); + } + } + rks = pmix_argv_join(agg, ';'); + pmix_argv_free(agg); + PMIx_generate_ppn(rks, &ppn); + free(rks); + } - x->ninfo = 16 + nprocs; - + x->ninfo = 1 + nprocs + nnodes; PMIX_INFO_CREATE(x->info, x->ninfo); - n = 0; - - PMIx_generate_regex("test000,test001,test002", ®ex); - PMIx_generate_ppn("0;1;2", &ppn); - - (void)strncpy(x->info[n].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_STRING; - x->info[n].value.data.string = regex; - ++n; - - /* if we have some empty nodes, then fill their spots */ - (void)strncpy(x->info[n].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_STRING; - x->info[n].value.data.string = ppn; - ++n; - - (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; - ++n; - - (void)strncpy(x->info[n].key, PMIX_SPAWNED, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = 0; - ++n; - - (void)strncpy(x->info[n].key, PMIX_LOCAL_SIZE, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; - ++n; - - (void)strncpy(x->info[n].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_STRING; - x->info[n].value.data.string = strdup(ranks); - ++n; - - (void)strncpy(x->info[n].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; - ++n; - - (void)strncpy(x->info[n].key, PMIX_JOBID, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_STRING; - x->info[n].value.data.string = strdup("1234"); - ++n; - - (void)strncpy(x->info[n].key, PMIX_NPROC_OFFSET, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = 0; - ++n; - - (void)strncpy(x->info[n].key, PMIX_NODEID, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = 0; - ++n; - - (void)strncpy(x->info[n].key, PMIX_NODE_SIZE, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; - ++n; - (void)strncpy(x->info[n].key, PMIX_NUM_NODES, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = 1; - ++n; - - (void)strncpy(x->info[n].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; + n = 0; + (void)strncpy(x->info[n].key, PMIX_JOB_INFO_ARRAY, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_DATA_ARRAY; + if (model) { + PMIX_DATA_ARRAY_CREATE(x->info[n].value.data.darray, 10, PMIX_INFO); + } else { + PMIX_DATA_ARRAY_CREATE(x->info[n].value.data.darray, 9, PMIX_INFO); + } + iptr = (pmix_info_t*)x->info[n].value.data.darray->array; + PMIX_INFO_LOAD(&iptr[0], PMIX_NODE_MAP, regex, PMIX_STRING); + isv1 = &iptr[0]; + PMIX_INFO_LOAD(&iptr[1], PMIX_PROC_MAP, ppn, PMIX_STRING); + isv2 = &iptr[1]; + PMIX_INFO_LOAD(&iptr[2], PMIX_JOB_SIZE, &nprocs, PMIX_UINT32); + PMIX_INFO_LOAD(&iptr[3], PMIX_JOBID, "1234", PMIX_STRING); + PMIX_INFO_LOAD(&iptr[4], PMIX_UNIV_SIZE, &nprocs, PMIX_UINT32); + PMIX_INFO_LOAD(&iptr[5], PMIX_MAX_PROCS, &nprocs, PMIX_UINT32); + m = 1; + PMIX_INFO_LOAD(&iptr[6], PMIX_JOB_NUM_APPS, &m, PMIX_UINT32); + PMIX_INFO_LOAD(&iptr[7], PMIX_NUM_NODES, &nnodes, PMIX_UINT32); + PMIX_INFO_LOAD(&iptr[8], PMIX_SPAWNED, NULL, PMIX_BOOL); + if (model) { + PMIX_INFO_LOAD(&iptr[9], PMIX_PROGRAMMING_MODEL, "ompi", PMIX_STRING); + } ++n; - (void)strncpy(x->info[n].key, PMIX_MAX_PROCS, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = nprocs; - ++n; + /* we have the required info to run setup_app, so do that now */ + PMIX_INFO_CREATE(iptr, 4); + PMIX_INFO_XFER(&iptr[0], isv1); + PMIX_INFO_XFER(&iptr[1], isv2); + PMIX_INFO_LOAD(&iptr[2], PMIX_SETUP_APP_ENVARS, NULL, PMIX_BOOL); + PMIX_LOAD_KEY(iptr[3].key, PMIX_ALLOC_NETWORK); + iptr[3].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(iptr[3].value.data.darray, 2, PMIX_INFO); + ip = (pmix_info_t*)iptr[3].value.data.darray->array; + asprintf(&rks, "%s.net", nspace); + PMIX_INFO_LOAD(&ip[0], PMIX_ALLOC_NETWORK_ID, rks, PMIX_STRING); + free(rks); + PMIX_INFO_LOAD(&ip[1], PMIX_ALLOC_NETWORK_SEC_KEY, NULL, PMIX_BOOL); + PMIX_CONSTRUCT(&cd, myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_setup_application(nspace, iptr, 4, + setup_cbfunc, &cd))) { + pmix_output(0, "[%s:%d] PMIx_server_setup_application failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc)); + DEBUG_DESTRUCT_LOCK(&cd.lock); + } else { + DEBUG_WAIT_THREAD(&cd.lock); + } + PMIX_INFO_FREE(iptr, 4); - (void)strncpy(x->info[n].key, PMIX_JOB_NUM_APPS, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_UINT32; - x->info[n].value.data.uint32 = 1; - ++n; + /* use the results to setup the local subsystems */ + PMIX_CONSTRUCT(&lock, myxfer_t); + if (PMIX_SUCCESS != (rc = PMIx_server_setup_local_support(nspace, cd.info, cd.ninfo, + opcbfunc, &lock))) { + pmix_output(0, "[%s:%d] PMIx_server_setup_local_support failed: %s", __FILE__, __LINE__, PMIx_Error_string(rc)); + } else { + DEBUG_WAIT_THREAD(&lock.lock); + } + PMIX_DESTRUCT(&lock); + PMIX_DESTRUCT(&cd); - (void)strncpy(x->info[n].key, PMIX_LOCALLDR, PMIX_MAX_KEYLEN); - x->info[n].value.type = PMIX_PROC_RANK; - x->info[n].value.data.uint32 = 0; - ++n; + /* create the node-info arrays */ + for (m=0; m < nnodes; m++) { + (void)strncpy(x->info[n].key, PMIX_NODE_INFO_ARRAY, PMIX_MAX_KEYLEN); + x->info[n].value.type = PMIX_DATA_ARRAY; + PMIX_DATA_ARRAY_CREATE(x->info[n].value.data.darray, 3, PMIX_INFO); + iptr = (pmix_info_t*)x->info[n].value.data.darray->array; + if (xversion) { + PMIX_INFO_LOAD(&iptr[0], PMIX_HOSTNAME, pmix_globals.hostname, PMIX_STRING); + } else { + PMIX_INFO_LOAD(&iptr[0], PMIX_HOSTNAME, hostnames[m % 3], PMIX_STRING); + } + PMIX_INFO_LOAD(&iptr[1], PMIX_NODEID, &m, PMIX_UINT32); + PMIX_INFO_LOAD(&iptr[2], PMIX_NODE_SIZE, &nprocs, PMIX_UINT32); + ++n; + } /* add the proc-specific data */ for (m=0; m < nprocs; m++) { (void)strncpy(x->info[n].key, PMIX_PROC_DATA, PMIX_MAX_KEYLEN); x->info[n].value.type = PMIX_DATA_ARRAY; - PMIX_DATA_ARRAY_CREATE(array, 5, PMIX_INFO); + PMIX_DATA_ARRAY_CREATE(array, 6, PMIX_INFO); x->info[n].value.data.darray = array; info = (pmix_info_t*)array->array; k = 0; @@ -824,11 +882,21 @@ static void set_namespace(int nprocs, char *ranks, char *nspace, (void)strncpy(info[k].key, PMIX_NODEID, PMIX_MAX_KEYLEN); info[k].value.type = PMIX_UINT32; - info[k].value.data.uint32 = 0; + info[k].value.data.uint32 = m % 3; + ++k; + + (void)strncpy(info[k].key, PMIX_HOSTNAME, PMIX_MAX_KEYLEN); + info[k].value.type = PMIX_STRING; + if (xversion) { + info[k].value.data.string = strdup(pmix_globals.hostname); + } else { + info[k].value.data.string = strdup(hostnames[m % 3]); + } ++k; /* move to next proc */ ++n; } + PMIx_server_register_nspace(nspace, nprocs, x->info, x->ninfo, cbfunc, x); } @@ -1124,7 +1192,7 @@ static pmix_status_t spawn_fn(const pmix_proc_t *proc, x->spcbfunc = cbfunc; x->cbdata = cbdata; - set_namespace(2, "0,1", "DYNSPACE", spcbfunc, x); + set_namespace(2, "DYNSPACE", spcbfunc, x); return PMIX_SUCCESS; } diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_cd.c b/opal/mca/pmix/pmix3x/pmix/test/test_cd.c index f1a800202e2..3feb4f50474 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_cd.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_cd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,14 +45,14 @@ int test_connect_disconnect(char *my_nspace, int my_rank) rc = PMIx_Connect(&proc, 1, NULL, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Connect blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } TEST_VERBOSE(("%s:%d: Connect blocking test succeded", my_nspace, my_rank)); rc = PMIx_Disconnect(&proc, 1, NULL, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Disconnect blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } TEST_VERBOSE(("%s:%d: Disconnect blocking test succeded.", my_nspace, my_rank)); @@ -64,7 +64,7 @@ int test_connect_disconnect(char *my_nspace, int my_rank) } if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Connect non-blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } TEST_VERBOSE(("%s:%d: Connect non-blocking test succeded.", my_nspace, my_rank)); @@ -76,7 +76,7 @@ int test_connect_disconnect(char *my_nspace, int my_rank) } if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Disconnect non-blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } TEST_VERBOSE(("%s:%d: Disconnect non-blocking test succeded.", my_nspace, my_rank)); return PMIX_SUCCESS; diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.c b/opal/mca/pmix/pmix3x/pmix/test/test_common.c index 7b9ac8701d1..ca594bcad50 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.c @@ -21,6 +21,7 @@ #include int pmix_test_verbose = 0; +test_params params; FILE *file; @@ -92,6 +93,10 @@ void parse_cmd(int argc, char **argv, test_params *params) if (NULL != argv[i]) { params->nservers = atoi(argv[i]); } + if (2 < params->nservers) { + fprintf(stderr, "Only support up to 2 servers\n"); + exit(1); + } } else if( 0 == strcmp(argv[i], "--verbose") || 0 == strcmp(argv[i],"-v") ){ TEST_VERBOSE_ON(); params->verbose = 1; diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_common.h b/opal/mca/pmix/pmix3x/pmix/test/test_common.h index 490f68323be..2d6a33af0f5 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_common.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_common.h @@ -133,6 +133,8 @@ typedef struct { uint32_t lsize; } test_params; +extern test_params params; + #define INIT_TEST_PARAMS(params) do { \ params.nprocs = 1; \ params.verbose = 0; \ @@ -219,7 +221,6 @@ extern pmix_list_t test_fences; extern pmix_list_t *noise_range; extern pmix_list_t key_replace; -#define NODE_NAME "node1" int get_total_ns_number(test_params params); int get_all_ranks_from_namespace(test_params params, char *nspace, pmix_proc_t **ranks, size_t *nranks); @@ -284,7 +285,8 @@ typedef struct { nanosleep(&ts,NULL); \ count++; \ } \ - PMIX_ACQUIRE_OBJECT(&cbdata); \ + rc = cbdata.status; \ + PMIX_ACQUIRE_OBJECT(&cbdata); \ } \ } \ if (PMIX_SUCCESS == rc) { \ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_error.c b/opal/mca/pmix/pmix3x/pmix/test/test_error.c index 24a63da4917..34fa7c3fb48 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_error.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_error.c @@ -69,6 +69,9 @@ int test_error(char *my_nspace, int my_rank, test_params params) pmix_status_t status; pmix_proc_t source; + /* turn OFF event handler testing pending fix of timeout_errhandler */ + return PMIX_SUCCESS; + TEST_VERBOSE(("test-error: running error handling test cases")); /* register specific client error handlers and test their invocation * by trigerring events from server side*/ diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c index a33d9618b71..f479ce59113 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_fence.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_fence.c @@ -103,42 +103,42 @@ int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } PUT(int, fence_num+my_rank, PMIX_GLOBAL, fence_num, put_ind++, params.use_same_keys); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } PUT(float, fence_num+1.1, PMIX_GLOBAL, fence_num, put_ind++, params.use_same_keys); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } PUT(uint32_t, fence_num+14, PMIX_GLOBAL, fence_num, put_ind++, params.use_same_keys); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } PUT(uint16_t, fence_num+15, PMIX_GLOBAL, fence_num, put_ind++, params.use_same_keys); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } /* Submit the data */ if (PMIX_SUCCESS != (rc = PMIx_Commit())) { TEST_ERROR(("%s:%d: PMIx_Commit failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } /* setup the fence */ @@ -157,7 +157,7 @@ int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) TEST_ERROR(("%s:%d: PMIx_Fence failed: %d", my_nspace, my_rank, rc)); PMIX_LIST_DESTRUCT(&test_fences); PMIX_PROC_FREE(pcs, npcs); - return rc; + exit(rc); } /* replace all items in the list with PMIX_RANK_WILDCARD rank by real ranks to get their data. */ @@ -169,7 +169,7 @@ int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Can't parse --ns-dist value in order to get ranks for namespace %s", my_nspace, my_rank, p->proc.nspace)); PMIX_LIST_DESTRUCT(&test_fences); - return PMIX_ERROR; + exit(PMIX_ERROR); } pmix_list_remove_item(desc->participants, (pmix_list_item_t*)p); for (i = 0; i < nranks; i++) { @@ -192,35 +192,35 @@ int test_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank)); PMIX_PROC_FREE(pcs, npcs); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } GET(int, (int)(fence_num+p->proc.rank), p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 0, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank)); PMIX_PROC_FREE(pcs, npcs); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } GET(float, fence_num+1.1, p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 1, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank)); PMIX_PROC_FREE(pcs, npcs); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } GET(uint32_t, (uint32_t)fence_num+14, p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 0, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank)); PMIX_PROC_FREE(pcs, npcs); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } GET(uint16_t, fence_num+15, p->proc.nspace, p->proc.rank, fence_num, put_ind++, params.use_same_keys, 1, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Get failed (%d) from %s:%d", my_nspace, my_rank, rc, p->proc.nspace, p->proc.rank)); PMIX_PROC_FREE(pcs, npcs); PMIX_LIST_DESTRUCT(&test_fences); - return rc; + exit(rc); } } /* barrier across participating processes to prevent putting new values with the same key @@ -246,35 +246,35 @@ static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, p (void)strncpy(proc.nspace, my_nspace, PMIX_MAX_NSLEN); proc.rank = PMIX_RANK_WILDCARD; - /* get number of neighbours on this node */ + /* get number of neighbors on this node */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_SIZE, NULL, 0, &val))) { TEST_ERROR(("%s:%d: PMIx_Get local peer # failed: %d", my_nspace, my_rank, rc)); - return rc; + exit(rc); } if (NULL == val) { TEST_ERROR(("%s:%d: PMIx_Get local peer # returned NULL value", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } if (val->type != PMIX_UINT32 ) { TEST_ERROR(("%s:%d: local peer # attribute value type mismatch," " want %d get %d(%d)", my_nspace, my_rank, PMIX_UINT32, val->type)); - return PMIX_ERROR; + exit(PMIX_ERROR); } npeers = val->data.uint32; peers = malloc(sizeof(pmix_rank_t) * npeers); - /* get ranks of neighbours on this node */ + /* get ranks of neighbors on this node */ if (PMIX_SUCCESS != (rc = PMIx_Get(&proc, PMIX_LOCAL_PEERS, NULL, 0, &val))) { TEST_ERROR(("%s:%d: PMIx_Get local peers failed: %d", my_nspace, my_rank, rc)); free(peers); - return rc; + exit(rc); } if (NULL == val) { TEST_ERROR(("%s:%d: PMIx_Get local peers returned NULL value", my_nspace, my_rank)); free(peers); - return PMIX_ERROR; + exit(PMIX_ERROR); } if (val->type != PMIX_STRING ) { @@ -282,7 +282,7 @@ static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, p " want %d get %d(%d)", my_nspace, my_rank, PMIX_UINT32, val->type)); free(peers); - return PMIX_ERROR; + exit(PMIX_ERROR); } *count = 0; @@ -293,7 +293,7 @@ static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, p TEST_ERROR(("%s:%d: Bad peer ranks number: should be %d, actual %d (%s)", my_nspace, my_rank, npeers, *count, val->data.string)); free(peers); - return PMIX_ERROR; + exit(PMIX_ERROR); } token = strtok_r(str, ",", &sptr); str = NULL; @@ -302,7 +302,7 @@ static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, p if( *eptr != '\0' ){ TEST_ERROR(("%s:%d: Bad peer ranks string", my_nspace, my_rank)); free(peers); - return PMIX_ERROR; + exit(PMIX_ERROR); } } @@ -312,7 +312,7 @@ static int get_local_peers(char *my_nspace, int my_rank, pmix_rank_t **_peers, p TEST_ERROR(("%s:%d: Bad peer ranks number: should be %d, actual %d (%s)", my_nspace, my_rank, npeers, *count, val->data.string)); free(peers); - return PMIX_ERROR; + exit(PMIX_ERROR); } *_peers = peers; return PMIX_SUCCESS; @@ -335,84 +335,83 @@ int test_job_fence(test_params params, char *my_nspace, pmix_rank_t my_rank) PUT(int, 12340 + i, PMIX_LOCAL, 100, i, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); - return rc; + exit(rc); } (void)snprintf(sval, 50, "%s:%d", my_nspace, my_rank); PUT(string, sval, PMIX_REMOTE, 101, i, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); - return PMIX_ERROR; + exit(PMIX_ERROR); } PUT(float, (float)12.15 + i, PMIX_GLOBAL, 102, i, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Put failed: %d", my_nspace, my_rank, rc)); - return PMIX_ERROR; + exit(PMIX_ERROR); } } /* Submit the data */ if (PMIX_SUCCESS != (rc = PMIx_Commit())) { TEST_ERROR(("%s:%d: PMIx_Commit failed: %d", my_nspace, my_rank, rc)); - return PMIX_ERROR; + exit(PMIX_ERROR); } /* Perform a fence if was requested */ FENCE(!params.nonblocking, params.collect, NULL, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: PMIx_Fence failed: %d", my_nspace, my_rank, rc)); - return rc; + exit(rc); } if (PMIX_SUCCESS != (rc = get_local_peers(my_nspace, my_rank, &peers, &npeers))) { - return PMIX_ERROR; + exit(rc); } /* Check the predefined output */ for (i=0; i < (int)params.ns_size; i++) { - for (j=0; j < 3; j++) { - int local = 0; pmix_rank_t k; for(k=0; k= ns_num) { TEST_ERROR(("%s:%d: get_total_ns_number function failed", my_nspace, my_rank)); - return PMIX_ERROR; + exit(PMIX_ERROR); } for (n = 0; n < ns_num; n++) { memset(nspace, 0, PMIX_MAX_NSLEN+1); @@ -103,16 +103,20 @@ int test_resolve_peers(char *my_nspace, int my_rank, test_params params) TEST_VERBOSE(("%s:%d: Connect to %s succeeded.", my_nspace, my_rank, nspace)); } else { TEST_ERROR(("%s:%d: Connect to %s failed.", my_nspace, my_rank, nspace)); - return PMIX_ERROR; + exit(rc); } - /* then resolve peers from this namespace. */ - rc = resolve_nspace(nspace, params, my_nspace, my_rank); - if (PMIX_SUCCESS == rc) { - TEST_VERBOSE(("%s:%d: Resolve peers succeeded for ns %s\n", my_nspace, my_rank, nspace)); - } else { - PMIx_Disconnect(procs, 2, NULL, 0); - break; + /* then resolve peers from this namespace - earlier versions cannot handle + * cross-nspace peer resolution because their test servers don't provide + * the info. So check for a marker of either 3.1.5 or above */ + if (NULL != getenv("PMIX_VERSION")) { + rc = resolve_nspace(nspace, params, my_nspace, my_rank); + if (PMIX_SUCCESS == rc) { + TEST_VERBOSE(("%s:%d: Resolve peers succeeded for ns %s\n", my_nspace, my_rank, nspace)); + } else { + TEST_ERROR(("%s:%d: Resolve peers failed for different namespace\n", my_nspace, my_rank)); + exit(rc); + } } /* disconnect from the processes of this namespace. */ @@ -120,8 +124,8 @@ int test_resolve_peers(char *my_nspace, int my_rank, test_params params) if (PMIX_SUCCESS == rc) { TEST_VERBOSE(("%s:%d: Disconnect from %s succeeded %s.", my_nspace, my_rank, nspace)); } else { - TEST_ERROR(("%s:%d: Disconnect from %s failed %s.", my_nspace, my_rank, nspace)); - return PMIX_ERROR; + TEST_ERROR(("%s:%d: Disconnect from %s failed.", my_nspace, my_rank, nspace)); + exit(rc); } } if (PMIX_SUCCESS == rc) { diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.c b/opal/mca/pmix/pmix3x/pmix/test/test_server.c index 30d174a9567..0afda702b24 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_server.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.c @@ -12,6 +12,7 @@ * */ +#define _GNU_SOURCE #include #include #include @@ -21,6 +22,7 @@ #include "pmix_server.h" #include "src/include/pmix_globals.h" +#include "src/util/error.h" #include "test_server.h" #include "test_common.h" @@ -28,6 +30,7 @@ #include "server_callbacks.h" int my_server_id = 0; +int test_fail = 0; server_info_t *my_server_info = NULL; pmix_list_t *server_list = NULL; @@ -41,10 +44,14 @@ static void sdes(server_info_t *s) event_del(s->evread); } s->evread = NULL; + if (NULL != s->hostname) { + free(s->hostname); + } } static void scon(server_info_t *s) { + s->hostname = NULL; s->idx = 0; s->pid = 0; s->rd_fd = -1; @@ -115,14 +122,29 @@ static void fill_seq_ranks_array(size_t nprocs, int base_rank, char **ranks) } } +static int server_find_id(const char *nspace, int rank) +{ + server_nspace_t *tmp; + + PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { + if (0 == strcmp(tmp->name, nspace)) { + return tmp->task_map[rank]; + } + } + return -1; +} + static void set_namespace(int local_size, int univ_size, int base_rank, char *name) { size_t ninfo; pmix_info_t *info; ninfo = 8; - char *regex, *ppn; - char *ranks = NULL; + char *regex, *ppn, *tmp; + char *ranks = NULL, **nodes = NULL; + char **rks=NULL; + int i; + int rc; PMIX_INFO_CREATE(info, ninfo); pmix_strncpy(info[0].key, PMIX_UNIV_SIZE, PMIX_MAX_KEYLEN); @@ -145,23 +167,62 @@ static void set_namespace(int local_size, int univ_size, pmix_strncpy(info[3].key, PMIX_LOCAL_PEERS, PMIX_MAX_KEYLEN); info[3].value.type = PMIX_STRING; info[3].value.data.string = strdup(ranks); - free(ranks); - PMIx_generate_regex(NODE_NAME, ®ex); - pmix_strncpy(info[4].key, PMIX_NODE_MAP, PMIX_MAX_KEYLEN); - info[4].value.type = PMIX_STRING; - info[4].value.data.string = strdup(regex); + /* assemble the node and proc map info */ + if (1 == params.nservers) { + pmix_argv_append_nosize(&nodes, my_server_info->hostname); + } else { + char hostname[PMIX_MAXHOSTNAMELEN]; + for (i = 0; i < params.nservers; i++) { + snprintf(hostname, PMIX_MAXHOSTNAMELEN, "node%d", i); + pmix_argv_append_nosize(&nodes, hostname); + } + } + + if (NULL != nodes) { + tmp = pmix_argv_join(nodes, ','); + pmix_argv_free(nodes); + nodes = NULL; + if (PMIX_SUCCESS != (rc = PMIx_generate_regex(tmp, ®ex) )) { + PMIX_ERROR_LOG(rc); + return; + } + free(tmp); + PMIX_INFO_LOAD(&info[4], PMIX_NODE_MAP, regex, PMIX_STRING); + } - /* generate the global proc map */ - fill_seq_ranks_array(univ_size, 0, &ranks); - if (NULL == ranks) { - return; + /* generate the global proc map - if we have two + * servers, then the procs not on this server must + * be on the other */ + if (2 == params.nservers) { + pmix_argv_append_nosize(&rks, ranks); + free(ranks); + nodes = NULL; + if (0 == my_server_id) { + for (i=base_rank+local_size; i < univ_size; i++) { + asprintf(&ppn, "%d", i); + pmix_argv_append_nosize(&nodes, ppn); + free(ppn); + } + ppn = pmix_argv_join(nodes, ','); + pmix_argv_append_nosize(&rks, ppn); + free(ppn); + } else { + for (i=0; i < base_rank; i++) { + asprintf(&ppn, "%d", i); + pmix_argv_append_nosize(&nodes, ppn); + free(ppn); + } + ppn = pmix_argv_join(nodes, ','); + pmix_argv_prepend_nosize(&rks, ppn); + free(ppn); + } + ranks = pmix_argv_join(rks, ';'); } PMIx_generate_ppn(ranks, &ppn); free(ranks); - pmix_strncpy(info[5].key, PMIX_PROC_MAP, PMIX_MAX_KEYLEN); - info[5].value.type = PMIX_STRING; - info[5].value.data.string = strdup(ppn); + PMIX_INFO_LOAD(&info[5], PMIX_PROC_MAP, ppn, PMIX_STRING); + free(ppn); pmix_strncpy(info[6].key, PMIX_JOB_SIZE, PMIX_MAX_KEYLEN); info[6].value.type = PMIX_UINT32; @@ -171,7 +232,7 @@ static void set_namespace(int local_size, int univ_size, info[7].value.type = PMIX_UINT32; info[7].value.data.uint32 = getpid (); - int in_progress = 1, rc; + int in_progress = 1; if (PMIX_SUCCESS == (rc = PMIx_server_register_nspace(name, local_size, info, ninfo, release_cb, &in_progress))) { PMIX_WAIT_FOR_COMPLETION(in_progress); @@ -187,7 +248,7 @@ static void server_unpack_procs(char *buf, size_t size) char *nspace; while ((size_t)(ptr - buf) < size) { - ns_count = *(size_t *)ptr; + memcpy (&ns_count, ptr, sizeof(size_t)); ptr += sizeof(size_t); for (i = 0; i < ns_count; i++) { @@ -195,16 +256,16 @@ static void server_unpack_procs(char *buf, size_t size) size_t ltasks, ntasks; int server_id; - server_id = *(int *)ptr; + memcpy (&server_id, ptr, sizeof(int)); ptr += sizeof(int); nspace = ptr; ptr += PMIX_MAX_NSLEN+1; - ntasks = *(size_t *)ptr; + memcpy (&ntasks, ptr, sizeof(size_t)); ptr += sizeof(size_t); - ltasks = *(size_t *)ptr; + memcpy (<asks, ptr, sizeof(size_t)); ptr += sizeof(size_t); PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { @@ -226,7 +287,8 @@ static void server_unpack_procs(char *buf, size_t size) } size_t i; for (i = 0; i < ltasks; i++) { - int rank = *(int *)ptr; + int rank; + memcpy (&rank, ptr, sizeof(int)); ptr += sizeof(int); if (ns_item->task_map[rank] >= 0) { continue; @@ -614,18 +676,6 @@ int server_fence_contrib(char *data, size_t ndata, return rc; } -static int server_find_id(const char *nspace, int rank) -{ - server_nspace_t *tmp; - - PMIX_LIST_FOREACH(tmp, server_nspace, server_nspace_t) { - if (0 == strcmp(tmp->name, nspace)) { - return tmp->task_map[rank]; - } - } - return -1; -} - static int server_pack_dmdx(int sender_id, const char *nspace, int rank, char **buf) { @@ -724,9 +774,73 @@ int server_dmdx_get(const char *nspace, int rank, return PMIX_ERROR; } +static void set_handler_default(int sig) +{ + struct sigaction act; + + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + sigemptyset(&act.sa_mask); + + sigaction(sig, &act, (struct sigaction *)0); +} + +static pmix_event_t handler; +static void wait_signal_callback(int fd, short event, void *arg) +{ + pmix_event_t *sig = (pmix_event_t*) arg; + int status; + pid_t pid; + int i; + + if (SIGCHLD != pmix_event_get_signal(sig)) { + return; + } + + /* we can have multiple children leave but only get one + * sigchild callback, so reap all the waitpids until we + * don't get anything valid back */ + while (1) { + pid = waitpid(-1, &status, WNOHANG); + if (-1 == pid && EINTR == errno) { + /* try it again */ + continue; + } + /* if we got garbage, then nothing we can do */ + if (pid <= 0) { + goto done; + } + /* we are already in an event, so it is safe to access the list */ + for(i=0; i < cli_info_cnt; i++){ + if( cli_info[i].pid == pid ){ + /* found it! */ + if (WIFEXITED(status)) { + cli_info[i].exit_code = WEXITSTATUS(status); + } else { + if (WIFSIGNALED(status)) { + cli_info[i].exit_code = WTERMSIG(status) + 128; + } + } + cli_cleanup(&cli_info[i]); + cli_info[i].alive = false; + break; + } + } + } + done: + for(i=0; i < cli_info_cnt; i++){ + if (cli_info[i].alive) { + /* someone is still alive */ + return; + } + } + /* get here if nobody is still alive */ + test_complete = true; +} + int server_init(test_params *params) { - pmix_info_t info[1]; + pmix_info_t info[2]; int rc = PMIX_SUCCESS; /* fork/init servers procs */ @@ -754,7 +868,9 @@ int server_init(test_params *params) } if (pid == 0) { server_list = PMIX_NEW(pmix_list_t); + my_server_info = server_info; my_server_id = i; + asprintf(&server_info->hostname, "node%d", i); server_info->idx = 0; server_info->pid = getppid(); server_info->rd_fd = fd1[0]; @@ -765,6 +881,7 @@ int server_init(test_params *params) pmix_list_append(server_list, &server_info->super); break; } + asprintf(&server_info->hostname, "node%d", i); server_info->idx = i; server_info->pid = pid; server_info->wr_fd = fd1[1]; @@ -774,6 +891,7 @@ int server_init(test_params *params) close(fd2[1]); } else { my_server_info = server_info; + server_info->hostname = strdup("node0"); server_info->pid = getpid(); server_info->idx = 0; server_info->rd_fd = fd1[0]; @@ -791,13 +909,13 @@ int server_init(test_params *params) params->nprocs / params->nservers + 1 : params->nprocs / params->nservers; /* setup the server library */ - (void)strncpy(info[0].key, PMIX_SOCKET_MODE, PMIX_MAX_KEYLEN); - info[0].value.type = PMIX_UINT32; - info[0].value.data.uint32 = 0666; + uint32_t u32 = 0666; + PMIX_INFO_LOAD(&info[0], PMIX_SOCKET_MODE, &u32, PMIX_UINT32); + PMIX_INFO_LOAD(&info[1], PMIX_HOSTNAME, my_server_info->hostname, PMIX_STRING); server_nspace = PMIX_NEW(pmix_list_t); - if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 1))) { + if (PMIX_SUCCESS != (rc = PMIx_server_init(&mymodule, info, 2))) { TEST_ERROR(("Init failed with error %d", rc)); goto error; } @@ -812,9 +930,17 @@ int server_init(test_params *params) } } +#if 0 /* register the errhandler */ PMIx_Register_event_handler(NULL, 0, NULL, 0, errhandler, errhandler_reg_callbk, NULL); +#endif + + /* setup to see sigchld on the forked tests */ + pmix_event_assign(&handler, pmix_globals.evbase, SIGCHLD, + EV_SIGNAL|EV_PERSIST, wait_signal_callback, &handler); + pmix_event_add(&handler, NULL); + if (0 != (rc = server_barrier())) { goto error; @@ -832,6 +958,7 @@ int server_finalize(test_params *params) int rc = PMIX_SUCCESS; int total_ret = 0; + total_ret = test_fail; if (0 != (rc = server_barrier())) { total_ret++; goto exit; @@ -852,11 +979,6 @@ int server_finalize(test_params *params) PMIX_LIST_RELEASE(server_list); TEST_VERBOSE(("SERVER %d FINALIZE PID:%d with status %d", my_server_id, getpid(), ret)); - if (0 == total_ret) { - TEST_OUTPUT(("Test finished OK!")); - } else { - rc = PMIX_ERROR; - } } PMIX_LIST_RELEASE(server_nspace); @@ -866,6 +988,11 @@ int server_finalize(test_params *params) total_ret += rc; goto exit; } + if (0 == total_ret) { + TEST_OUTPUT(("Test finished OK!")); + } else { + TEST_OUTPUT(("Test FAILED!")); + } exit: return total_ret; @@ -932,6 +1059,7 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, cli_kill_all(); return rc; } + TEST_VERBOSE(("run %s:%d", proc.nspace, proc.rank)); cli_info[cli_counter].pid = fork(); if (cli_info[cli_counter].pid < 0) { @@ -966,6 +1094,15 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, pmix_argv_append_nosize(&client_argv, digit); if (cli_info[cli_counter].pid == 0) { + sigset_t sigs; + set_handler_default(SIGTERM); + set_handler_default(SIGINT); + set_handler_default(SIGHUP); + set_handler_default(SIGPIPE); + set_handler_default(SIGCHLD); + sigprocmask(0, 0, &sigs); + sigprocmask(SIG_UNBLOCK, &sigs, 0); + if( !TEST_VERBOSE_GET() ){ // Hide clients stdout if (NULL == freopen("/dev/null","w", stdout)) { @@ -977,6 +1114,7 @@ int server_launch_clients(int local_size, int univ_size, int base_rank, TEST_ERROR(("execve() failed")); return 0; } + cli_info[cli_counter].alive = true; cli_info[cli_counter].state = CLI_FORKED; pmix_argv_free(client_argv); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_server.h b/opal/mca/pmix/pmix3x/pmix/test/test_server.h index 09767ea56f4..2cd78b88fec 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_server.h +++ b/opal/mca/pmix/pmix3x/pmix/test/test_server.h @@ -2,7 +2,7 @@ * Copyright (c) 2018 Mellanox Technologies, Inc. * All rights reserved. * - * Copyright (c) 2018 Intel, Inc. All rights reserved. + * Copyright (c) 2018-2019 Intel, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,6 +37,7 @@ typedef struct { struct server_info_t { pmix_list_item_t super; + char *hostname; pid_t pid; int idx; int rd_fd; @@ -64,6 +65,7 @@ extern int my_server_id; extern pmix_list_t *server_list; extern server_info_t *my_server_info; extern pmix_list_t *server_nspace; +extern int test_fail; int server_init(test_params *params); int server_finalize(test_params *params); diff --git a/opal/mca/pmix/pmix3x/pmix/test/test_spawn.c b/opal/mca/pmix/pmix3x/pmix/test/test_spawn.c index 9251d4de0d5..8956752d81e 100644 --- a/opal/mca/pmix/pmix3x/pmix/test/test_spawn.c +++ b/opal/mca/pmix/pmix3x/pmix/test/test_spawn.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2015-2019 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies, Inc. * All rights reserved. * $COPYRIGHT$ @@ -39,7 +39,7 @@ static int test_spawn_common(char *my_nspace, int my_rank, int blocking) if (blocking) { if (PMIX_SUCCESS != (rc = PMIx_Spawn(NULL, 0, apps, napps, nspace))) { PMIX_APP_FREE(apps, napps); - return rc; + exit(rc); } } else { spawn_cbdata cbdata; @@ -48,14 +48,14 @@ static int test_spawn_common(char *my_nspace, int my_rank, int blocking) rc = PMIx_Spawn_nb(NULL, 0, apps, napps, spawn_cb, (void*)&cbdata); if (PMIX_SUCCESS != rc) { PMIX_APP_FREE(apps, napps); - return rc; + exit(rc); } PMIX_WAIT_FOR_COMPLETION(cbdata.in_progress); strncpy(nspace, cbdata.nspace, strlen(cbdata.nspace)+1); } PMIX_APP_FREE(apps, napps); if (strncmp(nspace, "foobar", strlen(nspace)+1)) { - return PMIX_ERROR; + exit(PMIX_ERROR); } return rc; } @@ -66,13 +66,13 @@ int test_spawn(char *my_nspace, int my_rank) rc = test_spawn_common(my_nspace, my_rank, 1); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Spawn blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(rc); } TEST_VERBOSE(("%s:%d: Spawn blocking test succeded.", my_nspace, my_rank)); rc = test_spawn_common(my_nspace, my_rank, 0); if (PMIX_SUCCESS != rc) { TEST_ERROR(("%s:%d: Spawn non-blocking test failed.", my_nspace, my_rank)); - return PMIX_ERROR; + exit(rc); } TEST_VERBOSE(("%s:%d: Spawn non-blocking test succeded.", my_nspace, my_rank)); return PMIX_SUCCESS; From f136804c453a75763241158d9821ccee4ac4b5f7 Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Tue, 4 Feb 2020 22:20:27 +0100 Subject: [PATCH 518/674] hwloc/base: fix opal proc locality wrt to NUMA nodes on hwloc 1.11 Build was broken by mistake in commit d40662edc41a5a4d09ae690b640cfdeeb24e15a1 Fixes #7362 Signed-off-by: Brice Goglin (cherry picked from commit 907ad854b46b42ae7cb1e9c87238691a5cc25e36) --- opal/mca/hwloc/base/hwloc_base_util.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index f88f990311c..80d6b95ab0e 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -19,8 +19,8 @@ * Copyright (C) 2018 Mellanox Technologies, Ltd. * All rights reserved. * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. - * Copyright (c) 2019 IBM Corporation. All rights reserved. - * Copyright (c) 2019 Inria. All rights reserved. + * Copyright (c) 2019 IBM Corporation. All rights reserved. + * Copyright (c) 2019-2020 Inria. All rights reserved. * Copyright (c) 2020 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * @@ -2181,15 +2181,16 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, locality = t2; break; #if HWLOC_API_VERSION < 0x20000 - case HWLOC_OBJ_CACHE: - if (3 == obj->attr->cache.depth) { + case HWLOC_OBJ_CACHE: { + unsigned cachedepth = hwloc_get_obj_by_depth(topo, d, 0)->attr->cache.depth; + if (3 == cachedepth) { asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { free(locality); } locality = t2; break; - } else if (2 == obj->attr->cache.depth) { + } else if (2 == cachedepth) { asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { free(locality); @@ -2205,6 +2206,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, break; } break; + } #else case HWLOC_OBJ_L3CACHE: asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); @@ -2257,7 +2259,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo, * that we came up empty at this depth */ if (!hwloc_bitmap_iszero(result)) { hwloc_bitmap_list_asprintf(&tmp, result); - opal_asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp); + asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { free(locality); } From ff6b068b9333a51b6e4da7e603adc6ed51007912 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Tue, 11 Feb 2020 15:55:42 -0500 Subject: [PATCH 519/674] Fix pgcc18 support. - pgcc18 defines __GNUC__ similar to Intel compilers. So we must check for pgi higher up, or else configury will mistake it for gcc. Signed-off-by: Austen Lauria (cherry picked from commit 14785deb3c6609cb3f6763d0e07a49e86588c4da) --- config/opal_check_vendor.m4 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/config/opal_check_vendor.m4 b/config/opal_check_vendor.m4 index 056d9397592..ed789287e6e 100644 --- a/config/opal_check_vendor.m4 +++ b/config/opal_check_vendor.m4 @@ -102,14 +102,20 @@ AC_DEFUN([_OPAL_CHECK_COMPILER_VENDOR], [ opal_check_compiler_vendor_result="unknown" # GNU is probably the most common, so check that one as soon as - # possible. Intel pretends to be GNU, so need to check Intel - # before checking for GNU. + # possible. Intel and PGI18 pretends to be GNU, so need to check Intel + # and PGI before checking for GNU. # Intel AS_IF([test "$opal_check_compiler_vendor_result" = "unknown"], [OPAL_IF_IFELSE([defined(__INTEL_COMPILER) || defined(__ICC)], [opal_check_compiler_vendor_result="intel"])]) + # Portland Group + AS_IF([test "$opal_check_compiler_vendor_result" = "unknown"], + [OPAL_IFDEF_IFELSE([__PGI], + [opal_check_compiler_vendor_result="portland group"])]) + + # Fujitsu AS_IF([test "$opal_check_compiler_vendor_result" = "unknown"], [OPAL_IF_IFELSE([defined(__FUJITSU)], @@ -243,11 +249,6 @@ AC_DEFUN([_OPAL_CHECK_COMPILER_VENDOR], [ [OPAL_IFDEF_IFELSE([__POCC__], [opal_check_compiler_vendor_result="pelles"])]) - # Portland Group - AS_IF([test "$opal_check_compiler_vendor_result" = "unknown"], - [OPAL_IFDEF_IFELSE([__PGI], - [opal_check_compiler_vendor_result="portland group"])]) - # SAS/C AS_IF([test "$opal_check_compiler_vendor_result" = "unknown"], [OPAL_IF_IFELSE([defined(SASC) || defined(__SASC) || defined(__SASC__)], From eeb68215508c705f7b1deb2878e8babd92c3a5cd Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 11 Feb 2020 21:57:24 -0800 Subject: [PATCH 520/674] osc/rdma: modify attach to check for region overlap This commit addresses two issues in osc/rdma: 1) It is erroneous to attach regions that overlap. This was being allowed but the standard does not allow overlapping attachments. 2) Overlapping registration regions (4k alignment of attachments) appear to be allowed. Add attachment bases to the bookeeping structure so we can keep better track of what can be detached. It is possible that the standard did not intend to allow #2. If that is the case then #2 should fail in the same way as #1. There should be no technical reason to disallow #2 at this time. References #7384 Signed-off-by: Nathan Hjelm (cherry picked from commit 6649aef8bde750d2f1f28e52ff295919face3e0b) Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma.h | 3 +- ompi/mca/osc/rdma/osc_rdma_component.c | 7 +- ompi/mca/osc/rdma/osc_rdma_dynamic.c | 213 ++++++++++++++++++------- ompi/mca/osc/rdma/osc_rdma_module.c | 5 +- ompi/mca/osc/rdma/osc_rdma_types.h | 22 ++- 5 files changed, 183 insertions(+), 67 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma.h b/ompi/mca/osc/rdma/osc_rdma.h index 6aed111ddf0..8e8ecd0acfd 100644 --- a/ompi/mca/osc/rdma/osc_rdma.h +++ b/ompi/mca/osc/rdma/osc_rdma.h @@ -13,6 +13,7 @@ * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2013 Sandia National Laboratories. All rights reserved. * Copyright (c) 2016-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -248,7 +249,7 @@ struct ompi_osc_rdma_module_t { /** registration handles for dynamically attached regions. These are not stored * in the state structure as it is entirely local. */ - ompi_osc_rdma_handle_t *dynamic_handles; + ompi_osc_rdma_handle_t **dynamic_handles; /** shared memory segment. this segment holds this node's portion of the rank -> node * mapping array, node communication data (node_comm_info), state for all local ranks, diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index d1e99b98dd1..3c136701d91 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -20,6 +20,7 @@ * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -221,7 +222,7 @@ static int ompi_osc_rdma_component_register (void) asprintf(&description_str, "Maximum number of buffers that can be attached to a dynamic window. " "Keep in mind that each attached buffer will use a potentially limited " "resource (default: %d)", mca_osc_rdma_component.max_attach); - (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "max_attach", description_str, + (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "max_attach", description_str, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_SCOPE_GROUP, &mca_osc_rdma_component.max_attach); free(description_str); @@ -1257,8 +1258,8 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base, if (MPI_WIN_FLAVOR_DYNAMIC == flavor) { /* allocate space to store local btl handles for attached regions */ - module->dynamic_handles = (ompi_osc_rdma_handle_t *) calloc (mca_osc_rdma_component.max_attach, - sizeof (module->dynamic_handles[0])); + module->dynamic_handles = (ompi_osc_rdma_handle_t **) calloc (mca_osc_rdma_component.max_attach, + sizeof (module->dynamic_handles[0])); if (NULL == module->dynamic_handles) { ompi_osc_rdma_free (win); return OMPI_ERR_OUT_OF_RESOURCE; diff --git a/ompi/mca/osc/rdma/osc_rdma_dynamic.c b/ompi/mca/osc/rdma/osc_rdma_dynamic.c index c1c21581e94..50a18a66048 100644 --- a/ompi/mca/osc/rdma/osc_rdma_dynamic.c +++ b/ompi/mca/osc/rdma/osc_rdma_dynamic.c @@ -2,6 +2,7 @@ /* * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -16,6 +17,22 @@ #include "opal/util/sys_limits.h" +static void ompi_osc_rdma_handle_init (ompi_osc_rdma_handle_t *rdma_handle) +{ + rdma_handle->btl_handle = NULL; + OBJ_CONSTRUCT(&rdma_handle->attachments, opal_list_t); +} + +static void ompi_osc_rdma_handle_fini (ompi_osc_rdma_handle_t *rdma_handle) +{ + OPAL_LIST_DESTRUCT(&rdma_handle->attachments); +} + +OBJ_CLASS_INSTANCE(ompi_osc_rdma_handle_t, opal_object_t, ompi_osc_rdma_handle_init, + ompi_osc_rdma_handle_fini); + +OBJ_CLASS_INSTANCE(ompi_osc_rdma_attachment_t, opal_list_item_t, NULL, NULL); + /** * ompi_osc_rdma_find_region_containing: * @@ -48,13 +65,16 @@ static inline ompi_osc_rdma_region_t *ompi_osc_rdma_find_region_containing (ompi region_bound = (intptr_t) (region->base + region->len); - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "checking memory region %p-%p against %p-%p (index %d) (min_index = %d, max_index = %d)", - (void *) base, (void *) bound, (void *) region->base, (void *)(region->base + region->len), mid_index, - min_index, max_index); + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "checking memory region %p-%p against %p-%p (index %d) (min_index = %d, " + "max_index = %d)", (void *) base, (void *) bound, (void *) region->base, + (void *)(region->base + region->len), mid_index, min_index, max_index); if (region->base > base) { - return ompi_osc_rdma_find_region_containing (regions, min_index, mid_index-1, base, bound, region_size, region_index); - } else if (bound <= region_bound) { + return ompi_osc_rdma_find_region_containing (regions, min_index, mid_index-1, base, bound, region_size, + region_index); + } + + if (bound <= region_bound) { if (region_index) { *region_index = mid_index; } @@ -66,24 +86,76 @@ static inline ompi_osc_rdma_region_t *ompi_osc_rdma_find_region_containing (ompi } /* binary search for insertion point */ -static ompi_osc_rdma_region_t *find_insertion_point (ompi_osc_rdma_region_t *regions, int min_index, int max_index, intptr_t base, - size_t region_size, int *region_index) +static ompi_osc_rdma_region_t *find_insertion_point (ompi_osc_rdma_region_t *regions, int min_index, int max_index, + intptr_t base, size_t region_size, int *region_index) { int mid_index = (max_index + min_index) >> 1; ompi_osc_rdma_region_t *region = (ompi_osc_rdma_region_t *)((intptr_t) regions + mid_index * region_size); - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "find_insertion_point (%d, %d, %lx, %lu)\n", min_index, max_index, base, region_size); + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "find_insertion_point (%d, %d, %lx, %lu)\n", min_index, max_index, base, + region_size); if (max_index < min_index) { *region_index = min_index; return (ompi_osc_rdma_region_t *)((intptr_t) regions + min_index * region_size); } - if (region->base > base) { + if (region->base > base || (region->base == base && region->len > region_size)) { return find_insertion_point (regions, min_index, mid_index-1, base, region_size, region_index); - } else { - return find_insertion_point (regions, mid_index+1, max_index, base, region_size, region_index); } + + return find_insertion_point (regions, mid_index+1, max_index, base, region_size, region_index); +} + +static bool ompi_osc_rdma_find_conflicting_attachment (ompi_osc_rdma_handle_t *handle, intptr_t base, intptr_t bound) +{ + ompi_osc_rdma_attachment_t *attachment; + + OPAL_LIST_FOREACH(attachment, &handle->attachments, ompi_osc_rdma_attachment_t) { + intptr_t region_bound = attachment->base + attachment->len; + if (base >= attachment->base && base < region_bound || + bound > attachment->base && bound <= region_bound) { + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "existing region {%p, %p} overlaps region {%p, %p}", + (void *) attachment->base, (void *) region_bound, (void *) base, (void *) bound); + return true; + } + } + + return false; +} + +static int ompi_osc_rdma_add_attachment (ompi_osc_rdma_handle_t *handle, intptr_t base, size_t len) +{ + ompi_osc_rdma_attachment_t *attachment = OBJ_NEW(ompi_osc_rdma_attachment_t); + assert (NULL != attachment); + + if (ompi_osc_rdma_find_conflicting_attachment(handle, base, base + len)) { + return OMPI_ERR_RMA_ATTACH; + } + + attachment->base = base; + attachment->len = len; + + opal_list_append (&handle->attachments, &attachment->super); + + return OMPI_SUCCESS; +} + +static int ompi_osc_rdma_remove_attachment (ompi_osc_rdma_handle_t *handle, intptr_t base) +{ + ompi_osc_rdma_attachment_t *attachment; + + OPAL_LIST_FOREACH(attachment, &handle->attachments, ompi_osc_rdma_attachment_t) { + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "checking attachment %p against %p", + (void *) attachment->base, (void *) base); + if (attachment->base == (intptr_t) base) { + opal_list_remove_item (&handle->attachments, &attachment->super); + OBJ_RELEASE(attachment); + return OMPI_SUCCESS; + } + } + + return OMPI_ERR_NOT_FOUND; } int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len) @@ -92,12 +164,13 @@ int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len) const int my_rank = ompi_comm_rank (module->comm); ompi_osc_rdma_peer_t *my_peer = ompi_osc_rdma_module_peer (module, my_rank); ompi_osc_rdma_region_t *region; + ompi_osc_rdma_handle_t *rdma_region_handle; osc_rdma_counter_t region_count; osc_rdma_counter_t region_id; - void *bound; + intptr_t bound, aligned_base, aligned_bound; intptr_t page_size = opal_getpagesize (); - int region_index; - int ret; + int region_index, ret; + size_t aligned_len; if (module->flavor != MPI_WIN_FLAVOR_DYNAMIC) { return OMPI_ERR_RMA_FLAVOR; @@ -117,23 +190,26 @@ int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len) if (region_count == mca_osc_rdma_component.max_attach) { OPAL_THREAD_UNLOCK(&module->lock); + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "attach: could not attach. max attachment count reached."); return OMPI_ERR_RMA_ATTACH; } /* it is wasteful to register less than a page. this may allow the remote side to access more * memory but the MPI standard covers this with calling the calling behavior erroneous */ - bound = (void *)OPAL_ALIGN((intptr_t) base + len, page_size, intptr_t); - base = (void *)((intptr_t) base & ~(page_size - 1)); - len = (size_t)((intptr_t) bound - (intptr_t) base); - - /* see if a matching region already exists */ - region = ompi_osc_rdma_find_region_containing ((ompi_osc_rdma_region_t *) module->state->regions, 0, region_count - 1, (intptr_t) base, - (intptr_t) bound, module->region_size, ®ion_index); + bound = (intptr_t) base + len; + aligned_bound = OPAL_ALIGN((intptr_t) base + len, page_size, intptr_t); + aligned_base = (intptr_t) base & ~(page_size - 1); + aligned_len = (size_t)(aligned_bound - aligned_base); + + /* see if a registered region already exists */ + region = ompi_osc_rdma_find_region_containing ((ompi_osc_rdma_region_t *) module->state->regions, 0, region_count - 1, + aligned_base, aligned_bound, module->region_size, ®ion_index); if (NULL != region) { - ++module->dynamic_handles[region_index].refcnt; + /* validates that the region does not overlap with an existing region even if they are on the same page */ + ret = ompi_osc_rdma_add_attachment (module->dynamic_handles[region_index], (intptr_t) base, len); OPAL_THREAD_UNLOCK(&module->lock); /* no need to invalidate remote caches */ - return OMPI_SUCCESS; + return ret; } /* region is in flux */ @@ -144,45 +220,50 @@ int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len) /* do a binary seach for where the region should be inserted */ if (region_count) { - region = find_insertion_point ((ompi_osc_rdma_region_t *) module->state->regions, 0, region_count - 1, (intptr_t) base, - module->region_size, ®ion_index); + region = find_insertion_point ((ompi_osc_rdma_region_t *) module->state->regions, 0, region_count - 1, + (intptr_t) base, module->region_size, ®ion_index); if (region_index < region_count) { - memmove ((void *) ((intptr_t) region + module->region_size), region, (region_count - region_index) * module->region_size); - - if (module->selected_btl->btl_register_mem) { - memmove (module->dynamic_handles + region_index + 1, module->dynamic_handles + region_index, - (region_count - region_index) * sizeof (module->dynamic_handles[0])); - } + memmove ((void *) ((intptr_t) region + module->region_size), region, + (region_count - region_index) * module->region_size); + memmove (module->dynamic_handles + region_index + 1, module->dynamic_handles + region_index, + (region_count - region_index) * sizeof (module->dynamic_handles[0])); } } else { region_index = 0; region = (ompi_osc_rdma_region_t *) module->state->regions; } - region->base = (intptr_t) base; - region->len = len; + region->base = aligned_base; + region->len = aligned_len; + + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "attaching dynamic memory region {%p, %p} aligned {%p, %p}, at index %d", + base, (void *) bound, (void *) aligned_base, (void *) aligned_bound, region_index); - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_DEBUG, "attaching dynamic memory region {%p, %p} at index %d", - base, (void *)((intptr_t) base + len), region_index); + /* add RDMA region handle to track this region */ + rdma_region_handle = OBJ_NEW(ompi_osc_rdma_handle_t); + assert (NULL != rdma_region_handle); if (module->selected_btl->btl_register_mem) { mca_btl_base_registration_handle_t *handle; - ret = ompi_osc_rdma_register (module, MCA_BTL_ENDPOINT_ANY, (void *) region->base, region->len, MCA_BTL_REG_FLAG_ACCESS_ANY, - &handle); + ret = ompi_osc_rdma_register (module, MCA_BTL_ENDPOINT_ANY, (void *) region->base, region->len, + MCA_BTL_REG_FLAG_ACCESS_ANY, &handle); if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) { OPAL_THREAD_UNLOCK(&module->lock); + OBJ_RELEASE(rdma_region_handle); return OMPI_ERR_RMA_ATTACH; } memcpy (region->btl_handle_data, handle, module->selected_btl->btl_registration_handle_size); - module->dynamic_handles[region_index].btl_handle = handle; + rdma_region_handle->btl_handle = handle; } else { - module->dynamic_handles[region_index].btl_handle = NULL; + rdma_region_handle->btl_handle = NULL; } - module->dynamic_handles[region_index].refcnt = 1; + assert(OMPI_SUCCESS == ompi_osc_rdma_add_attachment (rdma_region_handle, (intptr_t) base, len)); + + module->dynamic_handles[region_index] = rdma_region_handle; #if OPAL_ENABLE_DEBUG for (int i = 0 ; i < region_count + 1 ; ++i) { @@ -211,9 +292,11 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base) ompi_osc_rdma_module_t *module = GET_MODULE(win); const int my_rank = ompi_comm_rank (module->comm); ompi_osc_rdma_peer_dynamic_t *my_peer = (ompi_osc_rdma_peer_dynamic_t *) ompi_osc_rdma_module_peer (module, my_rank); + ompi_osc_rdma_handle_t *rdma_region_handle; osc_rdma_counter_t region_count, region_id; ompi_osc_rdma_region_t *region; - int region_index; + void *bound; + int start_index = INT_MAX, region_index; if (module->flavor != MPI_WIN_FLAVOR_DYNAMIC) { return OMPI_ERR_WIN; @@ -221,24 +304,34 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base) OPAL_THREAD_LOCK(&module->lock); - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "detach: %s, %p", win->w_name, base); - /* the upper 4 bytes of the region count are an instance counter */ region_count = module->state->region_count & 0xffffffffL; region_id = module->state->region_count >> 32; - region = ompi_osc_rdma_find_region_containing ((ompi_osc_rdma_region_t *) module->state->regions, 0, - region_count - 1, (intptr_t) base, (intptr_t) base + 1, - module->region_size, ®ion_index); - if (NULL == region) { - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "could not find dynamic memory region starting at %p", base); - OPAL_THREAD_UNLOCK(&module->lock); - return OMPI_ERROR; + /* look up the associated region */ + for (region_index = 0 ; region_index < region_count ; ++region_index) { + rdma_region_handle = module->dynamic_handles[region_index]; + region = (ompi_osc_rdma_region_t *) ((intptr_t) module->state->regions + region_index * module->region_size); + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "checking attachments at index %d {.base=%p, len=%lu} for attachment %p" + ", region handle=%p", region_index, (void *) region->base, region->len, base, rdma_region_handle); + + if (region->base > (uintptr_t) base || (region->base + region->len) < (uintptr_t) base) { + continue; + } + + if (OPAL_SUCCESS == ompi_osc_rdma_remove_attachment (rdma_region_handle, (intptr_t) base)) { + break; + } } - if (--module->dynamic_handles[region_index].refcnt > 0) { + if (region_index == region_count) { + OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_INFO, "could not find dynamic memory attachment for %p", base); OPAL_THREAD_UNLOCK(&module->lock); - OSC_RDMA_VERBOSE(MCA_BASE_VERBOSE_TRACE, "detach complete"); + return OMPI_ERR_BASE; + } + + if (!opal_list_is_empty (&rdma_region_handle->attachments)) { + /* another region is referencing this attachment */ return OMPI_SUCCESS; } @@ -249,21 +342,21 @@ int ompi_osc_rdma_detach (struct ompi_win_t *win, const void *base) base, (void *)((intptr_t) base + region->len), region_index); if (module->selected_btl->btl_register_mem) { - ompi_osc_rdma_deregister (module, module->dynamic_handles[region_index].btl_handle); + ompi_osc_rdma_deregister (module, rdma_region_handle->btl_handle); - if (region_index < region_count - 1) { - memmove (module->dynamic_handles + region_index, module->dynamic_handles + region_index + 1, - (region_count - region_index - 1) * sizeof (void *)); - } - - memset (module->dynamic_handles + region_count - 1, 0, sizeof (module->dynamic_handles[0])); } if (region_index < region_count - 1) { + size_t end_count = region_count - region_index - 1; + memmove (module->dynamic_handles + region_index, module->dynamic_handles + region_index + 1, + end_count * sizeof (module->dynamic_handles[0])); memmove (region, (void *)((intptr_t) region + module->region_size), - (region_count - region_index - 1) * module->region_size);; + end_count * module->region_size); } + OBJ_RELEASE(rdma_region_handle); + module->dynamic_handles[region_count - 1] = NULL; + module->state->region_count = ((region_id + 1) << 32) | (region_count - 1); ompi_osc_rdma_lock_release_exclusive (module, &my_peer->super, offsetof (ompi_osc_rdma_state_t, regions_lock)); diff --git a/ompi/mca/osc/rdma/osc_rdma_module.c b/ompi/mca/osc/rdma/osc_rdma_module.c index 40765cb2d23..90e8b439c78 100644 --- a/ompi/mca/osc/rdma/osc_rdma_module.c +++ b/ompi/mca/osc/rdma/osc_rdma_module.c @@ -14,6 +14,7 @@ * Copyright (c) 2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. + * Copyright (c) 2020 Google, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -79,7 +80,9 @@ int ompi_osc_rdma_free(ompi_win_t *win) int region_count = module->state->region_count & 0xffffffffL; if (NULL != module->dynamic_handles) { for (int i = 0 ; i < region_count ; ++i) { - ompi_osc_rdma_deregister (module, module->dynamic_handles[i].btl_handle); + ompi_osc_rdma_handle_t *region_handle = module->dynamic_handles[i]; + ompi_osc_rdma_deregister (module, region_handle->btl_handle); + OBJ_RELEASE(region_handle); } free (module->dynamic_handles); diff --git a/ompi/mca/osc/rdma/osc_rdma_types.h b/ompi/mca/osc/rdma/osc_rdma_types.h index 4acb40154de..f4f96b8ff38 100644 --- a/ompi/mca/osc/rdma/osc_rdma_types.h +++ b/ompi/mca/osc/rdma/osc_rdma_types.h @@ -2,6 +2,7 @@ /* * 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 @@ -109,6 +110,21 @@ struct ompi_osc_rdma_region_t { }; typedef struct ompi_osc_rdma_region_t ompi_osc_rdma_region_t; +/** + * @brief data handle for attached memory region + * + * This structure describes an attached memory region. It is used + * to track the exact parameters passed to MPI_Win_attach to + * validate a new attachment as well as handle detach. + */ +struct ompi_osc_rdma_attachment_t { + opal_list_item_t super; + intptr_t base; + size_t len; +}; +typedef struct ompi_osc_rdma_attachment_t ompi_osc_rdma_attachment_t; +OBJ_CLASS_DECLARATION(ompi_osc_rdma_attachment_t); + /** * @brief data handle for dynamic memory regions * @@ -118,12 +134,14 @@ typedef struct ompi_osc_rdma_region_t ompi_osc_rdma_region_t; * region associated with a page (or set of pages) has been attached. */ struct ompi_osc_rdma_handle_t { + opal_object_t super; /** btl handle for the memory region */ mca_btl_base_registration_handle_t *btl_handle; - /** number of attaches assocated with this region */ - int refcnt; + /** attached regions associated with this registration */ + opal_list_t attachments; }; typedef struct ompi_osc_rdma_handle_t ompi_osc_rdma_handle_t; +OBJ_CLASS_DECLARATION(ompi_osc_rdma_handle_t); /** * @brief number of state buffers that can be used for storing From f4bc0f46d67c1d29caccb270f581161bea175806 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Sun, 16 Feb 2020 17:09:20 -0800 Subject: [PATCH 521/674] osc/rdma: bump the default max dynamic attachments to 64 This commit increaes the osc_rdma_max_attach variable from 32 to 64. The new default is kept low due to the small number of registration resources on some systems (Cray Aries). A larger max attachement value can be set by the user on other systems. Signed-off-by: Nathan Hjelm (cherry picked from commit 54c8233f4f670ee43e59d95316b8dc68f8258ba0) Signed-off-by: Nathan Hjelm --- ompi/mca/osc/rdma/osc_rdma_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 3c136701d91..31838b9f757 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -218,7 +218,7 @@ static int ompi_osc_rdma_component_register (void) MCA_BASE_VAR_SCOPE_LOCAL, &mca_osc_rdma_component.buffer_size); free(description_str); - mca_osc_rdma_component.max_attach = 32; + mca_osc_rdma_component.max_attach = 64; asprintf(&description_str, "Maximum number of buffers that can be attached to a dynamic window. " "Keep in mind that each attached buffer will use a potentially limited " "resource (default: %d)", mca_osc_rdma_component.max_attach); From 08da2f5ea5d95f739093e7c56df3ec54c3ea9c55 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Thu, 28 Nov 2019 11:04:30 +0100 Subject: [PATCH 522/674] Correctly set baseptr in contiguous shared memory window with local size zero Signed-off-by: Joseph Schuchart (cherry picked from commit 06bbcf4fd63dd184cf22f8bcad007c4b8b991a3c) --- ompi/mca/osc/sm/osc_sm_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index 0475e65266b..f8a5f87b632 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -338,7 +338,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit } module->sizes[i] = rbuf[i]; - if (module->sizes[i]) { + if (module->sizes[i] || !module->noncontig) { module->bases[i] = ((char *) module->segment_base) + total; total += rbuf[i]; } else { From d5434545a94366a3ac95da3e46ea207fed6ef159 Mon Sep 17 00:00:00 2001 From: Artem Ryabov Date: Sun, 23 Feb 2020 00:42:43 +0300 Subject: [PATCH 523/674] Mellanox Open MPI CI: optimized git checkout step to reduce CI duration Signed-off-by: Artem Ryabov --- .ci/mellanox/azure-pipelines.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/mellanox/azure-pipelines.yml b/.ci/mellanox/azure-pipelines.yml index a4fb7213238..4b3e3cbde26 100644 --- a/.ci/mellanox/azure-pipelines.yml +++ b/.ci/mellanox/azure-pipelines.yml @@ -31,10 +31,11 @@ jobs: inputs: sourceFolder: $(Pipeline.Workspace) contents: | - **/* + **/jenkins_scripts - checkout: self submodules: true path: ompi + clean: true - bash: | set -eE [ "$(debug)" = "true" ] && set -x From e14e84acebaddedab396691c9bab70457c46901e Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Fri, 21 Feb 2020 12:13:39 -0600 Subject: [PATCH 524/674] sharedfp/individual: defer error when not being able to open datafile This commit changes the behavior of the individual sharedfp component. If the component cannot create either the datafile or the metadatafile during File_open, no error is being raised going forward. This allows applications that do not use shared file pointer operations to continue execution without any issue. If the user however subsequently calls MPI_File_write_shared or similar operations, an error will be raised. Fixes issue #7429 Signed-off-by: Edgar Gabriel (cherry picked from commit df6e3e503aee6954807a6bdc3a73dfa9a7d030af) --- .../sharedfp_individual_file_open.c | 39 +++++++++++++++---- .../individual/sharedfp_individual_write.c | 32 ++++++++------- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c index ecdb8c723ea..5bff7247362 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2013-2018 University of Houston. All rights reserved. + * Copyright (c) 2013-2019 University of Houston. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. @@ -92,11 +92,18 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, &(MPI_INFO_NULL->super), datafilehandle, false); if ( OMPI_SUCCESS != err) { - opal_output(0, "mca_sharedfp_individual_file_open: Error during datafile file open\n"); + opal_output(ompi_sharedfp_base_framework.framework_output, + "mca_sharedfp_individual_file_open: Error during datafile file open. Continuing anyway. \n"); free (sh); free (datafilename); free (datafilehandle); - return err; + + // We reset the error code here to OMPI_SUCCESS since the individual component can act as + // a dummy component, in case no sharedfp operations are used by the code. Invoking any write/read + // operations will however lead to an error, since the sharedfp_data pointer will be NULL. + sh = NULL; + err = OMPI_SUCCESS; + goto exit; } /*----------------------------------------------------------*/ @@ -113,9 +120,13 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, if ( NULL == metadatafilename ) { free (sh); free (datafilename); + mca_common_ompio_file_close ( datafilehandle); free (datafilehandle); opal_output(0, "mca_sharedfp_individual_file_open: Error during memory allocation\n"); - return OMPI_ERR_OUT_OF_RESOURCE; + + sh=NULL; + err = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; } snprintf ( metadatafilename, len, "%s%s%d", filename, ".metadata.",fh->f_rank); @@ -123,22 +134,34 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, if ( NULL == metadatafilehandle ) { free (sh); free (datafilename); + mca_common_ompio_file_close ( datafilehandle); free (datafilehandle); free (metadatafilename); opal_output(0, "mca_sharedfp_individual_file_open: Error during memory allocation\n"); - return OMPI_ERR_OUT_OF_RESOURCE; + + sh = NULL; + err = OMPI_ERR_OUT_OF_RESOURCE; + goto exit; } err = mca_common_ompio_file_open ( MPI_COMM_SELF,metadatafilename, MPI_MODE_RDWR | MPI_MODE_CREATE | MPI_MODE_DELETE_ON_CLOSE, &(MPI_INFO_NULL->super), metadatafilehandle, false); if ( OMPI_SUCCESS != err) { - opal_output(0, "mca_sharedfp_individual_file_open: Error during metadatafile file open\n"); + opal_output(ompi_sharedfp_base_framework.framework_output, + "mca_sharedfp_individual_file_open: Error during metadatafile file open. Continuing anyway. \n"); free (sh); free (datafilename); + mca_common_ompio_file_close ( datafilehandle); free (datafilehandle); free (metadatafilename); free (metadatafilehandle); - return err; + + // We reset the error code here to OMPI_SUCCESS since the individual component can act as + // a dummy component, in case no sharedfp operations are used by the code. Invoking any write/read + // operations will however lead to an error, since the sharedfp_data pointer will be NULL. + sh = NULL; + err = OMPI_SUCCESS; + goto exit; } /*save the datafilehandle and metadatahandle in the sharedfp individual module data structure*/ @@ -150,6 +173,8 @@ int mca_sharedfp_individual_file_open (struct ompi_communicator_t *comm, headnode->metadatafilename = metadatafilename; } + +exit: /*save the sharedfp individual module data structure in the ompio filehandle structure*/ fh->f_sharedfp_data = sh; diff --git a/ompi/mca/sharedfp/individual/sharedfp_individual_write.c b/ompi/mca/sharedfp/individual/sharedfp_individual_write.c index 2b016001913..a1d21fb96c9 100644 --- a/ompi/mca/sharedfp/individual/sharedfp_individual_write.c +++ b/ompi/mca/sharedfp/individual/sharedfp_individual_write.c @@ -54,24 +54,26 @@ int mca_sharedfp_individual_write (ompio_file_t *fh, /*Retrieve data structure for shared file pointer operations*/ sh = fh->f_sharedfp_data; headnode = (mca_sharedfp_individual_header_record*)sh->selected_module_data; + if ( NULL == headnode) { + opal_output (0, "sharedfp_individual_write_ordered: headnode is NULL but file is open\n"); + return OMPI_ERROR; + } - if (headnode) { - /*Insert metadata record into a queue*/ - mca_sharedfp_individual_insert_metadata(OMPI_FILE_WRITE_SHARED, totalbytes, sh); - - /*Write the data into individual file*/ - ret = mca_common_ompio_file_write_at ( headnode->datafilehandle, - headnode->datafile_offset, - buf, count, datatype, status); - if ( OMPI_SUCCESS != ret ) { - opal_output(0,"mca_sharedfp_individual_write: Error while writing the datafile \n"); - return -1; - } - - /* Update the datafileoffset*/ - headnode->datafile_offset = headnode->datafile_offset + totalbytes; + /*Insert metadata record into a queue*/ + mca_sharedfp_individual_insert_metadata(OMPI_FILE_WRITE_SHARED, totalbytes, sh); + + /*Write the data into individual file*/ + ret = mca_common_ompio_file_write_at ( headnode->datafilehandle, + headnode->datafile_offset, + buf, count, datatype, status); + if ( OMPI_SUCCESS != ret ) { + opal_output(0,"mca_sharedfp_individual_write: Error while writing the datafile \n"); + return -1; } + /* Update the datafileoffset*/ + headnode->datafile_offset = headnode->datafile_offset + totalbytes; + return ret; } From 11d79d1f6ec6d253d01648c9b19854287daa09d5 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 24 Feb 2020 12:13:20 -0500 Subject: [PATCH 525/674] Updating OMPI v4.0.x to PMIx v3.1.5 released Signed-off-by: Geoffrey Paulsen --- opal/mca/pmix/pmix3x/pmix/NEWS | 7 +- opal/mca/pmix/pmix3x/pmix/VERSION | 12 +- .../pmix3x/pmix/config/pmix_check_vendor.m4 | 18 +- opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec | 2 +- .../pmix3x/pmix/src/client/pmix_client_get.c | 263 ++++++++++++------ .../pmix3x/pmix/src/include/pmix_globals.c | 4 + .../pmix3x/pmix/src/include/pmix_globals.h | 5 + .../mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c | 11 +- 8 files changed, 216 insertions(+), 106 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix/NEWS b/opal/mca/pmix/pmix3x/pmix/NEWS index 8b102555cba..ca24124edbf 100644 --- a/opal/mca/pmix/pmix3x/pmix/NEWS +++ b/opal/mca/pmix/pmix3x/pmix/NEWS @@ -1,4 +1,4 @@ -Copyright (c) 2015-2019 Intel, Inc. All rights reserved. +Copyright (c) 2015-2020 Intel, Inc. All rights reserved. Copyright (c) 2017-2020 IBM Corporation. All rights reserved. $COPYRIGHT$ @@ -58,6 +58,11 @@ in accordance with an Errata update of the PMIx v3 Standard - PR #1613: dstore: Fix cache size calculation - PR #1622: Fix multiple occurrences of unaligned access in pmix tests - PR #1620: Re-address the collective tracker problem +- PR #1625: Fix library triplet +- PR #1630: Fix support for PGI compiler pgcc18 +- PR #1637: Realign behavior of PMIx_Get and PMIx_Get_nb +- PR #1640: Properly handle forwarded output when no handler registered + 3.1.4 -- 9 Aug 2019 diff --git a/opal/mca/pmix/pmix3x/pmix/VERSION b/opal/mca/pmix/pmix3x/pmix/VERSION index f3fb512ecf3..ff271b549fb 100644 --- a/opal/mca/pmix/pmix3x/pmix/VERSION +++ b/opal/mca/pmix/pmix3x/pmix/VERSION @@ -25,14 +25,14 @@ release=5 # The only requirement is that it must be entirely printable ASCII # characters and have no white space. -greek=rc2 +greek= # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" # command, or with the date (if "git describe" fails) in the form of # "date". -repo_rev=git1fca232 +repo_rev=gitedebb24 # If tarball_version is not empty, it is used as the version string in # the tarball filename, regardless of all other versions listed in @@ -46,7 +46,7 @@ tarball_version= # The date when this release was created -date="Feb 10, 2020" +date="Feb 19, 2020" # The shared library version of each of PMIx's public libraries. # These versions are maintained in accordance with the "Library @@ -82,8 +82,8 @@ libpmi_so_version=1:1:0 libpmi2_so_version=1:0:0 # "Common" components install standalone libraries that are run-time -# # linked by one or more components. So they need to be versioned as -# # well. Yuck; this somewhat breaks the -# # components-don't-affect-the-build-system abstraction. +# linked by one or more components. So they need to be versioned as +# well. Yuck; this somewhat breaks the +# components-don't-affect-the-build-system abstraction. # libmca_common_dstore_so_version=1:2:0 diff --git a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_vendor.m4 b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_vendor.m4 index cf96c462563..7c83ce1fa2b 100644 --- a/opal/mca/pmix/pmix3x/pmix/config/pmix_check_vendor.m4 +++ b/opal/mca/pmix/pmix3x/pmix/config/pmix_check_vendor.m4 @@ -11,7 +11,7 @@ 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) 2012 Oracle and/or its affiliates. All rights reserved. -dnl Copyright (c) 2013 Intel, Inc. All rights reserved +dnl Copyright (c) 2013-2020 Intel, Inc. All rights reserved. dnl Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. @@ -45,7 +45,7 @@ AC_DEFUN([PMIX_C_COMPILER_VENDOR], [ # workaround to avoid syntax error with Autoconf < 2.68: m4_ifndef([AC_LANG_DEFINES_PROVIDED], - [m4_define([AC_LANG_DEFINES_PROVIDED])]) + [m4_define([AC_LANG_DEFINES_PROVIDED])]) # PMIX_IFDEF_IFELSE(symbol, [action-if-defined], # [action-if-not-defined]) @@ -85,14 +85,19 @@ AC_DEFUN([_PMIX_CHECK_COMPILER_VENDOR], [ pmix_check_compiler_vendor_result="unknown" # GNU is probably the most common, so check that one as soon as - # possible. Intel pretends to be GNU, so need to check Intel - # before checking for GNU. + # possible. Intel and PGI18 pretend to be GNU, so need to check Intel + # and PGI before checking for GNU. # Intel AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"], [PMIX_IF_IFELSE([defined(__INTEL_COMPILER) || defined(__ICC)], [pmix_check_compiler_vendor_result="intel"])]) + # Portland Group + AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"], + [PMIX_IFDEF_IFELSE([__PGI], + [pmix_check_compiler_vendor_result="portland group"])]) + # Fujitsu AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"], [PMIX_IF_IFELSE([defined(__FUJITSU)], @@ -212,11 +217,6 @@ AC_DEFUN([_PMIX_CHECK_COMPILER_VENDOR], [ [PMIX_IFDEF_IFELSE([__POCC__], [pmix_check_compiler_vendor_result="pelles"])]) - # Portland Group - AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"], - [PMIX_IFDEF_IFELSE([__PGI], - [pmix_check_compiler_vendor_result="portland group"])]) - # SAS/C AS_IF([test "$pmix_check_compiler_vendor_result" = "unknown"], [PMIX_IF_IFELSE([defined(SASC) || defined(__SASC) || defined(__SASC__)], diff --git a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec index ad3e79c2972..e9a263bf019 100644 --- a/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec +++ b/opal/mca/pmix/pmix3x/pmix/contrib/pmix.spec @@ -192,7 +192,7 @@ Summary: An extended/exascale implementation of PMI Name: %{?_name:%{_name}}%{!?_name:pmix} -Version: 3.1.5rc2 +Version: 3.1.5 Release: 1%{?dist} License: BSD Group: Development/Libraries diff --git a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c index a2a92ae87d9..3553a8a0c81 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c +++ b/opal/mca/pmix/pmix3x/pmix/src/client/pmix_client_get.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -89,11 +89,8 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, const pmix_info_t info[], size_t ninfo, pmix_value_t **val) { - pmix_cb_t *cb; + pmix_cb_t cb; pmix_status_t rc; - size_t n, nfo; - pmix_proc_t p; - pmix_info_t nodeinfo, *iptr; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -108,76 +105,23 @@ PMIX_EXPORT pmix_status_t PMIx_Get(const pmix_proc_t *proc, (NULL == proc) ? "NULL" : PMIX_NAME_PRINT(proc), (NULL == key) ? "NULL" : key); - memcpy(&p, proc, sizeof(pmix_proc_t)); - iptr = (pmix_info_t*)info; - nfo = ninfo; - - if (!PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { - if (PMIX_RANK_UNDEF == proc->rank || NULL == key) { - goto doget; - } - /* if they are asking about a node-level piece of info, - * then the rank must be UNDEF */ - if (pmix_check_node_info(key)) { - p.rank = PMIX_RANK_UNDEF; - /* see if they told us to get node info */ - if (NULL == info) { - /* guess not - better do it */ - PMIX_INFO_LOAD(&nodeinfo, PMIX_NODE_INFO, NULL, PMIX_BOOL); - iptr = &nodeinfo; - nfo = 1; - } - goto doget; - } - /* if they are asking about an app-level piece of info, - * then the rank must be UNDEF */ - if (pmix_check_app_info(key)) { - p.rank = PMIX_RANK_UNDEF; - /* see if they told us to get app info */ - if (NULL == info) { - /* guess not - better do it */ - PMIX_INFO_LOAD(&nodeinfo, PMIX_APP_INFO, NULL, PMIX_BOOL); - iptr = &nodeinfo; - nfo = 1; - } - goto doget; - } - - /* see if they are requesting session, node, or app-level info */ - for (n=0; n < ninfo; n++) { - if (PMIX_CHECK_KEY(info, PMIX_NODE_INFO) || - PMIX_CHECK_KEY(info, PMIX_APP_INFO) || - PMIX_CHECK_KEY(info, PMIX_SESSION_INFO)) { - goto doget; - } - } - } - - /* try to get data directly, without threadshift */ - if (PMIX_SUCCESS == (rc = _getfn_fastpath(&p, key, iptr, nfo, val))) { - goto done; - } - - doget: - /* create a callback object as we need to pass it to the - * recv routine so we know which callback to use when - * the return message is recvd */ - cb = PMIX_NEW(pmix_cb_t); - if (PMIX_SUCCESS != (rc = PMIx_Get_nb(&p, key, iptr, nfo, _value_cbfunc, cb))) { - PMIX_RELEASE(cb); + /* create a callback object so we can be notified when + * the non-blocking operation is complete */ + PMIX_CONSTRUCT(&cb, pmix_cb_t); + if (PMIX_SUCCESS != (rc = PMIx_Get_nb(proc, key, info, ninfo, _value_cbfunc, &cb))) { + PMIX_DESTRUCT(&cb); return rc; } /* wait for the data to return */ - PMIX_WAIT_THREAD(&cb->lock); - rc = cb->status; + PMIX_WAIT_THREAD(&cb.lock); + rc = cb.status; if (NULL != val) { - *val = cb->value; - cb->value = NULL; + *val = cb.value; + cb.value = NULL; } - PMIX_RELEASE(cb); + PMIX_DESTRUCT(&cb); - done: pmix_output_verbose(2, pmix_client_globals.get_output, "pmix:client get completed"); @@ -189,8 +133,15 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t pmix_value_cbfunc_t cbfunc, void *cbdata) { pmix_cb_t *cb; - int rank; - char *nm; + pmix_status_t rc; + size_t n, nfo; + bool wantinfo = false; + bool haveid = false; + pmix_proc_t p; + pmix_info_t *iptr; + bool copy = false; + uint32_t appnum; + pmix_value_t *ival = NULL; PMIX_ACQUIRE_THREAD(&pmix_global_lock); @@ -228,31 +179,181 @@ PMIX_EXPORT pmix_status_t PMIx_Get_nb(const pmix_proc_t *proc, const pmix_key_t /* if the given proc param is NULL, or the nspace is * empty, then the caller is referencing our own nspace */ if (NULL == proc || 0 == strlen(proc->nspace)) { - nm = pmix_globals.myid.nspace; + PMIX_LOAD_NSPACE(p.nspace, pmix_globals.myid.nspace); } else { - nm = (char*)proc->nspace; + PMIX_LOAD_NSPACE(p.nspace, proc->nspace); } /* if the proc param is NULL, then we are seeking a key that * must be globally unique, so communicate this to the hash * functions with the UNDEF rank */ if (NULL == proc) { - rank = PMIX_RANK_UNDEF; + p.rank = PMIX_RANK_UNDEF; } else { - rank = proc->rank; + p.rank = proc->rank; } + iptr = (pmix_info_t*)info; + nfo = ninfo; pmix_output_verbose(2, pmix_client_globals.get_output, - "pmix: get_nb value for proc %s:%u key %s", - nm, rank, (NULL == key) ? "NULL" : key); + "pmix: get_nb value for proc %s key %s", + PMIX_NAME_PRINT(&p), (NULL == key) ? "NULL" : key); + + if (!PMIX_PEER_IS_EARLIER(pmix_client_globals.myserver, 3, 1, 5)) { + /* ]don't consider the fastpath option + * for undefined rank or NULL keys */ + if (PMIX_RANK_UNDEF == p.rank || NULL == key) { + goto doget; + } + /* if they are asking about a node-level piece of info, + * then the rank must be UNDEF */ + if (pmix_check_node_info(key)) { + p.rank = PMIX_RANK_UNDEF; + /* the key is node-related - see if the target node is in the + * info array and if they tagged the request accordingly */ + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_NODE_INFO)) { + wantinfo = true; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_HOSTNAME)) { + haveid = true; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_NODEID)) { + haveid = true; + } + } + } + if (wantinfo && haveid) { + goto doget; + } else if (wantinfo) { + /* missing the nodeid/hostname - add our hostname */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_HOSTNAME, pmix_globals.hostname, PMIX_STRING); + copy = true; + goto doget; + } else if (haveid) { + /* flag that we want node info */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); + copy = true; + goto doget; + } else { + /* missing both */ + nfo = ninfo + 2; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_NODE_INFO, NULL, PMIX_BOOL); + PMIX_INFO_LOAD(&iptr[ninfo+1], PMIX_HOSTNAME, pmix_globals.hostname, PMIX_STRING); + copy = true; + goto doget; + } + } + /* see if they are asking about an app-level piece of info */ + wantinfo = false; + haveid = false; + if (pmix_check_app_info(key)) { + p.rank = PMIX_RANK_UNDEF; + /* the key is app-related - see if the target appnum is in the + * info array and if they tagged the request accordingly */ + if (NULL != info) { + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(&info[n], PMIX_APP_INFO)) { + wantinfo = true; + } else if (PMIX_CHECK_KEY(&info[n], PMIX_APPNUM) && + 0 != info[n].value.data.uint32) { + haveid = true; + } + } + } + if (wantinfo && haveid) { + goto doget; + } else if (wantinfo) { + /* missing the appnum - add ours */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + /* try to retrieve it */ + rc = _getfn_fastpath(&pmix_globals.myid, PMIX_APPNUM, NULL, 0, &ival); + if (PMIX_SUCCESS != rc) { + appnum = ival->data.uint32; + PMIX_VALUE_RELEASE(ival); + } else { + appnum = 0; + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APPNUM, &appnum, PMIX_UINT32); + copy = true; + goto doget; + } else if (haveid) { + /* flag that we want app info */ + nfo = ninfo + 1; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APP_INFO, NULL, PMIX_BOOL); + copy = true; + goto doget; + } else { + /* missing both */ + nfo = ninfo + 2; + PMIX_INFO_CREATE(iptr, nfo); + for (n=0; n < ninfo; n++) { + PMIX_INFO_XFER(&iptr[n], &info[n]); + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APP_INFO, NULL, PMIX_BOOL); + /* try to retrieve it */ + rc = _getfn_fastpath(&pmix_globals.myid, PMIX_APPNUM, NULL, 0, &ival); + if (PMIX_SUCCESS != rc) { + appnum = ival->data.uint32; + PMIX_VALUE_RELEASE(ival); + } else { + appnum = 0; + } + PMIX_INFO_LOAD(&iptr[ninfo], PMIX_APPNUM, &appnum, PMIX_UINT32); + copy = true; + goto doget; + } + } + + /* see if they are requesting session info or requesting cache refresh */ + for (n=0; n < ninfo; n++) { + if (PMIX_CHECK_KEY(info, PMIX_SESSION_INFO)) { + goto doget; + } + } + } + + /* try to get data directly, without threadshift */ + if (PMIX_SUCCESS == (rc = _getfn_fastpath(&p, key, iptr, nfo, &ival))) { + if (NULL != cbfunc) { + cbfunc(rc, ival, cbdata); + /* ownership of the memory in ival is passed to the + * user in the cbfunc, so don't release it here */ + } + return rc; + } + + doget: /* threadshift this request so we can access global structures */ cb = PMIX_NEW(pmix_cb_t); - cb->pname.nspace = strdup(nm); - cb->pname.rank = rank; + cb->pname.nspace = strdup(p.nspace); + cb->pname.rank = p.rank; cb->key = (char*)key; - cb->info = (pmix_info_t*)info; - cb->ninfo = ninfo; + cb->info = iptr; + cb->ninfo = nfo; + cb->infocopy = copy; cb->cbfunc.valuefn = cbfunc; cb->cbdata = cbdata; PMIX_THREADSHIFT(cb, _getnbfn); @@ -469,7 +570,7 @@ static pmix_status_t process_values(pmix_value_t **v, pmix_cb_t *cb) } /* we will return the data as an array of pmix_info_t * in the kvs pmix_value_t */ - val = (pmix_value_t*)malloc(sizeof(pmix_value_t)); + PMIX_VALUE_CREATE(val, 1); if (NULL == val) { return PMIX_ERR_NOMEM; } diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c index ee8f83f1461..3fce1389ebf 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.c @@ -307,6 +307,7 @@ static void cbcon(pmix_cb_t *p) p->nprocs = 0; p->info = NULL; p->ninfo = 0; + p->infocopy = false; p->nvals = 0; PMIX_CONSTRUCT(&p->kvs, pmix_list_t); p->copy = false; @@ -321,6 +322,9 @@ static void cbdes(pmix_cb_t *p) free(p->pname.nspace); } PMIX_DESTRUCT(&p->data); + if (p->infocopy) { + PMIX_INFO_FREE(p->info, p->ninfo); + } PMIX_LIST_DESTRUCT(&p->kvs); } PMIX_EXPORT PMIX_CLASS_INSTANCE(pmix_cb_t, diff --git a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h index 8da9c9ccd2d..9cbcd4a6077 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h +++ b/opal/mca/pmix/pmix3x/pmix/src/include/pmix_globals.h @@ -11,6 +11,10 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -391,6 +395,7 @@ typedef struct { size_t nprocs; pmix_info_t *info; size_t ninfo; + bool infocopy; size_t nvals; pmix_list_t kvs; bool copy; diff --git a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c index 956b16113a1..eee9793514d 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c +++ b/opal/mca/pmix/pmix3x/pmix/src/tool/pmix_tool.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ /* - * Copyright (c) 2014-2019 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2014-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2014 Artem Y. Polyakov . @@ -249,13 +249,8 @@ static void tool_iof_handler(struct pmix_peer_t *pr, goto cleanup; } /* lookup the handler for this IOF package */ - if (NULL == (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid))) { - /* something wrong here - should not happen */ - PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); - goto cleanup; - } - /* if the handler invokes a callback function, do so */ - if (NULL != req->cbfunc) { + if (NULL != (req = (pmix_iof_req_t*)pmix_pointer_array_get_item(&pmix_globals.iof_requests, refid)) && + NULL != req->cbfunc) { req->cbfunc(refid, channel, &source, &bo, info, ninfo); } else { /* otherwise, simply write it out to the specified std IO channel */ From 00c3cc143d60d55d9acec8a05dad9301337b62d6 Mon Sep 17 00:00:00 2001 From: Artem Ryabov Date: Tue, 25 Feb 2020 01:01:37 +0300 Subject: [PATCH 526/674] Disabled Mellanox Open MPI per-commit CI (as redundant). The CI is triggered only upon a PR creation or by special PR comments. Signed-off-by: Artem Ryabov --- .ci/README.md | 2 -- .ci/mellanox/azure-pipelines.yml | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.ci/README.md b/.ci/README.md index 53618af51be..2a9d5c09b15 100644 --- a/.ci/README.md +++ b/.ci/README.md @@ -1,6 +1,5 @@ # Open MPI Continuous Integration (CI) Services ## Mellanox Open MPI CI -[![Build Status](https://dev.azure.com/mlnx-swx/mellanox-ompi/_apis/build/status/Mellanox%20CI?branchName=v4.0.x)](https://dev.azure.com/mlnx-swx/mellanox-ompi/_build/latest?definitionId=12&branchName=v4.0.x) ### Scope [Mellanox](https://www.mellanox.com/) Open MPI CI is intended to verify Open MPI with recent Mellanox SW components ([Mellanox OFED](https://www.mellanox.com/page/products_dyn?product_family=26), [UCX](https://www.mellanox.com/page/products_dyn?product_family=281&mtag=ucx) and other [HPC-X](https://www.mellanox.com/page/products_dyn?product_family=189&mtag=hpc-x) components) in the Mellanox lab environment. @@ -11,7 +10,6 @@ Mellanox Open MPI CI includes: * Sanity functional testing. ### How to Run CI Mellanox Open MPI CI is triggered upon the following events: -* Push a commit into the master branch or release branches (starting from v4.0.x). CI is started automatically. CI status and log files are available on the Azure DevOps server. * Create a pull request (PR). CI status is visible in the PR status. CI is restarted automatically upon each new commit within the PR. CI status and log files are also available on the Azure DevOps server. * Trigger CI with special PR comments (for example, `/azp run`). Comment triggers are available only if the comment author has write permission to the PR target repo. Detailed information about comment triggers is available in the official Azure DevOps [documentation](https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#comment-triggers). ### Support diff --git a/.ci/mellanox/azure-pipelines.yml b/.ci/mellanox/azure-pipelines.yml index a4fb7213238..d5492a19280 100644 --- a/.ci/mellanox/azure-pipelines.yml +++ b/.ci/mellanox/azure-pipelines.yml @@ -1,6 +1,4 @@ -trigger: - - master - - v*.*.x +trigger: none pr: - master - v*.*.x From 1392fcd51e1ceb18d8c9e782fbd17e4c236ab620 Mon Sep 17 00:00:00 2001 From: Thomas Jahns Date: Fri, 21 Feb 2020 11:18:50 +0100 Subject: [PATCH 527/674] Fix incorrect argument in manual page. Signed-off-by: Thomas Jahns --- ompi/mpi/man/man3/MPI_Type_create_indexed_block.3in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ompi/mpi/man/man3/MPI_Type_create_indexed_block.3in b/ompi/mpi/man/man3/MPI_Type_create_indexed_block.3in index 18f4e6be11f..d9f7003392f 100644 --- a/ompi/mpi/man/man3/MPI_Type_create_indexed_block.3in +++ b/ompi/mpi/man/man3/MPI_Type_create_indexed_block.3in @@ -15,7 +15,7 @@ #include int MPI_Type_create_indexed_block(int \fIcount\fP, int \fIblocklength\fP, const int \fIarray_of_displacements\fP[], MPI_Datatype \fIoldtype\fP, MPI_Datatype *\fInewtype\fP) -int MPI_Type_create_hindexed_block(int \fIcount\fP, int \fIblocklength\fP, const int \fIarray_of_displacements\fP[], MPI_Datatype \fIoldtype\fP, MPI_Datatype *\fInewtype\fP) +int MPI_Type_create_hindexed_block(int \fIcount\fP, int \fIblocklength\fP, const MPI_Aint \fIarray_of_displacements\fP[], MPI_Datatype \fIoldtype\fP, MPI_Datatype *\fInewtype\fP) .fi .SH Fortran Syntax @@ -29,8 +29,9 @@ MPI_TYPE_CREATE_INDEXED_BLOCK(\fICOUNT, BLOCKLENGTH, MPI_TYPE_CREATE_HINDEXED_BLOCK(\fICOUNT, BLOCKLENGTH, ARRAY_OF_DISPLACEMENTS, OLDTYPE, NEWTYPE, IERROR\fP) - INTEGER \fICOUNT, BLOCKLENGTH, ARRAY_OF_DISPLACEMENTS(*), - OLDTYPE, NEWTYPE, IERROR \fP + INTEGER \fICOUNT, BLOCKLENGTH, OLDTYPE, NEWTYPE\fP + INTEGER(KIND=MPI_ADDRESS_KIND) \fIARRAY_OF_DISPLACEMENTS(*)\fP + INTEGER \fIIERROR\fP .fi .SH Fortran 2008 Syntax From 7dbf41969c52117d520a40e66f6477338cd670a7 Mon Sep 17 00:00:00 2001 From: Artem Ryabov Date: Tue, 25 Feb 2020 14:28:49 +0300 Subject: [PATCH 528/674] Use Mellanox CI tests specific for Open MPI v4.0.x Signed-off-by: Artem Ryabov --- .ci/mellanox/azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/mellanox/azure-pipelines.yml b/.ci/mellanox/azure-pipelines.yml index a4fb7213238..9ca37e9ed9a 100644 --- a/.ci/mellanox/azure-pipelines.yml +++ b/.ci/mellanox/azure-pipelines.yml @@ -13,7 +13,7 @@ pool: variables: ompi_jenkins_scripts_git_repo_url: https://github.com/mellanox-hpc/jenkins_scripts.git - ompi_jenkins_scripts_git_branch: master + ompi_jenkins_scripts_git_branch: ompi_v4.0.x # Enable debug information, supported values: true, false debug: true From a2c850e02d50b8c10187b48486eedea6db5ad06d Mon Sep 17 00:00:00 2001 From: Tsubasa Yanagibashi Date: Fri, 14 Feb 2020 17:52:56 +0900 Subject: [PATCH 529/674] osc/sm: fix typo and minor correction - fix a typo `alloc_shared_contig` to `alloc_shared_noncontig` - correct the value of `blocking_fence` Signed-off-by: Tsubasa Yanagibashi (cherry picked from commit a07a83d1899f8b65bbcdb71e681f4ca8f2109375) --- ompi/mca/osc/sm/osc_sm_component.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/sm/osc_sm_component.c b/ompi/mca/osc/sm/osc_sm_component.c index f8a5f87b632..03a1e949bd3 100644 --- a/ompi/mca/osc/sm/osc_sm_component.c +++ b/ompi/mca/osc/sm/osc_sm_component.c @@ -11,6 +11,7 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 FUJITSU LIMITED. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -204,7 +205,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit OBJ_CONSTRUCT(&module->lock, opal_mutex_t); - ret = opal_infosubscribe_subscribe(&(win->super), "alloc_shared_contig", "false", component_set_alloc_shared_noncontig_info); + ret = opal_infosubscribe_subscribe(&(win->super), "alloc_shared_noncontig", "false", component_set_alloc_shared_noncontig_info); if (OPAL_SUCCESS != ret) goto error; @@ -418,7 +419,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit #endif } - ret = opal_infosubscribe_subscribe(&(win->super), "blocking_fence", "false", + ret = opal_infosubscribe_subscribe(&(win->super), "blocking_fence", module->global_state->use_barrier_for_fence ? "true" : "false", component_set_blocking_fence_info); if (OPAL_SUCCESS != ret) goto error; From c5a2bc8f81df7c6d9f9d2f472eb56912522a5c9f Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Wed, 26 Feb 2020 12:51:46 -0700 Subject: [PATCH 530/674] news update for 4.0.3rc4 [skip ci] Signed-off-by: Howard Pritchard --- NEWS | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 6d34973a2ec..d1d6a262e9e 100644 --- a/NEWS +++ b/NEWS @@ -57,9 +57,15 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. -4.0.3 -- February, 2020 +4.0.3 -- March, 2020 ----------------------- -- Add support for Mellanox Connectx6. +- Update embedded PMIx to 3.1.5 +- Add support for Mellanox ConnectX-6. +- Fix an issue in OpenMPI IO when using shared file pointers. + Thanks to Romain Hild for reporting. +- Fix a problem with Open MPI using a previously installed + Fortran mpi module during compilation. Thanks to Marcin + Mielniczuk for reporting - Fix a problem with Fortran compiler wrappers ignoring use of disable-wrapper-runpath configure option. Thanks to David Shrader for reporting. From f7979fbc82adb78339de267b2775c88ad39c17a9 Mon Sep 17 00:00:00 2001 From: Austen Lauria Date: Tue, 3 Mar 2020 13:31:56 -0500 Subject: [PATCH 531/674] Fix segv in btl/vader. Keep track of the connected procs in vader_add_procs(). Otherwise, the same rank will reconnect the same shmem segment (rank 0+...) multiple times instead of the next one as intended. Signed-off-by: Austen Lauria (cherry picked from commit f69c8d6819dcc14f471cea90b50dc8ca98de12d4) --- opal/mca/btl/vader/btl_vader.h | 1 + opal/mca/btl/vader/btl_vader_component.c | 2 ++ opal/mca/btl/vader/btl_vader_module.c | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/opal/mca/btl/vader/btl_vader.h b/opal/mca/btl/vader/btl_vader.h index e3921429d5f..77dc936a904 100644 --- a/opal/mca/btl/vader/btl_vader.h +++ b/opal/mca/btl/vader/btl_vader.h @@ -124,6 +124,7 @@ struct mca_btl_vader_component_t { char *my_segment; /**< this rank's base pointer */ size_t segment_size; /**< size of my_segment */ int32_t num_smp_procs; /**< current number of smp procs on this host */ + int32_t local_rank; /**< current rank index at add_procs() time */ opal_free_list_t vader_frags_eager; /**< free list of vader send frags */ opal_free_list_t vader_frags_max_send; /**< free list of vader max send frags (large fragments) */ opal_free_list_t vader_frags_user; /**< free list of small inline frags */ diff --git a/opal/mca/btl/vader/btl_vader_component.c b/opal/mca/btl/vader/btl_vader_component.c index bbb8fc8f140..6e32af109db 100644 --- a/opal/mca/btl/vader/btl_vader_component.c +++ b/opal/mca/btl/vader/btl_vader_component.c @@ -559,6 +559,8 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls, /* no fast boxes allocated initially */ component->num_fbox_in_endpoints = 0; + component->local_rank = 0; + mca_btl_vader_check_single_copy (); if (MCA_BTL_VADER_XPMEM != mca_btl_vader_component.single_copy_mechanism) { diff --git a/opal/mca/btl/vader/btl_vader_module.c b/opal/mca/btl/vader/btl_vader_module.c index 1a54bbfcab9..73975ebd241 100644 --- a/opal/mca/btl/vader/btl_vader_module.c +++ b/opal/mca/btl/vader/btl_vader_module.c @@ -349,7 +349,7 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl, } } - for (int32_t proc = 0, local_rank = 0 ; proc < (int32_t) nprocs ; ++proc) { + for (int32_t proc = 0; proc < (int32_t) nprocs; ++proc) { /* check to see if this proc can be reached via shmem (i.e., if they're on my local host and in my job) */ if (procs[proc]->proc_name.jobid != my_proc->proc_name.jobid || @@ -367,8 +367,10 @@ static int vader_add_procs (struct mca_btl_base_module_t* btl, } /* setup endpoint */ - peers[proc] = component->endpoints + local_rank; - rc = init_vader_endpoint (peers[proc], procs[proc], local_rank++); + int rank = opal_atomic_fetch_add_32(&component -> local_rank, 1); + + peers[proc] = component->endpoints + rank; + rc = init_vader_endpoint (peers[proc], procs[proc], rank); if (OPAL_SUCCESS != rc) { break; } From 253502b1b163cdc400eaef59a2c4854989c7dda1 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Sat, 7 Mar 2020 09:16:20 -0800 Subject: [PATCH 532/674] timings: Fix timings when 'prefix' is used Signed-off-by: Artem Polyakov (cherry picked from commit 7c17a38c96db6da1c28d6c46d9293124dee6a23c) --- ompi/util/timings.h | 15 +++++++++++---- opal/util/timings.h | 28 ++++++++++------------------ 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/ompi/util/timings.h b/ompi/util/timings.h index be870665529..b582466661e 100644 --- a/ompi/util/timings.h +++ b/ompi/util/timings.h @@ -120,7 +120,7 @@ typedef struct ompi_timing_t { } \ } while(0) -#define OMPI_TIMING_APPEND(filename,func,desc,ts) \ +#define OMPI_TIMING_APPEND_PREFIX(filename, _prefix, func,desc,ts) \ do { \ if (OMPI_TIMING.cur_timing->use >= OMPI_TIMING.size){ \ OMPI_TIMING_ITEM_EXTEND; \ @@ -130,7 +130,12 @@ typedef struct ompi_timing_t { if (len >= OPAL_TIMING_STR_LEN) { \ OMPI_TIMING.error = 1; \ } \ - OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].prefix = func; \ + if( _prefix[0] ) { \ + OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].prefix = \ + func "/" _prefix; \ + } else { \ + OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].prefix = func;\ + } \ OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].file = filename; \ OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use++].ts = ts; \ OMPI_TIMING.cnt++; \ @@ -143,14 +148,14 @@ typedef struct ompi_timing_t { int i; \ double ts; \ OMPI_TIMING.import_cnt++; \ - OPAL_TIMING_ENV_CNT(func, cnt); \ + OPAL_TIMING_ENV_CNT_PREFIX(_prefix, func, cnt); \ OPAL_TIMING_ENV_ERROR_PREFIX(_prefix, func, OMPI_TIMING.error); \ for(i = 0; i < cnt; i++){ \ char *desc, *filename; \ OMPI_TIMING.cur_timing->val[OMPI_TIMING.cur_timing->use].imported= \ OMPI_TIMING.import_cnt; \ OPAL_TIMING_ENV_GETDESC_PREFIX(_prefix, &filename, func, i, &desc, ts); \ - OMPI_TIMING_APPEND(filename, func, desc, ts); \ + OMPI_TIMING_APPEND_PREFIX(filename, _prefix, func, desc, ts); \ } \ } \ } while(0) @@ -275,6 +280,8 @@ typedef struct ompi_timing_t { #define OMPI_TIMING_IMPORT_OPAL(func) +#define OMPI_TIMING_IMPORT_OPAL_PREFIX(_prefix, func) + #define OMPI_TIMING_FINALIZE #define OMPI_TIMING_ENABLED 0 diff --git a/opal/util/timings.h b/opal/util/timings.h index 1d3a11e5c27..6d561472d77 100644 --- a/opal/util/timings.h +++ b/opal/util/timings.h @@ -49,11 +49,11 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type); _prefix = ""; \ } \ (_nm)->error = 0; \ - n = snprintf((_nm)->id, OPAL_TIMING_STR_LEN, "%s%s", _prefix, func); \ + n = snprintf((_nm)->id, OPAL_TIMING_STR_LEN, "%s_%s", _prefix, func); \ if( n > OPAL_TIMING_STR_LEN ){ \ (_nm)->error = 1; \ } \ - n = sprintf((_nm)->cntr_env,"OMPI_TIMING_%s%s_CNT", prefix, (_nm)->id); \ + n = sprintf((_nm)->cntr_env,"OMPI_TIMING_%s_CNT", (_nm)->id); \ if( n > OPAL_TIMING_STR_LEN ){ \ (_nm)->error = 1; \ } \ @@ -77,11 +77,6 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type); } \ } while(0) -#define OPAL_TIMING_ENV_INIT(name) \ - opal_timing_env_t name ## _val, *name = &(name ## _val); \ - OPAL_TIMING_ENV_START_TYPE(__func__, name, OPAL_TIMING_AUTOMATIC_TIMER, ""); - - /* We use function names for identification * however this might be a problem for the private * functions declared as static as their names may @@ -89,10 +84,10 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type); * Use prefix to do a finer-grained identification if needed */ #define OPAL_TIMING_ENV_INIT_PREFIX(prefix, name) \ - do { \ - opal_timing_env_t name ## _val, *name = &(name ## _val); \ - *name = OPAL_TIMING_ENV_START_TYPE(__func__, name, OPAL_TIMING_AUTOMATIC_TIMER, prefix); \ - } while(0) + opal_timing_env_t name ## _val, *name = &(name ## _val); \ + OPAL_TIMING_ENV_START_TYPE(__func__, name, OPAL_TIMING_AUTOMATIC_TIMER, prefix); + +#define OPAL_TIMING_ENV_INIT(name) OPAL_TIMING_ENV_INIT_PREFIX("", name) #define OPAL_TIMING_ENV_NEXT(h, ...) \ do { \ @@ -161,7 +156,7 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type); do { \ char ename[OPAL_TIMING_STR_LEN]; \ char *ptr = NULL; \ - int n = snprintf(ename, OPAL_TIMING_STR_LEN, "OMPI_TIMING_%s%s_CNT", prefix, func); \ + int n = snprintf(ename, OPAL_TIMING_STR_LEN, "OMPI_TIMING_%s_%s_CNT", prefix, func); \ (_cnt) = 0; \ if ( n <= OPAL_TIMING_STR_LEN ){ \ ptr = getenv(ename); \ @@ -181,18 +176,15 @@ opal_timing_ts_func_t opal_timing_ts_func(opal_timer_type_t type); } \ } while(0) -#define OPAL_TIMING_ENV_CNT(func, _cnt) \ - OPAL_TIMING_ENV_CNT_PREFIX("", func, _cnt) - #define OPAL_TIMING_ENV_GETDESC_PREFIX(prefix, filename, func, i, desc, _t) \ do { \ char vname[OPAL_TIMING_STR_LEN]; \ (_t) = 0.0; \ - sprintf(vname, "OMPI_TIMING_%s%s_FILE_%d", prefix, func, i); \ + sprintf(vname, "OMPI_TIMING_%s_%s_FILE_%d", prefix, func, i); \ *filename = getenv(vname); \ - sprintf(vname, "OMPI_TIMING_%s%s_DESC_%d", prefix, func, i); \ + sprintf(vname, "OMPI_TIMING_%s_%s_DESC_%d", prefix, func, i); \ *desc = getenv(vname); \ - sprintf(vname, "OMPI_TIMING_%s%s_VAL_%d", prefix, func, i); \ + sprintf(vname, "OMPI_TIMING_%s_%s_VAL_%d", prefix, func, i); \ char *ptr = getenv(vname); \ if ( NULL != ptr ) { \ sscanf(ptr,"%lf", &(_t)); \ From e5cdf2612a511e8f37f74c2643c7ad8723e3c182 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Sat, 7 Mar 2020 09:27:36 -0800 Subject: [PATCH 533/674] timings: Update/extend OSHMEM timings Signed-off-by: Artem Polyakov (cherry picked from commit 0f51ea3fe54832412ff528a7f030591b0ba0d809) --- oshmem/mca/memheap/base/base.h | 2 +- oshmem/mca/memheap/base/memheap_base_alloc.c | 12 ++++- oshmem/mca/memheap/base/memheap_base_mkey.c | 23 ++++++++- oshmem/mca/memheap/base/memheap_base_select.c | 33 ++++++++++-- oshmem/runtime/oshmem_shmem_init.c | 51 ++++++++++++++++++- 5 files changed, 112 insertions(+), 9 deletions(-) diff --git a/oshmem/mca/memheap/base/base.h b/oshmem/mca/memheap/base/base.h index 1140e99d520..64cdb01ca4f 100644 --- a/oshmem/mca/memheap/base/base.h +++ b/oshmem/mca/memheap/base/base.h @@ -62,7 +62,7 @@ typedef struct mca_memheap_map { extern mca_memheap_map_t mca_memheap_base_map; extern mca_memheap_base_config_t mca_memheap_base_config; -int mca_memheap_base_alloc_init(mca_memheap_map_t *, size_t, long); +int mca_memheap_base_alloc_init(mca_memheap_map_t *, size_t, long, char *); void mca_memheap_base_alloc_exit(mca_memheap_map_t *); int mca_memheap_base_static_init(mca_memheap_map_t *); void mca_memheap_base_static_exit(mca_memheap_map_t *); diff --git a/oshmem/mca/memheap/base/memheap_base_alloc.c b/oshmem/mca/memheap/base/memheap_base_alloc.c index 8ff20677ab9..6b0f9c6caa9 100644 --- a/oshmem/mca/memheap/base/memheap_base_alloc.c +++ b/oshmem/mca/memheap/base/memheap_base_alloc.c @@ -17,13 +17,17 @@ #include "oshmem/mca/sshmem/base/base.h" #include "oshmem/mca/memheap/memheap.h" #include "oshmem/mca/memheap/base/base.h" +#include "ompi/util/timings.h" -int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size, long hint) +int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size, long hint, + char *timing_prefix) { int ret = OSHMEM_SUCCESS; char * seg_filename = NULL; + OPAL_TIMING_ENV_INIT_PREFIX(timing_prefix, timing); + assert(map); if (hint == 0) { assert(HEAP_SEG_INDEX == map->n_segments); @@ -33,8 +37,13 @@ int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size, long hint) map_segment_t *s = &map->mem_segs[map->n_segments]; seg_filename = oshmem_get_unique_file_name(oshmem_my_proc_id()); + + OPAL_TIMING_ENV_NEXT(timing, "oshmem_get_unique_file_name()"); + ret = mca_sshmem_segment_create(s, seg_filename, size, hint); + OPAL_TIMING_ENV_NEXT(timing, "mca_sshmem_segment_create()"); + if (OSHMEM_SUCCESS == ret) { map->n_segments++; MEMHEAP_VERBOSE(1, @@ -43,6 +52,7 @@ int mca_memheap_base_alloc_init(mca_memheap_map_t *map, size_t size, long hint) } free(seg_filename); + OPAL_TIMING_ENV_NEXT(timing, "DONE"); return ret; } diff --git a/oshmem/mca/memheap/base/memheap_base_mkey.c b/oshmem/mca/memheap/base/memheap_base_mkey.c index a4c24744aab..ea778bddc5a 100644 --- a/oshmem/mca/memheap/base/memheap_base_mkey.c +++ b/oshmem/mca/memheap/base/memheap_base_mkey.c @@ -27,6 +27,7 @@ #include "oshmem/mca/memheap/memheap.h" #include "oshmem/mca/memheap/base/base.h" #include "oshmem/mca/spml/spml.h" +#include "opal/util/timings.h" /* Turn ON/OFF debug output from build (default 0) */ #ifndef MEMHEAP_BASE_DEBUG @@ -529,14 +530,16 @@ void mca_memheap_modex_recv_all(void) int rc = OSHMEM_SUCCESS; size_t buffer_size; + OPAL_TIMING_ENV_INIT(recv_all); + if (!mca_memheap_base_key_exchange) { oshmem_shmem_barrier(); return; } - + OPAL_TIMING_ENV_NEXT(recv_all, "barrier"); nprocs = oshmem_num_procs(); my_pe = oshmem_my_proc_id(); - + OPAL_TIMING_ENV_NEXT(recv_all, "proc position"); /* buffer allocation for num_transports * message sizes and offsets */ @@ -560,6 +563,7 @@ void mca_memheap_modex_recv_all(void) rc = OSHMEM_ERR_OUT_OF_RESOURCE; goto exit_fatal; } + OPAL_TIMING_ENV_NEXT(recv_all, "alloc bufs"); /* serialize our own mkeys */ msg = OBJ_NEW(opal_buffer_t); @@ -582,6 +586,9 @@ void mca_memheap_modex_recv_all(void) opal_dss.unload(msg, &send_buffer, &size); MEMHEAP_VERBOSE(1, "local keys packed into %d bytes, %d segments", size, memheap_map->n_segments); + OPAL_TIMING_ENV_NEXT(recv_all, "serialize data"); + + /* we need to send num_transports and message sizes separately * since message sizes depend on types of btl used */ @@ -591,12 +598,17 @@ void mca_memheap_modex_recv_all(void) goto exit_fatal; } + OPAL_TIMING_ENV_NEXT(recv_all, "allgather: transport cnt"); + + rc = oshmem_shmem_allgather(&size, rcv_size, sizeof(int)); if (MPI_SUCCESS != rc) { MEMHEAP_ERROR("allgather failed"); goto exit_fatal; } + OPAL_TIMING_ENV_NEXT(recv_all, "allgather: size info"); + /* calculating offsets (displacements) for allgatherv */ rcv_offsets[0] = 0; @@ -613,6 +625,8 @@ void mca_memheap_modex_recv_all(void) goto exit_fatal; } + OPAL_TIMING_ENV_NEXT(recv_all, "alloc data buf"); + rc = oshmem_shmem_allgatherv(send_buffer, rcv_buffer, size, rcv_size, rcv_offsets); if (MPI_SUCCESS != rc) { free (rcv_buffer); @@ -620,6 +634,8 @@ void mca_memheap_modex_recv_all(void) goto exit_fatal; } + OPAL_TIMING_ENV_NEXT(recv_all, "Perform mkey exchange"); + opal_dss.load(msg, rcv_buffer, buffer_size); /* deserialize mkeys */ @@ -651,6 +667,8 @@ void mca_memheap_modex_recv_all(void) } } + OPAL_TIMING_ENV_NEXT(recv_all, "Unpack data"); + OPAL_THREAD_UNLOCK(&memheap_oob.lck); exit_fatal: @@ -670,6 +688,7 @@ void mca_memheap_modex_recv_all(void) OBJ_RELEASE(msg); } + OPAL_TIMING_ENV_NEXT(recv_all, "Cleanup"); /* This function requires abort in any error case */ if (OSHMEM_SUCCESS != rc) { oshmem_shmem_abort(rc); diff --git a/oshmem/mca/memheap/base/memheap_base_select.c b/oshmem/mca/memheap/base/memheap_base_select.c index 9b856c76972..bc5872efad5 100644 --- a/oshmem/mca/memheap/base/memheap_base_select.c +++ b/oshmem/mca/memheap/base/memheap_base_select.c @@ -24,7 +24,7 @@ #include "orte/mca/errmgr/errmgr.h" #include "oshmem/include/shmemx.h" #include "oshmem/mca/sshmem/base/base.h" - +#include "ompi/util/timings.h" mca_memheap_base_config_t mca_memheap_base_config = { .device_nic_mem_seg_size = 0 @@ -57,6 +57,8 @@ int mca_memheap_base_select() mca_memheap_base_component_t *best_component = NULL; mca_memheap_base_module_t *best_module = NULL; + OPAL_TIMING_ENV_INIT(timing); + if( OPAL_SUCCESS != mca_base_select("memheap", oshmem_memheap_base_framework.framework_output, &oshmem_memheap_base_framework.framework_components, (mca_base_module_t **) &best_module, @@ -65,11 +67,15 @@ int mca_memheap_base_select() return OSHMEM_ERROR; } + OPAL_TIMING_ENV_NEXT(timing, "env"); + context = _memheap_create(); if (NULL == context) { return OSHMEM_ERROR; } + OPAL_TIMING_ENV_NEXT(timing, "_memheap_create()"); + if (OSHMEM_SUCCESS != best_component->memheap_init(context)) { opal_show_help("help-oshmem-memheap.txt", "find-available:none-found", @@ -78,6 +84,8 @@ int mca_memheap_base_select() return OSHMEM_ERROR; } + OPAL_TIMING_ENV_NEXT(timing, "best_component->memheap_init()"); + /* Calculate memheap size in case it was not set during component initialization */ best_module->memheap_size = context->user_size; setenv(SHMEM_HEAP_TYPE, @@ -90,6 +98,7 @@ int mca_memheap_base_select() best_component->memheap_version.mca_type_name, best_component->memheap_version.mca_component_name); + OPAL_TIMING_ENV_NEXT(timing, "DONE"); return OSHMEM_SUCCESS; } @@ -104,43 +113,60 @@ static memheap_context_t* _memheap_create(void) static memheap_context_t context; size_t user_size, size; + OPAL_TIMING_ENV_INIT(timing); + user_size = _memheap_size(); if (user_size < MEMHEAP_BASE_MIN_SIZE) { MEMHEAP_ERROR("Requested memheap size is less than minimal meamheap size (%llu < %llu)", (unsigned long long)user_size, MEMHEAP_BASE_MIN_SIZE); return NULL ; } + + OPAL_TIMING_ENV_NEXT(timing, "_memheap_size()"); + /* Inititialize symmetric area */ if (OSHMEM_SUCCESS == rc) { rc = mca_memheap_base_alloc_init(&mca_memheap_base_map, - user_size + MEMHEAP_BASE_PRIVATE_SIZE, 0); + user_size + MEMHEAP_BASE_PRIVATE_SIZE, 0, + "regular_mem"); } + OPAL_TIMING_ENV_NEXT(timing, "mca_memheap_base_alloc_init()"); + /* Initialize atomic symmetric area */ size = mca_memheap_base_config.device_nic_mem_seg_size; if ((OSHMEM_SUCCESS == rc) && (size > 0)) { rc = mca_memheap_base_alloc_init(&mca_memheap_base_map, size, - SHMEM_HINT_DEVICE_NIC_MEM); + SHMEM_HINT_DEVICE_NIC_MEM, + "device_mem"); if (rc == OSHMEM_ERR_NOT_IMPLEMENTED) { /* do not treat NOT_IMPLEMENTED as error */ rc = OSHMEM_SUCCESS; } } + OPAL_TIMING_ENV_NEXT(timing, "mca_memheap_base_alloc_init(DEVICE_MEM)"); + + /* Inititialize static/global variables area */ if (OSHMEM_SUCCESS == rc) { rc = mca_memheap_base_static_init(&mca_memheap_base_map); } + OPAL_TIMING_ENV_NEXT(timing, "mca_memheap_base_static_init()"); + /* Memory Registration */ if (OSHMEM_SUCCESS == rc) { rc = mca_memheap_base_reg(&mca_memheap_base_map); } + OPAL_TIMING_ENV_NEXT(timing, "mca_memheap_base_reg()"); + /* Init OOB channel */ if (OSHMEM_SUCCESS == rc) { rc = memheap_oob_init(&mca_memheap_base_map); } + OPAL_TIMING_ENV_NEXT(timing, "memheap_oob_init()"); if (OSHMEM_SUCCESS == rc) { context.user_size = user_size; @@ -152,6 +178,7 @@ static memheap_context_t* _memheap_create(void) (void*) ((unsigned char*) mca_memheap_base_map.mem_segs[HEAP_SEG_INDEX].super.va_base + context.user_size); } + OPAL_TIMING_ENV_NEXT(timing, "DONE"); return ((OSHMEM_SUCCESS == rc) ? &context : NULL ); } diff --git a/oshmem/runtime/oshmem_shmem_init.c b/oshmem/runtime/oshmem_shmem_init.c index f1115810045..4f2fd870ad1 100644 --- a/oshmem/runtime/oshmem_shmem_init.c +++ b/oshmem/runtime/oshmem_shmem_init.c @@ -148,7 +148,7 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided) { int ret = OSHMEM_SUCCESS; - OMPI_TIMING_INIT(32); + OMPI_TIMING_INIT(128); if (!oshmem_shmem_initialized) { ret = ompi_mpi_init(argc, argv, requested, provided, true); @@ -165,9 +165,14 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided) ret = _shmem_init(argc, argv, requested, provided); OMPI_TIMING_NEXT("_shmem_init"); + OMPI_TIMING_IMPORT_OPAL("_shmem_init"); OMPI_TIMING_IMPORT_OPAL("mca_scoll_mpi_comm_query"); OMPI_TIMING_IMPORT_OPAL("mca_scoll_enable"); OMPI_TIMING_IMPORT_OPAL("mca_scoll_base_select"); + OMPI_TIMING_IMPORT_OPAL("mca_memheap_base_select"); + OMPI_TIMING_IMPORT_OPAL("_memheap_create"); + OMPI_TIMING_IMPORT_OPAL_PREFIX("regular_mem", "mca_memheap_base_alloc_init"); + OMPI_TIMING_IMPORT_OPAL_PREFIX("device_mem", "mca_memheap_base_alloc_init"); if (OSHMEM_SUCCESS != ret) { return ret; @@ -183,6 +188,7 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided) /* this is a collective op, implies barrier */ MCA_MEMHEAP_CALL(get_all_mkeys()); OMPI_TIMING_NEXT("get_all_mkeys()"); + OMPI_TIMING_IMPORT_OPAL("mca_memheap_modex_recv_all"); oshmem_shmem_preconnect_all(); OMPI_TIMING_NEXT("shmem_preconnect_all"); @@ -259,6 +265,8 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) oshmem_mpi_thread_requested = requested; oshmem_mpi_thread_provided = requested; + OPAL_TIMING_ENV_INIT(timing); + /* Register the OSHMEM layer's MCA parameters */ if (OSHMEM_SUCCESS != (ret = oshmem_shmem_register_params())) { error = "oshmem_info_register: oshmem_register_params failed"; @@ -271,43 +279,58 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) opal_output_set_verbosity(shmem_api_logger_output, oshmem_shmem_api_verbose); + OPAL_TIMING_ENV_NEXT(timing, "shmem_params"); /* initialize info */ if (OSHMEM_SUCCESS != (ret = oshmem_info_init())) { error = "oshmem_info_init() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "oshmem_info_init()"); + /* initialize proc */ if (OSHMEM_SUCCESS != (ret = oshmem_proc_init())) { error = "oshmem_proc_init() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "oshmem_proc_init()"); + if (OSHMEM_SUCCESS != (ret = oshmem_op_init())) { error = "oshmem_op_init() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "oshmem_op_init()"); + if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_spml_base_framework, MCA_BASE_OPEN_DEFAULT))) { error = "mca_spml_base_open() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "open SPML framework"); + if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_scoll_base_framework, MCA_BASE_OPEN_DEFAULT))) { error = "mca_scoll_base_open() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "open SCOLL framework"); + if (OSHMEM_SUCCESS != (ret = mca_spml_base_select(OPAL_ENABLE_PROGRESS_THREADS, 1))) { error = "mca_spml_base_select() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "select SPML framework"); + if (OSHMEM_SUCCESS != (ret = mca_scoll_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) { error = "mca_scoll_base_find_available() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "find SCOLL components"); + /* Initialize each SHMEM handle subsystem */ /* Initialize requests */ if (OSHMEM_SUCCESS != (ret = oshmem_request_init())) { @@ -315,11 +338,15 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) goto error; } + OPAL_TIMING_ENV_NEXT(timing, "oshmem_request_init()"); + if (OSHMEM_SUCCESS != (ret = oshmem_proc_group_init())) { error = "oshmem_proc_group_init() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "oshmem_proc_group_init()"); + /* start SPML/BTL's */ ret = MCA_SPML_CALL(enable(true)); if (OSHMEM_SUCCESS != ret) { @@ -327,6 +354,8 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) goto error; } + OPAL_TIMING_ENV_NEXT(timing, "MCA_SPML_CALL(enable())"); + ret = MCA_SPML_CALL(add_procs(oshmem_group_all->proc_array, oshmem_group_all->proc_count)); if (OSHMEM_SUCCESS != ret) { @@ -334,46 +363,64 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) goto error; } + OPAL_TIMING_ENV_NEXT(timing, "MCA_SPML_CALL(add_procs())"); + if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_sshmem_base_framework, MCA_BASE_OPEN_DEFAULT))) { error = "mca_sshmem_base_open() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "open SSHMEM framework"); + if (OSHMEM_SUCCESS != (ret = mca_sshmem_base_select())) { error = "mca_sshmem_base_select() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "select SSHMEM framework"); + if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_memheap_base_framework, MCA_BASE_OPEN_DEFAULT))) { error = "mca_memheap_base_open() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "open MEMHEAP framework"); + + if (OSHMEM_SUCCESS != (ret = mca_memheap_base_select())) { error = "mca_memheap_base_select() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "select MEMHEAP framework"); + if (OSHMEM_SUCCESS != (ret = mca_base_framework_open(&oshmem_atomic_base_framework, MCA_BASE_OPEN_DEFAULT))) { error = "mca_atomic_base_open() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "open ATOMIC framework"); + if (OSHMEM_SUCCESS != (ret = mca_atomic_base_find_available(OPAL_ENABLE_PROGRESS_THREADS, 1))) { error = "mca_atomic_base_find_available() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "find avail ATOMIC framework"); + /* This call should be done after memheap initialization */ if (OSHMEM_SUCCESS != (ret = mca_scoll_enable())) { error = "mca_scoll_enable() failed"; goto error; } + OPAL_TIMING_ENV_NEXT(timing, "mca_scoll_enable()"); + (*provided) = oshmem_mpi_thread_provided; oshmem_mpi_thread_multiple = (oshmem_mpi_thread_provided == SHMEM_THREAD_MULTIPLE) ? true : false; + error: if (ret != OSHMEM_SUCCESS) { const char *err_msg = opal_strerror(ret); orte_show_help("help-shmem-runtime.txt", @@ -386,7 +433,7 @@ static int _shmem_init(int argc, char **argv, int requested, int *provided) ret); return ret; } + OPAL_TIMING_ENV_NEXT(timing, "DONE"); return ret; } - From 898b4f22104b82853c93d75898412e1136019cff Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 17 Mar 2020 08:48:04 -0700 Subject: [PATCH 534/674] Support hwloc retrieval using legacy key Re-enable support for Slurm plugin using earlier PMIx_LOCAL_TOPO key Signed-off-by: Ralph Castain --- opal/mca/hwloc/base/hwloc_base_util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 80d6b95ab0e..0980be39ae0 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -13,10 +13,10 @@ * Copyright (c) 2011-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2012-2017 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2013-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (C) 2018 Mellanox Technologies, Ltd. + * Copyright (C) 2018 Mellanox Technologies, Ltd. * All rights reserved. * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. * Copyright (c) 2019 IBM Corporation. All rights reserved. @@ -355,6 +355,13 @@ int opal_hwloc_base_get_topology(void) OPAL_MODEX_RECV_VALUE_IMMEDIATE(rc, OPAL_PMIX_HWLOC_XML_V1, &wildcard_rank, &val, OPAL_STRING); #endif + + if (rc != OPAL_SUCCESS) { + /* check the old topo key to keep compatibility with older RMs */ + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, OPAL_PMIX_LOCAL_TOPO, + &wildcard_rank, &val, OPAL_STRING); + } + } else { opal_output_verbose(1, opal_hwloc_base_framework.framework_output, "hwloc:base PMIx not available"); From d7857d000a2c28e9633c41b33f2e30d54e90a0c1 Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Sat, 28 Mar 2020 17:32:31 +0700 Subject: [PATCH 535/674] Fix Bcast scatter_allgather (issue #7410) Signed-off-by: Mikhail Kurnosov (cherry picked from commit 66b6b8d34e9bb50d34145096a9a2b210290510ca) --- ompi/mca/coll/base/coll_base_bcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/coll/base/coll_base_bcast.c b/ompi/mca/coll/base/coll_base_bcast.c index 1490d3a0cf9..a35e18fa9c8 100644 --- a/ompi/mca/coll/base/coll_base_bcast.c +++ b/ompi/mca/coll/base/coll_base_bcast.c @@ -876,7 +876,7 @@ int ompi_coll_base_bcast_intra_scatter_allgather( } else if ((vremote < vrank) && (vremote < tree_root + nprocs_alldata) && (vrank >= tree_root + nprocs_alldata)) { err = MCA_PML_CALL(recv((char *)buf + (ptrdiff_t)offset * extent, - count - offset, datatype, remote, + count, datatype, remote, MCA_COLL_BASE_TAG_BCAST, comm, &status)); if (MPI_SUCCESS != err) { goto cleanup_and_return; } From 7b1beb0f6c155bebff603beae06e6d4c40cced19 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 10 Dec 2019 15:04:07 +0100 Subject: [PATCH 536/674] Harmonize return values of progress callbacks Signed-off-by: Joseph Schuchart (cherry picked from commit 2c97187ee05e592346206a697ca3d9531d600fcc) --- ompi/mca/coll/libnbc/coll_libnbc_component.c | 4 +++- ompi/mca/mtl/psm2/mtl_psm2.c | 2 +- ompi/mca/osc/pt2pt/osc_pt2pt_component.c | 5 ++++- ompi/mca/pml/ucx/pml_ucx.c | 3 +-- ompi/request/grequestx.c | 4 +++- opal/mca/btl/uct/btl_uct_component.c | 5 ++++- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 6598972773d..2e23d2b7391 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -307,6 +307,7 @@ ompi_coll_libnbc_progress(void) { ompi_coll_libnbc_request_t* request, *next; int res; + int completed = 0; if (0 == opal_list_get_size (&mca_coll_libnbc_component.active_requests)) { /* no requests -- nothing to do. do not grab a lock */ @@ -344,6 +345,7 @@ ompi_coll_libnbc_progress(void) if(!request->super.super.req_persistent || !REQUEST_COMPLETE(&request->super.super)) { ompi_request_complete(&request->super.super, true); } + completed++; } OPAL_THREAD_LOCK(&mca_coll_libnbc_component.lock); } @@ -351,7 +353,7 @@ ompi_coll_libnbc_progress(void) } OPAL_THREAD_UNLOCK(&mca_coll_libnbc_component.lock); - return 0; + return completed; } diff --git a/ompi/mca/mtl/psm2/mtl_psm2.c b/ompi/mca/mtl/psm2/mtl_psm2.c index 4b5fc9cfd9a..50f0d96fbce 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2.c +++ b/ompi/mca/mtl/psm2/mtl_psm2.c @@ -403,7 +403,7 @@ int ompi_mtl_psm2_progress( void ) { mca_mtl_psm2_request_t* mtl_psm2_request; psm2_mq_status2_t psm2_status; psm2_mq_req_t req; - int completed = 1; + int completed = 0; do { OPAL_THREAD_LOCK(&mtl_psm2_mq_mutex); diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c index acb08fee54c..b94e17f3d5d 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_component.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_component.c @@ -153,6 +153,7 @@ static int component_register (void) static int component_progress (void) { + int completed = 0; int pending_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_operations); int recv_count = opal_list_get_size (&mca_osc_pt2pt_component.pending_receives); ompi_osc_pt2pt_pending_t *pending, *next; @@ -167,6 +168,7 @@ static int component_progress (void) } (void) ompi_osc_pt2pt_process_receive (recv); + completed++; } } @@ -194,12 +196,13 @@ static int component_progress (void) if (OMPI_SUCCESS == ret) { opal_list_remove_item (&mca_osc_pt2pt_component.pending_operations, &pending->super); OBJ_RELEASE(pending); + completed++; } } OPAL_THREAD_UNLOCK(&mca_osc_pt2pt_component.pending_operations_lock); } - return 1; + return completed; } static int diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index fb7b7f84615..056d26538e1 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -512,8 +512,7 @@ int mca_pml_ucx_enable(bool enable) int mca_pml_ucx_progress(void) { - ucp_worker_progress(ompi_pml_ucx.ucp_worker); - return OMPI_SUCCESS; + return ucp_worker_progress(ompi_pml_ucx.ucp_worker); } int mca_pml_ucx_add_comm(struct ompi_communicator_t* comm) diff --git a/ompi/request/grequestx.c b/ompi/request/grequestx.c index 1cc069c2432..98678cef9ad 100644 --- a/ompi/request/grequestx.c +++ b/ompi/request/grequestx.c @@ -34,6 +34,7 @@ static opal_mutex_t lock; static int grequestx_progress(void) { ompi_grequest_t *request, *next; + int completed = 0; OPAL_THREAD_LOCK(&lock); if (!in_progress) { @@ -47,6 +48,7 @@ static int grequestx_progress(void) { OPAL_THREAD_LOCK(&lock); opal_list_remove_item(&requests, &request->greq_base.super.super); OPAL_THREAD_UNLOCK(&lock); + completed++; } OPAL_THREAD_LOCK(&lock); } @@ -54,7 +56,7 @@ static int grequestx_progress(void) { } OPAL_THREAD_UNLOCK(&lock); - return OMPI_SUCCESS; + return completed; } int ompi_grequestx_start( diff --git a/opal/mca/btl/uct/btl_uct_component.c b/opal/mca/btl/uct/btl_uct_component.c index bff160736bc..776fe918ab5 100644 --- a/opal/mca/btl/uct/btl_uct_component.c +++ b/opal/mca/btl/uct/btl_uct_component.c @@ -561,6 +561,7 @@ static int mca_btl_uct_tl_progress (mca_btl_uct_tl_t *tl, int starting_index) static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl) { mca_btl_uct_base_frag_t *frag, *next; + int completed = 0; size_t count; if (0 == (count = opal_list_get_size (&uct_btl->pending_frags))) { @@ -577,11 +578,13 @@ static int mca_btl_uct_component_progress_pending (mca_btl_uct_module_t *uct_btl if (OPAL_SUCCESS > mca_btl_uct_send_frag (uct_btl, frag, false)) { opal_list_prepend (&uct_btl->pending_frags, (opal_list_item_t *) frag); + } else { + completed++; } } OPAL_THREAD_UNLOCK(&uct_btl->lock); - return OPAL_SUCCESS; + return completed; } /** From 0425a7a7d89a4a26e13f6cdb71a123a63b5df371 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 8 Jan 2020 16:07:36 -0500 Subject: [PATCH 537/674] Consistent return from all progress functions. This fix ensures that all progress functions return the number of completed events. Signed-off-by: George Bosilca (cherry picked from commit 72501f8f9c37b8db8dd08b274abd9774687a60cb) --- ompi/communicator/comm_request.c | 4 +++- ompi/mca/mtl/psm2/mtl_psm2.c | 2 +- ompi/request/grequest.c | 19 ++++++++++--------- ompi/request/grequestx.c | 4 +--- oshmem/mca/spml/ucx/spml_ucx_component.c | 11 ++++++----- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ompi/communicator/comm_request.c b/ompi/communicator/comm_request.c index 272fc33600b..1ca5679ae08 100644 --- a/ompi/communicator/comm_request.c +++ b/ompi/communicator/comm_request.c @@ -100,6 +100,7 @@ static int ompi_comm_request_progress (void) { ompi_comm_request_t *request, *next; static int32_t progressing = 0; + int completed = 0; /* don't allow re-entry */ if (opal_atomic_swap_32 (&progressing, 1)) { @@ -121,6 +122,7 @@ static int ompi_comm_request_progress (void) if( REQUEST_COMPLETE(subreq) ) { ompi_request_free (&subreq); request_item->subreq_count--; + completed++; } else { item_complete = false; break; @@ -156,7 +158,7 @@ static int ompi_comm_request_progress (void) opal_mutex_unlock (&ompi_comm_request_mutex); progressing = 0; - return 1; + return completed; } void ompi_comm_request_start (ompi_comm_request_t *request) diff --git a/ompi/mca/mtl/psm2/mtl_psm2.c b/ompi/mca/mtl/psm2/mtl_psm2.c index 50f0d96fbce..086d824451e 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2.c +++ b/ompi/mca/mtl/psm2/mtl_psm2.c @@ -469,5 +469,5 @@ int ompi_mtl_psm2_progress( void ) { opal_show_help("help-mtl-psm2.txt", "error polling network", true, psm2_error_get_string(err)); - return 1; + return OMPI_ERROR; } diff --git a/ompi/request/grequest.c b/ompi/request/grequest.c index 10d8885d82d..c895b4232b6 100644 --- a/ompi/request/grequest.c +++ b/ompi/request/grequest.c @@ -202,14 +202,13 @@ int ompi_grequest_invoke_query(ompi_request_t *request, int rc = OMPI_SUCCESS; ompi_grequest_t *g = (ompi_grequest_t*) request; - /* MPI-2:8.2 does not say what to do with the return value from - the query function (i.e., the int return value from the C - function or the ierr argument from the Fortran function). - Making the command decision here to ignore it. If the handler - wants to pass an error back, it should set it in the MPI_ERROR - field in the status (which is always kept, regardless if the - top-level function was invoked with MPI_STATUS[ES]_IGNORE or - not). */ + /* MPI-3 mandates that the return value from the query function + * (i.e., the int return value from the C function or the ierr + * argument from the Fortran function) must be returned to the + * user. Thus, if the return of the query function is not MPI_SUCCESS + * we will update the MPI_ERROR field. Otherwise, the MPI_ERROR + * field is untouched (or left to the discretion of the query function). + */ if (NULL != g->greq_query.c_query) { if (g->greq_funcs_are_c) { rc = g->greq_query.c_query(g->greq_state, status); @@ -221,7 +220,9 @@ int ompi_grequest_invoke_query(ompi_request_t *request, rc = OMPI_FINT_2_INT(ierr); } } - + if( MPI_SUCCESS != rc ) { + status->MPI_ERROR = rc; + } return rc; } diff --git a/ompi/request/grequestx.c b/ompi/request/grequestx.c index 98678cef9ad..739458db8f6 100644 --- a/ompi/request/grequestx.c +++ b/ompi/request/grequestx.c @@ -44,13 +44,11 @@ static int grequestx_progress(void) { MPI_Status status; OPAL_THREAD_UNLOCK(&lock); request->greq_poll.c_poll(request->greq_state, &status); + OPAL_THREAD_LOCK(&lock); if (REQUEST_COMPLETE(&request->greq_base)) { - OPAL_THREAD_LOCK(&lock); opal_list_remove_item(&requests, &request->greq_base.super.super); - OPAL_THREAD_UNLOCK(&lock); completed++; } - OPAL_THREAD_LOCK(&lock); } in_progress = false; } diff --git a/oshmem/mca/spml/ucx/spml_ucx_component.c b/oshmem/mca/spml/ucx/spml_ucx_component.c index 5fd43bdbe5e..a0348e972ea 100644 --- a/oshmem/mca/spml/ucx/spml_ucx_component.c +++ b/oshmem/mca/spml/ucx/spml_ucx_component.c @@ -187,20 +187,21 @@ static int mca_spml_ucx_component_register(void) int spml_ucx_ctx_progress(void) { - int i; + int i, completed = 0; for (i = 0; i < mca_spml_ucx.active_array.ctxs_count; i++) { - ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); + completed += ucp_worker_progress(mca_spml_ucx.active_array.ctxs[i]->ucp_worker[0]); } - return 1; + return completed; } int spml_ucx_default_progress(void) { unsigned int i=0; + int completed = 0; for (i = 0; i < mca_spml_ucx.ucp_workers; i++) { - ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]); + completed += ucp_worker_progress(mca_spml_ucx_ctx_default.ucp_worker[i]); } - return 1; + return completed; } int spml_ucx_progress_aux_ctx(void) From 16c8931ec905baa9f1150c8603313fd9de5b9153 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 30 Mar 2020 15:48:27 -0700 Subject: [PATCH 538/674] Daemonize the orteds during tree-spawn Somehow, the line of code that actually added the daemonize option to the orted cmd line was removed. Signed-off-by: Ralph Castain --- orte/mca/plm/rsh/plm_rsh_module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/orte/mca/plm/rsh/plm_rsh_module.c b/orte/mca/plm/rsh/plm_rsh_module.c index 0a795f077d1..153cadfdfd5 100644 --- a/orte/mca/plm/rsh/plm_rsh_module.c +++ b/orte/mca/plm/rsh/plm_rsh_module.c @@ -14,7 +14,7 @@ * reserved. * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2011-2019 IBM Corporation. All rights reserved. - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -614,6 +614,7 @@ static int setup_launch(int *argcptr, char ***argvptr, (mca_plm_rsh_component.using_qrsh && mca_plm_rsh_component.daemonize_qrsh)) && ((!mca_plm_rsh_component.using_llspawn) || (mca_plm_rsh_component.using_llspawn && mca_plm_rsh_component.daemonize_llspawn))) { + opal_argv_append(&argc, &argv, "--daemonize"); } if (!mca_plm_rsh_component.no_tree_spawn) { From 7938c6175290360a997058187c2b2a3d1474b942 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 1 Apr 2020 16:19:54 +0900 Subject: [PATCH 539/674] configury: try if -fpp flag is needed to preprocess .F90 files .F90 files are preprocessed by gfortran and other compilers. NAG compilers only preprocess .{ff,ff90,ff95} files, and the -fpp flag is required to process .F90 files. Fixes open-mpi/ompi#7583 Signed-off-by: Gilles Gouaillardet (cherry picked from commit a2c711b54b207d9228ca70fe08028614903c2bf6) --- config/ompi_setup_fc.m4 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/config/ompi_setup_fc.m4 b/config/ompi_setup_fc.m4 index a65caa179d8..7526e15c634 100644 --- a/config/ompi_setup_fc.m4 +++ b/config/ompi_setup_fc.m4 @@ -14,8 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2009-2014 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) 2015-2020 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -139,6 +139,24 @@ AC_DEFUN([OMPI_SETUP_FC],[ [AC_FC_SRCEXT(f) AC_FC_SRCEXT(f90)]) + AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag]) + cat > conftest_f.F90 << EOF +#if 0 +#error The source file was not preprocessed +#endif + program bogus + end program +EOF + OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90], + [AC_MSG_RESULT(["yes"])], + [AC_MSG_CHECKING([if -fpp flag works]) + OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90], + [AC_MSG_RESULT(["yes"]) + FCFLAGS="$FCFLAGS -fpp"], + [AC_MSG_RESULT("no") + AC_MSG_ERROR(["cannot preprocess Fortran files, Aborting"])])]) + rm -f conftest* + # Per trac #1982, on OS X, we may need some esoteric linker flags # in the wrapper compilers. However, per # https://github.com/open-mpi/ompi/issues/259, we need to use From bc654354fef4e169f916d6bca13559b24c70d2a3 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 2 Apr 2020 16:12:09 -0700 Subject: [PATCH 540/674] Fortran: fix the F90 compiler preprocessor check Only check the if the Fortran compiler needs additional CLI flags for preprocessing .F90 files if we actually have an F90 compiler. Also fix a the AC_MSG_* usage. Signed-off-by: Jeff Squyres (cherry picked from commit a7e4ca4dc058902c705e14063cd3635f5a58b637) --- config/ompi_fortran_check_preprocess_f90.m4 | 43 +++++++++++++++++++++ config/ompi_setup_fc.m4 | 23 +++-------- 2 files changed, 48 insertions(+), 18 deletions(-) create mode 100644 config/ompi_fortran_check_preprocess_f90.m4 diff --git a/config/ompi_fortran_check_preprocess_f90.m4 b/config/ompi_fortran_check_preprocess_f90.m4 new file mode 100644 index 00000000000..84d623f81be --- /dev/null +++ b/config/ompi_fortran_check_preprocess_f90.m4 @@ -0,0 +1,43 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, +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) 2009 Oak Ridge National Labs. All rights reserved. +dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2015 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +AC_DEFUN([OMPI_FORTRAN_CHECK_PREPROCESS_F90], [ + AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag]) + cat > conftest_f.F90 << EOF +#if 0 +#error The source file was not preprocessed +#endif + program bogus + end program +EOF + OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_CHECKING([if -fpp flag works]) + OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90], + [AC_MSG_RESULT([yes]) + FCFLAGS="$FCFLAGS -fpp"], + [AC_MSG_RESULT(no) + AC_MSG_ERROR([cannot preprocess Fortran files, Aborting])])]) + rm -f conftest* +])dnl diff --git a/config/ompi_setup_fc.m4 b/config/ompi_setup_fc.m4 index 7526e15c634..ab60092f674 100644 --- a/config/ompi_setup_fc.m4 +++ b/config/ompi_setup_fc.m4 @@ -13,7 +13,7 @@ dnl All rights reserved. dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. -dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2015-2020 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ @@ -139,23 +139,10 @@ AC_DEFUN([OMPI_SETUP_FC],[ [AC_FC_SRCEXT(f) AC_FC_SRCEXT(f90)]) - AC_MSG_CHECKING([if Fortran compilers preprocess .F90 files without additional flag]) - cat > conftest_f.F90 << EOF -#if 0 -#error The source file was not preprocessed -#endif - program bogus - end program -EOF - OPAL_LOG_COMMAND([$FC $FCFLAGS -c conftest_f.F90], - [AC_MSG_RESULT(["yes"])], - [AC_MSG_CHECKING([if -fpp flag works]) - OPAL_LOG_COMMAND([$FC $FCFLAGS -fpp -c conftest_f.F90], - [AC_MSG_RESULT(["yes"]) - FCFLAGS="$FCFLAGS -fpp"], - [AC_MSG_RESULT("no") - AC_MSG_ERROR(["cannot preprocess Fortran files, Aborting"])])]) - rm -f conftest* + # Check to see if we need additional compiler flags for + # preprocessing .F90 files. + AS_IF([test $ompi_fc_happy -eq 1], + [OMPI_FORTRAN_CHECK_PREPROCESS_F90]) # Per trac #1982, on OS X, we may need some esoteric linker flags # in the wrapper compilers. However, per From e679a0a6f38a6b111ccef24a5d5723e9f10b95c0 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 7 Apr 2020 16:41:36 -0600 Subject: [PATCH 541/674] debuggers: don't remove session dirctory when the exiting process is a debugger process. relates to #5115 Signed-off-by: Howard Pritchard --- orte/mca/state/base/state_base_fns.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/orte/mca/state/base/state_base_fns.c b/orte/mca/state/base/state_base_fns.c index 16f35c88680..ceb8e1b2eca 100644 --- a/orte/mca/state/base/state_base_fns.c +++ b/orte/mca/state/base/state_base_fns.c @@ -3,6 +3,7 @@ * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyrigth (c) 2020 Triad National Security, LLC. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -734,8 +735,12 @@ void orte_state_base_track_procs(int fd, short argc, void *cbdata) /* Clean up the session directory as if we were the process * itself. This covers the case where the process died abnormally * and didn't cleanup its own session directory. + * Don't do this for debugger daemons otherwise reattach is + * broken. See https://github.com/open-mpi/ompi/issues/5115. */ - orte_session_dir_finalize(proc); + if (!ORTE_FLAG_TEST(jdata, ORTE_JOB_FLAG_DEBUGGER_DAEMON)) { + orte_session_dir_finalize(proc); + } } /* if we are trying to terminate and our routes are * gone, then terminate ourselves IF no local procs From e1543e37c6021022a873c1c223db5f1c12c6a430 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 9 Apr 2020 07:13:02 -0700 Subject: [PATCH 542/674] Silence unnecessary error logs Tracks https://github.com/openpmix/openpmix/pull/1669 Signed-off-by: Ralph Castain --- .../pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c index 57177ef5003..0bcce2b7693 100644 --- a/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c +++ b/opal/mca/pmix/pmix3x/pmix/src/mca/gds/ds12/gds_ds12_lock_pthread.c @@ -199,20 +199,16 @@ void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx) (ds12_lock_pthread_ctx_t*)*lock_ctx; if (NULL == pthread_lock) { - PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND); return; } if (0 != pthread_rwlock_destroy(pthread_lock->rwlock)) { - PMIX_ERROR_LOG(PMIX_ERROR); return; } if (NULL == pthread_lock->segment) { - PMIX_ERROR_LOG(PMIX_ERROR); return; } if (NULL == pthread_lock->lockfile) { - PMIX_ERROR_LOG(PMIX_ERROR); return; } From a073ef9ee8836bac8a08f09d08c0f07ce058f164 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Tue, 7 Apr 2020 23:56:42 -0400 Subject: [PATCH 543/674] Follow the MPI_T guidelines on return errors. As indicated in the MPI3.2 document 14.3.10 page 599 line 1, the only MPI error code possible is MPI_SUCCESS. All other errors must be in the error class MPI_T_ERR*. Fix the return of few pvar/cvar function that failed to correctly convert to an MPI error code. Signed-off-by: George Bosilca (cherry picked from commit f4af1848c9e5ea962a560e1f0b6bdab3d8ef0b6a) --- examples/spc_example.c | 12 +++++++----- ompi/mpi/tool/category_get_categories.c | 5 ++++- ompi/mpi/tool/category_get_cvars.c | 5 ++++- ompi/mpi/tool/category_get_index.c | 6 +++++- ompi/mpi/tool/category_get_info.c | 5 ++++- ompi/mpi/tool/category_get_num.c | 5 ++++- ompi/mpi/tool/category_get_pvars.c | 5 ++++- ompi/mpi/tool/cvar_get_index.c | 5 ++++- ompi/mpi/tool/cvar_get_info.c | 7 ++++++- ompi/mpi/tool/cvar_get_num.c | 5 ++++- ompi/mpi/tool/cvar_handle_alloc.c | 7 +++++-- ompi/mpi/tool/cvar_read.c | 11 +++++++---- ompi/mpi/tool/cvar_write.c | 5 ++++- ompi/mpi/tool/enum_get_info.c | 5 ++++- ompi/mpi/tool/enum_get_item.c | 7 +++++-- ompi/mpi/tool/init_thread.c | 7 +++++-- ompi/mpi/tool/mpit_common.c | 5 ++++- ompi/mpi/tool/pvar_get_index.c | 5 ++++- ompi/mpi/tool/pvar_get_info.c | 7 ++++++- ompi/mpi/tool/pvar_get_num.c | 5 ++++- ompi/mpi/tool/pvar_handle_alloc.c | 4 ++++ ompi/mpi/tool/pvar_handle_free.c | 5 ++++- ompi/mpi/tool/pvar_session_create.c | 5 ++++- test/spc/spc_test.c | 12 ++++++------ 24 files changed, 112 insertions(+), 38 deletions(-) diff --git a/examples/spc_example.c b/examples/spc_example.c index 5b57589cffd..11732cd9f40 100644 --- a/examples/spc_example.c +++ b/examples/spc_example.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The University of Tennessee and The University + * Copyright (c) 2018-2020 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * @@ -37,7 +37,7 @@ void message_exchange(int num_messages, int message_size) int main(int argc, char **argv) { - int num_messages, message_size; + int num_messages, message_size, rc; if(argc < 3) { printf("Usage: mpirun -np 2 --mca mpi_spc_attach all --mca mpi_spc_dump_enabled true ./spc_example [num_messages] [message_size]\n"); @@ -72,9 +72,11 @@ int main(int argc, char **argv) MPI_T_pvar_get_num(&num); for(i = 0; i < num; i++) { name_len = desc_len = 256; - PMPI_T_pvar_get_info(i, name, &name_len, &verbosity, - &var_class, &datatype, &enumtype, description, &desc_len, &bind, - &readonly, &continuous, &atomic); + rc = PMPI_T_pvar_get_info(i, name, &name_len, &verbosity, + &var_class, &datatype, &enumtype, description, &desc_len, &bind, + &readonly, &continuous, &atomic); + if( MPI_SUCCESS != rc ) + continue; if(strcmp(name, counter_names[rank]) == 0) { index = i; printf("[%d] %s -> %s\n", rank, name, description); diff --git a/ompi/mpi/tool/category_get_categories.c b/ompi/mpi/tool/category_get_categories.c index 0e85d9edd42..4f898b9c9c3 100644 --- a/ompi/mpi/tool/category_get_categories.c +++ b/ompi/mpi/tool/category_get_categories.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +41,7 @@ int MPI_T_category_get_categories(int cat_index, int len, int indices[]) do { rc = mca_base_var_group_get (cat_index, &group); if (0 > rc) { - rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER; + rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/category_get_cvars.c b/ompi/mpi/tool/category_get_cvars.c index 9983958aeff..430ba7db201 100644 --- a/ompi/mpi/tool/category_get_cvars.c +++ b/ompi/mpi/tool/category_get_cvars.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +41,7 @@ int MPI_T_category_get_cvars(int cat_index, int len, int indices[]) do { rc = mca_base_var_group_get (cat_index, &group); if (0 > rc) { - rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER; + rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/category_get_index.c b/ompi/mpi/tool/category_get_index.c index f25473c7b8a..df4e1946042 100644 --- a/ompi/mpi/tool/category_get_index.c +++ b/ompi/mpi/tool/category_get_index.c @@ -4,6 +4,10 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +35,7 @@ int MPI_T_category_get_index (const char *name, int *category_index) } if (MPI_PARAM_CHECK && (NULL == category_index || NULL == name)) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/category_get_info.c b/ompi/mpi/tool/category_get_info.c index 2b6766e54f2..1ee833509be 100644 --- a/ompi/mpi/tool/category_get_info.c +++ b/ompi/mpi/tool/category_get_info.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +41,7 @@ int MPI_T_category_get_info(int cat_index, char *name, int *name_len, do { rc = mca_base_var_group_get (cat_index, &group); if (0 > rc) { - rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER; + rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/category_get_num.c b/ompi/mpi/tool/category_get_num.c index cfbfcd8b0e6..f7b19beea20 100644 --- a/ompi/mpi/tool/category_get_num.c +++ b/ompi/mpi/tool/category_get_num.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -29,7 +32,7 @@ int MPI_T_category_get_num (int *num_cat) } if (MPI_PARAM_CHECK && NULL == num_cat) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/category_get_pvars.c b/ompi/mpi/tool/category_get_pvars.c index e6337ed2fe2..90eedb6c86b 100644 --- a/ompi/mpi/tool/category_get_pvars.c +++ b/ompi/mpi/tool/category_get_pvars.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -38,7 +41,7 @@ int MPI_T_category_get_pvars(int cat_index, int len, int indices[]) do { rc = mca_base_var_group_get (cat_index, &group); if (0 > rc) { - rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER; + rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/cvar_get_index.c b/ompi/mpi/tool/cvar_get_index.c index 2445d0462c4..2de238efa2e 100644 --- a/ompi/mpi/tool/cvar_get_index.c +++ b/ompi/mpi/tool/cvar_get_index.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +34,7 @@ int MPI_T_cvar_get_index (const char *name, int *cvar_index) } if (MPI_PARAM_CHECK && (NULL == cvar_index || NULL == name)) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/cvar_get_info.c b/ompi/mpi/tool/cvar_get_info.c index ba3bde12f8e..8b5e7fa0d14 100644 --- a/ompi/mpi/tool/cvar_get_info.c +++ b/ompi/mpi/tool/cvar_get_info.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,7 +42,7 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosit rc = mca_base_var_get (cvar_index, &var); if (OPAL_SUCCESS != rc) { rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : - MPI_ERR_OTHER; + MPI_T_ERR_INVALID; break; } @@ -49,6 +52,8 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosit /* find the corresponding mpi type for an mca type */ rc = ompit_var_type_to_datatype (var->mbv_type, datatype); if (OMPI_SUCCESS != rc) { + rc = MPI_T_ERR_INVALID; /* can't really happen as MPI_SUCCESS is the only + possible return from ompit_var_type_to_datatype */ break; } diff --git a/ompi/mpi/tool/cvar_get_num.c b/ompi/mpi/tool/cvar_get_num.c index 10e04514eee..0b852fc32be 100644 --- a/ompi/mpi/tool/cvar_get_num.c +++ b/ompi/mpi/tool/cvar_get_num.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,7 +31,7 @@ int MPI_T_cvar_get_num (int *num_cvar) { } if (MPI_PARAM_CHECK && NULL == num_cvar) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/cvar_handle_alloc.c b/ompi/mpi/tool/cvar_handle_alloc.c index 6e0ae41dd3f..0a0ecec297a 100644 --- a/ompi/mpi/tool/cvar_handle_alloc.c +++ b/ompi/mpi/tool/cvar_handle_alloc.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +36,7 @@ int MPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle, } if (MPI_PARAM_CHECK && (NULL == handle || NULL == count)) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); @@ -50,7 +53,7 @@ int MPI_T_cvar_handle_alloc (int cvar_index, void *obj_handle, rc = mca_base_var_get(cvar_index, &new_handle->var); if (OPAL_SUCCESS != rc) { rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX: - MPI_ERR_OTHER; + MPI_T_ERR_INVALID; free (new_handle); break; } diff --git a/ompi/mpi/tool/cvar_read.c b/ompi/mpi/tool/cvar_read.c index 2246c5f88be..ef53e736b93 100644 --- a/ompi/mpi/tool/cvar_read.c +++ b/ompi/mpi/tool/cvar_read.c @@ -5,6 +5,9 @@ * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2016 Intel, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -33,7 +36,7 @@ int MPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf) } if (MPI_PARAM_CHECK && NULL == buf) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); @@ -41,8 +44,8 @@ int MPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf) do { rc = mca_base_var_get_value(handle->var->mbv_index, &value, NULL, NULL); if (OPAL_SUCCESS != rc || NULL == value) { - /* shouldn't happen */ - rc = MPI_ERR_OTHER; + /* invalid or discarded cvar, ignore */ + rc = MPI_T_ERR_INVALID_INDEX; break; } @@ -84,7 +87,7 @@ int MPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf) break; default: - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; } } while (0); diff --git a/ompi/mpi/tool/cvar_write.c b/ompi/mpi/tool/cvar_write.c index 4d660416e0a..23731ffb601 100644 --- a/ompi/mpi/tool/cvar_write.c +++ b/ompi/mpi/tool/cvar_write.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +34,7 @@ int MPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf) } if (MPI_PARAM_CHECK && NULL == buf) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/enum_get_info.c b/ompi/mpi/tool/enum_get_info.c index 4e87bd0a676..441197e389f 100644 --- a/ompi/mpi/tool/enum_get_info.c +++ b/ompi/mpi/tool/enum_get_info.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,7 +39,7 @@ int MPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *name, int *name_len if (num) { rc = enumtype->get_count (enumtype, num); if (OPAL_SUCCESS != rc) { - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; break; } } diff --git a/ompi/mpi/tool/enum_get_item.c b/ompi/mpi/tool/enum_get_item.c index e9e8fff9ac2..0ddcd34f9b4 100644 --- a/ompi/mpi/tool/enum_get_item.c +++ b/ompi/mpi/tool/enum_get_item.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -37,7 +40,7 @@ int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, do { rc = enumtype->get_count (enumtype, &count); if (OPAL_SUCCESS != rc) { - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; break; } @@ -48,7 +51,7 @@ int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, rc = enumtype->get_value(enumtype, index, value, &tmp); if (OPAL_SUCCESS != rc) { - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/init_thread.c b/ompi/mpi/tool/init_thread.c index 53c8e4cf988..958985c3584 100644 --- a/ompi/mpi/tool/init_thread.c +++ b/ompi/mpi/tool/init_thread.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -45,14 +48,14 @@ int MPI_T_init_thread (int required, int *provided) /* call opal_init_util to intialize the MCA system */ rc = opal_init_util (NULL, NULL); if (OPAL_SUCCESS != rc) { - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; break; } /* register all parameters */ rc = ompi_info_register_framework_params (NULL); if (OMPI_SUCCESS != rc) { - rc = MPI_ERR_OTHER; + rc = MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/mpit_common.c b/ompi/mpi/tool/mpit_common.c index d30e1b89c94..e47da814f7a 100644 --- a/ompi/mpi/tool/mpit_common.c +++ b/ompi/mpi/tool/mpit_common.c @@ -5,6 +5,9 @@ * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -81,6 +84,6 @@ int ompit_opal_to_mpit_error (int rc) case OPAL_ERR_NOT_BOUND: return MPI_T_ERR_INVALID_HANDLE; default: - return MPI_ERR_UNKNOWN; + return MPI_T_ERR_INVALID; } } diff --git a/ompi/mpi/tool/pvar_get_index.c b/ompi/mpi/tool/pvar_get_index.c index b7d5d5e5244..6280439b973 100644 --- a/ompi/mpi/tool/pvar_get_index.c +++ b/ompi/mpi/tool/pvar_get_index.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -31,7 +34,7 @@ int MPI_T_pvar_get_index (const char *name, int var_class, int *pvar_index) } if (MPI_PARAM_CHECK && (NULL == pvar_index || NULL == name)) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } ompi_mpit_lock (); diff --git a/ompi/mpi/tool/pvar_get_info.c b/ompi/mpi/tool/pvar_get_info.c index 8121558f49c..a83984c85e3 100644 --- a/ompi/mpi/tool/pvar_get_info.c +++ b/ompi/mpi/tool/pvar_get_info.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,6 +44,7 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, bounds checking. */ ret = mca_base_pvar_get (pvar_index, &pvar); if (OMPI_SUCCESS != ret) { + ret = (OPAL_ERR_NOT_FOUND == ret) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } @@ -65,7 +69,8 @@ int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, ret = ompit_var_type_to_datatype (pvar->type, datatype); if (OMPI_SUCCESS != ret) { - break; + ret = MPI_T_ERR_INVALID; /* can't really happen as MPI_SUCCESS is the only + possible return from ompit_var_type_to_datatype */ } if (NULL != enumtype) { diff --git a/ompi/mpi/tool/pvar_get_num.c b/ompi/mpi/tool/pvar_get_num.c index 201e8b77cf3..190c8e2bc13 100644 --- a/ompi/mpi/tool/pvar_get_num.c +++ b/ompi/mpi/tool/pvar_get_num.c @@ -3,6 +3,9 @@ * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -28,7 +31,7 @@ int MPI_T_pvar_get_num(int *num_pvar) } if (MPI_PARAM_CHECK && NULL == num_pvar) { - return MPI_ERR_ARG; + return MPI_T_ERR_INVALID; } return mca_base_pvar_get_count (num_pvar); diff --git a/ompi/mpi/tool/pvar_handle_alloc.c b/ompi/mpi/tool/pvar_handle_alloc.c index 770f51323a4..83eb650475f 100644 --- a/ompi/mpi/tool/pvar_handle_alloc.c +++ b/ompi/mpi/tool/pvar_handle_alloc.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -39,6 +42,7 @@ int MPI_T_pvar_handle_alloc(MPI_T_pvar_session session, int pvar_index, bounds checking. */ ret = mca_base_pvar_get (pvar_index, &pvar); if (OMPI_SUCCESS != ret) { + ret = (OPAL_ERR_NOT_FOUND == ret) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID; break; } diff --git a/ompi/mpi/tool/pvar_handle_free.c b/ompi/mpi/tool/pvar_handle_free.c index 095964778ff..154d1c270f3 100644 --- a/ompi/mpi/tool/pvar_handle_free.c +++ b/ompi/mpi/tool/pvar_handle_free.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -44,7 +47,7 @@ int MPI_T_pvar_handle_free(MPI_T_pvar_session session, MPI_T_pvar_handle *handle ret = mca_base_pvar_handle_free (*handle); if (OPAL_SUCCESS != ret) { - ret = MPI_ERR_UNKNOWN; + ret = MPI_T_ERR_INVALID; } *handle = MPI_T_PVAR_HANDLE_NULL; diff --git a/ompi/mpi/tool/pvar_session_create.c b/ompi/mpi/tool/pvar_session_create.c index 6389125d529..9e0e91cf0a4 100644 --- a/ompi/mpi/tool/pvar_session_create.c +++ b/ompi/mpi/tool/pvar_session_create.c @@ -4,6 +4,9 @@ * reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,7 +37,7 @@ int MPI_T_pvar_session_create(MPI_T_pvar_session *session) *session = OBJ_NEW(mca_base_pvar_session_t); if (NULL == *session) { - ret = MPI_ERR_NO_MEM; + ret = MPI_T_ERR_MEMORY; } ompi_mpit_unlock (); diff --git a/test/spc/spc_test.c b/test/spc/spc_test.c index 65dc744435f..57b593fd934 100644 --- a/test/spc/spc_test.c +++ b/test/spc/spc_test.c @@ -1,7 +1,7 @@ /* - * Copyright (c) 2018 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. + * Copyright (c) 2018-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. * * Simple example usage of SPCs through MPI_T. */ @@ -71,9 +71,9 @@ int main(int argc, char **argv) for(i = 0; i < num; i++) { name_len = desc_len = 256; - MPI_T_pvar_get_info(i, name, &name_len, &verbosity, - &var_class, &datatype, &enumtype, description, &desc_len, &bind, - &readonly, &continuous, &atomic); + MPI_result = MPI_T_pvar_get_info(i, name, &name_len, &verbosity, + &var_class, &datatype, &enumtype, description, &desc_len, &bind, + &readonly, &continuous, &atomic); if(MPI_result != MPI_SUCCESS || MPI_result == MPI_T_ERR_PVAR_NO_STARTSTOP) { fprintf(stderr, "Failed to get pvar info.\n"); MPI_Abort(MPI_COMM_WORLD, MPI_result); From dfd34eb4e3f28137e14cfd17cb0bea1e51995d17 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 14 Apr 2020 10:14:41 +0900 Subject: [PATCH 544/674] fortran/use-mpi-f08: restore ABI compatibility An incorrect backport in open-mpi/ompi#7360 removed constants.c from ompi/mpi/fortran/use-mpi-f08/base/Makefile.am This one off commit fixes that, and move constants.h from ompi/mpi/fortran/use-mpi-f08 to ompi/mpi/fortran/use-mpi-f08/base Fixes open-mpi/ompi#7616 Signed-off-by: Gilles Gouaillardet --- .gitignore | 2 +- ompi/include/mpif-values.pl | 14 +++++++------- ompi/mpi/fortran/use-mpi-f08/base/Makefile.am | 6 +++++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index d9744ac97c3..ff8e303f9d9 100644 --- a/.gitignore +++ b/.gitignore @@ -214,8 +214,8 @@ ompi/mpi/fortran/mpif-h/sizeof_f.f90 ompi/mpi/fortran/mpif-h/profile/p*.c ompi/mpi/fortran/mpif-h/profile/psizeof_f.f90 +ompi/mpi/fortran/use-mpi-f08/base/constants.h ompi/mpi/fortran/use-mpi-f08/mod/mpi-f08-constants.h -ompi/mpi/fortran/use-mpi-f08/constants.h ompi/mpi/fortran/use-mpi-f08/sizeof_f08.f90 ompi/mpi/fortran/use-mpi-f08/sizeof_f08.h ompi/mpi/fortran/use-mpi-f08/profile/psizeof_f08.f90 diff --git a/ompi/include/mpif-values.pl b/ompi/include/mpif-values.pl index 70026216eb4..0c640d61194 100755 --- a/ompi/include/mpif-values.pl +++ b/ompi/include/mpif-values.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl # # Copyright (c) 2011-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 (c) 2016 FUJITSU LIMITED. All rights reserved. # $COPYRIGHT$ @@ -489,8 +489,8 @@ sub write_fortran_file { * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2009-2012 Los Alamos National Security, LLC. * All rights reserved. - * Copyright (c) 2016 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 @@ -498,8 +498,8 @@ sub write_fortran_file { * $HEADER$ */ -#ifndef USE_MPI_F08_CONSTANTS_H -#define USE_MPI_F08_CONSTANTS_H +#ifndef USE_MPI_F08_BASE_CONSTANTS_H +#define USE_MPI_F08_BASE_CONSTANTS_H '; @@ -522,9 +522,9 @@ sub write_fortran_file { $output .= "#define OMPI_$key $io_handles->{$key}\n"; } $output .= "\n"; -$output .= "#endif /* USE_MPI_F08_CONSTANTS_H */\n"; +$output .= "#endif /* USE_MPI_F08_BASE_CONSTANTS_H */\n"; -write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/constants.h", $output); +write_file("$topdir/ompi/mpi/fortran/use-mpi-f08/base/constants.h", $output); $output = '! WARNING! THIS IS A GENERATED FILE!! ! ANY EDITS YOU PUT HERE WILL BE LOST! diff --git a/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am b/ompi/mpi/fortran/use-mpi-f08/base/Makefile.am index 7e1bc3bc299..9d7730ed549 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) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # # $COPYRIGHT$ # @@ -29,6 +31,8 @@ if OMPI_BUILD_FORTRAN_USEMPIF08_BINDINGS noinst_LTLIBRARIES = libusempif08_ccode.la libusempif08_ccode_la_SOURCES = \ - buffer_detach.c + buffer_detach.c \ + constants.c \ + constants.h endif From 299aa6f31e16d8c2c7f1ede17abedf3ce13cd299 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Wed, 15 Apr 2020 17:08:21 -0700 Subject: [PATCH 545/674] Fix intercomm operations The locality for remote procs is not provided as it is only a local concept. Thus, you must always use modex_recv_optional to ensure you don't hang waiting for a response until dmodex times out. Signed-off-by: Ralph Castain --- ompi/communicator/comm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/communicator/comm.c b/ompi/communicator/comm.c index f0ad19e4f8d..b9ba206a772 100644 --- a/ompi/communicator/comm.c +++ b/ompi/communicator/comm.c @@ -20,7 +20,7 @@ * All rights reserved. * Copyright (c) 2014-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2014-2015 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2015 Mellanox Technologies. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -672,7 +672,7 @@ static int ompi_comm_split_type_get_part (ompi_group_t *group, const int split_t u16ptr = &locality; - OPAL_MODEX_RECV_VALUE(ret, OPAL_PMIX_LOCALITY, &proc_name, &u16ptr, OPAL_UINT16); + OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_LOCALITY, &proc_name, &u16ptr, OPAL_UINT16); if (OPAL_SUCCESS != ret) { continue; } @@ -1648,7 +1648,7 @@ ompi_proc_t **ompi_comm_get_rprocs ( ompi_communicator_t *local_comm, * to provide this information at startup */ uint16_t *u16ptr, u16; u16ptr = &u16; - OPAL_MODEX_RECV_VALUE(rc, OPAL_PMIX_LOCALITY, &rprocs[i]->super.proc_name, &u16ptr, OPAL_UINT16); + OPAL_MODEX_RECV_VALUE_OPTIONAL(rc, OPAL_PMIX_LOCALITY, &rprocs[i]->super.proc_name, &u16ptr, OPAL_UINT16); if (OPAL_SUCCESS == rc) { rprocs[i]->super.proc_flags = u16; } else { From 1cd89c9d7b231eaa5cba2dca4d1d2b2b43f812e9 Mon Sep 17 00:00:00 2001 From: Alex Margolin Date: Fri, 17 Apr 2020 16:11:34 +0300 Subject: [PATCH 546/674] rmaps/base: fix logic (crash, in some cases) when num_procs > num_objects Signed-off-by: Alex Margolin --- orte/mca/rmaps/base/rmaps_base_ranking.c | 27 ++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_ranking.c b/orte/mca/rmaps/base/rmaps_base_ranking.c index e4f67d9f4d5..aa75a2a144b 100644 --- a/orte/mca/rmaps/base/rmaps_base_ranking.c +++ b/orte/mca/rmaps/base/rmaps_base_ranking.c @@ -13,6 +13,7 @@ * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -142,7 +143,8 @@ static int rank_span(orte_job_t *jdata, return ORTE_ERROR; } /* ignore procs not on this object */ - if (!hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + if (NULL == locale || + !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { opal_output_verbose(5, orte_rmaps_base_framework.framework_output, "mca:rmaps:rank_span: proc at position %d is not on object %d", j, i); @@ -175,6 +177,11 @@ static int rank_span(orte_job_t *jdata, } } } + + /* Are all the procs ranked? we don't want to crash on INVALID ranks */ + if (cnt < app->num_procs) { + return ORTE_ERR_NOT_SUPPORTED; + } } return ORTE_SUCCESS; @@ -263,7 +270,8 @@ static int rank_fill(orte_job_t *jdata, return ORTE_ERROR; } /* ignore procs not on this object */ - if (!hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + if (NULL == locale || + !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { opal_output_verbose(5, orte_rmaps_base_framework.framework_output, "mca:rmaps:rank_fill: proc at position %d is not on object %d", j, i); @@ -293,6 +301,11 @@ static int rank_fill(orte_job_t *jdata, } } } + + /* Are all the procs ranked? we don't want to crash on INVALID ranks */ + if (cnt < app->num_procs) { + return ORTE_ERR_NOT_SUPPORTED; + } } return ORTE_SUCCESS; @@ -378,7 +391,8 @@ static int rank_by(orte_job_t *jdata, * algorithm, but this works for now. */ i = 0; - while (cnt < app->num_procs && i < (int)node->num_procs) { + while (cnt < app->num_procs && + ((i < (int)node->num_procs) || (i < num_objs))) { /* get the next object */ obj = (hwloc_obj_t)opal_pointer_array_get_item(&objs, i % num_objs); if (NULL == obj) { @@ -423,7 +437,7 @@ static int rank_by(orte_job_t *jdata, !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { opal_output_verbose(5, orte_rmaps_base_framework.framework_output, "mca:rmaps:rank_by: proc at position %d is not on object %d", - j, i); + j, i % num_objs); continue; } /* assign the vpid */ @@ -458,6 +472,11 @@ static int rank_by(orte_job_t *jdata, } /* cleanup */ OBJ_DESTRUCT(&objs); + + /* Are all the procs ranked? we don't want to crash on INVALID ranks */ + if (cnt < app->num_procs) { + return ORTE_ERR_NOT_SUPPORTED; + } } return ORTE_SUCCESS; } From 79c426885a4af7e2329e35acfc81ad6f7fc560ff Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Sat, 18 Apr 2020 06:32:07 -0700 Subject: [PATCH 547/674] Correct the error codes and clarify/correct logic Every mapper is required to set the locale, which is why it is an error if the locale attribute isn't found. Likewise, it is an error for any mapper to set a NULL locale as it makes no sense. However, I can see that maybe some compiler or static code checker might want to see concrete evidence we checked it - so check it in the right place. Backport the equivalent code from PRRTE as we know that works - more confidence than trying to add another patch to this old code. Signed-off-by: Ralph Castain --- orte/mca/rmaps/base/rmaps_base_ranking.c | 189 +++++++++++++---------- 1 file changed, 104 insertions(+), 85 deletions(-) diff --git a/orte/mca/rmaps/base/rmaps_base_ranking.c b/orte/mca/rmaps/base/rmaps_base_ranking.c index aa75a2a144b..3b4d084d978 100644 --- a/orte/mca/rmaps/base/rmaps_base_ranking.c +++ b/orte/mca/rmaps/base/rmaps_base_ranking.c @@ -10,7 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2014-2018 Intel, Inc. All rights reserved. + * Copyright (c) 2014-2020 Intel, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. @@ -138,13 +138,18 @@ static int rank_span(orte_job_t *jdata, } /* protect against bozo case */ locale = NULL; - if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR)) { + if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR) || + NULL == locale) { + /* all mappers are _required_ to set the locale where the proc + * has been mapped - it is therefore an error for this attribute + * not to be set. Likewise, only a programming error could allow + * the attribute to be set to a NULL value - however, we add that + * conditional here to silence any compiler warnings */ ORTE_ERROR_LOG(ORTE_ERROR); return ORTE_ERROR; } /* ignore procs not on this object */ - if (NULL == locale || - !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + if (!hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { opal_output_verbose(5, orte_rmaps_base_framework.framework_output, "mca:rmaps:rank_span: proc at position %d is not on object %d", j, i); @@ -180,7 +185,7 @@ static int rank_span(orte_job_t *jdata, /* Are all the procs ranked? we don't want to crash on INVALID ranks */ if (cnt < app->num_procs) { - return ORTE_ERR_NOT_SUPPORTED; + return ORTE_ERR_FAILED_TO_MAP; } } @@ -265,13 +270,18 @@ static int rank_fill(orte_job_t *jdata, } /* protect against bozo case */ locale = NULL; - if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR)) { + if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR) || + NULL == locale) { + /* all mappers are _required_ to set the locale where the proc + * has been mapped - it is therefore an error for this attribute + * not to be set. Likewise, only a programming error could allow + * the attribute to be set to a NULL value - however, we add that + * conditional here to silence any compiler warnings */ ORTE_ERROR_LOG(ORTE_ERROR); return ORTE_ERROR; } /* ignore procs not on this object */ - if (NULL == locale || - !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + if (!hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { opal_output_verbose(5, orte_rmaps_base_framework.framework_output, "mca:rmaps:rank_fill: proc at position %d is not on object %d", j, i); @@ -304,7 +314,7 @@ static int rank_fill(orte_job_t *jdata, /* Are all the procs ranked? we don't want to crash on INVALID ranks */ if (cnt < app->num_procs) { - return ORTE_ERR_NOT_SUPPORTED; + return ORTE_ERR_FAILED_TO_MAP; } } @@ -321,11 +331,12 @@ static int rank_by(orte_job_t *jdata, orte_vpid_t num_ranked=0; orte_node_t *node; orte_proc_t *proc, *pptr; - orte_vpid_t vpid, np; + orte_vpid_t vpid; int cnt; opal_pointer_array_t objs; hwloc_obj_t locale; orte_app_idx_t napp; + bool noassign; if (ORTE_RANKING_SPAN & ORTE_GET_RANKING_DIRECTIVE(jdata->map->ranking)) { return rank_span(jdata, target, cache_level); @@ -385,89 +396,97 @@ static int rank_by(orte_job_t *jdata, * of procs on the node can't be used to tell us when we * are done. Instead, we have to just keep going until all * procs are ranked - which means we have to make one extra - * pass thru the loop + * pass thru the loop. In addition, if we pass thru the entire + * loop without assigning anything then we are done * * Perhaps someday someone will come up with a more efficient * algorithm, but this works for now. */ - i = 0; - while (cnt < app->num_procs && - ((i < (int)node->num_procs) || (i < num_objs))) { - /* get the next object */ - obj = (hwloc_obj_t)opal_pointer_array_get_item(&objs, i % num_objs); - if (NULL == obj) { - break; - } - /* scan across the procs and find the one that is on this object */ - np = 0; - for (j=0; np < node->num_procs && j < node->procs->size && cnt < app->num_procs; j++) { - if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) { - continue; - } - np++; - /* ignore procs from other jobs */ - if (proc->name.jobid != jdata->jobid) { - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "mca:rmaps:rank_by skipping proc %s - from another job, num_ranked %d", - ORTE_NAME_PRINT(&proc->name), num_ranked); - continue; - } - /* ignore procs that are already ranked */ - if (ORTE_VPID_INVALID != proc->name.vpid) { - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "mca:rmaps:rank_by skipping proc %s - already ranked, num_ranked %d", - ORTE_NAME_PRINT(&proc->name), num_ranked); - continue; - } - /* ignore procs from other apps */ - if (proc->app_idx != app->idx) { - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "mca:rmaps:rank_by skipping proc %s - from another app, num_ranked %d", - ORTE_NAME_PRINT(&proc->name), num_ranked); - continue; - } - /* protect against bozo case */ - locale = NULL; - if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR)) { - ORTE_ERROR_LOG(ORTE_ERROR); - return ORTE_ERROR; + while (cnt < app->num_procs) { + noassign = true; + for (i=0; i < num_objs && cnt < app->num_procs; i++) { + /* get the next object */ + obj = (hwloc_obj_t)opal_pointer_array_get_item(&objs, i); + if (NULL == obj) { + break; } - /* ignore procs not on this object */ - if (NULL == locale || - !hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + /* scan across the procs and find the first unassigned one that includes this object */ + for (j=0; j < node->procs->size && cnt < app->num_procs; j++) { + if (NULL == (proc = (orte_proc_t*)opal_pointer_array_get_item(node->procs, j))) { + continue; + } + /* ignore procs from other jobs */ + if (proc->name.jobid != jdata->jobid) { + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "mca:rmaps:rank_by skipping proc %s - from another job, num_ranked %d", + ORTE_NAME_PRINT(&proc->name), num_ranked); + continue; + } + /* ignore procs that are already ranked */ + if (ORTE_VPID_INVALID != proc->name.vpid) { + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "mca:rmaps:rank_by skipping proc %s - already ranked, num_ranked %d", + ORTE_NAME_PRINT(&proc->name), num_ranked); + continue; + } + /* ignore procs from other apps - we will get to them */ + if (proc->app_idx != app->idx) { + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "mca:rmaps:rank_by skipping proc %s - from another app, num_ranked %d", + ORTE_NAME_PRINT(&proc->name), num_ranked); + continue; + } + /* protect against bozo case */ + locale = NULL; + if (!orte_get_attribute(&proc->attributes, ORTE_PROC_HWLOC_LOCALE, (void**)&locale, OPAL_PTR) || + NULL == locale) { + /* all mappers are _required_ to set the locale where the proc + * has been mapped - it is therefore an error for this attribute + * not to be set. Likewise, only a programming error could allow + * the attribute to be set to a NULL value - however, we add that + * conditional here to silence any compiler warnings */ + ORTE_ERROR_LOG(ORTE_ERROR); + return ORTE_ERROR; + } + /* ignore procs not on this object */ + if (!hwloc_bitmap_intersects(obj->cpuset, locale->cpuset)) { + opal_output_verbose(5, orte_rmaps_base_framework.framework_output, + "mca:rmaps:rank_by: proc at position %d is not on object %d", + j, i); + continue; + } + /* assign the vpid */ + proc->name.vpid = vpid; + if (0 == cnt) { + app->first_rank = proc->name.vpid; + } + cnt++; + noassign = false; opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "mca:rmaps:rank_by: proc at position %d is not on object %d", - j, i % num_objs); - continue; - } - /* assign the vpid */ - proc->name.vpid = vpid++; - if (0 == cnt) { - app->first_rank = proc->name.vpid; - } - cnt++; - opal_output_verbose(5, orte_rmaps_base_framework.framework_output, - "mca:rmaps:rank_by: proc in position %d is on object %d assigned rank %s", - j, i, ORTE_VPID_PRINT(proc->name.vpid)); - /* insert the proc into the jdata array */ - if (NULL != (pptr = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, proc->name.vpid))) { - OBJ_RELEASE(pptr); - } - OBJ_RETAIN(proc); - if (ORTE_SUCCESS != (rc = opal_pointer_array_set_item(jdata->procs, proc->name.vpid, proc))) { - ORTE_ERROR_LOG(rc); - OBJ_DESTRUCT(&objs); - return rc; + "mca:rmaps:rank_by: proc in position %d is on object %d assigned rank %s", + j, i, ORTE_VPID_PRINT(proc->name.vpid)); + /* insert the proc into the jdata array */ + if (NULL != (pptr = (orte_proc_t*)opal_pointer_array_get_item(jdata->procs, proc->name.vpid))) { + OBJ_RELEASE(pptr); + } + OBJ_RETAIN(proc); + if (ORTE_SUCCESS != (rc = opal_pointer_array_set_item(jdata->procs, proc->name.vpid, proc))) { + ORTE_ERROR_LOG(rc); + OBJ_DESTRUCT(&objs); + return rc; + } + num_ranked++; + /* track where the highest vpid landed - this is our + * new bookmark + */ + jdata->bookmark = node; + /* move to next object */ + break; } - num_ranked++; - /* track where the highest vpid landed - this is our - * new bookmark - */ - jdata->bookmark = node; - /* move to next object */ + } + if (noassign) { break; } - i++; } } /* cleanup */ @@ -475,7 +494,7 @@ static int rank_by(orte_job_t *jdata, /* Are all the procs ranked? we don't want to crash on INVALID ranks */ if (cnt < app->num_procs) { - return ORTE_ERR_NOT_SUPPORTED; + return ORTE_ERR_FAILED_TO_MAP; } } return ORTE_SUCCESS; From 2503b5f10faa3810c5f36900cf248df0e7177c84 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 21 Apr 2020 22:49:48 +0200 Subject: [PATCH 548/674] RDMA osc: remove extra retain on pending_op Signed-off-by: Joseph Schuchart (cherry picked from commit de67ada44251b2792f3fef19d890dc7aad39dd73) --- ompi/mca/osc/rdma/osc_rdma_lock.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_lock.h b/ompi/mca/osc/rdma/osc_rdma_lock.h index 7af4d703f6f..9e7ec485f00 100644 --- a/ompi/mca/osc/rdma/osc_rdma_lock.h +++ b/ompi/mca/osc/rdma/osc_rdma_lock.h @@ -45,9 +45,7 @@ static inline int ompi_osc_rdma_btl_fop (ompi_osc_rdma_module_t *module, struct pending_op = OBJ_NEW(ompi_osc_rdma_pending_op_t); assert (NULL != pending_op); - if (wait_for_completion) { - OBJ_RETAIN(pending_op); - } else { + if (!wait_for_completion) { /* NTH: need to keep track of pending ops to avoid a potential teardown problem */ pending_op->module = module; (void) opal_atomic_fetch_add_32 (&module->pending_ops, 1); From a0cdd9f597d4fe27c8fded298338aa593083db7b Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 21 Apr 2020 21:53:10 +0200 Subject: [PATCH 549/674] OSC base: do not retain datatype by default Signed-off-by: Joseph Schuchart (cherry picked from commit 154cf571b6a6996ff6ba9e0860f5d6a6fcf2d425) --- ompi/mca/osc/base/osc_base_obj_convert.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ompi/mca/osc/base/osc_base_obj_convert.h b/ompi/mca/osc/base/osc_base_obj_convert.h index c4709594503..20a993bea1b 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.h +++ b/ompi/mca/osc/base/osc_base_obj_convert.h @@ -54,7 +54,6 @@ ompi_osc_base_datatype_create(ompi_proc_t *remote_proc, void **payload) struct ompi_datatype_t *datatype = ompi_datatype_create_from_packed_description(payload, remote_proc); if (NULL == datatype) return NULL; - OMPI_DATATYPE_RETAIN(datatype); return datatype; } From 2785cbbc04ea95fbb6d5fc8d208c983092732d22 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 21 Apr 2020 21:53:36 +0200 Subject: [PATCH 550/674] OSC base: fix typos in documentation Signed-off-by: Joseph Schuchart (cherry picked from commit 07d1011afeb59d6ccaf401b30f6af7403da83f1f) --- ompi/mca/osc/base/osc_base_obj_convert.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/base/osc_base_obj_convert.h b/ompi/mca/osc/base/osc_base_obj_convert.h index 20a993bea1b..86b2bc63452 100644 --- a/ompi/mca/osc/base/osc_base_obj_convert.h +++ b/ompi/mca/osc/base/osc_base_obj_convert.h @@ -59,9 +59,9 @@ ompi_osc_base_datatype_create(ompi_proc_t *remote_proc, void **payload) /** - * Create datatype based on Fortran Index + * Create operation based on Fortran Index * - * Create a useable MPI datatype based on it's Fortran index, which is + * Create a useable MPI operation based on it's Fortran index, which is * globally the same for predefined operations. The op handle is * owned by the calling process and must be OBJ_RELEASEd when no * longer in use. From 7c435186c8c71bb77d9e90c9f2aab2bd5dbc7a56 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 14 Nov 2018 11:35:54 -0600 Subject: [PATCH 551/674] configury: do fail lustre detection when llapi_file_create() is not found The result of this test was previously and incorrectly ignored. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 72d3e290848b6e70d4c1101c229cd53be6190c33) --- config/ompi_check_lustre.m4 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/config/ompi_check_lustre.m4 b/config/ompi_check_lustre.m4 index 8c385bfe8fa..bd0acec15ec 100644 --- a/config/ompi_check_lustre.m4 +++ b/config/ompi_check_lustre.m4 @@ -12,8 +12,8 @@ dnl Copyright (c) 2004-2006 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved dnl Copyright (c) 2008-2018 University of Houston. All rights reserved. -dnl Copyright (c) 2015 Research Organization for Information Science -dnl and Technology (RIST). All rights reserved. +dnl Copyright (c) 2015-2018 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -63,8 +63,9 @@ AC_DEFUN([OMPI_CHECK_LUSTRE],[ [ompi_check_lustre_happy="yes"], [ompi_check_lustre_happy="no"]) - AC_MSG_CHECKING([for required lustre data structures]) - cat > conftest.c < conftest.c < Date: Wed, 14 Nov 2018 11:41:39 -0600 Subject: [PATCH 552/674] configury: fix include path in Lustre detection use -I$ompi_check_lustre_dir/include in order to correctly support configure --with-lustre Signed-off-by: Gilles Gouaillardet (cherry picked from commit 7783e5ad09084caf684cfd9b2acf7bd79354074f) --- config/ompi_check_lustre.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/ompi_check_lustre.m4 b/config/ompi_check_lustre.m4 index bd0acec15ec..0e78db9f64c 100644 --- a/config/ompi_check_lustre.m4 +++ b/config/ompi_check_lustre.m4 @@ -79,7 +79,7 @@ EOF # Try the compile OPAL_LOG_COMMAND( - [$CC $CFLAGS -I$with_lustre/include -c conftest.c], + [$CC $CFLAGS -I$ompi_check_lustre_dir/include -c conftest.c], [ompi_check_lustre_struct_happy="yes"], [ompi_check_lustre_struct_happy="no" ompi_check_lustre_happy="no"] From c43d8e54d630b69fdd3cad59b0e5b04856220a4b Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 23 Apr 2020 10:29:28 -0600 Subject: [PATCH 553/674] rework check lustre config to avoid rpath lib64 The original configury check for lustre was ending up rpathing in /usr/lib64 in the compiler wrapper scripts. This commit fixes that issue. related to #7580 Signed-off-by: Howard Pritchard (cherry picked from commit ea690d008b92a0091b9e5245bf171d25a5ea0b52) --- config/ompi_check_lustre.m4 | 62 +++++++++++++++++++------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/config/ompi_check_lustre.m4 b/config/ompi_check_lustre.m4 index 0e78db9f64c..9f97b5ff381 100644 --- a/config/ompi_check_lustre.m4 +++ b/config/ompi_check_lustre.m4 @@ -14,6 +14,8 @@ dnl Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved dnl Copyright (c) 2008-2018 University of Houston. All rights reserved. dnl Copyright (c) 2015-2018 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 $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -36,7 +38,6 @@ AC_DEFUN([OMPI_CHECK_LUSTRE],[ check_lustre_save_LDFLAGS="$LDFLAGS" check_lustre_save_CPPFLAGS="$CPPFLAGS" - check_lustre_configuration="none" ompi_check_lustre_happy="yes" # Get some configuration information @@ -46,26 +47,28 @@ AC_DEFUN([OMPI_CHECK_LUSTRE],[ OPAL_CHECK_WITHDIR([lustre], [$with_lustre], [include/lustre/lustreapi.h]) AS_IF([test "$with_lustre" = "no"], - [ompi_check_lustre_happy="no"], - [AS_IF([test -z "$with_lustre" || test "$with_lustre" = "yes"], - [ompi_check_lustre_dir="/usr"], - [ompi_check_lustre_dir=$with_lustre]) - - if test -e "$ompi_check_lustre_dir/lib64" ; then - ompi_check_lustre_libdir="$ompi_check_lustre_dir/lib64" - else - ompi_check_lustre_libdir="$ompi_check_lustre_dir/lib" - fi - - # Add correct -I and -L flags - OPAL_CHECK_PACKAGE([$1], [lustre/lustreapi.h], [lustreapi], [llapi_file_create], + [ompi_check_lustre_happy=no]) + + AS_IF([test "$ompi_check_lustre_happy" != "no" ], + [AC_MSG_CHECKING([looking for lustre libraries and header files in]) + AS_IF([test "$with_lustre" != "yes"], + [ompi_check_lustre_dir=$with_lustre + AC_MSG_RESULT([($ompi_check_lustre_dir)])], + [AC_MSG_RESULT([(default search paths)])]) + AS_IF([test -n "$with_lustre_libdir" && \ + test "$with_lustre_libdir" != "yes"], + [ompi_check_lustre_libdir=$with_lustre_libdir]) + ]) + + AS_IF([test "$ompi_check_lustre_happy" != "no" ], + [OPAL_CHECK_PACKAGE([$1], [lustre/lustreapi.h], [lustreapi], [llapi_file_create], [], [$ompi_check_lustre_dir], [$ompi_check_lustre_libdir], [ompi_check_lustre_happy="yes"], - [ompi_check_lustre_happy="no"]) + [ompi_check_lustre_happy="no"])]) - AS_IF([test "$ompi_check_lustre_happy" = "yes"], - [AC_MSG_CHECKING([for required lustre data structures]) - cat > conftest.c < conftest.c < Date: Wed, 29 Apr 2020 13:36:06 -0600 Subject: [PATCH 554/674] NEWS: news for v4.0.4 Signed-off-by: Howard Pritchard --- NEWS | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/NEWS b/NEWS index d1d6a262e9e..fdb9fcc7055 100644 --- a/NEWS +++ b/NEWS @@ -57,6 +57,30 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. +4.0.4 -- May, 2020 +----------------------- +- Update embedded PMIx to 3.1.5 +- Fix an ABI compatibility issue with the Fortran 2008 bindings. + Thanks to Alastair McKinstry for reporting. +- Fix an issue with rpath of /usr/lib64 when building OMPI on + systems with Lustre. Thanks to David Shrader for reporting. +- Fix a memory leak occurring with certain MPI RMA operations. +- Fix an issue with ORTE's mapping of MPI processes to resources. + Thanks to Alex Margolin for reporting and providing a fix. +- Correct a problem with incorrect error codes being returned + by OMPI MPI_T functions. +- Fix an issue with debugger tools not being able to attach + to mpirun more than once. Thanks to Gregory Lee for reporting. +- Fix an issue with the Fortran compiler wrappers when using + NAG compilers. Thanks to Peter Brady for reporting. +- Fix an issue with the ORTE ssh based process launcher at scale. + Thanks to Benjamín Hernández for reporting. +- Address an issue when using shared MPI I/O operations. OMPIO will + now successfully return from the file open statement but will + raise an error if the file system does not supported shared I/O + operations. Thanks to Romain Hild for reporting. +- Fix an issue with MPI_WIN_DETACH. Thanks to Thomas Naughton for reporting. + 4.0.3 -- March, 2020 ----------------------- - Update embedded PMIx to 3.1.5 From 7c621acf1b2e218af36f8c68f5db4b3d05115a31 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 31 Jan 2020 14:02:21 +0200 Subject: [PATCH 555/674] OPAL/UCX: enabling new API provided by UCX - added detection of new API into configuration - added tag_send call implemented using new API - added MPI_Send/MPI_Isend/MPI_Recv/MPI_Irecv implementations Signed-off-by: Sergey Oblomov (cherry picked from commit 75bda25ddbeea18bb001f367a712dc72592e1e58) --- config/ompi_check_ucx.m4 | 8 ++ ompi/mca/pml/ucx/pml_ucx.c | 115 +++++++++++++++++++++++----- ompi/mca/pml/ucx/pml_ucx_datatype.c | 90 ++++++++++++++++++---- ompi/mca/pml/ucx/pml_ucx_datatype.h | 53 +++++++++++-- ompi/mca/pml/ucx/pml_ucx_request.c | 46 ++++++++++- ompi/mca/pml/ucx/pml_ucx_request.h | 15 +++- 6 files changed, 284 insertions(+), 43 deletions(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 7f04ba3a52c..667cc985a43 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -128,6 +128,14 @@ AC_DEFUN([OMPI_CHECK_UCX],[ [AC_DEFINE([HAVE_UCP_WORKER_ADDRESS_FLAGS], [1], [have worker address attribute])], [], [#include ]) + AC_CHECK_DECLS([ucp_tag_send_nbx, + ucp_tag_send_sync_nbx, + ucp_tag_recv_nbx], + [], [], + [#include ]) + AC_CHECK_TYPES([ucp_request_param_t], + [], [], + [[#include ]]) CPPFLAGS=$old_CPPFLAGS OPAL_SUMMARY_ADD([[Transports]],[[Open UCX]],[$1],[$ompi_check_ucx_happy])])]) diff --git a/ompi/mca/pml/ucx/pml_ucx.c b/ompi/mca/pml/ucx/pml_ucx.c index 056d26538e1..f7144ff50dc 100644 --- a/ompi/mca/pml/ucx/pml_ucx.c +++ b/ompi/mca/pml/ucx/pml_ucx.c @@ -360,10 +360,10 @@ int mca_pml_ucx_cleanup(void) static ucp_ep_h mca_pml_ucx_add_proc_common(ompi_proc_t *proc) { + size_t addrlen = 0; ucp_ep_params_t ep_params; ucp_address_t *address; ucs_status_t status; - size_t addrlen; ucp_ep_h ep; int ret; @@ -431,6 +431,7 @@ int mca_pml_ucx_add_procs(struct ompi_proc_t **procs, size_t nprocs) return OMPI_SUCCESS; } +__opal_attribute_always_inline__ static inline ucp_ep_h mca_pml_ucx_get_ep(ompi_communicator_t *comm, int rank) { ucp_ep_h ep; @@ -556,6 +557,11 @@ int mca_pml_ucx_irecv(void *buf, size_t count, ompi_datatype_t *datatype, int src, int tag, struct ompi_communicator_t* comm, struct ompi_request_t **request) { +#if HAVE_DECL_UCP_TAG_RECV_NBX + pml_ucx_datatype_t *op_data = mca_pml_ucx_get_op_data(datatype); + ucp_request_param_t *param = &op_data->op_param.recv; +#endif + ucp_tag_t ucp_tag, ucp_tag_mask; ompi_request_t *req; @@ -563,10 +569,16 @@ int mca_pml_ucx_irecv(void *buf, size_t count, ompi_datatype_t *datatype, (void*)request); PML_UCX_MAKE_RECV_TAG(ucp_tag, ucp_tag_mask, tag, src, comm); +#if HAVE_DECL_UCP_TAG_RECV_NBX + req = (ompi_request_t*)ucp_tag_recv_nbx(ompi_pml_ucx.ucp_worker, buf, + mca_pml_ucx_get_data_size(op_data, count), + ucp_tag, ucp_tag_mask, param); +#else req = (ompi_request_t*)ucp_tag_recv_nb(ompi_pml_ucx.ucp_worker, buf, count, mca_pml_ucx_get_datatype(datatype), ucp_tag, ucp_tag_mask, mca_pml_ucx_recv_completion); +#endif if (UCS_PTR_IS_ERR(req)) { PML_UCX_ERROR("ucx recv failed: %s", ucs_status_string(UCS_PTR_STATUS(req))); return OMPI_ERROR; @@ -582,20 +594,34 @@ int mca_pml_ucx_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src int tag, struct ompi_communicator_t* comm, ompi_status_public_t* mpi_status) { + /* coverity[bad_alloc_arithmetic] */ + void *req = PML_UCX_REQ_ALLOCA(); +#if HAVE_DECL_UCP_TAG_RECV_NBX + pml_ucx_datatype_t *op_data = mca_pml_ucx_get_op_data(datatype); + ucp_request_param_t *recv_param = &op_data->op_param.recv; + ucp_request_param_t param; + + param.op_attr_mask = UCP_OP_ATTR_FIELD_REQUEST | + (recv_param->op_attr_mask & UCP_OP_ATTR_FIELD_DATATYPE); + param.datatype = recv_param->datatype; + param.request = req; +#endif ucp_tag_t ucp_tag, ucp_tag_mask; ucp_tag_recv_info_t info; ucs_status_t status; - void *req; PML_UCX_TRACE_RECV("%s", buf, count, datatype, src, tag, comm, "recv"); - /* coverity[bad_alloc_arithmetic] */ PML_UCX_MAKE_RECV_TAG(ucp_tag, ucp_tag_mask, tag, src, comm); - req = PML_UCX_REQ_ALLOCA(); - status = ucp_tag_recv_nbr(ompi_pml_ucx.ucp_worker, buf, count, - mca_pml_ucx_get_datatype(datatype), - ucp_tag, ucp_tag_mask, req); - +#if HAVE_DECL_UCP_TAG_RECV_NBX + ucp_tag_recv_nbx(ompi_pml_ucx.ucp_worker, buf, + mca_pml_ucx_get_data_size(op_data, count), + ucp_tag, ucp_tag_mask, ¶m); +#else + ucp_tag_recv_nbr(ompi_pml_ucx.ucp_worker, buf, count, + mca_pml_ucx_get_datatype(datatype), + ucp_tag, ucp_tag_mask, req); +#endif MCA_COMMON_UCX_PROGRESS_LOOP(ompi_pml_ucx.ucp_worker) { status = ucp_request_test(req, &info); if (status != UCS_INPROGRESS) { @@ -605,6 +631,7 @@ int mca_pml_ucx_recv(void *buf, size_t count, ompi_datatype_t *datatype, int src } } +__opal_attribute_always_inline__ static inline const char *mca_pml_ucx_send_mode_name(mca_pml_base_send_mode_t mode) { switch (mode) { @@ -726,6 +753,7 @@ mca_pml_ucx_bsend(ucp_ep_h ep, const void *buf, size_t count, return NULL; } +__opal_attribute_always_inline__ static inline ucs_status_ptr_t mca_pml_ucx_common_send(ucp_ep_h ep, const void *buf, size_t count, ompi_datatype_t *datatype, @@ -743,6 +771,32 @@ static inline ucs_status_ptr_t mca_pml_ucx_common_send(ucp_ep_h ep, const void * } } +#if HAVE_DECL_UCP_TAG_SEND_NBX +__opal_attribute_always_inline__ +static inline ucs_status_ptr_t +mca_pml_ucx_common_send_nbx(ucp_ep_h ep, const void *buf, + size_t count, + ompi_datatype_t *datatype, + ucp_tag_t tag, + mca_pml_base_send_mode_t mode, + ucp_request_param_t *param) +{ + pml_ucx_datatype_t *op_data = mca_pml_ucx_get_op_data(datatype); + + if (OPAL_UNLIKELY(MCA_PML_BASE_SEND_BUFFERED == mode)) { + return mca_pml_ucx_bsend(ep, buf, count, datatype, tag); + } else if (OPAL_UNLIKELY(MCA_PML_BASE_SEND_SYNCHRONOUS == mode)) { + return ucp_tag_send_sync_nb(ep, buf, count, + mca_pml_ucx_get_datatype(datatype), tag, + (ucp_send_callback_t)param->cb.send); + } else { + return ucp_tag_send_nbx(ep, buf, + mca_pml_ucx_get_data_size(op_data, count), + tag, param); + } +} +#endif + int mca_pml_ucx_isend(const void *buf, size_t count, ompi_datatype_t *datatype, int dst, int tag, mca_pml_base_send_mode_t mode, struct ompi_communicator_t* comm, @@ -761,10 +815,16 @@ int mca_pml_ucx_isend(const void *buf, size_t count, ompi_datatype_t *datatype, return OMPI_ERROR; } +#if HAVE_DECL_UCP_TAG_SEND_NBX + req = (ompi_request_t*)mca_pml_ucx_common_send_nbx(ep, buf, count, datatype, + PML_UCX_MAKE_SEND_TAG(tag, comm), mode, + &mca_pml_ucx_get_op_data(datatype)->op_param.send); +#else req = (ompi_request_t*)mca_pml_ucx_common_send(ep, buf, count, datatype, mca_pml_ucx_get_datatype(datatype), PML_UCX_MAKE_SEND_TAG(tag, comm), mode, mca_pml_ucx_send_completion); +#endif if (req == NULL) { PML_UCX_VERBOSE(8, "returning completed request"); @@ -806,20 +866,40 @@ mca_pml_ucx_send_nb(ucp_ep_h ep, const void *buf, size_t count, #if HAVE_DECL_UCP_TAG_SEND_NBR static inline __opal_attribute_always_inline__ int mca_pml_ucx_send_nbr(ucp_ep_h ep, const void *buf, size_t count, - ucp_datatype_t ucx_datatype, ucp_tag_t tag) - + ompi_datatype_t *datatype, ucp_tag_t tag) { - ucs_status_ptr_t req; - ucs_status_t status; - /* coverity[bad_alloc_arithmetic] */ - req = PML_UCX_REQ_ALLOCA(); - status = ucp_tag_send_nbr(ep, buf, count, ucx_datatype, tag, req); + ucs_status_ptr_t req = PML_UCX_REQ_ALLOCA(); +#if HAVE_DECL_UCP_TAG_SEND_NBX + pml_ucx_datatype_t *op_data = mca_pml_ucx_get_op_data(datatype); + ucp_request_param_t param = { + .op_attr_mask = UCP_OP_ATTR_FIELD_REQUEST | + (op_data->op_param.send.op_attr_mask & UCP_OP_ATTR_FIELD_DATATYPE) | + UCP_OP_ATTR_FLAG_FAST_CMPL, + .datatype = op_data->op_param.send.datatype, + .request = req + }; + + req = ucp_tag_send_nbx(ep, buf, + mca_pml_ucx_get_data_size(op_data, count), + tag, ¶m); + if (OPAL_LIKELY(req == UCS_OK)) { + return OMPI_SUCCESS; + } else if (UCS_PTR_IS_ERR(req)) { + PML_UCX_ERROR("%s failed: %d, %s", __func__, UCS_PTR_STATUS(req), + ucs_status_string(UCS_PTR_STATUS(req))); + return OPAL_ERROR; + } +#else + ucs_status_t status; + status = ucp_tag_send_nbr(ep, buf, count, + mca_pml_ucx_get_datatype(datatype), tag, req); if (OPAL_LIKELY(status == UCS_OK)) { return OMPI_SUCCESS; } +#endif - MCA_COMMON_UCX_WAIT_LOOP(req, ompi_pml_ucx.ucp_worker, "ucx send", (void)0); + MCA_COMMON_UCX_WAIT_LOOP(req, ompi_pml_ucx.ucp_worker, "ucx send nbr", (void)0); } #endif @@ -840,8 +920,7 @@ int mca_pml_ucx_send(const void *buf, size_t count, ompi_datatype_t *datatype, i #if HAVE_DECL_UCP_TAG_SEND_NBR if (OPAL_LIKELY((MCA_PML_BASE_SEND_BUFFERED != mode) && (MCA_PML_BASE_SEND_SYNCHRONOUS != mode))) { - return mca_pml_ucx_send_nbr(ep, buf, count, - mca_pml_ucx_get_datatype(datatype), + return mca_pml_ucx_send_nbr(ep, buf, count, datatype, PML_UCX_MAKE_SEND_TAG(tag, comm)); } #endif diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.c b/ompi/mca/pml/ucx/pml_ucx_datatype.c index 95f9da44cc8..43ca2ce9ebc 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.c +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.c @@ -8,12 +8,20 @@ */ #include "pml_ucx_datatype.h" +#include "pml_ucx_request.h" #include "ompi/runtime/mpiruntime.h" #include "ompi/attribute/attribute.h" #include +#include +#ifdef HAVE_UCP_REQUEST_PARAM_T +#define PML_UCX_DATATYPE_SET_VALUE(_datatype, _val) \ + (_datatype)->op_param.send._val; \ + (_datatype)->op_param.bsend._val; \ + (_datatype)->op_param.recv._val; +#endif static void* pml_ucx_generic_datatype_start_pack(void *context, const void *buffer, size_t count) @@ -133,31 +141,78 @@ int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, { ucp_datatype_t ucp_datatype = (ucp_datatype_t)attr_val; +#ifdef HAVE_UCP_REQUEST_PARAM_T + free((void*)datatype->pml_data); +#else PML_UCX_ASSERT((uint64_t)ucp_datatype == datatype->pml_data); - +#endif ucp_dt_destroy(ucp_datatype); datatype->pml_data = PML_UCX_DATATYPE_INVALID; return OMPI_SUCCESS; } +__opal_attribute_always_inline__ +static inline int mca_pml_ucx_datatype_is_contig(ompi_datatype_t *datatype) +{ + ptrdiff_t lb; + + ompi_datatype_type_lb(datatype, &lb); + + return (datatype->super.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && + (datatype->super.flags & OPAL_DATATYPE_FLAG_NO_GAPS) && + (lb == 0); +} + +#ifdef HAVE_UCP_REQUEST_PARAM_T +__opal_attribute_always_inline__ static inline +pml_ucx_datatype_t *mca_pml_ucx_init_nbx_datatype(ompi_datatype_t *datatype, + ucp_datatype_t ucp_datatype, + size_t size) +{ + pml_ucx_datatype_t *pml_datatype; + int is_contig_pow2; + + pml_datatype = malloc(sizeof(*pml_datatype)); + if (pml_datatype == NULL) { + PML_UCX_ERROR("Failed to allocate datatype structure"); + ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); + } + + pml_datatype->datatype = ucp_datatype; + pml_datatype->op_param.send.op_attr_mask = UCP_OP_ATTR_FIELD_CALLBACK; + pml_datatype->op_param.send.cb.send = mca_pml_ucx_send_nbx_completion; + pml_datatype->op_param.bsend.op_attr_mask = UCP_OP_ATTR_FIELD_CALLBACK; + pml_datatype->op_param.bsend.cb.send = mca_pml_ucx_bsend_nbx_completion; + pml_datatype->op_param.recv.op_attr_mask = UCP_OP_ATTR_FIELD_CALLBACK | + UCP_OP_ATTR_FLAG_NO_IMM_CMPL; + pml_datatype->op_param.recv.cb.recv = mca_pml_ucx_recv_nbx_completion; + + is_contig_pow2 = mca_pml_ucx_datatype_is_contig(datatype) && + !(size & (size - 1)); /* is_pow2(size) */ + if (is_contig_pow2) { + pml_datatype->size_shift = (int)(log(size) / log(2.0)); /* log2(size) */ + } else { + pml_datatype->size_shift = 0; + PML_UCX_DATATYPE_SET_VALUE(pml_datatype, op_attr_mask |= UCP_OP_ATTR_FIELD_DATATYPE); + PML_UCX_DATATYPE_SET_VALUE(pml_datatype, datatype = ucp_datatype); + } + + return pml_datatype; +} +#endif + ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype) { + size_t size = 0; /* init to suppress compiler warning */ ucp_datatype_t ucp_datatype; ucs_status_t status; - ptrdiff_t lb; - size_t size; int ret; - ompi_datatype_type_lb(datatype, &lb); - - if ((datatype->super.flags & OPAL_DATATYPE_FLAG_CONTIGUOUS) && - (datatype->super.flags & OPAL_DATATYPE_FLAG_NO_GAPS) && - (lb == 0)) - { + if (mca_pml_ucx_datatype_is_contig(datatype)) { ompi_datatype_type_size(datatype, &size); PML_UCX_ASSERT(size > 0); - datatype->pml_data = ucp_dt_make_contig(size); - return datatype->pml_data; + ucp_datatype = ucp_dt_make_contig(size); + goto out; } status = ucp_dt_create_generic(&pml_ucx_generic_datatype_ops, @@ -167,8 +222,6 @@ ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype) ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); } - datatype->pml_data = ucp_datatype; - /* Add custom attribute, to clean up UCX resources when OMPI datatype is * released. */ @@ -185,9 +238,18 @@ ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype) ompi_mpi_abort(&ompi_mpi_comm_world.comm, 1); } } - +out: PML_UCX_VERBOSE(7, "created generic UCX datatype 0x%"PRIx64, ucp_datatype) +#ifdef HAVE_UCP_REQUEST_PARAM_T + UCS_STATIC_ASSERT(sizeof(datatype->pml_data) >= sizeof(pml_ucx_datatype_t*)); + datatype->pml_data = (uint64_t)mca_pml_ucx_init_nbx_datatype(datatype, + ucp_datatype, + size); +#else + datatype->pml_data = ucp_datatype; +#endif + return ucp_datatype; } diff --git a/ompi/mca/pml/ucx/pml_ucx_datatype.h b/ompi/mca/pml/ucx/pml_ucx_datatype.h index f5207cecc75..921aab0d399 100644 --- a/ompi/mca/pml/ucx/pml_ucx_datatype.h +++ b/ompi/mca/pml/ucx/pml_ucx_datatype.h @@ -15,14 +15,25 @@ #define PML_UCX_DATATYPE_INVALID 0 +#ifdef HAVE_UCP_REQUEST_PARAM_T +typedef struct { + ucp_datatype_t datatype; + int size_shift; + struct { + ucp_request_param_t send; + ucp_request_param_t bsend; + ucp_request_param_t recv; + } op_param; +} pml_ucx_datatype_t; +#endif + struct pml_ucx_convertor { - opal_free_list_item_t super; - ompi_datatype_t *datatype; - opal_convertor_t opal_conv; - size_t offset; + opal_free_list_item_t super; + ompi_datatype_t *datatype; + opal_convertor_t opal_conv; + size_t offset; }; - ucp_datatype_t mca_pml_ucx_init_datatype(ompi_datatype_t *datatype); int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, @@ -31,15 +42,47 @@ int mca_pml_ucx_datatype_attr_del_fn(ompi_datatype_t* datatype, int keyval, OBJ_CLASS_DECLARATION(mca_pml_ucx_convertor_t); +__opal_attribute_always_inline__ static inline ucp_datatype_t mca_pml_ucx_get_datatype(ompi_datatype_t *datatype) { +#ifdef HAVE_UCP_REQUEST_PARAM_T + pml_ucx_datatype_t *ucp_type = (pml_ucx_datatype_t*)datatype->pml_data; + + if (OPAL_LIKELY(ucp_type != PML_UCX_DATATYPE_INVALID)) { + return ucp_type->datatype; + } +#else ucp_datatype_t ucp_type = datatype->pml_data; if (OPAL_LIKELY(ucp_type != PML_UCX_DATATYPE_INVALID)) { return ucp_type; } +#endif return mca_pml_ucx_init_datatype(datatype); } +#ifdef HAVE_UCP_REQUEST_PARAM_T +__opal_attribute_always_inline__ +static inline pml_ucx_datatype_t* +mca_pml_ucx_get_op_data(ompi_datatype_t *datatype) +{ + pml_ucx_datatype_t *ucp_type = (pml_ucx_datatype_t*)datatype->pml_data; + + if (OPAL_LIKELY(ucp_type != PML_UCX_DATATYPE_INVALID)) { + return ucp_type; + } + + mca_pml_ucx_init_datatype(datatype); + return (pml_ucx_datatype_t*)datatype->pml_data; +} + +__opal_attribute_always_inline__ +static inline size_t mca_pml_ucx_get_data_size(pml_ucx_datatype_t *op_data, + size_t count) +{ + return count << op_data->size_shift; +} +#endif + #endif /* PML_UCX_DATATYPE_H_ */ diff --git a/ompi/mca/pml/ucx/pml_ucx_request.c b/ompi/mca/pml/ucx/pml_ucx_request.c index 536ac95e79b..b072afc66ef 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.c +++ b/ompi/mca/pml/ucx/pml_ucx_request.c @@ -34,7 +34,8 @@ static int mca_pml_ucx_request_cancel(ompi_request_t *req, int flag) return OMPI_SUCCESS; } -void mca_pml_ucx_send_completion(void *request, ucs_status_t status) +__opal_attribute_always_inline__ static inline void +mca_pml_ucx_send_completion_internal(void *request, ucs_status_t status) { ompi_request_t *req = request; @@ -46,7 +47,8 @@ void mca_pml_ucx_send_completion(void *request, ucs_status_t status) ompi_request_complete(req, true); } -void mca_pml_ucx_bsend_completion(void *request, ucs_status_t status) +__opal_attribute_always_inline__ static inline void +mca_pml_ucx_bsend_completion_internal(void *request, ucs_status_t status) { ompi_request_t *req = request; @@ -59,8 +61,9 @@ void mca_pml_ucx_bsend_completion(void *request, ucs_status_t status) mca_pml_ucx_request_free(&req); } -void mca_pml_ucx_recv_completion(void *request, ucs_status_t status, - ucp_tag_recv_info_t *info) +__opal_attribute_always_inline__ static inline void +mca_pml_ucx_recv_completion_internal(void *request, ucs_status_t status, + const ucp_tag_recv_info_t *info) { ompi_request_t *req = request; @@ -73,6 +76,41 @@ void mca_pml_ucx_recv_completion(void *request, ucs_status_t status, ompi_request_complete(req, true); } +void mca_pml_ucx_send_completion(void *request, ucs_status_t status) +{ + mca_pml_ucx_send_completion_internal(request, status); +} + +void mca_pml_ucx_bsend_completion(void *request, ucs_status_t status) +{ + mca_pml_ucx_bsend_completion_internal(request, status); +} + +void mca_pml_ucx_recv_completion(void *request, ucs_status_t status, + ucp_tag_recv_info_t *info) +{ + mca_pml_ucx_recv_completion_internal(request, status, info); +} + +void mca_pml_ucx_send_nbx_completion(void *request, ucs_status_t status, + void *user_data) +{ + mca_pml_ucx_send_completion_internal(request, status); +} + +void mca_pml_ucx_bsend_nbx_completion(void *request, ucs_status_t status, + void *user_data) +{ + mca_pml_ucx_bsend_completion_internal(request, status); +} + +void mca_pml_ucx_recv_nbx_completion(void *request, ucs_status_t status, + const ucp_tag_recv_info_t *info, + void *user_data) +{ + mca_pml_ucx_recv_completion_internal(request, status, info); +} + static void mca_pml_ucx_persistent_request_detach(mca_pml_ucx_persistent_request_t *preq, ompi_request_t *tmp_req) { diff --git a/ompi/mca/pml/ucx/pml_ucx_request.h b/ompi/mca/pml/ucx/pml_ucx_request.h index cb53d30bcee..c9c017dc307 100644 --- a/ompi/mca/pml/ucx/pml_ucx_request.h +++ b/ompi/mca/pml/ucx/pml_ucx_request.h @@ -126,6 +126,16 @@ void mca_pml_ucx_bsend_completion(void *request, ucs_status_t status); void mca_pml_ucx_precv_completion(void *request, ucs_status_t status, ucp_tag_recv_info_t *info); +void mca_pml_ucx_send_nbx_completion(void *request, ucs_status_t status, + void *user_data); + +void mca_pml_ucx_bsend_nbx_completion(void *request, ucs_status_t status, + void *user_data); + +void mca_pml_ucx_recv_nbx_completion(void *request, ucs_status_t status, + const ucp_tag_recv_info_t *info, + void *user_data); + void mca_pml_ucx_persistent_request_complete(mca_pml_ucx_persistent_request_t *preq, ompi_request_t *tmp_req); @@ -141,8 +151,9 @@ static inline void mca_pml_ucx_request_reset(ompi_request_t *req) req->req_complete = REQUEST_PENDING; } -static void mca_pml_ucx_set_send_status(ompi_status_public_t* mpi_status, - ucs_status_t status) +__opal_attribute_always_inline__ +static inline void mca_pml_ucx_set_send_status(ompi_status_public_t* mpi_status, + ucs_status_t status) { if (OPAL_LIKELY(status == UCS_OK)) { mpi_status->MPI_ERROR = MPI_SUCCESS; From 466140da236c18f2393f870112bdbcbf50337727 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Mon, 4 May 2020 13:04:56 -0600 Subject: [PATCH 556/674] NEWS fix oops we already updated to PMIX 3.1.5 in the OMPI 4.0.3 release Signed-off-by: Howard Pritchard --- NEWS | 1 - 1 file changed, 1 deletion(-) diff --git a/NEWS b/NEWS index fdb9fcc7055..01fe1f08edd 100644 --- a/NEWS +++ b/NEWS @@ -59,7 +59,6 @@ included in the vX.Y.Z section and be denoted as: 4.0.4 -- May, 2020 ----------------------- -- Update embedded PMIx to 3.1.5 - Fix an ABI compatibility issue with the Fortran 2008 bindings. Thanks to Alastair McKinstry for reporting. - Fix an issue with rpath of /usr/lib64 when building OMPI on From 22d8fa197b73eff7afc6d5fd11a99ced396c388a Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Tue, 5 May 2020 12:08:52 -0400 Subject: [PATCH 557/674] event/external: Fix typo in LDFLAGS vs LIBS var before check * This should have been `LDFLAGS` not `LIBS`. Either works, but `LDFLAGS` is more correct. We should also include `CPPFLAGS` just in case the header is important to the check. Signed-off-by: Joshua Hursey --- opal/mca/event/external/configure.m4 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 15313db50a3..0bdd87c8b20 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -6,6 +6,7 @@ # and Technology (RIST). All rights reserved. # # Copyright (c) 2017-2018 Intel, Inc. All rights reserved. +# Copyright (c) 2020 IBM Corporation. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -115,11 +116,15 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ [opal_event_external_support=yes], [opal_event_external_support=no]) + AS_IF([test "$opal_event_external_support" = "yes"], + [LDFLAGS="$opal_event_external_LDFLAGS $LDFLAGS" + CPPFLAGS="$opal_event_external_CPPFLAGS $CPPFLAGS"], + []) + AS_IF([test "$opal_event_external_support" = "yes"], [# Ensure that this libevent has the symbol # "evthread_set_lock_callbacks", which will only exist if # libevent was configured with thread support. - LIBS="$opal_event_external_LDFLAGS $LIBS" AC_CHECK_LIB([event], [evthread_set_lock_callbacks], [], [AC_MSG_WARN([External libevent does not have thread support]) From 734866f8afff387101cd9596c2f29cee01cfd694 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 4 May 2020 16:58:15 -0500 Subject: [PATCH 558/674] Bumping VERSION for v4.0.4 This commit bumps the so versions for libraries for v4.0.4. This includes https://github.com/open-mpi/ompi/pull/7622 which fixes an ABI break introduced in the use_f08 library in v4.0.3. Signed-off-by: Geoffrey Paulsen --- VERSION | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 165c0de5cf8..a0dc7358b88 100644 --- a/VERSION +++ b/VERSION @@ -21,7 +21,7 @@ major=4 minor=0 -release=3 +release=4 # greek is generally used for alpha or beta release tags. If it is # non-empty, it will be appended to the version number. It does not @@ -30,7 +30,7 @@ release=3 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc4 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -62,7 +62,7 @@ date="Unreleased developer copy" # release managers (not individual developers). Notes: # 1. Since these version numbers are associated with *releases*, the -# version numbers maintained on the Open MPI SVN trunk (and developer +# version numbers maintained on the Open MPI GIT master (and developer # branches) is always 0:0:0 for all libraries. # 2. The version number of libmpi refers to the public MPI interfaces. @@ -88,14 +88,14 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=60:3:20 +libmpi_so_version=60:4:20 libmpi_cxx_so_version=60:1:20 libmpi_mpifh_so_version=60:2:20 libmpi_usempi_tkr_so_version=60:0:20 libmpi_usempi_ignore_tkr_so_version=60:0:20 -libmpi_usempif08_so_version=61:0:21 -libopen_rte_so_version=60:3:20 -libopen_pal_so_version=60:3:20 +libmpi_usempif08_so_version=61:1:21 +libopen_rte_so_version=60:4:20 +libopen_pal_so_version=60:4:20 libmpi_java_so_version=60:0:20 liboshmem_so_version=62:1:22 libompitrace_so_version=60:0:20 From 02e4825719e1221028cbd44445e7fbcd07c1491e Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Wed, 6 May 2020 14:33:49 -0500 Subject: [PATCH 559/674] Updating README to include WARNING about ABI break This commit adds a blurb to the README for v4.0.4, suggesting that users of libmpi_usempif08.so skip over v4.0.3. Much thanks to Jeff Squyres for help with wording. Signed-off-by: Geoffrey Paulsen --- README | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README b/README index 150fbda2ae2..074988221d1 100644 --- a/README +++ b/README @@ -8,11 +8,11 @@ Copyright (c) 2004-2008 High Performance Computing Center Stuttgart, University of Stuttgart. All rights reserved. Copyright (c) 2004-2007 The Regents of the University of California. All rights reserved. -Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved. +Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved. Copyright (c) 2006-2011 Mellanox Technologies. All rights reserved. Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved. Copyright (c) 2007 Myricom, Inc. All rights reserved. -Copyright (c) 2008-2019 IBM Corporation. All rights reserved. +Copyright (c) 2008-2020 IBM Corporation. All rights reserved. Copyright (c) 2010 Oak Ridge National Labs. All rights reserved. Copyright (c) 2011 University of Houston. All rights reserved. Copyright (c) 2013-2017 Intel, Inc. All rights reserved. @@ -66,11 +66,29 @@ Much, much more information is also available in the Open MPI FAQ: =========================================================================== The following abbreviated list of release notes applies to this code -base as of this writing (February 2019): +base as of this writing (May 2020): General notes ------------- +- WARNING - Open MPI v4.0.0-4.0.3 accidentally did not include some + constants from the mpi_f08 module interface (mostly dealing with C and + C++ datatypes). + + Additionally, v4.0.3 specifically dropped some constants from the + mpi_f08 module interface that were previously included in v4.0.0-v4.0.2. + + All mpi_f08 symbols have been restored in v4.0.4. + + There are two consequences to this sequence of events: + 1. There was an ABI break introduced in v4.0.3 (i.e., some + mpi_f08 symbols were dropped). + 2. New mpi_f08 symbols were introduced in v4.0.4 (i.e., all missing + symbols were restored). Applications who use these symbols and + who compile against v4.0.4 will not be able to successfully + run-time link against the libmpi_usempif08.so shared library + from prior versions of the v4.0.x series. + - Open MPI now includes two public software layers: MPI and OpenSHMEM. Throughout this document, references to Open MPI implicitly include both of these layers. When distinction between these two layers is From fc4199e3ba567a672ce1da0dc46efbfd996d71f6 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Tue, 5 May 2020 11:51:51 -0400 Subject: [PATCH 560/674] Add checks for libevent.so conflict with LSF * LSF ships a `libevent.so` that is no related to the `libevent.so` shipped with Libevent. * Add some checks to the configure logic to detect scenarios where this conflict can be detected, and provide the user with a descriptive warning message. - When detected by `event/external` this is just a warning since the internal component may be able to be used instead. - This happens when the user supplies the LSF path via the `LDFLAGS` envar instead of via `--with-lsf-libdir`. - When detected by a LSF component and LSF was explicitly requested then this becomes an error. Otherwise it will just print the warning and that component will fail to build. Signed-off-by: Joshua Hursey --- config/orte_check_lsf.m4 | 69 +++++++++++++++++++++++++++- opal/mca/event/external/configure.m4 | 29 +++++++++++- 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/config/orte_check_lsf.m4 b/config/orte_check_lsf.m4 index 0de332ca566..eefc819852d 100644 --- a/config/orte_check_lsf.m4 +++ b/config/orte_check_lsf.m4 @@ -15,7 +15,7 @@ dnl Copyright (c) 2015 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights dnl reserved. -dnl Copyright (c) 2017 IBM Corporation. All rights reserved. +dnl Copyright (c) 2017-2020 IBM Corporation. All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -120,6 +120,73 @@ AC_DEFUN([ORTE_CHECK_LSF],[ [orte_check_lsf_happy="yes"], [orte_check_lsf_happy="no"])]) + + # Some versions of LSF ship with a libevent.so in their library path. + # This is _not_ a copy of Libevent, but something specific to their project. + # The Open MPI components should not need to link against LSF's libevent.so + # However, the presence of it in the linker search path can cause a problem + # if there is a system installed Libevent and Open MPI chooses the 'external' + # event component prior to this stage. + # + # Add a check here to see if we are in a scenario where the two are conflicting. + # In which case the earlier checks for successful compile of an LSF program will + # have failed with messages like: + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_condition_callbacks' + # lib64/libevent_pthreads.so: undefined reference to `event_mm_malloc_' + # lib64/libevent_pthreads.so: undefined reference to `event_mm_free_' + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_id_callback' + # lib64/libevent_pthreads.so: undefined reference to `evthread_set_lock_callbacks' + # Because it picked up -levent from LSF, but -levent_pthreads from Libevent. + # + # So look for a function that libevent_pthreads is looking for from libevent.so. + # If it does appears then we have the correct libevent.so, otherwise then we picked + # up the LSF version and a conflict has been detected. + # If the external libevent component used 'event_core' instead of 'event' + orte_check_lsf_event_conflict=na + # Split libs into an array, see if -levent is in that list + orte_check_lsf_libevent_present=`echo $LIBS | awk '{split([$]0, a, " "); {for (k in a) {if (a[[k]] == "-levent") {print a[[k]]}}}}' | wc -l` + AS_IF([test "$orte_check_lsf_happy" = "no"], + [AS_IF([test "$opal_event_external_support" = "yes" && test "$orte_check_lsf_libevent_present" != 0], + [AS_IF([test "$orte_check_lsf_libdir" = "" ], + [], + [LDFLAGS="$LDFLAGS -L$orte_check_lsf_libdir"]) + # Note that we do not want to set LIBS here to include -llsf since + # the check is not for an LSF library, but for the conflict with + # LDFLAGS. + AC_CHECK_LIB([event], [evthread_set_condition_callbacks], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No. The correct libevent.so was linked.]) + orte_check_lsf_event_conflict=no], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([Yes. A wrong libevent.so was linked.]) + orte_check_lsf_event_conflict=yes]) + ], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No. Internal Libevent or libevent_core is being used.]) + orte_check_lsf_event_conflict=na])], + [AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([No. LSF checks passed.]) + orte_check_lsf_event_conflict=na]) + + AS_IF([test "$orte_check_lsf_event_conflict" = "yes"], + [AC_MSG_WARN([===================================================================]) + AC_MSG_WARN([Conflicting libevent.so libraries detected on the system.]) + AC_MSG_WARN([]) + AC_MSG_WARN([A system-installed Libevent library was detected and the Open MPI]) + AC_MSG_WARN([build system chose to use the 'external' component expecting to]) + AC_MSG_WARN([link against the Libevent in the linker search path.]) + AC_MSG_WARN([LSF provides a libevent.so that is not from Libevent in its]) + AC_MSG_WARN([library path. At this point the linker is attempting to resolve]) + AC_MSG_WARN([Libevent symbols using the LSF library because of the lack of]) + AC_MSG_WARN([an explicit linker path pointing to the system-installed Libevent.]) + AC_MSG_WARN([]) + AC_MSG_WARN([To resolve this issue either (A) explicitly pass the Libevent]) + AC_MSG_WARN([library path on the configure line (--with-libevent-libdir), or]) + AC_MSG_WARN([(B) use the internal libevent by requesting it from configure ]) + AC_MSG_WARN([with the --with-libevent=internal option.]) + AC_MSG_WARN([===================================================================]) + ]) + CPPFLAGS="$orte_check_lsf_$1_save_CPPFLAGS" LDFLAGS="$orte_check_lsf_$1_save_LDFLAGS" LIBS="$orte_check_lsf_$1_save_LIBS" diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 0bdd87c8b20..6e38b7d1e9e 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -116,10 +116,35 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ [opal_event_external_support=yes], [opal_event_external_support=no]) + # Check to see if the above check failed because it conflicted with LSF's libevent.so + # This can happen if LSF's library is in the LDFLAGS envar or default search + # path. The 'event_fini' function is only defined in LSF's libevent.so and not + # in Libevent's libevent.so + AS_IF([test "$opal_event_external_support" = "no"], + [AC_CHECK_LIB([event], [event_fini], + [AC_MSG_WARN([===================================================================]) + AC_MSG_WARN([Possible conflicting libevent.so libraries detected on the system.]) + AC_MSG_WARN([]) + AC_MSG_WARN([LSF provides a libevent.so that is not from Libevent in its]) + AC_MSG_WARN([library path. It is possible that you have installed Libevent]) + AC_MSG_WARN([on the system, but the linker is picking up the wrong version.]) + AC_MSG_WARN([]) + AC_MSG_WARN([Configure may continue and attempt to use the 'internal' libevent]) + AC_MSG_WARN([instead of the 'external' libevent if you did not explicitly request]) + AC_MSG_WARN([the 'external' component.]) + AC_MSG_WARN([]) + AC_MSG_WARN([If your intention was to use the 'external' libevent then you need]) + AC_MSG_WARN([to address this linker path ordering issue. One way to do so is]) + AC_MSG_WARN([to make sure the libevent system library path occurs before the]) + AC_MSG_WARN([LSF library path.]) + AC_MSG_WARN([===================================================================]) + opal_event_external_support=no + ]) + ]) + AS_IF([test "$opal_event_external_support" = "yes"], [LDFLAGS="$opal_event_external_LDFLAGS $LDFLAGS" - CPPFLAGS="$opal_event_external_CPPFLAGS $CPPFLAGS"], - []) + CPPFLAGS="$opal_event_external_CPPFLAGS $CPPFLAGS"]) AS_IF([test "$opal_event_external_support" = "yes"], [# Ensure that this libevent has the symbol From 886f41fe3381a338eac215f26360980c612e6bb8 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Wed, 6 May 2020 11:35:22 -0400 Subject: [PATCH 561/674] Move from legacy -levent to recommended -levent_core * `libevent_core.so` contains the core functionality that we depend upon - `libevent.so` library has been identified as the legacy target. - `libevent_core.so` exists as far back as Libevent 2.0.5 (oldest supported by OMPI) * `libevent_pthreads.so` can work with either `-levent` or `-levent_core` Signed-off-by: Joshua Hursey --- opal/mca/event/external/configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index 6e38b7d1e9e..daaac5fa27b 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -108,7 +108,7 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ OPAL_CHECK_PACKAGE([opal_event_external], [event2/event.h], - [event], + [event_core], [event_config_new], [-levent_pthreads], [$opal_event_dir], @@ -150,7 +150,7 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ [# Ensure that this libevent has the symbol # "evthread_set_lock_callbacks", which will only exist if # libevent was configured with thread support. - AC_CHECK_LIB([event], [evthread_set_lock_callbacks], + AC_CHECK_LIB([event_core], [evthread_set_lock_callbacks], [], [AC_MSG_WARN([External libevent does not have thread support]) AC_MSG_WARN([Open MPI requires libevent to be compiled with]) From 1632aa06c0d76cec652a12871cb08841a12cd3bb Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Sun, 10 May 2020 10:31:15 +0200 Subject: [PATCH 562/674] Correct typo in mapping-too-low* help messages Signed-off-by: Christoph Niethammer --- orte/mca/rmaps/base/help-orte-rmaps-base.txt | 4 ++-- orte/mca/rtc/base/help-orte-rtc-base.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/orte/mca/rmaps/base/help-orte-rmaps-base.txt b/orte/mca/rmaps/base/help-orte-rmaps-base.txt index 0d4724aeec7..0b6be0abe6b 100644 --- a/orte/mca/rmaps/base/help-orte-rmaps-base.txt +++ b/orte/mca/rmaps/base/help-orte-rmaps-base.txt @@ -349,7 +349,7 @@ situation and try again. # [mapping-too-low] A request for multiple cpus-per-proc was given, but a directive -was also give to map to an object level that has less cpus than +was also given to map to an object level that has less cpus than requested ones: #cpus-per-proc: %d @@ -405,7 +405,7 @@ by specifying "--bind-to none" on your command line. # [mapping-too-low-init] A request for multiple cpus-per-proc was given, but a directive -was also give to map to an object level that cannot support that +was also given to map to an object level that cannot support that directive. Please specify a mapping level that has more than one cpu, or diff --git a/orte/mca/rtc/base/help-orte-rtc-base.txt b/orte/mca/rtc/base/help-orte-rtc-base.txt index 8414cc58850..081b9121c2c 100644 --- a/orte/mca/rtc/base/help-orte-rtc-base.txt +++ b/orte/mca/rtc/base/help-orte-rtc-base.txt @@ -243,7 +243,7 @@ situation and try again. # [mapping-too-low] A request for multiple cpus-per-proc was given, but a directive -was also give to map to an object level that has less cpus than +was also given to map to an object level that has less cpus than requested ones: #cpus-per-proc: %d From 7dba35f78515b1ed17f1d3f504c45f431225247c Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Mon, 18 May 2020 15:08:10 -0400 Subject: [PATCH 563/674] A slightly stronger check for LSF's libevent Signed-off-by: Joshua Hursey (cherry picked from commit 05e095a1eef737849750a5f4f649e72c393eeb74) --- opal/mca/event/external/configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/event/external/configure.m4 b/opal/mca/event/external/configure.m4 index daaac5fa27b..826fc880cb9 100644 --- a/opal/mca/event/external/configure.m4 +++ b/opal/mca/event/external/configure.m4 @@ -118,10 +118,10 @@ AC_DEFUN([MCA_opal_event_external_CONFIG],[ # Check to see if the above check failed because it conflicted with LSF's libevent.so # This can happen if LSF's library is in the LDFLAGS envar or default search - # path. The 'event_fini' function is only defined in LSF's libevent.so and not + # path. The 'event_getcode4name' function is only defined in LSF's libevent.so and not # in Libevent's libevent.so AS_IF([test "$opal_event_external_support" = "no"], - [AC_CHECK_LIB([event], [event_fini], + [AC_CHECK_LIB([event], [event_getcode4name], [AC_MSG_WARN([===================================================================]) AC_MSG_WARN([Possible conflicting libevent.so libraries detected on the system.]) AC_MSG_WARN([]) From 76500e6cf87178d5a83fb2b8bde83b49cab7d205 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Mon, 18 May 2020 15:10:46 -0400 Subject: [PATCH 564/674] Fix LSF configure check for libevent conflict * Want to make sure that the result from `wc` is trimmed of spaces, so the `0` check returns properly * Add a few more comments, and fix wording in the warning message. Signed-off-by: Joshua Hursey --- config/orte_check_lsf.m4 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/config/orte_check_lsf.m4 b/config/orte_check_lsf.m4 index eefc819852d..50f269f912a 100644 --- a/config/orte_check_lsf.m4 +++ b/config/orte_check_lsf.m4 @@ -144,21 +144,25 @@ AC_DEFUN([ORTE_CHECK_LSF],[ # If the external libevent component used 'event_core' instead of 'event' orte_check_lsf_event_conflict=na # Split libs into an array, see if -levent is in that list - orte_check_lsf_libevent_present=`echo $LIBS | awk '{split([$]0, a, " "); {for (k in a) {if (a[[k]] == "-levent") {print a[[k]]}}}}' | wc -l` + orte_check_lsf_libevent_present=`echo "$LIBS" | awk '{split([$]0, a, " "); {for (k in a) {if (a[[k]] == "-levent") {print a[[k]]}}}}' | wc -l | tr -d '[[:space:]]'` + # (1) LSF check must have failed above. We need to know why... AS_IF([test "$orte_check_lsf_happy" = "no"], - [AS_IF([test "$opal_event_external_support" = "yes" && test "$orte_check_lsf_libevent_present" != 0], + [# (2) If there is a -levent in the $LIBS then that might be the problem + AS_IF([test "$opal_event_external_support" = "yes" && test "$orte_check_lsf_libevent_present" != "0"], [AS_IF([test "$orte_check_lsf_libdir" = "" ], [], [LDFLAGS="$LDFLAGS -L$orte_check_lsf_libdir"]) # Note that we do not want to set LIBS here to include -llsf since # the check is not for an LSF library, but for the conflict with # LDFLAGS. + # (3) Check to see if the -levent is from Libevent (check for a symbol it has) AC_CHECK_LIB([event], [evthread_set_condition_callbacks], [AC_MSG_CHECKING([for libevent conflict]) AC_MSG_RESULT([No. The correct libevent.so was linked.]) orte_check_lsf_event_conflict=no], - [AC_MSG_CHECKING([for libevent conflict]) - AC_MSG_RESULT([Yes. A wrong libevent.so was linked.]) + [# (4) The libevent.so is not from Libevent. Warn the user. + AC_MSG_CHECKING([for libevent conflict]) + AC_MSG_RESULT([Yes. Detected a libevent.so that is not from Libevent.]) orte_check_lsf_event_conflict=yes]) ], [AC_MSG_CHECKING([for libevent conflict]) @@ -175,6 +179,8 @@ AC_DEFUN([ORTE_CHECK_LSF],[ AC_MSG_WARN([A system-installed Libevent library was detected and the Open MPI]) AC_MSG_WARN([build system chose to use the 'external' component expecting to]) AC_MSG_WARN([link against the Libevent in the linker search path.]) + AC_MSG_WARN([If LSF is present on the system and in the default search path then]) + AC_MSG_WARN([it _may be_ the source of the conflict.]) AC_MSG_WARN([LSF provides a libevent.so that is not from Libevent in its]) AC_MSG_WARN([library path. At this point the linker is attempting to resolve]) AC_MSG_WARN([Libevent symbols using the LSF library because of the lack of]) From cac77786bc4a3909b31818b0871edaafb039bebc Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 18 May 2020 16:43:12 -0500 Subject: [PATCH 565/674] VERSION -> v4.0.4rc2 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index a0dc7358b88..1efd6e39603 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=4 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc1 +greek=rc2 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 6a882dbba7c56f9c3619022d551c9758343a4528 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 19 May 2020 09:22:56 -0600 Subject: [PATCH 566/674] update NEWS for 4.0.4rc2 Signed-off-by: Howard Pritchard --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 01fe1f08edd..9b0aee80296 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,9 @@ included in the vX.Y.Z section and be denoted as: 4.0.4 -- May, 2020 ----------------------- +- Add checks to avoid conflicts with a libevent library shipped with LSF. +- Switch to linking against libevent_core rather than libevent, if present. +- Add improved support for UCX 1.9 and later. - Fix an ABI compatibility issue with the Fortran 2008 bindings. Thanks to Alastair McKinstry for reporting. - Fix an issue with rpath of /usr/lib64 when building OMPI on From 6e42a3c66e2fade307117e343745746c4f839067 Mon Sep 17 00:00:00 2001 From: Boris Karasev Date: Thu, 14 May 2020 10:54:16 +0700 Subject: [PATCH 567/674] sys limits: fixed soft limit setting if it is less than hard limit Signed-off-by: Boris Karasev (cherry picked from commit fb9eca55cfdfc4638521b431a4e4d545d9d22559) --- opal/util/sys_limits.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/opal/util/sys_limits.c b/opal/util/sys_limits.c index 16d11cdb78e..c6b95a35334 100644 --- a/opal/util/sys_limits.c +++ b/opal/util/sys_limits.c @@ -16,6 +16,8 @@ * Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Mellanox Technologies, Inc. + * All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -76,7 +78,7 @@ static int opal_setlimit(int resource, char *value, rlim_t *out) if (0 <= getrlimit(resource, &rlim)) { if (rlim.rlim_max < maxlim) { - rlim_set.rlim_cur = rlim.rlim_cur; + rlim_set.rlim_cur = rlim.rlim_max; rlim_set.rlim_max = rlim.rlim_max; } else { rlim_set.rlim_cur = maxlim; From 806654074ccf2a17c55134323b627ebbb9a8e29d Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Sat, 30 May 2020 11:26:26 +0900 Subject: [PATCH 568/674] opal/util: fix opal_str_to_bool() correctly use strlen(char *) instead of sizeof(char *) Thanks Georg Geiser for reporting this issue. Refs. open-mpi/ompi#7772 Signed-off-by: Gilles Gouaillardet (cherry picked from commit c450b2140540a1f8eae1a6e6f9a22d17cd40e7d8) --- opal/util/info.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/opal/util/info.c b/opal/util/info.c index a88efe41c83..a086bc67cff 100644 --- a/opal/util/info.c +++ b/opal/util/info.c @@ -14,8 +14,8 @@ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2012-2017 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-2018 IBM Corporation. All rights reserved. * Copyright (c) 2017 Intel, Inc. All rights reserved. * $COPYRIGHT$ @@ -370,13 +370,13 @@ opal_str_to_bool(char *str) char *ptr; /* Trim whitespace */ - ptr = str + sizeof(str) - 1; + ptr = str + strlen(str) - 1; while (ptr >= str && isspace(*ptr)) { *ptr = '\0'; --ptr; } ptr = str; - while (ptr < str + sizeof(str) - 1 && *ptr != '\0' && + while (ptr < str + strlen(str) - 1 && *ptr != '\0' && isspace(*ptr)) { ++ptr; } From e9c2af935f329308556fae42c012b58bf138a814 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 4 Jun 2020 09:58:12 -0600 Subject: [PATCH 569/674] NEWS: update for 4.0.4rc3 [skip-ci] Signed-off-by: Howard Pritchard --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9b0aee80296..984f9f5fc4e 100644 --- a/NEWS +++ b/NEWS @@ -57,8 +57,10 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. -4.0.4 -- May, 2020 +4.0.4 -- June, 2020 ----------------------- +- Fix an illegal access issue caught using gcc's address sanitizer. + Thanks to Georg Geiser for reporting. - Add checks to avoid conflicts with a libevent library shipped with LSF. - Switch to linking against libevent_core rather than libevent, if present. - Add improved support for UCX 1.9 and later. From 2454bc057107eb9f8c7119f96b0f808d64ecdd83 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Thu, 4 Jun 2020 12:06:46 -0500 Subject: [PATCH 570/674] Updating VERSION to rc3 Signed-off-by: Geoffrey Paulsen --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 1efd6e39603..d76c69a7aa0 100644 --- a/VERSION +++ b/VERSION @@ -30,7 +30,7 @@ release=4 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc2 +greek=rc3 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 57c7d682334a997e302712842d1e4348bb03f2b6 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Wed, 3 Jun 2020 01:58:14 -0400 Subject: [PATCH 571/674] adding op-codes for syscall ipc for shmat/shmdt These op codes used to be in bits/ipc.h but were removed in glibc in 2015 with a comment saying they should be defined in internal headers: https://sourceware.org/bugzilla/show_bug.cgi?id=18560 and when glibc uses that syscall it seems to do so from its own definitions: https://github.com/bminor/glibc/search?q=IPCOP_shmat&unscoped_q=IPCOP_shmat So I think using #ifndef and defining them if they're not already defined using the values from glibc is the best option. At IBM it was the testing on redhat 8 that found this as an issue (the opcodes being undefined on the system made the #define HAS_SHMDT evaluate to false so intercept_shmat / intercept_shmdt were left undefined so shmat/shmdt memory events went unintercepted). (cherry picked from commit e8fab058dac7300569cb54b08e5500115f8bab8f) Signed-off-by: Mark Allen --- opal/mca/memory/patcher/memory_patcher_component.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 272ec721225..20bc4c10b34 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -15,7 +15,7 @@ * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. - * Copyright (c) 2016-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2016-2020 IBM Corporation. All rights reserved. * * $COPYRIGHT$ * @@ -334,6 +334,18 @@ static int intercept_brk (void *addr) #endif +// These op codes used to be in bits/ipc.h but were removed in glibc in 2015 +// with a comment saying they should be defined in internal headers: +// https://sourceware.org/bugzilla/show_bug.cgi?id=18560 +// and when glibc uses that syscall it seems to do so from its own definitions: +// https://github.com/bminor/glibc/search?q=IPCOP_shmat&unscoped_q=IPCOP_shmat +#ifndef IPCOP_shmat +#define IPCOP_shmat 21 +#endif +#ifndef IPCOP_shmdt +#define IPCOP_shmdt 22 +#endif + #define HAS_SHMDT (defined(SYS_shmdt) || \ (defined(IPCOP_shmdt) && defined(SYS_ipc))) #define HAS_SHMAT (defined(SYS_shmat) || \ From 8c7a51dda3db0a329e0f1aa36d302e5141406639 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 5 Jun 2020 11:01:56 -0700 Subject: [PATCH 572/674] dist: Fix character encodings in NEWS The NEWS file had a mix of ISO-8859-1 and UTF-8 encodings, which was making a mess of decoding the non-ASCII characters in the file. This patch unifies the NEWS file as a UTF-8 encoded file and changes many of the places where we had ASCII-ified a persons name. Signed-off-by: Brian Barrett (cherry picked from commit 2e23893f04ef30c598a23889a4242f8cf4a45238) Cherry-pick was modified to fix one more ISO-8859-1 character that was in the v4.0.x branch but not in the master branch. Signed-off-by: Brian Barrett --- NEWS | 76 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/NEWS b/NEWS index 9b0aee80296..60968ed1ef4 100644 --- a/NEWS +++ b/NEWS @@ -76,7 +76,7 @@ included in the vX.Y.Z section and be denoted as: - Fix an issue with the Fortran compiler wrappers when using NAG compilers. Thanks to Peter Brady for reporting. - Fix an issue with the ORTE ssh based process launcher at scale. - Thanks to Benjamín Hernández for reporting. + Thanks to Benjamín Hernández for reporting. - Address an issue when using shared MPI I/O operations. OMPIO will now successfully return from the file open statement but will raise an error if the file system does not supported shared I/O @@ -868,7 +868,7 @@ Bug fixes/minor improvements: a file from independent jobs. Thanks to Nicolas Joly for reporting this issue. - Optimize zero size MPI_IALLTOALL{V,W} with MPI_IN_PLACE. Thanks to - Lisandro Dalcin for the report. + Lisandro Dalcín for the report. - Fix a ROMIO buffer overflow problem for large transfers when using NFS filesystems. - Fix type of MPI_ARGV[S]_NULL which prevented it from being used @@ -1014,7 +1014,7 @@ Bug fixes/minor improvements: for reporting. - Fix crash in MPI_COMM_SPAWN. - Fix types for MPI_UNWEIGHTED and MPI_WEIGHTS_EMPTY. Thanks to - Lisandro Dalcin for reporting. + Lisandro Dalcín for reporting. - Correctly report the name of MPI_INTEGER16. - Add some missing MPI constants to the Fortran bindings. - Fixed compile error when configuring Open MPI with --enable-timing. @@ -1030,7 +1030,7 @@ Bug fixes/minor improvements: - Fix problem with use use of non-zero lower bound datatypes in collectives. Thanks to Hristo Iliev for reporting. - Fix a problem with memory allocation within MPI_GROUP_INTERSECTION. - Thanks to Lisandro Dalcin for reporting. + Thanks to Lisandro Dalcín for reporting. - Fix an issue with MPI_ALLGATHER for communicators that don't consist of two ranks. Thanks to David Love for reporting. - Various fixes for collectives when used with esoteric MPI datatypes. @@ -1199,9 +1199,9 @@ Bug fixes / minor enhancements: - Fix a problem with use of a 64 bit atomic counter. Thanks to Paul Hargrove for reporting. - Fix a problem with singleton job launching. Thanks to Lisandro - Dalcin for reporting. + Dalcín for reporting. - Fix a problem with use of MPI_UNDEFINED with MPI_COMM_SPLIT_TYPE. - Thanks to Lisandro Dalcin for reporting. + Thanks to Lisandro Dalcín for reporting. - Silence a compiler warning in PSM MTL. Thanks to Adrian Reber for reporting this. - Properly detect Intel TrueScale and OmniPath devices in the ACTIVE @@ -1217,7 +1217,7 @@ Bug fixes / minor enhancements: - Implement a workaround for a GNU Libtool problem. Thanks to Eric Schnetter for reporting and fixing. - Improve hcoll library detection in configure. Thanks to David - Shrader and Ake Sandgren for reporting this. + Shrader and Ã…ke Sandgren for reporting this. - Miscellaneous minor bug fixes in the hcoll component. - Miscellaneous minor bug fixes in the ugni component. - Fix problems with XRC detection in OFED 3.12 and older releases. @@ -1246,9 +1246,9 @@ Bug fixes / minor enhancements: - Fix a problem with MPI-RMA PSCW epochs. Thanks to Berk Hess for reporting this. - Fix a problem in neighborhood collectives. Thanks to Lisandro - Dalcin for reporting. + Dalcín for reporting. - Fix MPI_IREDUCE_SCATTER_BLOCK for a one-process communicator. Thanks - to Lisandro Dalcin for reporting. + to Lisandro Dalcín for reporting. - Add (Open MPI-specific) additional flavors to MPI_COMM_SPLIT_TYPE. See MPI_Comm_split_type(3) for details. Thanks to Nick Andersen for supplying this enhancement. @@ -1407,10 +1407,10 @@ Bug fixes / minor enhancements: - Create a datafile in the per-proc directory in order to make it unique per communicator. Thanks to Peter Wind for the report - Fix zero-size malloc in one-sided pt-to-pt code. Thanks to Lisandro - Dalcin for the report + Dalcín for the report - Fix MPI_Get_address when passed MPI_BOTTOM to not return an error. - Thanks to Lisandro Dalcin for the report -- Fix MPI_TYPE_SET_ATTR with NULL value. Thanks to Lisandro Dalcin for + Thanks to Lisandro Dalcín for the report +- Fix MPI_TYPE_SET_ATTR with NULL value. Thanks to Lisandro Dalcín for the report - Fix various Fortran08 binding issues - Fix memchecker no-data case. Thanks to Clinton Stimpson for the report @@ -1607,11 +1607,11 @@ Bug fixes / minor enhancements: options. - CUDA: Made the asynchronous copy mode be the default. - Fix a malloc(0) warning in MPI_IREDUCE_SCATTER_BLOCK. Thanks to - Lisandro Dalcin for reporting the issue. + Lisandro Dalcín for reporting the issue. - Fix typo in MPI_Scatter(3) man page. Thanks to Akshay Venkatesh for noticing the mistake. - Add rudimentary protection from TCP port scanners. -- Fix typo in Open MPI error handling. Thanks to Åke Sandgren for +- Fix typo in Open MPI error handling. Thanks to Ã…ke Sandgren for pointing out the error. - Increased the performance of the CM PML (i.e., the Portals, PSM, PSM2, MXM, and OFI transports). @@ -1695,7 +1695,7 @@ Bug fixes / minor enhancements: source of the problem. - Fixed MPI_THREAD_MULTIPLE deadlock error in the vader BTL. Thanks to Thomas Klimpel for reporting the issue. -- Fixed several Valgrind warnings. Thanks for Lisandro Dalcin for +- Fixed several Valgrind warnings. Thanks for Lisandro Dalcín for contributing a patch fixing some one-sided code paths. - Fixed version compatibility test in OOB that broke ABI within the 1.8 series. NOTE: this will not resolve the problem between pre-1.8.5 @@ -1806,7 +1806,7 @@ Bug fixes / minor enhancements: reporting the issue. - Fixed seg fault in neighborhood collectives when the degree of the topology is higher than the communicator size. Thanks to Lisandro - Dalcin for reporting the issue. + Dalcín for reporting the issue. - Fixed segfault in neighborhood collectives under certain use-cases. - Fixed various issues regarding Solaris support. Thanks to Siegmar Gross for patiently identifying all the issues. @@ -1897,7 +1897,7 @@ Bug fixes / minor enhancements: - Ensure mpirun aborts properly when unable to map processes in scheduled environments. - Ensure that MPI RMA error codes show up properly. Thanks to - Lisandro Dalcin for reporting the issue. + Lisandro Dalcín for reporting the issue. - Minor bug fixes and improvements to the bash and zsh mpirun autocompletion scripts. - Fix sequential mpirun process mapper. Thanks to Bill Chen for @@ -1935,7 +1935,7 @@ Bug fixes / minor enhancements: - Add config support for the Mellanox ConnectX 4 card. - Add missing MPI_COMM_GET|SET_INFO functions, and missing MPI_WEIGHTS_EMPTY and MPI_ERR_RMA_SHARED constants. Thanks to - Lisandro Dalcin for pointing out the issue. + Lisandro Dalcín for pointing out the issue. - Update some help messages in OSHMEM, the usnic BTL, the TCP BTL, and ORTE, and update documentation about ompi_info's --level option. - Fix some compiler warnings. @@ -1987,7 +1987,7 @@ Bug fixes / minor enhancements: - Add version check during startup to ensure you are using the same version of Open MPI on all nodes in a job. - Significantly improved the performance of MPI_DIMS_CREATE for large - values. Thanks to Andreas Schäfer for the contribution. + values. Thanks to Andreas Schäfer for the contribution. - Removed ASYNCHRONOUS keyword from the "ignore TKR" mpi_f08 module. - Deprecated the following mpirun options: --bynode, --bycore, --byslot: replaced with --map-by node|core|slot. @@ -2185,7 +2185,7 @@ Bug fixes / minor enhancements: Thanks to Alexey Ryzhikh for the patch. - Add bozo check for negative np values to mpirun to prevent a deadlock. Thanks to Upinder Malhi for identifying the issue. -- Fixed MPI_IS_THREAD_MAIN behavior. Thanks to Lisandro Dalcin for +- Fixed MPI_IS_THREAD_MAIN behavior. Thanks to Lisandro Dalcín for pointing out the problem. - Various rankfile fixes. - Fix functionality over iWARP devices. @@ -2381,7 +2381,7 @@ Bug fixes / minor enhancements: the patch. - Fixed debugger support for direct-launched jobs. - Fix MPI_IS_THREAD_MAIN to return the correct value. Thanks to - Lisandro Dalcin for pointing out the issue. + Lisandro Dalcín for pointing out the issue. - Update VT to 5.14.4.4: - Fix C++-11 issue. - Fix support for building RPMs on Fedora with CUDA libraries. @@ -2496,9 +2496,9 @@ Bug fixes / minor enhancements: - Improved collective algorithm selection for very large messages. - Fix PSM MTL affinity settings. - Fix issue with MPI_OP_COMMUTATIVE in the mpif.h bindings. Thanks to - Ake Sandgren for providing a patch to fix the issue. + Ã…ke Sandgren for providing a patch to fix the issue. - Fix issue with MPI_SIZEOF when using CHARACTER and LOGICAL types in - the mpi module. Thanks to Ake Sandgren for providing a patch to fix + the mpi module. Thanks to Ã…ke Sandgren for providing a patch to fix the issue. @@ -2569,13 +2569,13 @@ Bug fixes / minor enhancements: - Use aligned memory for OpenFabrics registered memory. - Multiple fixes for parameter checking in MPI_ALLGATHERV, MPI_REDUCE_SCATTER, MPI_SCATTERV, and MPI_GATHERV. Thanks to the - mpi4py community (Bennet Fauber, Lisandro Dalcin, Jonathan Dursi). + mpi4py community (Bennet Fauber, Lisandro Dalcín, Jonathan Dursi). - Fixed file positioning overflows in MPI_FILE_GET_POSITION, MPI_FILE_GET_POSITION_SHARED, FILE_GET_SIZE, FILE_GET_VIEW. - Removed the broken --cpu-set mpirun option. - Fix cleanup of MPI errorcodes. Thanks to Alexey Bayduraev for the patch. -- Fix default hostfile location. Thanks to Götz Waschk for noticing +- Fix default hostfile location. Thanks to Götz Waschk for noticing the issue. - Improve several error messages. @@ -2687,7 +2687,7 @@ Bug fixes / minor enhancements: - Add support for dynamic service levels (SLs) in the openib BTL. - Fixed C++ bindings cosmetic/warnings issue with MPI::Comm::NULL_COPY_FN and MPI::Comm::NULL_DELETE_FN. Thanks to - Júlio Hoffimann for identifying the issues. + Júlio Hoffimann for identifying the issues. - Also allow the word "slots" in rankfiles (i.e., not just "slot"). (** also to appear in 1.4.4) - Add Mellanox ConnectX 3 device IDs to the openib BTL defaults. @@ -3411,7 +3411,7 @@ and v1.4. features. - Fix SLURM race condition. - Fix MPI_File_c2f(MPI_FILE_NULL) to return 0, not -1. Thanks to - Lisandro Dalcin for the bug report. + Lisandro Dalcín for the bug report. - Fix the DSO build of tm PLM. - Various fixes for size disparity between C int's and Fortran INTEGER's. Thanks to Christoph van Wullen for the bug report. @@ -3654,7 +3654,7 @@ and v1.4. - Fix for ConnectX devices and OFED 1.3. See ticket #1190. - Fixed a configure problem for Fortran 90 on Cray systems. Ticket #1189. - Fix an uninitialized variable in the error case in opal_init.c. - Thanks to Ake Sandgren for pointing out the mistake. + Thanks to Ã…ke Sandgren for pointing out the mistake. - Fixed a hang in configure if $USER was not defined. Thanks to Darrell Kresge for noticing the problem. See ticket #900. - Added support for parallel debuggers even when we have an optimized build. @@ -3663,7 +3663,7 @@ and v1.4. compiling Open MPI with -g. See ticket #1179. - Removed some warnings about 'rm' from Mac OS X 10.5 (Leopard) builds. - Fix the handling of mx_finalize(). See ticket #1177. - Thanks to Ake Sandgren for bringing this issue to our attention. + Thanks to Ã…ke Sandgren for bringing this issue to our attention. - Fixed minor file descriptor leak in the Altix timer code. Thanks to Paul Hargrove for noticing the problem and supplying the fix. - Fix a problem when using a different compiler for C and Objective C. @@ -3674,7 +3674,7 @@ and v1.4. - A few manpage fixes from the Debian Open MPI maintainers. Thanks to Tilman Koschnick, Sylvestre Ledru, and Dirk Eddelbuettel. - Fixed issue with pthread detection when compilers are not all - from the same vendor. Thanks to Ake Sandgren for the bug + from the same vendor. Thanks to Ã…ke Sandgren for the bug report. See ticket #1150. - Fixed vector collectives in the self module. See ticket #1166. - Fixed some data-type engine bugs: an indexing bug, and an alignment bug. @@ -3702,12 +3702,12 @@ and v1.4. - Prevent users of 32-bit MPI apps from requesting >= 2GB of shared memory. - Added a Portals MTL. -- Fix 0 sized MPI_ALLOC_MEM requests. Thanks to Lisandro Dalcin for +- Fix 0 sized MPI_ALLOC_MEM requests. Thanks to Lisandro Dalcín for pointing out the problem. - Fixed a segfault crash on large SMPs when doing collectives. - A variety of fixes for Cray XT3/4 class of machines. - Fixed which error handler is used when MPI_COMM_SELF is passed - to MPI_COMM_FREE. Thanks to Lisandro Dalcini for the bug report. + to MPI_COMM_FREE. Thanks to Lisandro Dalcín for the bug report. - Fixed compilation on platforms that don't have hton/ntoh. - Fixed a logic problem in the fortran binding for MPI_TYPE_MATCH_SIZE. Thanks to Jeff Dusenberry for pointing out the problem and supplying @@ -3954,7 +3954,7 @@ and v1.4. in the MPI F77 bindings functions. Thanks to Pierre-Matthieu Anglade for bringing this problem to our attention. - Fix for a memory leak in the derived datatype function - ompi_ddt_duplicate(). Thanks to Andreas Schafer for reporting, + ompi_ddt_duplicate(). Thanks to Andreas Schäfer for reporting, diagnosing, and patching the leak. - Used better performing basic algorithm for MPI_ALLGATHERV. - Added a workaround for a bug in the Intel 9.1 C++ compiler (all @@ -3964,9 +3964,9 @@ and v1.4. - Fix MPI_SIZEOF implementation in the F90 bindings for COMPLEX variable types. - Fixes for persistent requests involving MPI_PROC_NULL. Thanks to - Lisandro Dalcin for reporting the problem. + Lisandro Dalcín for reporting the problem. - Fixes to MPI_TEST* and MPI_WAIT* for proper MPI exception reporting. - Thanks to Lisandro Dalcin for finding the issue. + Thanks to Lisandro Dalcín for finding the issue. - Various fixes for MPI generalized request handling; addition of missing MPI::Grequest functionality to the C++ bindings. - Add "mpi_preconnect_all" MCA parameter to force wireup of all MPI @@ -3977,7 +3977,7 @@ and v1.4. to Ralf Wildenhues for suggesting the fix. - Fix several MPI_*ERRHANDLER* functions and MPI_GROUP_TRANSLATE_RANKS with respect to what arguments they allowed and the behavior that - they effected. Thanks to Lisandro Dalcin for reporting the + they effected. Thanks to Lisandro Dalcín for reporting the problems. @@ -3986,7 +3986,7 @@ and v1.4. - Really fix Fortran status handling in MPI_WAITSOME and MPI_TESTSOME. - Various datatype fixes, reported by several users as causing - failures in the BLACS testing suite. Thanks to Harald Forbert, Ake + failures in the BLACS testing suite. Thanks to Harald Forbert, Ã…ke Sandgren and, Michael Kluskens for reporting the problem. - Correctness and performance fixes for heterogeneous environments. - Fixed a error in command line parsing on some platforms (causing @@ -4000,7 +4000,7 @@ and v1.4. - Fix various error checking in MPI_INFO_GET_NTHKEY and MPI_GROUP_TRANSLATE_RANKS, and some collective operations (particularly with regards to MPI_IN_PLACE). Thanks to Lisandro - Dalcin for reporting the problems. + Dalcín for reporting the problems. - Fix receiving messages to buffers allocated by MPI_ALLOC_MEM. - Fix a number of race conditions with the MPI-2 Onesided interface. From 3110473e677567b8a144afc306120830a02f2569 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 5 Jun 2020 11:14:34 -0700 Subject: [PATCH 573/674] dist: Update NEWS from release branches We have been bad about updating the NEWS file in master with all the changes that have gone into the release branches. Patch up NEWS with the changes from v3.0, v3.1, and v4.0 branches. Signed-off-by: Brian Barrett (cherry picked from commit 50765ae5a26f718c8840e65cb0cb813f4a65004b) Signed-off-by: Brian Barrett --- NEWS | 260 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 260 insertions(+) diff --git a/NEWS b/NEWS index 60968ed1ef4..26da8d126bb 100644 --- a/NEWS +++ b/NEWS @@ -271,6 +271,138 @@ Known issues: terminated normally but exited with non-zero error code. Thanks to Emre Brookes for reporting. +3.1.6 -- March, 2020 +-------------------- + +- Fix one-sided shared memory window configuration bug. +- Fix support for PGI'18 compiler. +- Fix issue with zero-length blockLength in MPI_TYPE_INDEXED. +- Fix run-time linker issues with OMPIO on newer Linux distros. +- Fix PMIX dstore locking compilation issue. Thanks to Marco Atzeri + for reporting the issue. +- Allow the user to override modulefile_path in the Open MPI SRPM, + even if install_in_opt is set to 1. +- Properly detect ConnectX-6 HCAs in the openib BTL. +- Fix segfault in the MTL/OFI initialization for large jobs. +- Fix issue to guarantee to properly release MPI one-sided lock when + using UCX transports to avoid a deadlock. +- Fix potential deadlock when processing outstanding transfers with + uGNI transports. +- Fix various portals4 control flow bugs. +- Fix communications ordering for alltoall and Cartesian neighborhood + collectives. +- Fix an infinite recursion crash in the memory patcher on systems + with glibc v2.26 or later (e.g., Ubuntu 18.04) when using certain + OS-bypass interconnects. + +3.1.5 -- November, 2019 +----------------------- + +- Fix OMPIO issue limiting file reads/writes to 2GB. Thanks to + Richard Warren for reporting the issue. +- At run time, automatically disable Linux cross-memory attach (CMA) + for vader BTL (shared memory) copies when running in user namespaces + (i.e., containers). Many thanks to Adrian Reber for raising the + issue and providing the fix. +- Sending very large MPI messages using the ofi MTL will fail with + some of the underlying Libfabric transports (e.g., PSM2 with + messages >=4GB, verbs with messages >=2GB). Prior version of Open + MPI failed silently; this version of Open MPI invokes the + appropriate MPI error handler upon failure. See + https://github.com/open-mpi/ompi/issues/7058 for more details. + Thanks to Emmanuel Thomé for raising the issue. +- Fix case where 0-extent datatypes might be eliminated during + optimization. Thanks to Github user @tjahns for raising the issue. +- Ensure that the MPIR_Breakpoint symbol is not optimized out on + problematic platforms. +- Fix MPI one-sided 32 bit atomic support. +- Fix OMPIO offset calculations with SEEK_END and SEEK_CUR in + MPI_FILE_GET_POSITION. Thanks to Wei-keng Liao for raising the + issue. +- Add "naive" regx component that will never fail, no matter how + esoteric the hostnames are. +- Fix corner case for datatype extent computations. Thanks to David + Dickenson for raising the issue. +- Allow individual jobs to set their map/rank/bind policies when + running LSF. Thanks to Nick R. Papior for assistance in solving the + issue. +- Fix MPI buffered sends with the "cm" PML. +- Properly propagate errors to avoid deadlocks in MPI one-sided operations. +- Update to PMIx v2.2.3. +- Fix data corruption in non-contiguous MPI accumulates over UCX. +- Fix ssh-based tree-based spawning at scale. Many thanks to Github + user @zrss for the report and diagnosis. +- Fix the Open MPI RPM spec file to not abort when grep fails. Thanks + to Daniel Letai for bringing this to our attention. +- Handle new SLURM CLI options (SLURM 19 deprecated some options that + Open MPI was using). Thanks to Jordan Hayes for the report and the + initial fix. +- OMPI: fix division by zero with an empty file view. +- Also handle shmat()/shmdt() memory patching with OS-bypass networks. +- Add support for unwinding info to all files that are present in the + stack starting from MPI_Init, which is helpful with parallel + debuggers. Thanks to James Clark for the report and initial fix. +- Fixed inadvertant use of bitwise operators in the MPI C++ bindings + header files. Thanks to Bert Wesarg for the report and the fix. + +3.1.4 -- April, 2019 +-------------------- + +- Fix compile error when configured with --enable-mpi-java and + --with-devel-headers. Thanks to @g-raffy for reporting the issue + (** also appeared: v3.0.4). +- Only use hugepages with appropriate permissions. Thanks to Hunter + Easterday for the fix. +- Fix possible floating point rounding and division issues in OMPIO + which led to crashes and/or data corruption with very large data. + Thanks to Axel Huebl and René Widera for identifing the issue, + supplying and testing the fix (** also appeared: v3.0.4). +- Use static_cast<> in mpi.h where appropriate. Thanks to @shadow-fx + for identifying the issue (** also appeared: v3.0.4). +- Fix RMA accumulate of non-predefined datatypes with predefined + operators. Thanks to Jeff Hammond for raising the issue (** also + appeared: v3.0.4). +- Fix race condition when closing open file descriptors when launching + MPI processes. Thanks to Jason Williams for identifying the issue and + supplying the fix (** also appeared: v3.0.4). +- Fix support for external PMIx v3.1.x. +- Fix Valgrind warnings for some MPI_TYPE_CREATE_* functions. Thanks + to Risto Toijala for identifying the issue and supplying the fix (** + also appeared: v3.0.4). +- Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX} for r=38 and r=308 (** also + appeared: v3.0.4). +- Fix assembly issues with old versions of gcc (<6.0.0) that affected + the stability of shared memory communications (e.g., with the vader + BTL) (** also appeared: v3.0.4). +- Fix MPI_Allreduce crashes with some cases in the coll/spacc module. +- Fix the OFI MTL handling of MPI_ANY_SOURCE (** also appeared: + v3.0.4). +- Fix noisy errors in the openib BTL with regards to + ibv_exp_query_device(). Thanks to Angel Beltre and others who + reported the issue (** also appeared: v3.0.4). +- Fix zero-size MPI one-sided windows with UCX. + +3.1.3 -- October, 2018 +---------------------- + +- Fix race condition in MPI_THREAD_MULTIPLE support of non-blocking + send/receive path. +- Fix error handling SIGCHLD forwarding. +- Add support for CHARACTER and LOGICAL Fortran datatypes for MPI_SIZEOF. +- Fix compile error when using OpenJDK 11 to compile the Java bindings. +- Fix crash when using a hostfile with a 'user@host' line. +- Numerous Fortran '08 interface fixes. +- TCP BTL error message fixes. +- OFI MTL now will use any provider other than shm, sockets, tcp, udp, or + rstream, rather than only supporting gni, psm, and psm2. +- Disable async receive of CUDA buffers by default, fixing a hang + on large transfers. +- Support the BCM57XXX and BCM58XXX Broadcomm adapters. +- Fix minmax datatype support in ROMIO. +- Bug fixes in vader shared memory transport. +- Support very large buffers with MPI_TYPE_VECTOR. +- Fix hang when launching with mpirun on Cray systems. + 3.1.2 -- August, 2018 ------------------------ @@ -377,6 +509,134 @@ Known issues: - Remove support for XL compilers older than v13.1. - Remove support for atomic operations using MacOS atomics library. +3.0.6 -- March, 2020 +-------------------- + +- Fix one-sided shared memory window configuration bug. +- Fix support for PGI'18 compiler. +- Fix run-time linker issues with OMPIO on newer Linux distros. +- Allow the user to override modulefile_path in the Open MPI SRPM, + even if install_in_opt is set to 1. +- Properly detect ConnectX-6 HCAs in the openib BTL. +- Fix segfault in the MTL/OFI initialization for large jobs. +- Fix various portals4 control flow bugs. +- Fix communications ordering for alltoall and Cartesian neighborhood + collectives. +- Fix an infinite recursion crash in the memory patcher on systems + with glibc v2.26 or later (e.g., Ubuntu 18.04) when using certain + OS-bypass interconnects. + +3.0.5 -- November, 2019 +----------------------- + +- Fix OMPIO issue limiting file reads/writes to 2GB. Thanks to + Richard Warren for reporting the issue. +- At run time, automatically disable Linux cross-memory attach (CMA) + for vader BTL (shared memory) copies when running in user namespaces + (i.e., containers). Many thanks to Adrian Reber for raising the + issue and providing the fix. +- Sending very large MPI messages using the ofi MTL will fail with + some of the underlying Libfabric transports (e.g., PSM2 with + messages >=4GB, verbs with messages >=2GB). Prior version of Open + MPI failed silently; this version of Open MPI invokes the + appropriate MPI error handler upon failure. See + https://github.com/open-mpi/ompi/issues/7058 for more details. + Thanks to Emmanuel Thomé for raising the issue. +- Fix case where 0-extent datatypes might be eliminated during + optimization. Thanks to Github user @tjahns for raising the issue. +- Ensure that the MPIR_Breakpoint symbol is not optimized out on + problematic platforms. +- Fix OMPIO offset calculations with SEEK_END and SEEK_CUR in + MPI_FILE_GET_POSITION. Thanks to Wei-keng Liao for raising the + issue. +- Fix corner case for datatype extent computations. Thanks to David + Dickenson for raising the issue. +- Fix MPI buffered sends with the "cm" PML. +- Update to PMIx v2.2.3. +- Fix ssh-based tree-based spawning at scale. Many thanks to Github + user @zrss for the report and diagnosis. +- Fix the Open MPI RPM spec file to not abort when grep fails. Thanks + to Daniel Letai for bringing this to our attention. +- Handle new SLURM CLI options (SLURM 19 deprecated some options that + Open MPI was using). Thanks to Jordan Hayes for the report and the + initial fix. +- OMPI: fix division by zero with an empty file view. +- Also handle shmat()/shmdt() memory patching with OS-bypass networks. +- Add support for unwinding info to all files that are present in the + stack starting from MPI_Init, which is helpful with parallel + debuggers. Thanks to James Clark for the report and initial fix. +- Fixed inadvertant use of bitwise operators in the MPI C++ bindings + header files. Thanks to Bert Wesarg for the report and the fix. +- Added configure option --disable-wrappers-runpath (alongside the + already-existing --disable-wrappers-rpath option) to prevent Open + MPI's configure script from automatically adding runpath CLI options + to the wrapper compilers. + +3.0.4 -- April, 2019 +-------------------- + +- Fix compile error when configured with --enable-mpi-java and + --with-devel-headers. Thanks to @g-raffy for reporting the issue. +- Fix possible floating point rounding and division issues in OMPIO + which led to crashes and/or data corruption with very large data. + Thanks to Axel Huebl and René Widera for identifing the issue, + supplying and testing the fix (** also appeared: v3.0.4). +- Use static_cast<> in mpi.h where appropriate. Thanks to @shadow-fx + for identifying the issue. +- Fix datatype issue with RMA accumulate. Thanks to Jeff Hammond for + raising the issue. +- Fix RMA accumulate of non-predefined datatypes with predefined + operators. Thanks to Jeff Hammond for raising the issue. +- Fix race condition when closing open file descriptors when launching + MPI processes. Thanks to Jason Williams for identifying the issue and + supplying the fix. +- Fix Valgrind warnings for some MPI_TYPE_CREATE_* functions. Thanks + to Risto Toijala for identifying the issue and supplying the fix. +- Fix MPI_TYPE_CREATE_F90_{REAL,COMPLEX} for r=38 and r=308. +- Fix assembly issues with old versions of gcc (<6.0.0) that affected + the stability of shared memory communications (e.g., with the vader + BTL). +- Fix the OFI MTL handling of MPI_ANY_SOURCE. +- Fix noisy errors in the openib BTL with regards to + ibv_exp_query_device(). Thanks to Angel Beltre and others who + reported the issue. + +3.0.3 -- October, 2018 +---------------------- + +- Fix race condition in MPI_THREAD_MULTIPLE support of non-blocking + send/receive path. +- Fix error handling SIGCHLD forwarding. +- Add support for CHARACTER and LOGICAL Fortran datatypes for MPI_SIZEOF. +- Fix compile error when using OpenJDK 11 to compile the Java bindings. +- Fix crash when using a hostfile with a 'user@host' line. +- Numerous Fortran '08 interface fixes. +- TCP BTL error message fixes. +- OFI MTL now will use any provider other than shm, sockets, tcp, udp, or + rstream, rather than only supporting gni, psm, and psm2. +- Disable async receive of CUDA buffers by default, fixing a hang + on large transfers. +- Support the BCM57XXX and BCM58XXX Broadcomm adapters. +- Fix minmax datatype support in ROMIO. +- Bug fixes in vader shared memory transport. +- Support very large buffers with MPI_TYPE_VECTOR. +- Fix hang when launching with mpirun on Cray systems. +- Bug fixes in OFI MTL. +- Assorted Portals 4.0 bug fixes. +- Fix for possible data corruption in MPI_BSEND. +- Move shared memory file for vader btl into /dev/shm on Linux. +- Fix for MPI_ISCATTER/MPI_ISCATTERV Fortran interfaces with MPI_IN_PLACE. +- Upgrade PMIx to v2.1.4. +- Fix for Power9 built-in atomics. +- Numerous One-sided bug fixes. +- Fix for race condition in uGNI BTL. +- Improve handling of large number of interfaces with TCP BTL. +- Numerous UCX bug fixes. +- Add support for QLogic and Broadcom Cumulus RoCE HCAs to Open IB BTL. +- Add patcher support for aarch64. +- Fix hang on Power and ARM when Open MPI was built with low compiler + optimization settings. + 3.0.2 -- June, 2018 ------------------- From f2dcf4b1292be7ffc60b686350dccdb1899cc7d7 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Mon, 8 Jun 2020 17:49:50 -0500 Subject: [PATCH 574/674] Adding Info about PR7778 to NEWS and README Signed-off-by: Geoffrey Paulsen --- NEWS | 4 +++- README | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 984f9f5fc4e..4104df54d66 100644 --- a/NEWS +++ b/NEWS @@ -14,7 +14,7 @@ Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Copyright (c) 2006-2018 Los Alamos National Security, LLC. All rights reserved. -Copyright (c) 2010-2019 IBM Corporation. All rights reserved. +Copyright (c) 2010-2020 IBM Corporation. All rights reserved. Copyright (c) 2012 Oak Ridge National Labs. All rights reserved. Copyright (c) 2012 Sandia National Laboratories. All rights reserved. Copyright (c) 2012 University of Houston. All rights reserved. @@ -59,6 +59,8 @@ included in the vX.Y.Z section and be denoted as: 4.0.4 -- June, 2020 ----------------------- +- Fix a memory patcher issue intercepting shmat and shmdt. This was + observed on RHEL 8.x ppc64le (see README for more info). - Fix an illegal access issue caught using gcc's address sanitizer. Thanks to Georg Geiser for reporting. - Add checks to avoid conflicts with a libevent library shipped with LSF. diff --git a/README b/README index 074988221d1..bcea81b7611 100644 --- a/README +++ b/README @@ -71,6 +71,13 @@ base as of this writing (May 2020): General notes ------------- +- Open MPI v4.0.4 fixed an issue with the memory patcher's ability to + intercept shmat and shmdt that could cause wrong answers. This was + observed on RHEL8.1 running on ppc64le, but it may affect other systems. + + For more information, please see: + https://github.com/open-mpi/ompi/pull/7778 + - WARNING - Open MPI v4.0.0-4.0.3 accidentally did not include some constants from the mpi_f08 module interface (mostly dealing with C and C++ datatypes). From 3137a78bceb49d052d187c682df8e29ac88099a9 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 9 Jun 2020 19:38:21 +0000 Subject: [PATCH 575/674] RAS:ALPS add support for ANL Cobalt This commit enables the ALPS RAS to get reservation information from COBALT. Signed-off-by: Howard Pritchard --- orte/mca/ras/alps/help-ras-alps.txt | 7 +++++-- orte/mca/ras/alps/ras_alps_component.c | 9 ++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/orte/mca/ras/alps/help-ras-alps.txt b/orte/mca/ras/alps/help-ras-alps.txt index 3e56a4443d1..6b5d095024e 100644 --- a/orte/mca/ras/alps/help-ras-alps.txt +++ b/orte/mca/ras/alps/help-ras-alps.txt @@ -10,6 +10,8 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. +# Copyrigth (c) 2020 Triad National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -25,14 +27,15 @@ variables: OMPI_ALPS_RESID BASIL_RESERVATION_ID + COBALT_JOBID However, it was unable to find either one of these variables. #This is a fatal error. [alps-env-var-invalid] While trying to determine what resources are available, the ALPS -resource allocator uses either the OMPI_ALPS_RESID or the -BASIL_RESERVATION_ID environment variable. +resource allocator uses either the OMPI_ALPS_RESID, +BASIL_RESERVATION_ID, or COBALT_JOBID environment variable. However, an error was encountered when trying to parse the variable: diff --git a/orte/mca/ras/alps/ras_alps_component.c b/orte/mca/ras/alps/ras_alps_component.c index 2bf719c80ee..322df6214b8 100644 --- a/orte/mca/ras/alps/ras_alps_component.c +++ b/orte/mca/ras/alps/ras_alps_component.c @@ -13,6 +13,8 @@ * Copyright (c) 2008 UT-Battelle, LLC * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -104,7 +106,12 @@ get_res_id(void) if (NULL != (id = getenv("BATCH_PARTITION_ID"))) { return strtoul(id, NULL, 10); } - if (NULL != (id = getenv("PBS_JOBID"))) { + + id = getenv("PBS_JOBID"); + if (NULL == id) { + id = getenv("COBALT_JOBID"); + } + if (NULL != id) { char *prepped_jid = prep_job_id(id); if (NULL == prepped_jid) { /* out of resources */ From 441e88f2b4a63efbda7657e635f14ba6262eeca1 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sat, 30 May 2020 16:41:57 +0000 Subject: [PATCH 576/674] dist: Start v4.1.x release series Signed-off-by: Brian Barrett --- LICENSE | 2 +- NEWS | 5 ++++- VERSION | 46 ++++++++++++++++++++++++---------------------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/LICENSE b/LICENSE index 29b02918cee..d0373912907 100644 --- a/LICENSE +++ b/LICENSE @@ -53,7 +53,7 @@ Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All rights reserved. Copyright (c) 2013-2019 Research Organization for Information Science (RIST). All rights reserved. -Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights +Copyright (c) 2017-2020 Amazon.com, Inc. or its affiliates. All Rights reserved. Copyright (c) 2019 Triad National Security, LLC. All rights reserved. diff --git a/NEWS b/NEWS index e6f18674427..1291c16f4ff 100644 --- a/NEWS +++ b/NEWS @@ -20,7 +20,7 @@ Copyright (c) 2012 Sandia National Laboratories. All rights reserved. Copyright (c) 2012 University of Houston. All rights reserved. Copyright (c) 2013 NVIDIA Corporation. All rights reserved. Copyright (c) 2013-2018 Intel, Inc. All rights reserved. -Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights +Copyright (c) 2018-2020 Amazon.com, Inc. or its affiliates. All Rights reserved. Copyright (c) 2019-2020 Triad National Security, LLC. All rights reserved. @@ -57,6 +57,9 @@ included in the vX.Y.Z section and be denoted as: (** also appeared: A.B.C) -- indicating that this item was previously included in release version vA.B.C. +4.1.0 -- July, 2020 +------------------- + 4.0.4 -- June, 2020 ----------------------- - Fix a memory patcher issue intercepting shmat and shmdt. This was diff --git a/VERSION b/VERSION index d76c69a7aa0..72adf1e78dd 100644 --- a/VERSION +++ b/VERSION @@ -10,6 +10,8 @@ # Copyright (c) 2018-2020 IBM Corporation. All rights reserved. # Copyright (c) 2018 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights + reserved. # This is the VERSION file for Open MPI, describing the precise # version of Open MPI in this distribution. The various components of @@ -20,8 +22,8 @@ # ... major=4 -minor=0 -release=4 +minor=1 +release=0 # greek is generally used for alpha or beta release tags. If it is # non-empty, it will be appended to the version number. It does not @@ -30,7 +32,7 @@ release=4 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=rc3 +greek=a1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" @@ -88,17 +90,17 @@ date="Unreleased developer copy" # Version numbers are described in the Libtool current:revision:age # format. -libmpi_so_version=60:4:20 -libmpi_cxx_so_version=60:1:20 -libmpi_mpifh_so_version=60:2:20 -libmpi_usempi_tkr_so_version=60:0:20 -libmpi_usempi_ignore_tkr_so_version=60:0:20 -libmpi_usempif08_so_version=61:1:21 -libopen_rte_so_version=60:4:20 -libopen_pal_so_version=60:4:20 -libmpi_java_so_version=60:0:20 -liboshmem_so_version=62:1:22 -libompitrace_so_version=60:0:20 +libmpi_so_version=70:0:30 +libmpi_cxx_so_version=70:0:30 +libmpi_mpifh_so_version=70:0:30 +libmpi_usempi_tkr_so_version=70:0:30 +libmpi_usempi_ignore_tkr_so_version=70:0:30 +libmpi_usempif08_so_version=70:0:30 +libopen_rte_so_version=70:0:30 +libopen_pal_so_version=70:0:30 +libmpi_java_so_version=70:0:30 +liboshmem_so_version=70:0:30 +libompitrace_so_version=70:0:30 # "Common" components install standalone libraries that are run-time # linked by one or more components. So they need to be versioned as @@ -106,15 +108,15 @@ libompitrace_so_version=60:0:20 # components-don't-affect-the-build-system abstraction. # OMPI layer -libmca_ompi_common_ompio_so_version=60:3:19 -libmca_ompi_common_monitoring_so_version=60:0:10 +libmca_ompi_common_ompio_so_version=70:0:29 +libmca_ompi_common_monitoring_so_version=70:0:20 # ORTE layer -libmca_orte_common_alps_so_version=60:0:20 +libmca_orte_common_alps_so_version=70:0:30 # OPAL layer -libmca_opal_common_cuda_so_version=60:0:20 -libmca_opal_common_sm_so_version=60:0:20 -libmca_opal_common_ucx_so_version=60:1:20 -libmca_opal_common_ugni_so_version=60:0:20 -libmca_opal_common_verbs_so_version=60:0:20 +libmca_opal_common_cuda_so_version=70:0:30 +libmca_opal_common_sm_so_version=70:0:30 +libmca_opal_common_ucx_so_version=70:0:30 +libmca_opal_common_ugni_so_version=70:0:30 +libmca_opal_common_verbs_so_version=70:0:30 From 3234079bbc2ed8c76c07a3c8b51a9aae7f19c307 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Fri, 15 Nov 2019 12:36:36 -0500 Subject: [PATCH 577/674] Add detection for JSM direct launch * Adds the `schizo/jsm` component that detects if the process was direct launched with IBM's Job Step Manager (JSM). JSM is a PMIx enhanced runtime environment so flag it as such. Signed-off-by: Joshua Hursey (cherry picked from commit 4f1de51371048085b86ee64e05849ad929c9f35c) --- orte/mca/schizo/jsm/Makefile.am | 37 ++++++++ orte/mca/schizo/jsm/configure.m4 | 31 ++++++ orte/mca/schizo/jsm/owner.txt | 7 ++ orte/mca/schizo/jsm/schizo_jsm.c | 104 +++++++++++++++++++++ orte/mca/schizo/jsm/schizo_jsm.h | 30 ++++++ orte/mca/schizo/jsm/schizo_jsm_component.c | 52 +++++++++++ 6 files changed, 261 insertions(+) create mode 100644 orte/mca/schizo/jsm/Makefile.am create mode 100644 orte/mca/schizo/jsm/configure.m4 create mode 100644 orte/mca/schizo/jsm/owner.txt create mode 100644 orte/mca/schizo/jsm/schizo_jsm.c create mode 100644 orte/mca/schizo/jsm/schizo_jsm.h create mode 100644 orte/mca/schizo/jsm/schizo_jsm_component.c diff --git a/orte/mca/schizo/jsm/Makefile.am b/orte/mca/schizo/jsm/Makefile.am new file mode 100644 index 00000000000..8cd24aa9519 --- /dev/null +++ b/orte/mca/schizo/jsm/Makefile.am @@ -0,0 +1,37 @@ +# +# Copyright (c) 2016 Intel, Inc. All rights reserved. +# Copyright (c) 2017-2019 IBM Corporation. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +sources = \ + schizo_jsm_component.c \ + schizo_jsm.h \ + schizo_jsm.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_orte_schizo_jsm_DSO +component_noinst = +component_install = mca_schizo_jsm.la +else +component_noinst = libmca_schizo_jsm.la +component_install = +endif + +mcacomponentdir = $(ortelibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_schizo_jsm_la_SOURCES = $(sources) +mca_schizo_jsm_la_LDFLAGS = -module -avoid-version +mca_schizo_jsm_la_LIBADD = $(top_builddir)/orte/lib@ORTE_LIB_PREFIX@open-rte.la + +noinst_LTLIBRARIES = $(component_noinst) +libmca_schizo_jsm_la_SOURCES = $(sources) +libmca_schizo_jsm_la_LDFLAGS = -module -avoid-version + diff --git a/orte/mca/schizo/jsm/configure.m4 b/orte/mca/schizo/jsm/configure.m4 new file mode 100644 index 00000000000..940e5a57c0d --- /dev/null +++ b/orte/mca/schizo/jsm/configure.m4 @@ -0,0 +1,31 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 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) 2009-2010 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2013 Los Alamos National Security, LLC. +# All rights reserved. +# Copyright (c) 2016 Intel, Inc. All rights reserved +# Copyright (c) 2017-2019 IBM Corporation. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_schizo_jsm_CONFIG([action-if-found], [action-if-not-found]) +# ----------------------------------------------------------- +AC_DEFUN([MCA_orte_schizo_jsm_CONFIG],[ + AC_CONFIG_FILES([orte/mca/schizo/jsm/Makefile]) + + # Nothing to do for now. +])dnl diff --git a/orte/mca/schizo/jsm/owner.txt b/orte/mca/schizo/jsm/owner.txt new file mode 100644 index 00000000000..2fd247dddb1 --- /dev/null +++ b/orte/mca/schizo/jsm/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: IBM +status: active diff --git a/orte/mca/schizo/jsm/schizo_jsm.c b/orte/mca/schizo/jsm/schizo_jsm.c new file mode 100644 index 00000000000..57861f13187 --- /dev/null +++ b/orte/mca/schizo/jsm/schizo_jsm.c @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + */ + +#include "orte_config.h" +#include "orte/types.h" +#include "opal/types.h" + +#ifdef HAVE_UNISTD_H +#include +#endif +#include + +#include "opal/util/argv.h" +#include "opal/util/basename.h" +#include "opal/util/opal_environ.h" + +#include "orte/runtime/orte_globals.h" +#include "orte/util/name_fns.h" +#include "orte/mca/schizo/base/base.h" + +#include "schizo_jsm.h" + +static orte_schizo_launch_environ_t check_launch_environment(void); +static void finalize(void); + +orte_schizo_base_module_t orte_schizo_jsm_module = { + .check_launch_environment = check_launch_environment, + .finalize = finalize +}; + +static char **pushed_envs = NULL; +static char **pushed_vals = NULL; +static orte_schizo_launch_environ_t myenv; +static bool myenvdefined = false; + +static orte_schizo_launch_environ_t check_launch_environment(void) +{ + int i; + + if (myenvdefined) { + return myenv; + } + myenvdefined = true; + + /* we were only selected because JSM was detected + * and we are an app, so no need to further check + * that here. Instead, see if we were direct launched + * vs launched via mpirun ('native') */ + if (NULL != orte_process_info.my_daemon_uri) { + /* Use PMI(x) for daemon interactions */ + myenv = ORTE_SCHIZO_NATIVE_LAUNCHED; + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"ess"); + opal_argv_append_nosize(&pushed_vals, "pmi"); + /* mark that we are native */ + opal_argv_append_nosize(&pushed_envs, "ORTE_SCHIZO_DETECTION"); + opal_argv_append_nosize(&pushed_vals, "NATIVE"); + } + else { + /* Use PMI(x) for daemon interactions */ + myenv = ORTE_SCHIZO_DIRECT_LAUNCHED; + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"ess"); + opal_argv_append_nosize(&pushed_vals, "pmi"); + /* mark that we are JSM */ + opal_argv_append_nosize(&pushed_envs, "ORTE_SCHIZO_DETECTION"); + opal_argv_append_nosize(&pushed_vals, "JSM"); + } + + /* We don't support singleton launch by JSM. + * If we did then the logic should be placed here. + */ + + opal_output_verbose(1, orte_schizo_base_framework.framework_output, + "schizo:jsm DECLARED AS %s", orte_schizo_base_print_env(myenv)); + if (NULL != pushed_envs) { + for (i=0; NULL != pushed_envs[i]; i++) { + opal_setenv(pushed_envs[i], pushed_vals[i], true, &environ); + } + } + + return myenv; +} + + +static void finalize(void) +{ + int i; + + if (NULL != pushed_envs) { + for (i=0; NULL != pushed_envs[i]; i++) { + opal_unsetenv(pushed_envs[i], &environ); + } + opal_argv_free(pushed_envs); + opal_argv_free(pushed_vals); + } +} diff --git a/orte/mca/schizo/jsm/schizo_jsm.h b/orte/mca/schizo/jsm/schizo_jsm.h new file mode 100644 index 00000000000..bb239345a04 --- /dev/null +++ b/orte/mca/schizo/jsm/schizo_jsm.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef _MCA_SCHIZO_JSM_H_ +#define _MCA_SCHIZO_JSM_H_ + +#include "orte_config.h" + +#include "orte/types.h" + +#include "opal/mca/base/base.h" +#include "orte/mca/schizo/schizo.h" + + +BEGIN_C_DECLS + +ORTE_MODULE_DECLSPEC extern orte_schizo_base_component_t mca_schizo_jsm_component; +extern orte_schizo_base_module_t orte_schizo_jsm_module; + +END_C_DECLS + +#endif /* MCA_SCHIZO_JSM_H_ */ + diff --git a/orte/mca/schizo/jsm/schizo_jsm_component.c b/orte/mca/schizo/jsm/schizo_jsm_component.c new file mode 100644 index 00000000000..992efed6633 --- /dev/null +++ b/orte/mca/schizo/jsm/schizo_jsm_component.c @@ -0,0 +1,52 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. + * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "orte_config.h" +#include "orte/types.h" +#include "opal/types.h" + +#include "opal/util/show_help.h" + +#include "orte/mca/schizo/schizo.h" +#include "schizo_jsm.h" + +static int component_query(mca_base_module_t **module, int *priority); + +/* + * Struct of function pointers and all that to let us be initialized + */ +orte_schizo_base_component_t mca_schizo_jsm_component = { + .base_version = { + MCA_SCHIZO_BASE_VERSION_1_0_0, + .mca_component_name = "jsm", + MCA_BASE_MAKE_VERSION(component, ORTE_MAJOR_VERSION, ORTE_MINOR_VERSION, + ORTE_RELEASE_VERSION), + .mca_query_component = component_query, + }, + .base_data = { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, +}; + +static int component_query(mca_base_module_t **module, int *priority) +{ + /* disqualify ourselves if we are not under jsm */ + if (NULL == getenv("JSM_JSRUN_PORT")) { + *priority = 0; + *module = NULL; + return OPAL_ERROR; + } + + *module = (mca_base_module_t*)&orte_schizo_jsm_module; + *priority = 80; + return ORTE_SUCCESS; +} From 0864b62e12b492e61aa5be605eec4a93333af7cd Mon Sep 17 00:00:00 2001 From: raafatfeki Date: Fri, 12 Jun 2020 12:57:18 -0400 Subject: [PATCH 578/674] fs/gpfs: Support of GPFS file system Creation of gpfs module under fs component. Signed-off-by: raafatfeki --- config/ompi_check_gpfs.m4 | 69 +++ ompi/mca/common/ompio/common_ompio.h | 3 +- ompi/mca/fs/base/base.h | 3 + ompi/mca/fs/base/fs_base_get_parent_dir.c | 82 +++ ompi/mca/fs/gpfs/Makefile.am | 54 ++ ompi/mca/fs/gpfs/configure.m4 | 45 ++ ompi/mca/fs/gpfs/fs_gpfs.c | 142 ++++++ ompi/mca/fs/gpfs/fs_gpfs.h | 68 +++ ompi/mca/fs/gpfs/fs_gpfs_component.c | 78 +++ ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c | 55 ++ ompi/mca/fs/gpfs/fs_gpfs_file_open.c | 79 +++ ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c | 594 ++++++++++++++++++++++ 12 files changed, 1271 insertions(+), 1 deletion(-) create mode 100644 config/ompi_check_gpfs.m4 create mode 100644 ompi/mca/fs/gpfs/Makefile.am create mode 100644 ompi/mca/fs/gpfs/configure.m4 create mode 100644 ompi/mca/fs/gpfs/fs_gpfs.c create mode 100644 ompi/mca/fs/gpfs/fs_gpfs.h create mode 100644 ompi/mca/fs/gpfs/fs_gpfs_component.c create mode 100644 ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c create mode 100644 ompi/mca/fs/gpfs/fs_gpfs_file_open.c create mode 100644 ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c diff --git a/config/ompi_check_gpfs.m4 b/config/ompi_check_gpfs.m4 new file mode 100644 index 00000000000..3c970847c9d --- /dev/null +++ b/config/ompi_check_gpfs.m4 @@ -0,0 +1,69 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +dnl University Research and Technology +dnl Corporation. All rights reserved. +dnl Copyright (c) 2004-2005 The University of Tennessee and The University +dnl of Tennessee Research Foundation. All rights +dnl reserved. +dnl Copyright (c) 2004-2018 High Performance Computing Center Stuttgart, +dnl University of Stuttgart. All rights reserved. +dnl Copyright (c) 2004-2006 The Regents of the University of California. +dnl All rights reserved. +dnl Copyright (c) 2018 University of Houston. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# OMPI_CHECK_GPFS(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +# check if GPFS support can be found. sets prefix_{CPPFLAGS, +# LDFLAGS, LIBS} as needed and runs action-if-found if there is +# support, otherwise executes action-if-not-found +AC_DEFUN([OMPI_CHECK_GPFS],[ + + check_gpfs_CPPFLAGS= + check_gpfs_LDFLAGS= + check_gpfs_LIBS= + + check_gpfs_save_LIBS="$LIBS" + check_gpfs_save_LDFLAGS="$LDFLAGS" + check_gpfs_save_CPPFLAGS="$CPPFLAGS" + + check_gpfs_configuration="none" + ompi_check_gpfs_happy="yes" + + # Get some configuration information + AC_ARG_WITH([gpfs], + [AC_HELP_STRING([--with-gpfs(=DIR)], + [Build Gpfs support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])]) + OPAL_CHECK_WITHDIR([gpfs], [$with_gpfs], [include/gpfs.h]) + + AS_IF([test "$with_gpfs" = "no"], + [ompi_check_gpfs_happy="no"], + [AS_IF([test -z "$with_gpfs" || test "$with_gpfs" = "yes"], + [ompi_check_gpfs_dir="/usr"], + [ompi_check_gpfs_dir=$with_gpfs]) + + if test -e "$ompi_check_gpfs_dir/lib64" ; then + ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib64" + else + ompi_check_gpfs_libdir="$ompi_check_gpfs_dir/lib" + fi + + # Add correct -I and -L flags + OPAL_CHECK_PACKAGE([$1], [gpfs.h], [gpfs], [gpfs_lib_init], + [], [$ompi_check_gpfs_dir], [$ompi_check_gpfs_libdir], + [ompi_check_gpfs_happy="yes"], + [ompi_check_gpfs_happy="no"]) + ]) + + AS_IF([test "$ompi_check_gpfs_happy" = "yes"], + [$2], + [AS_IF([test ! -z "$with_gpfs" && test "$with_gpfs" != "no"], + [AC_MSG_ERROR([GPFS support requested but not found. Aborting])]) + $3]) +]) diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index a1c195de08c..7e45c19081b 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -106,7 +106,8 @@ enum ompio_fs_type UFS = 1, PVFS2 = 2, LUSTRE = 3, - PLFS = 4 + PLFS = 4, + GPFS = 6 }; typedef struct mca_common_ompio_io_array_t { diff --git a/ompi/mca/fs/base/base.h b/ompi/mca/fs/base/base.h index 5d2a919ec20..de57221cf83 100644 --- a/ompi/mca/fs/base/base.h +++ b/ompi/mca/fs/base/base.h @@ -52,6 +52,9 @@ OMPI_DECLSPEC int mca_fs_base_init_file (struct ompio_file_t *file); OMPI_DECLSPEC int mca_fs_base_get_param (struct ompio_file_t *file, int keyval); OMPI_DECLSPEC void mca_fs_base_get_parent_dir (char *filename, char **dirnamep); OMPI_DECLSPEC int mca_fs_base_get_fstype(char *fname); +OMPI_DECLSPEC int mca_fs_base_get_mpi_err(int errno_val); +OMPI_DECLSPEC int mca_fs_base_get_file_perm(ompio_file_t *fh); +OMPI_DECLSPEC int mca_fs_base_get_file_amode(int rank, int access_mode); OMPI_DECLSPEC int mca_fs_base_file_delete (char* file_name, struct opal_info_t *info); OMPI_DECLSPEC int mca_fs_base_file_sync (ompio_file_t *fh); diff --git a/ompi/mca/fs/base/fs_base_get_parent_dir.c b/ompi/mca/fs/base/fs_base_get_parent_dir.c index bad67cac90f..e3770537852 100644 --- a/ompi/mca/fs/base/fs_base_get_parent_dir.c +++ b/ompi/mca/fs/base/fs_base_get_parent_dir.c @@ -117,8 +117,90 @@ int mca_fs_base_get_fstype(char *fname ) else if ( 0 == strncasecmp(fstype, "pvfs2", sizeof("pvfs2"))) { ompio_type = PVFS2; } + else if ( 0 == strncasecmp(fstype, "gpfs", sizeof("gpfs"))) { + ompio_type = GPFS; + } free (fstype); return ompio_type; } +int mca_fs_base_get_mpi_err(int errno_val) +{ + int ret; + switch (errno_val) { + case EACCES: + ret = MPI_ERR_ACCESS; + break; + case ENAMETOOLONG: + case EISDIR: + ret = MPI_ERR_BAD_FILE; + break; + case ENOENT: + ret = MPI_ERR_NO_SUCH_FILE; + break; + case EROFS: + ret = MPI_ERR_READ_ONLY; + break; + case EEXIST: + ret = MPI_ERR_FILE_EXISTS; + break; + case ENOSPC: + ret = MPI_ERR_NO_SPACE; + break; + case EDQUOT: + ret = MPI_ERR_QUOTA; + break; + case ETXTBSY: + ret = MPI_ERR_FILE_IN_USE; + break; + case EBADF: + ret = MPI_ERR_FILE; + break; + default: + ret = MPI_ERR_OTHER; + break; + } + return ret; +} + +int mca_fs_base_get_file_perm(ompio_file_t *fh) +{ + int old_mask; + int perm = fh->f_perm; + + if (OMPIO_PERM_NULL == perm) { + old_mask = umask(022); + umask(old_mask); + perm = old_mask ^ 0666; + } + return perm; +} + +int mca_fs_base_get_file_amode(int rank, int access_mode) +{ + int amode = 0; + + if (access_mode & MPI_MODE_RDONLY) { + amode = amode | O_RDONLY; + } + if (access_mode & MPI_MODE_WRONLY) { + amode = amode | O_WRONLY; + } + if (access_mode & MPI_MODE_RDWR) { + amode = amode | O_RDWR; + } + + /* MODE_CREATE and MODE_EXCL should only be set by one process */ + if(OMPIO_ROOT == rank) { + if (access_mode & MPI_MODE_CREATE) { + amode = amode | O_CREAT; + } + if (access_mode & MPI_MODE_EXCL) { + amode = amode | O_EXCL; + } + } + + return amode; +} + diff --git a/ompi/mca/fs/gpfs/Makefile.am b/ompi/mca/fs/gpfs/Makefile.am new file mode 100644 index 00000000000..748d868b49b --- /dev/null +++ b/ompi/mca/fs/gpfs/Makefile.am @@ -0,0 +1,54 @@ +# +# Copyright (c) 2004-2005 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) 2008-2011 University of Houston. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_ompi_fs_gpfs_DSO +component_noinst = +component_install = mca_fs_gpfs.la +else +component_noinst = libmca_fs_gpfs.la +component_install = +endif + +# Source files + +fs_gpfs_sources = \ + fs_gpfs_component.c \ + fs_gpfs_file_open.c \ + fs_gpfs_file_set_info.c\ + fs_gpfs_file_get_info.c\ + fs_gpfs.c \ + fs_gpfs.h + +AM_CPPFLAGS = $(fs_gpfs_CPPFLAGS) + +mcacomponentdir = $(pkglibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources) +mca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS) +mca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_fs_gpfs_la_SOURCES = $(fs_gpfs_sources) +libmca_fs_gpfs_la_LIBADD = $(fs_gpfs_LIBS) +libmca_fs_gpfs_la_LDFLAGS = -module -avoid-version $(fs_gpfs_LDFLAGS) + diff --git a/ompi/mca/fs/gpfs/configure.m4 b/ompi/mca/fs/gpfs/configure.m4 new file mode 100644 index 00000000000..a51ae2aee07 --- /dev/null +++ b/ompi/mca/fs/gpfs/configure.m4 @@ -0,0 +1,45 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 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 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2012 University of Houston. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + + +# MCA_fs_gpfs_CONFIG(action-if-can-compile, +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_ompi_fs_gpfs_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/fs/gpfs/Makefile]) + + OMPI_CHECK_GPFS([fs_gpfs], + [fs_gpfs_happy="yes"], + [fs_gpfs_happy="no"]) + + AS_IF([test "$fs_gpfs_happy" = "yes"], + [fs_gpfs_WRAPPER_EXTRA_LDFLAGS="$fs_gpfs_LDFLAGS" + fs_gpfs_WRAPPER_EXTRA_LIBS="$fs_gpfs_LIBS" + $1], + [$2]) + + OPAL_SUMMARY_ADD([[OMPIO File Systems]],[[IBM Spectrum Scale/GPFS]],[$1],[$fs_gpfs_happy]) + + # substitute in the things needed to build gpfs + AC_SUBST([fs_gpfs_CPPFLAGS]) + AC_SUBST([fs_gpfs_LDFLAGS]) + AC_SUBST([fs_gpfs_LIBS]) +])dnl diff --git a/ompi/mca/fs/gpfs/fs_gpfs.c b/ompi/mca/fs/gpfs/fs_gpfs.c new file mode 100644 index 00000000000..99752c6617a --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs.c @@ -0,0 +1,142 @@ +/* + * 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 + * 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) 2008-2018 University of Houston. All rights reserved. + * Copyright (c) 2018 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * These symbols are in a file by themselves to provide nice linker + * semantics. Since linkers generally pull in symbols by object fules, + * keeping these symbols as the only symbols in this file prevents + * utility programs such as "ompi_info" from having to import entire + * modules just to query their version and parameters + */ + +#include "ompi_config.h" +#include "mpi.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/gpfs/fs_gpfs.h" + +#ifdef HAVE_SYS_STATFS_H +#include /* or */ +#endif +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#include + +/* + * ******************************************************************* + * ************************ actions structure ************************ + * ******************************************************************* + */ +static mca_fs_base_module_1_0_0_t gpfs = { + mca_fs_gpfs_module_init, /* initalise after being selected */ + mca_fs_gpfs_module_finalize, /* close a module on a communicator */ + mca_fs_gpfs_file_open, + mca_fs_base_file_close, + mca_fs_base_file_delete, + mca_fs_base_file_set_size, + mca_fs_base_file_get_size, + mca_fs_base_file_sync +}; +/* + * ******************************************************************* + * ************************* structure ends ************************** + * ******************************************************************* + */ + +int mca_fs_gpfs_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads) +{ + /* Nothing to do */ + + return OMPI_SUCCESS; +} + +struct mca_fs_base_module_1_0_0_t * +mca_fs_gpfs_component_file_query (ompio_file_t *fh, int *priority) +{ + char *tmp; + + /* The code in this function is based on the ADIO FS selection in ROMIO + * Copyright (C) 1997 University of Chicago. + * See COPYRIGHT notice in top-level directory. + */ + + *priority = mca_fs_gpfs_priority; + + tmp = strchr (fh->f_filename, ':'); + if (!tmp) { + if (OMPIO_ROOT == fh->f_rank) { + fh->f_fstype = mca_fs_base_get_fstype ( (char *) fh->f_filename ); + } + if (MPI_COMM_NULL != fh->f_comm) { + fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype), + 1, + MPI_INT, + OMPIO_ROOT, + fh->f_comm, + fh->f_comm->c_coll->coll_bcast_module); + } + } + else { + if (!strncmp(fh->f_filename, "gpfs:", 5) || + !strncmp(fh->f_filename, "GPFS:", 5)) { + fh->f_fstype = GPFS; + } + } + + if (GPFS == fh->f_fstype) { + if (*priority < 50) { + *priority = 50; + return &gpfs; + } + } + + return NULL; +} + +int mca_fs_gpfs_component_file_unquery (ompio_file_t *file) +{ + /* This function might be needed for some purposes later. for now it + * does not have anything to do since there are no steps which need + * to be undone if this module is not selected */ + + return OMPI_SUCCESS; +} + +int mca_fs_gpfs_module_init (ompio_file_t *file) +{ + /* Make sure the file type is not overwritten by the last queried + * component */ + file->f_fstype = GPFS; + return OMPI_SUCCESS; +} + + +int mca_fs_gpfs_module_finalize (ompio_file_t *file) +{ + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/gpfs/fs_gpfs.h b/ompi/mca/fs/gpfs/fs_gpfs.h new file mode 100644 index 00000000000..ede11621962 --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs.h @@ -0,0 +1,68 @@ +/* -*- Mode: C; c-basic-offset:4 ; -*- */ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2007 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2015 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) 2008-2012 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_FS_GPFS_H +#define MCA_FS_GPFS_H + +#include "ompi_config.h" +#include "opal/mca/mca.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/io/ompio/io_ompio.h" + +#include + +extern int mca_fs_gpfs_priority; + +BEGIN_C_DECLS + +int mca_fs_gpfs_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads); +struct mca_fs_base_module_1_0_0_t * +mca_fs_gpfs_component_file_query(ompio_file_t *fh, int *priority); +int mca_fs_gpfs_component_file_unquery(ompio_file_t *file); + +int mca_fs_gpfs_module_init(ompio_file_t *file); +int mca_fs_gpfs_module_finalize(ompio_file_t *file); +OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_gpfs_component; + +/* + * ****************************************************************** + * ********* functions which are implemented in this module ********* + * ****************************************************************** + */ + +int mca_fs_gpfs_file_open(struct ompi_communicator_t *comm, const char *filename, + int amode, struct opal_info_t *info, struct ompio_file_t *fh); +int mca_fs_gpfs_file_set_info(struct ompio_file_t *fh, + struct ompi_info_t *info); +int mca_fs_gpfs_file_get_info(struct ompio_file_t *fh, + struct ompi_info_t **info_used); +int mca_fs_gpfs_io_selection(ompio_file_t *fh, + struct ompi_info_t *info, struct ompi_info_t *info_selected); + +/* + * ****************************************************************** + * ************ functions implemented in this module end ************ + * ****************************************************************** + */ + +END_C_DECLS + +#endif /* MCA_FS_GPFS_H */ diff --git a/ompi/mca/fs/gpfs/fs_gpfs_component.c b/ompi/mca/fs/gpfs/fs_gpfs_component.c new file mode 100644 index 00000000000..903e1b18d54 --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs_component.c @@ -0,0 +1,78 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2005 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) 2008-2011 University of Houston. All rights reserved. + * Copyright (c) 2015 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + * + * These symbols are in a file by themselves to provide nice linker + * semantics. Since linkers generally pull in symbols by object + * files, keeping these symbols as the only symbols in this file + * prevents utility programs such as "ompi_info" from having to import + * entire components just to query their version and parameters. + */ + +#include "ompi_config.h" +#include "fs_gpfs.h" +#include "mpi.h" + +/* + * Public string showing the fs gpfs component version number + */ +const char *mca_fs_gpfs_component_version_string = + "OMPI/MPI gpfs FS MCA component version " OMPI_VERSION; + +static int gpfs_register(void); + +int mca_fs_gpfs_priority = 20; +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +mca_fs_base_component_2_0_0_t mca_fs_gpfs_component = { + + /* First, the mca_component_t struct containing meta information + about the component itself */ + + .fsm_version = { + MCA_FS_BASE_VERSION_2_0_0, + + /* Component name and version */ + .mca_component_name = "gpfs", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_register_component_params = gpfs_register, + }, + .fsm_data = { + /* This component is checkpointable */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + .fsm_init_query = mca_fs_gpfs_component_init_query, /* get thread level */ + .fsm_file_query = mca_fs_gpfs_component_file_query, /* get priority and actions */ + .fsm_file_unquery = mca_fs_gpfs_component_file_unquery, /* undo what was done by previous function */ +}; + +static int gpfs_register(void) +{ + mca_fs_gpfs_priority = 20; + (void) mca_base_component_var_register(&mca_fs_gpfs_component.fsm_version, + "priority", "Priority of the gpfs fs component", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, &mca_fs_gpfs_priority); + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c new file mode 100644 index 00000000000..622335d5737 --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_get_info.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2015 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) 2008-2011 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fs_gpfs.h" +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/fs.h" + +#include +#include + +#include +#include +#include +#include + +/* + * file_get_info_gpfs + * + * Function: - get_info of a file + * Accepts: - same arguments as MPI_File_get_info() + * Returns: - new info object + */ + +int mca_fs_gpfs_file_get_info(ompio_file_t *fh, + ompi_info_t **info_used) +{ + int ret = OMPI_SUCCESS; + + *info_used = OBJ_NEW(ompi_info_t); + if (NULL == *info_used) { + return OMPI_ERR_OUT_OF_RESOURCE; + } + + ret = ompi_info_dup ((ompi_info_t *)fh->f_info, info_used); + + return ret; +} diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_open.c b/ompi/mca/fs/gpfs/fs_gpfs_file_open.c new file mode 100644 index 00000000000..497bc402f7a --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_open.c @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2004-2005 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-2015 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) 2008-2012 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/communicator/communicator.h" +#include "ompi/info/info.h" +#include "ompi/file/file.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fcoll/fcoll.h" +#include "ompi/mca/fcoll/base/base.h" +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/fbtl/base/base.h" +#include "fs_gpfs.h" + +#include +#include + +#include +#include +#include +#include +#include + +int +mca_fs_gpfs_file_open (struct ompi_communicator_t *comm, + const char* filename, + int access_mode, + struct opal_info_t *info, + ompio_file_t *fh) +{ + int perm, amode; + int ret = OMPI_SUCCESS; + + perm = mca_fs_base_get_file_perm(fh); + amode = mca_fs_base_get_file_amode(fh->f_rank, access_mode); + + if(OMPIO_ROOT == fh->f_rank) { + fh->fd = open (filename, amode, perm); + if ( 0 > fh->fd ) { + ret = mca_fs_base_get_mpi_err(errno); + } + } + + comm->c_coll->coll_bcast ( &ret, 1, MPI_INT, 0, comm, comm->c_coll->coll_bcast_module); + if ( OMPI_SUCCESS != ret ) { + fh->fd = -1; + return ret; + } + + if (OMPIO_ROOT != fh->f_rank) { + fh->fd = open (filename, amode, perm); + if ( 0 > fh->fd) { + return mca_fs_base_get_mpi_err(errno); + } + } + + fh->f_amode=access_mode; + mca_fs_gpfs_file_set_info(fh, (struct ompi_info_t *) info); + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c new file mode 100644 index 00000000000..f9e04fdc8c3 --- /dev/null +++ b/ompi/mca/fs/gpfs/fs_gpfs_file_set_info.c @@ -0,0 +1,594 @@ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2011 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2015 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) 2008-2011 University of Houston. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fs_gpfs.h" +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" + +#include +#include + +#include +#include +#include +#include + +/* + * file_set_info_gpfs + * + * Function: - set_info of a file + * Accepts: - same arguments as MPI_File_set_info() + * Returns: - Success if info is set + */ + +int mca_fs_gpfs_file_set_info(ompio_file_t *fh, struct ompi_info_t *info) +{ + int rc = 0; + int flag; + int valueLen = MPI_MAX_INFO_VAL; + char value[MPI_MAX_INFO_VAL + 1]; + char gpfsHintsKey[50]; + const char* split = ","; + char* token; + int ret = OMPI_SUCCESS; + ompi_info_t *info_selected; + info_selected = info; + gpfs_file_t gpfs_file_handle = fh->fd; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsAccessRange_t gpfsAccessRange; + } gpfs_hint_AccessRange; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsFreeRange_t gpfsFreeRange; + } gpfs_hint_FreeRange; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsClearFileCache_t gpfsClearFileCache; + } gpfs_hint_ClearFileCache; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsCancelHints_t gpfsCancelHints; + } gpfs_hint_CancelHints; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsSetReplication_t gpfsSetReplication; + } gpfs_hint_SetReplication; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsByteRange_t gpfsByteRange; + } gpfs_hint_ByteRange; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsRestripeData_t gpfsRestripeData; + } gpfs_hint_RestripeData; + + //CN: TODO: Implement the following currently unused GPFS hints + /* + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsRestripeRange_t gpfsRestripeRange; + } gpfs_hint_RestripeRange; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetReplication_t gpfsGetReplication; + } gpfs_hint_GetReplication; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetStoragePool_t gpfsGetStoragePool; + } gpfs_hint_GetStoragePool; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetFilesetName_t gpfsGetFilesetName; + } gpfs_hint_GetFilesetName; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetSnapshotName_t gpfsGetSnapshotName; + } gpfs_hint_GetSnapshotName; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsSetImmutable_t gpfsSetImmutable; + } gpfs_hint_SetImmutable; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetImmutable_t gpfsGetImmutable; + } gpfs_hint_GetImmutable; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsSetExpTime_t gpfsSetExpTime; + } gpfs_hint_SetExpTime; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetExpTime_t gpfsGetExpTime; + } gpfs_hint_GetExpTime; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsSetAppendOnly_t gpfsSetAppendOnly; + } gpfs_hint_SetAppendOnly; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsGetAppendOnly_t gpfsGetAppendOnly; + } gpfs_hint_GetAppendOnly; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsSetStoragePool_t gpfsSetStoragePool; + } gpfs_hint_SetStoragePool; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsRangeArray_t gpfsRangeArray; + } gpfs_hint_RangeArray; + + struct { + gpfsFcntlHeader_t gpfsFcntlHeader; + gpfsMultipleAccessRange_t gpfsMultipleAccessRange; + } gpfs_hint_MultipleAccessRange; + */ + + strcpy(gpfsHintsKey, "useSIOXLib"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + if(strcmp(value, "true") == 0) { + //using the SIOX lib and the I/O pattern selection + ret = mca_fs_gpfs_io_selection(fh, info, info_selected); + if (ret != OMPI_SUCCESS) + return ret; + } + else { + //CN: Is there something left to do here? + //TODO Sending the MPI_INFO to SIOX for knowledgebase + } + } + + //Setting GPFS Hint - gpfsAccessRange + strcpy(gpfsHintsKey, "gpfsAccessRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Access Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_AccessRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_AccessRange); + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_AccessRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_AccessRange.gpfsAccessRange.structLen = + sizeof(gpfs_hint_AccessRange.gpfsAccessRange); + gpfs_hint_AccessRange.gpfsAccessRange.structType = GPFS_ACCESS_RANGE; + token = strtok(value, split); + gpfs_hint_AccessRange.gpfsAccessRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.length = atol(token); + token = strtok(NULL, split); + gpfs_hint_AccessRange.gpfsAccessRange.isWrite = atoi(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_AccessRange); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_AccessRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsFreeRange + strcpy(gpfsHintsKey, "gpfsFreeRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Free Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_FreeRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_FreeRange); + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_FreeRange.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_FreeRange.gpfsFreeRange.structLen = + sizeof(gpfs_hint_FreeRange.gpfsFreeRange); + gpfs_hint_FreeRange.gpfsFreeRange.structType = GPFS_FREE_RANGE; + token = strtok(value, split); + gpfs_hint_FreeRange.gpfsFreeRange.start = atol(token); + token = strtok(NULL, split); + gpfs_hint_FreeRange.gpfsFreeRange.length = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_FreeRange); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_FreeRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRangeArray + //Setting GPFS Hint - gpfsMultipleAccessRange + + //Setting GPFS Hint - gpfsClearFileCache + strcpy(gpfsHintsKey, "gpfsClearFileCache"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & (strcmp(value, "true") == 0)) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Clear File Cache is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ClearFileCache); + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ClearFileCache.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_ClearFileCache.gpfsClearFileCache.structLen = + sizeof(gpfs_hint_ClearFileCache.gpfsClearFileCache); + gpfs_hint_ClearFileCache.gpfsClearFileCache.structType = GPFS_CLEAR_FILE_CACHE; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ClearFileCache); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_ClearFileCache gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsCancelHints + strcpy(gpfsHintsKey, "gpfsCancelHints"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag & (strcmp(value, "true") == 0)) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Cancel Hints is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_CancelHints.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_CancelHints); + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_CancelHints.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_CancelHints.gpfsCancelHints.structLen = + sizeof(gpfs_hint_CancelHints.gpfsCancelHints); + gpfs_hint_CancelHints.gpfsCancelHints.structType = GPFS_CANCEL_HINTS; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_CancelHints); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_CancelHints gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsSetReplication + strcpy(gpfsHintsKey, "gpfsSetReplication"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Set Replication is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_SetReplication.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_SetReplication); + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_SetReplication.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_SetReplication.gpfsSetReplication.structLen = + sizeof(gpfs_hint_SetReplication.gpfsSetReplication); + gpfs_hint_SetReplication.gpfsSetReplication.structType = GPFS_FCNTL_SET_REPLICATION; + token = strtok(value, split); + gpfs_hint_SetReplication.gpfsSetReplication.metadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxMetadataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.dataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.maxDataReplicas = atoi(token); + gpfs_hint_SetReplication.gpfsSetReplication.reserved = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_SetReplication); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_SetReplication gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsSetStoragePool + + //Setting GPFS Hint - gpfsByteRange + strcpy(gpfsHintsKey, "gpfsByteRange"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Byte Range is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_ByteRange.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_ByteRange); + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_ByteRange.gpfsFcntlHeader.fcntlReserved = 0; + + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.startOffset = atol(token); + token = strtok(value, split); + gpfs_hint_ByteRange.gpfsByteRange.numOfBlks = atol(token); + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_ByteRange); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_ByteRange gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //Setting GPFS Hint - gpfsRestripeData + strcpy(gpfsHintsKey, "gpfsRestripeData"); + ompi_info_get(info_selected, gpfsHintsKey, valueLen, value, &flag); + if (flag) { + opal_output(ompi_fs_base_framework.framework_output, + "GPFS Restripe Data is set: %s: %s\n", gpfsHintsKey, value); + gpfs_hint_RestripeData.gpfsFcntlHeader.totalLength = sizeof(gpfs_hint_RestripeData); + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlVersion = GPFS_FCNTL_CURRENT_VERSION; + gpfs_hint_RestripeData.gpfsFcntlHeader.fcntlReserved = 0; + + gpfs_hint_RestripeData.gpfsRestripeData.structLen = + sizeof(gpfs_hint_RestripeData.gpfsRestripeData); + gpfs_hint_RestripeData.gpfsRestripeData.structType = GPFS_FCNTL_RESTRIPE_DATA; + token = strtok(value, split); + gpfs_hint_RestripeData.gpfsRestripeData.options = atoi(token); + gpfs_hint_RestripeData.gpfsRestripeData.reserved1 = 0; + gpfs_hint_RestripeData.gpfsRestripeData.reserved2 = 0; + + rc = gpfs_fcntl(gpfs_file_handle, &gpfs_hint_RestripeData); + if (rc != 0) { + rc = errno; + opal_output(ompi_fs_base_framework.framework_output, + "gpfs_hint_RestripeData gpfs_fcntl(file handle: %d): Error number is %d, %s\n", + gpfs_file_handle, rc, strerror(rc)); + ret = OMPI_ERROR; + } + } + + //CN: TODO + //Setting GPFS Hint - gpfsRestripeRange + //Setting GPFS Hint - gpfsGetReplication + //Setting GPFS Hint - gpfsGetStoragePool + //Setting GPFS Hint - gpfsGetFilesetName + //Setting GPFS Hint - gpfsGetSnapshotName + //Setting GPFS Hint - gpfsSetImmutable + //Setting GPFS Hint - gpfsGetImmutable + //Setting GPFS Hint - gpfsSetExpTime + //Setting GPFS Hint - gpfsGetExpTime + //Setting GPFS Hint - gpfsSetAppendOnly + //Setting GPFS Hint - gpfsGetAppendOnly + + return ret; +} + +//CN: Will this function set info keys with siox prefix? +//CN: Where shall the knowledge of the optimization of GPFS hints go? Into Open MPI or into SIOX? +//CN: Never ever exit! Open MPI requires error propagation. +int mca_fs_gpfs_io_selection(ompio_file_t *fh, + struct ompi_info_t *info, struct ompi_info_t *info_selected) { + +//CN: configure option to enable/disable SIOX support? +#ifdef HAVE_C_SIOX_H + char value[MPI_MAX_INFO_VAL + 1], sioxHintsKey[50], optimal_value_str[MPI_MAX_INFO_VAL + 1]; + int rc = 0, valueLen = MPI_MAX_INFO_VAL, flag; + //START SIOX initialization + if (siox_gpfs_uiid == SIOX_INVALID_ID){ + siox_gpfs_uiid = siox_system_information_lookup_interface_id("MPI", + "Generic"); + if (!siox_component_is_registered(siox_gpfs_uiid)){ + fprintf(stderr, "SIOX Component MPI Generic is NOT registered!\n"); + siox_gpfs_component = siox_component_register(siox_gpfs_uiid, "GPFS"); + } + siox_gpfs_component_activity = siox_component_register_activity( + siox_gpfs_uiid, "MPI_File_open"); + } + //DEBUG: fprintf(stderr, "Beginning the SIOX_activity in mca_fs_gpfs_siox_io_selection()\n"); + + fh->f_siox_component = siox_gpfs_component; + fh->f_siox_activity = siox_activity_begin(siox_gpfs_component, + siox_gpfs_component_activity); + siox_activity_start(fh->f_siox_activity); + //END SIOX initialization + + info_selected = info; + + //DEBUG: fprintf(stderr, "Starting setting the SIOX_activity_attribute\n"); +//CN: Why we need all attributes as an dynamic array? +//CN: Only one element used at a time to be added to mpi_info object at a time + siox_attribute **siox_attribute_array; + //START Registering the SIOX activities' attributes + //Make sure how many SIOX activities' attributes should be registered + int i = 0; + int number_of_info = opal_list_get_size(&(info_selected->super)); + //DEBUG: fprintf(stderr, "The size of number_of_info is: %d\n", number_of_info); + +//CN: Why we need all attributes as an dynamic array? +//CN: Where is the corresponding free? + siox_attribute_array = (siox_attribute **) malloc( + sizeof(siox_attribute*) * number_of_info); + if (siox_attribute_array == 0) { + //DEBUG: fprintf(stderr, "assign siox_attribute_array fail, out of memory!\n"); + return OMPI_ERROR; + } + //END Registering the SIOX activities' attributes + // Setting the fileNameAttribute + siox_attribute_array[i] = siox_ontology_register_attribute("MPI", + "descriptor/filename", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], fh->f_filename); + i++; + +//CN: Code duplication en mass (9 times same code block wich changing key!) +//CN: do this with a loop over a list of sioxHintsKeys + //START setting the siox activity attributes + strcpy(sioxHintsKey, "sioxAccessRange"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + printf("Setting sioxAccessRange hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxAccessRange", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + printf("Getting optimal value of sioxAccessRange hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxFreeRange"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxFreeRange hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxFreeRange", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxFreeRange hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxClearFileCache"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxClearFileCache hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxClearFileCache", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + printf("Getting optimal value of sioxClearFileCache hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxCancelHints"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxCancelHints hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxCancelHints", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxCancelHints hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxDataShipStart"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxDataShipStart hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxDataShipStart", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + printf("Getting optimal value of sioxDataShipStart hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxDataShipStop"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + printf("Setting sioxDataShipStop hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxDataShipStop", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxDataShipStop hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxSetReplication"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxSetReplication hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxSetReplication", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxSetReplication hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxByteRange"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxByteRange hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxByteRange", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxByteRange hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + strcpy(sioxHintsKey, "sioxRestripeData"); + ompi_info_get(info_selected, sioxHintsKey, valueLen, value, &flag); + if (flag) { + //DEBUG: fprintf(stderr, "Setting sioxRestripeData hints to SIOX activity attribute.\n"); + siox_attribute_array[i] = siox_ontology_register_attribute("GPFS", + "sioxRestripeData", SIOX_STORAGE_STRING); + siox_activity_set_attribute(fh->f_siox_activity, + siox_attribute_array[i], &value); + if(siox_suggest_optimal_value_for_str(fh->f_siox_component, siox_attribute_array[i], fh->f_siox_activity, optimal_value_str, valueLen)) { + //DEBUG: fprintf(stderr, "Getting optimal value of sioxRestripeData hints from SIOX: %s \n", optimal_value_str); + ompi_info_set(info_selected, sioxHintsKey, optimal_value_str); + } + i++; + } + + //DEBUG: fprintf(stderr, "Stopping and ending the SIOX activity in mca_fs_gpfs_siox_io_selection()\n"); + siox_activity_stop(fh->f_siox_activity); + siox_activity_end(fh->f_siox_activity); +#else + info_selected = info; +#endif /* HAVE_C_SIOX_H */ + return OMPI_SUCCESS; +} From 020e9e4627841f19f21d6f5a46048e3555d6a302 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sun, 14 Jun 2020 11:37:28 -0700 Subject: [PATCH 579/674] mpi.h.in: fixups for static assert messages 1. __STDC_VERSION__ isn't necessarily defined (e.g., by C++ compilers). So check to make sure it is defined before we actually check the value. 2. If we're in C++11 (or later), use static_assert(). 3. Split the static assert macro in two macros: * THIS_SYMBOL_WAS_REMOVED_IN_MPI30(...): Insert a valid expression (i.e., 0, because it's only used with MPI_Datatype values, and since MPI_Datatype is a pointer, 0 is a valid RHS expression) before invoking the static assert so that we don't get a syntax error instead of the actual static assert error. * THIS_FUNCTION_WAS_REMOVED_IN_MPI30(...): No need for the valid expression; just invoke the assert functionality. Also remove an errant "\". Thanks to Constantine Khrulev and Martin Audet for identifying the issue and suggesting to use C11's static_assert(). Signed-off-by: Jeff Squyres (cherry picked from commit 835f8f1834b8798a23ee0db6ad94315e30cb9be3) --- ompi/include/mpi.h.in | 56 ++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 9a8c4877f63..469e7d6dd6d 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007-2019 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009-2012 Oak Rigde National Laboratory. All rights reserved. * Copyright (c) 2011 Sandia National Laboratories. All rights reserved. @@ -290,11 +290,12 @@ * just emit a compiletime warning (via the deprecation function * attribute) that they're using an MPI1 removed function. * - * Otherwise, we'd like to issue a fatal error directing the user - * that they've used an MPI1 removed function. If the user's - * compiler supports C11 _Static_assert feature, we #define - * the MPI routines to instead be a call to _Static_assert - * with an appropreate message suggesting the new MPI3 equivalent. + * Otherwise, we'd like to issue a fatal error directing the + * user that they've used an MPI1 removed function. If the + * user's compiler supports C11 _Static_assert() or + * C++11 static_assert(), we #define the MPI routines to + * instead be a call to an assert with an appropriate message + * suggesting the new MPI3 equivalent. * * Otherwise, if the user's compiler supports the error function * attribute, define the MPI routines with that error attribute. @@ -312,13 +313,27 @@ # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 # define OMPI_REMOVED_USE_STATIC_ASSERT 0 # define __mpi_interface_removed__(func, newfunc) __mpi_interface_deprecated__(#func " was removed in MPI-3.0. Use " #newfunc " instead. continuing...") -# elif (__STDC_VERSION__ >= 201112L) +# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) + /* This is the C11 (or later) case, which uses + _Static_assert() */ # define OMPI_OMIT_MPI1_COMPAT_DECLS 1 # define OMPI_REMOVED_USE_STATIC_ASSERT 1 // This macro definition may show up in compiler output. So we both // outdent it back to column 0 and give it a user-friendly name to // help users grok what we are trying to tell them here. -#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") +#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, new_symbol) 0; _Static_assert(0, #symbol " was removed in MPI-3.0. Use " #new_symbol " instead.") +#define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") +# elif defined(__cplusplus) && (__cplusplus >= 201103L) + /* This is the C++11 (or later) case, which uses + static_assert() */ +# define OMPI_OMIT_MPI1_COMPAT_DECLS 1 +# define OMPI_REMOVED_USE_STATIC_ASSERT 1 +/* This macro definition may show up in compiler output. So we both + * outdent it back to column 0 and give it a user-friendly name to + * help users grok what we are trying to tell them here. + */ +#define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, new_symbol) 0; static_assert(0, #symbol " was removed in MPI-3.0. Use " #new_symbol " instead.") +#define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") # elif OPAL_HAVE_ATTRIBUTE_ERROR # define OMPI_OMIT_MPI1_COMPAT_DECLS 0 # define OMPI_REMOVED_USE_STATIC_ASSERT 0 @@ -344,7 +359,10 @@ #endif #if !defined(THIS_SYMBOL_WAS_REMOVED_IN_MPI30) -# define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(func, newfunc) +# define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, newsymbol) +#endif +#if !defined(THIS_FUNCTION_WAS_REMOVED_IN_MPI30) +# define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) #endif #if !defined(OMPI_REMOVED_USE_STATIC_ASSERT) @@ -2838,16 +2856,16 @@ OMPI_DECLSPEC int PMPI_Type_ub(MPI_Datatype mtype, MPI_Aint *ub) #endif /* !OMPI_OMIT_MPI1_COMPAT_DECLS */ #if OMPI_REMOVED_USE_STATIC_ASSERT -#define MPI_Address(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Address, MPI_Get_address) -#define MPI_Errhandler_create(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_create, MPI_Comm_create_errhandler) -#define MPI_Errhandler_get(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_get, MPI_Comm_get_errhandler) -#define MPI_Errhandler_set(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Errhandler_set, MPI_Comm_set_errhandler) -#define MPI_Type_extent(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_extent, MPI_Type_get_extent) -#define MPI_Type_hindexed(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hindexed, MPI_Type_create_hindexed) -#define MPI_Type_hvector(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_hvector, MPI_Type_create_hvector) -#define MPI_Type_lb(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_lb, MPI_Type_get_extent) -#define MPI_Type_struct(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_struct, MPI_Type_create_struct) -#define MPI_Type_ub(...) THIS_SYMBOL_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) +#define MPI_Address(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Address, MPI_Get_address) +#define MPI_Errhandler_create(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_create, MPI_Comm_create_errhandler) +#define MPI_Errhandler_get(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_get, MPI_Comm_get_errhandler) +#define MPI_Errhandler_set(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Errhandler_set, MPI_Comm_set_errhandler) +#define MPI_Type_extent(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_extent, MPI_Type_get_extent) +#define MPI_Type_hindexed(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_hindexed, MPI_Type_create_hindexed) +#define MPI_Type_hvector(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_hvector, MPI_Type_create_hvector) +#define MPI_Type_lb(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_lb, MPI_Type_get_extent) +#define MPI_Type_struct(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_struct, MPI_Type_create_struct) +#define MPI_Type_ub(...) THIS_FUNCTION_WAS_REMOVED_IN_MPI30(MPI_Type_ub, MPI_Type_get_extent) #endif #if defined(c_plusplus) || defined(__cplusplus) From 5179f801656758792a67ecc92fac81dd8168c862 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 15 Jun 2020 12:56:51 -0700 Subject: [PATCH 580/674] mpi.h.in: Remove //-style comments Keep all comments in the user-facing mpi.h.in as "old style" C comments: /* */. This gives us maximum portability, just on the off chance that a user's C compiler does not support //-style comments. Signed-off-by: Jeff Squyres (cherry picked from commit d522c270373264aff0a7a2066bc3163b09e9a94b) --- ompi/include/mpi.h.in | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 469e7d6dd6d..3e7fe32aeff 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -318,9 +318,10 @@ _Static_assert() */ # define OMPI_OMIT_MPI1_COMPAT_DECLS 1 # define OMPI_REMOVED_USE_STATIC_ASSERT 1 -// This macro definition may show up in compiler output. So we both -// outdent it back to column 0 and give it a user-friendly name to -// help users grok what we are trying to tell them here. +/* This macro definition may show up in compiler output. So we both + * outdent it back to column 0 and give it a user-friendly name to + * help users grok what we are trying to tell them here. + */ #define THIS_SYMBOL_WAS_REMOVED_IN_MPI30(symbol, new_symbol) 0; _Static_assert(0, #symbol " was removed in MPI-3.0. Use " #new_symbol " instead.") #define THIS_FUNCTION_WAS_REMOVED_IN_MPI30(func, newfunc) _Static_assert(0, #func " was removed in MPI-3.0. Use " #newfunc " instead.") # elif defined(__cplusplus) && (__cplusplus >= 201103L) From d52b64c4888dec059c4c7d5ac0e322d304641829 Mon Sep 17 00:00:00 2001 From: Sergey Oblomov Date: Fri, 5 Jun 2020 15:26:14 +0300 Subject: [PATCH 581/674] COMMON/UCX: improved missing events test - there is new API to detect missing memmory events. Enabled using of new UCX API to detect missing events Signed-off-by: Sergey Oblomov (cherry picked from commit d6bff6ffbd70cfafacc3eefe592f900dc2e0be68) --- config/ompi_check_ucx.m4 | 3 ++- opal/mca/common/ucx/common_ucx.c | 36 +++++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/config/ompi_check_ucx.m4 b/config/ompi_check_ucx.m4 index 667cc985a43..6ad07905b6c 100644 --- a/config/ompi_check_ucx.m4 +++ b/config/ompi_check_ucx.m4 @@ -112,7 +112,8 @@ AC_DEFUN([OMPI_CHECK_UCX],[ ucp_request_check_status, ucp_put_nb, ucp_get_nb], [], [], [#include ]) - AC_CHECK_DECLS([ucm_test_events], + AC_CHECK_DECLS([ucm_test_events, + ucm_test_external_events], [], [], [#include ]) AC_CHECK_DECLS([UCP_ATOMIC_POST_OP_AND, diff --git a/opal/mca/common/ucx/common_ucx.c b/opal/mca/common/ucx/common_ucx.c index bf5d6c04943..ae8e66877ab 100644 --- a/opal/mca/common/ucx/common_ucx.c +++ b/opal/mca/common/ucx/common_ucx.c @@ -132,24 +132,46 @@ static void opal_common_ucx_mca_fence_complete_cb(int status, void *fenced) *(int*)fenced = 1; } -void opal_common_ucx_mca_proc_added(void) -{ #if HAVE_DECL_UCM_TEST_EVENTS +static ucs_status_t opal_common_ucx_mca_test_external_events(int events) +{ +#if HAVE_DECL_UCM_TEST_EXTERNAL_EVENTS + return ucm_test_external_events(UCM_EVENT_VM_UNMAPPED); +#else + return ucm_test_events(UCM_EVENT_VM_UNMAPPED); +#endif +} + +static void opal_common_ucx_mca_test_events(void) +{ static int warned = 0; - static char *mem_hooks_suggestion = "Pls try adding --mca opal_common_ucx_opal_mem_hooks 1 " - "to mpirun/oshrun command line to resolve this issue."; + const char *suggestion; ucs_status_t status; if (!warned) { - status = ucm_test_events(UCM_EVENT_VM_UNMAPPED); + if (opal_common_ucx.opal_mem_hooks) { + suggestion = "Please check OPAL memory events infrastructure."; + status = opal_common_ucx_mca_test_external_events(UCM_EVENT_VM_UNMAPPED); + } else { + suggestion = "Pls try adding --mca opal_common_ucx_opal_mem_hooks 1 " + "to mpirun/oshrun command line to resolve this issue."; + status = ucm_test_events(UCM_EVENT_VM_UNMAPPED); + } + if (status != UCS_OK) { MCA_COMMON_UCX_WARN("UCX is unable to handle VM_UNMAP event. " "This may cause performance degradation or data " - "corruption. %s", - opal_common_ucx.opal_mem_hooks ? "" : mem_hooks_suggestion); + "corruption. %s", suggestion); warned = 1; } } +} +#endif + +void opal_common_ucx_mca_proc_added(void) +{ +#if HAVE_DECL_UCM_TEST_EVENTS + opal_common_ucx_mca_test_events(); #endif } From eeee011ac0470eb1f31e23157ae35335e721c60c Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 15 Jun 2020 09:17:44 -0500 Subject: [PATCH 582/674] common/ompio: use avg. file view size in the aggregator selection logic This is a fix based on a bugreport on github/mailing list from CGNS. The core of the problem was that different processes entered different branches of our aggregator selection logic, due to the fact that in some cases processes had a matching file_view size and contiguous chunk size (thus assuming 1-D distribution), and some processes did not (thus assuming 2-D distribution). The fix is to calculate the avg. file view size across all processes and use this value, thus ensuring that all processes enter the same branch. Fixes issue #7809 Signed-off-by: Edgar Gabriel (cherry picked from commit 4a8a330bbaf9fe5ea07cd01146afb83b569f3138) --- ompi/mca/common/ompio/common_ompio.h | 3 +- .../common/ompio/common_ompio_aggregators.c | 2 +- .../mca/common/ompio/common_ompio_file_view.c | 50 +++---------------- 3 files changed, 9 insertions(+), 46 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index a1c195de08c..fdea7a9e526 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2008-2020 University of Houston. All rights reserved. * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2018 DataDirect Networks. All rights reserved. @@ -165,6 +165,7 @@ struct ompio_file_t { size_t f_stripe_size; int f_stripe_count; size_t f_cc_size; + size_t f_avg_view_size; int f_bytes_per_agg; enum ompio_fs_type f_fstype; ompi_request_t *f_split_coll_req; diff --git a/ompi/mca/common/ompio/common_ompio_aggregators.c b/ompi/mca/common/ompio/common_ompio_aggregators.c index fdde4dee96f..a063bea41f7 100644 --- a/ompi/mca/common/ompio/common_ompio_aggregators.c +++ b/ompi/mca/common/ompio/common_ompio_aggregators.c @@ -107,7 +107,7 @@ int mca_common_ompio_simple_grouping(ompio_file_t *fh, /* Determine whether to use the formula for 1-D or 2-D data decomposition. Anything ** that is not 1-D is assumed to be 2-D in this version */ - mode = ( fh->f_cc_size == fh->f_view_size ) ? 1 : 2; + mode = ( fh->f_cc_size == fh->f_avg_view_size ) ? 1 : 2; /* Determine the increment size when searching the optimal ** no. of aggregators diff --git a/ompi/mca/common/ompio/common_ompio_file_view.c b/ompi/mca/common/ompio/common_ompio_file_view.c index bf8a25345b8..684f67ce99d 100644 --- a/ompi/mca/common/ompio/common_ompio_file_view.c +++ b/ompi/mca/common/ompio/common_ompio_file_view.c @@ -328,36 +328,28 @@ int mca_common_ompio_set_view (ompio_file_t *fh, OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag) { - int uniform = 0; OMPI_MPI_OFFSET_TYPE avg[3] = {0,0,0}; OMPI_MPI_OFFSET_TYPE global_avg[3] = {0,0,0}; int i = 0; - /* This function does two things: first, it determines the average data chunk - ** size in the file view for each process and across all processes. - ** Second, it establishes whether the view across all processes is uniform. - ** By definition, uniform means: - ** 1. the file view of each process has the same number of contiguous sections - ** 2. each section in the file view has exactly the same size + /* This function determines the average data chunk + ** size in the file view for each process and across all processes, + ** and the avg. file_view size across processes. */ if ( flag ) { global_avg[0] = MCA_IO_DEFAULT_FILE_VIEW_SIZE; + fh->f_avg_view_size = fh->f_view_size; } else { for (i=0 ; i<(int)fh->f_iov_count ; i++) { avg[0] += fh->f_decoded_iov[i].iov_len; - if (i && 0 == uniform) { - if (fh->f_decoded_iov[i].iov_len != fh->f_decoded_iov[i-1].iov_len) { - uniform = 1; - } - } } if ( 0 != fh->f_iov_count ) { avg[0] = avg[0]/fh->f_iov_count; } avg[1] = (OMPI_MPI_OFFSET_TYPE) fh->f_iov_count; - avg[2] = (OMPI_MPI_OFFSET_TYPE) uniform; + avg[2] = (OMPI_MPI_OFFSET_TYPE) fh->f_view_size; fh->f_comm->c_coll->coll_allreduce (avg, global_avg, @@ -368,37 +360,7 @@ OMPI_MPI_OFFSET_TYPE get_contiguous_chunk_size (ompio_file_t *fh, int flag) fh->f_comm->c_coll->coll_allreduce_module); global_avg[0] = global_avg[0]/fh->f_size; global_avg[1] = global_avg[1]/fh->f_size; - -#if 0 - /* Disabling the feature since we are not using it anyway. Saves us one allreduce operation. */ - int global_uniform=0; - - if ( global_avg[0] == avg[0] && - global_avg[1] == avg[1] && - 0 == avg[2] && - 0 == global_avg[2] ) { - uniform = 0; - } - else { - uniform = 1; - } - - /* second confirmation round to see whether all processes agree - ** on having a uniform file view or not - */ - fh->f_comm->c_coll->coll_allreduce (&uniform, - &global_uniform, - 1, - MPI_INT, - MPI_MAX, - fh->f_comm, - fh->f_comm->c_coll->coll_allreduce_module); - - if ( 0 == global_uniform ){ - /* yes, everybody agrees on having a uniform file view */ - fh->f_flags |= OMPIO_UNIFORM_FVIEW; - } -#endif + fh->f_avg_view_size = global_avg[2]/fh->f_size; } return global_avg[0]; From b680893917697107f8f1b3d0274ea7102aa5ba13 Mon Sep 17 00:00:00 2001 From: Michael Heinz Date: Mon, 11 May 2020 13:58:30 -0400 Subject: [PATCH 583/674] Add check for PSM2 reference counting to PSM2 MTL #7721 As discussed, a feature is being added to libpsm2 to correctly handle the case where the library is opened by multiple OMPI transports in the same process. (For example, the OFI BTL and the PSM2 MTL). * Improved error message to indicate required libpsm2 version. * Adds a test at autogen/configure time for the existence of PSM2_LIB_REFCOUNT_CAP. Signed-off-by: Jeff Squyres Signed-off-by: Michael Heinz (cherry picked from commit f10305a49facec8daef24ac81a52207a3f4fb73f) --- config/ompi_check_psm2.m4 | 10 +++++++++- ompi/mca/mtl/psm2/mtl_psm2_component.c | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/config/ompi_check_psm2.m4 b/config/ompi_check_psm2.m4 index 58a7dd0c626..23157ec88de 100644 --- a/config/ompi_check_psm2.m4 +++ b/config/ompi_check_psm2.m4 @@ -76,7 +76,15 @@ AC_DEFUN([OMPI_CHECK_PSM2],[ [AC_MSG_WARN([glob.h not found. Can not build component.]) ompi_check_psm2_happy="no"])]) - OPAL_SUMMARY_ADD([[Transports]],[[Intel Omnipath (PSM2)]],[$1],[$ompi_check_psm2_happy]) + AS_IF([test "$ompi_check_psm2_happy" = "yes"], + [AC_CHECK_DECL([PSM2_LIB_REFCOUNT_CAP], + [], + [AC_MSG_WARN([PSM2 needs to be version 11.2.173 or later. Disabling MTL.]) + ompi_check_psm2_happy="no"], + [#include ]) + ]) + + OPAL_SUMMARY_ADD([[Transports]],[[Intel Omnipath (PSM2)]],[$1],[$ompi_check_psm2_happy]) fi AS_IF([test "$ompi_check_psm2_happy" = "yes"], diff --git a/ompi/mca/mtl/psm2/mtl_psm2_component.c b/ompi/mca/mtl/psm2/mtl_psm2_component.c index 30cb0ed5e77..950fb3e6eb9 100644 --- a/ompi/mca/mtl/psm2/mtl_psm2_component.c +++ b/ompi/mca/mtl/psm2/mtl_psm2_component.c @@ -194,6 +194,18 @@ ompi_mtl_psm2_component_open(void) static int ompi_mtl_psm2_component_query(mca_base_module_t **module, int *priority) { + + /* + * Mixing the PSM2 MTL with the OFI BTL (using PSM2) + * can cause an issue when they both call psm2_finalize + * in older versions of libpsm2. + */ + if (!psm2_get_capability_mask(PSM2_LIB_REFCOUNT_CAP)) { + opal_output_verbose(2, ompi_mtl_base_framework.framework_output, + "This version of the PSM2 MTL needs version 11.2.173 or later of the libpsm2 library for correct operation.\n"); + return OMPI_ERR_FATAL; + } + /* * if we get here it means that PSM2 is available so give high priority */ From 72bdae409d77c0720221cc5722f822d71513e5ca Mon Sep 17 00:00:00 2001 From: Michael Heinz Date: Wed, 3 Jun 2020 11:19:58 -0400 Subject: [PATCH 584/674] Add minimum library version needed to use PSM2 in OMPI #7779 Signed-off-by: Michael Heinz (cherry picked from commit fcabd349e4559ecca990d41e694b151ae3d9be16) --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index bcea81b7611..8413717394b 100644 --- a/README +++ b/README @@ -696,7 +696,7 @@ Network Support - "cm" supports a smaller number of networks (and they cannot be used together), but may provide better overall MPI performance: - - Intel Omni-Path PSM2 + - Intel Omni-Path PSM2 (version 11.2.173 or later) - Intel True Scale PSM (QLogic InfiniPath) - OpenFabrics Interfaces ("libfabric" tag matching) - Portals 4 From 2779a6a96b436fe167512ee7a1bb78336945bfa6 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 17 Jun 2020 10:23:13 -0700 Subject: [PATCH 585/674] tests/asm/run_tests: fix basename usage Looks like this script was left over from quite a long time ago, and was expecting CLI params from the "old"-style Automake test engine. Update it to look for `--test-name` to get the test name, and update a few other minor style things. Signed-off-by: Jeff Squyres (cherry picked from commit e8277d9d0605ee8cd9a6e6b3b63b22526aef9c38) --- test/asm/run_tests | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/asm/run_tests b/test/asm/run_tests index f1cf81ae0f4..8aab7c76f71 100644 --- a/test/asm/run_tests +++ b/test/asm/run_tests @@ -1,26 +1,39 @@ #!/bin/sh +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ retval=-1 +argv=$* -progname="`basename $*`" +set $* +while shift; do + if test "$1" = "--test-name"; then + progname=`basename $2` + break + fi +done echo "--> Testing $progname" for threads in 1 2 4 5 8 ; do - $* $threads + $argv $threads result=$? if test "$result" = "0" ; then echo " - $threads threads: Passed" - if test "$retval" = "-1" ; then + if test $retval -eq -1 ; then retval=0 fi elif test "$result" = "77" ; then echo " - $threads threads: Skipped" - if test "$retval" = "-1" ; then + if test $retval -eq -1 ; then retval=77 fi else echo " - $threads threads: Failed" - retval="$result" + retval=$result fi done From dd4b4b13eddad3d0328ab85ec5db941066a28963 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 27 Mar 2020 10:40:41 -0400 Subject: [PATCH 586/674] .mailmap: Add entry for Harumi Kuno Signed-off-by: Jeff Squyres --- .mailmap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.mailmap b/.mailmap index e8e71435ca9..4ad3e4cbedb 100644 --- a/.mailmap +++ b/.mailmap @@ -111,3 +111,5 @@ Geoffrey Paulsen Anandhi S Jayakumar Mohan Gandhi + +Harumi Kuno From e975c9975c0bc985ccf3566ccab1cd309e4f4d15 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sat, 30 May 2020 17:51:01 +0000 Subject: [PATCH 587/674] Revert "Remove the OFI/BTL component" This reverts commit 192f0f6fff4b4ba0f207054626c935941ff0b5d8. Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/Makefile.am | 62 +++ opal/mca/btl/ofi/README | 88 ++++ opal/mca/btl/ofi/btl_ofi.h | 311 ++++++++++++ opal/mca/btl/ofi/btl_ofi_atomics.c | 192 ++++++++ opal/mca/btl/ofi/btl_ofi_component.c | 681 +++++++++++++++++++++++++++ opal/mca/btl/ofi/btl_ofi_endpoint.c | 343 ++++++++++++++ opal/mca/btl/ofi/btl_ofi_endpoint.h | 75 +++ opal/mca/btl/ofi/btl_ofi_module.c | 329 +++++++++++++ opal/mca/btl/ofi/btl_ofi_rdma.c | 156 ++++++ opal/mca/btl/ofi/btl_ofi_rdma.h | 42 ++ opal/mca/btl/ofi/configure.m4 | 51 ++ opal/mca/btl/ofi/owner.txt | 7 + 12 files changed, 2337 insertions(+) create mode 100644 opal/mca/btl/ofi/Makefile.am create mode 100644 opal/mca/btl/ofi/README create mode 100644 opal/mca/btl/ofi/btl_ofi.h create mode 100644 opal/mca/btl/ofi/btl_ofi_atomics.c create mode 100644 opal/mca/btl/ofi/btl_ofi_component.c create mode 100644 opal/mca/btl/ofi/btl_ofi_endpoint.c create mode 100644 opal/mca/btl/ofi/btl_ofi_endpoint.h create mode 100644 opal/mca/btl/ofi/btl_ofi_module.c create mode 100644 opal/mca/btl/ofi/btl_ofi_rdma.c create mode 100644 opal/mca/btl/ofi/btl_ofi_rdma.h create mode 100644 opal/mca/btl/ofi/configure.m4 create mode 100644 opal/mca/btl/ofi/owner.txt diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am new file mode 100644 index 00000000000..fdaeec865d7 --- /dev/null +++ b/opal/mca/btl/ofi/Makefile.am @@ -0,0 +1,62 @@ +# +# Copyright (c) 2004-2005 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-2009 High Performance Computing Center Stuttgart, +# University of Stuttgart. All rights reserved. +# Copyright (c) 2004-2005 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2013 NVIDIA Corporation. All rights reserved. +# Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2018 Intel, inc. All rights reserved +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +#dist_opaldata_DATA = help-mpi-btl-ofi.txt + +AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) +sources = \ + btl_ofi.h \ + btl_ofi_component.c \ + btl_ofi_endpoint.h \ + btl_ofi_endpoint.c \ + btl_ofi_module.c \ + btl_ofi_rdma.h \ + btl_ofi_rdma.c \ + btl_ofi_atomics.c + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_opal_btl_ofi_DSO +lib = +lib_sources = +component = mca_btl_ofi.la +component_sources = $(sources) +else +lib = libmca_btl_ofi.la +lib_sources = $(sources) +component = +component_sources = +endif + +mcacomponentdir = $(opallibdir) +mcacomponent_LTLIBRARIES = $(component) +mca_btl_ofi_la_SOURCES = $(component_sources) +mca_btl_ofi_la_LDFLAGS = -module -avoid-version \ + $(opal_common_ofi_LDFLAGS) +mca_btl_ofi_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ + $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la + +noinst_LTLIBRARIES = $(lib) +libmca_btl_ofi_la_SOURCES = $(lib_sources) +libmca_btl_ofi_la_LDFLAGS = -module -avoid-version $(opal_common_ofi_LDFLAGS) diff --git a/opal/mca/btl/ofi/README b/opal/mca/btl/ofi/README new file mode 100644 index 00000000000..97e3759830d --- /dev/null +++ b/opal/mca/btl/ofi/README @@ -0,0 +1,88 @@ +======================================== +Design notes on BTL/OFI +======================================== + +This is the RDMA only btl based on OFI Libfabric. The goal is to enable RDMA +with multiple vendor hardware through one interface. Most of the operations are +managed by upper layer (osc/rdma). This BTL is mostly doing the low level work. + +Tested providers: sockets,psm2,ugni + +======================================== + +Component + +This BTL is requesting libfabric version 1.5 API and will not support older versions. + +The required capabilities of this BTL is FI_ATOMIC and FI_RMA with the endpoint type +of FI_EP_RDM only. This BTL does NOT support libfabric provider that requires local +memory registration (FI_MR_LOCAL). + +BTL/OFI will initialize a module with ONLY the first compatible info returned from OFI. +This means it will rely on OFI provider to do load balancing. The support for multiple +device might be added later. + +The BTL creates only one endpoint and one CQ. + +======================================== + +Memory Registration + +Open MPI has a system in place to exchange remote address and always use the remote +virtual address to refer to a piece of memory. However, some libfabric providers might +not support the use of virtual address and instead will use zero-based offset addressing. + +FI_MR_VIRT_ADDR is the flag that determine this behavior. mca_btl_ofi_reg_mem() handles +this by storing the base address in registration handle in case of the provider does not +support FI_MR_VIRT_ADDR. This base address will be used to calculate the offset later in +RDMA/Atomic operations. + +The BTL will try to use the address of registration handle as the key. However, if the +provider supports FI_MR_PROV_KEY, it will use provider provided key. Simply does not care. + +The BTL does not register local operand or compare. This is why this BTL does not support +FI_MR_LOCAL and will allocate every buffer before registering. This means FI_MR_ALLOCATED +is supported. So to be explicit. + +Supported MR mode bits (will work with or without): + enum: + - FI_MR_BASIC + - FI_MR_SCALABLE + + mode bits: + - FI_MR_VIRT_ADDR + - FI_MR_ALLOCATED + - FI_MR_PROV_KEY + +The BTL does NOT support (will not work with): + - FI_MR_LOCAL + - FI_MR_MMU_NOTIFY + - FI_MR_RMA_EVENT + - FI_MR_ENDPOINT + +Just a reminder, in libfabric API 1.5... +FI_MR_BASIC == (FI_MR_PROV_KEY | FI_MR_ALLOCATED | FI_MR_VIRT_ADDR) + +======================================== + +Completions + +Every operation in this BTL is asynchronous. The completion handling will occur in +mca_btl_ofi_component_progress() where we read the CQ with the completion context and +execute the callback functions. The completions are local. No remote completion event is +generated as local completion already guarantee global completion. + +The BTL keep tracks of number of outstanding operations and provide flush interface. + +======================================== + +Sockets Provider + +Sockets provider is the proof of concept provider for libfabric. It is supposed to support +all the OFI API with emulations. This provider is considered very slow and bound to raise +problems that we might not see from other faster providers. + +Known Problems: + - sockets provider uses progress thread and can cause segfault in finalize as we free + the resources while progress thread is still using it. sleep(1) was put in + mca_btl_ofi_componenet_close() for this reason. diff --git a/opal/mca/btl/ofi/btl_ofi.h b/opal/mca/btl/ofi/btl_ofi.h new file mode 100644 index 00000000000..02e44fd8b30 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi.h @@ -0,0 +1,311 @@ +/* -*- 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-2018 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) 2015-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ +/** + * @file + */ +#ifndef MCA_BTL_OFI_H +#define MCA_BTL_OFI_H + +#include "opal_config.h" +#include +#include + +/* Open MPI includes */ +#include "opal/mca/event/event.h" +#include "opal/mca/btl/btl.h" +#include "opal/mca/btl/base/base.h" +#include "opal/mca/mpool/mpool.h" +#include "opal/mca/btl/base/btl_base_error.h" +#include "opal/mca/rcache/base/base.h" +#include "opal/mca/pmix/pmix.h" + +#include +#include +#include +#include +#include +#include + +BEGIN_C_DECLS +#define MCA_BTL_OFI_MAX_MODULES 16 +#define MCA_BTL_OFI_MAX_CQ_READ_ENTRIES 128 +#define MCA_BTL_OFI_NUM_CQE_READ 64 +#define MCA_BTL_OFI_PROGRESS_THRESHOLD 64 + +#define MCA_BTL_OFI_ABORT(args) mca_btl_ofi_exit(args) + +enum mca_btl_ofi_type { + MCA_BTL_OFI_TYPE_PUT = 1, + MCA_BTL_OFI_TYPE_GET, + MCA_BTL_OFI_TYPE_AOP, + MCA_BTL_OFI_TYPE_AFOP, + MCA_BTL_OFI_TYPE_CSWAP, + MCA_BTL_OFI_TYPE_TOTAL +}; + +struct mca_btl_ofi_context_t { + int32_t context_id; + + /* transmit context */ + struct fid_ep *tx_ctx; + struct fid_ep *rx_ctx; + + /* completion queue */ + struct fid_cq *cq; + + /* completion info freelist */ + /* We have it per context to reduce the thread contention + * on the freelist. Things can get really slow. */ + opal_free_list_t comp_list; + + /* for thread locking */ + volatile int32_t lock; +}; +typedef struct mca_btl_ofi_context_t mca_btl_ofi_context_t; + +/** + * @brief OFI BTL module + */ +struct mca_btl_ofi_module_t { + /** base BTL interface */ + mca_btl_base_module_t super; + + /* libfabric components */ + struct fi_info *fabric_info; + struct fid_fabric *fabric; + struct fid_domain *domain; + struct fid_ep *ofi_endpoint; + struct fid_av *av; + + int num_contexts; + mca_btl_ofi_context_t *contexts; + + char *linux_device_name; + + /** whether the module has been fully initialized or not */ + bool initialized; + bool use_virt_addr; + bool is_scalable_ep; + + int64_t outstanding_rdma; + + /** linked list of BTL endpoints. this list is never searched so + * there is no need for a complicated structure here at this time*/ + opal_list_t endpoints; + + opal_mutex_t module_lock; + + /** registration cache */ + mca_rcache_base_module_t *rcache; +}; +typedef struct mca_btl_ofi_module_t mca_btl_ofi_module_t; + +extern mca_btl_ofi_module_t mca_btl_ofi_module_template; + +/** + * @brief OFI BTL component + */ +struct mca_btl_ofi_component_t { + mca_btl_base_component_3_0_0_t super; /**< base BTL component */ + + /** number of TL modules */ + int module_count; + int num_contexts_per_module; + int num_cqe_read; + int progress_threshold; + + size_t namelen; + + /** All BTL OFI modules (1 per tl) */ + mca_btl_ofi_module_t *modules[MCA_BTL_OFI_MAX_MODULES]; + +}; +typedef struct mca_btl_ofi_component_t mca_btl_ofi_component_t; + +OPAL_MODULE_DECLSPEC extern mca_btl_ofi_component_t mca_btl_ofi_component; + +struct mca_btl_base_registration_handle_t { + uint64_t rkey; + void *desc; + void *base_addr; +}; + +struct mca_btl_ofi_reg_t { + mca_rcache_base_registration_t base; + struct fid_mr *ur_mr; + + /* remote handle */ + mca_btl_base_registration_handle_t handle; +}; +typedef struct mca_btl_ofi_reg_t mca_btl_ofi_reg_t; + +OBJ_CLASS_DECLARATION(mca_btl_ofi_reg_t); + +/* completion structure store information needed + * for RDMA callbacks */ +struct mca_btl_ofi_completion_t { + opal_free_list_item_t comp_list; + opal_free_list_t *my_list; + + struct mca_btl_base_module_t *btl; + struct mca_btl_base_endpoint_t *endpoint; + struct mca_btl_ofi_context_t *my_context; + uint32_t type; + + void *local_address; + mca_btl_base_registration_handle_t *local_handle; + + /* information for atomic op */ + uint64_t operand; + uint64_t compare; + + mca_btl_base_rdma_completion_fn_t cbfunc; + void *cbcontext; + void *cbdata; + +}; +typedef struct mca_btl_ofi_completion_t mca_btl_ofi_completion_t; + +OBJ_CLASS_DECLARATION(mca_btl_ofi_completion_t); + +/** + * Initiate an asynchronous put. + * Completion Semantics: if this function returns a 1 then the operation + * is complete. a return of OPAL_SUCCESS indicates + * the put operation has been queued with the + * network. the local_handle can not be deregistered + * until all outstanding operations on that handle + * have been completed. + * + * @param btl (IN) BTL module + * @param endpoint (IN) BTL addressing information + * @param local_address (IN) Local address to put from (registered) + * @param remote_address (IN) Remote address to put to (registered remotely) + * @param local_handle (IN) Registration handle for region containing + * (local_address, local_address + size) + * @param remote_handle (IN) Remote registration handle for region containing + * (remote_address, remote_address + size) + * @param size (IN) Number of bytes to put + * @param flags (IN) Flags for this put operation + * @param order (IN) Ordering + * @param cbfunc (IN) Function to call on completion (if queued) + * @param cbcontext (IN) Context for the callback + * @param cbdata (IN) Data for callback + * + * @retval OPAL_SUCCESS The descriptor was successfully queued for a put + * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put + * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put + * operation. Try again later + * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or + * alignment restrictions. + */ +int mca_btl_ofi_put (struct mca_btl_base_module_t *btl, + struct mca_btl_base_endpoint_t *endpoint, void *local_address, + uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, + struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); + +/** + * Initiate an asynchronous get. + * Completion Semantics: if this function returns a 1 then the operation + * is complete. a return of OPAL_SUCCESS indicates + * the get operation has been queued with the + * network. the local_handle can not be deregistered + * until all outstanding operations on that handle + * have been completed. + * + * @param btl (IN) BTL module + * @param endpoint (IN) BTL addressing information + * @param local_address (IN) Local address to put from (registered) + * @param remote_address (IN) Remote address to put to (registered remotely) + * @param local_handle (IN) Registration handle for region containing + * (local_address, local_address + size) + * @param remote_handle (IN) Remote registration handle for region containing + * (remote_address, remote_address + size) + * @param size (IN) Number of bytes to put + * @param flags (IN) Flags for this put operation + * @param order (IN) Ordering + * @param cbfunc (IN) Function to call on completion (if queued) + * @param cbcontext (IN) Context for the callback + * @param cbdata (IN) Data for callback + * + * @retval OPAL_SUCCESS The descriptor was successfully queued for a put + * @retval OPAL_ERROR The descriptor was NOT successfully queued for a put + * @retval OPAL_ERR_OUT_OF_RESOURCE Insufficient resources to queue the put + * operation. Try again later + * @retval OPAL_ERR_NOT_AVAILABLE Put can not be performed due to size or + * alignment restrictions. + */ +int mca_btl_ofi_get (struct mca_btl_base_module_t *btl, + struct mca_btl_base_endpoint_t *endpoint, void *local_address, + uint64_t remote_address, struct mca_btl_base_registration_handle_t *local_handle, + struct mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); + +int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, + uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, + mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, + mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); + +int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, + void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, + uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, + void *cbcontext, void *cbdata); + +int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, + void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata); + + +int mca_btl_ofi_flush (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint); + +int mca_btl_ofi_finalize (mca_btl_base_module_t *btl); + +void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module); +int mca_btl_ofi_reg_mem (void *reg_data, void *base, size_t size, + mca_rcache_base_registration_t *reg); +int mca_btl_ofi_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg); + +int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context); +void mca_btl_ofi_exit(void); + +/* thread atomics */ +static inline bool mca_btl_ofi_context_trylock (mca_btl_ofi_context_t *context) +{ + return (context->lock || OPAL_ATOMIC_SWAP_32(&context->lock, 1)); +} + +static inline void mca_btl_ofi_context_lock(mca_btl_ofi_context_t *context) +{ + while (mca_btl_ofi_context_trylock(context)); +} + +static inline void mca_btl_ofi_context_unlock(mca_btl_ofi_context_t *context) +{ + opal_atomic_mb(); + context->lock = 0; +} + +END_C_DECLS +#endif diff --git a/opal/mca/btl/ofi/btl_ofi_atomics.c b/opal/mca/btl/ofi/btl_ofi_atomics.c new file mode 100644 index 00000000000..e5364ed6489 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_atomics.c @@ -0,0 +1,192 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include "btl_ofi_rdma.h" + +static inline int to_fi_op(mca_btl_base_atomic_op_t op) +{ + switch (op) { + case MCA_BTL_ATOMIC_ADD: + return FI_SUM; + case MCA_BTL_ATOMIC_SWAP: + return FI_ATOMIC_WRITE; + default: + BTL_ERROR(("Unknown or unsupported atomic op.")); + MCA_BTL_OFI_ABORT(); + + /* just to squash the warning */ + return OPAL_ERROR; + } +} + +int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, + void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, mca_btl_base_atomic_op_t op, + uint64_t operand, int flags, int order, mca_btl_base_rdma_completion_fn_t cbfunc, + void *cbcontext, void *cbdata) +{ + int rc; + int fi_datatype = FI_UINT64; + int fi_op; + + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_completion_t *comp = NULL; + mca_btl_ofi_context_t *ofi_context; + + ofi_context = get_ofi_context(ofi_btl); + + if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { + fi_datatype = FI_UINT32; + } + + fi_op = to_fi_op(op); + + comp = mca_btl_ofi_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_AFOP); + + /* copy the operand because it might get freed from upper layer */ + comp->operand = (uint64_t) operand; + + remote_address = (remote_address - (uint64_t) remote_handle->base_addr); + + rc = fi_fetch_atomic(ofi_context->tx_ctx, + (void*) &comp->operand, 1, NULL, /* operand */ + local_address, local_handle->desc, /* results */ + btl_endpoint->peer_addr, /* remote addr */ + remote_address, remote_handle->rkey, /* remote buffer */ + fi_datatype, fi_op, comp); + + if (rc == -FI_EAGAIN) { + return OPAL_ERR_OUT_OF_RESOURCE; + } else if (rc < 0) { + BTL_ERROR(("fi_fetch_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); + MCA_BTL_OFI_ABORT(); + } + + MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); + + return OPAL_SUCCESS; +} + +int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, + uint64_t remote_address, mca_btl_base_registration_handle_t *remote_handle, + mca_btl_base_atomic_op_t op, uint64_t operand, int flags, int order, + mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) +{ + int rc; + int fi_datatype = FI_UINT64; + int fi_op; + + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_completion_t *comp = NULL; + mca_btl_ofi_context_t *ofi_context; + + ofi_context = get_ofi_context(ofi_btl); + + if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { + fi_datatype = FI_UINT32; + } + + fi_op = to_fi_op(op); + + comp = mca_btl_ofi_completion_alloc(btl, endpoint, + ofi_context, + NULL, + NULL, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_AOP); + + /* copy the operand because it might get freed from upper layer */ + comp->operand = (uint64_t) operand; + + remote_address = (remote_address - (uint64_t) remote_handle->base_addr); + + rc = fi_atomic(ofi_context->tx_ctx, + (void*) &comp->operand, 1, NULL, /* operand */ + btl_endpoint->peer_addr, /* remote addr */ + remote_address, remote_handle->rkey, /* remote buffer */ + fi_datatype, fi_op, comp); + + if (rc == -FI_EAGAIN) { + return OPAL_ERR_OUT_OF_RESOURCE; + } else if (rc < 0) { + BTL_ERROR(("fi_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); + MCA_BTL_OFI_ABORT(); + } + + MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); + + return OPAL_SUCCESS; +} + +int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, + void *local_address, uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, uint64_t compare, uint64_t value, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) +{ + int rc; + int fi_datatype = FI_UINT64; + + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_completion_t *comp = NULL; + mca_btl_ofi_context_t *ofi_context; + + ofi_context = get_ofi_context(ofi_btl); + + if (flags & MCA_BTL_ATOMIC_FLAG_32BIT) { + fi_datatype = FI_UINT32; + } + + comp = mca_btl_ofi_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_CSWAP); + + /* copy the operand because it might get freed from upper layer */ + comp->operand = (uint64_t) value; + comp->compare = (uint64_t) compare; + + remote_address = (remote_address - (uint64_t) remote_handle->base_addr); + + /* perform atomic */ + rc = fi_compare_atomic(ofi_context->tx_ctx, + (void*) &comp->operand, 1, NULL, + (void*) &comp->compare, NULL, + local_address, local_handle->desc, + btl_endpoint->peer_addr, + remote_address, remote_handle->rkey, + fi_datatype, + FI_CSWAP, + comp); + + if (rc == -FI_EAGAIN) { + return OPAL_ERR_OUT_OF_RESOURCE; + } else if (rc < 0) { + BTL_ERROR(("fi_compare_atomic failed with rc=%d (%s)", rc, fi_strerror(-rc))); + MCA_BTL_OFI_ABORT(); + } + + MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); + + return OPAL_SUCCESS; +} diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c new file mode 100644 index 00000000000..1ee541afb36 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -0,0 +1,681 @@ +/* -*- 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) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "opal_config.h" + +#include "opal/mca/btl/btl.h" +#include "opal/mca/btl/base/base.h" +#include "opal/mca/hwloc/base/base.h" + +#include + +#include "btl_ofi.h" +#include "btl_ofi_endpoint.h" +#include "btl_ofi_rdma.h" + +#define MCA_BTL_OFI_REQUIRED_CAPS (FI_RMA | FI_ATOMIC) +#define MCA_BTL_OFI_REQUESTED_MR_MODE (FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_VIRT_ADDR) + +static char *prov_include; +static char *prov_exclude; +static char *ofi_progress_mode; +static bool disable_sep; +static int mca_btl_ofi_init_device(struct fi_info *info); + +/* validate information returned from fi_getinfo(). + * return OPAL_ERROR if we dont have what we need. */ +static int validate_info(struct fi_info *info) +{ + int mr_mode; + + BTL_VERBOSE(("validating device: %s", info->domain_attr->name)); + + /* we need exactly all the required bits */ + if ((info->caps & MCA_BTL_OFI_REQUIRED_CAPS) != MCA_BTL_OFI_REQUIRED_CAPS) { + BTL_VERBOSE(("unsupported caps")); + return OPAL_ERROR; + } + + /* we need FI_EP_RDM */ + if (info->ep_attr->type != FI_EP_RDM) { + BTL_VERBOSE(("unsupported EP type")); + return OPAL_ERROR; + } + + mr_mode = info->domain_attr->mr_mode; + + if (!(mr_mode == FI_MR_BASIC || mr_mode == FI_MR_SCALABLE || + (mr_mode & ~(FI_MR_VIRT_ADDR | FI_MR_ALLOCATED | FI_MR_PROV_KEY)) == 0)) { + BTL_VERBOSE(("unsupported MR mode")); + return OPAL_ERROR; + } + + if (!(info->tx_attr->op_flags | FI_DELIVERY_COMPLETE)) { + BTL_VERBOSE(("the endpoint tx_ctx does not support FI_DELIVERY_COMPLETE")); + return OPAL_ERROR; + } + + BTL_VERBOSE(("device: %s is good to go.", info->domain_attr->name)); + return OPAL_SUCCESS; +} + +/* Register the MCA parameters */ +static int mca_btl_ofi_component_register(void) +{ + mca_btl_ofi_module_t *module = &mca_btl_ofi_module_template; + + /* fi_getinfo with prov_name == NULL means ALL provider. + * Since now we are using the first valid info returned, I'm not sure + * if we need to provide the support for comma limited provider list. */ + prov_include = NULL; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "provider_include", + "OFI provider that ofi btl will query for. This parameter only " + "accept ONE provider name. " + "(e.g., \"psm2\"; an empty value means that all providers will " + "be considered.", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_4, + MCA_BASE_VAR_SCOPE_READONLY, + &prov_include); + + /* TODO: this param has not been implemented. Not sure if we need it. " */ + prov_exclude = NULL; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "provider_exclude", + "Comma-delimited list of OFI providers that are not considered for use " + "(default: \"sockets,mxm\"; empty value means that all providers will " + " be considered). " + "Mutually exclusive with btl_ofi_provider_include.", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_4, + MCA_BASE_VAR_SCOPE_READONLY, + &prov_exclude); + + mca_btl_ofi_component.num_cqe_read = MCA_BTL_OFI_NUM_CQE_READ; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "num_cq_read", + "Number of completion entries to read from a single cq_read. ", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_btl_ofi_component.num_cqe_read); + + ofi_progress_mode = "unspec"; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "progress_mode", + "requested provider progress mode. [unspec, auto, manual]" + "(default: unspec)", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &ofi_progress_mode); + + mca_btl_ofi_component.num_contexts_per_module = 1; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "num_contexts_per_module", + "number of communication context per module to create. " + "This should increase multithreaded performance but it is " + "advised that this number should be lower than total cores.", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_btl_ofi_component.num_contexts_per_module); + + disable_sep = false; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "disable_sep", + "force btl/ofi to never use scalable endpoint. ", + MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &disable_sep); + + mca_btl_ofi_component.progress_threshold = MCA_BTL_OFI_PROGRESS_THRESHOLD; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "progress_threshold", + "number of outstanding operation before btl will progress " + "automatically. Tuning this might improve performance on " + "certain type of application.", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_btl_ofi_component.progress_threshold); + + /* for now we want this component to lose to btl/ugni and btl/vader */ + module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH - 50; + + return mca_btl_base_param_register (&mca_btl_ofi_component.super.btl_version, + &module->super); +} + +static int mca_btl_ofi_component_open(void) +{ + mca_btl_ofi_component.module_count = 0; + return OPAL_SUCCESS; +} + +/* + * component cleanup - sanity checking of queue lengths + */ +static int mca_btl_ofi_component_close(void) +{ + /* If we don't sleep, sockets provider freaks out. */ + sleep(1); + return OPAL_SUCCESS; +} + +void mca_btl_ofi_exit(void) +{ + BTL_ERROR(("BTL OFI will now abort.")); + exit(1); +} + +/* + * OFI component initialization: + * read interface list from kernel and compare against component parameters + * then create a BTL instance for selected interfaces + */ + +static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, bool enable_progress_threads, + bool enable_mpi_threads) +{ + /* for this BTL to be useful the interface needs to support RDMA and certain atomic operations */ + int rc; + uint64_t progress_mode; + unsigned resource_count = 0; + struct mca_btl_base_module_t **base_modules; + + BTL_VERBOSE(("initializing ofi btl")); + + /* Set up libfabric hints. */ + uint32_t libfabric_api; + libfabric_api = fi_version(); + + /* bail if OFI version is less than 1.5. */ + if (libfabric_api < FI_VERSION(1, 5)) { + BTL_VERBOSE(("ofi btl disqualified because OFI version < 1.5.")); + return NULL; + } + + struct fi_info *info, *info_list; + struct fi_info hints = {0}; + struct fi_ep_attr ep_attr = {0}; + struct fi_rx_attr rx_attr = {0}; + struct fi_tx_attr tx_attr = {0}; + struct fi_fabric_attr fabric_attr = {0}; + struct fi_domain_attr domain_attr = {0}; + + /* Select the provider */ + fabric_attr.prov_name = prov_include; + + domain_attr.mr_mode = MCA_BTL_OFI_REQUESTED_MR_MODE; + + /* message progression mode. */ + if (!strcmp(ofi_progress_mode, "auto")) { + progress_mode = FI_PROGRESS_AUTO; + } else if (!strcmp(ofi_progress_mode, "manual")) { + progress_mode = FI_PROGRESS_MANUAL; + } else { + progress_mode = FI_PROGRESS_UNSPEC; + } + + domain_attr.control_progress = progress_mode; + domain_attr.data_progress = progress_mode; + + /* select endpoint type */ + ep_attr.type = FI_EP_RDM; + + /* ask for capabilities */ + hints.caps = MCA_BTL_OFI_REQUIRED_CAPS; + + /* Ask for completion context */ + hints.mode = FI_CONTEXT; + + hints.fabric_attr = &fabric_attr; + hints.domain_attr = &domain_attr; + hints.ep_attr = &ep_attr; + hints.tx_attr = &tx_attr; + hints.rx_attr = &rx_attr; + + /* for now */ + tx_attr.iov_limit = 1; + rx_attr.iov_limit = 1; + + tx_attr.op_flags = FI_DELIVERY_COMPLETE; + + mca_btl_ofi_component.module_count = 0; + + /* do the query. */ + rc = fi_getinfo(FI_VERSION(1, 5), NULL, NULL, 0, &hints, &info_list); + if (0 != rc) { + BTL_VERBOSE(("fi_getinfo failed with code %d: %s",rc, fi_strerror(-rc))); + return NULL; + } + + /* count the number of resources/ */ + info = info_list; + while(info) { + resource_count++; + info = info->next; + } + BTL_VERBOSE(("ofi btl found %d possible resources.", resource_count)); + + info = info_list; + + while(info) { + rc = validate_info(info); + if (OPAL_SUCCESS == rc) { + /* Device passed sanity check, let's make a module. + * We only pick the first device we found valid */ + rc = mca_btl_ofi_init_device(info); + if (OPAL_SUCCESS == rc) + break; + } + info = info->next; + } + + /* We are done with the returned info. */ + fi_freeinfo(info_list); + + /* pass module array back to caller */ + base_modules = calloc (mca_btl_ofi_component.module_count, sizeof (*base_modules)); + if (NULL == base_modules) { + return NULL; + } + + memcpy(base_modules, mca_btl_ofi_component.modules, + mca_btl_ofi_component.module_count *sizeof (mca_btl_ofi_component.modules[0])); + + BTL_VERBOSE(("ofi btl initialization complete. found %d suitable transports", + mca_btl_ofi_component.module_count)); + + *num_btl_modules = mca_btl_ofi_component.module_count; + + return base_modules; +} + +static int mca_btl_ofi_init_device(struct fi_info *info) +{ + int rc; + int *module_count = &mca_btl_ofi_component.module_count; + size_t namelen; + size_t num_contexts_to_create; + + char *linux_device_name; + char ep_name[FI_NAME_MAX]; + + struct fi_info *ofi_info; + struct fi_ep_attr *ep_attr; + struct fi_domain_attr *domain_attr; + struct fi_av_attr av_attr = {0}; + struct fid_fabric *fabric = NULL; + struct fid_domain *domain = NULL; + struct fid_ep *ep = NULL; + struct fid_av *av = NULL; + + mca_btl_ofi_module_t *module; + + /* allocate module */ + module = (mca_btl_ofi_module_t*) calloc(1, sizeof(mca_btl_ofi_module_t)); + if (NULL == module) { + BTL_ERROR(("failed to allocate memory for OFI module")); + goto fail; + } + *module = mca_btl_ofi_module_template; + + /* make a copy of the given info to store on the module */ + ofi_info = fi_dupinfo(info); + ep_attr = ofi_info->ep_attr; + domain_attr = ofi_info->domain_attr; + + linux_device_name = info->domain_attr->name; + BTL_VERBOSE(("initializing dev:%s provider:%s", + linux_device_name, + info->fabric_attr->prov_name)); + + /* fabric */ + rc = fi_fabric(ofi_info->fabric_attr, &fabric, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_fabric with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + /* domain */ + rc = fi_domain(fabric, ofi_info, &domain, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_domain with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + /* AV */ + av_attr.type = FI_AV_MAP; + rc = fi_av_open(domain, &av_attr, &av, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_av_open with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + num_contexts_to_create = mca_btl_ofi_component.num_contexts_per_module; + + /* If the domain support scalable endpoint. */ + if (domain_attr->max_ep_tx_ctx > 1 && !disable_sep) { + + BTL_VERBOSE(("btl/ofi using scalable endpoint.")); + + if (num_contexts_to_create > domain_attr->max_ep_tx_ctx) { + BTL_VERBOSE(("cannot create requested %u contexts. (node max=%zu)", + module->num_contexts, + domain_attr->max_ep_tx_ctx)); + goto fail; + } + + /* modify the info to let the provider know we are creating x contexts */ + ep_attr->tx_ctx_cnt = num_contexts_to_create; + ep_attr->rx_ctx_cnt = num_contexts_to_create; + + /* create scalable endpoint */ + rc = fi_scalable_ep(domain, ofi_info, &ep, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_scalable_ep with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + module->num_contexts = num_contexts_to_create; + module->is_scalable_ep = true; + + /* create contexts */ + module->contexts = mca_btl_ofi_context_alloc_scalable(ofi_info, + domain, ep, av, + num_contexts_to_create); + + } else { + /* warn the user if they want more than 1 context */ + if (num_contexts_to_create > 1) { + BTL_ERROR(("cannot create %zu contexts as the provider does not support " + "scalable endpoint. Falling back to single context endpoint.", + num_contexts_to_create)); + } + + BTL_VERBOSE(("btl/ofi using normal endpoint.")); + + rc = fi_endpoint(domain, ofi_info, &ep, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_endpoint with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + module->num_contexts = 1; + module->is_scalable_ep = false; + + /* create contexts */ + module->contexts = mca_btl_ofi_context_alloc_normal(ofi_info, + domain, ep, av); + } + + if (NULL == module->contexts) { + /* error message is already printed */ + goto fail; + } + + /* enable the endpoint for using */ + rc = fi_enable(ep); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_enable with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + /* Everything succeeded, lets create a module for this device. */ + /* store the information. */ + module->fabric_info = ofi_info; + module->fabric = fabric; + module->domain = domain; + module->av = av; + module->ofi_endpoint = ep; + module->linux_device_name = linux_device_name; + module->outstanding_rdma = 0; + module->use_virt_addr = false; + + if (ofi_info->domain_attr->mr_mode == FI_MR_BASIC || + ofi_info->domain_attr->mr_mode & FI_MR_VIRT_ADDR) { + module->use_virt_addr = true; + } + + /* initialize the rcache */ + mca_btl_ofi_rcache_init(module); + + /* create endpoint list */ + OBJ_CONSTRUCT(&module->endpoints, opal_list_t); + OBJ_CONSTRUCT(&module->module_lock, opal_mutex_t); + + /* create and send the modex for this device */ + namelen = sizeof(ep_name); + rc = fi_getname((fid_t)ep, &ep_name[0], &namelen); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_getname with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto fail; + } + + /* post our endpoint name so peer can use it to connect to us */ + OPAL_MODEX_SEND(rc, + OPAL_PMIX_GLOBAL, + &mca_btl_ofi_component.super.btl_version, + &ep_name, + namelen); + mca_btl_ofi_component.namelen = namelen; + + /* add this module to the list */ + mca_btl_ofi_component.modules[(*module_count)++] = module; + + return OPAL_SUCCESS; + +fail: + /* clean up */ + + /* if the contexts have not been initiated, num_contexts should + * be zero and we skip this. */ + for (int i=0; i < module->num_contexts; i++) { + mca_btl_ofi_context_finalize(&module->contexts[i], module->is_scalable_ep); + } + free(module->contexts); + + if (NULL != av) { + fi_close(&av->fid); + } + + if (NULL != ep) { + fi_close(&ep->fid); + } + + if (NULL != domain) { + fi_close(&domain->fid); + } + + if (NULL != fabric) { + fi_close(&fabric->fid); + } + free(module); + + /* not really a failure. just skip this device. */ + return OPAL_ERR_OUT_OF_RESOURCE; +} + +/** + * @brief OFI BTL progress function + * + * This function explictly progresses all workers. + */ +static int mca_btl_ofi_component_progress (void) +{ + int events = 0; + mca_btl_ofi_context_t *context; + + for (int i = 0 ; i < mca_btl_ofi_component.module_count ; ++i) { + mca_btl_ofi_module_t *module = mca_btl_ofi_component.modules[i]; + + /* progress context we own first. */ + context = get_ofi_context(module); + + if (mca_btl_ofi_context_trylock(context)) { + events += mca_btl_ofi_context_progress(context); + mca_btl_ofi_context_unlock(context); + } + + /* if there is nothing to do, try progress other's. */ + if (events == 0) { + for (int j = 0 ; j < module->num_contexts ; j++ ) { + + context = get_ofi_context_rr(module); + + if (mca_btl_ofi_context_trylock(context)) { + events += mca_btl_ofi_context_progress(context); + mca_btl_ofi_context_unlock(context); + } + + /* If we did something, good enough. return now. + * This is crucial for performance/latency. */ + if (events > 0) { + break; + } + } + } + } + + return events; +} + +int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context) { + + int ret = 0; + int events_read; + int events = 0; + struct fi_cq_entry cq_entry[MCA_BTL_OFI_MAX_CQ_READ_ENTRIES]; + struct fi_cq_err_entry cqerr = {0}; + + mca_btl_ofi_completion_t *comp; + + ret = fi_cq_read(context->cq, &cq_entry, mca_btl_ofi_component.num_cqe_read); + + if (0 < ret) { + events_read = ret; + for (int i = 0; i < events_read; i++) { + if (NULL != cq_entry[i].op_context) { + ++events; + comp = (mca_btl_ofi_completion_t*) cq_entry[i].op_context; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*)comp->btl; + + switch (comp->type) { + case MCA_BTL_OFI_TYPE_GET: + case MCA_BTL_OFI_TYPE_PUT: + case MCA_BTL_OFI_TYPE_AOP: + case MCA_BTL_OFI_TYPE_AFOP: + case MCA_BTL_OFI_TYPE_CSWAP: + + /* call the callback */ + if (comp->cbfunc) { + comp->cbfunc (comp->btl, comp->endpoint, + comp->local_address, comp->local_handle, + comp->cbcontext, comp->cbdata, OPAL_SUCCESS); + } + + /* return the completion handler */ + opal_free_list_return(comp->my_list, (opal_free_list_item_t*) comp); + + MCA_BTL_OFI_NUM_RDMA_DEC(ofi_btl); + break; + + default: + /* catasthrophic */ + BTL_ERROR(("unknown completion type")); + MCA_BTL_OFI_ABORT(); + } + } + } + } else if (OPAL_UNLIKELY(ret == -FI_EAVAIL)) { + ret = fi_cq_readerr(context->cq, &cqerr, 0); + + /* cq readerr failed!? */ + if (0 > ret) { + BTL_ERROR(("%s:%d: Error returned from fi_cq_readerr: %s(%d)", + __FILE__, __LINE__, fi_strerror(-ret), ret)); + } else { + BTL_ERROR(("fi_cq_readerr: (provider err_code = %d)\n", + cqerr.prov_errno)); + } + MCA_BTL_OFI_ABORT(); + } +#ifdef FI_EINTR + /* sometimes, sockets provider complain about interupt. We do nothing. */ + else if (OPAL_UNLIKELY(ret == -FI_EINTR)) { + + } +#endif + /* If the error is not FI_EAGAIN, report the error and abort. */ + else if (OPAL_UNLIKELY(ret != -FI_EAGAIN)) { + BTL_ERROR(("fi_cq_read returned error %d:%s", ret, fi_strerror(-ret))); + MCA_BTL_OFI_ABORT(); + } + + return events; +} + +/** OFI btl component */ +mca_btl_ofi_component_t mca_btl_ofi_component = { + .super = { + .btl_version = { + MCA_BTL_DEFAULT_VERSION("ofi"), + .mca_open_component = mca_btl_ofi_component_open, + .mca_close_component = mca_btl_ofi_component_close, + .mca_register_component_params = mca_btl_ofi_component_register, + }, + .btl_data = { + /* The component is not checkpoint ready */ + .param_field = MCA_BASE_METADATA_PARAM_NONE + }, + + .btl_init = mca_btl_ofi_component_init, + .btl_progress = mca_btl_ofi_component_progress, + }, +}; diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.c b/opal/mca/btl/ofi/btl_ofi_endpoint.c new file mode 100644 index 00000000000..0ef91a9b6ff --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_endpoint.c @@ -0,0 +1,343 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "btl_ofi.h" +#include "btl_ofi_endpoint.h" +#include "opal/util/proc.h" + +#if OPAL_HAVE_THREAD_LOCAL +opal_thread_local mca_btl_ofi_context_t *my_context = NULL; +#endif /* OPAL_HAVE_THREAD_LOCAL */ + +static void mca_btl_ofi_endpoint_construct (mca_btl_ofi_endpoint_t *endpoint) +{ + endpoint->peer_addr = 0; + OBJ_CONSTRUCT(&endpoint->ep_lock, opal_mutex_t); +} + +static void mca_btl_ofi_endpoint_destruct (mca_btl_ofi_endpoint_t *endpoint) +{ + endpoint->peer_addr = 0; + + /* set to null, we will free ofi endpoint in module */ + endpoint->ofi_endpoint = NULL; + + OBJ_DESTRUCT(&endpoint->ep_lock); +} + +OBJ_CLASS_INSTANCE(mca_btl_ofi_endpoint_t, opal_list_item_t, + mca_btl_ofi_endpoint_construct, + mca_btl_ofi_endpoint_destruct); + +mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep) +{ + mca_btl_ofi_endpoint_t *endpoint = OBJ_NEW(mca_btl_ofi_endpoint_t); + + if (OPAL_UNLIKELY(NULL == endpoint)) { + return NULL; + } + + endpoint->ep_proc = proc; + endpoint->ofi_endpoint = ep; + + return (mca_btl_base_endpoint_t *) endpoint; +} + +int ofi_comp_list_init(opal_free_list_t *comp_list) +{ + int rc; + OBJ_CONSTRUCT(comp_list, opal_free_list_t); + rc = opal_free_list_init(comp_list, + sizeof(mca_btl_ofi_completion_t), + opal_cache_line_size, + OBJ_CLASS(mca_btl_ofi_completion_t), + 0, + 0, + 128, + -1, + 128, + NULL, + 0, + NULL, + NULL, + NULL); + if (rc != OPAL_SUCCESS) { + BTL_VERBOSE(("cannot allocate completion freelist")); + } + return rc; +} + +/* mca_btl_ofi_context_alloc_normal() + * + * This function will allocate an ofi_context, map the endpoint to tx/rx context, + * bind CQ,AV to the endpoint and initialize all the structure. + * USE WITH NORMAL ENDPOINT ONLY */ +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *ep, + struct fid_av *av) +{ + int rc; + uint32_t cq_flags = FI_TRANSMIT; + char *linux_device_name = info->domain_attr->name; + + struct fi_cq_attr cq_attr = {0}; + + mca_btl_ofi_context_t *context; + + context = (mca_btl_ofi_context_t*) calloc(1, sizeof(*context)); + if (NULL == context) { + BTL_VERBOSE(("cannot allocate context")); + return NULL; + } + + /* Don't really need to check, just avoiding compiler warning because + * BTL_VERBOSE is a no op in performance build and the compiler will + * complain about unused variable. */ + if (NULL == linux_device_name) { + BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); + goto single_fail; + } + + cq_attr.format = FI_CQ_FORMAT_CONTEXT; + cq_attr.wait_obj = FI_WAIT_NONE; + rc = fi_cq_open(domain, &cq_attr, &context->cq, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_cq_open with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = fi_ep_bind(ep, (fid_t)av, 0); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = fi_ep_bind(ep, (fid_t)context->cq, cq_flags); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = ofi_comp_list_init(&context->comp_list); + if (rc != OPAL_SUCCESS) { + goto single_fail; + } + + context->tx_ctx = ep; + context->rx_ctx = ep; + context->context_id = 0; + + return context; + +single_fail: + mca_btl_ofi_context_finalize(context, false); + return NULL; +} + +/* mca_btl_ofi_context_alloc_scalable() + * + * This function allocate communication contexts and return the pointer + * to the first btl context. It also take care of all the bindings needed. + * USE WITH SCALABLE ENDPOINT ONLY */ +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *sep, + struct fid_av *av, + size_t num_contexts) +{ + BTL_VERBOSE(("creating %zu contexts", num_contexts)); + + int rc; + size_t i; + char *linux_device_name = info->domain_attr->name; + + struct fi_cq_attr cq_attr = {0}; + struct fi_tx_attr tx_attr = {0}; + struct fi_rx_attr rx_attr = {0}; + + mca_btl_ofi_context_t *contexts; + tx_attr.op_flags = FI_DELIVERY_COMPLETE; + + contexts = (mca_btl_ofi_context_t*) calloc(num_contexts, sizeof(*contexts)); + if (NULL == contexts) { + BTL_VERBOSE(("cannot allocate communication contexts.")); + return NULL; + } + + /* Don't really need to check, just avoiding compiler warning because + * BTL_VERBOSE is a no op in performance build and the compiler will + * complain about unused variable. */ + if (NULL == linux_device_name) { + BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); + goto scalable_fail; + } + + /* bind AV to endpoint */ + rc = fi_scalable_ep_bind(sep, (fid_t)av, 0); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + for (i=0; i < num_contexts; i++) { + rc = fi_tx_context(sep, i, &tx_attr, &contexts[i].tx_ctx, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_tx_context with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* We don't actually need a receiving context as we only do one-sided. + * However, sockets provider will hang if we dont have one. It is + * also nice to have equal number of tx/rx context. */ + rc = fi_rx_context(sep, i, &rx_attr, &contexts[i].rx_ctx, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_rx_context with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* create CQ */ + cq_attr.format = FI_CQ_FORMAT_CONTEXT; + cq_attr.wait_obj = FI_WAIT_NONE; + rc = fi_cq_open(domain, &cq_attr, &contexts[i].cq, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_cq_open with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* bind cq to transmit context */ + uint32_t cq_flags = (FI_TRANSMIT); + rc = fi_ep_bind(contexts[i].tx_ctx, (fid_t)contexts[i].cq, cq_flags); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* enable the context. */ + rc = fi_enable(contexts[i].tx_ctx); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_enable with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + rc = fi_enable(contexts[i].rx_ctx); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_enable with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* initialize completion freelist. */ + rc = ofi_comp_list_init(&contexts[i].comp_list); + if (rc != OPAL_SUCCESS) { + goto scalable_fail; + } + + /* assign the id */ + contexts[i].context_id = i; + } + + return contexts; + +scalable_fail: + /* close and free */ + for(i=0; i < num_contexts; i++) { + mca_btl_ofi_context_finalize(&contexts[i], true); + } + free(contexts); + + return NULL; +} + +void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep) { + + /* if it is a scalable ep, we have to close all contexts. */ + if (scalable_ep) { + if (NULL != context->tx_ctx) { + fi_close(&context->tx_ctx->fid); + } + + if (NULL != context->rx_ctx) { + fi_close(&context->rx_ctx->fid); + } + } + + if( NULL != context->cq) { + fi_close(&context->cq->fid); + } + + /* Can we destruct the object that hasn't been constructed? */ + OBJ_DESTRUCT(&context->comp_list); +} + +/* Get a context to use for communication. + * If TLS is supported, it will use the cached endpoint. + * If not, it will invoke the normal round-robin assignment. */ +mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl) +{ +#if OPAL_HAVE_THREAD_LOCAL + /* With TLS, we cache the context we use. */ + static volatile int64_t cur_num = 0; + + if (OPAL_UNLIKELY(my_context == NULL)) { + OPAL_THREAD_LOCK(&btl->module_lock); + + my_context = &btl->contexts[cur_num]; + cur_num = (cur_num + 1) %btl->num_contexts; + + OPAL_THREAD_UNLOCK(&btl->module_lock); + } + + assert (my_context); + return my_context; +#else + return get_ofi_context_rr(btl); +#endif +} + +/* return the context in a round-robin. */ +/* There is no need for atomics here as it might hurt the performance. */ +mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl) +{ + static volatile uint64_t rr_num = 0; + return &btl->contexts[rr_num++%btl->num_contexts]; +} diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.h b/opal/mca/btl/ofi/btl_ofi_endpoint.h new file mode 100644 index 00000000000..aad758d8c85 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_endpoint.h @@ -0,0 +1,75 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana + * University Research and Technology + * Corporation. All rights reserved. + * Copyright (c) 2004-2006 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) 2017-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_BTL_OFI_ENDPOINT_H +#define MCA_BTL_OFI_ENDPOINT_H + +#include "opal/class/opal_list.h" +#include "opal/mca/event/event.h" + +#include "btl_ofi.h" + +BEGIN_C_DECLS + +#if OPAL_HAVE_THREAD_LOCAL +extern opal_thread_local mca_btl_ofi_context_t *my_context; +#endif /* OPAL_HAVE_THREAD_LOCAL */ + +struct mca_btl_base_endpoint_t { + opal_list_item_t super; + + struct fid_ep *ofi_endpoint; + fi_addr_t peer_addr; + + /** endpoint proc */ + opal_proc_t *ep_proc; + + /** mutex to protect this structure */ + opal_mutex_t ep_lock; +}; + +typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t; +typedef mca_btl_base_endpoint_t mca_btl_ofi_endpoint_t; +OBJ_CLASS_DECLARATION(mca_btl_ofi_endpoint_t); + +int ofi_comp_list_init(opal_free_list_t *comp_list); + +mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep); + +/* contexts */ +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *sep, + struct fid_av *av, + size_t num_contexts); + +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *ep, + struct fid_av *av); +void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep); + +mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl); +mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl); + +END_C_DECLS +#endif diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c new file mode 100644 index 00000000000..df6ae1e2e1a --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -0,0 +1,329 @@ +/* -*- 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-2013 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, + * University of Stuttgart. All rights reserved. + * Copyright (c) 2004-2005 The Regents of the University of California. + * All rights reserved. + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include +#include "opal/class/opal_bitmap.h" +#include "opal/mca/btl/btl.h" +#include "opal/datatype/opal_convertor.h" +#include "opal/mca/mpool/base/base.h" +#include "opal/mca/mpool/mpool.h" + +#include "btl_ofi.h" +#include "btl_ofi_endpoint.h" + +static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl, + size_t nprocs, opal_proc_t **opal_procs, + mca_btl_base_endpoint_t **peers, + opal_bitmap_t *reachable) +{ + int rc; + int count; + char *ep_name = NULL; + size_t namelen = mca_btl_ofi_component.namelen; + + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + + for (size_t i = 0 ; i < nprocs ; ++i) { + peers[i] = mca_btl_ofi_endpoint_create (opal_procs[i], ofi_btl->ofi_endpoint); + if (OPAL_UNLIKELY(NULL == peers[i])) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + OPAL_MODEX_RECV(rc, &mca_btl_ofi_component.super.btl_version, + &peers[i]->ep_proc->proc_name, (void **)&ep_name, &namelen); + if (OPAL_SUCCESS != rc) { + BTL_ERROR(("error receiving modex")); + MCA_BTL_OFI_ABORT(); + } + + /* get peer fi_addr */ + count = fi_av_insert(ofi_btl->av, /* Address vector to insert */ + ep_name, /* peer name */ + 1, /* amount to insert */ + &peers[i]->peer_addr, /* return peer address here */ + 0, /* flags */ + NULL); /* context */ + + /* if succeed, add this proc and mark reachable */ + if (count == 1) { /* we inserted 1 address. */ + opal_list_append (&ofi_btl->endpoints, &peers[i]->super); + opal_bitmap_set_bit(reachable, i); + } else { + BTL_VERBOSE(("fi_av_insert failed with rc = %d", count)); + MCA_BTL_OFI_ABORT(); + } + } + + return OPAL_SUCCESS; +} + +static int mca_btl_ofi_del_procs (mca_btl_base_module_t *btl, size_t nprocs, + opal_proc_t **procs, mca_btl_base_endpoint_t **peers) +{ + int ret; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + + for (size_t i = 0 ; i < nprocs ; ++i) { + if (peers[i]) { + + /* remove the address from AV. */ + ret = fi_av_remove(ofi_btl->av, &peers[i]->peer_addr, 1, 0); + if (ret < 0) { + /* remove failed. this should not happen. */ + /* Lets not crash because we failed to remove an address. */ + BTL_ERROR(("fi_av_remove failed with error %d:%s", + ret, fi_strerror(-ret))); + } + + /* remove and free MPI endpoint from the list. */ + opal_list_remove_item (&ofi_btl->endpoints, &peers[i]->super); + OBJ_RELEASE(peers[i]); + } + } + + return OPAL_SUCCESS; +} + +void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module) +{ + if (!module->initialized) { + mca_rcache_base_resources_t rcache_resources; + char *tmp; + + (void) asprintf (&tmp, "ofi.%s", module->linux_device_name); + + rcache_resources.cache_name = tmp; + rcache_resources.reg_data = (void *) module; + rcache_resources.sizeof_reg = sizeof (mca_btl_ofi_reg_t); + rcache_resources.register_mem = mca_btl_ofi_reg_mem; + rcache_resources.deregister_mem = mca_btl_ofi_dereg_mem; + + module->rcache = mca_rcache_base_module_create ("grdma", module, &rcache_resources); + free (tmp); + + if (NULL == module->rcache) { + /* something when horribly wrong */ + BTL_ERROR(("cannot create rcache")); + MCA_BTL_OFI_ABORT(); + } + + module->initialized = true; + } +} + + +/** + * @brief Register a memory region for put/get/atomic operations. + * + * @param btl (IN) BTL 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 + * + * @returns a memory registration handle valid for both local and remote operations + * @returns NULL if the region could not be registered + * + * This function registers the specified region with the hardware for use with + * the btl_put, btl_get, btl_atomic_cas, btl_atomic_op, and btl_atomic_fop + * functions. Care should be taken to not hold an excessive number of registrations + * as they may use limited system/NIC resources. + */ +static struct mca_btl_base_registration_handle_t * +mca_btl_ofi_register_mem (struct mca_btl_base_module_t *btl, struct mca_btl_base_endpoint_t *endpoint, void *base, + size_t size, uint32_t flags) +{ + mca_btl_ofi_module_t *ofi_module = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_reg_t *reg; + int access_flags = flags & MCA_BTL_REG_FLAG_ACCESS_ANY; + int rc; + + rc = ofi_module->rcache->rcache_register (ofi_module->rcache, base, size, 0, access_flags, + (mca_rcache_base_registration_t **) ®); + if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) { + return NULL; + } + + return ®->handle; +} + +/** + * @brief Deregister a memory region + * + * @param btl (IN) BTL module region was registered with + * @param handle (IN) BTL registration handle to deregister + * + * This function deregisters the memory region associated with the specified handle. Care + * should be taken to not perform any RDMA or atomic operation on this memory region + * after it is deregistered. It is erroneous to specify a memory handle associated with + * a remote node. + */ +static int mca_btl_ofi_deregister_mem (mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle) +{ + mca_btl_ofi_module_t *ofi_module = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_reg_t *reg = + (mca_btl_ofi_reg_t *)((intptr_t) handle - offsetof (mca_btl_ofi_reg_t, handle)); + + (void) ofi_module->rcache->rcache_deregister (ofi_module->rcache, ®->base); + + return OPAL_SUCCESS; +} + +int mca_btl_ofi_reg_mem (void *reg_data, void *base, size_t size, mca_rcache_base_registration_t *reg) +{ + int rc; + static uint64_t access_flags = FI_REMOTE_WRITE | FI_REMOTE_READ | FI_READ | FI_WRITE; + + mca_btl_ofi_module_t *btl = (mca_btl_ofi_module_t*) reg_data; + mca_btl_ofi_reg_t *ur = (mca_btl_ofi_reg_t*) reg; + + rc = fi_mr_reg(btl->domain, base, size, access_flags, 0, + (uint64_t) reg, 0, &ur->ur_mr, NULL); + if (0 != rc) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + ur->handle.rkey = fi_mr_key(ur->ur_mr); + ur->handle.desc = fi_mr_desc(ur->ur_mr); + + /* In case the provider doesn't support FI_MR_VIRT_ADDR, + * we need to reference the remote address by the distance from base registered + * address. We keep this information to use in rdma/atomic operations. */ + if (btl->use_virt_addr) { + ur->handle.base_addr = 0; + } else { + ur->handle.base_addr = base; + } + + return OPAL_SUCCESS; +} + +int mca_btl_ofi_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg) +{ + mca_btl_ofi_reg_t *ur = (mca_btl_ofi_reg_t*)reg; + + if (ur->ur_mr != NULL) { + if (0 != fi_close(&ur->ur_mr->fid)) { + BTL_ERROR(("%s: error unpinning memory mr=%p: %s", + __func__, (void*) ur->ur_mr, strerror(errno))); + return OPAL_ERROR; + } + } + + return OPAL_SUCCESS; +} + +/* + * Cleanup/release module resources. + */ + +int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) +{ + int i; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *endpoint, *next; + + assert(btl); + + /* loop over all the contexts */ + for (i=0; i < ofi_btl->num_contexts; i++) { + mca_btl_ofi_context_finalize(&ofi_btl->contexts[i], ofi_btl->is_scalable_ep); + } + free(ofi_btl->contexts); + + if (NULL != ofi_btl->av) { + fi_close(&ofi_btl->av->fid); + } + + if (NULL != ofi_btl->ofi_endpoint) { + fi_close(&ofi_btl->ofi_endpoint->fid); + } + + if (NULL != ofi_btl->domain) { + fi_close(&ofi_btl->domain->fid); + } + + if (NULL != ofi_btl->fabric) { + fi_close(&ofi_btl->fabric->fid); + } + + if (NULL != ofi_btl->fabric_info) { + fi_freeinfo(ofi_btl->fabric_info); + } + + /* clean up any leftover endpoints */ + OPAL_LIST_FOREACH_SAFE(endpoint, next, &ofi_btl->endpoints, mca_btl_ofi_endpoint_t) { + opal_list_remove_item (&ofi_btl->endpoints, &endpoint->super); + OBJ_RELEASE(endpoint); + } + + OBJ_DESTRUCT(&ofi_btl->endpoints); + + if (ofi_btl->rcache) { + mca_rcache_base_module_destroy (ofi_btl->rcache); + } + + free (btl); + + return OPAL_SUCCESS; +} + +mca_btl_ofi_module_t mca_btl_ofi_module_template = { + .super = { + /* initialize functions. this btl only support RDMA and atomics + * for now so it does not provide prepare_src, alloc, free, or send */ + .btl_component = &mca_btl_ofi_component.super, + .btl_add_procs = mca_btl_ofi_add_procs, + .btl_del_procs = mca_btl_ofi_del_procs, + .btl_finalize = mca_btl_ofi_finalize, + .btl_put = mca_btl_ofi_put, + .btl_get = mca_btl_ofi_get, + .btl_register_mem = mca_btl_ofi_register_mem, + .btl_deregister_mem = mca_btl_ofi_deregister_mem, + .btl_atomic_op = mca_btl_ofi_aop, + .btl_atomic_fop = mca_btl_ofi_afop, + .btl_atomic_cswap = mca_btl_ofi_acswap, + .btl_flush = mca_btl_ofi_flush, + + /* set the default flags for this btl. ofi provides us with rdma and both + * fetching and non-fetching atomics (though limited to add and cswap) */ + .btl_flags = MCA_BTL_FLAGS_RDMA | + MCA_BTL_FLAGS_ATOMIC_FOPS | + MCA_BTL_FLAGS_ATOMIC_OPS, + + .btl_atomic_flags = MCA_BTL_ATOMIC_SUPPORTS_ADD | + MCA_BTL_ATOMIC_SUPPORTS_SWAP | + MCA_BTL_ATOMIC_SUPPORTS_CSWAP | + MCA_BTL_ATOMIC_SUPPORTS_32BIT, + + /* set the default limits on put and get */ + .btl_registration_handle_size = sizeof(mca_btl_base_registration_handle_t), + .btl_put_limit = 1 << 23, + .btl_put_alignment = 0, + .btl_get_limit = 1 << 23, + .btl_get_alignment = 0, + } +}; diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.c b/opal/mca/btl/ofi/btl_ofi_rdma.c new file mode 100644 index 00000000000..9a545038a4d --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_rdma.c @@ -0,0 +1,156 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "btl_ofi_rdma.h" + +OBJ_CLASS_INSTANCE(mca_btl_ofi_completion_t, + opal_free_list_item_t, + NULL, + NULL); + +mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_ofi_context_t *ofi_context, + void *local_address, + mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_rdma_completion_fn_t cbfunc, + void *cbcontext, void *cbdata, + int type) +{ + assert(btl); + assert(endpoint); + assert(ofi_context); + + mca_btl_ofi_completion_t *comp; + + comp = (mca_btl_ofi_completion_t*) opal_free_list_get(&ofi_context->comp_list); + assert(comp); + + comp->btl = btl; + comp->endpoint = endpoint; + comp->my_context = ofi_context; + comp->local_address = local_address; + comp->local_handle = local_handle; + comp->cbfunc = cbfunc; + comp->cbcontext = cbcontext; + comp->cbdata = cbdata; + comp->my_list = &ofi_context->comp_list; + comp->type = type; + + return comp; +} + +int mca_btl_ofi_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, + uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) +{ + + int rc; + + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_completion_t *comp; + mca_btl_ofi_context_t *ofi_context; + + ofi_context = get_ofi_context(ofi_btl); + + /* create completion context */ + comp = mca_btl_ofi_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_GET); + + remote_address = (remote_address - (uint64_t) remote_handle->base_addr); + + /* Remote write data across the wire */ + rc = fi_read(ofi_context->tx_ctx, + local_address, size, /* payload */ + local_handle->desc, + btl_endpoint->peer_addr, + remote_address, remote_handle->rkey, + comp); /* completion context */ + + if (-FI_EAGAIN == rc) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + if (0 != rc) { + BTL_ERROR(("fi_read failed with %d:%s", rc, fi_strerror(-rc))); + MCA_BTL_OFI_ABORT(); + } + + MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); + + return OPAL_SUCCESS; +} + +int mca_btl_ofi_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, void *local_address, + uint64_t remote_address, mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_registration_handle_t *remote_handle, size_t size, int flags, + int order, mca_btl_base_rdma_completion_fn_t cbfunc, void *cbcontext, void *cbdata) +{ + int rc; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_context_t *ofi_context; + + ofi_context = get_ofi_context(ofi_btl); + + /* create completion context */ + mca_btl_ofi_completion_t *comp; + comp = mca_btl_ofi_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_PUT); + + remote_address = (remote_address - (uint64_t) remote_handle->base_addr); + + /* Remote write data across the wire */ + rc = fi_write(ofi_context->tx_ctx, + local_address, size, /* payload */ + local_handle->desc, + btl_endpoint->peer_addr, + remote_address, remote_handle->rkey, + comp); /* completion context */ + + if (-FI_EAGAIN == rc) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + if (0 != rc) { + BTL_ERROR(("fi_write failed with %d:%s", rc, fi_strerror(-rc))); + MCA_BTL_OFI_ABORT(); + } + + MCA_BTL_OFI_NUM_RDMA_INC(ofi_btl); + + return OPAL_SUCCESS; + +} + +int mca_btl_ofi_flush (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint) +{ + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + + while(ofi_btl->outstanding_rdma > 0) { + (void) mca_btl_ofi_component.super.btl_progress(); + } + + return OPAL_SUCCESS; +} diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.h b/opal/mca/btl/ofi/btl_ofi_rdma.h new file mode 100644 index 00000000000..3de42454395 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_rdma.h @@ -0,0 +1,42 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel, Inc, All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef BTL_OFI_RDMA_H +#define BTL_OFI_RDMA_H + +#include "opal/threads/thread_usage.h" + +#include "btl_ofi.h" +#include "btl_ofi_endpoint.h" + +mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_ofi_context_t *ofi_context, + void *local_address, + mca_btl_base_registration_handle_t *local_handle, + mca_btl_base_rdma_completion_fn_t cbfunc, + void *cbcontext, void *cbdata, + int type); + +#define MCA_BTL_OFI_NUM_RDMA_INC(module) \ + OPAL_THREAD_ADD_FETCH64(&(module)->outstanding_rdma, 1); \ + if (module->outstanding_rdma > mca_btl_ofi_component.progress_threshold){ \ + mca_btl_ofi_component.super.btl_progress(); \ + } + +#define MCA_BTL_OFI_NUM_RDMA_DEC(module) \ + OPAL_THREAD_ADD_FETCH64(&(module)->outstanding_rdma, -1); + +#endif /* !defined(BTL_OFI_RDMA_H) */ + diff --git a/opal/mca/btl/ofi/configure.m4 b/opal/mca/btl/ofi/configure.m4 new file mode 100644 index 00000000000..222a7b29e03 --- /dev/null +++ b/opal/mca/btl/ofi/configure.m4 @@ -0,0 +1,51 @@ +# -*- shell-script -*- +# +# Copyright (c) 2004-2005 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-2006 The Regents of the University of California. +# All rights reserved. +# Copyright (c) 2006 QLogic Corp. All rights reserved. +# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2018 Los Alamos National Security, LLC. +# All rights reserved. +# Copyright (c) 2018 Intel, inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# OPAL_CHECK_OFI(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +# check if OFI support can be found. sets prefix_{CPPFLAGS, +# LDFLAGS, LIBS} as needed and runs action-if-found if there is +# support, otherwise executes action-if-not-found + +AC_DEFUN([MCA_opal_btl_ofi_CONFIG],[ + OPAL_VAR_SCOPE_PUSH([opal_btl_ofi_happy CPPFLAGS_save]) + + AC_CONFIG_FILES([opal/mca/btl/ofi/Makefile]) + + AC_REQUIRE([MCA_opal_common_ofi_CONFIG]) + + opal_btl_ofi_happy=0 + AS_IF([test "$opal_common_ofi_happy" = "yes"], + [CPPFLAGS_save=$CPPFLAGS + CPPFLAGS="$opal_common_ofi_CPPFLAGS $CPPFLAGS" + AC_CHECK_DECL([FI_MR_VIRT_ADDR], [opal_btl_ofi_happy=1], [], + [#include ]) + CPPFLAGS=$CPPFLAGS_save]) + AS_IF([test $opal_btl_ofi_happy -eq 1], + [$1], + [$2]) + + OPAL_VAR_SCOPE_POP +])dnl diff --git a/opal/mca/btl/ofi/owner.txt b/opal/mca/btl/ofi/owner.txt new file mode 100644 index 00000000000..f58f1cbab7e --- /dev/null +++ b/opal/mca/btl/ofi/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner:Intel +status:active From 02ac75434a40ae74568b513801992d0423147393 Mon Sep 17 00:00:00 2001 From: Matias Cabral Date: Mon, 23 Jul 2018 11:39:11 -0700 Subject: [PATCH 588/674] MTL OFI: Add support for mem_tag_format OFI providers may reserve some of the upper bits of the tag for internal usage and expose it using mem_tag_format. Check for that and adjust communicator bits as needed. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit d996f529c0377d794dea261c801e504dfbb33170) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/help-mtl-ofi.txt | 10 ++++++- ompi/mca/mtl/ofi/mtl_ofi_component.c | 39 +++++++++++++++++++++++----- ompi/mca/mtl/ofi/mtl_ofi_types.h | 3 +++ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/ompi/mca/mtl/ofi/help-mtl-ofi.txt b/ompi/mca/mtl/ofi/help-mtl-ofi.txt index fe00f11159a..b010c3403eb 100644 --- a/ompi/mca/mtl/ofi/help-mtl-ofi.txt +++ b/ompi/mca/mtl/ofi/help-mtl-ofi.txt @@ -1,6 +1,6 @@ # -*- text -*- # -# Copyright (c) 2013-2017 Intel, Inc. All rights reserved +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved # # Copyright (c) 2017 Cisco Systems, Inc. All rights reserved # $COPYRIGHT$ @@ -16,5 +16,13 @@ unusual; your job may behave unpredictably (and/or abort) after this. Local host: %s Location: %s:%d Error: %s (%zd) +# +[Not enough bits for CID] +OFI provider "%s" does not have enough free bits in its tag to fit the MPI +Communicator ID. See the mem_tag_format of the provider by running: +fi_info -v -p %s + + Local host: %s + Location: %s:%d [message too big] Message size %llu bigger than supported by selected transport. Max = %llu diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index e8a7170a019..90b329e07ec 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -387,10 +387,10 @@ ompi_mtl_ofi_check_fi_remote_cq_data(int fi_version, } static void -ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode) { +ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { switch (ofi_tag_mode) { case MTL_OFI_TAG_1: - ompi_mtl_ofi.base.mtl_max_contextid = (int)((1ULL << MTL_OFI_CID_BIT_COUNT_1 ) - 1); + *bits_for_cid = (int) MTL_OFI_CID_BIT_COUNT_1; ompi_mtl_ofi.base.mtl_max_tag = (int)((1ULL << (MTL_OFI_TAG_BIT_COUNT_1 - 1)) - 1); ompi_mtl_ofi.source_rank_tag_mask = MTL_OFI_SOURCE_TAG_MASK_1; @@ -405,7 +405,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode) { ompi_mtl_ofi.sync_proto_mask = MTL_OFI_PROTO_MASK_1; break; case MTL_OFI_TAG_2: - ompi_mtl_ofi.base.mtl_max_contextid = (int)((1ULL << MTL_OFI_CID_BIT_COUNT_2 ) - 1); + *bits_for_cid = (int) MTL_OFI_CID_BIT_COUNT_2; ompi_mtl_ofi.base.mtl_max_tag = (int)((1ULL << (MTL_OFI_TAG_BIT_COUNT_2 - 1)) - 1); ompi_mtl_ofi.source_rank_tag_mask = MTL_OFI_SOURCE_TAG_MASK_2; @@ -420,7 +420,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode) { ompi_mtl_ofi.sync_proto_mask = MTL_OFI_PROTO_MASK_2; break; default: /* use FI_REMOTE_CQ_DATA */ - ompi_mtl_ofi.base.mtl_max_contextid = (int)((1ULL << MTL_OFI_CID_BIT_COUNT_DATA ) - 1); + *bits_for_cid = (int) MTL_OFI_CID_BIT_COUNT_DATA; ompi_mtl_ofi.base.mtl_max_tag = (int)((1ULL << (MTL_OFI_TAG_BIT_COUNT_DATA - 1)) - 1); ompi_mtl_ofi.mpi_tag_mask = MTL_OFI_TAG_MASK_DATA; @@ -444,6 +444,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, struct fi_av_attr av_attr = {0}; char ep_name[FI_NAME_MAX] = {0}; size_t namelen; + int ofi_tag_leading_zeros; + int ofi_tag_bits_for_cid; /** * Hints to filter providers @@ -558,7 +560,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.fi_cq_data = false; if (MTL_OFI_TAG_AUTO == ofi_tag_mode) { /* Fallback to MTL_OFI_TAG_1 */ - ompi_mtl_ofi_define_tag_mode(MTL_OFI_TAG_1); + ompi_mtl_ofi_define_tag_mode(MTL_OFI_TAG_1, &ofi_tag_bits_for_cid); } else { /* MTL_OFI_TAG_FULL */ opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: OFI provider %s does not support FI_REMOTE_CQ_DATA\n", @@ -569,13 +571,36 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, /* Use FI_REMTOTE_CQ_DATA */ ompi_mtl_ofi.fi_cq_data = true; prov = prov_cq_data; - ompi_mtl_ofi_define_tag_mode(MTL_OFI_TAG_FULL); + ompi_mtl_ofi_define_tag_mode(MTL_OFI_TAG_FULL, &ofi_tag_bits_for_cid); } } else { /* MTL_OFI_TAG_1 or MTL_OFI_TAG_2 */ ompi_mtl_ofi.fi_cq_data = false; - ompi_mtl_ofi_define_tag_mode(ofi_tag_mode); + ompi_mtl_ofi_define_tag_mode(ofi_tag_mode, &ofi_tag_bits_for_cid); } + /** + * Check for potential bits in the OFI tag that providers may be reserving + * for internal usage (see mem_tag_format in fi_endpoint man page). + */ + + ofi_tag_leading_zeros = 0; + while (!((prov->ep_attr->mem_tag_format << ofi_tag_leading_zeros++) & + (uint64_t) MTL_OFI_HIGHEST_TAG_BIT) && + /* Do not keep looping if the provider does not support enough bits */ + (ofi_tag_bits_for_cid >= MTL_OFI_MINIMUM_CID_BITS)){ + ofi_tag_bits_for_cid--; + } + + if (ofi_tag_bits_for_cid < MTL_OFI_MINIMUM_CID_BITS) { + opal_show_help("help-mtl-ofi.txt", "Not enough bits for CID", true, + prov->fabric_attr->prov_name, + prov->fabric_attr->prov_name, + ompi_process_info.nodename, __FILE__, __LINE__); + goto error; + } + + /* Update the maximum supported Communicator ID */ + ompi_mtl_ofi.base.mtl_max_contextid = (int)((1ULL << ofi_tag_bits_for_cid) - 1); ompi_mtl_ofi.num_peers = 0; /** diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 0831c3b9881..30b10bd9be0 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -89,12 +89,15 @@ typedef struct mca_mtl_ofi_component_t { * More details of the tags are in the README file (mtl_ofi_tag_mode). */ +#define MTL_OFI_MINIMUM_CID_BITS (8) + /* Support FI_REMOTE_CQ_DATA, send the source rank in the CQ data (4 Bytes is the minimum) * 01234567 01234567 01234567 012345 67 01234567 01234567 01234567 01234567 * | | * context_id |prot| message tag */ #define MTL_OFI_PROTO_BIT_COUNT (2) +#define MTL_OFI_HIGHEST_TAG_BIT (0x8000000000000000ULL) #define MTL_OFI_CID_MASK_DATA (0xFFFFFFFC00000000ULL) #define MTL_OFI_CID_BIT_COUNT_DATA (30) From f9439c6d18347afe76212d60ce3e710a0a57dac7 Mon Sep 17 00:00:00 2001 From: Thananon Patinyasakdikul Date: Fri, 3 Aug 2018 12:30:03 -0700 Subject: [PATCH 589/674] btl/ofi: Added 2 side communication support. The 2 sided communication support is added for non-tagmatching provider to take advantage of this BTL and PML OB1. The current state is "functional" and not optimized for performance. Two sided support is disabled by default and can be turned on by mca parameter: "mca_btl_ofi_mode". Signed-off-by: Thananon Patinyasakdikul (cherry picked from commit 080115d44069e0c461a1af105cd41f28849cdffc) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/Makefile.am | 5 +- opal/mca/btl/ofi/README | 22 ++ opal/mca/btl/ofi/btl_ofi.h | 87 ++++- opal/mca/btl/ofi/btl_ofi_atomics.c | 49 +-- opal/mca/btl/ofi/btl_ofi_component.c | 191 ++++++----- opal/mca/btl/ofi/btl_ofi_context.c | 463 +++++++++++++++++++++++++++ opal/mca/btl/ofi/btl_ofi_endpoint.c | 293 ----------------- opal/mca/btl/ofi/btl_ofi_endpoint.h | 2 +- opal/mca/btl/ofi/btl_ofi_frag.c | 198 ++++++++++++ opal/mca/btl/ofi/btl_ofi_frag.h | 95 ++++++ opal/mca/btl/ofi/btl_ofi_module.c | 199 +++++++++--- opal/mca/btl/ofi/btl_ofi_rdma.c | 53 +-- opal/mca/btl/ofi/btl_ofi_rdma.h | 2 +- 13 files changed, 1158 insertions(+), 501 deletions(-) create mode 100644 opal/mca/btl/ofi/btl_ofi_context.c create mode 100644 opal/mca/btl/ofi/btl_ofi_frag.c create mode 100644 opal/mca/btl/ofi/btl_ofi_frag.h diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am index fdaeec865d7..b2250dc7ce2 100644 --- a/opal/mca/btl/ofi/Makefile.am +++ b/opal/mca/btl/ofi/Makefile.am @@ -31,7 +31,10 @@ sources = \ btl_ofi_module.c \ btl_ofi_rdma.h \ btl_ofi_rdma.c \ - btl_ofi_atomics.c + btl_ofi_atomics.c \ + btl_ofi_frag.c \ + btl_ofi_frag.h \ + btl_ofi_context.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la diff --git a/opal/mca/btl/ofi/README b/opal/mca/btl/ofi/README index 97e3759830d..0872da0aab4 100644 --- a/opal/mca/btl/ofi/README +++ b/opal/mca/btl/ofi/README @@ -86,3 +86,25 @@ Known Problems: - sockets provider uses progress thread and can cause segfault in finalize as we free the resources while progress thread is still using it. sleep(1) was put in mca_btl_ofi_componenet_close() for this reason. + - sockets provider deadlock in two-sided mode. Might be something about buffered recv. + (August 2018). + +======================================== + +Scalable Endpoint + +This BTL will try to use scalable endpoint to create communication context. This will increase +multithreaded performance for some application. The default number of context created is 1 and +can be tuned VIA MCA parameter "btl_ofi_num_contexts_per_module". It is advised that the number +of context should be equal to number of physical core for optimal performance. + +User can disable scalable endpoint by MCA parameter "btl_ofi_disable_sep". +With scalable endpoint disbled, the BTL will alias OFI endpoint to both tx and rx context. + +======================================== + +Two sided communication + +Two sided communication is added later on to BTL OFI to enable non tag-matching provider +to be able to use in Open MPI with this BTL. However, the support is only for "functional" +and has not been optimized for performance at this point. (August 2018) diff --git a/opal/mca/btl/ofi/btl_ofi.h b/opal/mca/btl/ofi/btl_ofi.h index 02e44fd8b30..a96bbf0b566 100644 --- a/opal/mca/btl/ofi/btl_ofi.h +++ b/opal/mca/btl/ofi/btl_ofi.h @@ -38,6 +38,8 @@ #include "opal/mca/rcache/base/base.h" #include "opal/mca/pmix/pmix.h" +#include "opal/class/opal_hash_table.h" + #include #include #include @@ -47,18 +49,31 @@ BEGIN_C_DECLS #define MCA_BTL_OFI_MAX_MODULES 16 -#define MCA_BTL_OFI_MAX_CQ_READ_ENTRIES 128 #define MCA_BTL_OFI_NUM_CQE_READ 64 -#define MCA_BTL_OFI_PROGRESS_THRESHOLD 64 + +#define MCA_BTL_OFI_DEFAULT_RD_NUM 10 +#define MCA_BTL_OFI_DEFAULT_MAX_CQE 128 +#define MCA_BTL_OFI_DEFAULT_PROGRESS_THRESHOLD 64 #define MCA_BTL_OFI_ABORT(args) mca_btl_ofi_exit(args) -enum mca_btl_ofi_type { - MCA_BTL_OFI_TYPE_PUT = 1, +#define TWO_SIDED_ENABLED mca_btl_ofi_component.two_sided_enabled + +enum mca_btl_ofi_mode { + MCA_BTL_OFI_MODE_ONE_SIDED = 0, + MCA_BTL_OFI_MODE_TWO_SIDED, + MCA_BTL_OFI_MODE_FULL_SUPPORT, + MCA_BTL_OFI_MODE_TOTAL +}; + +enum mca_btl_ofi_hdr_type { + MCA_BTL_OFI_TYPE_PUT = 0, MCA_BTL_OFI_TYPE_GET, MCA_BTL_OFI_TYPE_AOP, MCA_BTL_OFI_TYPE_AFOP, MCA_BTL_OFI_TYPE_CSWAP, + MCA_BTL_OFI_TYPE_SEND, + MCA_BTL_OFI_TYPE_RECV, MCA_BTL_OFI_TYPE_TOTAL }; @@ -75,7 +90,9 @@ struct mca_btl_ofi_context_t { /* completion info freelist */ /* We have it per context to reduce the thread contention * on the freelist. Things can get really slow. */ - opal_free_list_t comp_list; + opal_free_list_t rdma_comp_list; + opal_free_list_t frag_comp_list; + opal_free_list_t frag_list; /* for thread locking */ volatile int32_t lock; @@ -107,12 +124,14 @@ struct mca_btl_ofi_module_t { bool is_scalable_ep; int64_t outstanding_rdma; + int64_t outstanding_send; /** linked list of BTL endpoints. this list is never searched so * there is no need for a complicated structure here at this time*/ opal_list_t endpoints; opal_mutex_t module_lock; + opal_hash_table_t id_to_endpoint; /** registration cache */ mca_rcache_base_module_t *rcache; @@ -132,6 +151,9 @@ struct mca_btl_ofi_component_t { int num_contexts_per_module; int num_cqe_read; int progress_threshold; + int mode; + int rd_num; + bool two_sided_enabled; size_t namelen; @@ -160,32 +182,73 @@ typedef struct mca_btl_ofi_reg_t mca_btl_ofi_reg_t; OBJ_CLASS_DECLARATION(mca_btl_ofi_reg_t); +struct mca_btl_ofi_header_t { + mca_btl_base_tag_t tag; + size_t len; +}; +typedef struct mca_btl_ofi_header_t mca_btl_ofi_header_t; + +struct mca_btl_ofi_base_frag_t { + mca_btl_base_descriptor_t base; + mca_btl_base_segment_t segments[2]; + + int context_id; + struct mca_btl_ofi_module_t *btl; + struct mca_btl_base_endpoint_t *endpoint; + opal_free_list_t *free_list; + mca_btl_ofi_header_t hdr; +}; + +typedef struct mca_btl_ofi_base_frag_t mca_btl_ofi_base_frag_t; + +OBJ_CLASS_DECLARATION(mca_btl_ofi_base_frag_t); + + +struct mca_btl_ofi_completion_context_t { + struct fi_context ctx; + void *comp; +}; + +typedef struct mca_btl_ofi_completion_context_t mca_btl_ofi_completion_context_t; + /* completion structure store information needed * for RDMA callbacks */ -struct mca_btl_ofi_completion_t { +struct mca_btl_ofi_base_completion_t { opal_free_list_item_t comp_list; + opal_free_list_t *my_list; struct mca_btl_base_module_t *btl; struct mca_btl_base_endpoint_t *endpoint; struct mca_btl_ofi_context_t *my_context; - uint32_t type; + int type; +}; +typedef struct mca_btl_ofi_base_completion_t mca_btl_ofi_base_completion_t; +struct mca_btl_ofi_rdma_completion_t { + mca_btl_ofi_base_completion_t base; + mca_btl_ofi_completion_context_t comp_ctx; void *local_address; mca_btl_base_registration_handle_t *local_handle; - /* information for atomic op */ uint64_t operand; uint64_t compare; mca_btl_base_rdma_completion_fn_t cbfunc; void *cbcontext; void *cbdata; +}; +typedef struct mca_btl_ofi_rdma_completion_t mca_btl_ofi_rdma_completion_t; +struct mca_btl_ofi_frag_completion_t { + mca_btl_ofi_base_completion_t base; + mca_btl_ofi_completion_context_t comp_ctx; + mca_btl_ofi_base_frag_t *frag; }; -typedef struct mca_btl_ofi_completion_t mca_btl_ofi_completion_t; +typedef struct mca_btl_ofi_frag_completion_t mca_btl_ofi_frag_completion_t; -OBJ_CLASS_DECLARATION(mca_btl_ofi_completion_t); +OBJ_CLASS_DECLARATION(mca_btl_ofi_rdma_completion_t); +OBJ_CLASS_DECLARATION(mca_btl_ofi_frag_completion_t); /** * Initiate an asynchronous put. @@ -288,6 +351,10 @@ int mca_btl_ofi_reg_mem (void *reg_data, void *base, size_t size, int mca_btl_ofi_dereg_mem (void *reg_data, mca_rcache_base_registration_t *reg); int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context); + +mca_btl_ofi_module_t * mca_btl_ofi_module_alloc (int mode); + +int mca_btl_ofi_post_recvs(mca_btl_base_module_t* module, mca_btl_ofi_context_t *context, int count); void mca_btl_ofi_exit(void); /* thread atomics */ diff --git a/opal/mca/btl/ofi/btl_ofi_atomics.c b/opal/mca/btl/ofi/btl_ofi_atomics.c index e5364ed6489..34fa9cc4776 100644 --- a/opal/mca/btl/ofi/btl_ofi_atomics.c +++ b/opal/mca/btl/ofi/btl_ofi_atomics.c @@ -42,7 +42,7 @@ int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_end mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; + mca_btl_ofi_rdma_completion_t *comp = NULL; mca_btl_ofi_context_t *ofi_context; ofi_context = get_ofi_context(ofi_btl); @@ -53,12 +53,12 @@ int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_end fi_op = to_fi_op(op); - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_AFOP); + comp = mca_btl_ofi_rdma_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_AFOP); /* copy the operand because it might get freed from upper layer */ comp->operand = (uint64_t) operand; @@ -70,7 +70,7 @@ int mca_btl_ofi_afop (struct mca_btl_base_module_t *btl, struct mca_btl_base_end local_address, local_handle->desc, /* results */ btl_endpoint->peer_addr, /* remote addr */ remote_address, remote_handle->rkey, /* remote buffer */ - fi_datatype, fi_op, comp); + fi_datatype, fi_op, &comp->comp_ctx); if (rc == -FI_EAGAIN) { return OPAL_ERR_OUT_OF_RESOURCE; @@ -95,7 +95,7 @@ int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, mca_btl_base_endpoint_t mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; + mca_btl_ofi_rdma_completion_t *comp = NULL; mca_btl_ofi_context_t *ofi_context; ofi_context = get_ofi_context(ofi_btl); @@ -106,12 +106,12 @@ int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, mca_btl_base_endpoint_t fi_op = to_fi_op(op); - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - NULL, - NULL, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_AOP); + comp = mca_btl_ofi_rdma_completion_alloc(btl, endpoint, + ofi_context, + NULL, + NULL, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_AOP); /* copy the operand because it might get freed from upper layer */ comp->operand = (uint64_t) operand; @@ -122,7 +122,7 @@ int mca_btl_ofi_aop (struct mca_btl_base_module_t *btl, mca_btl_base_endpoint_t (void*) &comp->operand, 1, NULL, /* operand */ btl_endpoint->peer_addr, /* remote addr */ remote_address, remote_handle->rkey, /* remote buffer */ - fi_datatype, fi_op, comp); + fi_datatype, fi_op, &comp->comp_ctx); if (rc == -FI_EAGAIN) { return OPAL_ERR_OUT_OF_RESOURCE; @@ -144,9 +144,10 @@ int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_e int rc; int fi_datatype = FI_UINT64; + mca_btl_ofi_rdma_completion_t *comp = NULL; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp = NULL; mca_btl_ofi_context_t *ofi_context; ofi_context = get_ofi_context(ofi_btl); @@ -155,12 +156,12 @@ int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_e fi_datatype = FI_UINT32; } - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_CSWAP); + comp = mca_btl_ofi_rdma_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_CSWAP); /* copy the operand because it might get freed from upper layer */ comp->operand = (uint64_t) value; @@ -177,7 +178,7 @@ int mca_btl_ofi_acswap (struct mca_btl_base_module_t *btl, struct mca_btl_base_e remote_address, remote_handle->rkey, fi_datatype, FI_CSWAP, - comp); + &comp->comp_ctx); if (rc == -FI_EAGAIN) { return OPAL_ERR_OUT_OF_RESOURCE; diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 1ee541afb36..d1e03fc2d79 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -33,26 +33,28 @@ #include "btl_ofi.h" #include "btl_ofi_endpoint.h" #include "btl_ofi_rdma.h" +#include "btl_ofi_frag.h" + +#define MCA_BTL_OFI_ONE_SIDED_REQUIRED_CAPS (FI_RMA | FI_ATOMIC) +#define MCA_BTL_OFI_TWO_SIDED_REQUIRED_CAPS (FI_MSG) -#define MCA_BTL_OFI_REQUIRED_CAPS (FI_RMA | FI_ATOMIC) #define MCA_BTL_OFI_REQUESTED_MR_MODE (FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_VIRT_ADDR) static char *prov_include; -static char *prov_exclude; static char *ofi_progress_mode; static bool disable_sep; static int mca_btl_ofi_init_device(struct fi_info *info); /* validate information returned from fi_getinfo(). * return OPAL_ERROR if we dont have what we need. */ -static int validate_info(struct fi_info *info) +static int validate_info(struct fi_info *info, uint64_t required_caps) { int mr_mode; BTL_VERBOSE(("validating device: %s", info->domain_attr->name)); /* we need exactly all the required bits */ - if ((info->caps & MCA_BTL_OFI_REQUIRED_CAPS) != MCA_BTL_OFI_REQUIRED_CAPS) { + if ((info->caps & required_caps) != required_caps) { BTL_VERBOSE(("unsupported caps")); return OPAL_ERROR; } @@ -83,8 +85,27 @@ static int validate_info(struct fi_info *info) /* Register the MCA parameters */ static int mca_btl_ofi_component_register(void) { + char *msg; mca_btl_ofi_module_t *module = &mca_btl_ofi_module_template; + asprintf(&msg, "BTL OFI mode of operation. Valid values are: %d = One-Sided only, %d=Two-Sided only, " + "%d = Both one and two sided. BTL OFI is only optimized for one-sided communication", + MCA_BTL_OFI_MODE_ONE_SIDED, + MCA_BTL_OFI_MODE_TWO_SIDED, + MCA_BTL_OFI_MODE_FULL_SUPPORT); + if (NULL == msg) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + mca_btl_ofi_component.mode = MCA_BTL_OFI_MODE_ONE_SIDED; + (void)mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "mode", + msg, + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_btl_ofi_component.mode); + /* fi_getinfo with prov_name == NULL means ALL provider. * Since now we are using the first valid info returned, I'm not sure * if we need to provide the support for comma limited provider list. */ @@ -100,19 +121,6 @@ static int mca_btl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &prov_include); - /* TODO: this param has not been implemented. Not sure if we need it. " */ - prov_exclude = NULL; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "provider_exclude", - "Comma-delimited list of OFI providers that are not considered for use " - "(default: \"sockets,mxm\"; empty value means that all providers will " - " be considered). " - "Mutually exclusive with btl_ofi_provider_include.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_4, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_exclude); - mca_btl_ofi_component.num_cqe_read = MCA_BTL_OFI_NUM_CQE_READ; (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, "num_cq_read", @@ -146,13 +154,13 @@ static int mca_btl_ofi_component_register(void) disable_sep = false; (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, "disable_sep", - "force btl/ofi to never use scalable endpoint. ", + "force btl/ofi to never use scalable endpoint.", MCA_BASE_VAR_TYPE_BOOL, NULL, 0, 0, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_READONLY, &disable_sep); - mca_btl_ofi_component.progress_threshold = MCA_BTL_OFI_PROGRESS_THRESHOLD; + mca_btl_ofi_component.progress_threshold = MCA_BTL_OFI_DEFAULT_PROGRESS_THRESHOLD; (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, "progress_threshold", "number of outstanding operation before btl will progress " @@ -163,7 +171,17 @@ static int mca_btl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &mca_btl_ofi_component.progress_threshold); - /* for now we want this component to lose to btl/ugni and btl/vader */ + mca_btl_ofi_component.rd_num = MCA_BTL_OFI_DEFAULT_RD_NUM; + (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, + "rd_num", + "Number of receive descriptor posted per context.", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_btl_ofi_component.rd_num); + + + /* for now we want this component to lose to the MTL. */ module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH - 50; return mca_btl_base_param_register (&mca_btl_ofi_component.super.btl_version, @@ -226,6 +244,26 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, struct fi_tx_attr tx_attr = {0}; struct fi_fabric_attr fabric_attr = {0}; struct fi_domain_attr domain_attr = {0}; + uint64_t required_caps; + + switch (mca_btl_ofi_component.mode) { + + case MCA_BTL_OFI_MODE_TWO_SIDED: + mca_btl_ofi_component.two_sided_enabled = true; + required_caps = MCA_BTL_OFI_TWO_SIDED_REQUIRED_CAPS; + break; + + case MCA_BTL_OFI_MODE_FULL_SUPPORT: + mca_btl_ofi_component.two_sided_enabled = true; + required_caps = MCA_BTL_OFI_ONE_SIDED_REQUIRED_CAPS | + MCA_BTL_OFI_TWO_SIDED_REQUIRED_CAPS; + break; + + default: + /* default to only one sided. */ + required_caps = MCA_BTL_OFI_ONE_SIDED_REQUIRED_CAPS; + break; + } /* Select the provider */ fabric_attr.prov_name = prov_include; @@ -248,7 +286,9 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, ep_attr.type = FI_EP_RDM; /* ask for capabilities */ - hints.caps = MCA_BTL_OFI_REQUIRED_CAPS; + /* TODO: catch the caps here. */ + hints.caps = required_caps; + hints.mode = FI_CONTEXT; /* Ask for completion context */ hints.mode = FI_CONTEXT; @@ -285,7 +325,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, info = info_list; while(info) { - rc = validate_info(info); + rc = validate_info(info, required_caps); if (OPAL_SUCCESS == rc) { /* Device passed sanity check, let's make a module. * We only pick the first device we found valid */ @@ -337,13 +377,15 @@ static int mca_btl_ofi_init_device(struct fi_info *info) mca_btl_ofi_module_t *module; - /* allocate module */ - module = (mca_btl_ofi_module_t*) calloc(1, sizeof(mca_btl_ofi_module_t)); + module = mca_btl_ofi_module_alloc(mca_btl_ofi_component.mode); if (NULL == module) { - BTL_ERROR(("failed to allocate memory for OFI module")); + BTL_VERBOSE(("failed allocating ofi module")); goto fail; } - *module = mca_btl_ofi_module_template; + + /* If the user ask for two sided support, something bad is happening + * to the MTL, so we will take maximum priority to supersede the MTL. */ + module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_DEFAULT; /* make a copy of the given info to store on the module */ ofi_info = fi_dupinfo(info); @@ -486,6 +528,13 @@ static int mca_btl_ofi_init_device(struct fi_info *info) /* create endpoint list */ OBJ_CONSTRUCT(&module->endpoints, opal_list_t); OBJ_CONSTRUCT(&module->module_lock, opal_mutex_t); + OBJ_CONSTRUCT(&module->id_to_endpoint, opal_hash_table_t); + + rc = opal_hash_table_init (&module->id_to_endpoint, 512); + if (OPAL_SUCCESS != rc) { + BTL_ERROR(("error initializing hash table.")); + goto fail; + } /* create and send the modex for this device */ namelen = sizeof(ep_name); @@ -498,6 +547,21 @@ static int mca_btl_ofi_init_device(struct fi_info *info) goto fail; } + + /* If we have two-sided support. */ + if (TWO_SIDED_ENABLED) { + + /* post wildcard recvs */ + for (int i=0; i < module->num_contexts; i++) { + rc = mca_btl_ofi_post_recvs((mca_btl_base_module_t*) module, + &module->contexts[i], + mca_btl_ofi_component.rd_num); + if (OPAL_SUCCESS != rc) { + goto fail; + } + } + } + /* post our endpoint name so peer can use it to connect to us */ OPAL_MODEX_SEND(rc, OPAL_PMIX_GLOBAL, @@ -586,81 +650,6 @@ static int mca_btl_ofi_component_progress (void) return events; } -int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context) { - - int ret = 0; - int events_read; - int events = 0; - struct fi_cq_entry cq_entry[MCA_BTL_OFI_MAX_CQ_READ_ENTRIES]; - struct fi_cq_err_entry cqerr = {0}; - - mca_btl_ofi_completion_t *comp; - - ret = fi_cq_read(context->cq, &cq_entry, mca_btl_ofi_component.num_cqe_read); - - if (0 < ret) { - events_read = ret; - for (int i = 0; i < events_read; i++) { - if (NULL != cq_entry[i].op_context) { - ++events; - comp = (mca_btl_ofi_completion_t*) cq_entry[i].op_context; - mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*)comp->btl; - - switch (comp->type) { - case MCA_BTL_OFI_TYPE_GET: - case MCA_BTL_OFI_TYPE_PUT: - case MCA_BTL_OFI_TYPE_AOP: - case MCA_BTL_OFI_TYPE_AFOP: - case MCA_BTL_OFI_TYPE_CSWAP: - - /* call the callback */ - if (comp->cbfunc) { - comp->cbfunc (comp->btl, comp->endpoint, - comp->local_address, comp->local_handle, - comp->cbcontext, comp->cbdata, OPAL_SUCCESS); - } - - /* return the completion handler */ - opal_free_list_return(comp->my_list, (opal_free_list_item_t*) comp); - - MCA_BTL_OFI_NUM_RDMA_DEC(ofi_btl); - break; - - default: - /* catasthrophic */ - BTL_ERROR(("unknown completion type")); - MCA_BTL_OFI_ABORT(); - } - } - } - } else if (OPAL_UNLIKELY(ret == -FI_EAVAIL)) { - ret = fi_cq_readerr(context->cq, &cqerr, 0); - - /* cq readerr failed!? */ - if (0 > ret) { - BTL_ERROR(("%s:%d: Error returned from fi_cq_readerr: %s(%d)", - __FILE__, __LINE__, fi_strerror(-ret), ret)); - } else { - BTL_ERROR(("fi_cq_readerr: (provider err_code = %d)\n", - cqerr.prov_errno)); - } - MCA_BTL_OFI_ABORT(); - } -#ifdef FI_EINTR - /* sometimes, sockets provider complain about interupt. We do nothing. */ - else if (OPAL_UNLIKELY(ret == -FI_EINTR)) { - - } -#endif - /* If the error is not FI_EAGAIN, report the error and abort. */ - else if (OPAL_UNLIKELY(ret != -FI_EAGAIN)) { - BTL_ERROR(("fi_cq_read returned error %d:%s", ret, fi_strerror(-ret))); - MCA_BTL_OFI_ABORT(); - } - - return events; -} - /** OFI btl component */ mca_btl_ofi_component_t mca_btl_ofi_component = { .super = { diff --git a/opal/mca/btl/ofi/btl_ofi_context.c b/opal/mca/btl/ofi/btl_ofi_context.c new file mode 100644 index 00000000000..bd399c62280 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_context.c @@ -0,0 +1,463 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * $COPYRIGHT$ + * Copyright (c) 2018 Intel Inc. All rights reserved + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "btl_ofi.h" +#include "btl_ofi_frag.h" +#include "btl_ofi_rdma.h" + +#if OPAL_HAVE_THREAD_LOCAL +opal_thread_local mca_btl_ofi_context_t *my_context = NULL; +#endif /* OPAL_HAVE_THREAD_LOCAL */ + +int init_context_freelists(mca_btl_ofi_context_t *context) +{ + int rc; + OBJ_CONSTRUCT(&context->rdma_comp_list, opal_free_list_t); + rc = opal_free_list_init(&context->rdma_comp_list, + sizeof(mca_btl_ofi_rdma_completion_t), + opal_cache_line_size, + OBJ_CLASS(mca_btl_ofi_rdma_completion_t), + 0, + 0, + 512, + -1, + 512, + NULL, + 0, + NULL, + NULL, + NULL); + if (rc != OPAL_SUCCESS) { + BTL_VERBOSE(("cannot allocate completion freelist")); + return rc; + } + + if (TWO_SIDED_ENABLED) { + OBJ_CONSTRUCT(&context->frag_comp_list, opal_free_list_t); + rc = opal_free_list_init(&context->frag_comp_list, + sizeof(mca_btl_ofi_frag_completion_t), + opal_cache_line_size, + OBJ_CLASS(mca_btl_ofi_frag_completion_t), + 0, + 0, + 512, + -1, + 512, + NULL, + 0, + NULL, + NULL, + NULL); + if (rc != OPAL_SUCCESS) { + BTL_VERBOSE(("cannot allocate completion freelist")); + return rc; + } + + /* Initialize frag pool */ + OBJ_CONSTRUCT(&context->frag_list, opal_free_list_t); + rc = opal_free_list_init(&context->frag_list, + sizeof(mca_btl_ofi_base_frag_t) + + MCA_BTL_OFI_FRAG_SIZE, + opal_cache_line_size, + OBJ_CLASS(mca_btl_ofi_base_frag_t), + 0, + 0, + 1024, + -1, + 1024, + NULL, + 0, + NULL, + NULL, + NULL); + if (OPAL_SUCCESS != rc) { + BTL_VERBOSE(("failed to init frag pool (free_list)")); + } + } + + return rc; +} + +/* mca_btl_ofi_context_alloc_normal() + * + * This function will allocate an ofi_context, map the endpoint to tx/rx context, + * bind CQ,AV to the endpoint and initialize all the structure. + * USE WITH NORMAL ENDPOINT ONLY */ +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *ep, + struct fid_av *av) +{ + int rc; + uint32_t cq_flags = FI_TRANSMIT | FI_SEND | FI_RECV; + char *linux_device_name = info->domain_attr->name; + + struct fi_cq_attr cq_attr = {0}; + + mca_btl_ofi_context_t *context; + + context = (mca_btl_ofi_context_t*) calloc(1, sizeof(*context)); + if (NULL == context) { + BTL_VERBOSE(("cannot allocate context")); + return NULL; + } + + /* Don't really need to check, just avoiding compiler warning because + * BTL_VERBOSE is a no op in performance build and the compiler will + * complain about unused variable. */ + if (NULL == linux_device_name) { + BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); + goto single_fail; + } + + cq_attr.format = FI_CQ_FORMAT_CONTEXT; + cq_attr.wait_obj = FI_WAIT_NONE; + rc = fi_cq_open(domain, &cq_attr, &context->cq, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_cq_open with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = fi_ep_bind(ep, (fid_t)av, 0); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = fi_ep_bind(ep, (fid_t)context->cq, cq_flags); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto single_fail; + } + + rc = init_context_freelists(context); + if (rc != OPAL_SUCCESS) { + goto single_fail; + } + + context->tx_ctx = ep; + context->rx_ctx = ep; + context->context_id = 0; + + return context; + +single_fail: + mca_btl_ofi_context_finalize(context, false); + return NULL; +} + +/* mca_btl_ofi_context_alloc_scalable() + * + * This function allocate communication contexts and return the pointer + * to the first btl context. It also take care of all the bindings needed. + * USE WITH SCALABLE ENDPOINT ONLY */ +mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, + struct fid_domain *domain, + struct fid_ep *sep, + struct fid_av *av, + size_t num_contexts) +{ + BTL_VERBOSE(("creating %zu contexts", num_contexts)); + + int rc; + size_t i; + char *linux_device_name = info->domain_attr->name; + + struct fi_cq_attr cq_attr = {0}; + struct fi_tx_attr tx_attr = {0}; + struct fi_rx_attr rx_attr = {0}; + + mca_btl_ofi_context_t *contexts; + tx_attr.op_flags = FI_DELIVERY_COMPLETE; + + contexts = (mca_btl_ofi_context_t*) calloc(num_contexts, sizeof(*contexts)); + if (NULL == contexts) { + BTL_VERBOSE(("cannot allocate communication contexts.")); + return NULL; + } + + /* Don't really need to check, just avoiding compiler warning because + * BTL_VERBOSE is a no op in performance build and the compiler will + * complain about unused variable. */ + if (NULL == linux_device_name) { + BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); + goto scalable_fail; + } + + /* bind AV to endpoint */ + rc = fi_scalable_ep_bind(sep, (fid_t)av, 0); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + for (i=0; i < num_contexts; i++) { + rc = fi_tx_context(sep, i, &tx_attr, &contexts[i].tx_ctx, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_tx_context with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* We don't actually need a receiving context as we only do one-sided. + * However, sockets provider will hang if we dont have one. It is + * also nice to have equal number of tx/rx context. */ + rc = fi_rx_context(sep, i, &rx_attr, &contexts[i].rx_ctx, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_rx_context with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* create CQ */ + cq_attr.format = FI_CQ_FORMAT_CONTEXT; + cq_attr.wait_obj = FI_WAIT_NONE; + rc = fi_cq_open(domain, &cq_attr, &contexts[i].cq, NULL); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_cq_open with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* bind cq to transmit context */ + rc = fi_ep_bind(contexts[i].tx_ctx, (fid_t)contexts[i].cq, FI_TRANSMIT); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* bind cq to receiving context */ + if (TWO_SIDED_ENABLED) { + rc = fi_ep_bind(contexts[i].rx_ctx, (fid_t)contexts[i].cq, FI_RECV); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + } + + /* enable the context. */ + rc = fi_enable(contexts[i].tx_ctx); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_enable with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + rc = fi_enable(contexts[i].rx_ctx); + if (0 != rc) { + BTL_VERBOSE(("%s failed fi_enable with err=%s", + linux_device_name, + fi_strerror(-rc) + )); + goto scalable_fail; + } + + /* initialize freelists. */ + rc = init_context_freelists(&contexts[i]); + if (rc != OPAL_SUCCESS) { + goto scalable_fail; + } + + /* assign the id */ + contexts[i].context_id = i; + } + + return contexts; + +scalable_fail: + /* close and free */ + for(i=0; i < num_contexts; i++) { + mca_btl_ofi_context_finalize(&contexts[i], true); + } + free(contexts); + + return NULL; +} + +void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep) { + + /* if it is a scalable ep, we have to close all contexts. */ + if (scalable_ep) { + if (NULL != context->tx_ctx) { + fi_close(&context->tx_ctx->fid); + } + + if (NULL != context->rx_ctx) { + fi_close(&context->rx_ctx->fid); + } + } + + if( NULL != context->cq) { + fi_close(&context->cq->fid); + } + + /* Can we destruct the object that hasn't been constructed? */ + OBJ_DESTRUCT(&context->rdma_comp_list); + + if (TWO_SIDED_ENABLED) { + OBJ_DESTRUCT(&context->frag_comp_list); + OBJ_DESTRUCT(&context->frag_list); + } +} + +/* Get a context to use for communication. + * If TLS is supported, it will use the cached endpoint. + * If not, it will invoke the normal round-robin assignment. */ +mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl) +{ +#if OPAL_HAVE_THREAD_LOCAL + /* With TLS, we cache the context we use. */ + static volatile int64_t cur_num = 0; + + if (OPAL_UNLIKELY(my_context == NULL)) { + OPAL_THREAD_LOCK(&btl->module_lock); + + my_context = &btl->contexts[cur_num]; + cur_num = (cur_num + 1) %btl->num_contexts; + + OPAL_THREAD_UNLOCK(&btl->module_lock); + } + + assert (my_context); + return my_context; +#else + return get_ofi_context_rr(btl); +#endif +} + +/* return the context in a round-robin. */ +/* There is no need for atomics here as it might hurt the performance. */ +mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl) +{ + static volatile uint64_t rr_num = 0; + return &btl->contexts[rr_num++%btl->num_contexts]; +} + +int mca_btl_ofi_context_progress(mca_btl_ofi_context_t *context) { + + int ret = 0; + int events_read; + int events = 0; + struct fi_cq_entry cq_entry[MCA_BTL_OFI_DEFAULT_MAX_CQE]; + struct fi_cq_err_entry cqerr = {0}; + + mca_btl_ofi_completion_context_t *c_ctx; + mca_btl_ofi_base_completion_t *comp; + mca_btl_ofi_rdma_completion_t *rdma_comp; + mca_btl_ofi_frag_completion_t *frag_comp; + + ret = fi_cq_read(context->cq, &cq_entry, mca_btl_ofi_component.num_cqe_read); + + if (0 < ret) { + events_read = ret; + for (int i = 0; i < events_read; i++) { + if (NULL != cq_entry[i].op_context) { + ++events; + + c_ctx = (mca_btl_ofi_completion_context_t*) cq_entry[i].op_context; + + /* We are casting to every type here just for simplicity. */ + comp = (mca_btl_ofi_base_completion_t*) c_ctx->comp; + frag_comp = (mca_btl_ofi_frag_completion_t*) c_ctx->comp; + rdma_comp = (mca_btl_ofi_rdma_completion_t*) c_ctx->comp; + + switch (comp->type) { + case MCA_BTL_OFI_TYPE_GET: + case MCA_BTL_OFI_TYPE_PUT: + case MCA_BTL_OFI_TYPE_AOP: + case MCA_BTL_OFI_TYPE_AFOP: + case MCA_BTL_OFI_TYPE_CSWAP: + /* call the callback */ + if (rdma_comp->cbfunc) { + rdma_comp->cbfunc (comp->btl, comp->endpoint, + rdma_comp->local_address, rdma_comp->local_handle, + rdma_comp->cbcontext, rdma_comp->cbdata, OPAL_SUCCESS); + } + + MCA_BTL_OFI_NUM_RDMA_DEC((mca_btl_ofi_module_t*) comp->btl); + break; + + case MCA_BTL_OFI_TYPE_RECV: + mca_btl_ofi_recv_frag((mca_btl_ofi_module_t*) comp->btl, + (mca_btl_ofi_endpoint_t*) comp->endpoint, + context, frag_comp->frag); + break; + + case MCA_BTL_OFI_TYPE_SEND: + MCA_BTL_OFI_NUM_SEND_DEC((mca_btl_ofi_module_t*) comp->btl); + mca_btl_ofi_frag_complete(frag_comp->frag, OPAL_SUCCESS); + break; + + default: + /* catasthrophic */ + BTL_ERROR(("unknown completion type")); + MCA_BTL_OFI_ABORT(); + } + + /* return the completion handler */ + opal_free_list_return(comp->my_list, (opal_free_list_item_t*) comp); + } + } + } else if (OPAL_UNLIKELY(ret == -FI_EAVAIL)) { + ret = fi_cq_readerr(context->cq, &cqerr, 0); + + /* cq readerr failed!? */ + if (0 > ret) { + BTL_ERROR(("%s:%d: Error returned from fi_cq_readerr: %s(%d)", + __FILE__, __LINE__, fi_strerror(-ret), ret)); + } else { + BTL_ERROR(("fi_cq_readerr: (provider err_code = %d)\n", + cqerr.prov_errno)); + } + MCA_BTL_OFI_ABORT(); + } +#ifdef FI_EINTR + /* sometimes, sockets provider complain about interupt. We do nothing. */ + else if (OPAL_UNLIKELY(ret == -FI_EINTR)) { + + } +#endif + /* If the error is not FI_EAGAIN, report the error and abort. */ + else if (OPAL_UNLIKELY(ret != -FI_EAGAIN)) { + BTL_ERROR(("fi_cq_read returned error %d:%s", ret, fi_strerror(-ret))); + MCA_BTL_OFI_ABORT(); + } + + return events; +} + + diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.c b/opal/mca/btl/ofi/btl_ofi_endpoint.c index 0ef91a9b6ff..a374946cb00 100644 --- a/opal/mca/btl/ofi/btl_ofi_endpoint.c +++ b/opal/mca/btl/ofi/btl_ofi_endpoint.c @@ -15,10 +15,6 @@ #include "btl_ofi_endpoint.h" #include "opal/util/proc.h" -#if OPAL_HAVE_THREAD_LOCAL -opal_thread_local mca_btl_ofi_context_t *my_context = NULL; -#endif /* OPAL_HAVE_THREAD_LOCAL */ - static void mca_btl_ofi_endpoint_construct (mca_btl_ofi_endpoint_t *endpoint) { endpoint->peer_addr = 0; @@ -52,292 +48,3 @@ mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct return (mca_btl_base_endpoint_t *) endpoint; } - -int ofi_comp_list_init(opal_free_list_t *comp_list) -{ - int rc; - OBJ_CONSTRUCT(comp_list, opal_free_list_t); - rc = opal_free_list_init(comp_list, - sizeof(mca_btl_ofi_completion_t), - opal_cache_line_size, - OBJ_CLASS(mca_btl_ofi_completion_t), - 0, - 0, - 128, - -1, - 128, - NULL, - 0, - NULL, - NULL, - NULL); - if (rc != OPAL_SUCCESS) { - BTL_VERBOSE(("cannot allocate completion freelist")); - } - return rc; -} - -/* mca_btl_ofi_context_alloc_normal() - * - * This function will allocate an ofi_context, map the endpoint to tx/rx context, - * bind CQ,AV to the endpoint and initialize all the structure. - * USE WITH NORMAL ENDPOINT ONLY */ -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *ep, - struct fid_av *av) -{ - int rc; - uint32_t cq_flags = FI_TRANSMIT; - char *linux_device_name = info->domain_attr->name; - - struct fi_cq_attr cq_attr = {0}; - - mca_btl_ofi_context_t *context; - - context = (mca_btl_ofi_context_t*) calloc(1, sizeof(*context)); - if (NULL == context) { - BTL_VERBOSE(("cannot allocate context")); - return NULL; - } - - /* Don't really need to check, just avoiding compiler warning because - * BTL_VERBOSE is a no op in performance build and the compiler will - * complain about unused variable. */ - if (NULL == linux_device_name) { - BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); - goto single_fail; - } - - cq_attr.format = FI_CQ_FORMAT_CONTEXT; - cq_attr.wait_obj = FI_WAIT_NONE; - rc = fi_cq_open(domain, &cq_attr, &context->cq, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_cq_open with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = fi_ep_bind(ep, (fid_t)av, 0); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = fi_ep_bind(ep, (fid_t)context->cq, cq_flags); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto single_fail; - } - - rc = ofi_comp_list_init(&context->comp_list); - if (rc != OPAL_SUCCESS) { - goto single_fail; - } - - context->tx_ctx = ep; - context->rx_ctx = ep; - context->context_id = 0; - - return context; - -single_fail: - mca_btl_ofi_context_finalize(context, false); - return NULL; -} - -/* mca_btl_ofi_context_alloc_scalable() - * - * This function allocate communication contexts and return the pointer - * to the first btl context. It also take care of all the bindings needed. - * USE WITH SCALABLE ENDPOINT ONLY */ -mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info, - struct fid_domain *domain, - struct fid_ep *sep, - struct fid_av *av, - size_t num_contexts) -{ - BTL_VERBOSE(("creating %zu contexts", num_contexts)); - - int rc; - size_t i; - char *linux_device_name = info->domain_attr->name; - - struct fi_cq_attr cq_attr = {0}; - struct fi_tx_attr tx_attr = {0}; - struct fi_rx_attr rx_attr = {0}; - - mca_btl_ofi_context_t *contexts; - tx_attr.op_flags = FI_DELIVERY_COMPLETE; - - contexts = (mca_btl_ofi_context_t*) calloc(num_contexts, sizeof(*contexts)); - if (NULL == contexts) { - BTL_VERBOSE(("cannot allocate communication contexts.")); - return NULL; - } - - /* Don't really need to check, just avoiding compiler warning because - * BTL_VERBOSE is a no op in performance build and the compiler will - * complain about unused variable. */ - if (NULL == linux_device_name) { - BTL_VERBOSE(("linux device name is NULL. This shouldn't happen.")); - goto scalable_fail; - } - - /* bind AV to endpoint */ - rc = fi_scalable_ep_bind(sep, (fid_t)av, 0); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_scalable_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - for (i=0; i < num_contexts; i++) { - rc = fi_tx_context(sep, i, &tx_attr, &contexts[i].tx_ctx, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_tx_context with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* We don't actually need a receiving context as we only do one-sided. - * However, sockets provider will hang if we dont have one. It is - * also nice to have equal number of tx/rx context. */ - rc = fi_rx_context(sep, i, &rx_attr, &contexts[i].rx_ctx, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_rx_context with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* create CQ */ - cq_attr.format = FI_CQ_FORMAT_CONTEXT; - cq_attr.wait_obj = FI_WAIT_NONE; - rc = fi_cq_open(domain, &cq_attr, &contexts[i].cq, NULL); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_cq_open with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* bind cq to transmit context */ - uint32_t cq_flags = (FI_TRANSMIT); - rc = fi_ep_bind(contexts[i].tx_ctx, (fid_t)contexts[i].cq, cq_flags); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_ep_bind with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* enable the context. */ - rc = fi_enable(contexts[i].tx_ctx); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_enable with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - rc = fi_enable(contexts[i].rx_ctx); - if (0 != rc) { - BTL_VERBOSE(("%s failed fi_enable with err=%s", - linux_device_name, - fi_strerror(-rc) - )); - goto scalable_fail; - } - - /* initialize completion freelist. */ - rc = ofi_comp_list_init(&contexts[i].comp_list); - if (rc != OPAL_SUCCESS) { - goto scalable_fail; - } - - /* assign the id */ - contexts[i].context_id = i; - } - - return contexts; - -scalable_fail: - /* close and free */ - for(i=0; i < num_contexts; i++) { - mca_btl_ofi_context_finalize(&contexts[i], true); - } - free(contexts); - - return NULL; -} - -void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep) { - - /* if it is a scalable ep, we have to close all contexts. */ - if (scalable_ep) { - if (NULL != context->tx_ctx) { - fi_close(&context->tx_ctx->fid); - } - - if (NULL != context->rx_ctx) { - fi_close(&context->rx_ctx->fid); - } - } - - if( NULL != context->cq) { - fi_close(&context->cq->fid); - } - - /* Can we destruct the object that hasn't been constructed? */ - OBJ_DESTRUCT(&context->comp_list); -} - -/* Get a context to use for communication. - * If TLS is supported, it will use the cached endpoint. - * If not, it will invoke the normal round-robin assignment. */ -mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl) -{ -#if OPAL_HAVE_THREAD_LOCAL - /* With TLS, we cache the context we use. */ - static volatile int64_t cur_num = 0; - - if (OPAL_UNLIKELY(my_context == NULL)) { - OPAL_THREAD_LOCK(&btl->module_lock); - - my_context = &btl->contexts[cur_num]; - cur_num = (cur_num + 1) %btl->num_contexts; - - OPAL_THREAD_UNLOCK(&btl->module_lock); - } - - assert (my_context); - return my_context; -#else - return get_ofi_context_rr(btl); -#endif -} - -/* return the context in a round-robin. */ -/* There is no need for atomics here as it might hurt the performance. */ -mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl) -{ - static volatile uint64_t rr_num = 0; - return &btl->contexts[rr_num++%btl->num_contexts]; -} diff --git a/opal/mca/btl/ofi/btl_ofi_endpoint.h b/opal/mca/btl/ofi/btl_ofi_endpoint.h index aad758d8c85..423f83f1374 100644 --- a/opal/mca/btl/ofi/btl_ofi_endpoint.h +++ b/opal/mca/btl/ofi/btl_ofi_endpoint.h @@ -51,7 +51,7 @@ typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t; typedef mca_btl_base_endpoint_t mca_btl_ofi_endpoint_t; OBJ_CLASS_DECLARATION(mca_btl_ofi_endpoint_t); -int ofi_comp_list_init(opal_free_list_t *comp_list); +int init_context_freelists(mca_btl_ofi_context_t *context); mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep); diff --git a/opal/mca/btl/ofi/btl_ofi_frag.c b/opal/mca/btl/ofi/btl_ofi_frag.c new file mode 100644 index 00000000000..1fd5c7b3a83 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_frag.c @@ -0,0 +1,198 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * $COPYRIGHT$ + * Copyright (c) 2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2018 Intel Inc. All rights reserved + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "btl_ofi.h" +#include "btl_ofi_frag.h" +#include "btl_ofi_rdma.h" +#include "btl_ofi_endpoint.h" + +static void mca_btl_ofi_base_frag_constructor (mca_btl_ofi_base_frag_t *frag) +{ + /* zero everything out */ + memset ((char *) frag + sizeof (frag->base), 0, sizeof (*frag) - sizeof (frag->base)); + + frag->base.des_segments = frag->segments; + frag->base.des_segment_count = 1; +} + +static void mca_btl_ofi_base_frag_destructor (mca_btl_ofi_base_frag_t *frag) +{ + +} + +OBJ_CLASS_INSTANCE(mca_btl_ofi_base_frag_t, + mca_btl_base_descriptor_t, + mca_btl_ofi_base_frag_constructor, + mca_btl_ofi_base_frag_destructor); + +OBJ_CLASS_INSTANCE(mca_btl_ofi_frag_completion_t, + opal_free_list_item_t, + NULL, + NULL); + +mca_btl_ofi_frag_completion_t *mca_btl_ofi_frag_completion_alloc + (mca_btl_base_module_t *btl, + mca_btl_ofi_context_t *context, + mca_btl_ofi_base_frag_t *frag, + int type) +{ + mca_btl_ofi_frag_completion_t *comp; + + comp = (mca_btl_ofi_frag_completion_t*) opal_free_list_get(&context->frag_comp_list); + comp->base.btl = btl; + comp->base.my_context = context; + comp->base.my_list = &context->frag_comp_list; + comp->base.type = type; + + comp->frag = frag; + comp->comp_ctx.comp = comp; + + return comp; +} + + +mca_btl_base_descriptor_t *mca_btl_ofi_alloc( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + uint64_t order, size_t size, uint32_t flags) +{ + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*) btl; + mca_btl_ofi_base_frag_t *frag = NULL; + mca_btl_ofi_context_t *context = get_ofi_context(ofi_btl); + + frag = mca_btl_ofi_frag_alloc(ofi_btl, &context->frag_list, endpoint); + + if (OPAL_LIKELY(frag)) { + frag->segments[0].seg_addr.pval = frag + 1; + frag->segments[0].seg_len = size; + + frag->base.des_segment_count = 1; + frag->base.des_segments = &frag->segments[0]; + frag->base.des_flags = flags; + frag->base.order = order; + frag->hdr.len = size; + } + + return (mca_btl_base_descriptor_t*) frag; +} + +int mca_btl_ofi_free (mca_btl_base_module_t *btl, mca_btl_base_descriptor_t *des) +{ + /* return the frag to the free list. */ + mca_btl_ofi_frag_return ((mca_btl_ofi_base_frag_t*) des); + return OPAL_SUCCESS; +} + +int mca_btl_ofi_send (mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_base_descriptor_t *descriptor, + mca_btl_base_tag_t tag) +{ + int rc = 0; + mca_btl_ofi_context_t *context; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t*) btl; + mca_btl_ofi_endpoint_t *ofi_ep = (mca_btl_ofi_endpoint_t*) endpoint; + mca_btl_ofi_base_frag_t *frag = (mca_btl_ofi_base_frag_t*) descriptor; + mca_btl_ofi_frag_completion_t *comp; + + frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK; + + /* This tag is the active message tag for the remote side */ + frag->hdr.tag = tag; + + /* create completion context */ + context = get_ofi_context(ofi_btl); + comp = mca_btl_ofi_frag_completion_alloc(btl, context, frag, + MCA_BTL_OFI_TYPE_SEND); + + /* send the frag. Note that we start sending from BTL header + payload + * because we need the other side to have this header information. */ + rc = fi_send(context->tx_ctx, + &frag->hdr, + sizeof(mca_btl_ofi_header_t) + frag->hdr.len, + NULL, + ofi_ep->peer_addr, + &comp->comp_ctx); + + if (OPAL_UNLIKELY(FI_SUCCESS != rc)) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + MCA_BTL_OFI_NUM_SEND_INC(ofi_btl); + return OPAL_SUCCESS; +} + +inline int mca_btl_ofi_recv_frag (mca_btl_ofi_module_t *ofi_btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_ofi_context_t *context, + mca_btl_ofi_base_frag_t *frag) +{ + int rc; + mca_btl_active_message_callback_t *reg; + + /* Tell PML where the payload is */ + frag->base.des_segments = frag->segments; + frag->segments[0].seg_addr.pval = frag+1; + frag->segments[0].seg_len = frag->hdr.len; + frag->base.des_segment_count = 1; + + /* call the callback */ + reg = mca_btl_base_active_message_trigger + frag->hdr.tag; + reg->cbfunc (&ofi_btl->super, frag->hdr.tag, &frag->base, reg->cbdata); + mca_btl_ofi_frag_complete(frag, OPAL_SUCCESS); + + /* repost the recv */ + rc = mca_btl_ofi_post_recvs((mca_btl_base_module_t*) ofi_btl, context, 1); + if (OPAL_SUCCESS != rc) { + /* might not be that bad but let's just fail here. */ + BTL_ERROR(("failed reposting receive.")); + MCA_BTL_OFI_ABORT(); + } + + return OPAL_SUCCESS; +} + +struct mca_btl_base_descriptor_t *mca_btl_ofi_prepare_src ( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + opal_convertor_t *convertor, + uint8_t order, size_t reserve, + size_t *size, uint32_t flags) +{ + struct iovec iov; + size_t length; + uint32_t iov_count = 1; + mca_btl_ofi_base_frag_t *frag; + + /* allocate the frag with reserve. */ + frag = (mca_btl_ofi_base_frag_t*) mca_btl_ofi_alloc(btl, endpoint, + order, reserve, flags); + if (OPAL_UNLIKELY(NULL == frag)) { + return NULL; + } + + /* pack the data after the reserve */ + iov.iov_len = *size; + iov.iov_base = (IOVBASE_TYPE*)(((unsigned char*)(frag->segments[0].seg_addr.pval)) + reserve); + opal_convertor_pack(convertor, &iov, &iov_count, &length); + + /* pass on frag information */ + frag->base.des_segments = frag->segments; + frag->base.des_flags = flags; + frag->base.order = MCA_BTL_NO_ORDER; + frag->segments[0].seg_len += length; + frag->hdr.len += length; + *size = length; + + return &frag->base; +} diff --git a/opal/mca/btl/ofi/btl_ofi_frag.h b/opal/mca/btl/ofi/btl_ofi_frag.h new file mode 100644 index 00000000000..bc3892d5f83 --- /dev/null +++ b/opal/mca/btl/ofi/btl_ofi_frag.h @@ -0,0 +1,95 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#if !defined(MCA_BTL_OFI_FRAG_H) +#define MCA_BTL_OFI_FRAG_H + +#include "btl_ofi.h" +#include "btl_ofi_endpoint.h" + + +#define MCA_BTL_OFI_HDR_SIZE sizeof(mca_btl_ofi_header_t) +#define MCA_BTL_OFI_FRAG_SIZE 4096 +#define MCA_BTL_OFI_RECV_SIZE MCA_BTL_OFI_FRAG_SIZE + MCA_BTL_OFI_HDR_SIZE + +#define MCA_BTL_OFI_NUM_SEND_INC(module) \ + OPAL_ATOMIC_ADD_FETCH64(&(module)->outstanding_send, 1); \ + if (module->outstanding_send > mca_btl_ofi_component.progress_threshold) { \ + mca_btl_ofi_component.super.btl_progress(); \ + } + +#define MCA_BTL_OFI_NUM_SEND_DEC(module) \ + OPAL_ATOMIC_ADD_FETCH64(&(module)->outstanding_send, -1); + +mca_btl_base_descriptor_t *mca_btl_ofi_alloc( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + uint64_t order, size_t size, uint32_t flags); + +int mca_btl_ofi_free (mca_btl_base_module_t *btl, mca_btl_base_descriptor_t *des); + +int mca_btl_ofi_send (mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_base_descriptor_t *descriptor, + mca_btl_base_tag_t tag); + +int mca_btl_ofi_recv_frag (mca_btl_ofi_module_t *ofi_btl, + mca_btl_base_endpoint_t *endpoint, + mca_btl_ofi_context_t *context, + mca_btl_ofi_base_frag_t *frag); + +struct mca_btl_base_descriptor_t *mca_btl_ofi_prepare_src ( + mca_btl_base_module_t *btl, + mca_btl_base_endpoint_t *endpoint, + opal_convertor_t *convertor, + uint8_t order, size_t reserve, + size_t *size, uint32_t flags); + +mca_btl_ofi_frag_completion_t *mca_btl_ofi_frag_completion_alloc + (mca_btl_base_module_t *btl, + mca_btl_ofi_context_t *context, + mca_btl_ofi_base_frag_t *frag, + int type); + +static inline mca_btl_ofi_base_frag_t *mca_btl_ofi_frag_alloc (mca_btl_ofi_module_t *ofi_btl, opal_free_list_t *fl, + mca_btl_base_endpoint_t *endpoint) +{ + mca_btl_ofi_base_frag_t *frag = (mca_btl_ofi_base_frag_t *) opal_free_list_get (fl); + + if (OPAL_LIKELY(NULL != frag)) { + frag->free_list = fl; + frag->endpoint = endpoint; + frag->btl = ofi_btl; + } + + return frag; +} + +static inline void mca_btl_ofi_frag_return (mca_btl_ofi_base_frag_t *frag) +{ + opal_free_list_return (frag->free_list, &frag->base.super); +} + +static inline void mca_btl_ofi_frag_complete (mca_btl_ofi_base_frag_t *frag, int rc) { + mca_btl_ofi_module_t *ofi_btl = frag->btl; + + /* call the local callback if specified */ + if (frag->base.des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) { + frag->base.des_cbfunc(&ofi_btl->super, frag->endpoint, &frag->base, rc); + } + + /* If the BTL has ownership, return it to the free list, */ + if (OPAL_LIKELY(frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) { + mca_btl_ofi_frag_return (frag); + } +} + +#endif /* !defined(MCA_BTL_OFI_FRAG_H) */ diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c index df6ae1e2e1a..f9a3ae17b5c 100644 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -31,6 +31,7 @@ #include "btl_ofi.h" #include "btl_ofi_endpoint.h" +#include "btl_ofi_frag.h" static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl, size_t nprocs, opal_proc_t **opal_procs, @@ -42,12 +43,33 @@ static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl, char *ep_name = NULL; size_t namelen = mca_btl_ofi_component.namelen; + opal_proc_t *proc; + mca_btl_base_endpoint_t *ep; + mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; for (size_t i = 0 ; i < nprocs ; ++i) { - peers[i] = mca_btl_ofi_endpoint_create (opal_procs[i], ofi_btl->ofi_endpoint); - if (OPAL_UNLIKELY(NULL == peers[i])) { - return OPAL_ERR_OUT_OF_RESOURCE; + + proc = opal_procs[i]; + + /* See if we already have an endpoint for this proc. */ + rc = opal_hash_table_get_value_uint64 (&ofi_btl->id_to_endpoint, (intptr_t) proc, (void **) &ep); + + if (OPAL_SUCCESS == rc) { + BTL_VERBOSE(("returning existing endpoint for proc %s", OPAL_NAME_PRINT(proc->proc_name))); + peers[i] = ep; + + } else { + /* We don't have this endpoint yet, create one */ + peers[i] = mca_btl_ofi_endpoint_create (proc, ofi_btl->ofi_endpoint); + BTL_VERBOSE(("creating peer %p", peers[i])); + + if (OPAL_UNLIKELY(NULL == peers[i])) { + return OPAL_ERR_OUT_OF_RESOURCE; + } + + /* Add this endpoint to the lookup table */ + (void) opal_hash_table_set_value_uint64 (&ofi_btl->id_to_endpoint, (intptr_t) proc, (void**) &ep); } OPAL_MODEX_RECV(rc, &mca_btl_ofi_component.super.btl_version, @@ -81,24 +103,29 @@ static int mca_btl_ofi_add_procs (mca_btl_base_module_t *btl, static int mca_btl_ofi_del_procs (mca_btl_base_module_t *btl, size_t nprocs, opal_proc_t **procs, mca_btl_base_endpoint_t **peers) { - int ret; + int rc; mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; + mca_btl_base_endpoint_t *ep; for (size_t i = 0 ; i < nprocs ; ++i) { if (peers[i]) { - - /* remove the address from AV. */ - ret = fi_av_remove(ofi_btl->av, &peers[i]->peer_addr, 1, 0); - if (ret < 0) { - /* remove failed. this should not happen. */ - /* Lets not crash because we failed to remove an address. */ - BTL_ERROR(("fi_av_remove failed with error %d:%s", - ret, fi_strerror(-ret))); - } - - /* remove and free MPI endpoint from the list. */ - opal_list_remove_item (&ofi_btl->endpoints, &peers[i]->super); - OBJ_RELEASE(peers[i]); + rc = opal_hash_table_get_value_uint64 (&ofi_btl->id_to_endpoint, (intptr_t) procs[i], (void **) &ep); + + if (OPAL_SUCCESS == rc) { + /* remove the address from AV. */ + rc = fi_av_remove(ofi_btl->av, &peers[i]->peer_addr, 1, 0); + if (rc < 0) { + /* remove failed. this should not happen. */ + /* Lets not crash because we failed to remove an address. */ + BTL_ERROR(("fi_av_remove failed with error %d:%s", + rc, fi_strerror(-rc))); + } + + /* remove and free MPI endpoint from the list. */ + opal_list_remove_item (&ofi_btl->endpoints, &peers[i]->super); + (void) opal_hash_table_remove_value_uint64 (&ofi_btl->id_to_endpoint, (intptr_t) procs[i]); + OBJ_RELEASE(peers[i]); + } } } @@ -281,6 +308,8 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) } OBJ_DESTRUCT(&ofi_btl->endpoints); + OBJ_DESTRUCT(&ofi_btl->id_to_endpoint); + OBJ_DESTRUCT(&ofi_btl->module_lock); if (ofi_btl->rcache) { mca_rcache_base_module_destroy (ofi_btl->rcache); @@ -291,39 +320,119 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) return OPAL_SUCCESS; } +/* Post wildcard recvs on the rx context. */ +int mca_btl_ofi_post_recvs (mca_btl_base_module_t *module, + mca_btl_ofi_context_t *context, + int count) +{ + int i; + int rc; + mca_btl_ofi_base_frag_t *frag; + mca_btl_ofi_frag_completion_t *comp; + + for (i=0; i < count; i++) { + frag = (mca_btl_ofi_base_frag_t*) mca_btl_ofi_alloc(module, + NULL, + 0, + MCA_BTL_OFI_FRAG_SIZE, + MCA_BTL_DES_FLAGS_BTL_OWNERSHIP); + if (NULL == frag) { + BTL_ERROR(("cannot allocate recv frag.")); + return OPAL_ERROR; + } + + comp = mca_btl_ofi_frag_completion_alloc (module, + context, + frag, + MCA_BTL_OFI_TYPE_RECV); + + rc = fi_recv (context->rx_ctx, &frag->hdr, MCA_BTL_OFI_RECV_SIZE, + NULL, FI_ADDR_UNSPEC, &comp->comp_ctx); + + if (FI_SUCCESS != rc) { + BTL_ERROR(("cannot post recvs")); + return OPAL_ERROR; + } + } + return OPAL_SUCCESS; +} + +/* Allocate and fill out the module capabilities according to operation mode. */ +mca_btl_ofi_module_t * mca_btl_ofi_module_alloc (int mode) +{ + mca_btl_ofi_module_t *module; + + /* allocate module */ + module = (mca_btl_ofi_module_t*) calloc(1, sizeof(mca_btl_ofi_module_t)); + if (NULL == module) { + return NULL; + } + + /* fill in the defaults */ + *module = mca_btl_ofi_module_template; + + if (mode == MCA_BTL_OFI_MODE_ONE_SIDED || mode == MCA_BTL_OFI_MODE_FULL_SUPPORT) { + + module->super.btl_put = mca_btl_ofi_put; + module->super.btl_get = mca_btl_ofi_get; + module->super.btl_atomic_op = mca_btl_ofi_aop; + module->super.btl_atomic_fop = mca_btl_ofi_afop; + module->super.btl_atomic_cswap = mca_btl_ofi_acswap; + module->super.btl_flush = mca_btl_ofi_flush; + + module->super.btl_register_mem = mca_btl_ofi_register_mem; + module->super.btl_deregister_mem = mca_btl_ofi_deregister_mem; + + module->super.btl_flags |= MCA_BTL_FLAGS_ATOMIC_FOPS | + MCA_BTL_FLAGS_ATOMIC_OPS | + MCA_BTL_FLAGS_RDMA; + + module->super.btl_atomic_flags = MCA_BTL_ATOMIC_SUPPORTS_ADD | + MCA_BTL_ATOMIC_SUPPORTS_SWAP | + MCA_BTL_ATOMIC_SUPPORTS_CSWAP | + MCA_BTL_ATOMIC_SUPPORTS_32BIT ; + + module->super.btl_put_limit = 1 << 23; + module->super.btl_put_alignment = 0; + + module->super.btl_get_limit = 1 << 23; + module->super.btl_get_alignment = 0; + + module->super.btl_registration_handle_size = + sizeof(mca_btl_base_registration_handle_t); + } + + if (mode == MCA_BTL_OFI_MODE_TWO_SIDED || mode == MCA_BTL_OFI_MODE_FULL_SUPPORT) { + + module->super.btl_alloc = mca_btl_ofi_alloc; + module->super.btl_free = mca_btl_ofi_free; + module->super.btl_prepare_src = mca_btl_ofi_prepare_src; + + module->super.btl_send = mca_btl_ofi_send; + + module->super.btl_flags |= MCA_BTL_FLAGS_SEND; + module->super.btl_eager_limit = MCA_BTL_OFI_FRAG_SIZE; + module->super.btl_max_send_size = MCA_BTL_OFI_FRAG_SIZE; + module->super.btl_rndv_eager_limit = MCA_BTL_OFI_FRAG_SIZE; + + /* If two sided is enabled, we expected that the user knows exactly what + * they want. We bump the priority to maximum, making this BTL the default. */ + module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH; + } + + if (mode == MCA_BTL_OFI_MODE_FULL_SUPPORT) { + module->super.btl_rdma_pipeline_frag_size = 4 * 1024 * 1024; + module->super.btl_rdma_pipeline_send_length = 8 * 1024; + } + + return module; +} + mca_btl_ofi_module_t mca_btl_ofi_module_template = { .super = { - /* initialize functions. this btl only support RDMA and atomics - * for now so it does not provide prepare_src, alloc, free, or send */ .btl_component = &mca_btl_ofi_component.super, .btl_add_procs = mca_btl_ofi_add_procs, .btl_del_procs = mca_btl_ofi_del_procs, .btl_finalize = mca_btl_ofi_finalize, - .btl_put = mca_btl_ofi_put, - .btl_get = mca_btl_ofi_get, - .btl_register_mem = mca_btl_ofi_register_mem, - .btl_deregister_mem = mca_btl_ofi_deregister_mem, - .btl_atomic_op = mca_btl_ofi_aop, - .btl_atomic_fop = mca_btl_ofi_afop, - .btl_atomic_cswap = mca_btl_ofi_acswap, - .btl_flush = mca_btl_ofi_flush, - - /* set the default flags for this btl. ofi provides us with rdma and both - * fetching and non-fetching atomics (though limited to add and cswap) */ - .btl_flags = MCA_BTL_FLAGS_RDMA | - MCA_BTL_FLAGS_ATOMIC_FOPS | - MCA_BTL_FLAGS_ATOMIC_OPS, - - .btl_atomic_flags = MCA_BTL_ATOMIC_SUPPORTS_ADD | - MCA_BTL_ATOMIC_SUPPORTS_SWAP | - MCA_BTL_ATOMIC_SUPPORTS_CSWAP | - MCA_BTL_ATOMIC_SUPPORTS_32BIT, - - /* set the default limits on put and get */ - .btl_registration_handle_size = sizeof(mca_btl_base_registration_handle_t), - .btl_put_limit = 1 << 23, - .btl_put_alignment = 0, - .btl_get_limit = 1 << 23, - .btl_get_alignment = 0, } }; diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.c b/opal/mca/btl/ofi/btl_ofi_rdma.c index 9a545038a4d..0ecbd887bc1 100644 --- a/opal/mca/btl/ofi/btl_ofi_rdma.c +++ b/opal/mca/btl/ofi/btl_ofi_rdma.c @@ -13,12 +13,12 @@ #include "btl_ofi_rdma.h" -OBJ_CLASS_INSTANCE(mca_btl_ofi_completion_t, +OBJ_CLASS_INSTANCE(mca_btl_ofi_rdma_completion_t, opal_free_list_item_t, NULL, NULL); -mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( +mca_btl_ofi_rdma_completion_t *mca_btl_ofi_rdma_completion_alloc ( mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, mca_btl_ofi_context_t *ofi_context, @@ -32,21 +32,24 @@ mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( assert(endpoint); assert(ofi_context); - mca_btl_ofi_completion_t *comp; + mca_btl_ofi_rdma_completion_t *comp; - comp = (mca_btl_ofi_completion_t*) opal_free_list_get(&ofi_context->comp_list); + comp = (mca_btl_ofi_rdma_completion_t*) opal_free_list_get(&ofi_context->rdma_comp_list); assert(comp); - comp->btl = btl; - comp->endpoint = endpoint; - comp->my_context = ofi_context; + comp->base.btl = btl; + comp->base.endpoint = endpoint; + comp->base.my_context = ofi_context; + comp->base.my_list = &ofi_context->rdma_comp_list; + comp->base.type = type; + comp->local_address = local_address; comp->local_handle = local_handle; comp->cbfunc = cbfunc; comp->cbcontext = cbcontext; comp->cbdata = cbdata; - comp->my_list = &ofi_context->comp_list; - comp->type = type; + + comp->comp_ctx.comp = comp; return comp; } @@ -58,21 +61,21 @@ int mca_btl_ofi_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi { int rc; + mca_btl_ofi_rdma_completion_t *comp; mca_btl_ofi_module_t *ofi_btl = (mca_btl_ofi_module_t *) btl; mca_btl_ofi_endpoint_t *btl_endpoint = (mca_btl_ofi_endpoint_t*) endpoint; - mca_btl_ofi_completion_t *comp; mca_btl_ofi_context_t *ofi_context; ofi_context = get_ofi_context(ofi_btl); /* create completion context */ - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_GET); + comp = mca_btl_ofi_rdma_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_GET); remote_address = (remote_address - (uint64_t) remote_handle->base_addr); @@ -82,7 +85,7 @@ int mca_btl_ofi_get (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi local_handle->desc, btl_endpoint->peer_addr, remote_address, remote_handle->rkey, - comp); /* completion context */ + &comp->comp_ctx); /* completion context */ if (-FI_EAGAIN == rc) { return OPAL_ERR_OUT_OF_RESOURCE; @@ -111,13 +114,13 @@ int mca_btl_ofi_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi ofi_context = get_ofi_context(ofi_btl); /* create completion context */ - mca_btl_ofi_completion_t *comp; - comp = mca_btl_ofi_completion_alloc(btl, endpoint, - ofi_context, - local_address, - local_handle, - cbfunc, cbcontext, cbdata, - MCA_BTL_OFI_TYPE_PUT); + mca_btl_ofi_rdma_completion_t *comp; + comp = mca_btl_ofi_rdma_completion_alloc(btl, endpoint, + ofi_context, + local_address, + local_handle, + cbfunc, cbcontext, cbdata, + MCA_BTL_OFI_TYPE_PUT); remote_address = (remote_address - (uint64_t) remote_handle->base_addr); @@ -127,7 +130,7 @@ int mca_btl_ofi_put (mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoi local_handle->desc, btl_endpoint->peer_addr, remote_address, remote_handle->rkey, - comp); /* completion context */ + &comp->comp_ctx); /* completion context */ if (-FI_EAGAIN == rc) { return OPAL_ERR_OUT_OF_RESOURCE; diff --git a/opal/mca/btl/ofi/btl_ofi_rdma.h b/opal/mca/btl/ofi/btl_ofi_rdma.h index 3de42454395..a9ad34c147d 100644 --- a/opal/mca/btl/ofi/btl_ofi_rdma.h +++ b/opal/mca/btl/ofi/btl_ofi_rdma.h @@ -19,7 +19,7 @@ #include "btl_ofi.h" #include "btl_ofi_endpoint.h" -mca_btl_ofi_completion_t *mca_btl_ofi_completion_alloc ( +mca_btl_ofi_rdma_completion_t *mca_btl_ofi_rdma_completion_alloc ( mca_btl_base_module_t *btl, mca_btl_base_endpoint_t *endpoint, mca_btl_ofi_context_t *ofi_context, From ee3f6ab841454cb4671010bddea4d3d3a41c696f Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Thu, 23 Aug 2018 14:18:32 -0700 Subject: [PATCH 590/674] MTL OFI: Ask for FI_THREAD_DOMAIN support when not using MPI_THREAD_MULTIPLE When an application is not using multiple threads to call into MPI, we can safely ask for FI_THREAD_DOMAIN setting from the provider as it should translate to the least amount of locking in provider. Conversely, for applications using THREAD_MULTIPLE, explicitly ask for FI_THREAD_SAFE to prevent race conditions. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 5cbcae79d8619b99e4768578c8d11d3149e5c7c8) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 90b329e07ec..f23f4dd76b2 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -472,7 +472,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, hints->rx_attr->op_flags = FI_COMPLETION; hints->tx_attr->op_flags = FI_COMPLETION; - hints->domain_attr->threading = FI_THREAD_UNSPEC; + if (enable_mpi_threads) { + hints->domain_attr->threading = FI_THREAD_SAFE; + } else { + hints->domain_attr->threading = FI_THREAD_DOMAIN; + } switch (control_progress) { case MTL_OFI_PROG_AUTO: From 8ebd0d8f2460f08074a06f00350887eb07dbcb68 Mon Sep 17 00:00:00 2001 From: Thananon Patinyasakdikul Date: Tue, 6 Nov 2018 15:37:25 -0500 Subject: [PATCH 591/674] btl/ofi: fixed compiler warning on OSX. This commit closes #6049 Signed-off-by: Thananon Patinyasakdikul (cherry picked from commit d9bd54c628f73b9c4ded3c5baa5c6454d8f173f1) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_frag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/btl/ofi/btl_ofi_frag.c b/opal/mca/btl/ofi/btl_ofi_frag.c index 1fd5c7b3a83..0878e8908e7 100644 --- a/opal/mca/btl/ofi/btl_ofi_frag.c +++ b/opal/mca/btl/ofi/btl_ofi_frag.c @@ -132,7 +132,7 @@ int mca_btl_ofi_send (mca_btl_base_module_t *btl, return OPAL_SUCCESS; } -inline int mca_btl_ofi_recv_frag (mca_btl_ofi_module_t *ofi_btl, +int mca_btl_ofi_recv_frag (mca_btl_ofi_module_t *ofi_btl, mca_btl_base_endpoint_t *endpoint, mca_btl_ofi_context_t *context, mca_btl_ofi_base_frag_t *frag) From 22d0857ee50965bd48d393a00a58167f16c0bc97 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Wed, 24 Oct 2018 14:38:23 -0700 Subject: [PATCH 592/674] MTL/OFI: Add OFI Scalable Endpoint support OFI MTL supports OFI Scalable Endpoints feature as means to improve multi-threaded application throughput and message rate. Currently the feature is designed to utilize multiple TX/RX contexts exposed by the OFI provider in conjunction with a multi-communicator MPI application model. For more information, refer to README under mtl/ofi. Reviewed-by: Matias Cabral Reviewed-by: Neil Spruit Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 109d0569ffdc29f40518d02ad7a4d5bca3adc3d1) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/README | 82 ++++- ompi/mca/mtl/ofi/help-mtl-ofi.txt | 16 + ompi/mca/mtl/ofi/mtl_ofi.h | 477 ++++++++++++++++++++++----- ompi/mca/mtl/ofi/mtl_ofi_component.c | 353 ++++++++++++++------ ompi/mca/mtl/ofi/mtl_ofi_types.h | 61 +++- 5 files changed, 794 insertions(+), 195 deletions(-) diff --git a/ompi/mca/mtl/ofi/README b/ompi/mca/mtl/ofi/README index 2fe66b501a7..03a92a3c14f 100644 --- a/ompi/mca/mtl/ofi/README +++ b/ompi/mca/mtl/ofi/README @@ -1,5 +1,5 @@ -OFI MTL - +OFI MTL: +-------- The OFI MTL supports Libfabric (a.k.a. Open Fabrics Interfaces OFI, https://ofiwg.github.io/libfabric/) tagged APIs (fi_tagged(3)). At initialization time, the MTL queries libfabric for providers supporting tag matching @@ -9,6 +9,7 @@ The user may modify the OFI provider selection with mca parameters mtl_ofi_provider_include or mtl_ofi_provider_exclude. PROGRESS: +--------- The MTL registers a progress function to opal_progress. There is currently no support for asynchronous progress. The progress function reads multiple events from the OFI provider Completion Queue (CQ) per iteration (defaults to 100, can be @@ -16,12 +17,14 @@ modified with the mca mtl_ofi_progress_event_cnt) and iterates until the completion queue is drained. COMPLETIONS: +------------ Each operation uses a request type ompi_mtl_ofi_request_t which includes a reference -to an operation specific completion callback, an MPI request, and a context. The +to an operation specific completion callback, an MPI request, and a context. The context (fi_context) is used to map completion events with MPI_requests when reading the CQ. OFI TAG: +-------- MPI needs to send 96 bits of information per message (32 bits communicator id, 32 bits source rank, 32 bits MPI tag) but OFI only offers 64 bits tags. In addition, the OFI MTL uses 2 bits of the OFI tag for the synchronous send protocol. @@ -67,3 +70,76 @@ This is signaled in mem_tag_format (see fi_endpoint(3)) by setting higher order to zero. In such cases, the OFI MTL will reduce the number of communicator ids supported by reducing the bits available for the communicator ID field in the OFI tag. +SCALABLE ENDPOINTS: +------------------- +OFI MTL supports OFI Scalable Endpoints feature as a means to improve +multi-threaded application throughput and message rate. Currently the feature +is designed to utilize multiple TX/RX contexts exposed by the OFI provider in +conjunction with a multi-communicator MPI application model. Therefore, new OFI +contexts are created as and when communicators are duplicated in a lazy fashion +instead of creating them all at once during init time and this approach also +favours only creating as many contexts as needed. + +1. Multi-communicator model: + With this approach, the application first duplicates the communicators it + wants to use with MPI operations (ideally creating as many communicators as + the number of threads it wants to use to call into MPI). The duplicated + communicators are then used by the corresponding threads to perform MPI + operations. A possible usage scenario could be in an MPI + OMP + application as follows (example limited to 2 ranks): + + MPI_Comm dup_comm[n]; + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); + for (i = 0; i < n; i++) { + MPI_Comm_dup(MPI_COMM_WORLD, &dup_comm[i]); + } + if (rank == 0) { +#pragma omp parallel for private(host_sbuf, host_rbuf) num_threads(n) + for (i = 0; i < n ; i++) { + MPI_Send(host_sbuf, MYBUFSIZE, MPI_CHAR, + 1, MSG_TAG, dup_comm[i]); + MPI_Recv(host_rbuf, MYBUFSIZE, MPI_CHAR, + 1, MSG_TAG, dup_comm[i], &status); + } + } else if (rank == 1) { +#pragma omp parallel for private(status, host_sbuf, host_rbuf) num_threads(n) + for (i = 0; i < n ; i++) { + MPI_Recv(host_rbuf, MYBUFSIZE, MPI_CHAR, + 0, MSG_TAG, dup_comm[i], &status); + MPI_Send(host_sbuf, MYBUFSIZE, MPI_CHAR, + 0, MSG_TAG, dup_comm[i]); + } + } + +2. MCA variable: +To utilize the feature, the following MCA variable needs to be set: + mtl_ofi_thread_grouping: + This MCA variable is at the OFI MTL level and needs to be set to switch + the feature on. + + Default: 0 + + It is not recommended to set the MCA variable for: + - Multi-threaded MPI applications not following multi-communicator approach. + - Applications that have multiple threads using a single communicator as + it may degrade performance. + +Command-line syntax to set the MCA variable: + "-mca mtl_ofi_thread_grouping 1" + +3. Notes on performance: + - OFI MTL will create as many TX/RX contexts as allowed by an underlying + provider (each provider may have different thresholds). Once the threshold + is exceeded, contexts are used in a round-robin fashion which leads to + resource sharing among threads. Therefore locks are required to guard + against race conditions. For performance, it is recommended to have + + Number of communicators = Number of contexts + + For example, when using PSM2 provider, the number of contexts is dictated + by the Intel Omni-Path HFI1 driver module. + + - For applications using a single thread with multiple communicators and MCA + variable "mtl_ofi_thread_grouping" set to 1, the MTL will use multiple + contexts, but the benefits may be negligible as only one thread is driving + progress. diff --git a/ompi/mca/mtl/ofi/help-mtl-ofi.txt b/ompi/mca/mtl/ofi/help-mtl-ofi.txt index b010c3403eb..ba69439fdd5 100644 --- a/ompi/mca/mtl/ofi/help-mtl-ofi.txt +++ b/ompi/mca/mtl/ofi/help-mtl-ofi.txt @@ -24,5 +24,21 @@ fi_info -v -p %s Local host: %s Location: %s:%d + +[SEP unavailable] +Scalable Endpoint feature is required for Thread Grouping feature to work +but it is not supported by %s provider. Try disabling this feature. + + Local host: %s + Location: %s:%d + +[SEP ctxt limit] +Reached limit (%d) for number of OFI contexts that can be opened with the +provider. Creating new communicators beyond this limit is possible but +they will re-use existing contexts in round-robin fashion. +Using new communicators beyond the limit will impact performance. + + Local host: %s + Location: %s:%d [message too big] Message size %llu bigger than supported by selected transport. Max = %llu diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index d523595c14b..d437eb031c9 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -42,7 +42,6 @@ #include "mtl_ofi_endpoint.h" #include "mtl_ofi_compat.h" - BEGIN_C_DECLS extern mca_mtl_ofi_module_t ompi_mtl_ofi; @@ -54,14 +53,47 @@ extern int ompi_mtl_ofi_del_procs(struct mca_mtl_base_module_t *mtl, int ompi_mtl_ofi_progress_no_inline(void); +#if OPAL_HAVE_THREAD_LOCAL +extern opal_thread_local int per_thread_ctx; +extern opal_thread_local struct fi_cq_tagged_entry wc[MTL_OFI_MAX_PROG_EVENT_COUNT]; +#endif + +/* Set OFI context for operations which generate completion events */ +__opal_attribute_always_inline__ static inline void +set_thread_context(int ctxt) +{ +#if OPAL_HAVE_THREAD_LOCAL + per_thread_ctx = ctxt; + return; +#endif +} + +/* Retrieve OFI context to use for CQ poll */ +__opal_attribute_always_inline__ static inline void +get_thread_context(int *ctxt) +{ +#if OPAL_HAVE_THREAD_LOCAL + *ctxt = per_thread_ctx; +#endif + return; +} + +#define MTL_OFI_CONTEXT_LOCK(ctxt_id) \ +OPAL_LIKELY(!opal_mutex_atomic_trylock(&ompi_mtl_ofi.ofi_ctxt[ctxt_id].context_lock)) + +#define MTL_OFI_CONTEXT_UNLOCK(ctxt_id) \ +opal_mutex_atomic_unlock(&ompi_mtl_ofi.ofi_ctxt[ctxt_id].context_lock) + __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_progress(void) +ompi_mtl_ofi_context_progress(int ctxt_id) { - ssize_t ret; int count = 0, i, events_read; - struct fi_cq_err_entry error = { 0 }; ompi_mtl_ofi_request_t *ofi_req = NULL; - struct fi_cq_tagged_entry wc[ompi_mtl_ofi.ofi_progress_event_count]; + struct fi_cq_err_entry error = { 0 }; + ssize_t ret; +#if !OPAL_HAVE_THREAD_LOCAL + struct fi_cq_tagged_entry wc[MTL_OFI_MAX_PROG_EVENT_COUNT]; +#endif /** * Read the work completions from the CQ. @@ -69,7 +101,8 @@ ompi_mtl_ofi_progress(void) * Call the request's callback. */ while (true) { - ret = fi_cq_read(ompi_mtl_ofi.cq, (void *)&wc, ompi_mtl_ofi.ofi_progress_event_count); + ret = fi_cq_read(ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq, (void *)&wc, + ompi_mtl_ofi.ofi_progress_event_count); if (ret > 0) { count+= ret; events_read = ret; @@ -92,7 +125,7 @@ ompi_mtl_ofi_progress(void) * An error occured and is being reported via the CQ. * Read the error and forward it to the upper layer. */ - ret = fi_cq_readerr(ompi_mtl_ofi.cq, + ret = fi_cq_readerr(ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq, &error, 0); if (0 > ret) { @@ -126,6 +159,51 @@ ompi_mtl_ofi_progress(void) } } } + + return count; +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_progress(void) +{ + int count = 0, ctxt_id = 0, i; + static volatile uint32_t num_calls = 0; + + get_thread_context(&ctxt_id); + + if (ompi_mtl_ofi.mpi_thread_multiple) { + if (MTL_OFI_CONTEXT_LOCK(ctxt_id)) { + count += ompi_mtl_ofi_context_progress(ctxt_id); + MTL_OFI_CONTEXT_UNLOCK(ctxt_id); + } + } else { + count += ompi_mtl_ofi_context_progress(ctxt_id); + } + +#if OPAL_HAVE_THREAD_LOCAL + /* + * Try to progress other CQs in round-robin fashion. + * Progress is only made if no events were read from the CQ + * local to the calling thread past 16 times. + */ + if (OPAL_UNLIKELY((count == 0) && ompi_mtl_ofi.mpi_thread_multiple && + (((num_calls++) & 0xF) == 0 ))) { + for (i = 0; i < ompi_mtl_ofi.total_ctxts_used - 1; i++) { + ctxt_id = (ctxt_id + 1) % ompi_mtl_ofi.total_ctxts_used; + + if (MTL_OFI_CONTEXT_LOCK(ctxt_id)) { + count += ompi_mtl_ofi_context_progress(ctxt_id); + MTL_OFI_CONTEXT_UNLOCK(ctxt_id); + } + + /* Upon any work done, exit to let other threads take lock */ + if (OPAL_LIKELY(count > 0)) { + break; + } + } + } +#endif + return count; } @@ -148,6 +226,13 @@ ompi_mtl_ofi_progress(void) } while (OPAL_LIKELY(-FI_EAGAIN == RETURN)); \ } while (0); +#define MTL_OFI_LOG_FI_ERR(err, string) \ + do { \ + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + "%s:%d:%s: %s\n", \ + __FILE__, __LINE__, string, fi_strerror(-err)); \ + } while(0); + /* MTL interface functions */ int ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl); @@ -239,6 +324,20 @@ ompi_mtl_ofi_isend_callback(struct fi_cq_tagged_entry *wc, return OMPI_SUCCESS; } +#define MTL_OFI_MAP_COMM_TO_CONTEXT(comm_id, ctxt_id) \ + do { \ + if (ompi_mtl_ofi.thread_grouping && \ + (!ompi_mtl_ofi.threshold_comm_context_id || \ + ((uint32_t) ompi_mtl_ofi.threshold_comm_context_id > comm_id))) { \ + ctxt_id = ompi_mtl_ofi.comm_to_context[comm_id]; \ + } else if (ompi_mtl_ofi.thread_grouping) { \ + /* Round-robin assignment of contexts if threshold is reached */ \ + ctxt_id = comm_id % ompi_mtl_ofi.total_ctxts_used; \ + } else { \ + ctxt_id = 0; \ + } \ + } while (0); + __opal_attribute_always_inline__ static inline int ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, struct ompi_communicator_t *comm, @@ -249,8 +348,12 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, int tag) { ssize_t ret = OMPI_SUCCESS; - ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); + int ctxt_id = 0; + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); + + ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); assert(ack_req); ack_req->parent = ofi_req; @@ -259,7 +362,7 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, ofi_req->completion_count += 1; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, NULL, 0, NULL, @@ -290,7 +393,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, { ssize_t ret = OMPI_SUCCESS; ompi_mtl_ofi_request_t ofi_req; - int ompi_ret; + int ompi_ret, ctxt_id = 0; void *start; bool free_after; size_t length; @@ -299,6 +402,10 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, mca_mtl_ofi_endpoint_t *endpoint = NULL; ompi_mtl_ofi_request_t *ack_req = NULL; /* For synchronous send */ fi_addr_t src_addr = 0; + fi_addr_t sep_peer_fiaddr = 0; + + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); /** * Create a send request, start it and wait until it completes. @@ -309,6 +416,9 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, ompi_proc = ompi_comm_peer_lookup(comm, dest); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); + /* For Scalable Endpoints, gather target receive context */ + sep_peer_fiaddr = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); + ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_ret)) { return ompi_ret; @@ -328,7 +438,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, if (ompi_mtl_ofi.fi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); - src_addr = endpoint->peer_fiaddr; + src_addr = sep_peer_fiaddr; } else { match_bits = mtl_ofi_create_send_tag(comm->c_contextid, comm->c_my_rank, tag); @@ -345,27 +455,25 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, if (ompi_mtl_ofi.max_inject_size >= length) { if (ompi_mtl_ofi.fi_cq_data) { - MTL_OFI_RETRY_UNTIL_DONE(fi_tinjectdata(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tinjectdata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, comm->c_my_rank, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits), ret); } else { - MTL_OFI_RETRY_UNTIL_DONE(fi_tinject(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tinject(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits), ret); } if (OPAL_UNLIKELY(0 > ret)) { - char *fi_api = ompi_mtl_ofi.fi_cq_data ? "fi_tinjectddata" : "fi_tinject"; - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: %s failed: %s(%zd)", - __FILE__, __LINE__,fi_api, fi_strerror(-ret), ret); - + MTL_OFI_LOG_FI_ERR(ret, + ompi_mtl_ofi.fi_cq_data ? "fi_tinjectdata failed" + : "fi_tinject failed"); if (ack_req) { - fi_cancel((fid_t)ompi_mtl_ofi.ep, &ack_req->ctx); + fi_cancel((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, &ack_req->ctx); free(ack_req); } @@ -375,30 +483,27 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } else { ofi_req.completion_count += 1; if (ompi_mtl_ofi.fi_cq_data) { - MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, NULL, comm->c_my_rank, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits, (void *) &ofi_req.ctx), ret); } else { - MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, NULL, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits, (void *) &ofi_req.ctx), ret); } if (OPAL_UNLIKELY(0 > ret)) { - char *fi_api = ompi_mtl_ofi.fi_cq_data ? "fi_tsendddata" : "fi_send"; - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: %s failed: %s(%zd)", - __FILE__, __LINE__,fi_api, fi_strerror(-ret), ret); - free(fi_api); - + MTL_OFI_LOG_FI_ERR(ret, + ompi_mtl_ofi.fi_cq_data ? "fi_tsenddata failed" + : "fi_tsend failed"); ofi_req.status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); goto free_request_buffer; } @@ -432,7 +537,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, { ssize_t ret = OMPI_SUCCESS; ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t *) mtl_request; - int ompi_ret; + int ompi_ret, ctxt_id = 0; void *start; size_t length; bool free_after; @@ -440,7 +545,10 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, ompi_proc_t *ompi_proc = NULL; mca_mtl_ofi_endpoint_t *endpoint = NULL; ompi_mtl_ofi_request_t *ack_req = NULL; /* For synchronous send */ - fi_addr_t src_addr = 0; + fi_addr_t sep_peer_fiaddr = 0; + + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); ofi_req->event_callback = ompi_mtl_ofi_isend_callback; ofi_req->error_callback = ompi_mtl_ofi_send_error_callback; @@ -448,6 +556,9 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, ompi_proc = ompi_comm_peer_lookup(comm, dest); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); + /* For Scalable Endpoints, gather target receive context */ + sep_peer_fiaddr = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); + ompi_ret = ompi_mtl_datatype_pack(convertor, &start, &length, &free_after); if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_ret)) return ompi_ret; @@ -465,7 +576,6 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, if (ompi_mtl_ofi.fi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); - src_addr = endpoint->peer_fiaddr; } else { match_bits = mtl_ofi_create_send_tag(comm->c_contextid, comm->c_my_rank, tag); @@ -473,7 +583,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, } if (OPAL_UNLIKELY(MCA_PML_BASE_SEND_SYNCHRONOUS == mode)) { - ofi_req->status.MPI_ERROR = ompi_mtl_ofi_ssend_recv(ack_req, comm, &src_addr, + ofi_req->status.MPI_ERROR = ompi_mtl_ofi_ssend_recv(ack_req, comm, &sep_peer_fiaddr, ofi_req, endpoint, &match_bits, tag); if (OPAL_UNLIKELY(ofi_req->status.MPI_ERROR != OMPI_SUCCESS)) @@ -481,35 +591,27 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, } if (ompi_mtl_ofi.fi_cq_data) { - MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, NULL, comm->c_my_rank, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits, (void *) &ofi_req->ctx), ret); } else { - MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tsend(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, NULL, - endpoint->peer_fiaddr, + sep_peer_fiaddr, match_bits, (void *) &ofi_req->ctx), ret); } if (OPAL_UNLIKELY(0 > ret)) { - char *fi_api; - if (ompi_mtl_ofi.fi_cq_data) { - asprintf( &fi_api, "fi_tsendddata") ; - } - else { - asprintf( &fi_api, "fi_send") ; - } - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: %s failed: %s(%zd)", - __FILE__, __LINE__,fi_api, fi_strerror(-ret), ret); - free(fi_api); + MTL_OFI_LOG_FI_ERR(ret, + ompi_mtl_ofi.fi_cq_data ? "fi_tsenddata failed" + : "fi_tsend failed"); ofi_req->status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); } @@ -529,7 +631,7 @@ __opal_attribute_always_inline__ static inline int ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, ompi_mtl_ofi_request_t *ofi_req) { - int ompi_ret; + int ompi_ret, ctxt_id = 0; ssize_t ret; ompi_proc_t *ompi_proc = NULL; mca_mtl_ofi_endpoint_t *endpoint = NULL; @@ -537,6 +639,8 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, ompi_status_public_t *status = NULL; struct fi_msg_tagged tagged_msg; + MTL_OFI_MAP_COMM_TO_CONTEXT(ofi_req->comm->c_contextid, ctxt_id); + assert(ofi_req->super.ompi_req); status = &ofi_req->super.ompi_req->req_status; @@ -599,7 +703,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, if (ompi_mtl_ofi.any_addr == ofi_req->remote_addr) { ompi_proc = ompi_comm_peer_lookup(ofi_req->comm, src); endpoint = ompi_mtl_ofi_get_endpoint(ofi_req->mtl, ompi_proc); - ofi_req->remote_addr = endpoint->peer_fiaddr; + ofi_req->remote_addr = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); } tagged_msg.msg_iov = NULL; @@ -615,12 +719,10 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, tagged_msg.context = NULL; tagged_msg.data = 0; - MTL_OFI_RETRY_UNTIL_DONE(fi_tsendmsg(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_tsendmsg(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, &tagged_msg, 0), ret); if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_tsendmsg failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); + MTL_OFI_LOG_FI_ERR(ret, "fi_tsendmsg failed"); status->MPI_ERROR = OMPI_ERROR; } } @@ -666,7 +768,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, struct opal_convertor_t *convertor, mca_mtl_request_t *mtl_request) { - int ompi_ret = OMPI_SUCCESS; + int ompi_ret = OMPI_SUCCESS, ctxt_id = 0; ssize_t ret; uint64_t match_bits, mask_bits; fi_addr_t remote_addr = ompi_mtl_ofi.any_addr; @@ -677,12 +779,14 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, size_t length; bool free_after; + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); if (ompi_mtl_ofi.fi_cq_data) { if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup(comm, src); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); - remote_addr = endpoint->peer_fiaddr; + remote_addr = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); } mtl_ofi_create_recv_tag_CQD(&match_bits, &mask_bits, comm->c_contextid, @@ -713,7 +817,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, ofi_req->remote_addr = remote_addr; ofi_req->match_bits = match_bits; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ep, + MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, start, length, NULL, @@ -725,9 +829,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, if (NULL != ofi_req->buffer) { free(ofi_req->buffer); } - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecv failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); + MTL_OFI_LOG_FI_ERR(ret, "fi_trecv failed"); return ompi_mtl_ofi_get_error(ret); } @@ -798,9 +900,13 @@ ompi_mtl_ofi_imrecv(struct mca_mtl_base_module_t *mtl, bool free_after; struct iovec iov; struct fi_msg_tagged msg; - int ompi_ret; + int ompi_ret, ctxt_id = 0; ssize_t ret; uint64_t msgflags = FI_CLAIM | FI_COMPLETION; + struct ompi_communicator_t *comm = (*message)->comm; + + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); ompi_ret = ompi_mtl_datatype_recv_buf(convertor, &start, @@ -833,11 +939,9 @@ ompi_mtl_ofi_imrecv(struct mca_mtl_base_module_t *mtl, msg.context = (void *)&ofi_req->ctx; msg.data = 0; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, &msg, msgflags), ret); if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecvmsg failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); + MTL_OFI_LOG_FI_ERR(ret, "fi_trecvmsg failed"); return ompi_mtl_ofi_get_error(ret); } @@ -891,13 +995,17 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, ssize_t ret; struct fi_msg_tagged msg; uint64_t msgflags = FI_PEEK | FI_COMPLETION; + int ctxt_id = 0; + + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); if (ompi_mtl_ofi.fi_cq_data) { /* If the source is known, use its peer_fiaddr. */ if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup( comm, src ); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); - remote_proc = endpoint->peer_fiaddr; + remote_proc = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); } mtl_ofi_create_recv_tag_CQD(&match_bits, &mask_bits, comm->c_contextid, @@ -932,7 +1040,7 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, ofi_req.completion_count = 1; ofi_req.match_state = 0; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, &msg, msgflags), ret); if (-FI_ENOMSG == ret) { /** * The search request completed but no matching message was found. @@ -940,9 +1048,7 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, *flag = 0; return OMPI_SUCCESS; } else if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecvmsg failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); + MTL_OFI_LOG_FI_ERR(ret, "fi_trecvmsg failed"); return ompi_mtl_ofi_get_error(ret); } @@ -977,6 +1083,10 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, ssize_t ret; struct fi_msg_tagged msg; uint64_t msgflags = FI_PEEK | FI_CLAIM | FI_COMPLETION; + int ctxt_id = 0; + + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); ofi_req = malloc(sizeof *ofi_req); if (NULL == ofi_req) { @@ -991,7 +1101,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup( comm, src ); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); - remote_proc = endpoint->peer_fiaddr; + remote_proc = fi_rx_addr(endpoint->peer_fiaddr, ctxt_id, ompi_mtl_ofi.rx_ctx_bits); } mtl_ofi_create_recv_tag_CQD(&match_bits, &mask_bits, comm->c_contextid, @@ -1027,7 +1137,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, ofi_req->match_state = 0; ofi_req->mask_bits = mask_bits; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ep, &msg, msgflags), ret); + MTL_OFI_RETRY_UNTIL_DONE(fi_trecvmsg(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, &msg, msgflags), ret); if (-FI_ENOMSG == ret) { /** * The search request completed but no matching message was found. @@ -1036,9 +1146,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, free(ofi_req); return OMPI_SUCCESS; } else if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecvmsg failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); + MTL_OFI_LOG_FI_ERR(ret, "fi_trecvmsg failed"); free(ofi_req); return ompi_mtl_ofi_get_error(ret); } @@ -1076,9 +1184,11 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, mca_mtl_request_t *mtl_request, int flag) { - int ret; + int ret, ctxt_id = 0; ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t*) mtl_request; + MTL_OFI_MAP_COMM_TO_CONTEXT(ofi_req->comm->c_contextid, ctxt_id); + switch (ofi_req->type) { case OMPI_MTL_OFI_SEND: /** @@ -1095,7 +1205,8 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, ompi_mtl_ofi_progress(); if (!ofi_req->req_started) { - ret = fi_cancel((fid_t)ompi_mtl_ofi.ep, &ofi_req->ctx); + ret = fi_cancel((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, + &ofi_req->ctx); if (0 == ret) { /** * Wait for the request to be cancelled. @@ -1122,18 +1233,224 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, return OMPI_SUCCESS; } +static int ompi_mtl_ofi_init_contexts(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + mca_mtl_ofi_ep_type ep_type) +{ + int ret; + int ctxt_id = ompi_mtl_ofi.total_ctxts_used; + struct fi_cq_attr cq_attr = {0}; + cq_attr.format = FI_CQ_FORMAT_TAGGED; + cq_attr.size = ompi_mtl_ofi.ofi_progress_event_count; + + if (OFI_REGULAR_EP == ep_type) { + /* + * For regular endpoints, just create the Lock object and register + * progress function. + */ + goto init_regular_ep; + } + + /* + * We only create upto Max number of contexts allowed by provider. + * If user enables thread grouping feature and creates more number of + * communicators than we have contexts, then we set the threshold + * context_id so we know to use context 0 for operations involving these + * "extra" communicators. + */ + if (ompi_mtl_ofi.max_ctx_cnt <= ctxt_id) { + if (!ompi_mtl_ofi.threshold_comm_context_id) { + ompi_mtl_ofi.threshold_comm_context_id = comm->c_contextid; + + opal_show_help("help-mtl-ofi.txt", "SEP ctxt limit", true, ctxt_id, + ompi_process_info.nodename, __FILE__, __LINE__); + } + + return OMPI_SUCCESS; + } + + /* Init context info for Scalable EPs */ + ret = fi_tx_context(ompi_mtl_ofi.sep, ctxt_id, NULL, &ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, NULL); + if (ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_tx_context failed"); + goto init_error; + } + + ret = fi_rx_context(ompi_mtl_ofi.sep, ctxt_id, NULL, &ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, NULL); + if (ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_rx_context failed"); + goto init_error; + } + + ret = fi_cq_open(ompi_mtl_ofi.domain, &cq_attr, &ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq, NULL); + if (ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_cq_open failed"); + goto init_error; + } + + /* Bind CQ to TX/RX context object */ + ret = fi_ep_bind(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, (fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq, + FI_TRANSMIT | FI_SELECTIVE_COMPLETION); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_bind CQ-EP (FI_TRANSMIT) failed"); + goto init_error; + } + + ret = fi_ep_bind(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, (fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq, + FI_RECV | FI_SELECTIVE_COMPLETION); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_bind CQ-EP (FI_RECV) failed"); + goto init_error; + } + + /* Enable Endpoint for communication. This commits the bind operations */ + ret = fi_enable(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_enable (send context) failed"); + goto init_error; + } + + ret = fi_enable(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_enable (recv context) failed"); + goto init_error; + } + +init_regular_ep: + /* Initialize per-context lock */ + OBJ_CONSTRUCT(&ompi_mtl_ofi.ofi_ctxt[ctxt_id].context_lock, opal_mutex_t); + + if (MPI_COMM_WORLD == comm) { + ret = opal_progress_register(ompi_mtl_ofi_progress_no_inline); + if (OMPI_SUCCESS != ret) { + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: opal_progress_register failed: %d\n", + __FILE__, __LINE__, ret); + goto init_error; + } + } + + ompi_mtl_ofi.comm_to_context[comm->c_contextid] = ompi_mtl_ofi.total_ctxts_used; + ompi_mtl_ofi.total_ctxts_used++; + + return OMPI_SUCCESS; + +init_error: + if (ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep) { + (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep); + } + + if (ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep) { + (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep); + } + + if (ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq) { + (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq); + } + + return ret; +} + +static int ompi_mtl_ofi_finalize_contexts(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + mca_mtl_ofi_ep_type ep_type) +{ + int ret = OMPI_SUCCESS, ctxt_id = 0; + + if (OFI_REGULAR_EP == ep_type) { + /* For regular EPs, simply destruct Lock object and exit */ + goto finalize_regular_ep; + } + + if (ompi_mtl_ofi.thread_grouping && + ompi_mtl_ofi.threshold_comm_context_id && + ((uint32_t) ompi_mtl_ofi.threshold_comm_context_id <= comm->c_contextid)) { + return OMPI_SUCCESS; + } + + ctxt_id = ompi_mtl_ofi.thread_grouping ? + ompi_mtl_ofi.comm_to_context[comm->c_contextid] : 0; + + /* + * For regular EPs, TX/RX contexts are aliased to SEP object which is + * closed in ompi_mtl_ofi_finalize(). So, skip handling those here. + */ + if ((ret = fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep))) { + goto finalize_err; + } + + if ((ret = fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep))) { + goto finalize_err; + } + + if ((ret = fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].cq))) { + goto finalize_err; + } + +finalize_regular_ep: + /* Destroy context lock */ + OBJ_DESTRUCT(&ompi_mtl_ofi.ofi_ctxt[ctxt_id].context_lock); + + return OMPI_SUCCESS; + +finalize_err: + opal_show_help("help-mtl-ofi.txt", "OFI call fail", true, + "fi_close", + ompi_process_info.nodename, __FILE__, __LINE__, + fi_strerror(-ret), ret); + + return OMPI_ERROR; +} + __opal_attribute_always_inline__ static inline int ompi_mtl_ofi_add_comm(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm) { + int ret; + mca_mtl_ofi_ep_type ep_type = (false == ompi_mtl_ofi.sep_supported) ? + OFI_REGULAR_EP : OFI_SCALABLE_EP; + + /* + * If thread grouping enabled, add new OFI context for each communicator + * other than MPI_COMM_SELF. + */ + if ((ompi_mtl_ofi.thread_grouping && (MPI_COMM_SELF != comm)) || + /* If no thread grouping, add new OFI context only + * for MPI_COMM_WORLD. + */ + (!ompi_mtl_ofi.thread_grouping && (MPI_COMM_WORLD == comm))) { + + ret = ompi_mtl_ofi_init_contexts(mtl, comm, ep_type); + + if (OMPI_SUCCESS != ret) { + goto error; + } + } + return OMPI_SUCCESS; + +error: + return OMPI_ERROR; } __opal_attribute_always_inline__ static inline int ompi_mtl_ofi_del_comm(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm) { - return OMPI_SUCCESS; + int ret = OMPI_SUCCESS; + mca_mtl_ofi_ep_type ep_type = (false == ompi_mtl_ofi.sep_supported) ? + OFI_REGULAR_EP : OFI_SCALABLE_EP; + + /* + * Clean up OFI contexts information. + */ + if ((ompi_mtl_ofi.thread_grouping && (MPI_COMM_SELF != comm)) || + (!ompi_mtl_ofi.thread_grouping && (MPI_COMM_WORLD == comm))) { + + ret = ompi_mtl_ofi_finalize_contexts(mtl, comm, ep_type); + } + + return ret; } END_C_DECLS diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index f23f4dd76b2..8856db07983 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -33,6 +33,11 @@ static int data_progress; static int av_type; static int ofi_tag_mode; +#if OPAL_HAVE_THREAD_LOCAL + opal_thread_local int per_thread_ctx; + opal_thread_local struct fi_cq_tagged_entry wc[MTL_OFI_MAX_PROG_EVENT_COUNT]; +#endif + /* * Enumerators */ @@ -142,8 +147,8 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &prov_exclude); - ompi_mtl_ofi.ofi_progress_event_count = 100; - asprintf(&desc, "Max number of events to read each call to OFI progress (default: %d events will be read per OFI progress call)", ompi_mtl_ofi.ofi_progress_event_count); + ompi_mtl_ofi.ofi_progress_event_count = MTL_OFI_MAX_PROG_EVENT_COUNT; + opal_asprintf(&desc, "Max number of events to read each call to OFI progress (default: %d events will be read per OFI progress call)", ompi_mtl_ofi.ofi_progress_event_count); mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, "progress_event_cnt", desc, @@ -229,6 +234,15 @@ ompi_mtl_ofi_component_register(void) &av_type); OBJ_RELEASE(new_enum); + ompi_mtl_ofi.thread_grouping = 0; + mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, + "thread_grouping", + "Enable/Disable Thread Grouping feature", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mtl_ofi.thread_grouping); + return OMPI_SUCCESS; } @@ -242,8 +256,7 @@ ompi_mtl_ofi_component_open(void) ompi_mtl_ofi.domain = NULL; ompi_mtl_ofi.av = NULL; - ompi_mtl_ofi.cq = NULL; - ompi_mtl_ofi.ep = NULL; + ompi_mtl_ofi.sep = NULL; /** * Sanity check: provider_include and provider_exclude must be mutually @@ -431,6 +444,158 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { } } +#define MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts) \ + do { \ + ompi_mtl_ofi.comm_to_context = calloc(num_ofi_ctxts, sizeof(int)); \ + if (OPAL_UNLIKELY(!ompi_mtl_ofi.comm_to_context)) { \ + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + "%s:%d: alloc of comm_to_context array failed: %s\n",\ + __FILE__, __LINE__, strerror(errno)); \ + return ret; \ + } \ + } while (0); + +#define MTL_OFI_ALLOC_OFI_CTXTS() \ + do { \ + ompi_mtl_ofi.ofi_ctxt = (mca_mtl_ofi_context_t *) malloc(ompi_mtl_ofi.max_ctx_cnt * \ + sizeof(mca_mtl_ofi_context_t)); \ + if (OPAL_UNLIKELY(!ompi_mtl_ofi.ofi_ctxt)) { \ + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + "%s:%d: alloc of ofi_ctxt array failed: %s\n", \ + __FILE__, __LINE__, strerror(errno)); \ + return ret; \ + } \ + } while(0); + +static int ompi_mtl_ofi_init_sep(struct fi_info *prov) +{ + int ret = OMPI_SUCCESS, num_ofi_ctxts; + struct fi_av_attr av_attr = {0}; + + ompi_mtl_ofi.max_ctx_cnt = (prov->domain_attr->max_ep_tx_ctx < + prov->domain_attr->max_ep_rx_ctx) ? + prov->domain_attr->max_ep_tx_ctx : + prov->domain_attr->max_ep_rx_ctx; + + /* Provision enough contexts to service all ranks in a node */ + ompi_mtl_ofi.max_ctx_cnt /= (1 + ompi_process_info.num_local_peers); + prov->ep_attr->tx_ctx_cnt = prov->ep_attr->rx_ctx_cnt = + ompi_mtl_ofi.max_ctx_cnt; + + ret = fi_scalable_ep(ompi_mtl_ofi.domain, prov, &ompi_mtl_ofi.sep, NULL); + if (0 != ret) { + opal_show_help("help-mtl-ofi.txt", "OFI call fail", true, + "fi_scalable_ep", + ompi_process_info.nodename, __FILE__, __LINE__, + fi_strerror(-ret), -ret); + return ret; + } + + ompi_mtl_ofi.rx_ctx_bits = 0; + while (ompi_mtl_ofi.max_ctx_cnt >> ++ompi_mtl_ofi.rx_ctx_bits); + + av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; + av_attr.rx_ctx_bits = ompi_mtl_ofi.rx_ctx_bits; + av_attr.count = ompi_mtl_ofi.max_ctx_cnt; + ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); + + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_av_open failed"); + return ret; + } + + ret = fi_scalable_ep_bind(ompi_mtl_ofi.sep, (fid_t)ompi_mtl_ofi.av, 0); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_bind AV-EP failed"); + return ret; + } + + /* + * If SEP supported and Thread Grouping feature enabled, use + * max_ctx_cnt + 2. Extra 2 items is to accomodate Open MPI contextid + * numbering- COMM_WORLD is 0, COMM_SELF is 1. Other user created + * Comm contextid values are assigned sequentially starting with 3. + */ + num_ofi_ctxts = ompi_mtl_ofi.thread_grouping ? + ompi_mtl_ofi.max_ctx_cnt + 2 : 1; + MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts); + + ompi_mtl_ofi.total_ctxts_used = 0; + ompi_mtl_ofi.threshold_comm_context_id = 0; + + /* Allocate memory for OFI contexts */ + MTL_OFI_ALLOC_OFI_CTXTS(); + + return ret; +} + +static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov) +{ + int ret = OMPI_SUCCESS, num_ofi_ctxts; + struct fi_av_attr av_attr = {0}; + struct fi_cq_attr cq_attr = {0}; + cq_attr.format = FI_CQ_FORMAT_TAGGED; + cq_attr.size = ompi_mtl_ofi.ofi_progress_event_count; + + ompi_mtl_ofi.max_ctx_cnt = 1; + ret = fi_endpoint(ompi_mtl_ofi.domain, /* In: Domain object */ + prov, /* In: Provider */ + &ompi_mtl_ofi.sep, /* Out: Endpoint object */ + NULL); /* Optional context */ + if (0 != ret) { + opal_show_help("help-mtl-ofi.txt", "OFI call fail", true, + "fi_endpoint", + ompi_process_info.nodename, __FILE__, __LINE__, + fi_strerror(-ret), -ret); + return ret; + } + + /** + * Create the objects that will be bound to the endpoint. + * The objects include: + * - address vector and completion queues + */ + av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; + ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); + if (ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_av_open failed"); + return ret; + } + + ret = fi_ep_bind(ompi_mtl_ofi.sep, + (fid_t)ompi_mtl_ofi.av, + 0); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_bind AV-EP failed"); + return ret; + } + + num_ofi_ctxts = 1; + MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts); + + /* Allocate memory for OFI contexts */ + MTL_OFI_ALLOC_OFI_CTXTS(); + + ompi_mtl_ofi.ofi_ctxt[0].tx_ep = ompi_mtl_ofi.sep; + ompi_mtl_ofi.ofi_ctxt[0].rx_ep = ompi_mtl_ofi.sep; + + ret = fi_cq_open(ompi_mtl_ofi.domain, &cq_attr, &ompi_mtl_ofi.ofi_ctxt[0].cq, NULL); + if (ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_cq_open failed"); + return ret; + } + + /* Bind CQ to endpoint object */ + ret = fi_ep_bind(ompi_mtl_ofi.sep, (fid_t)ompi_mtl_ofi.ofi_ctxt[0].cq, + FI_TRANSMIT | FI_RECV | FI_SELECTIVE_COMPLETION); + if (0 != ret) { + MTL_OFI_LOG_FI_ERR(ret, "fi_bind CQ-EP failed"); + return ret; + } + + return ret; +} + static mca_mtl_base_module_t* ompi_mtl_ofi_component_init(bool enable_progress_threads, bool enable_mpi_threads) @@ -440,8 +605,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, struct fi_info *providers = NULL; struct fi_info *prov = NULL; struct fi_info *prov_cq_data = NULL; - struct fi_cq_attr cq_attr = {0}; - struct fi_av_attr av_attr = {0}; char ep_name[FI_NAME_MAX] = {0}; size_t namelen; int ofi_tag_leading_zeros; @@ -473,8 +636,10 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, hints->tx_attr->op_flags = FI_COMPLETION; if (enable_mpi_threads) { + ompi_mtl_ofi.mpi_thread_multiple = true; hints->domain_attr->threading = FI_THREAD_SAFE; } else { + ompi_mtl_ofi.mpi_thread_multiple = false; hints->domain_attr->threading = FI_THREAD_DOMAIN; } @@ -607,6 +772,27 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.base.mtl_max_contextid = (int)((1ULL << ofi_tag_bits_for_cid) - 1); ompi_mtl_ofi.num_peers = 0; + /* Check if Scalable Endpoints can be enabled for the provider */ + ompi_mtl_ofi.sep_supported = false; + if ((prov->domain_attr->max_ep_tx_ctx > 1) || + (prov->domain_attr->max_ep_rx_ctx > 1)) { + ompi_mtl_ofi.sep_supported = true; + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n", + __FILE__, __LINE__, prov->fabric_attr->prov_name); + } + + /* + * Scalable Endpoints is required for Thread Grouping feature + */ + if (!ompi_mtl_ofi.sep_supported && ompi_mtl_ofi.thread_grouping) { + opal_show_help("help-mtl-ofi.txt", "SEP unavailable", true, + prov->fabric_attr->prov_name, + ompi_process_info.nodename, __FILE__, __LINE__, + fi_strerror(-ret), -ret); + goto error; + } + /** * Open fabric * The getinfo struct returns a fabric attribute struct that can be used to @@ -641,25 +827,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } - /** - * Create a transport level communication endpoint. To use the endpoint, - * it must be bound to completion counters or event queues and enabled, - * and the resources consumed by it, such as address vectors, counters, - * completion queues, etc. - * see man fi_endpoint for more details. - */ - ret = fi_endpoint(ompi_mtl_ofi.domain, /* In: Domain object */ - prov, /* In: Provider */ - &ompi_mtl_ofi.ep, /* Out: Endpoint object */ - NULL); /* Optional context */ - if (0 != ret) { - opal_show_help("help-mtl-ofi.txt", "OFI call fail", true, - "fi_endpoint", - ompi_process_info.nodename, __FILE__, __LINE__, - fi_strerror(-ret), -ret); - goto error; - } - /** * Save the maximum sizes. */ @@ -667,76 +834,37 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.max_msg_size = prov->ep_attr->max_msg_size; /** - * Create the objects that will be bound to the endpoint. - * The objects include: - * - completion queue for events - * - address vector of other endpoint addresses - * - dynamic memory-spanning memory region + * The user is not allowed to exceed MTL_OFI_MAX_PROG_EVENT_COUNT. + * The reason is because progress entries array is now a TLS variable + * as opposed to being allocated on the heap for thread-safety purposes. */ - cq_attr.format = FI_CQ_FORMAT_TAGGED; + if (ompi_mtl_ofi.ofi_progress_event_count > MTL_OFI_MAX_PROG_EVENT_COUNT) { + ompi_mtl_ofi.ofi_progress_event_count = MTL_OFI_MAX_PROG_EVENT_COUNT; + } /** - * If a user has set an ofi_progress_event_count > the default, then - * the CQ size hint is set to the user's desired value such that - * the CQ created will have enough slots to store up to - * ofi_progress_event_count events. If a user has not set the - * ofi_progress_event_count, then the provider is trusted to set a - * default high CQ size and the CQ size hint is left unspecified. + * Create a transport level communication endpoint. To use the endpoint, + * it must be bound to the resources consumed by it such as address + * vectors, completion counters or event queues etc, and enabled. + * See man fi_endpoint for more details. */ - if (ompi_mtl_ofi.ofi_progress_event_count > 100) { - cq_attr.size = ompi_mtl_ofi.ofi_progress_event_count; - } - - ret = fi_cq_open(ompi_mtl_ofi.domain, &cq_attr, &ompi_mtl_ofi.cq, NULL); - if (ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_cq_open failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - goto error; - } - - av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; - - ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); - if (ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_av_open failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - goto error; + if (true == ompi_mtl_ofi.sep_supported) { + ret = ompi_mtl_ofi_init_sep(prov); + } else { + ret = ompi_mtl_ofi_init_regular_ep(prov); } - /** - * Bind the CQ and AV to the endpoint object. - */ - ret = fi_ep_bind(ompi_mtl_ofi.ep, - (fid_t)ompi_mtl_ofi.cq, - FI_TRANSMIT | FI_RECV | FI_SELECTIVE_COMPLETION); - if (0 != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_bind CQ-EP failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); + if (OMPI_SUCCESS != ret) { goto error; } - ret = fi_ep_bind(ompi_mtl_ofi.ep, - (fid_t)ompi_mtl_ofi.av, - 0); - if (0 != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_bind AV-EP failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); - goto error; - } + ompi_mtl_ofi.total_ctxts_used = 0; + ompi_mtl_ofi.threshold_comm_context_id = 0; - /** - * Enable the endpoint for communication - * This commits the bind operations. - */ - ret = fi_enable(ompi_mtl_ofi.ep); + /* Enable Endpoint for communication */ + ret = fi_enable(ompi_mtl_ofi.sep); if (0 != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_enable failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); + MTL_OFI_LOG_FI_ERR(ret, "fi_enable failed"); goto error; } @@ -754,11 +882,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * Get our address and publish it with modex. */ namelen = sizeof(ep_name); - ret = fi_getname((fid_t)ompi_mtl_ofi.ep, &ep_name[0], &namelen); + ret = fi_getname((fid_t)ompi_mtl_ofi.sep, + &ep_name[0], + &namelen); if (ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_getname failed: %s\n", - __FILE__, __LINE__, fi_strerror(-ret)); + MTL_OFI_LOG_FI_ERR(ret, "fi_getname failed"); goto error; } @@ -780,17 +908,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, */ ompi_mtl_ofi.any_addr = FI_ADDR_UNSPEC; - /** - * Activate progress callback. - */ - ret = opal_progress_register(ompi_mtl_ofi_progress_no_inline); - if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: opal_progress_register failed: %d\n", - __FILE__, __LINE__, ret); - goto error; - } - return &ompi_mtl_ofi.base; error: @@ -803,14 +920,16 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, if (hints) { (void) fi_freeinfo(hints); } + if (ompi_mtl_ofi.sep) { + (void) fi_close((fid_t)ompi_mtl_ofi.sep); + } if (ompi_mtl_ofi.av) { (void) fi_close((fid_t)ompi_mtl_ofi.av); } - if (ompi_mtl_ofi.cq) { - (void) fi_close((fid_t)ompi_mtl_ofi.cq); - } - if (ompi_mtl_ofi.ep) { - (void) fi_close((fid_t)ompi_mtl_ofi.ep); + if ((false == ompi_mtl_ofi.sep_supported) && + ompi_mtl_ofi.ofi_ctxt[0].cq) { + /* Check if CQ[0] was created for non-SEP case and close if needed */ + (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[0].cq); } if (ompi_mtl_ofi.domain) { (void) fi_close((fid_t)ompi_mtl_ofi.domain); @@ -818,6 +937,12 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, if (ompi_mtl_ofi.fabric) { (void) fi_close((fid_t)ompi_mtl_ofi.fabric); } + if (ompi_mtl_ofi.comm_to_context) { + free(ompi_mtl_ofi.comm_to_context); + } + if (ompi_mtl_ofi.ofi_ctxt) { + free(ompi_mtl_ofi.ofi_ctxt); + } return NULL; } @@ -830,16 +955,24 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl) opal_progress_unregister(ompi_mtl_ofi_progress_no_inline); /* Close all the OFI objects */ - if ((ret = fi_close((fid_t)ompi_mtl_ofi.ep))) { + if ((ret = fi_close((fid_t)ompi_mtl_ofi.sep))) { goto finalize_err; } - if ((ret = fi_close((fid_t)ompi_mtl_ofi.cq))) { + if ((ret = fi_close((fid_t)ompi_mtl_ofi.av))) { goto finalize_err; } - if ((ret = fi_close((fid_t)ompi_mtl_ofi.av))) { - goto finalize_err; + if (false == ompi_mtl_ofi.sep_supported) { + /* + * CQ[0] is bound to SEP object when SEP is not supported by a + * provider. OFI spec requires that we close the Endpoint that is bound + * to the CQ before closing the CQ itself. So, for the non-SEP case, we + * handle the closing of CQ[0] here. + */ + if ((ret = fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[0].cq))) { + goto finalize_err; + } } if ((ret = fi_close((fid_t)ompi_mtl_ofi.domain))) { @@ -850,6 +983,10 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl) goto finalize_err; } + /* Free memory allocated for TX/RX contexts */ + free(ompi_mtl_ofi.comm_to_context); + free(ompi_mtl_ofi.ofi_ctxt); + return OMPI_SUCCESS; finalize_err: diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 30b10bd9be0..6e54ae5dbfa 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -19,6 +19,19 @@ BEGIN_C_DECLS /** * MTL Module Interface */ + +typedef struct mca_mtl_ofi_context_t { + /* Transmit and receive contexts */ + struct fid_ep *tx_ep; + struct fid_ep *rx_ep; + + /* Completion queue */ + struct fid_cq *cq; + + /* Thread locking */ + opal_mutex_t context_lock; +} mca_mtl_ofi_context_t; + typedef struct mca_mtl_ofi_module_t { mca_mtl_base_module_t base; @@ -31,11 +44,38 @@ typedef struct mca_mtl_ofi_module_t { /** Address vector handle */ struct fid_av *av; - /** Completion queue handle */ - struct fid_cq *cq; + /* Scalable Endpoint */ + struct fid_ep *sep; + + /* Multi-threaded Application flag */ + bool mpi_thread_multiple; + + /* OFI contexts */ + mca_mtl_ofi_context_t *ofi_ctxt; + + /* Max context count for scalable endpoints */ + int max_ctx_cnt; - /** Endpoint to communicate on */ - struct fid_ep *ep; + /* Total number of TX/RX contexts used by MTL */ + int total_ctxts_used; + + /* + * Store context id of communicator if creating more than number of + * contexts + */ + int threshold_comm_context_id; + + /* Mapping of communicator ID to OFI context */ + int *comm_to_context; + + /* MCA parameter for Thread grouping feature */ + int thread_grouping; + + /* Boolen value to indicate if provider supports Scalable EP or not */ + bool sep_supported; + + /* Numbers of bits used for rx contexts */ + int rx_ctx_bits; /** Endpoint name length */ size_t epnamelen; @@ -80,6 +120,19 @@ typedef struct mca_mtl_ofi_component_t { mca_mtl_base_component_2_0_0_t super; } mca_mtl_ofi_component_t; +typedef enum { + OFI_REGULAR_EP = 0, + OFI_SCALABLE_EP, +} mca_mtl_ofi_ep_type; + +/* + * Define upper limit for number of events read from a CQ. + * Setting this to 100 as this was deemed optimal from empirical data. + * If one wants to read lesser number of events from the CQ, the MCA + * variable can be used. + */ +#define MTL_OFI_MAX_PROG_EVENT_COUNT 100 + /*OFI TAG: * Define 3 different OFI tag distributions: * 1) Support FI_REMOTE_CQ_DATA: No need for source rank in the tag From 4b293d3823ee682491d1e663d45b664ef9b0ccf2 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Tue, 11 Dec 2018 21:23:24 +0000 Subject: [PATCH 593/674] mtl/ofi: Fix crash if no providers found Commit 109d0569ffd introduced a crash when an error occurred before ofi_ctxt was allocated, including when no providers passed the selection logic. Properly check that the pointer is not NULL in the error cleanup code before dereferencing the pointer. Signed-off-by: Brian Barrett (cherry picked from commit 6e15128d960aaa40dd7e905ae3e9e53d9cdaac2a) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 8856db07983..a9f1ea00e47 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -927,6 +927,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, (void) fi_close((fid_t)ompi_mtl_ofi.av); } if ((false == ompi_mtl_ofi.sep_supported) && + ompi_mtl_ofi.ofi_ctxt != NULL && ompi_mtl_ofi.ofi_ctxt[0].cq) { /* Check if CQ[0] was created for non-SEP case and close if needed */ (void) fi_close((fid_t)ompi_mtl_ofi.ofi_ctxt[0].cq); From 3858b51d11bc5b0d4c7aa01d84bcf534672b8356 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Wed, 12 Dec 2018 10:53:56 -0800 Subject: [PATCH 594/674] Fix for SEP when num local procs is greater than available contexts For cases when the number of local processes is greater than the number of available contexts, the SEP initialization phase would calculate the number of contexts to provision for each rank to be 0 and would eventually crash. Fix the issue here by using regular endpoints in the event the number of local processes is more than available contexts. This fixes issue #6182. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit e5e19dfcf7618185bdc89f1e91506a9bf15355b1) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi.h | 4 +-- ompi/mca/mtl/ofi/mtl_ofi_component.c | 39 ++++++++++++++++------------ ompi/mca/mtl/ofi/mtl_ofi_types.h | 4 +-- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index d437eb031c9..bb22b1c5859 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -1407,7 +1407,7 @@ ompi_mtl_ofi_add_comm(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm) { int ret; - mca_mtl_ofi_ep_type ep_type = (false == ompi_mtl_ofi.sep_supported) ? + mca_mtl_ofi_ep_type ep_type = (0 == ompi_mtl_ofi.enable_sep) ? OFI_REGULAR_EP : OFI_SCALABLE_EP; /* @@ -1438,7 +1438,7 @@ ompi_mtl_ofi_del_comm(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm) { int ret = OMPI_SUCCESS; - mca_mtl_ofi_ep_type ep_type = (false == ompi_mtl_ofi.sep_supported) ? + mca_mtl_ofi_ep_type ep_type = (0 == ompi_mtl_ofi.enable_sep) ? OFI_REGULAR_EP : OFI_SCALABLE_EP; /* diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index a9f1ea00e47..0df79260cd5 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -472,13 +472,6 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) int ret = OMPI_SUCCESS, num_ofi_ctxts; struct fi_av_attr av_attr = {0}; - ompi_mtl_ofi.max_ctx_cnt = (prov->domain_attr->max_ep_tx_ctx < - prov->domain_attr->max_ep_rx_ctx) ? - prov->domain_attr->max_ep_tx_ctx : - prov->domain_attr->max_ep_rx_ctx; - - /* Provision enough contexts to service all ranks in a node */ - ompi_mtl_ofi.max_ctx_cnt /= (1 + ompi_process_info.num_local_peers); prov->ep_attr->tx_ctx_cnt = prov->ep_attr->rx_ctx_cnt = ompi_mtl_ofi.max_ctx_cnt; @@ -600,15 +593,14 @@ static mca_mtl_base_module_t* ompi_mtl_ofi_component_init(bool enable_progress_threads, bool enable_mpi_threads) { - int ret, fi_version; + int ret, fi_version, num_local_ranks; + int ofi_tag_leading_zeros, ofi_tag_bits_for_cid; struct fi_info *hints; struct fi_info *providers = NULL; struct fi_info *prov = NULL; struct fi_info *prov_cq_data = NULL; char ep_name[FI_NAME_MAX] = {0}; size_t namelen; - int ofi_tag_leading_zeros; - int ofi_tag_bits_for_cid; /** * Hints to filter providers @@ -773,10 +765,10 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.num_peers = 0; /* Check if Scalable Endpoints can be enabled for the provider */ - ompi_mtl_ofi.sep_supported = false; + ompi_mtl_ofi.enable_sep = 0; if ((prov->domain_attr->max_ep_tx_ctx > 1) || (prov->domain_attr->max_ep_rx_ctx > 1)) { - ompi_mtl_ofi.sep_supported = true; + ompi_mtl_ofi.enable_sep = 1; opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n", __FILE__, __LINE__, prov->fabric_attr->prov_name); @@ -785,7 +777,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, /* * Scalable Endpoints is required for Thread Grouping feature */ - if (!ompi_mtl_ofi.sep_supported && ompi_mtl_ofi.thread_grouping) { + if (!ompi_mtl_ofi.enable_sep && ompi_mtl_ofi.thread_grouping) { opal_show_help("help-mtl-ofi.txt", "SEP unavailable", true, prov->fabric_attr->prov_name, ompi_process_info.nodename, __FILE__, __LINE__, @@ -848,7 +840,20 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * vectors, completion counters or event queues etc, and enabled. * See man fi_endpoint for more details. */ - if (true == ompi_mtl_ofi.sep_supported) { + ompi_mtl_ofi.max_ctx_cnt = (prov->domain_attr->max_ep_tx_ctx < + prov->domain_attr->max_ep_rx_ctx) ? + prov->domain_attr->max_ep_tx_ctx : + prov->domain_attr->max_ep_rx_ctx; + + num_local_ranks = 1 + ompi_process_info.num_local_peers; + if (ompi_mtl_ofi.max_ctx_cnt <= num_local_ranks) { + ompi_mtl_ofi.enable_sep = 0; + } + + if (1 == ompi_mtl_ofi.enable_sep) { + /* Provision enough contexts to service all ranks in a node */ + ompi_mtl_ofi.max_ctx_cnt /= num_local_ranks; + ret = ompi_mtl_ofi_init_sep(prov); } else { ret = ompi_mtl_ofi_init_regular_ep(prov); @@ -926,7 +931,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, if (ompi_mtl_ofi.av) { (void) fi_close((fid_t)ompi_mtl_ofi.av); } - if ((false == ompi_mtl_ofi.sep_supported) && + if ((0 == ompi_mtl_ofi.enable_sep) && ompi_mtl_ofi.ofi_ctxt != NULL && ompi_mtl_ofi.ofi_ctxt[0].cq) { /* Check if CQ[0] was created for non-SEP case and close if needed */ @@ -964,9 +969,9 @@ ompi_mtl_ofi_finalize(struct mca_mtl_base_module_t *mtl) goto finalize_err; } - if (false == ompi_mtl_ofi.sep_supported) { + if (0 == ompi_mtl_ofi.enable_sep) { /* - * CQ[0] is bound to SEP object when SEP is not supported by a + * CQ[0] is bound to SEP object Nwhen SEP is not supported by a * provider. OFI spec requires that we close the Endpoint that is bound * to the CQ before closing the CQ itself. So, for the non-SEP case, we * handle the closing of CQ[0] here. diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 6e54ae5dbfa..1ca10115580 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -71,8 +71,8 @@ typedef struct mca_mtl_ofi_module_t { /* MCA parameter for Thread grouping feature */ int thread_grouping; - /* Boolen value to indicate if provider supports Scalable EP or not */ - bool sep_supported; + /* If SEP is used by OFI MTL */ + int enable_sep; /* Numbers of bits used for rx contexts */ int rx_ctx_bits; From f770b6cfa12c56cdeaec01483856b1f14d3d70af Mon Sep 17 00:00:00 2001 From: "Spruit, Neil R" Date: Wed, 17 Oct 2018 07:13:55 -0700 Subject: [PATCH 595/674] MTL_OFI: Generation of specialized functions at build time -> Added new targets in Makefile.am to call a new build script generate-opt-funcs.pl to generate specialized functions for each *.pm file. -> Added new perl module *.pm files for send,isend,irecv,iprobe,improbe which are loaded by generate-opt-funcs.pl to create new source files that correspond to the name of the .pm file to be used as part of MTL OFI. -> Added mtl_ofi_opt.pm.template and updated README with details on the specialization features and how to add additional specialization support. -> Added new opt_common/mtl_ofi_opt_common.pm containing common functions for generating the specialized functions used by all other *.pm modules. -> Added new mtl_ofi.h which includes the definitions for the function symbol table for storing the specialized functions along with the definitions for the initialization functions for the corresponding function pointers. -> Based off the OFI provider capabilities the specialized function pointers are assigned at mtl_ofi_component_init to the corresponding MTL OFI function. -> mca_mtl_ofi_module_t has been updated with the symbol table struct which is assigned at component init. Signed-off-by: Spruit, Neil R (cherry picked from commit bef5f50a42f53f4c6c30610aba236861f652f30e) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/Makefile.am | 33 +++- ompi/mca/mtl/ofi/README | 149 ++++++++++++++++++ ompi/mca/mtl/ofi/generate-opt-funcs.pl | 62 ++++++++ ompi/mca/mtl/ofi/mtl_ofi.c | 12 +- ompi/mca/mtl/ofi/mtl_ofi.h | 119 +++++++++++--- ompi/mca/mtl/ofi/mtl_ofi_component.c | 25 +++ ompi/mca/mtl/ofi/mtl_ofi_improbe_opt.pm | 73 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_iprobe_opt.pm | 72 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_irecv_opt.pm | 72 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_isend_opt.pm | 74 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_opt.h | 77 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_send_opt.pm | 71 +++++++++ ompi/mca/mtl/ofi/mtl_ofi_types.h | 3 + .../ofi/opt_common/mtl_ofi_opt.pm.template | 66 ++++++++ .../mtl/ofi/opt_common/mtl_ofi_opt_common.pm | 54 +++++++ 15 files changed, 933 insertions(+), 29 deletions(-) create mode 100644 ompi/mca/mtl/ofi/generate-opt-funcs.pl create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_improbe_opt.pm create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_iprobe_opt.pm create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_irecv_opt.pm create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_isend_opt.pm create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_opt.h create mode 100644 ompi/mca/mtl/ofi/mtl_ofi_send_opt.pm create mode 100644 ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt.pm.template create mode 100644 ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt_common.pm diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 985f6ad4599..9308884815a 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -14,12 +14,30 @@ # $HEADER$ # -EXTRA_DIST = post_configure.sh +EXTRA_DIST = post_configure.sh \ + $(generated_source_modules) + +MAINTAINERCLEANFILES = \ + $(generated_sources) AM_CPPFLAGS = $(opal_ofi_CPPFLAGS) dist_ompidata_DATA = help-mtl-ofi.txt +generated_source_modules = \ + mtl_ofi_send_opt.pm \ + mtl_ofi_isend_opt.pm \ + mtl_ofi_irecv_opt.pm \ + mtl_ofi_iprobe_opt.pm \ + mtl_ofi_improbe_opt.pm + +generated_sources = \ + mtl_ofi_send_opt.c \ + mtl_ofi_isend_opt.c \ + mtl_ofi_irecv_opt.c \ + mtl_ofi_iprobe_opt.c \ + mtl_ofi_improbe_opt.c + mtl_ofi_sources = \ mtl_ofi.h \ mtl_ofi.c \ @@ -28,7 +46,18 @@ mtl_ofi_sources = \ mtl_ofi_endpoint.h \ mtl_ofi_endpoint.c \ mtl_ofi_request.h \ - mtl_ofi_types.h + mtl_ofi_types.h \ + mtl_ofi_opt.h \ + $(generated_sources) + +# A number of files are generated from macro expansion to minimize +# branches in the critical path. These files have perl modules with the suffix +# .pm that generate the corresponding .c file with all possible branches as +# their own function and symbol. Additional input +# files should be added to generated_source_modules, as well as adding +# their .c variants to generated_sources. +%.c : %.pm; + $(PERL) generate-opt-funcs.pl $@ # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la diff --git a/ompi/mca/mtl/ofi/README b/ompi/mca/mtl/ofi/README index 03a92a3c14f..3ab76f3fa05 100644 --- a/ompi/mca/mtl/ofi/README +++ b/ompi/mca/mtl/ofi/README @@ -143,3 +143,152 @@ Command-line syntax to set the MCA variable: variable "mtl_ofi_thread_grouping" set to 1, the MTL will use multiple contexts, but the benefits may be negligible as only one thread is driving progress. + +SPECIALIZED FUNCTIONS: +------------------- +To improve performance when calling message passing APIs in the OFI mtl +specialized functions are generated at compile time that eliminate all the +if conditionals that can be determined at init and don't need to be +queried again during the critical path. These functions are generated by +perl scripts during make which generate functions and symbols for every +combination of flags for each function. + +1. ADDING NEW FLAGS FOR SPECIALIZATION OF EXISTING FUNCTION: + To add a new flag to an existing specialized function for handling cases + where different OFI providers may or may not support a particular feature, + then you must follow these steps: + 1) Update the "_generic" function in mtl_ofi.h with the new flag and + the if conditionals to read the new value. + 2) Update the *.pm file corresponding to the function with the new flag in: + gen_funcs(), gen_*_function(), & gen_*_sym_init() + 3) Update mtl_ofi_opt.h with: + The new flag as #define NEW_FLAG_TYPES #NUMBER_OF_STATES + example: #define OFI_CQ_DATA 2 (only has TRUE/FALSE states) + Update the function's types with: + #define OMPI_MTL_OFI_FUNCTION_TYPES [NEW_FLAG_TYPES] + +2. ADDING A NEW FUNCTION FOR SPECIALIZATION: + To add a new function to be specialized you must + follow these steps: + 1) Create a new mtl_ofi_"function_name"_opt.pm based off opt_common/mtl_ofi_opt.pm.template + 2) Add new .pm file to generated_source_modules in Makefile.am + 3) Add .c file to generated_sources in Makefile.am named the same as the corresponding .pm file + 4) Update existing or create function in mtl_ofi.h to _generic with new flags. + 5) Update mtl_ofi_opt.h with: + a) New function types: #define OMPI_MTL_OFI_FUNCTION_TYPES [FLAG_TYPES] + b) Add new function to the struct ompi_mtl_ofi_symtable: + struct ompi_mtl_ofi_symtable { + ... + int (*ompi_mtl_ofi_FUNCTION OMPI_MTL_OFI_FUNCTION_TYPES ) + } + c) Add new symbol table init function definition: + void ompi_mtl_ofi_FUNCTION_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); + 6) Add calls to init the new function in the symbol table and assign the function + pointer to be used based off the flags in mtl_ofi_component.c: + ompi_mtl_ofi_FUNCTION_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_FUNCTION = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_FUNCTION[ompi_mtl_ofi.flag]; + +3. EXAMPLE SPECIALIZED FILE: +The code below is an example of what is generated by the specialization +scripts for use in the OFI mtl. This code specializes the blocking +send functionality based on FI_REMOTE_CQ_DATA & OFI Scalable Endpoint support +provided by an OFI Provider. Only one function and symbol is used during +runtime based on if FI_REMOTE_CQ_DATA is supported and/or if OFI Scalable +Endpoint support is enabled. +/* + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "mtl_ofi.h" + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send_false_false(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + const bool OFI_CQ_DATA = false; + const bool OFI_SCEP_EPS = false; + + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + OFI_CQ_DATA, OFI_SCEP_EPS); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send_false_true(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + const bool OFI_CQ_DATA = false; + const bool OFI_SCEP_EPS = true; + + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + OFI_CQ_DATA, OFI_SCEP_EPS); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send_true_false(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + const bool OFI_CQ_DATA = true; + const bool OFI_SCEP_EPS = false; + + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + OFI_CQ_DATA, OFI_SCEP_EPS); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send_true_true(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + const bool OFI_CQ_DATA = true; + const bool OFI_SCEP_EPS = true; + + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + OFI_CQ_DATA, OFI_SCEP_EPS); +} + +void ompi_mtl_ofi_send_symtable_init(struct ompi_mtl_ofi_symtable* sym_table) +{ + + sym_table->ompi_mtl_ofi_send[false][false] + = ompi_mtl_ofi_send_false_false; + + + sym_table->ompi_mtl_ofi_send[false][true] + = ompi_mtl_ofi_send_false_true; + + + sym_table->ompi_mtl_ofi_send[true][false] + = ompi_mtl_ofi_send_true_false; + + + sym_table->ompi_mtl_ofi_send[true][true] + = ompi_mtl_ofi_send_true_true; + +} +### diff --git a/ompi/mca/mtl/ofi/generate-opt-funcs.pl b/ompi/mca/mtl/ofi/generate-opt-funcs.pl new file mode 100644 index 00000000000..a30a7b794ab --- /dev/null +++ b/ompi/mca/mtl/ofi/generate-opt-funcs.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use mtl_ofi_send_opt; +use mtl_ofi_isend_opt; +use mtl_ofi_irecv_opt; +use mtl_ofi_iprobe_opt; +use mtl_ofi_improbe_opt; +use opt_common::mtl_ofi_opt_common; + +my $MTL_OFI_HEADER = +'/* + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "mtl_ofi.h"'; + +my $specialization_file = $ARGV[0]; +my $specialization_type = $specialization_file; +$specialization_type =~ s{\.[^.]+$}{}; +my $sym_table_type = $specialization_type; +$sym_table_type =~ s/_opt//g; + +open my $gen_file, ">", $specialization_file; + +# +# Generate the Specialized functions & symbol table for the specified file. +# +print $gen_file "$MTL_OFI_HEADER\n\n"; + +my $GEN_FUNC = $specialization_type . "::gen_funcs\(\$gen_file, \"FUNC\"\)"; +my $GEN_SYM = $specialization_type . "::gen_funcs\(\$gen_file, \"SYM\"\)"; +my $SYM_TABLE = "ompi_" . $sym_table_type . "_symtable"; + +eval $GEN_FUNC; + +my $SYM_FUNC_HEADER = opt_common::mtl_ofi_opt_common::gen_sym_function_header($SYM_TABLE); +print $gen_file "$SYM_FUNC_HEADER\n"; + +eval $GEN_SYM; + +my $SYM_FUNC_FOOTER = opt_common::mtl_ofi_opt_common::gen_sym_function_footer(); +print $gen_file "$SYM_FUNC_FOOTER\n\n"; +close($gen_file); +exit(0); +### diff --git a/ompi/mca/mtl/ofi/mtl_ofi.c b/ompi/mca/mtl/ofi/mtl_ofi.c index b7f0b019b66..31fcd685541 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.c +++ b/ompi/mca/mtl/ofi/mtl_ofi.c @@ -23,12 +23,12 @@ mca_mtl_ofi_module_t ompi_mtl_ofi = { ompi_mtl_ofi_del_procs, ompi_mtl_ofi_finalize, - ompi_mtl_ofi_send, - ompi_mtl_ofi_isend, - ompi_mtl_ofi_irecv, - ompi_mtl_ofi_iprobe, - ompi_mtl_ofi_imrecv, - ompi_mtl_ofi_improbe, + NULL, + NULL, + NULL, + NULL, + ompi_mtl_ofi_imrecv, + NULL, ompi_mtl_ofi_cancel, ompi_mtl_ofi_add_comm, diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index bb22b1c5859..737ba3f6ae0 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -37,6 +37,7 @@ #include "ompi/mca/mtl/base/mtl_base_datatype.h" #include "ompi/message/message.h" +#include "mtl_ofi_opt.h" #include "mtl_ofi_types.h" #include "mtl_ofi_request.h" #include "mtl_ofi_endpoint.h" @@ -384,12 +385,13 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, +ompi_mtl_ofi_send_generic(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm, int dest, int tag, struct opal_convertor_t *convertor, - mca_pml_base_send_mode_t mode) + mca_pml_base_send_mode_t mode, + bool ofi_cq_data) { ssize_t ret = OMPI_SUCCESS; ompi_mtl_ofi_request_t ofi_req; @@ -436,7 +438,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, return OMPI_ERROR; } - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); src_addr = sep_peer_fiaddr; } else { @@ -454,7 +456,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } if (ompi_mtl_ofi.max_inject_size >= length) { - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { MTL_OFI_RETRY_UNTIL_DONE(fi_tinjectdata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, @@ -470,7 +472,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } if (OPAL_UNLIKELY(0 > ret)) { MTL_OFI_LOG_FI_ERR(ret, - ompi_mtl_ofi.fi_cq_data ? "fi_tinjectdata failed" + ofi_cq_data ? "fi_tinjectdata failed" : "fi_tinject failed"); if (ack_req) { fi_cancel((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, &ack_req->ctx); @@ -482,7 +484,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } } else { ofi_req.completion_count += 1; - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, @@ -502,7 +504,7 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } if (OPAL_UNLIKELY(0 > ret)) { MTL_OFI_LOG_FI_ERR(ret, - ompi_mtl_ofi.fi_cq_data ? "fi_tsenddata failed" + ofi_cq_data ? "fi_tsenddata failed" : "fi_tsend failed"); ofi_req.status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); goto free_request_buffer; @@ -526,14 +528,15 @@ ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, +ompi_mtl_ofi_isend_generic(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm, int dest, int tag, struct opal_convertor_t *convertor, mca_pml_base_send_mode_t mode, bool blocking, - mca_mtl_request_t *mtl_request) + mca_mtl_request_t *mtl_request, + bool ofi_cq_data) { ssize_t ret = OMPI_SUCCESS; ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t *) mtl_request; @@ -574,7 +577,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, return OMPI_ERROR; } - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { match_bits = mtl_ofi_create_send_tag_CQD(comm->c_contextid, tag); } else { match_bits = mtl_ofi_create_send_tag(comm->c_contextid, @@ -590,7 +593,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, goto free_request_buffer; } - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { MTL_OFI_RETRY_UNTIL_DONE(fi_tsenddata(ompi_mtl_ofi.ofi_ctxt[ctxt_id].tx_ep, start, length, @@ -610,7 +613,7 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, } if (OPAL_UNLIKELY(0 > ret)) { MTL_OFI_LOG_FI_ERR(ret, - ompi_mtl_ofi.fi_cq_data ? "fi_tsenddata failed" + ofi_cq_data ? "fi_tsenddata failed" : "fi_tsend failed"); ofi_req->status.MPI_ERROR = ompi_mtl_ofi_get_error(ret); } @@ -761,12 +764,13 @@ ompi_mtl_ofi_recv_error_callback(struct fi_cq_err_entry *error, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, +ompi_mtl_ofi_irecv_generic(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm, int src, int tag, struct opal_convertor_t *convertor, - mca_mtl_request_t *mtl_request) + mca_mtl_request_t *mtl_request, + bool ofi_cq_data) { int ompi_ret = OMPI_SUCCESS, ctxt_id = 0; ssize_t ret; @@ -782,7 +786,7 @@ ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); set_thread_context(ctxt_id); - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup(comm, src); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); @@ -980,12 +984,13 @@ ompi_mtl_ofi_probe_error_callback(struct fi_cq_err_entry *error, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, +ompi_mtl_ofi_iprobe_generic(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm, int src, int tag, int *flag, - struct ompi_status_public_t *status) + struct ompi_status_public_t *status, + bool ofi_cq_data) { struct ompi_mtl_ofi_request_t ofi_req; ompi_proc_t *ompi_proc = NULL; @@ -1000,7 +1005,7 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); set_thread_context(ctxt_id); - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { /* If the source is known, use its peer_fiaddr. */ if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup( comm, src ); @@ -1067,13 +1072,14 @@ ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, } __opal_attribute_always_inline__ static inline int -ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, +ompi_mtl_ofi_improbe_generic(struct mca_mtl_base_module_t *mtl, struct ompi_communicator_t *comm, int src, int tag, int *matched, struct ompi_message_t **message, - struct ompi_status_public_t *status) + struct ompi_status_public_t *status, + bool ofi_cq_data) { struct ompi_mtl_ofi_request_t *ofi_req; ompi_proc_t *ompi_proc = NULL; @@ -1097,7 +1103,7 @@ ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, * If the source is known, use its peer_fiaddr. */ - if (ompi_mtl_ofi.fi_cq_data) { + if (ofi_cq_data) { if (MPI_ANY_SOURCE != src) { ompi_proc = ompi_comm_peer_lookup( comm, src ); endpoint = ompi_mtl_ofi_get_endpoint(mtl, ompi_proc); @@ -1453,6 +1459,77 @@ ompi_mtl_ofi_del_comm(struct mca_mtl_base_module_t *mtl, return ret; } +#ifdef MCA_ompi_mtl_DIRECT_CALL + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + ompi_mtl_ofi.fi_cq_data); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode, + bool blocking, + mca_mtl_request_t *mtl_request) +{ + return ompi_mtl_ofi_isend_generic(mtl, comm, dest, tag, + convertor, mode, blocking, mtl_request, + ompi_mtl_ofi.fi_cq_data); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_irecv(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + struct opal_convertor_t *convertor, + mca_mtl_request_t *mtl_request) +{ + return ompi_mtl_ofi_irecv_generic(mtl, comm, src, tag, + convertor, mtl_request, + ompi_mtl_ofi.fi_cq_data); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_iprobe(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *flag, + struct ompi_status_public_t *status) +{ + return ompi_mtl_ofi_iprobe_generic(mtl, comm, src, tag, + flag, status, + ompi_mtl_ofi.fi_cq_data); +} + +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_improbe(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *matched, + struct ompi_message_t **message, + struct ompi_status_public_t *status) +{ + return ompi_mtl_ofi_improbe_generic(mtl, comm, src, tag, + matched, message, status, + ompi_mtl_ofi.fi_cq_data); +} +#endif + END_C_DECLS #endif /* MTL_OFI_H_HAS_BEEN_INCLUDED */ diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 0df79260cd5..004730819d2 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -739,6 +739,31 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi_define_tag_mode(ofi_tag_mode, &ofi_tag_bits_for_cid); } + /** + * Initialize the MTL OFI Symbol Tables & function pointers + * for specialized functions. + */ + + ompi_mtl_ofi_send_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_send = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_send[ompi_mtl_ofi.fi_cq_data]; + + ompi_mtl_ofi_isend_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_isend = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_isend[ompi_mtl_ofi.fi_cq_data]; + + ompi_mtl_ofi_irecv_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_irecv = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_irecv[ompi_mtl_ofi.fi_cq_data]; + + ompi_mtl_ofi_iprobe_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_iprobe = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_iprobe[ompi_mtl_ofi.fi_cq_data]; + + ompi_mtl_ofi_improbe_symtable_init(&ompi_mtl_ofi.sym_table); + ompi_mtl_ofi.base.mtl_improbe = + ompi_mtl_ofi.sym_table.ompi_mtl_ofi_improbe[ompi_mtl_ofi.fi_cq_data]; + /** * Check for potential bits in the OFI tag that providers may be reserving * for internal usage (see mem_tag_format in fi_endpoint man page). diff --git a/ompi/mca/mtl/ofi/mtl_ofi_improbe_opt.pm b/ompi/mca/mtl/ofi/mtl_ofi_improbe_opt.pm new file mode 100644 index 00000000000..e5a7296b8be --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_improbe_opt.pm @@ -0,0 +1,73 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_improbe_opt; + +my @true_false = ("false", "true"); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $OFI_CQ_DATA_EN = "false"; + + foreach $OFI_CQ_DATA_EN (@true_false) { + my @flags = ($OFI_CQ_DATA_EN); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_improbe_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_improbe_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_improbe_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $OFI_CQ_DATA_EN = $op_flags[0]; + + my $IMPROBE_FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_improbe_" . $MTL_OFI_NAME_EXT . "(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *matched, + struct ompi_message_t **message, + struct ompi_status_public_t *status) +{ + const bool OFI_CQ_DATA = " . $OFI_CQ_DATA_EN . "; + + return ompi_mtl_ofi_improbe_generic(mtl, comm, src, tag, + matched, message, status, + OFI_CQ_DATA); +}"; + return $IMPROBE_FUNCTION; +} + +sub gen_improbe_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_improbe_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_improbe[".$OFI_CQ_DATA_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_iprobe_opt.pm b/ompi/mca/mtl/ofi/mtl_ofi_iprobe_opt.pm new file mode 100644 index 00000000000..e2bbab99b31 --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_iprobe_opt.pm @@ -0,0 +1,72 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_iprobe_opt; + +my @true_false = ("false", "true"); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $OFI_CQ_DATA_EN = "false"; + + foreach $OFI_CQ_DATA_EN (@true_false) { + my @flags = ($OFI_CQ_DATA_EN); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_iprobe_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_iprobe_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_iprobe_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $OFI_CQ_DATA_EN = $op_flags[0]; + + my $IPROBE_FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_iprobe_" . $MTL_OFI_NAME_EXT . "(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *flag, + struct ompi_status_public_t *status) +{ + const bool OFI_CQ_DATA = " . $OFI_CQ_DATA_EN . "; + + return ompi_mtl_ofi_iprobe_generic(mtl, comm, src, tag, + flag, status, + OFI_CQ_DATA); +}"; + return $IPROBE_FUNCTION; +} + +sub gen_iprobe_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_iprobe_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_iprobe[".$OFI_CQ_DATA_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_irecv_opt.pm b/ompi/mca/mtl/ofi/mtl_ofi_irecv_opt.pm new file mode 100644 index 00000000000..f886bfc8c34 --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_irecv_opt.pm @@ -0,0 +1,72 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_irecv_opt; + +my @true_false = ("false", "true"); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $OFI_CQ_DATA_EN = "false"; + + foreach $OFI_CQ_DATA_EN (@true_false) { + my @flags = ($OFI_CQ_DATA_EN); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_irecv_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_irecv_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_irecv_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $OFI_CQ_DATA_EN = $op_flags[0]; + + my $IRECV_FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_irecv_" . $MTL_OFI_NAME_EXT . "(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + struct opal_convertor_t *convertor, + mca_mtl_request_t *mtl_request) +{ + const bool OFI_CQ_DATA = " . $OFI_CQ_DATA_EN . "; + + return ompi_mtl_ofi_irecv_generic(mtl, comm, src, tag, + convertor, mtl_request, + OFI_CQ_DATA); +}"; + return $IRECV_FUNCTION; +} + +sub gen_irecv_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_irecv_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_irecv[".$OFI_CQ_DATA_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_isend_opt.pm b/ompi/mca/mtl/ofi/mtl_ofi_isend_opt.pm new file mode 100644 index 00000000000..101c2c24a46 --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_isend_opt.pm @@ -0,0 +1,74 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_isend_opt; + +my @true_false = ("false", "true"); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $OFI_CQ_DATA_EN = "false"; + + foreach $OFI_CQ_DATA_EN (@true_false) { + my @flags = ($OFI_CQ_DATA_EN); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_isend_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_isend_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_isend_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $OFI_CQ_DATA_EN = $op_flags[0]; + + my $ISEND_FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_isend_" . $MTL_OFI_NAME_EXT . "(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode, + bool blocking, + mca_mtl_request_t *mtl_request) +{ + const bool OFI_CQ_DATA = " . $OFI_CQ_DATA_EN . "; + + return ompi_mtl_ofi_isend_generic(mtl, comm, dest, tag, + convertor, mode, blocking, + mtl_request, OFI_CQ_DATA); +}"; + return $ISEND_FUNCTION; +} + +sub gen_isend_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_isend_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_isend[".$OFI_CQ_DATA_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_opt.h b/ompi/mca/mtl/ofi/mtl_ofi_opt.h new file mode 100644 index 00000000000..106dec8ef91 --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_opt.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2013-2018 Intel, Inc. All rights reserved + * + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MTL_OFI_OPT_H +#define MTL_OFI_OPT_H + +#include "mtl_ofi.h" + +BEGIN_C_DECLS + +#define CQ_DATA_TYPES 2 +#define OMPI_MTL_OFI_SEND_TYPES [CQ_DATA_TYPES] +#define OMPI_MTL_OFI_ISEND_TYPES [CQ_DATA_TYPES] +#define OMPI_MTL_OFI_IRECV_TYPES [CQ_DATA_TYPES] +#define OMPI_MTL_OFI_IPROBE_TYPES [CQ_DATA_TYPES] +#define OMPI_MTL_OFI_IMPROBE_TYPES [CQ_DATA_TYPES] + +struct ompi_mtl_ofi_symtable { + int (*ompi_mtl_ofi_send OMPI_MTL_OFI_SEND_TYPES ) + (struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode); + int (*ompi_mtl_ofi_isend OMPI_MTL_OFI_ISEND_TYPES ) + (struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode, + bool blocking, + mca_mtl_request_t *mtl_request); + int (*ompi_mtl_ofi_irecv OMPI_MTL_OFI_IRECV_TYPES ) + (struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + struct opal_convertor_t *convertor, + mca_mtl_request_t *mtl_request); + int (*ompi_mtl_ofi_iprobe OMPI_MTL_OFI_IPROBE_TYPES ) + (struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *flag, + struct ompi_status_public_t *status); + int (*ompi_mtl_ofi_improbe OMPI_MTL_OFI_IMPROBE_TYPES ) + (struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int src, + int tag, + int *matched, + struct ompi_message_t **message, + struct ompi_status_public_t *status); +}; + +/** + * MTL OFI specialization function symbol table init + */ +void ompi_mtl_ofi_send_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); +void ompi_mtl_ofi_isend_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); +void ompi_mtl_ofi_irecv_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); +void ompi_mtl_ofi_iprobe_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); +void ompi_mtl_ofi_improbe_symtable_init(struct ompi_mtl_ofi_symtable* sym_table); + +END_C_DECLS + +#endif /* MTL_OFI_OPT_H */ \ No newline at end of file diff --git a/ompi/mca/mtl/ofi/mtl_ofi_send_opt.pm b/ompi/mca/mtl/ofi/mtl_ofi_send_opt.pm new file mode 100644 index 00000000000..4498bcc928a --- /dev/null +++ b/ompi/mca/mtl/ofi/mtl_ofi_send_opt.pm @@ -0,0 +1,71 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_send_opt; + +my @true_false = ("false", "true"); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $OFI_CQ_DATA_EN = "false"; + + foreach $OFI_CQ_DATA_EN (@true_false) { + my @flags = ($OFI_CQ_DATA_EN); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_send_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_send_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_send_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $SEND_FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_send_" . $MTL_OFI_NAME_EXT . "(struct mca_mtl_base_module_t *mtl, + struct ompi_communicator_t *comm, + int dest, + int tag, + struct opal_convertor_t *convertor, + mca_pml_base_send_mode_t mode) +{ + const bool OFI_CQ_DATA = " . $OFI_CQ_DATA_EN . "; + + return ompi_mtl_ofi_send_generic(mtl, comm, dest, tag, + convertor, mode, + OFI_CQ_DATA); +}"; + return $SEND_FUNCTION; +} + +sub gen_send_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_send_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $OFI_CQ_DATA_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_send[".$OFI_CQ_DATA_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 1ca10115580..5d630cfbf8b 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -111,6 +111,9 @@ typedef struct mca_mtl_ofi_module_t { unsigned long long sync_send_ack; unsigned long long sync_proto_mask; + /** Optimized function Symbol Tables **/ + struct ompi_mtl_ofi_symtable sym_table; + } mca_mtl_ofi_module_t; extern mca_mtl_ofi_module_t ompi_mtl_ofi; diff --git a/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt.pm.template b/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt.pm.template new file mode 100644 index 00000000000..aae49312879 --- /dev/null +++ b/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt.pm.template @@ -0,0 +1,66 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +use opt_common::mtl_ofi_opt_common; +package mtl_ofi_#INSERT FUNCTION NAME HERE#_opt; + +my @en_dis = (0, 1); + +sub gen_funcs { + my $gen_file = $_[0]; + my $gen_type = $_[1]; + my $#INSERT FLAG NAME HERE# = 0; + + foreach $#INSERT FLAG NAME HERE# (@en_dis) { + my @flags = ($#INSERT FLAG NAME HERE#); + if (($gen_type cmp "FUNC") == 0) { + my $FUNC = gen_#INSERT FUNCTION NAME HERE#_function(\@flags); + print $gen_file "$FUNC\n\n"; + } + if (($gen_type cmp "SYM") == 0) { + my $SYM = gen_#INSERT FUNCTION NAME HERE#_sym_init(\@flags); + print $gen_file "$SYM\n"; + } + } +} + +sub gen_#INSERT FUNCTION NAME HERE#_function { + my @op_flags = @{$_[0]}; + my $MTL_OFI_NAME_EXT = opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags); + my $#INSERT FLAG NAME HERE#_EN = $op_flags[0]; + + my $FUNCTION = +"__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_#INSERT FUNCTION NAME HERE#_" . $MTL_OFI_NAME_EXT . "(#INSERT FUNCTION ARGS HERE#) +{ + const int $#INSERT FLAG NAME HERE# = " . $#INSERT FLAG NAME HERE#_EN . "; + + return ompi_mtl_ofi_#INSERT FUNCTION NAME HERE#_generic(#INSERT FUNCTION ARGS HERE#, + #INSERT FLAG NAME HERE#); +}"; + return $FUNCTION; +} + +sub gen_#INSERT FUNCTION NAME HERE#_sym_init { + my @op_flags = @{$_[0]}; + my $MTL_OFI_FUNC_NAME = "ompi_mtl_ofi_#INSERT FUNCTION NAME HERE#_" . opt_common::mtl_ofi_opt_common::gen_flags_ext(\@op_flags) . ""; + my $#INSERT FLAG NAME HERE#_EN = $op_flags[0]; + my $symbol_init = +" + sym_table->ompi_mtl_ofi_#INSERT FUNCTION NAME HERE#[".$#INSERT FLAG NAME HERE#_EN."] + = ".$MTL_OFI_FUNC_NAME."; +"; + return $symbol_init; +} + +1; diff --git a/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt_common.pm b/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt_common.pm new file mode 100644 index 00000000000..557a21aa589 --- /dev/null +++ b/ompi/mca/mtl/ofi/opt_common/mtl_ofi_opt_common.pm @@ -0,0 +1,54 @@ +#!/usr/bin/env perl +# +# Copyright (c) 2013-2018 Intel, Inc. All rights reserved +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +use strict; +use warnings; +package opt_common::mtl_ofi_opt_common; + +# +# Generate the extension for functions and symbols based off the flags. +# +sub gen_flags_ext { + my $OP_FLAGS = ""; + my @name_flags = @{$_[0]}; + my $num_flags = $#name_flags; + for my $flag (@name_flags) { + $OP_FLAGS = $OP_FLAGS . $flag; + if ($num_flags--) { + $OP_FLAGS = $OP_FLAGS . '_'; + } + } + return $OP_FLAGS; +} + +# +# Generate the header for the specialized symbol table init function. +# +sub gen_sym_function_header { + my $MTL_OFI_SYM_TYPE = $_[0]; + my $header = +"void ".$MTL_OFI_SYM_TYPE."_init(struct ompi_mtl_ofi_symtable *sym_table) +{"; + return $header; +} +### + +# +# Generate the footer for the specialized symbol table init function. +# +sub gen_sym_function_footer { + my $footer = +"}"; + return $footer; +} +### + +1; From 6a27da6d7f16a9313ffb07a132f56fa22467c375 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Wed, 26 Dec 2018 11:29:10 -0800 Subject: [PATCH 596/674] mtl/ofi: Add MCA variables to enable SEP and to request number of OFI contexts Moving to a model where we have users actively _enable_ SEP feature for use rather than opening SEP by default if provider supports it. This allows us to not regress (either functionally or for performance reasons) any apps that were working correctly on regular endpoints. Also, providing MCA to specify number of OFI contexts to create and default this value to 1 (Given btl/ofi also creates one by default, this reduces the incidence of a scenario where we allocate all available contexts by default and if btl/ofi asks for one more, then provider breaks as it doesn't support it). While at it, spruce up README on SEP content. Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 37f9aff2a02e9d51628cc7075853ec4dba93d1e7) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/README | 52 ++++++++++-- ompi/mca/mtl/ofi/help-mtl-ofi.txt | 39 +++++++-- ompi/mca/mtl/ofi/mtl_ofi.h | 79 +++++++++--------- ompi/mca/mtl/ofi/mtl_ofi_component.c | 115 +++++++++++++++++++-------- ompi/mca/mtl/ofi/mtl_ofi_types.h | 39 +++------ 5 files changed, 203 insertions(+), 121 deletions(-) diff --git a/ompi/mca/mtl/ofi/README b/ompi/mca/mtl/ofi/README index 3ab76f3fa05..efe1ca531f4 100644 --- a/ompi/mca/mtl/ofi/README +++ b/ompi/mca/mtl/ofi/README @@ -111,11 +111,22 @@ favours only creating as many contexts as needed. } } -2. MCA variable: +2. MCA variables: To utilize the feature, the following MCA variable needs to be set: + mtl_ofi_enable_sep: + This MCA variable needs to be set to enable the use of Scalable Endpoints + feature in the OFI MTL. The underlying provider is also checked to ensure the + feature is supported. If the provider chosen does not support it, user needs + to either set this variable to 0 or select different provider which supports + the feature. + + Default: 0 + + Command-line syntax: + "-mca mtl_ofi_enable_sep 1" + mtl_ofi_thread_grouping: - This MCA variable is at the OFI MTL level and needs to be set to switch - the feature on. + This MCA variable needs to be set to switch Thread Grouping feature on. Default: 0 @@ -124,21 +135,46 @@ To utilize the feature, the following MCA variable needs to be set: - Applications that have multiple threads using a single communicator as it may degrade performance. -Command-line syntax to set the MCA variable: - "-mca mtl_ofi_thread_grouping 1" + Command-line syntax: + "-mca mtl_ofi_thread_grouping 1" + + mtl_ofi_num_ctxts: + MCA variable allows user to set the number of OFI contexts the applications + expects to use. For multi-threaded applications using Thread Grouping + feature, this number should be set to the number of user threads that will + call into MPI. For single-threaded applications one OFI context is + sufficient. + + Default: 1 + + Command-line syntax: + "-mca mtl_ofi_num_ctxts N" [ N: number of OFI contexts required by + application ] 3. Notes on performance: - - OFI MTL will create as many TX/RX contexts as allowed by an underlying - provider (each provider may have different thresholds). Once the threshold + - OFI MTL will create as many TX/RX contexts as set by MCA mtl_ofi_num_ctxts. + The number of contexts that can be created is also limited by the underlying + provider as each provider may have different thresholds. Once the threshold is exceeded, contexts are used in a round-robin fashion which leads to resource sharing among threads. Therefore locks are required to guard against race conditions. For performance, it is recommended to have - Number of communicators = Number of contexts + Number of threads = Number of communicators = Number of contexts For example, when using PSM2 provider, the number of contexts is dictated by the Intel Omni-Path HFI1 driver module. + - OPAL layer allows for multiple threads to enter progress simultaneously. To + enable this feature, user needs to set MCA variable + "max_thread_in_progress". When using Thread Grouping feature, it is + recommended to set this MCA parameter to the number of threads expected to + call into MPI as it provides performance benefits. + + Command-line syntax: + "-mca opal_max_thread_in_progress N" [ N: number of threads expected to + make MPI calls ] + Default: 1 + - For applications using a single thread with multiple communicators and MCA variable "mtl_ofi_thread_grouping" set to 1, the MTL will use multiple contexts, but the benefits may be negligible as only one thread is driving diff --git a/ompi/mca/mtl/ofi/help-mtl-ofi.txt b/ompi/mca/mtl/ofi/help-mtl-ofi.txt index ba69439fdd5..be9e579a4f9 100644 --- a/ompi/mca/mtl/ofi/help-mtl-ofi.txt +++ b/ompi/mca/mtl/ofi/help-mtl-ofi.txt @@ -26,17 +26,42 @@ fi_info -v -p %s Location: %s:%d [SEP unavailable] -Scalable Endpoint feature is required for Thread Grouping feature to work -but it is not supported by %s provider. Try disabling this feature. +Scalable Endpoint feature is enabled by the user but it is not supported by +%s provider. Try disabling this feature or use a different provider that +supports it using mtl_ofi_provider_include. Local host: %s Location: %s:%d -[SEP ctxt limit] -Reached limit (%d) for number of OFI contexts that can be opened with the -provider. Creating new communicators beyond this limit is possible but -they will re-use existing contexts in round-robin fashion. -Using new communicators beyond the limit will impact performance. +[SEP required] +Scalable Endpoint feature is required for Thread Grouping feature to work. +Please try enabling Scalable Endpoints using mtl_ofi_enable_sep. + + Local host: %s + Location: %s:%d + +[SEP thread grouping ctxt limit] +Reached limit (%d) for number of OFI contexts set by mtl_ofi_num_ctxts. +Please set mtl_ofi_num_ctxts to a larger value if you need more contexts. +If an MPI application creates more communicators than mtl_ofi_num_ctxts, +OFI MTL will make the new communicators re-use existing contexts in +round-robin fashion which will impact performance. + + Local host: %s + Location: %s:%d + +[Local ranks exceed ofi contexts] +Number of local ranks exceed the number of available OFI contexts in %s +provider and we cannot provision enough contexts for each rank. Try disabling +Scalable Endpoint feature. + + Local host: %s + Location: %s:%d + +[Ctxts exceeded available] +User requested for more than available contexts from provider. Limiting +to max allowed (%d). Contexts will be re used in round-robin fashion if there +are more threads than the available contexts. Local host: %s Location: %s:%d diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 737ba3f6ae0..63cf93275a3 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -327,16 +327,7 @@ ompi_mtl_ofi_isend_callback(struct fi_cq_tagged_entry *wc, #define MTL_OFI_MAP_COMM_TO_CONTEXT(comm_id, ctxt_id) \ do { \ - if (ompi_mtl_ofi.thread_grouping && \ - (!ompi_mtl_ofi.threshold_comm_context_id || \ - ((uint32_t) ompi_mtl_ofi.threshold_comm_context_id > comm_id))) { \ - ctxt_id = ompi_mtl_ofi.comm_to_context[comm_id]; \ - } else if (ompi_mtl_ofi.thread_grouping) { \ - /* Round-robin assignment of contexts if threshold is reached */ \ - ctxt_id = comm_id % ompi_mtl_ofi.total_ctxts_used; \ - } else { \ - ctxt_id = 0; \ - } \ + ctxt_id = ompi_mtl_ofi.comm_to_context[comm_id]; \ } while (0); __opal_attribute_always_inline__ static inline int @@ -348,40 +339,40 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, uint64_t *match_bits, int tag) { - ssize_t ret = OMPI_SUCCESS; - int ctxt_id = 0; + ssize_t ret = OMPI_SUCCESS; + int ctxt_id = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); - set_thread_context(ctxt_id); + MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + set_thread_context(ctxt_id); - ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); - assert(ack_req); + ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); + assert(ack_req); - ack_req->parent = ofi_req; - ack_req->event_callback = ompi_mtl_ofi_send_ack_callback; - ack_req->error_callback = ompi_mtl_ofi_send_ack_error_callback; + ack_req->parent = ofi_req; + ack_req->event_callback = ompi_mtl_ofi_send_ack_callback; + ack_req->error_callback = ompi_mtl_ofi_send_ack_error_callback; - ofi_req->completion_count += 1; + ofi_req->completion_count += 1; - MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, - NULL, - 0, - NULL, - *src_addr, - *match_bits | ompi_mtl_ofi.sync_send_ack, - 0, /* Exact match, no ignore bits */ - (void *) &ack_req->ctx), ret); - if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: fi_trecv failed: %s(%zd)", - __FILE__, __LINE__, fi_strerror(-ret), ret); - free(ack_req); - return ompi_mtl_ofi_get_error(ret); - } + MTL_OFI_RETRY_UNTIL_DONE(fi_trecv(ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, + NULL, + 0, + NULL, + *src_addr, + *match_bits | ompi_mtl_ofi.sync_send_ack, + 0, /* Exact match, no ignore bits */ + (void *) &ack_req->ctx), ret); + if (OPAL_UNLIKELY(0 > ret)) { + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: fi_trecv failed: %s(%zd)", + __FILE__, __LINE__, fi_strerror(-ret), ret); + free(ack_req); + return ompi_mtl_ofi_get_error(ret); + } - /* The SYNC_SEND tag bit is set for the send operation only.*/ - MTL_OFI_SET_SYNC_SEND(*match_bits); - return OMPI_SUCCESS; + /* The SYNC_SEND tag bit is set for the send operation only.*/ + MTL_OFI_SET_SYNC_SEND(*match_bits); + return OMPI_SUCCESS; } __opal_attribute_always_inline__ static inline int @@ -1258,13 +1249,15 @@ static int ompi_mtl_ofi_init_contexts(struct mca_mtl_base_module_t *mtl, } /* - * We only create upto Max number of contexts allowed by provider. + * We only create upto Max number of contexts asked for by the user. * If user enables thread grouping feature and creates more number of - * communicators than we have contexts, then we set the threshold - * context_id so we know to use context 0 for operations involving these - * "extra" communicators. + * communicators than available contexts, then we set the threshold + * context_id so that new communicators created beyond the threshold + * will be assigned to contexts in a round-robin fashion. */ - if (ompi_mtl_ofi.max_ctx_cnt <= ctxt_id) { + if (ompi_mtl_ofi.num_ofi_contexts <= ompi_mtl_ofi.total_ctxts_used) { + ompi_mtl_ofi.comm_to_context[comm->c_contextid] = comm->c_contextid % + ompi_mtl_ofi.total_ctxts_used; if (!ompi_mtl_ofi.threshold_comm_context_id) { ompi_mtl_ofi.threshold_comm_context_id = comm->c_contextid; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 004730819d2..a28fe85341c 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -234,6 +234,15 @@ ompi_mtl_ofi_component_register(void) &av_type); OBJ_RELEASE(new_enum); + ompi_mtl_ofi.enable_sep = 0; + mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, + "enable_sep", + "Enable SEP feature", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mtl_ofi.enable_sep); + ompi_mtl_ofi.thread_grouping = 0; mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, "thread_grouping", @@ -243,6 +252,20 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &ompi_mtl_ofi.thread_grouping); + /* + * Default Policy: Create 1 context and let user ask for more for + * multi-threaded workloads. User needs to ask for as many contexts as the + * number of threads that are anticipated to make MPI calls. + */ + ompi_mtl_ofi.num_ofi_contexts = 1; + mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, + "num_ctxts", + "Specify number of OFI contexts to create", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_4, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_mtl_ofi.num_ofi_contexts); + return OMPI_SUCCESS; } @@ -444,9 +467,9 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { } } -#define MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts) \ +#define MTL_OFI_ALLOC_COMM_TO_CONTEXT(arr_size) \ do { \ - ompi_mtl_ofi.comm_to_context = calloc(num_ofi_ctxts, sizeof(int)); \ + ompi_mtl_ofi.comm_to_context = calloc(arr_size, sizeof(int)); \ if (OPAL_UNLIKELY(!ompi_mtl_ofi.comm_to_context)) { \ opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ "%s:%d: alloc of comm_to_context array failed: %s\n",\ @@ -457,7 +480,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { #define MTL_OFI_ALLOC_OFI_CTXTS() \ do { \ - ompi_mtl_ofi.ofi_ctxt = (mca_mtl_ofi_context_t *) malloc(ompi_mtl_ofi.max_ctx_cnt * \ + ompi_mtl_ofi.ofi_ctxt = (mca_mtl_ofi_context_t *) malloc(ompi_mtl_ofi.num_ofi_contexts * \ sizeof(mca_mtl_ofi_context_t)); \ if (OPAL_UNLIKELY(!ompi_mtl_ofi.ofi_ctxt)) { \ opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ @@ -473,7 +496,7 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) struct fi_av_attr av_attr = {0}; prov->ep_attr->tx_ctx_cnt = prov->ep_attr->rx_ctx_cnt = - ompi_mtl_ofi.max_ctx_cnt; + ompi_mtl_ofi.num_ofi_contexts; ret = fi_scalable_ep(ompi_mtl_ofi.domain, prov, &ompi_mtl_ofi.sep, NULL); if (0 != ret) { @@ -485,11 +508,11 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) } ompi_mtl_ofi.rx_ctx_bits = 0; - while (ompi_mtl_ofi.max_ctx_cnt >> ++ompi_mtl_ofi.rx_ctx_bits); + while (ompi_mtl_ofi.num_ofi_contexts >> ++ompi_mtl_ofi.rx_ctx_bits); av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; av_attr.rx_ctx_bits = ompi_mtl_ofi.rx_ctx_bits; - av_attr.count = ompi_mtl_ofi.max_ctx_cnt; + av_attr.count = ompi_mtl_ofi.num_ofi_contexts; ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); if (0 != ret) { @@ -505,12 +528,12 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) /* * If SEP supported and Thread Grouping feature enabled, use - * max_ctx_cnt + 2. Extra 2 items is to accomodate Open MPI contextid + * num_ofi_contexts + 2. Extra 2 items is to accomodate Open MPI contextid * numbering- COMM_WORLD is 0, COMM_SELF is 1. Other user created * Comm contextid values are assigned sequentially starting with 3. */ num_ofi_ctxts = ompi_mtl_ofi.thread_grouping ? - ompi_mtl_ofi.max_ctx_cnt + 2 : 1; + ompi_mtl_ofi.num_ofi_contexts + 2 : 1; MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts); ompi_mtl_ofi.total_ctxts_used = 0; @@ -524,13 +547,14 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov) { - int ret = OMPI_SUCCESS, num_ofi_ctxts; + int ret = OMPI_SUCCESS; struct fi_av_attr av_attr = {0}; struct fi_cq_attr cq_attr = {0}; cq_attr.format = FI_CQ_FORMAT_TAGGED; cq_attr.size = ompi_mtl_ofi.ofi_progress_event_count; - ompi_mtl_ofi.max_ctx_cnt = 1; + /* Override any user defined setting */ + ompi_mtl_ofi.num_ofi_contexts = 1; ret = fi_endpoint(ompi_mtl_ofi.domain, /* In: Domain object */ prov, /* In: Provider */ &ompi_mtl_ofi.sep, /* Out: Endpoint object */ @@ -563,8 +587,7 @@ static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov) return ret; } - num_ofi_ctxts = 1; - MTL_OFI_ALLOC_COMM_TO_CONTEXT(num_ofi_ctxts); + MTL_OFI_ALLOC_COMM_TO_CONTEXT(1); /* Allocate memory for OFI contexts */ MTL_OFI_ALLOC_OFI_CTXTS(); @@ -593,7 +616,8 @@ static mca_mtl_base_module_t* ompi_mtl_ofi_component_init(bool enable_progress_threads, bool enable_mpi_threads) { - int ret, fi_version, num_local_ranks; + int ret, fi_version; + int num_local_ranks, sep_support_in_provider, max_ofi_ctxts; int ofi_tag_leading_zeros, ofi_tag_bits_for_cid; struct fi_info *hints; struct fi_info *providers = NULL; @@ -790,24 +814,32 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.num_peers = 0; /* Check if Scalable Endpoints can be enabled for the provider */ - ompi_mtl_ofi.enable_sep = 0; + sep_support_in_provider = 0; if ((prov->domain_attr->max_ep_tx_ctx > 1) || (prov->domain_attr->max_ep_rx_ctx > 1)) { - ompi_mtl_ofi.enable_sep = 1; - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n", - __FILE__, __LINE__, prov->fabric_attr->prov_name); + sep_support_in_provider = 1; } - /* - * Scalable Endpoints is required for Thread Grouping feature - */ - if (!ompi_mtl_ofi.enable_sep && ompi_mtl_ofi.thread_grouping) { - opal_show_help("help-mtl-ofi.txt", "SEP unavailable", true, - prov->fabric_attr->prov_name, - ompi_process_info.nodename, __FILE__, __LINE__, - fi_strerror(-ret), -ret); - goto error; + if (1 == ompi_mtl_ofi.enable_sep) { + if (0 == sep_support_in_provider) { + opal_show_help("help-mtl-ofi.txt", "SEP unavailable", true, + prov->fabric_attr->prov_name, + ompi_process_info.nodename, __FILE__, __LINE__); + goto error; + } else if (1 == sep_support_in_provider) { + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n", + __FILE__, __LINE__, prov->fabric_attr->prov_name); + } + } else { + /* + * Scalable Endpoints is required for Thread Grouping feature + */ + if (1 == ompi_mtl_ofi.thread_grouping) { + opal_show_help("help-mtl-ofi.txt", "SEP required", true, + ompi_process_info.nodename, __FILE__, __LINE__); + goto error; + } } /** @@ -865,19 +897,34 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * vectors, completion counters or event queues etc, and enabled. * See man fi_endpoint for more details. */ - ompi_mtl_ofi.max_ctx_cnt = (prov->domain_attr->max_ep_tx_ctx < - prov->domain_attr->max_ep_rx_ctx) ? - prov->domain_attr->max_ep_tx_ctx : - prov->domain_attr->max_ep_rx_ctx; + max_ofi_ctxts = (prov->domain_attr->max_ep_tx_ctx < + prov->domain_attr->max_ep_rx_ctx) ? + prov->domain_attr->max_ep_tx_ctx : + prov->domain_attr->max_ep_rx_ctx; num_local_ranks = 1 + ompi_process_info.num_local_peers; - if (ompi_mtl_ofi.max_ctx_cnt <= num_local_ranks) { - ompi_mtl_ofi.enable_sep = 0; + if ((max_ofi_ctxts <= num_local_ranks) && + (1 == ompi_mtl_ofi.enable_sep)) { + opal_show_help("help-mtl-ofi.txt", "Local ranks exceed ofi contexts", + true, prov->fabric_attr->prov_name, + ompi_process_info.nodename, __FILE__, __LINE__); + goto error; } if (1 == ompi_mtl_ofi.enable_sep) { /* Provision enough contexts to service all ranks in a node */ - ompi_mtl_ofi.max_ctx_cnt /= num_local_ranks; + max_ofi_ctxts /= num_local_ranks; + + /* + * If num ctxts user specified is more than max allowed, limit to max + * and start round-robining. Print warning to user. + */ + if (max_ofi_ctxts < ompi_mtl_ofi.num_ofi_contexts) { + opal_show_help("help-mtl-ofi.txt", "Ctxts exceeded available", + true, max_ofi_ctxts, + ompi_process_info.nodename, __FILE__, __LINE__); + ompi_mtl_ofi.num_ofi_contexts = max_ofi_ctxts; + } ret = ompi_mtl_ofi_init_sep(prov); } else { diff --git a/ompi/mca/mtl/ofi/mtl_ofi_types.h b/ompi/mca/mtl/ofi/mtl_ofi_types.h index 5d630cfbf8b..de9341fc51b 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_types.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_types.h @@ -44,38 +44,19 @@ typedef struct mca_mtl_ofi_module_t { /** Address vector handle */ struct fid_av *av; - /* Scalable Endpoint */ - struct fid_ep *sep; - /* Multi-threaded Application flag */ bool mpi_thread_multiple; - /* OFI contexts */ - mca_mtl_ofi_context_t *ofi_ctxt; - - /* Max context count for scalable endpoints */ - int max_ctx_cnt; - - /* Total number of TX/RX contexts used by MTL */ - int total_ctxts_used; - - /* - * Store context id of communicator if creating more than number of - * contexts - */ - int threshold_comm_context_id; - - /* Mapping of communicator ID to OFI context */ - int *comm_to_context; - - /* MCA parameter for Thread grouping feature */ - int thread_grouping; - - /* If SEP is used by OFI MTL */ - int enable_sep; - - /* Numbers of bits used for rx contexts */ - int rx_ctx_bits; + /* Scalable Endpoint attributes */ + struct fid_ep *sep; /* Endpoint object */ + mca_mtl_ofi_context_t *ofi_ctxt; /* OFI contexts */ + int threshold_comm_context_id; /* Set threshold communicator ID */ + int *comm_to_context; /* Map communicator ID to context */ + int rx_ctx_bits; /* Bits used for RX context */ + int total_ctxts_used; /* Total number of contexts used */ + int enable_sep; /* MCA to enable/disable SEP feature */ + int thread_grouping; /* MCA for thread grouping feature */ + int num_ofi_contexts; /* MCA for number of contexts to use */ /** Endpoint name length */ size_t epnamelen; From 29e85442430c32043b7bf4e5dcae47dc06381350 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 18 Jan 2019 14:00:10 -0800 Subject: [PATCH 597/674] mtl/ofi: Print descriptive error message on modex failure With MTLs, there's no "other transport" when the remote side does not have an active NIC, so we should print a useful error message when the modex failed (indicating lack of a NIC on the remote side). Signed-off-by: Brian Barrett (cherry picked from commit fe25097194145234c175ee0487b1fa9b13658d49) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/help-mtl-ofi.txt | 10 ++++++++++ ompi/mca/mtl/ofi/mtl_ofi.c | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ompi/mca/mtl/ofi/help-mtl-ofi.txt b/ompi/mca/mtl/ofi/help-mtl-ofi.txt index be9e579a4f9..56778f63b53 100644 --- a/ompi/mca/mtl/ofi/help-mtl-ofi.txt +++ b/ompi/mca/mtl/ofi/help-mtl-ofi.txt @@ -65,5 +65,15 @@ are more threads than the available contexts. Local host: %s Location: %s:%d + +[modex failed] +The OFI MTL was not able to find endpoint information for a remote +endpoint. Most likely, this means that the remote process was unable +to initialize the Libfabric NIC correctly. This error is not +recoverable and your application is likely to abort. + + Local host: %s + Remote host: %s + Error: %s (%d) [message too big] Message size %llu bigger than supported by selected transport. Max = %llu diff --git a/ompi/mca/mtl/ofi/mtl_ofi.c b/ompi/mca/mtl/ofi/mtl_ofi.c index 31fcd685541..6c679b88b93 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.c +++ b/ompi/mca/mtl/ofi/mtl_ofi.c @@ -98,9 +98,10 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, (void**)&ep_name, &size); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: modex_recv failed: %d\n", - __FILE__, __LINE__, ret); + opal_show_help("help-mtl-ofi.txt", "modex failed", + true, ompi_process_info.nodename, + procs[i]->super.proc_hostname, + opal_strerror(ret), ret); goto bail; } memcpy(&ep_names[i*namelen], ep_name, namelen); From a2cf9a41e31d2c95ed5f5dc85cea06711f0f19db Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Thu, 24 Jan 2019 19:44:53 +0000 Subject: [PATCH 598/674] mtl/ofi: Provide av count hint during initialization Provide the av_attr.count hint (number of addresses that will be inserted into the address vector through the life of the process) at initialization of the address vector. It's ok to be a bit wrong, but some endpoints (RxR) can benefit by not going through the slow growth realloc churn. Signed-off-by: Brian Barrett (cherry picked from commit 44be7f139ac8e3130ffeb0afd4f43abdde31dd83) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 51 ++++++++++++++++++---------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index a28fe85341c..41d9ff7d778 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -490,7 +490,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { } \ } while(0); -static int ompi_mtl_ofi_init_sep(struct fi_info *prov) +static int ompi_mtl_ofi_init_sep(struct fi_info *prov, int universe_size) { int ret = OMPI_SUCCESS, num_ofi_ctxts; struct fi_av_attr av_attr = {0}; @@ -512,7 +512,7 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; av_attr.rx_ctx_bits = ompi_mtl_ofi.rx_ctx_bits; - av_attr.count = ompi_mtl_ofi.num_ofi_contexts; + av_attr.count = ompi_mtl_ofi.num_ofi_contexts * universe_size; ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); if (0 != ret) { @@ -545,7 +545,7 @@ static int ompi_mtl_ofi_init_sep(struct fi_info *prov) return ret; } -static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov) +static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov, int universe_size) { int ret = OMPI_SUCCESS; struct fi_av_attr av_attr = {0}; @@ -573,6 +573,7 @@ static int ompi_mtl_ofi_init_regular_ep(struct fi_info * prov) * - address vector and completion queues */ av_attr.type = (MTL_OFI_AV_TABLE == av_type) ? FI_AV_TABLE: FI_AV_MAP; + av_attr.count = universe_size; ret = fi_av_open(ompi_mtl_ofi.domain, &av_attr, &ompi_mtl_ofi.av, NULL); if (ret) { MTL_OFI_LOG_FI_ERR(ret, "fi_av_open failed"); @@ -625,6 +626,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, struct fi_info *prov_cq_data = NULL; char ep_name[FI_NAME_MAX] = {0}; size_t namelen; + int universe_size; + char *univ_size_str; /** * Hints to filter providers @@ -897,21 +900,35 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * vectors, completion counters or event queues etc, and enabled. * See man fi_endpoint for more details. */ - max_ofi_ctxts = (prov->domain_attr->max_ep_tx_ctx < - prov->domain_attr->max_ep_rx_ctx) ? - prov->domain_attr->max_ep_tx_ctx : - prov->domain_attr->max_ep_rx_ctx; - - num_local_ranks = 1 + ompi_process_info.num_local_peers; - if ((max_ofi_ctxts <= num_local_ranks) && - (1 == ompi_mtl_ofi.enable_sep)) { - opal_show_help("help-mtl-ofi.txt", "Local ranks exceed ofi contexts", - true, prov->fabric_attr->prov_name, - ompi_process_info.nodename, __FILE__, __LINE__); - goto error; + + /* use the universe size as a rough guess on the address vector + * size hint that should be passed to fi_av_open(). For regular + * endpoints, the count will be the universe size. For scalable + * endpoints, the count will be the universe size multiplied by + * the number of contexts. In either case, if the universe grows + * (via dynamic processes), the count is a hint, not a hard limit, + * so libfabric will just be slightly less efficient. + */ + univ_size_str = getenv("OMPI_UNIVERSE_SIZE"); + if (NULL == univ_size_str || + (universe_size = strtol(univ_size_str, NULL, 0)) <= 0) { + universe_size = ompi_proc_world_size(); } if (1 == ompi_mtl_ofi.enable_sep) { + max_ofi_ctxts = (prov->domain_attr->max_ep_tx_ctx < + prov->domain_attr->max_ep_rx_ctx) ? + prov->domain_attr->max_ep_tx_ctx : + prov->domain_attr->max_ep_rx_ctx; + + num_local_ranks = 1 + ompi_process_info.num_local_peers; + if (max_ofi_ctxts <= num_local_ranks) { + opal_show_help("help-mtl-ofi.txt", "Local ranks exceed ofi contexts", + true, prov->fabric_attr->prov_name, + ompi_process_info.nodename, __FILE__, __LINE__); + goto error; + } + /* Provision enough contexts to service all ranks in a node */ max_ofi_ctxts /= num_local_ranks; @@ -926,9 +943,9 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_mtl_ofi.num_ofi_contexts = max_ofi_ctxts; } - ret = ompi_mtl_ofi_init_sep(prov); + ret = ompi_mtl_ofi_init_sep(prov, universe_size); } else { - ret = ompi_mtl_ofi_init_regular_ep(prov); + ret = ompi_mtl_ofi_init_regular_ep(prov, universe_size); } if (OMPI_SUCCESS != ret) { From 48df4efb56855c234397c6a1628d5c6853438a53 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Tue, 29 Jan 2019 15:10:06 -0800 Subject: [PATCH 599/674] mtl/ofi: Fix reference to help text object When we exceed the threshold number of contexts created, print appropriate help text Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 9cabcfdbba49f8b97f830f90e3d88be2f7685de4) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 63cf93275a3..2febe3d6206 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -1261,7 +1261,7 @@ static int ompi_mtl_ofi_init_contexts(struct mca_mtl_base_module_t *mtl, if (!ompi_mtl_ofi.threshold_comm_context_id) { ompi_mtl_ofi.threshold_comm_context_id = comm->c_contextid; - opal_show_help("help-mtl-ofi.txt", "SEP ctxt limit", true, ctxt_id, + opal_show_help("help-mtl-ofi.txt", "SEP thread grouping ctxt limit", true, ctxt_id, ompi_process_info.nodename, __FILE__, __LINE__); } From 0d2a0b15682bfc9a44021677b88d3e78be2148e6 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Fri, 1 Feb 2019 14:03:23 -0800 Subject: [PATCH 600/674] btl/ofi: Fix valgrind complaints on uninitialized pointer use It doesn't seem like the BTL was using uninitialized pointer. But simply setting the rcache pointer to NULL after destroying it makes the valgrind errors go away. Fixes Issue #6345 Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 786e686d4347655b574e609c65626c8323bb49b2) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c index f9a3ae17b5c..e4c8e380e4b 100644 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -313,6 +313,7 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) if (ofi_btl->rcache) { mca_rcache_base_module_destroy (ofi_btl->rcache); + ofi_btl->rcache = NULL; } free (btl); From a7045bceef70090243da46ce6d19cdf1bba48a30 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 6 Feb 2019 10:35:20 +0900 Subject: [PATCH 601/674] mtl/ofi: fix configury when VPATH is used Signed-off-by: Gilles Gouaillardet (cherry picked from commit 945f830f7a47acec52f02ec8d215c159f53550cd) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 9308884815a..f5311f3f22a 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -57,7 +57,7 @@ mtl_ofi_sources = \ # files should be added to generated_source_modules, as well as adding # their .c variants to generated_sources. %.c : %.pm; - $(PERL) generate-opt-funcs.pl $@ + $(PERL) -I$(top_srcdir)/ompi/mca/mtl/ofi $(top_srcdir)/ompi/mca/mtl/ofi/generate-opt-funcs.pl $@ # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la From 2dd7aa0587414fa02911327515e35f3c9d64430e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 6 Feb 2019 04:52:24 -0800 Subject: [PATCH 602/674] mtl/ofi/Makefile.am: down with tabs! Replace all tabs with spaces. No code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit aba2571881951a5fc88574125bc374a30f4cdd98) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/Makefile.am | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index f5311f3f22a..81526a35e2a 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -15,40 +15,40 @@ # EXTRA_DIST = post_configure.sh \ - $(generated_source_modules) + $(generated_source_modules) MAINTAINERCLEANFILES = \ - $(generated_sources) + $(generated_sources) AM_CPPFLAGS = $(opal_ofi_CPPFLAGS) dist_ompidata_DATA = help-mtl-ofi.txt generated_source_modules = \ - mtl_ofi_send_opt.pm \ - mtl_ofi_isend_opt.pm \ - mtl_ofi_irecv_opt.pm \ - mtl_ofi_iprobe_opt.pm \ - mtl_ofi_improbe_opt.pm + mtl_ofi_send_opt.pm \ + mtl_ofi_isend_opt.pm \ + mtl_ofi_irecv_opt.pm \ + mtl_ofi_iprobe_opt.pm \ + mtl_ofi_improbe_opt.pm generated_sources = \ - mtl_ofi_send_opt.c \ - mtl_ofi_isend_opt.c \ - mtl_ofi_irecv_opt.c \ - mtl_ofi_iprobe_opt.c \ - mtl_ofi_improbe_opt.c + mtl_ofi_send_opt.c \ + mtl_ofi_isend_opt.c \ + mtl_ofi_irecv_opt.c \ + mtl_ofi_iprobe_opt.c \ + mtl_ofi_improbe_opt.c mtl_ofi_sources = \ - mtl_ofi.h \ - mtl_ofi.c \ - mtl_ofi_compat.h \ - mtl_ofi_component.c \ - mtl_ofi_endpoint.h \ - mtl_ofi_endpoint.c \ - mtl_ofi_request.h \ - mtl_ofi_types.h \ - mtl_ofi_opt.h \ - $(generated_sources) + mtl_ofi.h \ + mtl_ofi.c \ + mtl_ofi_compat.h \ + mtl_ofi_component.c \ + mtl_ofi_endpoint.h \ + mtl_ofi_endpoint.c \ + mtl_ofi_request.h \ + mtl_ofi_types.h \ + mtl_ofi_opt.h \ + $(generated_sources) # A number of files are generated from macro expansion to minimize # branches in the critical path. These files have perl modules with the suffix From 9ad1c152dd5288f6d09683e8cff33de05ebb059b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 6 Feb 2019 05:20:42 -0800 Subject: [PATCH 603/674] btl/ofi/Makefile.am: down with tabs! Replace all tabs with spaces. No code or logic changes. Signed-off-by: Jeff Squyres (cherry picked from commit b556cabfe937f84f30e8870e0a8c128b839e5dfd) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/Makefile.am | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am index b2250dc7ce2..13693a287a5 100644 --- a/opal/mca/btl/ofi/Makefile.am +++ b/opal/mca/btl/ofi/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2013 NVIDIA Corporation. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # Copyright (c) 2018 Intel, inc. All rights reserved @@ -25,16 +25,16 @@ AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) sources = \ btl_ofi.h \ - btl_ofi_component.c \ - btl_ofi_endpoint.h \ - btl_ofi_endpoint.c \ - btl_ofi_module.c \ - btl_ofi_rdma.h \ - btl_ofi_rdma.c \ - btl_ofi_atomics.c \ - btl_ofi_frag.c \ - btl_ofi_frag.h \ - btl_ofi_context.c + btl_ofi_component.c \ + btl_ofi_endpoint.h \ + btl_ofi_endpoint.c \ + btl_ofi_module.c \ + btl_ofi_rdma.h \ + btl_ofi_rdma.c \ + btl_ofi_atomics.c \ + btl_ofi_frag.c \ + btl_ofi_frag.h \ + btl_ofi_context.c # Make the output library in this directory, and name it either # mca__.la (for DSO builds) or libmca__.la From 13853aa75b522097f9ad831218619719fe03cab2 Mon Sep 17 00:00:00 2001 From: Aravind Gopalakrishnan Date: Mon, 4 Feb 2019 12:28:04 -0800 Subject: [PATCH 604/674] mtl/ofi: Fix segfault when not using Thread-Grouping feature For the non thread-grouping paths, only the first (0th) OFI context should be used for communication. Otherwise this would access a non existant array item and cause segfault. While at it, clarifiy some content regarding SEPs in README (Credit to Matias Cabral for README edits). Signed-off-by: Aravind Gopalakrishnan (cherry picked from commit 6edcc479c4ed510bb14b6d47fc36cbe39c4a60e1) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/README | 42 +++++++++++++++++++++++--------------- ompi/mca/mtl/ofi/mtl_ofi.h | 34 ++++++++++++++++++------------ 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/ompi/mca/mtl/ofi/README b/ompi/mca/mtl/ofi/README index efe1ca531f4..7a8a6838a73 100644 --- a/ompi/mca/mtl/ofi/README +++ b/ompi/mca/mtl/ofi/README @@ -72,7 +72,7 @@ by reducing the bits available for the communicator ID field in the OFI tag. SCALABLE ENDPOINTS: ------------------- -OFI MTL supports OFI Scalable Endpoints feature as a means to improve +OFI MTL supports OFI Scalable Endpoints (SEP) feature as a means to improve multi-threaded application throughput and message rate. Currently the feature is designed to utilize multiple TX/RX contexts exposed by the OFI provider in conjunction with a multi-communicator MPI application model. Therefore, new OFI @@ -81,12 +81,13 @@ instead of creating them all at once during init time and this approach also favours only creating as many contexts as needed. 1. Multi-communicator model: - With this approach, the application first duplicates the communicators it - wants to use with MPI operations (ideally creating as many communicators as - the number of threads it wants to use to call into MPI). The duplicated - communicators are then used by the corresponding threads to perform MPI - operations. A possible usage scenario could be in an MPI + OMP - application as follows (example limited to 2 ranks): + With this approach, the MPI application is requried to first duplicate + the communicators it wants to use with MPI operations (ideally creating + as many communicators as the number of threads it wants to use to call + into MPI). The duplicated communicators are then used by the + corresponding threads to perform MPI operations. A possible usage + scenario could be in an MPI + OMP application as follows + (example limited to 2 ranks): MPI_Comm dup_comm[n]; MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided); @@ -112,13 +113,17 @@ favours only creating as many contexts as needed. } 2. MCA variables: -To utilize the feature, the following MCA variable needs to be set: + To utilize the feature, the following MCA variables need to be set: mtl_ofi_enable_sep: - This MCA variable needs to be set to enable the use of Scalable Endpoints + This MCA variable needs to be set to enable the use of Scalable Endpoints (SEP) feature in the OFI MTL. The underlying provider is also checked to ensure the feature is supported. If the provider chosen does not support it, user needs - to either set this variable to 0 or select different provider which supports + to either set this variable to 0 or select a different provider which supports the feature. + For single-threaded applications one OFI context is sufficient, so OFI SEPs + may not add benefit. + Note that mtl_ofi_thread_grouping (see below) needs to be enabled to use the + different OFI SEP contexts. Otherwise, only one context (ctxt 0) will be used. Default: 0 @@ -126,7 +131,12 @@ To utilize the feature, the following MCA variable needs to be set: "-mca mtl_ofi_enable_sep 1" mtl_ofi_thread_grouping: - This MCA variable needs to be set to switch Thread Grouping feature on. + Turn Thread Grouping feature on. This is needed to use the Multi-communicator + model explained above. This means that the OFI MTL will use the communicator + ID to decide the SEP contexts to be used by the thread. In this way, each + thread will have direct access to different OFI resources. If disabled, + only context 0 will be used. + Requires mtl_ofi_enable_sep to be set to 1. Default: 0 @@ -139,11 +149,11 @@ To utilize the feature, the following MCA variable needs to be set: "-mca mtl_ofi_thread_grouping 1" mtl_ofi_num_ctxts: - MCA variable allows user to set the number of OFI contexts the applications - expects to use. For multi-threaded applications using Thread Grouping - feature, this number should be set to the number of user threads that will - call into MPI. For single-threaded applications one OFI context is - sufficient. + This MCA variable allows user to set the number of OFI SEP contexts the + application expects to use. For multi-threaded applications using Thread + Grouping feature, this number should be set to the number of user threads + that will call into MPI. This variable will only have effect if + mtl_ofi_enable_sep is set to 1. Default: 1 diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 2febe3d6206..3b77e53e694 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -325,10 +325,18 @@ ompi_mtl_ofi_isend_callback(struct fi_cq_tagged_entry *wc, return OMPI_SUCCESS; } -#define MTL_OFI_MAP_COMM_TO_CONTEXT(comm_id, ctxt_id) \ - do { \ - ctxt_id = ompi_mtl_ofi.comm_to_context[comm_id]; \ - } while (0); +/* Return OFI context ID associated with the specific communicator */ +__opal_attribute_always_inline__ static inline int +ompi_mtl_ofi_map_comm_to_ctxt(uint32_t comm_id) +{ + /* For non-thread-grouping use case, only one context is used which is + * associated to MPI_COMM_WORLD, so use that. */ + if (0 == ompi_mtl_ofi.thread_grouping) { + comm_id = 0; + } + + return ompi_mtl_ofi.comm_to_context[comm_id]; +} __opal_attribute_always_inline__ static inline int ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, @@ -342,7 +350,7 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, ssize_t ret = OMPI_SUCCESS; int ctxt_id = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); ack_req = malloc(sizeof(ompi_mtl_ofi_request_t)); @@ -397,7 +405,7 @@ ompi_mtl_ofi_send_generic(struct mca_mtl_base_module_t *mtl, fi_addr_t src_addr = 0; fi_addr_t sep_peer_fiaddr = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); /** @@ -541,7 +549,7 @@ ompi_mtl_ofi_isend_generic(struct mca_mtl_base_module_t *mtl, ompi_mtl_ofi_request_t *ack_req = NULL; /* For synchronous send */ fi_addr_t sep_peer_fiaddr = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); ofi_req->event_callback = ompi_mtl_ofi_isend_callback; @@ -633,7 +641,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, ompi_status_public_t *status = NULL; struct fi_msg_tagged tagged_msg; - MTL_OFI_MAP_COMM_TO_CONTEXT(ofi_req->comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(ofi_req->comm->c_contextid); assert(ofi_req->super.ompi_req); status = &ofi_req->super.ompi_req->req_status; @@ -774,7 +782,7 @@ ompi_mtl_ofi_irecv_generic(struct mca_mtl_base_module_t *mtl, size_t length; bool free_after; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); if (ofi_cq_data) { @@ -900,7 +908,7 @@ ompi_mtl_ofi_imrecv(struct mca_mtl_base_module_t *mtl, uint64_t msgflags = FI_CLAIM | FI_COMPLETION; struct ompi_communicator_t *comm = (*message)->comm; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); ompi_ret = ompi_mtl_datatype_recv_buf(convertor, @@ -993,7 +1001,7 @@ ompi_mtl_ofi_iprobe_generic(struct mca_mtl_base_module_t *mtl, uint64_t msgflags = FI_PEEK | FI_COMPLETION; int ctxt_id = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); if (ofi_cq_data) { @@ -1082,7 +1090,7 @@ ompi_mtl_ofi_improbe_generic(struct mca_mtl_base_module_t *mtl, uint64_t msgflags = FI_PEEK | FI_CLAIM | FI_COMPLETION; int ctxt_id = 0; - MTL_OFI_MAP_COMM_TO_CONTEXT(comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(comm->c_contextid); set_thread_context(ctxt_id); ofi_req = malloc(sizeof *ofi_req); @@ -1184,7 +1192,7 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, int ret, ctxt_id = 0; ompi_mtl_ofi_request_t *ofi_req = (ompi_mtl_ofi_request_t*) mtl_request; - MTL_OFI_MAP_COMM_TO_CONTEXT(ofi_req->comm->c_contextid, ctxt_id); + ctxt_id = ompi_mtl_ofi_map_comm_to_ctxt(ofi_req->comm->c_contextid); switch (ofi_req->type) { case OMPI_MTL_OFI_SEND: From 585a40adb75f230385c9db33e54093f103bb1787 Mon Sep 17 00:00:00 2001 From: Matias A Cabral Date: Thu, 14 Feb 2019 14:31:29 -0500 Subject: [PATCH 605/674] MTL_OFI: Changed Recv cancel to be non-blocking Updated the OFI MTL's Recv cancel to be a non-blocking call to match the MPI spec. Given fi_cancel succeeded, then it is expected that the user will wait on the request to read the result of if the cancel has completed. Signed-off-by: Spruit, Neil R --- ompi/mca/mtl/ofi/mtl_ofi.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 3b77e53e694..df59f3604f2 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -1213,14 +1213,8 @@ ompi_mtl_ofi_cancel(struct mca_mtl_base_module_t *mtl, ret = fi_cancel((fid_t)ompi_mtl_ofi.ofi_ctxt[ctxt_id].rx_ep, &ofi_req->ctx); if (0 == ret) { - /** - * Wait for the request to be cancelled. - */ - while (!ofi_req->super.ompi_req->req_status._cancelled) { - opal_progress(); - if (ofi_req->req_started) - goto ofi_cancel_not_possible; - } + if (ofi_req->req_started) + goto ofi_cancel_not_possible; } else { ofi_cancel_not_possible: /** From 3262df243c1723432720bb93e28ebd7337a59da4 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 13 Feb 2019 10:39:00 -0800 Subject: [PATCH 606/674] mtl/ofi: add a .gitignore Ignore generated files. Signed-off-by: Jeff Squyres (cherry picked from commit ac54d771ec7b1805fa96d56b9cbcab5a49e3b8f6) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/.gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 ompi/mca/mtl/ofi/.gitignore diff --git a/ompi/mca/mtl/ofi/.gitignore b/ompi/mca/mtl/ofi/.gitignore new file mode 100644 index 00000000000..d9fe4058bb3 --- /dev/null +++ b/ompi/mca/mtl/ofi/.gitignore @@ -0,0 +1,5 @@ +mtl_ofi_improbe_opt.c +mtl_ofi_iprobe_opt.c +mtl_ofi_irecv_opt.c +mtl_ofi_isend_opt.c +mtl_ofi_send_opt.c From a3752b681bd02ca41917878ac971cdcfb423f33a Mon Sep 17 00:00:00 2001 From: guserav Date: Fri, 9 Aug 2019 09:42:12 -0700 Subject: [PATCH 607/674] Revert "Remove opal/mca/common/ofi." This reverts commit dd20174532928e0c9cdbe7b206868e6e4bea9d0b. Signed-off-by: guserav (cherry picked from commit 4ad78aaa156f118c907451b4e72d13dfebcbccf2) Signed-off-by: Brian Barrett --- VERSION | 1 + configure.ac | 1 + opal/mca/common/ofi/Makefile.am | 105 +++++++++++++++++++++++++++++++ opal/mca/common/ofi/common_ofi.c | 23 +++++++ opal/mca/common/ofi/common_ofi.h | 18 ++++++ opal/mca/common/ofi/configure.m4 | 32 ++++++++++ opal/mca/common/ofi/owner.txt | 7 +++ 7 files changed, 187 insertions(+) create mode 100644 opal/mca/common/ofi/Makefile.am create mode 100644 opal/mca/common/ofi/common_ofi.c create mode 100644 opal/mca/common/ofi/common_ofi.h create mode 100644 opal/mca/common/ofi/configure.m4 create mode 100644 opal/mca/common/ofi/owner.txt diff --git a/VERSION b/VERSION index 72adf1e78dd..0e9d7239417 100644 --- a/VERSION +++ b/VERSION @@ -116,6 +116,7 @@ libmca_orte_common_alps_so_version=70:0:30 # OPAL layer libmca_opal_common_cuda_so_version=70:0:30 +libmca_opal_common_ofi_so_version=10:0:0 libmca_opal_common_sm_so_version=70:0:30 libmca_opal_common_ucx_so_version=70:0:30 libmca_opal_common_ugni_so_version=70:0:30 diff --git a/configure.ac b/configure.ac index e696df3f7c0..b19e19a97aa 100644 --- a/configure.ac +++ b/configure.ac @@ -154,6 +154,7 @@ AC_SUBST(libopen_pal_so_version) # transparently by adding some intelligence in autogen.pl # and/or opal_mca.m4, but I don't have the cycles to do this # right now. +AC_SUBST(libmca_opal_common_ofi_so_version) AC_SUBST(libmca_opal_common_cuda_so_version) AC_SUBST(libmca_opal_common_sm_so_version) AC_SUBST(libmca_opal_common_ugni_so_version) diff --git a/opal/mca/common/ofi/Makefile.am b/opal/mca/common/ofi/Makefile.am new file mode 100644 index 00000000000..658e1a703f2 --- /dev/null +++ b/opal/mca/common/ofi/Makefile.am @@ -0,0 +1,105 @@ +# +# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana +# University Research and Technology +# Corporation. All rights reserved. +# Copyright (c) 2004-2013 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2004-2009 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) 2011-2013 NVIDIA Corporation. All rights reserved. +# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2017 Los Alamos National Security, LLC. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# +# A word of explanation... +# +# This library is linked against various MCA components because the +# support for ofis is needed in various places. +# +# Note that building this common component statically and linking +# against other dynamic components is *not* supported! + +AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) + +# Header files + +headers = \ + common_ofi.h + +# Source files + +sources = \ + common_ofi.c + +# As per above, we'll either have an installable or noinst result. +# The installable one should follow the same MCA prefix naming rules +# (i.e., libmca__.la). The noinst one can be named +# whatever it wants, although libmca___noinst.la is +# recommended. + +# To simplify components that link to this library, we will *always* +# have an output libtool library named libmca__.la -- even +# for case 2) described above (i.e., so there's no conditional logic +# necessary in component Makefile.am's that link to this library). +# Hence, if we're creating a noinst version of this library (i.e., +# case 2), we sym link it to the libmca__.la name +# (libtool will do the Right Things under the covers). See the +# all-local and clean-local rules, below, for how this is effected. + +lib_LTLIBRARIES = +noinst_LTLIBRARIES = +comp_inst = lib@OPAL_LIB_PREFIX@mca_common_ofi.la +comp_noinst = lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst.la + + +if MCA_BUILD_opal_common_ofi_DSO +lib_LTLIBRARIES += $(comp_inst) +else +noinst_LTLIBRARIES += $(comp_noinst) +endif + +lib@OPAL_LIB_PREFIX@mca_common_ofi_la_SOURCES = $(headers) $(sources) +lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LDFLAGS = \ + $(opal_common_ofi_LDFLAGS) \ + -version-info $(libmca_opal_common_ofi_so_version) +lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LIBADD = $(opal_common_ofi_LIBS) + +lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_SOURCES = $(headers) $(sources) +lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LDFLAGS = $(opal_common_ofi_LDFLAGS) +lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LIBADD = $(opal_common_ofi_LIBS) + +# Conditionally install the header files + +if WANT_INSTALL_HEADERS +opaldir = $(opalincludedir)/$(subdir) +opal_HEADERS = $(headers) +endif + +# These two rules will sym link the "noinst" libtool library filename +# to the installable libtool library filename in the case where we are +# compiling this component statically (case 2), described above). + +V=0 +OMPI_V_LN_SCOMP = $(ompi__v_LN_SCOMP_$V) +ompi__v_LN_SCOMP_ = $(ompi__v_LN_SCOMP_$AM_DEFAULT_VERBOSITY) +ompi__v_LN_SCOMP_0 = @echo " LN_S " `basename $(comp_inst)`; + +all-local: + $(OMPI_V_LN_SCOMP) if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + $(LN_S) "$(comp_noinst)" "$(comp_inst)"; \ + fi + +clean-local: + if test -z "$(lib_LTLIBRARIES)"; then \ + rm -f "$(comp_inst)"; \ + fi diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c new file mode 100644 index 00000000000..c2d02be50bb --- /dev/null +++ b/opal/mca/common/ofi/common_ofi.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "opal_config.h" +#include "opal/constants.h" + +#include +#include + +#include "common_ofi.h" + +int mca_common_ofi_register_mca_variables(void) +{ + return OPAL_SUCCESS; +} diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h new file mode 100644 index 00000000000..bb5a04f35a8 --- /dev/null +++ b/opal/mca/common/ofi/common_ofi.h @@ -0,0 +1,18 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2015 Intel, Inc. All rights reserved. + * Copyright (c) 2017 Los Alamos National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef OPAL_MCA_COMMON_OFI_H +#define OPAL_MCA_COMMON_OFI_H + +OPAL_DECLSPEC int mca_common_ofi_register_mca_variables(void); + +#endif /* OPAL_MCA_COMMON_OFI_H */ diff --git a/opal/mca/common/ofi/configure.m4 b/opal/mca/common/ofi/configure.m4 new file mode 100644 index 00000000000..4e47ad278dd --- /dev/null +++ b/opal/mca/common/ofi/configure.m4 @@ -0,0 +1,32 @@ +# -*- shell-script -*- +# +# Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved. +# Copyright (c) 2013 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2017 Los Alamos National Security, LLC. All rights +# reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +AC_DEFUN([MCA_opal_common_ofi_CONFIG],[ + AC_CONFIG_FILES([opal/mca/common/ofi/Makefile]) + + # Check for ofi. Note that $opal_common_ofi_happy is + # used in other configure.m4's to know if ofi configured + # successfully. + OPAL_CHECK_OFI([opal_common_ofi], + [opal_common_ofi_happy=yes + common_ofi_WRAPPER_EXTRA_LDFLAGS=$opal_common_ofi_LDFLAGS + common_ofi_WRAPPER_EXTRA_LIBS=$opal_common_ofi_LIBS + $1], + [opal_common_ofi_happy=no + $2]) + +])dnl diff --git a/opal/mca/common/ofi/owner.txt b/opal/mca/common/ofi/owner.txt new file mode 100644 index 00000000000..5fe87e2d40c --- /dev/null +++ b/opal/mca/common/ofi/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: Intel +status:active From 19771ada0c3252dba686c4be80cf4891ea0eee15 Mon Sep 17 00:00:00 2001 From: guserav Date: Fri, 9 Aug 2019 10:25:19 -0700 Subject: [PATCH 608/674] common/ofi: Fix check for OFI in build files The changes made in f5e1a672ccd5db127e85e1e8f6bcfeb8a8b04527 have been done after the common/ofi component was removed and thus the component doesn't reflect the changes made their. Namely f5e1a672ccd5db127e85e1e8f6bcfeb8a8b04527 changed: - How to call OPAL_CHECK_OFI (It sets opal_ofi_happy to yes now) - Dropped the common part in the build flags for ofi Signed-off-by: guserav (cherry picked from commit 0e25c95eaeabca67cbe5ad6370171e1cff47e52a) Signed-off-by: Brian Barrett --- opal/mca/common/ofi/Makefile.am | 11 ++++++----- opal/mca/common/ofi/configure.m4 | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/opal/mca/common/ofi/Makefile.am b/opal/mca/common/ofi/Makefile.am index 658e1a703f2..486acdf8b9b 100644 --- a/opal/mca/common/ofi/Makefile.am +++ b/opal/mca/common/ofi/Makefile.am @@ -14,6 +14,7 @@ # Copyright (c) 2015 Intel, Inc. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. +# Copyright (c) 2019 Hewlett Packard Enterprise. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -28,7 +29,7 @@ # Note that building this common component statically and linking # against other dynamic components is *not* supported! -AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) +AM_CPPFLAGS = $(opal_ofi_CPPFLAGS) # Header files @@ -69,13 +70,13 @@ endif lib@OPAL_LIB_PREFIX@mca_common_ofi_la_SOURCES = $(headers) $(sources) lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LDFLAGS = \ - $(opal_common_ofi_LDFLAGS) \ + $(opal_ofi_LDFLAGS) \ -version-info $(libmca_opal_common_ofi_so_version) -lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LIBADD = $(opal_common_ofi_LIBS) +lib@OPAL_LIB_PREFIX@mca_common_ofi_la_LIBADD = $(opal_ofi_LIBS) lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_SOURCES = $(headers) $(sources) -lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LDFLAGS = $(opal_common_ofi_LDFLAGS) -lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LIBADD = $(opal_common_ofi_LIBS) +lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LDFLAGS = $(opal_ofi_LDFLAGS) +lib@OPAL_LIB_PREFIX@mca_common_ofi_noinst_la_LIBADD = $(opal_ofi_LIBS) # Conditionally install the header files diff --git a/opal/mca/common/ofi/configure.m4 b/opal/mca/common/ofi/configure.m4 index 4e47ad278dd..2877964244e 100644 --- a/opal/mca/common/ofi/configure.m4 +++ b/opal/mca/common/ofi/configure.m4 @@ -8,6 +8,7 @@ # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. +# Copyright (c) 2019 Hewlett Packard Enterprise. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -18,15 +19,17 @@ AC_DEFUN([MCA_opal_common_ofi_CONFIG],[ AC_CONFIG_FILES([opal/mca/common/ofi/Makefile]) - # Check for ofi. Note that $opal_common_ofi_happy is + OPAL_CHECK_OFI + + # Note that $opal_common_ofi_happy is # used in other configure.m4's to know if ofi configured # successfully. - OPAL_CHECK_OFI([opal_common_ofi], - [opal_common_ofi_happy=yes - common_ofi_WRAPPER_EXTRA_LDFLAGS=$opal_common_ofi_LDFLAGS - common_ofi_WRAPPER_EXTRA_LIBS=$opal_common_ofi_LIBS - $1], - [opal_common_ofi_happy=no - $2]) + AS_IF([test "$opal_ofi_happy" = "yes"], + [opal_common_ofi_happy=yes + common_ofi_WRAPPER_EXTRA_LDFLAGS=$opal_ofi_LDFLAGS + common_ofi_WRAPPER_EXTRA_LIBS=$opal_ofi_LIBS + $1], + [opal_common_ofi_happy=no + $2]) ])dnl From d22d413baafc7f18c17b653f29e4ff966ecdbf96 Mon Sep 17 00:00:00 2001 From: guserav Date: Mon, 12 Aug 2019 16:17:59 -0700 Subject: [PATCH 609/674] common/ofi: Fix open-mpi/ompi#2519 As discussed in open-mpi/ompi#2519 the common component does not depend on libfabric yet. This commit introduces this dependency by just calling fi_version(). Signed-off-by: guserav (cherry picked from commit 8a67a95c993dbfc2e3fa652777cab6ee20a4a735) Signed-off-by: Brian Barrett --- opal/mca/common/ofi/common_ofi.c | 6 +++++- opal/mca/common/ofi/common_ofi.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index c2d02be50bb..83a6acd441e 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -19,5 +19,9 @@ int mca_common_ofi_register_mca_variables(void) { - return OPAL_SUCCESS; + if (fi_version() >= FI_VERSION(1,0)) { + return OPAL_SUCCESS; + } else { + return OPAL_ERROR; + } } diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h index bb5a04f35a8..3494cb7d3ac 100644 --- a/opal/mca/common/ofi/common_ofi.h +++ b/opal/mca/common/ofi/common_ofi.h @@ -12,6 +12,7 @@ #ifndef OPAL_MCA_COMMON_OFI_H #define OPAL_MCA_COMMON_OFI_H +#include OPAL_DECLSPEC int mca_common_ofi_register_mca_variables(void); From fc74a25b7cb858d95a2c04528d9dc0dc07366273 Mon Sep 17 00:00:00 2001 From: guserav Date: Tue, 20 Aug 2019 10:13:02 -0700 Subject: [PATCH 610/674] common/ofi: Set HPE as owner of component Signed-off-by: guserav (cherry picked from commit 56c3d9a2380b073508a6760599dbe6178cb8fdf9) Signed-off-by: Brian Barrett --- opal/mca/common/ofi/owner.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/common/ofi/owner.txt b/opal/mca/common/ofi/owner.txt index 5fe87e2d40c..1ebf53062e2 100644 --- a/opal/mca/common/ofi/owner.txt +++ b/opal/mca/common/ofi/owner.txt @@ -3,5 +3,5 @@ # owner: institution that is responsible for this package # status: e.g. active, maintenance, unmaintained # -owner: Intel +owner: Hewlett Packard Enterprise status:active From ac66f46dc7260aa03711c889024a76db661a4a22 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 18 Nov 2019 07:29:39 -0800 Subject: [PATCH 611/674] mtl/ofi: check for FI_LOCAL_COMM+FI_REMOTE_COMM Make sure to get an RDM provider that can provide both local and remote communication. We need this check because some providers could be selected via RXD or RXM, but can't provide local communication, for example. Add OPAL_CHECK_OFI_VERSION_GE() m4 macro to check that the Libfabric we're building against is >= a target version. Use this check in two places: 1. MTL/OFI: Make sure it is >= v1.5, because the FI_LOCAL_COMM / FI_REMOTE_COMM constants were introduced in Libfabric API v1.5. 2. BTL/usnic: It already had similar configury to check for Libfabric >= v1.1, but the usnic component was checking for >= v1.3. So update the btl/usnic configury to use the new macro and check for >= v1.3. Signed-off-by: Jeff Squyres (cherry picked from commit 21bc9042e1ff9c3075ababda9eaf49ccc90f64db) Signed-off-by: Brian Barrett --- config/opal_check_ofi.m4 | 41 +++++++++++++++++++++++++++- ompi/mca/mtl/ofi/configure.m4 | 8 +++++- ompi/mca/mtl/ofi/mtl_ofi_component.c | 13 +++++++-- opal/mca/btl/usnic/configure.m4 | 24 ++++------------ 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/config/opal_check_ofi.m4 b/config/opal_check_ofi.m4 index 339039c0e16..17dab76c0b4 100644 --- a/config/opal_check_ofi.m4 +++ b/config/opal_check_ofi.m4 @@ -1,6 +1,6 @@ dnl -*- shell-script -*- dnl -dnl Copyright (c) 2015-2019 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved. dnl Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights dnl reserved. dnl $COPYRIGHT$ @@ -10,6 +10,45 @@ dnl dnl $HEADER$ dnl +dnl +dnl OPAL_CHECK_OFI_VERSION_GE +dnl +dnl Check that the OFI API version number is >= a specific value. +dnl +dnl $1: version number to compare, in the form of "major,minor" +dnl (without quotes) -- i.e., a single token representing the +dnl arguments to FI_VERSION() +dnl $2: action if OFI API version is >= $1 +dnl $3: action if OFI API version is < $1 +AC_DEFUN([OPAL_CHECK_OFI_VERSION_GE],[ + OPAL_VAR_SCOPE_PUSH([opal_ofi_ver_ge_save_CPPFLAGS opal_ofi_ver_ge_happy]) + + AC_MSG_CHECKING([if OFI API version number is >= $1]) + opal_ofi_ver_ge_save_CPPFLAGS=$CPPFLAGS + CPPFLAGS=$opal_ofi_CPPFLAGS + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], +[[ +#if !defined(FI_MAJOR_VERSION) +#error "we cannot check the version -- sad panda" +#elif FI_VERSION_LT(FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION), FI_VERSION($1)) +#error "version is too low -- nopes" +#endif +]])], + [opal_ofi_ver_ge_happy=1], + [opal_ofi_ver_ge_happy=0]) + + AS_IF([test $opal_ofi_ver_ge_happy -eq 1], + [AC_MSG_RESULT([yes]) + $2], + [AC_MSG_RESULT([no]) + $3]) + + CPPFLAGS=$opal_ofi_ver_ge_save_CPPFLAGS + + OPAL_VAR_SCOPE_POP +])dnl + dnl dnl _OPAL_CHECK_OFI dnl -------------------------------------------------------- diff --git a/ompi/mca/mtl/ofi/configure.m4 b/ompi/mca/mtl/ofi/configure.m4 index 7bf981dba9b..2ab0a084e0c 100644 --- a/ompi/mca/mtl/ofi/configure.m4 +++ b/ompi/mca/mtl/ofi/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2013-2014 Intel, Inc. All rights reserved # -# Copyright (c) 2014-2019 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2014-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. # $COPYRIGHT$ @@ -28,6 +28,12 @@ AC_DEFUN([MCA_ompi_mtl_ofi_CONFIG],[ # Check for OFI OPAL_CHECK_OFI + # The OFI MTL requires at least OFI libfabric v1.5. + AS_IF([test "$opal_ofi_happy" = "yes"], + [OPAL_CHECK_OFI_VERSION_GE([1,5], + [], + [opal_ofi_happy=no])]) + AS_IF([test "$opal_ofi_happy" = "yes"], [$1], [$2]) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 41d9ff7d778..e84fe73c33c 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -646,9 +646,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, __FILE__, __LINE__); goto error; } + /* Make sure to get a RDM provider that can do the tagged matching + interface and local communication and remote communication. */ hints->mode = FI_CONTEXT; - hints->ep_attr->type = FI_EP_RDM; /* Reliable datagram */ - hints->caps = FI_TAGGED; /* Tag matching interface */ + hints->ep_attr->type = FI_EP_RDM; + hints->caps = FI_TAGGED | FI_LOCAL_COMM | FI_REMOTE_COMM; hints->tx_attr->msg_order = FI_ORDER_SAS; hints->rx_attr->msg_order = FI_ORDER_SAS; hints->rx_attr->op_flags = FI_COMPLETION; @@ -696,8 +698,13 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * FI_VERSION provides binary backward and forward compatibility support * Specify the version of OFI is coded to, the provider will select struct * layouts that are compatible with this version. + * + * Note: API version 1.5 is the first version that supports + * FI_LOCAL_COMM / FI_REMOTE_COMM checking (and we definitely need + * that checking -- e.g., some providers are suitable for RXD or + * RXM, but can't provide local communication). */ - fi_version = FI_VERSION(1, 0); + fi_version = FI_VERSION(1, 5); /** * fi_getinfo: returns information about fabric services for reaching a diff --git a/opal/mca/btl/usnic/configure.m4 b/opal/mca/btl/usnic/configure.m4 index 0e75e625a14..0345baced6b 100644 --- a/opal/mca/btl/usnic/configure.m4 +++ b/opal/mca/btl/usnic/configure.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2006 Sandia National Laboratories. All rights # reserved. -# Copyright (c) 2010-2019 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2017 Los Alamos National Security, LLC. All rights # reserved. # $COPYRIGHT$ @@ -100,25 +100,11 @@ AC_DEFUN([_OPAL_BTL_USNIC_DO_CONFIG],[ OPAL_CHECK_OFI opal_btl_usnic_happy=$opal_ofi_happy]) - # The usnic BTL requires at least OFI libfabric v1.1 (there was a - # critical bug in libfabric v1.0). + # The usnic BTL requires at least OFI libfabric v1.3. AS_IF([test "$opal_btl_usnic_happy" = "yes"], - [AC_MSG_CHECKING([whether OFI libfabric is >= v1.1]) - opal_btl_usnic_CPPFLAGS_save=$CPPFLAGS - CPPFLAGS="$opal_ofi_CPPFLAGS $CPPFLAGS" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[ -#if !defined(FI_MAJOR_VERSION) -#error your version of OFI libfabric is too old -#elif FI_VERSION(FI_MAJOR_VERSION, FI_MINOR_VERSION) < FI_VERSION(1, 1) -#error your version of OFI libfabric is too old -#endif -]])], - [opal_btl_usnic_happy=yes], - [opal_btl_usnic_happy=no]) - AC_MSG_RESULT([$opal_btl_usnic_happy]) - CPPFLAGS=$opal_btl_usnic_CPPFLAGS_save - ]) + [OPAL_CHECK_OFI_VERSION_GE([1,3], + [], + [opal_btl_usnic_happy=no])]) # Make sure we can find the OFI libfabric usnic extensions header AS_IF([test "$opal_btl_usnic_happy" = "yes" ], From 2a36c02a0cad71220104446f3924d8fbc0be7118 Mon Sep 17 00:00:00 2001 From: Robert Wespetal Date: Fri, 13 Dec 2019 21:12:34 +0000 Subject: [PATCH 612/674] mtl/ofi: Add workaround for EFA local/remote capabilities bug Some versions of Libfabric contain a bug in EFA where FI_REMOTE_COMM and FI_LOCAL_COMM are not advertised. In order to workaround this, we need to call fi_getinfo() without those capability bits to see if EFA is available first. Also move around some of the provider include/exclude list logic so we can skip this workaround if applicable. Signed-off-by: Robert Wespetal (cherry picked from commit 49128a7adbf197027043994f75cd01acb71f2a98) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 106 ++++++++++++++++++++++----- 1 file changed, 87 insertions(+), 19 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index e84fe73c33c..906f83f1e78 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -340,21 +340,12 @@ is_in_list(char **list, char *item) } static struct fi_info* -select_ofi_provider(struct fi_info *providers) +select_ofi_provider(struct fi_info *providers, + char **include_list, char **exclude_list) { - char **include_list = NULL; - char **exclude_list = NULL; struct fi_info *prov = providers; - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: mtl:ofi:provider_include = \"%s\"\n", - __FILE__, __LINE__, prov_include); - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, - "%s:%d: mtl:ofi:provider_exclude = \"%s\"\n", - __FILE__, __LINE__, prov_exclude); - - if (NULL != prov_include) { - include_list = opal_argv_split(prov_include, ','); + if (NULL != include_list) { while ((NULL != prov) && (!is_in_list(include_list, prov->fabric_attr->prov_name))) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, @@ -363,8 +354,7 @@ select_ofi_provider(struct fi_info *providers) prov->fabric_attr->prov_name); prov = prov->next; } - } else if (NULL != prov_exclude) { - exclude_list = opal_argv_split(prov_exclude, ','); + } else if (NULL != exclude_list) { while ((NULL != prov) && (is_in_list(exclude_list, prov->fabric_attr->prov_name))) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, @@ -375,9 +365,6 @@ select_ofi_provider(struct fi_info *providers) } } - opal_argv_free(include_list); - opal_argv_free(exclude_list); - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: mtl:ofi:prov: %s\n", __FILE__, __LINE__, @@ -620,7 +607,9 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, int ret, fi_version; int num_local_ranks, sep_support_in_provider, max_ofi_ctxts; int ofi_tag_leading_zeros, ofi_tag_bits_for_cid; - struct fi_info *hints; + char **include_list = NULL; + char **exclude_list = NULL; + struct fi_info *hints, *hints_dup = NULL; struct fi_info *providers = NULL; struct fi_info *prov = NULL; struct fi_info *prov_cq_data = NULL; @@ -629,6 +618,19 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, int universe_size; char *univ_size_str; + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: mtl:ofi:provider_include = \"%s\"\n", + __FILE__, __LINE__, prov_include); + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: mtl:ofi:provider_exclude = \"%s\"\n", + __FILE__, __LINE__, prov_exclude); + + if (NULL != prov_include) { + include_list = opal_argv_split(prov_include, ','); + } else if (NULL != prov_exclude) { + exclude_list = opal_argv_split(prov_exclude, ','); + } + /** * Hints to filter providers * See man fi_getinfo for a list of all filters @@ -706,6 +708,52 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, */ fi_version = FI_VERSION(1, 5); + /** + * The EFA provider in Libfabric versions prior to 1.10 contains a bug + * where the FI_LOCAL_COMM and FI_REMOTE_COMM capabilities are not + * advertised. However, we know that this provider supports both local and + * remote communication. We must exclude these capability bits in order to + * select EFA when we are using a version of Libfabric with this bug. + * + * Call fi_getinfo() without those capabilities and specifically ask for + * the EFA provider. This is safe to do as EFA is only supported on Amazon + * EC2 and EC2 only supports EFA and TCP-based networks. We'll also skip + * this logic if the user specifies an include list without EFA or adds EFA + * to the exclude list. + */ + if ((include_list && is_in_list(include_list, "efa")) || + (exclude_list && !is_in_list(exclude_list, "efa"))) { + hints_dup = fi_dupinfo(hints); + hints_dup->caps &= ~(FI_LOCAL_COMM | FI_REMOTE_COMM); + hints_dup->fabric_attr->prov_name = strdup("efa"); + + ret = fi_getinfo(fi_version, NULL, NULL, 0ULL, hints_dup, &providers); + + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: EFA specific fi_getinfo(): %s\n", + __FILE__, __LINE__, fi_strerror(-ret)); + + if (FI_ENODATA == -ret) { + /** + * EFA is not available so fall through to call fi_getinfo() again + * with the local/remote capabilities set. + */ + fi_freeinfo(hints_dup); + hints_dup = NULL; + } else if (0 != ret) { + opal_show_help("help-mtl-ofi.txt", "OFI call fail", true, + "fi_getinfo", + ompi_process_info.nodename, __FILE__, __LINE__, + fi_strerror(-ret), -ret); + goto error; + } else { + fi_freeinfo(hints); + hints = hints_dup; + hints_dup = NULL; + goto select_prov; + } + } + /** * fi_getinfo: returns information about fabric services for reaching a * remote node or service. this does not necessarily allocate resources. @@ -717,6 +765,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, 0ULL, /* Optional flag */ hints, /* In: Hints to filter providers */ &providers); /* Out: List of matching providers */ + + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: fi_getinfo(): %s\n", + __FILE__, __LINE__, fi_strerror(-ret)); + if (FI_ENODATA == -ret) { // It is not an error if no information is returned. goto error; @@ -728,10 +781,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } +select_prov: /** * Select a provider from the list returned by fi_getinfo(). */ - prov = select_ofi_provider(providers); + prov = select_ofi_provider(providers, include_list, exclude_list); if (!prov) { opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: select_ofi_provider: no provider found\n", @@ -739,6 +793,11 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, goto error; } + opal_argv_free(include_list); + include_list = NULL; + opal_argv_free(exclude_list); + exclude_list = NULL; + /** * Select the format of the OFI tag */ @@ -1012,6 +1071,12 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, return &ompi_mtl_ofi.base; error: + if (include_list) { + opal_argv_free(include_list); + } + if (exclude_list) { + opal_argv_free(exclude_list); + } if (providers) { (void) fi_freeinfo(providers); } @@ -1021,6 +1086,9 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, if (hints) { (void) fi_freeinfo(hints); } + if (hints_dup) { + (void) fi_freeinfo(hints_dup); + } if (ompi_mtl_ofi.sep) { (void) fi_close((fid_t)ompi_mtl_ofi.sep); } From bb57080c8460f90436b5b9d121e3181581c8f16c Mon Sep 17 00:00:00 2001 From: harumi kuno Date: Wed, 4 Mar 2020 17:51:08 -0700 Subject: [PATCH 613/674] Fix mca_btl_ofi_finalize clean-up logic This fix is from John L. Byrne (john.l.byrne@hpe.com). When OFI Libfabric binds objects to endpoints, before the object can be successfully closed, the endpoint must first be freed. For scalable endpoints, objects can also be bound to transmit and receive contexts, and for objects that are bound to contexts, we need to first free the contexts before freeing the endpoint. We also need to clear the memory registration cache. If we don't clean up properly, then fi\_close may not be able to close the domain because the dom will have a non-zero ref count. Signed-off-by: harumi kuno (cherry picked from commit 3095fabf94de249716fc146a4c4a609bd33a1aff) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_component.c | 12 ++++++++---- opal/mca/btl/ofi/btl_ofi_module.c | 25 ++++++++++++++++--------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index d1e03fc2d79..856c47ee51b 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -578,6 +578,10 @@ static int mca_btl_ofi_init_device(struct fi_info *info) fail: /* clean up */ + if (NULL != ep && !module->is_scalable_ep) { + fi_close(&ep->fid); + } + /* if the contexts have not been initiated, num_contexts should * be zero and we skip this. */ for (int i=0; i < module->num_contexts; i++) { @@ -585,14 +589,14 @@ static int mca_btl_ofi_init_device(struct fi_info *info) } free(module->contexts); - if (NULL != av) { - fi_close(&av->fid); - } - if (NULL != ep) { fi_close(&ep->fid); } + if (NULL != av) { + fi_close(&av->fid); + } + if (NULL != domain) { fi_close(&domain->fid); } diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c index e4c8e380e4b..7f29ee2de15 100644 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -275,20 +275,32 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) assert(btl); + /* clear the rcache */ + if (ofi_btl->rcache) { + mca_rcache_base_module_destroy (ofi_btl->rcache); + ofi_btl->rcache = NULL; + } + + /* For a standard ep, we need to close the ep first. */ + if (NULL != ofi_btl->ofi_endpoint && !ofi_btl->is_scalable_ep) { + fi_close(&ofi_btl->ofi_endpoint->fid); + ofi_btl->ofi_endpoint = NULL; + } + /* loop over all the contexts */ for (i=0; i < ofi_btl->num_contexts; i++) { mca_btl_ofi_context_finalize(&ofi_btl->contexts[i], ofi_btl->is_scalable_ep); } free(ofi_btl->contexts); - if (NULL != ofi_btl->av) { - fi_close(&ofi_btl->av->fid); - } - if (NULL != ofi_btl->ofi_endpoint) { fi_close(&ofi_btl->ofi_endpoint->fid); } + if (NULL != ofi_btl->av) { + fi_close(&ofi_btl->av->fid); + } + if (NULL != ofi_btl->domain) { fi_close(&ofi_btl->domain->fid); } @@ -311,11 +323,6 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) OBJ_DESTRUCT(&ofi_btl->id_to_endpoint); OBJ_DESTRUCT(&ofi_btl->module_lock); - if (ofi_btl->rcache) { - mca_rcache_base_module_destroy (ofi_btl->rcache); - ofi_btl->rcache = NULL; - } - free (btl); return OPAL_SUCCESS; From faaaf5ca1cb394e53694de972437ee291411bc77 Mon Sep 17 00:00:00 2001 From: Harumi Kuno Date: Sat, 7 Mar 2020 14:08:39 -0700 Subject: [PATCH 614/674] Add comments about order of close ops Per suggestion of @awlauria, added some comments about the need to free ep before resources it points to. Signed-off-by: Harumi Kuno (cherry picked from commit 1bc3dab118bb694d932ef365a7a922e514f82a20) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_component.c | 3 +++ opal/mca/btl/ofi/btl_ofi_module.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 856c47ee51b..2b13f166f92 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -578,6 +578,7 @@ static int mca_btl_ofi_init_device(struct fi_info *info) fail: /* clean up */ + /* close basic ep before closing av */ if (NULL != ep && !module->is_scalable_ep) { fi_close(&ep->fid); } @@ -589,10 +590,12 @@ static int mca_btl_ofi_init_device(struct fi_info *info) } free(module->contexts); + /* check for NULL ep to avoid double-close */ if (NULL != ep) { fi_close(&ep->fid); } + /* close av after closing basic ep */ if (NULL != av) { fi_close(&av->fid); } diff --git a/opal/mca/btl/ofi/btl_ofi_module.c b/opal/mca/btl/ofi/btl_ofi_module.c index 7f29ee2de15..a708fb15a4e 100644 --- a/opal/mca/btl/ofi/btl_ofi_module.c +++ b/opal/mca/btl/ofi/btl_ofi_module.c @@ -281,7 +281,7 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) ofi_btl->rcache = NULL; } - /* For a standard ep, we need to close the ep first. */ + /* Close basic ep before closing its attached resources. */ if (NULL != ofi_btl->ofi_endpoint && !ofi_btl->is_scalable_ep) { fi_close(&ofi_btl->ofi_endpoint->fid); ofi_btl->ofi_endpoint = NULL; @@ -297,6 +297,7 @@ int mca_btl_ofi_finalize (mca_btl_base_module_t* btl) fi_close(&ofi_btl->ofi_endpoint->fid); } + /* close ep before closing av */ if (NULL != ofi_btl->av) { fi_close(&ofi_btl->av->fid); } From 2e137ae31cf63aec44abf594486927037d4aef94 Mon Sep 17 00:00:00 2001 From: Harumi Kuno Date: Tue, 10 Mar 2020 17:39:59 -0600 Subject: [PATCH 615/674] set ep to NULL to avoid double close Per suggestion of @awlauria Signed-off-by: Harumi Kuno (cherry picked from commit ab4875ddc2b76ceced120fbfe09d8dcbde6e6ff3) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_component.c | 1 + 1 file changed, 1 insertion(+) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 2b13f166f92..6526cd4dad8 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -581,6 +581,7 @@ static int mca_btl_ofi_init_device(struct fi_info *info) /* close basic ep before closing av */ if (NULL != ep && !module->is_scalable_ep) { fi_close(&ep->fid); + ep = NULL; } /* if the contexts have not been initiated, num_contexts should From 62bfd5287023d91290728da8901f5fe9762240bd Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Thu, 26 Mar 2020 22:36:53 +0000 Subject: [PATCH 616/674] ofi: Call add_procs through PML Change ompi_mtl_ofi_get_endpoint() to call the active PML's add_procs() rather than the OFI MTL add_procs() directly when discovering a new process during operation. Functionally, this has no impact in correct operation. However, the current behavior means that the heterogenous and active PML checks are not being executed in the dynamic discovery case. Signed-off-by: Brian Barrett (cherry picked from commit 64d70b3076186b044f39f11d0d7d3e5bbcaec469) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/mtl_ofi.h | 6 ++++++ ompi/mca/mtl/ofi/mtl_ofi_endpoint.h | 14 ++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index df59f3604f2..183d80108f5 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -4,6 +4,8 @@ * reserved. * Copyright (c) 2019 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2018-2020 Amazon.com, Inc. or its affiliates. All rights + * reserved. * * $COPYRIGHT$ * @@ -48,6 +50,10 @@ BEGIN_C_DECLS extern mca_mtl_ofi_module_t ompi_mtl_ofi; extern mca_base_framework_t ompi_mtl_base_framework; +extern int ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, + size_t nprocs, + struct ompi_proc_t** procs); + extern int ompi_mtl_ofi_del_procs(struct mca_mtl_base_module_t *mtl, size_t nprocs, struct ompi_proc_t **procs); diff --git a/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h b/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h index 11003e675b9..992c336c3aa 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h +++ b/ompi/mca/mtl/ofi/mtl_ofi_endpoint.h @@ -1,5 +1,7 @@ /* * Copyright (c) 2013-2016 Intel, Inc. All rights reserved + * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights + * reserved. * * $COPYRIGHT$ * @@ -11,11 +13,9 @@ #ifndef OMPI_MTL_OFI_ENDPOINT_H #define OMPI_MTL_OFI_ENDPOINT_H -BEGIN_C_DECLS +#include "ompi/mca/pml/pml.h" -extern int ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, - size_t nprocs, - struct ompi_proc_t **procs); +BEGIN_C_DECLS OBJ_CLASS_DECLARATION(mca_mtl_ofi_endpoint_t); @@ -38,10 +38,12 @@ struct mca_mtl_ofi_endpoint_t { typedef struct mca_mtl_ofi_endpoint_t mca_mtl_ofi_endpoint_t; -static inline mca_mtl_ofi_endpoint_t *ompi_mtl_ofi_get_endpoint (struct mca_mtl_base_module_t* mtl, ompi_proc_t *ompi_proc) +static inline mca_mtl_ofi_endpoint_t * +ompi_mtl_ofi_get_endpoint(struct mca_mtl_base_module_t* mtl, + ompi_proc_t *ompi_proc) { if (OPAL_UNLIKELY(NULL == ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL])) { - if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_mtl_ofi_add_procs(mtl, 1, &ompi_proc))) { + if (OPAL_UNLIKELY(OMPI_SUCCESS != MCA_PML_CALL(add_procs(&ompi_proc, 1)))) { /* Fatal error. exit() out */ opal_output(0, "%s:%d: *** The Open MPI OFI MTL is aborting the MPI job (via exit(3)).\n", __FILE__, __LINE__); From d9bfb1c4da42360c600c0d37cb22daf5e630e591 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Thu, 16 Apr 2020 20:10:20 +0000 Subject: [PATCH 617/674] common/ofi: Added multi-NIC support to provider selection Adds the capability to select a NIC based on hardware locality. Creates a list of NICs that share the same cpuset as the process, then selects the NIC based on the (local rank) % (number of NICs). If no NICs are available that share the same cpuset, the selection process will create a list of all available NICs and make a selection based on (local rank) % (number of NICs) Signed-off-by: Nikola Dancejic (cherry picked from commit 167d75b42ac3ca4770d59c796c011d72e0fffde3) Signed-off-by: Brian Barrett --- ompi/mca/mtl/ofi/Makefile.am | 1 + ompi/mca/mtl/ofi/mtl_ofi_component.c | 23 +++ opal/mca/btl/ofi/Makefile.am | 3 +- opal/mca/btl/ofi/btl_ofi_component.c | 26 ++- opal/mca/common/ofi/common_ofi.c | 256 +++++++++++++++++++++++++++ opal/mca/common/ofi/common_ofi.h | 2 + 6 files changed, 306 insertions(+), 5 deletions(-) diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 81526a35e2a..3ad6ea6ede7 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -78,6 +78,7 @@ mca_mtl_ofi_la_LDFLAGS = \ $(opal_ofi_LDFLAGS) \ -module -avoid-version mca_mtl_ofi_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la \ $(opal_ofi_LIBS) noinst_LTLIBRARIES = $(component_noinst) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 906f83f1e78..80cf17dbb24 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -15,6 +15,7 @@ #include "mtl_ofi.h" #include "opal/util/argv.h" #include "opal/util/printf.h" +#include "opal/mca/common/ofi/common_ofi.h" static int ompi_mtl_ofi_component_open(void); static int ompi_mtl_ofi_component_query(mca_base_module_t **module, int *priority); @@ -370,6 +371,28 @@ select_ofi_provider(struct fi_info *providers, __FILE__, __LINE__, (prov ? prov->fabric_attr->prov_name : "none")); + /* The initial fi_getinfo() call will return a list of providers + * available for this process. once a provider is selected from the + * list, we will cycle through the remaining list to identify NICs + * serviced by this provider, and try to pick one on the same NUMA + * node as this process. If there are no NICs on the same NUMA node, + * we pick one in a manner which allows all ranks to make balanced + * use of available NICs on the system. + * + * Most providers give a separate fi_info object for each NIC, + * however some may have multiple info objects with different + * attributes for the same NIC. The initial provider attributes + * are used to ensure that all NICs we return provide the same + * capabilities as the inital one. + */ + if (NULL != prov) { + prov = opal_mca_common_ofi_select_provider(prov, ompi_process_info.my_local_rank); + opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + "%s:%d: mtl:ofi:provider: %s\n", + __FILE__, __LINE__, + (prov ? prov->domain_attr->name : "none")); + } + return prov; } diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am index 13693a287a5..dc66bfd6ffd 100644 --- a/opal/mca/btl/ofi/Makefile.am +++ b/opal/mca/btl/ofi/Makefile.am @@ -58,7 +58,8 @@ mca_btl_ofi_la_SOURCES = $(component_sources) mca_btl_ofi_la_LDFLAGS = -module -avoid-version \ $(opal_common_ofi_LDFLAGS) mca_btl_ofi_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ - $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la + $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la \ + $(opal_ofi_LIBS) noinst_LTLIBRARIES = $(lib) libmca_btl_ofi_la_SOURCES = $(lib_sources) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 6526cd4dad8..3719685afc7 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -27,6 +27,7 @@ #include "opal/mca/btl/btl.h" #include "opal/mca/btl/base/base.h" #include "opal/mca/hwloc/base/base.h" +#include "opal/mca/common/ofi/common_ofi.h" #include @@ -237,7 +238,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, return NULL; } - struct fi_info *info, *info_list; + struct fi_info *info, *info_list, *selected_info; struct fi_info hints = {0}; struct fi_ep_attr ep_attr = {0}; struct fi_rx_attr rx_attr = {0}; @@ -328,10 +329,27 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, rc = validate_info(info, required_caps); if (OPAL_SUCCESS == rc) { /* Device passed sanity check, let's make a module. - * We only pick the first device we found valid */ - rc = mca_btl_ofi_init_device(info); - if (OPAL_SUCCESS == rc) + * + * The initial fi_getinfo() call will return a list of providers + * available for this process. once a provider is selected from the + * list, we will cycle through the remaining list to identify NICs + * serviced by this provider, and try to pick one on the same NUMA + * node as this process. If there are no NICs on the same NUMA node, + * we pick one in a manner which allows all ranks to make balanced + * use of available NICs on the system. + * + * Most providers give a separate fi_info object for each NIC, + * however some may have multiple info objects with different + * attributes for the same NIC. The initial provider attributes + * are used to ensure that all NICs we return provide the same + * capabilities as the inital one. + */ + selected_info = opal_mca_common_ofi_select_provider(info, opal_process_info.my_local_rank); + rc = mca_btl_ofi_init_device(selected_info); + if (OPAL_SUCCESS == rc) { + info = selected_info; break; + } } info = info->next; } diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 83a6acd441e..0ae8f965801 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -11,6 +11,7 @@ #include "opal_config.h" #include "opal/constants.h" +#include "opal/mca/hwloc/base/base.h" #include #include @@ -25,3 +26,258 @@ int mca_common_ofi_register_mca_variables(void) return OPAL_ERROR; } } + +/* check that the tx attributes match */ +static int +check_tx_attr(struct fi_tx_attr *provider_info, + struct fi_tx_attr *provider) +{ + if (!(provider->msg_order & ~(provider_info->msg_order)) && + !(provider->op_flags & ~(provider_info->op_flags)) && + (provider->inject_size == provider_info->inject_size)) { + return 0; + } else { + return OPAL_ERROR; + } +} + +/* check that the rx attributes match */ +static int +check_rx_attr(struct fi_rx_attr *provider_info, + struct fi_rx_attr *provider) +{ + if (!(provider->msg_order & ~(provider_info->msg_order)) && + !(provider->op_flags & ~(provider_info->op_flags))) { + return 0; + } else { + return OPAL_ERROR; + } +} + +/* check that the ep attributes match */ +static int +check_ep_attr(struct fi_ep_attr *provider_info, + struct fi_ep_attr *provider) +{ + if (!(provider->type & ~(provider_info->type)) && + !(provider->mem_tag_format & ~(provider_info->mem_tag_format)) && + (provider->max_msg_size == provider_info->max_msg_size) && + (provider->tx_ctx_cnt == provider_info->tx_ctx_cnt) && + (provider->rx_ctx_cnt == provider_info->rx_ctx_cnt)) { + return 0; + } else { + return OPAL_ERROR; + } +} + +/* check that the provider attributes match */ +static int +check_provider_attr(struct fi_info *provider_info, + struct fi_info *provider) +{ + /* make sure both info are the same provider and provide the same attributes */ + if (0 == strcmp(provider_info->fabric_attr->prov_name, provider->fabric_attr->prov_name) && + !check_tx_attr(provider_info->tx_attr, provider->tx_attr) && + !check_rx_attr(provider_info->rx_attr, provider->rx_attr) && + !check_ep_attr(provider_info->ep_attr, provider->ep_attr) && + !(provider_info->caps & ~(provider->caps)) && + !(provider_info->mode & ~(provider->mode))) { + return 0; + } else { + return OPAL_ERROR; + } +} + +/* Check if a process and a pci device share the same cpuset + * @param (IN) pci struct fi_pci_attr pci device attributes, + * used to find hwloc object for device. + * + * @param (IN) topology hwloc_topology_t topology to get the cpusets + * from + * + * @param (OUT) returns true if cpusets match and false if + * cpusets do not match or an error prevents comparison + * + * Uses a pci device to find an ancestor that contains a cpuset, and + * determines if it intersects with the cpuset that the process is bound to. + * if the process is not bound, or if a cpuset is unavailable for whatever + * reason, returns false. Otherwise, returns the result of + * hwloc_cpuset_intersects() + */ +static bool +compare_cpusets(hwloc_topology_t topology, struct fi_pci_attr pci) +{ + bool result = false; + int ret; + hwloc_bitmap_t proc_cpuset; + hwloc_obj_t obj = NULL; + + /* Cannot find topology info if no topology is found */ + if (NULL == topology) { + return false; + } + + /* Allocate memory for proc_cpuset */ + proc_cpuset = hwloc_bitmap_alloc(); + if (NULL == proc_cpuset) { + return false; + } + + /* Fill cpuset with the collection of cpu cores that the process runs on */ + ret = hwloc_get_cpubind(topology, proc_cpuset, HWLOC_CPUBIND_PROCESS); + if (0 > ret) { + goto error; + } + + /* Get the pci device from bdf */ + obj = hwloc_get_pcidev_by_busid(topology, pci.domain_id, pci.bus_id, + pci.device_id, pci.function_id); + if (NULL == obj) { + goto error; + } + + /* pcidev objects don't have cpusets so find the first non-io object above */ + obj = hwloc_get_non_io_ancestor_obj(topology, obj); + if (NULL != obj) { + result = hwloc_bitmap_intersects(proc_cpuset, obj->cpuset); + } + +error: + hwloc_bitmap_free(proc_cpuset); + return result; +} + +/* Count providers returns the number of providers present in an fi_info list + * @param (IN) provider_list struct fi_info* list of providers available + * + * @param (OUT) int number of providers present in the list + * + * returns 0 if the list is NULL + */ +static int +count_providers(struct fi_info* provider_list) +{ + struct fi_info* dev = provider_list; + int num_provider = 0; + + while (NULL != dev) { + num_provider++; + dev = dev->next; + } + + return num_provider; +} + +/* Selects a NIC based on hardware locality to process cpuset and device BDF. + * + * @param provider_list (IN) struct fi_info* An initially selected + * provider NIC. The provider name and + * attributes are used to restrict NIC + * selection. This provider is returned if the + * NIC selection fails. + * + * @param local_index (IN) int The local rank of the process. Used to + * select one valid NIC if there is a case + * where more than one can be selected. This + * could occur when more than one provider + * shares the same cpuset as the process. + * + * @param provider (OUT) struct fi_info* object with the selected + * provider if the selection succeeds + * if the selection fails, returns the fi_info + * object that was initially provided. + * + * If there is more than one provider that shares the same cpuset, we use + * (local rank % number of valid providers that share the process cpuset) + * to select one of the local providers. + * + * Likewise, If no providers share the same cpuset as the process, we use + * (local rank % number of valid providers that share the process cpuset) + * to select one of the valid providers. + * + * Initializes opal_hwloc_topology to access hardware topology if not previously + * initialized + * + * If a provider does not provide a BDF, the locality can't be determined and it + * is treated as though it does not share the same cpuset as the process. + * + * All errors should be recoverable and will return the initially provided + * provider. However, if an error occurs this will no longer guarantee + * that the provider returned is local to the process or that the processes will + * balance across available NICs. + */ +struct fi_info* +opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_index) +{ + struct fi_info *provider = provider_list, *current_provider = provider_list; + struct fi_info **provider_table; + struct fi_pci_attr pci; + int ret; + unsigned int num_provider = 0, provider_limit = 0; + bool provider_found = false, cpusets_match = false; + + /* Initialize opal_hwloc_topology if it is not already */ + ret = opal_hwloc_base_get_topology(); + if (0 > ret) { + /* Provider selection can continue but there is no guarantee of locality */ + opal_output(1, "%s:%d:Failed to initialize topology\n", __FILE__, __LINE__); + } + + provider_limit = count_providers(provider_list); + + /* Allocate memory for provider table */ + provider_table = calloc(provider_limit, sizeof(struct fi_info*)); + if (NULL == provider_table) { + opal_output(1, "%s:%d:Failed to allocate memory for provider table\n", __FILE__, __LINE__); + return provider_list; + } + + current_provider = provider; + + /* Cycle through remaining fi_info objects, looking for alike providers */ + while (NULL != current_provider) { + if (!check_provider_attr(provider, current_provider)) { + cpusets_match = false; + if (NULL != current_provider->nic) { + pci = current_provider->nic->bus_attr->attr.pci; + cpusets_match = compare_cpusets(opal_hwloc_topology, pci); + } + + /* Reset the list if the cpusets match and no other provider was + * found on the same cpuset as the process. + */ + if (cpusets_match && !provider_found) { + provider_found = true; + num_provider = 0; + } + + /* Add the provider to the provider list if the cpusets match or if + * no other provider was found on the same cpuset as the process. + */ + if (cpusets_match || !provider_found) { + provider_table[num_provider] = current_provider; + num_provider++; + } + } + current_provider = current_provider->next; + } + + /* Select provider from local rank % number of providers */ + if (num_provider > 0) { + provider = provider_table[local_index % num_provider]; + } + +#if OPAL_DEBUG_ENABLE + if (NULL != provider->nic) { + pci = provider->nic->bus_attr->attr.pci; + cpusets_match = compare_cpusets(opal_hwloc_topology, pci); + } + + opal_output(10, "local rank: %d device: %s cpusets match: %s\n", + local_index, provider->domain_attr->name, cpusets_match ? "true" : "false"); +#endif + +err_free_table: + free(provider_table); + return provider; +} diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h index 3494cb7d3ac..30f9f4f88a3 100644 --- a/opal/mca/common/ofi/common_ofi.h +++ b/opal/mca/common/ofi/common_ofi.h @@ -16,4 +16,6 @@ OPAL_DECLSPEC int mca_common_ofi_register_mca_variables(void); +struct fi_info* opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int rank); + #endif /* OPAL_MCA_COMMON_OFI_H */ From c8659a98c4060623ddc104e88a16d551af77a067 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 29 Jan 2019 13:10:26 +0900 Subject: [PATCH 618/674] ofi: revamp OPAL_CHECK_OFI configury Update the OPAL_CHECK_OFI configury macro: - Make it safe to call the macro multiple times: - The checks only execute the first time it is invoked - Subsequent invocations, it just emits a friendly "checking..." message so that configure output is sensible/logical - With the goal of ultimately removing opal/mca/common/ofi, rename the output variables from OPAL_CHECK_OFI to be opal_ofi_{happy|CPPFLAGS|LDFLAGS|LIBS}. - Update btl/ofi, btl/usnic, and mtl/ofi for these new conventions. - Also, don't use AC_REQUIRE to invoke OPAL_CHECK_OFI because that causes the macro to be invoked at a fairly random time, which makes configure stdout confusing / hard to grok. - Remove a little left-over kruft in OPAL_CHECK_OFI, too (which resulted in an indenting change, making the change to opal_check_ofi.m4 look larger than it really is). Thanks Alastair McKinstry for the report and initial fix. Thanks Rashika Kheria for the reminder. Signed-off-by: Jeff Squyres (cherry picked from commit f5e1a672ccd5db127e85e1e8f6bcfeb8a8b04527) NOTE: This patch was cherry-picked into the v4.0.x branch as 9ad871fc, but the OFI BTL changes were skipped, because the OFI BTL was not in the v4.0.x branch. This version of the cherry pick brings in the changes to the OFI BTL. Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/Makefile.am | 7 ++++--- opal/mca/btl/ofi/configure.m4 | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am index dc66bfd6ffd..65e7e3edf65 100644 --- a/opal/mca/btl/ofi/Makefile.am +++ b/opal/mca/btl/ofi/Makefile.am @@ -22,7 +22,7 @@ #dist_opaldata_DATA = help-mpi-btl-ofi.txt -AM_CPPFLAGS = $(opal_common_ofi_CPPFLAGS) +AM_CPPFLAGS = $(opal_ofi_CPPFLAGS) sources = \ btl_ofi.h \ btl_ofi_component.c \ @@ -56,11 +56,12 @@ mcacomponentdir = $(opallibdir) mcacomponent_LTLIBRARIES = $(component) mca_btl_ofi_la_SOURCES = $(component_sources) mca_btl_ofi_la_LDFLAGS = -module -avoid-version \ - $(opal_common_ofi_LDFLAGS) + $(opal_ofi_LDFLAGS) mca_btl_ofi_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la \ $(OPAL_TOP_BUILDDIR)/opal/mca/common/ofi/lib@OPAL_LIB_PREFIX@mca_common_ofi.la \ $(opal_ofi_LIBS) noinst_LTLIBRARIES = $(lib) libmca_btl_ofi_la_SOURCES = $(lib_sources) -libmca_btl_ofi_la_LDFLAGS = -module -avoid-version $(opal_common_ofi_LDFLAGS) +libmca_btl_ofi_la_LDFLAGS = -module -avoid-version $(opal_ofi_LDFLAGS) +libmca_btl_ofi_la_LIBS = $(opal_ofi_LIBS) diff --git a/opal/mca/btl/ofi/configure.m4 b/opal/mca/btl/ofi/configure.m4 index 222a7b29e03..23c7370e48e 100644 --- a/opal/mca/btl/ofi/configure.m4 +++ b/opal/mca/btl/ofi/configure.m4 @@ -11,7 +11,7 @@ # Copyright (c) 2004-2006 The Regents of the University of California. # All rights reserved. # Copyright (c) 2006 QLogic Corp. All rights reserved. -# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2019 Cisco Systems, Inc. All rights reserved # Copyright (c) 2011-2018 Los Alamos National Security, LLC. # All rights reserved. # Copyright (c) 2018 Intel, inc. All rights reserved @@ -34,12 +34,13 @@ AC_DEFUN([MCA_opal_btl_ofi_CONFIG],[ AC_CONFIG_FILES([opal/mca/btl/ofi/Makefile]) - AC_REQUIRE([MCA_opal_common_ofi_CONFIG]) + # Check for OFI + OPAL_CHECK_OFI opal_btl_ofi_happy=0 - AS_IF([test "$opal_common_ofi_happy" = "yes"], + AS_IF([test "$opal_ofi_happy" = "yes"], [CPPFLAGS_save=$CPPFLAGS - CPPFLAGS="$opal_common_ofi_CPPFLAGS $CPPFLAGS" + CPPFLAGS="$opal_ofi_CPPFLAGS $CPPFLAGS" AC_CHECK_DECL([FI_MR_VIRT_ADDR], [opal_btl_ofi_happy=1], [], [#include ]) CPPFLAGS=$CPPFLAGS_save]) From c51917675c101d65ccf9b759a7bcb1b6e968ef1a Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Mon, 1 Jun 2020 23:14:41 +0000 Subject: [PATCH 619/674] common/ofi: Fixing compilation issue with ofi versions that do not support fi_info.nic Added the flag OPAL_OFI_PCI_DATA_AVAILABLE to remove accessing the nic object in fi_info when the ofi version does not support that structure. Signed-off-by: Nikola Dancejic dancejic@amazon.com (cherry picked from commit ae2a447b0eddaac057beecdba99e10903051a2a7) Signed-off-by: Brian Barrett --- config/opal_check_ofi.m4 | 13 +++++- opal/mca/common/ofi/common_ofi.c | 78 ++++++++++++++++++++++---------- 2 files changed, 65 insertions(+), 26 deletions(-) diff --git a/config/opal_check_ofi.m4 b/config/opal_check_ofi.m4 index 17dab76c0b4..ea0b9a9a337 100644 --- a/config/opal_check_ofi.m4 +++ b/config/opal_check_ofi.m4 @@ -89,10 +89,11 @@ AC_DEFUN([_OPAL_CHECK_OFI],[ OPAL_CHECK_WITHDIR([ofi-libdir], [$with_ofi_libdir], [libfabric.*]) - OPAL_VAR_SCOPE_PUSH([opal_check_ofi_save_CPPFLAGS opal_check_ofi_save_LDFLAGS opal_check_ofi_save_LIBS]) + OPAL_VAR_SCOPE_PUSH([opal_check_ofi_save_CPPFLAGS opal_check_ofi_save_LDFLAGS opal_check_ofi_save_LIBS opal_check_fi_info_pci]) opal_check_ofi_save_CPPFLAGS=$CPPFLAGS opal_check_ofi_save_LDFLAGS=$LDFLAGS opal_check_ofi_save_LIBS=$LIBS + opal_check_fi_info_pci=0 opal_ofi_happy=yes AS_IF([test "$with_ofi" = "no"], @@ -120,6 +121,16 @@ AC_DEFUN([_OPAL_CHECK_OFI],[ [], [opal_ofi_happy=no])]) + AS_IF([test $opal_ofi_happy = yes], + [AC_CHECK_MEMBER([struct fi_info.nic], + [opal_check_fi_info_pci=1], + [opal_check_fi_info_pci=0], + [[#include "$with_ofi/include/rdma/fabric.h"]])]) + + AC_DEFINE_UNQUOTED([OPAL_OFI_PCI_DATA_AVAILABLE], + [$opal_check_fi_info_pci], + [check if pci data is available in ofi]) + CPPFLAGS=$opal_check_ofi_save_CPPFLAGS LDFLAGS=$opal_check_ofi_save_LDFLAGS LIBS=$opal_check_ofi_save_LIBS diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 0ae8f965801..074fb880ca6 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -88,6 +88,7 @@ check_provider_attr(struct fi_info *provider_info, } } +#if OPAL_OFI_PCI_DATA_AVAILABLE /* Check if a process and a pci device share the same cpuset * @param (IN) pci struct fi_pci_attr pci device attributes, * used to find hwloc object for device. @@ -146,6 +147,7 @@ compare_cpusets(hwloc_topology_t topology, struct fi_pci_attr pci) hwloc_bitmap_free(proc_cpuset); return result; } +#endif /* Count providers returns the number of providers present in an fi_info list * @param (IN) provider_list struct fi_info* list of providers available @@ -168,41 +170,56 @@ count_providers(struct fi_info* provider_list) return num_provider; } -/* Selects a NIC based on hardware locality to process cpuset and device BDF. +/* Selects a NIC based on hardware locality between process cpuset and device BDF. + * + * Initializes opal_hwloc_topology to access hardware topology if not previously + * initialized + * + * There are 3 main cases that this covers: + * + * 1. If the first provider passed into this function is the only valid + * provider, this provider is returned. + * + * 2. If there is more than 1 provider that matches the type of the first + * provider in the list, and the BDF data + * is available then a provider is selected based on locality of device + * cpuset and process cpuset and tries to ensure that processes are distributed + * evenly across NICs. This has two separate cases: + * + * i. There is one or more provider local to the process: + * + * (local rank % number of providers of the same type that share the process cpuset) + * is used to select one of these providers. + * + * ii. There is no provider that is local to the process: + * + * (local rank % number of providers of the same type) + * is used to select one of these providers + * + * 3. If there is more than 1 providers of the same type in the list, and the BDF data + * is not available (the ofi version does not support fi_info.nic or the + * provider does not support BDF) then (local rank % number of providers of the same type) + * is used to select one of these providers * - * @param provider_list (IN) struct fi_info* An initially selected + * @param provider_list (IN) struct fi_info* An initially selected * provider NIC. The provider name and * attributes are used to restrict NIC * selection. This provider is returned if the * NIC selection fails. * - * @param local_index (IN) int The local rank of the process. Used to + * @param local_index (IN) int The local rank of the process. Used to * select one valid NIC if there is a case * where more than one can be selected. This * could occur when more than one provider * shares the same cpuset as the process. * - * @param provider (OUT) struct fi_info* object with the selected + * @param provider (OUT) struct fi_info* object with the selected * provider if the selection succeeds * if the selection fails, returns the fi_info * object that was initially provided. * - * If there is more than one provider that shares the same cpuset, we use - * (local rank % number of valid providers that share the process cpuset) - * to select one of the local providers. - * - * Likewise, If no providers share the same cpuset as the process, we use - * (local rank % number of valid providers that share the process cpuset) - * to select one of the valid providers. - * - * Initializes opal_hwloc_topology to access hardware topology if not previously - * initialized - * - * If a provider does not provide a BDF, the locality can't be determined and it - * is treated as though it does not share the same cpuset as the process. - * * All errors should be recoverable and will return the initially provided - * provider. However, if an error occurs this will no longer guarantee + * provider. However, if an error occurs we can no longer guarantee * that the provider returned is local to the process or that the processes will * balance across available NICs. */ @@ -211,7 +228,9 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind { struct fi_info *provider = provider_list, *current_provider = provider_list; struct fi_info **provider_table; +#if OPAL_OFI_PCI_DATA_AVAILABLE struct fi_pci_attr pci; +#endif int ret; unsigned int num_provider = 0, provider_limit = 0; bool provider_found = false, cpusets_match = false; @@ -220,7 +239,9 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind ret = opal_hwloc_base_get_topology(); if (0 > ret) { /* Provider selection can continue but there is no guarantee of locality */ - opal_output(1, "%s:%d:Failed to initialize topology\n", __FILE__, __LINE__); + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d:Failed to initialize topology\n", + __FILE__, __LINE__); } provider_limit = count_providers(provider_list); @@ -228,7 +249,9 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind /* Allocate memory for provider table */ provider_table = calloc(provider_limit, sizeof(struct fi_info*)); if (NULL == provider_table) { - opal_output(1, "%s:%d:Failed to allocate memory for provider table\n", __FILE__, __LINE__); + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d:Failed to allocate memory for provider table\n", + __FILE__, __LINE__); return provider_list; } @@ -238,10 +261,12 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind while (NULL != current_provider) { if (!check_provider_attr(provider, current_provider)) { cpusets_match = false; +#if OPAL_OFI_PCI_DATA_AVAILABLE if (NULL != current_provider->nic) { pci = current_provider->nic->bus_attr->attr.pci; cpusets_match = compare_cpusets(opal_hwloc_topology, pci); } +#endif /* Reset the list if the cpusets match and no other provider was * found on the same cpuset as the process. @@ -267,17 +292,20 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind provider = provider_table[local_index % num_provider]; } -#if OPAL_DEBUG_ENABLE +#if OPAL_OFI_PCI_DATA_AVAILABLE if (NULL != provider->nic) { pci = provider->nic->bus_attr->attr.pci; cpusets_match = compare_cpusets(opal_hwloc_topology, pci); } +#endif - opal_output(10, "local rank: %d device: %s cpusets match: %s\n", - local_index, provider->domain_attr->name, cpusets_match ? "true" : "false"); +#if OPAL_DEBUG_ENABLE + opal_output_verbose(1, opal_common_ofi.output, + "local rank: %d device: %s cpusets match: %s\n", + local_index, provider->domain_attr->name, + cpusets_match ? "true" : "false"); #endif -err_free_table: free(provider_table); return provider; } From 61b11e4101020728f8ce2b9fafddd3c2e4e0b0cf Mon Sep 17 00:00:00 2001 From: Harumi Kuno Date: Wed, 3 Jun 2020 09:56:29 -0600 Subject: [PATCH 620/674] mtl_btl_ofi_rcache_init() before creating domain mtl_btl_ofi_rcache_init() initializes patcher which should only take place things are single threaded. OFI providers may start spawn threads, so initialize the rcache before creating OFI objects to prevent races. Authored-by: John L. Byrne Signed-off-by: Harumi Kuno (cherry picked from commit f1b21cb77680106be870ad29e5a7534862fceed7) Signed-off-by: Brian Barrett --- opal/mca/btl/ofi/btl_ofi_component.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 3719685afc7..c1675775c2b 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -410,6 +410,12 @@ static int mca_btl_ofi_init_device(struct fi_info *info) ep_attr = ofi_info->ep_attr; domain_attr = ofi_info->domain_attr; + /* mtl_btl_ofi_rcache_init() initializes patcher which should only + * take place things are single threaded. OFI providers may start + * spawn threads, so initialize the rcache before creating OFI objects + * to prevent races. */ + mca_btl_ofi_rcache_init(module); + linux_device_name = info->domain_attr->name; BTL_VERBOSE(("initializing dev:%s provider:%s", linux_device_name, @@ -540,9 +546,6 @@ static int mca_btl_ofi_init_device(struct fi_info *info) module->use_virt_addr = true; } - /* initialize the rcache */ - mca_btl_ofi_rcache_init(module); - /* create endpoint list */ OBJ_CONSTRUCT(&module->endpoints, opal_list_t); OBJ_CONSTRUCT(&module->module_lock, opal_mutex_t); From 204922fff651de06ce416ccddbe41af6a7f0421d Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sun, 31 May 2020 03:03:19 +0000 Subject: [PATCH 621/674] dist: Add OFI backports to NEWS Signed-off-by: Brian Barrett --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 1291c16f4ff..d7b29d3f717 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,10 @@ included in the vX.Y.Z section and be denoted as: 4.1.0 -- July, 2020 ------------------- +- OFI/libfabric: Added support for multiple NICs +- OFI/libfabric: Added support for Scalable Endpoints +- OFI/libfabric: Added btl for one-sided support + 4.0.4 -- June, 2020 ----------------------- - Fix a memory patcher issue intercepting shmat and shmdt. This was From 1f5adc65bc9d4a526259f4a577a072dadd4a58a3 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Tue, 9 Jun 2020 15:44:27 -0400 Subject: [PATCH 622/674] noinline to avoid compiler reading TOC before PATCHER_BEGIN This bug was first seen in a different product that's using the same interception code as OMPI. But I think it's potentially in OMPI too. In my vanilla build of OMPI master on RH8 if I "gdb libopen-pal.so" and "disassemble intercept_brk", I'm seeing a suspicious extra instruction in front of PATCHER_BEGIN: 0x00000000000d6778 <+40>: std r2,24(r1) // something gcc put in front 0x00000000000d677c <+44>: std r2,96(r1) // PATCHER_BEGIN's toc_save 0x00000000000d6780 <+48>: nop // NOPs from PATCHER_BEGIN 0x00000000000d6784 <+52>: nop // that get replaced 0x00000000000d6788 <+56>: nop // by instructions that 0x00000000000d678c <+60>: nop // change r2 0x00000000000d6790 <+64>: nop // Later there are loads from that location like 0x000000000019e0e4 <+132>: ld r2,24(r1) that make me nervous since that's the pre-updated value. I believe this is the same thing Nathan is describing way back in a9bc692d and his solution was to put a second call around each interception, where the outer call is just intercept_brk(): PATCHER_BEGIN _intercept_brk() PATCHER_END and the inner call _intercept_brk() is where the bulk of the code goes. What I'm seeing is that _intercept_brk() is being inlined and probably negating Nathan's fix. So I want to add __opal_attribute_noinline__ to restore the fix. With this commit in place, the disassembly of intercept_brk becomes tiny because it's no longer inlining _intercept_brk() and the susipicious early save of r2 is gone. I made the same fix to all the intercept_* functions, although intercept_brk was the only one that had a suspicious save of r2. As far as empirical failures though, we only have those from the non-OMPI product that's using the same patcher code. I'm not actually getting OMPI to fail from the above suspicious data being saved in r1+24. Signed-off-by: Mark Allen (cherry picked from commit ddd1f578ecfc443d05250e09bf5e5077c6d6f304) --- .../memory/patcher/memory_patcher_component.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 20bc4c10b34..bb77b4175b7 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -107,6 +107,22 @@ opal_memory_patcher_component_t mca_memory_patcher_component = { * data. If this can be resolved the two levels can be joined. */ +/* + * Nathan's original fix described above can have the same problem reappear if the + * interception functions inline themselves. + */ +static void *_intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) __opal_attribute_noinline__; +static int _intercept_munmap(void *start, size_t length) __opal_attribute_noinline__; +#if defined(__linux__) +static void *_intercept_mremap (void *start, size_t oldlen, size_t newlen, int flags, void *new_address) __opal_attribute_noinline__; +#else +static void *_intercept_mremap (void *start, size_t oldlen, void *new_address, size_t newlen, int flags) __opal_attribute_noinline__; +#endif +static int _intercept_madvise (void *start, size_t length, int advice) __opal_attribute_noinline__; +static int _intercept_brk (void *addr) __opal_attribute_noinline__; +static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) __opal_attribute_noinline__; +static int _intercept_shmdt (const void *shmaddr) __opal_attribute_noinline__; + #if defined (SYS_mmap) #if defined(HAVE___MMAP) && !HAVE_DECL___MMAP From 1af51d07d6be7b87e26bb01aeb1b72633a86d151 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 16 Jun 2020 17:45:00 +0200 Subject: [PATCH 623/674] osc rdma: check for outstanding fragments before completing a request Signed-off-by: Joseph Schuchart (cherry picked from commit 85ed26f2f859283522188a68dea493cdc99d76aa) --- ompi/mca/osc/rdma/osc_rdma_comm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.c b/ompi/mca/osc/rdma/osc_rdma_comm.c index 1c166767783..d88fdf5c513 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.c +++ b/ompi/mca/osc/rdma/osc_rdma_comm.c @@ -391,8 +391,10 @@ static void ompi_osc_rdma_put_complete (struct mca_btl_base_module_t *btl, struc ompi_osc_rdma_request_t *request = request = (ompi_osc_rdma_request_t *) ((intptr_t) context & ~1); sync = request->sync; - /* NTH -- TODO: better error handling */ - ompi_osc_rdma_request_complete (request, status); + if (0 == OPAL_THREAD_ADD_FETCH32 (&request->outstanding_requests, -1)) { + /* NTH -- TODO: better error handling */ + ompi_osc_rdma_request_complete (request, status); + } } OSC_RDMA_VERBOSE(status ? MCA_BASE_VERBOSE_ERROR : MCA_BASE_VERBOSE_TRACE, "btl put complete on sync %p. local " From 059c9614a6c0d88869b63b0c4b7c6f4aae922f2b Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 18 Feb 2020 12:59:46 -0800 Subject: [PATCH 624/674] osc/rdma: fix bug in attach for non-debug builds This commit fixes an issue with non-debug builds where adding an attachment to the attachment list doesn't actually happen. This causes all MPI_Win_detach calls to fail. The call was within an assert which is optimized out in optimized builds. Signed-off-by: Nathan Hjelm (cherry picked from commit 8ee80d885561c4349ab97725416613614d63c77f) --- ompi/mca/osc/rdma/osc_rdma_dynamic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_dynamic.c b/ompi/mca/osc/rdma/osc_rdma_dynamic.c index 50a18a66048..a8c8116c64c 100644 --- a/ompi/mca/osc/rdma/osc_rdma_dynamic.c +++ b/ompi/mca/osc/rdma/osc_rdma_dynamic.c @@ -261,8 +261,8 @@ int ompi_osc_rdma_attach (struct ompi_win_t *win, void *base, size_t len) rdma_region_handle->btl_handle = NULL; } - assert(OMPI_SUCCESS == ompi_osc_rdma_add_attachment (rdma_region_handle, (intptr_t) base, len)); - + ret = ompi_osc_rdma_add_attachment (rdma_region_handle, (intptr_t) base, len); + assert(OMPI_SUCCESS == ret); module->dynamic_handles[region_index] = rdma_region_handle; #if OPAL_ENABLE_DEBUG From 8fcf9cee3ba5da993cbd32894ad6c4c963b1e1c5 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Tue, 14 Apr 2020 09:19:56 -0600 Subject: [PATCH 625/674] add a common ofi whitelist/blacklist also add common verbose variable. Note the verbosity thing is a little tricky owing to the way the MCA frameworks and components are registered and and initialized. The BTL's are registered/initialized prior to the MTL components even getting registered. Here's the change in ofi mtl mca parameters. Before commit: MCA mtl ofi: parameter "mtl_ofi_provider_include" (current value: "psm2", data source: environment, level: 1 user/basic, type: string) Comma-delimited list of OFI providers that are considered for use (e.g., "psm,psm2"; an empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_exclude. MCA mtl ofi: parameter "mtl_ofi_provider_exclude" (current value: "shm,sockets,tcp,udp,rstream", data source: default, level: 1 user/basic, type: string) Comma-delimited list of OFI providers that are not considered for use (default: "sockets,mxm"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include. After commit: MCA btl ofi: parameter "btl_ofi_provider_include" (current value: "", data source: default, level: 1 user/basic, type: string, synonym of: opal_common_ofi_provider_include) Comma-delimited list of OFI providers that are considered for use (e.g., "psm,psm2"; an empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_exclude. MCA btl ofi: parameter "btl_ofi_provider_exclude" (current value: "shm,sockets,tcp,udp,rstream", data source: default, level: 1 user/basic, type: string, synonym of: opal_common_ofi_provider_exclude) Comma-delimited list of OFI providers that are not considered for use (default: "sockets,mxm"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include. MCA mtl ofi: parameter "mtl_ofi_provider_exclude" (current value: "shm,sockets,tcp,udp,rstream", data source: default, level: 1 user/basic, type: string, synonym of: opal_common_ofi_provider_exclude) Comma-delimited list of OFI providers that are not considered for use (default: "sockets,mxm"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include. MCA mtl ofi: parameter "mtl_ofi_verbose" (current value: "0", data source: default, level: 3 user/all, type: int, synonym of: opal_common_ofi_verbose) related to #7755 Signed-off-by: Howard Pritchard (cherry picked from commit 9f1081a07ac3c7b7277a27277ed970ed713207c9) (cherry picked from commit 45b643d0cfa46f1abb9a5f43cf0ff304cf6a5fea) --- ompi/mca/mtl/ofi/Makefile.am | 2 + ompi/mca/mtl/ofi/mtl_ofi.c | 6 +- ompi/mca/mtl/ofi/mtl_ofi.h | 13 ++-- ompi/mca/mtl/ofi/mtl_ofi_component.c | 69 ++++++++---------- opal/mca/btl/ofi/Makefile.am | 2 + opal/mca/btl/ofi/btl_ofi_component.c | 41 ++++++----- opal/mca/common/ofi/common_ofi.c | 104 +++++++++++++++++++++++++-- opal/mca/common/ofi/common_ofi.h | 27 ++++++- 8 files changed, 189 insertions(+), 75 deletions(-) diff --git a/ompi/mca/mtl/ofi/Makefile.am b/ompi/mca/mtl/ofi/Makefile.am index 3ad6ea6ede7..832e2b8e6ec 100644 --- a/ompi/mca/mtl/ofi/Makefile.am +++ b/ompi/mca/mtl/ofi/Makefile.am @@ -7,6 +7,8 @@ # Copyright (c) 2017 IBM Corporation. All rights reserved. # Copyright (c) 2019 Research Organization for Information Science # and Technology (RIST). All rights reserved. +# Copyright (c) 2020 Triad National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/ompi/mca/mtl/ofi/mtl_ofi.c b/ompi/mca/mtl/ofi/mtl_ofi.c index 6c679b88b93..9d4a0d82748 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.c +++ b/ompi/mca/mtl/ofi/mtl_ofi.c @@ -112,7 +112,7 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, */ count = fi_av_insert(ompi_mtl_ofi.av, ep_names, nprocs, fi_addrs, 0, NULL); if ((count < 0) || (nprocs != (size_t)count)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: fi_av_insert failed: %d\n", __FILE__, __LINE__, count); ret = OMPI_ERROR; @@ -125,7 +125,7 @@ ompi_mtl_ofi_add_procs(struct mca_mtl_base_module_t *mtl, for (i = 0; i < nprocs; ++i) { endpoint = OBJ_NEW(mca_mtl_ofi_endpoint_t); if (NULL == endpoint) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl/ofi: could not allocate endpoint" " structure\n", __FILE__, __LINE__); @@ -170,7 +170,7 @@ ompi_mtl_ofi_del_procs(struct mca_mtl_base_module_t *mtl, endpoint = procs[i]->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL]; ret = fi_av_remove(ompi_mtl_ofi.av, &endpoint->peer_fiaddr, 1, 0); if (ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: fi_av_remove failed: %s\n", __FILE__, __LINE__, fi_strerror(errno)); return ret; } diff --git a/ompi/mca/mtl/ofi/mtl_ofi.h b/ompi/mca/mtl/ofi/mtl_ofi.h index 183d80108f5..44e107692c5 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi.h +++ b/ompi/mca/mtl/ofi/mtl_ofi.h @@ -2,7 +2,7 @@ * Copyright (c) 2013-2018 Intel, Inc. All rights reserved * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2019 Triad National Security, LLC. All rights + * Copyright (c) 2019-2020 Triad National Security, LLC. All rights * reserved. * Copyright (c) 2018-2020 Amazon.com, Inc. or its affiliates. All rights * reserved. @@ -38,6 +38,7 @@ #include "ompi/mca/mtl/base/base.h" #include "ompi/mca/mtl/base/mtl_base_datatype.h" #include "ompi/message/message.h" +#include "opal/mca/common/ofi/common_ofi.h" #include "mtl_ofi_opt.h" #include "mtl_ofi_types.h" @@ -235,7 +236,7 @@ ompi_mtl_ofi_progress(void) #define MTL_OFI_LOG_FI_ERR(err, string) \ do { \ - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + opal_output_verbose(1, opal_common_ofi.output, \ "%s:%d:%s: %s\n", \ __FILE__, __LINE__, string, fi_strerror(-err)); \ } while(0); @@ -377,7 +378,7 @@ ompi_mtl_ofi_ssend_recv(ompi_mtl_ofi_request_t *ack_req, 0, /* Exact match, no ignore bits */ (void *) &ack_req->ctx), ret); if (OPAL_UNLIKELY(0 > ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: fi_trecv failed: %s(%zd)", __FILE__, __LINE__, fi_strerror(-ret), ret); free(ack_req); @@ -663,7 +664,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, status->_ucount = wc->len; if (OPAL_UNLIKELY(wc->len > ofi_req->length)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "truncate expected: %ld %ld", wc->len, ofi_req->length); status->MPI_ERROR = MPI_ERR_TRUNCATE; @@ -677,7 +678,7 @@ ompi_mtl_ofi_recv_callback(struct fi_cq_tagged_entry *wc, ofi_req->buffer, wc->len); if (OPAL_UNLIKELY(OMPI_SUCCESS != ompi_ret)) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: ompi_mtl_datatype_unpack failed: %d", __FILE__, __LINE__, ompi_ret); status->MPI_ERROR = ompi_ret; @@ -1330,7 +1331,7 @@ static int ompi_mtl_ofi_init_contexts(struct mca_mtl_base_module_t *mtl, if (MPI_COMM_WORLD == comm) { ret = opal_progress_register(ompi_mtl_ofi_progress_no_inline); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: opal_progress_register failed: %d\n", __FILE__, __LINE__, ret); goto init_error; diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 80cf17dbb24..1e32d1af66f 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -5,6 +5,9 @@ * Copyright (c) 2014-2017 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -27,8 +30,6 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, bool enable_mpi_threads); static int param_priority; -static char *prov_include; -static char *prov_exclude; static int control_progress; static int data_progress; static int av_type; @@ -130,24 +131,6 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, ¶m_priority); - prov_include = NULL; - mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, - "provider_include", - "Comma-delimited list of OFI providers that are considered for use (e.g., \"psm,psm2\"; an empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_exclude.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_1, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_include); - - prov_exclude = "shm,sockets,tcp,udp,rstream"; - mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, - "provider_exclude", - "Comma-delimited list of OFI providers that are not considered for use (default: \"sockets,mxm\"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_1, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_exclude); - ompi_mtl_ofi.ofi_progress_event_count = MTL_OFI_MAX_PROG_EVENT_COUNT; opal_asprintf(&desc, "Max number of events to read each call to OFI progress (default: %d events will be read per OFI progress call)", ompi_mtl_ofi.ofi_progress_event_count); mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, @@ -267,6 +250,8 @@ ompi_mtl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &ompi_mtl_ofi.num_ofi_contexts); + opal_common_ofi_register_mca_variables(&mca_mtl_ofi_component.super.mtl_version); + return OMPI_SUCCESS; } @@ -311,6 +296,7 @@ ompi_mtl_ofi_component_query(mca_base_module_t **module, int *priority) static int ompi_mtl_ofi_component_close(void) { + opal_common_ofi_mca_deregister(); return OMPI_SUCCESS; } @@ -349,7 +335,7 @@ select_ofi_provider(struct fi_info *providers, if (NULL != include_list) { while ((NULL != prov) && (!is_in_list(include_list, prov->fabric_attr->prov_name))) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi: \"%s\" not in include list\n", __FILE__, __LINE__, prov->fabric_attr->prov_name); @@ -358,7 +344,7 @@ select_ofi_provider(struct fi_info *providers, } else if (NULL != exclude_list) { while ((NULL != prov) && (is_in_list(exclude_list, prov->fabric_attr->prov_name))) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi: \"%s\" in exclude list\n", __FILE__, __LINE__, prov->fabric_attr->prov_name); @@ -366,7 +352,7 @@ select_ofi_provider(struct fi_info *providers, } } - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi:prov: %s\n", __FILE__, __LINE__, (prov ? prov->fabric_attr->prov_name : "none")); @@ -396,6 +382,7 @@ select_ofi_provider(struct fi_info *providers, return prov; } + /* Check if FI_REMOTE_CQ_DATA is supported, if so send the source rank there * FI_DIRECTED_RECV is also needed so receives can discrimate the source */ @@ -481,7 +468,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { do { \ ompi_mtl_ofi.comm_to_context = calloc(arr_size, sizeof(int)); \ if (OPAL_UNLIKELY(!ompi_mtl_ofi.comm_to_context)) { \ - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + opal_output_verbose(1, opal_common_ofi.output, \ "%s:%d: alloc of comm_to_context array failed: %s\n",\ __FILE__, __LINE__, strerror(errno)); \ return ret; \ @@ -493,7 +480,7 @@ ompi_mtl_ofi_define_tag_mode(int ofi_tag_mode, int *bits_for_cid) { ompi_mtl_ofi.ofi_ctxt = (mca_mtl_ofi_context_t *) malloc(ompi_mtl_ofi.num_ofi_contexts * \ sizeof(mca_mtl_ofi_context_t)); \ if (OPAL_UNLIKELY(!ompi_mtl_ofi.ofi_ctxt)) { \ - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, \ + opal_output_verbose(1, opal_common_ofi.output, \ "%s:%d: alloc of ofi_ctxt array failed: %s\n", \ __FILE__, __LINE__, strerror(errno)); \ return ret; \ @@ -641,17 +628,19 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, int universe_size; char *univ_size_str; - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_common_ofi_mca_register(); + + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi:provider_include = \"%s\"\n", - __FILE__, __LINE__, prov_include); - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + __FILE__, __LINE__, *opal_common_ofi.prov_include); + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi:provider_exclude = \"%s\"\n", - __FILE__, __LINE__, prov_exclude); + __FILE__, __LINE__, *opal_common_ofi.prov_exclude); - if (NULL != prov_include) { - include_list = opal_argv_split(prov_include, ','); - } else if (NULL != prov_exclude) { - exclude_list = opal_argv_split(prov_exclude, ','); + if (NULL != *opal_common_ofi.prov_include) { + include_list = opal_argv_split(*opal_common_ofi.prov_include, ','); + } else if (NULL != *opal_common_ofi.prov_exclude) { + exclude_list = opal_argv_split(*opal_common_ofi.prov_exclude, ','); } /** @@ -666,7 +655,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, */ hints = fi_allocinfo(); if (!hints) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: Could not allocate fi_info\n", __FILE__, __LINE__); goto error; @@ -752,7 +741,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ret = fi_getinfo(fi_version, NULL, NULL, 0ULL, hints_dup, &providers); - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: EFA specific fi_getinfo(): %s\n", __FILE__, __LINE__, fi_strerror(-ret)); @@ -789,7 +778,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, hints, /* In: Hints to filter providers */ &providers); /* Out: List of matching providers */ - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: fi_getinfo(): %s\n", __FILE__, __LINE__, fi_strerror(-ret)); @@ -810,7 +799,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, */ prov = select_ofi_provider(providers, include_list, exclude_list); if (!prov) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: select_ofi_provider: no provider found\n", __FILE__, __LINE__); goto error; @@ -839,7 +828,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, /* Fallback to MTL_OFI_TAG_1 */ ompi_mtl_ofi_define_tag_mode(MTL_OFI_TAG_1, &ofi_tag_bits_for_cid); } else { /* MTL_OFI_TAG_FULL */ - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: OFI provider %s does not support FI_REMOTE_CQ_DATA\n", __FILE__, __LINE__, prov->fabric_attr->prov_name); goto error; @@ -919,7 +908,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, ompi_process_info.nodename, __FILE__, __LINE__); goto error; } else if (1 == sep_support_in_provider) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: Scalable EP supported in %s provider. Enabling in MTL.\n", __FILE__, __LINE__, prov->fabric_attr->prov_name); } @@ -1078,7 +1067,7 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, &ep_name, namelen); if (OMPI_SUCCESS != ret) { - opal_output_verbose(1, ompi_mtl_base_framework.framework_output, + opal_output_verbose(1, opal_common_ofi.output, "%s:%d: modex_send failed: %d\n", __FILE__, __LINE__, ret); goto error; diff --git a/opal/mca/btl/ofi/Makefile.am b/opal/mca/btl/ofi/Makefile.am index 65e7e3edf65..dd0c7caae90 100644 --- a/opal/mca/btl/ofi/Makefile.am +++ b/opal/mca/btl/ofi/Makefile.am @@ -13,6 +13,8 @@ # Copyright (c) 2013 NVIDIA Corporation. All rights reserved. # Copyright (c) 2017 IBM Corporation. All rights reserved. # Copyright (c) 2018 Intel, inc. All rights reserved +# Copyright (c) 2020 Triad National Security, LLC. All rights +# reserved. # $COPYRIGHT$ # # Additional copyrights may follow diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index c1675775c2b..470f0d76ac6 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -14,6 +14,9 @@ * reserved. * Copyright (c) 2018 Intel, Inc, All rights reserved * + * Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,7 +44,6 @@ #define MCA_BTL_OFI_REQUESTED_MR_MODE (FI_MR_ALLOCATED | FI_MR_PROV_KEY | FI_MR_VIRT_ADDR) -static char *prov_include; static char *ofi_progress_mode; static bool disable_sep; static int mca_btl_ofi_init_device(struct fi_info *info); @@ -107,20 +109,6 @@ static int mca_btl_ofi_component_register(void) MCA_BASE_VAR_SCOPE_READONLY, &mca_btl_ofi_component.mode); - /* fi_getinfo with prov_name == NULL means ALL provider. - * Since now we are using the first valid info returned, I'm not sure - * if we need to provide the support for comma limited provider list. */ - prov_include = NULL; - (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, - "provider_include", - "OFI provider that ofi btl will query for. This parameter only " - "accept ONE provider name. " - "(e.g., \"psm2\"; an empty value means that all providers will " - "be considered.", - MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, - OPAL_INFO_LVL_4, - MCA_BASE_VAR_SCOPE_READONLY, - &prov_include); mca_btl_ofi_component.num_cqe_read = MCA_BTL_OFI_NUM_CQE_READ; (void) mca_base_component_var_register(&mca_btl_ofi_component.super.btl_version, @@ -185,6 +173,8 @@ static int mca_btl_ofi_component_register(void) /* for now we want this component to lose to the MTL. */ module->super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_HIGH - 50; + opal_common_ofi_register_mca_variables(&mca_btl_ofi_component.super.btl_version); + return mca_btl_base_param_register (&mca_btl_ofi_component.super.btl_version, &module->super); } @@ -200,7 +190,8 @@ static int mca_btl_ofi_component_open(void) */ static int mca_btl_ofi_component_close(void) { - /* If we don't sleep, sockets provider freaks out. */ + opal_common_ofi_mca_deregister(); + /* If we don't sleep, sockets provider freaks out. Ummm this is a scary comment */ sleep(1); return OPAL_SUCCESS; } @@ -225,6 +216,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, uint64_t progress_mode; unsigned resource_count = 0; struct mca_btl_base_module_t **base_modules; + char **include_list = NULL; BTL_VERBOSE(("initializing ofi btl")); @@ -247,6 +239,8 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, struct fi_domain_attr domain_attr = {0}; uint64_t required_caps; + opal_common_ofi_mca_register(); + switch (mca_btl_ofi_component.mode) { case MCA_BTL_OFI_MODE_TWO_SIDED: @@ -266,8 +260,12 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, break; } - /* Select the provider */ - fabric_attr.prov_name = prov_include; + fabric_attr.prov_name = NULL; + /* Select the provider - sort of. we just take first element in list for now */ + if (NULL != *opal_common_ofi.prov_include) { + include_list = opal_argv_split(*opal_common_ofi.prov_include, ','); + fabric_attr.prov_name = include_list[0]; + } domain_attr.mr_mode = MCA_BTL_OFI_REQUESTED_MR_MODE; @@ -312,9 +310,13 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, rc = fi_getinfo(FI_VERSION(1, 5), NULL, NULL, 0, &hints, &info_list); if (0 != rc) { BTL_VERBOSE(("fi_getinfo failed with code %d: %s",rc, fi_strerror(-rc))); + if (NULL != include_list) { + opal_argv_free(include_list); + } return NULL; } + /* count the number of resources/ */ info = info_list; while(info) { @@ -356,6 +358,9 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, /* We are done with the returned info. */ fi_freeinfo(info_list); + if (NULL != include_list) { + opal_argv_free(include_list); + } /* pass module array back to caller */ base_modules = calloc (mca_btl_ofi_component.module_count, sizeof (*base_modules)); diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 074fb880ca6..9d6cc8ade2d 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -2,6 +2,8 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights + * reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -9,22 +11,110 @@ * $HEADER$ */ -#include "opal_config.h" -#include "opal/constants.h" -#include "opal/mca/hwloc/base/base.h" #include #include #include "common_ofi.h" +#include "opal_config.h" +#include "opal/constants.h" +#include "opal/util/argv.h" +#include "opal/mca/base/mca_base_var.h" +#include "opal/mca/base/mca_base_framework.h" +#include "opal/mca/hwloc/base/base.h" -int mca_common_ofi_register_mca_variables(void) +OPAL_DECLSPEC opal_common_ofi_module_t opal_common_ofi = { + .prov_include = NULL, + .prov_exclude = NULL, + .registered = 0, + .verbose = 0 +}; + +static const char default_prov_exclude_list[] = "shm,sockets,tcp,udp,rstream"; + +OPAL_DECLSPEC int opal_common_ofi_register_mca_variables(const mca_base_component_t *component) { - if (fi_version() >= FI_VERSION(1,0)) { - return OPAL_SUCCESS; - } else { + static int registered = 0; + static int include_index; + static int exclude_index; + static int verbose_index; + + if (fi_version() < FI_VERSION(1,0)) { return OPAL_ERROR; } + + if (!registered) { + /* + * this monkey business is needed because of the way the MCA VARs stuff tries to handle pointers to strings when + * when destructing the MCA var database. If you don't do something like this,the MCA var framework will try + * to dereference a pointer which itself is no longer a valid address owing to having been previously dlclosed. + */ + opal_common_ofi.prov_include = (char **)malloc(sizeof(char *)); + *opal_common_ofi.prov_include = NULL; + include_index = mca_base_var_register("opal", "opal_common", "ofi", + "provider_include", + "Comma-delimited list of OFI providers that are considered for use (e.g., \"psm,psm2\"; an empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_exclude.", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_1, + MCA_BASE_VAR_SCOPE_READONLY, + opal_common_ofi.prov_include); + opal_common_ofi.prov_exclude = (char **)malloc(sizeof(char *)); + *opal_common_ofi.prov_exclude = strdup(default_prov_exclude_list); + exclude_index = mca_base_var_register("opal", "opal_common", "ofi", + "provider_exclude", + "Comma-delimited list of OFI providers that are not considered for use (default: \"sockets,mxm\"; empty value means that all providers will be considered). Mutually exclusive with mtl_ofi_provider_include.", + MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, + OPAL_INFO_LVL_1, + MCA_BASE_VAR_SCOPE_READONLY, + opal_common_ofi.prov_exclude); + verbose_index = mca_base_var_register("opal", "opal_common", "ofi", "verbose", + "Verbose level of the OFI components", + MCA_BASE_VAR_TYPE_INT, NULL, 0, + MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_3, + MCA_BASE_VAR_SCOPE_LOCAL, + &opal_common_ofi.verbose); + registered = 1; + } + + if (component) { + mca_base_var_register_synonym(include_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "provider_include", 0); + mca_base_var_register_synonym(exclude_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "provider_exclude", 0); + mca_base_var_register_synonym(verbose_index, component->mca_project_name, + component->mca_type_name, + component->mca_component_name, + "verbose", 0); + } + + return OPAL_SUCCESS; +} + +OPAL_DECLSPEC void opal_common_ofi_mca_register(void) +{ + opal_common_ofi.registered++; + if (opal_common_ofi.registered > 1) { + opal_output_set_verbosity(opal_common_ofi.output, opal_common_ofi.verbose); + return; + } + + opal_common_ofi.output = opal_output_open(NULL); + opal_output_set_verbosity(opal_common_ofi.output, opal_common_ofi.verbose); +} + +OPAL_DECLSPEC void opal_common_ofi_mca_deregister(void) +{ + /* unregister only on last deregister */ + opal_common_ofi.registered--; + assert(opal_common_ofi.registered >= 0); + if (opal_common_ofi.registered) { + return; + } + opal_output_close(opal_common_ofi.output); } /* check that the tx attributes match */ diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h index 30f9f4f88a3..2745515dc6e 100644 --- a/opal/mca/common/ofi/common_ofi.h +++ b/opal/mca/common/ofi/common_ofi.h @@ -3,6 +3,9 @@ * Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2017 Los Alamos National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Triad National Security, LLC. All rights + * reserved. + * * $COPYRIGHT$ * * Additional copyrights may follow @@ -12,9 +15,31 @@ #ifndef OPAL_MCA_COMMON_OFI_H #define OPAL_MCA_COMMON_OFI_H + +#include "opal_config.h" +#include "opal/mca/base/mca_base_var.h" +#include "opal/mca/base/mca_base_framework.h" #include -OPAL_DECLSPEC int mca_common_ofi_register_mca_variables(void); +BEGIN_C_DECLS + +typedef struct opal_common_ofi_module { + char **prov_include; + char **prov_exclude; + int verbose; + int registered; + int output; +} opal_common_ofi_module_t; + +extern opal_common_ofi_module_t opal_common_ofi; + +OPAL_DECLSPEC int opal_common_ofi_register_mca_variables(const mca_base_component_t *component); +OPAL_DECLSPEC void opal_common_ofi_mca_register(void); +OPAL_DECLSPEC void opal_common_ofi_mca_deregister(void); +OPAL_DECLSPEC struct fi_info* opal_common_ofi_select_ofi_provider(struct fi_info *providers, + char *framework_name); + +END_C_DECLS struct fi_info* opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int rank); From d4219f814449846d0e29672101740cdcc8a89b0f Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Thu, 25 Jun 2020 16:16:58 +0200 Subject: [PATCH 626/674] OSC UCX: make sure no-op fetch in rget/rput is properly aligned Signed-off-by: Joseph Schuchart (cherry picked from commit c1f7776341254b825a1b5f12fb93088c73c2c2ef) --- ompi/mca/osc/ucx/osc_ucx_comm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/ucx/osc_ucx_comm.c b/ompi/mca/osc/ucx/osc_ucx_comm.c index adedae5c3ec..67c131771bd 100644 --- a/ompi/mca/osc/ucx/osc_ucx_comm.c +++ b/ompi/mca/osc/ucx/osc_ucx_comm.c @@ -904,9 +904,10 @@ int ompi_osc_ucx_rput(const void *origin_addr, int origin_count, return OMPI_ERROR; } + /* TODO: investigate whether ucp_worker_flush_nb is a better choice here */ internal_req = ucp_atomic_fetch_nb(ep, UCP_ATOMIC_FETCH_OP_FADD, 0, &(module->req_result), sizeof(uint64_t), - remote_addr, rkey, req_completion); + remote_addr & (~0x7), rkey, req_completion); if (UCS_PTR_IS_PTR(internal_req)) { internal_req->external_req = ucx_req; @@ -965,9 +966,10 @@ int ompi_osc_ucx_rget(void *origin_addr, int origin_count, return OMPI_ERROR; } + /* TODO: investigate whether ucp_worker_flush_nb is a better choice here */ internal_req = ucp_atomic_fetch_nb(ep, UCP_ATOMIC_FETCH_OP_FADD, 0, &(module->req_result), sizeof(uint64_t), - remote_addr, rkey, req_completion); + remote_addr & (~0x7), rkey, req_completion); if (UCS_PTR_IS_PTR(internal_req)) { internal_req->external_req = ucx_req; From ba221e1a082621fafec85a1f1f6955c9970e93bb Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Fri, 27 Jul 2018 09:34:17 +0700 Subject: [PATCH 627/674] coll/base/allgatherv: fix MPI_IN_PLACE processing The call of MPI_Allgatherv with sendbuf and sendtype parameters equal to MPI_IN_PLACE and NULL correspondingly, produces the segmentation fault. The problem is that sendtype is used even when sendbuf value is MPI_IN_PLACE. But according to the standard, sendtype and sendcount parameters should be ignored in this case. Signed-off-by: Mikhail Kurnosov (cherry picked from commit b45e190e6629b664872f7f872cfffd916180bb9a) Signed-off-by: Brian Barrett --- ompi/mca/coll/base/coll_base_allgatherv.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_allgatherv.c b/ompi/mca/coll/base/coll_base_allgatherv.c index 08762810db7..c3ced000a03 100644 --- a/ompi/mca/coll/base/coll_base_allgatherv.c +++ b/ompi/mca/coll/base/coll_base_allgatherv.c @@ -110,9 +110,6 @@ int ompi_coll_base_allgatherv_intra_bruck(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgather_intra_bruck rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -238,9 +235,6 @@ int ompi_coll_base_allgatherv_intra_ring(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgatherv_intra_ring rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -381,9 +375,6 @@ ompi_coll_base_allgatherv_intra_neighborexchange(const void *sbuf, int scount, OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "coll:base:allgatherv_intra_neighborexchange rank %d", rank)); - err = ompi_datatype_get_extent (sdtype, &slb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &rlb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } @@ -520,9 +511,6 @@ int ompi_coll_base_allgatherv_intra_two_procs(const void *sbuf, int scount, return MPI_ERR_UNSUPPORTED_OPERATION; } - err = ompi_datatype_get_extent (sdtype, &lb, &sext); - if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } - err = ompi_datatype_get_extent (rdtype, &lb, &rext); if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } From d9d84d5dd62732b4ce4f04e52abdc8527d2f9aa2 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Sep 2018 16:46:13 +0900 Subject: [PATCH 628/674] coll/libnbc: fix NBC_Unpack() always initialize 'size'. Only the a2a_sched_diss() alltoall algorithm is impacted, and this algo is currently unused, so there is no need to backport nor update the NEWS file for now. Signed-off-by: Gilles Gouaillardet (cherry picked from commit ff48e9286430b37aac3146efe2b355f255db94d5) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/nbc_internal.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ompi/mca/coll/libnbc/nbc_internal.h b/ompi/mca/coll/libnbc/nbc_internal.h index da9786dbb66..735beaa06e2 100644 --- a/ompi/mca/coll/libnbc/nbc_internal.h +++ b/ompi/mca/coll/libnbc/nbc_internal.h @@ -516,6 +516,11 @@ static inline int NBC_Unpack(void *src, int srccount, MPI_Datatype srctype, void int res; ptrdiff_t ext, lb; + res = ompi_datatype_pack_external_size("external32", srccount, srctype, &size); + if (OMPI_SUCCESS != res) { + NBC_Error ("MPI Error in ompi_datatype_pack_external_size() (%i)", res); + return res; + } #if OPAL_CUDA_SUPPORT if(NBC_Type_intrinsic(srctype) && !(opal_cuda_check_bufs((char *)tgt, (char *)src))) { #else @@ -523,7 +528,6 @@ static inline int NBC_Unpack(void *src, int srccount, MPI_Datatype srctype, void #endif /* OPAL_CUDA_SUPPORT */ /* if we have the same types and they are contiguous (intrinsic * types are contiguous), we can just use a single memcpy */ - res = ompi_datatype_pack_external_size("external32", srccount, srctype, &size); res = ompi_datatype_get_extent (srctype, &lb, &ext); if (OMPI_SUCCESS != res) { NBC_Error ("MPI Error in MPI_Type_extent() (%i)", res); From 2692840d40d8b76e796e73dc519cd4d135c43b7c Mon Sep 17 00:00:00 2001 From: Aurelien Bouteiller Date: Fri, 26 Jan 2018 14:21:13 -0500 Subject: [PATCH 629/674] Always return a valid error code from collective operations Signed-off-by: Aurelien Bouteiller (cherry picked from commit 466217fadda0391698b383f2792de7bcbdff7e97) Signed-off-by: Brian Barrett --- ompi/mca/coll/base/coll_base_allreduce.c | 6 ++- ompi/mca/coll/base/coll_base_alltoall.c | 21 +++++++- ompi/mca/coll/base/coll_base_alltoallv.c | 11 ++++- ompi/mca/coll/base/coll_base_barrier.c | 49 ++++++++++++++----- ompi/mca/coll/base/coll_base_bcast.c | 37 +++++++++++--- ompi/mca/coll/base/coll_base_gather.c | 9 ++++ ompi/mca/coll/base/coll_base_reduce.c | 30 +++++++++--- ompi/mca/coll/base/coll_base_reduce_scatter.c | 2 +- ompi/mca/coll/base/coll_base_util.c | 2 +- 9 files changed, 136 insertions(+), 31 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_allreduce.c b/ompi/mca/coll/base/coll_base_allreduce.c index eeb1d35fb45..828b32061a9 100644 --- a/ompi/mca/coll/base/coll_base_allreduce.c +++ b/ompi/mca/coll/base/coll_base_allreduce.c @@ -350,7 +350,7 @@ ompi_coll_base_allreduce_intra_ring(const void *sbuf, void *rbuf, int count, char *tmpsend = NULL, *tmprecv = NULL, *inbuf[2] = {NULL, NULL}; ptrdiff_t true_lb, true_extent, lb, extent; ptrdiff_t block_offset, max_real_segsize; - ompi_request_t *reqs[2] = {NULL, NULL}; + ompi_request_t *reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL}; size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); @@ -528,6 +528,7 @@ ompi_coll_base_allreduce_intra_ring(const void *sbuf, void *rbuf, int count, error_hndl: OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "%s:%4d\tRank %d Error occurred %d\n", __FILE__, line, rank, ret)); + ompi_coll_base_free_reqs(reqs, 2); (void)line; // silence compiler warning if (NULL != inbuf[0]) free(inbuf[0]); if (NULL != inbuf[1]) free(inbuf[1]); @@ -627,7 +628,7 @@ ompi_coll_base_allreduce_intra_ring_segmented(const void *sbuf, void *rbuf, int size_t typelng; char *tmpsend = NULL, *tmprecv = NULL, *inbuf[2] = {NULL, NULL}; ptrdiff_t block_offset, max_real_segsize; - ompi_request_t *reqs[2] = {NULL, NULL}; + ompi_request_t *reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL}; ptrdiff_t lb, extent, gap; size = ompi_comm_size(comm); @@ -847,6 +848,7 @@ ompi_coll_base_allreduce_intra_ring_segmented(const void *sbuf, void *rbuf, int error_hndl: OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "%s:%4d\tRank %d Error occurred %d\n", __FILE__, line, rank, ret)); + ompi_coll_base_free_reqs(reqs, 2); (void)line; // silence compiler warning if (NULL != inbuf[0]) free(inbuf[0]); if (NULL != inbuf[1]) free(inbuf[1]); diff --git a/ompi/mca/coll/base/coll_base_alltoall.c b/ompi/mca/coll/base/coll_base_alltoall.c index 3f1bdc5fb58..a61bf40ca97 100644 --- a/ompi/mca/coll/base/coll_base_alltoall.c +++ b/ompi/mca/coll/base/coll_base_alltoall.c @@ -393,6 +393,7 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount, if (0 < total_reqs) { reqs = ompi_coll_base_comm_get_reqs(module->base_data, 2 * total_reqs); if (NULL == reqs) { error = -1; line = __LINE__; goto error_hndl; } + reqs[0] = reqs[1] = MPI_REQUEST_NULL; } prcv = (char *) rbuf; @@ -468,6 +469,15 @@ int ompi_coll_base_alltoall_intra_linear_sync(const void *sbuf, int scount, return MPI_SUCCESS; error_hndl: + /* find a real error code */ + if (MPI_ERR_IN_STATUS == error) { + for( ri = 0; ri < nreqs; ri++ ) { + if (MPI_REQUEST_NULL == reqs[ri]) continue; + if (MPI_ERR_PENDING == reqs[ri]->req_status.MPI_ERROR) continue; + error = reqs[ri]->req_status.MPI_ERROR; + break; + } + } OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "%s:%4d\tError occurred %d, rank %2d", __FILE__, line, error, rank)); @@ -661,7 +671,16 @@ int ompi_coll_base_alltoall_intra_basic_linear(const void *sbuf, int scount, if (MPI_SUCCESS != err) { line = __LINE__; goto err_hndl; } err_hndl: - if( MPI_SUCCESS != err ) { + if (MPI_SUCCESS != err) { + /* find a real error code */ + if (MPI_ERR_IN_STATUS == err) { + for( i = 0; i < nreqs; i++ ) { + if (MPI_REQUEST_NULL == req[i]) continue; + if (MPI_ERR_PENDING == req[i]->req_status.MPI_ERROR) continue; + err = req[i]->req_status.MPI_ERROR; + break; + } + } OPAL_OUTPUT( (ompi_coll_base_framework.framework_output,"%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank) ); (void)line; // silence compiler warning diff --git a/ompi/mca/coll/base/coll_base_alltoallv.c b/ompi/mca/coll/base/coll_base_alltoallv.c index aec8b859444..dbe33e8eee4 100644 --- a/ompi/mca/coll/base/coll_base_alltoallv.c +++ b/ompi/mca/coll/base/coll_base_alltoallv.c @@ -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-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -276,6 +276,15 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts err = ompi_request_wait_all(nreqs, reqs, MPI_STATUSES_IGNORE); err_hndl: + /* find a real error code */ + if (MPI_ERR_IN_STATUS == err) { + for( i = 0; i < nreqs; i++ ) { + if (MPI_REQUEST_NULL == reqs[i]) continue; + if (MPI_ERR_PENDING == reqs[i]->req_status.MPI_ERROR) continue; + err = reqs[i]->req_status.MPI_ERROR; + break; + } + } /* Free the requests in all cases as they are persistent */ ompi_coll_base_free_reqs(reqs, nreqs); diff --git a/ompi/mca/coll/base/coll_base_barrier.c b/ompi/mca/coll/base/coll_base_barrier.c index a190f3be723..49ac4ea2e9e 100644 --- a/ompi/mca/coll/base/coll_base_barrier.c +++ b/ompi/mca/coll/base/coll_base_barrier.c @@ -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-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -102,8 +102,10 @@ int ompi_coll_base_barrier_intra_doublering(struct ompi_communicator_t *comm, { int rank, size, err = 0, line = 0, left, right; - rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); + if( 1 == size ) + return OMPI_SUCCESS; + rank = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output,"ompi_coll_base_barrier_intra_doublering rank %d", rank)); @@ -172,8 +174,10 @@ int ompi_coll_base_barrier_intra_recursivedoubling(struct ompi_communicator_t *c { int rank, size, adjsize, err, line, mask, remote; - rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); + if( 1 == size ) + return OMPI_SUCCESS; + rank = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "ompi_coll_base_barrier_intra_recursivedoubling rank %d", rank)); @@ -251,8 +255,10 @@ int ompi_coll_base_barrier_intra_bruck(struct ompi_communicator_t *comm, { int rank, size, distance, to, from, err, line = 0; - rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); + if( 1 == size ) + return MPI_SUCCESS; + rank = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "ompi_coll_base_barrier_intra_bruck rank %d", rank)); @@ -285,16 +291,19 @@ int ompi_coll_base_barrier_intra_bruck(struct ompi_communicator_t *comm, int ompi_coll_base_barrier_intra_two_procs(struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int remote, err; + int remote, size, err; + + size = ompi_comm_size(comm); + if( 1 == size ) + return MPI_SUCCESS; + if( 2 != ompi_comm_size(comm) ) { + return MPI_ERR_UNSUPPORTED_OPERATION; + } remote = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "ompi_coll_base_barrier_intra_two_procs rank %d", remote)); - if (2 != ompi_comm_size(comm)) { - return MPI_ERR_UNSUPPORTED_OPERATION; - } - remote = (remote + 1) & 0x1; err = ompi_coll_base_sendrecv_zero(remote, MCA_COLL_BASE_TAG_BARRIER, @@ -324,8 +333,10 @@ int ompi_coll_base_barrier_intra_basic_linear(struct ompi_communicator_t *comm, int i, err, rank, size, line; ompi_request_t** requests = NULL; - rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); + if( 1 == size ) + return MPI_SUCCESS; + rank = ompi_comm_rank(comm); /* All non-root send & receive zero-length message. */ if (rank > 0) { @@ -367,11 +378,21 @@ int ompi_coll_base_barrier_intra_basic_linear(struct ompi_communicator_t *comm, /* All done */ return MPI_SUCCESS; err_hndl: + if( NULL != requests ) { + /* find a real error code */ + if (MPI_ERR_IN_STATUS == err) { + for( i = 0; i < size; i++ ) { + if (MPI_REQUEST_NULL == requests[i]) continue; + if (MPI_ERR_PENDING == requests[i]->req_status.MPI_ERROR) continue; + err = requests[i]->req_status.MPI_ERROR; + break; + } + } + ompi_coll_base_free_reqs(requests, size); + } OPAL_OUTPUT( (ompi_coll_base_framework.framework_output,"%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank) ); (void)line; // silence compiler warning - if( NULL != requests ) - ompi_coll_base_free_reqs(requests, size); return err; } /* copied function (with appropriate renaming) ends here */ @@ -385,8 +406,10 @@ int ompi_coll_base_barrier_intra_tree(struct ompi_communicator_t *comm, { int rank, size, depth, err, jump, partner; - rank = ompi_comm_rank(comm); size = ompi_comm_size(comm); + if( 1 == size ) + return MPI_SUCCESS; + rank = ompi_comm_rank(comm); OPAL_OUTPUT((ompi_coll_base_framework.framework_output, "ompi_coll_base_barrier_intra_tree %d", rank)); diff --git a/ompi/mca/coll/base/coll_base_bcast.c b/ompi/mca/coll/base/coll_base_bcast.c index a35e18fa9c8..9a235051967 100644 --- a/ompi/mca/coll/base/coll_base_bcast.c +++ b/ompi/mca/coll/base/coll_base_bcast.c @@ -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-2017 The University of Tennessee and The University * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, @@ -214,13 +214,29 @@ ompi_coll_base_bcast_intra_generic( void* buffer, return (MPI_SUCCESS); error_hndl: - OPAL_OUTPUT( (ompi_coll_base_framework.framework_output,"%s:%4d\tError occurred %d, rank %2d", - __FILE__, line, err, rank) ); - (void)line; // silence compiler warnings + if (MPI_ERR_IN_STATUS == err) { + for( req_index = 0; req_index < 2; req_index++ ) { + if (MPI_REQUEST_NULL == recv_reqs[req_index]) continue; + if (MPI_ERR_PENDING == recv_reqs[req_index]->req_status.MPI_ERROR) continue; + err = recv_reqs[req_index]->req_status.MPI_ERROR; + break; + } + } ompi_coll_base_free_reqs( recv_reqs, 2); if( NULL != send_reqs ) { + if (MPI_ERR_IN_STATUS == err) { + for( req_index = 0; req_index < tree->tree_nextsize; req_index++ ) { + if (MPI_REQUEST_NULL == send_reqs[req_index]) continue; + if (MPI_ERR_PENDING == send_reqs[req_index]->req_status.MPI_ERROR) continue; + err = send_reqs[req_index]->req_status.MPI_ERROR; + break; + } + } ompi_coll_base_free_reqs(send_reqs, tree->tree_nextsize); } + OPAL_OUTPUT( (ompi_coll_base_framework.framework_output,"%s:%4d\tError occurred %d, rank %2d", + __FILE__, line, err, rank) ); + (void)line; // silence compiler warnings return err; } @@ -649,12 +665,21 @@ ompi_coll_base_bcast_intra_basic_linear(void *buff, int count, * care what the error was -- just that there *was* an error. The * PML will finish all requests, even if one or more of them fail. * i.e., by the end of this call, all the requests are free-able. - * So free them anyway -- even if there was an error, and return - * the error after we free everything. */ + * So free them anyway -- even if there was an error. + * Note we still need to get the actual error, as collective + * operations cannot return MPI_ERR_IN_STATUS. + */ err = ompi_request_wait_all(i, reqs, MPI_STATUSES_IGNORE); err_hndl: if( MPI_SUCCESS != err ) { /* Free the reqs */ + /* first find the real error code */ + for( preq = reqs; preq < reqs+i; preq++ ) { + if (MPI_REQUEST_NULL == *preq) continue; + if (MPI_ERR_PENDING == (*preq)->req_status.MPI_ERROR) continue; + err = (*preq)->req_status.MPI_ERROR; + break; + } ompi_coll_base_free_reqs(reqs, i); } diff --git a/ompi/mca/coll/base/coll_base_gather.c b/ompi/mca/coll/base/coll_base_gather.c index 8d5ab70d708..6fd1e981461 100644 --- a/ompi/mca/coll/base/coll_base_gather.c +++ b/ompi/mca/coll/base/coll_base_gather.c @@ -326,6 +326,15 @@ ompi_coll_base_gather_intra_linear_sync(const void *sbuf, int scount, return MPI_SUCCESS; error_hndl: if (NULL != reqs) { + /* find a real error code */ + if (MPI_ERR_IN_STATUS == ret) { + for( i = 0; i < size; i++ ) { + if (MPI_REQUEST_NULL == reqs[i]) continue; + if (MPI_ERR_PENDING == reqs[i]->req_status.MPI_ERROR) continue; + ret = reqs[i]->req_status.MPI_ERROR; + break; + } + } ompi_coll_base_free_reqs(reqs, size); } OPAL_OUTPUT (( ompi_coll_base_framework.framework_output, diff --git a/ompi/mca/coll/base/coll_base_reduce.c b/ompi/mca/coll/base/coll_base_reduce.c index 82838ddbcd5..dfd709bfb90 100644 --- a/ompi/mca/coll/base/coll_base_reduce.c +++ b/ompi/mca/coll/base/coll_base_reduce.c @@ -338,16 +338,34 @@ int ompi_coll_base_reduce_generic( const void* sendbuf, void* recvbuf, int origi return OMPI_SUCCESS; error_hndl: /* error handler */ + /* find a real error code */ + if (MPI_ERR_IN_STATUS == ret) { + for( i = 0; i < 2; i++ ) { + if (MPI_REQUEST_NULL == reqs[i]) continue; + if (MPI_ERR_PENDING == reqs[i]->req_status.MPI_ERROR) continue; + ret = reqs[i]->req_status.MPI_ERROR; + break; + } + } + ompi_coll_base_free_reqs(reqs, 2); + if( NULL != sreq ) { + if (MPI_ERR_IN_STATUS == ret) { + for( i = 0; i < max_outstanding_reqs; i++ ) { + if (MPI_REQUEST_NULL == sreq[i]) continue; + if (MPI_ERR_PENDING == sreq[i]->req_status.MPI_ERROR) continue; + ret = sreq[i]->req_status.MPI_ERROR; + break; + } + } + ompi_coll_base_free_reqs(sreq, max_outstanding_reqs); + } + if( inbuf_free[0] != NULL ) free(inbuf_free[0]); + if( inbuf_free[1] != NULL ) free(inbuf_free[1]); + if( accumbuf_free != NULL ) free(accumbuf); OPAL_OUTPUT (( ompi_coll_base_framework.framework_output, "ERROR_HNDL: node %d file %s line %d error %d\n", rank, __FILE__, line, ret )); (void)line; // silence compiler warning - if( inbuf_free[0] != NULL ) free(inbuf_free[0]); - if( inbuf_free[1] != NULL ) free(inbuf_free[1]); - if( accumbuf_free != NULL ) free(accumbuf); - if( NULL != sreq ) { - ompi_coll_base_free_reqs(sreq, max_outstanding_reqs); - } return ret; } diff --git a/ompi/mca/coll/base/coll_base_reduce_scatter.c b/ompi/mca/coll/base/coll_base_reduce_scatter.c index 948a17376c0..984a91787a0 100644 --- a/ompi/mca/coll/base/coll_base_reduce_scatter.c +++ b/ompi/mca/coll/base/coll_base_reduce_scatter.c @@ -464,7 +464,7 @@ ompi_coll_base_reduce_scatter_intra_ring( const void *sbuf, void *rbuf, const in char *tmpsend = NULL, *tmprecv = NULL, *accumbuf = NULL, *accumbuf_free = NULL; char *inbuf_free[2] = {NULL, NULL}, *inbuf[2] = {NULL, NULL}; ptrdiff_t extent, max_real_segsize, dsize, gap = 0; - ompi_request_t *reqs[2] = {NULL, NULL}; + ompi_request_t *reqs[2] = {MPI_REQUEST_NULL, MPI_REQUEST_NULL}; size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); diff --git a/ompi/mca/coll/base/coll_base_util.c b/ompi/mca/coll/base/coll_base_util.c index 5736c0946ff..422894e45ff 100644 --- a/ompi/mca/coll/base/coll_base_util.c +++ b/ompi/mca/coll/base/coll_base_util.c @@ -42,7 +42,7 @@ int ompi_coll_base_sendrecv_actual( const void* sendbuf, size_t scount, { /* post receive first, then send, then wait... should be fast (I hope) */ int err, line = 0; size_t rtypesize, stypesize; - ompi_request_t *req; + ompi_request_t *req = MPI_REQUEST_NULL; ompi_status_public_t rstatus; /* post new irecv */ From 547fb3d933113b4029a0eba9082382e421fa502a Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 12 Sep 2018 11:43:54 -0400 Subject: [PATCH 630/674] libnbc: remove some stale/dead code Gcc 8 identified hb_tree_csearch() as an infinite recursion, and it turns out that we never call this function, anyway. So just remove it. Fixes #5670. Signed-off-by: Jeff Squyres (cherry picked from commit 06c1bf73da875f4a6449f38a993530d6fae7817d) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/libdict/dict.h | 2 -- ompi/mca/coll/libnbc/libdict/dict_private.h | 1 - ompi/mca/coll/libnbc/libdict/hb_tree.c | 7 ------- ompi/mca/coll/libnbc/libdict/hb_tree.h | 1 - 4 files changed, 11 deletions(-) diff --git a/ompi/mca/coll/libnbc/libdict/dict.h b/ompi/mca/coll/libnbc/libdict/dict.h index 4680b2bc2cf..61f213ebaf8 100644 --- a/ompi/mca/coll/libnbc/libdict/dict.h +++ b/ompi/mca/coll/libnbc/libdict/dict.h @@ -62,7 +62,6 @@ struct dict { int (*_insert) __P((void *obj, void *k, void *d, int ow)); int (*_probe) __P((void *obj, void *key, void **dat)); void *(*_search) __P((void *obj, const void *k)); - const void *(*_csearch) __P((const void *obj, const void *k)); int (*_remove) __P((void *obj, const void *key, int del)); void (*_walk) __P((void *obj, dict_vis_func func)); unsigned (*_count) __P((const void *obj)); @@ -75,7 +74,6 @@ struct dict { #define dict_insert(dct,k,d,o) (dct)->_insert((dct)->_object, (k), (d), (o)) #define dict_probe(dct,k,d) (dct)->_probe((dct)->_object, (k), (d)) #define dict_search(dct,k) (dct)->_search((dct)->_object, (k)) -#define dict_csearch(dct,k) (dct)->_csearch((dct)->_object, (k)) #define dict_remove(dct,k,del) (dct)->_remove((dct)->_object, (k), (del)) #define dict_walk(dct,f) (dct)->_walk((dct)->_object, (f)) #define dict_count(dct) (dct)->_count((dct)->_object) diff --git a/ompi/mca/coll/libnbc/libdict/dict_private.h b/ompi/mca/coll/libnbc/libdict/dict_private.h index da2b6dbdeab..3635f58700b 100644 --- a/ompi/mca/coll/libnbc/libdict/dict_private.h +++ b/ompi/mca/coll/libnbc/libdict/dict_private.h @@ -15,7 +15,6 @@ typedef int (*insert_func) __P((void *, void *k, void *d, int o)); typedef int (*probe_func) __P((void *, void *k, void **d)); typedef void *(*search_func) __P((void *, const void *k)); -typedef const void *(*csearch_func) __P((const void *, const void *k)); typedef int (*remove_func) __P((void *, const void *k, int d)); typedef void (*walk_func) __P((void *, dict_vis_func visit)); typedef unsigned (*count_func) __P((const void *)); diff --git a/ompi/mca/coll/libnbc/libdict/hb_tree.c b/ompi/mca/coll/libnbc/libdict/hb_tree.c index c3837ed3cb2..4b454c44574 100644 --- a/ompi/mca/coll/libnbc/libdict/hb_tree.c +++ b/ompi/mca/coll/libnbc/libdict/hb_tree.c @@ -90,7 +90,6 @@ hb_dict_new(dict_cmp_func key_cmp, dict_del_func key_del, dct->_insert = (insert_func)hb_tree_insert; dct->_probe = (probe_func)hb_tree_probe; dct->_search = (search_func)hb_tree_search; - dct->_csearch = (csearch_func)hb_tree_csearch; dct->_remove = (remove_func)hb_tree_remove; dct->_empty = (empty_func)hb_tree_empty; dct->_walk = (walk_func)hb_tree_walk; @@ -170,12 +169,6 @@ hb_tree_search(hb_tree *tree, const void *key) return NULL; } -const void * -hb_tree_csearch(const hb_tree *tree, const void *key) -{ - return hb_tree_csearch((hb_tree *)tree, key); -} - int hb_tree_insert(hb_tree *tree, void *key, void *dat, int overwrite) { diff --git a/ompi/mca/coll/libnbc/libdict/hb_tree.h b/ompi/mca/coll/libnbc/libdict/hb_tree.h index 2de8af6d190..8be94e14538 100644 --- a/ompi/mca/coll/libnbc/libdict/hb_tree.h +++ b/ompi/mca/coll/libnbc/libdict/hb_tree.h @@ -26,7 +26,6 @@ void hb_tree_destroy __P((hb_tree *tree, int del)); int hb_tree_insert __P((hb_tree *tree, void *key, void *dat, int overwrite)); int hb_tree_probe __P((hb_tree *tree, void *key, void **dat)); void *hb_tree_search __P((hb_tree *tree, const void *key)); -const void *hb_tree_csearch __P((const hb_tree *tree, const void *key)); int hb_tree_remove __P((hb_tree *tree, const void *key, int del)); void hb_tree_empty __P((hb_tree *tree, int del)); void hb_tree_walk __P((hb_tree *tree, dict_vis_func visit)); From 65990af3ad963147f15b241391e064057a0195ea Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Thu, 20 Sep 2018 09:46:59 +0700 Subject: [PATCH 631/674] coll/libnbc: add recursive doubling algorithm for MPI_Iscan Implements recursive doubling algorithm for MPI_Iscan. The algorithm preserves order of operations so it can be used both by commutative and non-commutative operations. The MCA parameter coll_libnbc_iscan_algorithm was added for dynamic algorithm selection. Signed-off-by: Mikhail Kurnosov (cherry picked from commit 3d43ff0f3209d5bf4713c6696acb0acb8f1756e4) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 1 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 19 ++ ompi/mca/coll/libnbc/nbc_iscan.c | 270 ++++++++++++++----- 3 files changed, 225 insertions(+), 65 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 17abf86f2ab..813af02e5ef 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -70,6 +70,7 @@ BEGIN_C_DECLS #define NBC_NUM_COLL 17 extern bool libnbc_ibcast_skip_dt_decision; +extern int libnbc_iscan_algorithm; struct ompi_coll_libnbc_component_t { mca_coll_base_component_2_0_0_t super; diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 2e23d2b7391..36b6cd48c61 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -46,6 +46,13 @@ static int libnbc_priority = 10; static bool libnbc_in_progress = false; /* protect from recursive calls */ bool libnbc_ibcast_skip_dt_decision = true; +int libnbc_iscan_algorithm = 0; /* iscan user forced algorithm */ +static mca_base_var_enum_value_t iscan_algorithms[] = { + {0, "ignore"}, + {1, "linear"}, + {2, "recursive_doubling"}, + {0, NULL} +}; static int libnbc_open(void); static int libnbc_close(void); @@ -128,6 +135,8 @@ libnbc_close(void) static int libnbc_register(void) { + mca_base_var_enum_t *new_enum = NULL; + /* Use a low priority, but allow other components to be lower */ libnbc_priority = 10; (void) mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, @@ -158,6 +167,16 @@ libnbc_register(void) MCA_BASE_VAR_SCOPE_READONLY, &libnbc_ibcast_skip_dt_decision); + libnbc_iscan_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_iscan_algorithms", iscan_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "iscan_algorithm", + "Which iscan algorithm is used: 0 ignore, 1 linear, 2 recursive_doubling", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_iscan_algorithm); + OBJ_RELEASE(new_enum); + return OMPI_SUCCESS; } diff --git a/ompi/mca/coll/libnbc/nbc_iscan.c b/ompi/mca/coll/libnbc/nbc_iscan.c index 33374ede7ae..0fdecd40c02 100644 --- a/ompi/mca/coll/libnbc/nbc_iscan.c +++ b/ompi/mca/coll/libnbc/nbc_iscan.c @@ -18,8 +18,20 @@ * Author(s): Torsten Hoefler * */ +#include "opal/include/opal/align.h" +#include "ompi/op/op.h" + #include "nbc_internal.h" +static inline int scan_sched_linear( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, NBC_Schedule *schedule, + void *tmpbuf); +static inline int scan_sched_recursivedoubling( + int rank, int comm_size, const void *sendbuf, void *recvbuf, + int count, MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf1, void *tmpbuf2); + #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { @@ -39,27 +51,41 @@ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { } #endif -/* linear iscan - * working principle: - * 1. each node (but node 0) receives from left neighbor - * 2. performs op - * 3. all but rank p-1 do sends to it's right neighbor and exits - * - */ static int nbc_scan_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module, bool persistent) { - int rank, p, res; - ptrdiff_t gap, span; - NBC_Schedule *schedule; - void *tmpbuf = NULL; - char inplace; - ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; + int rank, p, res; + ptrdiff_t gap, span; + NBC_Schedule *schedule; + void *tmpbuf = NULL, *tmpbuf1 = NULL, *tmpbuf2 = NULL; + enum { NBC_SCAN_LINEAR, NBC_SCAN_RDBL } alg; + char inplace; + ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; + + NBC_IN_PLACE(sendbuf, recvbuf, inplace); - NBC_IN_PLACE(sendbuf, recvbuf, inplace); + rank = ompi_comm_rank (comm); + p = ompi_comm_size (comm); - rank = ompi_comm_rank (comm); - p = ompi_comm_size (comm); + if (count == 0) { + return nbc_get_noop_request(persistent, request); + } + + span = opal_datatype_span(&datatype->super, count, &gap); + if (libnbc_iscan_algorithm == 2) { + alg = NBC_SCAN_RDBL; + ptrdiff_t span_align = OPAL_ALIGN(span, datatype->super.align, ptrdiff_t); + tmpbuf = malloc(span_align + span); + if (NULL == tmpbuf) { return OMPI_ERR_OUT_OF_RESOURCE; } + tmpbuf1 = (void *)(-gap); + tmpbuf2 = (char *)(span_align) - gap; + } else { + alg = NBC_SCAN_LINEAR; + if (rank > 0) { + tmpbuf = malloc(span); + if (NULL == tmpbuf) { return OMPI_ERR_OUT_OF_RESOURCE; } + } + } #ifdef NBC_CACHE_SCHEDULE NBC_Scan_args *args, *found, search; @@ -75,60 +101,28 @@ static int nbc_scan_init(const void* sendbuf, void* recvbuf, int count, MPI_Data #endif schedule = OBJ_NEW(NBC_Schedule); if (OPAL_UNLIKELY(NULL == schedule)) { - return OMPI_ERR_OUT_OF_RESOURCE; + free(tmpbuf); + return OMPI_ERR_OUT_OF_RESOURCE; } - if (!inplace) { - /* copy data to receivebuf */ - res = NBC_Sched_copy ((void *)sendbuf, false, count, datatype, - recvbuf, false, count, datatype, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - return res; - } + if (alg == NBC_SCAN_LINEAR) { + res = scan_sched_linear(rank, p, sendbuf, recvbuf, count, datatype, + op, inplace, schedule, tmpbuf); + } else { + res = scan_sched_recursivedoubling(rank, p, sendbuf, recvbuf, count, + datatype, op, inplace, schedule, tmpbuf1, tmpbuf2); } - - if(rank != 0) { - span = opal_datatype_span(&datatype->super, count, &gap); - tmpbuf = malloc (span); - if (NULL == tmpbuf) { - OBJ_RELEASE(schedule); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - /* we have to wait until we have the data */ - res = NBC_Sched_recv ((void *)(-gap), true, count, datatype, rank-1, schedule, true); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - - /* perform the reduce in my local buffer */ - /* this cannot be done until tmpbuf is unused :-( so barrier after the op */ - res = NBC_Sched_op ((void *)(-gap), true, recvbuf, false, count, datatype, op, schedule, - true); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); return res; - } } - if (rank != p-1) { - res = NBC_Sched_send (recvbuf, false, count, datatype, rank+1, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + res = NBC_Sched_commit(schedule); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); free(tmpbuf); return res; - } - } - - res = NBC_Sched_commit (schedule); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; } #ifdef NBC_CACHE_SCHEDULE @@ -162,14 +156,160 @@ static int nbc_scan_init(const void* sendbuf, void* recvbuf, int count, MPI_Data } #endif - res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); + res = NBC_Schedule_request(schedule, comm, libnbc_module, persistent, request, tmpbuf); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + OBJ_RELEASE(schedule); + free(tmpbuf); + return res; + } + + return OMPI_SUCCESS; +} + +/* + * scan_sched_linear: + * + * Function: Linear algorithm for inclusive scan. + * Accepts: Same as MPI_Iscan + * Returns: MPI_SUCCESS or error code + * + * Working principle: + * 1. Each process (but process 0) receives from left neighbor + * 2. Performs op + * 3. All but rank p-1 do sends to it's right neighbor and exits + * + * Schedule length: O(1) + */ +static inline int scan_sched_linear( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, NBC_Schedule *schedule, + void *tmpbuf) +{ + int res = OMPI_SUCCESS; + + if (!inplace) { + /* Copy data to recvbuf */ + res = NBC_Sched_copy((void *)sendbuf, false, count, datatype, + recvbuf, false, count, datatype, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + + if (rank > 0) { + ptrdiff_t gap; + opal_datatype_span(&datatype->super, count, &gap); + /* We have to wait until we have the data */ + res = NBC_Sched_recv((void *)(-gap), true, count, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Perform the reduce in my local buffer */ + /* this cannot be done until tmpbuf is unused :-( so barrier after the op */ + res = NBC_Sched_op((void *)(-gap), true, recvbuf, false, count, datatype, op, schedule, + true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + + if (rank != comm_size - 1) { + res = NBC_Sched_send(recvbuf, false, count, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + +cleanup_and_return: return res; - } +} - return OMPI_SUCCESS; +/* + * scan_sched_recursivedoubling: + * + * Function: Recursive doubling algorithm for inclusive scan. + * Accepts: Same as MPI_Iscan + * Returns: MPI_SUCCESS or error code + * + * Description: Implements recursive doubling algorithm for MPI_Iscan. + * The algorithm preserves order of operations so it can + * be used both by commutative and non-commutative operations. + * + * Example for 5 processes and commutative operation MPI_SUM: + * Process: 0 1 2 3 4 + * recvbuf: [0] [1] [2] [3] [4] + * psend: [0] [1] [2] [3] [4] + * + * Step 1: + * recvbuf: [0] [0+1] [2] [2+3] [4] + * psend: [1+0] [0+1] [3+2] [2+3] [4] + * + * Step 2: + * recvbuf: [0] [0+1] [(1+0)+2] [(1+0)+(2+3)] [4] + * psend: [(3+2)+(1+0)] [(2+3)+(0+1)] [(1+0)+(3+2)] [(1+0)+(2+3)] [4] + * + * Step 3: + * recvbuf: [0] [0+1] [(1+0)+2] [(1+0)+(2+3)] [((3+2)+(1+0))+4] + * psend: [4+((3+2)+(1+0))] [((3+2)+(1+0))+4] + * + * Time complexity (worst case): \ceil(\log_2(p))(2\alpha + 2m\beta + 2m\gamma) + * Memory requirements (per process): 2 * count * typesize = O(count) + * Limitations: intra-communicators only + * Schedule length: O(log(p)) + */ +static inline int scan_sched_recursivedoubling( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf1, void *tmpbuf2) +{ + int res = OMPI_SUCCESS; + + if (!inplace) { + res = NBC_Sched_copy((void *)sendbuf, false, count, datatype, + recvbuf, false, count, datatype, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + if (comm_size < 2) + goto cleanup_and_return; + + char *psend = (char *)tmpbuf1; + char *precv = (char *)tmpbuf2; + res = NBC_Sched_copy(recvbuf, false, count, datatype, + psend, true, count, datatype, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + int is_commute = ompi_op_is_commute(op); + for (int mask = 1; mask < comm_size; mask <<= 1) { + int remote = rank ^ mask; + if (remote < comm_size) { + res = NBC_Sched_send(psend, true, count, datatype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv(precv, true, count, datatype, remote, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + if (rank > remote) { + /* Accumulate prefix reduction: recvbuf = precv recvbuf */ + res = NBC_Sched_op(precv, true, recvbuf, false, count, + datatype, op, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* Partial result: psend = precv psend */ + res = NBC_Sched_op(precv, true, psend, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } else { + if (is_commute) { + /* psend = precv psend */ + res = NBC_Sched_op(precv, true, psend, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } else { + /* precv = psend precv */ + res = NBC_Sched_op(psend, true, precv, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + char *tmp = psend; + psend = precv; + precv = tmp; + } + } + } + } + + cleanup_and_return: + return res; } int ompi_coll_libnbc_iscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, From de5e435dee3383e265df45d75486c78a721a179a Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Mon, 17 Sep 2018 10:21:02 +0700 Subject: [PATCH 632/674] coll/libnbc: add recursive doubling algorithm for MPI_Iexscan Implements recursive doubling algorithm for MPI_Iexscan. The algorithm preserves order of operations so it can be used both by commutative and non-commutative operations. The MCA parameter 'coll_libnbc_iexscan_algorithm' was added for dynamic algorithm selection. Signed-off-by: Mikhail Kurnosov (cherry picked from commit dfe203e167f5d8abc3b55226c6f17a468c9567dd) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 1 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 18 ++ ompi/mca/coll/libnbc/nbc_iexscan.c | 316 +++++++++++++------ 3 files changed, 245 insertions(+), 90 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 813af02e5ef..578a50946fb 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -70,6 +70,7 @@ BEGIN_C_DECLS #define NBC_NUM_COLL 17 extern bool libnbc_ibcast_skip_dt_decision; +extern int libnbc_iexscan_algorithm; extern int libnbc_iscan_algorithm; struct ompi_coll_libnbc_component_t { diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 36b6cd48c61..df75ac3706c 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -46,6 +46,14 @@ static int libnbc_priority = 10; static bool libnbc_in_progress = false; /* protect from recursive calls */ bool libnbc_ibcast_skip_dt_decision = true; +int libnbc_iexscan_algorithm = 0; /* iexscan user forced algorithm */ +static mca_base_var_enum_value_t iexscan_algorithms[] = { + {0, "ignore"}, + {1, "linear"}, + {2, "recursive_doubling"}, + {0, NULL} +}; + int libnbc_iscan_algorithm = 0; /* iscan user forced algorithm */ static mca_base_var_enum_value_t iscan_algorithms[] = { {0, "ignore"}, @@ -167,6 +175,16 @@ libnbc_register(void) MCA_BASE_VAR_SCOPE_READONLY, &libnbc_ibcast_skip_dt_decision); + libnbc_iexscan_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_iexscan_algorithms", iexscan_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "iexscan_algorithm", + "Which iexscan algorithm is used: 0 ignore, 1 linear, 2 recursive_doubling", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_iexscan_algorithm); + OBJ_RELEASE(new_enum); + libnbc_iscan_algorithm = 0; (void) mca_base_var_enum_create("coll_libnbc_iscan_algorithms", iscan_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, diff --git a/ompi/mca/coll/libnbc/nbc_iexscan.c b/ompi/mca/coll/libnbc/nbc_iexscan.c index 90a6b6bf27f..fccf89d3eb8 100644 --- a/ompi/mca/coll/libnbc/nbc_iexscan.c +++ b/ompi/mca/coll/libnbc/nbc_iexscan.c @@ -18,8 +18,20 @@ * Author(s): Torsten Hoefler * */ +#include "opal/include/opal/align.h" +#include "ompi/op/op.h" + #include "nbc_internal.h" +static inline int exscan_sched_linear( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, NBC_Schedule *schedule, + void *tmpbuf); +static inline int exscan_sched_recursivedoubling( + int rank, int comm_size, const void *sendbuf, void *recvbuf, + int count, MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf1, void *tmpbuf2); + #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { @@ -39,32 +51,44 @@ int NBC_Scan_args_compare(NBC_Scan_args *a, NBC_Scan_args *b, void *param) { } #endif -/* linear iexscan - * working principle: - * 1. each node (but node 0) receives from left neigbor - * 2. performs op - * 3. all but rank p-1 do sends to it's right neigbor and exits - * - */ static int nbc_exscan_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module, bool persistent) { int rank, p, res; - ptrdiff_t gap, span; NBC_Schedule *schedule; -#ifdef NBC_CACHE_SCHEDULE - NBC_Scan_args *args, *found, search; -#endif char inplace; - void *tmpbuf = NULL; + void *tmpbuf = NULL, *tmpbuf1 = NULL, *tmpbuf2 = NULL; + enum { NBC_EXSCAN_LINEAR, NBC_EXSCAN_RDBL } alg; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; + ptrdiff_t span, gap; NBC_IN_PLACE(sendbuf, recvbuf, inplace); - rank = ompi_comm_rank (comm); - p = ompi_comm_size (comm); + rank = ompi_comm_rank(comm); + p = ompi_comm_size(comm); + + if (p < 2) { + return nbc_get_noop_request(persistent, request); + } + + span = opal_datatype_span(&datatype->super, count, &gap); + if (libnbc_iexscan_algorithm == 2) { + alg = NBC_EXSCAN_RDBL; + ptrdiff_t span_align = OPAL_ALIGN(span, datatype->super.align, ptrdiff_t); + tmpbuf = malloc(span_align + span); + if (NULL == tmpbuf) { return OMPI_ERR_OUT_OF_RESOURCE; } + tmpbuf1 = (void *)(-gap); + tmpbuf2 = (char *)(span_align) - gap; + } else { + alg = NBC_EXSCAN_LINEAR; + if (rank > 0) { + tmpbuf = malloc(span); + if (NULL == tmpbuf) { return OMPI_ERR_OUT_OF_RESOURCE; } + } + } #ifdef NBC_CACHE_SCHEDULE + NBC_Scan_args *args, *found, search; /* search schedule in communicator specific tree */ search.sendbuf = sendbuf; search.recvbuf = recvbuf; @@ -74,84 +98,31 @@ static int nbc_exscan_init(const void* sendbuf, void* recvbuf, int count, MPI_Da found = (NBC_Scan_args *) hb_tree_search ((hb_tree *) libnbc_module->NBC_Dict[NBC_EXSCAN], &search); if (NULL == found) { #endif - schedule = OBJ_NEW(NBC_Schedule); - if (OPAL_UNLIKELY(NULL == schedule)) { - free(tmpbuf); - return OMPI_ERR_OUT_OF_RESOURCE; - } - - if (rank != 0) { - span = opal_datatype_span(&datatype->super, count, &gap); - tmpbuf = malloc(span); - if (NULL == tmpbuf) { - return OMPI_ERR_OUT_OF_RESOURCE; - } - if (inplace) { - res = NBC_Sched_copy(recvbuf, false, count, datatype, - (char *)tmpbuf-gap, false, count, datatype, schedule, false); - } else { - res = NBC_Sched_copy((void *)sendbuf, false, count, datatype, - (char *)tmpbuf-gap, false, count, datatype, schedule, false); - } - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - - res = NBC_Sched_recv (recvbuf, false, count, datatype, rank-1, schedule, false); - - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - - if (rank < p - 1) { - /* we have to wait until we have the data */ - res = NBC_Sched_barrier(schedule); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - - res = NBC_Sched_op (recvbuf, false, (void *)(-gap), true, count, - datatype, op, schedule, true); - - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } + schedule = OBJ_NEW(NBC_Schedule); + if (OPAL_UNLIKELY(NULL == schedule)) { + free(tmpbuf); + return OMPI_ERR_OUT_OF_RESOURCE; + } - /* send reduced data onward */ - res = NBC_Sched_send ((void *)(-gap), true, count, datatype, rank + 1, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - } - } else if (p > 1) { - if (inplace) { - res = NBC_Sched_send (recvbuf, false, count, datatype, 1, schedule, false); - } else { - res = NBC_Sched_send (sendbuf, false, count, datatype, 1, schedule, false); - } - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } - } + if (alg == NBC_EXSCAN_LINEAR) { + res = exscan_sched_linear(rank, p, sendbuf, recvbuf, count, datatype, + op, inplace, schedule, tmpbuf); + } else { + res = exscan_sched_recursivedoubling(rank, p, sendbuf, recvbuf, count, + datatype, op, inplace, schedule, tmpbuf1, tmpbuf2); + } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + OBJ_RELEASE(schedule); + free(tmpbuf); + return res; + } - res = NBC_Sched_commit(schedule); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - free(tmpbuf); - return res; - } + res = NBC_Sched_commit(schedule); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + OBJ_RELEASE(schedule); + free(tmpbuf); + return res; + } #ifdef NBC_CACHE_SCHEDULE /* save schedule to tree */ @@ -224,3 +195,168 @@ int ompi_coll_libnbc_exscan_init(const void* sendbuf, void* recvbuf, int count, return OMPI_SUCCESS; } + +/* + * exscan_sched_linear: + * + * Function: Linear algorithm for exclusive scan. + * Accepts: Same as MPI_Iexscan + * Returns: MPI_SUCCESS or error code + * + * Working principle: + * 1. Each process (but process 0) receives from left neighbor + * 2. Performs op + * 3. All but rank p - 1 do sends to it's right neighbor and exits + * + * Schedule length: O(1) + */ +static inline int exscan_sched_linear( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, NBC_Schedule *schedule, + void *tmpbuf) +{ + int res = OMPI_SUCCESS; + ptrdiff_t gap; + opal_datatype_span(&datatype->super, count, &gap); + + if (rank > 0) { + if (inplace) { + res = NBC_Sched_copy(recvbuf, false, count, datatype, + (char *)tmpbuf - gap, false, count, datatype, schedule, false); + } else { + res = NBC_Sched_copy((void *)sendbuf, false, count, datatype, + (char *)tmpbuf - gap, false, count, datatype, schedule, false); + } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_recv(recvbuf, false, count, datatype, rank - 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + if (rank < comm_size - 1) { + /* We have to wait until we have the data */ + res = NBC_Sched_barrier(schedule); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_op(recvbuf, false, (void *)(-gap), true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Send reduced data onward */ + res = NBC_Sched_send ((void *)(-gap), true, count, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + } else if (comm_size > 1) { + /* Process 0 */ + if (inplace) { + res = NBC_Sched_send(recvbuf, false, count, datatype, 1, schedule, false); + } else { + res = NBC_Sched_send(sendbuf, false, count, datatype, 1, schedule, false); + } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + +cleanup_and_return: + return res; +} + +/* + * exscan_sched_recursivedoubling: + * + * Function: Recursive doubling algorithm for exclusive scan. + * Accepts: Same as MPI_Iexscan + * Returns: MPI_SUCCESS or error code + * + * Description: Implements recursive doubling algorithm for MPI_Iexscan. + * The algorithm preserves order of operations so it can + * be used both by commutative and non-commutative operations. + * + * Example for 5 processes and commutative operation MPI_SUM: + * Process: 0 1 2 3 4 + * recvbuf: - - - - - + * psend: [0] [1] [2] [3] [4] + * + * Step 1: + * recvbuf: - [0] - [2] - + * psend: [1+0] [0+1] [3+2] [2+3] [4] + * + * Step 2: + * recvbuf: - [0] [1+0] [(0+1)+2] - + * psend: [(3+2)+(1+0)] [(2+3)+(0+1)] [(1+0)+(3+2)] [(1+0)+(2+3)] [4] + * + * Step 3: + * recvbuf: - [0] [1+0] [(0+1)+2] [(3+2)+(1+0)] + * psend: [4+((3+2)+(1+0))] [((3+2)+(1+0))+4] + * + * Time complexity (worst case): \ceil(\log_2(p))(2\alpha + 2m\beta + 2m\gamma) + * Memory requirements (per process): 2 * count * typesize = O(count) + * Limitations: intra-communicators only + * Schedule length: O(log(p)) + */ +static inline int exscan_sched_recursivedoubling( + int rank, int comm_size, const void *sendbuf, void *recvbuf, int count, + MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf1, void *tmpbuf2) +{ + int res = OMPI_SUCCESS; + char *psend = (char *)tmpbuf1; + char *precv = (char *)tmpbuf2; + + if (!inplace) { + res = NBC_Sched_copy((char *)sendbuf, false, count, datatype, + psend, true, count, datatype, schedule, true); + } else { + res = NBC_Sched_copy((char *)recvbuf, false, count, datatype, + psend, true, count, datatype, schedule, true); + } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + int is_commute = ompi_op_is_commute(op); + int is_first_block = 1; + + for (int mask = 1; mask < comm_size; mask <<= 1) { + int remote = rank ^ mask; + if (remote < comm_size) { + res = NBC_Sched_send(psend, true, count, datatype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv(precv, true, count, datatype, remote, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + if (rank > remote) { + /* Assertion: rank > 0 and rbuf is valid */ + if (is_first_block) { + res = NBC_Sched_copy(precv, true, count, datatype, + recvbuf, false, count, datatype, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + is_first_block = 0; + } else { + /* Accumulate prefix reduction: recvbuf = precv recvbuf */ + res = NBC_Sched_op(precv, true, recvbuf, false, count, + datatype, op, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + /* Partial result: psend = precv psend */ + res = NBC_Sched_op(precv, true, psend, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } else { + if (is_commute) { + /* psend = precv psend */ + res = NBC_Sched_op(precv, true, psend, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } else { + /* precv = psend precv */ + res = NBC_Sched_op(psend, true, precv, true, count, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + char *tmp = psend; + psend = precv; + precv = tmp; + } + } + } + } + +cleanup_and_return: + return res; +} From 6f6d8180a3e84e64e4dd0ea8770d4c202f2c6bc1 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Fri, 28 Sep 2018 18:54:47 -0700 Subject: [PATCH 633/674] coll libnbc: Remove dead code Remove dead code that was causing warnings about unused static functions. Signed-off-by: Brian Barrett (cherry picked from commit 2e24e6ec082d29f76dcbc75c6f214d2d0d647701) Signed-off-by: Brian Barrett --- .../mca/coll/libnbc/nbc_ineighbor_allgather.c | 151 ------------------ 1 file changed, 151 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c index e15ddf33269..ad0f6a128f6 100644 --- a/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c +++ b/ompi/mca/coll/libnbc/nbc_ineighbor_allgather.c @@ -181,157 +181,6 @@ int ompi_coll_libnbc_ineighbor_allgather(const void *sbuf, int scount, MPI_Datat return OMPI_SUCCESS; } -/* better binomial bcast - * working principle: - * - each node gets a virtual rank vrank - * - the 'root' node get vrank 0 - * - node 0 gets the vrank of the 'root' - * - all other ranks stay identical (they do not matter) - * - * Algorithm: - * - each node with vrank > 2^r and vrank < 2^r+1 receives from node - * vrank - 2^r (vrank=1 receives from 0, vrank 0 receives never) - * - each node sends each round r to node vrank + 2^r - * - a node stops to send if 2^r > commsize - */ -#define RANK2VRANK(rank, vrank, root) \ -{ \ - vrank = rank; \ - if (rank == 0) vrank = root; \ - if (rank == root) vrank = 0; \ -} -#define VRANK2RANK(rank, vrank, root) \ -{ \ - rank = vrank; \ - if (vrank == 0) rank = root; \ - if (vrank == root) rank = 0; \ -} -static inline int bcast_sched_binomial(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype) { - int maxr, vrank, peer, res; - - maxr = (int)ceil((log((double)p)/LOG2)); - - RANK2VRANK(rank, vrank, root); - - /* receive from the right hosts */ - if (vrank != 0) { - for (int r = 0 ; r < maxr ; ++r) { - if ((vrank >= (1 << r)) && (vrank < (1 << (r + 1)))) { - VRANK2RANK(peer, vrank - (1 << r), root); - res = NBC_Sched_recv (buffer, false, count, datatype, peer, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - } - - res = NBC_Sched_barrier (schedule); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - - /* now send to the right hosts */ - for (int r = 0 ; r < maxr ; ++r) { - if (((vrank + (1 << r) < p) && (vrank < (1 << r))) || (vrank == 0)) { - VRANK2RANK(peer, vrank + (1 << r), root); - res = NBC_Sched_send (buffer, false, count, datatype, peer, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - } - - return OMPI_SUCCESS; -} - -/* simple linear MPI_Ibcast */ -static inline int bcast_sched_linear(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype) { - int res; - - /* send to all others */ - if(rank == root) { - for (int peer = 0 ; peer < p ; ++peer) { - if (peer != root) { - /* send msg to peer */ - res = NBC_Sched_send (buffer, false, count, datatype, peer, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - } - } else { - /* recv msg from root */ - res = NBC_Sched_recv (buffer, false, count, datatype, root, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - - return OMPI_SUCCESS; -} - -/* simple chained MPI_Ibcast */ -static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype, int fragsize, size_t size) { - int res, vrank, rpeer, speer, numfrag, fragcount, thiscount; - MPI_Aint ext; - char *buf; - - RANK2VRANK(rank, vrank, root); - VRANK2RANK(rpeer, vrank-1, root); - VRANK2RANK(speer, vrank+1, root); - res = ompi_datatype_type_extent(datatype, &ext); - if (MPI_SUCCESS != res) { - NBC_Error("MPI Error in ompi_datatype_type_extent() (%i)", res); - return res; - } - - if (count == 0) { - return OMPI_SUCCESS; - } - - numfrag = count * size/fragsize; - if ((count * size) % fragsize != 0) { - numfrag++; - } - - fragcount = count/numfrag; - - for (int fragnum = 0 ; fragnum < numfrag ; ++fragnum) { - buf = (char *) buffer + fragnum * fragcount * ext; - thiscount = fragcount; - if (fragnum == numfrag-1) { - /* last fragment may not be full */ - thiscount = count - fragcount * fragnum; - } - - /* root does not receive */ - if (vrank != 0) { - res = NBC_Sched_recv (buf, false, thiscount, datatype, rpeer, schedule, true); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - - /* last rank does not send */ - if (vrank != p-1) { - res = NBC_Sched_send (buf, false, thiscount, datatype, speer, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - - /* this barrier here seems awaward but isn't!!!! */ - if (vrank == 0) { - res = NBC_Sched_barrier (schedule); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - return res; - } - } - } - } - - return OMPI_SUCCESS; -} int ompi_coll_libnbc_neighbor_allgather_init(const void *sbuf, int scount, MPI_Datatype stype, void *rbuf, int rcount, MPI_Datatype rtype, struct ompi_communicator_t *comm, From a318f117f687f2877d0b32abac6026490963eea4 Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Mon, 10 Sep 2018 21:33:31 +0700 Subject: [PATCH 634/674] coll/libnbc: add Rabenseifner's algorithm for MPI_Ireduce An implementation of R. Rabenseifner's algorithm for MPI_Ireduce. This algorithm is a combination of a reduce-scatter implemented with recursive vector halving and recursive distance doubling, followed either by a gather. Limitations: -- count >= 2^{\floor{\log_2 p}} -- commutative operations only -- intra-communicators only Signed-off-by: Mikhail Kurnosov (cherry picked from commit 7bd63e79c865080c801a45ed852602bdc4eb4d8f) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 1 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 19 + ompi/mca/coll/libnbc/nbc_ireduce.c | 390 ++++++++++++++++++- 3 files changed, 401 insertions(+), 9 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 578a50946fb..76b944bc775 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -71,6 +71,7 @@ BEGIN_C_DECLS extern bool libnbc_ibcast_skip_dt_decision; extern int libnbc_iexscan_algorithm; +extern int libnbc_ireduce_algorithm; extern int libnbc_iscan_algorithm; struct ompi_coll_libnbc_component_t { diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index df75ac3706c..2a5553d7114 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -54,6 +54,15 @@ static mca_base_var_enum_value_t iexscan_algorithms[] = { {0, NULL} }; +int libnbc_ireduce_algorithm = 0; /* ireduce user forced algorithm */ +static mca_base_var_enum_value_t ireduce_algorithms[] = { + {0, "ignore"}, + {1, "chain"}, + {2, "binomial"}, + {3, "rabenseifner"}, + {0, NULL} +}; + int libnbc_iscan_algorithm = 0; /* iscan user forced algorithm */ static mca_base_var_enum_value_t iscan_algorithms[] = { {0, "ignore"}, @@ -185,6 +194,16 @@ libnbc_register(void) &libnbc_iexscan_algorithm); OBJ_RELEASE(new_enum); + libnbc_ireduce_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_ireduce_algorithms", ireduce_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "ireduce_algorithm", + "Which ireduce algorithm is used: 0 ignore, 1 chain, 2 binomial, 3 rabenseifner", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_ireduce_algorithm); + OBJ_RELEASE(new_enum); + libnbc_iscan_algorithm = 0; (void) mca_base_var_enum_create("coll_libnbc_iscan_algorithms", iscan_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index c222fa3a7f0..52521a02179 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -20,6 +20,7 @@ */ #include "opal/include/opal/align.h" +#include "opal/util/bit_ops.h" #include "ompi/op/op.h" #include "nbc_internal.h" @@ -31,6 +32,10 @@ static inline int red_sched_chain (int rank, int p, int root, const void *sendbu static inline int red_sched_linear (int rank, int rsize, int root, const void *sendbuf, void *recvbuf, void *tmpbuf, int count, MPI_Datatype datatype, MPI_Op op, NBC_Schedule *schedule); +static inline int red_sched_redscat_gather( + int rank, int comm_size, int root, const void *sbuf, void *rbuf, + char tmpredbuf, int count, MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmp_buf, struct ompi_communicator_t *comm); #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ @@ -63,7 +68,7 @@ static int nbc_reduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Da char *redbuf=NULL, inplace; void *tmpbuf; char tmpredbuf = 0; - enum { NBC_RED_BINOMIAL, NBC_RED_CHAIN } alg; + enum { NBC_RED_BINOMIAL, NBC_RED_CHAIN, NBC_RED_REDSCAT_GATHER} alg; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; ptrdiff_t span, gap; @@ -98,22 +103,42 @@ static int nbc_reduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Da span = opal_datatype_span(&datatype->super, count, &gap); /* algorithm selection */ - if (p > 4 || size * count < 65536 || !ompi_op_is_commute(op)) { - alg = NBC_RED_BINOMIAL; - if(rank == root) { - /* root reduces in receivebuffer */ - tmpbuf = malloc (span); + int nprocs_pof2 = opal_next_poweroftwo(p) >> 1; + if (libnbc_ireduce_algorithm == 0) { + if (ompi_op_is_commute(op) && p > 2 && count >= nprocs_pof2) { + alg = NBC_RED_REDSCAT_GATHER; + } else if (p > 4 || size * count < 65536 || !ompi_op_is_commute(op)) { + alg = NBC_RED_BINOMIAL; + } else { + alg = NBC_RED_CHAIN; + } + } else { + if (libnbc_ireduce_algorithm == 1) { + alg = NBC_RED_CHAIN; + } else if (libnbc_ireduce_algorithm == 2) { + alg = NBC_RED_BINOMIAL; + } else if (libnbc_ireduce_algorithm == 3 && ompi_op_is_commute(op) && p > 2 && count >= nprocs_pof2) { + alg = NBC_RED_REDSCAT_GATHER; + } else { + alg = NBC_RED_CHAIN; + } + } + + /* allocate temporary buffers */ + if (alg == NBC_RED_REDSCAT_GATHER || alg == NBC_RED_BINOMIAL) { + if (rank == root) { + /* root reduces in receive buffer */ + tmpbuf = malloc(span); redbuf = recvbuf; } else { /* recvbuf may not be valid on non-root nodes */ ptrdiff_t span_align = OPAL_ALIGN(span, datatype->super.align, ptrdiff_t); - tmpbuf = malloc (span_align + span); - redbuf = (char*)span_align - gap; + tmpbuf = malloc(span_align + span); + redbuf = (char *)span_align - gap; tmpredbuf = 1; } } else { tmpbuf = malloc (span); - alg = NBC_RED_CHAIN; segsize = 16384/2; } @@ -151,6 +176,9 @@ static int nbc_reduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Da case NBC_RED_CHAIN: res = red_sched_chain(rank, p, root, sendbuf, recvbuf, count, datatype, op, ext, size, schedule, tmpbuf, segsize); break; + case NBC_RED_REDSCAT_GATHER: + res = red_sched_redscat_gather(rank, p, root, sendbuf, redbuf, tmpredbuf, count, datatype, op, inplace, schedule, tmpbuf, comm); + break; } } @@ -560,6 +588,350 @@ static inline int red_sched_linear (int rank, int rsize, int root, const void *s return OMPI_SUCCESS; } +/* + * red_sched_redscat_gather: + * + * Description: an implementation of Rabenseifner's Reduce algorithm [1, 2]. + * [1] Rajeev Thakur, Rolf Rabenseifner and William Gropp. + * Optimization of Collective Communication Operations in MPICH // + * The Int. Journal of High Performance Computing Applications. Vol 19, + * Issue 1, pp. 49--66. + * [2] http://www.hlrs.de/mpi/myreduce.html. + * + * This algorithm is a combination of a reduce-scatter implemented with + * recursive vector halving and recursive distance doubling, followed either + * by a binomial tree gather. + * + * Step 1. If the number of processes is not a power of two, reduce it to + * the nearest lower power of two (p' = 2^{\floor{\log_2 p}}) + * by removing r = p - p' extra processes as follows. In the first 2r processes + * (ranks 0 to 2r - 1), all the even ranks send the second half of the input + * vector to their right neighbor (rank + 1), and all the odd ranks send + * the first half of the input vector to their left neighbor (rank - 1). + * The even ranks compute the reduction on the first half of the vector and + * the odd ranks compute the reduction on the second half. The odd ranks then + * send the result to their left neighbors (the even ranks). As a result, + * the even ranks among the first 2r processes now contain the reduction with + * the input vector on their right neighbors (the odd ranks). These odd ranks + * do not participate in the rest of the algorithm, which leaves behind + * a power-of-two number of processes. The first r even-ranked processes and + * the last p - 2r processes are now renumbered from 0 to p' - 1. + * + * Step 2. The remaining processes now perform a reduce-scatter by using + * recursive vector halving and recursive distance doubling. The even-ranked + * processes send the second half of their buffer to rank + 1 and the odd-ranked + * processes send the first half of their buffer to rank - 1. All processes + * then compute the reduction between the local buffer and the received buffer. + * In the next log_2(p') - 1 steps, the buffers are recursively halved, and the + * distance is doubled. At the end, each of the p' processes has 1 / p' of the + * total reduction result. + * + * Step 3. A binomial tree gather is performed by using recursive vector + * doubling and distance halving. In the non-power-of-two case, if the root + * happens to be one of those odd-ranked processes that would normally + * be removed in the first step, then the role of this process and process 0 + * are interchanged. + * + * Limitations: + * count >= 2^{\floor{\log_2 p}} + * commutative operations only + * intra-communicators only + * + * Memory requirements (per process): + * rank != root: 2 * count * typesize + 4 * \log_2(p) * sizeof(int) = O(count) + * rank == root: count * typesize + 4 * \log_2(p) * sizeof(int) = O(count) + * + * Schedule length (rounds): O(\log(p)) + * Recommendations: root = 0, otherwise it is required additional steps + * in the root process. + */ +static inline int red_sched_redscat_gather( + int rank, int comm_size, int root, const void *sbuf, void *rbuf, + char tmpredbuf, int count, MPI_Datatype datatype, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmp_buf, struct ompi_communicator_t *comm) +{ + int res = OMPI_SUCCESS; + int *rindex = NULL, *rcount = NULL, *sindex = NULL, *scount = NULL; + + /* Find nearest power-of-two less than or equal to comm_size */ + int nsteps = opal_hibit(comm_size, comm->c_cube_dim + 1); /* ilog2(comm_size) */ + int nprocs_pof2 = 1 << nsteps; /* flp2(comm_size) */ + + ptrdiff_t lb, extent; + ompi_datatype_get_extent(datatype, &lb, &extent); + + if ((rank != root) || !inplace) { + res = NBC_Sched_copy((char *)sbuf, false, count, datatype, + rbuf, tmpredbuf, count, datatype, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + + /* + * Step 1. Reduce the number of processes to the nearest lower power of two + * p' = 2^{\floor{\log_2 p}} by removing r = p - p' processes. + * 1. In the first 2r processes (ranks 0 to 2r - 1), all the even ranks send + * the second half of the input vector to their right neighbor (rank + 1) + * and all the odd ranks send the first half of the input vector to their + * left neighbor (rank - 1). + * 2. All 2r processes compute the reduction on their half. + * 3. The odd ranks then send the result to their left neighbors + * (the even ranks). + * + * The even ranks (0 to 2r - 1) now contain the reduction with the input + * vector on their right neighbors (the odd ranks). The first r even + * processes and the p - 2r last processes are renumbered from + * 0 to 2^{\floor{\log_2 p}} - 1. These odd ranks do not participate in the + * rest of the algorithm. + */ + + int vrank, step, wsize; + int nprocs_rem = comm_size - nprocs_pof2; + + if (rank < 2 * nprocs_rem) { + int count_lhalf = count / 2; + int count_rhalf = count - count_lhalf; + + if (rank % 2 != 0) { + /* + * Odd process -- exchange with rank - 1 + * Send the left half of the input vector to the left neighbor, + * Recv the right half of the input vector from the left neighbor + */ + res = NBC_Sched_send(rbuf, tmpredbuf, count_lhalf, datatype, rank - 1, + schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_recv((char *)tmp_buf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_op((char *)tmp_buf + (ptrdiff_t)count_lhalf * extent, + false, (char *)rbuf + (ptrdiff_t)count_lhalf * extent, + tmpredbuf, count_rhalf, datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Send the right half to the left neighbor */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + tmpredbuf, count_rhalf, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* This process does not participate in recursive doubling phase */ + vrank = -1; + + } else { + /* + * Even process -- exchange with rank + 1 + * Send the right half of the input vector to the right neighbor, + * Recv the left half of the input vector from the right neighbor + */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + tmpredbuf, count_rhalf, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_recv((char *)tmp_buf, false, count_lhalf, datatype, rank + 1, + schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_op(tmp_buf, false, rbuf, tmpredbuf, count_lhalf, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Recv the right half from the right neighbor */ + res = NBC_Sched_recv((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + tmpredbuf, count_rhalf, datatype, rank + 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + vrank = rank / 2; + } + } else { /* rank >= 2 * nprocs_rem */ + vrank = rank - nprocs_rem; + } + + /* + * Step 2. Reduce-scatter implemented with recursive vector halving and + * recursive distance doubling. We have p' = 2^{\floor{\log_2 p}} + * power-of-two number of processes with new ranks (vrank) and result in rbuf. + * + * The even-ranked processes send the right half of their buffer to rank + 1 + * and the odd-ranked processes send the left half of their buffer to + * rank - 1. All processes then compute the reduction between the local + * buffer and the received buffer. In the next \log_2(p') - 1 steps, the + * buffers are recursively halved, and the distance is doubled. At the end, + * each of the p' processes has 1 / p' of the total reduction result. + */ + + rindex = malloc(sizeof(*rindex) * nsteps); /* O(\log_2(p)) */ + sindex = malloc(sizeof(*sindex) * nsteps); + rcount = malloc(sizeof(*rcount) * nsteps); + scount = malloc(sizeof(*scount) * nsteps); + if (NULL == rindex || NULL == sindex || NULL == rcount || NULL == scount) { + res = OMPI_ERR_OUT_OF_RESOURCE; + goto cleanup_and_return; + } + + if (vrank != -1) { + step = 0; + wsize = count; + sindex[0] = rindex[0] = 0; + + for (int mask = 1; mask < nprocs_pof2; mask <<= 1) { + /* + * On each iteration: rindex[step] = sindex[step] -- begining of the + * current window. Length of the current window is storded in wsize. + */ + int vdest = vrank ^ mask; + /* Translate vdest virtual rank to real rank */ + int dest = (vdest < nprocs_rem) ? vdest * 2 : vdest + nprocs_rem; + + if (rank < dest) { + /* + * Recv into the left half of the current window, send the right + * half of the window to the peer (perform reduce on the left + * half of the current window) + */ + rcount[step] = wsize / 2; + scount[step] = wsize - rcount[step]; + sindex[step] = rindex[step] + rcount[step]; + } else { + /* + * Recv into the right half of the current window, send the left + * half of the window to the peer (perform reduce on the right + * half of the current window) + */ + scount[step] = wsize / 2; + rcount[step] = wsize - scount[step]; + rindex[step] = sindex[step] + scount[step]; + } + + /* Send part of data from the rbuf, recv into the tmp_buf */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)sindex[step] * extent, + tmpredbuf, scount[step], datatype, dest, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv((char *)tmp_buf + (ptrdiff_t)rindex[step] * extent, + false, rcount[step], datatype, dest, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Local reduce: rbuf[] = tmp_buf[] rbuf[] */ + res = NBC_Sched_op((char *)tmp_buf + (ptrdiff_t)rindex[step] * extent, + false, (char *)rbuf + (ptrdiff_t)rindex[step] * extent, + tmpredbuf, rcount[step], datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Move the current window to the received message */ + if (step + 1 < nsteps) { + rindex[step + 1] = rindex[step]; + sindex[step + 1] = rindex[step]; + wsize = rcount[step]; + step++; + } + } + } + /* + * Assertion: each process has 1 / p' of the total reduction result: + * rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...]. + */ + + /* + * Setup the root process for gather operation. + * Case 1: root < 2r and root is odd -- root process was excluded on step 1 + * Recv data from process 0, vroot = 0, vrank = 0 + * Case 2: root < 2r and root is even: vroot = root / 2 + * Case 3: root >= 2r: vroot = root - r + */ + int vroot = 0; + if (root < 2 * nprocs_rem) { + if (root % 2 != 0) { + vroot = 0; + if (rank == root) { + /* + * Case 1: root < 2r and root is odd -- root process was + * excluded on step 1 (newrank == -1). + * Recv a data from the process 0. + */ + rindex[0] = 0; + step = 0, wsize = count; + for (int mask = 1; mask < nprocs_pof2; mask *= 2) { + rcount[step] = wsize / 2; + scount[step] = wsize - rcount[step]; + rindex[step] = 0; + sindex[step] = rcount[step]; + step++; + wsize /= 2; + } + + res = NBC_Sched_recv(rbuf, tmpredbuf, rcount[nsteps - 1], datatype, + 0, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + vrank = 0; + + } else if (vrank == 0) { + /* Send a data to the root */ + res = NBC_Sched_send(rbuf, tmpredbuf, rcount[nsteps - 1], datatype, + root, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + vrank = -1; + } + } else { + /* Case 2: root < 2r and a root is even: vroot = root / 2 */ + vroot = root / 2; + } + } else { + /* Case 3: root >= 2r: newroot = root - r */ + vroot = root - nprocs_rem; + } + + /* + * Step 3. Gather result at the vroot by the binomial tree algorithm. + * Each process has 1 / p' of the total reduction result: + * rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...]. + * All exchanges are executed in reverse order relative + * to recursive doubling (previous step). + */ + + if (vrank != -1) { + int vdest_tree, vroot_tree; + step = nsteps - 1; /* step = ilog2(p') - 1 */ + + for (int mask = nprocs_pof2 >> 1; mask > 0; mask >>= 1) { + int vdest = vrank ^ mask; + /* Translate vdest virtual rank to real rank */ + int dest = (vdest < nprocs_rem) ? vdest * 2 : vdest + nprocs_rem; + if ((vdest == 0) && (root < 2 * nprocs_rem) && (root % 2 != 0)) + dest = root; + + vdest_tree = vdest >> step; + vdest_tree <<= step; + vroot_tree = vroot >> step; + vroot_tree <<= step; + if (vdest_tree == vroot_tree) { + /* Send data from rbuf and exit */ + + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)rindex[step] * extent, + tmpredbuf, rcount[step], datatype, dest, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + break; + } else { + /* Recv and continue */ + res = NBC_Sched_recv((char *)rbuf + (ptrdiff_t)sindex[step] * extent, + tmpredbuf, scount[step], datatype, dest, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + step--; + } + } + + cleanup_and_return: + if (NULL != rindex) + free(rindex); + if (NULL != sindex) + free(sindex); + if (NULL != rcount) + free(rcount); + if (NULL != scount) + free(scount); + return res; +} + int ompi_coll_libnbc_reduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module) { From 6971dab943d0c76ab56a8605fa1bd8f045fbddca Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Tue, 25 Sep 2018 21:14:09 +0700 Subject: [PATCH 635/674] coll/libnbc: add knomial tree algorithm for MPI_Ibcast Signed-off-by: Mikhail Kurnosov (cherry picked from commit b0429d25dfb1ed3f9adfa45169478cada0ba2675) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 2 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 29 ++++++ ompi/mca/coll/libnbc/nbc_ibcast.c | 93 +++++++++++++++++--- 3 files changed, 111 insertions(+), 13 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 76b944bc775..2f22aed8ad0 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -70,6 +70,8 @@ BEGIN_C_DECLS #define NBC_NUM_COLL 17 extern bool libnbc_ibcast_skip_dt_decision; +extern int libnbc_ibcast_algorithm; +extern int libnbc_ibcast_knomial_radix; extern int libnbc_iexscan_algorithm; extern int libnbc_ireduce_algorithm; extern int libnbc_iscan_algorithm; diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 2a5553d7114..964f42b6351 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -46,6 +46,17 @@ static int libnbc_priority = 10; static bool libnbc_in_progress = false; /* protect from recursive calls */ bool libnbc_ibcast_skip_dt_decision = true; +int libnbc_ibcast_algorithm = 0; /* ibcast user forced algorithm */ +int libnbc_ibcast_knomial_radix = 4; +static mca_base_var_enum_value_t ibcast_algorithms[] = { + {0, "ignore"}, + {1, "linear"}, + {2, "binomial"}, + {3, "chain"}, + {4, "knomial"}, + {0, NULL} +}; + int libnbc_iexscan_algorithm = 0; /* iexscan user forced algorithm */ static mca_base_var_enum_value_t iexscan_algorithms[] = { {0, "ignore"}, @@ -184,6 +195,24 @@ libnbc_register(void) MCA_BASE_VAR_SCOPE_READONLY, &libnbc_ibcast_skip_dt_decision); + libnbc_ibcast_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_ibcast_algorithms", ibcast_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "ibcast_algorithm", + "Which ibcast algorithm is used: 0 ignore, 1 linear, 2 binomial, 3 chain, 4 knomial", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_ibcast_algorithm); + OBJ_RELEASE(new_enum); + + libnbc_ibcast_knomial_radix = 4; + (void) mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "ibcast_knomial_radix", "k-nomial tree radix for the ibcast algorithm (radix > 1)", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &libnbc_ibcast_knomial_radix); + libnbc_iexscan_algorithm = 0; (void) mca_base_var_enum_create("coll_libnbc_iexscan_algorithms", iexscan_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, diff --git a/ompi/mca/coll/libnbc/nbc_ibcast.c b/ompi/mca/coll/libnbc/nbc_ibcast.c index 3cd1ca7b267..3137e1bd9b8 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast.c @@ -26,6 +26,8 @@ static inline int bcast_sched_linear(int rank, int p, int root, NBC_Schedule *sc MPI_Datatype datatype); static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *schedule, void *buffer, int count, MPI_Datatype datatype, int fragsize, size_t size); +static inline int bcast_sched_knomial(int rank, int comm_size, int root, NBC_Schedule *schedule, void *buf, + int count, MPI_Datatype datatype, int knomial_radix); #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ @@ -55,7 +57,7 @@ static int nbc_bcast_init(void *buffer, int count, MPI_Datatype datatype, int ro #ifdef NBC_CACHE_SCHEDULE NBC_Bcast_args *args, *found, search; #endif - enum { NBC_BCAST_LINEAR, NBC_BCAST_BINOMIAL, NBC_BCAST_CHAIN } alg; + enum { NBC_BCAST_LINEAR, NBC_BCAST_BINOMIAL, NBC_BCAST_CHAIN, NBC_BCAST_KNOMIAL } alg; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; rank = ompi_comm_rank (comm); @@ -73,25 +75,40 @@ static int nbc_bcast_init(void *buffer, int count, MPI_Datatype datatype, int ro segsize = 16384; /* algorithm selection */ - if( libnbc_ibcast_skip_dt_decision ) { - if (p <= 4) { - alg = NBC_BCAST_LINEAR; + if (libnbc_ibcast_algorithm == 0) { + if( libnbc_ibcast_skip_dt_decision ) { + if (p <= 4) { + alg = NBC_BCAST_LINEAR; + } + else { + alg = NBC_BCAST_BINOMIAL; + } } else { - alg = NBC_BCAST_BINOMIAL; + if (p <= 4) { + alg = NBC_BCAST_LINEAR; + } else if (size * count < 65536) { + alg = NBC_BCAST_BINOMIAL; + } else if (size * count < 524288) { + alg = NBC_BCAST_CHAIN; + segsize = 8192; + } else { + alg = NBC_BCAST_CHAIN; + segsize = 32768; + } } - } - else { - if (p <= 4) { + } else { + /* user forced dynamic decision */ + if (libnbc_ibcast_algorithm == 1) { alg = NBC_BCAST_LINEAR; - } else if (size * count < 65536) { + } else if (libnbc_ibcast_algorithm == 2) { alg = NBC_BCAST_BINOMIAL; - } else if (size * count < 524288) { + } else if (libnbc_ibcast_algorithm == 3) { alg = NBC_BCAST_CHAIN; - segsize = 8192; + } else if (libnbc_ibcast_algorithm == 4 && libnbc_ibcast_knomial_radix > 1) { + alg = NBC_BCAST_KNOMIAL; } else { - alg = NBC_BCAST_CHAIN; - segsize = 32768; + alg = NBC_BCAST_LINEAR; } } @@ -119,6 +136,9 @@ static int nbc_bcast_init(void *buffer, int count, MPI_Datatype datatype, int ro case NBC_BCAST_CHAIN: res = bcast_sched_chain(rank, p, root, schedule, buffer, count, datatype, segsize, size); break; + case NBC_BCAST_KNOMIAL: + res = bcast_sched_knomial(rank, p, root, schedule, buffer, count, datatype, libnbc_ibcast_knomial_radix); + break; } if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { @@ -342,6 +362,53 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch return OMPI_SUCCESS; } +/* + * bcast_sched_knomial: + * + * Description: an implementation of Ibcast using k-nomial tree algorithm + * + * Time: (radix - 1)O(log_{radix}(comm_size)) + * Memory: O(reqs_max) + * Schedule length (rounds): O(log(comm_size)) + */ +static inline int bcast_sched_knomial( + int rank, int comm_size, int root, NBC_Schedule *schedule, void *buf, + int count, MPI_Datatype datatype, int knomial_radix) +{ + int res = OMPI_SUCCESS; + + /* Receive from parent */ + int vrank = (rank - root + comm_size) % comm_size; + int mask = 0x1; + while (mask < comm_size) { + if (vrank % (knomial_radix * mask)) { + int parent = vrank / (knomial_radix * mask) * (knomial_radix * mask); + parent = (parent + root) % comm_size; + res = NBC_Sched_recv(buf, false, count, datatype, parent, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + break; + } + mask *= knomial_radix; + } + mask /= knomial_radix; + + /* Send data to all children */ + while (mask > 0) { + for (int r = 1; r < knomial_radix; r++) { + int child = vrank + mask * r; + if (child < comm_size) { + child = (child + root) % comm_size; + res = NBC_Sched_send(buf, false, count, datatype, child, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + } + mask /= knomial_radix; + } + +cleanup_and_return: + return res; +} + static int nbc_bcast_inter_init(void *buffer, int count, MPI_Datatype datatype, int root, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module, bool persistent) { From 91a4b4c799795d6f5e66e91762e7414fb8a1a9ee Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Thu, 11 Oct 2018 21:43:13 +0700 Subject: [PATCH 636/674] coll/libnbc: add recursive doubling algorithm for MPI_Iallgather Implements recursive doubling algorithm for MPI_Iallgather. The algorithm can be used only for power-of-two number of processes. Signed-off-by: Mikhail Kurnosov (cherry picked from commit a7386c1e09fb274991ca5b50d9d418a0d6b77b6c) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 1 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 18 ++ ompi/mca/coll/libnbc/nbc_iallgather.c | 175 ++++++++++++++++--- 3 files changed, 167 insertions(+), 27 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 2f22aed8ad0..6510cf1cb86 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -70,6 +70,7 @@ BEGIN_C_DECLS #define NBC_NUM_COLL 17 extern bool libnbc_ibcast_skip_dt_decision; +extern int libnbc_iallgather_algorithm; extern int libnbc_ibcast_algorithm; extern int libnbc_ibcast_knomial_radix; extern int libnbc_iexscan_algorithm; diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 964f42b6351..f5d59702083 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -46,6 +46,14 @@ static int libnbc_priority = 10; static bool libnbc_in_progress = false; /* protect from recursive calls */ bool libnbc_ibcast_skip_dt_decision = true; +int libnbc_iallgather_algorithm = 0; /* iallgather user forced algorithm */ +static mca_base_var_enum_value_t iallgather_algorithms[] = { + {0, "ignore"}, + {1, "linear"}, + {2, "recursive_doubling"}, + {0, NULL} +}; + int libnbc_ibcast_algorithm = 0; /* ibcast user forced algorithm */ int libnbc_ibcast_knomial_radix = 4; static mca_base_var_enum_value_t ibcast_algorithms[] = { @@ -195,6 +203,16 @@ libnbc_register(void) MCA_BASE_VAR_SCOPE_READONLY, &libnbc_ibcast_skip_dt_decision); + libnbc_iallgather_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_iallgather_algorithms", iallgather_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "iallgather_algorithm", + "Which iallgather algorithm is used: 0 ignore, 1 linear, 2 recursive_doubling", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_iallgather_algorithm); + OBJ_RELEASE(new_enum); + libnbc_ibcast_algorithm = 0; (void) mca_base_var_enum_create("coll_libnbc_ibcast_algorithms", ibcast_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, diff --git a/ompi/mca/coll/libnbc/nbc_iallgather.c b/ompi/mca/coll/libnbc/nbc_iallgather.c index e7a9104fbaa..54d6d31412b 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgather.c +++ b/ompi/mca/coll/libnbc/nbc_iallgather.c @@ -20,6 +20,15 @@ */ #include "nbc_internal.h" +static inline int allgather_sched_linear( + int rank, int comm_size, NBC_Schedule *schedule, const void *sendbuf, + int scount, struct ompi_datatype_t *sdtype, void *recvbuf, int rcount, + struct ompi_datatype_t *rdtype); +static inline int allgather_sched_recursivedoubling( + int rank, int comm_size, NBC_Schedule *schedule, const void *sbuf, + int scount, struct ompi_datatype_t *sdtype, void *rbuf, int rcount, + struct ompi_datatype_t *rdtype); + #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ int NBC_Allgather_args_compare(NBC_Allgather_args *a, NBC_Allgather_args *b, void *param) { @@ -40,10 +49,6 @@ int NBC_Allgather_args_compare(NBC_Allgather_args *a, NBC_Allgather_args *b, voi } #endif -/* simple linear MPI_Iallgather - * the algorithm uses p-1 rounds - * each node sends the packet it received last round (or has in round 0) to it's right neighbor (modulo p) - * each node receives from it's left (modulo p) neighbor */ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module, bool persistent) @@ -51,16 +56,31 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s int rank, p, res; MPI_Aint rcvext; NBC_Schedule *schedule; - char *rbuf, *sbuf, inplace; + char *rbuf, inplace; #ifdef NBC_CACHE_SCHEDULE NBC_Allgather_args *args, *found, search; #endif + enum { NBC_ALLGATHER_LINEAR, NBC_ALLGATHER_RDBL} alg; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; NBC_IN_PLACE(sendbuf, recvbuf, inplace); rank = ompi_comm_rank (comm); p = ompi_comm_size (comm); + int is_commsize_pow2 = !(p & (p - 1)); + + if (libnbc_iallgather_algorithm == 0) { + alg = NBC_ALLGATHER_LINEAR; + } else { + /* user forced dynamic decision */ + if (libnbc_iallgather_algorithm == 1) { + alg = NBC_ALLGATHER_LINEAR; + } else if (libnbc_iallgather_algorithm == 2 && is_commsize_pow2) { + alg = NBC_ALLGATHER_RDBL; + } else { + alg = NBC_ALLGATHER_LINEAR; + } + } res = ompi_datatype_type_extent(recvtype, &rcvext); if (MPI_SUCCESS != res) { @@ -98,36 +118,34 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s return OMPI_ERR_OUT_OF_RESOURCE; } - sbuf = (char *)recvbuf + rank * recvcount * rcvext; - - if (persistent && !inplace) { /* for nonblocking, data has been copied already */ + if (persistent && !inplace) { + /* for nonblocking, data has been copied already */ /* copy my data to receive buffer (= send buffer of NBC_Sched_send) */ - res = NBC_Sched_copy ((void *)sendbuf, false, sendcount, sendtype, - sbuf, false, recvcount, recvtype, schedule, true); + rbuf = (char *)recvbuf + rank * recvcount * rcvext; + res = NBC_Sched_copy((void *)sendbuf, false, sendcount, sendtype, + rbuf, false, recvcount, recvtype, schedule, true); if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { OBJ_RELEASE(schedule); return res; } } - /* do p-1 rounds */ - for(int r = 0 ; r < p ; ++r) { - if(r != rank) { - /* recv from rank r */ - rbuf = (char *)recvbuf + r * recvcount * rcvext; - res = NBC_Sched_recv (rbuf, false, recvcount, recvtype, r, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - return res; - } + switch (alg) { + case NBC_ALLGATHER_LINEAR: + if (rank == 0) printf("MK: LINEAR\n"); + res = allgather_sched_linear(rank, p, schedule, sendbuf, sendcount, sendtype, + recvbuf, recvcount, recvtype); + break; + case NBC_ALLGATHER_RDBL: + if (rank == 0) printf("MK: RDBL\n"); + res = allgather_sched_recursivedoubling(rank, p, schedule, sendbuf, sendcount, + sendtype, recvbuf, recvcount, recvtype); + break; + } - /* send to rank r - not from the sendbuf to optimize MPI_IN_PLACE */ - res = NBC_Sched_send (sbuf, false, recvcount, recvtype, r, schedule, false); - if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { - OBJ_RELEASE(schedule); - return res; - } - } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { + OBJ_RELEASE(schedule); + return res; } res = NBC_Sched_commit(schedule); @@ -270,6 +288,109 @@ int ompi_coll_libnbc_iallgather_inter(const void* sendbuf, int sendcount, MPI_Da return OMPI_SUCCESS; } +/* + * allgather_sched_linear + * + * Description: an implementation of Iallgather using linear algorithm + * + * Time: O(comm_size) + * Schedule length (rounds): O(comm_size) + */ +static inline int allgather_sched_linear( + int rank, int comm_size, NBC_Schedule *schedule, const void *sendbuf, + int scount, struct ompi_datatype_t *sdtype, void *recvbuf, int rcount, + struct ompi_datatype_t *rdtype) +{ + int res = OMPI_SUCCESS; + ptrdiff_t rlb, rext; + + res = ompi_datatype_get_extent(rdtype, &rlb, &rext); + char *sbuf = (char *)recvbuf + rank * rcount * rext; + + for (int remote = 0; remote < comm_size ; ++remote) { + if (remote != rank) { + /* Recv from rank remote */ + char *rbuf = (char *)recvbuf + remote * rcount * rext; + res = NBC_Sched_recv(rbuf, false, rcount, rdtype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + /* Send to rank remote - not from the sendbuf to optimize MPI_IN_PLACE */ + res = NBC_Sched_send(sbuf, false, rcount, rdtype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + } + +cleanup_and_return: + return res; +} + +/* + * allgather_sched_recursivedoubling + * + * Description: an implementation of Iallgather using recursive doubling algorithm + * Limitation: power-of-two number of processes only + * Time: O(log(comm_size)) + * Schedule length (rounds): O(log(comm_size)) + * Memory: no additional memory requirements beyond user-supplied buffers. + * + * Example on 4 nodes: + * Initialization: everyone has its own buffer at location rank in rbuf + * # 0 1 2 3 + * [0] [ ] [ ] [ ] + * [ ] [1] [ ] [ ] + * [ ] [ ] [2] [ ] + * [ ] [ ] [ ] [3] + * Step 0: exchange data with (rank ^ 2^0) + * # 0 1 2 3 + * [0] [0] [ ] [ ] + * [1] [1] [ ] [ ] + * [ ] [ ] [2] [2] + * [ ] [ ] [3] [3] + * Step 1: exchange data with (rank ^ 2^1) (if you can) + * # 0 1 2 3 + * [0] [0] [0] [0] + * [1] [1] [1] [1] + * [2] [2] [2] [2] + * [3] [3] [3] [3] + * + */ +static inline int allgather_sched_recursivedoubling( + int rank, int comm_size, NBC_Schedule *schedule, const void *sbuf, + int scount, struct ompi_datatype_t *sdtype, void *rbuf, int rcount, + struct ompi_datatype_t *rdtype) +{ + int res = OMPI_SUCCESS; + ptrdiff_t rlb, rext; + char *tmpsend = NULL, *tmprecv = NULL; + + res = ompi_datatype_get_extent(rdtype, &rlb, &rext); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + int sendblocklocation = rank; + for (int distance = 1; distance < comm_size; distance <<= 1) { + int remote = rank ^ distance; + + tmpsend = (char *)rbuf + (ptrdiff_t)sendblocklocation * (ptrdiff_t)rcount * rext; + if (rank < remote) { + tmprecv = (char *)rbuf + (ptrdiff_t)(sendblocklocation + distance) * (ptrdiff_t)rcount * rext; + } else { + tmprecv = (char *)rbuf + (ptrdiff_t)(sendblocklocation - distance) * (ptrdiff_t)rcount * rext; + sendblocklocation -= distance; + } + + res = NBC_Sched_send(tmpsend, false, (ptrdiff_t)distance * (ptrdiff_t)rcount, + rdtype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + + res = NBC_Sched_recv(tmprecv, false, (ptrdiff_t)distance * (ptrdiff_t)rcount, + rdtype, remote, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + +cleanup_and_return: + return res; +} + int ompi_coll_libnbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount, MPI_Datatype recvtype, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module) { From fd29cce114b2d3ab57b1e137ec916186401f194c Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 17 Oct 2018 18:04:39 -0400 Subject: [PATCH 637/674] Remove few warnings in libnbc identified by clang-1000.11.45.2 Signed-off-by: George Bosilca (cherry picked from commit 66182a294d5e8cf03a00fba579b05f59e764133c) Signed-off-by: Brian Barrett --- ompi/mca/coll/base/coll_base_bcast.c | 4 +++- ompi/mca/coll/libnbc/nbc_iexscan.c | 2 +- ompi/mca/coll/libnbc/nbc_ireduce.c | 3 ++- ompi/mca/coll/libnbc/nbc_ireduce_scatter.c | 2 +- ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c | 2 +- ompi/mca/coll/libnbc/nbc_iscan.c | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ompi/mca/coll/base/coll_base_bcast.c b/ompi/mca/coll/base/coll_base_bcast.c index 9a235051967..7af75353d2d 100644 --- a/ompi/mca/coll/base/coll_base_bcast.c +++ b/ompi/mca/coll/base/coll_base_bcast.c @@ -646,7 +646,9 @@ ompi_coll_base_bcast_intra_basic_linear(void *buff, int count, /* Root sends data to all others. */ preq = reqs = ompi_coll_base_comm_get_reqs(module->base_data, size-1); - if( NULL == reqs ) { err = OMPI_ERR_OUT_OF_RESOURCE; goto err_hndl; } + if( NULL == reqs ) { + return OMPI_ERR_OUT_OF_RESOURCE; + } for (i = 0; i < size; ++i) { if (i == rank) { diff --git a/ompi/mca/coll/libnbc/nbc_iexscan.c b/ompi/mca/coll/libnbc/nbc_iexscan.c index fccf89d3eb8..547da001dc1 100644 --- a/ompi/mca/coll/libnbc/nbc_iexscan.c +++ b/ompi/mca/coll/libnbc/nbc_iexscan.c @@ -18,7 +18,7 @@ * Author(s): Torsten Hoefler * */ -#include "opal/include/opal/align.h" +#include "opal/align.h" #include "ompi/op/op.h" #include "nbc_internal.h" diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index 52521a02179..cf92481928e 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -19,7 +19,8 @@ * */ -#include "opal/include/opal/align.h" +#include "ompi_config.h" +#include "opal/align.h" #include "opal/util/bit_ops.h" #include "ompi/op/op.h" diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c index 230bcaa0101..9e0ebb39b37 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter.c @@ -21,7 +21,7 @@ * Author(s): Torsten Hoefler * */ -#include "opal/include/opal/align.h" +#include "opal/align.h" #include "nbc_internal.h" diff --git a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c index 6dadd1eafa8..54bee4f13df 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce_scatter_block.c @@ -19,7 +19,7 @@ * Author(s): Torsten Hoefler * */ -#include "opal/include/opal/align.h" +#include "opal/align.h" #include "nbc_internal.h" diff --git a/ompi/mca/coll/libnbc/nbc_iscan.c b/ompi/mca/coll/libnbc/nbc_iscan.c index 0fdecd40c02..ccc531d669e 100644 --- a/ompi/mca/coll/libnbc/nbc_iscan.c +++ b/ompi/mca/coll/libnbc/nbc_iscan.c @@ -18,7 +18,7 @@ * Author(s): Torsten Hoefler * */ -#include "opal/include/opal/align.h" +#include "opal/align.h" #include "ompi/op/op.h" #include "nbc_internal.h" From 5ee1fb62b94748b5c127342770e943266704437f Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Sat, 6 Oct 2018 22:37:21 +0700 Subject: [PATCH 638/674] coll/libnbc: add Rabenseifner's algorithm for MPI_Iallreduce An implementation of R. Rabenseifner's algorithm for MPI_Iallreduce. This algorithm is a combination of a reduce-scatter implemented with recursive vector halving and recursive distance doubling, followed either by an allgather. Limitations: -- count >= 2^{\floor{\log_2 p}} -- commutative operations only -- intra-communicators only Signed-off-by: Mikhail Kurnosov (cherry picked from commit 73e048b62a92325fc3fca80c2ade5f5e9bf3192a) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc.h | 1 + ompi/mca/coll/libnbc/coll_libnbc_component.c | 22 +- ompi/mca/coll/libnbc/nbc_iallreduce.c | 296 ++++++++++++++++++- 3 files changed, 311 insertions(+), 8 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc.h b/ompi/mca/coll/libnbc/coll_libnbc.h index 6510cf1cb86..badc1870771 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc.h +++ b/ompi/mca/coll/libnbc/coll_libnbc.h @@ -71,6 +71,7 @@ BEGIN_C_DECLS extern bool libnbc_ibcast_skip_dt_decision; extern int libnbc_iallgather_algorithm; +extern int libnbc_iallreduce_algorithm; extern int libnbc_ibcast_algorithm; extern int libnbc_ibcast_knomial_radix; extern int libnbc_iexscan_algorithm; diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index f5d59702083..9daaebcb82a 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -54,6 +54,15 @@ static mca_base_var_enum_value_t iallgather_algorithms[] = { {0, NULL} }; +int libnbc_iallreduce_algorithm = 0; /* iallreduce user forced algorithm */ +static mca_base_var_enum_value_t iallreduce_algorithms[] = { + {0, "ignore"}, + {1, "ring"}, + {2, "binomial"}, + {3, "rabenseifner"}, + {0, NULL} +}; + int libnbc_ibcast_algorithm = 0; /* ibcast user forced algorithm */ int libnbc_ibcast_knomial_radix = 4; static mca_base_var_enum_value_t ibcast_algorithms[] = { @@ -97,7 +106,6 @@ static int libnbc_init_query(bool, bool); static mca_coll_base_module_t *libnbc_comm_query(struct ompi_communicator_t *, int *); static int libnbc_module_enable(mca_coll_base_module_t *, struct ompi_communicator_t *); - /* * Instantiate the public struct with all of our public information * and pointers to our public functions in it @@ -213,6 +221,16 @@ libnbc_register(void) &libnbc_iallgather_algorithm); OBJ_RELEASE(new_enum); + libnbc_iallreduce_algorithm = 0; + (void) mca_base_var_enum_create("coll_libnbc_iallreduce_algorithms", iallreduce_algorithms, &new_enum); + mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, + "iallreduce_algorithm", + "Which iallreduce algorithm is used: 0 ignore, 1 ring, 2 binomial, 3 rabenseifner", + MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, + &libnbc_iallreduce_algorithm); + OBJ_RELEASE(new_enum); + libnbc_ibcast_algorithm = 0; (void) mca_base_var_enum_create("coll_libnbc_ibcast_algorithms", ibcast_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, @@ -264,8 +282,6 @@ libnbc_register(void) return OMPI_SUCCESS; } - - /* * Initial query function that is invoked during MPI_INIT, allowing * this component to disqualify itself if it doesn't support the diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index 57aa0d77e0d..e3df780efef 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -22,6 +22,7 @@ #include "ompi/communicator/communicator.h" #include "ompi/datatype/ompi_datatype.h" #include "ompi/op/op.h" +#include "opal/util/bit_ops.h" #include @@ -33,6 +34,10 @@ static inline int allred_sched_ring(int rank, int p, int count, MPI_Datatype dat static inline int allred_sched_linear(int rank, int p, const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, ptrdiff_t gap, MPI_Op op, int ext, int size, NBC_Schedule *schedule, void *tmpbuf); +static inline int allred_sched_redscat_allgather( + int rank, int comm_size, int count, MPI_Datatype datatype, ptrdiff_t gap, + const void *sbuf, void *rbuf, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf, struct ompi_communicator_t *comm); #ifdef NBC_CACHE_SCHEDULE /* tree comparison function for schedule cache */ @@ -64,7 +69,7 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI #ifdef NBC_CACHE_SCHEDULE NBC_Allreduce_args *args, *found, search; #endif - enum { NBC_ARED_BINOMIAL, NBC_ARED_RING } alg; + enum { NBC_ARED_BINOMIAL, NBC_ARED_RING, NBC_ARED_REDSCAT_ALLGATHER } alg; char inplace; void *tmpbuf = NULL; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -105,12 +110,25 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI } /* algorithm selection */ - if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) { - alg = NBC_ARED_BINOMIAL; + int nprocs_pof2 = opal_next_poweroftwo(p) >> 1; + if (libnbc_iallreduce_algorithm == 0) { + if(p < 4 || size*count < 65536 || !ompi_op_is_commute(op) || inplace) { + alg = NBC_ARED_BINOMIAL; + } else if (count >= nprocs_pof2 && ompi_op_is_commute(op)) { + alg = NBC_ARED_REDSCAT_ALLGATHER; + } else { + alg = NBC_ARED_RING; + } } else { - alg = NBC_ARED_RING; + if (libnbc_iallreduce_algorithm == 1) + alg = NBC_ARED_RING; + else if (libnbc_iallreduce_algorithm == 2) + alg = NBC_ARED_BINOMIAL; + else if (libnbc_iallreduce_algorithm == 3 && count >= nprocs_pof2 && ompi_op_is_commute(op)) { + alg = NBC_ARED_REDSCAT_ALLGATHER; + } else + alg = NBC_ARED_RING; } - #ifdef NBC_CACHE_SCHEDULE /* search schedule in communicator specific tree */ search.sendbuf = sendbuf; @@ -135,6 +153,9 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI case NBC_ARED_BINOMIAL: res = allred_sched_diss(rank, p, count, datatype, gap, sendbuf, recvbuf, op, inplace, schedule, tmpbuf); break; + case NBC_ARED_REDSCAT_ALLGATHER: + res = allred_sched_redscat_allgather(rank, p, count, datatype, gap, sendbuf, recvbuf, op, inplace, schedule, tmpbuf, comm); + break; case NBC_ARED_RING: res = allred_sched_ring(rank, p, count, datatype, sendbuf, recvbuf, op, size, ext, schedule, tmpbuf); break; @@ -735,6 +756,271 @@ static inline int allred_sched_linear(int rank, int rsize, const void *sendbuf, return OMPI_SUCCESS; } +/* + * allred_sched_redscat_allgather: + * + * Description: an implementation of Rabenseifner's Allreduce algorithm [1, 2]. + * [1] Rajeev Thakur, Rolf Rabenseifner and William Gropp. + * Optimization of Collective Communication Operations in MPICH // + * The Int. Journal of High Performance Computing Applications. Vol 19, + * Issue 1, pp. 49--66. + * [2] http://www.hlrs.de/mpi/myreduce.html. + * + * This algorithm is a combination of a reduce-scatter implemented with + * recursive vector halving and recursive distance doubling, followed either + * by an allgather implemented with recursive doubling. + * + * Step 1. If the number of processes is not a power of two, reduce it to + * the nearest lower power of two (p' = 2^{\floor{\log_2 p}}) + * by removing r = p - p' extra processes as follows. In the first 2r processes + * (ranks 0 to 2r - 1), all the even ranks send the second half of the input + * vector to their right neighbor (rank + 1), and all the odd ranks send + * the first half of the input vector to their left neighbor (rank - 1). + * The even ranks compute the reduction on the first half of the vector and + * the odd ranks compute the reduction on the second half. The odd ranks then + * send the result to their left neighbors (the even ranks). As a result, + * the even ranks among the first 2r processes now contain the reduction with + * the input vector on their right neighbors (the odd ranks). These odd ranks + * do not participate in the rest of the algorithm, which leaves behind + * a power-of-two number of processes. The first r even-ranked processes and + * the last p - 2r processes are now renumbered from 0 to p' - 1. + * + * Step 2. The remaining processes now perform a reduce-scatter by using + * recursive vector halving and recursive distance doubling. The even-ranked + * processes send the second half of their buffer to rank + 1 and the odd-ranked + * processes send the first half of their buffer to rank - 1. All processes + * then compute the reduction between the local buffer and the received buffer. + * In the next log_2(p') - 1 steps, the buffers are recursively halved, and the + * distance is doubled. At the end, each of the p' processes has 1 / p' of the + * total reduction result. + * + * Step 3. An allgather is performed by using recursive vector doubling and + * distance halving. All exchanges are executed in reverse order relative + * to recursive doubling on previous step. If the number of processes is not + * a power of two, the total result vector must be sent to the r processes + * that were removed in the first step. + * + * Limitations: + * count >= 2^{\floor{\log_2 p}} + * commutative operations only + * intra-communicators only + * + * Memory requirements (per process): + * count * typesize + 4 * \log_2(p) * sizeof(int) = O(count) + * + * Schedule length (rounds): O(\log(p)) + */ +static inline int allred_sched_redscat_allgather( + int rank, int comm_size, int count, MPI_Datatype datatype, ptrdiff_t gap, + const void *sbuf, void *rbuf, MPI_Op op, char inplace, + NBC_Schedule *schedule, void *tmpbuf, struct ompi_communicator_t *comm) +{ + int res = OMPI_SUCCESS; + int *rindex = NULL, *rcount = NULL, *sindex = NULL, *scount = NULL; + /* Find nearest power-of-two less than or equal to comm_size */ + int nsteps = opal_hibit(comm_size, comm->c_cube_dim + 1); /* ilog2(comm_size) */ + int nprocs_pof2 = 1 << nsteps; /* flp2(comm_size) */ + if (!inplace) { + res = NBC_Sched_copy((char *)sbuf, false, count, datatype, + rbuf, false, count, datatype, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + char *tmp_buf = (char *)tmpbuf - gap; + ptrdiff_t lb, extent; + ompi_datatype_get_extent(datatype, &lb, &extent); + /* + * Step 1. Reduce the number of processes to the nearest lower power of two + * p' = 2^{\floor{\log_2 p}} by removing r = p - p' processes. + * 1. In the first 2r processes (ranks 0 to 2r - 1), all the even ranks send + * the second half of the input vector to their right neighbor (rank + 1) + * and all the odd ranks send the first half of the input vector to their + * left neighbor (rank - 1). + * 2. All 2r processes compute the reduction on their half. + * 3. The odd ranks then send the result to their left neighbors + * (the even ranks). + * + * The even ranks (0 to 2r - 1) now contain the reduction with the input + * vector on their right neighbors (the odd ranks). The first r even + * processes and the p - 2r last processes are renumbered from + * 0 to 2^{\floor{\log_2 p}} - 1. + */ + int vrank, step, wsize; + int nprocs_rem = comm_size - nprocs_pof2; + if (rank < 2 * nprocs_rem) { + int count_lhalf = count / 2; + int count_rhalf = count - count_lhalf; + if (rank % 2 != 0) { + /* + * Odd process -- exchange with rank - 1 + * Send the left half of the input vector to the left neighbor, + * Recv the right half of the input vector from the left neighbor + */ + res = NBC_Sched_send(rbuf, false, count_lhalf, datatype, rank - 1, + schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv(tmp_buf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_op(tmp_buf + (ptrdiff_t)count_lhalf * extent, + false, (char *)rbuf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* Send the right half to the left neighbor */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* This process does not participate in recursive doubling phase */ + vrank = -1; + } else { + /* + * Even process -- exchange with rank + 1 + * Send the right half of the input vector to the right neighbor, + * Recv the left half of the input vector from the right neighbor + */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv(tmp_buf, false, count_lhalf, datatype, rank + 1, + schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_op(tmp_buf, false, rbuf, false, count_lhalf, + datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* Recv the right half from the right neighbor */ + res = NBC_Sched_recv((char *)rbuf + (ptrdiff_t)count_lhalf * extent, + false, count_rhalf, datatype, rank + 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + vrank = rank / 2; + } + } else { /* rank >= 2 * nprocs_rem */ + vrank = rank - nprocs_rem; + } + /* + * Step 2. Reduce-scatter implemented with recursive vector halving and + * recursive distance doubling. We have p' = 2^{\floor{\log_2 p}} + * power-of-two number of processes with new ranks (vrank) and result in rbuf. + * + * The even-ranked processes send the right half of their buffer to rank + 1 + * and the odd-ranked processes send the left half of their buffer to + * rank - 1. All processes then compute the reduction between the local + * buffer and the received buffer. In the next \log_2(p') - 1 steps, the + * buffers are recursively halved, and the distance is doubled. At the end, + * each of the p' processes has 1 / p' of the total reduction result. + */ + rindex = malloc(sizeof(*rindex) * nsteps); + sindex = malloc(sizeof(*sindex) * nsteps); + rcount = malloc(sizeof(*rcount) * nsteps); + scount = malloc(sizeof(*scount) * nsteps); + if (NULL == rindex || NULL == sindex || NULL == rcount || NULL == scount) { + res = OMPI_ERR_OUT_OF_RESOURCE; + goto cleanup_and_return; + } + if (vrank != -1) { + step = 0; + wsize = count; + sindex[0] = rindex[0] = 0; + for (int mask = 1; mask < nprocs_pof2; mask <<= 1) { + /* + * On each iteration: rindex[step] = sindex[step] -- begining of the + * current window. Length of the current window is storded in wsize. + */ + int vdest = vrank ^ mask; + /* Translate vdest virtual rank to real rank */ + int dest = (vdest < nprocs_rem) ? vdest * 2 : vdest + nprocs_rem; + if (rank < dest) { + /* + * Recv into the left half of the current window, send the right + * half of the window to the peer (perform reduce on the left + * half of the current window) + */ + rcount[step] = wsize / 2; + scount[step] = wsize - rcount[step]; + sindex[step] = rindex[step] + rcount[step]; + } else { + /* + * Recv into the right half of the current window, send the left + * half of the window to the peer (perform reduce on the right + * half of the current window) + */ + scount[step] = wsize / 2; + rcount[step] = wsize - scount[step]; + rindex[step] = sindex[step] + scount[step]; + } + /* Send part of data from the rbuf, recv into the tmp_buf */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)sindex[step] * extent, + false, scount[step], datatype, dest, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv((char *)tmp_buf + (ptrdiff_t)rindex[step] * extent, + false, rcount[step], datatype, dest, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* Local reduce: rbuf[] = tmp_buf[] rbuf[] */ + res = NBC_Sched_op((char *)tmp_buf + (ptrdiff_t)rindex[step] * extent, + false, (char *)rbuf + (ptrdiff_t)rindex[step] * extent, + false, rcount[step], datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + /* Move the current window to the received message */ + if (step + 1 < nsteps) { + rindex[step + 1] = rindex[step]; + sindex[step + 1] = rindex[step]; + wsize = rcount[step]; + step++; + } + } + /* + * Assertion: each process has 1 / p' of the total reduction result: + * rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...]. + */ + /* + * Step 3. Allgather by the recursive doubling algorithm. + * Each process has 1 / p' of the total reduction result: + * rcount[nsteps - 1] elements in the rbuf[rindex[nsteps - 1], ...]. + * All exchanges are executed in reverse order relative + * to recursive doubling (previous step). + */ + step = nsteps - 1; + for (int mask = nprocs_pof2 >> 1; mask > 0; mask >>= 1) { + int vdest = vrank ^ mask; + /* Translate vdest virtual rank to real rank */ + int dest = (vdest < nprocs_rem) ? vdest * 2 : vdest + nprocs_rem; + /* + * Send rcount[step] elements from rbuf[rindex[step]...] + * Recv scount[step] elements to rbuf[sindex[step]...] + */ + res = NBC_Sched_send((char *)rbuf + (ptrdiff_t)rindex[step] * extent, + false, rcount[step], datatype, dest, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + res = NBC_Sched_recv((char *)rbuf + (ptrdiff_t)sindex[step] * extent, + false, scount[step], datatype, dest, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + step--; + } + } + /* + * Step 4. Send total result to excluded odd ranks. + */ + if (rank < 2 * nprocs_rem) { + if (rank % 2 != 0) { + /* Odd process -- recv result from rank - 1 */ + res = NBC_Sched_recv(rbuf, false, count, datatype, rank - 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } else { + /* Even process -- send result to rank + 1 */ + res = NBC_Sched_send(rbuf, false, count, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { goto cleanup_and_return; } + } + } + cleanup_and_return: + if (NULL != rindex) + free(rindex); + if (NULL != sindex) + free(sindex); + if (NULL != rcount) + free(rcount); + if (NULL != scount) + free(scount); + return res; +} + int ompi_coll_libnbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, struct ompi_communicator_t *comm, MPI_Info info, ompi_request_t ** request, struct mca_coll_base_module_2_3_0_t *module) { From bf1c8bb3946ce1a1c0f457a5f54bd91c611750b8 Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Thu, 18 Oct 2018 15:23:09 +0700 Subject: [PATCH 639/674] coll/libnbc/ireduce: silence Coverity warning CID 1440360 Signed-off-by: Mikhail Kurnosov (cherry picked from commit 8b511c788965e6467b5fd834f1adbdcca5012f55) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/nbc_ireduce.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ompi/mca/coll/libnbc/nbc_ireduce.c b/ompi/mca/coll/libnbc/nbc_ireduce.c index cf92481928e..da50f1eb276 100644 --- a/ompi/mca/coll/libnbc/nbc_ireduce.c +++ b/ompi/mca/coll/libnbc/nbc_ireduce.c @@ -656,6 +656,10 @@ static inline int red_sched_redscat_gather( /* Find nearest power-of-two less than or equal to comm_size */ int nsteps = opal_hibit(comm_size, comm->c_cube_dim + 1); /* ilog2(comm_size) */ + if (nsteps < 1) { + /* This case never happens (for comm_size < 2 other algorithms are used) */ + return OMPI_ERR_NOT_SUPPORTED; + } int nprocs_pof2 = 1 << nsteps; /* flp2(comm_size) */ ptrdiff_t lb, extent; From ba11f31fc80702f7cd9767cea67ccd9a6baa033e Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Fri, 26 Oct 2018 15:52:02 +0700 Subject: [PATCH 640/674] coll/libnbc: remove debug output 1. Remove debug output in iallgather (I have forgotten to remove it). 2. Remove an incorrect comment in description of ibcast Signed-off-by: Mikhail Kurnosov (cherry picked from commit 64abd0f405be91b927cd8f37d30cdf41aa6685c2) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/nbc_iallgather.c | 2 -- ompi/mca/coll/libnbc/nbc_ibcast.c | 1 - 2 files changed, 3 deletions(-) diff --git a/ompi/mca/coll/libnbc/nbc_iallgather.c b/ompi/mca/coll/libnbc/nbc_iallgather.c index 54d6d31412b..29ba7a6a9c1 100644 --- a/ompi/mca/coll/libnbc/nbc_iallgather.c +++ b/ompi/mca/coll/libnbc/nbc_iallgather.c @@ -132,12 +132,10 @@ static int nbc_allgather_init(const void* sendbuf, int sendcount, MPI_Datatype s switch (alg) { case NBC_ALLGATHER_LINEAR: - if (rank == 0) printf("MK: LINEAR\n"); res = allgather_sched_linear(rank, p, schedule, sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype); break; case NBC_ALLGATHER_RDBL: - if (rank == 0) printf("MK: RDBL\n"); res = allgather_sched_recursivedoubling(rank, p, schedule, sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype); break; diff --git a/ompi/mca/coll/libnbc/nbc_ibcast.c b/ompi/mca/coll/libnbc/nbc_ibcast.c index 3137e1bd9b8..cbd381328d0 100644 --- a/ompi/mca/coll/libnbc/nbc_ibcast.c +++ b/ompi/mca/coll/libnbc/nbc_ibcast.c @@ -368,7 +368,6 @@ static inline int bcast_sched_chain(int rank, int p, int root, NBC_Schedule *sch * Description: an implementation of Ibcast using k-nomial tree algorithm * * Time: (radix - 1)O(log_{radix}(comm_size)) - * Memory: O(reqs_max) * Schedule length (rounds): O(log(comm_size)) */ static inline int bcast_sched_knomial( From 2891a23329e9a46fc80ff17e06cffb889a405cbf Mon Sep 17 00:00:00 2001 From: Alex Anenkov Date: Sun, 19 May 2019 18:39:11 +0700 Subject: [PATCH 641/674] coll/libnbc: add recursive doubling algorithm for MPI_Iallreduce Signed-off-by: Alex Anenkov (cherry picked from commit 77d466edf369c9851476b7ec7392f3dfd4cdc0b1) Signed-off-by: Brian Barrett --- ompi/mca/coll/libnbc/coll_libnbc_component.c | 3 +- ompi/mca/coll/libnbc/nbc_iallreduce.c | 170 ++++++++++++++++++- 2 files changed, 168 insertions(+), 5 deletions(-) diff --git a/ompi/mca/coll/libnbc/coll_libnbc_component.c b/ompi/mca/coll/libnbc/coll_libnbc_component.c index 9daaebcb82a..bcb0e06c2d9 100644 --- a/ompi/mca/coll/libnbc/coll_libnbc_component.c +++ b/ompi/mca/coll/libnbc/coll_libnbc_component.c @@ -60,6 +60,7 @@ static mca_base_var_enum_value_t iallreduce_algorithms[] = { {1, "ring"}, {2, "binomial"}, {3, "rabenseifner"}, + {4, "recursive_doubling"}, {0, NULL} }; @@ -225,7 +226,7 @@ libnbc_register(void) (void) mca_base_var_enum_create("coll_libnbc_iallreduce_algorithms", iallreduce_algorithms, &new_enum); mca_base_component_var_register(&mca_coll_libnbc_component.super.collm_version, "iallreduce_algorithm", - "Which iallreduce algorithm is used: 0 ignore, 1 ring, 2 binomial, 3 rabenseifner", + "Which iallreduce algorithm is used: 0 ignore, 1 ring, 2 binomial, 3 rabenseifner, 4 recursive_doubling", MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, &libnbc_iallreduce_algorithm); diff --git a/ompi/mca/coll/libnbc/nbc_iallreduce.c b/ompi/mca/coll/libnbc/nbc_iallreduce.c index e3df780efef..b8e9f27cbdf 100644 --- a/ompi/mca/coll/libnbc/nbc_iallreduce.c +++ b/ompi/mca/coll/libnbc/nbc_iallreduce.c @@ -28,6 +28,9 @@ static inline int allred_sched_diss(int rank, int p, int count, MPI_Datatype datatype, ptrdiff_t gap, const void *sendbuf, void *recvbuf, MPI_Op op, char inplace, NBC_Schedule *schedule, void *tmpbuf); +static inline int allred_sched_recursivedoubling(int rank, int p, const void *sendbuf, void *recvbuf, + int count, MPI_Datatype datatype, ptrdiff_t gap, MPI_Op op, + char inplace, NBC_Schedule *schedule, void *tmpbuf); static inline int allred_sched_ring(int rank, int p, int count, MPI_Datatype datatype, const void *sendbuf, void *recvbuf, MPI_Op op, int size, int ext, NBC_Schedule *schedule, void *tmpbuf); @@ -69,7 +72,7 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI #ifdef NBC_CACHE_SCHEDULE NBC_Allreduce_args *args, *found, search; #endif - enum { NBC_ARED_BINOMIAL, NBC_ARED_RING, NBC_ARED_REDSCAT_ALLGATHER } alg; + enum { NBC_ARED_BINOMIAL, NBC_ARED_RING, NBC_ARED_REDSCAT_ALLGATHER, NBC_ARED_RDBL } alg; char inplace; void *tmpbuf = NULL; ompi_coll_libnbc_module_t *libnbc_module = (ompi_coll_libnbc_module_t*) module; @@ -124,9 +127,11 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI alg = NBC_ARED_RING; else if (libnbc_iallreduce_algorithm == 2) alg = NBC_ARED_BINOMIAL; - else if (libnbc_iallreduce_algorithm == 3 && count >= nprocs_pof2 && ompi_op_is_commute(op)) { + else if (libnbc_iallreduce_algorithm == 3 && count >= nprocs_pof2 && ompi_op_is_commute(op)) alg = NBC_ARED_REDSCAT_ALLGATHER; - } else + else if (libnbc_iallreduce_algorithm == 4) + alg = NBC_ARED_RDBL; + else alg = NBC_ARED_RING; } #ifdef NBC_CACHE_SCHEDULE @@ -159,6 +164,9 @@ static int nbc_allreduce_init(const void* sendbuf, void* recvbuf, int count, MPI case NBC_ARED_RING: res = allred_sched_ring(rank, p, count, datatype, sendbuf, recvbuf, op, size, ext, schedule, tmpbuf); break; + case NBC_ARED_RDBL: + res = allred_sched_recursivedoubling(rank, p, sendbuf, recvbuf, count, datatype, gap, op, inplace, schedule, tmpbuf); + break; } } @@ -470,6 +478,161 @@ static inline int allred_sched_diss(int rank, int p, int count, MPI_Datatype dat return OMPI_SUCCESS; } +/* + * allred_sched_recursivedoubling + * + * Function: Recursive doubling algorithm for iallreduce operation + * + * Description: Implements recursive doubling algorithm for iallreduce. + * The algorithm preserves order of operations so it can + * be used both by commutative and non-commutative operations. + * Schedule length: O(\log(p)) + * Memory requirements: + * Each process requires a temporary buffer: count * typesize = O(count) + * + * Example on 7 nodes: + * Initial state + * # 0 1 2 3 4 5 6 + * [0] [1] [2] [3] [4] [5] [6] + * Initial adjustment step for non-power of two nodes. + * old rank 1 3 5 6 + * new rank 0 1 2 3 + * [0+1] [2+3] [4+5] [6] + * Step 1 + * old rank 1 3 5 6 + * new rank 0 1 2 3 + * [0+1+] [0+1+] [4+5+] [4+5+] + * [2+3+] [2+3+] [6 ] [6 ] + * Step 2 + * old rank 1 3 5 6 + * new rank 0 1 2 3 + * [0+1+] [0+1+] [0+1+] [0+1+] + * [2+3+] [2+3+] [2+3+] [2+3+] + * [4+5+] [4+5+] [4+5+] [4+5+] + * [6 ] [6 ] [6 ] [6 ] + * Final adjustment step for non-power of two nodes + * # 0 1 2 3 4 5 6 + * [0+1+] [0+1+] [0+1+] [0+1+] [0+1+] [0+1+] [0+1+] + * [2+3+] [2+3+] [2+3+] [2+3+] [2+3+] [2+3+] [2+3+] + * [4+5+] [4+5+] [4+5+] [4+5+] [4+5+] [4+5+] [4+5+] + * [6 ] [6 ] [6 ] [6 ] [6 ] [6 ] [6 ] + * + */ +static inline int allred_sched_recursivedoubling(int rank, int p, const void *sendbuf, void *recvbuf, + int count, MPI_Datatype datatype, ptrdiff_t gap, MPI_Op op, + char inplace, NBC_Schedule *schedule, void *tmpbuf) +{ + int res, pof2, nprocs_rem, vrank; + char *tmpsend = NULL, *tmprecv = NULL, *tmpswap = NULL; + + tmpsend = (char*) tmpbuf - gap; + tmprecv = (char*) recvbuf; + + if (inplace) { + res = NBC_Sched_copy(recvbuf, false, count, datatype, + tmpsend, false, count, datatype, schedule, true); + } else { + res = NBC_Sched_copy((void *)sendbuf, false, count, datatype, + tmpsend, false, count, datatype, schedule, true); + } + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + /* Get nearest power of two less than or equal to comm size */ + pof2 = opal_next_poweroftwo(p) >> 1; + + /* Handle non-power-of-two case: + - Even ranks less than 2 * nprocs_rem send their data to (rank + 1), and + sets new rank to -1. + - Odd ranks less than 2 * nprocs_rem receive data from (rank - 1), + apply appropriate operation, and set new rank to rank/2 + - Everyone else sets rank to rank - nprocs_rem + */ + nprocs_rem = p - pof2; + if (rank < 2 * nprocs_rem) { + if (0 == rank % 2) { /* Even */ + res = NBC_Sched_send(tmpsend, false, count, datatype, rank + 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + vrank = -1; + } else { /* Odd */ + res = NBC_Sched_recv(tmprecv, false, count, datatype, rank - 1, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + /* tmpsend = tmprecv (op) tmpsend */ + res = NBC_Sched_op(tmprecv, false, tmpsend, false, count, datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + vrank = rank >> 1; + } + } else { + vrank = rank - nprocs_rem; + } + + /* Communication/Computation loop + - Exchange message with remote node. + - Perform appropriate operation taking in account order of operations: + result = value (op) result + */ + if (0 <= vrank) { + for (int distance = 1; distance < pof2; distance <<= 1) { + int remote = vrank ^ distance; + + /* Find real rank of remote node */ + if (remote < nprocs_rem) { + remote = remote * 2 + 1; + } else { + remote += nprocs_rem; + } + + /* Exchange the data */ + res = NBC_Sched_send(tmpsend, false, count, datatype, remote, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + res = NBC_Sched_recv(tmprecv, false, count, datatype, remote, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + /* Apply operation */ + if (rank < remote) { + /* tmprecv = tmpsend (op) tmprecv */ + res = NBC_Sched_op(tmpsend, false, tmprecv, false, + count, datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + + /* Swap tmpsend and tmprecv buffers */ + tmpswap = tmprecv; tmprecv = tmpsend; tmpsend = tmpswap; + } else { + /* tmpsend = tmprecv (op) tmpsend */ + res = NBC_Sched_op(tmprecv, false, tmpsend, false, + count, datatype, op, schedule, true); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + } + } + } + + /* Handle non-power-of-two case: + - Even ranks less than 2 * nprocs_rem receive result from (rank + 1) + - Odd ranks less than 2 * nprocs_rem send result from tmpsend to (rank - 1) + */ + if (rank < 2 * nprocs_rem) { + if (0 == rank % 2) { /* Even */ + res = NBC_Sched_recv(recvbuf, false, count, datatype, rank + 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + tmpsend = (char *)recvbuf; + } else { /* Odd */ + res = NBC_Sched_send(tmpsend, false, count, datatype, rank - 1, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + } + } + + /* Copy result back into recvbuf */ + if (tmpsend != recvbuf) { + res = NBC_Sched_copy(tmpsend, false, count, datatype, + recvbuf, false, count, datatype, schedule, false); + if (OPAL_UNLIKELY(OMPI_SUCCESS != res)) { return res; } + } + + return OMPI_SUCCESS; +} + static inline int allred_sched_ring (int r, int p, int count, MPI_Datatype datatype, const void *sendbuf, void *recvbuf, MPI_Op op, int size, int ext, NBC_Schedule *schedule, void *tmpbuf) { int segsize, *segsizes, *segoffsets; /* segment sizes and offsets per segment (number of segments == number of nodes */ @@ -1044,4 +1207,3 @@ int ompi_coll_libnbc_allreduce_inter_init(const void* sendbuf, void* recvbuf, in return OMPI_SUCCESS; } - From f51bd8ca0cb0e673140a9a1197b5dfdb66835c4b Mon Sep 17 00:00:00 2001 From: Tomislav Janjusic Date: Thu, 17 Jan 2019 06:20:58 +0200 Subject: [PATCH 642/674] Coll/hcoll: adding scatterv interface Signed-off-by: Valentin Petrov valentinp@mellanox.com (cherry picked from commit 6ea920e225c7ed905949c6afec554b6bf2705f94) Signed-off-by: Brian Barrett --- ompi/mca/coll/hcoll/coll_hcoll.h | 11 ++++++++ ompi/mca/coll/hcoll/coll_hcoll_module.c | 5 ++++ ompi/mca/coll/hcoll/coll_hcoll_ops.c | 37 +++++++++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/ompi/mca/coll/hcoll/coll_hcoll.h b/ompi/mca/coll/hcoll/coll_hcoll.h index aaecbc11fec..d7bb79658e1 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll.h +++ b/ompi/mca/coll/hcoll/coll_hcoll.h @@ -138,6 +138,8 @@ struct mca_coll_hcoll_module_t { mca_coll_base_module_t *previous_gather_module; mca_coll_base_module_gatherv_fn_t previous_gatherv; mca_coll_base_module_t *previous_gatherv_module; + mca_coll_base_module_scatterv_fn_t previous_scatterv; + mca_coll_base_module_t *previous_scatterv_module; mca_coll_base_module_reduce_scatter_fn_t previous_reduce_scatter; mca_coll_base_module_t *previous_reduce_scatter_module; mca_coll_base_module_ibcast_fn_t previous_ibcast; @@ -241,6 +243,15 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); + +int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *displs, + struct ompi_datatype_t *sdtype, + void* rbuf, int rcount, + struct ompi_datatype_t *rdtype, + int root, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module); + int mca_coll_hcoll_ibarrier(struct ompi_communicator_t *comm, ompi_request_t** request, mca_coll_base_module_t *module); diff --git a/ompi/mca/coll/hcoll/coll_hcoll_module.c b/ompi/mca/coll/hcoll/coll_hcoll_module.c index aa262c98492..7e638bb309e 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_module.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_module.c @@ -45,6 +45,7 @@ static void mca_coll_hcoll_module_clear(mca_coll_hcoll_module_t *hcoll_module) hcoll_module->previous_allgatherv = NULL; hcoll_module->previous_gather = NULL; hcoll_module->previous_gatherv = NULL; + hcoll_module->previous_scatterv = NULL; hcoll_module->previous_alltoall = NULL; hcoll_module->previous_alltoallv = NULL; hcoll_module->previous_alltoallw = NULL; @@ -68,6 +69,7 @@ static void mca_coll_hcoll_module_clear(mca_coll_hcoll_module_t *hcoll_module) hcoll_module->previous_allgatherv_module = NULL; hcoll_module->previous_gather_module = NULL; hcoll_module->previous_gatherv_module = NULL; + hcoll_module->previous_scatterv_module = NULL; hcoll_module->previous_alltoall_module = NULL; hcoll_module->previous_alltoallv_module = NULL; hcoll_module->previous_alltoallw_module = NULL; @@ -120,6 +122,7 @@ static void mca_coll_hcoll_module_destruct(mca_coll_hcoll_module_t *hcoll_module OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_allgather_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_allgatherv_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_gatherv_module); + OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_scatterv_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_alltoall_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_alltoallv_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_reduce_module); @@ -174,6 +177,7 @@ static int mca_coll_hcoll_save_coll_handlers(mca_coll_hcoll_module_t *hcoll_modu HCOL_SAVE_PREV_COLL_API(allgather); HCOL_SAVE_PREV_COLL_API(allgatherv); HCOL_SAVE_PREV_COLL_API(gatherv); + HCOL_SAVE_PREV_COLL_API(scatterv); HCOL_SAVE_PREV_COLL_API(alltoall); HCOL_SAVE_PREV_COLL_API(alltoallv); @@ -392,6 +396,7 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority) hcoll_module->super.coll_alltoall = hcoll_collectives.coll_alltoall ? mca_coll_hcoll_alltoall : NULL; hcoll_module->super.coll_alltoallv = hcoll_collectives.coll_alltoallv ? mca_coll_hcoll_alltoallv : NULL; hcoll_module->super.coll_gatherv = hcoll_collectives.coll_gatherv ? mca_coll_hcoll_gatherv : NULL; + hcoll_module->super.coll_scatterv = hcoll_collectives.coll_scatterv ? mca_coll_hcoll_scatterv : NULL; hcoll_module->super.coll_reduce = hcoll_collectives.coll_reduce ? mca_coll_hcoll_reduce : NULL; hcoll_module->super.coll_ibarrier = hcoll_collectives.coll_ibarrier ? mca_coll_hcoll_ibarrier : NULL; hcoll_module->super.coll_ibcast = hcoll_collectives.coll_ibcast ? mca_coll_hcoll_ibcast : NULL; diff --git a/ompi/mca/coll/hcoll/coll_hcoll_ops.c b/ompi/mca/coll/hcoll/coll_hcoll_ops.c index de563e455b3..5791fe17db1 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_ops.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_ops.c @@ -397,6 +397,43 @@ int mca_coll_hcoll_gatherv(const void* sbuf, int scount, } +int mca_coll_hcoll_scatterv(const void* sbuf, const int *scounts, const int *displs, + struct ompi_datatype_t *sdtype, + void* rbuf, int rcount, + struct ompi_datatype_t *rdtype, + int root, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module) +{ + dte_data_representation_t stype; + dte_data_representation_t rtype; + int rc; + HCOL_VERBOSE(20,"RUNNING HCOL SCATTERV"); + mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; + stype = ompi_dtype_2_hcoll_dtype(sdtype, NO_DERIVED); + rtype = ompi_dtype_2_hcoll_dtype(rdtype, NO_DERIVED); + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(stype) || HCOL_DTE_IS_ZERO(rtype))) { + /*If we are here then datatype is not simple predefined datatype */ + /*In future we need to add more complex mapping to the dte_data_representation_t */ + /* Now use fallback */ + HCOL_VERBOSE(20,"Ompi_datatype is not supported: sdtype = %s, rdtype = %s; calling fallback scatterv;", + sdtype->super.name, + rdtype->super.name); + rc = hcoll_module->previous_scatterv(sbuf, scounts, displs, sdtype, + rbuf, rcount, rdtype, root, + comm, hcoll_module->previous_scatterv_module); + return rc; + } + rc = hcoll_collectives.coll_scatterv((void *)sbuf, (int *)scounts, (int *)displs, stype, rbuf, rcount, rtype, root, hcoll_module->hcoll_context); + if (HCOLL_SUCCESS != rc){ + HCOL_VERBOSE(20,"RUNNING FALLBACK SCATTERV"); + rc = hcoll_module->previous_scatterv(sbuf, scounts, displs, sdtype, + rbuf, rcount, rdtype, root, + comm, hcoll_module->previous_scatterv_module); + } + return rc; +} + int mca_coll_hcoll_ibarrier(struct ompi_communicator_t *comm, ompi_request_t ** request, mca_coll_base_module_t *module) From 221fad6862a792ecbe12a65a2cbaa5990ce623ea Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 10 Sep 2019 13:55:59 +0900 Subject: [PATCH 643/674] coll/cuda: remove unnecessary references to ORTE Signed-off-by: Gilles Gouaillardet (cherry picked from commit 531171ca50955f8b7762f932388f633852454e6f) Signed-off-by: Brian Barrett --- ompi/mca/coll/cuda/coll_cuda_module.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ompi/mca/coll/cuda/coll_cuda_module.c b/ompi/mca/coll/cuda/coll_cuda_module.c index d8702dd378e..137f55a7636 100644 --- a/ompi/mca/coll/cuda/coll_cuda_module.c +++ b/ompi/mca/coll/cuda/coll_cuda_module.c @@ -3,6 +3,8 @@ * of Tennessee Research Foundation. All rights * reserved. * Copyright (c) 2014 NVIDIA Corporation. All rights reserved. + * Copyright (c) 2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -19,8 +21,8 @@ #include "mpi.h" -#include "orte/util/show_help.h" -#include "orte/util/proc_info.h" +#include "opal/util/show_help.h" +#include "ompi/mca/rte/rte.h" #include "ompi/constants.h" #include "ompi/communicator/communicator.h" @@ -146,8 +148,8 @@ int mca_coll_cuda_module_enable(mca_coll_base_module_t *module, if (good) { return OMPI_SUCCESS; } - orte_show_help("help-mpi-coll-cuda.txt", "missing collective", true, - orte_process_info.nodename, + opal_show_help("help-mpi-coll-cuda.txt", "missing collective", true, + ompi_process_info.nodename, mca_coll_cuda_component.priority, msg); return OMPI_ERR_NOT_FOUND; } From 7eb94164a017a49e50411366ce261eb79c86f91a Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Thu, 24 Oct 2019 16:06:27 +0000 Subject: [PATCH 644/674] COLL/TUNED: Add linear scatter using isend for mlnx platform Signed-off-by: Mikhail Brinskii (cherry picked from commit f2cbd4806e9a38b5e58c0fc69b41624af79fb99b) Signed-off-by: Brian Barrett --- contrib/platform/mellanox/optimized.conf | 5 + ompi/mca/coll/base/coll_base_functions.h | 2 + ompi/mca/coll/base/coll_base_scatter.c | 112 +++++++++++++++++- ompi/mca/coll/tuned/coll_tuned.h | 5 + ompi/mca/coll/tuned/coll_tuned_component.c | 7 ++ .../coll/tuned/coll_tuned_decision_fixed.c | 11 ++ .../coll/tuned/coll_tuned_scatter_decision.c | 41 ++++++- 7 files changed, 181 insertions(+), 2 deletions(-) diff --git a/contrib/platform/mellanox/optimized.conf b/contrib/platform/mellanox/optimized.conf index 048d85f3427..b86b37c9e2f 100644 --- a/contrib/platform/mellanox/optimized.conf +++ b/contrib/platform/mellanox/optimized.conf @@ -10,6 +10,7 @@ # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # Copyright (c) 2006 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2019 Mellanox Technologies. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -84,4 +85,8 @@ bml_r2_show_unreach_errors = 0 coll_tuned_alltoall_large_msg = 250000 coll_tuned_alltoall_min_procs = 2048 coll_tuned_alltoall_algorithm_max_requests = 8 +coll_tuned_scatter_intermediate_msg = 8192 +coll_tuned_scatter_large_msg = 250000 +coll_tuned_scatter_min_procs = 1048510 +coll_tuned_scatter_algorithm_max_requests = 64 diff --git a/ompi/mca/coll/base/coll_base_functions.h b/ompi/mca/coll/base/coll_base_functions.h index 40de8762eb2..11b46ba47eb 100644 --- a/ompi/mca/coll/base/coll_base_functions.h +++ b/ompi/mca/coll/base/coll_base_functions.h @@ -18,6 +18,7 @@ * and Technology (RIST). All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -291,6 +292,7 @@ int ompi_coll_base_scan_intra_recursivedoubling(SCAN_ARGS); /* Scatter */ int ompi_coll_base_scatter_intra_basic_linear(SCATTER_ARGS); int ompi_coll_base_scatter_intra_binomial(SCATTER_ARGS); +int ompi_coll_base_scatter_intra_linear_nb(SCATTER_ARGS, int max_reqs); /* ScatterV */ diff --git a/ompi/mca/coll/base/coll_base_scatter.c b/ompi/mca/coll/base/coll_base_scatter.c index 648845689df..0ca35971532 100644 --- a/ompi/mca/coll/base/coll_base_scatter.c +++ b/ompi/mca/coll/base/coll_base_scatter.c @@ -14,6 +14,7 @@ * reserved. * Copyright (c) 2015-2016 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -273,5 +274,114 @@ ompi_coll_base_scatter_intra_basic_linear(const void *sbuf, int scount, return MPI_SUCCESS; } - /* copied function (with appropriate renaming) ends here */ + +/* + * Use isends for distributing the data with periodic sync by blocking send. + * Blocking send acts like a local resources flush, because it ensures + * progression until the message is sent/(copied to some sort of transmit buffer). + */ +int +ompi_coll_base_scatter_intra_linear_nb(const void *sbuf, int scount, + struct ompi_datatype_t *sdtype, + void *rbuf, int rcount, + struct ompi_datatype_t *rdtype, + int root, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module, + int max_reqs) +{ + int i, rank, size, err, line, nreqs; + ptrdiff_t incr; + char *ptmp; + ompi_request_t **reqs = NULL, **preq; + + rank = ompi_comm_rank(comm); + size = ompi_comm_size(comm); + + /* If not root, receive data. */ + if (rank != root) { + err = MCA_PML_CALL(recv(rbuf, rcount, rdtype, root, + MCA_COLL_BASE_TAG_SCATTER, + comm, MPI_STATUS_IGNORE)); + if (MPI_SUCCESS != err) { + line = __LINE__; goto err_hndl; + } + + return MPI_SUCCESS; + } + + if (max_reqs <= 1) { + max_reqs = 0; + nreqs = size - 1; /* no send for myself */ + } else { + /* We use blocking MPI_Send (which does not need a request) + * every max_reqs send operation (which is size/max_reqs at most), + * therefore no need to allocate requests for these sends. */ + nreqs = size - (size / max_reqs); + } + + reqs = ompi_coll_base_comm_get_reqs(module->base_data, nreqs); + if (NULL == reqs) { + err = OMPI_ERR_OUT_OF_RESOURCE; + line = __LINE__; goto err_hndl; + } + + err = ompi_datatype_type_extent(sdtype, &incr); + if (OMPI_SUCCESS != err) { + line = __LINE__; goto err_hndl; + } + incr *= scount; + + /* I am the root, loop sending data. */ + for (i = 0, ptmp = (char *)sbuf, preq = reqs; i < size; ++i, ptmp += incr) { + /* simple optimization */ + if (i == rank) { + if (MPI_IN_PLACE != rbuf) { + err = ompi_datatype_sndrcv(ptmp, scount, sdtype, rbuf, rcount, + rdtype); + } + } else { + if (!max_reqs || (i % max_reqs)) { + err = MCA_PML_CALL(isend(ptmp, scount, sdtype, i, + MCA_COLL_BASE_TAG_SCATTER, + MCA_PML_BASE_SEND_STANDARD, + comm, preq++)); + } else { + err = MCA_PML_CALL(send(ptmp, scount, sdtype, i, + MCA_COLL_BASE_TAG_SCATTER, + MCA_PML_BASE_SEND_STANDARD, + comm)); + } + } + if (MPI_SUCCESS != err) { + line = __LINE__; goto err_hndl; + } + } + + err = ompi_request_wait_all(preq - reqs, reqs, MPI_STATUSES_IGNORE); + if (MPI_SUCCESS != err) { + line = __LINE__; goto err_hndl; + } + + return MPI_SUCCESS; + +err_hndl: + if (NULL != reqs) { + /* find a real error code */ + if (MPI_ERR_IN_STATUS == err) { + for (i = 0; i < nreqs; i++) { + if (MPI_REQUEST_NULL == reqs[i]) continue; + if (MPI_ERR_PENDING == reqs[i]->req_status.MPI_ERROR) continue; + err = reqs[i]->req_status.MPI_ERROR; + break; + } + } + ompi_coll_base_free_reqs(reqs, nreqs); + } + OPAL_OUTPUT((ompi_coll_base_framework.framework_output, + "%s:%4d\tError occurred %d, rank %2d", __FILE__, line, err, rank)); + (void)line; /* silence compiler warning */ + return err; +} + diff --git a/ompi/mca/coll/tuned/coll_tuned.h b/ompi/mca/coll/tuned/coll_tuned.h index d6fc4b89bde..e4d66cc6004 100644 --- a/ompi/mca/coll/tuned/coll_tuned.h +++ b/ompi/mca/coll/tuned/coll_tuned.h @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -41,6 +42,10 @@ extern int ompi_coll_tuned_alltoall_intermediate_msg; extern int ompi_coll_tuned_alltoall_large_msg; extern int ompi_coll_tuned_alltoall_min_procs; extern int ompi_coll_tuned_alltoall_max_requests; +extern int ompi_coll_tuned_scatter_intermediate_msg; +extern int ompi_coll_tuned_scatter_large_msg; +extern int ompi_coll_tuned_scatter_min_procs; +extern int ompi_coll_tuned_scatter_blocking_send_ratio; /* forced algorithm choices */ /* this structure is for storing the indexes to the forced algorithm mca params... */ diff --git a/ompi/mca/coll/tuned/coll_tuned_component.c b/ompi/mca/coll/tuned/coll_tuned_component.c index 25e9bc77a0d..a17cfacb126 100644 --- a/ompi/mca/coll/tuned/coll_tuned_component.c +++ b/ompi/mca/coll/tuned/coll_tuned_component.c @@ -16,6 +16,7 @@ * reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -64,6 +65,12 @@ int ompi_coll_tuned_alltoall_large_msg = 3000; int ompi_coll_tuned_alltoall_min_procs = 0; /* disable by default */ int ompi_coll_tuned_alltoall_max_requests = 0; /* no limit for alltoall by default */ +/* Disable by default */ +int ompi_coll_tuned_scatter_intermediate_msg = 0; +int ompi_coll_tuned_scatter_large_msg = 0; +int ompi_coll_tuned_scatter_min_procs = 0; +int ompi_coll_tuned_scatter_blocking_send_ratio = 0; + /* forced alogrithm variables */ /* indices for the MCA parameters */ coll_tuned_force_algorithm_mca_param_indices_t ompi_coll_tuned_forced_params[COLLCOUNT] = {{0}}; diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index 97560c5c089..b3699ed2736 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -15,6 +15,7 @@ * reserved. * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -780,6 +781,7 @@ int ompi_coll_tuned_scatter_intra_dec_fixed(const void *sbuf, int scount, { const size_t small_block_size = 300; const int small_comm_size = 10; + const int intermediate_comm_size = 64; int communicator_size, rank; size_t dsize, block_size; @@ -802,7 +804,16 @@ int ompi_coll_tuned_scatter_intra_dec_fixed(const void *sbuf, int scount, return ompi_coll_base_scatter_intra_binomial(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, module); + } else if ((communicator_size < ompi_coll_tuned_scatter_min_procs) && + (communicator_size > intermediate_comm_size) && + (block_size >= ompi_coll_tuned_scatter_intermediate_msg) && + (block_size < ompi_coll_tuned_scatter_large_msg)) { + return ompi_coll_base_scatter_intra_linear_nb(sbuf, scount, sdtype, + rbuf, rcount, rdtype, + root, comm, module, + ompi_coll_tuned_scatter_blocking_send_ratio); } + return ompi_coll_base_scatter_intra_basic_linear(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, module); diff --git a/ompi/mca/coll/tuned/coll_tuned_scatter_decision.c b/ompi/mca/coll/tuned/coll_tuned_scatter_decision.c index b7bcdd6be86..df1176ff4ec 100644 --- a/ompi/mca/coll/tuned/coll_tuned_scatter_decision.c +++ b/ompi/mca/coll/tuned/coll_tuned_scatter_decision.c @@ -5,6 +5,7 @@ * reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -36,6 +37,7 @@ static mca_base_var_enum_value_t scatter_algorithms[] = { {0, "ignore"}, {1, "basic_linear"}, {2, "binomial"}, + {3, "linear_nb"}, {0, NULL} }; @@ -74,7 +76,7 @@ ompi_coll_tuned_scatter_intra_check_forced_init(coll_tuned_force_algorithm_mca_p mca_param_indices->algorithm_param_index = mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, "scatter_algorithm", - "Which scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial.", + "Which scatter algorithm is used. Can be locked down to choice of: 0 ignore, 1 basic linear, 2 binomial, 3 non-blocking linear.", MCA_BASE_VAR_TYPE_INT, new_enum, 0, MCA_BASE_VAR_FLAG_SETTABLE, OPAL_INFO_LVL_5, MCA_BASE_VAR_SCOPE_ALL, @@ -114,6 +116,38 @@ ompi_coll_tuned_scatter_intra_check_forced_init(coll_tuned_force_algorithm_mca_p MCA_BASE_VAR_SCOPE_ALL, &coll_tuned_scatter_chain_fanout); + (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "scatter_min_procs", + "use basic linear algorithm for communicators larger than this value", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_coll_tuned_scatter_min_procs); + + (void)mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "scatter_algorithm_max_requests", + "Issue a blocking send every this many non-blocking requests. Only has meaning for non-blocking linear algorithm.", + MCA_BASE_VAR_TYPE_INT, NULL, 0, MCA_BASE_VAR_FLAG_SETTABLE, + OPAL_INFO_LVL_5, + MCA_BASE_VAR_SCOPE_ALL, + &ompi_coll_tuned_scatter_blocking_send_ratio); + + (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "scatter_intermediate_msg", + "use non-blocking linear algorithm for messages larger than this value", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_coll_tuned_scatter_intermediate_msg); + + (void) mca_base_component_var_register(&mca_coll_tuned_component.super.collm_version, + "scatter_large_msg", + "use linear algorithm for messages larger than this value", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_READONLY, + &ompi_coll_tuned_scatter_large_msg); + return (MPI_SUCCESS); } @@ -144,6 +178,11 @@ ompi_coll_tuned_scatter_intra_do_this(const void *sbuf, int scount, return ompi_coll_base_scatter_intra_binomial(sbuf, scount, sdtype, rbuf, rcount, rdtype, root, comm, module); + case (3): + return ompi_coll_base_scatter_intra_linear_nb(sbuf, scount, sdtype, + rbuf, rcount, rdtype, + root, comm, module, + ompi_coll_tuned_scatter_blocking_send_ratio); } /* switch */ OPAL_OUTPUT((ompi_coll_tuned_stream, "coll:tuned:scatter_intra_do_this attempt to select algorithm %d when only 0-%d is valid?", From 03758b1ef7ab9166f58a1f855f7fcfa0b4129c19 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 14 Apr 2020 23:02:12 +0000 Subject: [PATCH 645/674] coll/tuned: Fix typos Signed-off-by: William Zhang (cherry picked from commit 50640402ab5765a0dfde71628adfbbaa686555bd) Signed-off-by: Brian Barrett --- ompi/mca/coll/tuned/coll_tuned_dynamic_file.c | 4 ++-- ompi/mca/coll/tuned/coll_tuned_module.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c b/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c index eab50091838..4ab319b85e1 100644 --- a/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c +++ b/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c @@ -90,14 +90,14 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t** fptr = fopen (fname, "r"); if (!fptr) { - OPAL_OUTPUT((ompi_coll_tuned_stream,"cannot read rules file [%s]\n", fname)); + OPAL_OUTPUT((ompi_coll_tuned_stream,"Cannot read rules file [%s]\n", fname)); goto on_file_error; } /* make space and init the algorithm rules for each of the n_collectives MPI collectives */ alg_rules = ompi_coll_tuned_mk_alg_rules (n_collectives); if (NULL == alg_rules) { - OPAL_OUTPUT((ompi_coll_tuned_stream,"cannot cannot allocate rules for file [%s]\n", fname)); + OPAL_OUTPUT((ompi_coll_tuned_stream,"Cannot allocate rules for file [%s]\n", fname)); goto on_file_error; } diff --git a/ompi/mca/coll/tuned/coll_tuned_module.c b/ompi/mca/coll/tuned/coll_tuned_module.c index ff409b5eba0..bf2c7da1434 100644 --- a/ompi/mca/coll/tuned/coll_tuned_module.c +++ b/ompi/mca/coll/tuned/coll_tuned_module.c @@ -91,7 +91,7 @@ ompi_coll_tuned_comm_query(struct ompi_communicator_t *comm, int *priority) tuned_module->super.coll_module_enable = tuned_module_enable; tuned_module->super.ft_event = mca_coll_tuned_ft_event; - /* By default stick with the fied version of the tuned collectives. Later on, + /* By default stick with the fixed version of the tuned collectives. Later on, * when the module get enabled, set the correct version based on the availability * of the dynamic rules. */ From db6ed187b2d9148ebf1a7b6c416a7a6bcc083420 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Tue, 14 Apr 2020 23:02:41 +0000 Subject: [PATCH 646/674] coll/tuned: Add NULL check to prevent segfault Signed-off-by: William Zhang cr https://code.amazon.com/reviews/CR-23837553 (cherry picked from commit 771f9c011d2a4daf78a4b26f88c971b3868fe132) Signed-off-by: Brian Barrett --- ompi/mca/coll/tuned/coll_tuned_dynamic_file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c b/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c index 4ab319b85e1..7ba85078fd2 100644 --- a/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c +++ b/ompi/mca/coll/tuned/coll_tuned_dynamic_file.c @@ -142,6 +142,10 @@ int ompi_coll_tuned_read_rules_config_file (char *fname, ompi_coll_alg_rule_t** OPAL_OUTPUT((ompi_coll_tuned_stream, "Read communicator count %d for dynamic rule for collective ID %d\n", NCS, CI)); alg_p->n_com_sizes = NCS; alg_p->com_rules = ompi_coll_tuned_mk_com_rules (NCS, CI); + if (NULL == alg_p->com_rules) { + OPAL_OUTPUT((ompi_coll_tuned_stream,"Cannot allocate com rules for file [%s]\n", fname)); + goto on_file_error; + } for (ncs=0;ncsn_msg_sizes = NMS; com_p->msg_rules = ompi_coll_tuned_mk_msg_rules (NMS, CI, ncs, CS); + if (NULL == com_p->msg_rules) { + OPAL_OUTPUT((ompi_coll_tuned_stream,"Cannot allocate msg rules for file [%s]\n", fname)); + goto on_file_error; + } msg_p = com_p->msg_rules; From 339ee6378ad2b540fb05547cc8596f0110d35b2f Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Sun, 31 May 2020 03:03:19 +0000 Subject: [PATCH 647/674] dist: Add Collectives backports to NEWS Signed-off-by: Brian Barrett --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d7b29d3f717..868e6bc3ce7 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,7 @@ included in the vX.Y.Z section and be denoted as: - OFI/libfabric: Added support for multiple NICs - OFI/libfabric: Added support for Scalable Endpoints - OFI/libfabric: Added btl for one-sided support +- libnbc: Adding numerous performance-improving algorithms 4.0.4 -- June, 2020 ----------------------- From 7987a7f56e491bb606d151a80e8d5c6cf2ab1d1f Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 26 Jun 2020 07:23:27 -0700 Subject: [PATCH 648/674] common_ofi: fix preprocessor macro typo Signed-off-by: Jeff Squyres (cherry picked from commit f64c30e93c719b0c910e81f716b68d5889de8ce5) --- opal/mca/common/ofi/common_ofi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 9d6cc8ade2d..08e9f77c258 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -4,6 +4,7 @@ * reserved. * Copyright (c) 2020 Triad National Security, LLC. All rights * reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved * $COPYRIGHT$ * * Additional copyrights may follow @@ -389,7 +390,7 @@ opal_mca_common_ofi_select_provider(struct fi_info *provider_list, int local_ind } #endif -#if OPAL_DEBUG_ENABLE +#if OPAL_ENABLE_DEBUG opal_output_verbose(1, opal_common_ofi.output, "local rank: %d device: %s cpusets match: %s\n", local_index, provider->domain_attr->name, From 6e145188d91f35738007bfc6e0c4d7b4183733e4 Mon Sep 17 00:00:00 2001 From: raafatfeki Date: Mon, 15 Jun 2020 11:28:34 -0400 Subject: [PATCH 649/674] fs/ime & fbtl/ime: Support of IME file system Signed-off-by: raafatfeki --- config/ompi_check_ime.m4 | 62 +++++++ ompi/mca/common/ompio/common_ompio.h | 1 + ompi/mca/fbtl/ime/Makefile.am | 40 +++++ ompi/mca/fbtl/ime/configure.m4 | 29 ++++ ompi/mca/fbtl/ime/fbtl_ime.c | 182 ++++++++++++++++++++ ompi/mca/fbtl/ime/fbtl_ime.h | 99 +++++++++++ ompi/mca/fbtl/ime/fbtl_ime_blocking_op.c | 122 +++++++++++++ ompi/mca/fbtl/ime/fbtl_ime_component.c | 79 +++++++++ ompi/mca/fbtl/ime/fbtl_ime_nonblocking_op.c | 175 +++++++++++++++++++ ompi/mca/fbtl/ime/owner.txt | 7 + ompi/mca/fs/base/fs_base_get_parent_dir.c | 3 + ompi/mca/fs/ime/Makefile.am | 47 +++++ ompi/mca/fs/ime/configure.m4 | 30 ++++ ompi/mca/fs/ime/fs_ime.c | 155 +++++++++++++++++ ompi/mca/fs/ime/fs_ime.h | 72 ++++++++ ompi/mca/fs/ime/fs_ime_component.c | 77 +++++++++ ompi/mca/fs/ime/fs_ime_file_close.c | 42 +++++ ompi/mca/fs/ime/fs_ime_file_delete.c | 41 +++++ ompi/mca/fs/ime/fs_ime_file_get_size.c | 44 +++++ ompi/mca/fs/ime/fs_ime_file_open.c | 70 ++++++++ ompi/mca/fs/ime/fs_ime_file_set_size.c | 50 ++++++ ompi/mca/fs/ime/fs_ime_file_sync.c | 33 ++++ ompi/mca/fs/ime/owner.txt | 7 + 23 files changed, 1467 insertions(+) create mode 100644 config/ompi_check_ime.m4 create mode 100644 ompi/mca/fbtl/ime/Makefile.am create mode 100644 ompi/mca/fbtl/ime/configure.m4 create mode 100644 ompi/mca/fbtl/ime/fbtl_ime.c create mode 100644 ompi/mca/fbtl/ime/fbtl_ime.h create mode 100644 ompi/mca/fbtl/ime/fbtl_ime_blocking_op.c create mode 100644 ompi/mca/fbtl/ime/fbtl_ime_component.c create mode 100644 ompi/mca/fbtl/ime/fbtl_ime_nonblocking_op.c create mode 100644 ompi/mca/fbtl/ime/owner.txt create mode 100644 ompi/mca/fs/ime/Makefile.am create mode 100644 ompi/mca/fs/ime/configure.m4 create mode 100644 ompi/mca/fs/ime/fs_ime.c create mode 100644 ompi/mca/fs/ime/fs_ime.h create mode 100644 ompi/mca/fs/ime/fs_ime_component.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_close.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_delete.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_get_size.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_open.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_set_size.c create mode 100644 ompi/mca/fs/ime/fs_ime_file_sync.c create mode 100644 ompi/mca/fs/ime/owner.txt diff --git a/config/ompi_check_ime.m4 b/config/ompi_check_ime.m4 new file mode 100644 index 00000000000..ab832bf852f --- /dev/null +++ b/config/ompi_check_ime.m4 @@ -0,0 +1,62 @@ +dnl -*- shell-script -*- +dnl +dnl Copyright (c) 2018 DataDirect Networks. All rights reserved. +dnl $COPYRIGHT$ +dnl +dnl Additional copyrights may follow +dnl +dnl $HEADER$ +dnl + +# OMPI_CHECK_IME(prefix, [action-if-found], [action-if-not-found]) +# -------------------------------------------------------- +# check if IME support can be found. sets prefix_{CPPFLAGS, +# LDFLAGS, LIBS} as needed and runs action-if-found if there is +# support, otherwise executes action-if-not-found +AC_DEFUN([OMPI_CHECK_IME],[ + + check_ime_CPPFLAGS= + check_ime_LDFLAGS= + check_ime_LIBS= + + check_ime_configuration="none" + ompi_check_ime_happy="yes" + + + # Get some configuration information + AC_ARG_WITH([ime], + [AC_HELP_STRING([--with-ime(=DIR)], + [Build IME support, optionally adding DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries])]) + OPAL_CHECK_WITHDIR([ime], [$with_ime], [include/ime_native.h]) + + AS_IF([test "$with_ime" = "no"], + [ompi_check_ime_happy="no"], + [AS_IF([test -z "$with_ime"], + [ompi_check_ime_dir="/usr/local"], + [ompi_check_ime_dir=$with_ime]) + + if test -e "$ompi_check_ime_dir/lib64" ; then + ompi_check_ime_libdir="$ompi_check_ime_dir/lib64" + else + ompi_check_ime_libdir="$ompi_check_ime_dir/lib" + fi + + # Add correct -I and -L flags + OPAL_CHECK_PACKAGE([$1], [ime_native.h], [im_client], [ime_client_native2_init], [], + [$ompi_check_ime_dir], [$ompi_check_ime_libdir], + [ompi_check_ime_happy="yes"], + [OPAL_CHECK_PACKAGE([$1], [ime_native.h], [im_client], [ime_native_init], [], + [$ompi_check_ime_dir], [$ompi_check_ime_libdir], + [ompi_check_ime_happy="yes"], + [ompi_check_ime_happy="no"]) + ]) + ]) + + AS_IF([test "$ompi_check_ime_happy" = "yes"], + [$2], + [AS_IF([test ! -z "$with_ime" && test "$with_ime" != "no"], + [echo IME support not found]) + $3]) + + ]) + diff --git a/ompi/mca/common/ompio/common_ompio.h b/ompi/mca/common/ompio/common_ompio.h index 2f9dc45ad64..66b5c2077a7 100644 --- a/ompi/mca/common/ompio/common_ompio.h +++ b/ompi/mca/common/ompio/common_ompio.h @@ -107,6 +107,7 @@ enum ompio_fs_type PVFS2 = 2, LUSTRE = 3, PLFS = 4, + IME = 5, GPFS = 6 }; diff --git a/ompi/mca/fbtl/ime/Makefile.am b/ompi/mca/fbtl/ime/Makefile.am new file mode 100644 index 00000000000..2dfebbcb0c0 --- /dev/null +++ b/ompi/mca/fbtl/ime/Makefile.am @@ -0,0 +1,40 @@ +# +# Copyright (c) 2018 DataDirect Networks. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +if MCA_BUILD_ompi_fbtl_ime_DSO +component_noinst = +component_install = mca_fbtl_ime.la +else +component_noinst = libmca_fbtl_ime.la +component_install = +endif + + +# Source files + +fbtl_ime_sources = \ + fbtl_ime.h \ + fbtl_ime.c \ + fbtl_ime_component.c \ + fbtl_ime_blocking_op.c \ + fbtl_ime_nonblocking_op.c + +AM_CPPFLAGS = $(fbtl_ime_CPPFLAGS) + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_fbtl_ime_la_SOURCES = $(fbtl_ime_sources) +mca_fbtl_ime_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(fbtl_ime_LIBS) +mca_fbtl_ime_la_LDFLAGS = -module -avoid-version $(fbtl_ime_LDFLAGS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_fbtl_ime_la_SOURCES = $(fbtl_ime_sources) +libmca_fbtl_ime_la_LIBADD = $(fbtl_ime_LIBS) +libmca_fbtl_ime_la_LDFLAGS = -module -avoid-version $(fbtl_ime_LDFLAGS) \ No newline at end of file diff --git a/ompi/mca/fbtl/ime/configure.m4 b/ompi/mca/fbtl/ime/configure.m4 new file mode 100644 index 00000000000..388b01e222e --- /dev/null +++ b/ompi/mca/fbtl/ime/configure.m4 @@ -0,0 +1,29 @@ +# -*- shell-script -*- +# +# Copyright (c) 2018 DataDirect Networks. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_fbtl_ime_CONFIG(action-if-can-compile, +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_ompi_fbtl_ime_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/fbtl/ime/Makefile]) + + OMPI_CHECK_IME([fbtl_ime], + [fbtl_ime_happy="yes"], + [fbtl_ime_happy="no"]) + + AS_IF([test "$fbtl_ime_happy" = "yes"], + [$1], + [$2]) + + # substitute in the things needed to build ime + AC_SUBST([fbtl_ime_CPPFLAGS]) + AC_SUBST([fbtl_ime_LDFLAGS]) + AC_SUBST([fbtl_ime_LIBS]) +])dnl diff --git a/ompi/mca/fbtl/ime/fbtl_ime.c b/ompi/mca/fbtl/ime/fbtl_ime.c new file mode 100644 index 00000000000..5e4179ac003 --- /dev/null +++ b/ompi/mca/fbtl/ime/fbtl_ime.c @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "mpi.h" + +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/fbtl/ime/fbtl_ime.h" + +/* + * ******************************************************************* + * ************************ actions structure ************************ + * ******************************************************************* + */ +static mca_fbtl_base_module_1_0_0_t ime = { + mca_fbtl_ime_module_init, /* initalise after being selected */ + mca_fbtl_ime_module_finalize, /* close a module on a communicator */ + mca_fbtl_ime_preadv, /* blocking read */ + mca_fbtl_ime_ipreadv, /* non-blocking read*/ + mca_fbtl_ime_pwritev, /* blocking write */ + mca_fbtl_ime_ipwritev, /* non-blocking write */ + mca_fbtl_ime_progress, /* module specific progress */ + mca_fbtl_ime_request_free /* free module specific data items on the request */ +}; +/* + * ******************************************************************* + * ************************* structure ends ************************** + * ******************************************************************* + */ + +int mca_fbtl_ime_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads) +{ + /* Nothing to do */ + return OMPI_SUCCESS; +} + +struct mca_fbtl_base_module_1_0_0_t * +mca_fbtl_ime_component_file_query (ompio_file_t *fh, int *priority) +{ + *priority = mca_fbtl_ime_priority; + + /* Do the same as the FS component: + Only return a non-null component if IME + can handle the IO operations. */ + if (IME == fh->f_fstype) { + if (*priority < FBTL_IME_INCREASED_PRIORITY) { + *priority = FBTL_IME_INCREASED_PRIORITY; + } + return &ime; + } + + return NULL; +} + +int mca_fbtl_ime_component_file_unquery (ompio_file_t *file) +{ + /* This function might be needed for some purposes later. for now it + * does not have anything to do since there are no steps which need + * to be undone if this module is not selected */ + + return OMPI_SUCCESS; +} + +int mca_fbtl_ime_module_init (ompio_file_t *file) +{ + return OMPI_SUCCESS; +} + + +int mca_fbtl_ime_module_finalize (ompio_file_t *file) +{ + return OMPI_SUCCESS; +} + +bool mca_fbtl_ime_progress ( mca_ompio_request_t *req) +{ + int i=0, lcount=0, ret_code=0; + mca_fbtl_ime_request_data_t *data=(mca_fbtl_ime_request_data_t *)req->req_data; + + /* Go through all the requests in the current batch to check + * if they have finished. */ + for (i=data->aio_first_active_req; i < data->aio_last_active_req; i++ ) { + if ( data->aio_req_status[i] == FBTL_IME_REQ_CLOSED ) { + lcount++; + } + else if ( data->aio_req_status[i] >= 0 ) { + /* request has finished */ + data->aio_open_reqs--; + lcount++; + data->aio_total_len += data->aio_req_status[i]; + data->aio_req_status[i] = FBTL_IME_REQ_CLOSED; + } + else if ( data->aio_req_status[i] == FBTL_IME_REQ_ERROR ) { + /* an error occured. */ + data->aio_open_reqs--; + lcount++; + data->aio_req_fail_count++; + data->aio_req_status[i] = FBTL_IME_REQ_CLOSED; + } + else { + /* not yet done */ + } + } + + /* In case the current batch of requests terminated, exit if an error + * happened for any request. + */ + if ( data->aio_req_fail_count > 0 && + lcount == data->aio_last_active_req - data->aio_first_active_req ) { + goto error_exit; + } + + /* In case some requests are pending, and no error happened in any of the + * previous requests, then the next batch of operations should be prepared. + */ + if ( (lcount == data->aio_req_chunks) && (0 != data->aio_open_reqs) ) { + + /* prepare the next batch of operations */ + data->aio_first_active_req = data->aio_last_active_req; + if ( (data->aio_req_count-data->aio_last_active_req) > data->aio_req_chunks ) { + data->aio_last_active_req += data->aio_req_chunks; + } + else { + data->aio_last_active_req = data->aio_req_count; + } + + /* Send the requests. */ + for ( i=data->aio_first_active_req; i< data->aio_last_active_req; i++ ) { + if ( FBTL_IME_READ == data->aio_req_type && + ime_native_aio_read(&data->aio_reqs[i]) < 0 ) { + opal_output(1, "mca_fbtl_ime_progress: error in aio_read()"); + data->aio_req_status[i] = FBTL_IME_REQ_ERROR; + data->aio_last_active_req = i + 1; + break; + } + else if ( FBTL_IME_WRITE == data->aio_req_type && + ime_native_aio_write(&data->aio_reqs[i]) < 0 ) { + opal_output(1, "mca_fbtl_ime_progress: error in aio_write()"); + data->aio_req_status[i] = FBTL_IME_REQ_ERROR; + data->aio_last_active_req = i + 1; + break; + } + } + } + + if ( 0 == data->aio_open_reqs ) { + /* all pending operations are finished for this request */ + req->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; + req->req_ompi.req_status._ucount = data->aio_total_len; + return true; + } + return false; + +error_exit: + req->req_ompi.req_status.MPI_ERROR = OMPI_ERROR; + req->req_ompi.req_status._ucount = data->aio_total_len; + return true; +} + +void mca_fbtl_ime_request_free ( mca_ompio_request_t *req) +{ + /* Free the fbtl specific data structures */ + mca_fbtl_ime_request_data_t *data=(mca_fbtl_ime_request_data_t *)req->req_data; + if (NULL != data) { + free (data->allocated_data); + free (data); + req->req_data = NULL; + } +} + +void mca_fbtl_ime_complete_cb (struct ime_aiocb *aiocb, int err, ssize_t bytes) +{ + ssize_t *req_status = (ssize_t *) aiocb->user_context; + *req_status = err == 0 ? bytes : FBTL_IME_REQ_ERROR; +} \ No newline at end of file diff --git a/ompi/mca/fbtl/ime/fbtl_ime.h b/ompi/mca/fbtl/ime/fbtl_ime.h new file mode 100644 index 00000000000..fe0a555a58b --- /dev/null +++ b/ompi/mca/fbtl/ime/fbtl_ime.h @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_FBTL_IME_H +#define MCA_FBTL_IME_H + +#include "ime_native.h" + +#include "ompi_config.h" +#include "ompi/mca/mca.h" +#include "ompi/mca/fbtl/fbtl.h" +#include "ompi/mca/common/ompio/common_ompio.h" +#include "ompi/mca/common/ompio/common_ompio_request.h" + +extern int mca_fbtl_ime_priority; +extern int mca_fbtl_ime_iov_max; +extern int mca_fbtl_ime_aio_reqs_max; + +#define FBTL_IME_BASE_PRIORITY 0 +#define FBTL_IME_INCREASED_PRIORITY 50 +#define FBTL_IME_AIO_REQS_MAX 128 + +#ifdef IME_IOV_MAX +#define FBTL_IME_IOV_MAX IME_IOV_MAX +#else +#define FBTL_IME_IOV_MAX 1024 +#endif + + +BEGIN_C_DECLS + +int mca_fbtl_ime_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads); +struct mca_fbtl_base_module_1_0_0_t * +mca_fbtl_ime_component_file_query (ompio_file_t *file, int *priority); +int mca_fbtl_ime_component_file_unquery (ompio_file_t *file); + +int mca_fbtl_ime_module_init (ompio_file_t *file); +int mca_fbtl_ime_module_finalize (ompio_file_t *file); + +OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_ime_component; +/* + * ****************************************************************** + * ********* functions which are implemented in this module ********* + * ****************************************************************** + */ + +ssize_t mca_fbtl_ime_preadv (ompio_file_t *file ); +ssize_t mca_fbtl_ime_pwritev (ompio_file_t *file ); +ssize_t mca_fbtl_ime_ipreadv (ompio_file_t *file, + ompi_request_t *request); +ssize_t mca_fbtl_ime_ipwritev (ompio_file_t *file, + ompi_request_t *request); + +bool mca_fbtl_ime_progress (mca_ompio_request_t *req); +void mca_fbtl_ime_request_free (mca_ompio_request_t *req); +void mca_fbtl_ime_complete_cb (struct ime_aiocb *aiocb, int err, ssize_t bytes); + +struct mca_fbtl_ime_request_data_t { + int aio_req_count; /* total number of aio reqs */ + int aio_open_reqs; /* number of unfinished reqs */ + int aio_req_type; /* read or write */ + int aio_req_chunks; /* max. no. of aio reqs that can be posted at once*/ + int aio_first_active_req; /* first active posted req */ + int aio_last_active_req; /* last currently active poted req */ + int aio_req_fail_count; /* number of requests that failed*/ + struct iovec *aio_iovecs; /* array of iovecs copied from the file handle */ + struct ime_aiocb *aio_reqs; /* array of aio requests that will be sent to IME */ + ssize_t *aio_req_status; /* array of status for the IME requests */ + ssize_t aio_total_len; /* total amount of data written */ + ompio_file_t *aio_fh; /* pointer back to the mca_io_ompio_fh structure */ + void *allocated_data; /* pointer to the allocated space + that will contain all the necessary iovecs, + IME requests and their statuses */ +}; +typedef struct mca_fbtl_ime_request_data_t mca_fbtl_ime_request_data_t; + +/* define constants for read/write operations */ +#define FBTL_IME_READ 1 +#define FBTL_IME_WRITE 2 +#define FBTL_IME_IN_PROGRESS -1 +#define FBTL_IME_REQ_ERROR -2 +#define FBTL_IME_REQ_CLOSED -3 + +/* + * ****************************************************************** + * ************ functions implemented in this module end ************ + * ****************************************************************** + */ + +END_C_DECLS + +#endif /* MCA_FBTL_IME_H */ diff --git a/ompi/mca/fbtl/ime/fbtl_ime_blocking_op.c b/ompi/mca/fbtl/ime/fbtl_ime_blocking_op.c new file mode 100644 index 00000000000..571a31773ad --- /dev/null +++ b/ompi/mca/fbtl/ime/fbtl_ime_blocking_op.c @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fbtl_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fbtl/fbtl.h" + +static ssize_t mca_fbtl_ime_blocking_op(ompio_file_t *fh, int io_op); + +ssize_t mca_fbtl_ime_preadv(ompio_file_t *fh) +{ + return mca_fbtl_ime_blocking_op(fh, FBTL_IME_READ); +} + +ssize_t mca_fbtl_ime_pwritev(ompio_file_t *fh) +{ + return mca_fbtl_ime_blocking_op(fh, FBTL_IME_WRITE); +} + +static ssize_t mca_fbtl_ime_blocking_op(ompio_file_t *fh, int io_op) +{ + int i, block = 1, ret; + struct iovec *iov = NULL; + int iov_count = 0; + OMPI_MPI_OFFSET_TYPE iov_offset = 0; + ssize_t bytes_processed = 0, ret_code = 0; + + if (NULL == fh->f_io_array) { + return OMPI_ERROR; + } + + iov = (struct iovec *) malloc + (OMPIO_IOVEC_INITIAL_SIZE * sizeof (struct iovec)); + if (NULL == iov) { + opal_output(1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + + /* Go through all IO entries and try to aggregate them. */ + for (i = 0 ; i < fh->f_num_of_io_entries; i++) { + iov[iov_count].iov_base = fh->f_io_array[i].memory_address; + iov[iov_count].iov_len = fh->f_io_array[i].length; + iov_count++; + + /* Save the file offset if the current iovec is + the first one in the iovec array. */ + if (iov_count == 1) { + iov_offset = (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset; + } + + /* Allocate more memory for the iovecs if necessary */ + if (iov_count == OMPIO_IOVEC_INITIAL_SIZE * block) { + block++; + struct iovec *new_iov = (struct iovec *) realloc(iov, + OMPIO_IOVEC_INITIAL_SIZE * block * sizeof(struct iovec)); + if (new_iov == NULL) { + free(iov); + opal_output(1, "OUT OF MEMORY\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + } + + /* If: + - There is no next iovec + - OR the next iovec is not "contiguous" + - OR we exceeded the advised number of iovecs for IME + Then: pwritev/preadv shall be called, + and the iovec array resetted */ + if (i+1 == fh->f_num_of_io_entries || + ((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset + + (ptrdiff_t)fh->f_io_array[i].length) != + (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset || + iov_count >= mca_fbtl_ime_iov_max ) { + + switch (io_op) { + case FBTL_IME_READ: + ret_code = ime_native_preadv(fh->fd, iov, iov_count, iov_offset); + if (ret_code < 0) { + opal_output(1, "mca_fbtl_ime_blocking_op: error in " + "ime_native_preadv error ret=%zd %s", + ret_code, strerror(errno)); + goto error_exit; + } + break; + + case FBTL_IME_WRITE: + ret_code = ime_native_pwritev(fh->fd, iov, iov_count, iov_offset); + if (ret_code < 0) { + opal_output(1, "mca_fbtl_ime_blocking_op: error in " + "ime_native_pwritev error ret=%zd %s", + ret_code, strerror(errno)); + goto error_exit; + } + break; + + default: + opal_output(1, "mca_fbtl_ime_blocking_op: an unsupported " + "IO operation was requested. io_op=%d", io_op); + goto error_exit; + } + + bytes_processed += ret_code; + iov_count = 0; + } + } + + free (iov); + return bytes_processed; + +error_exit: + free(iov); + return OMPI_ERROR; +} diff --git a/ompi/mca/fbtl/ime/fbtl_ime_component.c b/ompi/mca/fbtl/ime/fbtl_ime_component.c new file mode 100644 index 00000000000..82d738879ff --- /dev/null +++ b/ompi/mca/fbtl/ime/fbtl_ime_component.c @@ -0,0 +1,79 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fbtl_ime.h" +#include "mpi.h" + +int mca_fbtl_ime_priority = FBTL_IME_BASE_PRIORITY; +int mca_fbtl_ime_iov_max = FBTL_IME_IOV_MAX; +int mca_fbtl_ime_aio_reqs_max = FBTL_IME_AIO_REQS_MAX; + +/* + * Private functions + */ +static int register_component(void); + +/* + * Public string showing the fbtl ime component version number + */ +const char *mca_fbtl_ime_component_version_string = + "OMPI/MPI IME FBTL MCA component version " OMPI_VERSION; + + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +mca_fbtl_base_component_2_0_0_t mca_fbtl_ime_component = { + + /* First, the mca_component_t struct containing meta information + about the component itself */ + + .fbtlm_version = { + MCA_FBTL_BASE_VERSION_2_0_0, + + /* Component name and version */ + .mca_component_name = "ime", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_register_component_params = register_component, + }, + .fbtlm_data = { + /* This component is checkpointable */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + .fbtlm_init_query = mca_fbtl_ime_component_init_query, /* get thread level */ + .fbtlm_file_query = mca_fbtl_ime_component_file_query, /* get priority and actions */ + .fbtlm_file_unquery = mca_fbtl_ime_component_file_unquery, /* undo what was done by previous function */ +}; + +static int register_component(void) +{ + mca_fbtl_ime_iov_max = FBTL_IME_IOV_MAX; + (void) mca_base_component_var_register(&mca_fbtl_ime_component.fbtlm_version, + "iov_max", "Maximum iov count that should be used when " + "calling an IME native function", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_fbtl_ime_iov_max); + + mca_fbtl_ime_aio_reqs_max = FBTL_IME_AIO_REQS_MAX; + (void) mca_base_component_var_register(&mca_fbtl_ime_component.fbtlm_version, + "aio_reqs_max", "Maximum number of aiocb requests that should " + "be sent simultaneously when calling an IME native function", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_fbtl_ime_aio_reqs_max ); + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fbtl/ime/fbtl_ime_nonblocking_op.c b/ompi/mca/fbtl/ime/fbtl_ime_nonblocking_op.c new file mode 100644 index 00000000000..16ca81127b7 --- /dev/null +++ b/ompi/mca/fbtl/ime/fbtl_ime_nonblocking_op.c @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fbtl_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fbtl/fbtl.h" + +static ssize_t mca_fbtl_ime_nonblocking_op (ompio_file_t *fh, + ompi_request_t *request, int io_op); + +ssize_t mca_fbtl_ime_ipreadv (ompio_file_t *fh, ompi_request_t *request) +{ + return mca_fbtl_ime_nonblocking_op(fh, request, FBTL_IME_READ); +} +ssize_t mca_fbtl_ime_ipwritev (ompio_file_t *fh, ompi_request_t *request) +{ + return mca_fbtl_ime_nonblocking_op(fh, request, FBTL_IME_WRITE); +} + +static ssize_t mca_fbtl_ime_nonblocking_op (ompio_file_t *fh, + ompi_request_t *request, int io_op) +{ + mca_fbtl_ime_request_data_t *data; + mca_ompio_request_t *req = (mca_ompio_request_t *) request; + int i=0, req_index = 0, ret; + + data = (mca_fbtl_ime_request_data_t *) malloc ( sizeof (mca_fbtl_ime_request_data_t)); + if ( NULL == data ) { + opal_output (1,"could not allocate memory\n"); + return OMPI_ERR_OUT_OF_RESOURCE; + } + + /* We might allocate too much memory here because we don't know + how many IME requests will be necessary. + + We will use all the iovec "slots" in the array, + but maybe not all the request and request status slots. + That is, because an IME request can handle several iovecs, + not just one. */ + data->allocated_data = (void*) malloc( fh->f_num_of_io_entries * + (sizeof(struct iovec) + + sizeof(struct ime_aiocb) + + sizeof(ssize_t)) ); + if (NULL == data->allocated_data) { + opal_output(1, "OUT OF MEMORY\n"); + free(data); + return OMPI_ERR_OUT_OF_RESOURCE; + } + data->aio_iovecs = (struct iovec *) data->allocated_data; + data->aio_reqs = (struct ime_aiocb *) (data->aio_iovecs + + fh->f_num_of_io_entries); + data->aio_req_status = (ssize_t *) (data->aio_reqs + + fh->f_num_of_io_entries); + + /* Fill some attributes of the OMPIO request data */ + data->aio_req_type = io_op; /* The correctness of io_op will be checked later */ + data->aio_req_chunks = mca_fbtl_ime_aio_reqs_max; + data->aio_req_fail_count = 0; + data->aio_total_len = 0; + data->aio_fh = fh; + data->aio_reqs[0].iovcnt = 0; + + /* Go through all IO entries and try to aggregate them. */ + for ( i=0; if_num_of_io_entries; i++ ) { + data->aio_iovecs[i].iov_base = fh->f_io_array[i].memory_address; + data->aio_iovecs[i].iov_len = fh->f_io_array[i].length; + + /* If the processed iovec will be the first in our ime_aiocb request, + then we initialize this aio request for IME. */ + if (data->aio_reqs[req_index].iovcnt == 0) { + data->aio_reqs[req_index].iov = &data->aio_iovecs[i]; + data->aio_reqs[req_index].iovcnt = 1; + data->aio_reqs[req_index].file_offset = (off_t) + fh->f_io_array[i].offset; + data->aio_reqs[req_index].fd = fh->fd; + data->aio_reqs[req_index].complete_cb = &mca_fbtl_ime_complete_cb; + data->aio_reqs[req_index].user_context = (intptr_t) + &data->aio_req_status[req_index]; + data->aio_req_status[req_index] = FBTL_IME_IN_PROGRESS; + } + + /* Here we check if the next iovec will be appended to + the current ime_aiocb request. + ie: if data is contiguous + AND we don't exceed the advised number of iovecs for IME + In that case, the next iovec will be appended to the IME req. */ + if (i+1 != fh->f_num_of_io_entries && + ((OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i].offset + + (ptrdiff_t)fh->f_io_array[i].length) == + (OMPI_MPI_OFFSET_TYPE)(intptr_t)fh->f_io_array[i+1].offset && + data->aio_reqs[req_index].iovcnt < mca_fbtl_ime_iov_max ) { + data->aio_reqs[req_index].iovcnt++; + } + + /* Otherwise, we need to create a new request + (except if there is no next iovec to process) */ + else if ( i+1 != fh->f_num_of_io_entries ) { + req_index++; + data->aio_reqs[req_index].iovcnt = 0; + } + } + + /* Fill the missing attributes of the OMPI request */ + data->aio_req_count = req_index + 1; + data->aio_open_reqs = req_index + 1; + data->aio_first_active_req = 0; + if ( data->aio_req_count > data->aio_req_chunks ) { + data->aio_last_active_req = data->aio_req_chunks; + } + else { + data->aio_last_active_req = data->aio_req_count; + } + + /* Actually start the requests (or at least the first batch). + In case an error happened when one request is started, we + don't send the next ones and mark the failing request as + the last active one. Finally we exit as if no error happened, + because some other requests might have already been started + and they need to be finalized properly (via the progress function). + */ + for (i=0; i < data->aio_last_active_req; i++) { + switch(io_op) { + + case FBTL_IME_READ: + ret = ime_native_aio_read(&data->aio_reqs[i]); + if (ret < 0) { + opal_output(1, "mca_fbtl_ime_nonblocking_op: error in " + "ime_native_aio_read() error ret=%d %s", + ret, strerror(errno)); + data->aio_req_status[i] = FBTL_IME_REQ_ERROR; + data->aio_last_active_req = i + 1; + goto standard_exit; + } + break; + + case FBTL_IME_WRITE: + ret = ime_native_aio_write(&data->aio_reqs[i]); + if (ret < 0) { + opal_output(1, "mca_fbtl_ime_nonblocking_op: error in " + "ime_native_aio_write() error ret=%d %s", + ret, strerror(errno)); + data->aio_req_status[i] = FBTL_IME_REQ_ERROR; + data->aio_last_active_req = i + 1; + goto standard_exit; + } + break; + + default: + opal_output(1, "mca_fbtl_ime_nonblocking_op: an unsupported " + "IO operation was requested. io_op=%d", io_op); + goto error_exit; + } + } + +standard_exit: + req->req_data = data; + req->req_progress_fn = mca_fbtl_ime_progress; + req->req_free_fn = mca_fbtl_ime_request_free; + + return OMPI_SUCCESS; + +error_exit: + free(data->allocated_data); + free(data); + return OMPI_ERROR; +} diff --git a/ompi/mca/fbtl/ime/owner.txt b/ompi/mca/fbtl/ime/owner.txt new file mode 100644 index 00000000000..cc0fc2e2593 --- /dev/null +++ b/ompi/mca/fbtl/ime/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: DataDirect Networks +status: active diff --git a/ompi/mca/fs/base/fs_base_get_parent_dir.c b/ompi/mca/fs/base/fs_base_get_parent_dir.c index e3770537852..78c23e7a7f9 100644 --- a/ompi/mca/fs/base/fs_base_get_parent_dir.c +++ b/ompi/mca/fs/base/fs_base_get_parent_dir.c @@ -117,6 +117,9 @@ int mca_fs_base_get_fstype(char *fname ) else if ( 0 == strncasecmp(fstype, "pvfs2", sizeof("pvfs2"))) { ompio_type = PVFS2; } + else if ( 0 == strncasecmp(fstype, "ime", sizeof("ime"))) { + ompio_type = IME; + } else if ( 0 == strncasecmp(fstype, "gpfs", sizeof("gpfs"))) { ompio_type = GPFS; } diff --git a/ompi/mca/fs/ime/Makefile.am b/ompi/mca/fs/ime/Makefile.am new file mode 100644 index 00000000000..db15704e732 --- /dev/null +++ b/ompi/mca/fs/ime/Makefile.am @@ -0,0 +1,47 @@ +# +# Copyright (c) 2018 DataDirect Networks. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# Make the output library in this directory, and name it either +# mca__.la (for DSO builds) or libmca__.la +# (for static builds). + +if MCA_BUILD_ompi_fs_ime_DSO +component_noinst = +component_install = mca_fs_ime.la +else +component_noinst = libmca_fs_ime.la +component_install = +endif + +# Source files + +fs_ime_sources = \ + fs_ime.h \ + fs_ime.c \ + fs_ime_component.c \ + fs_ime_file_open.c \ + fs_ime_file_close.c \ + fs_ime_file_delete.c \ + fs_ime_file_sync.c \ + fs_ime_file_set_size.c \ + fs_ime_file_get_size.c + +AM_CPPFLAGS = $(fs_ime_CPPFLAGS) + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_fs_ime_la_SOURCES = $(fs_ime_sources) +mca_fs_ime_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(fs_ime_LIBS) +mca_fs_ime_la_LDFLAGS = -module -avoid-version $(fs_ime_LDFLAGS) + +noinst_LTLIBRARIES = $(component_noinst) +libmca_fs_ime_la_SOURCES = $(fs_ime_sources) +libmca_fs_ime_la_LIBADD = $(fs_ime_LIBS) +libmca_fs_ime_la_LDFLAGS = -module -avoid-version $(fs_ime_LDFLAGS) \ No newline at end of file diff --git a/ompi/mca/fs/ime/configure.m4 b/ompi/mca/fs/ime/configure.m4 new file mode 100644 index 00000000000..44bdce422ba --- /dev/null +++ b/ompi/mca/fs/ime/configure.m4 @@ -0,0 +1,30 @@ +# -*- shell-script -*- +# +# Copyright (c) 2018 DataDirect Networks. All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_fs_ime_CONFIG(action-if-can-compile, +# [action-if-cant-compile]) +# ------------------------------------------------ +AC_DEFUN([MCA_ompi_fs_ime_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/fs/ime/Makefile]) + + OMPI_CHECK_IME([fs_ime], + [fs_ime_happy="yes"], + [fs_ime_happy="no"]) + + OPAL_SUMMARY_ADD([[OMPIO File Systems]],[[DDN Infinite Memory Engine]],[$1],[$fs_ime_happy]) + AS_IF([test "$fs_ime_happy" = "yes"], + [$1], + [$2]) + + # substitute in the things needed to build ime + AC_SUBST([fs_ime_CPPFLAGS]) + AC_SUBST([fs_ime_LDFLAGS]) + AC_SUBST([fs_ime_LIBS]) +])dnl diff --git a/ompi/mca/fs/ime/fs_ime.c b/ompi/mca/fs/ime/fs_ime.c new file mode 100644 index 00000000000..708f1eccfd2 --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime.c @@ -0,0 +1,155 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "mpi.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/ime/fs_ime.h" + +/* + * ******************************************************************* + * ************************ actions structure ************************ + * ******************************************************************* + */ +static mca_fs_base_module_1_0_0_t ime = { + mca_fs_ime_module_init, /* initalise after being selected */ + mca_fs_ime_module_finalize, /* close a module on a communicator */ + mca_fs_ime_file_open, + mca_fs_ime_file_close, + mca_fs_ime_file_delete, + mca_fs_ime_file_set_size, + mca_fs_ime_file_get_size, + mca_fs_ime_file_sync +}; +/* + * ******************************************************************* + * ************************* structure ends ************************** + * ******************************************************************* + */ + +/* + * Private variables + */ +static int mca_fs_ime_IS_INITIALIZED = 0; + +/* + * Function decls + */ +int mca_fs_ime_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads) +{ + /* Nothing to do */ + + return OMPI_SUCCESS; +} + +struct mca_fs_base_module_1_0_0_t * +mca_fs_ime_component_file_query (ompio_file_t *fh, int *priority) +{ + /* IME should only be used for paths starting with ime: or IME: + Therefore, this function will return a NULL module when no IME + path is detected. */ + + char *tmp; + + *priority = mca_fs_ime_priority; + + tmp = strchr (fh->f_filename, ':'); + if (!tmp) { + /* The communicator might be NULL if we only want to delete the file */ + if (OMPIO_ROOT == fh->f_rank || MPI_COMM_NULL == fh->f_comm) { + fh->f_fstype = mca_fs_base_get_fstype ( fh->f_filename ); + } + if (fh->f_comm != MPI_COMM_NULL) { + fh->f_comm->c_coll->coll_bcast (&(fh->f_fstype), + 1, + MPI_INT, + OMPIO_ROOT, + fh->f_comm, + fh->f_comm->c_coll->coll_bcast_module); + } + } + else { + if (!strncmp(fh->f_filename, DEFAULT_IME_PREFIX_NO_FWD_SLASH, + IME_FILE_PREFIX_LEN_NO_FWD_SLASH)){ + fh->f_fstype = IME; + } + } + + /* According to my understanding, a valid module should be returned + as long as a valid FS type is detected. (This isn't what is done + for LUSTRE or PVFS2) + */ + if (IME == fh->f_fstype) { + if (*priority < FS_IME_INCREASED_PRIORITY) { + *priority = FS_IME_INCREASED_PRIORITY; + } + return &ime; + } + + return NULL; +} + +int mca_fs_ime_component_file_unquery (ompio_file_t *file) +{ + /* This function might be needed for some purposes later. for now it + * does not have anything to do since there are no steps which need + * to be undone if this module is not selected */ + + return OMPI_SUCCESS; +} + +int mca_fs_ime_module_init (ompio_file_t *file) +{ + /* Make sure the file type is not overwritten by the last queried + * component */ + file->f_fstype = IME; + + if (mca_fs_ime_IS_INITIALIZED == 0) { + mca_fs_ime_IS_INITIALIZED = 1; + ime_native_init(); + } + return OMPI_SUCCESS; +} + +int mca_fs_ime_module_finalize (ompio_file_t *file) +{ + /* + * Nothing to do here: + * We can't finalize IME here because other files might + * still be using it. Instead, IME is finalized when + * the OMPIO component is closed. + */ + + return OMPI_SUCCESS; +} + +int mca_fs_ime_native_fini() +{ + int ret; + if (mca_fs_ime_IS_INITIALIZED == 0) { + return OMPI_SUCCESS; + } + + /* We don't actually need to reset this variable since + mca_fs_ime_native_fini is only called once: + when OMPIO is closed + */ + mca_fs_ime_IS_INITIALIZED = 0; + + ret = ime_native_finalize(); + if (ret != 0) { + return OMPI_ERROR; + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime.h b/ompi/mca/fs/ime/fs_ime.h new file mode 100644 index 00000000000..170f03a06e2 --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_FS_IME_H +#define MCA_FS_IME_H + +#include "ompi_config.h" +#include "ompi/mca/mca.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/mca/common/ompio/common_ompio.h" + +extern int mca_fs_ime_priority; +extern int mca_fs_ime_lock_algorithm; + +#define FS_IME_LOCK_AUTO 0 +#define FS_IME_BASE_PRIORITY 20 +#define FS_IME_INCREASED_PRIORITY 50 + +BEGIN_C_DECLS + +int mca_fs_ime_component_init_query(bool enable_progress_threads, + bool enable_mpi_threads); +struct mca_fs_base_module_1_0_0_t * +mca_fs_ime_component_file_query (ompio_file_t *fh, int *priority); +int mca_fs_ime_component_file_unquery (ompio_file_t *file); + +int mca_fs_ime_module_init (ompio_file_t *file); +int mca_fs_ime_module_finalize (ompio_file_t *file); + +int mca_fs_ime_native_fini(); + +OMPI_MODULE_DECLSPEC extern mca_fs_base_component_2_0_0_t mca_fs_ime_component; +/* + * ****************************************************************** + * ********* functions which are implemented in this module ********* + * ****************************************************************** + */ + +int mca_fs_ime_file_open (struct ompi_communicator_t *comm, + const char *filename, + int amode, + struct opal_info_t *info, + ompio_file_t *fh); + +int mca_fs_ime_file_close (ompio_file_t *fh); + +int mca_fs_ime_file_delete (char *filename, + struct opal_info_t *info); + +int mca_fs_ime_file_set_size (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE size); + +int mca_fs_ime_file_get_size (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE *size); + +int mca_fs_ime_file_sync (ompio_file_t *fh); + +/* + * ****************************************************************** + * ************ functions implemented in this module end ************ + * ****************************************************************** + */ + +END_C_DECLS + +#endif /* MCA_FS_IME_H */ diff --git a/ompi/mca/fs/ime/fs_ime_component.c b/ompi/mca/fs/ime/fs_ime_component.c new file mode 100644 index 00000000000..ea4e06de96a --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_component.c @@ -0,0 +1,77 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" +#include "fs_ime.h" +#include "mpi.h" + +int mca_fs_ime_priority = FS_IME_BASE_PRIORITY; +int mca_fs_ime_lock_algorithm = FS_IME_LOCK_AUTO; + +/* + * Private functions + */ +static int register_component(void); + + +/* + * Public string showing the fs ime component version number + */ +const char *mca_fs_ime_component_version_string = + "OMPI/MPI IME FS MCA component version " OMPI_VERSION; + +/* + * Instantiate the public struct with all of our public information + * and pointers to our public functions in it + */ +mca_fs_base_component_2_0_0_t mca_fs_ime_component = { + + /* First, the mca_component_t struct containing meta information + about the component itself */ + + .fsm_version = { + MCA_FS_BASE_VERSION_2_0_0, + + /* Component name and version */ + .mca_component_name = "ime", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_register_component_params = register_component, + }, + .fsm_data = { + /* This component is checkpointable */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + .fsm_init_query = mca_fs_ime_component_init_query, /* get thread level */ + .fsm_file_query = mca_fs_ime_component_file_query, /* get priority and actions */ + .fsm_file_unquery = mca_fs_ime_component_file_unquery, /* undo what was done by previous function */ +}; + +static int register_component(void) +{ + mca_fs_ime_priority = FS_IME_BASE_PRIORITY; + (void) mca_base_component_var_register(&mca_fs_ime_component.fsm_version, + "priority", "Priority of the fs ime component", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_fs_ime_priority); + + mca_fs_ime_lock_algorithm = FS_IME_LOCK_AUTO; + (void) mca_base_component_var_register(&mca_fs_ime_component.fsm_version, + "lock_algorithm", "Locking algorithm used by the fs ime component. " + " 0: auto (default)", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_9, + MCA_BASE_VAR_SCOPE_READONLY, + &mca_fs_ime_lock_algorithm ); + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_close.c b/ompi/mca/fs/ime/fs_ime_file_close.c new file mode 100644 index 00000000000..68d24e72afc --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_close.c @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" + +/* + * file_close_ime + * + * Function: - closes a new file + * Accepts: - file handle + * Returns: - Success if file closed + */ +int mca_fs_ime_file_close (ompio_file_t *fh) +{ + int ret; + + fh->f_comm->c_coll->coll_barrier (fh->f_comm, + fh->f_comm->c_coll->coll_barrier_module); + /* reset errno */ + errno = 0; + + ret = ime_native_close(fh->fd); + if (ret != 0) { + return mca_fs_base_get_mpi_err(errno); + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_delete.c b/ompi/mca/fs/ime/fs_ime_file_delete.c new file mode 100644 index 00000000000..2f428a750f7 --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_delete.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" + +/* + * file_delete_ime + * + * Function: - deletes a file + * Accepts: - file name & info + * Returns: - Success if file closed + */ +int mca_fs_ime_file_delete (char* file_name, + struct opal_info_t *info) +{ + int ret; + + /* reset errno */ + errno = 0; + + ret = ime_native_unlink(file_name); + if (ret != 0) { + return mca_fs_base_get_mpi_err(errno); + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_get_size.c b/ompi/mca/fs/ime/fs_ime_file_get_size.c new file mode 100644 index 00000000000..8e0e9af9460 --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_get_size.c @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" + +/* + * file_get_size_ime + * + * Function: - get_size of a file + * Accepts: - same arguments as MPI_File_get_size() + * Returns: - Success if size is get + */ +int mca_fs_ime_file_get_size (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE *size) +{ + /* reset errno */ + errno = 0; + + *size = ime_native_lseek(fh->fd, 0, SEEK_END); + if (*size < 0) { + return mca_fs_base_get_mpi_err(errno); + } + + errno = 0; + if ((ime_native_lseek(fh->fd, fh->f_offset, SEEK_SET)) < 0) { + return mca_fs_base_get_mpi_err(errno); + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_open.c b/ompi/mca/fs/ime/fs_ime_file_open.c new file mode 100644 index 00000000000..b0ae3e6368a --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_open.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" +#include "ompi/communicator/communicator.h" +#include "ompi/info/info.h" +#include "opal/util/path.h" + +/* + * file_open_ime + * + * Function: - opens a new file + * Accepts: - same arguments as MPI_File_open() + * Returns: - Success if new file handle + */ +int mca_fs_ime_file_open (struct ompi_communicator_t *comm, + const char* filename, + int access_mode, + struct opal_info_t *info, + ompio_file_t *fh) +{ + int perm, amode; + int ret = OMPI_SUCCESS; + + perm = mca_fs_base_get_file_perm(fh); + amode = mca_fs_base_get_file_amode(fh->f_rank, access_mode); + + + /* Reset errno */ + errno = 0; + + if (OMPIO_ROOT == fh->f_rank) { + fh->fd = ime_native_open(filename, amode, perm); + if ( fh->fd < 0 ) { + ret = mca_fs_base_get_mpi_err(errno); + } + } + + comm->c_coll->coll_bcast (&ret, 1, MPI_INT, OMPIO_ROOT, comm, + comm->c_coll->coll_bcast_module); + if ( ret != OMPI_SUCCESS ) { + fh->fd = -1; + return ret; + } + + if (OMPIO_ROOT != fh->f_rank) { + errno = 0; + fh->fd = ime_native_open(filename, amode, perm); + if ( fh->fd < 0 ) { + return mca_fs_base_get_mpi_err(errno); + } + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_set_size.c b/ompi/mca/fs/ime/fs_ime_file_set_size.c new file mode 100644 index 00000000000..c0741635387 --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_set_size.c @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" + +/* + * file_set_size_ime + * + * Function: - set_size of a file + * Accepts: - same arguments as MPI_File_set_size() + * Returns: - Success if size is set + */ +int mca_fs_ime_file_set_size (ompio_file_t *fh, + OMPI_MPI_OFFSET_TYPE size) +{ + int ret = 0; + + /* reset errno */ + errno = 0; + + if (OMPIO_ROOT == fh->f_rank) { + ret = ime_native_ftruncate(fh->fd, size); + } + + fh->f_comm->c_coll->coll_bcast(&ret, + 1, + MPI_INT, + OMPIO_ROOT, + fh->f_comm, + fh->f_comm->c_coll->coll_bcast_module); + + if (ret < 0) { + return mca_fs_base_get_mpi_err(errno); + } + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/fs_ime_file_sync.c b/ompi/mca/fs/ime/fs_ime_file_sync.c new file mode 100644 index 00000000000..3dd18db6cdc --- /dev/null +++ b/ompi/mca/fs/ime/fs_ime_file_sync.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2018 DataDirect Networks. All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ime_native.h" + +#include "ompi_config.h" +#include "fs_ime.h" + +#include "mpi.h" +#include "ompi/constants.h" +#include "ompi/mca/fs/base/base.h" +#include "ompi/mca/fs/fs.h" + +int mca_fs_ime_file_sync (ompio_file_t *fh) +{ + int ret; + + /* reset errno */ + errno = 0; + + ret = ime_native_fsync(fh->fd); + if (ret != 0) { + return mca_fs_base_get_mpi_err(errno); + } + + return OMPI_SUCCESS; +} diff --git a/ompi/mca/fs/ime/owner.txt b/ompi/mca/fs/ime/owner.txt new file mode 100644 index 00000000000..cc0fc2e2593 --- /dev/null +++ b/ompi/mca/fs/ime/owner.txt @@ -0,0 +1,7 @@ +# +# owner/status file +# owner: institution that is responsible for this package +# status: e.g. active, maintenance, unmaintained +# +owner: DataDirect Networks +status: active From ad1d427d60c7b93658b870866222d1de204099cb Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Thu, 30 Apr 2020 09:28:10 +0200 Subject: [PATCH 650/674] Accept UCX 1.8 in configure of btl/uct The configure script for the btl uct component reports an error for the new UCX 1.8.0 versions as it was fixed up to UCX 1.7. This fixes #7612 Signed-off-by: Christoph Niethammer (cherry picked from commit 9b10f46126b0a5aa796d9fec063c2d454a9a1bc9) --- opal/mca/btl/uct/configure.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/btl/uct/configure.m4 b/opal/mca/btl/uct/configure.m4 index 61c7c8cd0f3..d6e258ff649 100644 --- a/opal/mca/btl/uct/configure.m4 +++ b/opal/mca/btl/uct/configure.m4 @@ -6,7 +6,7 @@ # 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, +# Copyright (c) 2004-2020 High Performance Computing Center Stuttgart, # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2006 The Regents of the University of California. # All rights reserved. @@ -52,7 +52,7 @@ dnl fi max_allowed_uct_major=1 - max_allowed_uct_minor=7 + max_allowed_uct_minor=8 if test "$btl_uct_happy" = "yes" && test "$enable_uct_version_check" != "no"; then AC_MSG_CHECKING([UCT version compatibility]) OPAL_VAR_SCOPE_PUSH([CPPFLAGS_save]) From b4106e94e1b17f5b983c58d8fa595c09c73e6e7b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 27 Jun 2020 09:42:07 -0700 Subject: [PATCH 651/674] pmix3x: Remove --enable-install-libpmix option This option is problematic, and has never worked in an Open MPI v4.0.x release tarball. Given that PMIx is now available elsewhere, it isn't worth fixing this option. See https://github.com/open-mpi/ompi/issues/6228 for more detail. NOTE: This is a v4.0.x-specific commit because this option no longer exists on master because we deleted the entire pmix3x component. Hence, it's not possible to cherry-pick anything from master back to the v4.0.x branch. Signed-off-by: Jeff Squyres (cherry picked from commit 447b14061880e218371f9eb0cbe427b8358d45b8) --- opal/mca/pmix/pmix3x/configure.m4 | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/opal/mca/pmix/pmix3x/configure.m4 b/opal/mca/pmix/pmix3x/configure.m4 index 10cd639e09b..8ad5343b6ab 100644 --- a/opal/mca/pmix/pmix3x/configure.m4 +++ b/opal/mca/pmix/pmix3x/configure.m4 @@ -12,7 +12,7 @@ # All rights reserved. # Copyright (c) 2011-2013 Los Alamos National Security, LLC. # All rights reserved. -# Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2010-2020 Cisco Systems, Inc. All rights reserved # Copyright (c) 2013-2019 Intel, Inc. All rights reserved. # Copyright (c) 2015-2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -37,10 +37,6 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[ opal_pmix_pmix3x_save_LDFLAGS=$LDFLAGS opal_pmix_pmix3x_save_LIBS=$LIBS - AC_ARG_ENABLE([install-libpmix], - [AC_HELP_STRING([--enable-install-libpmix], - [Enable a native PMIx library and headers in the OMPI install location (default: disabled)])]) - AC_ARG_ENABLE([pmix-timing], [AC_HELP_STRING([--enable-pmix-timing], [Enable PMIx timing measurements (default: disabled)])]) @@ -54,16 +50,12 @@ AC_DEFUN([MCA_opal_pmix_pmix3x_CONFIG],[ fi opal_pmix_pmix3x_args="$opal_pmix_pmix3x_timing_flag --without-tests-examples --disable-pmix-binaries --disable-pmix-backward-compatibility --disable-visibility --enable-embedded-libevent --with-libevent-header=\\\"opal/mca/event/$opal_event_base_include\\\" --enable-embedded-hwloc --with-hwloc-header=\\\"$opal_hwloc_base_include\\\"" + opal_pmix_pmix3x_args="--with-pmix-symbol-rename=OPAL_MCA_PMIX3X_ --enable-embedded-mode $opal_pmix_pmix3x_args" AS_IF([test "$enable_debug" = "yes"], [opal_pmix_pmix3x_args="--enable-debug $opal_pmix_pmix3x_args" CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS -g"], [opal_pmix_pmix3x_args="--disable-debug $opal_pmix_pmix3x_args" CFLAGS="$OPAL_CFLAGS_BEFORE_PICKY $OPAL_VISIBILITY_CFLAGS"]) - AC_MSG_CHECKING([if want to install standalone libpmix]) - AS_IF([test "$enable_install_libpmix" = "yes"], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - opal_pmix_pmix3x_args="--with-pmix-symbol-rename=OPAL_MCA_PMIX3X_ --enable-embedded-mode $opal_pmix_pmix3x_args"]) AS_IF([test "$with_devel_headers" = "yes"], [opal_pmix_pmix3x_args="--with-devel-headers $opal_pmix_pmix3x_args"]) CPPFLAGS="-I$OPAL_TOP_SRCDIR -I$OPAL_TOP_BUILDDIR -I$OPAL_TOP_SRCDIR/opal/include -I$OPAL_TOP_BUILDDIR/opal/include $CPPFLAGS" From 2d3f862f1d1fb6e1543cae5a17c7761be7367a84 Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Fri, 26 Jun 2020 22:19:21 +0200 Subject: [PATCH 652/674] osc rdma: check for outstanding fragments before completing a request in ompi_osc_rdma_put_complete_flush as well Signed-off-by: Joseph Schuchart (cherry picked from commit caed3b2eed478c76f34d56b5d0495bf26e44a9bb) --- ompi/mca/osc/rdma/osc_rdma_comm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_comm.c b/ompi/mca/osc/rdma/osc_rdma_comm.c index d88fdf5c513..af80efcc986 100644 --- a/ompi/mca/osc/rdma/osc_rdma_comm.c +++ b/ompi/mca/osc/rdma/osc_rdma_comm.c @@ -422,8 +422,10 @@ static void ompi_osc_rdma_put_complete_flush (struct mca_btl_base_module_t *btl, ompi_osc_rdma_request_t *request = request = (ompi_osc_rdma_request_t *) ((intptr_t) context & ~1); module = request->module; - /* NTH -- TODO: better error handling */ - ompi_osc_rdma_request_complete (request, status); + if (0 == OPAL_THREAD_ADD_FETCH32 (&request->outstanding_requests, -1)) { + /* NTH -- TODO: better error handling */ + ompi_osc_rdma_request_complete (request, status); + } } OSC_RDMA_VERBOSE(status ? MCA_BASE_VERBOSE_ERROR : MCA_BASE_VERBOSE_TRACE, "btl put complete on module %p. local " From 540b14fc32cd6fc69e3c8effe2a2b60038a3bbc5 Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Thu, 28 May 2020 13:47:41 -0500 Subject: [PATCH 653/674] Use the active PML to call add_procs() ompi_mtl_portals4_get_endpoint() was incorrectly making a direct call to ompi_mtl_portals4_add_procs(). Instead use the actve PML to call add_procs(). If add_procs() fails, call ompi_rte_abort() to terminate the job. Signed-off-by: Todd Kordenbrock (cherry picked from commit 0a637967fac24246c84da0952423b3dc1b2f62f1) --- ompi/mca/mtl/portals4/mtl_portals4_endpoint.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h b/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h index 2c135cc126f..5a352da7633 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h +++ b/ompi/mca/mtl/portals4/mtl_portals4_endpoint.h @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2010 Sandia National Laboratories. All rights reserved. + * Copyright (c) 2010-2020 Sandia National Laboratories. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -20,6 +20,7 @@ #ifndef OMPI_MTL_PORTALS_ENDPOINT_H #define OMPI_MTL_PORTALS_ENDPOINT_H +#include "ompi/mca/pml/pml.h" #include "ompi/mca/mtl/portals4/mtl_portals4.h" struct mca_mtl_base_endpoint_t { @@ -31,7 +32,10 @@ static inline mca_mtl_base_endpoint_t * ompi_mtl_portals4_get_endpoint (struct mca_mtl_base_module_t* mtl, ompi_proc_t *ompi_proc) { if (OPAL_UNLIKELY(NULL == ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4])) { - ompi_mtl_portals4_add_procs (mtl, 1, &ompi_proc); + int rc; + if (OPAL_UNLIKELY(OMPI_SUCCESS != (rc = MCA_PML_CALL(add_procs(&ompi_proc, 1))))) { + ompi_rte_abort(rc,"ompi_mtl_portals4_get_endpoint(): pml->add_procs() failed. Aborting.\n"); + } } return ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_PORTALS4]; From 20f9ed98f225fb22bbeb7444ef0629d238df6a69 Mon Sep 17 00:00:00 2001 From: Todd Kordenbrock Date: Wed, 24 Jun 2020 11:05:39 -0500 Subject: [PATCH 654/674] mtl-portals4: replace abort() with ompi_rte_abort() coll-portals4: replace abort() with ompi_rte_abort() Signed-off-by: Todd Kordenbrock (cherry picked from commit 04b94637dd2c5e05edf0917d02b9d1e48316d063) --- ompi/mca/coll/portals4/coll_portals4_component.c | 2 +- ompi/mca/mtl/portals4/mtl_portals4_component.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ompi/mca/coll/portals4/coll_portals4_component.c b/ompi/mca/coll/portals4/coll_portals4_component.c index d632340ee26..dcb6f284ed9 100644 --- a/ompi/mca/coll/portals4/coll_portals4_component.c +++ b/ompi/mca/coll/portals4/coll_portals4_component.c @@ -754,7 +754,7 @@ portals4_progress(void) } else if (PTL_EQ_DROPPED == ret) { opal_output(ompi_coll_base_framework.framework_output, "Flow control situation without recovery (EQ_DROPPED)\n"); - abort(); + ompi_rte_abort(ret, "coll-portals4: Flow control situation without recovery (EQ_DROPPED)"); } else { opal_output(ompi_coll_base_framework.framework_output, "Error returned from PtlEQGet: %d", ret); diff --git a/ompi/mca/mtl/portals4/mtl_portals4_component.c b/ompi/mca/mtl/portals4/mtl_portals4_component.c index 915e3e2fc74..57777ff5f19 100644 --- a/ompi/mca/mtl/portals4/mtl_portals4_component.c +++ b/ompi/mca/mtl/portals4/mtl_portals4_component.c @@ -523,7 +523,7 @@ ompi_mtl_portals4_progress(void) if (OMPI_SUCCESS != ret) { opal_output(ompi_mtl_base_framework.framework_output, "Error returned from target event callback: %d", ret); - abort(); + ompi_rte_abort(ret, "mtl-portals4: Error returned from target event callback"); } } break; @@ -535,7 +535,7 @@ ompi_mtl_portals4_progress(void) if (OMPI_SUCCESS != ret) { opal_output(ompi_mtl_base_framework.framework_output, "Error returned from target event callback: %d", ret); - abort(); + ompi_rte_abort(ret, "mtl-portals4: Error returned from target event callback"); } } break; @@ -550,12 +550,12 @@ ompi_mtl_portals4_progress(void) opal_output_verbose(1, ompi_mtl_base_framework.framework_output, "%s:%d: flowctl_trigger() failed: %d\n", __FILE__, __LINE__, ret); - abort(); + ompi_rte_abort(ret, "mtl-portals4: Flow control failed (PT_DISABLED)"); } #else opal_output(ompi_mtl_base_framework.framework_output, "Flow control situation without recovery (PT_DISABLED)"); - abort(); + ompi_rte_abort(ret, "mtl-portals4: Flow control situation without recovery (PT_DISABLED)"); #endif break; @@ -573,7 +573,7 @@ ompi_mtl_portals4_progress(void) opal_output(ompi_mtl_base_framework.framework_output, "Flow control situation without recovery (EQ_DROPPED): %d", which); - abort(); + ompi_rte_abort(ret, "mtl-portals4: Flow control situation without recovery (EQ_DROPPED)"); } else { opal_output(ompi_mtl_base_framework.framework_output, "Error returned from PtlEQGet: %d", ret); From 12468349d2497fbb1b060d4d549bc109208e8589 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 30 Jun 2020 06:54:04 -0700 Subject: [PATCH 655/674] Increment the vpid after assignment Fix the rank-by operation Signed-off-by: Ralph Castain --- orte/mca/rmaps/base/rmaps_base_ranking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/orte/mca/rmaps/base/rmaps_base_ranking.c b/orte/mca/rmaps/base/rmaps_base_ranking.c index 3b4d084d978..9c0960b93b3 100644 --- a/orte/mca/rmaps/base/rmaps_base_ranking.c +++ b/orte/mca/rmaps/base/rmaps_base_ranking.c @@ -456,7 +456,7 @@ static int rank_by(orte_job_t *jdata, continue; } /* assign the vpid */ - proc->name.vpid = vpid; + proc->name.vpid = vpid++; if (0 == cnt) { app->first_rank = proc->name.vpid; } From 2441fb2baf5622dd79161251b4d6b4f0f4c83e16 Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Thu, 11 Jun 2020 22:39:01 +0300 Subject: [PATCH 656/674] coll/hcoll: reduce_scatter(block) interface Signed-off-by: Valentin Petrov --- ompi/mca/coll/hcoll/coll_hcoll.h | 14 ++++ ompi/mca/coll/hcoll/coll_hcoll_module.c | 11 ++++ ompi/mca/coll/hcoll/coll_hcoll_ops.c | 85 +++++++++++++++++++++++++ 3 files changed, 110 insertions(+) diff --git a/ompi/mca/coll/hcoll/coll_hcoll.h b/ompi/mca/coll/hcoll/coll_hcoll.h index d7bb79658e1..0c33d18d8ea 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll.h +++ b/ompi/mca/coll/hcoll/coll_hcoll.h @@ -142,6 +142,8 @@ struct mca_coll_hcoll_module_t { mca_coll_base_module_t *previous_scatterv_module; mca_coll_base_module_reduce_scatter_fn_t previous_reduce_scatter; mca_coll_base_module_t *previous_reduce_scatter_module; + mca_coll_base_module_reduce_scatter_block_fn_t previous_reduce_scatter_block; + mca_coll_base_module_t *previous_reduce_scatter_block_module; mca_coll_base_module_ibcast_fn_t previous_ibcast; mca_coll_base_module_t *previous_ibcast_module; mca_coll_base_module_ibarrier_fn_t previous_ibarrier; @@ -212,6 +214,18 @@ int mca_coll_hcoll_allreduce(const void *sbuf, void *rbuf, int count, struct ompi_communicator_t *comm, mca_coll_base_module_t *module); +#if HCOLL_API > HCOLL_VERSION(4,5) +int mca_coll_hcoll_reduce_scatter_block(const void *sbuf, void *rbuf, int rcount, + struct ompi_datatype_t *dtype, + struct ompi_op_t *op, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module); +int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int* rcounts, + struct ompi_datatype_t *dtype, + struct ompi_op_t *op, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module); +#endif int mca_coll_hcoll_reduce(const void *sbuf, void *rbuf, int count, struct ompi_datatype_t *dtype, struct ompi_op_t *op, diff --git a/ompi/mca/coll/hcoll/coll_hcoll_module.c b/ompi/mca/coll/hcoll/coll_hcoll_module.c index 7e638bb309e..d09607d8d02 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_module.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_module.c @@ -51,6 +51,7 @@ static void mca_coll_hcoll_module_clear(mca_coll_hcoll_module_t *hcoll_module) hcoll_module->previous_alltoallw = NULL; hcoll_module->previous_reduce = NULL; hcoll_module->previous_reduce_scatter = NULL; + hcoll_module->previous_reduce_scatter_block = NULL; hcoll_module->previous_ibarrier = NULL; hcoll_module->previous_ibcast = NULL; hcoll_module->previous_iallreduce = NULL; @@ -119,6 +120,8 @@ static void mca_coll_hcoll_module_destruct(mca_coll_hcoll_module_t *hcoll_module OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_barrier_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_bcast_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_allreduce_module); + OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_reduce_scatter_block_module); + OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_reduce_scatter_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_allgather_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_allgatherv_module); OBJ_RELEASE_IF_NOT_NULL(hcoll_module->previous_gatherv_module); @@ -173,6 +176,8 @@ static int mca_coll_hcoll_save_coll_handlers(mca_coll_hcoll_module_t *hcoll_modu HCOL_SAVE_PREV_COLL_API(barrier); HCOL_SAVE_PREV_COLL_API(bcast); HCOL_SAVE_PREV_COLL_API(allreduce); + HCOL_SAVE_PREV_COLL_API(reduce_scatter_block); + HCOL_SAVE_PREV_COLL_API(reduce_scatter); HCOL_SAVE_PREV_COLL_API(reduce); HCOL_SAVE_PREV_COLL_API(allgather); HCOL_SAVE_PREV_COLL_API(allgatherv); @@ -419,6 +424,12 @@ mca_coll_hcoll_comm_query(struct ompi_communicator_t *comm, int *priority) hcoll_module->super.coll_ialltoallv = hcoll_collectives.coll_ialltoallv ? mca_coll_hcoll_ialltoallv : NULL; #else hcoll_module->super.coll_ialltoallv = NULL; +#endif +#if HCOLL_API > HCOLL_VERSION(4,5) + hcoll_module->super.coll_reduce_scatter_block = hcoll_collectives.coll_reduce_scatter_block ? + mca_coll_hcoll_reduce_scatter_block : NULL; + hcoll_module->super.coll_reduce_scatter = hcoll_collectives.coll_reduce_scatter ? + mca_coll_hcoll_reduce_scatter : NULL; #endif *priority = cm->hcoll_priority; module = &hcoll_module->super; diff --git a/ompi/mca/coll/hcoll/coll_hcoll_ops.c b/ompi/mca/coll/hcoll/coll_hcoll_ops.c index 5791fe17db1..d864ae0d558 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_ops.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_ops.c @@ -760,3 +760,88 @@ int mca_coll_hcoll_ialltoallv(const void *sbuf, int *scounts, int *sdisps, return rc; } #endif + +#if HCOLL_API > HCOLL_VERSION(4,5) +int mca_coll_hcoll_reduce_scatter_block(const void *sbuf, void *rbuf, int rcount, + struct ompi_datatype_t *dtype, + struct ompi_op_t *op, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module) { + dte_data_representation_t Dtype; + hcoll_dte_op_t *Op; + int rc; + HCOL_VERBOSE(20,"RUNNING HCOL REDUCE SCATTER BLOCK"); + mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; + Dtype = ompi_dtype_2_hcoll_dtype(dtype, NO_DERIVED); + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(Dtype))){ + /*If we are here then datatype is not simple predefined datatype */ + /*In future we need to add more complex mapping to the dte_data_representation_t */ + /* Now use fallback */ + HCOL_VERBOSE(20,"Ompi_datatype is not supported: dtype = %s; calling fallback allreduce;", + dtype->super.name); + goto fallback; + } + + Op = ompi_op_2_hcolrte_op(op); + if (OPAL_UNLIKELY(HCOL_DTE_OP_NULL == Op->id)){ + /*If we are here then datatype is not simple predefined datatype */ + /*In future we need to add more complex mapping to the dte_data_representation_t */ + /* Now use fallback */ + HCOL_VERBOSE(20,"ompi_op_t is not supported: op = %s; calling fallback allreduce;", + op->o_name); + goto fallback; + } + + rc = hcoll_collectives.coll_reduce_scatter_block((void *)sbuf,rbuf,rcount,Dtype,Op,hcoll_module->hcoll_context); + if (HCOLL_SUCCESS != rc){ + fallback: + HCOL_VERBOSE(20,"RUNNING FALLBACK ALLREDUCE"); + rc = hcoll_module->previous_reduce_scatter_block(sbuf,rbuf, + rcount,dtype,op, + comm, hcoll_module->previous_allreduce_module); + } + return rc; +} + +int mca_coll_hcoll_reduce_scatter(const void *sbuf, void *rbuf, const int* rcounts, + struct ompi_datatype_t *dtype, + struct ompi_op_t *op, + struct ompi_communicator_t *comm, + mca_coll_base_module_t *module) { + dte_data_representation_t Dtype; + hcoll_dte_op_t *Op; + int rc; + HCOL_VERBOSE(20,"RUNNING HCOL REDUCE SCATTER"); + mca_coll_hcoll_module_t *hcoll_module = (mca_coll_hcoll_module_t*)module; + Dtype = ompi_dtype_2_hcoll_dtype(dtype, NO_DERIVED); + if (OPAL_UNLIKELY(HCOL_DTE_IS_ZERO(Dtype))){ + /*If we are here then datatype is not simple predefined datatype */ + /*In future we need to add more complex mapping to the dte_data_representation_t */ + /* Now use fallback */ + HCOL_VERBOSE(20,"Ompi_datatype is not supported: dtype = %s; calling fallback allreduce;", + dtype->super.name); + goto fallback; + } + + Op = ompi_op_2_hcolrte_op(op); + if (OPAL_UNLIKELY(HCOL_DTE_OP_NULL == Op->id)){ + /*If we are here then datatype is not simple predefined datatype */ + /*In future we need to add more complex mapping to the dte_data_representation_t */ + /* Now use fallback */ + HCOL_VERBOSE(20,"ompi_op_t is not supported: op = %s; calling fallback allreduce;", + op->o_name); + goto fallback; + } + + rc = hcoll_collectives.coll_reduce_scatter((void*)sbuf, rbuf, (int*)rcounts, + Dtype, Op, hcoll_module->hcoll_context); + if (HCOLL_SUCCESS != rc){ + fallback: + HCOL_VERBOSE(20,"RUNNING FALLBACK ALLREDUCE"); + rc = hcoll_module->previous_reduce_scatter(sbuf,rbuf, + rcounts,dtype,op, + comm, hcoll_module->previous_allreduce_module); + } + return rc; +} +#endif From 6f401186f79a432c3377d18698818eb572bdc03e Mon Sep 17 00:00:00 2001 From: Valentin Petrov Date: Thu, 25 Jun 2020 09:09:35 +0300 Subject: [PATCH 657/674] coll/hcoll: compile warning fix Signed-off-by: Valentin Petrov --- ompi/mca/coll/hcoll/coll_hcoll.h | 8 ++++---- ompi/mca/coll/hcoll/coll_hcoll_ops.c | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/ompi/mca/coll/hcoll/coll_hcoll.h b/ompi/mca/coll/hcoll/coll_hcoll.h index 0c33d18d8ea..a9210fb47f3 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll.h +++ b/ompi/mca/coll/hcoll/coll_hcoll.h @@ -317,11 +317,11 @@ int mca_coll_hcoll_ialltoall(const void *sbuf, int scount, mca_coll_base_module_t *module); #if HCOLL_API >= HCOLL_VERSION(3,7) -int mca_coll_hcoll_ialltoallv(const void *sbuf, int *scounts, - int *sdisps, +int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, + const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, int *rcounts, - int *rdisps, + void *rbuf, const int *rcounts, + const int *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t **req, diff --git a/ompi/mca/coll/hcoll/coll_hcoll_ops.c b/ompi/mca/coll/hcoll/coll_hcoll_ops.c index d864ae0d558..a4e83f99436 100644 --- a/ompi/mca/coll/hcoll/coll_hcoll_ops.c +++ b/ompi/mca/coll/hcoll/coll_hcoll_ops.c @@ -136,7 +136,8 @@ int mca_coll_hcoll_allgatherv(const void *sbuf, int scount, hcoll_module->previous_allgatherv_module); return rc; } - rc = hcoll_collectives.coll_allgatherv((void *)sbuf,scount,stype,rbuf,rcount,displs,rtype,hcoll_module->hcoll_context); + rc = hcoll_collectives.coll_allgatherv((void *)sbuf,scount,stype,rbuf,(int*)rcount, + (int*)displs,rtype,hcoll_module->hcoll_context); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK ALLGATHERV"); rc = hcoll_module->previous_allgatherv(sbuf,scount,sdtype, @@ -558,7 +559,7 @@ int mca_coll_hcoll_iallgatherv(const void *sbuf, int scount, hcoll_module->previous_iallgatherv_module); return rc; } - rc = hcoll_collectives.coll_iallgatherv((void *)sbuf,scount,stype,rbuf,rcount,displs,rtype, + rc = hcoll_collectives.coll_iallgatherv((void *)sbuf,scount,stype,rbuf,(int*)rcount,(int*)displs,rtype, hcoll_module->hcoll_context, rt_handle); if (HCOLL_SUCCESS != rc){ HCOL_VERBOSE(20,"RUNNING FALLBACK NON-BLOCKING ALLGATHER"); @@ -724,9 +725,9 @@ int mca_coll_hcoll_igatherv(const void* sbuf, int scount, #if HCOLL_API >= HCOLL_VERSION(3,7) -int mca_coll_hcoll_ialltoallv(const void *sbuf, int *scounts, int *sdisps, +int mca_coll_hcoll_ialltoallv(const void *sbuf, const int *scounts, const int *sdisps, struct ompi_datatype_t *sdtype, - void *rbuf, int *rcounts, int *rdisps, + void *rbuf, const int *rcounts, const int *rdisps, struct ompi_datatype_t *rdtype, struct ompi_communicator_t *comm, ompi_request_t ** request, From 55eab422b5fdefa28fb9af32531011838b451171 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Mon, 6 Jul 2020 19:35:15 +0000 Subject: [PATCH 658/674] dist: Move version to 4.1.0rc1 Signed-off-by: Brian Barrett --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0e9d7239417..bbcb25cc8ff 100644 --- a/VERSION +++ b/VERSION @@ -32,7 +32,7 @@ release=0 # requirement is that it must be entirely printable ASCII characters # and have no white space. -greek=a1 +greek=rc1 # If repo_rev is empty, then the repository version number will be # obtained during "make dist" via the "git describe --tags --always" From 9dc3a9e85dde240c7943dcb7b2197202fd3978d9 Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Mon, 6 Jul 2020 19:34:56 +0000 Subject: [PATCH 659/674] dist: Update NEWS file for 4.1.0rc1 Signed-off-by: Brian Barrett --- NEWS | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/NEWS b/NEWS index 868e6bc3ce7..6c11d2cd0b9 100644 --- a/NEWS +++ b/NEWS @@ -60,6 +60,12 @@ included in the vX.Y.Z section and be denoted as: 4.1.0 -- July, 2020 ------------------- +- runtime: fix situation where rank-by argument does not work +- Portals4: Clean up error handling corner cases +- runtime: Remove --enable-install-libpmix option, which has not + worked since it was added +- UCX: Allow UCX 1.8 to be used with the btl uct +- OMPIO: Add support for the IME file system - OFI/libfabric: Added support for multiple NICs - OFI/libfabric: Added support for Scalable Endpoints - OFI/libfabric: Added btl for one-sided support From 94922937c2e7ac0e1a21cf3b9ac213137aca8b05 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 10 Jul 2020 06:59:22 -0700 Subject: [PATCH 660/674] fortran.m4: disallow when sizeof(int) != sizeof(INTEGER) NOTE: This is intentionally not a cherry pick from master. Instead, this is a cherry-pick from the equivalent commit on the v4.0.x branch. See below. There is a problem with the mpi_f08 module when sizeof(int) != sizeof(INTEGER): the size of TYPE(MPI_Status) is too small. This causes buffer overruns when Open MPI is configured with (for example) sizeof(int)==4 and sizeof(INTEGER)==8, and then you call the mpi_f08 MPI_RECV subroutine. This will end up copying the resulting C MPI_Status to the buffer pointing to the Fortran status, but the code does not know if the Fortran status is an mpif.h status or a TYPE(MPI_Status) -- it just blindly copies over as if the Fortran status is an INTEGER array of length MPI_STATUS_SIZE. Unfortunately, TYPE(MPI_Status) is actually smaller than this, so we overrun the buffer. Hilarity ensues. The simple fix for this is to make TYPE(MPI_Status) the same size as INTEGER(MPI_STATUS_SIZE), but we can't do that here on the release branch because it will break ABI. This commit does the following: - checks to see if we're in a sizeof(int) != sizeof(INTEGER) scenario - if so, if the user has not specifically excluded building the mpi_f08 module, display a Giant Error Message (GEM) and abort configure. This is unusual; we don't usually abort configure when feature XYZ can't be built -- if the user didn't specifically ask for XYZ, we just emit a notice that we won't build XYZ and continue. This situation is a little different because we're on a release branch: prior releases have built mpi_f08 by default -- even in this "bad" scenario. Hence, in this case, we explicitly tell the user that this is now a known-bad scenario and abort. In the GEM, we give the user two options: 1. Change their compiler flags so that sizeof(int) == sizeof(INTEGER) and re-run configure, or 2. Explicitly disable the mpi_f08 module via --enable-mpi-fortran=usempi Thanks to @ahaichen for reporting the issue. Note: the proper fix has been implemented on master (i.e., what will become v5.0.0), but since that breaks ABI, we can't cherry pick it back here to an existing release branch series. Hence, we cherry-picked this fix from the v4.0.x branch. Signed-off-by: Jeff Squyres (cherry picked from commit 27836a614b9c29d7636cdf1a9b838b1532281a8a) --- config/ompi_setup_mpi_fortran.m4 | 66 ++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/config/ompi_setup_mpi_fortran.m4 b/config/ompi_setup_mpi_fortran.m4 index 95c88aeb8b5..f7d46543744 100644 --- a/config/ompi_setup_mpi_fortran.m4 +++ b/config/ompi_setup_mpi_fortran.m4 @@ -373,6 +373,72 @@ AC_DEFUN([OMPI_SETUP_MPI_FORTRAN],[ OMPI_FORTRAN_F08_TYPE=$OMPI_FORTRAN_IGNORE_TKR_TYPE ]) + # The mpi_f08 module in this version of Open MPI does not properly + # handle if sizeof(INTEGER) != sizeof(int) with the mpi_f08 + # bindings. As of July 2020, this issue is fixed on master / what + # will eventually become Open MPI v5.0.x, but the fix causes an + # ABI break. Hence, we're not going to fix it here on this + # release branch. + # + # This is a bit of a quandry, however, because up until v4.0.4, we + # built the Open MPI F08 bindings by default (if the compiler + # supported them), even in this problematic scenario. Meaning: a + # user could use the exact same compilers + configure command line + # between v4.0.4 and v4.0.5 and suddenly -- probably unexpectedly + # -- not get F08 bindings. That seems a little weird. + # + # Instead, if we're in the "bad" scenario (sizeof(int) != + # sizeof(INTEGER)), if the user didn't explicitly disable the + # mpi_f08 module, we'll print a Giant Error Message (GEM) and tell + # them what their options are. This may be slightly annoying for + # the user, but it at least it won't violate the Law of Least + # Surprise. + # + # Note that mpif.h and mpi module are still ok in the sizeof(int) + # != sizeof(INTEGER) scenario; this isssue *only* affects the use + # of mpi_f08's TYPE(MPI_Status). + # + # The following URLs shed some light on this decision: + # + # - https://github.com/open-mpi/ompi/pull/7921 -- in particular, + # the comment at + # https://github.com/open-mpi/ompi/pull/7921#issuecomment-656418618 + # - https://github.com/open-mpi/ompi/pull/7922 -- in particlar, + # the comment at + # https://github.com/open-mpi/ompi/pull/7922#issuecomment-656788803 + # + AC_MSG_CHECKING([if sizeof(C int) == sizeof(Fortran INTEGER)]) + AS_IF([test $ac_cv_sizeof_int -eq $OMPI_SIZEOF_FORTRAN_INTEGER], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AS_IF([test $OMPI_TRY_FORTRAN_BINDINGS -ge $OMPI_FORTRAN_USEMPIF08_BINDINGS], + [c=$ac_cv_sizeof_int + f=$OMPI_SIZEOF_FORTRAN_INTEGER + cat < Date: Fri, 28 Jun 2019 13:37:19 +0900 Subject: [PATCH 661/674] mpi/c: fix param checks in [I]Neighbor_alltoall{v,w} do not check some input parameters when an {in,out}degree is zero Thanks Junchao Zhang for analyzing and reporting this issue. Signed-off-by: Gilles Gouaillardet (cherry picked from commit 5655d64bd3e064cdd6925b994e555e75d00d0f08) --- ompi/mpi/c/ineighbor_alltoallv.c | 13 +++++++------ ompi/mpi/c/ineighbor_alltoallw.c | 13 ++++++------- ompi/mpi/c/neighbor_alltoallv.c | 11 ++++++----- ompi/mpi/c/neighbor_alltoallw.c | 13 +++++++------ 4 files changed, 26 insertions(+), 24 deletions(-) diff --git a/ompi/mpi/c/ineighbor_alltoallv.c b/ompi/mpi/c/ineighbor_alltoallv.c index a44d081e10a..06775609797 100644 --- a/ompi/mpi/c/ineighbor_alltoallv.c +++ b/ompi/mpi/c/ineighbor_alltoallv.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -102,14 +102,15 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i } else if (! OMPI_COMM_IS_TOPO(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME); - } else if ((NULL == sendcounts) || (NULL == sdispls) || - (NULL == recvcounts) || (NULL == rdispls) || - MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); + if (((0 < outdegree) && ((NULL == sendcounts) || (NULL == sdispls))) || + ((0 < indegree) && ((NULL == recvcounts) || (NULL == rdispls))) || + MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); + } for (i = 0; i < outdegree; ++i) { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/ineighbor_alltoallw.c b/ompi/mpi/c/ineighbor_alltoallw.c index efb4d24f5f7..1821a334439 100644 --- a/ompi/mpi/c/ineighbor_alltoallw.c +++ b/ompi/mpi/c/ineighbor_alltoallw.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2018 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -102,14 +102,13 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M FUNC_NAME); } - if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) || - (NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) || + err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree); + OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); + if (((0 < outdegree) && ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes))) || + ((0 < indegree) && ((NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes))) || MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } - - err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree); - OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); for (i = 0; i < outdegree; ++i) { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/neighbor_alltoallv.c b/ompi/mpi/c/neighbor_alltoallv.c index 44234a62604..4af24fab9c1 100644 --- a/ompi/mpi/c/neighbor_alltoallv.c +++ b/ompi/mpi/c/neighbor_alltoallv.c @@ -13,7 +13,7 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science + * Copyright (c) 2014-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ @@ -101,14 +101,15 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in } else if (! OMPI_COMM_IS_TOPO(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_COMM, FUNC_NAME); - } else if ((NULL == sendcounts) || (NULL == sdispls) || - (NULL == recvcounts) || (NULL == rdispls) || - MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); + if (((0 < outdegree) && ((NULL == sendcounts) || (NULL == sdispls))) || + ((0 < indegree) && ((NULL == recvcounts) || (NULL == rdispls))) || + MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); + } for (i = 0; i < outdegree; ++i) { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtype, sendcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); diff --git a/ompi/mpi/c/neighbor_alltoallw.c b/ompi/mpi/c/neighbor_alltoallw.c index 29bf626f8b2..7beca2fcf70 100644 --- a/ompi/mpi/c/neighbor_alltoallw.c +++ b/ompi/mpi/c/neighbor_alltoallw.c @@ -13,8 +13,8 @@ * Copyright (c) 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2017 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2014-2015 Research Organization for Information Science - * and Technology (RIST). All rights reserved. + * Copyright (c) 2014-2019 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. * $COPYRIGHT$ * @@ -97,14 +97,15 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP } else if (! OMPI_COMM_IS_TOPO(comm)) { return OMPI_ERRHANDLER_INVOKE(MPI_COMM_WORLD, MPI_ERR_TOPOLOGY, FUNC_NAME); - } else if ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes) || - (NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes) || - MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { - return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); } err = mca_topo_base_neighbor_count (comm, &indegree, &outdegree); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); + if (((0 < outdegree) && ((NULL == sendcounts) || (NULL == sdispls) || (NULL == sendtypes))) || + ((0 < indegree) && ((NULL == recvcounts) || (NULL == rdispls) || (NULL == recvtypes))) || + MPI_IN_PLACE == sendbuf || MPI_IN_PLACE == recvbuf) { + return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG, FUNC_NAME); + } for (i = 0; i < outdegree; ++i) { OMPI_CHECK_DATATYPE_FOR_SEND(err, sendtypes[i], sendcounts[i]); OMPI_ERRHANDLER_CHECK(err, comm, err, FUNC_NAME); From 8b5b0c5a2a62294aa9dbb32a1952f199bb1bcd55 Mon Sep 17 00:00:00 2001 From: Artem Polyakov Date: Fri, 6 Mar 2020 10:15:22 -0800 Subject: [PATCH 662/674] schizo/slurm: Disable binding in case of Slurm direct launch Signed-off-by: Artem Polyakov (cherry picked from commit c72f295dfaced7e9f879b1eba3eebb7c35cb5bf5) --- orte/mca/schizo/slurm/schizo_slurm.c | 33 +++++----------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/orte/mca/schizo/slurm/schizo_slurm.c b/orte/mca/schizo/slurm/schizo_slurm.c index 1038f690448..c91e53b2e2a 100644 --- a/orte/mca/schizo/slurm/schizo_slurm.c +++ b/orte/mca/schizo/slurm/schizo_slurm.c @@ -93,33 +93,12 @@ static orte_schizo_launch_environ_t check_launch_environment(void) opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"ess"); opal_argv_append_nosize(&pushed_vals, "pmi"); - /* if we are direct launched by SLURM, then we want - * to ensure that we do not override their binding - * options, so set that envar */ - if (NULL != (bind = getenv("SLURM_CPU_BIND_TYPE"))) { - if (0 == strcmp(bind, "none")) { - opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"hwloc_base_binding_policy"); - opal_argv_append_nosize(&pushed_vals, "none"); - /* indicate we are externally bound so we won't try to do it ourselves */ - opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"orte_externally_bound"); - opal_argv_append_nosize(&pushed_vals, "1"); - } else if (bind == strstr(bind, "mask_cpu")) { - /* if the bind list is all F's, then the - * user didn't specify anything */ - if (NULL != (list = getenv("SLURM_CPU_BIND_LIST")) && - NULL != (ptr = strchr(list, 'x'))) { - ++ptr; // step over the 'x' - for (i=0; '\0' != *ptr; ptr++) { - if ('F' != *ptr) { - /* indicate we are externally bound */ - opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"orte_externally_bound"); - opal_argv_append_nosize(&pushed_vals, "1"); - break; - } - } - } - } - } + /* if we are direct-launched by SLURM, then disable binding */ + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"hwloc_base_binding_policy"); + opal_argv_append_nosize(&pushed_vals, "none"); + /* indicate we are externally bound so we won't try to do it ourselves */ + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"orte_externally_bound"); + opal_argv_append_nosize(&pushed_vals, "1"); setup: opal_output_verbose(1, orte_schizo_base_framework.framework_output, From c71e1fa1db48a2829cc6f64f8980ebd3b2b36621 Mon Sep 17 00:00:00 2001 From: Joshua Hursey Date: Mon, 13 Jul 2020 15:31:21 -0500 Subject: [PATCH 663/674] v4.1.x: schizo/jsm: Disable binding when direct launched Signed-off-by: Joshua Hursey --- orte/mca/schizo/jsm/schizo_jsm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/orte/mca/schizo/jsm/schizo_jsm.c b/orte/mca/schizo/jsm/schizo_jsm.c index 57861f13187..08350e23773 100644 --- a/orte/mca/schizo/jsm/schizo_jsm.c +++ b/orte/mca/schizo/jsm/schizo_jsm.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. - * Copyright (c) 2017-2019 IBM Corporation. All rights reserved. + * Copyright (c) 2017-2020 IBM Corporation. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -78,6 +78,13 @@ static orte_schizo_launch_environ_t check_launch_environment(void) * If we did then the logic should be placed here. */ + /* if we are direct-launched by JSM, then disable binding */ + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"hwloc_base_binding_policy"); + opal_argv_append_nosize(&pushed_vals, "none"); + /* indicate we are externally bound so we won't try to do it ourselves */ + opal_argv_append_nosize(&pushed_envs, OPAL_MCA_PREFIX"orte_externally_bound"); + opal_argv_append_nosize(&pushed_vals, "1"); + opal_output_verbose(1, orte_schizo_base_framework.framework_output, "schizo:jsm DECLARED AS %s", orte_schizo_base_print_env(myenv)); if (NULL != pushed_envs) { From b4e04bbd8a5eafe6cd6854884025460253a50962 Mon Sep 17 00:00:00 2001 From: dongzhong Date: Fri, 11 Oct 2019 11:12:07 -0400 Subject: [PATCH 664/674] Add supports for MPI_OP using AVX512, AVX2 and MMX Add logic to handle different architectural capabilities Detect the compiler flags necessary to build specialized versions of the MPI_OP. Once the different flavors (AVX512, AVX2, AVX) are built, detect at runtime which is the best match with the current processor capabilities. Add validation checks for loadu 256 and 512 bits. Add validation tests for MPI_Op. Signed-off-by: Jeff Squyres Signed-off-by: Gilles Gouaillardet Signed-off-by: dongzhong Signed-off-by: George Bosilca (cherry picked from commit 14b3c706289cfc26e53b13efd3eb85641636e459) --- config/opal_config_asm.m4 | 4 +- ompi/mca/op/avx/Makefile.am | 101 ++ ompi/mca/op/avx/configure.m4 | 265 +++++ ompi/mca/op/avx/op_avx.h | 65 ++ ompi/mca/op/avx/op_avx_component.c | 295 ++++++ ompi/mca/op/avx/op_avx_functions.c | 1279 +++++++++++++++++++++++ ompi/mca/op/base/op_base_functions.c | 105 +- ompi/mca/op/base/op_base_op_select.c | 6 +- ompi/mca/op/op.h | 6 +- test/datatype/Makefile.am | 8 +- test/datatype/check_op.sh | 81 ++ test/datatype/reduce_local.c | 1425 ++++++++++++++++++++++++++ 12 files changed, 3623 insertions(+), 17 deletions(-) create mode 100644 ompi/mca/op/avx/Makefile.am create mode 100644 ompi/mca/op/avx/configure.m4 create mode 100644 ompi/mca/op/avx/op_avx.h create mode 100644 ompi/mca/op/avx/op_avx_component.c create mode 100644 ompi/mca/op/avx/op_avx_functions.c create mode 100755 test/datatype/check_op.sh create mode 100644 test/datatype/reduce_local.c diff --git a/config/opal_config_asm.m4 b/config/opal_config_asm.m4 index 65675d16b58..d0874e1c37b 100644 --- a/config/opal_config_asm.m4 +++ b/config/opal_config_asm.m4 @@ -2,7 +2,7 @@ dnl dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana dnl University Research and Technology dnl Corporation. All rights reserved. -dnl Copyright (c) 2004-2018 The University of Tennessee and The University +dnl Copyright (c) 2004-2020 The University of Tennessee and The University dnl of Tennessee Research Foundation. All rights dnl reserved. dnl Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, @@ -1245,7 +1245,7 @@ AC_MSG_ERROR([Can not continue.]) # Check for RDTSCP support result=0 - AS_IF([test "$opal_cv_asm_arch" = "OPAL_X86_64" || test "$opal_cv_asm_arch" = "OPAL_IA32"], + AS_IF([test "$opal_cv_asm_arch" = "X86_64" || test "$opal_cv_asm_arch" = "IA32"], [AC_MSG_CHECKING([for RDTSCP assembly support]) AC_LANG_PUSH([C]) AC_TRY_RUN([[ diff --git a/ompi/mca/op/avx/Makefile.am b/ompi/mca/op/avx/Makefile.am new file mode 100644 index 00000000000..41dcf2e1834 --- /dev/null +++ b/ompi/mca/op/avx/Makefile.am @@ -0,0 +1,101 @@ +# +# Copyright (c) 2019-2020 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2020 Research Organization for Information Science +# and Technology (RIST). All rights reserved. +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# This component provide support for the Advanced Vector Extensions (AVX) +# available in recent versions of x86 processors. +# +# See https://github.com/open-mpi/ompi/wiki/devel-CreateComponent +# for more details on how to make Open MPI components. + +# First, list all .h and .c sources. It is necessary to list all .h +# files so that they will be picked up in the distribution tarball. + +sources = op_avx_component.c op_avx.h +sources_extended = op_avx_functions.c + +# Open MPI components can be compiled two ways: +# +# 1. As a standalone dynamic shared object (DSO), sometimes called a +# dynamically loadable library (DLL). +# +# 2. As a static library that is slurped up into the upper-level +# libmpi library (regardless of whether libmpi is a static or dynamic +# library). This is called a "Libtool convenience library". +# +# The component needs to create an output library in this top-level +# component directory, and named either mca__.la (for DSO +# builds) or libmca__.la (for static builds). The OMPI +# build system will have set the +# MCA_BUILD_ompi___DSO AM_CONDITIONAL to indicate +# which way this component should be built. + +# We need to support all processors from early AVX to full AVX512 support, based on +# a decision made at runtime. So, we generate all combinations of capabilities, and +# we will select the most suitable (based on the processor flags) during the +# component initialization. +specialized_op_libs = +if MCA_BUILD_ompi_op_has_avx_support +specialized_op_libs += liblocal_ops_avx.la +liblocal_ops_avx_la_SOURCES = $(sources_extended) +liblocal_ops_avx_la_CFLAGS = @MCA_BUILD_OP_AVX_FLAGS@ +liblocal_ops_avx_la_CPPFLAGS = -DGENERATE_AVX_CODE +if MCA_BUILD_ompi_op_has_sse3_support +liblocal_ops_avx_la_CPPFLAGS += -DGENERATE_SSE3_CODE +endif +if MCA_BUILD_ompi_op_has_sse41_support +liblocal_ops_avx_la_CPPFLAGS += -DGENERATE_SSE41_CODE +endif +endif +if MCA_BUILD_ompi_op_has_avx2_support +specialized_op_libs += liblocal_ops_avx2.la +liblocal_ops_avx2_la_SOURCES = $(sources_extended) +liblocal_ops_avx2_la_CFLAGS = @MCA_BUILD_OP_AVX2_FLAGS@ +liblocal_ops_avx2_la_CPPFLAGS = -DGENERATE_SSE3_CODE -DGENERATE_SSE41_CODE -DGENERATE_AVX_CODE -DGENERATE_AVX2_CODE +endif +if MCA_BUILD_ompi_op_has_avx512_support +specialized_op_libs += liblocal_ops_avx512.la +liblocal_ops_avx512_la_SOURCES = $(sources_extended) +liblocal_ops_avx512_la_CFLAGS = @MCA_BUILD_OP_AVX512_FLAGS@ +liblocal_ops_avx512_la_CPPFLAGS = -DGENERATE_SSE3_CODE -DGENERATE_SSE41_CODE -DGENERATE_AVX_CODE -DGENERATE_AVX2_CODE -DGENERATE_AVX512_CODE +endif + +component_noinst = $(specialized_op_libs) +if MCA_BUILD_ompi_op_avx_DSO +component_install = mca_op_avx.la +else +component_install = +component_noinst += libmca_op_avx.la +endif + +# Specific information for DSO builds. +# +# The DSO should install itself in $(ompilibdir) (by default, +# $prefix/lib/openmpi). + +mcacomponentdir = $(ompilibdir) +mcacomponent_LTLIBRARIES = $(component_install) +mca_op_avx_la_SOURCES = $(sources) +mca_op_avx_la_LIBADD = $(specialized_op_libs) +mca_op_avx_la_LDFLAGS = -module -avoid-version + + +# Specific information for static builds. +# +# Note that we *must* "noinst"; the upper-layer Makefile.am's will +# slurp in the resulting .la library into libmpi. + +noinst_LTLIBRARIES = $(component_noinst) +libmca_op_avx_la_SOURCES = $(sources) +libmca_op_avx_la_LIBADD = $(specialized_op_libs) +libmca_op_avx_la_LDFLAGS = -module -avoid-version + diff --git a/ompi/mca/op/avx/configure.m4 b/ompi/mca/op/avx/configure.m4 new file mode 100644 index 00000000000..889aa85ba5f --- /dev/null +++ b/ompi/mca/op/avx/configure.m4 @@ -0,0 +1,265 @@ +# -*- shell-script -*- +# +# Copyright (c) 2019-2020 The University of Tennessee and The University +# of Tennessee Research Foundation. All rights +# reserved. +# Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. +# +# $COPYRIGHT$ +# +# Additional copyrights may follow +# +# $HEADER$ +# + +# MCA_ompi_op_avx_CONFIG([action-if-can-compile], +# [action-if-cant-compile]) +# ------------------------------------------------ +# We can always build, unless we were explicitly disabled. +AC_DEFUN([MCA_ompi_op_avx_CONFIG],[ + AC_CONFIG_FILES([ompi/mca/op/avx/Makefile]) + + MCA_BUILD_OP_AVX_FLAGS="" + MCA_BUILD_OP_AVX2_FLAGS="" + MCA_BUILD_OP_AVX512_FLAGS="" + op_sse3_support=0 + op_sse41_support=0 + op_avx_support=0 + op_avx2_support=0 + op_avx512_support=0 + OPAL_VAR_SCOPE_PUSH([op_avx_cflags_save]) + + AS_IF([test "$opal_cv_asm_arch" = "X86_64"], + [AC_LANG_PUSH([C]) + + # + # Check for AVX512 support + # + AC_MSG_CHECKING([for AVX512 support (no additional flags)]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m512 vA, vB; + _mm512_add_ps(vA, vB) + ]])], + [op_avx512_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + + AS_IF([test $op_avx512_support -eq 0], + [AC_MSG_CHECKING([for AVX512 support (with -march=skylake-avx512)]) + op_avx_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS -march=skylake-avx512" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m512 vA, vB; + _mm512_add_ps(vA, vB) + ]])], + [op_avx512_support=1 + MCA_BUILD_OP_AVX512_FLAGS="-march=skylake-avx512" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + CFLAGS="$op_avx_cflags_save" + ]) + # + # Some combination of gcc and older as would not correctly build the code generated by + # _mm256_loadu_si256. Screen them out. + # + AS_IF([test $op_avx512_support -eq 1], + [AC_MSG_CHECKING([if _mm512_loadu_si512 generates code that can be compiled]) + op_avx_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS_WITHOUT_OPTFLAGS -O0 $MCA_BUILD_OP_AVX512_FLAGS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + int A[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; + __m512i vA = _mm512_loadu_si512((__m512i*)&(A[1])) + ]])], + [AC_MSG_RESULT([yes])], + [op_avx512_support=0 + MCA_BUILD_OP_AVX512_FLAGS="" + AC_MSG_RESULT([no])]) + CFLAGS="$op_avx_cflags_save" + ]) + # + # Check support for AVX2 + # + AC_MSG_CHECKING([for AVX2 support (no additional flags)]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m256 vA, vB; + _mm256_add_ps(vA, vB) + ]])], + [op_avx2_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + AS_IF([test $op_avx2_support -eq 0], + [AC_MSG_CHECKING([for AVX2 support (with -mavx2)]) + op_avx_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS -mavx2" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m256 vA, vB; + _mm256_add_ps(vA, vB) + ]])], + [op_avx2_support=1 + MCA_BUILD_OP_AVX2_FLAGS="-mavx2" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + CFLAGS="$op_avx_cflags_save" + ]) + # + # Some combination of gcc and older as would not correctly build the code generated by + # _mm256_loadu_si256. Screen them out. + # + AS_IF([test $op_avx2_support -eq 1], + [AC_MSG_CHECKING([if _mm256_loadu_si256 generates code that can be compiled]) + op_avx_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS_WITHOUT_OPTFLAGS -O0 $MCA_BUILD_OP_AVX2_FLAGS" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + int A[8] = {0, 1, 2, 3, 4, 5, 6, 7}; + __m256i vA = _mm256_loadu_si256((__m256i*)&A) + ]])], + [AC_MSG_RESULT([yes])], + [op_avx2_support=0 + MCA_BUILD_OP_AVX2_FLAGS="" + AC_MSG_RESULT([no])]) + CFLAGS="$op_avx_cflags_save" + ]) + # + # What about early AVX support. The rest of the logic is slightly different as + # we need to include some of the SSE4.1 and SSE3 instructions. So, we first check + # if we can compile AVX code without a flag, then we validate that we have support + # for the SSE4.1 and SSE3 instructions we need. If not, we check for the usage of + # the AVX flag, and then recheck if we have support for the SSE4.1 and SSE3 + # instructions. + # + AC_MSG_CHECKING([for AVX support (no additional flags)]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m128 vA, vB; + _mm_add_ps(vA, vB) + ]])], + [op_avx_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + # + # Check for SSE4.1 support + # + AS_IF([test $op_avx_support -eq 1], + [AC_MSG_CHECKING([for SSE4.1 support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m128i vA, vB; + (void)_mm_max_epi8(vA, vB) + ]])], + [op_sse41_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + ]) + # + # Check for SSE3 support + # + AS_IF([test $op_avx_support -eq 1], + [AC_MSG_CHECKING([for SSE3 support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + int A[4] = {0, 1, 2, 3}; + __m128i vA = _mm_lddqu_si128((__m128i*)&A) + ]])], + [op_sse3_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + ]) + # Second pass, do we need to add the AVX flag ? + AS_IF([test $op_avx_support -eq 0 || test $op_sse41_support -eq 0 || test $op_sse3_support -eq 0], + [AC_MSG_CHECKING([for AVX support (with -mavx)]) + op_avx_cflags_save="$CFLAGS" + CFLAGS="$CFLAGS -mavx" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m128 vA, vB; + _mm_add_ps(vA, vB) + ]])], + [op_avx_support=1 + MCA_BUILD_OP_AVX_FLAGS="-mavx" + op_sse41_support=0 + op_sse3_support=0 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + + AS_IF([test $op_sse41_support -eq 0], + [AC_MSG_CHECKING([for SSE4.1 support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + __m128i vA, vB; + (void)_mm_max_epi8(vA, vB) + ]])], + [op_sse41_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + ]) + AS_IF([test $op_sse3_support -eq 0], + [AC_MSG_CHECKING([for SSE3 support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[ + int A[4] = {0, 1, 2, 3}; + __m128i vA = _mm_lddqu_si128((__m128i*)&A) + ]])], + [op_sse3_support=1 + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + ]) + CFLAGS="$op_avx_cflags_save" + ]) + + AC_LANG_POP([C]) + ]) + AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_AVX512], + [$op_avx512_support], + [AVX512 supported in the current build]) + AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_AVX2], + [$op_avx2_support], + [AVX2 supported in the current build]) + AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_AVX], + [$op_avx_support], + [AVX supported in the current build]) + AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_SSE41], + [$op_sse41_support], + [SSE4.1 supported in the current build]) + AC_DEFINE_UNQUOTED([OMPI_MCA_OP_HAVE_SSE3], + [$op_sse3_support], + [SSE3 supported in the current build]) + AM_CONDITIONAL([MCA_BUILD_ompi_op_has_avx512_support], + [test "$op_avx512_support" == "1"]) + AM_CONDITIONAL([MCA_BUILD_ompi_op_has_avx2_support], + [test "$op_avx2_support" == "1"]) + AM_CONDITIONAL([MCA_BUILD_ompi_op_has_avx_support], + [test "$op_avx_support" == "1"]) + AM_CONDITIONAL([MCA_BUILD_ompi_op_has_sse41_support], + [test "$op_sse41_support" == "1"]) + AM_CONDITIONAL([MCA_BUILD_ompi_op_has_sse3_support], + [test "$op_sse3_support" == "1"]) + AC_SUBST(MCA_BUILD_OP_AVX512_FLAGS) + AC_SUBST(MCA_BUILD_OP_AVX2_FLAGS) + AC_SUBST(MCA_BUILD_OP_AVX_FLAGS) + + OPAL_VAR_SCOPE_POP + # Enable this component iff we have at least the most basic form of support + # for vectorial ISA + AS_IF([test $op_avx_support -eq 1 || test $op_avx2_support -eq 1 || test $op_avx512_support -eq 1], + [$1], + [$2]) + +])dnl diff --git a/ompi/mca/op/avx/op_avx.h b/ompi/mca/op/avx/op_avx.h new file mode 100644 index 00000000000..1f2523f887d --- /dev/null +++ b/ompi/mca/op/avx/op_avx.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2019-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#ifndef MCA_OP_AVX_EXPORT_H +#define MCA_OP_AVX_EXPORT_H + +#include "ompi_config.h" + +#include "ompi/mca/mca.h" +#include "opal/class/opal_object.h" + +#include "ompi/mca/op/op.h" + +BEGIN_C_DECLS + +#define OMPI_OP_AVX_HAS_AVX512BW_FLAG 0x00000200 +#define OMPI_OP_AVX_HAS_AVX512F_FLAG 0x00000100 +#define OMPI_OP_AVX_HAS_AVX2_FLAG 0x00000020 +#define OMPI_OP_AVX_HAS_AVX_FLAG 0x00000010 +#define OMPI_OP_AVX_HAS_SSE4_1_FLAG 0x00000008 +#define OMPI_OP_AVX_HAS_SSE3_FLAG 0x00000004 +#define OMPI_OP_AVX_HAS_SSE2_FLAG 0x00000002 +#define OMPI_OP_AVX_HAS_SSE_FLAG 0x00000001 + +/** + * Derive a struct from the base op component struct, allowing us to + * cache some component-specific information on our well-known + * component struct. + */ +typedef struct { + /** The base op component struct */ + ompi_op_base_component_1_0_0_t super; + + /* What follows is avx-component-specific cached information. We + tend to use this scheme (caching information on the avx + component itself) instead of lots of individual global + variables for the component. The following data fields are + avxs; replace them with whatever is relevant for your + component. */ + + uint32_t flags; /* AVX capabilities supported by the processor */ +} ompi_op_avx_component_t; + +/** + * Globally exported variable. Note that it is a *avx* component + * (defined above), which has the ompi_op_base_component_t as its + * first member. Hence, the MCA/op framework will find the data that + * it expects in the first memory locations, but then the component + * itself can cache additional information after that that can be used + * by both the component and modules. + */ +OMPI_DECLSPEC extern ompi_op_avx_component_t + mca_op_avx_component; + +END_C_DECLS + +#endif /* MCA_OP_AVX_EXPORT_H */ diff --git a/ompi/mca/op/avx/op_avx_component.c b/ompi/mca/op/avx/op_avx_component.c new file mode 100644 index 00000000000..e5c5d760977 --- /dev/null +++ b/ompi/mca/op/avx/op_avx_component.c @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2019-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/** @file + * + * This is the "avx" component source code. + * + */ + +#include "ompi_config.h" + +#include "opal/util/printf.h" + +#include "ompi/constants.h" +#include "ompi/op/op.h" +#include "ompi/mca/op/op.h" +#include "ompi/mca/op/base/base.h" +#include "ompi/mca/op/avx/op_avx.h" + +static int avx_component_open(void); +static int avx_component_close(void); +static int avx_component_init_query(bool enable_progress_threads, + bool enable_mpi_thread_multiple); +static struct ompi_op_base_module_1_0_0_t * + avx_component_op_query(struct ompi_op_t *op, int *priority); +static int avx_component_register(void); + +/** + * A slightly modified code from + * https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family + */ +#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1300) + +#include + +static uint32_t has_intel_AVX_features(void) +{ + uint32_t flags = 0; + + flags |= _may_i_use_cpu_feature(_FEATURE_AVX512F) ? OMPI_OP_AVX_HAS_AVX512F_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_AVX512BW) ? OMPI_OP_AVX_HAS_AVX512BW_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_AVX2) ? OMPI_OP_AVX_HAS_AVX2_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_AVX) ? OMPI_OP_AVX_HAS_AVX_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_SSE4_1) ? OMPI_OP_AVX_HAS_SSE4_1_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_SSE3) ? OMPI_OP_AVX_HAS_SSE3_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_SSE2) ? OMPI_OP_AVX_HAS_SSE2_FLAG : 0; + flags |= _may_i_use_cpu_feature(_FEATURE_SSE) ? OMPI_OP_AVX_HAS_SSE_FLAG : 0; + return flags; +} +#else /* non-Intel compiler */ +#include + +#if defined(_MSC_VER) +#include +#endif + +static void run_cpuid(uint32_t eax, uint32_t ecx, uint32_t* abcd) +{ +#if defined(_MSC_VER) + __cpuidex(abcd, eax, ecx); +#else + uint32_t ebx = 0, edx = 0; +#if defined( __i386__ ) && defined ( __PIC__ ) + /* in case of PIC under 32-bit EBX cannot be clobbered */ + __asm__ ( "movl %%ebx, %%edi \n\t cpuid \n\t xchgl %%ebx, %%edi" : "=D" (ebx), +#else + __asm__ ( "cpuid" : "+b" (ebx), +#endif /* defined( __i386__ ) && defined ( __PIC__ ) */ + "+a" (eax), "+c" (ecx), "=d" (edx) ); + abcd[0] = eax; abcd[1] = ebx; abcd[2] = ecx; abcd[3] = edx; +#endif +} + +static uint32_t has_intel_AVX_features(void) +{ + /* From https://en.wikipedia.org/wiki/CPUID#EAX=1:_Processor_Info_and_Feature_Bits */ + const uint32_t avx512f_mask = (1U << 16); // AVX512F (EAX = 7, ECX = 0) : EBX + const uint32_t avx512_bw_mask = (1U << 30); // AVX512BW (EAX = 7, ECX = 0) : EBX + const uint32_t avx2_mask = (1U << 5); // AVX2 (EAX = 7, ECX = 0) : EBX + const uint32_t avx_mask = (1U << 28); // AVX (EAX = 1, ECX = 0) : ECX + const uint32_t sse4_1_mask = (1U << 19); // SSE4.1 (EAX = 1, ECX = 0) : ECX + const uint32_t sse3_mask = (1U << 0); // SSE3 (EAX = 1, ECX = 0) : ECX + const uint32_t sse2_mask = (1U << 26); // SSE2 (EAX = 1, ECX = 0) : EDX + const uint32_t sse_mask = (1U << 15); // SSE (EAX = 1, ECX = 0) : EDX + uint32_t flags = 0, abcd[4]; + + run_cpuid( 1, 0, abcd ); + flags |= (abcd[2] & avx_mask) ? OMPI_OP_AVX_HAS_AVX_FLAG : 0; + flags |= (abcd[2] & sse4_1_mask) ? OMPI_OP_AVX_HAS_SSE4_1_FLAG : 0; + flags |= (abcd[2] & sse3_mask) ? OMPI_OP_AVX_HAS_SSE3_FLAG : 0; + flags |= (abcd[3] & sse2_mask) ? OMPI_OP_AVX_HAS_SSE2_FLAG : 0; + flags |= (abcd[3] & sse_mask) ? OMPI_OP_AVX_HAS_SSE_FLAG : 0; +#if defined(__APPLE__) + uint32_t fma_movbe_osxsave_mask = ((1U << 12) | (1U << 22) | (1U << 27)); /* FMA(12) + MOVBE (22) OSXSAVE (27) */ + // OS supports extended processor state management ? + if ( (abcd[2] & fma_movbe_osxsave_mask) != fma_movbe_osxsave_mask ) + return 0; +#endif /* defined(__APPLE__) */ + + run_cpuid( 7, 0, abcd ); + flags |= (abcd[1] & avx512f_mask) ? OMPI_OP_AVX_HAS_AVX512F_FLAG : 0; + flags |= (abcd[1] & avx512_bw_mask) ? OMPI_OP_AVX_HAS_AVX512BW_FLAG : 0; + flags |= (abcd[1] & avx2_mask) ? OMPI_OP_AVX_HAS_AVX2_FLAG : 0; + return flags; +} +#endif /* non-Intel compiler */ + +ompi_op_avx_component_t mca_op_avx_component = { + { + .opc_version = { + OMPI_OP_BASE_VERSION_1_0_0, + + .mca_component_name = "avx", + MCA_BASE_MAKE_VERSION(component, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, + OMPI_RELEASE_VERSION), + .mca_open_component = avx_component_open, + .mca_close_component = avx_component_close, + .mca_register_component_params = avx_component_register, + }, + .opc_data = { + /* The component is checkpoint ready */ + MCA_BASE_METADATA_PARAM_CHECKPOINT + }, + + .opc_init_query = avx_component_init_query, + .opc_op_query = avx_component_op_query, + }, +}; + +/* + * Component open + */ +static int avx_component_open(void) +{ + /* We checked the flags during register, so if they are set to + * zero either the architecture is not suitable or the user disabled + * AVX support. + * + * A first level check to see what level of AVX is available on the + * hardware. + * + * Note that if this function returns non-OMPI_SUCCESS, then this + * component won't even be shown in ompi_info output (which is + * probably not what you want). + */ + return OMPI_SUCCESS; +} + +/* + * Component close + */ +static int avx_component_close(void) +{ + /* If avx was opened successfully, close it (i.e., release any + resources that may have been allocated on this component). + Note that _component_close() will always be called at the end + of the process, so it may have been after any/all of the other + component functions have been invoked (and possibly even after + modules have been created and/or destroyed). */ + + return OMPI_SUCCESS; +} + +/* + * Register MCA params. + */ +static int +avx_component_register(void) +{ + int32_t requested_flags = mca_op_avx_component.flags = has_intel_AVX_features(); + (void) mca_base_component_var_register(&mca_op_avx_component.super.opc_version, + "support", + "Level of SSE/MMX/AVX support to be used (combination of processor capabilities as follow SSE 0x01, SSE2 0x02, SSE3 0x04, SSE4.1 0x08, AVX 0x010, AVX2 0x020, AVX512F 0x100, AVX512BW 0x200) capped by the local architecture capabilities", + MCA_BASE_VAR_TYPE_INT, NULL, 0, 0, + OPAL_INFO_LVL_6, + MCA_BASE_VAR_SCOPE_LOCAL, + &mca_op_avx_component.flags); + mca_op_avx_component.flags &= requested_flags; + return OMPI_SUCCESS; +} + +/* + * Query whether this component wants to be used in this process. + */ +static int +avx_component_init_query(bool enable_progress_threads, + bool enable_mpi_thread_multiple) +{ + if( 0 == mca_op_avx_component.flags ) + return OMPI_ERR_NOT_SUPPORTED; + return OMPI_SUCCESS; +} + +#if OMPI_MCA_OP_HAVE_AVX512 + extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx512[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; + extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx512[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; +#endif +#if OMPI_MCA_OP_HAVE_AVX2 + extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx2[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; + extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx2[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; +#endif +#if OMPI_MCA_OP_HAVE_AVX + extern ompi_op_base_handler_fn_t ompi_op_avx_functions_avx[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; + extern ompi_op_base_3buff_handler_fn_t ompi_op_avx_3buff_functions_avx[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX]; +#endif +/* + * Query whether this component can be used for a specific op + */ +static struct ompi_op_base_module_1_0_0_t* +avx_component_op_query(struct ompi_op_t *op, int *priority) +{ + ompi_op_base_module_t *module = NULL; + /* Sanity check -- although the framework should never invoke the + _component_op_query() on non-intrinsic MPI_Op's, we'll put a + check here just to be sure. */ + if (0 == (OMPI_OP_FLAGS_INTRINSIC & op->o_flags)) { + return NULL; + } + + switch (op->o_f_to_c_index) { + case OMPI_OP_BASE_FORTRAN_MAX: + case OMPI_OP_BASE_FORTRAN_MIN: + case OMPI_OP_BASE_FORTRAN_SUM: + case OMPI_OP_BASE_FORTRAN_PROD: + case OMPI_OP_BASE_FORTRAN_BOR: + case OMPI_OP_BASE_FORTRAN_BAND: + case OMPI_OP_BASE_FORTRAN_BXOR: + module = OBJ_NEW(ompi_op_base_module_t); + for (int i = 0; i < OMPI_OP_BASE_TYPE_MAX; ++i) { +#if OMPI_MCA_OP_HAVE_AVX512 + if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX512F_FLAG ) { + module->opm_fns[i] = ompi_op_avx_functions_avx512[op->o_f_to_c_index][i]; + module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx512[op->o_f_to_c_index][i]; + } +#endif +#if OMPI_MCA_OP_HAVE_AVX2 + if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX2_FLAG ) { + if( NULL == module->opm_fns[i] ) { + module->opm_fns[i] = ompi_op_avx_functions_avx2[op->o_f_to_c_index][i]; + } + if( NULL == module->opm_3buff_fns[i] ) { + module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx2[op->o_f_to_c_index][i]; + } + } +#endif +#if OMPI_MCA_OP_HAVE_AVX + if( mca_op_avx_component.flags & OMPI_OP_AVX_HAS_AVX_FLAG ) { + if( NULL == module->opm_fns[i] ) { + module->opm_fns[i] = ompi_op_avx_functions_avx[op->o_f_to_c_index][i]; + } + if( NULL == module->opm_3buff_fns[i] ) { + module->opm_3buff_fns[i] = ompi_op_avx_3buff_functions_avx[op->o_f_to_c_index][i]; + } + } +#endif + if( NULL != module->opm_fns[i] ) { + OBJ_RETAIN(module); + } + if( NULL != module->opm_3buff_fns[i] ) { + OBJ_RETAIN(module); + } + } + break; + case OMPI_OP_BASE_FORTRAN_LAND: + case OMPI_OP_BASE_FORTRAN_LOR: + case OMPI_OP_BASE_FORTRAN_LXOR: + case OMPI_OP_BASE_FORTRAN_MAXLOC: + case OMPI_OP_BASE_FORTRAN_MINLOC: + case OMPI_OP_BASE_FORTRAN_REPLACE: + default: + break; + } + /* If we got a module from above, we'll return it. Otherwise, + we'll return NULL, indicating that this component does not want + to be considered for selection for this MPI_Op. Note that the + functions each returned a *avx* component pointer + (vs. a *base* component pointer -- where an *avx* component + is a base component plus some other module-specific cached + information), so we have to cast it to the right pointer type + before returning. */ + if (NULL != module) { + *priority = 50; + } + return (ompi_op_base_module_1_0_0_t *) module; +} diff --git a/ompi/mca/op/avx/op_avx_functions.c b/ompi/mca/op/avx/op_avx_functions.c new file mode 100644 index 00000000000..92d71db1772 --- /dev/null +++ b/ompi/mca/op/avx/op_avx_functions.c @@ -0,0 +1,1279 @@ +/* + * Copyright (c) 2019-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#include "opal/util/output.h" + +#include "ompi/op/op.h" +#include "ompi/mca/op/op.h" +#include "ompi/mca/op/base/base.h" +#include "ompi/mca/op/avx/op_avx.h" + +#include + +#if defined(GENERATE_AVX512_CODE) +#define PREPEND _avx512 +#elif defined(GENERATE_AVX2_CODE) +#define PREPEND _avx2 +#elif defined(GENERATE_AVX_CODE) +#define PREPEND _avx +#else +#error This file should not be compiled in this conditions +#endif + +/* + * Concatenate preprocessor tokens A and B without expanding macro definitions + * (however, if invoked from a macro, macro arguments are expanded). + */ +#define OP_CONCAT_NX(A, B) A ## B + +/* + * Concatenate preprocessor tokens A and B after macro-expanding them. + */ +#define OP_CONCAT(A, B) OP_CONCAT_NX(A, B) + +/* + * Since all the functions in this file are essentially identical, we + * use a macro to substitute in names and types. The core operation + * in all functions that use this macro is the same. + * + * This macro is for (out op in). + * + * Support ops: max, min, for signed/unsigned 8,16,32,64 + * sum, for integer 8,16,32,64 + * + */ + +#define OMPI_OP_AVX_HAS_FLAGS(_flag) \ + (((_flag) & mca_op_avx_component.flags) == (_flag)) + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG|OMPI_OP_AVX_HAS_AVX512BW_FLAG) ) { \ + int types_per_step = (512 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m512i vecA = _mm512_loadu_si512((__m512*)in); \ + in += types_per_step; \ + __m512i vecB = _mm512_loadu_si512((__m512*)out); \ + __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm512_storeu_si512((__m512*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX2_FUNC(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX2_FLAG | OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + int types_per_step = (256 / 8) / sizeof(type); /* AVX2 */ \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256i vecA = _mm256_loadu_si256((__m256i*)in); \ + in += types_per_step; \ + __m256i vecB = _mm256_loadu_si256((__m256i*)out); \ + __m256i res = _mm256_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm256_storeu_si256((__m256i*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX2_FUNC(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_SSE3_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE4_1_FUNC(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE3_FLAG | OMPI_OP_AVX_HAS_SSE4_1_FLAG) ) { \ + int types_per_step = (128 / 8) / sizeof(type); /* AVX */ \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128i vecA = _mm_lddqu_si128((__m128i*)in); \ + in += types_per_step; \ + __m128i vecB = _mm_lddqu_si128((__m128i*)out); \ + __m128i res = _mm_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm_storeu_si128((__m128i*)out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE4_1_FUNC(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_FUNC(name, type_sign, type_size, type, op) \ +static void OP_CONCAT(ompi_op_avx_2buff_##name##_##type,PREPEND)(const void *_in, void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int left_over = *count; \ + type *in = (type*)_in, *out = (type*)_out; \ + OP_AVX_AVX512_FUNC(name, type_sign, type_size, type, op); \ + OP_AVX_AVX2_FUNC(name, type_sign, type_size, type, op); \ + OP_AVX_SSE4_1_FUNC(name, type_sign, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(out[7], in[7]); \ + case 7: out[6] = current_func(out[6], in[6]); \ + case 6: out[5] = current_func(out[5], in[5]); \ + case 5: out[4] = current_func(out[4], in[4]); \ + case 4: out[3] = current_func(out[3], in[3]); \ + case 3: out[2] = current_func(out[2], in[2]); \ + case 2: out[1] = current_func(out[1], in[1]); \ + case 1: out[0] = current_func(out[0], in[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_MUL(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG | OMPI_OP_AVX_HAS_AVX512BW_FLAG) ) { \ + int types_per_step = (256 / 8) / sizeof(type); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m256i vecA_tmp = _mm256_loadu_si256((__m256i*)in); \ + __m256i vecB_tmp = _mm256_loadu_si256((__m256i*)out); \ + in += types_per_step; \ + __m512i vecA = _mm512_cvtepi8_epi16(vecA_tmp); \ + __m512i vecB = _mm512_cvtepi8_epi16(vecB_tmp); \ + __m512i res = _mm512_##op##_ep##type_sign##16(vecA, vecB); \ + vecB_tmp = _mm512_cvtepi16_epi8(res); \ + _mm256_storeu_si256((__m256i*)out, vecB_tmp); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_MUL(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ +/** + * There is no support for 16 to 8 conversion without AVX512BW and AVX512VL, so + * there is no AVX-only optimized function posible for OP_AVX_AVX2_MUL. + */ + +/* special case for int8 mul */ +#define OP_AVX_MUL(name, type_sign, type_size, type, op) \ +static void OP_CONCAT( ompi_op_avx_2buff_##name##_##type, PREPEND)(const void *_in, void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int left_over = *count; \ + type *in = (type*)_in, *out = (type*)_out; \ + OP_AVX_AVX512_MUL(name, type_sign, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(out[7], in[7]); \ + case 7: out[6] = current_func(out[6], in[6]); \ + case 6: out[5] = current_func(out[5], in[5]); \ + case 5: out[4] = current_func(out[4], in[4]); \ + case 4: out[3] = current_func(out[3], in[3]); \ + case 3: out[2] = current_func(out[2], in[2]); \ + case 2: out[1] = current_func(out[1], in[1]); \ + case 1: out[0] = current_func(out[0], in[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in += how_much; \ + } \ +} + +/* + * This macro is for bit-wise operations (out op in). + * + * Support ops: or, xor, and of 512 bits (representing integer data) + * + */ +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_BIT_FUNC(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS( OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(type); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512i vecA = _mm512_loadu_si512((__m512i*)in); \ + in += types_per_step; \ + __m512i vecB = _mm512_loadu_si512((__m512i*)out); \ + __m512i res = _mm512_##op##_si512(vecA, vecB); \ + _mm512_storeu_si512((__m512i*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_BIT_FUNC(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX2_BIT_FUNC(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX2_FLAG | OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256i vecA = _mm256_loadu_si256((__m256i*)in); \ + in += types_per_step; \ + __m256i vecB = _mm256_loadu_si256((__m256i*)out); \ + __m256i res = _mm256_##op##_si256(vecA, vecB); \ + _mm256_storeu_si256((__m256i*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX2_BIT_FUNC(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_SSE3_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE3_BIT_FUNC(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE3_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128i vecA = _mm_lddqu_si128((__m128i*)in); \ + in += types_per_step; \ + __m128i vecB = _mm_lddqu_si128((__m128i*)out); \ + __m128i res = _mm_##op##_si128(vecA, vecB); \ + _mm_storeu_si128((__m128i*)out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE3_BIT_FUNC(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_BIT_FUNC(name, type_size, type, op) \ +static void OP_CONCAT(ompi_op_avx_2buff_##name##_##type,PREPEND)(const void *_in, void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step, left_over = *count; \ + type *in = (type*)_in, *out = (type*)_out; \ + OP_AVX_AVX512_BIT_FUNC(name, type_size, type, op); \ + OP_AVX_AVX2_BIT_FUNC(name, type_size, type, op); \ + OP_AVX_SSE3_BIT_FUNC(name, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(out[7], in[7]); \ + case 7: out[6] = current_func(out[6], in[6]); \ + case 6: out[5] = current_func(out[5], in[5]); \ + case 5: out[4] = current_func(out[4], in[4]); \ + case 4: out[3] = current_func(out[3], in[3]); \ + case 3: out[2] = current_func(out[2], in[2]); \ + case 2: out[1] = current_func(out[1], in[1]); \ + case 1: out[0] = current_func(out[0], in[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_FLOAT_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(float); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512 vecA = _mm512_load_ps((__m512*)in); \ + __m512 vecB = _mm512_load_ps((__m512*)out); \ + in += types_per_step; \ + __m512 res = _mm512_##op##_ps(vecA, vecB); \ + _mm512_store_ps((__m512*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_FLOAT_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX_FLOAT_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(float); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256 vecA = _mm256_load_ps(in); \ + in += types_per_step; \ + __m256 vecB = _mm256_load_ps(out); \ + __m256 res = _mm256_##op##_ps(vecA, vecB); \ + _mm256_store_ps(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX_FLOAT_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_AVX_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE_FLOAT_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(float); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128 vecA = _mm_load_ps(in); \ + in += types_per_step; \ + __m128 vecB = _mm_load_ps(out); \ + __m128 res = _mm_##op##_ps(vecA, vecB); \ + _mm_store_ps(out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE_FLOAT_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_FLOAT_FUNC(op) \ +static void OP_CONCAT(ompi_op_avx_2buff_##op##_float,PREPEND)(const void *_in, void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step, left_over = *count; \ + float *in = (float*)_in, *out = (float*)_out; \ + OP_AVX_AVX512_FLOAT_FUNC(op); \ + OP_AVX_AVX_FLOAT_FUNC(op); \ + OP_AVX_SSE_FLOAT_FUNC(op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(out[7], in[7]); \ + case 7: out[6] = current_func(out[6], in[6]); \ + case 6: out[5] = current_func(out[5], in[5]); \ + case 5: out[4] = current_func(out[4], in[4]); \ + case 4: out[3] = current_func(out[3], in[3]); \ + case 3: out[2] = current_func(out[2], in[2]); \ + case 2: out[1] = current_func(out[1], in[1]); \ + case 1: out[0] = current_func(out[0], in[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_DOUBLE_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(double); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512d vecA = _mm512_load_pd(in); \ + in += types_per_step; \ + __m512d vecB = _mm512_load_pd(out); \ + __m512d res = _mm512_##op##_pd(vecA, vecB); \ + _mm512_store_pd((out), res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_DOUBLE_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX_DOUBLE_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(double); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256d vecA = _mm256_load_pd(in); \ + in += types_per_step; \ + __m256d vecB = _mm256_load_pd(out); \ + __m256d res = _mm256_##op##_pd(vecA, vecB); \ + _mm256_store_pd(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX_DOUBLE_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_AVX_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE2_DOUBLE_FUNC(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE2_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(double); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128d vecA = _mm_load_pd(in); \ + in += types_per_step; \ + __m128d vecB = _mm_load_pd(out); \ + __m128d res = _mm_##op##_pd(vecA, vecB); \ + _mm_store_pd(out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE2_DOUBLE_FUNC(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_DOUBLE_FUNC(op) \ +static void OP_CONCAT(ompi_op_avx_2buff_##op##_double,PREPEND)(const void *_in, void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step = (512 / 8) / sizeof(double); \ + int left_over = *count; \ + double* in = (double*)_in; \ + double* out = (double*)_out; \ + OP_AVX_AVX512_DOUBLE_FUNC(op); \ + OP_AVX_AVX_DOUBLE_FUNC(op); \ + OP_AVX_SSE2_DOUBLE_FUNC(op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(out[7], in[7]); \ + case 7: out[6] = current_func(out[6], in[6]); \ + case 6: out[5] = current_func(out[5], in[5]); \ + case 5: out[4] = current_func(out[4], in[4]); \ + case 4: out[3] = current_func(out[3], in[3]); \ + case 3: out[2] = current_func(out[2], in[2]); \ + case 2: out[1] = current_func(out[1], in[1]); \ + case 1: out[0] = current_func(out[0], in[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in += how_much; \ + } \ +} + + +/************************************************************************* + * Max + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) > (b) ? (a) : (b)) + OP_AVX_FUNC(max, i, 8, int8_t, max) + OP_AVX_FUNC(max, u, 8, uint8_t, max) + OP_AVX_FUNC(max, i, 16, int16_t, max) + OP_AVX_FUNC(max, u, 16, uint16_t, max) + OP_AVX_FUNC(max, i, 32, int32_t, max) + OP_AVX_FUNC(max, u, 32, uint32_t, max) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC(max, i, 64, int64_t, max) + OP_AVX_FUNC(max, u, 64, uint64_t, max) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC(max) + OP_AVX_DOUBLE_FUNC(max) + +/************************************************************************* + * Min + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) < (b) ? (a) : (b)) + OP_AVX_FUNC(min, i, 8, int8_t, min) + OP_AVX_FUNC(min, u, 8, uint8_t, min) + OP_AVX_FUNC(min, i, 16, int16_t, min) + OP_AVX_FUNC(min, u, 16, uint16_t, min) + OP_AVX_FUNC(min, i, 32, int32_t, min) + OP_AVX_FUNC(min, u, 32, uint32_t, min) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC(min, i, 64, int64_t, min) + OP_AVX_FUNC(min, u, 64, uint64_t, min) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC(min) + OP_AVX_DOUBLE_FUNC(min) + +/************************************************************************* + * Sum + ************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) + (b)) + OP_AVX_FUNC(sum, i, 8, int8_t, adds) + OP_AVX_FUNC(sum, u, 8, uint8_t, adds) + OP_AVX_FUNC(sum, i, 16, int16_t, adds) + OP_AVX_FUNC(sum, u, 16, uint16_t, adds) + OP_AVX_FUNC(sum, i, 32, int32_t, add) + OP_AVX_FUNC(sum, i, 32, uint32_t, add) + OP_AVX_FUNC(sum, i, 64, int64_t, add) + OP_AVX_FUNC(sum, i, 64, uint64_t, add) + + /* Floating point */ + OP_AVX_FLOAT_FUNC(add) + OP_AVX_DOUBLE_FUNC(add) + +/************************************************************************* + * Product + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) * (b)) + OP_AVX_MUL(prod, i, 8, int8_t, mullo) + OP_AVX_MUL(prod, i, 8, uint8_t, mullo) + OP_AVX_FUNC(prod, i, 16, int16_t, mullo) + OP_AVX_FUNC(prod, i, 16, uint16_t, mullo) + OP_AVX_FUNC(prod, i, 32, int32_t, mullo) + OP_AVX_FUNC(prod, i ,32, uint32_t, mullo) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC(prod, i, 64, int64_t, mullo) + OP_AVX_FUNC(prod, i, 64, uint64_t, mullo) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC(mul) + OP_AVX_DOUBLE_FUNC(mul) + +/************************************************************************* + * Bitwise AND + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) & (b)) + OP_AVX_BIT_FUNC(band, 8, int8_t, and) + OP_AVX_BIT_FUNC(band, 8, uint8_t, and) + OP_AVX_BIT_FUNC(band, 16, int16_t, and) + OP_AVX_BIT_FUNC(band, 16, uint16_t, and) + OP_AVX_BIT_FUNC(band, 32, int32_t, and) + OP_AVX_BIT_FUNC(band, 32, uint32_t, and) + OP_AVX_BIT_FUNC(band, 64, int64_t, and) + OP_AVX_BIT_FUNC(band, 64, uint64_t, and) + + // not defined - OP_AVX_FLOAT_FUNC(and) + // not defined - OP_AVX_DOUBLE_FUNC(and) + +/************************************************************************* + * Bitwise OR + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) | (b)) + OP_AVX_BIT_FUNC(bor, 8, int8_t, or) + OP_AVX_BIT_FUNC(bor, 8, uint8_t, or) + OP_AVX_BIT_FUNC(bor, 16, int16_t, or) + OP_AVX_BIT_FUNC(bor, 16, uint16_t, or) + OP_AVX_BIT_FUNC(bor, 32, int32_t, or) + OP_AVX_BIT_FUNC(bor, 32, uint32_t, or) + OP_AVX_BIT_FUNC(bor, 64, int64_t, or) + OP_AVX_BIT_FUNC(bor, 64, uint64_t, or) + + // not defined - OP_AVX_FLOAT_FUNC(or) + // not defined - OP_AVX_DOUBLE_FUNC(or) + +/************************************************************************* + * Bitwise XOR + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) ^ (b)) + OP_AVX_BIT_FUNC(bxor, 8, int8_t, xor) + OP_AVX_BIT_FUNC(bxor, 8, uint8_t, xor) + OP_AVX_BIT_FUNC(bxor, 16, int16_t, xor) + OP_AVX_BIT_FUNC(bxor, 16, uint16_t, xor) + OP_AVX_BIT_FUNC(bxor, 32, int32_t, xor) + OP_AVX_BIT_FUNC(bxor, 32, uint32_t, xor) + OP_AVX_BIT_FUNC(bxor, 64, int64_t, xor) + OP_AVX_BIT_FUNC(bxor, 64, uint64_t, xor) + + // not defined - OP_AVX_FLOAT_FUNC(xor) + // not defined - OP_AVX_DOUBLE_FUNC(xor) + +/* + * This is a three buffer (2 input and 1 output) version of the reduction + * routines, needed for some optimizations. + */ +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_FUNC_3(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG|OMPI_OP_AVX_HAS_AVX512BW_FLAG) ) { \ + int types_per_step = (512 / 8) / sizeof(type); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512i vecA = _mm512_loadu_si512(in1); \ + __m512i vecB = _mm512_loadu_si512(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m512i res = _mm512_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm512_storeu_si512((out), res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_FUNC_3(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX2_FUNC_3(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX2_FLAG | OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + int types_per_step = (256 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256i vecA = _mm256_loadu_si256((__m256i*)in1); \ + __m256i vecB = _mm256_loadu_si256((__m256i*)in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m256i res = _mm256_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm256_storeu_si256((__m256i*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX2_FUNC_3(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_SSE3_CODE) && defined(OMPI_MCA_OP_HAVE_SSE41) && (1 == OMPI_MCA_OP_HAVE_SSE41) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE4_1_FUNC_3(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE3_FLAG | OMPI_OP_AVX_HAS_SSE4_1_FLAG) ) { \ + int types_per_step = (128 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128i vecA = _mm_lddqu_si128((__m128i*)in1); \ + __m128i vecB = _mm_lddqu_si128((__m128i*)in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m128i res = _mm_##op##_ep##type_sign##type_size(vecA, vecB); \ + _mm_storeu_si128((__m128i*)out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE4_1_FUNC_3(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_FUNC_3(name, type_sign, type_size, type, op) \ +static void OP_CONCAT(ompi_op_avx_3buff_##name##_##type,PREPEND)(const void * restrict _in1, \ + const void * restrict _in2, \ + void * restrict _out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + type *in1 = (type*)_in1, *in2 = (type*)_in2, *out = (type*)_out; \ + int left_over = *count; \ + OP_AVX_AVX512_FUNC_3(name, type_sign, type_size, type, op); \ + OP_AVX_AVX2_FUNC_3(name, type_sign, type_size, type, op); \ + OP_AVX_SSE4_1_FUNC_3(name, type_sign, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(in1[7], in2[7]); \ + case 7: out[6] = current_func(in1[6], in2[6]); \ + case 6: out[5] = current_func(in1[5], in2[5]); \ + case 5: out[4] = current_func(in1[4], in2[4]); \ + case 4: out[3] = current_func(in1[3], in2[3]); \ + case 3: out[2] = current_func(in1[2], in2[2]); \ + case 2: out[1] = current_func(in1[1], in2[1]); \ + case 1: out[0] = current_func(in1[0], in2[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in1 += how_much; \ + in2 += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_MUL_3(name, type_sign, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG | OMPI_OP_AVX_HAS_AVX512BW_FLAG) ) { \ + int types_per_step = (256 / 8) / sizeof(type); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m256i vecA_tmp = _mm256_loadu_si256((__m256i*)in1); \ + __m256i vecB_tmp = _mm256_loadu_si256((__m256i*)in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m512i vecA = _mm512_cvtepi8_epi16(vecA_tmp); \ + __m512i vecB = _mm512_cvtepi8_epi16(vecB_tmp); \ + __m512i res = _mm512_##op##_ep##type_sign##16(vecA, vecB); \ + vecB_tmp = _mm512_cvtepi16_epi8(res); \ + _mm256_storeu_si256((__m256i*)out, vecB_tmp); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_MUL_3(name, type_sign, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ +/** + * There is no support for 16 to 8 conversion without AVX512BW and AVX512VL, so + * there is no AVX-only optimized function posible for OP_AVX_AVX2_MUL. + */ + +/* special case for int8 mul */ +#define OP_AVX_MUL_3(name, type_sign, type_size, type, op) \ +static void OP_CONCAT(ompi_op_avx_3buff_##name##_##type,PREPEND)(const void * restrict _in1, \ + const void * restrict _in2, \ + void * restrict _out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + type *in1 = (type*)_in1, *in2 = (type*)_in2, *out = (type*)_out; \ + int left_over = *count; \ + OP_AVX_AVX512_MUL_3(name, type_sign, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(in1[7], in2[7]); \ + case 7: out[6] = current_func(in1[6], in2[6]); \ + case 6: out[5] = current_func(in1[5], in2[5]); \ + case 5: out[4] = current_func(in1[4], in2[4]); \ + case 4: out[3] = current_func(in1[3], in2[3]); \ + case 3: out[2] = current_func(in1[2], in2[2]); \ + case 2: out[1] = current_func(in1[1], in2[1]); \ + case 1: out[0] = current_func(in1[0], in2[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in1 += how_much; \ + in2 += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_BIT_FUNC_3(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(type); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512i vecA = _mm512_loadu_si512(in1); \ + __m512i vecB = _mm512_loadu_si512(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m512i res = _mm512_##op##_si512(vecA, vecB); \ + _mm512_storeu_si512(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_BIT_FUNC_3(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX2_BIT_FUNC_3(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX2_FLAG | OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256i vecA = _mm256_loadu_si256((__m256i*)in1); \ + __m256i vecB = _mm256_loadu_si256((__m256i*)in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m256i res = _mm256_##op##_si256(vecA, vecB); \ + _mm256_storeu_si256((__m256i*)out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX2_BIT_FUNC_3(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_SSE3_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE3_BIT_FUNC_3(name, type_size, type, op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE3_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(type); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128i vecA = _mm_lddqu_si128((__m128i*)in1); \ + __m128i vecB = _mm_lddqu_si128((__m128i*)in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m128i res = _mm_##op##_si128(vecA, vecB); \ + _mm_storeu_si128((__m128i*)out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE3_BIT_FUNC_3(name, type_size, type, op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_BIT_FUNC_3(name, type_size, type, op) \ +static void OP_CONCAT(ompi_op_avx_3buff_##op##_##type,PREPEND)(const void *_in1, const void *_in2, \ + void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step, left_over = *count; \ + type *in1 = (type*)_in1, *in2 = (type*)_in2, *out = (type*)_out; \ + OP_AVX_AVX512_BIT_FUNC_3(name, type_size, type, op); \ + OP_AVX_AVX2_BIT_FUNC_3(name, type_size, type, op); \ + OP_AVX_SSE3_BIT_FUNC_3(name, type_size, type, op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(in1[7], in2[7]); \ + case 7: out[6] = current_func(in1[6], in2[6]); \ + case 6: out[5] = current_func(in1[5], in2[5]); \ + case 5: out[4] = current_func(in1[4], in2[4]); \ + case 4: out[3] = current_func(in1[3], in2[3]); \ + case 3: out[2] = current_func(in1[2], in2[2]); \ + case 2: out[1] = current_func(in1[1], in2[1]); \ + case 1: out[0] = current_func(in1[0], in2[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in1 += how_much; \ + in2 += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_FLOAT_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(float); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512 vecA = _mm512_load_ps(in1); \ + __m512 vecB = _mm512_load_ps(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m512 res = _mm512_##op##_ps(vecA, vecB); \ + _mm512_store_ps(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_FLOAT_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX_FLOAT_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(float); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256 vecA = _mm256_load_ps(in1); \ + __m256 vecB = _mm256_load_ps(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m256 res = _mm256_##op##_ps(vecA, vecB); \ + _mm256_store_ps(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX_FLOAT_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_AVX_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE_FLOAT_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(float); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128 vecA = _mm_load_ps(in1); \ + __m128 vecB = _mm_load_ps(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m128 res = _mm_##op##_ps(vecA, vecB); \ + _mm_store_ps(out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE_FLOAT_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_FLOAT_FUNC_3(op) \ +static void OP_CONCAT(ompi_op_avx_3buff_##op##_float,PREPEND)(const void *_in1, const void *_in2, \ + void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step, left_over = *count; \ + float *in1 = (float*)_in1, *in2 = (float*)_in2, *out = (float*)_out; \ + OP_AVX_AVX512_FLOAT_FUNC_3(op); \ + OP_AVX_AVX_FLOAT_FUNC_3(op); \ + OP_AVX_SSE_FLOAT_FUNC_3(op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(in1[7], in2[7]); \ + case 7: out[6] = current_func(in1[6], in2[6]); \ + case 6: out[5] = current_func(in1[5], in2[5]); \ + case 5: out[4] = current_func(in1[4], in2[4]); \ + case 4: out[3] = current_func(in1[3], in2[3]); \ + case 3: out[2] = current_func(in1[2], in2[2]); \ + case 2: out[1] = current_func(in1[1], in2[1]); \ + case 1: out[0] = current_func(in1[0], in2[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in1 += how_much; \ + in2 += how_much; \ + } \ +} + +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) +#define OP_AVX_AVX512_DOUBLE_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ + types_per_step = (512 / 8) / sizeof(double); \ + for (; left_over >= types_per_step; left_over -= types_per_step) { \ + __m512d vecA = _mm512_load_pd((in1)); \ + __m512d vecB = _mm512_load_pd((in2)); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m512d res = _mm512_##op##_pd(vecA, vecB); \ + _mm512_store_pd((out), res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX512_DOUBLE_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) */ + +#if defined(GENERATE_AVX2_CODE) && defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) +#define OP_AVX_AVX_DOUBLE_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ + types_per_step = (256 / 8) / sizeof(double); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m256d vecA = _mm256_load_pd(in1); \ + __m256d vecB = _mm256_load_pd(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m256d res = _mm256_##op##_pd(vecA, vecB); \ + _mm256_store_pd(out, res); \ + out += types_per_step; \ + } \ + if( 0 == left_over ) return; \ + } +#else +#define OP_AVX_AVX_DOUBLE_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX2) && (1 == OMPI_MCA_OP_HAVE_AVX2) */ + +#if defined(GENERATE_AVX_CODE) && defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) +#define OP_AVX_SSE2_DOUBLE_FUNC_3(op) \ + if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE2_FLAG) ) { \ + types_per_step = (128 / 8) / sizeof(double); \ + for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ + __m128d vecA = _mm_load_pd(in1); \ + __m128d vecB = _mm_load_pd(in2); \ + in1 += types_per_step; \ + in2 += types_per_step; \ + __m128d res = _mm_##op##_pd(vecA, vecB); \ + _mm_store_pd(out, res); \ + out += types_per_step; \ + } \ + } +#else +#define OP_AVX_SSE2_DOUBLE_FUNC_3(op) {} +#endif /* defined(OMPI_MCA_OP_HAVE_AVX) && (1 == OMPI_MCA_OP_HAVE_AVX) */ + +#define OP_AVX_DOUBLE_FUNC_3(op) \ +static void OP_CONCAT(ompi_op_avx_3buff_##op##_double,PREPEND)(const void *_in1, const void *_in2, \ + void *_out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ +{ \ + int types_per_step, left_over = *count; \ + double *in1 = (double*)_in1, *in2 = (double*)_in2, *out = (double*)_out; \ + OP_AVX_AVX512_DOUBLE_FUNC_3(op); \ + OP_AVX_AVX_DOUBLE_FUNC_3(op); \ + OP_AVX_SSE2_DOUBLE_FUNC_3(op); \ + while( left_over > 0 ) { \ + int how_much = (left_over > 8) ? 8 : left_over; \ + switch(how_much) { \ + case 8: out[7] = current_func(in1[7], in2[7]); \ + case 7: out[6] = current_func(in1[6], in2[6]); \ + case 6: out[5] = current_func(in1[5], in2[5]); \ + case 5: out[4] = current_func(in1[4], in2[4]); \ + case 4: out[3] = current_func(in1[3], in2[3]); \ + case 3: out[2] = current_func(in1[2], in2[2]); \ + case 2: out[1] = current_func(in1[1], in2[1]); \ + case 1: out[0] = current_func(in1[0], in2[0]); \ + } \ + left_over -= how_much; \ + out += how_much; \ + in1 += how_much; \ + in2 += how_much; \ + } \ +} + +/************************************************************************* + * Max + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) > (b) ? (a) : (b)) + + OP_AVX_FUNC_3(max, i, 8, int8_t, max) + OP_AVX_FUNC_3(max, u, 8, uint8_t, max) + OP_AVX_FUNC_3(max, i, 16, int16_t, max) + OP_AVX_FUNC_3(max, u, 16, uint16_t, max) + OP_AVX_FUNC_3(max, i, 32, int32_t, max) + OP_AVX_FUNC_3(max, u, 32, uint32_t, max) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC_3(max, i, 64, int64_t, max) + OP_AVX_FUNC_3(max, u, 64, uint64_t, max) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC_3(max) + OP_AVX_DOUBLE_FUNC_3(max) + +/************************************************************************* + * Min + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) < (b) ? (a) : (b)) + OP_AVX_FUNC_3(min, i, 8, int8_t, min) + OP_AVX_FUNC_3(min, u, 8, uint8_t, min) + OP_AVX_FUNC_3(min, i, 16, int16_t, min) + OP_AVX_FUNC_3(min, u, 16, uint16_t, min) + OP_AVX_FUNC_3(min, i, 32, int32_t, min) + OP_AVX_FUNC_3(min, u, 32, uint32_t, min) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC_3(min, i, 64, int64_t, min) + OP_AVX_FUNC_3(min, u, 64, uint64_t, min) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC_3(min) + OP_AVX_DOUBLE_FUNC_3(min) + +/************************************************************************* + * Sum + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) + (b)) + + OP_AVX_FUNC_3(sum, i, 8, int8_t, add) + OP_AVX_FUNC_3(sum, i, 8, uint8_t, add) + OP_AVX_FUNC_3(sum, i, 16, int16_t, add) + OP_AVX_FUNC_3(sum, i, 16, uint16_t, add) + OP_AVX_FUNC_3(sum, i, 32, int32_t, add) + OP_AVX_FUNC_3(sum, i, 32, uint32_t, add) + OP_AVX_FUNC_3(sum, i, 64, int64_t, add) + OP_AVX_FUNC_3(sum, i, 64, uint64_t, add) + + /* Floating point */ + OP_AVX_FLOAT_FUNC_3(add) + OP_AVX_DOUBLE_FUNC_3(add) + +/************************************************************************* + * Product + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) * (b)) + OP_AVX_MUL_3(prod, i, 8, int8_t, mullo) + OP_AVX_MUL_3(prod, i, 8, uint8_t, mullo) + OP_AVX_FUNC_3(prod, i, 16, int16_t, mullo) + OP_AVX_FUNC_3(prod, i, 16, uint16_t, mullo) + OP_AVX_FUNC_3(prod, i, 32, int32_t, mullo) + OP_AVX_FUNC_3(prod, i ,32, uint32_t, mullo) +#if defined(GENERATE_AVX512_CODE) && defined(OMPI_MCA_OP_HAVE_AVX512) && (1 == OMPI_MCA_OP_HAVE_AVX512) + OP_AVX_FUNC_3(prod, i, 64, int64_t, mullo) + OP_AVX_FUNC_3(prod, i, 64, uint64_t, mullo) +#endif + + /* Floating point */ + OP_AVX_FLOAT_FUNC_3(mul) + OP_AVX_DOUBLE_FUNC_3(mul) + +/************************************************************************* + * Bitwise AND + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) & (b)) + OP_AVX_BIT_FUNC_3(band, 8, int8_t, and) + OP_AVX_BIT_FUNC_3(band, 8, uint8_t, and) + OP_AVX_BIT_FUNC_3(band, 16, int16_t, and) + OP_AVX_BIT_FUNC_3(band, 16, uint16_t, and) + OP_AVX_BIT_FUNC_3(band, 32, int32_t, and) + OP_AVX_BIT_FUNC_3(band, 32, uint32_t, and) + OP_AVX_BIT_FUNC_3(band, 64, int64_t, and) + OP_AVX_BIT_FUNC_3(band, 64, uint64_t, and) + + // not defined - OP_AVX_FLOAT_FUNC_3(and) + // not defined - OP_AVX_DOUBLE_FUNC_3(and) + +/************************************************************************* + * Bitwise OR + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) | (b)) + OP_AVX_BIT_FUNC_3(bor, 8, int8_t, or) + OP_AVX_BIT_FUNC_3(bor, 8, uint8_t, or) + OP_AVX_BIT_FUNC_3(bor, 16, int16_t, or) + OP_AVX_BIT_FUNC_3(bor, 16, uint16_t, or) + OP_AVX_BIT_FUNC_3(bor, 32, int32_t, or) + OP_AVX_BIT_FUNC_3(bor, 32, uint32_t, or) + OP_AVX_BIT_FUNC_3(bor, 64, int64_t, or) + OP_AVX_BIT_FUNC_3(bor, 64, uint64_t, or) + + // not defined - OP_AVX_FLOAT_FUNC_3(or) + // not defined - OP_AVX_DOUBLE_FUNC_3(or) + +/************************************************************************* + * Bitwise XOR + *************************************************************************/ +#undef current_func +#define current_func(a, b) ((a) ^ (b)) + OP_AVX_BIT_FUNC_3(bxor, 8, int8_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 8, uint8_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 16, int16_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 16, uint16_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 32, int32_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 32, uint32_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 64, int64_t, xor) + OP_AVX_BIT_FUNC_3(bxor, 64, uint64_t, xor) + + // not defined - OP_AVX_FLOAT_FUNC_3(xor) + // not defined - OP_AVX_DOUBLE_FUNC_3(xor) + +/** C integer ***********************************************************/ +#define C_INTEGER_8_16_32(name, ftype) \ + [OMPI_OP_BASE_TYPE_INT8_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_int8_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_UINT8_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_uint8_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_INT16_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_int16_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_UINT16_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_uint16_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_INT32_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_int32_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_UINT32_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_uint32_t,PREPEND) + +#define C_INTEGER(name, ftype) \ + C_INTEGER_8_16_32(name, ftype), \ + [OMPI_OP_BASE_TYPE_INT64_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_int64_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_UINT64_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_uint64_t,PREPEND) + +#if defined(GENERATE_AVX512_CODE) +#define C_INTEGER_OPTIONAL(name, ftype) \ + C_INTEGER_8_16_32(name, ftype), \ + [OMPI_OP_BASE_TYPE_INT64_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_int64_t,PREPEND), \ + [OMPI_OP_BASE_TYPE_UINT64_T] = OP_CONCAT(ompi_op_avx_##ftype##_##name##_uint64_t,PREPEND) +#else +#define C_INTEGER_OPTIONAL(name, ftype) \ + C_INTEGER_8_16_32(name, ftype) +#endif + +/** Floating point, including all the Fortran reals *********************/ +#define FLOAT(name, ftype) OP_CONCAT(ompi_op_avx_##ftype##_##name##_float,PREPEND) +#define DOUBLE(name, ftype) OP_CONCAT(ompi_op_avx_##ftype##_##name##_double,PREPEND) + +#define FLOATING_POINT(name, ftype) \ + [OMPI_OP_BASE_TYPE_FLOAT] = FLOAT(name, ftype), \ + [OMPI_OP_BASE_TYPE_DOUBLE] = DOUBLE(name, ftype) + +/* + * MPI_OP_NULL + * All types + */ +#define FLAGS_NO_FLOAT \ + (OMPI_OP_FLAGS_INTRINSIC | OMPI_OP_FLAGS_ASSOC | OMPI_OP_FLAGS_COMMUTE) +#define FLAGS \ + (OMPI_OP_FLAGS_INTRINSIC | OMPI_OP_FLAGS_ASSOC | \ + OMPI_OP_FLAGS_FLOAT_ASSOC | OMPI_OP_FLAGS_COMMUTE) + +ompi_op_base_handler_fn_t OP_CONCAT(ompi_op_avx_functions, PREPEND)[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX] = +{ + /* Corresponds to MPI_OP_NULL */ + [OMPI_OP_BASE_FORTRAN_NULL] = { + /* Leaving this empty puts in NULL for all entries */ + NULL, + }, + /* Corresponds to MPI_MAX */ + [OMPI_OP_BASE_FORTRAN_MAX] = { + C_INTEGER_OPTIONAL(max, 2buff), + FLOATING_POINT(max, 2buff), + }, + /* Corresponds to MPI_MIN */ + [OMPI_OP_BASE_FORTRAN_MIN] = { + C_INTEGER_OPTIONAL(min, 2buff), + FLOATING_POINT(min, 2buff), + }, + /* Corresponds to MPI_SUM */ + [OMPI_OP_BASE_FORTRAN_SUM] = { + C_INTEGER(sum, 2buff), + FLOATING_POINT(add, 2buff), + }, + /* Corresponds to MPI_PROD */ + [OMPI_OP_BASE_FORTRAN_PROD] = { + C_INTEGER_OPTIONAL(prod, 2buff), + FLOATING_POINT(mul, 2buff), + }, + /* Corresponds to MPI_LAND */ + [OMPI_OP_BASE_FORTRAN_LAND] = { + NULL, + }, + /* Corresponds to MPI_BAND */ + [OMPI_OP_BASE_FORTRAN_BAND] = { + C_INTEGER(band, 2buff), + }, + /* Corresponds to MPI_LOR */ + [OMPI_OP_BASE_FORTRAN_LOR] = { + NULL, + }, + /* Corresponds to MPI_BOR */ + [OMPI_OP_BASE_FORTRAN_BOR] = { + C_INTEGER(bor, 2buff), + }, + /* Corresponds to MPI_LXOR */ + [OMPI_OP_BASE_FORTRAN_LXOR] = { + NULL, + }, + /* Corresponds to MPI_BXOR */ + [OMPI_OP_BASE_FORTRAN_BXOR] = { + C_INTEGER(bxor, 2buff), + }, + /* Corresponds to MPI_REPLACE */ + [OMPI_OP_BASE_FORTRAN_REPLACE] = { + /* (MPI_ACCUMULATE is handled differently than the other + reductions, so just zero out its function + implementations here to ensure that users don't invoke + MPI_REPLACE with any reduction operations other than + ACCUMULATE) */ + NULL, + }, + +}; + +ompi_op_base_3buff_handler_fn_t OP_CONCAT(ompi_op_avx_3buff_functions, PREPEND)[OMPI_OP_BASE_FORTRAN_OP_MAX][OMPI_OP_BASE_TYPE_MAX] = +{ + /* Corresponds to MPI_OP_NULL */ + [OMPI_OP_BASE_FORTRAN_NULL] = { + /* Leaving this empty puts in NULL for all entries */ + NULL, + }, + /* Corresponds to MPI_MAX */ + [OMPI_OP_BASE_FORTRAN_MAX] = { + C_INTEGER_OPTIONAL(max, 3buff), + FLOATING_POINT(max, 3buff), + }, + /* Corresponds to MPI_MIN */ + [OMPI_OP_BASE_FORTRAN_MIN] = { + C_INTEGER_OPTIONAL(min, 3buff), + FLOATING_POINT(min, 3buff), + }, + /* Corresponds to MPI_SUM */ + [OMPI_OP_BASE_FORTRAN_SUM] = { + C_INTEGER(sum, 3buff), + FLOATING_POINT(add, 3buff), + }, + /* Corresponds to MPI_PROD */ + [OMPI_OP_BASE_FORTRAN_PROD] = { + C_INTEGER_OPTIONAL(prod, 3buff), + FLOATING_POINT(mul, 3buff), + }, + /* Corresponds to MPI_LAND */ + [OMPI_OP_BASE_FORTRAN_LAND] ={ + NULL, + }, + /* Corresponds to MPI_BAND */ + [OMPI_OP_BASE_FORTRAN_BAND] = { + C_INTEGER(and, 3buff), + }, + /* Corresponds to MPI_LOR */ + [OMPI_OP_BASE_FORTRAN_LOR] = { + NULL, + }, + /* Corresponds to MPI_BOR */ + [OMPI_OP_BASE_FORTRAN_BOR] = { + C_INTEGER(or, 3buff), + }, + /* Corresponds to MPI_LXOR */ + [OMPI_OP_BASE_FORTRAN_LXOR] = { + NULL, + }, + /* Corresponds to MPI_BXOR */ + [OMPI_OP_BASE_FORTRAN_BXOR] = { + C_INTEGER(xor, 3buff), + }, + /* Corresponds to MPI_REPLACE */ + [OMPI_OP_BASE_FORTRAN_REPLACE] = { + /* MPI_ACCUMULATE is handled differently than the other + reductions, so just zero out its function + implementations here to ensure that users don't invoke + MPI_REPLACE with any reduction operations other than + ACCUMULATE */ + NULL, + }, +}; diff --git a/ompi/mca/op/base/op_base_functions.c b/ompi/mca/op/base/op_base_functions.c index 99a248f85c7..8360ef59d4b 100644 --- a/ompi/mca/op/base/op_base_functions.c +++ b/ompi/mca/op/base/op_base_functions.c @@ -37,7 +37,7 @@ * This macro is for (out op in). */ #define OP_FUNC(name, type_name, type, op) \ - static void ompi_op_base_2buff_##name##_##type_name(void *in, void *out, int *count, \ + static void ompi_op_base_2buff_##name##_##type_name(const void *in, void *out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -57,7 +57,7 @@ * This macro is for (out = op(out, in)) */ #define FUNC_FUNC(name, type_name, type) \ - static void ompi_op_base_2buff_##name##_##type_name(void *in, void *out, int *count, \ + static void ompi_op_base_2buff_##name##_##type_name(const void *in, void *out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -85,7 +85,7 @@ } ompi_op_predefined_##type_name##_t; #define LOC_FUNC(name, type_name, op) \ - static void ompi_op_base_2buff_##name##_##type_name(void *in, void *out, int *count, \ + static void ompi_op_base_2buff_##name##_##type_name(const void *in, void *out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -102,6 +102,49 @@ } \ } +/* + * Define a function to calculate sum of complex numbers using a real + * number floating-point type (float, double, etc.). This macro is used + * when the compiler supports a real number floating-point type but does + * not supports the corresponding complex number type. + */ +#define COMPLEX_SUM_FUNC(type_name, type) \ + static void ompi_op_base_2buff_sum_##type_name(const void *in, void *out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ + { \ + int i; \ + type (*a)[2] = (type (*)[2]) in; \ + type (*b)[2] = (type (*)[2]) out; \ + for (i = 0; i < *count; ++i, ++a, ++b) { \ + (*b)[0] += (*a)[0]; \ + (*b)[1] += (*a)[1]; \ + } \ + } + +/* + * Define a function to calculate product of complex numbers using a real + * number floating-point type (float, double, etc.). This macro is used + * when the compiler supports a real number floating-point type but does + * not supports the corresponding complex number type. + */ +#define COMPLEX_PROD_FUNC(type_name, type) \ + static void ompi_op_base_2buff_prod_##type_name(const void *in, void *out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ + { \ + int i; \ + type (*a)[2] = (type (*)[2]) in; \ + type (*b)[2] = (type (*)[2]) out; \ + type c[2]; \ + for (i = 0; i < *count; ++i, ++a, ++b) { \ + c[0] = (*a)[0] * (*b)[0] - (*a)[1] * (*b)[1]; \ + c[1] = (*a)[0] * (*b)[1] + (*a)[1] * (*b)[0]; \ + (*b)[0] = c[0]; \ + (*b)[1] = c[1]; \ + } \ + } + /************************************************************************* * Max *************************************************************************/ @@ -604,8 +647,8 @@ LOC_FUNC(minloc, long_double_int, <) * routines, needed for some optimizations. */ #define OP_FUNC_3BUF(name, type_name, type, op) \ - static void ompi_op_base_3buff_##name##_##type_name(void * restrict in1, \ - void * restrict in2, void * restrict out, int *count, \ + static void ompi_op_base_3buff_##name##_##type_name(const void * restrict in1, \ + const void * restrict in2, void * restrict out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -626,8 +669,8 @@ LOC_FUNC(minloc, long_double_int, <) * This macro is for (out = op(in1, in2)) */ #define FUNC_FUNC_3BUF(name, type_name, type) \ - static void ompi_op_base_3buff_##name##_##type_name(void * restrict in1, \ - void * restrict in2, void * restrict out, int *count, \ + static void ompi_op_base_3buff_##name##_##type_name(const void * restrict in1, \ + const void * restrict in2, void * restrict out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -659,8 +702,8 @@ LOC_FUNC(minloc, long_double_int, <) */ #define LOC_FUNC_3BUF(name, type_name, op) \ - static void ompi_op_base_3buff_##name##_##type_name(void * restrict in1, \ - void * restrict in2, void * restrict out, int *count, \ + static void ompi_op_base_3buff_##name##_##type_name(const void * restrict in1, \ + const void * restrict in2, void * restrict out, int *count, \ struct ompi_datatype_t **dtype, \ struct ompi_op_base_module_1_0_0_t *module) \ { \ @@ -682,6 +725,50 @@ LOC_FUNC(minloc, long_double_int, <) } \ } +/* + * Define a function to calculate sum of complex numbers using a real + * number floating-point type (float, double, etc.). This macro is used + * when the compiler supports a real number floating-point type but does + * not supports the corresponding complex number type. + */ +#define COMPLEX_SUM_FUNC_3BUF(type_name, type) \ + static void ompi_op_base_3buff_sum_##type_name(const void * restrict in1, \ + const void * restrict in2, void * restrict out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ + { \ + int i; \ + type (*a1)[2] = (type (*)[2]) in1; \ + type (*a2)[2] = (type (*)[2]) in2; \ + type (*b)[2] = (type (*)[2]) out; \ + for (i = 0; i < *count; ++i, ++a1, ++a2, ++b) { \ + (*b)[0] = (*a1)[0] + (*a2)[0]; \ + (*b)[1] = (*a1)[1] + (*a2)[1]; \ + } \ + } + +/* + * Define a function to calculate product of complex numbers using a real + * number floating-point type (float, double, etc.). This macro is used + * when the compiler supports a real number floating-point type but does + * not supports the corresponding complex number type. + */ +#define COMPLEX_PROD_FUNC_3BUF(type_name, type) \ + static void ompi_op_base_3buff_prod_##type_name(const void * restrict in1, \ + const void * restrict in2, void * restrict out, int *count, \ + struct ompi_datatype_t **dtype, \ + struct ompi_op_base_module_1_0_0_t *module) \ + { \ + int i; \ + type (*a1)[2] = (type (*)[2]) in1; \ + type (*a2)[2] = (type (*)[2]) in2; \ + type (*b)[2] = (type (*)[2]) out; \ + for (i = 0; i < *count; ++i, ++a1, ++a2, ++b) { \ + (*b)[0] = (*a1)[0] * (*a2)[0] - (*a1)[1] * (*a2)[1]; \ + (*b)[1] = (*a1)[0] * (*a2)[1] + (*a1)[1] * (*a2)[0]; \ + } \ + } + /************************************************************************* * Max *************************************************************************/ diff --git a/ompi/mca/op/base/op_base_op_select.c b/ompi/mca/op/base/op_base_op_select.c index 93a72ace232..837bc51580c 100644 --- a/ompi/mca/op/base/op_base_op_select.c +++ b/ompi/mca/op/base/op_base_op_select.c @@ -14,6 +14,8 @@ * rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -206,8 +208,8 @@ int ompi_op_base_op_select(ompi_op_t *op) static int avail_op_compare(opal_list_item_t **itema, opal_list_item_t **itemb) { - avail_op_t *availa = (avail_op_t *) itema; - avail_op_t *availb = (avail_op_t *) itemb; + avail_op_t *availa = (avail_op_t *) *itema; + avail_op_t *availb = (avail_op_t *) *itemb; if (availa->ao_priority > availb->ao_priority) { return 1; diff --git a/ompi/mca/op/op.h b/ompi/mca/op/op.h index a4006b20c61..4afa6605e7c 100644 --- a/ompi/mca/op/op.h +++ b/ompi/mca/op/op.h @@ -250,7 +250,7 @@ typedef struct ompi_op_base_module_1_0_0_t ompi_op_base_module_t; * repeated code, but it's better this way (and this typedef will * never change, so there's not much of a maintenance worry). */ -typedef void (*ompi_op_base_handler_fn_1_0_0_t)(void *, void *, int *, +typedef void (*ompi_op_base_handler_fn_1_0_0_t)(const void *, void *, int *, struct ompi_datatype_t **, struct ompi_op_base_module_1_0_0_t *); @@ -259,8 +259,8 @@ typedef ompi_op_base_handler_fn_1_0_0_t ompi_op_base_handler_fn_t; /* * Typedef for 3-buffer (two input and one output) op functions. */ -typedef void (*ompi_op_base_3buff_handler_fn_1_0_0_t)(void *, - void *, +typedef void (*ompi_op_base_3buff_handler_fn_1_0_0_t)(const void *, + const void *, void *, int *, struct ompi_datatype_t **, struct ompi_op_base_module_1_0_0_t *); diff --git a/test/datatype/Makefile.am b/test/datatype/Makefile.am index 4366724a523..3da8fdffb73 100644 --- a/test/datatype/Makefile.am +++ b/test/datatype/Makefile.am @@ -16,7 +16,7 @@ if PROJECT_OMPI MPI_TESTS = checksum position position_noncontig ddt_test ddt_raw ddt_raw2 unpack_ooo ddt_pack external32 large_data - MPI_CHECKS = to_self + MPI_CHECKS = to_self reduce_local endif TESTS = opal_datatype_test unpack_hetero $(MPI_TESTS) @@ -96,5 +96,11 @@ unpack_hetero_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) unpack_hetero_LDADD = \ $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la +reduce_local_SOURCES = reduce_local.c +reduce_local_LDFLAGS = $(OMPI_PKG_CONFIG_LDFLAGS) +reduce_local_LDADD = \ + $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \ + $(top_builddir)/opal/lib@OPAL_LIB_PREFIX@open-pal.la + distclean: rm -rf *.dSYM .deps .libs *.log *.o *.trs $(check_PROGRAMS) Makefile diff --git a/test/datatype/check_op.sh b/test/datatype/check_op.sh new file mode 100755 index 00000000000..820e938eaf5 --- /dev/null +++ b/test/datatype/check_op.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -u + +echo "ompi version with AVX512 -- Usage: arg1: count of elements, args2: 'i'|'u'|'f'|'d' : datatype: signed, unsigned, float, double. args3 size of type. args4 operation" +mpirun="mpirun --mca pml ob1 --mca btl vader,self" +# For SVE-architecture +# echo "$mpirun -mca op_sve_hardware_available 0 -mca op_avx_hardware_available 0 -np 1 Reduce_local_float 1048576 i 8 max" + +# For X86_64 architectures +# echo "$mpirun -mca op_avx_support 0 -np 1 Reduce_local_float 1048576 i 8 max" + +Orange="\033[0;33m" +Blue="\033[0;34m" +Purple="\033[0;35m" +Yellow="\e[1;33m" + +NC="\e[m" + +verbose=0 + +echo "=========Signed Integer type all operations & all sizes========" +echo "" +for op in max min sum prod band bor bxor; do + echo -e "\n===Operation $op test===" + for type_size in 8 16 32 64; do + for size in 0 1 7 15 31 63 127 130; do + foo=$((1024 * 1024 + $size)) + echo -e "Test $Yellow __mm512 instruction for loop $NC Total_num_bits = $foo * $type_size " + cmd="$mpirun -np 1 reduce_local -l $foo -u $foo -t i -s $type_size -o $op" + if test $verbose -eq 1 ; then echo $cmd; fi + eval $cmd + done + echo -e "\n\n" + done + echo -e "\n\n" +done +echo "=========Signed Integer type all operations & all sizes========" +echo -e "\n\n" + +echo "=========Unsigned Integer type all operations & all sizes========" +echo "" +for op in max min sum prod band bor bxor; do + echo -e "\n===Operation $op test===" + for type_size in 8 16 32 64; do + for size in 0 1 7 15 31 63 127 130; do + foo=$((1024 * 1024 + $size)) + echo -e "Test $Yellow __mm512 instruction for loop $NC Total_num_bits = $foo * $type_size" + cmd="$mpirun -np 1 reduce_local -l $foo -u $foo -t u -s $type_size -o $op" + if test $verbose -eq 1 ; then echo $cmd; fi + eval $cmd + done + done +done +echo "=========Unsigned Integer type all operations & all sizes========" +echo -e "\n\n" + +echo "=======Float type all operations========" +echo "" +for op in max min sum prod; do + for size in 1024 127 130; do + foo=$((1024 * 1024 + $size)) + echo -e "Test $Yellow __mm512 instruction for loop $NC Total_num_bits = $foo * 32" + cmd="$mpirun -np 1 reduce_local -l $foo -u $foo -t f -s 32 -o $op" + if test $verbose -eq 1 ; then echo $cmd; fi + eval $cmd + done +done + +echo "========Double type all operations=========" +echo "" +for op in max min sum prod; do + for size in 1024 127 130; do + foo=$((1024 * 1024 + $size)) + echo -e "Test $Yellow __mm512 instruction for loop $NC Total_num_bits = $foo * 64" + cmd="$mpirun -np 1 reduce_local -l $foo -u $foo -t d -s 64 -o $op" + if test $verbose -eq 1 ; then echo $cmd; fi + eval $cmd + done +done + diff --git a/test/datatype/reduce_local.c b/test/datatype/reduce_local.c new file mode 100644 index 00000000000..aed0de40106 --- /dev/null +++ b/test/datatype/reduce_local.c @@ -0,0 +1,1425 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2019-2020 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2020 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "mpi.h" +#include "ompi/communicator/communicator.h" +#include "ompi/runtime/mpiruntime.h" +#include "ompi/datatype/ompi_datatype.h" + +typedef struct op_name_s { + char* name; + char* mpi_op_name; + MPI_Op op; +} op_name_t; +static op_name_t array_of_ops [] = { + { "max", "MPI_MAX", MPI_MAX }, + { "min", "MPI_MIN", MPI_MIN }, + { "sum", "MPI_SUM", MPI_SUM }, + { "prod", "MPI_PROD", MPI_PROD }, + { "land", "MPI_LAND", MPI_LAND }, + { "band", "MPI_BAND", MPI_BAND }, + { "lor", "MPI_LOR", MPI_LOR }, + { "bor", "MPI_BOR", MPI_BOR }, + { "lxor", "MPI_LXOR", MPI_LXOR }, + { "bxor", "MPI_BXOR", MPI_BXOR }, + { "replace", "MPI_REPLACE", MPI_REPLACE }, + { NULL, "MPI_OP_NULL", MPI_OP_NULL } +}; +static int do_ops[12] = { -1, }; /* index of the ops to do. Size +1 larger than the array_of_ops */ +static int verbose = 0; +static int total_errors = 0; + +#define max(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) + +#define min(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a < _b ? _a : _b; }) + +static void print_status(char* op, char* type, int type_size, + int count, double duration, + int correct ) +{ + if(correct) { + printf("%-10s %s %-10d%s ", op, type, type_size, (verbose ? " [\033[1;32msuccess\033[0m]" : "")); + } else { + printf("%-10s %s [\033[1;31mfail\033[0m]", op, type); + total_errors++; + } + printf(" count %-10d time %.6f seconds\n", count, duration); +} + +int main(int argc, char **argv) +{ + static void *in_buf = NULL, *inout_buf = NULL, *inout_check_buf = NULL; + int count, type_size = 8, rank, size, provided, correctness = 1; + int repeats = 1, i, c; + double tstart, tend; + bool check = true; + char type[5] = "uifd", *op = "sum", *mpi_type; + int lower = 1, upper = 1000000, skip_op_type; + MPI_Op mpi_op; + + while( -1 != (c = getopt(argc, argv, "l:u:t:o:s:n:vfh")) ) { + switch(c) { + case 'l': + lower = atoi(optarg); + if( lower <= 0 ) { + fprintf(stderr, "The number of elements must be positive\n"); + exit(-1); + } + break; + case 'u': + upper = atoi(optarg); + break; + case 'f': + check = false; + break; + case 'v': + verbose++; + break; + case 'r': + repeats = atoi(optarg); + if( repeats <= 0 ) { + fprintf(stderr, "The number of repetitions (%d) must be positive\n", repeats); + exit(-1); + } + break; + case 't': + for( i = 0; i < (int)strlen(optarg); i++ ) { + if( ! (('i' == optarg[i]) || ('u' == optarg[i]) || + ('f' == optarg[i]) || ('d' == optarg[i])) ) { + fprintf(stderr, "type must be i (signed int), u (unsigned int), f (float) or d (double)\n"); + exit(-1); + } + } + strncpy(type, optarg, 4); + break; + case 'o': + { + if( 0 == strcmp(optarg, "all") ) { + for( i = 0; NULL != array_of_ops[i].name; i++ ) { + do_ops[i] = i; + } + do_ops[i] = -1; /* stop */ + } else { + int n, idx = 0; + char* token, *arg = optarg; + while ((token = strsep(&arg, ",")) != NULL) { + for( i = 0; NULL != array_of_ops[i].name; i++ ) { /* find the op */ + if( 0 == strcmp(array_of_ops[i].name, token) ) { + /* check if the op was not already selected */ + for(n = 0; n < idx; n++ ) { + if( i == do_ops[n] ) { + break; + } + } + if( n >= idx ) { + do_ops[idx++] = i; + do_ops[idx] = -1; + } + break; + } + } + if( NULL == array_of_ops[i].name ) { + fprintf(stderr, "Unknown op %s. Ignored.\n", token); + } + } + } + } + break; + case 's': + type_size = atoi(optarg); + if( ! ((8 == type_size) || (16 == type_size) || (32 == type_size) || (64 == type_size)) ) { + fprintf(stderr, "type_size must be 8, 16, 32 or 64. %d is an invalid value\n", + type_size); + exit(-1); + } + break; + case 'h': + fprintf(stdout, "%s options are:\n" + " -l : lower number of elements\n" + " -u : upper number of elements\n" + " -s : 8, 16, 32 or 64 bits elements\n" + " -t [i,u,f,d] : type of the elements to apply the operations on\n" + " -o : comma separated list of operations to execute among\n" + " sum, min, max, prod, bor, bxor, band\n" + " -h: this help message\n", argv[0]); + exit(0); + } + } + + in_buf = malloc(upper * sizeof(double)); + inout_buf = malloc(upper * sizeof(double)); + inout_check_buf = malloc(upper * sizeof(double)); + + ompi_mpi_init(argc, argv, MPI_THREAD_SERIALIZED, &provided, false); + + rank = ompi_comm_rank(MPI_COMM_WORLD); (void)rank; + size = ompi_comm_size(MPI_COMM_WORLD); (void)size; + + for(uint32_t type_idx = 0; type_idx < strlen(type); type_idx++ ) { + for(uint32_t op_idx = 0; do_ops[op_idx] >= 0; op_idx++ ) { + op = array_of_ops[do_ops[op_idx]].name; + mpi_op = array_of_ops[do_ops[op_idx]].op; + skip_op_type = 1; + + for( count = lower; count <= upper; count += count ) { + mpi_type = NULL; + correctness = 1; + if('i' == type[type_idx]) { + if( 8 == type_size ) { + int8_t *in_int8 = (int8_t*)in_buf, + *inout_int8 = (int8_t*)inout_buf, + *inout_int8_for_check = (int8_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_int8[i] = 5; + inout_int8[i] = inout_int8_for_check[i] = -3; + } + mpi_type = "MPI_INT8_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == (int8_t)(in_int8[i] + inout_int8_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == max(inout_int8_for_check[i], in_int8[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, inout_int8[i], op, in_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_int8, in_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == min(inout_int8_for_check[i], in_int8[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, inout_int8[i], op, in_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == (in_int8[i] | inout_int8_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == (in_int8[i] ^ inout_int8_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == (int8_t)(in_int8[i] * inout_int8_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int8[i] == (in_int8[i] & inout_int8_for_check[i]) ) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 16 == type_size ) { + int16_t *in_int16 = (int16_t*)in_buf, + *inout_int16 = (int16_t*)inout_buf, + *inout_int16_for_check = (int16_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_int16[i] = 5; + inout_int16[i] = inout_int16_for_check[i] = -3; + } + mpi_type = "MPI_INT16_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == (int16_t)(in_int16[i] + inout_int16_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == max(inout_int16_for_check[i], in_int16[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, inout_int16[i], op, in_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_int16, in_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == min(inout_int16_for_check[i],in_int16[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, inout_int16[i], op, in_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == (in_int16[i] | inout_int16_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == (in_int16[i] ^ inout_int16_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == (int16_t)(in_int16[i] * inout_int16_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int16[i] == (in_int16[i] & inout_int16_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 32 == type_size ) { + int32_t *in_int32 = (int32_t*)in_buf, + *inout_int32 = (int32_t*)inout_buf, + *inout_int32_for_check = (int32_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_int32[i] = 5; + inout_int32[i] = inout_int32_for_check[i] = 3; + } + mpi_type = "MPI_INT32_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == (int32_t)(in_int32[i] + inout_int32_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == max(inout_int32_for_check[i], in_int32[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, in_int32[i], op, inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_int32, in_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == min(inout_int32_for_check[i], in_int32[i])) + continue; + printf("First error at position %d (%d != %s(%d))\n", + i, in_int32[i], op, inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == (in_int32[i] | inout_int32_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == (int32_t)(in_int32[i] * inout_int32_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == (in_int32[i] & inout_int32_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int32[i] == (in_int32[i] ^ inout_int32_for_check[i])) + continue; + printf("First error at position %d (%d %s %d != %d)\n", + i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 64 == type_size ) { + int64_t *in_int64 = (int64_t*)in_buf, + *inout_int64 = (int64_t*)inout_buf, + *inout_int64_for_check = (int64_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_int64[i] = 5; + inout_int64[i] = inout_int64_for_check[i] = 3; + } + mpi_type = "MPI_INT64_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == (int64_t)(in_int64[i] + inout_int64_for_check[i])) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == max(inout_int64_for_check[i], in_int64[i])) + continue; + printf("First error at position %d (%lld != %s(%lld))\n", + i, inout_int64[i], op, in_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_int64, in_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == min(inout_int64_for_check[i], in_int64[i])) + continue; + printf("First error at position %d (%lld != %s(%lld))\n", + i, inout_int64[i], op, in_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_int64, in_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == in_int64[i]) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == (in_int64[i] | inout_int64_for_check[i])) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == (in_int64[i] ^ inout_int64_for_check[i])) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64,inout_int64,count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == (int64_t)(in_int64[i] * inout_int64_for_check[i])) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_int64[i] == (in_int64[i] & inout_int64_for_check[i]) ) + continue; + printf("First error at position %d (%lld %s %lld != %lld)\n", + i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + } + + if( 'u' == type[type_idx] ) { + if( 8 == type_size ) { + uint8_t *in_uint8 = (uint8_t*)in_buf, + *inout_uint8 = (uint8_t*)inout_buf, + *inout_uint8_for_check = (uint8_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_uint8[i] = 5; + inout_uint8[i] = inout_uint8_for_check[i] = 121; + } + mpi_type = "MPI_UINT8_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == (uint8_t)(in_uint8[i] + inout_uint8_for_check[i])) + continue; + printf("First error at position %d (%u %s %u [%u] != %u)\n", + i, in_uint8[i], op, inout_uint8_for_check[i], (uint8_t)(in_uint8[i] + inout_uint8_for_check[i]), inout_uint8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == max(inout_uint8_for_check[i], in_uint8[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint8[i], op, inout_uint8_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == min(inout_uint8_for_check[i], in_uint8[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint8[i], op, inout_uint8_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == (in_uint8[i] | inout_uint8_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == (in_uint8[i] ^ inout_uint8_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == (uint8_t)(in_uint8[i] * inout_uint8_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint8[i] == (in_uint8[i] & inout_uint8_for_check[i]) ) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 16 == type_size ) { + uint16_t *in_uint16 = (uint16_t*)in_buf, + *inout_uint16 = (uint16_t*)inout_buf, + *inout_uint16_for_check = (uint16_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_uint16[i] = 5; + inout_uint16[i] = inout_uint16_for_check[i] = 1234; + } + mpi_type = "MPI_UINT16_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == (uint16_t)(in_uint16[i] + inout_uint16_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == max(inout_uint16_for_check[i], in_uint16[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint16[i], op, inout_uint16_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == min(inout_uint16_for_check[i], in_uint16[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint16[i], op, inout_uint16_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == (in_uint16[i] | inout_uint16_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == (in_uint16[i] ^ inout_uint16_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == (uint16_t)(in_uint16[i] * inout_uint16_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint16[i] == (in_uint16[i] & inout_uint16_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 32 == type_size ) { + uint32_t *in_uint32 = (uint32_t*)in_buf, + *inout_uint32 = (uint32_t*)inout_buf, + *inout_uint32_for_check = (uint32_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_uint32[i] = 5; + inout_uint32[i] = inout_uint32_for_check[i] = 3; + } + mpi_type = "MPI_UINT32_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == (uint32_t)(in_uint32[i] + inout_uint32_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == max(inout_uint32_for_check[i], in_uint32[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint32[i], op, inout_uint32_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { // we reverse the send and recv buffers + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_uint32, in_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == min(inout_uint32_for_check[i], in_uint32[i])) + continue; + printf("First error at position %d (%u != %s(%u))\n", + i, inout_uint32[i], op, inout_uint32_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32,inout_uint32,count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == (in_uint32[i] | inout_uint32_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == (uint32_t)(in_uint32[i] * inout_uint32_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == (in_uint32[i] & inout_uint32_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint32[i] == (in_uint32[i] ^ inout_uint32_for_check[i])) + continue; + printf("First error at position %d (%u %s %u != %u)\n", + i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + if( 64 == type_size ) { + int64_t *in_uint64 = (int64_t*)in_buf, + *inout_uint64 = (int64_t*)inout_buf, + *inout_uint64_for_check = (int64_t*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_uint64[i] = 5; + inout_uint64[i] = inout_uint64_for_check[i] = 32433; + } + mpi_type = "MPI_UINT64_T"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( correctness = 1, i = 0; i < count; i++ ) { + if(inout_uint64[i] == (int64_t)(in_uint64[i] + inout_uint64_for_check[i])) + continue; + printf("First error at position %d (%llu %s %llu != %llu)\n", + i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == max(inout_uint64_for_check[i], in_uint64[i])) + continue; + printf("First error at position %d (%llu != %s(%llu))\n", + i, inout_uint64[i], op, inout_uint64_for_check[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == min(inout_uint64_for_check[i], in_uint64[i])) + continue; + printf("First error at position %d (%llu != %s(%llu, %llu))\n", + i, inout_uint64[i], op, inout_uint64_for_check[i], in_uint64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == (in_uint64[i] | inout_uint64_for_check[i])) + continue; + printf("First error at position %d (%llu %s %llu != %llu)\n", + i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "bxor") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == (in_uint64[i] ^ inout_uint64_for_check[i])) + continue; + printf("First error at position %d (%llu %s %llu != %llu)\n", + i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64,inout_uint64,count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == (int64_t)(in_uint64[i] * inout_uint64_for_check[i])) + continue; + printf("First error at position %d (%llu %s %llu != %llu)\n", + i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "band") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_uint64[i] == (in_uint64[i] & inout_uint64_for_check[i]) ) + continue; + printf("First error at position %d (%llu %s %llu != %llu)\n", + i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + } + + if( 'f' == type[type_idx] ) { + float *in_float = (float*)in_buf, + *inout_float = (float*)inout_buf, + *inout_float_for_check = (float*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_float[i] = 1000.0+1; + inout_float[i] = inout_float_for_check[i] = 100.0+2; + } + mpi_type = "MPI_FLOAT"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_float[i] == inout_float_for_check[i]+in_float[i]) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_float[i] == max(inout_float_for_check[i], in_float[i])) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_float,in_float,count, MPI_FLOAT, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_float[i] == min(inout_float_for_check[i], in_float[i])) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_float[i] == in_float[i] * inout_float_for_check[i]) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + + if( 'd' == type[type_idx] ) { + double *in_double = (double*)in_buf, + *inout_double = (double*)inout_buf, + *inout_double_for_check = (double*)inout_check_buf; + for( i = 0; i < count; i++ ) { + in_double[i] = 10.0+1; + inout_double[i] = inout_double_for_check[i] = 1.0+2; + } + mpi_type = "MPI_DOUBLE"; + + if( 0 == strcmp(op, "sum") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_double[i] == inout_double_for_check[i]+in_double[i]) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "max") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_double[i] == max(inout_double_for_check[i], in_double[i])) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "min") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(inout_double, in_double, count, MPI_DOUBLE, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_double[i] == min(inout_double_for_check[i], in_double[i])) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + if( 0 == strcmp(op, "prod") ) { + skip_op_type = 0; + tstart = MPI_Wtime(); + MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); + tend = MPI_Wtime(); + if( check ) { + for( i = 0; i < count; i++ ) { + if(inout_double[i] == inout_double_for_check[i]*in_double[i]) + continue; + printf("First error at position %d\n", i); + correctness = 0; + break; + } + } + goto check_and_continue; + } + } + check_and_continue: + if( !skip_op_type ) + print_status(array_of_ops[do_ops[op_idx]].mpi_op_name, + mpi_type, type_size, count, tend-tstart, correctness); + } + if( !skip_op_type ) + printf("\n"); + } + } + ompi_mpi_finalize(); + + free(in_buf); + free(inout_buf); + free(inout_check_buf); + + return (0 == total_errors) ? 0 : -1; +} + From c018337d030a29e620263e0520fd0a71e146f796 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Wed, 1 Jul 2020 21:46:56 +0000 Subject: [PATCH 665/674] v4.1.x: common/ofi: added address format check to fix provider selection bugfix: provider selection would not differentiate between ipv4 and ipv6 addresses which would cause some nodes to be unable to communicate between each other. Adding a check for address format to provider selection to ensure that all nodes use the same address format. Signed-off-by: Nikola Dancejic (cherry picked from commit 7e463713014ae58f7e78d7a5b49e9e63d62e374e) --- opal/mca/common/ofi/common_ofi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index 08e9f77c258..e0b5c04dd65 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -172,7 +172,8 @@ check_provider_attr(struct fi_info *provider_info, !check_rx_attr(provider_info->rx_attr, provider->rx_attr) && !check_ep_attr(provider_info->ep_attr, provider->ep_attr) && !(provider_info->caps & ~(provider->caps)) && - !(provider_info->mode & ~(provider->mode))) { + !(provider_info->mode & ~(provider->mode)) && + provider_info->addr_format == provider->addr_format) { return 0; } else { return OPAL_ERROR; From 229724799e51029d479b792a47be499cb2ff8ac5 Mon Sep 17 00:00:00 2001 From: tomhers Date: Mon, 6 Jul 2020 16:22:49 -0400 Subject: [PATCH 666/674] BTL/OFI: Fix missing include file. The missing include file causes an error when using an external version of LibEvent. Signed-off-by: tomhers (cherry picked from commit 88f9d2c90f1730f2e0b5bc4951893f60ff5a1332) --- opal/mca/btl/ofi/btl_ofi_component.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index 470f0d76ac6..f99db0a2d07 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -27,6 +27,9 @@ #include "opal_config.h" +#include "opal/util/printf.h" +#include "opal/util/argv.h" + #include "opal/mca/btl/btl.h" #include "opal/mca/btl/base/base.h" #include "opal/mca/hwloc/base/base.h" From 390772023aaa4a7d5189b6a46d5ae033a6d53332 Mon Sep 17 00:00:00 2001 From: Geoffrey Paulsen Date: Wed, 15 Jul 2020 18:07:46 -0500 Subject: [PATCH 667/674] Adding SLURM binding policy change to README Signed-off-by: Geoffrey Paulsen --- README | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README b/README index 8413717394b..1b63c3cfbef 100644 --- a/README +++ b/README @@ -2045,6 +2045,9 @@ srun: shell$ srun -N 2 hello_world_oshmem + NOTE: Starting with Open MPI v4.0.5, libmpi will honor SLURM's binding + policy even if that would leave the processes unbound. + =========================================================================== The Modular Component Architecture (MCA) From 3d08d790e91f9e6ff28f70432f7c03029f55475e Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Thu, 16 Jul 2020 17:06:35 +0200 Subject: [PATCH 668/674] osc/rdma: fail query_btls if no endpoint for non-local peer is found Signed-off-by: Joseph Schuchart (cherry picked from commit eebc451ec8313975998a63e25938fb4e0b4d6c44) --- ompi/mca/osc/rdma/osc_rdma_component.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/ompi/mca/osc/rdma/osc_rdma_component.c b/ompi/mca/osc/rdma/osc_rdma_component.c index 31838b9f757..e42dd76e28b 100644 --- a/ompi/mca/osc/rdma/osc_rdma_component.c +++ b/ompi/mca/osc/rdma/osc_rdma_component.c @@ -803,6 +803,7 @@ static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, struct mca_btl_b { struct mca_btl_base_module_t **possible_btls = NULL; int comm_size = ompi_comm_size (comm); + int comm_rank = ompi_comm_rank (comm); int rc = OMPI_SUCCESS, max_btls = 0; unsigned int selected_latency = INT_MAX; struct mca_btl_base_module_t *selected_btl = NULL; @@ -842,10 +843,11 @@ static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, struct mca_btl_b return OMPI_SUCCESS; } - for (int i = 0 ; i < comm_size ; ++i) { - ompi_proc_t *proc = ompi_comm_peer_lookup (comm, i); + for (int rank = 0 ; rank < comm_size ; ++rank) { + ompi_proc_t *proc = ompi_comm_peer_lookup (comm, rank); mca_bml_base_endpoint_t *endpoint; int num_btls, prev_max; + bool found_btl = false; endpoint = mca_bml_base_get_endpoint (proc); if (NULL == endpoint) { @@ -891,23 +893,30 @@ static int ompi_osc_rdma_query_btls (ompi_communicator_t *comm, struct mca_btl_b for (int j = 0 ; j < max_btls ; ++j) { if (endpoint->btl_rdma.bml_btls[i_btl].btl == possible_btls[j]) { ++btl_counts[j]; + found_btl = true; break; } else if (NULL == possible_btls[j]) { possible_btls[j] = endpoint->btl_rdma.bml_btls[i_btl].btl; btl_counts[j] = 1; + found_btl = true; break; } } } } + + /* any non-local rank must have a usable btl */ + if (!found_btl && comm_rank == rank) { + /* no btl = no rdma/atomics */ + rc = OMPI_ERR_UNREACH; + break; + } } if (OMPI_SUCCESS != rc) { free (possible_btls); free (btl_counts); - - /* no btl = no rdma/atomics */ - return OMPI_ERR_NOT_AVAILABLE; + return rc; } for (int i = 0 ; i < max_btls ; ++i) { From e0bd64f843b47751d069222c06cb622a5b37a801 Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Tue, 21 Jul 2020 19:41:37 +0200 Subject: [PATCH 669/674] Fix memory leak in configure, which prevents leak sanitizer usage If building Open MPI with sanitizers, e.g $ configure CC=clang CFLAGS=-fsanitize=address .... configure test programs are also build with the sanitizers and will report errors resulting in configure to fail. Signed-off-by: Christoph Niethammer --- config/c_get_alignment.m4 | 1 + 1 file changed, 1 insertion(+) diff --git a/config/c_get_alignment.m4 b/config/c_get_alignment.m4 index 4ec7bf7c1b3..a300cc3d1a3 100644 --- a/config/c_get_alignment.m4 +++ b/config/c_get_alignment.m4 @@ -44,6 +44,7 @@ AC_DEFUN([OPAL_C_GET_ALIGNMENT],[ FILE *f=fopen("conftestval", "w"); if (!f) exit(1); diff = ((char *)&p->x) - ((char *)&p->c); + free(p); fprintf(f, "%d\n", (diff >= 0) ? diff : -diff); ]])], [AS_TR_SH([opal_cv_c_align_$1])=`cat conftestval`], [AC_MSG_WARN([*** Problem running configure test!]) From 5a13c5352f5aa054fcc0222d5db66791602a6231 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Wed, 13 May 2020 14:03:18 -0700 Subject: [PATCH 670/674] coll/tuned: Change the default collective algorithm selection The default algorithm selections were out of date and not performing well. After gathering data from OMPI developers, new default algorithm decisions were selected for: allgather allgatherv allreduce alltoall alltoallv barrier bcast gather reduce reduce_scatter_block reduce_scatter scatter These results were gathered using the ompi-collectives-tuning package and then averaged amongst the results gathered from multiple OMPI developers on their clusters. You can access the graphs and averaged data here: https://drive.google.com/drive/folders/1MV5E9gN-5tootoWoh62aoXmN0jiWiqh3 Signed-off-by: William Zhang (cherry picked from commit ce40cfbaa53406be71319041e13e893b0def7ad9) --- .../coll/tuned/coll_tuned_decision_fixed.c | 1906 ++++++++++++----- 1 file changed, 1412 insertions(+), 494 deletions(-) diff --git a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c index b3699ed2736..d06f3ea19fe 100644 --- a/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c +++ b/ompi/mca/coll/tuned/coll_tuned_decision_fixed.c @@ -16,6 +16,8 @@ * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2019 Mellanox Technologies. All rights reserved. + * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. + * All Rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -34,6 +36,14 @@ #include "ompi/op/op.h" #include "coll_tuned.h" +/* + * The new default fixed decision functions were generated based off of + * results that were gathered using the ompi-collectives-tuning package. + * These results were submitted by multiple OMPI developers on their clusters + * and were subsequently averaged to generate the algorithm switch points + * seen below. + */ + /* * allreduce_intra * @@ -48,48 +58,199 @@ ompi_coll_tuned_allreduce_intra_dec_fixed(const void *sbuf, void *rbuf, int coun struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - size_t dsize, block_dsize; - int comm_size = ompi_comm_size(comm); - const size_t intermediate_message = 10000; + size_t dsize, total_dsize; + int communicator_size, alg; + communicator_size = ompi_comm_size(comm); OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allreduce_intra_dec_fixed")); - /** - * Decision function based on MX results from the Grig cluster at UTK. + ompi_datatype_type_size(dtype, &dsize); + total_dsize = dsize * (ptrdiff_t)count; + + /** Algorithms: + * {1, "basic_linear"}, + * {2, "nonoverlapping"}, + * {3, "recursive_doubling"}, + * {4, "ring"}, + * {5, "segmented_ring"}, + * {6, "rabenseifner" * - * Currently, linear, recursive doubling, and nonoverlapping algorithms - * can handle both commutative and non-commutative operations. - * Ring algorithm does not support non-commutative operations. + * Currently, ring, segmented ring, and rabenseifner do not support + * non-commutative operations. */ - ompi_datatype_type_size(dtype, &dsize); - block_dsize = dsize * (ptrdiff_t)count; - - if (block_dsize < intermediate_message) { - return (ompi_coll_base_allreduce_intra_recursivedoubling(sbuf, rbuf, - count, dtype, - op, comm, module)); - } - - if( ompi_op_is_commute(op) && (count > comm_size) ) { - const size_t segment_size = 1 << 20; /* 1 MB */ - if (((size_t)comm_size * (size_t)segment_size >= block_dsize)) { - return (ompi_coll_base_allreduce_intra_ring(sbuf, rbuf, count, dtype, - op, comm, module)); + if( !ompi_op_is_commute(op) ) { + if (communicator_size < 4) { + if (total_dsize < 131072) { + alg = 3; + } else { + alg = 1; + } + } else if (communicator_size < 8) { + alg = 3; + } else if (communicator_size < 16) { + if (total_dsize < 1048576) { + alg = 3; + } else { + alg = 2; + } + } else if (communicator_size < 32) { + alg = 3; + } else if (communicator_size < 64) { + if (total_dsize < 131072) { + alg = 1; + } else { + alg = 3; + } + } else if (communicator_size < 128) { + if (total_dsize < 128) { + alg = 1; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 1; + } else { + alg = 3; + } + } else if (communicator_size < 256) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 16384) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 2; + } else if (total_dsize < 524288) { + alg = 3; + } else { + alg = 2; + } + } else if (communicator_size < 512) { + if (total_dsize < 4096) { + alg = 2; + } else if (total_dsize < 524288) { + alg = 3; + } else { + alg = 2; + } + } else { + if (total_dsize < 2048) { + alg = 2; + } else { + alg = 3; + } + } + } else { + if (communicator_size < 4) { + if (total_dsize < 8) { + alg = 4; + } else if (total_dsize < 4096) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 16384) { + alg = 3; + } else if (total_dsize < 65536) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 5; + } else { + alg = 6; + } + } else if (communicator_size < 8) { + if (total_dsize < 16) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 16) { + if (total_dsize < 8192) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 32) { + if (total_dsize < 64) { + alg = 5; + } else if (total_dsize < 4096) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 64) { + if (total_dsize < 128) { + alg = 5; + } else { + alg = 6; + } + } else if (communicator_size < 128) { + if (total_dsize < 128) { + alg = 1; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 1; + } else if (total_dsize < 262144) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 256) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 16384) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 2; + } else if (total_dsize < 262144) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 512) { + if (total_dsize < 4096) { + alg = 2; + } else { + alg = 6; + } + } else if (communicator_size < 2048) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 16384) { + alg = 3; + } else { + alg = 6; + } + } else if (communicator_size < 4096) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 5; + } else if (total_dsize < 16384) { + alg = 3; + } else { + alg = 6; + } } else { - return (ompi_coll_base_allreduce_intra_ring_segmented(sbuf, rbuf, - count, dtype, - op, comm, module, - segment_size)); + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 16384) { + alg = 5; + } else if (total_dsize < 32768) { + alg = 3; + } else { + alg = 6; + } } } - return (ompi_coll_base_allreduce_intra_nonoverlapping(sbuf, rbuf, count, - dtype, op, comm, module)); + return ompi_coll_tuned_allreduce_intra_do_this (sbuf, rbuf, count, dtype, op, + comm, module, alg, 0, 0); } /* * alltoall_intra_dec * - * Function: - seletects alltoall algorithm to use + * Function: - selects alltoall algorithm to use * Accepts: - same arguments as MPI_Alltoall() * Returns: - MPI_SUCCESS or error code */ @@ -101,72 +262,182 @@ int ompi_coll_tuned_alltoall_intra_dec_fixed(const void *sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int communicator_size; - size_t dsize, block_dsize; -#if 0 - size_t total_dsize; -#endif + int communicator_size, alg; + size_t dsize, total_dsize; communicator_size = ompi_comm_size(comm); - - /* special case */ - if (communicator_size==2) { - return ompi_coll_base_alltoall_intra_two_procs(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } - - /* Decision function based on measurement on Grig cluster at - the University of Tennessee (2GB MX) up to 64 nodes. - Has better performance for messages of intermediate sizes than the old one */ - /* determine block size */ if (MPI_IN_PLACE != sbuf) { ompi_datatype_type_size(sdtype, &dsize); } else { ompi_datatype_type_size(rdtype, &dsize); } - block_dsize = dsize * (ptrdiff_t)scount; - - if ((block_dsize < (size_t) ompi_coll_tuned_alltoall_small_msg) - && (communicator_size > 12)) { - return ompi_coll_base_alltoall_intra_bruck(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - - } else if (block_dsize < (size_t) ompi_coll_tuned_alltoall_intermediate_msg) { - return ompi_coll_base_alltoall_intra_basic_linear(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } else if ((block_dsize < (size_t) ompi_coll_tuned_alltoall_large_msg) && - (communicator_size <= ompi_coll_tuned_alltoall_min_procs)) { - return ompi_coll_base_alltoall_intra_linear_sync(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module, - ompi_coll_tuned_alltoall_max_requests); + total_dsize = dsize * (ptrdiff_t)scount; + + /** Algorithms: + * {1, "linear"}, + * {2, "pairwise"}, + * {3, "modified_bruck"}, + * {4, "linear_sync"}, + * {5, "two_proc"}, + */ + if (communicator_size == 2) { + if (total_dsize < 2) { + alg = 2; + } else if (total_dsize < 4) { + alg = 5; + } else if (total_dsize < 16) { + alg = 2; + } else if (total_dsize < 64) { + alg = 5; + } else if (total_dsize < 256) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 5; + } else if (total_dsize < 32768) { + alg = 2; + } else if (total_dsize < 262144) { + alg = 4; + } else if (total_dsize < 1048576) { + alg = 5; + } else { + alg = 2; + } + } else if (communicator_size < 8) { + if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 16384) { + alg = 1; + } else if (total_dsize < 65536) { + alg = 4; + } else if (total_dsize < 524288) { + alg = 1; + } else if (total_dsize < 1048576) { + alg = 2; + } else { + alg = 1; + } + } else if (communicator_size < 16) { + if (total_dsize < 262144) { + alg = 4; + } else { + alg = 1; + } + } else if (communicator_size < 32) { + if (total_dsize < 4) { + alg = 4; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 32768) { + alg = 1; + } else if (total_dsize < 262144) { + alg = 4; + } else if (total_dsize < 524288) { + alg = 1; + } else { + alg = 4; + } + } else if (communicator_size < 64) { + if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 524288) { + alg = 1; + } else { + alg = 4; + } + } else if (communicator_size < 128) { + if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 2048) { + alg = 1; + } else if (total_dsize < 4096) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 256) { + if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 2048) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 512) { + if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 32768) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 1024) { + if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 16384) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 2048) { + if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 1024) { + alg = 4; + } else if (total_dsize < 2048) { + alg = 1; + } else if (total_dsize < 16384) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 4; + } + } else if (communicator_size < 4096) { + if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 4096) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 4; + } else { + alg = 1; + } + } else { + if (total_dsize < 2048) { + alg = 3; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 16384) { + alg = 1; + } else if (total_dsize < 32768) { + alg = 4; + } else if (total_dsize < 65536) { + alg = 1; + } else { + alg = 4; + } } - return ompi_coll_base_alltoall_intra_pairwise(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - -#if 0 - /* previous decision */ - - /* else we need data size for decision function */ - ompi_datatype_type_size(sdtype, &dsize); - total_dsize = dsize * scount * communicator_size; /* needed for decision */ - - OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoall_intra_dec_fixed rank %d com_size %d msg_length %ld", - ompi_comm_rank(comm), communicator_size, total_dsize)); - - if (communicator_size >= 12 && total_dsize <= 768) { - return ompi_coll_base_alltoall_intra_bruck(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module); - } - if (total_dsize <= 131072) { - return ompi_coll_base_alltoall_intra_basic_linear(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module); - } - return ompi_coll_base_alltoall_intra_pairwise(sbuf, scount, sdtype, rbuf, rcount, rdtype, comm, module); -#endif + return ompi_coll_tuned_alltoall_intra_do_this (sbuf, scount, sdtype, + rbuf, rcount, rdtype, + comm, module, + alg, 0, 0, ompi_coll_tuned_alltoall_max_requests); } /* @@ -181,53 +452,90 @@ int ompi_coll_tuned_alltoallv_intra_dec_fixed(const void *sbuf, const int *scoun struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - /* For starters, just keep the original algorithm. */ - return ompi_coll_base_alltoallv_intra_pairwise(sbuf, scounts, sdisps, sdtype, - rbuf, rcounts, rdisps,rdtype, - comm, module); + int communicator_size, alg; + communicator_size = ompi_comm_size(comm); + + OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_alltoallv_intra_dec_fixed com_size %d", + communicator_size)); + /** Algorithms: + * {1, "basic_linear"}, + * {2, "pairwise"}, + * + * We can only optimize based on com size + */ + if (communicator_size < 4) { + alg = 2; + } else if (communicator_size < 64) { + alg = 1; + } else if (communicator_size < 128) { + alg = 2; + } else if (communicator_size < 256) { + alg = 1; + } else if (communicator_size < 1024) { + alg = 2; + } else { + alg = 1; + } + + return ompi_coll_tuned_alltoallv_intra_do_this (sbuf, scounts, sdisps, sdtype, + rbuf, rcounts, rdisps, rdtype, + comm, module, + alg); } /* * barrier_intra_dec * - * Function: - seletects barrier algorithm to use + * Function: - selects barrier algorithm to use * Accepts: - same arguments as MPI_Barrier() * Returns: - MPI_SUCCESS or error code (passed from the barrier implementation) */ int ompi_coll_tuned_barrier_intra_dec_fixed(struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int communicator_size = ompi_comm_size(comm); + int communicator_size, alg; + communicator_size = ompi_comm_size(comm); OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_barrier_intra_dec_fixed com_size %d", communicator_size)); - - if( 2 == communicator_size ) - return ompi_coll_base_barrier_intra_two_procs(comm, module); - /** - * Basic optimisation. If we have a power of 2 number of nodes - * the use the recursive doubling algorithm, otherwise - * bruck is the one we want. + /** Algorithms: + * {1, "linear"}, + * {2, "double_ring"}, + * {3, "recursive_doubling"}, + * {4, "bruck"}, + * {5, "two_proc"}, + * {6, "tree"}, + * + * We can only optimize based on com size */ - { - bool has_one = false; - for( ; communicator_size > 0; communicator_size >>= 1 ) { - if( communicator_size & 0x1 ) { - if( has_one ) - return ompi_coll_base_barrier_intra_bruck(comm, module); - has_one = true; - } - } + if (communicator_size < 4) { + alg = 3; + } else if (communicator_size < 8) { + alg = 1; + } else if (communicator_size < 64) { + alg = 3; + } else if (communicator_size < 256) { + alg = 4; + } else if (communicator_size < 512) { + alg = 6; + } else if (communicator_size < 1024) { + alg = 4; + } else if (communicator_size < 4096) { + alg = 6; + } else { + alg = 4; } - return ompi_coll_base_barrier_intra_recursivedoubling(comm, module); + + return ompi_coll_tuned_barrier_intra_do_this (comm, module, + alg, 0, 0); } /* * bcast_intra_dec * - * Function: - seletects broadcast algorithm to use + * Function: - selects broadcast algorithm to use * Accepts: - same arguments as MPI_Bcast() * Returns: - MPI_SUCCESS or error code (passed from the bcast implementation) */ @@ -236,117 +544,153 @@ int ompi_coll_tuned_bcast_intra_dec_fixed(void *buff, int count, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - /* Decision function based on MX results for - messages up to 36MB and communicator sizes up to 64 nodes */ - const size_t small_message_size = 2048; - const size_t intermediate_message_size = 370728; - const double a_p16 = 3.2118e-6; /* [1 / byte] */ - const double b_p16 = 8.7936; - const double a_p64 = 2.3679e-6; /* [1 / byte] */ - const double b_p64 = 1.1787; - const double a_p128 = 1.6134e-6; /* [1 / byte] */ - const double b_p128 = 2.1102; - - int communicator_size; - int segsize = 0; - size_t message_size, dsize; - - communicator_size = ompi_comm_size(comm); + size_t total_dsize, dsize; + int communicator_size, alg; + communicator_size = ompi_comm_size(comm); - /* else we need data size for decision function */ ompi_datatype_type_size(datatype, &dsize); - message_size = dsize * (unsigned long)count; /* needed for decision */ + total_dsize = dsize * (unsigned long)count; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_bcast_intra_dec_fixed" - " root %d rank %d com_size %d msg_length %lu", - root, ompi_comm_rank(comm), communicator_size, (unsigned long)message_size)); - - /* Handle messages of small and intermediate size, and - single-element broadcasts */ - if ((message_size < small_message_size) || (count <= 1)) { - /* Binomial without segmentation */ - segsize = 0; - return ompi_coll_base_bcast_intra_binomial(buff, count, datatype, - root, comm, module, - segsize); - - } else if (message_size < intermediate_message_size) { - /* SplittedBinary with 1KB segments */ - segsize = 1024; - return ompi_coll_base_bcast_intra_split_bintree(buff, count, datatype, - root, comm, module, - segsize); - - } - /* Handle large message sizes */ - else if (communicator_size < (a_p128 * message_size + b_p128)) { - /* Pipeline with 128KB segments */ - segsize = 1024 << 7; - return ompi_coll_base_bcast_intra_pipeline(buff, count, datatype, - root, comm, module, - segsize); - - } else if (communicator_size < 13) { - /* Split Binary with 8KB segments */ - segsize = 1024 << 3; - return ompi_coll_base_bcast_intra_split_bintree(buff, count, datatype, - root, comm, module, - segsize); - - } else if (communicator_size < (a_p64 * message_size + b_p64)) { - /* Pipeline with 64KB segments */ - segsize = 1024 << 6; - return ompi_coll_base_bcast_intra_pipeline(buff, count, datatype, - root, comm, module, - segsize); - - } else if (communicator_size < (a_p16 * message_size + b_p16)) { - /* Pipeline with 16KB segments */ - segsize = 1024 << 4; - return ompi_coll_base_bcast_intra_pipeline(buff, count, datatype, - root, comm, module, - segsize); - + " root %d rank %d com_size %d", + root, ompi_comm_rank(comm), communicator_size)); + + /** Algorithms: + * {1, "basic_linear"}, + * {2, "chain"}, + * {3, "pipeline"}, + * {4, "split_binary_tree"}, + * {5, "binary_tree"}, + * {6, "binomial"}, + * {7, "knomial"}, + * {8, "scatter_allgather"}, + * {9, "scatter_allgather_ring"}, + */ + if (communicator_size < 4) { + if (total_dsize < 2) { + alg = 9; + } else if (total_dsize < 32) { + alg = 3; + } else if (total_dsize < 256) { + alg = 5; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 1024) { + alg = 7; + } else if (total_dsize < 32768) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 5; + } else if (total_dsize < 262144) { + alg = 2; + } else if (total_dsize < 524288) { + alg = 1; + } else if (total_dsize < 1048576) { + alg = 6; + } else { + alg = 5; + } + } else if (communicator_size < 8) { + if (total_dsize < 2) { + alg = 8; + } else if (total_dsize < 64) { + alg = 5; + } else if (total_dsize < 128) { + alg = 6; + } else if (total_dsize < 2048) { + alg = 5; + } else if (total_dsize < 8192) { + alg = 6; + } else if (total_dsize < 1048576) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 16) { + if (total_dsize < 8) { + alg = 7; + } else if (total_dsize < 64) { + alg = 5; + } else if (total_dsize < 4096) { + alg = 7; + } else if (total_dsize < 16384) { + alg = 5; + } else if (total_dsize < 32768) { + alg = 6; + } else { + alg = 1; + } + } else if (communicator_size < 32) { + if (total_dsize < 4096) { + alg = 7; + } else if (total_dsize < 1048576) { + alg = 6; + } else { + alg = 8; + } + } else if (communicator_size < 64) { + if (total_dsize < 2048) { + alg = 6; + } else { + alg = 7; + } + } else if (communicator_size < 128) { + alg = 7; + } else if (communicator_size < 256) { + if (total_dsize < 2) { + alg = 6; + } else if (total_dsize < 128) { + alg = 8; + } else if (total_dsize < 16384) { + alg = 5; + } else if (total_dsize < 32768) { + alg = 1; + } else if (total_dsize < 65536) { + alg = 5; + } else { + alg = 7; + } + } else if (communicator_size < 1024) { + if (total_dsize < 16384) { + alg = 7; + } else if (total_dsize < 32768) { + alg = 4; + } else { + alg = 7; + } + } else if (communicator_size < 2048) { + if (total_dsize < 524288) { + alg = 7; + } else { + alg = 8; + } + } else if (communicator_size < 4096) { + if (total_dsize < 262144) { + alg = 7; + } else { + alg = 8; + } + } else { + if (total_dsize < 8192) { + alg = 7; + } else if (total_dsize < 16384) { + alg = 5; + } else if (total_dsize < 262144) { + alg = 7; + } else { + alg = 8; + } } - /* Pipeline with 8KB segments */ - segsize = 1024 << 3; - return ompi_coll_base_bcast_intra_pipeline(buff, count, datatype, - root, comm, module, - segsize); -#if 0 - /* this is based on gige measurements */ - - if (communicator_size < 4) { - return ompi_coll_base_bcast_intra_basic_linear(buff, count, datatype, root, comm, module); - } - if (communicator_size == 4) { - if (message_size < 524288) segsize = 0; - else segsize = 16384; - return ompi_coll_base_bcast_intra_bintree(buff, count, datatype, root, comm, module, segsize); - } - if (communicator_size <= 8 && message_size < 4096) { - return ompi_coll_base_bcast_intra_basic_linear(buff, count, datatype, root, comm, module); - } - if (communicator_size > 8 && message_size >= 32768 && message_size < 524288) { - segsize = 16384; - return ompi_coll_base_bcast_intra_bintree(buff, count, datatype, root, comm, module, segsize); - } - if (message_size >= 524288) { - segsize = 16384; - return ompi_coll_base_bcast_intra_pipeline(buff, count, datatype, root, comm, module, segsize); - } - segsize = 0; - /* once tested can swap this back in */ - /* return ompi_coll_base_bcast_intra_bmtree(buff, count, datatype, root, comm, segsize); */ - return ompi_coll_base_bcast_intra_bintree(buff, count, datatype, root, comm, module, segsize); -#endif /* 0 */ + return ompi_coll_tuned_bcast_intra_do_this (buff, count, datatype, root, + comm, module, + alg, 0, 0); } /* * reduce_intra_dec * - * Function: - seletects reduce algorithm to use + * Function: - selects reduce algorithm to use * Accepts: - same arguments as MPI_reduce() * Returns: - MPI_SUCCESS or error code (passed from the reduce implementation) * @@ -357,108 +701,158 @@ int ompi_coll_tuned_reduce_intra_dec_fixed( const void *sendbuf, void *recvbuf, struct ompi_communicator_t* comm, mca_coll_base_module_t *module) { - int communicator_size, segsize = 0; - size_t message_size, dsize; - const double a1 = 0.6016 / 1024.0; /* [1/B] */ - const double b1 = 1.3496; - const double a2 = 0.0410 / 1024.0; /* [1/B] */ - const double b2 = 9.7128; - const double a3 = 0.0422 / 1024.0; /* [1/B] */ - const double b3 = 1.1614; - const double a4 = 0.0033 / 1024.0; /* [1/B] */ - const double b4 = 1.6761; - - const int max_requests = 0; /* no limit on # of outstanding requests */ + int communicator_size, alg; + size_t total_dsize, dsize; communicator_size = ompi_comm_size(comm); - /* need data size for decision function */ - ompi_datatype_type_size(datatype, &dsize); - message_size = dsize * (ptrdiff_t)count; /* needed for decision */ + OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_intra_dec_fixed " + "root %d rank %d com_size %d", root, ompi_comm_rank(comm), communicator_size)); - /** - * If the operation is non commutative we currently have choice of linear - * or in-order binary tree algorithm. + ompi_datatype_type_size(datatype, &dsize); + total_dsize = dsize * (ptrdiff_t)count; /* needed for decision */ + + /** Algorithms: + * {1, "linear"}, + * {2, "chain"}, + * {3, "pipeline"}, + * {4, "binary"}, + * {5, "binomial"}, + * {6, "in-order_binary"}, + * {7, "rabenseifner"}, + * + * Currently, only linear and in-order binary tree algorithms are + * capable of non commutative ops. */ if( !ompi_op_is_commute(op) ) { - if ((communicator_size < 12) && (message_size < 2048)) { - return ompi_coll_base_reduce_intra_basic_linear (sendbuf, recvbuf, count, datatype, op, root, comm, module); + if (communicator_size < 4) { + if (total_dsize < 8) { + alg = 6; + } else { + alg = 1; + } + } else if (communicator_size < 8) { + alg = 1; + } else if (communicator_size < 16) { + if (total_dsize < 1024) { + alg = 6; + } else if (total_dsize < 8192) { + alg = 1; + } else if (total_dsize < 16384) { + alg = 6; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 6; + } + } else if (communicator_size < 128) { + alg = 6; + } else if (communicator_size < 256) { + if (total_dsize < 512) { + alg = 6; + } else if (total_dsize < 1024) { + alg = 1; + } else { + alg = 6; + } + } else { + alg = 6; } - return ompi_coll_base_reduce_intra_in_order_binary (sendbuf, recvbuf, count, datatype, op, root, comm, module, - 0, max_requests); - } - - OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_intra_dec_fixed " - "root %d rank %d com_size %d msg_length %lu", - root, ompi_comm_rank(comm), communicator_size, (unsigned long)message_size)); - - if ((communicator_size < 8) && (message_size < 512)){ - /* Linear_0K */ - return ompi_coll_base_reduce_intra_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm, module); - } else if (((communicator_size < 8) && (message_size < 20480)) || - (message_size < 2048) || (count <= 1)) { - /* Binomial_0K */ - segsize = 0; - return ompi_coll_base_reduce_intra_binomial(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, max_requests); - } else if (communicator_size > (a1 * message_size + b1)) { - /* Binomial_1K */ - segsize = 1024; - return ompi_coll_base_reduce_intra_binomial(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, max_requests); - } else if (communicator_size > (a2 * message_size + b2)) { - /* Pipeline_1K */ - segsize = 1024; - return ompi_coll_base_reduce_intra_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, max_requests); - } else if (communicator_size > (a3 * message_size + b3)) { - /* Binary_32K */ - segsize = 32*1024; - return ompi_coll_base_reduce_intra_binary( sendbuf, recvbuf, count, datatype, op, root, - comm, module, segsize, max_requests); - } - if (communicator_size > (a4 * message_size + b4)) { - /* Pipeline_32K */ - segsize = 32*1024; } else { - /* Pipeline_64K */ - segsize = 64*1024; - } - return ompi_coll_base_reduce_intra_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, max_requests); - -#if 0 - /* for small messages use linear algorithm */ - if (message_size <= 4096) { - segsize = 0; - fanout = communicator_size - 1; - /* when linear implemented or taken from basic put here, right now using chain as a linear system */ - /* it is implemented and I shouldn't be calling a chain with a fanout bigger than MAXTREEFANOUT from topo.h! */ - return ompi_coll_base_reduce_intra_basic_linear(sendbuf, recvbuf, count, datatype, op, root, comm, module); - } - if (message_size < 524288) { - if (message_size <= 65536 ) { - segsize = 32768; - fanout = 8; - } else { - segsize = 1024; - fanout = communicator_size/2; - } - /* later swap this for a binary tree */ - /* fanout = 2; */ - return ompi_coll_base_reduce_intra_chain(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, fanout, max_requests); + if (communicator_size < 4) { + if (total_dsize < 8) { + alg = 7; + } else if (total_dsize < 16) { + alg = 4; + } else if (total_dsize < 32) { + alg = 3; + } else if (total_dsize < 262144) { + alg = 1; + } else if (total_dsize < 524288) { + alg = 3; + } else if (total_dsize < 1048576) { + alg = 2; + } else { + alg = 3; + } + } else if (communicator_size < 8) { + if (total_dsize < 4096) { + alg = 4; + } else if (total_dsize < 65536) { + alg = 2; + } else if (total_dsize < 262144) { + alg = 5; + } else if (total_dsize < 524288) { + alg = 1; + } else if (total_dsize < 1048576) { + alg = 5; + } else { + alg = 1; + } + } else if (communicator_size < 16) { + if (total_dsize < 8192) { + alg = 4; + } else { + alg = 5; + } + } else if (communicator_size < 32) { + if (total_dsize < 4096) { + alg = 4; + } else { + alg = 5; + } + } else if (communicator_size < 256) { + alg = 5; + } else if (communicator_size < 512) { + if (total_dsize < 8192) { + alg = 5; + } else if (total_dsize < 16384) { + alg = 6; + } else { + alg = 5; + } + } else if (communicator_size < 2048) { + alg = 5; + } else if (communicator_size < 4096) { + if (total_dsize < 512) { + alg = 5; + } else if (total_dsize < 1024) { + alg = 6; + } else if (total_dsize < 8192) { + alg = 5; + } else if (total_dsize < 16384) { + alg = 6; + } else { + alg = 5; + } + } else { + if (total_dsize < 16) { + alg = 5; + } else if (total_dsize < 32) { + alg = 6; + } else if (total_dsize < 1024) { + alg = 5; + } else if (total_dsize < 2048) { + alg = 6; + } else if (total_dsize < 8192) { + alg = 5; + } else if (total_dsize < 16384) { + alg = 6; + } else { + alg = 5; + } + } } - segsize = 1024; - return ompi_coll_base_reduce_intra_pipeline(sendbuf, recvbuf, count, datatype, op, root, comm, module, - segsize, max_requests); -#endif /* 0 */ + + return ompi_coll_tuned_reduce_intra_do_this (sendbuf, recvbuf, count, datatype, + op, root, comm, module, + alg, 0, 0, 0); } /* * reduce_scatter_intra_dec * - * Function: - seletects reduce_scatter algorithm to use + * Function: - selects reduce_scatter algorithm to use * Accepts: - same arguments as MPI_Reduce_scatter() * Returns: - MPI_SUCCESS or error code (passed from * the reduce scatter implementation) @@ -470,51 +864,196 @@ int ompi_coll_tuned_reduce_scatter_intra_dec_fixed( const void *sbuf, void *rbuf struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int comm_size, i, pow2; - size_t total_message_size, dsize; - const double a = 0.0012; - const double b = 8.0; - const size_t small_message_size = 12 * 1024; - const size_t large_message_size = 256 * 1024; + int communicator_size, i, alg; + size_t total_dsize, dsize; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_scatter_intra_dec_fixed")); - comm_size = ompi_comm_size(comm); - /* We need data size for decision function */ + communicator_size = ompi_comm_size(comm); ompi_datatype_type_size(dtype, &dsize); - total_message_size = 0; - for (i = 0; i < comm_size; i++) { - total_message_size += rcounts[i]; + total_dsize = 0; + for (i = 0; i < communicator_size; i++) { + total_dsize += rcounts[i]; } + total_dsize *= dsize; - if( !ompi_op_is_commute(op) ) { - return ompi_coll_base_reduce_scatter_intra_nonoverlapping(sbuf, rbuf, rcounts, - dtype, op, - comm, module); + /** Algorithms: + * {1, "non-overlapping"}, + * {2, "recursive_halving"}, + * {3, "ring"}, + * {4, "butterfly"}, + * + * Recursive halving and ring do not support 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; + } + } + } else { + if (communicator_size < 4) { + if (total_dsize < 65536) { + alg = 3; + } else if (total_dsize < 131072) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 8) { + if (total_dsize < 8) { + alg = 1; + } else if (total_dsize < 262144) { + alg = 2; + } else { + alg = 3; + } + } else if (communicator_size < 32) { + if (total_dsize < 262144) { + alg = 2; + } else { + alg = 3; + } + } else if (communicator_size < 64) { + if (total_dsize < 64) { + alg = 1; + } else if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 524288) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 128) { + if (total_dsize < 256) { + alg = 1; + } else if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 2048) { + alg = 4; + } else if (total_dsize < 4096) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 256) { + if (total_dsize < 256) { + alg = 1; + } else if (total_dsize < 512) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 512) { + if (total_dsize < 256) { + alg = 1; + } else if (total_dsize < 1024) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 1024) { + if (total_dsize < 512) { + alg = 1; + } else if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 8192) { + alg = 4; + } else if (total_dsize < 16384) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 2048) { + if (total_dsize < 512) { + alg = 1; + } else if (total_dsize < 4096) { + alg = 2; + } else if (total_dsize < 16384) { + alg = 4; + } else if (total_dsize < 32768) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 4096) { + if (total_dsize < 512) { + alg = 1; + } else if (total_dsize < 4096) { + alg = 2; + } else { + alg = 4; + } + } else { + if (total_dsize < 1024) { + alg = 1; + } else if (total_dsize < 8192) { + alg = 2; + } else { + alg = 4; + } + } } - total_message_size *= dsize; - - /* compute the nearest power of 2 */ - pow2 = opal_next_poweroftwo_inclusive (comm_size); - - if ((total_message_size <= small_message_size) || - ((total_message_size <= large_message_size) && (pow2 == comm_size)) || - (comm_size >= a * total_message_size + b)) { - return - ompi_coll_base_reduce_scatter_intra_basic_recursivehalving(sbuf, rbuf, rcounts, - dtype, op, - comm, module); - } - return ompi_coll_base_reduce_scatter_intra_ring(sbuf, rbuf, rcounts, - dtype, op, - comm, module); + return ompi_coll_tuned_reduce_scatter_intra_do_this (sbuf, rbuf, rcounts, dtype, + op, comm, module, + alg, 0, 0); } /* * reduce_scatter_block_intra_dec * - * Function: - seletects reduce_scatter_block algorithm to use + * Function: - selects reduce_scatter_block algorithm to use * Accepts: - same arguments as MPI_Reduce_scatter_block() * Returns: - MPI_SUCCESS or error code (passed from * the reduce scatter implementation) @@ -526,15 +1065,186 @@ int ompi_coll_tuned_reduce_scatter_block_intra_dec_fixed(const void *sbuf, void struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { + int communicator_size, alg; + size_t dsize, total_dsize; + OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_reduce_scatter_block_intra_dec_fixed")); - return ompi_coll_base_reduce_scatter_block_basic_linear(sbuf, rbuf, rcount, - dtype, op, comm, module); + + + ompi_datatype_type_size(dtype, &dsize); + total_dsize = dsize * (ptrdiff_t)rcount; + + communicator_size = ompi_comm_size(comm); + + /** Algorithms: + * {1, "basic_linear"}, + * {2, "recursive_doubling"}, + * {3, "recursive_halving"}, + * {4, "butterfly"}, + * + * Only recursive halving does not support 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; + } + } + } else { + if (communicator_size < 4) { + if (total_dsize < 4) { + alg = 2; + } else if (total_dsize < 8) { + alg = 4; + } else if (total_dsize < 16) { + alg = 3; + } else if (total_dsize < 128) { + alg = 4; + } else if (total_dsize < 256) { + alg = 3; + } else if (total_dsize < 4096) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 3; + } else if (total_dsize < 131072) { + alg = 4; + } else { + alg = 1; + } + } else if (communicator_size < 8) { + if (total_dsize < 8) { + alg = 3; + } else if (total_dsize < 32) { + alg = 2; + } else if (total_dsize < 256) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 3; + } else if (total_dsize < 16384) { + alg = 4; + } else if (total_dsize < 1048576) { + alg = 3; + } else { + alg = 1; + } + } else if (communicator_size < 16) { + if (total_dsize < 4) { + alg = 1; + } else if (total_dsize < 32) { + alg = 3; + } else if (total_dsize < 128) { + alg = 4; + } else if (total_dsize < 524288) { + alg = 3; + } else if (total_dsize < 4194304) { + alg = 1; + } else { + alg = 4; + } + } else if (communicator_size < 32) { + if (total_dsize < 32) { + alg = 1; + } else if (total_dsize < 524288) { + alg = 3; + } else if (total_dsize < 2097152) { + alg = 1; + } else if (total_dsize < 4194304) { + alg = 3; + } else { + alg = 4; + } + } else { + if (total_dsize < 4) { + alg = 3; + } else if (total_dsize < 16) { + alg = 1; + } else if (total_dsize < 65536) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 4; + } + } + } + + return ompi_coll_tuned_reduce_scatter_block_intra_do_this (sbuf, rbuf, rcount, dtype, + op, comm, module, + alg, 0, 0); } /* * allgather_intra_dec * - * Function: - seletects allgather algorithm to use + * Function: - selects allgather algorithm to use * Accepts: - same arguments as MPI_Allgather() * Returns: - MPI_SUCCESS or error code, passed from corresponding * internal allgather function. @@ -547,91 +1257,150 @@ int ompi_coll_tuned_allgather_intra_dec_fixed(const void *sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int communicator_size, pow2_size; + int communicator_size, alg; size_t dsize, total_dsize; - - communicator_size = ompi_comm_size(comm); - - /* Special case for 2 processes */ - if (communicator_size == 2) { - return ompi_coll_base_allgather_intra_two_procs(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } - - /* Determine complete data size */ if (MPI_IN_PLACE != sbuf) { ompi_datatype_type_size(sdtype, &dsize); } else { ompi_datatype_type_size(rdtype, &dsize); } - total_dsize = dsize * (ptrdiff_t)scount * (ptrdiff_t)communicator_size; + total_dsize = dsize * (ptrdiff_t)scount; - OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed" - " rank %d com_size %d msg_length %lu", - ompi_comm_rank(comm), communicator_size, (unsigned long)total_dsize)); - - pow2_size = opal_next_poweroftwo_inclusive (communicator_size); - - /* Decision based on MX 2Gb results from Grig cluster at - The University of Tennesse, Knoxville - - if total message size is less than 50KB use either bruck or - recursive doubling for non-power of two and power of two nodes, - respectively. - - else use ring and neighbor exchange algorithms for odd and even - number of nodes, respectively. - */ - if (total_dsize < 50000) { - if (pow2_size == communicator_size) { - return ompi_coll_base_allgather_intra_recursivedoubling(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } else { - return ompi_coll_base_allgather_intra_bruck(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); + communicator_size = ompi_comm_size(comm); + /** Algorithms: + * {1, "linear"}, + * {2, "bruck"}, + * {3, "recursive_doubling"}, + * {4, "ring"}, + * {5, "neighbor"}, + * {6, "two_proc"} + */ + if (communicator_size == 2) { + alg = 6; + } else if (communicator_size < 32) { + alg = 3; + } else if (communicator_size < 64) { + if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 65536) { + alg = 5; + } else { + alg = 4; + } + } else if (communicator_size < 128) { + if (total_dsize < 64) { + alg = 1; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 65536) { + alg = 5; + } else { + alg = 4; + } + } else if (communicator_size < 256) { + if (total_dsize < 32) { + alg = 1; + } else if (total_dsize < 512) { + alg = 3; + } else if (total_dsize < 131072) { + alg = 5; + } else if (total_dsize < 524288) { + alg = 4; + } else if (total_dsize < 1048576) { + alg = 5; + } else { + alg = 4; + } + } else if (communicator_size < 512) { + if (total_dsize < 16) { + alg = 1; + } else if (total_dsize < 32) { + alg = 3; + } else if (total_dsize < 128) { + alg = 2; + } else if (total_dsize < 1024) { + alg = 3; + } else if (total_dsize < 131072) { + alg = 5; + } else if (total_dsize < 524288) { + alg = 4; + } else if (total_dsize < 1048576) { + alg = 5; + } else { + alg = 4; + } + } else if (communicator_size < 1024) { + if (total_dsize < 4) { + alg = 1; + } else if (total_dsize < 64) { + alg = 3; + } else if (total_dsize < 256) { + alg = 2; + } else if (total_dsize < 2048) { + alg = 3; + } else { + alg = 5; + } + } else if (communicator_size < 2048) { + if (total_dsize < 2) { + alg = 1; + } else if (total_dsize < 4) { + alg = 3; + } else if (total_dsize < 8) { + alg = 2; + } else if (total_dsize < 16) { + alg = 3; + } else if (total_dsize < 32) { + alg = 2; + } else if (total_dsize < 256) { + alg = 3; + } else if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 3; + } else { + alg = 5; + } + } else if (communicator_size < 4096) { + if (total_dsize < 32) { + alg = 2; + } else if (total_dsize < 128) { + alg = 3; + } else if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 3; + } else { + alg = 5; } } else { - if (communicator_size % 2) { - return ompi_coll_base_allgather_intra_ring(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); + if (total_dsize < 2) { + alg = 3; + } else if (total_dsize < 8) { + alg = 2; + } else if (total_dsize < 16) { + alg = 3; + } else if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 3; } else { - return ompi_coll_base_allgather_intra_neighborexchange(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); + alg = 5; } } -#if defined(USE_MPICH2_DECISION) - /* Decision as in MPICH-2 - presented in Thakur et.al. "Optimization of Collective Communication - Operations in MPICH", International Journal of High Performance Computing - Applications, Vol. 19, No. 1, 49-66 (2005) - - for power-of-two processes and small and medium size messages - (up to 512KB) use recursive doubling - - for non-power-of-two processes and small messages (80KB) use bruck, - - for everything else use ring. - */ - if ((pow2_size == communicator_size) && (total_dsize < 524288)) { - return ompi_coll_base_allgather_intra_recursivedoubling(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } else if (total_dsize <= 81920) { - return ompi_coll_base_allgather_intra_bruck(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); - } - return ompi_coll_base_allgather_intra_ring(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - comm, module); -#endif /* defined(USE_MPICH2_DECISION) */ + OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_allgather_intra_dec_fixed" + " rank %d com_size %d", ompi_comm_rank(comm), communicator_size)); + + return ompi_coll_tuned_allgather_intra_do_this(sbuf, scount, sdtype, + rbuf, rcount, rdtype, + comm, module, alg, 0, 0); } /* * allgatherv_intra_dec * - * Function: - seletects allgatherv algorithm to use + * Function: - selects allgatherv algorithm to use * Accepts: - same arguments as MPI_Allgatherv() * Returns: - MPI_SUCCESS or error code, passed from corresponding * internal allgatherv function. @@ -645,20 +1414,11 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - int i; - int communicator_size; + int communicator_size, alg, i; size_t dsize, total_dsize; communicator_size = ompi_comm_size(comm); - /* Special case for 2 processes */ - if (communicator_size == 2) { - return ompi_coll_base_allgatherv_intra_two_procs(sbuf, scount, sdtype, - rbuf, rcounts, rdispls, rdtype, - comm, module); - } - - /* Determine complete data size */ if (MPI_IN_PLACE != sbuf) { ompi_datatype_type_size(sdtype, &dsize); } else { @@ -666,37 +1426,128 @@ int ompi_coll_tuned_allgatherv_intra_dec_fixed(const void *sbuf, int scount, } total_dsize = 0; - for (i = 0; i < communicator_size; i++) { - total_dsize += dsize * (ptrdiff_t)rcounts[i]; - } - - OPAL_OUTPUT((ompi_coll_tuned_stream, - "ompi_coll_tuned_allgatherv_intra_dec_fixed" - " rank %d com_size %d msg_length %lu", - ompi_comm_rank(comm), communicator_size, (unsigned long)total_dsize)); - - /* Decision based on allgather decision. */ - if (total_dsize < 50000) { - return ompi_coll_base_allgatherv_intra_bruck(sbuf, scount, sdtype, - rbuf, rcounts, rdispls, rdtype, - comm, module); + for (i = 0; i < communicator_size; i++) { total_dsize += dsize * rcounts[i]; } + + /** Algorithms: + * {1, "default"}, + * {2, "bruck"}, + * {3, "ring"}, + * {4, "neighbor"}, + * {5, "two_proc"}, + */ + if (communicator_size == 2) { + if (total_dsize < 2048) { + alg = 3; + } else if (total_dsize < 4096) { + alg = 5; + } else if (total_dsize < 8192) { + alg = 3; + } else { + alg = 5; + } + } else if (communicator_size < 8) { + if (total_dsize < 256) { + alg = 1; + } else if (total_dsize < 4096) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 3; + } else if (total_dsize < 16384) { + alg = 4; + } else if (total_dsize < 262144) { + alg = 2; + } else { + alg = 4; + } + } else if (communicator_size < 16) { + if (total_dsize < 1024) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 32) { + if (total_dsize < 32) { + alg = 1; + } else { + alg = 2; + } + } else if (communicator_size < 64) { + if (total_dsize < 1024) { + alg = 2; + } else if (total_dsize < 2048) { + alg = 4; + } else if (total_dsize < 8192) { + alg = 3; + } else if (total_dsize < 16384) { + alg = 4; + } else if (total_dsize < 32768) { + alg = 3; + } else if (total_dsize < 65536) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 128) { + if (total_dsize < 16) { + alg = 1; + } else if (total_dsize < 1024) { + alg = 2; + } else if (total_dsize < 65536) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 256) { + if (total_dsize < 1024) { + alg = 2; + } else if (total_dsize < 65536) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 512) { + if (total_dsize < 1024) { + alg = 2; + } else if (total_dsize < 131072) { + alg = 4; + } else { + alg = 3; + } + } else if (communicator_size < 1024) { + if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 1024) { + alg = 1; + } else if (total_dsize < 4096) { + alg = 2; + } else if (total_dsize < 1048576) { + alg = 4; + } else { + alg = 3; + } } else { - if (communicator_size % 2) { - return ompi_coll_base_allgatherv_intra_ring(sbuf, scount, sdtype, - rbuf, rcounts, rdispls, rdtype, - comm, module); + if (total_dsize < 4096) { + alg = 2; } else { - return ompi_coll_base_allgatherv_intra_neighborexchange(sbuf, scount, sdtype, - rbuf, rcounts, rdispls, rdtype, - comm, module); + alg = 4; } } + + OPAL_OUTPUT((ompi_coll_tuned_stream, + "ompi_coll_tuned_allgatherv_intra_dec_fixed" + " rank %d com_size %d", ompi_comm_rank(comm), communicator_size)); + + return ompi_coll_tuned_allgatherv_intra_do_this (sbuf, scount, sdtype, + rbuf, rcounts, + rdispls, rdtype, + comm, module, + alg, 0, 0); } /* * gather_intra_dec * - * Function: - seletects gather algorithm to use + * Function: - selects gather algorithm to use * Accepts: - same arguments as MPI_Gather() * Returns: - MPI_SUCCESS or error code, passed from corresponding * internal allgather function. @@ -710,18 +1561,8 @@ int ompi_coll_tuned_gather_intra_dec_fixed(const void *sbuf, int scount, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - const int large_segment_size = 32768; - const int small_segment_size = 1024; - - const size_t large_block_size = 92160; - const size_t intermediate_block_size = 6000; - const size_t small_block_size = 1024; - - const int large_communicator_size = 60; - const int small_communicator_size = 10; - - int communicator_size, rank; - size_t dsize, block_size; + int communicator_size, alg, rank; + size_t dsize, total_dsize; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_gather_intra_dec_fixed")); @@ -729,44 +1570,72 @@ int ompi_coll_tuned_gather_intra_dec_fixed(const void *sbuf, int scount, communicator_size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); - /* Determine block size */ if (rank == root) { ompi_datatype_type_size(rdtype, &dsize); - block_size = dsize * (ptrdiff_t)rcount; + total_dsize = dsize * (ptrdiff_t)rcount; } else { ompi_datatype_type_size(sdtype, &dsize); - block_size = dsize * (ptrdiff_t)scount; + total_dsize = dsize * (ptrdiff_t)scount; } - if (block_size > large_block_size) { - return ompi_coll_base_gather_intra_linear_sync(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module, - large_segment_size); - - } else if (block_size > intermediate_block_size) { - return ompi_coll_base_gather_intra_linear_sync(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module, - small_segment_size); - - } else if ((communicator_size > large_communicator_size) || - ((communicator_size > small_communicator_size) && - (block_size < small_block_size))) { - return ompi_coll_base_gather_intra_binomial(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module); + /** Algorithms: + * {1, "basic_linear"}, + * {2, "binomial"}, + * {3, "linear_sync"}, + * + * We do not make any rank specific checks since the params + * should be uniform across ranks. + */ + if (communicator_size < 4) { + if (total_dsize < 2) { + alg = 3; + } else if (total_dsize < 4) { + alg = 1; + } else if (total_dsize < 32768) { + alg = 2; + } else if (total_dsize < 65536) { + alg = 1; + } else if (total_dsize < 131072) { + alg = 2; + } else { + alg = 3; + } + } else if (communicator_size < 8) { + if (total_dsize < 1024) { + alg = 2; + } else if (total_dsize < 8192) { + alg = 1; + } else if (total_dsize < 32768) { + alg = 2; + } else if (total_dsize < 262144) { + alg = 1; + } else { + alg = 3; + } + } else if (communicator_size < 256) { + alg = 2; + } else if (communicator_size < 512) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 8192) { + alg = 1; + } else { + alg = 2; + } + } else { + alg = 2; } - /* Otherwise, use basic linear */ - return ompi_coll_base_gather_intra_basic_linear(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module); + + return ompi_coll_tuned_gather_intra_do_this (sbuf, scount, sdtype, + rbuf, rcount, rdtype, + root, comm, module, + alg, 0, 0); } /* * scatter_intra_dec * - * Function: - seletects scatter algorithm to use + * Function: - selects scatter algorithm to use * Accepts: - same arguments as MPI_Scatter() * Returns: - MPI_SUCCESS or error code, passed from corresponding * internal allgather function. @@ -779,42 +1648,91 @@ int ompi_coll_tuned_scatter_intra_dec_fixed(const void *sbuf, int scount, int root, struct ompi_communicator_t *comm, mca_coll_base_module_t *module) { - const size_t small_block_size = 300; - const int small_comm_size = 10; - const int intermediate_comm_size = 64; - int communicator_size, rank; - size_t dsize, block_size; + int communicator_size, alg, rank; + size_t dsize, total_dsize; OPAL_OUTPUT((ompi_coll_tuned_stream, "ompi_coll_tuned_scatter_intra_dec_fixed")); communicator_size = ompi_comm_size(comm); rank = ompi_comm_rank(comm); - /* Determine block size */ + if (root == rank) { ompi_datatype_type_size(sdtype, &dsize); - block_size = dsize * (ptrdiff_t)scount; + total_dsize = dsize * (ptrdiff_t)scount; } else { ompi_datatype_type_size(rdtype, &dsize); - block_size = dsize * (ptrdiff_t)rcount; + total_dsize = dsize * (ptrdiff_t)rcount; } - if ((communicator_size > small_comm_size) && - (block_size < small_block_size)) { - return ompi_coll_base_scatter_intra_binomial(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module); - } else if ((communicator_size < ompi_coll_tuned_scatter_min_procs) && - (communicator_size > intermediate_comm_size) && - (block_size >= ompi_coll_tuned_scatter_intermediate_msg) && - (block_size < ompi_coll_tuned_scatter_large_msg)) { - return ompi_coll_base_scatter_intra_linear_nb(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module, - ompi_coll_tuned_scatter_blocking_send_ratio); + /** Algorithms: + * {1, "basic_linear"}, + * {2, "binomial"}, + * {3, "linear_nb"}, + * + * We do not make any rank specific checks since the params + * should be uniform across ranks. + */ + if (communicator_size < 4) { + if (total_dsize < 2) { + alg = 3; + } else if (total_dsize < 131072) { + alg = 1; + } else if (total_dsize < 262144) { + alg = 3; + } else { + alg = 1; + } + } else if (communicator_size < 8) { + if (total_dsize < 2048) { + alg = 2; + } else if (total_dsize < 4096) { + alg = 1; + } else if (total_dsize < 8192) { + alg = 2; + } else if (total_dsize < 32768) { + alg = 1; + } else if (total_dsize < 1048576) { + alg = 3; + } else { + alg = 1; + } + } else if (communicator_size < 16) { + if (total_dsize < 16384) { + alg = 2; + } else if (total_dsize < 1048576) { + alg = 3; + } else { + alg = 1; + } + } else if (communicator_size < 32) { + if (total_dsize < 16384) { + alg = 2; + } else if (total_dsize < 32768) { + alg = 1; + } else { + alg = 3; + } + } else if (communicator_size < 64) { + if (total_dsize < 512) { + alg = 2; + } else if (total_dsize < 8192) { + alg = 3; + } else if (total_dsize < 16384) { + alg = 2; + } else { + alg = 3; + } + } else { + if (total_dsize < 512) { + alg = 2; + } else { + alg = 3; + } } - return ompi_coll_base_scatter_intra_basic_linear(sbuf, scount, sdtype, - rbuf, rcount, rdtype, - root, comm, module); + return ompi_coll_tuned_scatter_intra_do_this (sbuf, scount, sdtype, + rbuf, rcount, rdtype, + root, comm, module, + alg, 0, 0); } From abe3aaa4a7b0e010943ba10e1f09ec8307ee5d11 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Fri, 31 Jul 2020 11:47:22 -0700 Subject: [PATCH 671/674] btl/ofi: Use common provider include/exclude list The btl/ofi does not currently utilize the common ofi include/exclude list. Added verification code similar to the mtl/ofi that will check if the info object is in the include or exclude list. If it isn't in the include list or is in the exclude list, validate_info will return OPAL_ERROR. The btl/ofi will no longer pass a provider name as a hint when calling getinfo, instead filtering the provider during validate_info. This patch also moves the is_in_list MTL function into common code and adds additional debugging output to the BTL to match the MTL standard. Signed-off-by: William Zhang (cherry picked from commit 9b8f463a768206a26e5b1dcea0612a403462b1d0) --- ompi/mca/mtl/ofi/mtl_ofi_component.c | 28 ++++------------------- opal/mca/btl/ofi/btl_ofi_component.c | 33 +++++++++++++++++++++++----- opal/mca/common/ofi/common_ofi.c | 19 ++++++++++++++++ opal/mca/common/ofi/common_ofi.h | 15 +++++++++++++ 4 files changed, 66 insertions(+), 29 deletions(-) diff --git a/ompi/mca/mtl/ofi/mtl_ofi_component.c b/ompi/mca/mtl/ofi/mtl_ofi_component.c index 1e32d1af66f..9fd1e968c5b 100644 --- a/ompi/mca/mtl/ofi/mtl_ofi_component.c +++ b/ompi/mca/mtl/ofi/mtl_ofi_component.c @@ -306,26 +306,6 @@ ompi_mtl_ofi_progress_no_inline(void) return ompi_mtl_ofi_progress(); } -static int -is_in_list(char **list, char *item) -{ - int i = 0; - - if ((NULL == list) || (NULL == item)) { - return 0; - } - - while (NULL != list[i]) { - if (0 == strncasecmp(item, list[i], strlen(list[i]))) { - return 1; - } else { - i++; - } - } - - return 0; -} - static struct fi_info* select_ofi_provider(struct fi_info *providers, char **include_list, char **exclude_list) @@ -334,7 +314,7 @@ select_ofi_provider(struct fi_info *providers, if (NULL != include_list) { while ((NULL != prov) && - (!is_in_list(include_list, prov->fabric_attr->prov_name))) { + (!opal_common_ofi_is_in_list(include_list, prov->fabric_attr->prov_name))) { opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi: \"%s\" not in include list\n", __FILE__, __LINE__, @@ -343,7 +323,7 @@ select_ofi_provider(struct fi_info *providers, } } else if (NULL != exclude_list) { while ((NULL != prov) && - (is_in_list(exclude_list, prov->fabric_attr->prov_name))) { + (opal_common_ofi_is_in_list(exclude_list, prov->fabric_attr->prov_name))) { opal_output_verbose(1, opal_common_ofi.output, "%s:%d: mtl:ofi: \"%s\" in exclude list\n", __FILE__, __LINE__, @@ -733,8 +713,8 @@ ompi_mtl_ofi_component_init(bool enable_progress_threads, * this logic if the user specifies an include list without EFA or adds EFA * to the exclude list. */ - if ((include_list && is_in_list(include_list, "efa")) || - (exclude_list && !is_in_list(exclude_list, "efa"))) { + if ((include_list && opal_common_ofi_is_in_list(include_list, "efa")) || + (exclude_list && !opal_common_ofi_is_in_list(exclude_list, "efa"))) { hints_dup = fi_dupinfo(hints); hints_dup->caps &= ~(FI_LOCAL_COMM | FI_REMOTE_COMM); hints_dup->fabric_attr->prov_name = strdup("efa"); diff --git a/opal/mca/btl/ofi/btl_ofi_component.c b/opal/mca/btl/ofi/btl_ofi_component.c index f99db0a2d07..c437b79c951 100644 --- a/opal/mca/btl/ofi/btl_ofi_component.c +++ b/opal/mca/btl/ofi/btl_ofi_component.c @@ -53,10 +53,25 @@ static int mca_btl_ofi_init_device(struct fi_info *info); /* validate information returned from fi_getinfo(). * return OPAL_ERROR if we dont have what we need. */ -static int validate_info(struct fi_info *info, uint64_t required_caps) +static int validate_info(struct fi_info *info, uint64_t required_caps, + char **include_list, char **exclude_list) { int mr_mode; + if (NULL != include_list && !opal_common_ofi_is_in_list(include_list, info->fabric_attr->prov_name)) { + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d: btl:ofi: \"%s\" not in include list\n", + __FILE__, __LINE__, + info->fabric_attr->prov_name); + return OPAL_ERROR; + } else if (NULL != exclude_list && opal_common_ofi_is_in_list(exclude_list, info->fabric_attr->prov_name)) { + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d: btl:ofi: \"%s\" in exclude list\n", + __FILE__, __LINE__, + info->fabric_attr->prov_name); + return OPAL_ERROR; + } + BTL_VERBOSE(("validating device: %s", info->domain_attr->name)); /* we need exactly all the required bits */ @@ -219,7 +234,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, uint64_t progress_mode; unsigned resource_count = 0; struct mca_btl_base_module_t **base_modules; - char **include_list = NULL; + char **include_list = NULL, **exclude_list = NULL; BTL_VERBOSE(("initializing ofi btl")); @@ -264,10 +279,18 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, } fabric_attr.prov_name = NULL; - /* Select the provider - sort of. we just take first element in list for now */ + + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d: btl:ofi:provider_include = \"%s\"\n", + __FILE__, __LINE__, *opal_common_ofi.prov_include); + opal_output_verbose(1, opal_common_ofi.output, + "%s:%d: btl:ofi:provider_exclude = \"%s\"\n", + __FILE__, __LINE__, *opal_common_ofi.prov_exclude); + if (NULL != *opal_common_ofi.prov_include) { include_list = opal_argv_split(*opal_common_ofi.prov_include, ','); - fabric_attr.prov_name = include_list[0]; + } else if (NULL != *opal_common_ofi.prov_exclude) { + exclude_list = opal_argv_split(*opal_common_ofi.prov_exclude, ','); } domain_attr.mr_mode = MCA_BTL_OFI_REQUESTED_MR_MODE; @@ -331,7 +354,7 @@ static mca_btl_base_module_t **mca_btl_ofi_component_init (int *num_btl_modules, info = info_list; while(info) { - rc = validate_info(info, required_caps); + rc = validate_info(info, required_caps, include_list, exclude_list); if (OPAL_SUCCESS == rc) { /* Device passed sanity check, let's make a module. * diff --git a/opal/mca/common/ofi/common_ofi.c b/opal/mca/common/ofi/common_ofi.c index e0b5c04dd65..314e2b16af1 100644 --- a/opal/mca/common/ofi/common_ofi.c +++ b/opal/mca/common/ofi/common_ofi.c @@ -33,6 +33,25 @@ OPAL_DECLSPEC opal_common_ofi_module_t opal_common_ofi = { static const char default_prov_exclude_list[] = "shm,sockets,tcp,udp,rstream"; +OPAL_DECLSPEC int opal_common_ofi_is_in_list(char **list, char *item) +{ + int i = 0; + + if ((NULL == list) || (NULL == item)) { + return 0; + } + + while (NULL != list[i]) { + if (0 == strncasecmp(item, list[i], strlen(list[i]))) { + return 1; + } else { + i++; + } + } + + return 0; +} + OPAL_DECLSPEC int opal_common_ofi_register_mca_variables(const mca_base_component_t *component) { static int registered = 0; diff --git a/opal/mca/common/ofi/common_ofi.h b/opal/mca/common/ofi/common_ofi.h index 2745515dc6e..06ac691132c 100644 --- a/opal/mca/common/ofi/common_ofi.h +++ b/opal/mca/common/ofi/common_ofi.h @@ -38,6 +38,21 @@ OPAL_DECLSPEC void opal_common_ofi_mca_register(void); OPAL_DECLSPEC void opal_common_ofi_mca_deregister(void); OPAL_DECLSPEC struct fi_info* opal_common_ofi_select_ofi_provider(struct fi_info *providers, char *framework_name); +/* + * @param list (IN) List of strings corresponding to lower providers. + * @param item (IN) Single string corresponding to a provider. + * + * @return 0 The lower provider of the item string is not in + * list or an input was NULL + * @return 1 The lower provider of the item string matches + * a string in the item list. + * + * This function will take a provider name string and a list of lower + * provider name strings as inputs. It will return true if the lower + * provider in the item string matches a lower provider in the list. + * + */ +OPAL_DECLSPEC int opal_common_ofi_is_in_list(char **list, char *item); END_C_DECLS From 11620038f972af87b8f2ed310c01f48645a4952a Mon Sep 17 00:00:00 2001 From: Mikhail Kurnosov Date: Tue, 11 Aug 2020 08:43:47 +0700 Subject: [PATCH 672/674] Fix a typo in parsing locality string: L0 changed to L1 (`prte_hwloc_base_get_locality_string` never returns locality string with L0). Signed-off-by: Mikhail Kurnosov (cherry picked from commit 4708458d6b12d1b7a8e11fa3c3f784c545780707) --- opal/mca/hwloc/base/hwloc_base_util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index 0980be39ae0..0a67f3406fa 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -2312,7 +2312,7 @@ char* opal_hwloc_base_get_location(char *locality, } else if (2 == index) { srch = "L2"; } else { - srch = "L0"; + srch = "L1"; } break; #else @@ -2323,7 +2323,7 @@ char* opal_hwloc_base_get_location(char *locality, srch = "L2"; break; case HWLOC_OBJ_L1CACHE: - srch = "L0"; + srch = "L1"; break; #endif case HWLOC_OBJ_CORE: From eb9ced786a0f949f090c2d4365761c81ba82ed67 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 22 Jul 2020 01:19:12 -0400 Subject: [PATCH 673/674] Use the unaligned SSE memory access primitive. Alter the test to validate misaligned data. Fixes #7954. Signed-off-by: George Bosilca (cherry picked from commit b6d71aa893db51c393df9c993fde597eff5457e8) Signed-off-by: Brian Barrett --- ompi/mca/op/avx/op_avx_functions.c | 72 +++++++++++++++--------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/ompi/mca/op/avx/op_avx_functions.c b/ompi/mca/op/avx/op_avx_functions.c index 92d71db1772..c79a8b34506 100644 --- a/ompi/mca/op/avx/op_avx_functions.c +++ b/ompi/mca/op/avx/op_avx_functions.c @@ -286,11 +286,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##name##_##type,PREPEND)(const void *_in if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ types_per_step = (512 / 8) / sizeof(float); \ for (; left_over >= types_per_step; left_over -= types_per_step) { \ - __m512 vecA = _mm512_load_ps((__m512*)in); \ - __m512 vecB = _mm512_load_ps((__m512*)out); \ + __m512 vecA = _mm512_loadu_ps((__m512*)in); \ + __m512 vecB = _mm512_loadu_ps((__m512*)out); \ in += types_per_step; \ __m512 res = _mm512_##op##_ps(vecA, vecB); \ - _mm512_store_ps((__m512*)out, res); \ + _mm512_storeu_ps((__m512*)out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -304,11 +304,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##name##_##type,PREPEND)(const void *_in if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ types_per_step = (256 / 8) / sizeof(float); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m256 vecA = _mm256_load_ps(in); \ + __m256 vecA = _mm256_loadu_ps(in); \ in += types_per_step; \ - __m256 vecB = _mm256_load_ps(out); \ + __m256 vecB = _mm256_loadu_ps(out); \ __m256 res = _mm256_##op##_ps(vecA, vecB); \ - _mm256_store_ps(out, res); \ + _mm256_storeu_ps(out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -322,11 +322,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##name##_##type,PREPEND)(const void *_in if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE_FLAG) ) { \ types_per_step = (128 / 8) / sizeof(float); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m128 vecA = _mm_load_ps(in); \ + __m128 vecA = _mm_loadu_ps(in); \ in += types_per_step; \ - __m128 vecB = _mm_load_ps(out); \ + __m128 vecB = _mm_loadu_ps(out); \ __m128 res = _mm_##op##_ps(vecA, vecB); \ - _mm_store_ps(out, res); \ + _mm_storeu_ps(out, res); \ out += types_per_step; \ } \ } @@ -367,11 +367,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##op##_float,PREPEND)(const void *_in, v if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ types_per_step = (512 / 8) / sizeof(double); \ for (; left_over >= types_per_step; left_over -= types_per_step) { \ - __m512d vecA = _mm512_load_pd(in); \ + __m512d vecA = _mm512_loadu_pd(in); \ in += types_per_step; \ - __m512d vecB = _mm512_load_pd(out); \ + __m512d vecB = _mm512_loadu_pd(out); \ __m512d res = _mm512_##op##_pd(vecA, vecB); \ - _mm512_store_pd((out), res); \ + _mm512_storeu_pd((out), res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -385,11 +385,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##op##_float,PREPEND)(const void *_in, v if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ types_per_step = (256 / 8) / sizeof(double); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m256d vecA = _mm256_load_pd(in); \ + __m256d vecA = _mm256_loadu_pd(in); \ in += types_per_step; \ - __m256d vecB = _mm256_load_pd(out); \ + __m256d vecB = _mm256_loadu_pd(out); \ __m256d res = _mm256_##op##_pd(vecA, vecB); \ - _mm256_store_pd(out, res); \ + _mm256_storeu_pd(out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -403,11 +403,11 @@ static void OP_CONCAT(ompi_op_avx_2buff_##op##_float,PREPEND)(const void *_in, v if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE2_FLAG) ) { \ types_per_step = (128 / 8) / sizeof(double); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m128d vecA = _mm_load_pd(in); \ + __m128d vecA = _mm_loadu_pd(in); \ in += types_per_step; \ - __m128d vecB = _mm_load_pd(out); \ + __m128d vecB = _mm_loadu_pd(out); \ __m128d res = _mm_##op##_pd(vecA, vecB); \ - _mm_store_pd(out, res); \ + _mm_storeu_pd(out, res); \ out += types_per_step; \ } \ } @@ -813,12 +813,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_##type,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ types_per_step = (512 / 8) / sizeof(float); \ for (; left_over >= types_per_step; left_over -= types_per_step) { \ - __m512 vecA = _mm512_load_ps(in1); \ - __m512 vecB = _mm512_load_ps(in2); \ + __m512 vecA = _mm512_loadu_ps(in1); \ + __m512 vecB = _mm512_loadu_ps(in2); \ in1 += types_per_step; \ in2 += types_per_step; \ __m512 res = _mm512_##op##_ps(vecA, vecB); \ - _mm512_store_ps(out, res); \ + _mm512_storeu_ps(out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -832,12 +832,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_##type,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ types_per_step = (256 / 8) / sizeof(float); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m256 vecA = _mm256_load_ps(in1); \ - __m256 vecB = _mm256_load_ps(in2); \ + __m256 vecA = _mm256_loadu_ps(in1); \ + __m256 vecB = _mm256_loadu_ps(in2); \ in1 += types_per_step; \ in2 += types_per_step; \ __m256 res = _mm256_##op##_ps(vecA, vecB); \ - _mm256_store_ps(out, res); \ + _mm256_storeu_ps(out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -851,12 +851,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_##type,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE_FLAG) ) { \ types_per_step = (128 / 8) / sizeof(float); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m128 vecA = _mm_load_ps(in1); \ - __m128 vecB = _mm_load_ps(in2); \ + __m128 vecA = _mm_loadu_ps(in1); \ + __m128 vecB = _mm_loadu_ps(in2); \ in1 += types_per_step; \ in2 += types_per_step; \ __m128 res = _mm_##op##_ps(vecA, vecB); \ - _mm_store_ps(out, res); \ + _mm_storeu_ps(out, res); \ out += types_per_step; \ } \ } @@ -899,12 +899,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_float,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX512F_FLAG) ) { \ types_per_step = (512 / 8) / sizeof(double); \ for (; left_over >= types_per_step; left_over -= types_per_step) { \ - __m512d vecA = _mm512_load_pd((in1)); \ - __m512d vecB = _mm512_load_pd((in2)); \ + __m512d vecA = _mm512_loadu_pd((in1)); \ + __m512d vecB = _mm512_loadu_pd((in2)); \ in1 += types_per_step; \ in2 += types_per_step; \ __m512d res = _mm512_##op##_pd(vecA, vecB); \ - _mm512_store_pd((out), res); \ + _mm512_storeu_pd((out), res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -918,12 +918,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_float,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_AVX_FLAG) ) { \ types_per_step = (256 / 8) / sizeof(double); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m256d vecA = _mm256_load_pd(in1); \ - __m256d vecB = _mm256_load_pd(in2); \ + __m256d vecA = _mm256_loadu_pd(in1); \ + __m256d vecB = _mm256_loadu_pd(in2); \ in1 += types_per_step; \ in2 += types_per_step; \ __m256d res = _mm256_##op##_pd(vecA, vecB); \ - _mm256_store_pd(out, res); \ + _mm256_storeu_pd(out, res); \ out += types_per_step; \ } \ if( 0 == left_over ) return; \ @@ -937,12 +937,12 @@ static void OP_CONCAT(ompi_op_avx_3buff_##op##_float,PREPEND)(const void *_in1, if( OMPI_OP_AVX_HAS_FLAGS(OMPI_OP_AVX_HAS_SSE2_FLAG) ) { \ types_per_step = (128 / 8) / sizeof(double); \ for( ; left_over >= types_per_step; left_over -= types_per_step ) { \ - __m128d vecA = _mm_load_pd(in1); \ - __m128d vecB = _mm_load_pd(in2); \ + __m128d vecA = _mm_loadu_pd(in1); \ + __m128d vecB = _mm_loadu_pd(in2); \ in1 += types_per_step; \ in2 += types_per_step; \ __m128d res = _mm_##op##_pd(vecA, vecB); \ - _mm_store_pd(out, res); \ + _mm_storeu_pd(out, res); \ out += types_per_step; \ } \ } From c20626e60d3d880a301b4d3768f35563dca3fe4f Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 22 Jul 2020 11:26:07 -0400 Subject: [PATCH 674/674] Check unaligned ops for correctness. Signed-off-by: George Bosilca (cherry picked from commit c4e88a43a3a1f6a13f8eaa8b90d2a0a8caba5adf) Signed-off-by: Brian Barrett --- test/datatype/reduce_local.c | 1371 ++++++++-------------------------- 1 file changed, 327 insertions(+), 1044 deletions(-) diff --git a/test/datatype/reduce_local.c b/test/datatype/reduce_local.c index aed0de40106..97890f94227 100644 --- a/test/datatype/reduce_local.c +++ b/test/datatype/reduce_local.c @@ -71,6 +71,94 @@ static void print_status(char* op, char* type, int type_size, printf(" count %-10d time %.6f seconds\n", count, duration); } +static int do_ops_built = 0; +static int +build_do_ops( char* optarg, int* do_ops) +{ + int i; + if( 0 == strcmp(optarg, "all") ) { + for( i = 0; NULL != array_of_ops[i].name; i++ ) { + do_ops[i] = i; + } + do_ops[i] = -1; /* stop */ + } else { + int n, idx = 0; + char* token, *arg = optarg; + while ((token = strsep(&arg, ",")) != NULL) { + for( i = 0; NULL != array_of_ops[i].name; i++ ) { /* find the op */ + if( 0 == strcmp(array_of_ops[i].name, token) ) { + /* check if the op was not already selected */ + for(n = 0; n < idx; n++ ) { + if( i == do_ops[n] ) { + break; + } + } + if( n >= idx ) { + do_ops[idx++] = i; + do_ops[idx] = -1; + } + break; + } + } + if( NULL == array_of_ops[i].name ) { + fprintf(stderr, "Unknown op %s. Ignored.\n", token); + } + } + } + do_ops_built = 1; + return 0; +} + + +#define MPI_OP_TEST(OPNAME, MPIOP, MPITYPE, TYPE, INBUF, INOUT_BUF, CHECK_BUF, COUNT, TYPE_PREFIX) \ +do { \ + const TYPE *_p1 = ((TYPE*)(INBUF)), *_p3 = ((TYPE*)(CHECK_BUF)); \ + TYPE *_p2 = ((TYPE*)(INOUT_BUF)); \ + skip_op_type = 0; \ + for(int _k = 0; _k < min((COUNT), 4); +_k++ ) { \ + memcpy(_p2, _p3, sizeof(TYPE) * (COUNT)); \ + tstart = MPI_Wtime(); \ + MPI_Reduce_local(_p1+_k, _p2+_k, (COUNT)-_k, (MPITYPE), (MPIOP)); \ + tend = MPI_Wtime(); \ + if( check ) { \ + for( i = 0; i < (COUNT)-_k; i++ ) { \ + if(((_p2+_k)[i]) == (((_p1+_k)[i]) OPNAME ((_p3+_k)[i]))) \ + continue; \ + printf("First error at alignment %d position %d (%" TYPE_PREFIX " %s %" TYPE_PREFIX " != %" TYPE_PREFIX ")\n", \ + _k, i, (_p1+_k)[i], (#OPNAME), (_p3+_k)[i], (_p2+_k)[i]); \ + correctness = 0; \ + break; \ + } \ + } \ + } \ + goto check_and_continue; \ +} while (0) + +#define MPI_OP_MINMAX_TEST(OPNAME, MPIOP, MPITYPE, TYPE, INBUF, INOUT_BUF, CHECK_BUF, COUNT, TYPE_PREFIX) \ +do { \ + const TYPE *_p1 = ((TYPE*)(INBUF)), *_p3 = ((TYPE*)(CHECK_BUF)); \ + TYPE *_p2 = ((TYPE*)(INOUT_BUF)); \ + skip_op_type = 0; \ + for(int _k = 0; _k < min((COUNT), 4); +_k++ ) { \ + memcpy(_p2, _p3, sizeof(TYPE) * (COUNT)); \ + tstart = MPI_Wtime(); \ + MPI_Reduce_local(_p1+_k, _p2+_k, (COUNT), (MPITYPE), (MPIOP)); \ + tend = MPI_Wtime(); \ + if( check ) { \ + for( i = 0; i < (COUNT); i++ ) { \ + TYPE _v1 = *(_p1+_k), _v2 = *(_p2+_k), _v3 = *(_p3+_k); \ + if(_v2 == OPNAME(_v1, _v3)) \ + continue; \ + printf("First error at alignment %d position %d (%" TYPE_PREFIX " != %s(%" TYPE_PREFIX ", %" TYPE_PREFIX ")\n", \ + _k, i, _v1, (#OPNAME), _v3, _v2); \ + correctness = 0; \ + break; \ + } \ + } \ + } \ + goto check_and_continue; \ +} while (0) + int main(int argc, char **argv) { static void *in_buf = NULL, *inout_buf = NULL, *inout_check_buf = NULL; @@ -118,37 +206,7 @@ int main(int argc, char **argv) strncpy(type, optarg, 4); break; case 'o': - { - if( 0 == strcmp(optarg, "all") ) { - for( i = 0; NULL != array_of_ops[i].name; i++ ) { - do_ops[i] = i; - } - do_ops[i] = -1; /* stop */ - } else { - int n, idx = 0; - char* token, *arg = optarg; - while ((token = strsep(&arg, ",")) != NULL) { - for( i = 0; NULL != array_of_ops[i].name; i++ ) { /* find the op */ - if( 0 == strcmp(array_of_ops[i].name, token) ) { - /* check if the op was not already selected */ - for(n = 0; n < idx; n++ ) { - if( i == do_ops[n] ) { - break; - } - } - if( n >= idx ) { - do_ops[idx++] = i; - do_ops[idx] = -1; - } - break; - } - } - if( NULL == array_of_ops[i].name ) { - fprintf(stderr, "Unknown op %s. Ignored.\n", token); - } - } - } - } + build_do_ops( optarg, do_ops); break; case 's': type_size = atoi(optarg); @@ -166,11 +224,15 @@ int main(int argc, char **argv) " -t [i,u,f,d] : type of the elements to apply the operations on\n" " -o : comma separated list of operations to execute among\n" " sum, min, max, prod, bor, bxor, band\n" + " -v: increase the verbosity level\n" " -h: this help message\n", argv[0]); exit(0); } } + if( !do_ops_built ) { /* not yet done, take the default */ + build_do_ops( "all", do_ops); + } in_buf = malloc(upper * sizeof(double)); inout_buf = malloc(upper * sizeof(double)); inout_check_buf = malloc(upper * sizeof(double)); @@ -201,124 +263,39 @@ int main(int argc, char **argv) mpi_type = "MPI_INT8_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == (int8_t)(in_int8[i] + inout_int8_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == max(inout_int8_for_check[i], in_int8[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, inout_int8[i], op, in_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_int8, in_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == min(inout_int8_for_check[i], in_int8[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, inout_int8[i], op, in_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == (in_int8[i] | inout_int8_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == (in_int8[i] ^ inout_int8_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == (int8_t)(in_int8[i] * inout_int8_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int8, inout_int8, count, MPI_INT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int8[i] == (in_int8[i] & inout_int8_for_check[i]) ) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int8[i], op, inout_int8_for_check[i], inout_int8[i]); - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_INT8_T, int8_t, + in_int8, inout_int8, inout_int8_for_check, + count, PRId8); } } if( 16 == type_size ) { @@ -332,123 +309,39 @@ int main(int argc, char **argv) mpi_type = "MPI_INT16_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == (int16_t)(in_int16[i] + inout_int16_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == max(inout_int16_for_check[i], in_int16[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, inout_int16[i], op, in_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_int16, in_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == min(inout_int16_for_check[i],in_int16[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, inout_int16[i], op, in_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == (in_int16[i] | inout_int16_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == (in_int16[i] ^ inout_int16_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == (int16_t)(in_int16[i] * inout_int16_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int16, inout_int16, count, MPI_INT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int16[i] == (in_int16[i] & inout_int16_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int16[i], op, inout_int16_for_check[i], inout_int16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_INT16_T, int16_t, + in_int16, inout_int16, inout_int16_for_check, + count, PRId16); } } if( 32 == type_size ) { @@ -462,123 +355,39 @@ int main(int argc, char **argv) mpi_type = "MPI_INT32_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == (int32_t)(in_int32[i] + inout_int32_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == max(inout_int32_for_check[i], in_int32[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, in_int32[i], op, inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_int32, in_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == min(inout_int32_for_check[i], in_int32[i])) - continue; - printf("First error at position %d (%d != %s(%d))\n", - i, in_int32[i], op, inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == (in_int32[i] | inout_int32_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); + } + if( 0 == strcmp(op, "bxor") ) { + MPI_OP_TEST( ^, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == (int32_t)(in_int32[i] * inout_int32_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == (in_int32[i] & inout_int32_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); } - if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int32, inout_int32, count, MPI_INT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int32[i] == (in_int32[i] ^ inout_int32_for_check[i])) - continue; - printf("First error at position %d (%d %s %d != %d)\n", - i, in_int32[i], op, inout_int32_for_check[i], inout_int32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_INT32_T, int32_t, + in_int32, inout_int32, inout_int32_for_check, + count, PRId32); } } if( 64 == type_size ) { @@ -592,140 +401,39 @@ int main(int argc, char **argv) mpi_type = "MPI_INT64_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == (int64_t)(in_int64[i] + inout_int64_for_check[i])) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == max(inout_int64_for_check[i], in_int64[i])) - continue; - printf("First error at position %d (%lld != %s(%lld))\n", - i, inout_int64[i], op, in_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_int64, in_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == min(inout_int64_for_check[i], in_int64[i])) - continue; - printf("First error at position %d (%lld != %s(%lld))\n", - i, inout_int64[i], op, in_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_int64, in_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == in_int64[i]) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == (in_int64[i] | inout_int64_for_check[i])) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == (in_int64[i] ^ inout_int64_for_check[i])) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64,inout_int64,count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == (int64_t)(in_int64[i] * inout_int64_for_check[i])) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_int64, inout_int64, count, MPI_INT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_int64[i] == (in_int64[i] & inout_int64_for_check[i]) ) - continue; - printf("First error at position %d (%lld %s %lld != %lld)\n", - i, in_int64[i], op, inout_int64_for_check[i], inout_int64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_INT64_T, int64_t, + in_int64, inout_int64, inout_int64_for_check, + count, PRId64); } } } @@ -737,128 +445,44 @@ int main(int argc, char **argv) *inout_uint8_for_check = (uint8_t*)inout_check_buf; for( i = 0; i < count; i++ ) { in_uint8[i] = 5; - inout_uint8[i] = inout_uint8_for_check[i] = 121; + inout_uint8[i] = inout_uint8_for_check[i] = 2; } mpi_type = "MPI_UINT8_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == (uint8_t)(in_uint8[i] + inout_uint8_for_check[i])) - continue; - printf("First error at position %d (%u %s %u [%u] != %u)\n", - i, in_uint8[i], op, inout_uint8_for_check[i], (uint8_t)(in_uint8[i] + inout_uint8_for_check[i]), inout_uint8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == max(inout_uint8_for_check[i], in_uint8[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint8[i], op, inout_uint8_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == min(inout_uint8_for_check[i], in_uint8[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint8[i], op, inout_uint8_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == (in_uint8[i] | inout_uint8_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == (in_uint8[i] ^ inout_uint8_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == (uint8_t)(in_uint8[i] * inout_uint8_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint8, inout_uint8, count, MPI_UINT8_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint8[i] == (in_uint8[i] & inout_uint8_for_check[i]) ) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint8[i], op, inout_uint8_for_check[i], inout_uint8[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_UINT8_T, uint8_t, + in_uint8, inout_uint8, inout_uint8_for_check, + count, PRIu8); } } if( 16 == type_size ) { @@ -872,123 +496,39 @@ int main(int argc, char **argv) mpi_type = "MPI_UINT16_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == (uint16_t)(in_uint16[i] + inout_uint16_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == max(inout_uint16_for_check[i], in_uint16[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint16[i], op, inout_uint16_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == min(inout_uint16_for_check[i], in_uint16[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint16[i], op, inout_uint16_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == (in_uint16[i] | inout_uint16_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == (in_uint16[i] ^ inout_uint16_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == (uint16_t)(in_uint16[i] * inout_uint16_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint16, inout_uint16, count, MPI_UINT16_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint16[i] == (in_uint16[i] & inout_uint16_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint16[i], op, inout_uint16_for_check[i], inout_uint16[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_UINT16_T, uint16_t, + in_uint16, inout_uint16, inout_uint16_for_check, + count, PRIu16); } } if( 32 == type_size ) { @@ -1002,129 +542,45 @@ int main(int argc, char **argv) mpi_type = "MPI_UINT32_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == (uint32_t)(in_uint32[i] + inout_uint32_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == max(inout_uint32_for_check[i], in_uint32[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint32[i], op, inout_uint32_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { // we reverse the send and recv buffers - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_uint32, in_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == min(inout_uint32_for_check[i], in_uint32[i])) - continue; - printf("First error at position %d (%u != %s(%u))\n", - i, inout_uint32[i], op, inout_uint32_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32,inout_uint32,count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == (in_uint32[i] | inout_uint32_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); + } + if( 0 == strcmp(op, "bxor") ) { + MPI_OP_TEST( ^, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == (uint32_t)(in_uint32[i] * inout_uint32_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == (in_uint32[i] & inout_uint32_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); } - if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint32, inout_uint32, count, MPI_UINT32_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint32[i] == (in_uint32[i] ^ inout_uint32_for_check[i])) - continue; - printf("First error at position %d (%u %s %u != %u)\n", - i, in_uint32[i], op, inout_uint32_for_check[i], inout_uint32[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); + } + if( 0 == strcmp(op, "min") ) { //intentionly reversed in and out + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_UINT32_T, uint32_t, + in_uint32, inout_uint32, inout_uint32_for_check, + count, PRIu32); } } if( 64 == type_size ) { - int64_t *in_uint64 = (int64_t*)in_buf, - *inout_uint64 = (int64_t*)inout_buf, - *inout_uint64_for_check = (int64_t*)inout_check_buf; + uint64_t *in_uint64 = (uint64_t*)in_buf, + *inout_uint64 = (uint64_t*)inout_buf, + *inout_uint64_for_check = (uint64_t*)inout_check_buf; for( i = 0; i < count; i++ ) { in_uint64[i] = 5; inout_uint64[i] = inout_uint64_for_check[i] = 32433; @@ -1132,124 +588,39 @@ int main(int argc, char **argv) mpi_type = "MPI_UINT64_T"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( correctness = 1, i = 0; i < count; i++ ) { - if(inout_uint64[i] == (int64_t)(in_uint64[i] + inout_uint64_for_check[i])) - continue; - printf("First error at position %d (%llu %s %llu != %llu)\n", - i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == max(inout_uint64_for_check[i], in_uint64[i])) - continue; - printf("First error at position %d (%llu != %s(%llu))\n", - i, inout_uint64[i], op, inout_uint64_for_check[i]); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == min(inout_uint64_for_check[i], in_uint64[i])) - continue; - printf("First error at position %d (%llu != %s(%llu, %llu))\n", - i, inout_uint64[i], op, inout_uint64_for_check[i], in_uint64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); } if( 0 == strcmp(op, "bor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == (in_uint64[i] | inout_uint64_for_check[i])) - continue; - printf("First error at position %d (%llu %s %llu != %llu)\n", - i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( |, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); } if( 0 == strcmp(op, "bxor") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == (in_uint64[i] ^ inout_uint64_for_check[i])) - continue; - printf("First error at position %d (%llu %s %llu != %llu)\n", - i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( ^, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); } if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64,inout_uint64,count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == (int64_t)(in_uint64[i] * inout_uint64_for_check[i])) - continue; - printf("First error at position %d (%llu %s %llu != %llu)\n", - i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( *, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); } if( 0 == strcmp(op, "band") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_uint64, inout_uint64, count, MPI_UINT64_T, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_uint64[i] == (in_uint64[i] & inout_uint64_for_check[i]) ) - continue; - printf("First error at position %d (%llu %s %llu != %llu)\n", - i, in_uint64[i], op, inout_uint64_for_check[i], inout_uint64[i]); - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( &, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); + } + if( 0 == strcmp(op, "max") ) { + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); + } + if( 0 == strcmp(op, "min") ) { + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_UINT64_T, uint64_t, + in_uint64, inout_uint64, inout_uint64_for_check, + count, PRIu64); } } } @@ -1265,68 +636,24 @@ int main(int argc, char **argv) mpi_type = "MPI_FLOAT"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_float[i] == inout_float_for_check[i]+in_float[i]) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_FLOAT, float, + in_float, inout_float, inout_float_for_check, + count, "f"); + } + if( 0 == strcmp(op, "prod") ) { + MPI_OP_TEST( *, mpi_op, MPI_FLOAT, float, + in_float, inout_float, inout_float_for_check, + count, "f"); } if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_float[i] == max(inout_float_for_check[i], in_float[i])) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_FLOAT, float, + in_float, inout_float, inout_float_for_check, + count, "f"); } if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_float,in_float,count, MPI_FLOAT, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_float[i] == min(inout_float_for_check[i], in_float[i])) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_float, inout_float, count, MPI_FLOAT, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_float[i] == in_float[i] * inout_float_for_check[i]) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_FLOAT, float, + in_float, inout_float, inout_float_for_check, + count, "f"); } } @@ -1341,68 +668,24 @@ int main(int argc, char **argv) mpi_type = "MPI_DOUBLE"; if( 0 == strcmp(op, "sum") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_double[i] == inout_double_for_check[i]+in_double[i]) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_TEST( +, mpi_op, MPI_DOUBLE, double, + in_double, inout_double, inout_double_for_check, + count, "g"); + } + if( 0 == strcmp(op, "prod") ) { + MPI_OP_TEST( *, mpi_op, MPI_DOUBLE, double, + in_double, inout_double, inout_double_for_check, + count, "f"); } if( 0 == strcmp(op, "max") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_double[i] == max(inout_double_for_check[i], in_double[i])) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_MINMAX_TEST(max, mpi_op, MPI_DOUBLE, double, + in_double, inout_double, inout_double_for_check, + count, "f"); } if( 0 == strcmp(op, "min") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(inout_double, in_double, count, MPI_DOUBLE, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_double[i] == min(inout_double_for_check[i], in_double[i])) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; - } - if( 0 == strcmp(op, "prod") ) { - skip_op_type = 0; - tstart = MPI_Wtime(); - MPI_Reduce_local(in_double, inout_double, count, MPI_DOUBLE, mpi_op); - tend = MPI_Wtime(); - if( check ) { - for( i = 0; i < count; i++ ) { - if(inout_double[i] == inout_double_for_check[i]*in_double[i]) - continue; - printf("First error at position %d\n", i); - correctness = 0; - break; - } - } - goto check_and_continue; + MPI_OP_MINMAX_TEST(min, mpi_op, MPI_DOUBLE, double, + in_double, inout_double, inout_double_for_check, + count, "f"); } } check_and_continue: